mosh-1.4.0/0000775000175000017500000000000014327736673007507 500000000000000mosh-1.4.0/ChangeLog0000644000175000017500000004016513145365374011176 000000000000002017-07-21 Keith Winstein * Version 1.3.2 released. * Platform support: * Explicitly enable binding to both IPv4 and IPv6 addresses. (Giel van Schijndel) * Restore perl 5.8.8 support for RHEL5. (Alexander Chernyakhovsky) * Make tests detect UTF-8 locale with a helper executable. (John Hood) * Don't print /etc/motd on IllumOS. (John Hood) * Print {,/var}/run/motd.dynamic on Ubuntu. (John Hood) * Fix build on Haiku. (Adrien Destugues) * Disable unicode-later-combining.test for tmux 2.4. This fixes build failures. (John Hood) * Bug fixes: * In tests, explicitly set 80x24 tmux window, for newer versions of tmux. (John Hood) * Work around JuiceSSH rendering bug. (John Hood) * Do not move cursor for SCROLL UP and SCROLL DOWN-- fixes an issue with tmux 2.4. (John Hood) 2017-03-25 Keith Winstein * Version 1.3.0 released. * New features: * Change website URLs from http://mosh.mit.edu to https://mosh.org. (Keith Winstein) * Add --no-ssh-pty option for Dropbear compatibility and other issues. * Switch to semantic versioning, making this version 1.3.0 instead of 1.2.7. * Platform support: * Added nonce-incrementing test. (Keith Winstein) * Add build-source-package.sh for Debian. (Keith Winstein) * Fix CPPFLAGS handling possibly causing curses detection failure. (John Hood) * Add an Appveyor/Cygwin CI build. * Improve warning-flags detection for 'make distcheck'. (John Hood) * Improve robustness of regression tests. (John Hood) * Support OpenBSD pledge() sandboxing. (John Hood) * Use backward-compatible name for AES in AppleCommonCrypto, fixing builds with older OS X SDKs. (John Hood) * Detect clock_gettime() and CLOCK_MONOTONIC carefully, fixing OS X 10.12 + Xcode 7.3 builds. (John Hood) * Support older versions of Perl, back to 5.10, fixing RHEL 5 builds. (Anders Kaseorg) * Add a Travis OS X CI and release build. (John Hood) * Add --help and --version, enabling Automake's 'std-options' checks. (Anders Kaseorg) * Add a simple smoke test not requiring tmux, to help validate builds on older platforms including RHEL 5. (Anders Kaseorg) * Check for presence of clock_gettime() for OS X, where the symbol may not be resolved on older OS X versions. (John Hood) * Fix a memory alignment issue in OCB with ARM/Neon. (Carlos Cabanero) * Mosh now runs correctly on Bash for Windows with Windows 10 Insider builds 15002 and higher. (No change in Mosh) * Other minor platform compatibility fixes for Mosh sources and tests. (John Hood) * Bug fixes: * Work around a pty buffering issue causing failed connections on FreeBSD 11, or with Dropbear. (John Hood) * Restore '-p 0' option for OS-selected UDP port bindings. (John Hood) * Shell hygiene fixes, including better quoting of pathnames. (Anders Kaseorg) * Fix typos in project docs. (Jakub Wilk) * Fix excess newlines on mosh client startup/shutdown. (John Hood) * Exit gracefully, closing session, on pty write or ioctl failure. (John Hood) * Fix two bugs that caused mosh-server to consume excessive CPU in certain circumstances. (John Hood) * Fix bug that caused text copied from mosh-client to paste as long lines joined by spaces. (John Hood) * Documentation improvements. (chenxiaoqino, Ashish Gupta) * Use getuid(), not geteuid(), for correct getpw* lookups. (John Hood) 2016-08-10 Keith Winstein * Version 1.2.6 released. * New features: * Add Travis CI builds for Linux and Mac. (Anders Kaseorg, others) * Add a --local option to run without ssh. (John Hood) * Mosh now returns exitstatus reflecting connection success. (John Hood) * Add an end-to-end test suite and many tests. (John Hood) * Implement timeouts and signals to help address orphaned sessions. (John Hood) * Major rework of Mosh's display differencing/rendering code with much improved performance for slow machines. (John Hood) * Implement ANSI back/forward tab (CSI CBT, CSI CHT). (John Hood) * Do not start user shell until network session starts. (John Hood) * Add options for more flexible specification of IPv4/IPv6 hostname resolution. (John Hood) * Improved bash completion. (Steve Dignam, HIGUCHI Yuta) * Add options for different methods of resolving the remote host address, allowing operation without SshProxyCommand. (John Hood) * Platform support: * Add configurable support for Apple Common Crypto and Nettle, in place of OpenSSL. Implement base64 locally. (John Hood) * Workaround Cygwin select() bug. (John Hood) * Updates to Debian packaging. (Anders Kaseorg, Keith Winstein) * Workaround a glibc-2.22 issue causing segfaults on Debian Sid. (John Hood with help from many others) * Prefer c++ to g++, for systems like FreeBSD where g++ is not usable. (John Hood) * Fixes for Illumos Hipster 20151003. (John Hood) * Disable -Werror for protobuf code, to resolve a new gcc6 warning. (John Hood) * Link test for -fstack-protector-all on an embedded platform. (Baruch Siach) * Resolve issue with bswap64() on FreeBSD-CURRENT with libc++-3.8.0. (John Hood) * Fix issue with RECVTOS error message on client on FreeBSD. (John Hood) * Bug fixes: * Remove an assertion causing aborts on Unicode fallback found by fuzzing with afl. (Keith Winstein) * Fix a server hang with XON/XOFF on BSD systems. (John Hood) * Fix a typeahead-prediction bug that caused display corruption on urxvt. (John Hood) 2015-07-12 Keith Winstein * Version 1.2.5 released. * New features: * Bind to a specific IP address with --bind-server. (Philipp Haselwarter) * MOSH_ESCAPE_KEY configures escape character. (Timo J. Rinne) * Support non-roaming IPv6. (Anders Kaseorg) * Implement XTerm mouse mode. (Barosl LEE, Andrew Chin, Louis Kruger) * Report Git revision along with version if available. (John Hood) * Platform support: * Add pselect() emulation. (Jérémie Courrèges-Anglas) * OpenBSD, OS X: Fix be64toh-related issues. (Jérémie Courrèges-Anglas) * ARM Neon: fix gcc4.8 compiling problem(Pasi Sjöholm) * NaCl: Conditionally rename main to mosh_main. (Richard Woodbury) * FreeBSD: Token pasting, forkpty(), ARM fixes. (John Hood) * AIX: Implement CTTY grabbing when TIOCSCTTY is missing (Anton Lundin) * OS X: Broaden build support to cover OS X 10.5 through 10.10. (John Hood) * Debian: Improve bash-completion install and functionality. (Suggested by Gabriel Filion, John Hood) * Bug fixes: * Automake/autoconf workarounds. (Anders Kaseorg) * mosh-server: Allow startup without PTY. (Keith Winstein) * network.cc: Properly close old fd on Socket assignment operator. (Thanks to Igor Bukanov) * mosh-server: Allow startup with zero-window-size PTY. (Igor Bukanov) * AddrInfo: Fix error message generation when node == NULL (Anders Kaseorg) * Timestamp: Prevent integer overflow on Darwin PPC 32-bit (Anders Kaseorg) * scripts/mosh: Fix hang when remote closes the connection (Anders Kaseorg) * Fix issues with parsing of 256-color SGR sequences. (John Hood) * Numerous code hygiene, Coverity, and Clang static analyzer fixes. (Anders Kaseorg, Geoffrey Thomas, John Hood) 2013-03-27 Keith Winstein * Version 1.2.4 released. * New features: * Support port ranges with -p LOWPORT:HIGHPORT (Luke Mewburn) * Ctrl-^ Ctrl-Z suspends mosh client (Nikolai Zeldovich) * mm:ss display of lost-contact times (Kevin Ballard) * Show infobar with control chars when Ctrl-^ is typed * Put terminal in altscreen mode (Anders Kaseorg) * Tell automake/Debian pkg about our checks (Anders Kaseorg) * Platform support: * OS X: Script to build a universal package (Peter Iannucci) * FreeBSD: Fix build problems (Jimmy Olgeni) * AIX: port by Anton Lundin * Solaris with system curses (Anton Lundin) * Cygwin and others: eliminate use of IO::Pty (Anton Lundin) * Bug fixes: * Fix bug (introduced in 1.2.3) where server stays around if process quits while client is detached * Clean up spurious entries from detached sessions warning * Fix freeze when connectivity is one-directional for hours (reported by Axel Beckert) * Don't wipe title until a new one is set (sqweek) * Eliminate memory leaks and cppcheck warnings (Anders Kaseorg) 2012-10-19 Keith Winstein * Version 1.2.3 released. * Security improvements: * Use OpenSSL AES implementation * Update AES-OCB implementation (Keegan McAllister) * Don't let bad server dictate IP (Felix Groebert) * New features: * Client hops ports to survive challenging client-side firewall * Server stops sending to save client power (Daniel Drown) * Set DiffServ code point and ECN-capable (Dave Täht) * Slow down if explicit congestion notification received * Warn about unattached Mosh sessions on login * Compatible with KDE konsole (uses BEL to terminate OSC) * Improved heuristic about color of predicted characters * Bug fixes: * Improved performance on systems with expensive time * No longer choke on "ffff::" address for hosts with IPv6 * More conservative MTU and datagram sizing * Platform support: * Build on Solaris and IllumOS (Timo Sirainen, Ira Cooper) * Build on ARM with gcc 4.7 (Alexander Chernyakhovsky) * Licensing changes: * Allow distribution on Apple App Stores * Allow linking with OpenSSL 2012-06-12 Keith Winstein * Version 1.2.2 released. * Remove warning on out-of-order/duplicated datagrams * Add "experimental" prediction mode 2012-05-25 Keith Winstein * Version 1.2.1 released. * Improve performance on lossy links. * New diagnostic message when link is dead in only one direction. * Use less CPU when link is down. (Keegan McAllister) * Use much less CPU when application or mosh-server sends large repeat counts (resolves CVE-2012-2385, reported by Timo Juhani Lindfors). * Use less memory when mosh-server is malicious. * Fix vttest regression re: wrapping and tabs. * Enable roundtrip verifier of terminal emulator correctness when verbose. * Remove skalibs as a dependency. (Keegan McAllister) * Remove use of poll() and OS X poll workaround. (Keegan McAllister) * Include bash_completion file. (ejeffrey) * Include UFW firewall profile. (Fumihito YOSHIDA) * Warning on out-of-order/duplicated datagrams (or failed nonce increment). * Clearer error message on invalid port number. * Cleanups to quit scenario when firewalled. 2012-04-26 Keith Winstein * Version 1.2 released. * Remove Boost as a dependency (Keegan McAllister) * Add support for FreeBSD, Cygwin, RHEL/CentOS 5, OS X 10.5 on PPC. * More verbose and helpful diagnostics. Server now has -v flag. * Client now has --ssh= flag to set SSH options (like port) * Remove skalibs as a dependency on Debian/Ubuntu (Keegan McAllister) * Now passes locale-related env vars over the connection * Fix startup script to no longer hang on some Macs (Jay Freeman) * Fix terminal emulation and argument parsing on FreeBSD * Fix alignment problems on ARM * Now prints message of the day * Use binary hardening flags where available (Keegan McAllister) * Responsiveness and CPU-usage improvements * Several terminal-emulation improvements and bug fixes 2012-04-03 Keith Winstein * Version 1.1.3 released. * Builds on armel, armhf, and kFreeBSD. * Fixes bug causing occasional missing/extra wraparound copy-and-paste. * Eliminates valgrind complaint over unused winsize fields. * Close connection after four petabytes (per OCB recommendation). 2012-03-28 Keith Winstein * Version 1.1.2 released. * Fixes to build on OS X 10.5 with older gcc and -lpoll (Quentin Smith) * Add --with-utempter and --without-utempter per gentoo request (Michael Weber) * configure now requires ncurses headers (and others) to be installed * Consolidate locale routines to help Android port (Keegan McAllister) 2012-03-27 Keith Winstein * Version 1.1.1 released. * Fix spec file and build failure on Fedora. * Print out error message properly on fatal_assert(). * Support for machines without posix_memalign(). 2012-03-22 Keith Winstein * Version 1.1 released (stable release). * Allows user to specify remote command to execute. * Only advertises 256 colors when user's terminal has 256 colors. * Add chaff to datagrams to frustrate statistical analysis of length * Cosmetic fixes to terminal handling * Improved startup script (Anders Kaseorg) 2012-03-16 Keith Winstein * Version 1.0.2 released. * Uses xterm-256color and supports 256-color escape sequences. * Posterizes to 8 colors unless the user has a 256-color terminal. * Handles terminals without BCE. * Starts login shell. 2012-03-14 Keith Winstein * Version 1.0.1 released. * Roughly 40% less CPU usage. 2012-03-12 Keith Winstein * Version 1.0 released. * mosh now supports --version option and prints no-warranty message. 2012-03-10 Keith Winstein * Version 0.98 released. * Add option to select server-side UDP port. * Restrict default UDP port range to 60000..61000. * Use TERM / terminfo to decide when to send ECH sequence. * Now works properly inside tmux. 2012-03-07 Keith Winstein * Version 0.97 released. * Merged Mac OS X port (thanks to Quentin Smith and Anders Kaseorg) * Server will quit if no connection within first 60 seconds * Startup script no longer requires threaded Perl * Add --enable-compile-warnings=error to ./configure * Fix some flicker issues with adaptive prediction mode 2012-02-26 Keith Winstein * Version 0.96 released. * Compress all instructions with zlib 2012-02-25 Keith Winstein * Version 0.95 released. * Make echo acknowledgment reliable to reduce spurious mispredict detections. * Require two dropped heartbeats before showing blue bar of lost contact * Print newline before MOSH CONNECT string to make more robust if intermediate keys hit * Disable ControlMaster in initial SSH connection so proxy is always used * Make retransmissions occur at frame rate (vs. every 3 seconds) for limited time after loss 2012-02-15 Keith Winstein * Version 0.94 released. * Make man pages * Replace C++11 features (lambda and auto) with boost equivalents (Anders Kaseorg) * Now builds with g++ or clang (with libstdc++) 2012-02-13 Keith Winstein * Version 0.93 released. * Make utmp entries 2012-02-13 Keith Winstein * Version 0.92 released. * Allows user to select prediction mode (always/never/adaptive) * Fix bug in server startup on slow hosts * Better prediction when deleting at line ending 2012-02-09 Keith Winstein * Version 0.91 released. * Startup script support SSH options and aliases (Anders Kaseorg) * End use of Path MTU discovery and allow IP fragmentation because, e.g., Cisco VPN has MTU of 1200 and does not pass ICMP too-big. * Better exception and error handling. * Restrict predictive local echo display to long-delay links (>60 ms RTT) or for temporarily after a "glitch." Otherwise simply show server echos, while maintaining prediction overlay in the background in case it is needed. 2012-02-07 Keith Winstein * Version 0.9b released. * Improvements to build system (Anders Kaseorg) 2012-02-06 Keith Winstein * Version 0.9 released. mosh-1.4.0/Makefile.in0000664000175000017500000011106314327736657011500 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 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@ # aminclude_static.am generated automatically by Autoconf # from AX_AM_MACROS_STATIC on Mon Oct 31 05:21:03 PDT 2022 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)) 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 = : subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ $(top_srcdir)/m4/ax_ac_print_to_file.m4 \ $(top_srcdir)/m4/ax_add_am_macro_static.m4 \ $(top_srcdir)/m4/ax_am_macros_static.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_gnu_make.m4 \ $(top_srcdir)/m4/ax_check_library.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_code_coverage.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ $(top_srcdir)/m4/ax_file_escapes.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 $(top_srcdir)/m4/pkg.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 = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/include/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 = 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) # 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 \ $(top_srcdir)/aminclude_static.am AUTHORS COPYING ChangeLog \ NEWS README.md THANKS ar-lib compile install-sh missing 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 -200 -exec chmod u+w {} ';' \ && 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 = --best 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 -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@ CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@ CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@ CPPFLAGS = @CPPFLAGS@ CRYPTO_CFLAGS = @CRYPTO_CFLAGS@ CRYPTO_LIBS = @CRYPTO_LIBS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CURSES_LIB = @CURSES_LIB@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FUZZING_CFLAGS = @FUZZING_CFLAGS@ GCOV = @GCOV@ GENHTML = @GENHTML@ HARDEN_CFLAGS = @HARDEN_CFLAGS@ HARDEN_LDFLAGS = @HARDEN_LDFLAGS@ HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LCOV = @LCOV@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MISC_CXXFLAGS = @MISC_CXXFLAGS@ MKDIR_P = @MKDIR_P@ Nettle_CFLAGS = @Nettle_CFLAGS@ Nettle_LIBS = @Nettle_LIBS@ OBJEXT = @OBJEXT@ OpenSSL_CFLAGS = @OpenSSL_CFLAGS@ OpenSSL_LIBS = @OpenSSL_LIBS@ 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@ PICKY_CXXFLAGS = @PICKY_CXXFLAGS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROTOC = @PROTOC@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TINFO_CFLAGS = @TINFO_CFLAGS@ TINFO_CPPFLAGS = @TINFO_CPPFLAGS@ TINFO_LDFLAGS = @TINFO_LDFLAGS@ TINFO_LIBS = @TINFO_LIBS@ VERSION = @VERSION@ WARNING_CXXFLAGS = @WARNING_CXXFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ completions = @completions@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ ifGNUmake = @ifGNUmake@ ifnGNUmake = @ifnGNUmake@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ protobuf_CFLAGS = @protobuf_CFLAGS@ protobuf_LIBS = @protobuf_LIBS@ 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@ # Work around inconsistency in AX_CODE_COVERAGE defining # AM_DISTCHECK_CONFIGURE_FLAGS only in some branches @CODE_COVERAGE_ENABLED_FALSE@AM_DISTCHECK_CONFIGURE_FLAGS = --enable-compile-warnings=distcheck \ @CODE_COVERAGE_ENABLED_FALSE@ --enable-examples --enable-syslog @CODE_COVERAGE_ENABLED_TRUE@AM_DISTCHECK_CONFIGURE_FLAGS := \ @CODE_COVERAGE_ENABLED_TRUE@ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ @CODE_COVERAGE_ENABLED_TRUE@ --disable-code-coverage \ @CODE_COVERAGE_ENABLED_TRUE@ --enable-compile-warnings=distcheck \ @CODE_COVERAGE_ENABLED_TRUE@ --enable-examples --enable-syslog @CODE_COVERAGE_ENABLED_TRUE@GITIGNOREFILES := $(GITIGNOREFILES) $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY) @CODE_COVERAGE_ENABLED_TRUE@code_coverage_v_lcov_cap = $(code_coverage_v_lcov_cap_$(V)) @CODE_COVERAGE_ENABLED_TRUE@code_coverage_v_lcov_cap_ = $(code_coverage_v_lcov_cap_$(AM_DEFAULT_VERBOSITY)) @CODE_COVERAGE_ENABLED_TRUE@code_coverage_v_lcov_cap_0 = @echo " LCOV --capture" $(CODE_COVERAGE_OUTPUT_FILE); @CODE_COVERAGE_ENABLED_TRUE@code_coverage_v_lcov_ign = $(code_coverage_v_lcov_ign_$(V)) @CODE_COVERAGE_ENABLED_TRUE@code_coverage_v_lcov_ign_ = $(code_coverage_v_lcov_ign_$(AM_DEFAULT_VERBOSITY)) @CODE_COVERAGE_ENABLED_TRUE@code_coverage_v_lcov_ign_0 = @echo " LCOV --remove /tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN); @CODE_COVERAGE_ENABLED_TRUE@code_coverage_v_genhtml = $(code_coverage_v_genhtml_$(V)) @CODE_COVERAGE_ENABLED_TRUE@code_coverage_v_genhtml_ = $(code_coverage_v_genhtml_$(AM_DEFAULT_VERBOSITY)) @CODE_COVERAGE_ENABLED_TRUE@code_coverage_v_genhtml_0 = @echo " GEN " "$(CODE_COVERAGE_OUTPUT_DIRECTORY)"; @CODE_COVERAGE_ENABLED_TRUE@code_coverage_quiet = $(code_coverage_quiet_$(V)) @CODE_COVERAGE_ENABLED_TRUE@code_coverage_quiet_ = $(code_coverage_quiet_$(AM_DEFAULT_VERBOSITY)) @CODE_COVERAGE_ENABLED_TRUE@code_coverage_quiet_0 = --quiet # sanitizes the test-name: replaces with underscores: dashes and dots @CODE_COVERAGE_ENABLED_TRUE@code_coverage_sanitize = $(subst -,_,$(subst .,_,$(1))) ACLOCAL_AMFLAGS = -I m4 SUBDIRS = scripts src man conf EXTRA_DIST = autogen.sh ocb-license.html README.md COPYING.iOS BUILT_SOURCES = VERSION # AX_CODE_COVERAGE configuration # Remove everything outside of this repository CODE_COVERAGE_IGNORE_PATTERN = "/usr/include/*" "/usr/lib/*" "*/src/tests/*" "*/src/protobufs/*" # Ensure coverage is relative to the top of the repository CODE_COVERAGE_DIRECTORY = $(abs_top_builddir) # non-Automake defines CPPCHECK_FLAGS = --enable=all --template=gcc --force # -j8 disables unused function checking. CLANG_SCAN_BUILD = scan-build BEAR = bear OCLINT_JCD = oclint-json-compilation-database OCLINT_OPTIONS = -enable-global-analysis -max-priority-2=1000 -max-priority-3=1000 \ -rc LONG_LINE=160 \ -rc LONG_VARIABLE_NAME=40 \ -rc SHORT_VARIABLE_NAME=1 \ -rc MINIMUM_CASES_IN_SWITCH=2 all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am--refresh: Makefile @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/aminclude_static.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_srcdir)/aminclude_static.am $(am__empty): $(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): # 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) test -d "$(distdir)" || mkdir "$(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 $(GZIP_ENV) -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 $(GZIP_ENV) -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: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-recursive install-exec: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) 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: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || 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." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-recursive clean-am: clean-generic clean-local mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive 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 check install install-am \ install-exec install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--refresh check check-am clean clean-cscope clean-generic \ clean-local 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-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 # Code coverage # # Optional: # - CODE_COVERAGE_DIRECTORY: Top-level directory for code coverage reporting. # Multiple directories may be specified, separated by whitespace. # (Default: $(top_builddir)) # - CODE_COVERAGE_OUTPUT_FILE: Filename and path for the .info file generated # by lcov for code coverage. (Default: # $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info) # - CODE_COVERAGE_OUTPUT_DIRECTORY: Directory for generated code coverage # reports to be created. (Default: # $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage) # - CODE_COVERAGE_BRANCH_COVERAGE: Set to 1 to enforce branch coverage, # set to 0 to disable it and leave empty to stay with the default. # (Default: empty) # - CODE_COVERAGE_LCOV_SHOPTS_DEFAULT: Extra options shared between both lcov # instances. (Default: based on ) # - CODE_COVERAGE_LCOV_SHOPTS: Extra options to shared between both lcov # instances. (Default: ) # - CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH: --gcov-tool pathtogcov # - CODE_COVERAGE_LCOV_OPTIONS_DEFAULT: Extra options to pass to the # collecting lcov instance. (Default: ) # - CODE_COVERAGE_LCOV_OPTIONS: Extra options to pass to the collecting lcov # instance. (Default: ) # - CODE_COVERAGE_LCOV_RMOPTS_DEFAULT: Extra options to pass to the filtering # lcov instance. (Default: empty) # - CODE_COVERAGE_LCOV_RMOPTS: Extra options to pass to the filtering lcov # instance. (Default: ) # - CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT: Extra options to pass to the # genhtml instance. (Default: based on ) # - CODE_COVERAGE_GENHTML_OPTIONS: Extra options to pass to the genhtml # instance. (Default: ) # - CODE_COVERAGE_IGNORE_PATTERN: Extra glob pattern of files to ignore # # The generated report will be titled using the $(PACKAGE_NAME) and # $(PACKAGE_VERSION). In order to add the current git hash to the title, # use the git-version-gen script, available online. # Optional variables # run only on top dir @CODE_COVERAGE_ENABLED_TRUE@ ifeq ($(abs_builddir), $(abs_top_builddir)) @CODE_COVERAGE_ENABLED_TRUE@CODE_COVERAGE_DIRECTORY ?= $(top_builddir) @CODE_COVERAGE_ENABLED_TRUE@CODE_COVERAGE_OUTPUT_FILE ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info @CODE_COVERAGE_ENABLED_TRUE@CODE_COVERAGE_OUTPUT_DIRECTORY ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage @CODE_COVERAGE_ENABLED_TRUE@CODE_COVERAGE_BRANCH_COVERAGE ?= @CODE_COVERAGE_ENABLED_TRUE@CODE_COVERAGE_LCOV_SHOPTS_DEFAULT ?= $(if $(CODE_COVERAGE_BRANCH_COVERAGE),--rc lcov_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE)) @CODE_COVERAGE_ENABLED_TRUE@CODE_COVERAGE_LCOV_SHOPTS ?= $(CODE_COVERAGE_LCOV_SHOPTS_DEFAULT) @CODE_COVERAGE_ENABLED_TRUE@CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH ?= --gcov-tool "$(GCOV)" @CODE_COVERAGE_ENABLED_TRUE@CODE_COVERAGE_LCOV_OPTIONS_DEFAULT ?= $(CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH) @CODE_COVERAGE_ENABLED_TRUE@CODE_COVERAGE_LCOV_OPTIONS ?= $(CODE_COVERAGE_LCOV_OPTIONS_DEFAULT) @CODE_COVERAGE_ENABLED_TRUE@CODE_COVERAGE_LCOV_RMOPTS_DEFAULT ?= @CODE_COVERAGE_ENABLED_TRUE@CODE_COVERAGE_LCOV_RMOPTS ?= $(CODE_COVERAGE_LCOV_RMOPTS_DEFAULT) @CODE_COVERAGE_ENABLED_TRUE@CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT ?=$(if $(CODE_COVERAGE_BRANCH_COVERAGE),--rc genhtml_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE)) @CODE_COVERAGE_ENABLED_TRUE@CODE_COVERAGE_GENHTML_OPTIONS ?= $(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT) @CODE_COVERAGE_ENABLED_TRUE@CODE_COVERAGE_IGNORE_PATTERN ?= # Use recursive makes in order to ignore errors during check @CODE_COVERAGE_ENABLED_TRUE@check-code-coverage: @CODE_COVERAGE_ENABLED_TRUE@ -$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -k check @CODE_COVERAGE_ENABLED_TRUE@ $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture # Capture code coverage data @CODE_COVERAGE_ENABLED_TRUE@code-coverage-capture: code-coverage-capture-hook @CODE_COVERAGE_ENABLED_TRUE@ $(code_coverage_v_lcov_cap)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(call code_coverage_sanitize,$(PACKAGE_NAME)-$(PACKAGE_VERSION))" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_OPTIONS) @CODE_COVERAGE_ENABLED_TRUE@ $(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS) @CODE_COVERAGE_ENABLED_TRUE@ -@rm -f "$(CODE_COVERAGE_OUTPUT_FILE).tmp" @CODE_COVERAGE_ENABLED_TRUE@ $(code_coverage_v_genhtml)LANG=C $(GENHTML) $(code_coverage_quiet) $(addprefix --prefix ,$(CODE_COVERAGE_DIRECTORY)) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS) @CODE_COVERAGE_ENABLED_TRUE@ @echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html" @CODE_COVERAGE_ENABLED_TRUE@code-coverage-clean: @CODE_COVERAGE_ENABLED_TRUE@ -$(LCOV) --directory $(top_builddir) -z @CODE_COVERAGE_ENABLED_TRUE@ -rm -rf "$(CODE_COVERAGE_OUTPUT_FILE)" "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" @CODE_COVERAGE_ENABLED_TRUE@ -find . \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete @CODE_COVERAGE_ENABLED_TRUE@code-coverage-dist-clean: @CODE_COVERAGE_ENABLED_TRUE@ else # ifneq ($(abs_builddir), $(abs_top_builddir)) @CODE_COVERAGE_ENABLED_TRUE@check-code-coverage: @CODE_COVERAGE_ENABLED_TRUE@code-coverage-capture: code-coverage-capture-hook @CODE_COVERAGE_ENABLED_TRUE@code-coverage-clean: @CODE_COVERAGE_ENABLED_TRUE@code-coverage-dist-clean: @CODE_COVERAGE_ENABLED_TRUE@ endif # ifeq ($(abs_builddir), $(abs_top_builddir)) # Use recursive makes in order to ignore errors during check @CODE_COVERAGE_ENABLED_FALSE@check-code-coverage: @CODE_COVERAGE_ENABLED_FALSE@ @echo "Need to reconfigure with --enable-code-coverage" # Capture code coverage data @CODE_COVERAGE_ENABLED_FALSE@code-coverage-capture: code-coverage-capture-hook @CODE_COVERAGE_ENABLED_FALSE@ @echo "Need to reconfigure with --enable-code-coverage" @CODE_COVERAGE_ENABLED_FALSE@code-coverage-clean: @CODE_COVERAGE_ENABLED_FALSE@code-coverage-dist-clean: # Hook rule executed before code-coverage-capture, overridable by the user code-coverage-capture-hook: .PHONY: check-code-coverage code-coverage-capture code-coverage-dist-clean code-coverage-clean code-coverage-capture-hook .PHONY: VERSION VERSION: @echo @PACKAGE_STRING@ > VERSION.dist @set -e; if git describe --dirty --always > VERSION.git 2>&1 && \ [ -z `git rev-parse --show-prefix` ]; then \ if ! diff -q VERSION.git VERSION > /dev/null 2>&1; then \ mv -f VERSION.git VERSION; \ fi; \ elif ! diff -q VERSION.dist VERSION > /dev/null 2>&1; then \ mv -f VERSION.dist VERSION; \ fi @rm -f VERSION.dist VERSION.git clean-local: @rm -rf VERSION cov-int mosh-coverity.txz compile_commands.json # Linters and static checkers, for development only. Not included in # build dependencies, and outside of Automake processing. cppcheck: cppcheck $(CPPCHECK_FLAGS) -include src/include/config.h -I src/include \ -I src/crypto -I src/frontend -I src/network -I src/protobufs \ -I src/statesync -I src/terminal -I src/util \ -I /usr/include -I /usr/include/google/protobuf -I/usr/include/openssl \ src # Coverity. cov-build: $(MAKE) clean rm -rf cov-int cov-build --dir cov-int $(MAKE) check TESTS= tar -caf mosh-coverity.txz cov-int # These two rules are for Bear + OCLint. # Don't *run* the tests, prediction-unicode.test generates arguments # with illegal UTF-8 that make Bear unhappy. compile_commands.json: $(MAKE) clean bear $(MAKE) check TESTS= oclint: compile_commands.json $(OCLINT_JCD) -e src/protobufs -- $(OCLINT_OPTIONS) # Clang's scan-build static checker. scan-build: $(MAKE) clean $(CLANG_SCAN_BUILD) $(MAKE) check TESTS= # 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: mosh-1.4.0/aminclude_static.am0000664000175000017500000001513414327736657013264 00000000000000 # aminclude_static.am generated automatically by Autoconf # from AX_AM_MACROS_STATIC on Mon Oct 31 05:21:03 PDT 2022 # Code coverage # # Optional: # - CODE_COVERAGE_DIRECTORY: Top-level directory for code coverage reporting. # Multiple directories may be specified, separated by whitespace. # (Default: $(top_builddir)) # - CODE_COVERAGE_OUTPUT_FILE: Filename and path for the .info file generated # by lcov for code coverage. (Default: # $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info) # - CODE_COVERAGE_OUTPUT_DIRECTORY: Directory for generated code coverage # reports to be created. (Default: # $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage) # - CODE_COVERAGE_BRANCH_COVERAGE: Set to 1 to enforce branch coverage, # set to 0 to disable it and leave empty to stay with the default. # (Default: empty) # - CODE_COVERAGE_LCOV_SHOPTS_DEFAULT: Extra options shared between both lcov # instances. (Default: based on ) # - CODE_COVERAGE_LCOV_SHOPTS: Extra options to shared between both lcov # instances. (Default: ) # - CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH: --gcov-tool pathtogcov # - CODE_COVERAGE_LCOV_OPTIONS_DEFAULT: Extra options to pass to the # collecting lcov instance. (Default: ) # - CODE_COVERAGE_LCOV_OPTIONS: Extra options to pass to the collecting lcov # instance. (Default: ) # - CODE_COVERAGE_LCOV_RMOPTS_DEFAULT: Extra options to pass to the filtering # lcov instance. (Default: empty) # - CODE_COVERAGE_LCOV_RMOPTS: Extra options to pass to the filtering lcov # instance. (Default: ) # - CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT: Extra options to pass to the # genhtml instance. (Default: based on ) # - CODE_COVERAGE_GENHTML_OPTIONS: Extra options to pass to the genhtml # instance. (Default: ) # - CODE_COVERAGE_IGNORE_PATTERN: Extra glob pattern of files to ignore # # The generated report will be titled using the $(PACKAGE_NAME) and # $(PACKAGE_VERSION). In order to add the current git hash to the title, # use the git-version-gen script, available online. # Optional variables # run only on top dir if CODE_COVERAGE_ENABLED ifeq ($(abs_builddir), $(abs_top_builddir)) CODE_COVERAGE_DIRECTORY ?= $(top_builddir) CODE_COVERAGE_OUTPUT_FILE ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info CODE_COVERAGE_OUTPUT_DIRECTORY ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage CODE_COVERAGE_BRANCH_COVERAGE ?= CODE_COVERAGE_LCOV_SHOPTS_DEFAULT ?= $(if $(CODE_COVERAGE_BRANCH_COVERAGE),--rc lcov_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE)) CODE_COVERAGE_LCOV_SHOPTS ?= $(CODE_COVERAGE_LCOV_SHOPTS_DEFAULT) CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH ?= --gcov-tool "$(GCOV)" CODE_COVERAGE_LCOV_OPTIONS_DEFAULT ?= $(CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH) CODE_COVERAGE_LCOV_OPTIONS ?= $(CODE_COVERAGE_LCOV_OPTIONS_DEFAULT) CODE_COVERAGE_LCOV_RMOPTS_DEFAULT ?= CODE_COVERAGE_LCOV_RMOPTS ?= $(CODE_COVERAGE_LCOV_RMOPTS_DEFAULT) CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT ?=$(if $(CODE_COVERAGE_BRANCH_COVERAGE),--rc genhtml_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE)) CODE_COVERAGE_GENHTML_OPTIONS ?= $(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT) CODE_COVERAGE_IGNORE_PATTERN ?= GITIGNOREFILES := $(GITIGNOREFILES) $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY) code_coverage_v_lcov_cap = $(code_coverage_v_lcov_cap_$(V)) code_coverage_v_lcov_cap_ = $(code_coverage_v_lcov_cap_$(AM_DEFAULT_VERBOSITY)) code_coverage_v_lcov_cap_0 = @echo " LCOV --capture" $(CODE_COVERAGE_OUTPUT_FILE); code_coverage_v_lcov_ign = $(code_coverage_v_lcov_ign_$(V)) code_coverage_v_lcov_ign_ = $(code_coverage_v_lcov_ign_$(AM_DEFAULT_VERBOSITY)) code_coverage_v_lcov_ign_0 = @echo " LCOV --remove /tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN); code_coverage_v_genhtml = $(code_coverage_v_genhtml_$(V)) code_coverage_v_genhtml_ = $(code_coverage_v_genhtml_$(AM_DEFAULT_VERBOSITY)) code_coverage_v_genhtml_0 = @echo " GEN " "$(CODE_COVERAGE_OUTPUT_DIRECTORY)"; code_coverage_quiet = $(code_coverage_quiet_$(V)) code_coverage_quiet_ = $(code_coverage_quiet_$(AM_DEFAULT_VERBOSITY)) code_coverage_quiet_0 = --quiet # sanitizes the test-name: replaces with underscores: dashes and dots code_coverage_sanitize = $(subst -,_,$(subst .,_,$(1))) # Use recursive makes in order to ignore errors during check check-code-coverage: -$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -k check $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture # Capture code coverage data code-coverage-capture: code-coverage-capture-hook $(code_coverage_v_lcov_cap)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(call code_coverage_sanitize,$(PACKAGE_NAME)-$(PACKAGE_VERSION))" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_OPTIONS) $(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS) -@rm -f "$(CODE_COVERAGE_OUTPUT_FILE).tmp" $(code_coverage_v_genhtml)LANG=C $(GENHTML) $(code_coverage_quiet) $(addprefix --prefix ,$(CODE_COVERAGE_DIRECTORY)) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS) @echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html" code-coverage-clean: -$(LCOV) --directory $(top_builddir) -z -rm -rf "$(CODE_COVERAGE_OUTPUT_FILE)" "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" -find . \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete code-coverage-dist-clean: AM_DISTCHECK_CONFIGURE_FLAGS := $(AM_DISTCHECK_CONFIGURE_FLAGS) --disable-code-coverage else # ifneq ($(abs_builddir), $(abs_top_builddir)) check-code-coverage: code-coverage-capture: code-coverage-capture-hook code-coverage-clean: code-coverage-dist-clean: endif # ifeq ($(abs_builddir), $(abs_top_builddir)) else #! CODE_COVERAGE_ENABLED # Use recursive makes in order to ignore errors during check check-code-coverage: @echo "Need to reconfigure with --enable-code-coverage" # Capture code coverage data code-coverage-capture: code-coverage-capture-hook @echo "Need to reconfigure with --enable-code-coverage" code-coverage-clean: code-coverage-dist-clean: endif #CODE_COVERAGE_ENABLED # Hook rule executed before code-coverage-capture, overridable by the user code-coverage-capture-hook: .PHONY: check-code-coverage code-coverage-capture code-coverage-dist-clean code-coverage-clean code-coverage-capture-hook mosh-1.4.0/ar-lib0000755000175000017500000001336314327736657010531 00000000000000#! /bin/sh # Wrapper for Microsoft lib.exe me=ar-lib scriptversion=2019-07-04.01; # UTC # Copyright (C) 2010-2021 Free Software Foundation, Inc. # Written by Peter Rosin . # # 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 # . # func_error message func_error () { echo "$me: $1" 1>&2 exit 1 } file_conv= # func_file_conv build_file # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. 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 in 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_at_file at_file operation archive # Iterate over all members in AT_FILE performing OPERATION on ARCHIVE # for each of them. # When interpreting the content of the @FILE, do NOT use func_file_conv, # since the user would need to supply preconverted file names to # binutils ar, at least for MinGW. func_at_file () { operation=$2 archive=$3 at_file_contents=`cat "$1"` eval set x "$at_file_contents" shift for member do $AR -NOLOGO $operation:"$member" "$archive" || exit $? done } case $1 in '') func_error "no command. Try '$0 --help' for more information." ;; -h | --h*) cat <&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 $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-writeable /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 incompatibilities 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: mosh-1.4.0/configure.ac0000664000175000017500000005331414326375453011715 00000000000000# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ([2.61]) AC_INIT([mosh], [1.4.0], [mosh-devel@mit.edu]) AM_INIT_AUTOMAKE([foreign std-options -Wall -Werror -Wno-portability]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) AC_CONFIG_SRCDIR([src/frontend/mosh-client.cc]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([src/include/config.h]) AC_LANG([C++]) AX_CODE_COVERAGE # Checks for programs. AC_PROG_CC([cc gcc clang]) AC_PROG_CXX([c++ g++ clang++]) AC_PROG_RANLIB AC_PATH_PROG([PROTOC], [protoc], []) AS_IF([test x"$PROTOC" = x], [AC_MSG_ERROR([cannot find protoc, the Protocol Buffers compiler])]) # automake 1.12 seems to require this, but automake 1.11 doesn't recognize it m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) # Protobuf 3.6+ requires C++11. AS_IF([pkg-config --atleast-version 3.6.0 protobuf], [AX_CXX_COMPILE_STDCXX([11])]) WARNING_CXXFLAGS="" PICKY_CXXFLAGS="" DISTCHECK_CXXFLAGS="" AC_ARG_ENABLE([compile-warnings], [AS_HELP_STRING([--enable-compile-warnings@<:@=no/yes/maximum/error/distcheck@:>@], [Turn on compiler warnings])], [case "$enableval" in no) ;; '' | yes) WARNING_CXXFLAGS="-Wall" ;; maximum) WARNING_CXXFLAGS="-Wall" PICKY_CXXFLAGS="-Wextra -pedantic -Wno-long-long -Weffc++ -Wmissing-declarations" ;; error) # remove -Wno-c++17-extensions once protocolbuffers/protobuf#9181 is # resolved # remove -Wno-unused-parameter once # protocolbuffers/protobuf#10357 is resolved WARNING_CXXFLAGS="-Wall -Werror -Wno-c++17-extensions" PICKY_CXXFLAGS="-Wextra -pedantic -Wno-long-long -Weffc++ -Wmissing-declarations -Wno-unused-parameter" ;; distcheck) WARNING_CXXFLAGS="-Wall -Werror" PICKY_CXXFLAGS="-Wextra -pedantic -Wno-long-long -Weffc++ -Wmissing-declarations" AX_CHECK_COMPILE_FLAG([-Wno-error=unused-parameter], [PICKY_CXXFLAGS="$PICKY_CXXFLAGS -Wno-error=unused-parameter"], [], [-Werror]) AX_CHECK_COMPILE_FLAG([-Wno-error=c++11-extensions], [PICKY_CXXFLAGS="$PICKY_CXXFLAGS -Wno-error=c++11-extensions"], [], [-Werror]) AX_CHECK_COMPILE_FLAG([-Wno-error=deprecated-declarations], [PICKY_CXXFLAGS="$PICKY_CXXFLAGS -Wno-error=deprecated-declarations"], [], [-Werror]) AX_CHECK_COMPILE_FLAG([-Wno-error=nested-anon-types], [PICKY_CXXFLAGS="$PICKY_CXXFLAGS -Wno-error=nested-anon-types"], [], [-Werror]) ;; *) AC_MSG_ERROR([Unknown argument '$enableval' to --enable-compile-warnings]) ;; esac], [WARNING_CXXFLAGS="-Wall"]) AC_SUBST([WARNING_CXXFLAGS]) AC_SUBST([PICKY_CXXFLAGS]) # Check for fuzzing support before the flag wrapper, because if # requested and missing the functionality is entirely nonexistent. MISC_CXXFLAGS="" AC_ARG_ENABLE([fuzzing], [AS_HELP_STRING([--enable-fuzzing], [Enable compiler and linker options to enable fuzz testing @<:@no/yes/libfuzzer@:>@])], [fuzzing="$enableval" case "$enableval" in no) ;; '' | yes | libfuzzer) AX_CHECK_COMPILE_FLAG([-fsanitize=fuzzer], [FUZZING_CFLAGS="$FUZZING_CFLAGS -fsanitize=fuzzer"], [ AC_MSG_ERROR([Fuzzing requested, but compiler support not present])], [-Werror]) ;; *) AC_MSG_ERROR(["Unknown argument '$enableval' to --enable-fuzzing]) ;; esac], [fuzzing="no"]) AC_SUBST([FUZZING_CFLAGS]) AC_SUBST([MISC_CXXFLAGS]) AM_CONDITIONAL([ENABLE_FUZZING], [test x"$fuzzing" != xno]) AC_ARG_ENABLE([asan], [AS_HELP_STRING([--enable-asan], [Enable compiler and linker options to enable AddressSanitizer @<:@no@:>@])], [asan="$enableval"], [asan="no"]) AS_IF([test x"$asan" != x"no"], [ AX_CHECK_COMPILE_FLAG([-fsanitize=address,leak], [MISC_CXXFLAGS="$MISC_CXXFLAGS -fsanitize=address,leak"], [ AC_MSG_ERROR([ASAN requested, but compiler support not present])], [-Werror]) ]) AC_SUBST([MISC_CXXFLAGS]) # We want to check for compiler flag support, but there is no way to make # clang's "argument unused" warning fatal. So we invoke the compiler through a # wrapper script that greps for this message. saved_CXX="$CXX" saved_LD="$LD" flag_wrap="$srcdir/scripts/wrap-compiler-for-flag-check" CXX="$flag_wrap $CXX" LD="$flag_wrap $LD" AC_DEFUN([check_cxx_flag], [AX_CHECK_COMPILE_FLAG([$1], [$2], [$3], [-Werror $4])]) AC_DEFUN([check_link_flag], [AX_CHECK_LINK_FLAG([$1], [$2], [$3], [-Werror $4])]) AC_ARG_ENABLE([hardening], [AS_HELP_STRING([--enable-hardening], [Enable compiler and linker options to frustrate memory corruption exploits @<:@yes@:>@])], [hardening="$enableval"], [hardening="yes"]) HARDEN_CFLAGS="" HARDEN_LDFLAGS="" AS_IF([test x"$hardening" != x"no"], [ check_cxx_flag([-fno-strict-overflow], [HARDEN_CFLAGS="$HARDEN_CFLAGS -fno-strict-overflow"]) # This one will likely succeed, even on platforms where it does nothing. check_cxx_flag([-D_FORTIFY_SOURCE=2], [HARDEN_CFLAGS="$HARDEN_CFLAGS -D_FORTIFY_SOURCE=2"]) check_link_flag([-fstack-protector-all], [HARDEN_CFLAGS="$HARDEN_CFLAGS -fstack-protector-all" check_cxx_flag([-Wstack-protector], [HARDEN_CFLAGS="$HARDEN_CFLAGS -Wstack-protector"], [], [-fstack-protector-all]) check_cxx_flag([--param ssp-buffer-size=1], [HARDEN_CFLAGS="$HARDEN_CFLAGS --param ssp-buffer-size=1"], [], [-fstack-protector-all])]) check_cxx_flag([-fPIE], [check_link_flag([-fPIE -pie], [HARDEN_CFLAGS="$HARDEN_CFLAGS -fPIE" HARDEN_LDFLAGS="$HARDEN_LDFLAGS -pie"], [check_link_flag([-fPIE -Wl,-pie], [HARDEN_CFLAGS="$HARDEN_CFLAGS -fPIE" HARDEN_LDFLAGS="$HARDEN_LDFLAGS -Wl,-pie"])])]) check_link_flag([-Wl,-z,relro], [HARDEN_LDFLAGS="$HARDEN_LDFLAGS -Wl,-z,relro" check_link_flag([-Wl,-z,now], [HARDEN_LDFLAGS="$HARDEN_LDFLAGS -Wl,-z,now"])])]) AC_SUBST([HARDEN_CFLAGS]) AC_SUBST([HARDEN_LDFLAGS]) # Also check for a few non-hardening-related flags. AX_CHECK_COMPILE_FLAG([-fno-default-inline], [MISC_CXXFLAGS="$MISC_CXXFLAGS -fno-default-inline"], [], [-Werror]) AX_CHECK_COMPILE_FLAG([-pipe], [MISC_CXXFLAGS="$MISC_CXXFLAGS -pipe"], [], [-Werror]) AC_SUBST([MISC_CXXFLAGS]) # End of flag tests. CXX="$saved_CXX" LD="$saved_LD" AC_ARG_ENABLE([client], [AS_HELP_STRING([--enable-client], [Build the mosh-client program @<:@yes@:>@])], [build_client="$enableval"], [build_client="yes"]) AM_CONDITIONAL([BUILD_CLIENT], [test x"$build_client" != xno]) AC_ARG_ENABLE([server], [AS_HELP_STRING([--enable-server], [Build the mosh-server program @<:@yes@:>@])], [build_server="$enableval"], [build_server="yes"]) AM_CONDITIONAL([BUILD_SERVER], [test x"$build_server" != xno]) AC_ARG_ENABLE([examples], [AS_HELP_STRING([--enable-examples], [Build the miscellaneous programs in src/examples @<:@no@:>@])], [build_examples="$enableval"], [build_examples="no"]) AM_CONDITIONAL([BUILD_EXAMPLES], [test x"$build_examples" != xno]) AC_ARG_ENABLE([ufw], [AS_HELP_STRING([--enable-ufw], [Install firewall profile for ufw (Uncomplicated Firewall) @<:@no@:>@])], [install_ufw="$enableval"], [install_ufw="no"]) AM_CONDITIONAL([INSTALL_UFW], [test x"$install_ufw" != xno]) AC_ARG_ENABLE([completion], [AS_HELP_STRING([--enable-completion], [Install bash_completion rule @<:@no@:>@])], [install_completion="$enableval"], [install_completion="no"]) AM_CONDITIONAL([INSTALL_COMPLETION], [test x"$install_completion" != xno]) AC_ARG_ENABLE([syslog], [AS_HELP_STRING([--enable-syslog], [Enable connection logging in mosh-server @<:@no@:>@])], [enable_syslog="$enableval"], [enable_syslog="no"]) AS_IF([test x"$enable_syslog" != xno], [AC_CHECK_HEADERS([syslog.h], [AC_DEFINE([HAVE_SYSLOG], [1], [Define if syslog is available.])], [AS_IF([test x"$enable_syslog" = xcheck], [AC_MSG_WARN([Unable to find syslog.h.])], [AC_MSG_ERROR([--enable-syslog was given but syslog.h was not found.])])])]) # Checks for libraries. AC_ARG_ENABLE([static-libraries], [AS_HELP_STRING([--enable-static-libraries], [Enable all static linking options below @<:@no@:>@])]) AC_ARG_ENABLE([static-libstdc++], [AS_HELP_STRING([--enable-static-libstdc++], [Link libstdc++ statically @<:@no@:>@])], [], [enable_static_libstdc__="$enable_static_libraries"]) AS_IF([test "$enable_static_libstdc__" = yes], [LDFLAGS="$LDFLAGS -static-libstdc++"]) AC_ARG_ENABLE([static-libgcc], [AS_HELP_STRING([--enable-static-libgcc], [Link libgcc statically @<:@no@:>@])], [], [enable_static_libgcc="$enable_static_libraries"]) AS_IF([test "$enable_static_libgcc" = yes], [LDFLAGS="$LDFLAGS -static-libgcc"]) AC_ARG_WITH([utempter], [AS_HELP_STRING([--with-utempter], [write utmp entries using libutempter @<:@check@:>@])], [with_utempter="$withval"], [with_utempter="check"]) AC_ARG_ENABLE([static-utempter], [AS_HELP_STRING([--enable-static-utempter], [Link utempter statically @<:@no@:>@])], [], [enable_static_utempter="$enable_static_libraries"]) AS_IF([test x"$with_utempter" != xno], [AC_CHECK_LIB([utempter], [utempter_remove_record], [UTEMPTER_LIBS=-lutempter AS_IF([test "$enable_static_utempter" = yes], [UTEMPTER_LIBS="-Wl,-Bstatic $UTEMPTER_LIBS -Wl,-Bdynamic"]) LIBS="$UTEMPTER_LIBS $LIBS" AC_DEFINE([HAVE_UTEMPTER], [1], [Define if libutempter is available.])], [AS_IF([test x"$with_utempter" = xcheck], [AC_MSG_WARN([Unable to find libutempter; utmp entries will not be made.])], [AC_MSG_ERROR([--with-utempter was given but libutempter was not found.])])])]) AC_ARG_ENABLE([static-zlib], [AS_HELP_STRING([--enable-static-zlib], [Link zlib statically @<:@no@:>@])], [], [enable_static_zlib="$enable_static_libraries"]) AC_CHECK_LIB([z], [compress], [ZLIB_LIBS=-lz AS_IF([test "$enable_static_zlib" = yes], [ZLIB_LIBS="-Wl,-Bstatic $ZLIB_LIBS -Wl,-Bdynamic"]) LIBS="$ZLIB_LIBS $LIBS"], [AC_MSG_ERROR([Unable to find zlib.])]) AC_SEARCH_LIBS([socket], [socket network]) AC_SEARCH_LIBS([inet_addr], [nsl]) AC_SEARCH_LIBS([clock_gettime], [rt]) # Checks for header files. AC_CHECK_HEADERS(m4_normalize([ fcntl.h langinfo.h limits.h locale.h netdb.h netinet/in.h stddef.h stdint.h inttypes.h stdlib.h string.h sys/ioctl.h sys/resource.h sys/socket.h sys/stat.h sys/time.h termios.h unistd.h wchar.h wctype.h ]), [], [AC_MSG_ERROR([Missing required header file.])]) AC_CHECK_HEADERS([pty.h util.h libutil.h paths.h]) AC_CHECK_HEADERS([endian.h sys/endian.h]) AC_CHECK_HEADERS([utmpx.h]) AC_CHECK_HEADERS([termio.h]) AC_CHECK_HEADERS([sys/uio.h]) AC_CHECK_HEADERS([memory tr1/memory]) # Checks for typedefs, structures, and compiler characteristics. AC_C_INLINE AC_TYPE_INT64_T AC_TYPE_PID_T AC_C_RESTRICT AC_TYPE_SIZE_T AC_TYPE_SSIZE_T AC_TYPE_UINT16_T AC_TYPE_UINT32_T AC_TYPE_UINT64_T AC_TYPE_UINT8_T AC_TYPE_UINTPTR_T # Checks for library functions. AC_CHECK_FUNCS(m4_normalize([ gettimeofday posix_memalign cfmakeraw pselect pledge ])) # Start by trying to find the needed tinfo parts by pkg-config PKG_CHECK_MODULES([TINFO], [tinfo], [AC_DEFINE([HAVE_CURSES_H], [1], [Define to 1 if is present])], [PKG_CHECK_MODULES([TINFO], [ncurses], [AC_DEFINE([HAVE_CURSES_H], [1], [Define to 1 if is present])], [AX_CHECK_LIBRARY([TINFO], [curses.h], [tinfo], [AC_DEFINE([HAVE_CURSES_H], [1], [Define to 1 if is present]) AC_SUBST([TINFO_CFLAGS], ["$TINFO_CPPFLAGS"]) AC_SUBST([TINFO_LIBS], ["$TINFO_LDFLAGS -ltinfo"])],)])]) # Then try to find it in a specific install dir AC_ARG_WITH(curses, [AC_HELP_STRING([--with-curses=DIR], [Where curses is installed])], [if test $withval != yes; then cv_curses=$withval fi if test x$cv_curses != x/usr; then CURSES_LDFLAGS="-L${cv_curses}/lib" CURSES_CPPFLAGS="-I${cv_curses}/include" fi]) if test "x$ax_cv_have_TINFO" = xno ; then # save away old LDFLAGS/CPPFLAGS and check for curses with cv_curses old_LDFLAGS="$LDFLAGS" old_CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS $CURSES_LDFLAGS" CPPFLAGS="$CPPFLAGS $CURSES_CPPFLAGS" AX_WITH_CURSES # restore old LDFLAGS/CPPFLAGS LDFLAGS="$old_LDFLAGS" CPPFLAGS="$old_CPPFLAGS" if test "x$ax_cv_curses_which" = xno ; then AC_MSG_ERROR([requires either tinfo, NcursesW or Ncurses library]) else AC_SUBST([TINFO_LIBS], ["$CURSES_LDFLAGS $CURSES_LIB"]) AC_SUBST([TINFO_CFLAGS], ["$CURSES_CPPFLAGS"]) fi fi AC_ARG_ENABLE([static-curses], [AS_HELP_STRING([--enable-static-curses], [Link curses statically @<:@no@:>@])], [], [enable_static_curses="$enable_static_libraries"]) AS_IF([test "$enable_static_curses" = yes], [TINFO_LIBS="-Wl,-Bstatic $TINFO_LIBS -Wl,-Bdynamic"]) dnl Default to OpenSSL, or OS X crypto library if found AC_CHECK_HEADERS([CommonCrypto/CommonCrypto.h], [default_crypto_library="apple-common-crypto"], [default_crypto_library="openssl"] ) dnl Allow user to select over the default. AC_ARG_WITH( [crypto-library], [AS_HELP_STRING([--with-crypto-library=library], [build with the given crypto library, TYPE=openssl|nettle|apple-common-crypto @<:@default=openssl@:>@])], [ case "${withval}" in openssl|openssl-with-internal-ocb|openssl-with-openssl-ocb|nettle|apple-common-crypto) ;; *) AC_MSG_ERROR([bad value ${withval} for --with-crypto-library]) ;; esac ], [with_crypto_library="$default_crypto_library"] ) dnl Checks for chosen crypto library PKG_CHECK_MODULES([OpenSSL], [openssl], [have_openssl=yes AC_CHECK_LIB([crypto], [AES_encrypt], [have_deprecated_openssl_aes=yes]) AC_CHECK_LIB([crypto], [EVP_aes_128_ocb], [have_evp_aes_ocb=yes])], [:]) PKG_CHECK_MODULES([Nettle], [nettle], [have_nettle=yes], [:]) AS_CASE([$with_crypto_library], [openssl*], [AS_IF([test "x$have_openssl" != xyes], [AC_MSG_ERROR([OpenSSL crypto library not found])]) AC_DEFINE([USE_OPENSSL_AES], [1], [Use OpenSSL library]) AC_SUBST([CRYPTO_CFLAGS], ["$OpenSSL_CFLAGS"]) AC_SUBST([CRYPTO_LIBS], ["$OpenSSL_LIBS -lcrypto"])]) case "${with_crypto_library}" in openssl|openssl-with-internal-ocb) AS_IF([test "x$have_deprecated_openssl_aes" != xyes], [AC_MSG_ERROR([found OpenSSL without AES support])]) AM_CONDITIONAL([USE_AES_OCB_FROM_OPENSSL], [false]) human_readable_cryptography_description='internal OCB, OpenSSL AES' ;; openssl-with-openssl-ocb) AS_IF([test "x$have_evp_aes_ocb" != xyes], [AC_MSG_ERROR([found OpenSSL without AES-OCB support])]) AM_CONDITIONAL([USE_AES_OCB_FROM_OPENSSL], [true]) human_readable_cryptography_description='OpenSSL OCB, OpenSSL AES' ;; nettle) AS_IF([test "x$have_nettle" != xyes], [AC_MSG_ERROR([Nettle crypto library not found])]) AC_DEFINE([USE_NETTLE_AES], [1], [Use Nettle library]) AC_SUBST([CRYPTO_CFLAGS], ["$Nettle_CFLAGS"]) AC_SUBST([CRYPTO_LIBS], ["$Nettle_LIBS"]) AM_CONDITIONAL([USE_AES_OCB_FROM_OPENSSL], [false]) human_readable_cryptography_description='internal OCB, Nettle AES' ;; apple-common-crypto) AS_IF([test "x$ac_cv_header_CommonCrypto_CommonCrypto_h" != xyes], [AC_MSG_ERROR([Apple Common Crypto header not found])]) AC_DEFINE([USE_APPLE_COMMON_CRYPTO_AES], [1], [Use Apple Common Crypto library]) AM_CONDITIONAL([USE_AES_OCB_FROM_OPENSSL], [false]) human_readable_cryptography_description='internal OCB, Apple Common Crypto AES' ;; esac AC_ARG_ENABLE([static-crypto], [AS_HELP_STRING([--enable-static-crypto], [Link crypto library statically @<:@no@:>@])], [], [enable_static_crypto="$enable_static_libraries"]) AS_IF([test "$enable_static_crypto" = yes], [CRYPTO_LIBS="-Wl,-Bstatic $CRYPTO_LIBS -Wl,-Bdynamic"]) AC_CHECK_DECL([forkpty], [AC_DEFINE([FORKPTY_IN_LIBUTIL], [1], [Define if libutil.h necessary for forkpty().])], , [[#include #include ]]) AC_SEARCH_LIBS([forkpty], [util bsd], [ AC_DEFINE([HAVE_FORKPTY],, [Define if you have forkpty().]) ]) AC_MSG_CHECKING([whether FD_ISSET() argument is const]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include class T { public: fd_set fds; bool Fun( void ) const { return FD_ISSET( 0, &fds ); } };]], [[T x = T(); return x.Fun();]])], [AC_DEFINE([FD_ISSET_IS_CONST], [1], [Define if FD_ISSET() fd_set argument is const.]) AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) AC_MSG_CHECKING([whether std::shared_ptr is available]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include class T { public: std::shared_ptr Fun( void ) { return std::shared_ptr( new int ( 0 ) ); } };]], [[T x; return !!x.Fun();]])], [AC_DEFINE([HAVE_STD_SHARED_PTR], [1], [Define if std::shared_ptr is available.]) AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) AC_MSG_CHECKING([whether std::tr1::shared_ptr is available]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include class T { public: std::tr1::shared_ptr Fun( void ) { return std::tr1::shared_ptr( new int ( 0 ) ); } };]], [[T x; return !!x.Fun();]])], [AC_DEFINE([HAVE_STD_TR1_SHARED_PTR], [1], [Define if std::tr1::shared_ptr is available.]) AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) AC_MSG_CHECKING([whether clock_gettime() is supported]) AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include struct timespec ts; ]], [[return clock_gettime(CLOCK_MONOTONIC, &ts);]])], [AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [Define if clock_gettime() is available.]) AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) AC_CHECK_DECL([mach_absolute_time], [AC_DEFINE([HAVE_MACH_ABSOLUTE_TIME], [1], [Define if mach_absolute_time is available.])], , [[#include ]]) AC_CHECK_DECLS([__builtin_ctz]) AC_CHECK_DECLS([ffs], [], [], [[#include ]]) AC_CHECK_DECLS([be64toh, betoh64, bswap64, __builtin_bswap64], [], [], [[#if defined(HAVE_ENDIAN_H) #include #elif defined(HAVE_SYS_ENDIAN_H) #include #include #endif]]) AS_IF([test x"$ac_cv_have_decl_be64toh" != xyes && test x"$ac_cv_have_decl_betoh64" != xyes], [AC_CHECK_DECL([OSSwapHostToBigInt64], [AC_DEFINE([HAVE_OSX_SWAP], [1], [Define if OSSwapHostToBigInt64 and friends exist.])], [AC_MSG_WARN([Unable to find byte swapping functions; using built-in routines.])], [[#include ]])]) AC_CHECK_DECL([IP_MTU_DISCOVER], [AC_DEFINE([HAVE_IP_MTU_DISCOVER], [1], [Define if IP_MTU_DISCOVER is a valid sockopt.])], , [[#include ]]) AC_CHECK_DECL([IP_RECVTOS], [AC_DEFINE([HAVE_IP_RECVTOS], [1], [Define if IP_RECVTOS is a valid sockopt.])], , [[#include ]]) AC_CHECK_DECL([__STDC_ISO_10646__], [], [AC_MSG_WARN([C library doesn't advertise wchar_t is Unicode (OS X works anyway with workaround).])], [[#include ]]) AC_CHECK_DECL([IUTF8], [AC_DEFINE([HAVE_IUTF8], [1], [Define if IUTF8 is a defined termios mode.])], [AC_MSG_WARN([No IUTF8 termios mode; character-erase of multibyte character sequence probably does not work properly in canonical mode on this platform.])], [[#include ]]) # Checks for protobuf PKG_CHECK_MODULES([protobuf], [protobuf]) # On Debian Sid 2016-03-16ish at least, "pkgconfig --libs protobuf" # gives us the bogus "-lprotobuf -pthread -lpthread"; remove # "-lpthread" which misconfigures compile, causing a segfault in # mosh-server. AS_IF([echo "$protobuf_LIBS" | grep -q -- -pthread], [protobuf_LIBS="`echo $protobuf_LIBS | sed 's/-lpthread//g'`"]) AC_ARG_ENABLE([static-protobuf], [AS_HELP_STRING([--enable-static-protobuf], [Link protobuf statically @<:@no@:>@])], [], [enable_static_protobuf="$enable_static_libraries"]) AS_IF([test "$enable_static_protobuf" = yes], [protobuf_LIBS="-Wl,-Bstatic $protobuf_LIBS -Wl,-Bdynamic"], [AS_IF([test "$enable_static_libstdc__" = yes], [AC_MSG_ERROR([--enable-static-libstdc++ requires --enable-static-protobuf])]) AS_IF([test "$enable_static_libgcc" = yes], [AC_MSG_ERROR([--enable-static-libgcc requires --enable-static-protobuf])])]) AC_MSG_CHECKING([whether protoc matches protobuf]) cat > conftest.proto <<'EOF' syntax = "proto2"; option optimize_for = LITE_RUNTIME; EOF AS_IF([$PROTOC --cpp_out=. conftest.proto], [old_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $protobuf_CFLAGS" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include "conftest.pb.h"]], [[]])], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]) cat conftest.err AC_MSG_FAILURE([Could not build output generated by protoc ($PROTOC). Check that protoc matches the installed protobuf headers and libraries.])]) CPPFLAGS="$old_CPPFLAGS"], [AC_MSG_RESULT([no]) AC_MSG_ERROR([Could not run protoc ($PROTOC).])]) # Bash completion needs to ask where it goes if >= 2.0 is installed. AS_IF([test "$install_completion" != no], [PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0], [if test "$prefix" = "NONE"; then completions="`pkg-config --variable=completionsdir bash-completion`" else completions="`pkg-config --define-variable=prefix=$prefix --variable=completionsdir bash-completion`" fi], [completions="${sysconfdir}/bash_completion.d"]) AC_SUBST([completions])]) AC_CONFIG_FILES([ Makefile src/Makefile src/crypto/Makefile src/frontend/Makefile src/fuzz/Makefile src/include/Makefile src/network/Makefile src/protobufs/Makefile src/statesync/Makefile src/terminal/Makefile src/util/Makefile scripts/Makefile src/examples/Makefile src/tests/Makefile man/Makefile conf/Makefile ]) AC_OUTPUT AC_MSG_NOTICE([ === Configuration results ===]) AC_MSG_NOTICE([Version: $PACKAGE_VERSION]) AC_MSG_NOTICE([c++ compiler: $CXX]) AC_MSG_NOTICE([Warning CXXFLAGS: $WARNING_CXXFLAGS]) AC_MSG_NOTICE([Picky CXXFLAGS: $PICKY_CXXFLAGS]) AC_MSG_NOTICE([Harden CFLAGS: $HARDEN_CFLAGS]) AC_MSG_NOTICE([Cryptography: $human_readable_cryptography_description]) AC_MSG_NOTICE([ =============================]) mosh-1.4.0/configure0000775000175000017500000124342014327736657011346 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.71 for mosh 1.4.0. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2017, 2020-2021 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 as_nop=: 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 $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; 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="as_nop=: 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 \$as_nop case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; 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 \$as_nop exitcode=1; echo positional parameters were not saved. 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" if (eval "$as_required") 2>/dev/null then : as_have_required=yes else $as_nop as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null then : else $as_nop 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 $as_nop 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 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 and mosh-devel@mit.edu $0: about your system, including any error possibly output $0: before this message. Then install a modern shell, or $0: manually run the script under such a shell if you do $0: have one." fi exit 1 fi 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_nop # --------- # Do nothing but, unlike ":", preserve the value of $?. as_fn_nop () { return $? } as_nop=as_fn_nop # 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 $as_nop as_fn_append () { eval $1=\$$1\$2 } 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 $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_nop # --------- # Do nothing but, unlike ":", preserve the value of $?. as_fn_nop () { return $? } as_nop=as_fn_nop # 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 ' 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_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" 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='mosh' PACKAGE_TARNAME='mosh' PACKAGE_VERSION='1.4.0' PACKAGE_STRING='mosh 1.4.0' PACKAGE_BUGREPORT='mosh-devel@mit.edu' PACKAGE_URL='' ac_unique_file="src/frontend/mosh-client.cc" # 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_cxx_list= ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS completions BASH_COMPLETION_LIBS BASH_COMPLETION_CFLAGS protobuf_LIBS protobuf_CFLAGS USE_AES_OCB_FROM_OPENSSL_FALSE USE_AES_OCB_FROM_OPENSSL_TRUE CRYPTO_LIBS CRYPTO_CFLAGS Nettle_LIBS Nettle_CFLAGS OpenSSL_LIBS OpenSSL_CFLAGS CURSES_LIB TINFO_LDFLAGS TINFO_CPPFLAGS TINFO_LIBS TINFO_CFLAGS PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG INSTALL_COMPLETION_FALSE INSTALL_COMPLETION_TRUE INSTALL_UFW_FALSE INSTALL_UFW_TRUE BUILD_EXAMPLES_FALSE BUILD_EXAMPLES_TRUE BUILD_SERVER_FALSE BUILD_SERVER_TRUE BUILD_CLIENT_FALSE BUILD_CLIENT_TRUE HARDEN_LDFLAGS HARDEN_CFLAGS ENABLE_FUZZING_FALSE ENABLE_FUZZING_TRUE MISC_CXXFLAGS FUZZING_CFLAGS PICKY_CXXFLAGS WARNING_CXXFLAGS HAVE_CXX11 ac_ct_AR AR PROTOC RANLIB am__fastdepCXX_FALSE am__fastdepCXX_TRUE CXXDEPMODE ac_ct_CXX CXXFLAGS CXX 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 CODE_COVERAGE_LIBS CODE_COVERAGE_CXXFLAGS CODE_COVERAGE_CFLAGS CODE_COVERAGE_CPPFLAGS GENHTML LCOV GCOV ifnGNUmake ifGNUmake CODE_COVERAGE_ENABLED CODE_COVERAGE_ENABLED_FALSE CODE_COVERAGE_ENABLED_TRUE 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 with_gcov enable_code_coverage enable_dependency_tracking enable_compile_warnings enable_fuzzing enable_asan enable_hardening enable_client enable_server enable_examples enable_ufw enable_completion enable_syslog enable_static_libraries enable_static_libstdc__ enable_static_libgcc with_utempter enable_static_utempter enable_static_zlib with_curses with_ncurses with_ncursesw enable_static_curses with_crypto_library enable_static_crypto enable_static_protobuf ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CXX CXXFLAGS CCC PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR TINFO_CFLAGS TINFO_LIBS TINFO_CPPFLAGS TINFO_LDFLAGS CURSES_LIB OpenSSL_CFLAGS OpenSSL_LIBS Nettle_CFLAGS Nettle_LIBS protobuf_CFLAGS protobuf_LIBS BASH_COMPLETION_CFLAGS BASH_COMPLETION_LIBS' # 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 mosh 1.4.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] 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/mosh] --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 _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of mosh 1.4.0:";; 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-code-coverage Whether to enable code coverage support --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --enable-compile-warnings[=no/yes/maximum/error/distcheck] Turn on compiler warnings --enable-fuzzing Enable compiler and linker options to enable fuzz testing [no/yes/libfuzzer] --enable-asan Enable compiler and linker options to enable AddressSanitizer [no] --enable-hardening Enable compiler and linker options to frustrate memory corruption exploits [yes] --enable-client Build the mosh-client program [yes] --enable-server Build the mosh-server program [yes] --enable-examples Build the miscellaneous programs in src/examples [no] --enable-ufw Install firewall profile for ufw (Uncomplicated Firewall) [no] --enable-completion Install bash_completion rule [no] --enable-syslog Enable connection logging in mosh-server [no] --enable-static-libraries Enable all static linking options below [no] --enable-static-libstdc++ Link libstdc++ statically [no] --enable-static-libgcc Link libgcc statically [no] --enable-static-utempter Link utempter statically [no] --enable-static-zlib Link zlib statically [no] --enable-static-curses Link curses statically [no] --enable-static-crypto Link crypto library statically [no] --enable-static-protobuf Link protobuf statically [no] Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-gcov=GCOV use given GCOV for coverage (GCOV=gcov). --with-utempter write utmp entries using libutempter [check] --with-curses=DIR Where curses is installed --with-ncurses force the use of Ncurses or NcursesW --without-ncursesw do not use NcursesW (wide character support) --with-crypto-library=library build with the given crypto library, TYPE=openssl|nettle|apple-common-crypto [default=openssl] 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 CXX C++ compiler command CXXFLAGS C++ compiler flags PKG_CONFIG path to pkg-config utility PKG_CONFIG_PATH directories to add to pkg-config's search path PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path TINFO_CFLAGS C compiler flags for TINFO, overriding pkg-config TINFO_LIBS linker flags for TINFO, overriding pkg-config TINFO_CPPFLAGS C preprocessor flags for TINFO headers TINFO_LDFLAGS linker flags for TINFO libraries CURSES_LIB linker library for Curses, e.g. -lcurses OpenSSL_CFLAGS C compiler flags for OpenSSL, overriding pkg-config OpenSSL_LIBS linker flags for OpenSSL, overriding pkg-config Nettle_CFLAGS C compiler flags for Nettle, overriding pkg-config Nettle_LIBS linker flags for Nettle, overriding pkg-config protobuf_CFLAGS C compiler flags for protobuf, overriding pkg-config protobuf_LIBS linker flags for protobuf, overriding pkg-config BASH_COMPLETION_CFLAGS C compiler flags for BASH_COMPLETION, overriding pkg-config BASH_COMPLETION_LIBS linker flags for BASH_COMPLETION, overriding pkg-config 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 . _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 mosh configure 1.4.0 generated by GNU Autoconf 2.71 Copyright (C) 2021 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 $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_cxx_try_compile LINENO # ---------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_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_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext then : ac_retval=0 else $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_cxx_try_compile # ac_fn_cxx_try_link LINENO # ------------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_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_cxx_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 $as_nop printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 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_cxx_try_link # ac_fn_cxx_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_cxx_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 $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : eval "$3=yes" else $as_nop eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext 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_cxx_check_header_compile # ac_fn_c_find_intX_t LINENO BITS VAR # ----------------------------------- # Finds a signed integer type with width BITS, setting cache variable VAR # accordingly. ac_fn_c_find_intX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 printf %s "checking for int$2_t... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. for ac_type in int$2_t 'int' 'long int' \ 'long long int' 'short int' 'signed char'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default enum { N = $2 / 2 - 1 }; int main (void) { static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default enum { N = $2 / 2 - 1 }; int main (void) { static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1) < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : else $as_nop case $ac_type in #( int$2_t) : eval "$3=yes" ;; #( *) : eval "$3=\$ac_type" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if eval test \"x\$"$3"\" = x"no" then : else $as_nop break fi done 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_find_intX_t # ac_fn_cxx_check_type LINENO TYPE VAR INCLUDES # --------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_cxx_check_type () { 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 $as_nop eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : else $as_nop eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext 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_cxx_check_type # ac_fn_c_find_uintX_t LINENO BITS VAR # ------------------------------------ # Finds an unsigned integer type with width BITS, setting cache variable VAR # accordingly. ac_fn_c_find_uintX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 printf %s "checking for uint$2_t... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ 'unsigned long long int' 'unsigned short int' 'unsigned char'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main (void) { static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : case $ac_type in #( uint$2_t) : eval "$3=yes" ;; #( *) : eval "$3=\$ac_type" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if eval test \"x\$"$3"\" = x"no" then : else $as_nop break fi done 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_find_uintX_t # ac_fn_cxx_check_func LINENO FUNC VAR # ------------------------------------ # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_cxx_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 $as_nop 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 (); 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 (); /* 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_cxx_try_link "$LINENO" then : eval "$3=yes" else $as_nop eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext 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_cxx_check_func # ac_fn_check_decl LINENO SYMBOL VAR INCLUDES EXTRA-OPTIONS FLAG-VAR # ------------------------------------------------------------------ # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR # accordingly. Pass EXTRA-OPTIONS to the compiler, using FLAG-VAR. ac_fn_check_decl () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack as_decl_name=`echo $2|sed 's/ *(.*//'` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 printf %s "checking whether $as_decl_name is declared... " >&6; } if eval test \${$3+y} then : printf %s "(cached) " >&6 else $as_nop as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` eval ac_save_FLAGS=\$$6 as_fn_append $6 " $5" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main (void) { #ifndef $as_decl_name #ifdef __cplusplus (void) $as_decl_use; #else (void) $as_decl_name; #endif #endif ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : eval "$3=yes" else $as_nop eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext eval $6=\$ac_save_FLAGS 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_check_decl 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 mosh $as_me 1.4.0, which was generated by GNU Autoconf 2.71. 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 # 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 (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not \xHH hex character constants. These 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 #include extern int puts (const char *); extern int printf (const char *, ...); extern int dprintf (int, const char *, ...); extern void *malloc (size_t); // 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) { // See if C++-style comments work. // 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; // 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; } " # Test code for whether the C++ compiler supports C++98 (global declarations) ac_cxx_conftest_cxx98_globals=' // Does the compiler advertise C++98 conformance? #if !defined __cplusplus || __cplusplus < 199711L # error "Compiler does not advertise C++98 conformance" #endif // These inclusions are to reject old compilers that // lack the unsuffixed header files. #include #include // and are *not* freestanding headers in C++98. extern void assert (int); namespace std { extern int strcmp (const char *, const char *); } // Namespaces, exceptions, and templates were all added after "C++ 2.0". using std::exception; using std::strcmp; namespace { void test_exception_syntax() { try { throw "test"; } catch (const char *s) { // Extra parentheses suppress a warning when building autoconf itself, // due to lint rules shared with more typical C programs. assert (!(strcmp) (s, "test")); } } template struct test_template { T const val; explicit test_template(T t) : val(t) {} template T add(U u) { return static_cast(u) + val; } }; } // anonymous namespace ' # Test code for whether the C++ compiler supports C++98 (body of main) ac_cxx_conftest_cxx98_main=' assert (argc); assert (! argv[0]); { test_exception_syntax (); test_template tt (2.0); assert (tt.add (4) == 6.0); assert (true && !false); } ' # Test code for whether the C++ compiler supports C++11 (global declarations) ac_cxx_conftest_cxx11_globals=' // Does the compiler advertise C++ 2011 conformance? #if !defined __cplusplus || __cplusplus < 201103L # error "Compiler does not advertise C++11 conformance" #endif namespace cxx11test { constexpr int get_val() { return 20; } struct testinit { int i; double d; }; class delegate { public: delegate(int n) : n(n) {} delegate(): delegate(2354) {} virtual int getval() { return this->n; }; protected: int n; }; class overridden : public delegate { public: overridden(int n): delegate(n) {} virtual int getval() override final { return this->n * 2; } }; class nocopy { public: nocopy(int i): i(i) {} nocopy() = default; nocopy(const nocopy&) = delete; nocopy & operator=(const nocopy&) = delete; private: int i; }; // for testing lambda expressions template Ret eval(Fn f, Ret v) { return f(v); } // for testing variadic templates and trailing return types template auto sum(V first) -> V { return first; } template auto sum(V first, Args... rest) -> V { return first + sum(rest...); } } ' # Test code for whether the C++ compiler supports C++11 (body of main) ac_cxx_conftest_cxx11_main=' { // Test auto and decltype auto a1 = 6538; auto a2 = 48573953.4; auto a3 = "String literal"; int total = 0; for (auto i = a3; *i; ++i) { total += *i; } decltype(a2) a4 = 34895.034; } { // Test constexpr short sa[cxx11test::get_val()] = { 0 }; } { // Test initializer lists cxx11test::testinit il = { 4323, 435234.23544 }; } { // Test range-based for int array[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; for (auto &x : array) { x += 23; } } { // Test lambda expressions using cxx11test::eval; assert (eval ([](int x) { return x*2; }, 21) == 42); double d = 2.0; assert (eval ([&](double x) { return d += x; }, 3.0) == 5.0); assert (d == 5.0); assert (eval ([=](double x) mutable { return d += x; }, 4.0) == 9.0); assert (d == 5.0); } { // Test use of variadic templates using cxx11test::sum; auto a = sum(1); auto b = sum(1, 2); auto c = sum(1.0, 2.0, 3.0); } { // Test constructor delegation cxx11test::delegate d1; cxx11test::delegate d2(); cxx11test::delegate d3(45); } { // Test override and final cxx11test::overridden o1(55464); } { // Test nullptr char *c = nullptr; } { // Test template brackets test_template<::test_template> v(test_template(12)); } { // Unicode literals char const *utf8 = u8"UTF-8 string \u2500"; char16_t const *utf16 = u"UTF-8 string \u2500"; char32_t const *utf32 = U"UTF-32 string \u2500"; } ' # Test code for whether the C compiler supports C++11 (complete). ac_cxx_conftest_cxx11_program="${ac_cxx_conftest_cxx98_globals} ${ac_cxx_conftest_cxx11_globals} int main (int argc, char **argv) { int ok = 0; ${ac_cxx_conftest_cxx98_main} ${ac_cxx_conftest_cxx11_main} return ok; } " # Test code for whether the C compiler supports C++98 (complete). ac_cxx_conftest_cxx98_program="${ac_cxx_conftest_cxx98_globals} int main (int argc, char **argv) { int ok = 0; ${ac_cxx_conftest_cxx98_main} return ok; } " as_fn_append ac_header_cxx_list " stdio.h stdio_h HAVE_STDIO_H" as_fn_append ac_header_cxx_list " stdlib.h stdlib_h HAVE_STDLIB_H" as_fn_append ac_header_cxx_list " string.h string_h HAVE_STRING_H" as_fn_append ac_header_cxx_list " inttypes.h inttypes_h HAVE_INTTYPES_H" as_fn_append ac_header_cxx_list " stdint.h stdint_h HAVE_STDINT_H" as_fn_append ac_header_cxx_list " strings.h strings_h HAVE_STRINGS_H" as_fn_append ac_header_cxx_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" as_fn_append ac_header_cxx_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" as_fn_append ac_header_cxx_list " unistd.h unistd_h HAVE_UNISTD_H" # Auxiliary files required by this configure script. ac_aux_files="ar-lib 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 $as_nop as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 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.16' # 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 $as_nop 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 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 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). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file 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 if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } # 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 grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! 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 $as_nop 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 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 $as_nop 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 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 $as_nop 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 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 the slow shell script. Don't cache a # value for MKDIR_P 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. MKDIR_P="$ac_install_sh -d" 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 $as_nop 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 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 $as_nop 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 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 # Check whether --enable-silent-rules was given. if test ${enable_silent_rules+y} then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac 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 $as_nop 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 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; } 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 AM_BACKSLASH='\' 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='mosh' VERSION='1.4.0' 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 # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi fi # Check whether --enable-silent-rules was given. if test ${enable_silent_rules+y} then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=0;; esac 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 $as_nop 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 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; } 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 AM_BACKSLASH='\' ac_config_headers="$ac_config_headers src/include/config.h" ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu # allow to override gcov location # Check whether --with-gcov was given. if test ${with_gcov+y} then : withval=$with_gcov; _AX_CODE_COVERAGE_GCOV_PROG_WITH=$with_gcov else $as_nop _AX_CODE_COVERAGE_GCOV_PROG_WITH=gcov fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build with code coverage support" >&5 printf %s "checking whether to build with code coverage support... " >&6; } # Check whether --enable-code-coverage was given. if test ${enable_code_coverage+y} then : enableval=$enable_code_coverage; else $as_nop enable_code_coverage=no fi if test "x$enable_code_coverage" = xyes; then CODE_COVERAGE_ENABLED_TRUE= CODE_COVERAGE_ENABLED_FALSE='#' else CODE_COVERAGE_ENABLED_TRUE='#' CODE_COVERAGE_ENABLED_FALSE= fi CODE_COVERAGE_ENABLED=$enable_code_coverage { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_code_coverage" >&5 printf "%s\n" "$enable_code_coverage" >&6; } if test "x$enable_code_coverage" = xyes then : 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 $as_nop 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 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 for GNU make" >&5 printf %s "checking for GNU make... " >&6; } if test ${_cv_gnu_make_command+y} then : printf %s "(cached) " >&6 else $as_nop _cv_gnu_make_command="" ; for a in "$MAKE" make gmake gnumake ; do if test -z "$a" ; then continue ; fi ; if "$a" --version 2> /dev/null | grep GNU 2>&1 > /dev/null ; then _cv_gnu_make_command=$a ; AX_CHECK_GNU_MAKE_HEADLINE=$("$a" --version 2> /dev/null | grep "GNU Make") ax_check_gnu_make_version=$(echo ${AX_CHECK_GNU_MAKE_HEADLINE} | ${AWK} -F " " '{ print $(NF); }') break ; fi done ; fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $_cv_gnu_make_command" >&5 printf "%s\n" "$_cv_gnu_make_command" >&6; } if test "x$_cv_gnu_make_command" = x"" then : ifGNUmake="#" else $as_nop ifGNUmake="" fi if test "x$_cv_gnu_make_command" = x"" then : ifnGNUmake="" else $as_nop ifnGNUmake="#" fi if test "x$_cv_gnu_make_command" = x"" then : { ax_cv_gnu_make_command=; unset ax_cv_gnu_make_command;} else $as_nop ax_cv_gnu_make_command=${_cv_gnu_make_command} fi if test "x$_cv_gnu_make_command" = x"" then : as_fn_error $? "not using GNU make that is needed for coverage" "$LINENO" 5 fi # check for gcov if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}$_AX_CODE_COVERAGE_GCOV_PROG_WITH", so it can be a program name with args. set dummy ${ac_tool_prefix}$_AX_CODE_COVERAGE_GCOV_PROG_WITH; 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_GCOV+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$GCOV"; then ac_cv_prog_GCOV="$GCOV" # 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_GCOV="${ac_tool_prefix}$_AX_CODE_COVERAGE_GCOV_PROG_WITH" 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 fi GCOV=$ac_cv_prog_GCOV if test -n "$GCOV"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $GCOV" >&5 printf "%s\n" "$GCOV" >&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_GCOV"; then ac_ct_GCOV=$GCOV # Extract the first word of "$_AX_CODE_COVERAGE_GCOV_PROG_WITH", so it can be a program name with args. set dummy $_AX_CODE_COVERAGE_GCOV_PROG_WITH; 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_GCOV+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_GCOV"; then ac_cv_prog_ac_ct_GCOV="$ac_ct_GCOV" # 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_GCOV="$_AX_CODE_COVERAGE_GCOV_PROG_WITH" 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 fi ac_ct_GCOV=$ac_cv_prog_ac_ct_GCOV if test -n "$ac_ct_GCOV"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_GCOV" >&5 printf "%s\n" "$ac_ct_GCOV" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_GCOV" = x; then GCOV=":" 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 GCOV=$ac_ct_GCOV fi else GCOV="$ac_cv_prog_GCOV" fi if test "X$GCOV" = "X:" then : as_fn_error $? "gcov is needed to do coverage" "$LINENO" 5 fi if test "$GCC" = "no" then : as_fn_error $? "not compiling with gcc, which is required for gcov code coverage" "$LINENO" 5 fi # Extract the first word of "lcov", so it can be a program name with args. set dummy lcov; 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_LCOV+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$LCOV"; then ac_cv_prog_LCOV="$LCOV" # 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_LCOV="lcov" 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 fi LCOV=$ac_cv_prog_LCOV if test -n "$LCOV"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LCOV" >&5 printf "%s\n" "$LCOV" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi # Extract the first word of "genhtml", so it can be a program name with args. set dummy genhtml; 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_GENHTML+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$GENHTML"; then ac_cv_prog_GENHTML="$GENHTML" # 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_GENHTML="genhtml" 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 fi GENHTML=$ac_cv_prog_GENHTML if test -n "$GENHTML"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $GENHTML" >&5 printf "%s\n" "$GENHTML" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test x"$LCOV" = x then : as_fn_error $? "To enable code coverage reporting you must have lcov installed" "$LINENO" 5 fi if test x"$GENHTML" = x then : as_fn_error $? "Could not find genhtml from the lcov package" "$LINENO" 5 fi CODE_COVERAGE_CPPFLAGS="-DNDEBUG" CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage" CODE_COVERAGE_CXXFLAGS="-O0 -g -fprofile-arcs -ftest-coverage" CODE_COVERAGE_LIBS="-lgcov" fi # Checks for programs. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in cc gcc clang 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 $as_nop 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 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 cc gcc clang 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 $as_nop 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 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 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 $as_nop ac_file='' 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 $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } 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 $as_nop { { 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; } 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"); 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.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 $as_nop 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 $as_nop 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; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext 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 $as_nop 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 $as_nop ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu 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 $as_nop 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 $as_nop 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 $as_nop 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 fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag 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 $as_nop 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 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 $as_nop 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 $as_nop { 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" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 ac_prog_cc_stdc=c11 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 $as_nop 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 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 $as_nop 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 $as_nop { 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" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 ac_prog_cc_stdc=c99 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 $as_nop 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 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 $as_nop 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 $as_nop { 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" fi ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 ac_prog_cc_stdc=c89 fi fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_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 $as_nop 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 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=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu 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 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 $as_nop 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 thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { 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_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in c++ g++ clang++ 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_CXX+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # 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_CXX="$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 fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 printf "%s\n" "$CXX" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in c++ g++ clang++ 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_CXX+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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_CXX="$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 fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 printf "%s\n" "$ac_ct_CXX" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" 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 CXX=$ac_ct_CXX fi fi fi fi # 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; 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_cxx_compiler_gnu+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ac_compiler_gnu=yes else $as_nop ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; } ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi ac_test_CXXFLAGS=${CXXFLAGS+y} ac_save_CXXFLAGS=$CXXFLAGS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 printf %s "checking whether $CXX accepts -g... " >&6; } if test ${ac_cv_prog_cxx_g+y} then : printf %s "(cached) " >&6 else $as_nop ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_prog_cxx_g=yes else $as_nop CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : else $as_nop ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_prog_cxx_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 printf "%s\n" "$ac_cv_prog_cxx_g" >&6; } if test $ac_test_CXXFLAGS; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi ac_prog_cxx_stdcxx=no if test x$ac_prog_cxx_stdcxx = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 printf %s "checking for $CXX option to enable C++11 features... " >&6; } if test ${ac_cv_prog_cxx_11+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cxx_11=no ac_save_CXX=$CXX cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_cxx_conftest_cxx11_program _ACEOF for ac_arg in '' -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x -qlanglvl=extended0x -AA do CXX="$ac_save_CXX $ac_arg" if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_prog_cxx_cxx11=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cxx_cxx11" != "xno" && break done rm -f conftest.$ac_ext CXX=$ac_save_CXX fi if test "x$ac_cv_prog_cxx_cxx11" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cxx_cxx11" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 printf "%s\n" "$ac_cv_prog_cxx_cxx11" >&6; } CXX="$CXX $ac_cv_prog_cxx_cxx11" fi ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 ac_prog_cxx_stdcxx=cxx11 fi fi if test x$ac_prog_cxx_stdcxx = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 printf %s "checking for $CXX option to enable C++98 features... " >&6; } if test ${ac_cv_prog_cxx_98+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_prog_cxx_98=no ac_save_CXX=$CXX cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_cxx_conftest_cxx98_program _ACEOF for ac_arg in '' -std=gnu++98 -std=c++98 -qlanglvl=extended -AA do CXX="$ac_save_CXX $ac_arg" if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_prog_cxx_cxx98=$ac_arg fi rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cxx_cxx98" != "xno" && break done rm -f conftest.$ac_ext CXX=$ac_save_CXX fi if test "x$ac_cv_prog_cxx_cxx98" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 printf "%s\n" "unsupported" >&6; } else $as_nop if test "x$ac_cv_prog_cxx_cxx98" = x then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 printf "%s\n" "none needed" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 printf "%s\n" "$ac_cv_prog_cxx_cxx98" >&6; } CXX="$CXX $ac_cv_prog_cxx_cxx98" fi ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98 ac_prog_cxx_stdcxx=cxx98 fi fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu depcc="$CXX" 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_CXX_dependencies_compiler_type+y} then : printf %s "(cached) " >&6 else $as_nop 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_CXX_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 thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CXX_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 printf "%s\n" "$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then am__fastdepCXX_TRUE= am__fastdepCXX_FALSE='#' else am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; 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_RANLIB+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # 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_RANLIB="${ac_tool_prefix}ranlib" 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 fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 printf "%s\n" "$RANLIB" >&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_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; 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_RANLIB+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # 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_RANLIB="ranlib" 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 fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 printf "%s\n" "$ac_ct_RANLIB" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" 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 RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi # Extract the first word of "protoc", so it can be a program name with args. set dummy protoc; 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_PROTOC+y} then : printf %s "(cached) " >&6 else $as_nop case $PROTOC in [\\/]* | ?:[\\/]*) ac_cv_path_PROTOC="$PROTOC" # 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_PROTOC="$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 ;; esac fi PROTOC=$ac_cv_path_PROTOC if test -n "$PROTOC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PROTOC" >&5 printf "%s\n" "$PROTOC" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test x"$PROTOC" = x then : as_fn_error $? "cannot find protoc, the Protocol Buffers compiler" "$LINENO" 5 fi # automake 1.12 seems to require this, but automake 1.11 doesn't recognize it if test -n "$ac_tool_prefix"; then for ac_prog in ar lib "link -lib" 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_AR+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$AR"; then ac_cv_prog_AR="$AR" # 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_AR="$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 fi AR=$ac_cv_prog_AR if test -n "$AR"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 printf "%s\n" "$AR" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar lib "link -lib" 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_AR+y} then : printf %s "(cached) " >&6 else $as_nop if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # 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_AR="$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 fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 printf "%s\n" "$ac_ct_AR" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" 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 AR=$ac_ct_AR fi fi : ${AR=ar} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the archiver ($AR) interface" >&5 printf %s "checking the archiver ($AR) interface... " >&6; } if test ${am_cv_ar_interface+y} then : printf %s "(cached) " >&6 else $as_nop 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_cv_ar_interface=ar cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int some_variable = 0; _ACEOF if ac_fn_c_try_compile "$LINENO" then : am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 (eval $am_ar_try) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -eq 0; then am_cv_ar_interface=ar else am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$am_ar_try\""; } >&5 (eval $am_ar_try) 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -eq 0; then am_cv_ar_interface=lib else am_cv_ar_interface=unknown fi fi rm -f conftest.lib libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_ar_interface" >&5 printf "%s\n" "$am_cv_ar_interface" >&6; } case $am_cv_ar_interface in ar) ;; lib) # Microsoft lib, so override with the ar-lib wrapper script. # FIXME: It is wrong to rewrite AR. # 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__AR in this case, # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something # similar. AR="$am_aux_dir/ar-lib $AR" ;; unknown) as_fn_error $? "could not determine $AR interface" "$LINENO" 5 ;; esac # Protobuf 3.6+ requires C++11. if pkg-config --atleast-version 3.6.0 protobuf then : ax_cxx_compile_alternatives="11 0x" ax_cxx_compile_cxx11_required=true ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ac_success=no if test x$ac_success = xno; then for alternative in ${ax_cxx_compile_alternatives}; do switch="-std=gnu++${alternative}" cachevar=`printf "%s\n" "ax_cv_cxx_compile_cxx11_$switch" | $as_tr_sh` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features with $switch" >&5 printf %s "checking whether $CXX supports C++11 features with $switch... " >&6; } if eval test \${$cachevar+y} then : printf %s "(cached) " >&6 else $as_nop ac_save_CXX="$CXX" CXX="$CXX $switch" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ // If the compiler admits that it is not ready for C++11, why torture it? // Hopefully, this will speed up the test. #ifndef __cplusplus #error "This is not a C++ compiler" #elif __cplusplus < 201103L #error "This is not a C++11 compiler" #else namespace cxx11 { namespace test_static_assert { template struct check { static_assert(sizeof(int) <= sizeof(T), "not big enough"); }; } namespace test_final_override { struct Base { virtual void f() {} }; struct Derived : public Base { virtual void f() override {} }; } namespace test_double_right_angle_brackets { template < typename T > struct check {}; typedef check single_type; typedef check> double_type; typedef check>> triple_type; typedef check>>> quadruple_type; } namespace test_decltype { int f() { int a = 1; decltype(a) b = 2; return a + b; } } namespace test_type_deduction { template < typename T1, typename T2 > struct is_same { static const bool value = false; }; template < typename T > struct is_same { static const bool value = true; }; template < typename T1, typename T2 > auto add(T1 a1, T2 a2) -> decltype(a1 + a2) { return a1 + a2; } int test(const int c, volatile int v) { static_assert(is_same::value == true, ""); static_assert(is_same::value == false, ""); static_assert(is_same::value == false, ""); auto ac = c; auto av = v; auto sumi = ac + av + 'x'; auto sumf = ac + av + 1.0; static_assert(is_same::value == true, ""); static_assert(is_same::value == true, ""); static_assert(is_same::value == true, ""); static_assert(is_same::value == false, ""); static_assert(is_same::value == true, ""); return (sumf > 0.0) ? sumi : add(c, v); } } namespace test_noexcept { int f() { return 0; } int g() noexcept { return 0; } static_assert(noexcept(f()) == false, ""); static_assert(noexcept(g()) == true, ""); } namespace test_constexpr { template < typename CharT > unsigned long constexpr strlen_c_r(const CharT *const s, const unsigned long acc) noexcept { return *s ? strlen_c_r(s + 1, acc + 1) : acc; } template < typename CharT > unsigned long constexpr strlen_c(const CharT *const s) noexcept { return strlen_c_r(s, 0UL); } static_assert(strlen_c("") == 0UL, ""); static_assert(strlen_c("1") == 1UL, ""); static_assert(strlen_c("example") == 7UL, ""); static_assert(strlen_c("another\0example") == 7UL, ""); } namespace test_rvalue_references { template < int N > struct answer { static constexpr int value = N; }; answer<1> f(int&) { return answer<1>(); } answer<2> f(const int&) { return answer<2>(); } answer<3> f(int&&) { return answer<3>(); } void test() { int i = 0; const int c = 0; static_assert(decltype(f(i))::value == 1, ""); static_assert(decltype(f(c))::value == 2, ""); static_assert(decltype(f(0))::value == 3, ""); } } namespace test_uniform_initialization { struct test { static const int zero {}; static const int one {1}; }; static_assert(test::zero == 0, ""); static_assert(test::one == 1, ""); } namespace test_lambdas { void test1() { auto lambda1 = [](){}; auto lambda2 = lambda1; lambda1(); lambda2(); } int test2() { auto a = [](int i, int j){ return i + j; }(1, 2); auto b = []() -> int { return '0'; }(); auto c = [=](){ return a + b; }(); auto d = [&](){ return c; }(); auto e = [a, &b](int x) mutable { const auto identity = [](int y){ return y; }; for (auto i = 0; i < a; ++i) a += b--; return x + identity(a + b); }(0); return a + b + c + d + e; } int test3() { const auto nullary = [](){ return 0; }; const auto unary = [](int x){ return x; }; using nullary_t = decltype(nullary); using unary_t = decltype(unary); const auto higher1st = [](nullary_t f){ return f(); }; const auto higher2nd = [unary](nullary_t f1){ return [unary, f1](unary_t f2){ return f2(unary(f1())); }; }; return higher1st(nullary) + higher2nd(nullary)(unary); } } namespace test_variadic_templates { template struct sum; template struct sum { static constexpr auto value = N0 + sum::value; }; template <> struct sum<> { static constexpr auto value = 0; }; static_assert(sum<>::value == 0, ""); static_assert(sum<1>::value == 1, ""); static_assert(sum<23>::value == 23, ""); static_assert(sum<1, 2>::value == 3, ""); static_assert(sum<5, 5, 11>::value == 21, ""); static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); } // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function // because of this. namespace test_template_alias_sfinae { struct foo {}; template using member = typename T::member_type; template void func(...) {} template void func(member*) {} void test(); void test() { func(0); } } } // namespace cxx11 #endif // __cplusplus >= 201103L _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : eval $cachevar=yes else $as_nop eval $cachevar=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CXX="$ac_save_CXX" fi eval ac_res=\$$cachevar { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } if eval test x\$$cachevar = xyes; then CXX="$CXX $switch" if test -n "$CXXCPP" ; then CXXCPP="$CXXCPP $switch" fi ac_success=yes break fi done fi if test x$ac_success = xno; then for alternative in ${ax_cxx_compile_alternatives}; do for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do cachevar=`printf "%s\n" "ax_cv_cxx_compile_cxx11_$switch" | $as_tr_sh` { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features with $switch" >&5 printf %s "checking whether $CXX supports C++11 features with $switch... " >&6; } if eval test \${$cachevar+y} then : printf %s "(cached) " >&6 else $as_nop ac_save_CXX="$CXX" CXX="$CXX $switch" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ // If the compiler admits that it is not ready for C++11, why torture it? // Hopefully, this will speed up the test. #ifndef __cplusplus #error "This is not a C++ compiler" #elif __cplusplus < 201103L #error "This is not a C++11 compiler" #else namespace cxx11 { namespace test_static_assert { template struct check { static_assert(sizeof(int) <= sizeof(T), "not big enough"); }; } namespace test_final_override { struct Base { virtual void f() {} }; struct Derived : public Base { virtual void f() override {} }; } namespace test_double_right_angle_brackets { template < typename T > struct check {}; typedef check single_type; typedef check> double_type; typedef check>> triple_type; typedef check>>> quadruple_type; } namespace test_decltype { int f() { int a = 1; decltype(a) b = 2; return a + b; } } namespace test_type_deduction { template < typename T1, typename T2 > struct is_same { static const bool value = false; }; template < typename T > struct is_same { static const bool value = true; }; template < typename T1, typename T2 > auto add(T1 a1, T2 a2) -> decltype(a1 + a2) { return a1 + a2; } int test(const int c, volatile int v) { static_assert(is_same::value == true, ""); static_assert(is_same::value == false, ""); static_assert(is_same::value == false, ""); auto ac = c; auto av = v; auto sumi = ac + av + 'x'; auto sumf = ac + av + 1.0; static_assert(is_same::value == true, ""); static_assert(is_same::value == true, ""); static_assert(is_same::value == true, ""); static_assert(is_same::value == false, ""); static_assert(is_same::value == true, ""); return (sumf > 0.0) ? sumi : add(c, v); } } namespace test_noexcept { int f() { return 0; } int g() noexcept { return 0; } static_assert(noexcept(f()) == false, ""); static_assert(noexcept(g()) == true, ""); } namespace test_constexpr { template < typename CharT > unsigned long constexpr strlen_c_r(const CharT *const s, const unsigned long acc) noexcept { return *s ? strlen_c_r(s + 1, acc + 1) : acc; } template < typename CharT > unsigned long constexpr strlen_c(const CharT *const s) noexcept { return strlen_c_r(s, 0UL); } static_assert(strlen_c("") == 0UL, ""); static_assert(strlen_c("1") == 1UL, ""); static_assert(strlen_c("example") == 7UL, ""); static_assert(strlen_c("another\0example") == 7UL, ""); } namespace test_rvalue_references { template < int N > struct answer { static constexpr int value = N; }; answer<1> f(int&) { return answer<1>(); } answer<2> f(const int&) { return answer<2>(); } answer<3> f(int&&) { return answer<3>(); } void test() { int i = 0; const int c = 0; static_assert(decltype(f(i))::value == 1, ""); static_assert(decltype(f(c))::value == 2, ""); static_assert(decltype(f(0))::value == 3, ""); } } namespace test_uniform_initialization { struct test { static const int zero {}; static const int one {1}; }; static_assert(test::zero == 0, ""); static_assert(test::one == 1, ""); } namespace test_lambdas { void test1() { auto lambda1 = [](){}; auto lambda2 = lambda1; lambda1(); lambda2(); } int test2() { auto a = [](int i, int j){ return i + j; }(1, 2); auto b = []() -> int { return '0'; }(); auto c = [=](){ return a + b; }(); auto d = [&](){ return c; }(); auto e = [a, &b](int x) mutable { const auto identity = [](int y){ return y; }; for (auto i = 0; i < a; ++i) a += b--; return x + identity(a + b); }(0); return a + b + c + d + e; } int test3() { const auto nullary = [](){ return 0; }; const auto unary = [](int x){ return x; }; using nullary_t = decltype(nullary); using unary_t = decltype(unary); const auto higher1st = [](nullary_t f){ return f(); }; const auto higher2nd = [unary](nullary_t f1){ return [unary, f1](unary_t f2){ return f2(unary(f1())); }; }; return higher1st(nullary) + higher2nd(nullary)(unary); } } namespace test_variadic_templates { template struct sum; template struct sum { static constexpr auto value = N0 + sum::value; }; template <> struct sum<> { static constexpr auto value = 0; }; static_assert(sum<>::value == 0, ""); static_assert(sum<1>::value == 1, ""); static_assert(sum<23>::value == 23, ""); static_assert(sum<1, 2>::value == 3, ""); static_assert(sum<5, 5, 11>::value == 21, ""); static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); } // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function // because of this. namespace test_template_alias_sfinae { struct foo {}; template using member = typename T::member_type; template void func(...) {} template void func(member*) {} void test(); void test() { func(0); } } } // namespace cxx11 #endif // __cplusplus >= 201103L _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : eval $cachevar=yes else $as_nop eval $cachevar=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CXX="$ac_save_CXX" fi eval ac_res=\$$cachevar { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } if eval test x\$$cachevar = xyes; then CXX="$CXX $switch" if test -n "$CXXCPP" ; then CXXCPP="$CXXCPP $switch" fi ac_success=yes break fi done if test x$ac_success = xyes; then break fi done fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test x$ax_cxx_compile_cxx11_required = xtrue; then if test x$ac_success = xno; then as_fn_error $? "*** A compiler with support for C++11 language features is required." "$LINENO" 5 fi fi if test x$ac_success = xno; then HAVE_CXX11=0 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: No compiler with C++11 support was found" >&5 printf "%s\n" "$as_me: No compiler with C++11 support was found" >&6;} else HAVE_CXX11=1 printf "%s\n" "#define HAVE_CXX11 1" >>confdefs.h fi fi WARNING_CXXFLAGS="" PICKY_CXXFLAGS="" DISTCHECK_CXXFLAGS="" # Check whether --enable-compile-warnings was given. if test ${enable_compile_warnings+y} then : enableval=$enable_compile_warnings; case "$enableval" in no) ;; '' | yes) WARNING_CXXFLAGS="-Wall" ;; maximum) WARNING_CXXFLAGS="-Wall" PICKY_CXXFLAGS="-Wextra -pedantic -Wno-long-long -Weffc++ -Wmissing-declarations" ;; error) # remove -Wno-c++17-extensions once protocolbuffers/protobuf#9181 is # resolved # remove -Wno-unused-parameter once # protocolbuffers/protobuf#10357 is resolved WARNING_CXXFLAGS="-Wall -Werror -Wno-c++17-extensions" PICKY_CXXFLAGS="-Wextra -pedantic -Wno-long-long -Weffc++ -Wmissing-declarations -Wno-unused-parameter" ;; distcheck) WARNING_CXXFLAGS="-Wall -Werror" PICKY_CXXFLAGS="-Wextra -pedantic -Wno-long-long -Weffc++ -Wmissing-declarations" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -Wno-error=unused-parameter" >&5 printf %s "checking whether C++ compiler accepts -Wno-error=unused-parameter... " >&6; } if test ${ax_cv_check_cxxflags__Werror__Wno_error_unused_parameter+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror -Wno-error=unused-parameter" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ax_cv_check_cxxflags__Werror__Wno_error_unused_parameter=yes else $as_nop ax_cv_check_cxxflags__Werror__Wno_error_unused_parameter=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cxxflags__Werror__Wno_error_unused_parameter" >&5 printf "%s\n" "$ax_cv_check_cxxflags__Werror__Wno_error_unused_parameter" >&6; } if test x"$ax_cv_check_cxxflags__Werror__Wno_error_unused_parameter" = xyes then : PICKY_CXXFLAGS="$PICKY_CXXFLAGS -Wno-error=unused-parameter" else $as_nop : fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -Wno-error=c++11-extensions" >&5 printf %s "checking whether C++ compiler accepts -Wno-error=c++11-extensions... " >&6; } if test ${ax_cv_check_cxxflags__Werror__Wno_error_cpp11_extensions+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror -Wno-error=c++11-extensions" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ax_cv_check_cxxflags__Werror__Wno_error_cpp11_extensions=yes else $as_nop ax_cv_check_cxxflags__Werror__Wno_error_cpp11_extensions=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cxxflags__Werror__Wno_error_cpp11_extensions" >&5 printf "%s\n" "$ax_cv_check_cxxflags__Werror__Wno_error_cpp11_extensions" >&6; } if test x"$ax_cv_check_cxxflags__Werror__Wno_error_cpp11_extensions" = xyes then : PICKY_CXXFLAGS="$PICKY_CXXFLAGS -Wno-error=c++11-extensions" else $as_nop : fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -Wno-error=deprecated-declarations" >&5 printf %s "checking whether C++ compiler accepts -Wno-error=deprecated-declarations... " >&6; } if test ${ax_cv_check_cxxflags__Werror__Wno_error_deprecated_declarations+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror -Wno-error=deprecated-declarations" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ax_cv_check_cxxflags__Werror__Wno_error_deprecated_declarations=yes else $as_nop ax_cv_check_cxxflags__Werror__Wno_error_deprecated_declarations=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cxxflags__Werror__Wno_error_deprecated_declarations" >&5 printf "%s\n" "$ax_cv_check_cxxflags__Werror__Wno_error_deprecated_declarations" >&6; } if test x"$ax_cv_check_cxxflags__Werror__Wno_error_deprecated_declarations" = xyes then : PICKY_CXXFLAGS="$PICKY_CXXFLAGS -Wno-error=deprecated-declarations" else $as_nop : fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -Wno-error=nested-anon-types" >&5 printf %s "checking whether C++ compiler accepts -Wno-error=nested-anon-types... " >&6; } if test ${ax_cv_check_cxxflags__Werror__Wno_error_nested_anon_types+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror -Wno-error=nested-anon-types" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ax_cv_check_cxxflags__Werror__Wno_error_nested_anon_types=yes else $as_nop ax_cv_check_cxxflags__Werror__Wno_error_nested_anon_types=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cxxflags__Werror__Wno_error_nested_anon_types" >&5 printf "%s\n" "$ax_cv_check_cxxflags__Werror__Wno_error_nested_anon_types" >&6; } if test x"$ax_cv_check_cxxflags__Werror__Wno_error_nested_anon_types" = xyes then : PICKY_CXXFLAGS="$PICKY_CXXFLAGS -Wno-error=nested-anon-types" else $as_nop : fi ;; *) as_fn_error $? "Unknown argument '$enableval' to --enable-compile-warnings" "$LINENO" 5 ;; esac else $as_nop WARNING_CXXFLAGS="-Wall" fi # Check for fuzzing support before the flag wrapper, because if # requested and missing the functionality is entirely nonexistent. MISC_CXXFLAGS="" # Check whether --enable-fuzzing was given. if test ${enable_fuzzing+y} then : enableval=$enable_fuzzing; fuzzing="$enableval" case "$enableval" in no) ;; '' | yes | libfuzzer) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -fsanitize=fuzzer" >&5 printf %s "checking whether C++ compiler accepts -fsanitize=fuzzer... " >&6; } if test ${ax_cv_check_cxxflags__Werror__fsanitize_fuzzer+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror -fsanitize=fuzzer" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ax_cv_check_cxxflags__Werror__fsanitize_fuzzer=yes else $as_nop ax_cv_check_cxxflags__Werror__fsanitize_fuzzer=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cxxflags__Werror__fsanitize_fuzzer" >&5 printf "%s\n" "$ax_cv_check_cxxflags__Werror__fsanitize_fuzzer" >&6; } if test x"$ax_cv_check_cxxflags__Werror__fsanitize_fuzzer" = xyes then : FUZZING_CFLAGS="$FUZZING_CFLAGS -fsanitize=fuzzer" else $as_nop as_fn_error $? "Fuzzing requested, but compiler support not present" "$LINENO" 5 fi ;; *) as_fn_error $? "\"Unknown argument '$enableval' to --enable-fuzzing" "$LINENO" 5 ;; esac else $as_nop fuzzing="no" fi if test x"$fuzzing" != xno; then ENABLE_FUZZING_TRUE= ENABLE_FUZZING_FALSE='#' else ENABLE_FUZZING_TRUE='#' ENABLE_FUZZING_FALSE= fi # Check whether --enable-asan was given. if test ${enable_asan+y} then : enableval=$enable_asan; asan="$enableval" else $as_nop asan="no" fi if test x"$asan" != x"no" then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -fsanitize=address,leak" >&5 printf %s "checking whether C++ compiler accepts -fsanitize=address,leak... " >&6; } if test ${ax_cv_check_cxxflags__Werror__fsanitize_address_leak+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror -fsanitize=address,leak" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ax_cv_check_cxxflags__Werror__fsanitize_address_leak=yes else $as_nop ax_cv_check_cxxflags__Werror__fsanitize_address_leak=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cxxflags__Werror__fsanitize_address_leak" >&5 printf "%s\n" "$ax_cv_check_cxxflags__Werror__fsanitize_address_leak" >&6; } if test x"$ax_cv_check_cxxflags__Werror__fsanitize_address_leak" = xyes then : MISC_CXXFLAGS="$MISC_CXXFLAGS -fsanitize=address,leak" else $as_nop as_fn_error $? "ASAN requested, but compiler support not present" "$LINENO" 5 fi fi # We want to check for compiler flag support, but there is no way to make # clang's "argument unused" warning fatal. So we invoke the compiler through a # wrapper script that greps for this message. saved_CXX="$CXX" saved_LD="$LD" flag_wrap="$srcdir/scripts/wrap-compiler-for-flag-check" CXX="$flag_wrap $CXX" LD="$flag_wrap $LD" # Check whether --enable-hardening was given. if test ${enable_hardening+y} then : enableval=$enable_hardening; hardening="$enableval" else $as_nop hardening="yes" fi HARDEN_CFLAGS="" HARDEN_LDFLAGS="" if test x"$hardening" != x"no" then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -fno-strict-overflow" >&5 printf %s "checking whether C++ compiler accepts -fno-strict-overflow... " >&6; } if test ${ax_cv_check_cxxflags__Werror___fno_strict_overflow+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror -fno-strict-overflow" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ax_cv_check_cxxflags__Werror___fno_strict_overflow=yes else $as_nop ax_cv_check_cxxflags__Werror___fno_strict_overflow=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cxxflags__Werror___fno_strict_overflow" >&5 printf "%s\n" "$ax_cv_check_cxxflags__Werror___fno_strict_overflow" >&6; } if test x"$ax_cv_check_cxxflags__Werror___fno_strict_overflow" = xyes then : HARDEN_CFLAGS="$HARDEN_CFLAGS -fno-strict-overflow" else $as_nop : fi # This one will likely succeed, even on platforms where it does nothing. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -D_FORTIFY_SOURCE=2" >&5 printf %s "checking whether C++ compiler accepts -D_FORTIFY_SOURCE=2... " >&6; } if test ${ax_cv_check_cxxflags__Werror___D_FORTIFY_SOURCE_2+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror -D_FORTIFY_SOURCE=2" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ax_cv_check_cxxflags__Werror___D_FORTIFY_SOURCE_2=yes else $as_nop ax_cv_check_cxxflags__Werror___D_FORTIFY_SOURCE_2=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cxxflags__Werror___D_FORTIFY_SOURCE_2" >&5 printf "%s\n" "$ax_cv_check_cxxflags__Werror___D_FORTIFY_SOURCE_2" >&6; } if test x"$ax_cv_check_cxxflags__Werror___D_FORTIFY_SOURCE_2" = xyes then : HARDEN_CFLAGS="$HARDEN_CFLAGS -D_FORTIFY_SOURCE=2" else $as_nop : fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts -fstack-protector-all" >&5 printf %s "checking whether the linker accepts -fstack-protector-all... " >&6; } if test ${ax_cv_check_ldflags__Werror___fstack_protector_all+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$LDFLAGS LDFLAGS="$LDFLAGS -Werror -fstack-protector-all" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : ax_cv_check_ldflags__Werror___fstack_protector_all=yes else $as_nop ax_cv_check_ldflags__Werror___fstack_protector_all=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_ldflags__Werror___fstack_protector_all" >&5 printf "%s\n" "$ax_cv_check_ldflags__Werror___fstack_protector_all" >&6; } if test x"$ax_cv_check_ldflags__Werror___fstack_protector_all" = xyes then : HARDEN_CFLAGS="$HARDEN_CFLAGS -fstack-protector-all" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -Wstack-protector" >&5 printf %s "checking whether C++ compiler accepts -Wstack-protector... " >&6; } if test ${ax_cv_check_cxxflags__Werror__fstack_protector_all__Wstack_protector+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror -fstack-protector-all -Wstack-protector" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ax_cv_check_cxxflags__Werror__fstack_protector_all__Wstack_protector=yes else $as_nop ax_cv_check_cxxflags__Werror__fstack_protector_all__Wstack_protector=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cxxflags__Werror__fstack_protector_all__Wstack_protector" >&5 printf "%s\n" "$ax_cv_check_cxxflags__Werror__fstack_protector_all__Wstack_protector" >&6; } if test x"$ax_cv_check_cxxflags__Werror__fstack_protector_all__Wstack_protector" = xyes then : HARDEN_CFLAGS="$HARDEN_CFLAGS -Wstack-protector" else $as_nop : fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts --param ssp-buffer-size=1" >&5 printf %s "checking whether C++ compiler accepts --param ssp-buffer-size=1... " >&6; } if test ${ax_cv_check_cxxflags__Werror__fstack_protector_all___param_ssp_buffer_size_1+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror -fstack-protector-all --param ssp-buffer-size=1" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ax_cv_check_cxxflags__Werror__fstack_protector_all___param_ssp_buffer_size_1=yes else $as_nop ax_cv_check_cxxflags__Werror__fstack_protector_all___param_ssp_buffer_size_1=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cxxflags__Werror__fstack_protector_all___param_ssp_buffer_size_1" >&5 printf "%s\n" "$ax_cv_check_cxxflags__Werror__fstack_protector_all___param_ssp_buffer_size_1" >&6; } if test x"$ax_cv_check_cxxflags__Werror__fstack_protector_all___param_ssp_buffer_size_1" = xyes then : HARDEN_CFLAGS="$HARDEN_CFLAGS --param ssp-buffer-size=1" else $as_nop : fi else $as_nop : fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -fPIE" >&5 printf %s "checking whether C++ compiler accepts -fPIE... " >&6; } if test ${ax_cv_check_cxxflags__Werror___fPIE+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror -fPIE" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ax_cv_check_cxxflags__Werror___fPIE=yes else $as_nop ax_cv_check_cxxflags__Werror___fPIE=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cxxflags__Werror___fPIE" >&5 printf "%s\n" "$ax_cv_check_cxxflags__Werror___fPIE" >&6; } if test x"$ax_cv_check_cxxflags__Werror___fPIE" = xyes then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts -fPIE -pie" >&5 printf %s "checking whether the linker accepts -fPIE -pie... " >&6; } if test ${ax_cv_check_ldflags__Werror___fPIE__pie+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$LDFLAGS LDFLAGS="$LDFLAGS -Werror -fPIE -pie" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : ax_cv_check_ldflags__Werror___fPIE__pie=yes else $as_nop ax_cv_check_ldflags__Werror___fPIE__pie=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_ldflags__Werror___fPIE__pie" >&5 printf "%s\n" "$ax_cv_check_ldflags__Werror___fPIE__pie" >&6; } if test x"$ax_cv_check_ldflags__Werror___fPIE__pie" = xyes then : HARDEN_CFLAGS="$HARDEN_CFLAGS -fPIE" HARDEN_LDFLAGS="$HARDEN_LDFLAGS -pie" else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts -fPIE -Wl,-pie" >&5 printf %s "checking whether the linker accepts -fPIE -Wl,-pie... " >&6; } if test ${ax_cv_check_ldflags__Werror___fPIE__Wl__pie+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$LDFLAGS LDFLAGS="$LDFLAGS -Werror -fPIE -Wl,-pie" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : ax_cv_check_ldflags__Werror___fPIE__Wl__pie=yes else $as_nop ax_cv_check_ldflags__Werror___fPIE__Wl__pie=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_ldflags__Werror___fPIE__Wl__pie" >&5 printf "%s\n" "$ax_cv_check_ldflags__Werror___fPIE__Wl__pie" >&6; } if test x"$ax_cv_check_ldflags__Werror___fPIE__Wl__pie" = xyes then : HARDEN_CFLAGS="$HARDEN_CFLAGS -fPIE" HARDEN_LDFLAGS="$HARDEN_LDFLAGS -Wl,-pie" else $as_nop : fi fi else $as_nop : fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts -Wl,-z,relro" >&5 printf %s "checking whether the linker accepts -Wl,-z,relro... " >&6; } if test ${ax_cv_check_ldflags__Werror___Wl__z_relro+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$LDFLAGS LDFLAGS="$LDFLAGS -Werror -Wl,-z,relro" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : ax_cv_check_ldflags__Werror___Wl__z_relro=yes else $as_nop ax_cv_check_ldflags__Werror___Wl__z_relro=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_ldflags__Werror___Wl__z_relro" >&5 printf "%s\n" "$ax_cv_check_ldflags__Werror___Wl__z_relro" >&6; } if test x"$ax_cv_check_ldflags__Werror___Wl__z_relro" = xyes then : HARDEN_LDFLAGS="$HARDEN_LDFLAGS -Wl,-z,relro" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts -Wl,-z,now" >&5 printf %s "checking whether the linker accepts -Wl,-z,now... " >&6; } if test ${ax_cv_check_ldflags__Werror___Wl__z_now+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$LDFLAGS LDFLAGS="$LDFLAGS -Werror -Wl,-z,now" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : ax_cv_check_ldflags__Werror___Wl__z_now=yes else $as_nop ax_cv_check_ldflags__Werror___Wl__z_now=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_ldflags__Werror___Wl__z_now" >&5 printf "%s\n" "$ax_cv_check_ldflags__Werror___Wl__z_now" >&6; } if test x"$ax_cv_check_ldflags__Werror___Wl__z_now" = xyes then : HARDEN_LDFLAGS="$HARDEN_LDFLAGS -Wl,-z,now" else $as_nop : fi else $as_nop : fi fi # Also check for a few non-hardening-related flags. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -fno-default-inline" >&5 printf %s "checking whether C++ compiler accepts -fno-default-inline... " >&6; } if test ${ax_cv_check_cxxflags__Werror__fno_default_inline+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror -fno-default-inline" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ax_cv_check_cxxflags__Werror__fno_default_inline=yes else $as_nop ax_cv_check_cxxflags__Werror__fno_default_inline=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cxxflags__Werror__fno_default_inline" >&5 printf "%s\n" "$ax_cv_check_cxxflags__Werror__fno_default_inline" >&6; } if test x"$ax_cv_check_cxxflags__Werror__fno_default_inline" = xyes then : MISC_CXXFLAGS="$MISC_CXXFLAGS -fno-default-inline" else $as_nop : fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -pipe" >&5 printf %s "checking whether C++ compiler accepts -pipe... " >&6; } if test ${ax_cv_check_cxxflags__Werror__pipe+y} then : printf %s "(cached) " >&6 else $as_nop ax_check_save_flags=$CXXFLAGS CXXFLAGS="$CXXFLAGS -Werror -pipe" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ax_cv_check_cxxflags__Werror__pipe=yes else $as_nop ax_cv_check_cxxflags__Werror__pipe=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CXXFLAGS=$ax_check_save_flags fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cxxflags__Werror__pipe" >&5 printf "%s\n" "$ax_cv_check_cxxflags__Werror__pipe" >&6; } if test x"$ax_cv_check_cxxflags__Werror__pipe" = xyes then : MISC_CXXFLAGS="$MISC_CXXFLAGS -pipe" else $as_nop : fi # End of flag tests. CXX="$saved_CXX" LD="$saved_LD" # Check whether --enable-client was given. if test ${enable_client+y} then : enableval=$enable_client; build_client="$enableval" else $as_nop build_client="yes" fi if test x"$build_client" != xno; then BUILD_CLIENT_TRUE= BUILD_CLIENT_FALSE='#' else BUILD_CLIENT_TRUE='#' BUILD_CLIENT_FALSE= fi # Check whether --enable-server was given. if test ${enable_server+y} then : enableval=$enable_server; build_server="$enableval" else $as_nop build_server="yes" fi if test x"$build_server" != xno; then BUILD_SERVER_TRUE= BUILD_SERVER_FALSE='#' else BUILD_SERVER_TRUE='#' BUILD_SERVER_FALSE= fi # Check whether --enable-examples was given. if test ${enable_examples+y} then : enableval=$enable_examples; build_examples="$enableval" else $as_nop build_examples="no" fi if test x"$build_examples" != xno; then BUILD_EXAMPLES_TRUE= BUILD_EXAMPLES_FALSE='#' else BUILD_EXAMPLES_TRUE='#' BUILD_EXAMPLES_FALSE= fi # Check whether --enable-ufw was given. if test ${enable_ufw+y} then : enableval=$enable_ufw; install_ufw="$enableval" else $as_nop install_ufw="no" fi if test x"$install_ufw" != xno; then INSTALL_UFW_TRUE= INSTALL_UFW_FALSE='#' else INSTALL_UFW_TRUE='#' INSTALL_UFW_FALSE= fi # Check whether --enable-completion was given. if test ${enable_completion+y} then : enableval=$enable_completion; install_completion="$enableval" else $as_nop install_completion="no" fi if test x"$install_completion" != xno; then INSTALL_COMPLETION_TRUE= INSTALL_COMPLETION_FALSE='#' else INSTALL_COMPLETION_TRUE='#' INSTALL_COMPLETION_FALSE= fi # Check whether --enable-syslog was given. if test ${enable_syslog+y} then : enableval=$enable_syslog; enable_syslog="$enableval" else $as_nop enable_syslog="no" fi ac_header= ac_cache= for ac_item in $ac_header_cxx_list do if test $ac_cache; then ac_fn_cxx_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 if test x"$enable_syslog" != xno then : for ac_header in syslog.h do : ac_fn_cxx_check_header_compile "$LINENO" "syslog.h" "ac_cv_header_syslog_h" "$ac_includes_default" if test "x$ac_cv_header_syslog_h" = xyes then : printf "%s\n" "#define HAVE_SYSLOG_H 1" >>confdefs.h printf "%s\n" "#define HAVE_SYSLOG 1" >>confdefs.h else $as_nop if test x"$enable_syslog" = xcheck then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Unable to find syslog.h." >&5 printf "%s\n" "$as_me: WARNING: Unable to find syslog.h." >&2;} else $as_nop as_fn_error $? "--enable-syslog was given but syslog.h was not found." "$LINENO" 5 fi fi done fi # Checks for libraries. # Check whether --enable-static-libraries was given. if test ${enable_static_libraries+y} then : enableval=$enable_static_libraries; fi # Check whether --enable-static-libstdc++ was given. if test ${enable_static_libstdc__+y} then : enableval=$enable_static_libstdc__; else $as_nop enable_static_libstdc__="$enable_static_libraries" fi if test "$enable_static_libstdc__" = yes then : LDFLAGS="$LDFLAGS -static-libstdc++" fi # Check whether --enable-static-libgcc was given. if test ${enable_static_libgcc+y} then : enableval=$enable_static_libgcc; else $as_nop enable_static_libgcc="$enable_static_libraries" fi if test "$enable_static_libgcc" = yes then : LDFLAGS="$LDFLAGS -static-libgcc" fi # Check whether --with-utempter was given. if test ${with_utempter+y} then : withval=$with_utempter; with_utempter="$withval" else $as_nop with_utempter="check" fi # Check whether --enable-static-utempter was given. if test ${enable_static_utempter+y} then : enableval=$enable_static_utempter; else $as_nop enable_static_utempter="$enable_static_libraries" fi if test x"$with_utempter" != xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for utempter_remove_record in -lutempter" >&5 printf %s "checking for utempter_remove_record in -lutempter... " >&6; } if test ${ac_cv_lib_utempter_utempter_remove_record+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lutempter $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ namespace conftest { extern "C" int utempter_remove_record (); } int main (void) { return conftest::utempter_remove_record (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : ac_cv_lib_utempter_utempter_remove_record=yes else $as_nop ac_cv_lib_utempter_utempter_remove_record=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_utempter_utempter_remove_record" >&5 printf "%s\n" "$ac_cv_lib_utempter_utempter_remove_record" >&6; } if test "x$ac_cv_lib_utempter_utempter_remove_record" = xyes then : UTEMPTER_LIBS=-lutempter if test "$enable_static_utempter" = yes then : UTEMPTER_LIBS="-Wl,-Bstatic $UTEMPTER_LIBS -Wl,-Bdynamic" fi LIBS="$UTEMPTER_LIBS $LIBS" printf "%s\n" "#define HAVE_UTEMPTER 1" >>confdefs.h else $as_nop if test x"$with_utempter" = xcheck then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Unable to find libutempter; utmp entries will not be made." >&5 printf "%s\n" "$as_me: WARNING: Unable to find libutempter; utmp entries will not be made." >&2;} else $as_nop as_fn_error $? "--with-utempter was given but libutempter was not found." "$LINENO" 5 fi fi fi # Check whether --enable-static-zlib was given. if test ${enable_static_zlib+y} then : enableval=$enable_static_zlib; else $as_nop enable_static_zlib="$enable_static_libraries" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for compress in -lz" >&5 printf %s "checking for compress in -lz... " >&6; } if test ${ac_cv_lib_z_compress+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lz $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ namespace conftest { extern "C" int compress (); } int main (void) { return conftest::compress (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : ac_cv_lib_z_compress=yes else $as_nop ac_cv_lib_z_compress=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_compress" >&5 printf "%s\n" "$ac_cv_lib_z_compress" >&6; } if test "x$ac_cv_lib_z_compress" = xyes then : ZLIB_LIBS=-lz if test "$enable_static_zlib" = yes then : ZLIB_LIBS="-Wl,-Bstatic $ZLIB_LIBS -Wl,-Bdynamic" fi LIBS="$ZLIB_LIBS $LIBS" else $as_nop as_fn_error $? "Unable to find zlib." "$LINENO" 5 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5 printf %s "checking for library containing socket... " >&6; } if test ${ac_cv_search_socket+y} then : printf %s "(cached) " >&6 else $as_nop ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ namespace conftest { extern "C" int socket (); } int main (void) { return conftest::socket (); ; return 0; } _ACEOF for ac_lib in '' socket network do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_cxx_try_link "$LINENO" then : ac_cv_search_socket=$ac_res fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext if test ${ac_cv_search_socket+y} then : break fi done if test ${ac_cv_search_socket+y} then : else $as_nop ac_cv_search_socket=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_socket" >&5 printf "%s\n" "$ac_cv_search_socket" >&6; } ac_res=$ac_cv_search_socket if test "$ac_res" != no then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing inet_addr" >&5 printf %s "checking for library containing inet_addr... " >&6; } if test ${ac_cv_search_inet_addr+y} then : printf %s "(cached) " >&6 else $as_nop ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ namespace conftest { extern "C" int inet_addr (); } int main (void) { return conftest::inet_addr (); ; return 0; } _ACEOF for ac_lib in '' nsl do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_cxx_try_link "$LINENO" then : ac_cv_search_inet_addr=$ac_res fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext if test ${ac_cv_search_inet_addr+y} then : break fi done if test ${ac_cv_search_inet_addr+y} then : else $as_nop ac_cv_search_inet_addr=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_inet_addr" >&5 printf "%s\n" "$ac_cv_search_inet_addr" >&6; } ac_res=$ac_cv_search_inet_addr if test "$ac_res" != no then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5 printf %s "checking for library containing clock_gettime... " >&6; } if test ${ac_cv_search_clock_gettime+y} then : printf %s "(cached) " >&6 else $as_nop ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ namespace conftest { extern "C" int clock_gettime (); } int main (void) { return conftest::clock_gettime (); ; return 0; } _ACEOF for ac_lib in '' rt do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_cxx_try_link "$LINENO" then : ac_cv_search_clock_gettime=$ac_res fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext if test ${ac_cv_search_clock_gettime+y} then : break fi done if test ${ac_cv_search_clock_gettime+y} then : else $as_nop ac_cv_search_clock_gettime=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5 printf "%s\n" "$ac_cv_search_clock_gettime" >&6; } ac_res=$ac_cv_search_clock_gettime if test "$ac_res" != no then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi # Checks for header files. for ac_header in fcntl.h langinfo.h limits.h locale.h netdb.h netinet/in.h stddef.h stdint.h inttypes.h stdlib.h string.h sys/ioctl.h sys/resource.h sys/socket.h sys/stat.h sys/time.h termios.h unistd.h wchar.h wctype.h do : as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_cxx_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes" then : cat >>confdefs.h <<_ACEOF #define `printf "%s\n" "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF else $as_nop as_fn_error $? "Missing required header file." "$LINENO" 5 fi done ac_fn_cxx_check_header_compile "$LINENO" "pty.h" "ac_cv_header_pty_h" "$ac_includes_default" if test "x$ac_cv_header_pty_h" = xyes then : printf "%s\n" "#define HAVE_PTY_H 1" >>confdefs.h fi ac_fn_cxx_check_header_compile "$LINENO" "util.h" "ac_cv_header_util_h" "$ac_includes_default" if test "x$ac_cv_header_util_h" = xyes then : printf "%s\n" "#define HAVE_UTIL_H 1" >>confdefs.h fi ac_fn_cxx_check_header_compile "$LINENO" "libutil.h" "ac_cv_header_libutil_h" "$ac_includes_default" if test "x$ac_cv_header_libutil_h" = xyes then : printf "%s\n" "#define HAVE_LIBUTIL_H 1" >>confdefs.h fi ac_fn_cxx_check_header_compile "$LINENO" "paths.h" "ac_cv_header_paths_h" "$ac_includes_default" if test "x$ac_cv_header_paths_h" = xyes then : printf "%s\n" "#define HAVE_PATHS_H 1" >>confdefs.h fi ac_fn_cxx_check_header_compile "$LINENO" "endian.h" "ac_cv_header_endian_h" "$ac_includes_default" if test "x$ac_cv_header_endian_h" = xyes then : printf "%s\n" "#define HAVE_ENDIAN_H 1" >>confdefs.h fi ac_fn_cxx_check_header_compile "$LINENO" "sys/endian.h" "ac_cv_header_sys_endian_h" "$ac_includes_default" if test "x$ac_cv_header_sys_endian_h" = xyes then : printf "%s\n" "#define HAVE_SYS_ENDIAN_H 1" >>confdefs.h fi ac_fn_cxx_check_header_compile "$LINENO" "utmpx.h" "ac_cv_header_utmpx_h" "$ac_includes_default" if test "x$ac_cv_header_utmpx_h" = xyes then : printf "%s\n" "#define HAVE_UTMPX_H 1" >>confdefs.h fi ac_fn_cxx_check_header_compile "$LINENO" "termio.h" "ac_cv_header_termio_h" "$ac_includes_default" if test "x$ac_cv_header_termio_h" = xyes then : printf "%s\n" "#define HAVE_TERMIO_H 1" >>confdefs.h fi ac_fn_cxx_check_header_compile "$LINENO" "sys/uio.h" "ac_cv_header_sys_uio_h" "$ac_includes_default" if test "x$ac_cv_header_sys_uio_h" = xyes then : printf "%s\n" "#define HAVE_SYS_UIO_H 1" >>confdefs.h fi ac_fn_cxx_check_header_compile "$LINENO" "memory" "ac_cv_header_memory" "$ac_includes_default" if test "x$ac_cv_header_memory" = xyes then : printf "%s\n" "#define HAVE_MEMORY 1" >>confdefs.h fi ac_fn_cxx_check_header_compile "$LINENO" "tr1/memory" "ac_cv_header_tr1_memory" "$ac_includes_default" if test "x$ac_cv_header_tr1_memory" = xyes then : printf "%s\n" "#define HAVE_TR1_MEMORY 1" >>confdefs.h fi # Checks for typedefs, structures, and compiler characteristics. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 printf %s "checking for inline... " >&6; } if test ${ac_cv_c_inline+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo (void) {return 0; } $ac_kw foo_t foo (void) {return 0; } #endif _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_c_inline=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 printf "%s\n" "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac ac_fn_c_find_intX_t "$LINENO" "64" "ac_cv_c_int64_t" case $ac_cv_c_int64_t in #( no|yes) ;; #( *) printf "%s\n" "#define int64_t $ac_cv_c_int64_t" >>confdefs.h ;; esac ac_fn_cxx_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default " if test "x$ac_cv_type_pid_t" = xyes then : else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined _WIN64 && !defined __CYGWIN__ LLP64 #endif int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ac_pid_type='int' else $as_nop ac_pid_type='__int64' fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext printf "%s\n" "#define pid_t $ac_pid_type" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5 printf %s "checking for C/C++ restrict keyword... " >&6; } if test ${ac_cv_c_restrict+y} then : printf %s "(cached) " >&6 else $as_nop ac_cv_c_restrict=no # Put '__restrict__' first, to avoid problems with glibc and non-GCC; see: # https://lists.gnu.org/archive/html/bug-autoconf/2016-02/msg00006.html # Put 'restrict' last, because C++ lacks it. for ac_kw in __restrict__ __restrict _Restrict restrict; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ typedef int *int_ptr; int foo (int_ptr $ac_kw ip) { return ip[0]; } int bar (int [$ac_kw]); /* Catch GCC bug 14050. */ int bar (int ip[$ac_kw]) { return ip[0]; } int main (void) { int s[1]; int *$ac_kw t = s; t[0] = 0; return foo (t) + bar (t); ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : ac_cv_c_restrict=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext test "$ac_cv_c_restrict" != no && break done fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_restrict" >&5 printf "%s\n" "$ac_cv_c_restrict" >&6; } case $ac_cv_c_restrict in restrict) ;; no) printf "%s\n" "#define restrict /**/" >>confdefs.h ;; *) printf "%s\n" "#define restrict $ac_cv_c_restrict" >>confdefs.h ;; esac ac_fn_cxx_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes then : else $as_nop printf "%s\n" "#define size_t unsigned int" >>confdefs.h fi ac_fn_cxx_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" if test "x$ac_cv_type_ssize_t" = xyes then : else $as_nop printf "%s\n" "#define ssize_t int" >>confdefs.h fi ac_fn_c_find_uintX_t "$LINENO" "16" "ac_cv_c_uint16_t" case $ac_cv_c_uint16_t in #( no|yes) ;; #( *) printf "%s\n" "#define uint16_t $ac_cv_c_uint16_t" >>confdefs.h ;; esac ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t" case $ac_cv_c_uint32_t in #( no|yes) ;; #( *) printf "%s\n" "#define _UINT32_T 1" >>confdefs.h printf "%s\n" "#define uint32_t $ac_cv_c_uint32_t" >>confdefs.h ;; esac ac_fn_c_find_uintX_t "$LINENO" "64" "ac_cv_c_uint64_t" case $ac_cv_c_uint64_t in #( no|yes) ;; #( *) printf "%s\n" "#define _UINT64_T 1" >>confdefs.h printf "%s\n" "#define uint64_t $ac_cv_c_uint64_t" >>confdefs.h ;; esac ac_fn_c_find_uintX_t "$LINENO" "8" "ac_cv_c_uint8_t" case $ac_cv_c_uint8_t in #( no|yes) ;; #( *) printf "%s\n" "#define _UINT8_T 1" >>confdefs.h printf "%s\n" "#define uint8_t $ac_cv_c_uint8_t" >>confdefs.h ;; esac ac_fn_cxx_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "$ac_includes_default" if test "x$ac_cv_type_uintptr_t" = xyes then : printf "%s\n" "#define HAVE_UINTPTR_T 1" >>confdefs.h else $as_nop for ac_type in 'unsigned int' 'unsigned long int' \ 'unsigned long long int'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main (void) { static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($ac_type))]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : printf "%s\n" "#define uintptr_t $ac_type" >>confdefs.h ac_type= fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext test -z "$ac_type" && break done fi # Checks for library functions. ac_fn_cxx_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday" if test "x$ac_cv_func_gettimeofday" = xyes then : printf "%s\n" "#define HAVE_GETTIMEOFDAY 1" >>confdefs.h fi ac_fn_cxx_check_func "$LINENO" "posix_memalign" "ac_cv_func_posix_memalign" if test "x$ac_cv_func_posix_memalign" = xyes then : printf "%s\n" "#define HAVE_POSIX_MEMALIGN 1" >>confdefs.h fi ac_fn_cxx_check_func "$LINENO" "cfmakeraw" "ac_cv_func_cfmakeraw" if test "x$ac_cv_func_cfmakeraw" = xyes then : printf "%s\n" "#define HAVE_CFMAKERAW 1" >>confdefs.h fi ac_fn_cxx_check_func "$LINENO" "pselect" "ac_cv_func_pselect" if test "x$ac_cv_func_pselect" = xyes then : printf "%s\n" "#define HAVE_PSELECT 1" >>confdefs.h fi ac_fn_cxx_check_func "$LINENO" "pledge" "ac_cv_func_pledge" if test "x$ac_cv_func_pledge" = xyes then : printf "%s\n" "#define HAVE_PLEDGE 1" >>confdefs.h fi # Start by trying to find the needed tinfo parts by pkg-config if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; 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_PKG_CONFIG+y} then : printf %s "(cached) " >&6 else $as_nop case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # 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_PKG_CONFIG="$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 ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 printf "%s\n" "$PKG_CONFIG" >&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_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; 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_ac_pt_PKG_CONFIG+y} then : printf %s "(cached) " >&6 else $as_nop case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # 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_ac_pt_PKG_CONFIG="$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 ;; esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 printf "%s\n" "$ac_pt_PKG_CONFIG" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then PKG_CONFIG="" 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 PKG_CONFIG=$ac_pt_PKG_CONFIG fi else PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 printf %s "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } PKG_CONFIG="" fi fi pkg_failed=no { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for TINFO" >&5 printf %s "checking for TINFO... " >&6; } if test -n "$TINFO_CFLAGS"; then pkg_cv_TINFO_CFLAGS="$TINFO_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"tinfo\""; } >&5 ($PKG_CONFIG --exists --print-errors "tinfo") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_TINFO_CFLAGS=`$PKG_CONFIG --cflags "tinfo" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$TINFO_LIBS"; then pkg_cv_TINFO_LIBS="$TINFO_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"tinfo\""; } >&5 ($PKG_CONFIG --exists --print-errors "tinfo") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_TINFO_LIBS=`$PKG_CONFIG --libs "tinfo" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then TINFO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "tinfo" 2>&1` else TINFO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "tinfo" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$TINFO_PKG_ERRORS" >&5 pkg_failed=no { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for TINFO" >&5 printf %s "checking for TINFO... " >&6; } if test -n "$TINFO_CFLAGS"; then pkg_cv_TINFO_CFLAGS="$TINFO_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ncurses\""; } >&5 ($PKG_CONFIG --exists --print-errors "ncurses") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_TINFO_CFLAGS=`$PKG_CONFIG --cflags "ncurses" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$TINFO_LIBS"; then pkg_cv_TINFO_LIBS="$TINFO_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ncurses\""; } >&5 ($PKG_CONFIG --exists --print-errors "ncurses") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_TINFO_LIBS=`$PKG_CONFIG --libs "ncurses" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then TINFO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "ncurses" 2>&1` else TINFO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "ncurses" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$TINFO_PKG_ERRORS" >&5 if test ${ax_cv_have_TINFO+y} then : printf %s "(cached) " >&6 else $as_nop save_CPPFLAGS="$CPPFLAGS" save_LDFLAGS="$LDFLAGS" save_LIBS="$LIBS" if test "x$TINFO_CPPFLAGS" != "x" then : CPPFLAGS="$CPPFLAGS $TINFO_CPPFLAGS" fi if test "x$TINFO_LDFLAGS" != "x" then : LDFLAGS="$LDFLAGS $TINFO_LDFLAGS" fi ac_fn_cxx_check_header_compile "$LINENO" "curses.h" "ac_cv_header_curses_h" "$ac_includes_default" if test "x$ac_cv_header_curses_h" = xyes then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for main in -ltinfo" >&5 printf %s "checking for main in -ltinfo... " >&6; } if test ${ac_cv_lib_tinfo_main+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ltinfo $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ namespace conftest { extern "C" int main (); } int main (void) { return conftest::main (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : ac_cv_lib_tinfo_main=yes else $as_nop ac_cv_lib_tinfo_main=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tinfo_main" >&5 printf "%s\n" "$ac_cv_lib_tinfo_main" >&6; } if test "x$ac_cv_lib_tinfo_main" = xyes then : ax_cv_have_TINFO=yes else $as_nop ax_cv_have_TINFO=no fi else $as_nop ax_cv_have_TINFO=no fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" fi if test "$ax_cv_have_TINFO" = "yes" then : printf "%s\n" "#define HAVE_TINFO 1" >>confdefs.h printf "%s\n" "#define HAVE_CURSES_H 1" >>confdefs.h TINFO_CFLAGS="$TINFO_CPPFLAGS" TINFO_LIBS="$TINFO_LDFLAGS -ltinfo" fi elif test $pkg_failed = untried; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } if test ${ax_cv_have_TINFO+y} then : printf %s "(cached) " >&6 else $as_nop save_CPPFLAGS="$CPPFLAGS" save_LDFLAGS="$LDFLAGS" save_LIBS="$LIBS" if test "x$TINFO_CPPFLAGS" != "x" then : CPPFLAGS="$CPPFLAGS $TINFO_CPPFLAGS" fi if test "x$TINFO_LDFLAGS" != "x" then : LDFLAGS="$LDFLAGS $TINFO_LDFLAGS" fi ac_fn_cxx_check_header_compile "$LINENO" "curses.h" "ac_cv_header_curses_h" "$ac_includes_default" if test "x$ac_cv_header_curses_h" = xyes then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for main in -ltinfo" >&5 printf %s "checking for main in -ltinfo... " >&6; } if test ${ac_cv_lib_tinfo_main+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ltinfo $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ namespace conftest { extern "C" int main (); } int main (void) { return conftest::main (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : ac_cv_lib_tinfo_main=yes else $as_nop ac_cv_lib_tinfo_main=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tinfo_main" >&5 printf "%s\n" "$ac_cv_lib_tinfo_main" >&6; } if test "x$ac_cv_lib_tinfo_main" = xyes then : ax_cv_have_TINFO=yes else $as_nop ax_cv_have_TINFO=no fi else $as_nop ax_cv_have_TINFO=no fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" fi if test "$ax_cv_have_TINFO" = "yes" then : printf "%s\n" "#define HAVE_TINFO 1" >>confdefs.h printf "%s\n" "#define HAVE_CURSES_H 1" >>confdefs.h TINFO_CFLAGS="$TINFO_CPPFLAGS" TINFO_LIBS="$TINFO_LDFLAGS -ltinfo" fi else TINFO_CFLAGS=$pkg_cv_TINFO_CFLAGS TINFO_LIBS=$pkg_cv_TINFO_LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } printf "%s\n" "#define HAVE_CURSES_H 1" >>confdefs.h fi elif test $pkg_failed = untried; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } pkg_failed=no { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for TINFO" >&5 printf %s "checking for TINFO... " >&6; } if test -n "$TINFO_CFLAGS"; then pkg_cv_TINFO_CFLAGS="$TINFO_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ncurses\""; } >&5 ($PKG_CONFIG --exists --print-errors "ncurses") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_TINFO_CFLAGS=`$PKG_CONFIG --cflags "ncurses" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$TINFO_LIBS"; then pkg_cv_TINFO_LIBS="$TINFO_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"ncurses\""; } >&5 ($PKG_CONFIG --exists --print-errors "ncurses") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_TINFO_LIBS=`$PKG_CONFIG --libs "ncurses" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then TINFO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "ncurses" 2>&1` else TINFO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "ncurses" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$TINFO_PKG_ERRORS" >&5 if test ${ax_cv_have_TINFO+y} then : printf %s "(cached) " >&6 else $as_nop save_CPPFLAGS="$CPPFLAGS" save_LDFLAGS="$LDFLAGS" save_LIBS="$LIBS" if test "x$TINFO_CPPFLAGS" != "x" then : CPPFLAGS="$CPPFLAGS $TINFO_CPPFLAGS" fi if test "x$TINFO_LDFLAGS" != "x" then : LDFLAGS="$LDFLAGS $TINFO_LDFLAGS" fi ac_fn_cxx_check_header_compile "$LINENO" "curses.h" "ac_cv_header_curses_h" "$ac_includes_default" if test "x$ac_cv_header_curses_h" = xyes then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for main in -ltinfo" >&5 printf %s "checking for main in -ltinfo... " >&6; } if test ${ac_cv_lib_tinfo_main+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ltinfo $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ namespace conftest { extern "C" int main (); } int main (void) { return conftest::main (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : ac_cv_lib_tinfo_main=yes else $as_nop ac_cv_lib_tinfo_main=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tinfo_main" >&5 printf "%s\n" "$ac_cv_lib_tinfo_main" >&6; } if test "x$ac_cv_lib_tinfo_main" = xyes then : ax_cv_have_TINFO=yes else $as_nop ax_cv_have_TINFO=no fi else $as_nop ax_cv_have_TINFO=no fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" fi if test "$ax_cv_have_TINFO" = "yes" then : printf "%s\n" "#define HAVE_TINFO 1" >>confdefs.h printf "%s\n" "#define HAVE_CURSES_H 1" >>confdefs.h TINFO_CFLAGS="$TINFO_CPPFLAGS" TINFO_LIBS="$TINFO_LDFLAGS -ltinfo" fi elif test $pkg_failed = untried; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } if test ${ax_cv_have_TINFO+y} then : printf %s "(cached) " >&6 else $as_nop save_CPPFLAGS="$CPPFLAGS" save_LDFLAGS="$LDFLAGS" save_LIBS="$LIBS" if test "x$TINFO_CPPFLAGS" != "x" then : CPPFLAGS="$CPPFLAGS $TINFO_CPPFLAGS" fi if test "x$TINFO_LDFLAGS" != "x" then : LDFLAGS="$LDFLAGS $TINFO_LDFLAGS" fi ac_fn_cxx_check_header_compile "$LINENO" "curses.h" "ac_cv_header_curses_h" "$ac_includes_default" if test "x$ac_cv_header_curses_h" = xyes then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for main in -ltinfo" >&5 printf %s "checking for main in -ltinfo... " >&6; } if test ${ac_cv_lib_tinfo_main+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ltinfo $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ namespace conftest { extern "C" int main (); } int main (void) { return conftest::main (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : ac_cv_lib_tinfo_main=yes else $as_nop ac_cv_lib_tinfo_main=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tinfo_main" >&5 printf "%s\n" "$ac_cv_lib_tinfo_main" >&6; } if test "x$ac_cv_lib_tinfo_main" = xyes then : ax_cv_have_TINFO=yes else $as_nop ax_cv_have_TINFO=no fi else $as_nop ax_cv_have_TINFO=no fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" fi if test "$ax_cv_have_TINFO" = "yes" then : printf "%s\n" "#define HAVE_TINFO 1" >>confdefs.h printf "%s\n" "#define HAVE_CURSES_H 1" >>confdefs.h TINFO_CFLAGS="$TINFO_CPPFLAGS" TINFO_LIBS="$TINFO_LDFLAGS -ltinfo" fi else TINFO_CFLAGS=$pkg_cv_TINFO_CFLAGS TINFO_LIBS=$pkg_cv_TINFO_LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } printf "%s\n" "#define HAVE_CURSES_H 1" >>confdefs.h fi else TINFO_CFLAGS=$pkg_cv_TINFO_CFLAGS TINFO_LIBS=$pkg_cv_TINFO_LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } printf "%s\n" "#define HAVE_CURSES_H 1" >>confdefs.h fi # Then try to find it in a specific install dir # Check whether --with-curses was given. if test ${with_curses+y} then : withval=$with_curses; if test $withval != yes; then cv_curses=$withval fi if test x$cv_curses != x/usr; then CURSES_LDFLAGS="-L${cv_curses}/lib" CURSES_CPPFLAGS="-I${cv_curses}/include" fi fi if test "x$ax_cv_have_TINFO" = xno ; then # save away old LDFLAGS/CPPFLAGS and check for curses with cv_curses old_LDFLAGS="$LDFLAGS" old_CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS $CURSES_LDFLAGS" CPPFLAGS="$CPPFLAGS $CURSES_CPPFLAGS" # Check whether --with-ncurses was given. if test ${with_ncurses+y} then : withval=$with_ncurses; else $as_nop with_ncurses=check fi # Check whether --with-ncursesw was given. if test ${with_ncursesw+y} then : withval=$with_ncursesw; else $as_nop with_ncursesw=check fi ax_saved_LIBS=$LIBS if test "x$with_ncurses" = xyes || test "x$with_ncursesw" = xyes then : ax_with_plaincurses=no else $as_nop ax_with_plaincurses=check fi ax_cv_curses_which=no # Test for NcursesW if test "x$CURSES_LIB" = x && test "x$with_ncursesw" != xno then : LIBS="$ax_saved_LIBS -lncursesw" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for NcursesW wide-character library" >&5 printf %s "checking for NcursesW wide-character library... " >&6; } if test ${ax_cv_ncursesw+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ namespace conftest { extern "C" int initscr (); } int main (void) { return conftest::initscr (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : ax_cv_ncursesw=yes else $as_nop ax_cv_ncursesw=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_ncursesw" >&5 printf "%s\n" "$ax_cv_ncursesw" >&6; } if test "x$ax_cv_ncursesw" = xno && test "x$with_ncursesw" = xyes then : as_fn_error $? "--with-ncursesw specified but could not find NcursesW library" "$LINENO" 5 fi if test "x$ax_cv_ncursesw" = xyes then : ax_cv_curses=yes ax_cv_curses_which=ncursesw CURSES_LIB="-lncursesw" printf "%s\n" "#define HAVE_NCURSESW 1" >>confdefs.h printf "%s\n" "#define HAVE_CURSES 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working ncursesw/curses.h" >&5 printf %s "checking for working ncursesw/curses.h... " >&6; } if test ${ax_cv_header_ncursesw_curses_h+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _XOPEN_SOURCE_EXTENDED 1 #include int main (void) { chtype a = A_BOLD; int b = KEY_LEFT; chtype c = COLOR_PAIR(1) & A_COLOR; attr_t d = WA_NORMAL; cchar_t e; wint_t f; int g = getattrs(stdscr); int h = getcurx(stdscr) + getmaxx(stdscr); initscr(); init_pair(1, COLOR_WHITE, COLOR_RED); wattr_set(stdscr, d, 0, NULL); wget_wch(stdscr, &f); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : ax_cv_header_ncursesw_curses_h=yes else $as_nop ax_cv_header_ncursesw_curses_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_header_ncursesw_curses_h" >&5 printf "%s\n" "$ax_cv_header_ncursesw_curses_h" >&6; } if test "x$ax_cv_header_ncursesw_curses_h" = xyes then : ax_cv_curses_enhanced=yes ax_cv_curses_color=yes ax_cv_curses_obsolete=yes printf "%s\n" "#define HAVE_CURSES_ENHANCED 1" >>confdefs.h printf "%s\n" "#define HAVE_CURSES_COLOR 1" >>confdefs.h printf "%s\n" "#define HAVE_CURSES_OBSOLETE 1" >>confdefs.h printf "%s\n" "#define HAVE_NCURSESW_CURSES_H 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working ncursesw.h" >&5 printf %s "checking for working ncursesw.h... " >&6; } if test ${ax_cv_header_ncursesw_h+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _XOPEN_SOURCE_EXTENDED 1 #include int main (void) { chtype a = A_BOLD; int b = KEY_LEFT; chtype c = COLOR_PAIR(1) & A_COLOR; attr_t d = WA_NORMAL; cchar_t e; wint_t f; int g = getattrs(stdscr); int h = getcurx(stdscr) + getmaxx(stdscr); initscr(); init_pair(1, COLOR_WHITE, COLOR_RED); wattr_set(stdscr, d, 0, NULL); wget_wch(stdscr, &f); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : ax_cv_header_ncursesw_h=yes else $as_nop ax_cv_header_ncursesw_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_header_ncursesw_h" >&5 printf "%s\n" "$ax_cv_header_ncursesw_h" >&6; } if test "x$ax_cv_header_ncursesw_h" = xyes then : ax_cv_curses_enhanced=yes ax_cv_curses_color=yes ax_cv_curses_obsolete=yes printf "%s\n" "#define HAVE_CURSES_ENHANCED 1" >>confdefs.h printf "%s\n" "#define HAVE_CURSES_COLOR 1" >>confdefs.h printf "%s\n" "#define HAVE_CURSES_OBSOLETE 1" >>confdefs.h printf "%s\n" "#define HAVE_NCURSESW_H 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working ncurses.h" >&5 printf %s "checking for working ncurses.h... " >&6; } if test ${ax_cv_header_ncurses_h_with_ncursesw+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _XOPEN_SOURCE_EXTENDED 1 #include int main (void) { chtype a = A_BOLD; int b = KEY_LEFT; chtype c = COLOR_PAIR(1) & A_COLOR; attr_t d = WA_NORMAL; cchar_t e; wint_t f; int g = getattrs(stdscr); int h = getcurx(stdscr) + getmaxx(stdscr); initscr(); init_pair(1, COLOR_WHITE, COLOR_RED); wattr_set(stdscr, d, 0, NULL); wget_wch(stdscr, &f); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : ax_cv_header_ncurses_h_with_ncursesw=yes else $as_nop ax_cv_header_ncurses_h_with_ncursesw=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_header_ncurses_h_with_ncursesw" >&5 printf "%s\n" "$ax_cv_header_ncurses_h_with_ncursesw" >&6; } if test "x$ax_cv_header_ncurses_h_with_ncursesw" = xyes then : ax_cv_curses_enhanced=yes ax_cv_curses_color=yes ax_cv_curses_obsolete=yes printf "%s\n" "#define HAVE_CURSES_ENHANCED 1" >>confdefs.h printf "%s\n" "#define HAVE_CURSES_COLOR 1" >>confdefs.h printf "%s\n" "#define HAVE_CURSES_OBSOLETE 1" >>confdefs.h printf "%s\n" "#define HAVE_NCURSES_H 1" >>confdefs.h fi if test "x$ax_cv_header_ncursesw_curses_h" = xno && test "x$ax_cv_header_ncursesw_h" = xno && test "x$ax_cv_header_ncurses_h_with_ncursesw" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: could not find a working ncursesw/curses.h, ncursesw.h or ncurses.h" >&5 printf "%s\n" "$as_me: WARNING: could not find a working ncursesw/curses.h, ncursesw.h or ncurses.h" >&2;} fi fi fi # Test for Ncurses if test "x$CURSES_LIB" = x && test "x$with_ncurses" != xno && test "x$ax_cv_curses_which" = xno then : LIBS="$ax_saved_LIBS -lncurses" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Ncurses library" >&5 printf %s "checking for Ncurses library... " >&6; } if test ${ax_cv_ncurses+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ namespace conftest { extern "C" int initscr (); } int main (void) { return conftest::initscr (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : ax_cv_ncurses=yes else $as_nop ax_cv_ncurses=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_ncurses" >&5 printf "%s\n" "$ax_cv_ncurses" >&6; } if test "x$ax_cv_ncurses" = xno && test "x$with_ncurses" = xyes then : as_fn_error $? "--with-ncurses specified but could not find Ncurses library" "$LINENO" 5 fi if test "x$ax_cv_ncurses" = xyes then : ax_cv_curses=yes ax_cv_curses_which=ncurses CURSES_LIB="-lncurses" printf "%s\n" "#define HAVE_NCURSES 1" >>confdefs.h printf "%s\n" "#define HAVE_CURSES 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working ncurses/curses.h" >&5 printf %s "checking for working ncurses/curses.h... " >&6; } if test ${ax_cv_header_ncurses_curses_h+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { chtype a = A_BOLD; int b = KEY_LEFT; chtype c = COLOR_PAIR(1) & A_COLOR; int g = getattrs(stdscr); int h = getcurx(stdscr) + getmaxx(stdscr); initscr(); init_pair(1, COLOR_WHITE, COLOR_RED); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : ax_cv_header_ncurses_curses_h=yes else $as_nop ax_cv_header_ncurses_curses_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_header_ncurses_curses_h" >&5 printf "%s\n" "$ax_cv_header_ncurses_curses_h" >&6; } if test "x$ax_cv_header_ncurses_curses_h" = xyes then : ax_cv_curses_color=yes ax_cv_curses_obsolete=yes printf "%s\n" "#define HAVE_CURSES_COLOR 1" >>confdefs.h printf "%s\n" "#define HAVE_CURSES_OBSOLETE 1" >>confdefs.h printf "%s\n" "#define HAVE_NCURSES_CURSES_H 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working ncurses.h" >&5 printf %s "checking for working ncurses.h... " >&6; } if test ${ax_cv_header_ncurses_h+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { chtype a = A_BOLD; int b = KEY_LEFT; chtype c = COLOR_PAIR(1) & A_COLOR; int g = getattrs(stdscr); int h = getcurx(stdscr) + getmaxx(stdscr); initscr(); init_pair(1, COLOR_WHITE, COLOR_RED); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : ax_cv_header_ncurses_h=yes else $as_nop ax_cv_header_ncurses_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_header_ncurses_h" >&5 printf "%s\n" "$ax_cv_header_ncurses_h" >&6; } if test "x$ax_cv_header_ncurses_h" = xyes then : ax_cv_curses_color=yes ax_cv_curses_obsolete=yes printf "%s\n" "#define HAVE_CURSES_COLOR 1" >>confdefs.h printf "%s\n" "#define HAVE_CURSES_OBSOLETE 1" >>confdefs.h printf "%s\n" "#define HAVE_NCURSES_H 1" >>confdefs.h fi if test "x$ax_cv_header_ncurses_curses_h" = xno && test "x$ax_cv_header_ncurses_h" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: could not find a working ncurses/curses.h or ncurses.h" >&5 printf "%s\n" "$as_me: WARNING: could not find a working ncurses/curses.h or ncurses.h" >&2;} fi fi fi # Test for plain Curses (or if CURSES_LIB was set by user) if test "x$with_plaincurses" != xno && test "x$ax_cv_curses_which" = xno then : if test "x$CURSES_LIB" != x then : LIBS="$ax_saved_LIBS $CURSES_LIB" else $as_nop LIBS="$ax_saved_LIBS -lcurses" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Curses library" >&5 printf %s "checking for Curses library... " >&6; } if test ${ax_cv_plaincurses+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ namespace conftest { extern "C" int initscr (); } int main (void) { return conftest::initscr (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : ax_cv_plaincurses=yes else $as_nop ax_cv_plaincurses=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_plaincurses" >&5 printf "%s\n" "$ax_cv_plaincurses" >&6; } if test "x$ax_cv_plaincurses" = xyes then : ax_cv_curses=yes ax_cv_curses_which=plaincurses if test "x$CURSES_LIB" = x then : CURSES_LIB="-lcurses" fi printf "%s\n" "#define HAVE_CURSES 1" >>confdefs.h # Check for base conformance (and header file) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working curses.h" >&5 printf %s "checking for working curses.h... " >&6; } if test ${ax_cv_header_curses_h+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { chtype a = A_BOLD; int b = KEY_LEFT; initscr(); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : ax_cv_header_curses_h=yes else $as_nop ax_cv_header_curses_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_header_curses_h" >&5 printf "%s\n" "$ax_cv_header_curses_h" >&6; } if test "x$ax_cv_header_curses_h" = xyes then : printf "%s\n" "#define HAVE_CURSES_H 1" >>confdefs.h # Check for X/Open Enhanced conformance { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for X/Open Enhanced Curses conformance" >&5 printf %s "checking for X/Open Enhanced Curses conformance... " >&6; } if test ${ax_cv_plaincurses_enhanced+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _XOPEN_SOURCE_EXTENDED 1 #include #ifndef _XOPEN_CURSES #error "this Curses library is not enhanced" "this Curses library is not enhanced" #endif int main (void) { chtype a = A_BOLD; int b = KEY_LEFT; chtype c = COLOR_PAIR(1) & A_COLOR; attr_t d = WA_NORMAL; cchar_t e; wint_t f; initscr(); init_pair(1, COLOR_WHITE, COLOR_RED); wattr_set(stdscr, d, 0, NULL); wget_wch(stdscr, &f); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : ax_cv_plaincurses_enhanced=yes else $as_nop ax_cv_plaincurses_enhanced=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_plaincurses_enhanced" >&5 printf "%s\n" "$ax_cv_plaincurses_enhanced" >&6; } if test "x$ax_cv_plaincurses_enhanced" = xyes then : ax_cv_curses_enhanced=yes ax_cv_curses_color=yes printf "%s\n" "#define HAVE_CURSES_ENHANCED 1" >>confdefs.h printf "%s\n" "#define HAVE_CURSES_COLOR 1" >>confdefs.h fi # Check for color functions { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Curses color functions" >&5 printf %s "checking for Curses color functions... " >&6; } if test ${ax_cv_plaincurses_color+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _XOPEN_SOURCE_EXTENDED 1 #include int main (void) { chtype a = A_BOLD; int b = KEY_LEFT; chtype c = COLOR_PAIR(1) & A_COLOR; initscr(); init_pair(1, COLOR_WHITE, COLOR_RED); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : ax_cv_plaincurses_color=yes else $as_nop ax_cv_plaincurses_color=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_plaincurses_color" >&5 printf "%s\n" "$ax_cv_plaincurses_color" >&6; } if test "x$ax_cv_plaincurses_color" = xyes then : ax_cv_curses_color=yes printf "%s\n" "#define HAVE_CURSES_COLOR 1" >>confdefs.h fi # Check for obsolete functions { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for obsolete Curses functions" >&5 printf %s "checking for obsolete Curses functions... " >&6; } if test ${ax_cv_plaincurses_obsolete+y} then : printf %s "(cached) " >&6 else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main (void) { chtype a = A_BOLD; int b = KEY_LEFT; int g = getattrs(stdscr); int h = getcurx(stdscr) + getmaxx(stdscr); initscr(); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : ax_cv_plaincurses_obsolete=yes else $as_nop ax_cv_plaincurses_obsolete=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_plaincurses_obsolete" >&5 printf "%s\n" "$ax_cv_plaincurses_obsolete" >&6; } if test "x$ax_cv_plaincurses_obsolete" = xyes then : ax_cv_curses_obsolete=yes printf "%s\n" "#define HAVE_CURSES_OBSOLETE 1" >>confdefs.h fi fi if test "x$ax_cv_header_curses_h" = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: could not find a working curses.h" >&5 printf "%s\n" "$as_me: WARNING: could not find a working curses.h" >&2;} fi fi fi if test "x$ax_cv_curses" != xyes then : ax_cv_curses=no fi if test "x$ax_cv_curses_enhanced" != xyes then : ax_cv_curses_enhanced=no fi if test "x$ax_cv_curses_color" != xyes then : ax_cv_curses_color=no fi if test "x$ax_cv_curses_obsolete" != xyes then : ax_cv_curses_obsolete=no fi LIBS=$ax_saved_LIBS # restore old LDFLAGS/CPPFLAGS LDFLAGS="$old_LDFLAGS" CPPFLAGS="$old_CPPFLAGS" if test "x$ax_cv_curses_which" = xno ; then as_fn_error $? "requires either tinfo, NcursesW or Ncurses library" "$LINENO" 5 else TINFO_LIBS="$CURSES_LDFLAGS $CURSES_LIB" TINFO_CFLAGS="$CURSES_CPPFLAGS" fi fi # Check whether --enable-static-curses was given. if test ${enable_static_curses+y} then : enableval=$enable_static_curses; else $as_nop enable_static_curses="$enable_static_libraries" fi if test "$enable_static_curses" = yes then : TINFO_LIBS="-Wl,-Bstatic $TINFO_LIBS -Wl,-Bdynamic" fi for ac_header in CommonCrypto/CommonCrypto.h do : ac_fn_cxx_check_header_compile "$LINENO" "CommonCrypto/CommonCrypto.h" "ac_cv_header_CommonCrypto_CommonCrypto_h" "$ac_includes_default" if test "x$ac_cv_header_CommonCrypto_CommonCrypto_h" = xyes then : printf "%s\n" "#define HAVE_COMMONCRYPTO_COMMONCRYPTO_H 1" >>confdefs.h default_crypto_library="apple-common-crypto" else $as_nop default_crypto_library="openssl" fi done # Check whether --with-crypto-library was given. if test ${with_crypto_library+y} then : withval=$with_crypto_library; case "${withval}" in openssl|openssl-with-internal-ocb|openssl-with-openssl-ocb|nettle|apple-common-crypto) ;; *) as_fn_error $? "bad value ${withval} for --with-crypto-library" "$LINENO" 5 ;; esac else $as_nop with_crypto_library="$default_crypto_library" fi pkg_failed=no { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OpenSSL" >&5 printf %s "checking for OpenSSL... " >&6; } if test -n "$OpenSSL_CFLAGS"; then pkg_cv_OpenSSL_CFLAGS="$OpenSSL_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openssl\""; } >&5 ($PKG_CONFIG --exists --print-errors "openssl") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_OpenSSL_CFLAGS=`$PKG_CONFIG --cflags "openssl" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$OpenSSL_LIBS"; then pkg_cv_OpenSSL_LIBS="$OpenSSL_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openssl\""; } >&5 ($PKG_CONFIG --exists --print-errors "openssl") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_OpenSSL_LIBS=`$PKG_CONFIG --libs "openssl" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then OpenSSL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "openssl" 2>&1` else OpenSSL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "openssl" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$OpenSSL_PKG_ERRORS" >&5 : elif test $pkg_failed = untried; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } : else OpenSSL_CFLAGS=$pkg_cv_OpenSSL_CFLAGS OpenSSL_LIBS=$pkg_cv_OpenSSL_LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } have_openssl=yes { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for AES_encrypt in -lcrypto" >&5 printf %s "checking for AES_encrypt in -lcrypto... " >&6; } if test ${ac_cv_lib_crypto_AES_encrypt+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lcrypto $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ namespace conftest { extern "C" int AES_encrypt (); } int main (void) { return conftest::AES_encrypt (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : ac_cv_lib_crypto_AES_encrypt=yes else $as_nop ac_cv_lib_crypto_AES_encrypt=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_AES_encrypt" >&5 printf "%s\n" "$ac_cv_lib_crypto_AES_encrypt" >&6; } if test "x$ac_cv_lib_crypto_AES_encrypt" = xyes then : have_deprecated_openssl_aes=yes fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for EVP_aes_128_ocb in -lcrypto" >&5 printf %s "checking for EVP_aes_128_ocb in -lcrypto... " >&6; } if test ${ac_cv_lib_crypto_EVP_aes_128_ocb+y} then : printf %s "(cached) " >&6 else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lcrypto $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ namespace conftest { extern "C" int EVP_aes_128_ocb (); } int main (void) { return conftest::EVP_aes_128_ocb (); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : ac_cv_lib_crypto_EVP_aes_128_ocb=yes else $as_nop ac_cv_lib_crypto_EVP_aes_128_ocb=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_EVP_aes_128_ocb" >&5 printf "%s\n" "$ac_cv_lib_crypto_EVP_aes_128_ocb" >&6; } if test "x$ac_cv_lib_crypto_EVP_aes_128_ocb" = xyes then : have_evp_aes_ocb=yes fi fi pkg_failed=no { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Nettle" >&5 printf %s "checking for Nettle... " >&6; } if test -n "$Nettle_CFLAGS"; then pkg_cv_Nettle_CFLAGS="$Nettle_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"nettle\""; } >&5 ($PKG_CONFIG --exists --print-errors "nettle") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_Nettle_CFLAGS=`$PKG_CONFIG --cflags "nettle" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$Nettle_LIBS"; then pkg_cv_Nettle_LIBS="$Nettle_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"nettle\""; } >&5 ($PKG_CONFIG --exists --print-errors "nettle") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_Nettle_LIBS=`$PKG_CONFIG --libs "nettle" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then Nettle_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "nettle" 2>&1` else Nettle_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "nettle" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$Nettle_PKG_ERRORS" >&5 : elif test $pkg_failed = untried; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } : else Nettle_CFLAGS=$pkg_cv_Nettle_CFLAGS Nettle_LIBS=$pkg_cv_Nettle_LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } have_nettle=yes fi case $with_crypto_library in #( openssl*) : if test "x$have_openssl" != xyes then : as_fn_error $? "OpenSSL crypto library not found" "$LINENO" 5 fi printf "%s\n" "#define USE_OPENSSL_AES 1" >>confdefs.h CRYPTO_CFLAGS="$OpenSSL_CFLAGS" CRYPTO_LIBS="$OpenSSL_LIBS -lcrypto" ;; #( *) : ;; esac case "${with_crypto_library}" in openssl|openssl-with-internal-ocb) if test "x$have_deprecated_openssl_aes" != xyes then : as_fn_error $? "found OpenSSL without AES support" "$LINENO" 5 fi if false; then USE_AES_OCB_FROM_OPENSSL_TRUE= USE_AES_OCB_FROM_OPENSSL_FALSE='#' else USE_AES_OCB_FROM_OPENSSL_TRUE='#' USE_AES_OCB_FROM_OPENSSL_FALSE= fi human_readable_cryptography_description='internal OCB, OpenSSL AES' ;; openssl-with-openssl-ocb) if test "x$have_evp_aes_ocb" != xyes then : as_fn_error $? "found OpenSSL without AES-OCB support" "$LINENO" 5 fi if true; then USE_AES_OCB_FROM_OPENSSL_TRUE= USE_AES_OCB_FROM_OPENSSL_FALSE='#' else USE_AES_OCB_FROM_OPENSSL_TRUE='#' USE_AES_OCB_FROM_OPENSSL_FALSE= fi human_readable_cryptography_description='OpenSSL OCB, OpenSSL AES' ;; nettle) if test "x$have_nettle" != xyes then : as_fn_error $? "Nettle crypto library not found" "$LINENO" 5 fi printf "%s\n" "#define USE_NETTLE_AES 1" >>confdefs.h CRYPTO_CFLAGS="$Nettle_CFLAGS" CRYPTO_LIBS="$Nettle_LIBS" if false; then USE_AES_OCB_FROM_OPENSSL_TRUE= USE_AES_OCB_FROM_OPENSSL_FALSE='#' else USE_AES_OCB_FROM_OPENSSL_TRUE='#' USE_AES_OCB_FROM_OPENSSL_FALSE= fi human_readable_cryptography_description='internal OCB, Nettle AES' ;; apple-common-crypto) if test "x$ac_cv_header_CommonCrypto_CommonCrypto_h" != xyes then : as_fn_error $? "Apple Common Crypto header not found" "$LINENO" 5 fi printf "%s\n" "#define USE_APPLE_COMMON_CRYPTO_AES 1" >>confdefs.h if false; then USE_AES_OCB_FROM_OPENSSL_TRUE= USE_AES_OCB_FROM_OPENSSL_FALSE='#' else USE_AES_OCB_FROM_OPENSSL_TRUE='#' USE_AES_OCB_FROM_OPENSSL_FALSE= fi human_readable_cryptography_description='internal OCB, Apple Common Crypto AES' ;; esac # Check whether --enable-static-crypto was given. if test ${enable_static_crypto+y} then : enableval=$enable_static_crypto; else $as_nop enable_static_crypto="$enable_static_libraries" fi if test "$enable_static_crypto" = yes then : CRYPTO_LIBS="-Wl,-Bstatic $CRYPTO_LIBS -Wl,-Bdynamic" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX options needed to detect all undeclared functions" >&5 printf %s "checking for $CXX options needed to detect all undeclared functions... " >&6; } if test ${ac_cv_cxx_undeclared_builtin_options+y} then : printf %s "(cached) " >&6 else $as_nop ac_save_CFLAGS=$CFLAGS ac_cv_cxx_undeclared_builtin_options='cannot detect' for ac_arg in '' -fno-builtin; do CFLAGS="$ac_save_CFLAGS $ac_arg" # This test program should *not* compile successfully. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { (void) strchr; ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : else $as_nop # This test program should compile successfully. # No library function is consistently available on # freestanding implementations, so test against a dummy # declaration. Include always-available headers on the # off chance that they somehow elicit warnings. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include extern void ac_decl (int, char *); int main (void) { (void) ac_decl (0, (char *) 0); (void) ac_decl; ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : if test x"$ac_arg" = x then : ac_cv_cxx_undeclared_builtin_options='none needed' else $as_nop ac_cv_cxx_undeclared_builtin_options=$ac_arg fi break fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done CFLAGS=$ac_save_CFLAGS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_undeclared_builtin_options" >&5 printf "%s\n" "$ac_cv_cxx_undeclared_builtin_options" >&6; } case $ac_cv_cxx_undeclared_builtin_options in #( 'cannot detect') : { { 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 make $CXX report undeclared builtins See \`config.log' for more details" "$LINENO" 5; } ;; #( 'none needed') : ac_cxx_undeclared_builtin_options='' ;; #( *) : ac_cxx_undeclared_builtin_options=$ac_cv_cxx_undeclared_builtin_options ;; esac ac_fn_check_decl "$LINENO" "forkpty" "ac_cv_have_decl_forkpty" "#include #include " "$ac_cxx_undeclared_builtin_options" "CXXFLAGS" if test "x$ac_cv_have_decl_forkpty" = xyes then : printf "%s\n" "#define FORKPTY_IN_LIBUTIL 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing forkpty" >&5 printf %s "checking for library containing forkpty... " >&6; } if test ${ac_cv_search_forkpty+y} then : printf %s "(cached) " >&6 else $as_nop ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ namespace conftest { extern "C" int forkpty (); } int main (void) { return conftest::forkpty (); ; return 0; } _ACEOF for ac_lib in '' util bsd do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_cxx_try_link "$LINENO" then : ac_cv_search_forkpty=$ac_res fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext if test ${ac_cv_search_forkpty+y} then : break fi done if test ${ac_cv_search_forkpty+y} then : else $as_nop ac_cv_search_forkpty=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_forkpty" >&5 printf "%s\n" "$ac_cv_search_forkpty" >&6; } ac_res=$ac_cv_search_forkpty if test "$ac_res" != no then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" printf "%s\n" "#define HAVE_FORKPTY /**/" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether FD_ISSET() argument is const" >&5 printf %s "checking whether FD_ISSET() argument is const... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include class T { public: fd_set fds; bool Fun( void ) const { return FD_ISSET( 0, &fds ); } }; int main (void) { T x = T(); return x.Fun(); ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : printf "%s\n" "#define FD_ISSET_IS_CONST 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether std::shared_ptr is available" >&5 printf %s "checking whether std::shared_ptr is available... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include class T { public: std::shared_ptr Fun( void ) { return std::shared_ptr( new int ( 0 ) ); } }; int main (void) { T x; return !!x.Fun(); ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : printf "%s\n" "#define HAVE_STD_SHARED_PTR 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether std::tr1::shared_ptr is available" >&5 printf %s "checking whether std::tr1::shared_ptr is available... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include class T { public: std::tr1::shared_ptr Fun( void ) { return std::tr1::shared_ptr( new int ( 0 ) ); } }; int main (void) { T x; return !!x.Fun(); ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : printf "%s\n" "#define HAVE_STD_TR1_SHARED_PTR 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether clock_gettime() is supported" >&5 printf %s "checking whether clock_gettime() is supported... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include struct timespec ts; int main (void) { return clock_gettime(CLOCK_MONOTONIC, &ts); ; return 0; } _ACEOF if ac_fn_cxx_try_link "$LINENO" then : printf "%s\n" "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext ac_fn_check_decl "$LINENO" "mach_absolute_time" "ac_cv_have_decl_mach_absolute_time" "#include " "$ac_cxx_undeclared_builtin_options" "CXXFLAGS" if test "x$ac_cv_have_decl_mach_absolute_time" = xyes then : printf "%s\n" "#define HAVE_MACH_ABSOLUTE_TIME 1" >>confdefs.h fi ac_fn_check_decl "$LINENO" "__builtin_ctz" "ac_cv_have_decl___builtin_ctz" "$ac_includes_default" "$ac_cxx_undeclared_builtin_options" "CXXFLAGS" if test "x$ac_cv_have_decl___builtin_ctz" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL___BUILTIN_CTZ $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "ffs" "ac_cv_have_decl_ffs" "#include " "$ac_cxx_undeclared_builtin_options" "CXXFLAGS" if test "x$ac_cv_have_decl_ffs" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_FFS $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "be64toh" "ac_cv_have_decl_be64toh" "#if defined(HAVE_ENDIAN_H) #include #elif defined(HAVE_SYS_ENDIAN_H) #include #include #endif " "$ac_cxx_undeclared_builtin_options" "CXXFLAGS" if test "x$ac_cv_have_decl_be64toh" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_BE64TOH $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "betoh64" "ac_cv_have_decl_betoh64" "#if defined(HAVE_ENDIAN_H) #include #elif defined(HAVE_SYS_ENDIAN_H) #include #include #endif " "$ac_cxx_undeclared_builtin_options" "CXXFLAGS" if test "x$ac_cv_have_decl_betoh64" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_BETOH64 $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "bswap64" "ac_cv_have_decl_bswap64" "#if defined(HAVE_ENDIAN_H) #include #elif defined(HAVE_SYS_ENDIAN_H) #include #include #endif " "$ac_cxx_undeclared_builtin_options" "CXXFLAGS" if test "x$ac_cv_have_decl_bswap64" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL_BSWAP64 $ac_have_decl" >>confdefs.h ac_fn_check_decl "$LINENO" "__builtin_bswap64" "ac_cv_have_decl___builtin_bswap64" "#if defined(HAVE_ENDIAN_H) #include #elif defined(HAVE_SYS_ENDIAN_H) #include #include #endif " "$ac_cxx_undeclared_builtin_options" "CXXFLAGS" if test "x$ac_cv_have_decl___builtin_bswap64" = xyes then : ac_have_decl=1 else $as_nop ac_have_decl=0 fi printf "%s\n" "#define HAVE_DECL___BUILTIN_BSWAP64 $ac_have_decl" >>confdefs.h if test x"$ac_cv_have_decl_be64toh" != xyes && test x"$ac_cv_have_decl_betoh64" != xyes then : ac_fn_check_decl "$LINENO" "OSSwapHostToBigInt64" "ac_cv_have_decl_OSSwapHostToBigInt64" "#include " "$ac_cxx_undeclared_builtin_options" "CXXFLAGS" if test "x$ac_cv_have_decl_OSSwapHostToBigInt64" = xyes then : printf "%s\n" "#define HAVE_OSX_SWAP 1" >>confdefs.h else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Unable to find byte swapping functions; using built-in routines." >&5 printf "%s\n" "$as_me: WARNING: Unable to find byte swapping functions; using built-in routines." >&2;} fi fi ac_fn_check_decl "$LINENO" "IP_MTU_DISCOVER" "ac_cv_have_decl_IP_MTU_DISCOVER" "#include " "$ac_cxx_undeclared_builtin_options" "CXXFLAGS" if test "x$ac_cv_have_decl_IP_MTU_DISCOVER" = xyes then : printf "%s\n" "#define HAVE_IP_MTU_DISCOVER 1" >>confdefs.h fi ac_fn_check_decl "$LINENO" "IP_RECVTOS" "ac_cv_have_decl_IP_RECVTOS" "#include " "$ac_cxx_undeclared_builtin_options" "CXXFLAGS" if test "x$ac_cv_have_decl_IP_RECVTOS" = xyes then : printf "%s\n" "#define HAVE_IP_RECVTOS 1" >>confdefs.h fi ac_fn_check_decl "$LINENO" "__STDC_ISO_10646__" "ac_cv_have_decl___STDC_ISO_10646__" "#include " "$ac_cxx_undeclared_builtin_options" "CXXFLAGS" if test "x$ac_cv_have_decl___STDC_ISO_10646__" = xyes then : else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: C library doesn't advertise wchar_t is Unicode (OS X works anyway with workaround)." >&5 printf "%s\n" "$as_me: WARNING: C library doesn't advertise wchar_t is Unicode (OS X works anyway with workaround)." >&2;} fi ac_fn_check_decl "$LINENO" "IUTF8" "ac_cv_have_decl_IUTF8" "#include " "$ac_cxx_undeclared_builtin_options" "CXXFLAGS" if test "x$ac_cv_have_decl_IUTF8" = xyes then : printf "%s\n" "#define HAVE_IUTF8 1" >>confdefs.h else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: No IUTF8 termios mode; character-erase of multibyte character sequence probably does not work properly in canonical mode on this platform." >&5 printf "%s\n" "$as_me: WARNING: No IUTF8 termios mode; character-erase of multibyte character sequence probably does not work properly in canonical mode on this platform." >&2;} fi # Checks for protobuf pkg_failed=no { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for protobuf" >&5 printf %s "checking for protobuf... " >&6; } if test -n "$protobuf_CFLAGS"; then pkg_cv_protobuf_CFLAGS="$protobuf_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"protobuf\""; } >&5 ($PKG_CONFIG --exists --print-errors "protobuf") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_protobuf_CFLAGS=`$PKG_CONFIG --cflags "protobuf" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$protobuf_LIBS"; then pkg_cv_protobuf_LIBS="$protobuf_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"protobuf\""; } >&5 ($PKG_CONFIG --exists --print-errors "protobuf") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_protobuf_LIBS=`$PKG_CONFIG --libs "protobuf" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then protobuf_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "protobuf" 2>&1` else protobuf_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "protobuf" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$protobuf_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (protobuf) were not met: $protobuf_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables protobuf_CFLAGS and protobuf_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } { { 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 pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables protobuf_CFLAGS and protobuf_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else protobuf_CFLAGS=$pkg_cv_protobuf_CFLAGS protobuf_LIBS=$pkg_cv_protobuf_LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } fi # On Debian Sid 2016-03-16ish at least, "pkgconfig --libs protobuf" # gives us the bogus "-lprotobuf -pthread -lpthread"; remove # "-lpthread" which misconfigures compile, causing a segfault in # mosh-server. if echo "$protobuf_LIBS" | grep -q -- -pthread then : protobuf_LIBS="`echo $protobuf_LIBS | sed 's/-lpthread//g'`" fi # Check whether --enable-static-protobuf was given. if test ${enable_static_protobuf+y} then : enableval=$enable_static_protobuf; else $as_nop enable_static_protobuf="$enable_static_libraries" fi if test "$enable_static_protobuf" = yes then : protobuf_LIBS="-Wl,-Bstatic $protobuf_LIBS -Wl,-Bdynamic" else $as_nop if test "$enable_static_libstdc__" = yes then : as_fn_error $? "--enable-static-libstdc++ requires --enable-static-protobuf" "$LINENO" 5 fi if test "$enable_static_libgcc" = yes then : as_fn_error $? "--enable-static-libgcc requires --enable-static-protobuf" "$LINENO" 5 fi fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether protoc matches protobuf" >&5 printf %s "checking whether protoc matches protobuf... " >&6; } cat > conftest.proto <<'EOF' syntax = "proto2"; option optimize_for = LITE_RUNTIME; EOF if $PROTOC --cpp_out=. conftest.proto then : old_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $protobuf_CFLAGS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include "conftest.pb.h" int main (void) { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO" then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } cat conftest.err { { 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 $? "Could not build output generated by protoc ($PROTOC). Check that protoc matches the installed protobuf headers and libraries. See \`config.log' for more details" "$LINENO" 5; } fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CPPFLAGS="$old_CPPFLAGS" else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } as_fn_error $? "Could not run protoc ($PROTOC)." "$LINENO" 5 fi # Bash completion needs to ask where it goes if >= 2.0 is installed. if test "$install_completion" != no then : pkg_failed=no { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for BASH_COMPLETION" >&5 printf %s "checking for BASH_COMPLETION... " >&6; } if test -n "$BASH_COMPLETION_CFLAGS"; then pkg_cv_BASH_COMPLETION_CFLAGS="$BASH_COMPLETION_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"bash-completion >= 2.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "bash-completion >= 2.0") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_BASH_COMPLETION_CFLAGS=`$PKG_CONFIG --cflags "bash-completion >= 2.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$BASH_COMPLETION_LIBS"; then pkg_cv_BASH_COMPLETION_LIBS="$BASH_COMPLETION_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"bash-completion >= 2.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "bash-completion >= 2.0") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_BASH_COMPLETION_LIBS=`$PKG_CONFIG --libs "bash-completion >= 2.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then BASH_COMPLETION_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "bash-completion >= 2.0" 2>&1` else BASH_COMPLETION_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "bash-completion >= 2.0" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$BASH_COMPLETION_PKG_ERRORS" >&5 completions="${sysconfdir}/bash_completion.d" elif test $pkg_failed = untried; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } completions="${sysconfdir}/bash_completion.d" else BASH_COMPLETION_CFLAGS=$pkg_cv_BASH_COMPLETION_CFLAGS BASH_COMPLETION_LIBS=$pkg_cv_BASH_COMPLETION_LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } if test "$prefix" = "NONE"; then completions="`pkg-config --variable=completionsdir bash-completion`" else completions="`pkg-config --define-variable=prefix=$prefix --variable=completionsdir bash-completion`" fi fi fi ac_config_files="$ac_config_files Makefile src/Makefile src/crypto/Makefile src/frontend/Makefile src/fuzz/Makefile src/include/Makefile src/network/Makefile src/protobufs/Makefile src/statesync/Makefile src/terminal/Makefile src/util/Makefile scripts/Makefile src/examples/Makefile src/tests/Makefile man/Makefile conf/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, 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; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${CODE_COVERAGE_ENABLED_TRUE}" && test -z "${CODE_COVERAGE_ENABLED_FALSE}"; then as_fn_error $? "conditional \"CODE_COVERAGE_ENABLED\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 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 if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_FUZZING_TRUE}" && test -z "${ENABLE_FUZZING_FALSE}"; then as_fn_error $? "conditional \"ENABLE_FUZZING\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${BUILD_CLIENT_TRUE}" && test -z "${BUILD_CLIENT_FALSE}"; then as_fn_error $? "conditional \"BUILD_CLIENT\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${BUILD_SERVER_TRUE}" && test -z "${BUILD_SERVER_FALSE}"; then as_fn_error $? "conditional \"BUILD_SERVER\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${BUILD_EXAMPLES_TRUE}" && test -z "${BUILD_EXAMPLES_FALSE}"; then as_fn_error $? "conditional \"BUILD_EXAMPLES\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${INSTALL_UFW_TRUE}" && test -z "${INSTALL_UFW_FALSE}"; then as_fn_error $? "conditional \"INSTALL_UFW\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${INSTALL_COMPLETION_TRUE}" && test -z "${INSTALL_COMPLETION_FALSE}"; then as_fn_error $? "conditional \"INSTALL_COMPLETION\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${USE_AES_OCB_FROM_OPENSSL_TRUE}" && test -z "${USE_AES_OCB_FROM_OPENSSL_FALSE}"; then as_fn_error $? "conditional \"USE_AES_OCB_FROM_OPENSSL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${USE_AES_OCB_FROM_OPENSSL_TRUE}" && test -z "${USE_AES_OCB_FROM_OPENSSL_FALSE}"; then as_fn_error $? "conditional \"USE_AES_OCB_FROM_OPENSSL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${USE_AES_OCB_FROM_OPENSSL_TRUE}" && test -z "${USE_AES_OCB_FROM_OPENSSL_FALSE}"; then as_fn_error $? "conditional \"USE_AES_OCB_FROM_OPENSSL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${USE_AES_OCB_FROM_OPENSSL_TRUE}" && test -z "${USE_AES_OCB_FROM_OPENSSL_FALSE}"; then as_fn_error $? "conditional \"USE_AES_OCB_FROM_OPENSSL\" 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 as_nop=: 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 $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; 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 $as_nop as_fn_append () { eval $1=\$$1\$2 } 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 $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } 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_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" 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 mosh $as_me 1.4.0, which was generated by GNU Autoconf 2.71. 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 ." _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="\\ mosh config.status 1.4.0 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" Copyright (C) 2021 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}" _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 "src/include/config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/include/config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "src/crypto/Makefile") CONFIG_FILES="$CONFIG_FILES src/crypto/Makefile" ;; "src/frontend/Makefile") CONFIG_FILES="$CONFIG_FILES src/frontend/Makefile" ;; "src/fuzz/Makefile") CONFIG_FILES="$CONFIG_FILES src/fuzz/Makefile" ;; "src/include/Makefile") CONFIG_FILES="$CONFIG_FILES src/include/Makefile" ;; "src/network/Makefile") CONFIG_FILES="$CONFIG_FILES src/network/Makefile" ;; "src/protobufs/Makefile") CONFIG_FILES="$CONFIG_FILES src/protobufs/Makefile" ;; "src/statesync/Makefile") CONFIG_FILES="$CONFIG_FILES src/statesync/Makefile" ;; "src/terminal/Makefile") CONFIG_FILES="$CONFIG_FILES src/terminal/Makefile" ;; "src/util/Makefile") CONFIG_FILES="$CONFIG_FILES src/util/Makefile" ;; "scripts/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/Makefile" ;; "src/examples/Makefile") CONFIG_FILES="$CONFIG_FILES src/examples/Makefile" ;; "src/tests/Makefile") CONFIG_FILES="$CONFIG_FILES src/tests/Makefile" ;; "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; "conf/Makefile") CONFIG_FILES="$CONFIG_FILES conf/Makefile" ;; *) 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 } ;; 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 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: === Configuration results ===" >&5 printf "%s\n" "$as_me: === Configuration results ===" >&6;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Version: $PACKAGE_VERSION" >&5 printf "%s\n" "$as_me: Version: $PACKAGE_VERSION" >&6;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: c++ compiler: $CXX" >&5 printf "%s\n" "$as_me: c++ compiler: $CXX" >&6;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Warning CXXFLAGS: $WARNING_CXXFLAGS" >&5 printf "%s\n" "$as_me: Warning CXXFLAGS: $WARNING_CXXFLAGS" >&6;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Picky CXXFLAGS: $PICKY_CXXFLAGS" >&5 printf "%s\n" "$as_me: Picky CXXFLAGS: $PICKY_CXXFLAGS" >&6;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Harden CFLAGS: $HARDEN_CFLAGS" >&5 printf "%s\n" "$as_me: Harden CFLAGS: $HARDEN_CFLAGS" >&6;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Cryptography: $human_readable_cryptography_description" >&5 printf "%s\n" "$as_me: Cryptography: $human_readable_cryptography_description" >&6;} { printf "%s\n" "$as_me:${as_lineno-$LINENO}: =============================" >&5 printf "%s\n" "$as_me: =============================" >&6;} mosh-1.4.0/compile0000755000175000017500000001635014327736657011012 00000000000000#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2021 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 | *.[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 . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]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: mosh-1.4.0/depcomp0000755000175000017500000005602014327736660011001 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2021 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 . EOF exit $? ;; -v | --v*) echo "depcomp $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 digits=0123456789 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 interferences 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 obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB 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: mosh-1.4.0/conf/0000775000175000017500000000000014327736673010434 500000000000000mosh-1.4.0/conf/Makefile.in0000664000175000017500000004127214327736657012431 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 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)) 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 = : @INSTALL_UFW_TRUE@am__append_1 = ufw/applications.d/mosh @INSTALL_COMPLETION_TRUE@am__append_2 = bash-completion/completions/mosh subdir = conf ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ $(top_srcdir)/m4/ax_ac_print_to_file.m4 \ $(top_srcdir)/m4/ax_add_am_macro_static.m4 \ $(top_srcdir)/m4/ax_am_macros_static.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_gnu_make.m4 \ $(top_srcdir)/m4/ax_check_library.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_code_coverage.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ $(top_srcdir)/m4/ax_file_escapes.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 $(top_srcdir)/m4/pkg.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__dist_completions_DATA_DIST) \ $(am__nobase_dist_sysconf_DATA_DIST) $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/include/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__dist_completions_DATA_DIST = bash-completion/completions/mosh 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 -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(completionsdir)" \ "$(DESTDIR)$(sysconfdir)" am__nobase_dist_sysconf_DATA_DIST = ufw/applications.d/mosh DATA = $(dist_completions_DATA) $(nobase_dist_sysconf_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@ CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@ CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@ CPPFLAGS = @CPPFLAGS@ CRYPTO_CFLAGS = @CRYPTO_CFLAGS@ CRYPTO_LIBS = @CRYPTO_LIBS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CURSES_LIB = @CURSES_LIB@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FUZZING_CFLAGS = @FUZZING_CFLAGS@ GCOV = @GCOV@ GENHTML = @GENHTML@ HARDEN_CFLAGS = @HARDEN_CFLAGS@ HARDEN_LDFLAGS = @HARDEN_LDFLAGS@ HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LCOV = @LCOV@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MISC_CXXFLAGS = @MISC_CXXFLAGS@ MKDIR_P = @MKDIR_P@ Nettle_CFLAGS = @Nettle_CFLAGS@ Nettle_LIBS = @Nettle_LIBS@ OBJEXT = @OBJEXT@ OpenSSL_CFLAGS = @OpenSSL_CFLAGS@ OpenSSL_LIBS = @OpenSSL_LIBS@ 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@ PICKY_CXXFLAGS = @PICKY_CXXFLAGS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROTOC = @PROTOC@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TINFO_CFLAGS = @TINFO_CFLAGS@ TINFO_CPPFLAGS = @TINFO_CPPFLAGS@ TINFO_LDFLAGS = @TINFO_LDFLAGS@ TINFO_LIBS = @TINFO_LIBS@ VERSION = @VERSION@ WARNING_CXXFLAGS = @WARNING_CXXFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ completions = @completions@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ ifGNUmake = @ifGNUmake@ ifnGNUmake = @ifnGNUmake@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ protobuf_CFLAGS = @protobuf_CFLAGS@ protobuf_LIBS = @protobuf_LIBS@ 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@ completionsdir = @completions@ dist_completions_DATA = $(am__append_2) nobase_dist_sysconf_DATA = $(am__append_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 conf/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign conf/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-dist_completionsDATA: $(dist_completions_DATA) @$(NORMAL_INSTALL) @list='$(dist_completions_DATA)'; test -n "$(completionsdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(completionsdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(completionsdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(completionsdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(completionsdir)" || exit $$?; \ done uninstall-dist_completionsDATA: @$(NORMAL_UNINSTALL) @list='$(dist_completions_DATA)'; test -n "$(completionsdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(completionsdir)'; $(am__uninstall_files_from_dir) install-nobase_dist_sysconfDATA: $(nobase_dist_sysconf_DATA) @$(NORMAL_INSTALL) @list='$(nobase_dist_sysconf_DATA)'; test -n "$(sysconfdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sysconfdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sysconfdir)" || exit 1; \ fi; \ $(am__nobase_list) | while read dir files; do \ xfiles=; for file in $$files; do \ if test -f "$$file"; then xfiles="$$xfiles $$file"; \ else xfiles="$$xfiles $(srcdir)/$$file"; fi; done; \ test -z "$$xfiles" || { \ test "x$$dir" = x. || { \ echo " $(MKDIR_P) '$(DESTDIR)$(sysconfdir)/$$dir'"; \ $(MKDIR_P) "$(DESTDIR)$(sysconfdir)/$$dir"; }; \ echo " $(INSTALL_DATA) $$xfiles '$(DESTDIR)$(sysconfdir)/$$dir'"; \ $(INSTALL_DATA) $$xfiles "$(DESTDIR)$(sysconfdir)/$$dir" || exit $$?; }; \ done uninstall-nobase_dist_sysconfDATA: @$(NORMAL_UNINSTALL) @list='$(nobase_dist_sysconf_DATA)'; test -n "$(sysconfdir)" || list=; \ $(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \ dir='$(DESTDIR)$(sysconfdir)'; $(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 $(DATA) installdirs: for dir in "$(DESTDIR)$(completionsdir)" "$(DESTDIR)$(sysconfdir)"; 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: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || 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-dist_completionsDATA install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-nobase_dist_sysconfDATA 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 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-dist_completionsDATA \ uninstall-nobase_dist_sysconfDATA .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-dist_completionsDATA install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-nobase_dist_sysconfDATA 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-dist_completionsDATA \ uninstall-nobase_dist_sysconfDATA .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: mosh-1.4.0/conf/ufw/0000775000175000017500000000000014327736673011235 500000000000000mosh-1.4.0/conf/ufw/applications.d/0000775000175000017500000000000014327736673014145 500000000000000mosh-1.4.0/conf/ufw/applications.d/mosh0000644000175000017500000000020113103401307014713 00000000000000[mosh] title=Mosh (mobile shell) description=Mobile shell that supports roaming and intelligent local echo ports=60000:61000/udp mosh-1.4.0/conf/Makefile.am0000644000175000017500000000036713103401307012362 00000000000000completionsdir = @completions@ dist_completions_DATA = nobase_dist_sysconf_DATA = if INSTALL_UFW nobase_dist_sysconf_DATA += ufw/applications.d/mosh endif if INSTALL_COMPLETION dist_completions_DATA += bash-completion/completions/mosh endif mosh-1.4.0/conf/bash-completion/0000775000175000017500000000000014327736673013520 500000000000000mosh-1.4.0/conf/bash-completion/completions/0000775000175000017500000000000014327736673016054 500000000000000mosh-1.4.0/conf/bash-completion/completions/mosh0000644000175000017500000000146213103401307016634 00000000000000# Bash completions for Mosh, the mobile shell. -*- shell-script -*- __mosh_init_completion() { if declare -F _init_completions >/dev/null 2>&1; then _init_completion else COMPREPLY=() _get_comp_words_by_ref cur prev words cword fi } _mosh () { local cur __mosh_init_completion || return local simple_flags="-a -b -4 -6 -p" local flags="--client= --server= --predict= --family= --port= --bind-server= --ssh= --no-init --help --version" if [[ "$cur" == --* && "$COMP_CWORD" == 1 ]]; then COMPREPLY=($(compgen -W "$flags" -- "$cur")) elif [[ "$cur" == -* && "$COMP_CWORD" == 1 ]]; then COMPREPLY=($(compgen -W "$simple_flags" -- "$cur")) else _known_hosts_real -a "$cur" fi } complete -o nospace -F _mosh mosh mosh-1.4.0/autogen.sh0000755000175000017500000000003713103401307011374 00000000000000#!/bin/sh exec autoreconf -fi mosh-1.4.0/test-driver0000755000175000017500000001141714327736660011623 00000000000000#! /bin/sh # test-driver - basic testsuite driver script. scriptversion=2018-03-07.03; # UTC # Copyright (C) 2011-2021 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. # This file is maintained in Automake, please report # bugs to or send patches to # . # Make unconditional expansion of undefined variables an error. This # helps a lot in preventing typo-related bugs. set -u usage_error () { echo "$0: $*" >&2 print_usage >&2 exit 2 } print_usage () { cat <"$log_file" "$@" >>"$log_file" 2>&1 estatus=$? if test $enable_hard_errors = no && test $estatus -eq 99; then tweaked_estatus=1 else tweaked_estatus=$estatus fi case $tweaked_estatus:$expect_failure in 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; 0:*) col=$grn res=PASS recheck=no gcopy=no;; 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; *:*) col=$red res=FAIL recheck=yes gcopy=yes;; esac # Report the test outcome and exit status in the logs, so that one can # know whether the test passed or failed simply by looking at the '.log' # file, without the need of also peaking into the corresponding '.trs' # file (automake bug#11814). echo "$res $test_name (exit status: $estatus)" >>"$log_file" # Report outcome to console. echo "${col}${res}${std}: $test_name" # Register the test result, and other relevant metadata. echo ":test-result: $res" > $trs_file echo ":global-test-result: $res" >> $trs_file echo ":recheck: $recheck" >> $trs_file echo ":copy-in-global-log: $gcopy" >> $trs_file # 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: mosh-1.4.0/src/0000775000175000017500000000000014327736673010276 500000000000000mosh-1.4.0/src/Makefile.in0000664000175000017500000004572514327736657012302 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 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)) 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 = : subdir = src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ $(top_srcdir)/m4/ax_ac_print_to_file.m4 \ $(top_srcdir)/m4/ax_add_am_macro_static.m4 \ $(top_srcdir)/m4/ax_am_macros_static.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_gnu_make.m4 \ $(top_srcdir)/m4/ax_check_library.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_code_coverage.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ $(top_srcdir)/m4/ax_file_escapes.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 $(top_srcdir)/m4/pkg.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 = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/include/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 = 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 \ distdir distdir-am 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)` DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 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" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@ CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@ CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@ CPPFLAGS = @CPPFLAGS@ CRYPTO_CFLAGS = @CRYPTO_CFLAGS@ CRYPTO_LIBS = @CRYPTO_LIBS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CURSES_LIB = @CURSES_LIB@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FUZZING_CFLAGS = @FUZZING_CFLAGS@ GCOV = @GCOV@ GENHTML = @GENHTML@ HARDEN_CFLAGS = @HARDEN_CFLAGS@ HARDEN_LDFLAGS = @HARDEN_LDFLAGS@ HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LCOV = @LCOV@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MISC_CXXFLAGS = @MISC_CXXFLAGS@ MKDIR_P = @MKDIR_P@ Nettle_CFLAGS = @Nettle_CFLAGS@ Nettle_LIBS = @Nettle_LIBS@ OBJEXT = @OBJEXT@ OpenSSL_CFLAGS = @OpenSSL_CFLAGS@ OpenSSL_LIBS = @OpenSSL_LIBS@ 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@ PICKY_CXXFLAGS = @PICKY_CXXFLAGS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROTOC = @PROTOC@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TINFO_CFLAGS = @TINFO_CFLAGS@ TINFO_CPPFLAGS = @TINFO_CPPFLAGS@ TINFO_LDFLAGS = @TINFO_LDFLAGS@ TINFO_LIBS = @TINFO_LIBS@ VERSION = @VERSION@ WARNING_CXXFLAGS = @WARNING_CXXFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ completions = @completions@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ ifGNUmake = @ifGNUmake@ ifnGNUmake = @ifnGNUmake@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ protobuf_CFLAGS = @protobuf_CFLAGS@ protobuf_LIBS = @protobuf_LIBS@ 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 = include protobufs util crypto terminal network statesync frontend examples tests fuzz all: all-recursive .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 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): # 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" 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 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 @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 check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: 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: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || 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-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic 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 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) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic cscopelist-am ctags ctags-am \ distclean distclean-generic distclean-tags 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-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 # 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: mosh-1.4.0/src/network/0000775000175000017500000000000014327736673011767 500000000000000mosh-1.4.0/src/network/Makefile.in0000664000175000017500000004552214327736660013760 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 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)) 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 = : subdir = src/network ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ $(top_srcdir)/m4/ax_ac_print_to_file.m4 \ $(top_srcdir)/m4/ax_add_am_macro_static.m4 \ $(top_srcdir)/m4/ax_am_macros_static.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_gnu_make.m4 \ $(top_srcdir)/m4/ax_check_library.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_code_coverage.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ $(top_srcdir)/m4/ax_file_escapes.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 $(top_srcdir)/m4/pkg.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 = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) ARFLAGS = cru AM_V_AR = $(am__v_AR_@AM_V@) am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) am__v_AR_0 = @echo " AR " $@; am__v_AR_1 = libmoshnetwork_a_AR = $(AR) $(ARFLAGS) libmoshnetwork_a_LIBADD = am_libmoshnetwork_a_OBJECTS = network.$(OBJEXT) \ transportfragment.$(OBJEXT) compressor.$(OBJEXT) libmoshnetwork_a_OBJECTS = $(am_libmoshnetwork_a_OBJECTS) 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)/src/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/compressor.Po ./$(DEPDIR)/network.Po \ ./$(DEPDIR)/transportfragment.Po am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) am__v_CXX_0 = @echo " CXX " $@; am__v_CXX_1 = CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) am__v_CXXLD_0 = @echo " CXXLD " $@; am__v_CXXLD_1 = 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 = $(libmoshnetwork_a_SOURCES) DIST_SOURCES = $(libmoshnetwork_a_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@ CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@ CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@ CPPFLAGS = @CPPFLAGS@ CRYPTO_CFLAGS = @CRYPTO_CFLAGS@ CRYPTO_LIBS = @CRYPTO_LIBS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CURSES_LIB = @CURSES_LIB@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FUZZING_CFLAGS = @FUZZING_CFLAGS@ GCOV = @GCOV@ GENHTML = @GENHTML@ HARDEN_CFLAGS = @HARDEN_CFLAGS@ HARDEN_LDFLAGS = @HARDEN_LDFLAGS@ HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LCOV = @LCOV@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MISC_CXXFLAGS = @MISC_CXXFLAGS@ MKDIR_P = @MKDIR_P@ Nettle_CFLAGS = @Nettle_CFLAGS@ Nettle_LIBS = @Nettle_LIBS@ OBJEXT = @OBJEXT@ OpenSSL_CFLAGS = @OpenSSL_CFLAGS@ OpenSSL_LIBS = @OpenSSL_LIBS@ 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@ PICKY_CXXFLAGS = @PICKY_CXXFLAGS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROTOC = @PROTOC@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TINFO_CFLAGS = @TINFO_CFLAGS@ TINFO_CPPFLAGS = @TINFO_CPPFLAGS@ TINFO_LDFLAGS = @TINFO_LDFLAGS@ TINFO_LIBS = @TINFO_LIBS@ VERSION = @VERSION@ WARNING_CXXFLAGS = @WARNING_CXXFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ completions = @completions@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ ifGNUmake = @ifGNUmake@ ifnGNUmake = @ifnGNUmake@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ protobuf_CFLAGS = @protobuf_CFLAGS@ protobuf_LIBS = @protobuf_LIBS@ 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@ AM_CPPFLAGS = -I$(srcdir)/../util -I$(srcdir)/../crypto -I../protobufs $(protobuf_CFLAGS) AM_CXXFLAGS = $(WARNING_CXXFLAGS) $(PICKY_CXXFLAGS) $(HARDEN_CFLAGS) $(MISC_CXXFLAGS) $(CODE_COVERAGE_CXXFLAGS) noinst_LIBRARIES = libmoshnetwork.a libmoshnetwork_a_SOURCES = network.cc network.h networktransport-impl.h networktransport.h transportfragment.cc transportfragment.h transportsender-impl.h transportsender.h transportstate.h compressor.cc compressor.h all: all-am .SUFFIXES: .SUFFIXES: .cc .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/network/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/network/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): clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libmoshnetwork.a: $(libmoshnetwork_a_OBJECTS) $(libmoshnetwork_a_DEPENDENCIES) $(EXTRA_libmoshnetwork_a_DEPENDENCIES) $(AM_V_at)-rm -f libmoshnetwork.a $(AM_V_AR)$(libmoshnetwork_a_AR) libmoshnetwork.a $(libmoshnetwork_a_OBJECTS) $(libmoshnetwork_a_LIBADD) $(AM_V_at)$(RANLIB) libmoshnetwork.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compressor.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/network.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transportfragment.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .cc.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -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 $(LIBRARIES) installdirs: 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: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || 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 clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/compressor.Po -rm -f ./$(DEPDIR)/network.Po -rm -f ./$(DEPDIR)/transportfragment.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-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)/compressor.Po -rm -f ./$(DEPDIR)/network.Po -rm -f ./$(DEPDIR)/transportfragment.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: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-noinstLIBRARIES 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-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 \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .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: mosh-1.4.0/src/network/networktransport.h0000644000175000017500000001177013103401307015500 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #ifndef NETWORK_TRANSPORT_HPP #define NETWORK_TRANSPORT_HPP #include #include #include #include #include #include "network.h" #include "transportsender.h" #include "transportfragment.h" namespace Network { template class Transport { private: /* the underlying, encrypted network connection */ Connection connection; /* sender side */ TransportSender sender; /* helper methods for recv() */ void process_throwaway_until( uint64_t throwaway_num ); /* simple receiver */ list< TimestampedState > received_states; uint64_t receiver_quench_timer; RemoteState last_receiver_state; /* the state we were in when user last queried state */ FragmentAssembly fragments; unsigned int verbose; public: Transport( MyState &initial_state, RemoteState &initial_remote, const char *desired_ip, const char *desired_port ); Transport( MyState &initial_state, RemoteState &initial_remote, const char *key_str, const char *ip, const char *port ); /* Send data or an ack if necessary. */ void tick( void ) { sender.tick(); } /* Returns the number of ms to wait until next possible event. */ int wait_time( void ) { return sender.wait_time(); } /* Blocks waiting for a packet. */ void recv( void ); /* Find diff between last receiver state and current remote state, then rationalize states. */ string get_remote_diff( void ); /* Shut down other side of connection. */ /* Illegal to change current_state after this. */ void start_shutdown( void ) { sender.start_shutdown(); } bool shutdown_in_progress( void ) const { return sender.get_shutdown_in_progress(); } bool shutdown_acknowledged( void ) const { return sender.get_shutdown_acknowledged(); } bool shutdown_ack_timed_out( void ) const { return sender.shutdown_ack_timed_out(); } bool has_remote_addr( void ) const { return connection.get_has_remote_addr(); } /* Other side has requested shutdown and we have sent one ACK */ bool counterparty_shutdown_ack_sent( void ) const { return sender.get_counterparty_shutdown_acknowledged(); } std::string port( void ) const { return connection.port(); } string get_key( void ) const { return connection.get_key(); } MyState &get_current_state( void ) { return sender.get_current_state(); } void set_current_state( const MyState &x ) { sender.set_current_state( x ); } uint64_t get_remote_state_num( void ) const { return received_states.back().num; } const TimestampedState & get_latest_remote_state( void ) const { return received_states.back(); } const std::vector< int > fds( void ) const { return connection.fds(); } void set_verbose( unsigned int s_verbose ) { sender.set_verbose( s_verbose ); verbose = s_verbose; } void set_send_delay( int new_delay ) { sender.set_send_delay( new_delay ); } uint64_t get_sent_state_acked_timestamp( void ) const { return sender.get_sent_state_acked_timestamp(); } uint64_t get_sent_state_acked( void ) const { return sender.get_sent_state_acked(); } uint64_t get_sent_state_last( void ) const { return sender.get_sent_state_last(); } unsigned int send_interval( void ) const { return sender.send_interval(); } const Addr &get_remote_addr( void ) const { return connection.get_remote_addr(); } socklen_t get_remote_addr_len( void ) const { return connection.get_remote_addr_len(); } std::string &get_send_error( void ) { return connection.get_send_error(); } }; } #endif mosh-1.4.0/src/network/transportfragment.cc0000664000175000017500000001405114174450057015764 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include #include "byteorder.h" #include "transportfragment.h" #include "transportinstruction.pb.h" #include "compressor.h" #include "fatal_assert.h" using namespace Network; using namespace TransportBuffers; static string network_order_string( uint16_t host_order ) { uint16_t net_int = htobe16( host_order ); return string( (char *)&net_int, sizeof( net_int ) ); } static string network_order_string( uint64_t host_order ) { uint64_t net_int = htobe64( host_order ); return string( (char *)&net_int, sizeof( net_int ) ); } string Fragment::tostring( void ) { assert( initialized ); string ret; ret += network_order_string( id ); fatal_assert( !( fragment_num & 0x8000 ) ); /* effective limit on size of a terminal screen change or buffered user input */ uint16_t combined_fragment_num = ( final << 15 ) | fragment_num; ret += network_order_string( combined_fragment_num ); assert( ret.size() == frag_header_len ); ret += contents; return ret; } Fragment::Fragment( const string &x ) : id( -1 ), fragment_num( -1 ), final( false ), initialized( true ), contents() { fatal_assert( x.size() >= frag_header_len ); contents = string( x.begin() + frag_header_len, x.end() ); uint64_t data64; uint16_t *data16 = (uint16_t *)x.data(); memcpy( &data64, x.data(), sizeof( data64 ) ); id = be64toh( data64 ); fragment_num = be16toh( data16[ 4 ] ); final = ( fragment_num & 0x8000 ) >> 15; fragment_num &= 0x7FFF; } bool FragmentAssembly::add_fragment( Fragment &frag ) { /* see if this is a totally new packet */ if ( current_id != frag.id ) { fragments.clear(); fragments.resize( frag.fragment_num + 1 ); fragments.at( frag.fragment_num ) = frag; fragments_arrived = 1; fragments_total = -1; /* unknown */ current_id = frag.id; } else { /* not a new packet */ /* see if we already have this fragment */ if ( (fragments.size() > frag.fragment_num) && (fragments.at( frag.fragment_num ).initialized) ) { /* make sure new version is same as what we already have */ assert( fragments.at( frag.fragment_num ) == frag ); } else { if ( (int)fragments.size() < frag.fragment_num + 1 ) { fragments.resize( frag.fragment_num + 1 ); } fragments.at( frag.fragment_num ) = frag; fragments_arrived++; } } if ( frag.final ) { fragments_total = frag.fragment_num + 1; assert( (int)fragments.size() <= fragments_total ); fragments.resize( fragments_total ); } if ( fragments_total != -1 ) { assert( fragments_arrived <= fragments_total ); } /* see if we're done */ return fragments_arrived == fragments_total; } Instruction FragmentAssembly::get_assembly( void ) { assert( fragments_arrived == fragments_total ); string encoded; for ( int i = 0; i < fragments_total; i++ ) { assert( fragments.at( i ).initialized ); encoded += fragments.at( i ).contents; } Instruction ret; fatal_assert( ret.ParseFromString( get_compressor().uncompress_str( encoded ) ) ); fragments.clear(); fragments_arrived = 0; fragments_total = -1; return ret; } bool Fragment::operator==( const Fragment &x ) const { return ( id == x.id ) && ( fragment_num == x.fragment_num ) && ( final == x.final ) && ( initialized == x.initialized ) && ( contents == x.contents ); } vector Fragmenter::make_fragments( const Instruction &inst, size_t MTU ) { MTU -= Fragment::frag_header_len; if ( (inst.old_num() != last_instruction.old_num()) || (inst.new_num() != last_instruction.new_num()) || (inst.ack_num() != last_instruction.ack_num()) || (inst.throwaway_num() != last_instruction.throwaway_num()) || (inst.chaff() != last_instruction.chaff()) || (inst.protocol_version() != last_instruction.protocol_version()) || (last_MTU != MTU) ) { next_instruction_id++; } if ( (inst.old_num() == last_instruction.old_num()) && (inst.new_num() == last_instruction.new_num()) ) { assert( inst.diff() == last_instruction.diff() ); } last_instruction = inst; last_MTU = MTU; string payload = get_compressor().compress_str( inst.SerializeAsString() ); uint16_t fragment_num = 0; vector ret; while ( !payload.empty() ) { string this_fragment; bool final = false; if ( payload.size() > MTU ) { this_fragment = string( payload.begin(), payload.begin() + MTU ); payload = string( payload.begin() + MTU, payload.end() ); } else { this_fragment = payload; payload.clear(); final = true; } ret.push_back( Fragment( next_instruction_id, fragment_num++, final, this_fragment ) ); } return ret; } mosh-1.4.0/src/network/network.cc0000664000175000017500000004647614174450057013715 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include "config.h" #include #include #ifdef HAVE_SYS_UIO_H #include #endif #include #include #include #include #include #include #include "dos_assert.h" #include "fatal_assert.h" #include "byteorder.h" #include "network.h" #include "crypto.h" #include "timestamp.h" #ifndef MSG_DONTWAIT #define MSG_DONTWAIT MSG_NONBLOCK #endif #ifndef AI_NUMERICSERV #define AI_NUMERICSERV 0 #endif using namespace Network; using namespace Crypto; const uint64_t DIRECTION_MASK = uint64_t(1) << 63; const uint64_t SEQUENCE_MASK = uint64_t(-1) ^ DIRECTION_MASK; /* Read in packet */ Packet::Packet( const Message & message ) : seq( message.nonce.val() & SEQUENCE_MASK ), direction( (message.nonce.val() & DIRECTION_MASK) ? TO_CLIENT : TO_SERVER ), timestamp( -1 ), timestamp_reply( -1 ), payload() { dos_assert( message.text.size() >= 2 * sizeof( uint16_t ) ); const uint16_t *data = (uint16_t *)message.text.data(); timestamp = be16toh( data[ 0 ] ); timestamp_reply = be16toh( data[ 1 ] ); payload = string( message.text.begin() + 2 * sizeof( uint16_t ), message.text.end() ); } /* Output from packet */ Message Packet::toMessage( void ) { uint64_t direction_seq = (uint64_t( direction == TO_CLIENT ) << 63) | (seq & SEQUENCE_MASK); uint16_t ts_net[ 2 ] = { static_cast( htobe16( timestamp ) ), static_cast( htobe16( timestamp_reply ) ) }; string timestamps = string( (char *)ts_net, 2 * sizeof( uint16_t ) ); return Message( Nonce( direction_seq ), timestamps + payload ); } Packet Connection::new_packet( const string &s_payload ) { uint16_t outgoing_timestamp_reply = -1; uint64_t now = timestamp(); if ( now - saved_timestamp_received_at < 1000 ) { /* we have a recent received timestamp */ /* send "corrected" timestamp advanced by how long we held it */ outgoing_timestamp_reply = saved_timestamp + (now - saved_timestamp_received_at); saved_timestamp = -1; saved_timestamp_received_at = 0; } Packet p( direction, timestamp16(), outgoing_timestamp_reply, s_payload ); return p; } void Connection::hop_port( void ) { assert( !server ); setup(); assert( remote_addr_len != 0 ); socks.push_back( Socket( remote_addr.sa.sa_family ) ); prune_sockets(); } void Connection::prune_sockets( void ) { /* don't keep old sockets if the new socket has been working for long enough */ if ( socks.size() > 1 ) { if ( timestamp() - last_port_choice > MAX_OLD_SOCKET_AGE ) { int num_to_kill = socks.size() - 1; for ( int i = 0; i < num_to_kill; i++ ) { socks.pop_front(); } } } else { return; } /* make sure we don't have too many receive sockets open */ if ( socks.size() > MAX_PORTS_OPEN ) { int num_to_kill = socks.size() - MAX_PORTS_OPEN; for ( int i = 0; i < num_to_kill; i++ ) { socks.pop_front(); } } } Connection::Socket::Socket( int family ) : _fd( socket( family, SOCK_DGRAM, 0 ) ) { if ( _fd < 0 ) { throw NetworkException( "socket", errno ); } /* Disable path MTU discovery */ #ifdef HAVE_IP_MTU_DISCOVER int flag = IP_PMTUDISC_DONT; if ( setsockopt( _fd, IPPROTO_IP, IP_MTU_DISCOVER, &flag, sizeof flag ) < 0 ) { throw NetworkException( "setsockopt", errno ); } #endif // int dscp = 0x92; /* OS X does not have IPTOS_DSCP_AF42 constant */ int dscp = 0x02; /* ECN-capable transport only */ if ( setsockopt( _fd, IPPROTO_IP, IP_TOS, &dscp, sizeof dscp ) < 0 ) { // perror( "setsockopt( IP_TOS )" ); } /* request explicit congestion notification on received datagrams */ #ifdef HAVE_IP_RECVTOS int tosflag = true; if ( setsockopt( _fd, IPPROTO_IP, IP_RECVTOS, &tosflag, sizeof tosflag ) < 0 && family == IPPROTO_IP ) { /* FreeBSD disallows this option on IPv6 sockets. */ perror( "setsockopt( IP_RECVTOS )" ); } #endif } void Connection::setup( void ) { last_port_choice = timestamp(); } const std::vector< int > Connection::fds( void ) const { std::vector< int > ret; for ( std::deque< Socket >::const_iterator it = socks.begin(); it != socks.end(); it++ ) { ret.push_back( it->fd() ); } return ret; } void Connection::set_MTU( int family ) { switch ( family ) { case AF_INET: MTU = DEFAULT_IPV4_MTU - IPV4_HEADER_LEN; break; case AF_INET6: MTU = DEFAULT_IPV6_MTU - IPV6_HEADER_LEN; break; default: throw NetworkException( "Unknown address family", 0 ); } } class AddrInfo { public: struct addrinfo *res; AddrInfo( const char *node, const char *service, const struct addrinfo *hints ) : res( NULL ) { int errcode = getaddrinfo( node, service, hints, &res ); if ( errcode != 0 ) { throw NetworkException( std::string( "Bad IP address (" ) + (node != NULL ? node : "(null)") + "): " + gai_strerror( errcode ), 0 ); } } ~AddrInfo() { freeaddrinfo(res); } private: AddrInfo(const AddrInfo &); AddrInfo &operator=(const AddrInfo &); }; Connection::Connection( const char *desired_ip, const char *desired_port ) /* server */ : socks(), has_remote_addr( false ), remote_addr(), remote_addr_len( 0 ), server( true ), MTU( DEFAULT_SEND_MTU ), key(), session( key ), direction( TO_CLIENT ), saved_timestamp( -1 ), saved_timestamp_received_at( 0 ), expected_receiver_seq( 0 ), last_heard( -1 ), last_port_choice( -1 ), last_roundtrip_success( -1 ), RTT_hit( false ), SRTT( 1000 ), RTTVAR( 500 ), send_error() { setup(); /* The mosh wrapper always gives an IP request, in order to deal with multihomed servers. The port is optional. */ /* If an IP request is given, we try to bind to that IP, but we also try INADDR_ANY. If a port request is given, we bind only to that port. */ /* convert port numbers */ int desired_port_low = -1; int desired_port_high = -1; if ( desired_port && !parse_portrange( desired_port, desired_port_low, desired_port_high ) ) { throw NetworkException("Invalid port range", 0); } /* try to bind to desired IP first */ if ( desired_ip ) { try { if ( try_bind( desired_ip, desired_port_low, desired_port_high ) ) { return; } } catch ( const NetworkException &e ) { fprintf( stderr, "Error binding to IP %s: %s\n", desired_ip, e.what() ); } } /* now try any local interface */ try { if ( try_bind( NULL, desired_port_low, desired_port_high ) ) { return; } } catch ( const NetworkException &e ) { fprintf( stderr, "Error binding to any interface: %s\n", e.what() ); throw; /* this time it's fatal */ } throw NetworkException( "Could not bind", errno ); } bool Connection::try_bind( const char *addr, int port_low, int port_high ) { struct addrinfo hints; memset( &hints, 0, sizeof( hints ) ); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_DGRAM; hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST | AI_NUMERICSERV; AddrInfo ai( addr, "0", &hints ); Addr local_addr; socklen_t local_addr_len = ai.res->ai_addrlen; memcpy( &local_addr.sa, ai.res->ai_addr, local_addr_len ); int search_low = PORT_RANGE_LOW, search_high = PORT_RANGE_HIGH; if ( port_low != -1 ) { /* low port preference */ search_low = port_low; } if ( port_high != -1 ) { /* high port preference */ search_high = port_high; } socks.push_back( Socket( local_addr.sa.sa_family ) ); for ( int i = search_low; i <= search_high; i++ ) { switch (local_addr.sa.sa_family) { case AF_INET: local_addr.sin.sin_port = htons( i ); break; case AF_INET6: local_addr.sin6.sin6_port = htons( i ); break; default: throw NetworkException( "Unknown address family", 0 ); } if ( local_addr.sa.sa_family == AF_INET6 && memcmp(&local_addr.sin6.sin6_addr, &in6addr_any, sizeof(in6addr_any)) == 0 ) { const int off = 0; if ( setsockopt( sock(), IPPROTO_IPV6, IPV6_V6ONLY, &off, sizeof(off) ) ) { perror( "setsockopt( IPV6_V6ONLY, off )" ); } } if ( ::bind( sock(), &local_addr.sa, local_addr_len ) == 0 ) { set_MTU( local_addr.sa.sa_family ); return true; } // else fallthrough to below code, on last iteration. } int saved_errno = errno; socks.pop_back(); char host[ NI_MAXHOST ], serv[ NI_MAXSERV ]; int errcode = getnameinfo( &local_addr.sa, local_addr_len, host, sizeof( host ), serv, sizeof( serv ), NI_DGRAM | NI_NUMERICHOST | NI_NUMERICSERV ); if ( errcode != 0 ) { throw NetworkException( std::string( "bind: getnameinfo: " ) + gai_strerror( errcode ), 0 ); } fprintf( stderr, "Failed binding to %s:%s\n", host, serv ); throw NetworkException( "bind", saved_errno ); } Connection::Connection( const char *key_str, const char *ip, const char *port ) /* client */ : socks(), has_remote_addr( false ), remote_addr(), remote_addr_len( 0 ), server( false ), MTU( DEFAULT_SEND_MTU ), key( key_str ), session( key ), direction( TO_SERVER ), saved_timestamp( -1 ), saved_timestamp_received_at( 0 ), expected_receiver_seq( 0 ), last_heard( -1 ), last_port_choice( -1 ), last_roundtrip_success( -1 ), RTT_hit( false ), SRTT( 1000 ), RTTVAR( 500 ), send_error() { setup(); /* associate socket with remote host and port */ struct addrinfo hints; memset( &hints, 0, sizeof( hints ) ); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_DGRAM; hints.ai_flags = AI_NUMERICHOST | AI_NUMERICSERV; AddrInfo ai( ip, port, &hints ); fatal_assert( static_cast( ai.res->ai_addrlen ) <= sizeof( remote_addr ) ); remote_addr_len = ai.res->ai_addrlen; memcpy( &remote_addr.sa, ai.res->ai_addr, remote_addr_len ); has_remote_addr = true; socks.push_back( Socket( remote_addr.sa.sa_family ) ); set_MTU( remote_addr.sa.sa_family ); } void Connection::send( const string & s ) { if ( !has_remote_addr ) { return; } Packet px = new_packet( s ); string p = session.encrypt( px.toMessage() ); ssize_t bytes_sent = sendto( sock(), p.data(), p.size(), MSG_DONTWAIT, &remote_addr.sa, remote_addr_len ); if ( bytes_sent != static_cast( p.size() ) ) { /* Make sendto() failure available to the frontend. */ send_error = "sendto: "; send_error += strerror( errno ); if ( errno == EMSGSIZE ) { MTU = DEFAULT_SEND_MTU; /* payload MTU of last resort */ } } uint64_t now = timestamp(); if ( server ) { if ( now - last_heard > SERVER_ASSOCIATION_TIMEOUT ) { has_remote_addr = false; fprintf( stderr, "Server now detached from client.\n" ); } } else { /* client */ if ( ( now - last_port_choice > PORT_HOP_INTERVAL ) && ( now - last_roundtrip_success > PORT_HOP_INTERVAL ) ) { hop_port(); } } } string Connection::recv( void ) { assert( !socks.empty() ); for ( std::deque< Socket >::const_iterator it = socks.begin(); it != socks.end(); it++ ) { string payload; try { payload = recv_one( it->fd()); } catch ( NetworkException & e ) { if ( (e.the_errno == EAGAIN) || (e.the_errno == EWOULDBLOCK) ) { continue; } else { throw; } } /* succeeded */ prune_sockets(); return payload; } throw NetworkException( "No packet received" ); } string Connection::recv_one( int sock_to_recv ) { /* receive source address, ECN, and payload in msghdr structure */ Addr packet_remote_addr; struct msghdr header; struct iovec msg_iovec; char msg_payload[ Session::RECEIVE_MTU ]; char msg_control[ Session::RECEIVE_MTU ]; /* receive source address */ header.msg_name = &packet_remote_addr; header.msg_namelen = sizeof packet_remote_addr; /* receive payload */ msg_iovec.iov_base = msg_payload; msg_iovec.iov_len = sizeof msg_payload; header.msg_iov = &msg_iovec; header.msg_iovlen = 1; /* receive explicit congestion notification */ header.msg_control = msg_control; header.msg_controllen = sizeof msg_control; /* receive flags */ header.msg_flags = 0; ssize_t received_len = recvmsg( sock_to_recv, &header, MSG_DONTWAIT ); if ( received_len < 0 ) { throw NetworkException( "recvmsg", errno ); } if ( header.msg_flags & MSG_TRUNC ) { throw NetworkException( "Received oversize datagram", errno ); } /* receive ECN */ bool congestion_experienced = false; struct cmsghdr *ecn_hdr = CMSG_FIRSTHDR( &header ); if ( ecn_hdr && ecn_hdr->cmsg_level == IPPROTO_IP && ( ecn_hdr->cmsg_type == IP_TOS #ifdef IP_RECVTOS || ecn_hdr->cmsg_type == IP_RECVTOS #endif ) ) { /* got one */ uint8_t *ecn_octet_p = (uint8_t *)CMSG_DATA( ecn_hdr ); assert( ecn_octet_p ); congestion_experienced = (*ecn_octet_p & 0x03) == 0x03; } Packet p( session.decrypt( msg_payload, received_len ) ); dos_assert( p.direction == (server ? TO_SERVER : TO_CLIENT) ); /* prevent malicious playback to sender */ if ( p.seq < expected_receiver_seq ) { /* don't use (but do return) out-of-order packets for timestamp or targeting */ return p.payload; } expected_receiver_seq = p.seq + 1; /* this is security-sensitive because a replay attack could otherwise screw up the timestamp and targeting */ if ( p.timestamp != uint16_t(-1) ) { saved_timestamp = p.timestamp; saved_timestamp_received_at = timestamp(); if ( congestion_experienced ) { /* signal counterparty to slow down */ /* this will gradually slow the counterparty down to the minimum frame rate */ saved_timestamp -= CONGESTION_TIMESTAMP_PENALTY; if ( server ) { fprintf( stderr, "Received explicit congestion notification.\n" ); } } } if ( p.timestamp_reply != uint16_t(-1) ) { uint16_t now = timestamp16(); double R = timestamp_diff( now, p.timestamp_reply ); if ( R < 5000 ) { /* ignore large values, e.g. server was Ctrl-Zed */ if ( !RTT_hit ) { /* first measurement */ SRTT = R; RTTVAR = R / 2; RTT_hit = true; } else { const double alpha = 1.0 / 8.0; const double beta = 1.0 / 4.0; RTTVAR = (1 - beta) * RTTVAR + ( beta * fabs( SRTT - R ) ); SRTT = (1 - alpha) * SRTT + ( alpha * R ); } } } /* auto-adjust to remote host */ has_remote_addr = true; last_heard = timestamp(); if ( server && /* only client can roam */ ( remote_addr_len != header.msg_namelen || memcmp( &remote_addr, &packet_remote_addr, remote_addr_len ) != 0 ) ) { remote_addr = packet_remote_addr; remote_addr_len = header.msg_namelen; char host[ NI_MAXHOST ], serv[ NI_MAXSERV ]; int errcode = getnameinfo( &remote_addr.sa, remote_addr_len, host, sizeof( host ), serv, sizeof( serv ), NI_DGRAM | NI_NUMERICHOST | NI_NUMERICSERV ); if ( errcode != 0 ) { throw NetworkException( std::string( "recv_one: getnameinfo: " ) + gai_strerror( errcode ), 0 ); } fprintf( stderr, "Server now attached to client at %s:%s\n", host, serv ); } return p.payload; } std::string Connection::port( void ) const { Addr local_addr; socklen_t addrlen = sizeof( local_addr ); if ( getsockname( sock(), &local_addr.sa, &addrlen ) < 0 ) { throw NetworkException( "getsockname", errno ); } char serv[ NI_MAXSERV ]; int errcode = getnameinfo( &local_addr.sa, addrlen, NULL, 0, serv, sizeof( serv ), NI_DGRAM | NI_NUMERICSERV ); if ( errcode != 0 ) { throw NetworkException( std::string( "port: getnameinfo: " ) + gai_strerror( errcode ), 0 ); } return std::string( serv ); } uint64_t Network::timestamp( void ) { return frozen_timestamp(); } uint16_t Network::timestamp16( void ) { uint16_t ts = timestamp() % 65536; if ( ts == uint16_t(-1) ) { ts++; } return ts; } uint16_t Network::timestamp_diff( uint16_t tsnew, uint16_t tsold ) { int diff = tsnew - tsold; if ( diff < 0 ) { diff += 65536; } assert( diff >= 0 ); assert( diff <= 65535 ); return diff; } uint64_t Connection::timeout( void ) const { uint64_t RTO = lrint( ceil( SRTT + 4 * RTTVAR ) ); if ( RTO < MIN_RTO ) { RTO = MIN_RTO; } else if ( RTO > MAX_RTO ) { RTO = MAX_RTO; } return RTO; } Connection::Socket::~Socket() { fatal_assert ( close( _fd ) == 0 ); } Connection::Socket::Socket( const Socket & other ) : _fd( dup( other._fd ) ) { if ( _fd < 0 ) { throw NetworkException( "socket", errno ); } } Connection::Socket & Connection::Socket::operator=( const Socket & other ) { if ( dup2( other._fd, _fd ) < 0 ) { throw NetworkException( "socket", errno ); } return *this; } bool Connection::parse_portrange( const char * desired_port, int & desired_port_low, int & desired_port_high ) { /* parse "port" or "portlow:porthigh" */ desired_port_low = desired_port_high = 0; char *end; long value; /* parse first (only?) port */ errno = 0; value = strtol( desired_port, &end, 10 ); if ( (errno != 0) || (*end != '\0' && *end != ':') ) { fprintf( stderr, "Invalid (low) port number (%s)\n", desired_port ); return false; } if ( (value < 0) || (value > 65535) ) { fprintf( stderr, "(Low) port number %ld outside valid range [0..65535]\n", value ); return false; } desired_port_low = (int)value; if (*end == '\0') { /* not a port range */ desired_port_high = desired_port_low; return true; } /* port range; parse high port */ const char * cp = end + 1; errno = 0; value = strtol( cp, &end, 10 ); if ( (errno != 0) || (*end != '\0') ) { fprintf( stderr, "Invalid high port number (%s)\n", cp ); return false; } if ( (value < 0) || (value > 65535) ) { fprintf( stderr, "High port number %ld outside valid range [0..65535]\n", value ); return false; } desired_port_high = (int)value; if ( desired_port_low > desired_port_high ) { fprintf( stderr, "Low port %d greater than high port %d\n", desired_port_low, desired_port_high ); return false; } if ( desired_port_low == 0 ) { fprintf( stderr, "Low port 0 incompatible with port ranges\n" ); return false; } return true; } mosh-1.4.0/src/network/transportsender-impl.h0000664000175000017500000003115714174450057016250 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #ifndef TRANSPORT_SENDER_IMPL_HPP #define TRANSPORT_SENDER_IMPL_HPP #include #include #include #include #include #include "transportsender.h" #include "transportfragment.h" #include using namespace Network; template TransportSender::TransportSender( Connection *s_connection, MyState &initial_state ) : connection( s_connection ), current_state( initial_state ), sent_states( 1, TimestampedState( timestamp(), 0, initial_state ) ), assumed_receiver_state( sent_states.begin() ), fragmenter(), next_ack_time( timestamp() ), next_send_time( timestamp() ), verbose( 0 ), shutdown_in_progress( false ), shutdown_tries( 0 ), shutdown_start( -1 ), ack_num( 0 ), pending_data_ack( false ), SEND_MINDELAY( 8 ), last_heard( 0 ), prng(), mindelay_clock( -1 ) { } /* Try to send roughly two frames per RTT, bounded by limits on frame rate */ template unsigned int TransportSender::send_interval( void ) const { int SEND_INTERVAL = lrint( ceil( connection->get_SRTT() / 2.0 ) ); if ( SEND_INTERVAL < SEND_INTERVAL_MIN ) { SEND_INTERVAL = SEND_INTERVAL_MIN; } else if ( SEND_INTERVAL > SEND_INTERVAL_MAX ) { SEND_INTERVAL = SEND_INTERVAL_MAX; } return SEND_INTERVAL; } /* Housekeeping routine to calculate next send and ack times */ template void TransportSender::calculate_timers( void ) { uint64_t now = timestamp(); /* Update assumed receiver state */ update_assumed_receiver_state(); /* Cut out common prefix of all states */ rationalize_states(); if ( pending_data_ack && (next_ack_time > now + ACK_DELAY) ) { next_ack_time = now + ACK_DELAY; } if ( !(current_state == sent_states.back().state) ) { if ( mindelay_clock == uint64_t( -1 ) ) { mindelay_clock = now; } next_send_time = std::max( mindelay_clock + SEND_MINDELAY, sent_states.back().timestamp + send_interval() ); } else if ( !(current_state == assumed_receiver_state->state) && (last_heard + ACTIVE_RETRY_TIMEOUT > now) ) { next_send_time = sent_states.back().timestamp + send_interval(); if ( mindelay_clock != uint64_t( -1 ) ) { next_send_time = std::max( next_send_time, mindelay_clock + SEND_MINDELAY ); } } else if ( !(current_state == sent_states.front().state ) && (last_heard + ACTIVE_RETRY_TIMEOUT > now) ) { next_send_time = sent_states.back().timestamp + connection->timeout() + ACK_DELAY; } else { next_send_time = uint64_t(-1); } /* speed up shutdown sequence */ if ( shutdown_in_progress || (ack_num == uint64_t(-1)) ) { next_ack_time = sent_states.back().timestamp + send_interval(); } } /* How many ms to wait until next event */ template int TransportSender::wait_time( void ) { calculate_timers(); uint64_t next_wakeup = next_ack_time; if ( next_send_time < next_wakeup ) { next_wakeup = next_send_time; } uint64_t now = timestamp(); if ( !connection->get_has_remote_addr() ) { return INT_MAX; } if ( next_wakeup > now ) { return next_wakeup - now; } else { return 0; } } /* Send data or an empty ack if necessary */ template void TransportSender::tick( void ) { calculate_timers(); /* updates assumed receiver state and rationalizes */ if ( !connection->get_has_remote_addr() ) { return; } uint64_t now = timestamp(); if ( (now < next_ack_time) && (now < next_send_time) ) { return; } /* Determine if a new diff or empty ack needs to be sent */ string diff = current_state.diff_from( assumed_receiver_state->state ); attempt_prospective_resend_optimization( diff ); if ( verbose ) { /* verify diff has round-trip identity (modulo Unicode fallback rendering) */ MyState newstate( assumed_receiver_state->state ); newstate.apply_string( diff ); if ( current_state.compare( newstate ) ) { fprintf( stderr, "Warning, round-trip Instruction verification failed!\n" ); } /* Also verify that both the original frame and generated frame have the same initial diff. */ std::string current_diff( current_state.init_diff() ); std::string new_diff( newstate.init_diff() ); if ( current_diff != new_diff ) { fprintf( stderr, "Warning, target state Instruction verification failed!\n" ); } } if ( diff.empty() ) { if ( (now >= next_ack_time) ) { send_empty_ack(); mindelay_clock = uint64_t( -1 ); } if ( (now >= next_send_time) ) { next_send_time = uint64_t( -1 ); mindelay_clock = uint64_t( -1 ); } } else if ( (now >= next_send_time) || (now >= next_ack_time) ) { /* Send diffs or ack */ send_to_receiver( diff ); mindelay_clock = uint64_t( -1 ); } } template void TransportSender::send_empty_ack( void ) { uint64_t now = timestamp(); assert( now >= next_ack_time ); uint64_t new_num = sent_states.back().num + 1; /* special case for shutdown sequence */ if ( shutdown_in_progress ) { new_num = uint64_t( -1 ); } // sent_states.push_back( TimestampedState( sent_states.back().timestamp, new_num, current_state ) ); add_sent_state( now, new_num, current_state ); send_in_fragments( "", new_num ); next_ack_time = now + ACK_INTERVAL; next_send_time = uint64_t(-1); } template void TransportSender::add_sent_state( uint64_t the_timestamp, uint64_t num, MyState &state ) { sent_states.push_back( TimestampedState( the_timestamp, num, state ) ); if ( sent_states.size() > 32 ) { /* limit on state queue */ typename sent_states_type::iterator last = sent_states.end(); for ( int i = 0; i < 16; i++ ) { last--; } sent_states.erase( last ); /* erase state from middle of queue */ } } template void TransportSender::send_to_receiver( const string & diff ) { uint64_t new_num; if ( current_state == sent_states.back().state ) { /* previously sent */ new_num = sent_states.back().num; } else { /* new state */ new_num = sent_states.back().num + 1; } /* special case for shutdown sequence */ if ( shutdown_in_progress ) { new_num = uint64_t( -1 ); } if ( new_num == sent_states.back().num ) { sent_states.back().timestamp = timestamp(); } else { add_sent_state( timestamp(), new_num, current_state ); } send_in_fragments( diff, new_num ); // Can throw NetworkException /* successfully sent, probably */ /* ("probably" because the FIRST size-exceeded datagram doesn't get an error) */ assumed_receiver_state = sent_states.end(); assumed_receiver_state--; next_ack_time = timestamp() + ACK_INTERVAL; next_send_time = uint64_t(-1); } template void TransportSender::update_assumed_receiver_state( void ) { uint64_t now = timestamp(); /* start from what is known and give benefit of the doubt to unacknowledged states transmitted recently enough ago */ assumed_receiver_state = sent_states.begin(); typename list< TimestampedState >::iterator i = sent_states.begin(); i++; while ( i != sent_states.end() ) { assert( now >= i->timestamp ); if ( uint64_t(now - i->timestamp) < connection->timeout() + ACK_DELAY ) { assumed_receiver_state = i; } else { return; } i++; } } template void TransportSender::rationalize_states( void ) { const MyState * known_receiver_state = &sent_states.front().state; current_state.subtract( known_receiver_state ); for ( typename list< TimestampedState >::reverse_iterator i = sent_states.rbegin(); i != sent_states.rend(); i++ ) { i->state.subtract( known_receiver_state ); } } template const string TransportSender::make_chaff( void ) { const size_t CHAFF_MAX = 16; const size_t chaff_len = prng.uint8() % (CHAFF_MAX + 1); char chaff[ CHAFF_MAX ]; prng.fill( chaff, chaff_len ); return string( chaff, chaff_len ); } template void TransportSender::send_in_fragments( const string & diff, uint64_t new_num ) { Instruction inst; inst.set_protocol_version( MOSH_PROTOCOL_VERSION ); inst.set_old_num( assumed_receiver_state->num ); inst.set_new_num( new_num ); inst.set_ack_num( ack_num ); inst.set_throwaway_num( sent_states.front().num ); inst.set_diff( diff ); inst.set_chaff( make_chaff() ); if ( new_num == uint64_t(-1) ) { shutdown_tries++; } vector fragments = fragmenter.make_fragments( inst, connection->get_MTU() - Network::Connection::ADDED_BYTES - Crypto::Session::ADDED_BYTES ); for ( vector::iterator i = fragments.begin(); i != fragments.end(); i++ ) { connection->send( i->tostring() ); if ( verbose ) { fprintf( stderr, "[%u] Sent [%d=>%d] id %d, frag %d ack=%d, throwaway=%d, len=%d, frame rate=%.2f, timeout=%d, srtt=%.1f\n", (unsigned int)(timestamp() % 100000), (int)inst.old_num(), (int)inst.new_num(), (int)i->id, (int)i->fragment_num, (int)inst.ack_num(), (int)inst.throwaway_num(), (int)i->contents.size(), 1000.0 / (double)send_interval(), (int)connection->timeout(), connection->get_SRTT() ); } } pending_data_ack = false; } template void TransportSender::process_acknowledgment_through( uint64_t ack_num ) { /* Ignore ack if we have culled the state it's acknowledging */ typename sent_states_type::iterator i; for ( i = sent_states.begin(); i != sent_states.end(); i++ ) { if ( i->num == ack_num ) { break; } } if ( i != sent_states.end() ) { for ( i = sent_states.begin(); i != sent_states.end(); ) { typename sent_states_type::iterator i_next = i; i_next++; if ( i->num < ack_num ) { sent_states.erase( i ); } i = i_next; } } assert( !sent_states.empty() ); } /* give up on getting acknowledgement for shutdown */ template bool TransportSender::shutdown_ack_timed_out( void ) const { if ( shutdown_in_progress ) { if ( shutdown_tries >= SHUTDOWN_RETRIES ) { return true; } else if ( timestamp() - shutdown_start >= uint64_t( ACTIVE_RETRY_TIMEOUT ) ) { return true; } } return false; } /* Executed upon entry to new receiver state */ template void TransportSender::set_ack_num( uint64_t s_ack_num ) { ack_num = s_ack_num; } /* Investigate diff against known receiver state instead */ /* Mutates proposed_diff */ template void TransportSender::attempt_prospective_resend_optimization( string &proposed_diff ) { if ( assumed_receiver_state == sent_states.begin() ) { return; } string resend_diff = current_state.diff_from( sent_states.front().state ); /* We do a prophylactic resend if it would make the diff shorter, or if it would lengthen it by no more than 100 bytes and still be less than 1000 bytes. */ if ( (resend_diff.size() <= proposed_diff.size()) || ( (resend_diff.size() < 1000) && (resend_diff.size() - proposed_diff.size() < 100) ) ) { assumed_receiver_state = sent_states.begin(); proposed_diff = resend_diff; } } #endif mosh-1.4.0/src/network/compressor.cc0000664000175000017500000000440214174450057014377 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include #include "compressor.h" #include "dos_assert.h" using namespace Network; using std::string; string Compressor::compress_str( const string &input ) { long unsigned int len = BUFFER_SIZE; dos_assert( Z_OK == compress( buffer, &len, reinterpret_cast( input.data() ), input.size() ) ); return string( reinterpret_cast( buffer ), len ); } string Compressor::uncompress_str( const string &input ) { long unsigned int len = BUFFER_SIZE; dos_assert( Z_OK == uncompress( buffer, &len, reinterpret_cast( input.data() ), input.size() ) ); return string( reinterpret_cast( buffer ), len ); } /* construct on first use */ Compressor & Network::get_compressor( void ) { static Compressor the_compressor; return the_compressor; } mosh-1.4.0/src/network/transportfragment.h0000664000175000017500000000622514174450057015632 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #ifndef TRANSPORT_FRAGMENT_HPP #define TRANSPORT_FRAGMENT_HPP #include #include #include #include "transportinstruction.pb.h" namespace Network { using std::vector; using std::string; using namespace TransportBuffers; class Fragment { public: static const size_t frag_header_len = sizeof( uint64_t ) + sizeof( uint16_t ); uint64_t id; uint16_t fragment_num; bool final; bool initialized; string contents; Fragment() : id( -1 ), fragment_num( -1 ), final( false ), initialized( false ), contents() {} Fragment( uint64_t s_id, uint16_t s_fragment_num, bool s_final, const string & s_contents ) : id( s_id ), fragment_num( s_fragment_num ), final( s_final ), initialized( true ), contents( s_contents ) {} Fragment( const string &x ); string tostring( void ); bool operator==( const Fragment &x ) const; }; class FragmentAssembly { private: vector fragments; uint64_t current_id; int fragments_arrived, fragments_total; public: FragmentAssembly() : fragments(), current_id( -1 ), fragments_arrived( 0 ), fragments_total( -1 ) {} bool add_fragment( Fragment &inst ); Instruction get_assembly( void ); }; class Fragmenter { private: uint64_t next_instruction_id; Instruction last_instruction; size_t last_MTU; public: Fragmenter() : next_instruction_id( 0 ), last_instruction(), last_MTU( -1 ) { last_instruction.set_old_num( -1 ); last_instruction.set_new_num( -1 ); } vector make_fragments( const Instruction &inst, size_t MTU ); uint64_t last_ack_sent( void ) const { return last_instruction.ack_num(); } }; } #endif mosh-1.4.0/src/network/compressor.h0000664000175000017500000000400414174450057014237 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #ifndef COMPRESSOR_H #define COMPRESSOR_H #include namespace Network { class Compressor { private: static const int BUFFER_SIZE = 2048 * 2048; /* effective limit on terminal size */ unsigned char buffer[BUFFER_SIZE]; public: Compressor() : buffer() {} ~Compressor() {} std::string compress_str( const std::string &input ); std::string uncompress_str( const std::string &input ); /* unused */ Compressor( const Compressor & ); Compressor & operator=( const Compressor & ); }; Compressor & get_compressor( void ); } #endif mosh-1.4.0/src/network/network.h0000664000175000017500000001601214174450057013536 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #ifndef NETWORK_HPP #define NETWORK_HPP #include #include #include #include #include #include #include #include #include #include #include "crypto.h" using namespace Crypto; namespace Network { static const unsigned int MOSH_PROTOCOL_VERSION = 2; /* bumped for echo-ack */ uint64_t timestamp( void ); uint16_t timestamp16( void ); uint16_t timestamp_diff( uint16_t tsnew, uint16_t tsold ); class NetworkException : public std::exception { public: string function; int the_errno; private: string my_what; public: NetworkException( string s_function="", int s_errno=0) : function( s_function ), the_errno( s_errno ), my_what(function + ": " + strerror(the_errno)) {} const char *what() const throw () { return my_what.c_str(); } ~NetworkException() throw () {} }; enum Direction { TO_SERVER = 0, TO_CLIENT = 1 }; class Packet { public: const uint64_t seq; Direction direction; uint16_t timestamp, timestamp_reply; string payload; Packet( Direction s_direction, uint16_t s_timestamp, uint16_t s_timestamp_reply, const string & s_payload ) : seq( Crypto::unique() ), direction( s_direction ), timestamp( s_timestamp ), timestamp_reply( s_timestamp_reply ), payload( s_payload ) {} Packet( const Message & message ); Message toMessage( void ); }; union Addr { struct sockaddr sa; struct sockaddr_in sin; struct sockaddr_in6 sin6; struct sockaddr_storage ss; }; class Connection { private: /* * For IPv4, guess the typical (minimum) header length; * fragmentation is not dangerous, just inefficient. */ static const int IPV4_HEADER_LEN = 20 /* base IP header */ + 8 /* UDP */; /* * For IPv6, we don't want to ever have MTU issues, so make a * conservative guess about header size. */ static const int IPV6_HEADER_LEN = 40 /* base IPv6 header */ + 16 /* 2 minimum-sized extension headers */ + 8 /* UDP */; /* Application datagram MTU. For constructors and fallback. */ static const int DEFAULT_SEND_MTU = 500; /* * IPv4 MTU. Don't use full Ethernet-derived MTU, * mobile networks have high tunneling overhead. * * As of July 2016, VPN traffic over Amtrak Acela wifi seems to be * dropped if tunnelled packets are 1320 bytes or larger. Use a * 1280-byte IPv4 MTU for now. * * We may have to implement ICMP-less PMTUD (RFC 4821) eventually. */ static const int DEFAULT_IPV4_MTU = 1280; /* IPv6 MTU. Use the guaranteed minimum to avoid fragmentation. */ static const int DEFAULT_IPV6_MTU = 1280; static const uint64_t MIN_RTO = 50; /* ms */ static const uint64_t MAX_RTO = 1000; /* ms */ static const int PORT_RANGE_LOW = 60001; static const int PORT_RANGE_HIGH = 60999; static const unsigned int SERVER_ASSOCIATION_TIMEOUT = 40000; static const unsigned int PORT_HOP_INTERVAL = 10000; static const unsigned int MAX_PORTS_OPEN = 10; static const unsigned int MAX_OLD_SOCKET_AGE = 60000; static const int CONGESTION_TIMESTAMP_PENALTY = 500; /* ms */ bool try_bind( const char *addr, int port_low, int port_high ); class Socket { private: int _fd; public: int fd( void ) const { return _fd; } Socket( int family ); ~Socket(); Socket( const Socket & other ); Socket & operator=( const Socket & other ); }; std::deque< Socket > socks; bool has_remote_addr; Addr remote_addr; socklen_t remote_addr_len; bool server; int MTU; /* application datagram MTU */ Base64Key key; Session session; void setup( void ); Direction direction; uint16_t saved_timestamp; uint64_t saved_timestamp_received_at; uint64_t expected_receiver_seq; uint64_t last_heard; uint64_t last_port_choice; uint64_t last_roundtrip_success; /* transport layer needs to tell us this */ bool RTT_hit; double SRTT; double RTTVAR; /* Error from send()/sendto(). */ string send_error; Packet new_packet( const string &s_payload ); void hop_port( void ); int sock( void ) const { assert( !socks.empty() ); return socks.back().fd(); } void prune_sockets( void ); string recv_one( int sock_to_recv ); void set_MTU( int family ); public: /* Network transport overhead. */ static const int ADDED_BYTES = 8 /* seqno/nonce */ + 4 /* timestamps */; Connection( const char *desired_ip, const char *desired_port ); /* server */ Connection( const char *key_str, const char *ip, const char *port ); /* client */ void send( const string & s ); string recv( void ); const std::vector< int > fds( void ) const; int get_MTU( void ) const { return MTU; } std::string port( void ) const; string get_key( void ) const { return key.printable_key(); } bool get_has_remote_addr( void ) const { return has_remote_addr; } uint64_t timeout( void ) const; double get_SRTT( void ) const { return SRTT; } const Addr &get_remote_addr( void ) const { return remote_addr; } socklen_t get_remote_addr_len( void ) const { return remote_addr_len; } string &get_send_error( void ) { return send_error; } void set_last_roundtrip_success( uint64_t s_success ) { last_roundtrip_success = s_success; } static bool parse_portrange( const char * desired_port_range, int & desired_port_low, int & desired_port_high ); }; } #endif mosh-1.4.0/src/network/networktransport-impl.h0000664000175000017500000001622614174450057016461 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #ifndef NETWORK_TRANSPORT_IMPL_HPP #define NETWORK_TRANSPORT_IMPL_HPP #include "networktransport.h" #include "transportsender-impl.h" using namespace Network; template Transport::Transport( MyState &initial_state, RemoteState &initial_remote, const char *desired_ip, const char *desired_port ) : connection( desired_ip, desired_port ), sender( &connection, initial_state ), received_states( 1, TimestampedState( timestamp(), 0, initial_remote ) ), receiver_quench_timer( 0 ), last_receiver_state( initial_remote ), fragments(), verbose( 0 ) { /* server */ } template Transport::Transport( MyState &initial_state, RemoteState &initial_remote, const char *key_str, const char *ip, const char *port ) : connection( key_str, ip, port ), sender( &connection, initial_state ), received_states( 1, TimestampedState( timestamp(), 0, initial_remote ) ), receiver_quench_timer( 0 ), last_receiver_state( initial_remote ), fragments(), verbose( 0 ) { /* client */ } template void Transport::recv( void ) { string s( connection.recv() ); Fragment frag( s ); if ( fragments.add_fragment( frag ) ) { /* complete packet */ Instruction inst = fragments.get_assembly(); if ( inst.protocol_version() != MOSH_PROTOCOL_VERSION ) { throw NetworkException( "mosh protocol version mismatch", 0 ); } sender.process_acknowledgment_through( inst.ack_num() ); /* inform network layer of roundtrip (end-to-end-to-end) connectivity */ connection.set_last_roundtrip_success( sender.get_sent_state_acked_timestamp() ); /* first, make sure we don't already have the new state */ for ( typename list< TimestampedState >::iterator i = received_states.begin(); i != received_states.end(); i++ ) { if ( inst.new_num() == i->num ) { return; } } /* now, make sure we do have the old state */ bool found = 0; typename list< TimestampedState >::iterator reference_state = received_states.begin(); while ( reference_state != received_states.end() ) { if ( inst.old_num() == reference_state->num ) { found = true; break; } reference_state++; } if ( !found ) { // fprintf( stderr, "Ignoring out-of-order packet. Reference state %d has been discarded or hasn't yet been received.\n", int(inst.old_num) ); return; /* this is security-sensitive and part of how we enforce idempotency */ } /* Do not accept state if our queue is full */ /* This is better than dropping states from the middle of the queue (as sender does), because we don't want to ACK a state and then discard it later. */ process_throwaway_until( inst.throwaway_num() ); if ( received_states.size() > 1024 ) { /* limit on state queue */ uint64_t now = timestamp(); if ( now < receiver_quench_timer ) { /* deny letting state grow further */ if ( verbose ) { fprintf( stderr, "[%u] Receiver queue full, discarding %d (malicious sender or long-unidirectional connectivity?)\n", (unsigned int)(timestamp() % 100000), (int)inst.new_num() ); } return; } else { receiver_quench_timer = now + 15000; } } /* apply diff to reference state */ TimestampedState new_state = *reference_state; new_state.timestamp = timestamp(); new_state.num = inst.new_num(); if ( !inst.diff().empty() ) { new_state.state.apply_string( inst.diff() ); } /* Insert new state in sorted place */ for ( typename list< TimestampedState >::iterator i = received_states.begin(); i != received_states.end(); i++ ) { if ( i->num > new_state.num ) { received_states.insert( i, new_state ); if ( verbose ) { fprintf( stderr, "[%u] Received OUT-OF-ORDER state %d [ack %d]\n", (unsigned int)(timestamp() % 100000), (int)new_state.num, (int)inst.ack_num() ); } return; } } if ( verbose ) { fprintf( stderr, "[%u] Received state %d [coming from %d, ack %d]\n", (unsigned int)(timestamp() % 100000), (int)new_state.num, (int)inst.old_num(), (int)inst.ack_num() ); } received_states.push_back( new_state ); sender.set_ack_num( received_states.back().num ); sender.remote_heard( new_state.timestamp ); if ( !inst.diff().empty() ) { sender.set_data_ack(); } } } /* The sender uses throwaway_num to tell us the earliest received state that we need to keep around */ template void Transport::process_throwaway_until( uint64_t throwaway_num ) { typename list< TimestampedState >::iterator i = received_states.begin(); while ( i != received_states.end() ) { typename list< TimestampedState >::iterator inext = i; inext++; if ( i->num < throwaway_num ) { received_states.erase( i ); } i = inext; } fatal_assert( received_states.size() > 0 ); } template string Transport::get_remote_diff( void ) { /* find diff between last receiver state and current remote state, then rationalize states */ string ret( received_states.back().state.diff_from( last_receiver_state ) ); const RemoteState *oldest_receiver_state = &received_states.front().state; for ( typename list< TimestampedState >::reverse_iterator i = received_states.rbegin(); i != received_states.rend(); i++ ) { i->state.subtract( oldest_receiver_state ); } last_receiver_state = received_states.back().state; return ret; } #endif mosh-1.4.0/src/network/Makefile.am0000664000175000017500000000071114272621034013721 00000000000000AM_CPPFLAGS = -I$(srcdir)/../util -I$(srcdir)/../crypto -I../protobufs $(protobuf_CFLAGS) AM_CXXFLAGS = $(WARNING_CXXFLAGS) $(PICKY_CXXFLAGS) $(HARDEN_CFLAGS) $(MISC_CXXFLAGS) $(CODE_COVERAGE_CXXFLAGS) noinst_LIBRARIES = libmoshnetwork.a libmoshnetwork_a_SOURCES = network.cc network.h networktransport-impl.h networktransport.h transportfragment.cc transportfragment.h transportsender-impl.h transportsender.h transportstate.h compressor.cc compressor.h mosh-1.4.0/src/network/transportsender.h0000664000175000017500000001354114174450057015306 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #ifndef TRANSPORT_SENDER_HPP #define TRANSPORT_SENDER_HPP #include #include #include "network.h" #include "transportinstruction.pb.h" #include "transportstate.h" #include "transportfragment.h" #include "prng.h" namespace Network { using std::list; using std::pair; using namespace TransportBuffers; /* timing parameters */ const int SEND_INTERVAL_MIN = 20; /* ms between frames */ const int SEND_INTERVAL_MAX = 250; /* ms between frames */ const int ACK_INTERVAL = 3000; /* ms between empty acks */ const int ACK_DELAY = 100; /* ms before delayed ack */ const int SHUTDOWN_RETRIES = 16; /* number of shutdown packets to send before giving up */ const int ACTIVE_RETRY_TIMEOUT = 10000; /* attempt to resend at frame rate */ template class TransportSender { private: /* helper methods for tick() */ void update_assumed_receiver_state( void ); void attempt_prospective_resend_optimization( string &proposed_diff ); void rationalize_states( void ); void send_to_receiver( const string & diff ); void send_empty_ack( void ); void send_in_fragments( const string & diff, uint64_t new_num ); void add_sent_state( uint64_t the_timestamp, uint64_t num, MyState &state ); /* state of sender */ Connection *connection; MyState current_state; typedef list< TimestampedState > sent_states_type; sent_states_type sent_states; /* first element: known, acknowledged receiver state */ /* last element: last sent state */ /* somewhere in the middle: the assumed state of the receiver */ typename sent_states_type::iterator assumed_receiver_state; /* for fragment creation */ Fragmenter fragmenter; /* timing state */ uint64_t next_ack_time; uint64_t next_send_time; void calculate_timers( void ); unsigned int verbose; bool shutdown_in_progress; int shutdown_tries; uint64_t shutdown_start; /* information about receiver state */ uint64_t ack_num; bool pending_data_ack; unsigned int SEND_MINDELAY; /* ms to collect all input */ uint64_t last_heard; /* last time received new state */ /* chaff to disguise instruction length */ PRNG prng; const string make_chaff( void ); uint64_t mindelay_clock; /* time of first pending change to current state */ public: /* constructor */ TransportSender( Connection *s_connection, MyState &initial_state ); /* Send data or an ack if necessary */ void tick( void ); /* Returns the number of ms to wait until next possible event. */ int wait_time( void ); /* Executed upon receipt of ack */ void process_acknowledgment_through( uint64_t ack_num ); /* Executed upon entry to new receiver state */ void set_ack_num( uint64_t s_ack_num ); /* Accelerate reply ack */ void set_data_ack( void ) { pending_data_ack = true; } /* Received something */ void remote_heard( uint64_t ts ) { last_heard = ts; } /* Starts shutdown sequence */ void start_shutdown( void ) { if ( !shutdown_in_progress ) { shutdown_start = timestamp(); shutdown_in_progress = true; } } /* Misc. getters and setters */ /* Cannot modify current_state while shutdown in progress */ MyState &get_current_state( void ) { assert( !shutdown_in_progress ); return current_state; } void set_current_state( const MyState &x ) { assert( !shutdown_in_progress ); current_state = x; current_state.reset_input(); } void set_verbose( unsigned int s_verbose ) { verbose = s_verbose; } bool get_shutdown_in_progress( void ) const { return shutdown_in_progress; } bool get_shutdown_acknowledged( void ) const { return sent_states.front().num == uint64_t(-1); } bool get_counterparty_shutdown_acknowledged( void ) const { return fragmenter.last_ack_sent() == uint64_t(-1); } uint64_t get_sent_state_acked_timestamp( void ) const { return sent_states.front().timestamp; } uint64_t get_sent_state_acked( void ) const { return sent_states.front().num; } uint64_t get_sent_state_last( void ) const { return sent_states.back().num; } bool shutdown_ack_timed_out( void ) const; void set_send_delay( int new_delay ) { SEND_MINDELAY = new_delay; } unsigned int send_interval( void ) const; /* nonexistent methods to satisfy -Weffc++ */ TransportSender( const TransportSender &x ); TransportSender & operator=( const TransportSender &x ); }; } #endif mosh-1.4.0/src/network/transportstate.h0000664000175000017500000000346514174450057015152 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #ifndef TRANSPORT_STATE_HPP #define TRANSPORT_STATE_HPP namespace Network { template class TimestampedState { public: uint64_t timestamp; uint64_t num; State state; TimestampedState( uint64_t s_timestamp, uint64_t s_num, const State &s_state ) : timestamp( s_timestamp ), num( s_num ), state( s_state ) {} }; } #endif mosh-1.4.0/src/util/0000775000175000017500000000000014327736673011253 500000000000000mosh-1.4.0/src/util/shared.h0000664000175000017500000000530614174450057012603 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #ifndef SHARED_HPP #define SHARED_HPP #include "config.h" #ifdef HAVE_MEMORY #include #endif #ifdef HAVE_TR1_MEMORY #include #endif namespace shared { #ifdef HAVE_STD_SHARED_PTR using std::shared_ptr; using std::make_shared; #else #ifdef HAVE_STD_TR1_SHARED_PTR using std::tr1::shared_ptr; // make_shared emulation. template inline shared_ptr make_shared() { return shared_ptr(new Tp()); } template inline shared_ptr make_shared(const A1& a1) { return shared_ptr(new Tp(a1)); } template inline shared_ptr make_shared(const A1& a1, const A2& a2) { return shared_ptr(new Tp(a1, a2)); } template inline shared_ptr make_shared(const A1& a1, const A2& a2, const A3& a3) { return shared_ptr(new Tp(a1, a2, a3)); } template inline shared_ptr make_shared(const A1& a1, const A2& a2, const A3& a3, const A4& a4) { return shared_ptr(new Tp(a1, a2, a3, a4)); } #else #error Need a shared_ptr class. Try Boost::TR1. #endif #endif } #endif mosh-1.4.0/src/util/Makefile.in0000664000175000017500000004600614327736660013242 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 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)) 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 = : subdir = src/util ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ $(top_srcdir)/m4/ax_ac_print_to_file.m4 \ $(top_srcdir)/m4/ax_add_am_macro_static.m4 \ $(top_srcdir)/m4/ax_am_macros_static.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_gnu_make.m4 \ $(top_srcdir)/m4/ax_check_library.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_code_coverage.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ $(top_srcdir)/m4/ax_file_escapes.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 $(top_srcdir)/m4/pkg.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 = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) ARFLAGS = cru AM_V_AR = $(am__v_AR_@AM_V@) am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) am__v_AR_0 = @echo " AR " $@; am__v_AR_1 = libmoshutil_a_AR = $(AR) $(ARFLAGS) libmoshutil_a_LIBADD = am_libmoshutil_a_OBJECTS = locale_utils.$(OBJEXT) swrite.$(OBJEXT) \ select.$(OBJEXT) timestamp.$(OBJEXT) pty_compat.$(OBJEXT) libmoshutil_a_OBJECTS = $(am_libmoshutil_a_OBJECTS) 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)/src/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/locale_utils.Po \ ./$(DEPDIR)/pty_compat.Po ./$(DEPDIR)/select.Po \ ./$(DEPDIR)/swrite.Po ./$(DEPDIR)/timestamp.Po am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) am__v_CXX_0 = @echo " CXX " $@; am__v_CXX_1 = CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) am__v_CXXLD_0 = @echo " CXXLD " $@; am__v_CXXLD_1 = 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 = $(libmoshutil_a_SOURCES) DIST_SOURCES = $(libmoshutil_a_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@ CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@ CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@ CPPFLAGS = @CPPFLAGS@ CRYPTO_CFLAGS = @CRYPTO_CFLAGS@ CRYPTO_LIBS = @CRYPTO_LIBS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CURSES_LIB = @CURSES_LIB@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FUZZING_CFLAGS = @FUZZING_CFLAGS@ GCOV = @GCOV@ GENHTML = @GENHTML@ HARDEN_CFLAGS = @HARDEN_CFLAGS@ HARDEN_LDFLAGS = @HARDEN_LDFLAGS@ HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LCOV = @LCOV@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MISC_CXXFLAGS = @MISC_CXXFLAGS@ MKDIR_P = @MKDIR_P@ Nettle_CFLAGS = @Nettle_CFLAGS@ Nettle_LIBS = @Nettle_LIBS@ OBJEXT = @OBJEXT@ OpenSSL_CFLAGS = @OpenSSL_CFLAGS@ OpenSSL_LIBS = @OpenSSL_LIBS@ 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@ PICKY_CXXFLAGS = @PICKY_CXXFLAGS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROTOC = @PROTOC@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TINFO_CFLAGS = @TINFO_CFLAGS@ TINFO_CPPFLAGS = @TINFO_CPPFLAGS@ TINFO_LDFLAGS = @TINFO_LDFLAGS@ TINFO_LIBS = @TINFO_LIBS@ VERSION = @VERSION@ WARNING_CXXFLAGS = @WARNING_CXXFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ completions = @completions@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ ifGNUmake = @ifGNUmake@ ifnGNUmake = @ifnGNUmake@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ protobuf_CFLAGS = @protobuf_CFLAGS@ protobuf_LIBS = @protobuf_LIBS@ 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@ AM_CXXFLAGS = $(WARNING_CXXFLAGS) $(PICKY_CXXFLAGS) $(HARDEN_CFLAGS) $(MISC_CXXFLAGS) $(CODE_COVERAGE_CXXFLAGS) noinst_LIBRARIES = libmoshutil.a libmoshutil_a_SOURCES = locale_utils.cc locale_utils.h swrite.cc swrite.h dos_assert.h fatal_assert.h select.h select.cc timestamp.h timestamp.cc pty_compat.cc pty_compat.h shared.h all: all-am .SUFFIXES: .SUFFIXES: .cc .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/util/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/util/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): clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libmoshutil.a: $(libmoshutil_a_OBJECTS) $(libmoshutil_a_DEPENDENCIES) $(EXTRA_libmoshutil_a_DEPENDENCIES) $(AM_V_at)-rm -f libmoshutil.a $(AM_V_AR)$(libmoshutil_a_AR) libmoshutil.a $(libmoshutil_a_OBJECTS) $(libmoshutil_a_LIBADD) $(AM_V_at)$(RANLIB) libmoshutil.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/locale_utils.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pty_compat.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/select.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/swrite.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timestamp.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .cc.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -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 $(LIBRARIES) installdirs: 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: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || 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 clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/locale_utils.Po -rm -f ./$(DEPDIR)/pty_compat.Po -rm -f ./$(DEPDIR)/select.Po -rm -f ./$(DEPDIR)/swrite.Po -rm -f ./$(DEPDIR)/timestamp.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-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)/locale_utils.Po -rm -f ./$(DEPDIR)/pty_compat.Po -rm -f ./$(DEPDIR)/select.Po -rm -f ./$(DEPDIR)/swrite.Po -rm -f ./$(DEPDIR)/timestamp.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: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-noinstLIBRARIES 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-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 \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .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: mosh-1.4.0/src/util/swrite.h0000644000175000017500000000304613103401307012630 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #ifndef SWRITE_HPP #define SWRITE_HPP int swrite( int fd, const char *str, ssize_t len = -1 ); #endif mosh-1.4.0/src/util/locale_utils.cc0000664000175000017500000000720514174450057014152 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include "config.h" #include #include #include #include #include #include #if HAVE_LANGINFO_H #include #endif #include "locale_utils.h" const std::string LocaleVar::str( void ) const { if ( name.empty() ) { return std::string( "[no charset variables]" ); } return name + "=" + value; } const LocaleVar get_ctype( void ) { /* Reimplement the search logic, just for diagnostics */ if ( const char *all = getenv( "LC_ALL" ) ) { return LocaleVar( "LC_ALL", all ); } else if ( const char *ctype = getenv( "LC_CTYPE" ) ) { return LocaleVar( "LC_CTYPE", ctype ); } else if ( const char *lang = getenv( "LANG" ) ) { return LocaleVar( "LANG", lang ); } return LocaleVar( "", "" ); } const char *locale_charset( void ) { static const char ASCII_name[] = "US-ASCII"; /* Produce more pleasant name of US-ASCII */ const char *ret = nl_langinfo( CODESET ); if ( strcmp( ret, "ANSI_X3.4-1968" ) == 0 ) { ret = ASCII_name; } return ret; } bool is_utf8_locale( void ) { /* Verify locale calls for UTF-8 */ if ( strcmp( locale_charset(), "UTF-8" ) != 0 && strcmp( locale_charset(), "utf-8" ) != 0 ) { return false; } return true; } void set_native_locale( void ) { /* Adopt native locale */ if ( NULL == setlocale( LC_ALL, "" ) ) { int saved_errno = errno; if ( saved_errno == ENOENT ) { LocaleVar ctype( get_ctype() ); fprintf( stderr, "The locale requested by %s isn't available here.\n", ctype.str().c_str() ); if ( !ctype.name.empty() ) { fprintf( stderr, "Running `locale-gen %s' may be necessary.\n\n", ctype.value.c_str() ); } } else { errno = saved_errno; perror( "setlocale" ); } } } void clear_locale_variables( void ) { unsetenv( "LANG" ); unsetenv( "LANGUAGE" ); unsetenv( "LC_CTYPE" ); unsetenv( "LC_NUMERIC" ); unsetenv( "LC_TIME" ); unsetenv( "LC_COLLATE" ); unsetenv( "LC_MONETARY" ); unsetenv( "LC_MESSAGES" ); unsetenv( "LC_PAPER" ); unsetenv( "LC_NAME" ); unsetenv( "LC_ADDRESS" ); unsetenv( "LC_TELEPHONE" ); unsetenv( "LC_MEASUREMENT" ); unsetenv( "LC_IDENTIFICATION" ); unsetenv( "LC_ALL" ); } mosh-1.4.0/src/util/timestamp.h0000644000175000017500000000311213103401307013310 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #ifndef TIMESTAMP_HPP #define TIMESTAMP_HPP #include void freeze_timestamp( void ); uint64_t frozen_timestamp( void ); #endif mosh-1.4.0/src/util/fatal_assert.h0000644000175000017500000000364113103401307013764 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #ifndef FATAL_ASSERT_HPP #define FATAL_ASSERT_HPP #include #include static void fatal_error( const char *expression, const char *file, int line, const char *function ) { fprintf( stderr, "Fatal assertion failure in function %s at %s:%d\nFailed test: %s\n", function, file, line, expression ); abort(); } #define fatal_assert(expr) \ ((expr) \ ? (void)0 \ : fatal_error (#expr, __FILE__, __LINE__, __func__ )) #endif mosh-1.4.0/src/util/select.cc0000644000175000017500000000336013154724276012752 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include "select.h" fd_set Select::dummy_fd_set; sigset_t Select::dummy_sigset; unsigned int Select::verbose = 0; void Select::handle_signal( int signum ) { fatal_assert( signum >= 0 ); fatal_assert( signum <= MAX_SIGNAL_NUMBER ); Select &sel = get_instance(); sel.got_signal[ signum ] = 1; } mosh-1.4.0/src/util/pty_compat.h0000644000175000017500000000344313103401307013473 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #ifndef PTY_COMPAT_HPP #define PTY_COMPAT_HPP #include "config.h" #ifndef HAVE_FORKPTY # define forkpty my_forkpty #endif #ifndef HAVE_CFMAKERAW # define cfmakeraw my_cfmakeraw #endif pid_t my_forkpty( int *amaster, char *name, const struct termios *termp, const struct winsize *winp ); void my_cfmakeraw( struct termios *termios_p ); #endif mosh-1.4.0/src/util/Makefile.am0000664000175000017500000000051114272621034013203 00000000000000AM_CXXFLAGS = $(WARNING_CXXFLAGS) $(PICKY_CXXFLAGS) $(HARDEN_CFLAGS) $(MISC_CXXFLAGS) $(CODE_COVERAGE_CXXFLAGS) noinst_LIBRARIES = libmoshutil.a libmoshutil_a_SOURCES = locale_utils.cc locale_utils.h swrite.cc swrite.h dos_assert.h fatal_assert.h select.h select.cc timestamp.h timestamp.cc pty_compat.cc pty_compat.h shared.h mosh-1.4.0/src/util/swrite.cc0000664000175000017500000000374114174450057013011 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include #include #include #include "swrite.h" int swrite( int fd, const char *str, ssize_t len ) { ssize_t total_bytes_written = 0; ssize_t bytes_to_write = ( len >= 0 ) ? len : (ssize_t) strlen( str ); while ( total_bytes_written < bytes_to_write ) { ssize_t bytes_written = write( fd, str + total_bytes_written, bytes_to_write - total_bytes_written ); if ( bytes_written <= 0 ) { perror( "write" ); return -1; } total_bytes_written += bytes_written; } return 0; } mosh-1.4.0/src/util/dos_assert.h0000644000175000017500000000401213103401307013453 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #ifndef DOS_ASSERT_HPP #define DOS_ASSERT_HPP #include #include #include "crypto.h" static void dos_detected( const char *expression, const char *file, int line, const char *function ) { char buffer[ 2048 ]; snprintf( buffer, 2048, "Illegal counterparty input (possible denial of service) in function %s at %s:%d, failed test: %s\n", function, file, line, expression ); throw Crypto::CryptoException( buffer ); } #define dos_assert(expr) \ ((expr) \ ? (void)0 \ : dos_detected (#expr, __FILE__, __LINE__, __func__ )) #endif mosh-1.4.0/src/util/pty_compat.cc0000644000175000017500000001110013103401307013616 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include "config.h" #if !defined(HAVE_FORKPTY) || !defined(HAVE_CFMAKERAW) #include #include #include #include #include #include #include #include #include "pty_compat.h" #ifndef HAVE_FORKPTY pid_t my_forkpty( int *amaster, char *name, const struct termios *termp, const struct winsize *winp ) { /* For Solaris and AIX */ int master, slave; char *slave_name; pid_t pid; #ifdef _AIX #define PTY_DEVICE "/dev/ptc" #else #define PTY_DEVICE "/dev/ptmx" #endif master = open( PTY_DEVICE, O_RDWR | O_NOCTTY ); if ( master < 0 ) { perror( "open(" PTY_DEVICE ")" ); return -1; } if ( grantpt( master ) < 0 ) { perror( "grantpt" ); close( master ); return -1; } if ( unlockpt(master) < 0 ) { perror( "unlockpt" ); close( master ); return -1; } slave_name = ptsname( master ); if ( slave_name == NULL ) { perror( "ptsname" ); close( master ); return -1; } slave = open( slave_name, O_RDWR | O_NOCTTY ); if ( slave < 0 ) { perror( "open(slave)" ); close( master ); return -1; } #ifndef _AIX if ( ioctl(slave, I_PUSH, "ptem") < 0 || ioctl(slave, I_PUSH, "ldterm") < 0 ) { perror( "ioctl(I_PUSH)" ); close( slave ); close( master ); return -1; } #endif if ( amaster != NULL ) *amaster = master; if ( name != NULL) strcpy( name, slave_name ); if ( termp != NULL ) { if ( tcsetattr( slave, TCSAFLUSH, termp ) < 0 ) { perror( "tcsetattr" ); exit( 1 ); } } // we need to set initial window size, or TIOCGWINSZ fails struct winsize w; w.ws_row = 25; w.ws_col = 80; w.ws_xpixel = 0; w.ws_ypixel = 0; if ( ioctl( slave, TIOCSWINSZ, &w) < 0 ) { perror( "ioctl TIOCSWINSZ" ); exit( 1 ); } if ( winp != NULL ) { if ( ioctl( slave, TIOCGWINSZ, winp ) < 0 ) { perror( "ioctl TIOCGWINSZ" ); exit( 1 ); } } pid = fork(); switch ( pid ) { case -1: /* Error */ perror( "fork()" ); return -1; case 0: /* Child */ if ( setsid() < 0 ) perror( "setsid" ); #ifdef TIOCSCTTY if ( ioctl( slave, TIOCSCTTY, NULL ) < 0 ) { perror( "ioctl" ); return -1; } #else { int dummy_fd; dummy_fd = open (slave_name, O_RDWR); if (dummy_fd < 0) { perror( "open(slave_name)" ); return -1; } close (dummy_fd); } #endif /* TIOCSCTTY */ close( master ); dup2( slave, STDIN_FILENO ); dup2( slave, STDOUT_FILENO ); dup2( slave, STDERR_FILENO ); return 0; default: /* Parent */ close( slave ); return pid; } } #endif #ifndef HAVE_CFMAKERAW void my_cfmakeraw( struct termios *termios_p ) { termios_p->c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON); termios_p->c_oflag &= ~OPOST; termios_p->c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN); termios_p->c_cflag &= ~(CSIZE | PARENB); termios_p->c_cflag |= CS8; termios_p->c_cc[VMIN] = 1; // read() is satisfied after 1 char termios_p->c_cc[VTIME] = 0; // No timer } #endif #endif mosh-1.4.0/src/util/select.h0000664000175000017500000001551014174450057012612 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #ifndef SELECT_HPP #define SELECT_HPP #include #include #include #include #include #include "fatal_assert.h" #include "timestamp.h" /* Convenience wrapper for pselect(2). Any signals blocked by calling sigprocmask() outside this code will still be received during Select::select(). So don't do that. */ class Select { public: static Select &get_instance( void ) { /* COFU may or may not be thread-safe, depending on compiler */ static Select instance; return instance; } private: Select() : max_fd( -1 ) /* These initializations are not used; they are just here to appease -Weffc++. */ , all_fds( dummy_fd_set ) , read_fds( dummy_fd_set ) , empty_sigset( dummy_sigset ) , consecutive_polls( 0 ) { FD_ZERO( &all_fds ); FD_ZERO( &read_fds ); clear_got_signal(); fatal_assert( 0 == sigemptyset( &empty_sigset ) ); } void clear_got_signal( void ) { for ( volatile sig_atomic_t *p = got_signal; p < got_signal + sizeof( got_signal ) / sizeof( *got_signal ); p++ ) { *p = 0; } } /* not implemented */ Select( const Select & ); Select &operator=( const Select & ); public: void add_fd( int fd ) { if ( fd > max_fd ) { max_fd = fd; } FD_SET( fd, &all_fds ); } void clear_fds( void ) { FD_ZERO( &all_fds ); } static void add_signal( int signum ) { fatal_assert( signum >= 0 ); fatal_assert( signum <= MAX_SIGNAL_NUMBER ); /* Block the signal so we don't get it outside of pselect(). */ sigset_t to_block; fatal_assert( 0 == sigemptyset( &to_block ) ); fatal_assert( 0 == sigaddset( &to_block, signum ) ); fatal_assert( 0 == sigprocmask( SIG_BLOCK, &to_block, NULL ) ); /* Register a handler, which will only be called when pselect() is interrupted by a (possibly queued) signal. */ struct sigaction sa; sa.sa_flags = 0; sa.sa_handler = &handle_signal; fatal_assert( 0 == sigfillset( &sa.sa_mask ) ); fatal_assert( 0 == sigaction( signum, &sa, NULL ) ); } /* timeout unit: milliseconds; negative timeout means wait forever */ int select( int timeout ) { memcpy( &read_fds, &all_fds, sizeof( read_fds ) ); clear_got_signal(); /* Rate-limit and warn about polls. */ if ( verbose > 1 && timeout == 0 ) { fprintf( stderr, "%s: got poll (timeout 0)\n", __func__ ); } if ( timeout == 0 && ++consecutive_polls >= MAX_POLLS ) { if ( verbose > 1 && consecutive_polls == MAX_POLLS ) { fprintf( stderr, "%s: got %d polls, rate limiting.\n", __func__, MAX_POLLS ); } timeout = 1; } else if ( timeout != 0 && consecutive_polls ) { if ( verbose > 1 && consecutive_polls >= MAX_POLLS ) { fprintf( stderr, "%s: got %d consecutive polls\n", __func__, consecutive_polls ); } consecutive_polls = 0; } #ifdef HAVE_PSELECT struct timespec ts; struct timespec *tsp = NULL; if ( timeout >= 0 ) { ts.tv_sec = timeout / 1000; ts.tv_nsec = 1000000 * (long( timeout ) % 1000); tsp = &ts; } int ret = ::pselect( max_fd + 1, &read_fds, NULL, NULL, tsp, &empty_sigset ); #else struct timeval tv; struct timeval *tvp = NULL; sigset_t old_sigset; if ( timeout >= 0 ) { tv.tv_sec = timeout / 1000; tv.tv_usec = 1000 * (long( timeout ) % 1000); tvp = &tv; } int ret = sigprocmask( SIG_SETMASK, &empty_sigset, &old_sigset ); if ( ret != -1 ) { ret = ::select( max_fd + 1, &read_fds, NULL, NULL, tvp ); sigprocmask( SIG_SETMASK, &old_sigset, NULL ); } #endif if ( ret == 0 || ( ret == -1 && errno == EINTR ) ) { /* Look for and report Cygwin select() bug. */ if ( ret == 0 ) { for ( int fd = 0; fd <= max_fd; fd++ ) { if ( FD_ISSET( fd, &read_fds ) ) { fprintf( stderr, "select(): nfds = 0 but read fd %d is set\n", fd ); } } } /* The user should process events as usual. */ FD_ZERO( &read_fds ); ret = 0; } freeze_timestamp(); return ret; } bool read( int fd ) #if FD_ISSET_IS_CONST const #endif { assert( FD_ISSET( fd, &all_fds ) ); return FD_ISSET( fd, &read_fds ); } /* This method consumes a signal notification. */ bool signal( int signum ) { fatal_assert( signum >= 0 ); fatal_assert( signum <= MAX_SIGNAL_NUMBER ); /* XXX This requires a guard against concurrent signals. */ bool rv = got_signal[ signum ]; got_signal[ signum ] = 0; return rv; } /* This method does not consume signal notifications. */ bool any_signal( void ) const { bool rv = false; for (int i = 0; i < MAX_SIGNAL_NUMBER; i++) { rv |= got_signal[ i ]; } return rv; } static void set_verbose( unsigned int s_verbose ) { verbose = s_verbose; } private: static const int MAX_SIGNAL_NUMBER = 64; /* Number of 0-timeout selects after which we begin to think * something's wrong. */ static const int MAX_POLLS = 10; static void handle_signal( int signum ); int max_fd; /* We assume writes to got_signal are atomic, though we also try to mask out concurrent signal handlers. */ volatile sig_atomic_t got_signal[ MAX_SIGNAL_NUMBER + 1 ]; fd_set all_fds, read_fds; sigset_t empty_sigset; static fd_set dummy_fd_set; static sigset_t dummy_sigset; int consecutive_polls; static unsigned int verbose; }; #endif mosh-1.4.0/src/util/timestamp.cc0000664000175000017500000000776614174450064013510 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include "config.h" #include "timestamp.h" #include #if HAVE_CLOCK_GETTIME #include #endif #if HAVE_MACH_ABSOLUTE_TIME #include #include #endif #if HAVE_GETTIMEOFDAY #include #include #endif // On Apple systems CLOCK_MONOTONIC is unfortunately able to go // backwards in time. This breaks mosh when system is returning from // suspend as described in ticket #1014. To avoid this issue prefer // CLOCK_MONOTONIC_RAW on Apple systems when available. #if defined(__APPLE__) && defined(CLOCK_MONOTONIC_RAW) #define CLOCKTYPE CLOCK_MONOTONIC_RAW #else #define CLOCKTYPE CLOCK_MONOTONIC #endif static uint64_t millis_cache = -1; uint64_t frozen_timestamp( void ) { if ( millis_cache == uint64_t( -1 ) ) { freeze_timestamp(); } return millis_cache; } void freeze_timestamp( void ) { // Try all our clock sources till we get something. This could // break if a source only sometimes works in a given process. #if HAVE_CLOCK_GETTIME // Preferred clock source-- portable, monotonic, (should be) // adjusted after system sleep struct timespec tp; if ( #if defined(__APPLE__) && defined(__MACH__) // Check for presence, for OS X SDK >= 10.12 and runtime < 10.12 &clock_gettime != NULL && #endif clock_gettime( CLOCKTYPE, &tp ) == 0 ) { uint64_t millis = tp.tv_nsec / 1000000; millis += uint64_t( tp.tv_sec ) * 1000; millis_cache = millis; return; } #endif #if HAVE_MACH_ABSOLUTE_TIME // Monotonic, not adjusted after system sleep. OS X 10.12 has // mach_continuous_time(), but also has clock_gettime(). static mach_timebase_info_data_t s_timebase_info; static double absolute_to_millis = 0.0; if (absolute_to_millis == 0.0) { if (ERR_SUCCESS == mach_timebase_info(&s_timebase_info)) { absolute_to_millis = 1e-6 * s_timebase_info.numer / s_timebase_info.denom; } else absolute_to_millis = -1.0; } // NB: mach_absolute_time() returns "absolute time units" // We need to apply a conversion to get milliseconds. if (absolute_to_millis > 0.0) { millis_cache = mach_absolute_time() * absolute_to_millis; return; } #endif #if HAVE_GETTIMEOFDAY // Not monotonic. // NOTE: If time steps backwards, timeouts may be confused. struct timeval tv; if ( gettimeofday(&tv, NULL) ) { perror( "gettimeofday" ); } else { uint64_t millis = tv.tv_usec / 1000; millis += uint64_t( tv.tv_sec ) * 1000; millis_cache = millis; return; } #else # error "gettimeofday() unavailable-- required as timer of last resort" #endif } mosh-1.4.0/src/util/locale_utils.h0000644000175000017500000000357713103401307014003 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #ifndef LOCALE_UTILS_HPP #define LOCALE_UTILS_HPP #include class LocaleVar { public: const std::string name, value; LocaleVar( const char *s_name, const char *s_value ) : name( s_name ), value( s_value ) {} const std::string str( void ) const; }; const LocaleVar get_ctype( void ); const char *locale_charset( void ); bool is_utf8_locale( void ); void set_native_locale( void ); void clear_locale_variables( void ); #endif mosh-1.4.0/src/crypto/0000775000175000017500000000000014327736673011616 500000000000000mosh-1.4.0/src/crypto/ocb_internal.cc0000664000175000017500000014160014272621034014465 00000000000000/*------------------------------------------------------------------------ / OCB Version 3 Reference Code (Optimized C) Last modified 08-SEP-2012 /------------------------------------------------------------------------- / Copyright (c) 2012 Ted Krovetz. / Copyright 2022 Google LLC / / Permission to use, copy, modify, and/or distribute this software for any / purpose with or without fee is hereby granted, provided that the above / copyright notice and this permission notice appear in all copies. / / THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES / WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF / MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR / ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES / WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN / ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF / OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. / / Phillip Rogaway holds patents relevant to OCB. See the following for / his patent grant: http://www.cs.ucdavis.edu/~rogaway/ocb/grant.htm / / Special thanks to Keegan McAllister for suggesting several good improvements / / Comments are welcome: Ted Krovetz - Dedicated to Laurel K /------------------------------------------------------------------------- */ #include "config.h" /* This module implements the ae.h interface for OpenSSL, Apple Common / Crypto, and Nettle. */ #if !defined(USE_OPENSSL_AES) && !defined(USE_APPLE_COMMON_CRYPTO_AES) && \ !defined(USE_NETTLE_AES) #error ocb_internal.cc only works with OpenSSL, Apple Common Crypto, or Nettle #endif /* ----------------------------------------------------------------------- */ /* Usage notes */ /* ----------------------------------------------------------------------- */ /* - When AE_PENDING is passed as the 'final' parameter of any function, / the length parameters must be a multiple of (BPI*16). / - When available, SSE or AltiVec registers are used to manipulate data. / So, when on machines with these facilities, all pointers passed to / any function should be 16-byte aligned. / - Plaintext and ciphertext pointers may be equal (ie, plaintext gets / encrypted in-place), but no other pair of pointers may be equal. / - This code assumes all x86 processors have SSE2 and SSSE3 instructions / when compiling under MSVC. If untrue, alter the #define. / - This code is tested for C99 and recent versions of GCC and MSVC. */ /* ----------------------------------------------------------------------- */ /* User configuration options */ /* ----------------------------------------------------------------------- */ /* Set the AES key length to use and length of authentication tag to produce. / Setting either to 0 requires the value be set at runtime via ae_init(). / Some optimizations occur for each when set to a fixed value. */ #define OCB_KEY_LEN 16 /* 0, 16, 24 or 32. 0 means set in ae_init */ #define OCB_TAG_LEN 16 /* 0 to 16. 0 means set in ae_init */ /* This implementation has built-in support for multiple AES APIs. Set any / one of the following to non-zero to specify which to use. */ #if 0 #define USE_APPLE_COMMON_CRYPTO_AES 0 #define USE_NETTLE_AES 0 #define USE_OPENSSL_AES 1 /* http://openssl.org */ #endif /* During encryption and decryption, various "L values" are required. / The L values can be precomputed during initialization (requiring extra / space in ae_ctx), generated as needed (slightly slowing encryption and / decryption), or some combination of the two. L_TABLE_SZ specifies how many / L values to precompute. L_TABLE_SZ must be at least 3. L_TABLE_SZ*16 bytes / are used for L values in ae_ctx. Plaintext and ciphertexts shorter than / 2^L_TABLE_SZ blocks need no L values calculated dynamically. */ #define L_TABLE_SZ 16 /* Set L_TABLE_SZ_IS_ENOUGH non-zero iff you know that all plaintexts / will be shorter than 2^(L_TABLE_SZ+4) bytes in length. This results / in better performance. */ #define L_TABLE_SZ_IS_ENOUGH 1 /* ----------------------------------------------------------------------- */ /* Includes and compiler specific definitions */ /* ----------------------------------------------------------------------- */ #include "ae.h" #include "crypto.h" #include "fatal_assert.h" #include #include #if defined(HAVE_STRINGS_H) #include #endif #if defined(HAVE_ENDIAN_H) #include #elif defined(HAVE_SYS_ENDIAN_H) #include #include #endif #include /* Define standard sized integers */ #if defined(_MSC_VER) && (_MSC_VER < 1600) typedef unsigned __int8 uint8_t; typedef unsigned __int32 uint32_t; typedef unsigned __int64 uint64_t; typedef __int64 int64_t; #else #include #endif /* Compiler-specific intrinsics and fixes: bswap64, ntz */ #if _MSC_VER #define inline __inline /* MSVC doesn't recognize "inline" in C */ #define restrict __restrict /* MSVC doesn't recognize "restrict" in C */ #define __SSE2__ (_M_IX86 || _M_AMD64 || _M_X64) /* Assume SSE2 */ #define __SSSE3__ (_M_IX86 || _M_AMD64 || _M_X64) /* Assume SSSE3 */ #include #pragma intrinsic(_byteswap_uint64, _BitScanForward, memcpy) #elif __GNUC__ #ifndef inline #define inline __inline__ /* No "inline" in GCC ansi C mode */ #endif #ifndef restrict #define restrict __restrict__ /* No "restrict" in GCC ansi C mode */ #endif #endif #if _MSC_VER #define bswap64(x) _byteswap_uint64(x) #elif HAVE_DECL_BSWAP64 /* nothing */ #elif HAVE_DECL___BUILTIN_BSWAP64 #define bswap64(x) __builtin_bswap64(x) /* GCC 4.3+ */ #else #define bswap32(x) \ ((((x) & 0xff000000u) >> 24) | (((x) & 0x00ff0000u) >> 8) | \ (((x) & 0x0000ff00u) << 8) | (((x) & 0x000000ffu) << 24)) static inline uint64_t bswap64(uint64_t x) { union { uint64_t u64; uint32_t u32[2]; } in, out; in.u64 = x; out.u32[0] = bswap32(in.u32[1]); out.u32[1] = bswap32(in.u32[0]); return out.u64; } #endif #if _MSC_VER static inline unsigned ntz(unsigned x) {_BitScanForward(&x,x);return x;} #elif HAVE_DECL___BUILTIN_CTZ #define ntz(x) __builtin_ctz((unsigned)(x)) /* GCC 3.4+ */ #elif HAVE_DECL_FFS #define ntz(x) (ffs(x) - 1) #else #if (L_TABLE_SZ <= 9) && (L_TABLE_SZ_IS_ENOUGH) /* < 2^13 byte texts */ static inline unsigned ntz(unsigned x) { static const unsigned char tz_table[] = {0, 2,3,2,4,2,3,2,5,2,3,2,4,2,3,2,6,2,3,2,4,2,3,2,5,2,3,2,4,2,3,2,7, 2,3,2,4,2,3,2,5,2,3,2,4,2,3,2,6,2,3,2,4,2,3,2,5,2,3,2,4,2,3,2,8, 2,3,2,4,2,3,2,5,2,3,2,4,2,3,2,6,2,3,2,4,2,3,2,5,2,3,2,4,2,3,2,7, 2,3,2,4,2,3,2,5,2,3,2,4,2,3,2,6,2,3,2,4,2,3,2,5,2,3,2,4,2,3,2}; return tz_table[x/4]; } #else /* From http://supertech.csail.mit.edu/papers/debruijn.pdf */ static inline unsigned ntz(unsigned x) { static const unsigned char tz_table[32] = { 0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9}; return tz_table[((uint32_t)((x & -x) * 0x077CB531u)) >> 27]; } #endif #endif /* ----------------------------------------------------------------------- */ /* Define blocks and operations -- Patch if incorrect on your compiler. */ /* ----------------------------------------------------------------------- */ #if __SSE2__ #include /* SSE instructions and _mm_malloc */ #include /* SSE2 instructions */ typedef __m128i block; #define xor_block(x,y) _mm_xor_si128(x,y) #define zero_block() _mm_setzero_si128() #define unequal_blocks(x,y) \ (_mm_movemask_epi8(_mm_cmpeq_epi8(x,y)) != 0xffff) #if __SSSE3__ #include /* SSSE3 instructions */ #define swap_if_le(b) \ _mm_shuffle_epi8(b,_mm_set_epi8(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)) #else static inline block swap_if_le(block b) { block a = _mm_shuffle_epi32 (b, _MM_SHUFFLE(0,1,2,3)); a = _mm_shufflehi_epi16(a, _MM_SHUFFLE(2,3,0,1)); a = _mm_shufflelo_epi16(a, _MM_SHUFFLE(2,3,0,1)); return _mm_xor_si128(_mm_srli_epi16(a,8), _mm_slli_epi16(a,8)); } #endif static inline block gen_offset(uint64_t KtopStr[3], unsigned bot) { block hi = _mm_load_si128((__m128i *)(KtopStr+0)); /* hi = B A */ block lo = _mm_loadu_si128((__m128i *)(KtopStr+1)); /* lo = C B */ __m128i lshift = _mm_cvtsi32_si128(bot); __m128i rshift = _mm_cvtsi32_si128(64-bot); lo = _mm_xor_si128(_mm_sll_epi64(hi,lshift),_mm_srl_epi64(lo,rshift)); #if __SSSE3__ return _mm_shuffle_epi8(lo,_mm_set_epi8(8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7)); #else return swap_if_le(_mm_shuffle_epi32(lo, _MM_SHUFFLE(1,0,3,2))); #endif } static inline block double_block(block bl) { const __m128i mask = _mm_set_epi32(135,1,1,1); __m128i tmp = _mm_srai_epi32(bl, 31); tmp = _mm_and_si128(tmp, mask); tmp = _mm_shuffle_epi32(tmp, _MM_SHUFFLE(2,1,0,3)); bl = _mm_slli_epi32(bl, 1); return _mm_xor_si128(bl,tmp); } #elif __ALTIVEC__ && _CALL_ELF != 2 #include typedef vector unsigned block; #define xor_block(x,y) vec_xor(x,y) #define zero_block() vec_splat_u32(0) #define unequal_blocks(x,y) vec_any_ne(x,y) #define swap_if_le(b) (b) #if __PPC64__ static block gen_offset(uint64_t KtopStr[3], unsigned bot) { union {uint64_t u64[2]; block bl;} rval; rval.u64[0] = (KtopStr[0] << bot) | (KtopStr[1] >> (64-bot)); rval.u64[1] = (KtopStr[1] << bot) | (KtopStr[2] >> (64-bot)); return rval.bl; } #else /* Special handling: Shifts are mod 32, and no 64-bit types */ static block gen_offset(uint64_t KtopStr[3], unsigned bot) { const vector unsigned k32 = {32,32,32,32}; vector unsigned hi = *(vector unsigned *)(KtopStr+0); vector unsigned lo = *(vector unsigned *)(KtopStr+2); vector unsigned bot_vec; if (bot < 32) { lo = vec_sld(hi,lo,4); } else { vector unsigned t = vec_sld(hi,lo,4); lo = vec_sld(hi,lo,8); hi = t; bot = bot - 32; } if (bot == 0) return hi; *(unsigned *)&bot_vec = bot; vector unsigned lshift = vec_splat(bot_vec,0); vector unsigned rshift = vec_sub(k32,lshift); hi = vec_sl(hi,lshift); lo = vec_sr(lo,rshift); return vec_xor(hi,lo); } #endif static inline block double_block(block b) { const vector unsigned char mask = {135,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}; const vector unsigned char perm = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0}; const vector unsigned char shift7 = vec_splat_u8(7); const vector unsigned char shift1 = vec_splat_u8(1); vector unsigned char c = (vector unsigned char)b; vector unsigned char t = vec_sra(c,shift7); t = vec_and(t,mask); t = vec_perm(t,t,perm); c = vec_sl(c,shift1); return (block)vec_xor(c,t); } #elif __ARM_NEON__ #include typedef int8x16_t block; /* Yay! Endian-neutral reads! */ #define xor_block(x,y) veorq_s8(x,y) #define zero_block() vdupq_n_s8(0) static inline int unequal_blocks(block a, block b) { int64x2_t t=veorq_s64((int64x2_t)a,(int64x2_t)b); return (vgetq_lane_s64(t,0)|vgetq_lane_s64(t,1))!=0; } #define swap_if_le(b) (b) /* Using endian-neutral int8x16_t */ /* KtopStr is reg correct by 64 bits, return mem correct */ static block gen_offset(uint64_t KtopStr[3], unsigned bot) { const union { unsigned x; unsigned char endian; } little = { 1 }; const int64x2_t k64 = {-64,-64}; uint64x2_t hi, lo; memcpy(&hi, KtopStr, sizeof(hi)); memcpy(&lo, KtopStr+1, sizeof(lo)); int64x2_t ls = vdupq_n_s64(bot); int64x2_t rs = vqaddq_s64(k64,ls); block rval = (block)veorq_u64(vshlq_u64(hi,ls),vshlq_u64(lo,rs)); if (little.endian) rval = vrev64q_s8(rval); return rval; } static inline block double_block(block b) { const block mask = {-121,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}; block tmp = vshrq_n_s8(b,7); tmp = vandq_s8(tmp, mask); tmp = vextq_s8(tmp, tmp, 1); /* Rotate high byte to end */ b = vshlq_n_s8(b,1); return veorq_s8(tmp,b); } #else typedef struct { uint64_t l,r; } block; static inline block xor_block(block x, block y) { x.l^=y.l; x.r^=y.r; return x; } static inline block zero_block(void) { const block t = {0,0}; return t; } #define unequal_blocks(x, y) ((((x).l^(y).l)|((x).r^(y).r)) != 0) static inline block swap_if_le(block b) { const union { unsigned x; unsigned char endian; } little = { 1 }; if (little.endian) { block r; r.l = bswap64(b.l); r.r = bswap64(b.r); return r; } else return b; } /* KtopStr is reg correct by 64 bits, return mem correct */ static block gen_offset(uint64_t KtopStr[3], unsigned bot) { block rval; if (bot != 0) { rval.l = (KtopStr[0] << bot) | (KtopStr[1] >> (64-bot)); rval.r = (KtopStr[1] << bot) | (KtopStr[2] >> (64-bot)); } else { rval.l = KtopStr[0]; rval.r = KtopStr[1]; } return swap_if_le(rval); } #if __GNUC__ && !__clang__ && __arm__ static inline block double_block(block b) { __asm__ ("adds %1,%1,%1\n\t" "adcs %H1,%H1,%H1\n\t" "adcs %0,%0,%0\n\t" "adcs %H0,%H0,%H0\n\t" "it cs\n\t" "eorcs %1,%1,#135" : "+r"(b.l), "+r"(b.r) : : "cc"); return b; } #else static inline block double_block(block b) { uint64_t t = (uint64_t)((int64_t)b.l >> 63); b.l = (b.l + b.l) ^ (b.r >> 63); b.r = (b.r + b.r) ^ (t & 135); return b; } #endif #endif /* ----------------------------------------------------------------------- */ /* AES */ /* ----------------------------------------------------------------------- */ /*---------------*/ #if USE_OPENSSL_AES /*---------------*/ #include /* http://openssl.org/ */ namespace ocb_aes { typedef EVP_CIPHER_CTX KEY; enum { BLOCK_SIZE = 16 }; static KEY *KEY_new() { KEY *key = EVP_CIPHER_CTX_new(); if (key == NULL) { throw std::bad_alloc(); } return key; } static void KEY_delete(KEY *key) { EVP_CIPHER_CTX_free(key); } static void set_encrypt_key(const unsigned char *user_key, int bits, KEY *key) { // Do not copy and paste this code! It is far too low-level to be // general-purpose. If you're looking for an example of using AEAD // through OpenSSL's EVP_CIPHER API, have a look at ocb_openssl.cc // instead. // // This function and the others in this section replicate the behavior of // OpenSSL's deprecated AES_* primitives. Those primitives implemented AES // without any block cipher mode--that is, in ECB mode. Normally, using ECB // mode anywhere would be questionable, but it's safe here because it's // being used to implement a higher-level cryptographic mode (OCB mode), // which is in turn used by Mosh. fatal_assert(bits == 128); if (EVP_EncryptInit_ex(key, EVP_aes_128_ecb(), /*impl=*/NULL, user_key, /*iv=*/NULL) != 1 || EVP_CIPHER_CTX_set_padding(key, false) != 1) { throw Crypto::CryptoException("Could not initialize AES encryption context."); } } static void set_decrypt_key(const unsigned char *user_key, int bits, KEY *key) { // Do not copy and paste this code! See notes in set_encrypt_key. fatal_assert(bits == 128); if (EVP_DecryptInit_ex(key, EVP_aes_128_ecb(), /*impl=*/NULL, user_key, /*iv=*/NULL) != 1 || EVP_CIPHER_CTX_set_padding(key, false) != 1) { throw Crypto::CryptoException("Could not initialize AES decryption context."); } } static void encrypt(const unsigned char *in, unsigned char *out, KEY *key) { // Even though the functions in this section use ECB mode (which is // stateless), OpenSSL still requires calls to EncryptInit and // EncryptFinal. Since ECB mode has no IV and they key is unchanged, // every parameter to this function can be NULL (which OpenSSL // interprets as "don't change this"). if (EVP_EncryptInit_ex(key, /*type=*/NULL, /*impl=*/NULL, /*key=*/NULL, /*iv=*/NULL) != 1) { throw Crypto::CryptoException("Could not start AES encryption operation."); } int len; if (EVP_EncryptUpdate(key, out, &len, in, BLOCK_SIZE) != 1) { throw Crypto::CryptoException("Could not AES-encrypt block."); } int total_len = len; if (EVP_EncryptFinal_ex(key, out + total_len, &len) != 1) { throw Crypto::CryptoException("Could not finish AES encryption operation."); } total_len += len; fatal_assert(total_len == BLOCK_SIZE); } static void decrypt(const unsigned char *in, unsigned char *out, KEY *key) { // See notes in encrypt about EncryptInit and EncryptFinal; the same // notes apply to DecryptInit and DecryptFinal here. if (EVP_DecryptInit_ex(key, /*type=*/NULL, /*impl=*/NULL, /*key=*/NULL, /*iv=*/NULL) != 1) { throw Crypto::CryptoException("Could not start AES decryption operation."); } int len; if (EVP_DecryptUpdate(key, out, &len, in, BLOCK_SIZE) != 1) { throw Crypto::CryptoException("Could not AES-decrypt block."); } int total_len = len; if (EVP_DecryptFinal_ex(key, out + total_len, &len) != 1) { throw Crypto::CryptoException("Could not finish AES decryption operation."); } total_len += len; fatal_assert(total_len == BLOCK_SIZE); } /* How to ECB encrypt an array of blocks, in place */ static void ecb_encrypt_blks(block *blks, unsigned nblks, KEY *key) { while (nblks) { --nblks; encrypt(reinterpret_cast(blks+nblks), reinterpret_cast(blks+nblks), key); } } static void ecb_decrypt_blks(block *blks, unsigned nblks, KEY *key) { while (nblks) { --nblks; decrypt(reinterpret_cast(blks+nblks), reinterpret_cast(blks+nblks), key); } } } // namespace ocb_aes #define BPI 4 /* Number of blocks in buffer per ECB call */ /*-------------------*/ #elif USE_APPLE_COMMON_CRYPTO_AES /*-------------------*/ #include namespace ocb_aes { typedef struct { CCCryptorRef ref; uint8_t b[4096]; } KEY; static KEY *KEY_new() { return new KEY; } static void KEY_delete(KEY *key) { delete key; } static void set_encrypt_key(const unsigned char *handle, const int bits, KEY *key) { CCCryptorStatus rv = CCCryptorCreateFromData( kCCEncrypt, kCCAlgorithmAES128, kCCOptionECBMode, handle, bits / 8, NULL, &(key->b), sizeof (key->b), &(key->ref), NULL); fatal_assert(rv == kCCSuccess); } static void set_decrypt_key(const unsigned char *handle, const int bits, KEY *key) { CCCryptorStatus rv = CCCryptorCreateFromData( kCCDecrypt, kCCAlgorithmAES128, kCCOptionECBMode, handle, bits / 8, NULL, &(key->b), sizeof (key->b), &(key->ref), NULL); fatal_assert(rv == kCCSuccess); } static void encrypt(unsigned char *src, unsigned char *dst, KEY *key) { size_t dataOutMoved; CCCryptorStatus rv = CCCryptorUpdate( key->ref, (const void *)src, kCCBlockSizeAES128, (void *)dst, kCCBlockSizeAES128, &dataOutMoved); fatal_assert(rv == kCCSuccess); fatal_assert(dataOutMoved == kCCBlockSizeAES128); } #if 0 /* unused */ static void decrypt(unsigned char *src, unsigned char *dst, KEY *key) { encrypt(src, dst, key); } #endif static void ecb_encrypt_blks(block *blks, unsigned nblks, KEY *key) { const size_t dataSize = kCCBlockSizeAES128 * nblks; size_t dataOutMoved; CCCryptorStatus rv = CCCryptorUpdate( key->ref, (const void *)blks, dataSize, (void *)blks, dataSize, &dataOutMoved); fatal_assert(rv == kCCSuccess); fatal_assert(dataOutMoved == dataSize); } static void ecb_decrypt_blks(block *blks, unsigned nblks, KEY *key) { ecb_encrypt_blks(blks, nblks, key); } } // namespace ocb_aes #define BPI 4 /* Number of blocks in buffer per ECB call */ /*-------------------*/ #elif USE_NETTLE_AES /*-------------------*/ #include namespace ocb_aes { typedef struct aes128_ctx KEY; static KEY *KEY_new() { return new KEY; } static void KEY_delete(KEY *key) { delete key; } static void set_encrypt_key(const unsigned char *handle, const int bits, KEY *key) { fatal_assert(bits == 128); nettle_aes128_set_encrypt_key(key, (const uint8_t *)handle); } static void set_decrypt_key(const unsigned char *handle, const int bits, KEY *key) { fatal_assert(bits == 128); nettle_aes128_set_decrypt_key(key, (const uint8_t *)handle); } static void encrypt(unsigned char *src, unsigned char *dst, KEY *key) { nettle_aes128_encrypt(key, AES_BLOCK_SIZE, dst, src); } #if 0 /* unused */ static void decrypt(unsigned char *src, unsigned char *dst, KEY *key) { nettle_aes128_decrypt(key, AES_BLOCK_SIZE, dst, src); } #endif static void ecb_encrypt_blks(block *blks, unsigned nblks, KEY *key) { nettle_aes128_encrypt(key, nblks * AES_BLOCK_SIZE, (unsigned char*)blks, (unsigned char*)blks); } static void ecb_decrypt_blks(block *blks, unsigned nblks, KEY *key) { nettle_aes128_decrypt(key, nblks * AES_BLOCK_SIZE, (unsigned char*)blks, (unsigned char*)blks); } } // namespace ocb_aes #define BPI 4 /* Number of blocks in buffer per ECB call */ #else #error "No AES implementation selected." #endif /* ----------------------------------------------------------------------- */ /* Define OCB context structure. */ /* ----------------------------------------------------------------------- */ /*------------------------------------------------------------------------ / Each item in the OCB context is stored either "memory correct" or / "register correct". On big-endian machines, this is identical. On / little-endian machines, one must choose whether the byte-string / is in the correct order when it resides in memory or in registers. / It must be register correct whenever it is to be manipulated / arithmetically, but must be memory correct whenever it interacts / with the plaintext or ciphertext. /------------------------------------------------------------------------- */ struct _ae_ctx { block offset; /* Memory correct */ block checksum; /* Memory correct */ block Lstar; /* Memory correct */ block Ldollar; /* Memory correct */ block L[L_TABLE_SZ]; /* Memory correct */ block ad_checksum; /* Memory correct */ block ad_offset; /* Memory correct */ block cached_Top; /* Memory correct */ uint64_t KtopStr[3]; /* Register correct, each item */ uint32_t ad_blocks_processed; uint32_t blocks_processed; ocb_aes::KEY *decrypt_key; ocb_aes::KEY *encrypt_key; #if (OCB_TAG_LEN == 0) unsigned tag_len; #endif }; /* ----------------------------------------------------------------------- */ /* L table lookup (or on-the-fly generation) */ /* ----------------------------------------------------------------------- */ #if L_TABLE_SZ_IS_ENOUGH #define getL(_ctx, _tz) ((_ctx)->L[_tz]) #else static block getL(const ae_ctx *ctx, unsigned tz) { if (tz < L_TABLE_SZ) return ctx->L[tz]; else { unsigned i; /* Bring L[MAX] into registers, make it register correct */ block rval = swap_if_le(ctx->L[L_TABLE_SZ-1]); rval = double_block(rval); for (i=L_TABLE_SZ; i < tz; i++) rval = double_block(rval); return swap_if_le(rval); /* To memory correct */ } } #endif /* ----------------------------------------------------------------------- */ /* Public functions */ /* ----------------------------------------------------------------------- */ /* 32-bit SSE2 and Altivec systems need to be forced to allocate memory on 16-byte alignments. (I believe all major 64-bit systems do already.) */ /* Mosh uses its own AlignedBuffer class, not ae_allocate() or ae_free(). */ /* ----------------------------------------------------------------------- */ int ae_clear (ae_ctx *ctx) /* Zero ae_ctx and undo initialization */ { ocb_aes::KEY_delete(ctx->encrypt_key); ocb_aes::KEY_delete(ctx->decrypt_key); memset(ctx, 0, sizeof(ae_ctx)); return AE_SUCCESS; } int ae_ctx_sizeof(void) { return (int) sizeof(ae_ctx); } /* ----------------------------------------------------------------------- */ int ae_init(ae_ctx *ctx, const void *key, int key_len, int nonce_len, int tag_len) { unsigned i; block tmp_blk; if (nonce_len != 12) return AE_NOT_SUPPORTED; ctx->decrypt_key = ocb_aes::KEY_new(); ctx->encrypt_key = ocb_aes::KEY_new(); /* Initialize encryption & decryption keys */ #if (OCB_KEY_LEN > 0) key_len = OCB_KEY_LEN; #endif ocb_aes::set_encrypt_key(reinterpret_cast(key), key_len*8, ctx->encrypt_key); ocb_aes::set_decrypt_key(reinterpret_cast(key), static_cast(key_len*8), ctx->decrypt_key); /* Zero things that need zeroing */ ctx->cached_Top = ctx->ad_checksum = zero_block(); ctx->ad_blocks_processed = 0; /* Compute key-dependent values */ ocb_aes::encrypt(reinterpret_cast(&ctx->cached_Top), reinterpret_cast(&ctx->Lstar), ctx->encrypt_key); tmp_blk = swap_if_le(ctx->Lstar); tmp_blk = double_block(tmp_blk); ctx->Ldollar = swap_if_le(tmp_blk); tmp_blk = double_block(tmp_blk); ctx->L[0] = swap_if_le(tmp_blk); for (i = 1; i < L_TABLE_SZ; i++) { tmp_blk = double_block(tmp_blk); ctx->L[i] = swap_if_le(tmp_blk); } #if (OCB_TAG_LEN == 0) ctx->tag_len = tag_len; #else (void) tag_len; /* Suppress var not used error */ #endif return AE_SUCCESS; } /* ----------------------------------------------------------------------- */ static block gen_offset_from_nonce(ae_ctx *ctx, const void *nonce) { const union { unsigned x; unsigned char endian; } little = { 1 }; union { uint32_t u32[4]; uint8_t u8[16]; block bl; } tmp; unsigned idx; /* Replace cached nonce Top if needed */ tmp.u32[0] = (little.endian?0x01000000:0x00000001); tmp.u32[1] = ((uint32_t *)nonce)[0]; tmp.u32[2] = ((uint32_t *)nonce)[1]; tmp.u32[3] = ((uint32_t *)nonce)[2]; idx = (unsigned)(tmp.u8[15] & 0x3f); /* Get low 6 bits of nonce */ tmp.u8[15] = tmp.u8[15] & 0xc0; /* Zero low 6 bits of nonce */ if ( unequal_blocks(tmp.bl,ctx->cached_Top) ) { /* Cached? */ ctx->cached_Top = tmp.bl; /* Update cache, KtopStr */ ocb_aes::encrypt(tmp.u8, (unsigned char *)&ctx->KtopStr, ctx->encrypt_key); if (little.endian) { /* Make Register Correct */ ctx->KtopStr[0] = bswap64(ctx->KtopStr[0]); ctx->KtopStr[1] = bswap64(ctx->KtopStr[1]); } ctx->KtopStr[2] = ctx->KtopStr[0] ^ (ctx->KtopStr[0] << 8) ^ (ctx->KtopStr[1] >> 56); } return gen_offset(ctx->KtopStr, idx); } static void process_ad(ae_ctx *ctx, const void *ad, int ad_len, int final) { union { uint32_t u32[4]; uint8_t u8[16]; block bl; } tmp; block ad_offset, ad_checksum; const block * adp = (block *)ad; unsigned i,k,tz,remaining; ad_offset = ctx->ad_offset; ad_checksum = ctx->ad_checksum; i = ad_len/(BPI*16); if (i) { unsigned ad_block_num = ctx->ad_blocks_processed; do { block ta[BPI], oa[BPI]; ad_block_num += BPI; tz = ntz(ad_block_num); oa[0] = xor_block(ad_offset, ctx->L[0]); ta[0] = xor_block(oa[0], adp[0]); oa[1] = xor_block(oa[0], ctx->L[1]); ta[1] = xor_block(oa[1], adp[1]); oa[2] = xor_block(ad_offset, ctx->L[1]); ta[2] = xor_block(oa[2], adp[2]); #if BPI == 4 ad_offset = xor_block(oa[2], getL(ctx, tz)); ta[3] = xor_block(ad_offset, adp[3]); #elif BPI == 8 oa[3] = xor_block(oa[2], ctx->L[2]); ta[3] = xor_block(oa[3], adp[3]); oa[4] = xor_block(oa[1], ctx->L[2]); ta[4] = xor_block(oa[4], adp[4]); oa[5] = xor_block(oa[0], ctx->L[2]); ta[5] = xor_block(oa[5], adp[5]); oa[6] = xor_block(ad_offset, ctx->L[2]); ta[6] = xor_block(oa[6], adp[6]); ad_offset = xor_block(oa[6], getL(ctx, tz)); ta[7] = xor_block(ad_offset, adp[7]); #endif ocb_aes::ecb_encrypt_blks(ta, BPI, ctx->encrypt_key); ad_checksum = xor_block(ad_checksum, ta[0]); ad_checksum = xor_block(ad_checksum, ta[1]); ad_checksum = xor_block(ad_checksum, ta[2]); ad_checksum = xor_block(ad_checksum, ta[3]); #if (BPI == 8) ad_checksum = xor_block(ad_checksum, ta[4]); ad_checksum = xor_block(ad_checksum, ta[5]); ad_checksum = xor_block(ad_checksum, ta[6]); ad_checksum = xor_block(ad_checksum, ta[7]); #endif adp += BPI; } while (--i); ctx->ad_blocks_processed = ad_block_num; ctx->ad_offset = ad_offset; ctx->ad_checksum = ad_checksum; } if (final) { block ta[BPI]; /* Process remaining associated data, compute its tag contribution */ remaining = ((unsigned)ad_len) % (BPI*16); if (remaining) { k=0; #if (BPI == 8) if (remaining >= 64) { tmp.bl = xor_block(ad_offset, ctx->L[0]); ta[0] = xor_block(tmp.bl, adp[0]); tmp.bl = xor_block(tmp.bl, ctx->L[1]); ta[1] = xor_block(tmp.bl, adp[1]); ad_offset = xor_block(ad_offset, ctx->L[1]); ta[2] = xor_block(ad_offset, adp[2]); ad_offset = xor_block(ad_offset, ctx->L[2]); ta[3] = xor_block(ad_offset, adp[3]); remaining -= 64; k=4; } #endif if (remaining >= 32) { ad_offset = xor_block(ad_offset, ctx->L[0]); ta[k] = xor_block(ad_offset, adp[k]); ad_offset = xor_block(ad_offset, getL(ctx, ntz(k+2))); ta[k+1] = xor_block(ad_offset, adp[k+1]); remaining -= 32; k+=2; } if (remaining >= 16) { ad_offset = xor_block(ad_offset, ctx->L[0]); ta[k] = xor_block(ad_offset, adp[k]); remaining = remaining - 16; ++k; } if (remaining) { ad_offset = xor_block(ad_offset,ctx->Lstar); tmp.bl = zero_block(); memcpy(tmp.u8, adp+k, remaining); tmp.u8[remaining] = (unsigned char)0x80u; ta[k] = xor_block(ad_offset, tmp.bl); ++k; } ocb_aes::ecb_encrypt_blks(ta, k, ctx->encrypt_key); switch (k) { #if (BPI == 8) case 8: ad_checksum = xor_block(ad_checksum, ta[7]); /* fallthrough */ case 7: ad_checksum = xor_block(ad_checksum, ta[6]); /* fallthrough */ case 6: ad_checksum = xor_block(ad_checksum, ta[5]); /* fallthrough */ case 5: ad_checksum = xor_block(ad_checksum, ta[4]); /* fallthrough */ #endif case 4: ad_checksum = xor_block(ad_checksum, ta[3]); /* fallthrough */ case 3: ad_checksum = xor_block(ad_checksum, ta[2]); /* fallthrough */ case 2: ad_checksum = xor_block(ad_checksum, ta[1]); /* fallthrough */ case 1: ad_checksum = xor_block(ad_checksum, ta[0]); } ctx->ad_checksum = ad_checksum; } } } /* ----------------------------------------------------------------------- */ int ae_encrypt(ae_ctx * ctx, const void * nonce, const void *pt, int pt_len, const void *ad, int ad_len, void *ct, void *tag, int final) { union { uint32_t u32[4]; uint8_t u8[16]; block bl; } tmp; block offset, checksum; unsigned i, k; block * ctp = (block *)ct; const block * ptp = (block *)pt; /* Non-null nonce means start of new message, init per-message values */ if (nonce) { ctx->offset = gen_offset_from_nonce(ctx, nonce); ctx->ad_offset = ctx->checksum = zero_block(); ctx->ad_blocks_processed = ctx->blocks_processed = 0; if (ad_len >= 0) ctx->ad_checksum = zero_block(); } /* Process associated data */ if (ad_len > 0) process_ad(ctx, ad, ad_len, final); /* Encrypt plaintext data BPI blocks at a time */ offset = ctx->offset; checksum = ctx->checksum; i = pt_len/(BPI*16); if (i) { block oa[BPI]; unsigned block_num = ctx->blocks_processed; oa[BPI-1] = offset; do { block ta[BPI]; block_num += BPI; oa[0] = xor_block(oa[BPI-1], ctx->L[0]); ta[0] = xor_block(oa[0], ptp[0]); checksum = xor_block(checksum, ptp[0]); oa[1] = xor_block(oa[0], ctx->L[1]); ta[1] = xor_block(oa[1], ptp[1]); checksum = xor_block(checksum, ptp[1]); oa[2] = xor_block(oa[1], ctx->L[0]); ta[2] = xor_block(oa[2], ptp[2]); checksum = xor_block(checksum, ptp[2]); #if BPI == 4 oa[3] = xor_block(oa[2], getL(ctx, ntz(block_num))); ta[3] = xor_block(oa[3], ptp[3]); checksum = xor_block(checksum, ptp[3]); #elif BPI == 8 oa[3] = xor_block(oa[2], ctx->L[2]); ta[3] = xor_block(oa[3], ptp[3]); checksum = xor_block(checksum, ptp[3]); oa[4] = xor_block(oa[1], ctx->L[2]); ta[4] = xor_block(oa[4], ptp[4]); checksum = xor_block(checksum, ptp[4]); oa[5] = xor_block(oa[0], ctx->L[2]); ta[5] = xor_block(oa[5], ptp[5]); checksum = xor_block(checksum, ptp[5]); oa[6] = xor_block(oa[7], ctx->L[2]); ta[6] = xor_block(oa[6], ptp[6]); checksum = xor_block(checksum, ptp[6]); oa[7] = xor_block(oa[6], getL(ctx, ntz(block_num))); ta[7] = xor_block(oa[7], ptp[7]); checksum = xor_block(checksum, ptp[7]); #endif ocb_aes::ecb_encrypt_blks(ta, BPI, ctx->encrypt_key); ctp[0] = xor_block(ta[0], oa[0]); ctp[1] = xor_block(ta[1], oa[1]); ctp[2] = xor_block(ta[2], oa[2]); ctp[3] = xor_block(ta[3], oa[3]); #if (BPI == 8) ctp[4] = xor_block(ta[4], oa[4]); ctp[5] = xor_block(ta[5], oa[5]); ctp[6] = xor_block(ta[6], oa[6]); ctp[7] = xor_block(ta[7], oa[7]); #endif ptp += BPI; ctp += BPI; } while (--i); ctx->offset = offset = oa[BPI-1]; ctx->blocks_processed = block_num; ctx->checksum = checksum; } if (final) { block ta[BPI+1], oa[BPI]; /* Process remaining plaintext and compute its tag contribution */ unsigned remaining = ((unsigned)pt_len) % (BPI*16); k = 0; /* How many blocks in ta[] need ECBing */ if (remaining) { #if (BPI == 8) if (remaining >= 64) { oa[0] = xor_block(offset, ctx->L[0]); ta[0] = xor_block(oa[0], ptp[0]); checksum = xor_block(checksum, ptp[0]); oa[1] = xor_block(oa[0], ctx->L[1]); ta[1] = xor_block(oa[1], ptp[1]); checksum = xor_block(checksum, ptp[1]); oa[2] = xor_block(oa[1], ctx->L[0]); ta[2] = xor_block(oa[2], ptp[2]); checksum = xor_block(checksum, ptp[2]); offset = oa[3] = xor_block(oa[2], ctx->L[2]); ta[3] = xor_block(offset, ptp[3]); checksum = xor_block(checksum, ptp[3]); remaining -= 64; k = 4; } #endif if (remaining >= 32) { oa[k] = xor_block(offset, ctx->L[0]); ta[k] = xor_block(oa[k], ptp[k]); checksum = xor_block(checksum, ptp[k]); offset = oa[k+1] = xor_block(oa[k], ctx->L[1]); ta[k+1] = xor_block(offset, ptp[k+1]); checksum = xor_block(checksum, ptp[k+1]); remaining -= 32; k+=2; } if (remaining >= 16) { offset = oa[k] = xor_block(offset, ctx->L[0]); ta[k] = xor_block(offset, ptp[k]); checksum = xor_block(checksum, ptp[k]); remaining -= 16; ++k; } if (remaining) { tmp.bl = zero_block(); memcpy(tmp.u8, ptp+k, remaining); tmp.u8[remaining] = (unsigned char)0x80u; checksum = xor_block(checksum, tmp.bl); ta[k] = offset = xor_block(offset,ctx->Lstar); ++k; } } offset = xor_block(offset, ctx->Ldollar); /* Part of tag gen */ ta[k] = xor_block(offset, checksum); /* Part of tag gen */ ocb_aes::ecb_encrypt_blks(ta, k + 1, ctx->encrypt_key); offset = xor_block(ta[k], ctx->ad_checksum); /* Part of tag gen */ if (remaining) { --k; tmp.bl = xor_block(tmp.bl, ta[k]); memcpy(ctp+k, tmp.u8, remaining); } switch (k) { #if (BPI == 8) case 7: ctp[6] = xor_block(ta[6], oa[6]); /* fallthrough */ case 6: ctp[5] = xor_block(ta[5], oa[5]); /* fallthrough */ case 5: ctp[4] = xor_block(ta[4], oa[4]); /* fallthrough */ case 4: ctp[3] = xor_block(ta[3], oa[3]); /* fallthrough */ #endif case 3: ctp[2] = xor_block(ta[2], oa[2]); /* fallthrough */ case 2: ctp[1] = xor_block(ta[1], oa[1]); /* fallthrough */ case 1: ctp[0] = xor_block(ta[0], oa[0]); } /* Tag is placed at the correct location */ if (tag) { #if (OCB_TAG_LEN == 16) *(block *)tag = offset; #elif (OCB_TAG_LEN > 0) memcpy((char *)tag, &offset, OCB_TAG_LEN); #else memcpy((char *)tag, &offset, ctx->tag_len); #endif } else { #if (OCB_TAG_LEN > 0) memcpy((char *)ct + pt_len, &offset, OCB_TAG_LEN); pt_len += OCB_TAG_LEN; #else memcpy((char *)ct + pt_len, &offset, ctx->tag_len); pt_len += ctx->tag_len; #endif } } return (int) pt_len; } /* ----------------------------------------------------------------------- */ /* Compare two regions of memory, taking a constant amount of time for a given buffer size -- under certain assumptions about the compiler and machine, of course. Use this to avoid timing side-channel attacks. Returns 0 for memory regions with equal contents; non-zero otherwise. */ static int constant_time_memcmp(const void *av, const void *bv, size_t n) { const uint8_t *a = (const uint8_t *) av; const uint8_t *b = (const uint8_t *) bv; uint8_t result = 0; size_t i; for (i=0; i 0) ct_len -= OCB_TAG_LEN; #else ct_len -= ctx->tag_len; #endif /* Non-null nonce means start of new message, init per-message values */ if (nonce) { ctx->offset = gen_offset_from_nonce(ctx, nonce); ctx->ad_offset = ctx->checksum = zero_block(); ctx->ad_blocks_processed = ctx->blocks_processed = 0; if (ad_len >= 0) ctx->ad_checksum = zero_block(); } /* Process associated data */ if (ad_len > 0) process_ad(ctx, ad, ad_len, final); /* Encrypt plaintext data BPI blocks at a time */ offset = ctx->offset; checksum = ctx->checksum; i = ct_len/(BPI*16); if (i) { block oa[BPI]; unsigned block_num = ctx->blocks_processed; oa[BPI-1] = offset; do { block ta[BPI]; block_num += BPI; oa[0] = xor_block(oa[BPI-1], ctx->L[0]); ta[0] = xor_block(oa[0], ctp[0]); oa[1] = xor_block(oa[0], ctx->L[1]); ta[1] = xor_block(oa[1], ctp[1]); oa[2] = xor_block(oa[1], ctx->L[0]); ta[2] = xor_block(oa[2], ctp[2]); #if BPI == 4 oa[3] = xor_block(oa[2], getL(ctx, ntz(block_num))); ta[3] = xor_block(oa[3], ctp[3]); #elif BPI == 8 oa[3] = xor_block(oa[2], ctx->L[2]); ta[3] = xor_block(oa[3], ctp[3]); oa[4] = xor_block(oa[1], ctx->L[2]); ta[4] = xor_block(oa[4], ctp[4]); oa[5] = xor_block(oa[0], ctx->L[2]); ta[5] = xor_block(oa[5], ctp[5]); oa[6] = xor_block(oa[7], ctx->L[2]); ta[6] = xor_block(oa[6], ctp[6]); oa[7] = xor_block(oa[6], getL(ctx, ntz(block_num))); ta[7] = xor_block(oa[7], ctp[7]); #endif ocb_aes::ecb_decrypt_blks(ta,BPI,ctx->decrypt_key); ptp[0] = xor_block(ta[0], oa[0]); checksum = xor_block(checksum, ptp[0]); ptp[1] = xor_block(ta[1], oa[1]); checksum = xor_block(checksum, ptp[1]); ptp[2] = xor_block(ta[2], oa[2]); checksum = xor_block(checksum, ptp[2]); ptp[3] = xor_block(ta[3], oa[3]); checksum = xor_block(checksum, ptp[3]); #if (BPI == 8) ptp[4] = xor_block(ta[4], oa[4]); checksum = xor_block(checksum, ptp[4]); ptp[5] = xor_block(ta[5], oa[5]); checksum = xor_block(checksum, ptp[5]); ptp[6] = xor_block(ta[6], oa[6]); checksum = xor_block(checksum, ptp[6]); ptp[7] = xor_block(ta[7], oa[7]); checksum = xor_block(checksum, ptp[7]); #endif ptp += BPI; ctp += BPI; } while (--i); ctx->offset = offset = oa[BPI-1]; ctx->blocks_processed = block_num; ctx->checksum = checksum; } if (final) { block ta[BPI+1], oa[BPI]; /* Process remaining plaintext and compute its tag contribution */ unsigned remaining = ((unsigned)ct_len) % (BPI*16); k = 0; /* How many blocks in ta[] need ECBing */ if (remaining) { #if (BPI == 8) if (remaining >= 64) { oa[0] = xor_block(offset, ctx->L[0]); ta[0] = xor_block(oa[0], ctp[0]); oa[1] = xor_block(oa[0], ctx->L[1]); ta[1] = xor_block(oa[1], ctp[1]); oa[2] = xor_block(oa[1], ctx->L[0]); ta[2] = xor_block(oa[2], ctp[2]); offset = oa[3] = xor_block(oa[2], ctx->L[2]); ta[3] = xor_block(offset, ctp[3]); remaining -= 64; k = 4; } #endif if (remaining >= 32) { oa[k] = xor_block(offset, ctx->L[0]); ta[k] = xor_block(oa[k], ctp[k]); offset = oa[k+1] = xor_block(oa[k], ctx->L[1]); ta[k+1] = xor_block(offset, ctp[k+1]); remaining -= 32; k+=2; } if (remaining >= 16) { offset = oa[k] = xor_block(offset, ctx->L[0]); ta[k] = xor_block(offset, ctp[k]); remaining -= 16; ++k; } if (remaining) { block pad; offset = xor_block(offset,ctx->Lstar); ocb_aes::encrypt(reinterpret_cast(&offset), tmp.u8, ctx->encrypt_key); pad = tmp.bl; memcpy(tmp.u8,ctp+k,remaining); tmp.bl = xor_block(tmp.bl, pad); tmp.u8[remaining] = (unsigned char)0x80u; memcpy(ptp+k, tmp.u8, remaining); checksum = xor_block(checksum, tmp.bl); } } ocb_aes::ecb_decrypt_blks(ta,k,ctx->decrypt_key); switch (k) { #if (BPI == 8) case 7: ptp[6] = xor_block(ta[6], oa[6]); checksum = xor_block(checksum, ptp[6]); /* fallthrough */ case 6: ptp[5] = xor_block(ta[5], oa[5]); checksum = xor_block(checksum, ptp[5]); /* fallthrough */ case 5: ptp[4] = xor_block(ta[4], oa[4]); checksum = xor_block(checksum, ptp[4]); /* fallthrough */ case 4: ptp[3] = xor_block(ta[3], oa[3]); checksum = xor_block(checksum, ptp[3]); /* fallthrough */ #endif case 3: ptp[2] = xor_block(ta[2], oa[2]); checksum = xor_block(checksum, ptp[2]); /* fallthrough */ case 2: ptp[1] = xor_block(ta[1], oa[1]); checksum = xor_block(checksum, ptp[1]); /* fallthrough */ case 1: ptp[0] = xor_block(ta[0], oa[0]); checksum = xor_block(checksum, ptp[0]); } /* Calculate expected tag */ offset = xor_block(offset, ctx->Ldollar); tmp.bl = xor_block(offset, checksum); ocb_aes::encrypt(tmp.u8, tmp.u8, ctx->encrypt_key); tmp.bl = xor_block(tmp.bl, ctx->ad_checksum); /* Full tag */ /* Compare with proposed tag, change ct_len if invalid */ if ((OCB_TAG_LEN == 16) && tag) { if (unequal_blocks(tmp.bl, *(block *)tag)) ct_len = AE_INVALID; } else { #if (OCB_TAG_LEN > 0) int len = OCB_TAG_LEN; #else int len = ctx->tag_len; #endif if (tag) { if (constant_time_memcmp(tag,tmp.u8,len) != 0) ct_len = AE_INVALID; } else { if (constant_time_memcmp((char *)ct + ct_len,tmp.u8,len) != 0) ct_len = AE_INVALID; } } } return ct_len; } /* ----------------------------------------------------------------------- */ /* Simple test program */ /* ----------------------------------------------------------------------- */ #if defined(OCB_TEST_PROGRAM) #include #include #if __GNUC__ #define ALIGN(n) __attribute__ ((aligned(n))) #elif _MSC_VER #define ALIGN(n) __declspec(align(n)) #else /* Not GNU/Microsoft: delete alignment uses. */ #define ALIGN(n) #endif static void pbuf(void *p, unsigned len, const void *s) { unsigned i; if (s) printf("%s", (char *)s); for (i = 0; i < len; i++) printf("%02X", (unsigned)(((unsigned char *)p)[i])); printf("\n"); } static void vectors(ae_ctx *ctx, int len) { ALIGN(16) uint8_t pt[128]; ALIGN(16) uint8_t ct[144]; ALIGN(16) uint8_t nonce[] = {0,1,2,3,4,5,6,7,8,9,10,11}; int i; for (i=0; i < 128; i++) pt[i] = i; i = ae_encrypt(ctx,nonce,pt,len,pt,len,ct,NULL,AE_FINALIZE); printf("P=%d,A=%d: ",len,len); pbuf(ct, i, NULL); i = ae_encrypt(ctx,nonce,pt,0,pt,len,ct,NULL,AE_FINALIZE); printf("P=%d,A=%d: ",0,len); pbuf(ct, i, NULL); i = ae_encrypt(ctx,nonce,pt,len,pt,0,ct,NULL,AE_FINALIZE); printf("P=%d,A=%d: ",len,0); pbuf(ct, i, NULL); } static void validate() { ALIGN(16) uint8_t pt[1024]; ALIGN(16) uint8_t ct[1024]; ALIGN(16) uint8_t tag[16]; ALIGN(16) uint8_t nonce[12] = {0,}; ALIGN(16) uint8_t key[32] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; ALIGN(16) uint8_t valid[] = {0xB2,0xB4,0x1C,0xBF,0x9B,0x05,0x03,0x7D, 0xA7,0xF1,0x6C,0x24,0xA3,0x5C,0x1C,0x94}; ae_ctx ctx; uint8_t *val_buf, *next; int i, len; val_buf = (uint8_t *)malloc(22400 + 16); next = val_buf = (uint8_t *)(((size_t)val_buf + 16) & ~((size_t)15)); if (0) { ae_init(&ctx, key, 16, 12, 16); /* pbuf(&ctx, sizeof(ctx), "CTX: "); */ vectors(&ctx,0); vectors(&ctx,8); vectors(&ctx,16); vectors(&ctx,24); vectors(&ctx,32); vectors(&ctx,40); } memset(key,0,32); memset(pt,0,128); ae_init(&ctx, key, 16, 12, 16); /* RFC Vector test */ for (i = 0; i < 128; i++) { int first = ((i/3)/(BPI*16))*(BPI*16); int second = first; int third = i - (first + second); nonce[11] = i; if (0) { ae_encrypt(&ctx,nonce,pt,i,pt,i,ct,NULL,AE_FINALIZE); memcpy(next,ct,(size_t)i+16); next = next+i+16; ae_encrypt(&ctx,nonce,pt,i,pt,0,ct,NULL,AE_FINALIZE); memcpy(next,ct,(size_t)i+16); next = next+i+16; ae_encrypt(&ctx,nonce,pt,0,pt,i,ct,NULL,AE_FINALIZE); memcpy(next,ct,16); next = next+16; } else { ae_encrypt(&ctx,nonce,pt,first,pt,first,ct,NULL,AE_PENDING); ae_encrypt(&ctx,NULL,pt+first,second,pt+first,second,ct+first,NULL,AE_PENDING); ae_encrypt(&ctx,NULL,pt+first+second,third,pt+first+second,third,ct+first+second,NULL,AE_FINALIZE); memcpy(next,ct,(size_t)i+16); next = next+i+16; ae_encrypt(&ctx,nonce,pt,first,pt,0,ct,NULL,AE_PENDING); ae_encrypt(&ctx,NULL,pt+first,second,pt,0,ct+first,NULL,AE_PENDING); ae_encrypt(&ctx,NULL,pt+first+second,third,pt,0,ct+first+second,NULL,AE_FINALIZE); memcpy(next,ct,(size_t)i+16); next = next+i+16; ae_encrypt(&ctx,nonce,pt,0,pt,first,ct,NULL,AE_PENDING); ae_encrypt(&ctx,NULL,pt,0,pt+first,second,ct,NULL,AE_PENDING); ae_encrypt(&ctx,NULL,pt,0,pt+first+second,third,ct,NULL,AE_FINALIZE); memcpy(next,ct,16); next = next+16; } } nonce[11] = 0; ae_encrypt(&ctx,nonce,NULL,0,val_buf,next-val_buf,ct,tag,AE_FINALIZE); pbuf(tag,16,0); if (memcmp(valid,tag,16) == 0) printf("Vectors: PASS\n"); else printf("Vectors: FAIL\n"); /* Encrypt/Decrypt test */ for (i = 0; i < 128; i++) { int first = ((i/3)/(BPI*16))*(BPI*16); int second = first; int third = i - (first + second); nonce[11] = i%128; if (1) { len = ae_encrypt(&ctx,nonce,val_buf,i,val_buf,i,ct,tag,AE_FINALIZE); len = ae_encrypt(&ctx,nonce,val_buf,i,val_buf,-1,ct,tag,AE_FINALIZE); len = ae_decrypt(&ctx,nonce,ct,len,val_buf,-1,pt,tag,AE_FINALIZE); if (len == -1) { printf("Authentication error: %d\n", i); return; } if (len != i) { printf("Length error: %d\n", i); return; } if (memcmp(val_buf,pt,i)) { printf("Decrypt error: %d\n", i); return; } } else { len = ae_encrypt(&ctx,nonce,val_buf,i,val_buf,i,ct,NULL,AE_FINALIZE); ae_decrypt(&ctx,nonce,ct,first,val_buf,first,pt,NULL,AE_PENDING); ae_decrypt(&ctx,NULL,ct+first,second,val_buf+first,second,pt+first,NULL,AE_PENDING); len = ae_decrypt(&ctx,NULL,ct+first+second,len-(first+second),val_buf+first+second,third,pt+first+second,NULL,AE_FINALIZE); if (len == -1) { printf("Authentication error: %d\n", i); return; } if (memcmp(val_buf,pt,i)) { printf("Decrypt error: %d\n", i); return; } } } printf("Decrypt: PASS\n"); } int main() { validate(); return 0; } #endif #if USE_OPENSSL_AES char infoString[] = "OCB3 (OpenSSL)"; #endif mosh-1.4.0/src/crypto/Makefile.in0000664000175000017500000004652514327736657013621 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 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)) 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 = : @USE_AES_OCB_FROM_OPENSSL_TRUE@am__append_1 = ocb_openssl.cc @USE_AES_OCB_FROM_OPENSSL_FALSE@am__append_2 = ocb_internal.cc subdir = src/crypto ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ $(top_srcdir)/m4/ax_ac_print_to_file.m4 \ $(top_srcdir)/m4/ax_add_am_macro_static.m4 \ $(top_srcdir)/m4/ax_am_macros_static.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_gnu_make.m4 \ $(top_srcdir)/m4/ax_check_library.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_code_coverage.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ $(top_srcdir)/m4/ax_file_escapes.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 $(top_srcdir)/m4/pkg.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 = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) ARFLAGS = cru AM_V_AR = $(am__v_AR_@AM_V@) am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) am__v_AR_0 = @echo " AR " $@; am__v_AR_1 = libmoshcrypto_a_AR = $(AR) $(ARFLAGS) libmoshcrypto_a_LIBADD = am__libmoshcrypto_a_SOURCES_DIST = ae.h ocb_openssl.cc ocb_internal.cc \ base64.cc base64.h byteorder.h crypto.cc crypto.h prng.h @USE_AES_OCB_FROM_OPENSSL_TRUE@am__objects_1 = ocb_openssl.$(OBJEXT) @USE_AES_OCB_FROM_OPENSSL_FALSE@am__objects_2 = \ @USE_AES_OCB_FROM_OPENSSL_FALSE@ ocb_internal.$(OBJEXT) am__objects_3 = $(am__objects_1) $(am__objects_2) am_libmoshcrypto_a_OBJECTS = $(am__objects_3) base64.$(OBJEXT) \ crypto.$(OBJEXT) libmoshcrypto_a_OBJECTS = $(am_libmoshcrypto_a_OBJECTS) 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)/src/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/base64.Po ./$(DEPDIR)/crypto.Po \ ./$(DEPDIR)/ocb_internal.Po ./$(DEPDIR)/ocb_openssl.Po am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) am__v_CXX_0 = @echo " CXX " $@; am__v_CXX_1 = CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) am__v_CXXLD_0 = @echo " CXXLD " $@; am__v_CXXLD_1 = 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 = $(libmoshcrypto_a_SOURCES) DIST_SOURCES = $(am__libmoshcrypto_a_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@ CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@ CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@ CPPFLAGS = @CPPFLAGS@ CRYPTO_CFLAGS = @CRYPTO_CFLAGS@ CRYPTO_LIBS = @CRYPTO_LIBS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CURSES_LIB = @CURSES_LIB@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FUZZING_CFLAGS = @FUZZING_CFLAGS@ GCOV = @GCOV@ GENHTML = @GENHTML@ HARDEN_CFLAGS = @HARDEN_CFLAGS@ HARDEN_LDFLAGS = @HARDEN_LDFLAGS@ HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LCOV = @LCOV@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MISC_CXXFLAGS = @MISC_CXXFLAGS@ MKDIR_P = @MKDIR_P@ Nettle_CFLAGS = @Nettle_CFLAGS@ Nettle_LIBS = @Nettle_LIBS@ OBJEXT = @OBJEXT@ OpenSSL_CFLAGS = @OpenSSL_CFLAGS@ OpenSSL_LIBS = @OpenSSL_LIBS@ 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@ PICKY_CXXFLAGS = @PICKY_CXXFLAGS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROTOC = @PROTOC@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TINFO_CFLAGS = @TINFO_CFLAGS@ TINFO_CPPFLAGS = @TINFO_CPPFLAGS@ TINFO_LDFLAGS = @TINFO_LDFLAGS@ TINFO_LIBS = @TINFO_LIBS@ VERSION = @VERSION@ WARNING_CXXFLAGS = @WARNING_CXXFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ completions = @completions@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ ifGNUmake = @ifGNUmake@ ifnGNUmake = @ifnGNUmake@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ protobuf_CFLAGS = @protobuf_CFLAGS@ protobuf_LIBS = @protobuf_LIBS@ 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@ AM_CPPFLAGS = -I$(srcdir)/../util $(CRYPTO_CFLAGS) AM_CXXFLAGS = $(WARNING_CXXFLAGS) $(PICKY_CXXFLAGS) $(HARDEN_CFLAGS) $(MISC_CXXFLAGS) $(CODE_COVERAGE_CXXFLAGS) noinst_LIBRARIES = libmoshcrypto.a OCB_SRCS = ae.h $(am__append_1) $(am__append_2) libmoshcrypto_a_SOURCES = \ $(OCB_SRCS) \ base64.cc \ base64.h \ byteorder.h \ crypto.cc \ crypto.h \ prng.h all: all-am .SUFFIXES: .SUFFIXES: .cc .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/crypto/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/crypto/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): clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libmoshcrypto.a: $(libmoshcrypto_a_OBJECTS) $(libmoshcrypto_a_DEPENDENCIES) $(EXTRA_libmoshcrypto_a_DEPENDENCIES) $(AM_V_at)-rm -f libmoshcrypto.a $(AM_V_AR)$(libmoshcrypto_a_AR) libmoshcrypto.a $(libmoshcrypto_a_OBJECTS) $(libmoshcrypto_a_LIBADD) $(AM_V_at)$(RANLIB) libmoshcrypto.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base64.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crypto.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ocb_internal.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ocb_openssl.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .cc.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -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 $(LIBRARIES) installdirs: 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: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || 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 clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/base64.Po -rm -f ./$(DEPDIR)/crypto.Po -rm -f ./$(DEPDIR)/ocb_internal.Po -rm -f ./$(DEPDIR)/ocb_openssl.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-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)/base64.Po -rm -f ./$(DEPDIR)/crypto.Po -rm -f ./$(DEPDIR)/ocb_internal.Po -rm -f ./$(DEPDIR)/ocb_openssl.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: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-noinstLIBRARIES 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-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 \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .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: mosh-1.4.0/src/crypto/base64.cc0000644000175000017500000001137713103401307013106 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include #include #include "fatal_assert.h" #include "base64.h" static const char table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; static const unsigned char reverse[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3e, 0xff, 0xff, 0xff, 0x3f, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, }; /* Reverse maps from an ASCII char to a base64 sixbit value. Returns > 0x3f on failure. */ static unsigned char base64_char_to_sixbit(unsigned char c) { return reverse[c]; } bool base64_decode( const char *b64, const size_t b64_len, uint8_t *raw, size_t *raw_len ) { fatal_assert( b64_len == 24 ); /* only useful for Mosh keys */ fatal_assert( *raw_len == 16 ); uint32_t bytes = 0; for (int i = 0; i < 22; i++) { unsigned char sixbit = base64_char_to_sixbit(*(b64++)); if (sixbit > 0x3f) { return false; } bytes <<= 6; bytes |= sixbit; /* write groups of 3 */ if (i % 4 == 3) { raw[0] = bytes >> 16; raw[1] = bytes >> 8; raw[2] = bytes; raw += 3; bytes = 0; } } /* last byte of output */ *raw = bytes >> 4; if (b64[0] != '=' || b64[1] != '=') { return false; } return true; } void base64_encode( const uint8_t *raw, const size_t raw_len, char *b64, const size_t b64_len ) { fatal_assert( b64_len == 24 ); /* only useful for Mosh keys */ fatal_assert( raw_len == 16 ); /* first 15 bytes of input */ for (int i = 0; i < 5; i++) { uint32_t bytes = (raw[0] << 16) | (raw[1] << 8) | raw[2]; b64[0] = table[(bytes >> 18) & 0x3f]; b64[1] = table[(bytes >> 12) & 0x3f]; b64[2] = table[(bytes >> 6) & 0x3f]; b64[3] = table[(bytes) & 0x3f]; raw += 3; b64 += 4; } /* last byte of input, last 4 of output */ uint8_t lastchar = *raw; b64[0] = table[(lastchar >> 2) & 0x3f]; b64[1] = table[(lastchar << 4) & 0x3f]; b64[2] = '='; b64[3] = '='; } mosh-1.4.0/src/crypto/byteorder.h0000644000175000017500000000727313103401307013663 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #ifndef BYTEORDER_HPP #define BYTEORDER_HPP #include "config.h" #if HAVE_DECL_BE64TOH || HAVE_DECL_BETOH64 # if defined(HAVE_ENDIAN_H) # include # elif defined(HAVE_SYS_ENDIAN_H) # include # include # endif #if !HAVE_DECL_BE64TOH && HAVE_DECL_BETOH64 #define be64toh betoh64 #define be16toh betoh16 #endif #elif HAVE_OSX_SWAP # include # define htobe64 OSSwapHostToBigInt64 # define be64toh OSSwapBigToHostInt64 # define htobe16 OSSwapHostToBigInt16 # define be16toh OSSwapBigToHostInt16 #else /* Use our fallback implementation, which is correct for any endianness. */ #include /* Make sure they aren't macros */ #undef htobe64 #undef be64toh #undef htobe16 #undef be16toh /* Use unions rather than casts, to comply with strict aliasing rules. */ inline uint64_t htobe64( uint64_t x ) { uint8_t xs[ 8 ] = { static_cast( ( x >> 56 ) & 0xFF ), static_cast( ( x >> 48 ) & 0xFF ), static_cast( ( x >> 40 ) & 0xFF ), static_cast( ( x >> 32 ) & 0xFF ), static_cast( ( x >> 24 ) & 0xFF ), static_cast( ( x >> 16 ) & 0xFF ), static_cast( ( x >> 8 ) & 0xFF ), static_cast( ( x ) & 0xFF ) }; union { const uint8_t *p8; const uint64_t *p64; } u; u.p8 = xs; return *u.p64; } inline uint64_t be64toh( uint64_t x ) { union { const uint8_t *p8; const uint64_t *p64; } u; u.p64 = &x; return ( uint64_t( u.p8[ 0 ] ) << 56 ) | ( uint64_t( u.p8[ 1 ] ) << 48 ) | ( uint64_t( u.p8[ 2 ] ) << 40 ) | ( uint64_t( u.p8[ 3 ] ) << 32 ) | ( uint64_t( u.p8[ 4 ] ) << 24 ) | ( uint64_t( u.p8[ 5 ] ) << 16 ) | ( uint64_t( u.p8[ 6 ] ) << 8 ) | ( uint64_t( u.p8[ 7 ] ) ); } inline uint16_t htobe16( uint16_t x ) { uint8_t xs[ 2 ] = { static_cast( ( x >> 8 ) & 0xFF ), static_cast( ( x ) & 0xFF ) }; union { const uint8_t *p8; const uint16_t *p16; } u; u.p8 = xs; return *u.p16; } inline uint16_t be16toh( uint16_t x ) { union { const uint8_t *p8; const uint16_t *p16; } u; u.p16 = &x; return ( uint16_t( u.p8[ 0 ] ) << 8 ) | ( uint16_t( u.p8[ 1 ] ) ); } #endif #endif mosh-1.4.0/src/crypto/ae.h0000644000175000017500000001701613103401307012245 00000000000000/* --------------------------------------------------------------------------- * * AEAD API 0.12 - 13 July 2011 * * This file gives an interface appropriate for many authenticated * encryption with associated data (AEAD) implementations. It does not try * to accommodate all possible options or limitations that an implementation * might have -- you should consult the documentation of your chosen * implementation to find things like RFC 5116 constants, alignment * requirements, whether the incremental interface is supported, etc. * * This file is in the public domain. It is provided "as is", without * warranty of any kind. Use at your own risk. * * Comments are welcome: Ted Krovetz . * * ------------------------------------------------------------------------ */ #ifndef _AE_H_ #define _AE_H_ #ifdef __cplusplus extern "C" { #endif /* -------------------------------------------------------------------------- * * Constants * * ----------------------------------------------------------------------- */ /* Return status codes: Negative return values indicate an error occurred. * For full explanations of error values, consult the implementation's * documentation. */ #define AE_SUCCESS ( 0) /* Indicates successful completion of call */ #define AE_INVALID (-1) /* Indicates bad tag during decryption */ #define AE_NOT_SUPPORTED (-2) /* Indicates unsupported option requested */ /* Flags: When data can be processed "incrementally", these flags are used * to indicate whether the submitted data is the last or not. */ #define AE_FINALIZE (1) /* This is the last of data */ #define AE_PENDING (0) /* More data of is coming */ /* -------------------------------------------------------------------------- * * AEAD opaque structure definition * * ----------------------------------------------------------------------- */ typedef struct _ae_ctx ae_ctx; /* -------------------------------------------------------------------------- * * Data Structure Routines * * ----------------------------------------------------------------------- */ ae_ctx* ae_allocate (void *misc); /* Allocate ae_ctx, set optional ptr */ void ae_free (ae_ctx *ctx); /* Deallocate ae_ctx struct */ int ae_clear (ae_ctx *ctx); /* Undo initialization */ int ae_ctx_sizeof(void); /* Return sizeof(ae_ctx) */ /* ae_allocate() allocates an ae_ctx structure, but does not initialize it. * ae_free() deallocates an ae_ctx structure, but does not zeroize it. * ae_clear() zeroes sensitive values associated with an ae_ctx structure * and deallocates any auxiliary structures allocated during ae_init(). * ae_ctx_sizeof() returns sizeof(ae_ctx), to aid in any static allocations. */ /* -------------------------------------------------------------------------- * * AEAD Routines * * ----------------------------------------------------------------------- */ int ae_init(ae_ctx *ctx, const void *key, int key_len, int nonce_len, int tag_len); /* -------------------------------------------------------------------------- * * Initialize an ae_ctx context structure. * * Parameters: * ctx - Pointer to an ae_ctx structure to be initialized * key - Pointer to user-supplied key * key_len - Length of key supplied, in bytes * nonce_len - Length of nonces to be used for this key, in bytes * tag_len - Length of tags to be produced for this key, in bytes * * Returns: * AE_SUCCESS - Success. Ctx ready for use. * AE_NOT_SUPPORTED - An unsupported length was supplied. Ctx is untouched. * Otherwise - Error. Check implementation documentation for codes. * * ----------------------------------------------------------------------- */ int ae_encrypt(ae_ctx *ctx, const void *nonce, const void *pt, int pt_len, const void *ad, int ad_len, void *ct, void *tag, int final); /* -------------------------------------------------------------------------- * * Encrypt plaintext; provide for authentication of ciphertext/associated data. * * Parameters: * ctx - Pointer to an ae_ctx structure initialized by ae_init. * nonce - Pointer to a nonce_len (defined in ae_init) byte nonce. * pt - Pointer to plaintext bytes to be encrypted. * pt_len - number of bytes pointed to by pt. * ad - Pointer to associated data. * ad_len - number of bytes pointed to by ad. * ct - Pointer to buffer to receive ciphertext encryption. * tag - Pointer to receive authentication tag; or NULL * if tag is to be bundled into the ciphertext. * final - Non-zero if this call completes the plaintext being encrypted. * * If nonce!=NULL then a message is being initiated. If final!=0 * then a message is being finalized. If final==0 or nonce==NULL * then the incremental interface is being used. If nonce!=NULL and * ad_len<0, then use same ad as last message. * * Returns: * non-negative - Number of bytes written to ct. * AE_NOT_SUPPORTED - Usage mode unsupported (eg, incremental and/or sticky). * Otherwise - Error. Check implementation documentation for codes. * * ----------------------------------------------------------------------- */ int ae_decrypt(ae_ctx *ctx, const void *nonce, const void *ct, int ct_len, const void *ad, int ad_len, void *pt, const void *tag, int final); /* -------------------------------------------------------------------------- * * Decrypt ciphertext; provide authenticity of plaintext and associated data. * * Parameters: * ctx - Pointer to an ae_ctx structure initialized by ae_init. * nonce - Pointer to a nonce_len (defined in ae_init) byte nonce. * ct - Pointer to ciphertext bytes to be decrypted. * ct_len - number of bytes pointed to by ct. * ad - Pointer to associated data. * ad_len - number of bytes pointed to by ad. * pt - Pointer to buffer to receive plaintext decryption. * tag - Pointer to tag_len (defined in ae_init) bytes; or NULL * if tag is bundled into the ciphertext. Non-NULL tag is only * read when final is non-zero. * final - Non-zero if this call completes the ciphertext being decrypted. * * If nonce!=NULL then "ct" points to the start of a ciphertext. If final!=0 * then "in" points to the final piece of ciphertext. If final==0 or nonce== * NULL then the incremental interface is being used. If nonce!=NULL and * ad_len<0, then use same ad as last message. * * Returns: * non-negative - Number of bytes written to pt. * AE_INVALID - Authentication failure. * AE_NOT_SUPPORTED - Usage mode unsupported (eg, incremental and/or sticky). * Otherwise - Error. Check implementation documentation for codes. * * NOTE !!! NOTE !!! -- The ciphertext should be assumed possibly inauthentic * until it has been completely written and it is * verified that this routine did not return AE_INVALID. * * ----------------------------------------------------------------------- */ #ifdef __cplusplus } /* closing brace for extern "C" */ #endif #endif /* _AE_H_ */ mosh-1.4.0/src/crypto/base64.h0000644000175000017500000000323513103401307012742 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include bool base64_decode( const char *b64, const size_t b64_len, uint8_t *raw, size_t *raw_len ); void base64_encode( const uint8_t *raw, const size_t raw_len, char *b64, const size_t b64_len ); mosh-1.4.0/src/crypto/crypto.h0000664000175000017500000001077714174450057013230 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #ifndef CRYPTO_HPP #define CRYPTO_HPP #include "ae.h" #include #include #include #include #include long int myatoi( const char *str ); class PRNG; namespace Crypto { using std::string; class CryptoException : public std::exception { public: string text; bool fatal; CryptoException( string s_text, bool s_fatal = false ) : text( s_text ), fatal( s_fatal ) {}; const char *what() const throw () { return text.c_str(); } ~CryptoException() throw () {} }; /* * OCB (and other algorithms) require a source of nonce/sequence * numbers that never repeats its output. Enforce that with this * function. */ uint64_t unique( void ); /* 16-byte-aligned buffer, with length. */ class AlignedBuffer { private: size_t m_len; void *m_allocated; char *m_data; public: AlignedBuffer( size_t len, const char *data = NULL ); ~AlignedBuffer() { free( m_allocated ); } char * data( void ) const { return m_data; } size_t len( void ) const { return m_len; } private: /* Not implemented */ AlignedBuffer( const AlignedBuffer & ); AlignedBuffer & operator=( const AlignedBuffer & ); }; class Base64Key { private: unsigned char key[ 16 ]; public: Base64Key(); /* random key */ Base64Key(PRNG &prng); Base64Key( string printable_key ); string printable_key( void ) const; unsigned char *data( void ) { return key; } }; class Nonce { public: static const int NONCE_LEN = 12; private: char bytes[ NONCE_LEN ]; public: Nonce( uint64_t val ); Nonce( const char *s_bytes, size_t len ); string cc_str( void ) const { return string( bytes + 4, 8 ); } const char *data( void ) const { return bytes; } uint64_t val( void ) const; }; class Message { public: const Nonce nonce; const string text; Message( const char *nonce_bytes, size_t nonce_len, const char *text_bytes, size_t text_len ) : nonce( nonce_bytes, nonce_len ), text( text_bytes, text_len ) {} Message( const Nonce & s_nonce, const string & s_text ) : nonce( s_nonce ), text( s_text ) {} }; class Session { private: Base64Key key; AlignedBuffer ctx_buf; ae_ctx *ctx; uint64_t blocks_encrypted; AlignedBuffer plaintext_buffer; AlignedBuffer ciphertext_buffer; AlignedBuffer nonce_buffer; public: static const int RECEIVE_MTU = 2048; /* Overhead (not counting the nonce, which is handled by network transport) */ static const int ADDED_BYTES = 16 /* final OCB block */; Session( Base64Key s_key ); ~Session(); const string encrypt( const Message & plaintext ); const Message decrypt( const char *str, size_t len ); const Message decrypt( const string & ciphertext ) { return decrypt( ciphertext.data(), ciphertext.size() ); } Session( const Session & ); Session & operator=( const Session & ); }; void disable_dumping_core( void ); void reenable_dumping_core( void ); } #endif mosh-1.4.0/src/crypto/crypto.cc0000664000175000017500000002160314174450057013354 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include #include #include #include #include #include #include #include "byteorder.h" #include "crypto.h" #include "base64.h" #include "fatal_assert.h" #include "prng.h" using namespace Crypto; long int myatoi( const char *str ) { char *end; errno = 0; long int ret = strtol( str, &end, 10 ); if ( ( errno != 0 ) || ( end != str + strlen( str ) ) ) { throw CryptoException( "Bad integer." ); } return ret; } uint64_t Crypto::unique( void ) { static uint64_t counter = 0; uint64_t rv = counter++; if ( counter == 0 ) { throw CryptoException( "Counter wrapped", true ); } return rv; } AlignedBuffer::AlignedBuffer( size_t len, const char *data ) : m_len( len ), m_allocated( NULL ), m_data( NULL ) { size_t alloc_len = len ? len : 1; #if defined(HAVE_POSIX_MEMALIGN) if ( ( 0 != posix_memalign( &m_allocated, 16, alloc_len ) ) || ( m_allocated == NULL ) ) { throw std::bad_alloc(); } m_data = (char *) m_allocated; #else /* malloc() a region 15 bytes larger than we need, and find the aligned offset within. */ m_allocated = malloc( 15 + alloc_len ); if ( m_allocated == NULL ) { throw std::bad_alloc(); } uintptr_t iptr = (uintptr_t) m_allocated; if ( iptr & 0xF ) { iptr += 16 - ( iptr & 0xF ); } assert( !( iptr & 0xF ) ); assert( iptr >= (uintptr_t) m_allocated ); assert( iptr <= ( 15 + (uintptr_t) m_allocated ) ); m_data = (char *) iptr; #endif /* !defined(HAVE_POSIX_MEMALIGN) */ if ( data ) { memcpy( m_data, data, len ); } } Base64Key::Base64Key( string printable_key ) { if ( printable_key.length() != 22 ) { throw CryptoException( "Key must be 22 letters long." ); } string base64 = printable_key + "=="; size_t len = 16; if ( !base64_decode( base64.data(), 24, key, &len ) ) { throw CryptoException( "Key must be well-formed base64." ); } if ( len != 16 ) { throw CryptoException( "Key must represent 16 octets." ); } /* to catch changes after the first 128 bits */ if ( printable_key != this->printable_key() ) { throw CryptoException( "Base64 key was not encoded 128-bit key." ); } } Base64Key::Base64Key() { PRNG().fill( key, sizeof( key ) ); } Base64Key::Base64Key(PRNG &prng) { prng.fill( key, sizeof( key ) ); } string Base64Key::printable_key( void ) const { char base64[ 24 ]; base64_encode( key, 16, base64, 24 ); if ( (base64[ 23 ] != '=') || (base64[ 22 ] != '=') ) { throw CryptoException( string( "Unexpected output from base64_encode: " ) + string( base64, 24 ) ); } base64[ 22 ] = 0; return string( base64 ); } Session::Session( Base64Key s_key ) : key( s_key ), ctx_buf( ae_ctx_sizeof() ), ctx( (ae_ctx *)ctx_buf.data() ), blocks_encrypted( 0 ), plaintext_buffer( RECEIVE_MTU ), ciphertext_buffer( RECEIVE_MTU ), nonce_buffer( Nonce::NONCE_LEN ) { if ( AE_SUCCESS != ae_init( ctx, key.data(), 16, 12, 16 ) ) { throw CryptoException( "Could not initialize AES-OCB context." ); } } Session::~Session() { fatal_assert( ae_clear( ctx ) == AE_SUCCESS ); } Nonce::Nonce( uint64_t val ) { uint64_t val_net = htobe64( val ); memset( bytes, 0, 4 ); memcpy( bytes + 4, &val_net, 8 ); } uint64_t Nonce::val( void ) const { uint64_t ret; memcpy( &ret, bytes + 4, 8 ); return be64toh( ret ); } Nonce::Nonce( const char *s_bytes, size_t len ) { if ( len != 8 ) { throw CryptoException( "Nonce representation must be 8 octets long." ); } memset( bytes, 0, 4 ); memcpy( bytes + 4, s_bytes, 8 ); } const string Session::encrypt( const Message & plaintext ) { const size_t pt_len = plaintext.text.size(); const int ciphertext_len = pt_len + 16; assert( (size_t)ciphertext_len <= ciphertext_buffer.len() ); assert( pt_len <= plaintext_buffer.len() ); memcpy( plaintext_buffer.data(), plaintext.text.data(), pt_len ); memcpy( nonce_buffer.data(), plaintext.nonce.data(), Nonce::NONCE_LEN ); if ( ciphertext_len != ae_encrypt( ctx, /* ctx */ nonce_buffer.data(), /* nonce */ plaintext_buffer.data(), /* pt */ pt_len, /* pt_len */ NULL, /* ad */ 0, /* ad_len */ ciphertext_buffer.data(), /* ct */ NULL, /* tag */ AE_FINALIZE ) ) { /* final */ throw CryptoException( "ae_encrypt() returned error." ); } blocks_encrypted += pt_len >> 4; if ( pt_len & 0xF ) { /* partial block */ blocks_encrypted++; } /* "Both the privacy and the authenticity properties of OCB degrade as per s^2 / 2^128, where s is the total number of blocks that the adversary acquires.... In order to ensure that s^2 / 2^128 remains small, a given key should be used to encrypt at most 2^48 blocks (2^55 bits or 4 petabytes)" -- http://tools.ietf.org/html/draft-krovetz-ocb-03 We deem it unlikely that a legitimate user will send 4 PB through a Mosh session. If it happens, we simply kill the session. The server and client use the same key, so we actually need to die after 2^47 blocks. */ if ( blocks_encrypted >> 47 ) { throw CryptoException( "Encrypted 2^47 blocks.", true ); } string text( ciphertext_buffer.data(), ciphertext_len ); return plaintext.nonce.cc_str() + text; } const Message Session::decrypt( const char *str, size_t len ) { if ( len < 24 ) { throw CryptoException( "Ciphertext must contain nonce and tag." ); } int body_len = len - 8; int pt_len = body_len - 16; if ( pt_len < 0 ) { /* super-assertion that pt_len does not equal AE_INVALID */ fprintf( stderr, "BUG.\n" ); exit( 1 ); } assert( (size_t)body_len <= ciphertext_buffer.len() ); assert( (size_t)pt_len <= plaintext_buffer.len() ); Nonce nonce( str, 8 ); memcpy( ciphertext_buffer.data(), str + 8, body_len ); memcpy( nonce_buffer.data(), nonce.data(), Nonce::NONCE_LEN ); if ( pt_len != ae_decrypt( ctx, /* ctx */ nonce_buffer.data(), /* nonce */ ciphertext_buffer.data(), /* ct */ body_len, /* ct_len */ NULL, /* ad */ 0, /* ad_len */ plaintext_buffer.data(), /* pt */ NULL, /* tag */ AE_FINALIZE ) ) { /* final */ throw CryptoException( "Packet failed integrity check." ); } const Message ret( nonce, string( plaintext_buffer.data(), pt_len ) ); return ret; } static rlim_t saved_core_rlimit; /* Disable dumping core, as a precaution to avoid saving sensitive data to disk. */ void Crypto::disable_dumping_core( void ) { struct rlimit limit; if ( 0 != getrlimit( RLIMIT_CORE, &limit ) ) { /* We don't throw CryptoException because this is called very early in main(), outside of 'try'. */ perror( "getrlimit(RLIMIT_CORE)" ); exit( 1 ); } saved_core_rlimit = limit.rlim_cur; limit.rlim_cur = 0; if ( 0 != setrlimit( RLIMIT_CORE, &limit ) ) { perror( "setrlimit(RLIMIT_CORE)" ); exit( 1 ); } } void Crypto::reenable_dumping_core( void ) { /* Silent failure is safe. */ struct rlimit limit; if ( 0 == getrlimit( RLIMIT_CORE, &limit ) ) { limit.rlim_cur = saved_core_rlimit; setrlimit( RLIMIT_CORE, &limit ); } } mosh-1.4.0/src/crypto/ocb_openssl.cc0000664000175000017500000001410414272621034014332 00000000000000#include "config.h" #include "ae.h" #include #include #include struct _ae_ctx { EVP_CIPHER_CTX *enc_ctx; EVP_CIPHER_CTX *dec_ctx; int tag_len; }; int ae_clear(ae_ctx* ctx) { EVP_CIPHER_CTX_free(ctx->enc_ctx); EVP_CIPHER_CTX_free(ctx->dec_ctx); OPENSSL_cleanse(ctx, sizeof(*ctx)); return AE_SUCCESS; } int ae_ctx_sizeof() { return sizeof(_ae_ctx); } // If direction is 1, initializes encryption. If 0, initializes // decryption. See the documentation of EVP_CipherInit_ex static int ae_evp_cipher_init(EVP_CIPHER_CTX **in_ctx, int direction, const unsigned char *key, int nonce_len, int tag_len) { // Create an OpenSSL EVP context. It does not yet have any specific // cipher associated with it. if (!(*in_ctx = EVP_CIPHER_CTX_new())) { return -3; } EVP_CIPHER_CTX *ctx = *in_ctx; // Although OCB-AES has the same initialization process between // encryption and decryption, an EVP_CIPHER_CTX must be initialized // for a specific direction. if (EVP_CipherInit_ex(ctx, EVP_aes_128_ocb(), /*impl=*/NULL, /*key=*/key, /*iv=*/NULL, direction) != 1) { return -3; } // Attempt to set the nonce length. If it fails, the length must not // be supported. However, that should have been handled by the // pre-condition check above. if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_IVLEN, nonce_len, NULL) != 1) { return -3; } // A NULL tag length means that EVP_CTRL_AEAD_SET_TAG is only being // used to set the length if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, tag_len, NULL) != 1) { return -3; } return AE_SUCCESS; } int ae_init(ae_ctx *ctx, const void *key, int key_len, int nonce_len, int tag_len) { // Pre-condition: Only nonces of length 12 are supported. The // documentation of `ae_init` in ae.h specifies that `ctx` is // untouched if an invalid configuration is requested. Delegating // this to OpenSSL would happen too late; `ctx` has already been // modified. if (nonce_len != 12) { return AE_NOT_SUPPORTED; } // Pre-condition: Only AES-128 is supported. if (key_len != 16) { return AE_NOT_SUPPORTED; } int r = AE_SUCCESS; if ((r = ae_evp_cipher_init(&ctx->enc_ctx, 1, reinterpret_cast(key), nonce_len, tag_len))!= AE_SUCCESS) { return r; } if ((r = ae_evp_cipher_init(&ctx->dec_ctx, 0, reinterpret_cast(key), nonce_len, tag_len)) != AE_SUCCESS) { return r; } ctx->tag_len = tag_len; return AE_SUCCESS; } int ae_encrypt(ae_ctx *ctx, const void *nonce_ptr, const void *pt_ptr, int pt_len, const void *ad_ptr, int ad_len, void *ct_ptr, void *tag, int final) { const unsigned char *nonce = reinterpret_cast(nonce_ptr); const unsigned char *pt = reinterpret_cast(pt_ptr); const unsigned char* ad = reinterpret_cast(ad_ptr); unsigned char* ct = reinterpret_cast(ct_ptr); // Streaming mode is not supported; nonce must always be provided. if (final != AE_FINALIZE) { return AE_NOT_SUPPORTED; } if (nonce == NULL) { return AE_NOT_SUPPORTED; } if (EVP_EncryptInit_ex(ctx->enc_ctx, /*type=*/NULL, /*impl=*/NULL, /*key=*/NULL, nonce) != 1) { return -3; } int len = 0; if (ad != NULL && ad_len > 0 && EVP_EncryptUpdate(ctx->enc_ctx, /*out=*/NULL, &len, ad, ad_len) != 1) { return -3; } len = 0; if (pt != NULL && pt_len > 0 && EVP_EncryptUpdate(ctx->enc_ctx, ct, &len, pt, pt_len) != 1) { return -3; } int ciphertext_len = len; if (EVP_EncryptFinal_ex(ctx->enc_ctx, ct + ciphertext_len, &len) != 1) { return -3; } ciphertext_len += len; // If `tag` is provided, the authentication tag goes // there. Otherwise, it is appended after the ciphertext. void *tag_location = tag != NULL ? tag : ct + ciphertext_len; if (EVP_CIPHER_CTX_ctrl(ctx->enc_ctx, EVP_CTRL_AEAD_GET_TAG, ctx->tag_len, tag_location) != 1) { return -3; } if (tag == NULL) { ciphertext_len += ctx->tag_len; } return ciphertext_len; } int ae_decrypt(ae_ctx *ctx, const void *nonce_ptr, const void *ct_ptr, int ct_len, const void *ad_ptr, int ad_len, void *pt_ptr, const void *tag, int final) { const unsigned char *nonce = reinterpret_cast(nonce_ptr); const unsigned char *ct = reinterpret_cast(ct_ptr); const unsigned char* ad = reinterpret_cast(ad_ptr); unsigned char* pt = reinterpret_cast(pt_ptr); if (ct_len < ctx->tag_len) { return AE_INVALID; } // If an external tag is not provided, then the tag is assumed to be // the final bytes of the cipher text. Subtract it off now so the // plaintext does not accidentally try to decrypt the AEAD tag (and // then cause an authentication failure). if (tag == NULL) { ct_len -= ctx->tag_len; } // Like encryption, nonce must always be provided and streaming is not supported. if (final != AE_FINALIZE) { return AE_NOT_SUPPORTED; } if (nonce == NULL) { return AE_NOT_SUPPORTED; } if (EVP_DecryptInit_ex(ctx->dec_ctx, /*type=*/NULL, /*impl=*/NULL, /*key=*/NULL, nonce) != 1) { return -3; } int len = 0; if (ad != NULL && ad_len > 0 && EVP_DecryptUpdate(ctx->dec_ctx, /*out=*/NULL, &len, ad, ad_len) != 1) { return -3; } len = 0; if (ct != NULL && ct_len > 0 && EVP_DecryptUpdate(ctx->dec_ctx, pt, &len, ct, ct_len) != 1) { return -3; } int plaintext_len = len; // If `tag` is provided, the authentication is read from // there. Otherwise, it's the last bytes of the ciphertext. (This is // a convention, not a requirement of OCB mode). const void *tag_location = tag != NULL ? tag : ct + ct_len; if (EVP_CIPHER_CTX_ctrl(ctx->dec_ctx, EVP_CTRL_AEAD_SET_TAG, ctx->tag_len, (void *)tag_location) != 1) { return -3; } if (EVP_DecryptFinal_ex(ctx->dec_ctx, pt + plaintext_len, &len) != 1) { return AE_INVALID; } plaintext_len += len; return plaintext_len; } mosh-1.4.0/src/crypto/Makefile.am0000664000175000017500000000065314272621034013555 00000000000000AM_CPPFLAGS = -I$(srcdir)/../util $(CRYPTO_CFLAGS) AM_CXXFLAGS = $(WARNING_CXXFLAGS) $(PICKY_CXXFLAGS) $(HARDEN_CFLAGS) $(MISC_CXXFLAGS) $(CODE_COVERAGE_CXXFLAGS) noinst_LIBRARIES = libmoshcrypto.a OCB_SRCS = ae.h if USE_AES_OCB_FROM_OPENSSL OCB_SRCS += ocb_openssl.cc else OCB_SRCS += ocb_internal.cc endif libmoshcrypto_a_SOURCES = \ $(OCB_SRCS) \ base64.cc \ base64.h \ byteorder.h \ crypto.cc \ crypto.h \ prng.h mosh-1.4.0/src/crypto/prng.h0000644000175000017500000000464413103401307012631 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #ifndef PRNG_HPP #define PRNG_HPP #include #include #include #include "crypto.h" /* Read random bytes from /dev/urandom. We rely on stdio buffering for efficiency. */ static const char rdev[] = "/dev/urandom"; using namespace Crypto; class PRNG { private: std::ifstream randfile; /* unimplemented to satisfy -Weffc++ */ PRNG( const PRNG & ); PRNG & operator=( const PRNG & ); public: PRNG() : randfile( rdev, std::ifstream::in | std::ifstream::binary ) {} void fill( void *dest, size_t size ) { if ( 0 == size ) { return; } randfile.read( static_cast( dest ), size ); if ( !randfile ) { throw CryptoException( "Could not read from " + std::string( rdev ) ); } } uint8_t uint8() { uint8_t x; fill( &x, 1 ); return x; } uint32_t uint32() { uint32_t x; fill( &x, 4 ); return x; } uint64_t uint64() { uint64_t x; fill( &x, 8 ); return x; } }; #endif mosh-1.4.0/src/frontend/0000775000175000017500000000000014327736673012115 500000000000000mosh-1.4.0/src/frontend/Makefile.in0000664000175000017500000005514614327736657014117 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 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)) 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 = : bin_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) @BUILD_CLIENT_TRUE@am__append_1 = mosh-client @BUILD_SERVER_TRUE@am__append_2 = mosh-server subdir = src/frontend ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ $(top_srcdir)/m4/ax_ac_print_to_file.m4 \ $(top_srcdir)/m4/ax_add_am_macro_static.m4 \ $(top_srcdir)/m4/ax_am_macros_static.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_gnu_make.m4 \ $(top_srcdir)/m4/ax_check_library.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_code_coverage.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ $(top_srcdir)/m4/ax_file_escapes.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 $(top_srcdir)/m4/pkg.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 = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @BUILD_CLIENT_TRUE@am__EXEEXT_1 = mosh-client$(EXEEXT) @BUILD_SERVER_TRUE@am__EXEEXT_2 = mosh-server$(EXEEXT) am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am_mosh_client_OBJECTS = mosh-client.$(OBJEXT) stmclient.$(OBJEXT) \ terminaloverlay.$(OBJEXT) mosh_client_OBJECTS = $(am_mosh_client_OBJECTS) mosh_client_LDADD = $(LDADD) am__DEPENDENCIES_1 = mosh_client_DEPENDENCIES = ../crypto/libmoshcrypto.a \ ../network/libmoshnetwork.a ../statesync/libmoshstatesync.a \ ../terminal/libmoshterminal.a ../util/libmoshutil.a \ ../protobufs/libmoshprotos.a $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am_mosh_server_OBJECTS = mosh-server.$(OBJEXT) mosh_server_OBJECTS = $(am_mosh_server_OBJECTS) am__DEPENDENCIES_2 = ../crypto/libmoshcrypto.a \ ../network/libmoshnetwork.a ../statesync/libmoshstatesync.a \ ../terminal/libmoshterminal.a ../util/libmoshutil.a \ ../protobufs/libmoshprotos.a $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) mosh_server_DEPENDENCIES = $(am__DEPENDENCIES_2) 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)/src/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/mosh-client.Po \ ./$(DEPDIR)/mosh-server.Po ./$(DEPDIR)/stmclient.Po \ ./$(DEPDIR)/terminaloverlay.Po am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) am__v_CXX_0 = @echo " CXX " $@; am__v_CXX_1 = CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) am__v_CXXLD_0 = @echo " CXXLD " $@; am__v_CXXLD_1 = 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 = $(mosh_client_SOURCES) $(mosh_server_SOURCES) DIST_SOURCES = $(mosh_client_SOURCES) $(mosh_server_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@ CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@ CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@ CPPFLAGS = @CPPFLAGS@ CRYPTO_CFLAGS = @CRYPTO_CFLAGS@ CRYPTO_LIBS = @CRYPTO_LIBS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CURSES_LIB = @CURSES_LIB@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FUZZING_CFLAGS = @FUZZING_CFLAGS@ GCOV = @GCOV@ GENHTML = @GENHTML@ HARDEN_CFLAGS = @HARDEN_CFLAGS@ HARDEN_LDFLAGS = @HARDEN_LDFLAGS@ HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LCOV = @LCOV@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MISC_CXXFLAGS = @MISC_CXXFLAGS@ MKDIR_P = @MKDIR_P@ Nettle_CFLAGS = @Nettle_CFLAGS@ Nettle_LIBS = @Nettle_LIBS@ OBJEXT = @OBJEXT@ OpenSSL_CFLAGS = @OpenSSL_CFLAGS@ OpenSSL_LIBS = @OpenSSL_LIBS@ 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@ PICKY_CXXFLAGS = @PICKY_CXXFLAGS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROTOC = @PROTOC@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TINFO_CFLAGS = @TINFO_CFLAGS@ TINFO_CPPFLAGS = @TINFO_CPPFLAGS@ TINFO_LDFLAGS = @TINFO_LDFLAGS@ TINFO_LIBS = @TINFO_LIBS@ VERSION = @VERSION@ WARNING_CXXFLAGS = @WARNING_CXXFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ completions = @completions@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ ifGNUmake = @ifGNUmake@ ifnGNUmake = @ifnGNUmake@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ protobuf_CFLAGS = @protobuf_CFLAGS@ protobuf_LIBS = @protobuf_LIBS@ 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@ AM_CPPFLAGS = -I$(srcdir)/../statesync -I$(srcdir)/../terminal -I$(srcdir)/../network -I$(srcdir)/../crypto -I../protobufs -I$(srcdir)/../util $(TINFO_CFLAGS) $(protobuf_CFLAGS) $(CRYPTO_CFLAGS) AM_CXXFLAGS = $(WARNING_CXXFLAGS) $(PICKY_CXXFLAGS) $(HARDEN_CFLAGS) $(MISC_CXXFLAGS) $(CODE_COVERAGE_CXXFLAGS) AM_LDFLAGS = $(HARDEN_LDFLAGS) $(CODE_COVERAGE_LIBS) LDADD = ../crypto/libmoshcrypto.a ../network/libmoshnetwork.a ../statesync/libmoshstatesync.a ../terminal/libmoshterminal.a ../util/libmoshutil.a ../protobufs/libmoshprotos.a -lm $(TINFO_LIBS) $(protobuf_LIBS) $(CRYPTO_LIBS) mosh_server_LDADD = $(LDADD) mosh_client_SOURCES = mosh-client.cc stmclient.cc stmclient.h terminaloverlay.cc terminaloverlay.h mosh_server_SOURCES = mosh-server.cc all: all-am .SUFFIXES: .SUFFIXES: .cc .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/frontend/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/frontend/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)" && rm -f $$files clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) installcheck-binPROGRAMS: $(bin_PROGRAMS) bad=0; pid=$$$$; list="$(bin_PROGRAMS)"; for p in $$list; do \ case ' $(AM_INSTALLCHECK_STD_OPTIONS_EXEMPT) ' in \ *" $$p "* | *" $(srcdir)/$$p "*) continue;; \ esac; \ f=`echo "$$p" | \ sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ for opt in --help --version; do \ if "$(DESTDIR)$(bindir)/$$f" $$opt >c$${pid}_.out \ 2>c$${pid}_.err &2; bad=1; fi; \ done; \ done; rm -f c$${pid}_.???; exit $$bad mosh-client$(EXEEXT): $(mosh_client_OBJECTS) $(mosh_client_DEPENDENCIES) $(EXTRA_mosh_client_DEPENDENCIES) @rm -f mosh-client$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(mosh_client_OBJECTS) $(mosh_client_LDADD) $(LIBS) mosh-server$(EXEEXT): $(mosh_server_OBJECTS) $(mosh_server_DEPENDENCIES) $(EXTRA_mosh_server_DEPENDENCIES) @rm -f mosh-server$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(mosh_server_OBJECTS) $(mosh_server_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mosh-client.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mosh-server.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stmclient.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/terminaloverlay.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .cc.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -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) 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: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || 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 mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/mosh-client.Po -rm -f ./$(DEPDIR)/mosh-server.Po -rm -f ./$(DEPDIR)/stmclient.Po -rm -f ./$(DEPDIR)/terminaloverlay.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-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: installcheck-binPROGRAMS maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/mosh-client.Po -rm -f ./$(DEPDIR)/mosh-server.Po -rm -f ./$(DEPDIR)/stmclient.Po -rm -f ./$(DEPDIR)/terminaloverlay.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 .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-binPROGRAMS clean-generic 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-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 \ installcheck-binPROGRAMS 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 .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: mosh-1.4.0/src/frontend/terminaloverlay.h0000664000175000017500000002536214174450057015420 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #ifndef TERMINAL_OVERLAY_HPP #define TERMINAL_OVERLAY_HPP #include "terminalframebuffer.h" #include "network.h" #include "transportsender.h" #include "parser.h" #include #include namespace Overlay { using namespace Terminal; using namespace Network; using std::deque; using std::list; using std::vector; using std::wstring; enum Validity { Pending, Correct, CorrectNoCredit, IncorrectOrExpired, Inactive }; class ConditionalOverlay { public: uint64_t expiration_frame; int col; bool active; /* represents a prediction at all */ uint64_t tentative_until_epoch; /* when to show */ uint64_t prediction_time; /* used to find long-pending predictions */ ConditionalOverlay( uint64_t s_exp, int s_col, uint64_t s_tentative ) : expiration_frame( s_exp ), col( s_col ), active( false ), tentative_until_epoch( s_tentative ), prediction_time( uint64_t( -1 ) ) {} virtual ~ConditionalOverlay() {} bool tentative( uint64_t confirmed_epoch ) const { return tentative_until_epoch > confirmed_epoch; } void reset( void ) { expiration_frame = tentative_until_epoch = -1; active = false; } void expire( uint64_t s_exp, uint64_t now ) { expiration_frame = s_exp; prediction_time = now; } }; class ConditionalCursorMove : public ConditionalOverlay { public: int row; void apply( Framebuffer &fb, uint64_t confirmed_epoch ) const; Validity get_validity( const Framebuffer &fb, uint64_t early_ack, uint64_t late_ack ) const; ConditionalCursorMove( uint64_t s_exp, int s_row, int s_col, uint64_t s_tentative ) : ConditionalOverlay( s_exp, s_col, s_tentative ), row( s_row ) {} }; class ConditionalOverlayCell : public ConditionalOverlay { public: Cell replacement; bool unknown; vector original_contents; /* we don't give credit for correct predictions that match the original contents */ void apply( Framebuffer &fb, uint64_t confirmed_epoch, int row, bool flag ) const; Validity get_validity( const Framebuffer &fb, int row, uint64_t early_ack, uint64_t late_ack ) const; ConditionalOverlayCell( uint64_t s_exp, int s_col, uint64_t s_tentative ) : ConditionalOverlay( s_exp, s_col, s_tentative ), replacement( 0 ), unknown( false ), original_contents() {} void reset( void ) { unknown = false; original_contents.clear(); ConditionalOverlay::reset(); } void reset_with_orig( void ) { if ( (!active) || unknown ) { reset(); return; } original_contents.push_back( replacement ); ConditionalOverlay::reset(); } }; class ConditionalOverlayRow { public: int row_num; typedef vector overlay_cells_type; overlay_cells_type overlay_cells; void apply( Framebuffer &fb, uint64_t confirmed_epoch, bool flag ) const; ConditionalOverlayRow( int s_row_num ) : row_num( s_row_num ), overlay_cells() {} }; /* the various overlays */ class NotificationEngine { private: uint64_t last_word_from_server; uint64_t last_acked_state; string escape_key_string; wstring message; bool message_is_network_error; uint64_t message_expiration; bool show_quit_keystroke; bool server_late( uint64_t ts ) const { return (ts - last_word_from_server) > 6500; } bool reply_late( uint64_t ts ) const { return (ts - last_acked_state) > 10000; } bool need_countup( uint64_t ts ) const { return server_late( ts ) || reply_late( ts ); } public: void adjust_message( void ); void apply( Framebuffer &fb ) const; const wstring &get_notification_string( void ) const { return message; } void server_heard( uint64_t s_last_word ) { last_word_from_server = s_last_word; } void server_acked( uint64_t s_last_acked ) { last_acked_state = s_last_acked; } int wait_time( void ) const; void set_notification_string( const wstring &s_message, bool permanent = false, bool s_show_quit_keystroke = true ) { message = s_message; if ( permanent ) { message_expiration = -1; } else { message_expiration = timestamp() + 1000; } message_is_network_error = false; show_quit_keystroke = s_show_quit_keystroke; } void set_escape_key_string( const string &s_name ) { char tmp[ 128 ]; snprintf( tmp, sizeof tmp, " [To quit: %s .]", s_name.c_str() ); escape_key_string = tmp; } void set_network_error( const std::string &s ) { wchar_t tmp[ 128 ]; swprintf( tmp, 128, L"%s", s.c_str() ); message = tmp; message_is_network_error = true; message_expiration = timestamp() + Network::ACK_INTERVAL + 100; } void clear_network_error() { if ( message_is_network_error ) { message_expiration = std::min( message_expiration, timestamp() + 1000 ); } } NotificationEngine(); }; class PredictionEngine { private: static const uint64_t SRTT_TRIGGER_LOW = 20; /* <= ms cures SRTT trigger to show predictions */ static const uint64_t SRTT_TRIGGER_HIGH = 30; /* > ms starts SRTT trigger */ static const uint64_t FLAG_TRIGGER_LOW = 50; /* <= ms cures flagging */ static const uint64_t FLAG_TRIGGER_HIGH = 80; /* > ms starts flagging */ static const uint64_t GLITCH_THRESHOLD = 250; /* prediction outstanding this long is glitch */ static const uint64_t GLITCH_REPAIR_COUNT = 10; /* non-glitches required to cure glitch trigger */ static const uint64_t GLITCH_REPAIR_MININTERVAL = 150; /* required time in between non-glitches */ static const uint64_t GLITCH_FLAG_THRESHOLD = 5000; /* prediction outstanding this long => underline */ char last_byte; Parser::UTF8Parser parser; typedef list overlays_type; overlays_type overlays; typedef list cursors_type; cursors_type cursors; typedef ConditionalOverlayRow::overlay_cells_type overlay_cells_type; uint64_t local_frame_sent, local_frame_acked, local_frame_late_acked; ConditionalOverlayRow & get_or_make_row( int row_num, int num_cols ); uint64_t prediction_epoch; uint64_t confirmed_epoch; void become_tentative( void ); void newline_carriage_return( const Framebuffer &fb ); bool flagging; /* whether we are underlining predictions */ bool srtt_trigger; /* show predictions because of slow round trip time */ unsigned int glitch_trigger; /* show predictions temporarily because of long-pending prediction */ uint64_t last_quick_confirmation; ConditionalCursorMove & cursor( void ) { assert( !cursors.empty() ); return cursors.back(); } void kill_epoch( uint64_t epoch, const Framebuffer &fb ); void init_cursor( const Framebuffer &fb ); unsigned int send_interval; int last_height, last_width; public: enum DisplayPreference { Always, Never, Adaptive, Experimental }; private: DisplayPreference display_preference; bool predict_overwrite; bool active( void ) const; bool timing_tests_necessary( void ) const { /* Are there any timing-based triggers that haven't fired yet? */ return !( glitch_trigger && flagging ); } public: void set_display_preference( DisplayPreference s_pref ) { display_preference = s_pref; } void set_predict_overwrite( bool overwrite ) { predict_overwrite = overwrite; } void apply( Framebuffer &fb ) const; void new_user_byte( char the_byte, const Framebuffer &fb ); void cull( const Framebuffer &fb ); void reset( void ); void set_local_frame_sent( uint64_t x ) { local_frame_sent = x; } void set_local_frame_acked( uint64_t x ) { local_frame_acked = x; } void set_local_frame_late_acked( uint64_t x ) { local_frame_late_acked = x; } void set_send_interval( unsigned int x ) { send_interval = x; } int wait_time( void ) const { return ( timing_tests_necessary() && active() ) ? 50 : INT_MAX; } PredictionEngine( void ) : last_byte( 0 ), parser(), overlays(), cursors(), local_frame_sent( 0 ), local_frame_acked( 0 ), local_frame_late_acked( 0 ), prediction_epoch( 1 ), confirmed_epoch( 0 ), flagging( false ), srtt_trigger( false ), glitch_trigger( 0 ), last_quick_confirmation( 0 ), send_interval( 250 ), last_height( 0 ), last_width( 0 ), display_preference( Adaptive ), predict_overwrite( false ) { } }; class TitleEngine { private: Terminal::Framebuffer::title_type prefix; public: void apply( Framebuffer &fb ) const { fb.prefix_window_title( prefix ); } TitleEngine() : prefix() {} void set_prefix( const wstring &s ); }; /* the overlay manager */ class OverlayManager { private: NotificationEngine notifications; PredictionEngine predictions; TitleEngine title; public: void apply( Framebuffer &fb ); NotificationEngine & get_notification_engine( void ) { return notifications; } PredictionEngine & get_prediction_engine( void ) { return predictions; } void set_title_prefix( const wstring &s ) { title.set_prefix( s ); } OverlayManager() : notifications(), predictions(), title() {} int wait_time( void ) const { return std::min( notifications.wait_time(), predictions.wait_time() ); } }; } #endif mosh-1.4.0/src/frontend/stmclient.cc0000664000175000017500000004362714174450057014347 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include "config.h" #include #include #include #include #include #include #include #include #include #include #include #include #if HAVE_PTY_H #include #elif HAVE_UTIL_H #include #endif #include "stmclient.h" #include "swrite.h" #include "completeterminal.h" #include "user.h" #include "fatal_assert.h" #include "locale_utils.h" #include "pty_compat.h" #include "select.h" #include "timestamp.h" #include "networktransport-impl.h" using std::wstring; void STMClient::resume( void ) { /* Restore termios state */ if ( tcsetattr( STDIN_FILENO, TCSANOW, &raw_termios ) < 0 ) { perror( "tcsetattr" ); exit( 1 ); } /* Put terminal in application-cursor-key mode */ swrite( STDOUT_FILENO, display.open().c_str() ); /* Flag that outer terminal state is unknown */ repaint_requested = true; } void STMClient::init( void ) { if ( !is_utf8_locale() ) { LocaleVar native_ctype = get_ctype(); string native_charset( locale_charset() ); fprintf( stderr, "mosh-client needs a UTF-8 native locale to run.\n\n" "Unfortunately, the client's environment (%s) specifies\n" "the character set \"%s\".\n\n", native_ctype.str().c_str(), native_charset.c_str() ); int unused __attribute((unused)) = system( "locale" ); exit( 1 ); } /* Verify terminal configuration */ if ( tcgetattr( STDIN_FILENO, &saved_termios ) < 0 ) { perror( "tcgetattr" ); exit( 1 ); } /* Put terminal driver in raw mode */ raw_termios = saved_termios; #ifdef HAVE_IUTF8 if ( !(raw_termios.c_iflag & IUTF8) ) { // fprintf( stderr, "Warning: Locale is UTF-8 but termios IUTF8 flag not set. Setting IUTF8 flag.\n" ); /* Probably not really necessary since we are putting terminal driver into raw mode anyway. */ raw_termios.c_iflag |= IUTF8; } #endif /* HAVE_IUTF8 */ cfmakeraw( &raw_termios ); if ( tcsetattr( STDIN_FILENO, TCSANOW, &raw_termios ) < 0 ) { perror( "tcsetattr" ); exit( 1 ); } /* Put terminal in application-cursor-key mode */ swrite( STDOUT_FILENO, display.open().c_str() ); /* Add our name to window title */ if ( !getenv( "MOSH_TITLE_NOPREFIX" ) ) { overlays.set_title_prefix( wstring( L"[mosh] " ) ); } /* Set terminal escape key. */ const char *escape_key_env; if ( (escape_key_env = getenv( "MOSH_ESCAPE_KEY" )) != NULL ) { if ( strlen( escape_key_env ) == 1 ) { escape_key = (int)escape_key_env[0]; if ( escape_key > 0 && escape_key < 128 ) { if ( escape_key < 32 ) { /* If escape is ctrl-something, pass it with repeating the key without ctrl. */ escape_pass_key = escape_key + (int)'@'; } else { /* If escape is something else, pass it with repeating the key itself. */ escape_pass_key = escape_key; } if ( escape_pass_key >= 'A' && escape_pass_key <= 'Z' ) { /* If escape pass is an upper case character, define optional version as lower case of the same. */ escape_pass_key2 = escape_pass_key + (int)'a' - (int)'A'; } else { escape_pass_key2 = escape_pass_key; } } else { escape_key = 0x1E; escape_pass_key = '^'; escape_pass_key2 = '^'; } } else if ( strlen( escape_key_env ) == 0 ) { escape_key = -1; } else { escape_key = 0x1E; escape_pass_key = '^'; escape_pass_key2 = '^'; } } else { escape_key = 0x1E; escape_pass_key = '^'; escape_pass_key2 = '^'; } /* There are so many better ways to shoot oneself into leg than setting escape key to Ctrl-C, Ctrl-D, NewLine, Ctrl-L or CarriageReturn that we just won't allow that. */ if ( escape_key == 0x03 || escape_key == 0x04 || escape_key == 0x0A || escape_key == 0x0C || escape_key == 0x0D ) { escape_key = 0x1E; escape_pass_key = '^'; escape_pass_key2 = '^'; } /* Adjust escape help differently if escape is a control character. */ if ( escape_key > 0 ) { char escape_pass_name_buf[16]; char escape_key_name_buf[16]; snprintf(escape_pass_name_buf, sizeof escape_pass_name_buf, "\"%c\"", escape_pass_key); if (escape_key < 32) { snprintf(escape_key_name_buf, sizeof escape_key_name_buf, "Ctrl-%c", escape_pass_key); escape_requires_lf = false; } else { snprintf(escape_key_name_buf, sizeof escape_key_name_buf, "\"%c\"", escape_key); escape_requires_lf = true; } string tmp; tmp = string( escape_pass_name_buf ); wstring escape_pass_name = std::wstring(tmp.begin(), tmp.end()); tmp = string( escape_key_name_buf ); wstring escape_key_name = std::wstring(tmp.begin(), tmp.end()); escape_key_help = L"Commands: Ctrl-Z suspends, \".\" quits, " + escape_pass_name + L" gives literal " + escape_key_name; overlays.get_notification_engine().set_escape_key_string( tmp ); } wchar_t tmp[ 128 ]; swprintf( tmp, 128, L"Nothing received from server on UDP port %s.", port.c_str() ); connecting_notification = wstring( tmp ); } void STMClient::shutdown( void ) { /* Restore screen state */ overlays.get_notification_engine().set_notification_string( wstring( L"" ) ); overlays.get_notification_engine().server_heard( timestamp() ); overlays.set_title_prefix( wstring( L"" ) ); output_new_frame(); /* Restore terminal and terminal-driver state */ swrite( STDOUT_FILENO, display.close().c_str() ); if ( tcsetattr( STDIN_FILENO, TCSANOW, &saved_termios ) < 0 ) { perror( "tcsetattr" ); exit( 1 ); } if ( still_connecting() ) { fprintf( stderr, "\nmosh did not make a successful connection to %s:%s.\n" "Please verify that UDP port %s is not firewalled and can reach the server.\n\n" "(By default, mosh uses a UDP port between 60000 and 61000. The -p option\n" "selects a specific UDP port number.)\n", ip.c_str(), port.c_str(), port.c_str() ); } else if ( network && !clean_shutdown ) { fputs( "\n\nmosh did not shut down cleanly. Please note that the\n" "mosh-server process may still be running on the server.\n", stderr ); } } void STMClient::main_init( void ) { Select &sel = Select::get_instance(); sel.add_signal( SIGWINCH ); sel.add_signal( SIGTERM ); sel.add_signal( SIGINT ); sel.add_signal( SIGHUP ); sel.add_signal( SIGPIPE ); sel.add_signal( SIGCONT ); /* get initial window size */ if ( ioctl( STDIN_FILENO, TIOCGWINSZ, &window_size ) < 0 ) { perror( "ioctl TIOCGWINSZ" ); return; } /* local state */ local_framebuffer = Terminal::Framebuffer( window_size.ws_col, window_size.ws_row ); new_state = Terminal::Framebuffer( 1, 1 ); /* initialize screen */ string init = display.new_frame( false, local_framebuffer, local_framebuffer ); swrite( STDOUT_FILENO, init.data(), init.size() ); /* open network */ Network::UserStream blank; Terminal::Complete local_terminal( window_size.ws_col, window_size.ws_row ); network = NetworkPointer( new NetworkType( blank, local_terminal, key.c_str(), ip.c_str(), port.c_str() ) ); network->set_send_delay( 1 ); /* minimal delay on outgoing keystrokes */ /* tell server the size of the terminal */ network->get_current_state().push_back( Parser::Resize( window_size.ws_col, window_size.ws_row ) ); /* be noisy as necessary */ network->set_verbose( verbose ); Select::set_verbose( verbose ); } void STMClient::output_new_frame( void ) { if ( !network ) { /* clean shutdown even when not initialized */ return; } /* fetch target state */ new_state = network->get_latest_remote_state().state.get_fb(); /* apply local overlays */ overlays.apply( new_state ); /* calculate minimal difference from where we are */ const string diff( display.new_frame( !repaint_requested, local_framebuffer, new_state ) ); swrite( STDOUT_FILENO, diff.data(), diff.size() ); repaint_requested = false; local_framebuffer = new_state; } void STMClient::process_network_input( void ) { network->recv(); /* Now give hints to the overlays */ overlays.get_notification_engine().server_heard( network->get_latest_remote_state().timestamp ); overlays.get_notification_engine().server_acked( network->get_sent_state_acked_timestamp() ); overlays.get_prediction_engine().set_local_frame_acked( network->get_sent_state_acked() ); overlays.get_prediction_engine().set_send_interval( network->send_interval() ); overlays.get_prediction_engine().set_local_frame_late_acked( network->get_latest_remote_state().state.get_echo_ack() ); } bool STMClient::process_user_input( int fd ) { const int buf_size = 16384; char buf[ buf_size ]; /* fill buffer if possible */ ssize_t bytes_read = read( fd, buf, buf_size ); if ( bytes_read == 0 ) { /* EOF */ return false; } else if ( bytes_read < 0 ) { perror( "read" ); return false; } NetworkType &net = *network; if ( net.shutdown_in_progress() ) { return true; } overlays.get_prediction_engine().set_local_frame_sent( net.get_sent_state_last() ); /* Don't predict for bulk data. */ bool paste = bytes_read > 100; if ( paste ) { overlays.get_prediction_engine().reset(); } for ( int i = 0; i < bytes_read; i++ ) { char the_byte = buf[ i ]; if ( !paste ) { overlays.get_prediction_engine().new_user_byte( the_byte, local_framebuffer ); } if ( quit_sequence_started ) { if ( the_byte == '.' ) { /* Quit sequence is Ctrl-^ . */ if ( net.has_remote_addr() && (!net.shutdown_in_progress()) ) { overlays.get_notification_engine().set_notification_string( wstring( L"Exiting on user request..." ), true ); net.start_shutdown(); return true; } return false; } else if ( the_byte == 0x1a ) { /* Suspend sequence is escape_key Ctrl-Z */ /* Restore terminal and terminal-driver state */ swrite( STDOUT_FILENO, display.close().c_str() ); if ( tcsetattr( STDIN_FILENO, TCSANOW, &saved_termios ) < 0 ) { perror( "tcsetattr" ); exit( 1 ); } fputs( "\n\033[37;44m[mosh is suspended.]\033[m\n", stdout ); fflush( NULL ); /* actually suspend */ kill( 0, SIGSTOP ); resume(); } else if ( (the_byte == escape_pass_key) || (the_byte == escape_pass_key2) ) { /* Emulation sequence to type escape_key is escape_key + escape_pass_key (that is escape key without Ctrl) */ net.get_current_state().push_back( Parser::UserByte( escape_key ) ); } else { /* Escape key followed by anything other than . and ^ gets sent literally */ net.get_current_state().push_back( Parser::UserByte( escape_key ) ); net.get_current_state().push_back( Parser::UserByte( the_byte ) ); } quit_sequence_started = false; if ( overlays.get_notification_engine().get_notification_string() == escape_key_help ) { overlays.get_notification_engine().set_notification_string( L"" ); } continue; } quit_sequence_started = (escape_key > 0) && (the_byte == escape_key) && (lf_entered || (! escape_requires_lf)); if ( quit_sequence_started ) { lf_entered = false; overlays.get_notification_engine().set_notification_string( escape_key_help, true, false ); continue; } lf_entered = ( (the_byte == 0x0A) || (the_byte == 0x0D) ); /* LineFeed, Ctrl-J, '\n' or CarriageReturn, Ctrl-M, '\r' */ if ( the_byte == 0x0C ) { /* Ctrl-L */ repaint_requested = true; } net.get_current_state().push_back( Parser::UserByte( the_byte ) ); } return true; } bool STMClient::process_resize( void ) { /* get new size */ if ( ioctl( STDIN_FILENO, TIOCGWINSZ, &window_size ) < 0 ) { perror( "ioctl TIOCGWINSZ" ); return false; } /* tell remote emulator */ Parser::Resize res( window_size.ws_col, window_size.ws_row ); if ( !network->shutdown_in_progress() ) { network->get_current_state().push_back( res ); } /* note remote emulator will probably reply with its own Resize to adjust our state */ /* tell prediction engine */ overlays.get_prediction_engine().reset(); return true; } bool STMClient::main( void ) { /* initialize signal handling and structures */ main_init(); /* Drop unnecessary privileges */ #ifdef HAVE_PLEDGE /* OpenBSD pledge() syscall */ if ( pledge( "stdio inet tty", NULL )) { perror( "pledge() failed" ); exit( 1 ); } #endif /* prepare to poll for events */ Select &sel = Select::get_instance(); while ( 1 ) { try { output_new_frame(); int wait_time = std::min( network->wait_time(), overlays.wait_time() ); /* Handle startup "Connecting..." message */ if ( still_connecting() ) { wait_time = std::min( 250, wait_time ); } /* poll for events */ /* network->fd() can in theory change over time */ sel.clear_fds(); std::vector< int > fd_list( network->fds() ); for ( std::vector< int >::const_iterator it = fd_list.begin(); it != fd_list.end(); it++ ) { sel.add_fd( *it ); } sel.add_fd( STDIN_FILENO ); int active_fds = sel.select( wait_time ); if ( active_fds < 0 ) { perror( "select" ); break; } bool network_ready_to_read = false; for ( std::vector< int >::const_iterator it = fd_list.begin(); it != fd_list.end(); it++ ) { if ( sel.read( *it ) ) { /* packet received from the network */ /* we only read one socket each run */ network_ready_to_read = true; } } if ( network_ready_to_read ) { process_network_input(); } if ( sel.read( STDIN_FILENO ) && !process_user_input( STDIN_FILENO ) ) { /* input from the user needs to be fed to the network */ if ( !network->has_remote_addr() ) { break; } else if ( !network->shutdown_in_progress() ) { overlays.get_notification_engine().set_notification_string( wstring( L"Exiting..." ), true ); network->start_shutdown(); } } if ( sel.signal( SIGWINCH ) && !process_resize() ) { /* resize */ return false; } if ( sel.signal( SIGCONT ) ) { resume(); } if ( sel.signal( SIGTERM ) || sel.signal( SIGINT ) || sel.signal( SIGHUP ) || sel.signal( SIGPIPE ) ) { /* shutdown signal */ if ( !network->has_remote_addr() ) { break; } else if ( !network->shutdown_in_progress() ) { overlays.get_notification_engine().set_notification_string( wstring( L"Signal received, shutting down..." ), true ); network->start_shutdown(); } } /* quit if our shutdown has been acknowledged */ if ( network->shutdown_in_progress() && network->shutdown_acknowledged() ) { clean_shutdown = true; break; } /* quit after shutdown acknowledgement timeout */ if ( network->shutdown_in_progress() && network->shutdown_ack_timed_out() ) { break; } /* quit if we received and acknowledged a shutdown request */ if ( network->counterparty_shutdown_ack_sent() ) { clean_shutdown = true; break; } /* write diagnostic message if can't reach server */ if ( still_connecting() && (!network->shutdown_in_progress()) && (timestamp() - network->get_latest_remote_state().timestamp > 250) ) { if ( timestamp() - network->get_latest_remote_state().timestamp > 15000 ) { if ( !network->shutdown_in_progress() ) { overlays.get_notification_engine().set_notification_string( wstring( L"Timed out waiting for server..." ), true ); network->start_shutdown(); } } else { overlays.get_notification_engine().set_notification_string( connecting_notification ); } } else if ( (network->get_remote_state_num() != 0) && (overlays.get_notification_engine().get_notification_string() == connecting_notification) ) { overlays.get_notification_engine().set_notification_string( L"" ); } network->tick(); string & send_error = network->get_send_error(); if ( !send_error.empty() ) { overlays.get_notification_engine().set_network_error( send_error ); send_error.clear(); } else { overlays.get_notification_engine().clear_network_error(); } } catch ( const Network::NetworkException &e ) { if ( !network->shutdown_in_progress() ) { overlays.get_notification_engine().set_network_error( e.what() ); } struct timespec req; req.tv_sec = 0; req.tv_nsec = 200000000; /* 0.2 sec */ nanosleep( &req, NULL ); freeze_timestamp(); } catch ( const Crypto::CryptoException &e ) { if ( e.fatal ) { throw; } else { wchar_t tmp[ 128 ]; swprintf( tmp, 128, L"Crypto exception: %s", e.what() ); overlays.get_notification_engine().set_notification_string( wstring( tmp ) ); } } } return clean_shutdown; } mosh-1.4.0/src/frontend/stmclient.h0000664000175000017500000001111314174450057014172 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #ifndef STM_CLIENT_HPP #define STM_CLIENT_HPP #include #include #include #include "completeterminal.h" #include "networktransport.h" #include "user.h" #include "shared.h" #include "terminaloverlay.h" class STMClient { private: std::string ip; std::string port; std::string key; int escape_key; int escape_pass_key; int escape_pass_key2; bool escape_requires_lf; std::wstring escape_key_help; struct termios saved_termios, raw_termios; struct winsize window_size; Terminal::Framebuffer local_framebuffer, new_state; Overlay::OverlayManager overlays; typedef Network::Transport< Network::UserStream, Terminal::Complete > NetworkType; typedef shared::shared_ptr< NetworkType > NetworkPointer; NetworkPointer network; Terminal::Display display; std::wstring connecting_notification; bool repaint_requested, lf_entered, quit_sequence_started; bool clean_shutdown; unsigned int verbose; void main_init( void ); void process_network_input( void ); bool process_user_input( int fd ); bool process_resize( void ); void output_new_frame( void ); bool still_connecting( void ) const { /* Initially, network == NULL */ return network && ( network->get_remote_state_num() == 0 ); } void resume( void ); /* restore state after SIGCONT */ public: STMClient( const char *s_ip, const char *s_port, const char *s_key, const char *predict_mode, unsigned int s_verbose, const char *predict_overwrite ) : ip( s_ip ? s_ip : "" ), port( s_port ? s_port : "" ), key( s_key ? s_key : "" ), escape_key( 0x1E ), escape_pass_key( '^' ), escape_pass_key2( '^' ), escape_requires_lf( false ), escape_key_help( L"?" ), saved_termios(), raw_termios(), window_size(), local_framebuffer( 1, 1 ), new_state( 1, 1 ), overlays(), network(), display( true ), /* use TERM environment var to initialize display */ connecting_notification(), repaint_requested( false ), lf_entered( false ), quit_sequence_started( false ), clean_shutdown( false ), verbose( s_verbose ) { if ( predict_mode ) { if ( !strcmp( predict_mode, "always" ) ) { overlays.get_prediction_engine().set_display_preference( Overlay::PredictionEngine::Always ); } else if ( !strcmp( predict_mode, "never" ) ) { overlays.get_prediction_engine().set_display_preference( Overlay::PredictionEngine::Never ); } else if ( !strcmp( predict_mode, "adaptive" ) ) { overlays.get_prediction_engine().set_display_preference( Overlay::PredictionEngine::Adaptive ); } else if ( !strcmp( predict_mode, "experimental" ) ) { overlays.get_prediction_engine().set_display_preference( Overlay::PredictionEngine::Experimental ); } else { fprintf( stderr, "Unknown prediction mode %s.\n", predict_mode ); exit( 1 ); } } if ( predict_overwrite && !strcmp( predict_overwrite, "yes" ) ) { overlays.get_prediction_engine().set_predict_overwrite( true ); } } void init( void ); void shutdown( void ); bool main( void ); /* unused */ STMClient( const STMClient & ); STMClient & operator=( const STMClient & ); }; #endif mosh-1.4.0/src/frontend/terminaloverlay.cc0000664000175000017500000006324414174450057015557 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include #include #include #include #include #include "terminaloverlay.h" using namespace Overlay; void ConditionalOverlayCell::apply( Framebuffer &fb, uint64_t confirmed_epoch, int row, bool flag ) const { if ( (!active) || (row >= fb.ds.get_height()) || (col >= fb.ds.get_width()) ) { return; } if ( tentative( confirmed_epoch ) ) { return; } if ( replacement.is_blank() && fb.get_cell( row, col )->is_blank() ) { flag = false; } if ( unknown ) { if ( flag && ( col != fb.ds.get_width() - 1 ) ) { fb.get_mutable_cell( row, col )->get_renditions().set_attribute(Renditions::underlined, true); } return; } if ( *fb.get_cell( row, col ) != replacement ) { *(fb.get_mutable_cell( row, col )) = replacement; if ( flag ) { fb.get_mutable_cell( row, col )->get_renditions().set_attribute( Renditions::underlined, true ); } } } Validity ConditionalOverlayCell::get_validity( const Framebuffer &fb, int row, uint64_t early_ack __attribute__((unused)), uint64_t late_ack ) const { if ( !active ) { return Inactive; } if ( (row >= fb.ds.get_height()) || (col >= fb.ds.get_width()) ) { return IncorrectOrExpired; } const Cell ¤t = *( fb.get_cell( row, col ) ); /* see if it hasn't been updated yet */ if ( late_ack < expiration_frame ) { return Pending; } if ( unknown ) { return CorrectNoCredit; } if ( replacement.is_blank() ) { /* too easy for this to trigger falsely */ return CorrectNoCredit; } if ( current.contents_match( replacement ) ) { vector::const_iterator it = original_contents.begin(); for ( ; it != original_contents.end(); it++ ) { if ( it->contents_match( replacement ) ) break; } if ( it == original_contents.end() ) { return Correct; } return CorrectNoCredit; } return IncorrectOrExpired; } Validity ConditionalCursorMove::get_validity( const Framebuffer &fb, uint64_t early_ack __attribute((unused)), uint64_t late_ack ) const { if ( !active ) { return Inactive; } if ( (row >= fb.ds.get_height()) || (col >= fb.ds.get_width()) ) { // fprintf( stderr, "Crazy cursor (%d,%d)!\n", row, col ); return IncorrectOrExpired; } if ( late_ack >= expiration_frame ) { if ( (fb.ds.get_cursor_col() == col) && (fb.ds.get_cursor_row() == row) ) { return Correct; } return IncorrectOrExpired; } return Pending; } void ConditionalCursorMove::apply( Framebuffer &fb, uint64_t confirmed_epoch ) const { if ( !active ) { return; } if ( tentative( confirmed_epoch ) ) { return; } assert( row < fb.ds.get_height() ); assert( col < fb.ds.get_width() ); assert( !fb.ds.origin_mode ); fb.ds.move_row( row, false ); fb.ds.move_col( col, false, false ); } NotificationEngine::NotificationEngine() : last_word_from_server( timestamp() ), last_acked_state( timestamp() ), escape_key_string(), message(), message_is_network_error( false ), message_expiration( -1 ), show_quit_keystroke( true ) {} static std::string human_readable_duration( int num_seconds, const std::string &seconds_abbr ) { char tmp[ 128 ]; if ( num_seconds < 60 ) { snprintf( tmp, 128, "%d %s", num_seconds, seconds_abbr.c_str() ); } else if ( num_seconds < 3600 ) { snprintf( tmp, 128, "%d:%02d", num_seconds / 60, num_seconds % 60 ); } else { snprintf( tmp, 128, "%d:%02d:%02d", num_seconds / 3600, (num_seconds / 60) % 60, num_seconds % 60 ); } return tmp; } void NotificationEngine::apply( Framebuffer &fb ) const { uint64_t now = timestamp(); bool time_expired = need_countup( now ); if ( message.empty() && !time_expired ) { return; } assert( fb.ds.get_width() > 0 ); assert( fb.ds.get_height() > 0 ); /* hide cursor if necessary */ if ( fb.ds.get_cursor_row() == 0 ) { fb.ds.cursor_visible = false; } /* draw bar across top of screen */ Cell notification_bar( 0 ); notification_bar.get_renditions().set_foreground_color( 7 ); notification_bar.get_renditions().set_background_color( 4 ); notification_bar.append( 0x20 ); for ( int i = 0; i < fb.ds.get_width(); i++ ) { *(fb.get_mutable_cell( 0, i )) = notification_bar; } /* write message */ wchar_t tmp[ 128 ]; /* We want to prefer the "last contact" message if we simply haven't heard from the server in a while, but print the "last reply" message if the problem is uplink-only. */ double since_heard = (double)(now - last_word_from_server) / 1000.0; double since_ack = (double)(now - last_acked_state) / 1000.0; const char server_message[] = "contact"; const char reply_message[] = "reply"; double time_elapsed = since_heard; const char *explanation = server_message; if ( reply_late( now ) && (!server_late( now )) ) { time_elapsed = since_ack; explanation = reply_message; } const static char blank[] = ""; const char *keystroke_str = show_quit_keystroke ? escape_key_string.c_str() : blank; if ( message.empty() && (!time_expired) ) { return; } if ( message.empty() && time_expired ) { swprintf( tmp, 128, L"mosh: Last %s %s ago.%s", explanation, human_readable_duration( static_cast( time_elapsed ), "seconds" ).c_str(), keystroke_str ); } else if ( (!message.empty()) && (!time_expired) ) { swprintf( tmp, 128, L"mosh: %ls%s", message.c_str(), keystroke_str ); } else { swprintf( tmp, 128, L"mosh: %ls (%s without %s.)%s", message.c_str(), human_readable_duration( static_cast( time_elapsed ), "s" ).c_str(), explanation, keystroke_str ); } wstring string_to_draw( tmp ); int overlay_col = 0; Cell *combining_cell = fb.get_mutable_cell( 0, 0 ); /* We unfortunately duplicate the terminal's logic for how to render a Unicode sequence into graphemes */ for ( wstring::const_iterator i = string_to_draw.begin(); i != string_to_draw.end(); i++ ) { if ( overlay_col >= fb.ds.get_width() ) { break; } wchar_t ch = *i; int chwidth = ch == L'\0' ? -1 : wcwidth( ch ); Cell *this_cell = 0; switch ( chwidth ) { case 1: /* normal character */ case 2: /* wide character */ this_cell = fb.get_mutable_cell( 0, overlay_col ); fb.reset_cell( this_cell ); this_cell->get_renditions().set_attribute(Renditions::bold, true); this_cell->get_renditions().set_foreground_color( 7 ); this_cell->get_renditions().set_background_color( 4 ); this_cell->append( ch ); this_cell->set_wide( chwidth == 2 ); combining_cell = this_cell; overlay_col += chwidth; break; case 0: /* combining character */ if ( !combining_cell ) { break; } if ( combining_cell->empty() ) { assert( !combining_cell->get_wide() ); combining_cell->set_fallback( true ); overlay_col++; } if ( !combining_cell->full() ) { combining_cell->append( ch ); } break; case -1: /* unprintable character */ break; default: assert( !"unexpected character width from wcwidth()" ); } } } void NotificationEngine::adjust_message( void ) { if ( timestamp() >= message_expiration ) { message.clear(); } } int NotificationEngine::wait_time( void ) const { uint64_t next_expiry = INT_MAX; uint64_t now = timestamp(); next_expiry = std::min( next_expiry, message_expiration - now ); if ( need_countup( now ) ) { uint64_t countup_interval = 1000; if ( ( now - last_word_from_server ) > 60000 ) { /* If we've been disconnected for 60 seconds, save power by updating the display less often. See #243. */ countup_interval = Network::ACK_INTERVAL; } next_expiry = std::min( next_expiry, countup_interval ); } return next_expiry; } void OverlayManager::apply( Framebuffer &fb ) { predictions.cull( fb ); predictions.apply( fb ); notifications.adjust_message(); notifications.apply( fb ); title.apply( fb ); } void TitleEngine::set_prefix( const wstring &s ) { prefix = Terminal::Framebuffer::title_type( s.begin(), s.end() ); } void ConditionalOverlayRow::apply( Framebuffer &fb, uint64_t confirmed_epoch, bool flag ) const { for ( overlay_cells_type::const_iterator it = overlay_cells.begin(); it != overlay_cells.end(); it++ ) { it->apply( fb, confirmed_epoch, row_num, flag ); } } void PredictionEngine::apply( Framebuffer &fb ) const { if ( (display_preference == Never) || !( srtt_trigger || glitch_trigger || (display_preference == Always) || (display_preference == Experimental) ) ){ return; } for ( cursors_type::const_iterator it = cursors.begin(); it != cursors.end(); it++ ) { it->apply( fb, confirmed_epoch ); } for ( overlays_type::const_iterator it = overlays.begin(); it != overlays.end(); it++ ) { it->apply( fb, confirmed_epoch, flagging ); } } void PredictionEngine::kill_epoch( uint64_t epoch, const Framebuffer &fb ) { for( cursors_type::iterator it = cursors.begin(); it != cursors.end(); ) { cursors_type::iterator it_next = it; it_next++; if ( it->tentative( epoch - 1 )) { cursors.erase( it ); } it = it_next; } cursors.push_back( ConditionalCursorMove( local_frame_sent + 1, fb.ds.get_cursor_row(), fb.ds.get_cursor_col(), prediction_epoch ) ); cursor().active = true; for ( overlays_type::iterator i = overlays.begin(); i != overlays.end(); i++ ) { for ( overlay_cells_type::iterator j = i->overlay_cells.begin(); j != i->overlay_cells.end(); j++ ) { if ( j->tentative( epoch - 1 ) ) { j->reset(); } } } become_tentative(); } void PredictionEngine::reset( void ) { cursors.clear(); overlays.clear(); become_tentative(); // fprintf( stderr, "RESETTING\n" ); } void PredictionEngine::init_cursor( const Framebuffer &fb ) { if ( cursors.empty() ) { /* initialize new cursor prediction */ cursors.push_back( ConditionalCursorMove( local_frame_sent + 1, fb.ds.get_cursor_row(), fb.ds.get_cursor_col(), prediction_epoch ) ); cursor().active = true; } else if ( cursor().tentative_until_epoch != prediction_epoch ) { cursors.push_back( ConditionalCursorMove( local_frame_sent + 1, cursor().row, cursor().col, prediction_epoch ) ); cursor().active = true; } } void PredictionEngine::cull( const Framebuffer &fb ) { if ( display_preference == Never ) { return; } if ( (last_height != fb.ds.get_height()) || (last_width != fb.ds.get_width()) ) { last_height = fb.ds.get_height(); last_width = fb.ds.get_width(); reset(); } uint64_t now = timestamp(); /* control srtt_trigger with hysteresis */ if ( send_interval > SRTT_TRIGGER_HIGH ) { srtt_trigger = true; } else if ( srtt_trigger && (send_interval <= SRTT_TRIGGER_LOW) /* 20 ms is current minimum value */ && (!active()) ) { /* only turn off when no predictions being shown */ srtt_trigger = false; } /* control underlining with hysteresis */ if ( send_interval > FLAG_TRIGGER_HIGH ) { flagging = true; } else if ( send_interval <= FLAG_TRIGGER_LOW ) { flagging = false; } /* really big glitches also activate underlining */ if ( glitch_trigger > GLITCH_REPAIR_COUNT ) { flagging = true; } /* go through cell predictions */ overlays_type::iterator i = overlays.begin(); while ( i != overlays.end() ) { overlays_type::iterator inext = i; inext++; if ( (i->row_num < 0) || (i->row_num >= fb.ds.get_height()) ) { overlays.erase( i ); i = inext; continue; } for ( overlay_cells_type::iterator j = i->overlay_cells.begin(); j != i->overlay_cells.end(); j++ ) { switch ( j->get_validity( fb, i->row_num, local_frame_acked, local_frame_late_acked ) ) { case IncorrectOrExpired: if ( j->tentative( confirmed_epoch ) ) { /* fprintf( stderr, "Bad tentative prediction in row %d, col %d (think %lc, actually %lc)\n", i->row_num, j->col, j->replacement.debug_contents(), fb.get_cell( i->row_num, j->col )->debug_contents() ); */ if ( display_preference == Experimental ) { j->reset(); } else { kill_epoch( j->tentative_until_epoch, fb ); } /* if ( j->display_time != uint64_t(-1) ) { fprintf( stderr, "TIMING %ld - %ld (TENT)\n", time(NULL), now - j->display_time ); } */ } else { /* fprintf( stderr, "[%d=>%d] Killing prediction in row %d, col %d (think %lc, actually %lc)\n", (int)local_frame_acked, (int)j->expiration_frame, i->row_num, j->col, j->replacement.debug_contents(), fb.get_cell( i->row_num, j->col )->debug_contents() ); */ /* if ( j->display_time != uint64_t(-1) ) { fprintf( stderr, "TIMING %ld - %ld\n", time(NULL), now - j->display_time ); } */ if ( display_preference == Experimental ) { j->reset(); } else { reset(); return; } } break; case Correct: /* if ( j->display_time != uint64_t(-1) ) { fprintf( stderr, "TIMING %ld + %ld\n", now, now - j->display_time ); } */ if ( j->tentative_until_epoch > confirmed_epoch ) { confirmed_epoch = j->tentative_until_epoch; /* fprintf( stderr, "%lc in (%d,%d) confirms epoch %lu (predicting in epoch %lu)\n", j->replacement.debug_contents(), i->row_num, j->col, confirmed_epoch, prediction_epoch ); */ } /* When predictions come in quickly, slowly take away the glitch trigger. */ if ( now - j->prediction_time < GLITCH_THRESHOLD && ( glitch_trigger > 0 && now - GLITCH_REPAIR_MININTERVAL >= last_quick_confirmation ) ) { glitch_trigger--; last_quick_confirmation = now; } /* match rest of row to the actual renditions */ { const Renditions &actual_renditions = fb.get_cell( i->row_num, j->col )->get_renditions(); for ( overlay_cells_type::iterator k = j; k != i->overlay_cells.end(); k++ ) { k->replacement.get_renditions() = actual_renditions; } } /* fallthrough */ case CorrectNoCredit: j->reset(); break; case Pending: /* When a prediction takes a long time to be confirmed, we activate the predictions even if SRTT is low */ if ( (now - j->prediction_time) >= GLITCH_FLAG_THRESHOLD ) { glitch_trigger = GLITCH_REPAIR_COUNT * 2; /* display and underline */ } else if ( ((now - j->prediction_time) >= GLITCH_THRESHOLD) && (glitch_trigger < GLITCH_REPAIR_COUNT) ) { glitch_trigger = GLITCH_REPAIR_COUNT; /* just display */ } break; default: break; } } i = inext; } /* go through cursor predictions */ if ( !cursors.empty() && cursor().get_validity( fb, local_frame_acked, local_frame_late_acked ) == IncorrectOrExpired ) { /* fprintf( stderr, "Sadly, we're predicting (%d,%d) vs. (%d,%d) [tau: %ld, expiration_time=%ld, now=%ld]\n", cursor().row, cursor().col, fb.ds.get_cursor_row(), fb.ds.get_cursor_col(), cursor().tentative_until_epoch, cursor().expiration_time, now ); */ if ( display_preference == Experimental ) { cursors.clear(); } else { reset(); return; } } /* NB: switching from list to another STL container could break this code. So we don't use the cursors_type typedef. */ for ( list::iterator it = cursors.begin(); it != cursors.end(); ) { if ( it->get_validity( fb, local_frame_acked, local_frame_late_acked ) != Pending ) { it = cursors.erase( it ); } else { it++; } } } ConditionalOverlayRow & PredictionEngine::get_or_make_row( int row_num, int num_cols ) { overlays_type::iterator it; for ( it = overlays.begin(); it != overlays.end(); it++ ) { if ( it->row_num == row_num ) { break; } } if ( it != overlays.end() ) { return *it; } /* make row */ ConditionalOverlayRow r( row_num ); r.overlay_cells.reserve( num_cols ); for ( int i = 0; i < num_cols; i++ ) { r.overlay_cells.push_back( ConditionalOverlayCell( 0, i, prediction_epoch ) ); assert( r.overlay_cells[ i ].col == i ); } overlays.push_back( r ); return overlays.back(); } void PredictionEngine::new_user_byte( char the_byte, const Framebuffer &fb ) { if ( display_preference == Never ) { return; } if ( display_preference == Experimental ) { prediction_epoch = confirmed_epoch; } cull( fb ); uint64_t now = timestamp(); /* translate application-mode cursor control function to ANSI cursor control sequence */ if ( (last_byte == 0x1b) && (the_byte == 'O') ) { the_byte = '['; } last_byte = the_byte; Parser::Actions actions; parser.input( the_byte, actions ); for ( Parser::Actions::iterator it = actions.begin(); it != actions.end(); it++ ) { Parser::Action& act = **it; /* fprintf( stderr, "Action: %s (%lc)\n", act->name().c_str(), act->char_present ? act->ch : L'_' ); */ const std::type_info& type_act = typeid( act ); if ( type_act == typeid( Parser::Print ) ) { /* make new prediction */ init_cursor( fb ); assert( act.char_present ); wchar_t ch = act.ch; /* XXX handle wide characters */ if ( ch == 0x7f ) { /* backspace */ // fprintf( stderr, "Backspace.\n" ); ConditionalOverlayRow &the_row = get_or_make_row( cursor().row, fb.ds.get_width() ); if ( cursor().col > 0 ) { cursor().col--; cursor().expire( local_frame_sent + 1, now ); if ( predict_overwrite ) { ConditionalOverlayCell &cell = the_row.overlay_cells[ cursor().col ]; cell.reset_with_orig(); cell.active = true; cell.tentative_until_epoch = prediction_epoch; cell.expire( local_frame_sent + 1, now ); const Cell orig_cell = *fb.get_cell(); cell.original_contents.push_back( orig_cell ); cell.replacement = orig_cell; cell.replacement.clear(); cell.replacement.append(' '); } else { for ( int i = cursor().col; i < fb.ds.get_width(); i++ ) { ConditionalOverlayCell &cell = the_row.overlay_cells[ i ]; cell.reset_with_orig(); cell.active = true; cell.tentative_until_epoch = prediction_epoch; cell.expire( local_frame_sent + 1, now ); cell.original_contents.push_back( *fb.get_cell( cursor().row, i ) ); if ( i + 2 < fb.ds.get_width() ) { ConditionalOverlayCell &next_cell = the_row.overlay_cells[ i + 1 ]; const Cell *next_cell_actual = fb.get_cell( cursor().row, i + 1 ); if ( next_cell.active ) { if ( next_cell.unknown ) { cell.unknown = true; } else { cell.unknown = false; cell.replacement = next_cell.replacement; } } else { cell.unknown = false; cell.replacement = *next_cell_actual; } } else { cell.unknown = true; } } } } } else if ( (ch < 0x20) || (wcwidth( ch ) != 1) ) { /* unknown print */ become_tentative(); // fprintf( stderr, "Unknown print 0x%x\n", ch ); } else { assert( cursor().row >= 0 ); assert( cursor().col >= 0 ); assert( cursor().row < fb.ds.get_height() ); assert( cursor().col < fb.ds.get_width() ); ConditionalOverlayRow &the_row = get_or_make_row( cursor().row, fb.ds.get_width() ); if ( cursor().col + 1 >= fb.ds.get_width() ) { /* prediction in the last column is tricky */ /* e.g., emacs will show wrap character, shell will just put the character there */ become_tentative(); } /* do the insert */ int rightmost_column = predict_overwrite ? cursor().col : fb.ds.get_width() - 1; for ( int i = rightmost_column; i > cursor().col; i-- ) { ConditionalOverlayCell &cell = the_row.overlay_cells[ i ]; cell.reset_with_orig(); cell.active = true; cell.tentative_until_epoch = prediction_epoch; cell.expire( local_frame_sent + 1, now ); cell.original_contents.push_back( *fb.get_cell( cursor().row, i ) ); ConditionalOverlayCell &prev_cell = the_row.overlay_cells[ i - 1 ]; const Cell *prev_cell_actual = fb.get_cell( cursor().row, i - 1 ); if ( i == fb.ds.get_width() - 1 ) { cell.unknown = true; } else if ( prev_cell.active ) { if ( prev_cell.unknown ) { cell.unknown = true; } else { cell.unknown = false; cell.replacement = prev_cell.replacement; } } else { cell.unknown = false; cell.replacement = *prev_cell_actual; } } ConditionalOverlayCell &cell = the_row.overlay_cells[ cursor().col ]; cell.reset_with_orig(); cell.active = true; cell.tentative_until_epoch = prediction_epoch; cell.expire( local_frame_sent + 1, now ); cell.replacement.get_renditions() = fb.ds.get_renditions(); /* heuristic: match renditions of character to the left */ if ( cursor().col > 0 ) { ConditionalOverlayCell &prev_cell = the_row.overlay_cells[ cursor().col - 1 ]; const Cell *prev_cell_actual = fb.get_cell( cursor().row, cursor().col - 1 ); if ( prev_cell.active && (!prev_cell.unknown) ) { cell.replacement.get_renditions() = prev_cell.replacement.get_renditions(); } else { cell.replacement.get_renditions() = prev_cell_actual->get_renditions(); } } cell.replacement.clear(); cell.replacement.append( ch ); cell.original_contents.push_back( *fb.get_cell( cursor().row, cursor().col ) ); /* fprintf( stderr, "[%d=>%d] Predicting %lc in row %d, col %d [tue: %lu]\n", (int)local_frame_acked, (int)cell.expiration_frame, ch, cursor().row, cursor().col, cell.tentative_until_epoch ); */ cursor().expire( local_frame_sent + 1, now ); /* do we need to wrap? */ if ( cursor().col < fb.ds.get_width() - 1 ) { cursor().col++; } else { become_tentative(); newline_carriage_return( fb ); } } } else if ( type_act == typeid( Parser::Execute ) ) { if ( act.char_present && (act.ch == 0x0d) /* CR */ ) { become_tentative(); newline_carriage_return( fb ); } else { // fprintf( stderr, "Execute 0x%x\n", act.ch ); become_tentative(); } } else if ( type_act == typeid( Parser::Esc_Dispatch ) ) { // fprintf( stderr, "Escape sequence\n" ); become_tentative(); } else if ( type_act == typeid( Parser::CSI_Dispatch ) ) { if ( act.char_present && (act.ch == L'C') ) { /* right arrow */ init_cursor( fb ); if ( cursor().col < fb.ds.get_width() - 1 ) { cursor().col++; cursor().expire( local_frame_sent + 1, now ); } } else if ( act.char_present && (act.ch == L'D') ) { /* left arrow */ init_cursor( fb ); if ( cursor().col > 0 ) { cursor().col--; cursor().expire( local_frame_sent + 1, now ); } } else { // fprintf( stderr, "CSI sequence %lc\n", act.ch ); become_tentative(); } } } } void PredictionEngine::newline_carriage_return( const Framebuffer &fb ) { uint64_t now = timestamp(); init_cursor( fb ); cursor().col = 0; if ( cursor().row == fb.ds.get_height() - 1 ) { /* Don't try to predict scroll until we have versioned cell predictions */ /* for ( overlays_type::iterator i = overlays.begin(); i != overlays.end(); i++ ) { i->row_num--; for ( overlay_cells_type::iterator j = i->overlay_cells.begin(); j != i->overlay_cells.end(); j++ ) { if ( j->active ) { j->expire( local_frame_sent + 1, now ); } } } */ /* make blank prediction for last row */ ConditionalOverlayRow &the_row = get_or_make_row( cursor().row, fb.ds.get_width() ); for ( overlay_cells_type::iterator j = the_row.overlay_cells.begin(); j != the_row.overlay_cells.end(); j++ ) { j->active = true; j->tentative_until_epoch = prediction_epoch; j->expire( local_frame_sent + 1, now ); j->replacement.clear(); } } else { cursor().row++; } } void PredictionEngine::become_tentative( void ) { if ( display_preference != Experimental ) { prediction_epoch++; } /* fprintf( stderr, "Now tentative in epoch %lu (confirmed=%lu)\n", prediction_epoch, confirmed_epoch ); */ } bool PredictionEngine::active( void ) const { if ( !cursors.empty() ) { return true; } for ( overlays_type::const_iterator i = overlays.begin(); i != overlays.end(); i++ ) { for ( overlay_cells_type::const_iterator j = i->overlay_cells.begin(); j != i->overlay_cells.end(); j++ ) { if ( j->active ) { return true; } } } return false; } mosh-1.4.0/src/frontend/Makefile.am0000664000175000017500000000155314272621034014054 00000000000000AM_CPPFLAGS = -I$(srcdir)/../statesync -I$(srcdir)/../terminal -I$(srcdir)/../network -I$(srcdir)/../crypto -I../protobufs -I$(srcdir)/../util $(TINFO_CFLAGS) $(protobuf_CFLAGS) $(CRYPTO_CFLAGS) AM_CXXFLAGS = $(WARNING_CXXFLAGS) $(PICKY_CXXFLAGS) $(HARDEN_CFLAGS) $(MISC_CXXFLAGS) $(CODE_COVERAGE_CXXFLAGS) AM_LDFLAGS = $(HARDEN_LDFLAGS) $(CODE_COVERAGE_LIBS) LDADD = ../crypto/libmoshcrypto.a ../network/libmoshnetwork.a ../statesync/libmoshstatesync.a ../terminal/libmoshterminal.a ../util/libmoshutil.a ../protobufs/libmoshprotos.a -lm $(TINFO_LIBS) $(protobuf_LIBS) $(CRYPTO_LIBS) mosh_server_LDADD = $(LDADD) bin_PROGRAMS = if BUILD_CLIENT bin_PROGRAMS += mosh-client endif if BUILD_SERVER bin_PROGRAMS += mosh-server endif mosh_client_SOURCES = mosh-client.cc stmclient.cc stmclient.h terminaloverlay.cc terminaloverlay.h mosh_server_SOURCES = mosh-server.cc mosh-1.4.0/src/frontend/mosh-server.cc0000664000175000017500000007370014272621034014604 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include "config.h" #include "version.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_UTEMPTER #include #endif #ifdef HAVE_SYSLOG #include #endif #include #include #include #include #include #ifdef HAVE_UTMPX_H #include #endif #ifdef HAVE_PATHS_H #include #endif #if HAVE_PTY_H #include #elif HAVE_UTIL_H #include #endif #if FORKPTY_IN_LIBUTIL #include #endif #include "completeterminal.h" #include "swrite.h" #include "user.h" #include "fatal_assert.h" #include "locale_utils.h" #include "pty_compat.h" #include "select.h" #include "timestamp.h" #include "fatal_assert.h" #ifndef _PATH_BSHELL #define _PATH_BSHELL "/bin/sh" #endif #include "networktransport-impl.h" typedef Network::Transport< Terminal::Complete, Network::UserStream > ServerConnection; static void serve( int host_fd, Terminal::Complete &terminal, ServerConnection &network, long network_timeout, long network_signaled_timeout ); static int run_server( const char *desired_ip, const char *desired_port, const string &command_path, char *command_argv[], const int colors, unsigned int verbose, bool with_motd ); static void print_version( FILE *file ) { fputs( "mosh-server (" PACKAGE_STRING ") [build " BUILD_VERSION "]\n" "Copyright 2012 Keith Winstein \n" "License GPLv3+: GNU GPL version 3 or later .\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n", file ); } static void print_usage( FILE *stream, const char *argv0 ) { fprintf( stream, "Usage: %s new [-s] [-v] [-i LOCALADDR] [-p PORT[:PORT2]] [-c COLORS] [-l NAME=VALUE] [-- COMMAND...]\n", argv0 ); } static bool print_motd( const char *filename ); static void chdir_homedir( void ); static bool motd_hushed( void ); static void warn_unattached( const string & ignore_entry ); /* Simple spinloop */ static void spin( void ) { static unsigned int spincount = 0; spincount++; if ( spincount > 10 ) { struct timespec req; req.tv_sec = 0; req.tv_nsec = 100000000; /* 0.1 sec */ nanosleep( &req, NULL ); freeze_timestamp(); } } static string get_SSH_IP( void ) { const char *SSH_CONNECTION = getenv( "SSH_CONNECTION" ); if ( !SSH_CONNECTION ) { /* Older sshds don't set this */ fputs( "Warning: SSH_CONNECTION not found; binding to any interface.\n", stderr ); return string( "" ); } std::istringstream ss( SSH_CONNECTION ); string dummy, local_interface_IP; ss >> dummy >> dummy >> local_interface_IP; if ( !ss ) { fputs( "Warning: Could not parse SSH_CONNECTION; binding to any interface.\n", stderr ); return string( "" ); } /* Strip IPv6 prefix. */ const char IPv6_prefix[] = "::ffff:"; if ( ( local_interface_IP.length() > strlen( IPv6_prefix ) ) && ( 0 == strncasecmp( local_interface_IP.c_str(), IPv6_prefix, strlen( IPv6_prefix ) ) ) ) { return local_interface_IP.substr( strlen( IPv6_prefix ) ); } return local_interface_IP; } int main( int argc, char *argv[] ) { /* For security, make sure we don't dump core */ Crypto::disable_dumping_core(); /* Detect edge case */ fatal_assert( argc > 0 ); const char *desired_ip = NULL; string desired_ip_str; const char *desired_port = NULL; string command_path; char **command_argv = NULL; int colors = 0; unsigned int verbose = 0; /* don't close stdin/stdout/stderr */ /* Will cause mosh-server not to correctly detach on old versions of sshd. */ list locale_vars; /* strip off command */ for ( int i = 1; i < argc; i++ ) { if ( 0 == strcmp( argv[ i ], "--help" ) || 0 == strcmp( argv[ i ], "-h" ) ) { print_usage( stdout, argv[ 0 ] ); exit( 0 ); } if ( 0 == strcmp( argv[ i ], "--version" ) ) { print_version( stdout ); exit( 0 ); } if ( 0 == strcmp( argv[ i ], "--" ) ) { /* -- is mandatory */ if ( i != argc - 1 ) { command_argv = argv + i + 1; } argc = i; /* rest of options before -- */ break; } } /* Parse new command-line syntax */ if ( (argc >= 2) && (strcmp( argv[ 1 ], "new" ) == 0) ) { /* new option syntax */ int opt; while ( (opt = getopt( argc - 1, argv + 1, "@:i:p:c:svl:" )) != -1 ) { switch ( opt ) { /* * This undocumented option does nothing but eat its argument. * Useful in scripting where you prepend something to a * mosh-server argv, and might end up with something like * "mosh-server new -v new -c 256", now you can say * "mosh-server new -v -@ new -c 256" to discard the second * "new". */ case '@': break; case 'i': desired_ip = optarg; break; case 'p': desired_port = optarg; break; case 's': desired_ip = NULL; desired_ip_str = get_SSH_IP(); if ( !desired_ip_str.empty() ) { desired_ip = desired_ip_str.c_str(); fatal_assert( desired_ip ); } break; case 'c': try { colors = myatoi( optarg ); } catch ( const CryptoException & ) { fprintf( stderr, "%s: Bad number of colors (%s)\n", argv[ 0 ], optarg ); print_usage( stderr, argv[ 0 ] ); exit( 1 ); } break; case 'v': verbose++; break; case 'l': locale_vars.push_back( string( optarg ) ); break; default: /* don't die on unknown options */ print_usage( stderr, argv[ 0 ] ); break; } } } else if ( argc == 1 ) { /* legacy argument parsing for older client wrapper script */ /* do nothing */ } else if ( argc == 2 ) { desired_ip = argv[ 1 ]; } else if ( argc == 3 ) { desired_ip = argv[ 1 ]; desired_port = argv[ 2 ]; } else { print_usage( stderr, argv[ 0 ] ); exit( 1 ); } /* Sanity-check arguments */ int dpl, dph; if ( desired_port && ! Connection::parse_portrange( desired_port, dpl, dph ) ) { fprintf( stderr, "%s: Bad UDP port range (%s)\n", argv[ 0 ], desired_port ); print_usage( stderr, argv[ 0 ] ); exit( 1 ); } bool with_motd = false; #ifdef HAVE_SYSLOG openlog(argv[0], LOG_PID | LOG_NDELAY, LOG_AUTH); #endif /* Get shell */ char *my_argv[ 2 ]; string shell_name; if ( !command_argv ) { /* get shell name */ const char *shell = getenv( "SHELL" ); if ( shell == NULL ) { struct passwd *pw = getpwuid( getuid() ); if ( pw == NULL ) { perror( "getpwuid" ); exit( 1 ); } shell = pw->pw_shell; } string shell_path( shell ); if ( shell_path.empty() ) { /* empty shell means Bourne shell */ shell_path = _PATH_BSHELL; } command_path = shell_path; size_t shell_slash( shell_path.rfind('/') ); if ( shell_slash == string::npos ) { shell_name = shell_path; } else { shell_name = shell_path.substr(shell_slash + 1); } /* prepend '-' to make login shell */ shell_name = '-' + shell_name; my_argv[ 0 ] = const_cast( shell_name.c_str() ); my_argv[ 1 ] = NULL; command_argv = my_argv; with_motd = true; } if ( command_path.empty() ) { command_path = command_argv[0]; } /* Adopt implementation locale */ set_native_locale(); if ( !is_utf8_locale() ) { /* save details for diagnostic */ LocaleVar native_ctype = get_ctype(); string native_charset( locale_charset() ); /* apply locale-related environment variables from client */ clear_locale_variables(); for ( list::const_iterator i = locale_vars.begin(); i != locale_vars.end(); i++ ) { char *env_string = strdup( i->c_str() ); fatal_assert( env_string ); if ( 0 != putenv( env_string ) ) { perror( "putenv" ); } } /* check again */ set_native_locale(); if ( !is_utf8_locale() ) { LocaleVar client_ctype = get_ctype(); string client_charset( locale_charset() ); fprintf( stderr, "mosh-server needs a UTF-8 native locale to run.\n\n" "Unfortunately, the local environment (%s) specifies\n" "the character set \"%s\",\n\n" "The client-supplied environment (%s) specifies\n" "the character set \"%s\".\n\n", native_ctype.str().c_str(), native_charset.c_str(), client_ctype.str().c_str(), client_charset.c_str() ); int unused __attribute((unused)) = system( "locale" ); exit( 1 ); } } try { return run_server( desired_ip, desired_port, command_path, command_argv, colors, verbose, with_motd ); } catch ( const Network::NetworkException &e ) { fprintf( stderr, "Network exception: %s\n", e.what() ); return 1; } catch ( const Crypto::CryptoException &e ) { fprintf( stderr, "Crypto exception: %s\n", e.what() ); return 1; } } static int run_server( const char *desired_ip, const char *desired_port, const string &command_path, char *command_argv[], const int colors, unsigned int verbose, bool with_motd ) { /* get network idle timeout */ long network_timeout = 0; char *timeout_envar = getenv( "MOSH_SERVER_NETWORK_TMOUT" ); if ( timeout_envar && *timeout_envar ) { errno = 0; char *endptr; network_timeout = strtol( timeout_envar, &endptr, 10 ); if ( *endptr != '\0' || ( network_timeout == 0 && errno == EINVAL ) ) { fputs( "MOSH_SERVER_NETWORK_TMOUT not a valid integer, ignoring\n", stderr ); } else if ( network_timeout < 0 ) { fputs( "MOSH_SERVER_NETWORK_TMOUT is negative, ignoring\n", stderr ); network_timeout = 0; } } /* get network signaled idle timeout */ long network_signaled_timeout = 0; char *signal_envar = getenv( "MOSH_SERVER_SIGNAL_TMOUT" ); if ( signal_envar && *signal_envar ) { errno = 0; char *endptr; network_signaled_timeout = strtol( signal_envar, &endptr, 10 ); if ( *endptr != '\0' || ( network_signaled_timeout == 0 && errno == EINVAL ) ) { fputs( "MOSH_SERVER_SIGNAL_TMOUT not a valid integer, ignoring\n", stderr ); } else if ( network_signaled_timeout < 0 ) { fputs( "MOSH_SERVER_SIGNAL_TMOUT is negative, ignoring\n", stderr ); network_signaled_timeout = 0; } } /* get initial window size */ struct winsize window_size; if ( ioctl( STDIN_FILENO, TIOCGWINSZ, &window_size ) < 0 || window_size.ws_col == 0 || window_size.ws_row == 0 ) { /* Fill in sensible defaults. */ /* They will be overwritten by client on first connection. */ memset( &window_size, 0, sizeof( window_size ) ); window_size.ws_col = 80; window_size.ws_row = 24; } /* open parser and terminal */ Terminal::Complete terminal( window_size.ws_col, window_size.ws_row ); /* open network */ Network::UserStream blank; typedef shared::shared_ptr NetworkPointer; NetworkPointer network( new ServerConnection( terminal, blank, desired_ip, desired_port ) ); network->set_verbose( verbose ); Select::set_verbose( verbose ); /* * If mosh-server is run on a pty, then typeahead may echo and break mosh.pl's * detection of the MOSH CONNECT message. Print it on a new line to bodge * around that. */ if ( isatty( STDIN_FILENO ) ) { puts( "\r\n" ); } printf( "MOSH CONNECT %s %s\n", network->port().c_str(), network->get_key().c_str() ); /* don't let signals kill us */ struct sigaction sa; sa.sa_handler = SIG_IGN; sa.sa_flags = 0; fatal_assert( 0 == sigfillset( &sa.sa_mask ) ); fatal_assert( 0 == sigaction( SIGHUP, &sa, NULL ) ); fatal_assert( 0 == sigaction( SIGPIPE, &sa, NULL ) ); /* detach from terminal */ fflush( NULL ); pid_t the_pid = fork(); if ( the_pid < 0 ) { perror( "fork" ); } else if ( the_pid > 0 ) { fputs( "\nmosh-server (" PACKAGE_STRING ") [build " BUILD_VERSION "]\n" "Copyright 2012 Keith Winstein \n" "License GPLv3+: GNU GPL version 3 or later .\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n\n", stderr ); fprintf( stderr, "[mosh-server detached, pid = %d]\n", static_cast(the_pid) ); #ifndef HAVE_IUTF8 fputs( "\nWarning: termios IUTF8 flag not defined.\n" "Character-erase of multibyte character sequence\n" "probably does not work properly on this platform.\n", stderr ); #endif /* HAVE_IUTF8 */ fflush( NULL ); if ( isatty( STDOUT_FILENO ) ) { tcdrain( STDOUT_FILENO ); } if ( isatty( STDERR_FILENO ) ) { tcdrain( STDERR_FILENO ); } exit( 0 ); } int master; /* close file descriptors */ if ( verbose == 0 ) { /* Necessary to properly detach on old versions of sshd (e.g. RHEL/CentOS 5.0). */ int nullfd; nullfd = open( "/dev/null", O_RDWR ); if ( nullfd == -1 ) { perror( "open" ); exit( 1 ); } if ( dup2 ( nullfd, STDIN_FILENO ) < 0 || dup2 ( nullfd, STDOUT_FILENO ) < 0 || dup2 ( nullfd, STDERR_FILENO ) < 0 ) { perror( "dup2" ); exit( 1 ); } if ( close( nullfd ) < 0 ) { perror( "close" ); exit( 1 ); } } char utmp_entry[ 64 ] = { 0 }; snprintf( utmp_entry, 64, "mosh [%ld]", static_cast( getpid() ) ); /* Fork child process */ pid_t child = forkpty( &master, NULL, NULL, &window_size ); if ( child == -1 ) { perror( "forkpty" ); exit( 1 ); } if ( child == 0 ) { /* child */ /* reenable signals */ struct sigaction sa; sa.sa_handler = SIG_DFL; sa.sa_flags = 0; fatal_assert( 0 == sigfillset( &sa.sa_mask ) ); fatal_assert( 0 == sigaction( SIGHUP, &sa, NULL ) ); fatal_assert( 0 == sigaction( SIGPIPE, &sa, NULL ) ); #ifdef HAVE_SYSLOG closelog(); #endif /* close server-related file descriptors */ network.reset(); /* set IUTF8 if available */ #ifdef HAVE_IUTF8 struct termios child_termios; if ( tcgetattr( STDIN_FILENO, &child_termios ) < 0 ) { perror( "tcgetattr" ); exit( 1 ); } child_termios.c_iflag |= IUTF8; if ( tcsetattr( STDIN_FILENO, TCSANOW, &child_termios ) < 0 ) { perror( "tcsetattr" ); exit( 1 ); } #endif /* HAVE_IUTF8 */ /* set TERM */ const char default_term[] = "xterm"; const char color_term[] = "xterm-256color"; if ( setenv( "TERM", (colors == 256) ? color_term : default_term, true ) < 0 ) { perror( "setenv" ); exit( 1 ); } /* ask ncurses to send UTF-8 instead of ISO 2022 for line-drawing chars */ if ( setenv( "NCURSES_NO_UTF8_ACS", "1", true ) < 0 ) { perror( "setenv" ); exit( 1 ); } /* clear STY environment variable so GNU screen regards us as top level */ if ( unsetenv( "STY" ) < 0 ) { perror( "unsetenv" ); exit( 1 ); } chdir_homedir(); if ( with_motd && (!motd_hushed()) ) { // On illumos motd is printed by /etc/profile. #ifndef __sun // For Ubuntu, try and print one of {,/var}/run/motd.dynamic. // This file is only updated when pam_motd is run, but when // mosh-server is run in the usual way with ssh via the script, // this always happens. // XXX Hackish knowledge of Ubuntu PAM configuration. // But this seems less awful than build-time detection with autoconf. if (!print_motd("/run/motd.dynamic")) { print_motd("/var/run/motd.dynamic"); } // Always print traditional /etc/motd. print_motd("/etc/motd"); #endif warn_unattached( utmp_entry ); } /* Wait for parent to release us. */ char linebuf[81]; if (fgets(linebuf, sizeof linebuf, stdin) == NULL) { err( 1, "parent signal" ); } Crypto::reenable_dumping_core(); if ( execvp( command_path.c_str(), command_argv ) < 0 ) { warn( "execvp: %s", command_path.c_str() ); sleep( 3 ); exit( 1 ); } } else { /* parent */ /* Drop unnecessary privileges */ #ifdef HAVE_PLEDGE /* OpenBSD pledge() syscall */ if ( pledge( "stdio inet tty", NULL )) { perror( "pledge() failed" ); exit( 1 ); } #endif #ifdef HAVE_UTEMPTER /* make utmp entry */ utempter_add_record( master, utmp_entry ); #endif try { serve( master, terminal, *network, network_timeout, network_signaled_timeout ); } catch ( const Network::NetworkException &e ) { fprintf( stderr, "Network exception: %s\n", e.what() ); } catch ( const Crypto::CryptoException &e ) { fprintf( stderr, "Crypto exception: %s\n", e.what() ); } #ifdef HAVE_UTEMPTER utempter_remove_record( master ); #endif if ( close( master ) < 0 ) { perror( "close" ); exit( 1 ); } } fputs( "\n[mosh-server is exiting.]\n", stdout ); return 0; } static void serve( int host_fd, Terminal::Complete &terminal, ServerConnection &network, long network_timeout, long network_signaled_timeout ) { /* scale timeouts */ const uint64_t network_timeout_ms = static_cast( network_timeout ) * 1000; const uint64_t network_signaled_timeout_ms = static_cast( network_signaled_timeout ) * 1000; /* prepare to poll for events */ Select &sel = Select::get_instance(); sel.add_signal( SIGTERM ); sel.add_signal( SIGINT ); sel.add_signal( SIGUSR1 ); uint64_t last_remote_num = network.get_remote_state_num(); #ifdef HAVE_UTEMPTER bool connected_utmp = false; #endif #if defined(HAVE_SYSLOG) || defined(HAVE_UTEMPTER) bool force_connection_change_evt = false; Addr saved_addr; socklen_t saved_addr_len = 0; #endif #ifdef HAVE_SYSLOG struct passwd *pw = getpwuid( getuid() ); if (pw == NULL) { throw NetworkException( std::string( "serve: getpwuid: " ) + strerror( errno ), 0 ); } syslog(LOG_INFO, "user %s session begin", pw->pw_name); #endif bool child_released = false; while ( true ) { try { static const uint64_t timeout_if_no_client = 60000; int timeout = INT_MAX; uint64_t now = Network::timestamp(); timeout = std::min( timeout, network.wait_time() ); timeout = std::min( timeout, terminal.wait_time( now ) ); if ( (!network.get_remote_state_num()) || network.shutdown_in_progress() ) { timeout = std::min( timeout, 5000 ); } /* * The server goes completely asleep if it has no remote peer. * We may want to wake up sooner. */ if ( network_timeout_ms ) { int64_t network_sleep = network_timeout_ms - ( now - network.get_latest_remote_state().timestamp ); if ( network_sleep < 0 ) { network_sleep = 0; } else if ( network_sleep > INT_MAX ) { /* 24 days might be too soon. That's OK. */ network_sleep = INT_MAX; } timeout = std::min( timeout, static_cast(network_sleep) ); } /* poll for events */ sel.clear_fds(); std::vector< int > fd_list( network.fds() ); assert( fd_list.size() == 1 ); /* servers don't hop */ int network_fd = fd_list.back(); sel.add_fd( network_fd ); if ( !network.shutdown_in_progress() ) { sel.add_fd( host_fd ); } int active_fds = sel.select( timeout ); if ( active_fds < 0 ) { perror( "select" ); break; } now = Network::timestamp(); uint64_t time_since_remote_state = now - network.get_latest_remote_state().timestamp; string terminal_to_host; if ( sel.read( network_fd ) ) { /* packet received from the network */ network.recv(); /* is new user input available for the terminal? */ if ( network.get_remote_state_num() != last_remote_num ) { last_remote_num = network.get_remote_state_num(); Network::UserStream us; us.apply_string( network.get_remote_diff() ); /* apply userstream to terminal */ for ( size_t i = 0; i < us.size(); i++ ) { const Parser::Action &action = us.get_action( i ); if ( typeid( action ) == typeid( Parser::Resize ) ) { /* apply only the last consecutive Resize action */ if ( i < us.size() - 1 ) { const Parser::Action &next = us.get_action( i + 1 ); if ( typeid( next ) == typeid( Parser::Resize ) ) { continue; } } /* tell child process of resize */ const Parser::Resize &res = static_cast( action ); struct winsize window_size; if ( ioctl( host_fd, TIOCGWINSZ, &window_size ) < 0 ) { perror( "ioctl TIOCGWINSZ" ); network.start_shutdown(); } window_size.ws_col = res.width; window_size.ws_row = res.height; if ( ioctl( host_fd, TIOCSWINSZ, &window_size ) < 0 ) { perror( "ioctl TIOCSWINSZ" ); network.start_shutdown(); } } terminal_to_host += terminal.act( action ); } if ( !us.empty() ) { /* register input frame number for future echo ack */ terminal.register_input_frame( last_remote_num, now ); } /* update client with new state of terminal */ if ( !network.shutdown_in_progress() ) { network.set_current_state( terminal ); } #if defined(HAVE_SYSLOG) || defined(HAVE_UTEMPTER) #ifdef HAVE_UTEMPTER if (!connected_utmp) { force_connection_change_evt = true; } else { force_connection_change_evt = false; } #else force_connection_change_evt = false; #endif /** * - HAVE_UTEMPTER - update utmp entry if we have become "connected" * - HAVE_SYSLOG - log connection information to syslog **/ if ( (force_connection_change_evt) || saved_addr_len != network.get_remote_addr_len() || memcmp( &saved_addr, &network.get_remote_addr(), saved_addr_len ) != 0 ) { saved_addr = network.get_remote_addr(); saved_addr_len = network.get_remote_addr_len(); char host[ NI_MAXHOST ]; int errcode = getnameinfo( &saved_addr.sa, saved_addr_len, host, sizeof( host ), NULL, 0, NI_NUMERICHOST ); if ( errcode != 0 ) { throw NetworkException( std::string( "serve: getnameinfo: " ) + gai_strerror( errcode ), 0 ); } #ifdef HAVE_UTEMPTER utempter_remove_record( host_fd ); char tmp[ 64 + NI_MAXHOST ]; snprintf( tmp, 64 + NI_MAXHOST, "%s via mosh [%ld]", host, static_cast( getpid() ) ); utempter_add_record( host_fd, tmp ); connected_utmp = true; #endif #ifdef HAVE_SYSLOG syslog(LOG_INFO, "user %s connected from host: %s", pw->pw_name, host); #endif } #endif /* Tell child to start login session. */ if ( !child_released ) { if ( swrite( host_fd, "\n", 1 ) < 0) { err( 1, "child release" ); } child_released = true; } } } if ( (!network.shutdown_in_progress()) && sel.read( host_fd ) ) { /* input from the host needs to be fed to the terminal */ const int buf_size = 16384; char buf[ buf_size ]; /* fill buffer if possible */ ssize_t bytes_read = read( host_fd, buf, buf_size ); /* If the pty slave is closed, reading from the master can fail with EIO (see #264). So we treat errors on read() like EOF. */ if ( bytes_read <= 0 ) { network.start_shutdown(); } else { terminal_to_host += terminal.act( string( buf, bytes_read ) ); /* update client with new state of terminal */ network.set_current_state( terminal ); } } /* write user input and terminal writeback to the host */ if ( swrite( host_fd, terminal_to_host.c_str(), terminal_to_host.length() ) < 0 ) { network.start_shutdown(); } bool idle_shutdown = false; if ( network_timeout_ms && network_timeout_ms <= time_since_remote_state ) { idle_shutdown = true; fprintf( stderr, "Network idle for %llu seconds.\n", static_cast( time_since_remote_state / 1000 ) ); } if ( sel.signal( SIGUSR1 ) && ( !network_signaled_timeout_ms || network_signaled_timeout_ms <= time_since_remote_state ) ) { idle_shutdown = true; fprintf( stderr, "Network idle for %llu seconds when SIGUSR1 received\n", static_cast( time_since_remote_state / 1000 ) ); } if ( sel.any_signal() || idle_shutdown ) { /* shutdown signal */ if ( network.has_remote_addr() && (!network.shutdown_in_progress()) ) { network.start_shutdown(); } else { break; } } /* quit if our shutdown has been acknowledged */ if ( network.shutdown_in_progress() && network.shutdown_acknowledged() ) { break; } /* quit after shutdown acknowledgement timeout */ if ( network.shutdown_in_progress() && network.shutdown_ack_timed_out() ) { break; } /* quit if we received and acknowledged a shutdown request */ if ( network.counterparty_shutdown_ack_sent() ) { break; } #ifdef HAVE_UTEMPTER /* update utmp if has been more than 30 seconds since heard from client */ if ( connected_utmp && time_since_remote_state > 30000 ) { utempter_remove_record( host_fd ); char tmp[ 64 ]; snprintf( tmp, 64, "mosh [%ld]", static_cast( getpid() ) ); utempter_add_record( host_fd, tmp ); connected_utmp = false; } #endif if ( terminal.set_echo_ack( now ) && !network.shutdown_in_progress() ) { /* update client with new echo ack */ network.set_current_state( terminal ); } if ( !network.get_remote_state_num() && time_since_remote_state >= timeout_if_no_client ) { fprintf( stderr, "No connection within %llu seconds.\n", static_cast( timeout_if_no_client / 1000 ) ); break; } network.tick(); } catch ( const Network::NetworkException &e ) { fprintf( stderr, "%s\n", e.what() ); spin(); } catch ( const Crypto::CryptoException &e ) { if ( e.fatal ) { throw; } else { fprintf( stderr, "Crypto exception: %s\n", e.what() ); } } } #ifdef HAVE_SYSLOG syslog(LOG_INFO, "user %s session end", pw->pw_name); #endif } /* Print the motd from a given file, if available */ static bool print_motd( const char *filename ) { FILE *motd = fopen( filename, "r" ); if ( !motd ) { return false; } const int BUFSIZE = 256; char buffer[ BUFSIZE ]; while ( 1 ) { size_t bytes_read = fread( buffer, 1, BUFSIZE, motd ); if ( bytes_read == 0 ) { break; /* don't report error */ } size_t bytes_written = fwrite( buffer, 1, bytes_read, stdout ); if ( bytes_written == 0 ) { break; } } fclose( motd ); return true; } static void chdir_homedir( void ) { const char *home = getenv( "HOME" ); if ( home == NULL ) { struct passwd *pw = getpwuid( getuid() ); if ( pw == NULL ) { perror( "getpwuid" ); return; /* non-fatal */ } home = pw->pw_dir; } if ( chdir( home ) < 0 ) { perror( "chdir" ); } if ( setenv( "PWD", home, 1 ) < 0 ) { perror( "setenv" ); } } static bool motd_hushed( void ) { /* must be in home directory already */ struct stat buf; return 0 == lstat( ".hushlogin", &buf ); } #ifdef HAVE_UTMPX_H static bool device_exists( const char *ut_line ) { string device_name = string( "/dev/" ) + string( ut_line ); struct stat buf; return 0 == lstat( device_name.c_str(), &buf ); } #endif static void warn_unattached( const string & ignore_entry ) { #ifdef HAVE_UTMPX_H /* get username */ const struct passwd *pw = getpwuid( getuid() ); if ( pw == NULL ) { perror( "getpwuid" ); /* non-fatal */ return; } const string username( pw->pw_name ); /* look for unattached sessions */ vector< string > unattached_mosh_servers; while ( struct utmpx *entry = getutxent() ) { if ( (entry->ut_type == USER_PROCESS) && (username == string( entry->ut_user )) ) { /* does line show unattached mosh session */ string text( entry->ut_host ); if ( (text.size() >= 5) && (text.substr( 0, 5 ) == "mosh ") && (text[ text.size() - 1 ] == ']') && (text != ignore_entry) && device_exists( entry->ut_line ) ) { unattached_mosh_servers.push_back( text ); } } } /* print out warning if necessary */ if ( unattached_mosh_servers.empty() ) { return; } else if ( unattached_mosh_servers.size() == 1 ) { printf( "\033[37;44mMosh: You have a detached Mosh session on this server (%s).\033[m\n\n", unattached_mosh_servers.front().c_str() ); } else { string pid_string; for ( vector< string >::const_iterator it = unattached_mosh_servers.begin(); it != unattached_mosh_servers.end(); it++ ) { pid_string += " - " + *it + "\n"; } printf( "\033[37;44mMosh: You have %d detached Mosh sessions on this server, with PIDs:\n%s\033[m\n", (int)unattached_mosh_servers.size(), pid_string.c_str() ); } #endif /* HAVE_UTMPX_H */ } mosh-1.4.0/src/frontend/mosh-client.cc0000664000175000017500000001366014174450057014561 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include "config.h" #include "version.h" #include #include #include "stmclient.h" #include "crypto.h" #include "locale_utils.h" #include "fatal_assert.h" /* These need to be included last because of conflicting defines. */ /* * stmclient.h includes termios.h, and that will break termio/termios pull in on Solaris. * The solution is to include termio.h also. * But Mac OS X doesn't have termio.h, so this needs a guard. */ #ifdef HAVE_TERMIO_H #include #endif #if defined HAVE_NCURSESW_CURSES_H # include # include #elif defined HAVE_NCURSESW_H # include # include #elif defined HAVE_NCURSES_CURSES_H # include # include #elif defined HAVE_NCURSES_H # include # include #elif defined HAVE_CURSES_H # include # include #else # error "SysV or X/Open-compatible Curses header file required" #endif static void print_version( FILE *file ) { fputs( "mosh-client (" PACKAGE_STRING ") [build " BUILD_VERSION "]\n" "Copyright 2012 Keith Winstein \n" "License GPLv3+: GNU GPL version 3 or later .\n" "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n", file ); } static void print_usage( FILE *file, const char *argv0 ) { print_version( file ); fprintf( file, "\nUsage: %s [-# 'ARGS'] IP PORT\n" " %s -c\n", argv0, argv0 ); } static void print_colorcount( void ) { /* check colors */ setupterm((char *)0, 1, (int *)0); char colors_name[] = "colors"; int color_val = tigetnum( colors_name ); if ( color_val == -2 ) { fprintf( stderr, "Invalid terminfo numeric capability: %s\n", colors_name ); } printf( "%d\n", color_val ); } #ifdef NACL int mosh_main( int argc, char *argv[] ) #else int main( int argc, char *argv[] ) #endif { unsigned int verbose = 0; /* For security, make sure we don't dump core */ Crypto::disable_dumping_core(); /* Detect edge case */ fatal_assert( argc > 0 ); /* Get arguments */ for ( int i = 1; i < argc; i++ ) { if ( 0 == strcmp( argv[ i ], "--help" ) ) { print_usage( stdout, argv[ 0 ] ); exit( 0 ); } if ( 0 == strcmp( argv[ i ], "--version" ) ) { print_version( stdout ); exit( 0 ); } } int opt; while ( (opt = getopt( argc, argv, "#:cv" )) != -1 ) { switch ( opt ) { case '#': // Ignore the original arguments to mosh wrapper break; case 'c': print_colorcount(); exit( 0 ); break; case 'v': verbose++; break; default: print_usage( stderr, argv[ 0 ] ); exit( 1 ); break; } } char *ip, *desired_port; if ( argc - optind != 2 ) { print_usage( stderr, argv[ 0 ] ); exit( 1 ); } ip = argv[ optind ]; desired_port = argv[ optind + 1 ]; /* Sanity-check arguments */ if ( desired_port && ( strspn( desired_port, "0123456789" ) != strlen( desired_port ) ) ) { fprintf( stderr, "%s: Bad UDP port (%s)\n\n", argv[ 0 ], desired_port ); print_usage( stderr, argv[ 0 ] ); exit( 1 ); } /* Read key from environment */ char *env_key = getenv( "MOSH_KEY" ); if ( env_key == NULL ) { fputs( "MOSH_KEY environment variable not found.\n", stderr ); exit( 1 ); } /* Read prediction preference */ char *predict_mode = getenv( "MOSH_PREDICTION_DISPLAY" ); /* can be NULL */ /* Read prediction insertion preference */ char *predict_overwrite = getenv( "MOSH_PREDICTION_OVERWRITE" ); /* can be NULL */ string key( env_key ); if ( unsetenv( "MOSH_KEY" ) < 0 ) { perror( "unsetenv" ); exit( 1 ); } /* Adopt native locale */ set_native_locale(); bool success = false; try { STMClient client( ip, desired_port, key.c_str(), predict_mode, verbose, predict_overwrite ); client.init(); try { success = client.main(); } catch ( ... ) { client.shutdown(); throw; } client.shutdown(); } catch ( const Network::NetworkException &e ) { fprintf( stderr, "Network exception: %s\r\n", e.what() ); success = false; } catch ( const Crypto::CryptoException &e ) { fprintf( stderr, "Crypto exception: %s\r\n", e.what() ); success = false; } catch ( const std::exception &e ) { fprintf( stderr, "Error: %s\r\n", e.what() ); success = false; } printf( "[mosh is exiting.]\n" ); return !success; } mosh-1.4.0/src/protobufs/0000775000175000017500000000000014327736673012321 500000000000000mosh-1.4.0/src/protobufs/Makefile.in0000664000175000017500000004673614327736660014322 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 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)) 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 = : subdir = src/protobufs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ $(top_srcdir)/m4/ax_ac_print_to_file.m4 \ $(top_srcdir)/m4/ax_add_am_macro_static.m4 \ $(top_srcdir)/m4/ax_am_macros_static.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_gnu_make.m4 \ $(top_srcdir)/m4/ax_check_library.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_code_coverage.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ $(top_srcdir)/m4/ax_file_escapes.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 $(top_srcdir)/m4/pkg.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 = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) ARFLAGS = cru AM_V_AR = $(am__v_AR_@AM_V@) am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) am__v_AR_0 = @echo " AR " $@; am__v_AR_1 = libmoshprotos_a_AR = $(AR) $(ARFLAGS) libmoshprotos_a_LIBADD = am__objects_1 = am_libmoshprotos_a_OBJECTS = $(am__objects_1) am__objects_2 = userinput.pb.$(OBJEXT) hostinput.pb.$(OBJEXT) \ transportinstruction.pb.$(OBJEXT) nodist_libmoshprotos_a_OBJECTS = $(am__objects_2) $(am__objects_1) libmoshprotos_a_OBJECTS = $(am_libmoshprotos_a_OBJECTS) \ $(nodist_libmoshprotos_a_OBJECTS) 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)/src/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/hostinput.pb.Po \ ./$(DEPDIR)/transportinstruction.pb.Po \ ./$(DEPDIR)/userinput.pb.Po am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) am__v_CXX_0 = @echo " CXX " $@; am__v_CXX_1 = CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) am__v_CXXLD_0 = @echo " CXXLD " $@; am__v_CXXLD_1 = 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 = $(libmoshprotos_a_SOURCES) $(nodist_libmoshprotos_a_SOURCES) DIST_SOURCES = $(libmoshprotos_a_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@ CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@ CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@ CPPFLAGS = @CPPFLAGS@ CRYPTO_CFLAGS = @CRYPTO_CFLAGS@ CRYPTO_LIBS = @CRYPTO_LIBS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CURSES_LIB = @CURSES_LIB@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FUZZING_CFLAGS = @FUZZING_CFLAGS@ GCOV = @GCOV@ GENHTML = @GENHTML@ HARDEN_CFLAGS = @HARDEN_CFLAGS@ HARDEN_LDFLAGS = @HARDEN_LDFLAGS@ HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LCOV = @LCOV@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MISC_CXXFLAGS = @MISC_CXXFLAGS@ MKDIR_P = @MKDIR_P@ Nettle_CFLAGS = @Nettle_CFLAGS@ Nettle_LIBS = @Nettle_LIBS@ OBJEXT = @OBJEXT@ OpenSSL_CFLAGS = @OpenSSL_CFLAGS@ OpenSSL_LIBS = @OpenSSL_LIBS@ 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@ PICKY_CXXFLAGS = @PICKY_CXXFLAGS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROTOC = @PROTOC@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TINFO_CFLAGS = @TINFO_CFLAGS@ TINFO_CPPFLAGS = @TINFO_CPPFLAGS@ TINFO_LDFLAGS = @TINFO_LDFLAGS@ TINFO_LIBS = @TINFO_LIBS@ VERSION = @VERSION@ WARNING_CXXFLAGS = @WARNING_CXXFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ completions = @completions@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ ifGNUmake = @ifGNUmake@ ifnGNUmake = @ifnGNUmake@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ protobuf_CFLAGS = @protobuf_CFLAGS@ protobuf_LIBS = @protobuf_LIBS@ 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@ source = userinput.proto hostinput.proto transportinstruction.proto AM_CPPFLAGS = $(protobuf_CFLAGS) AM_CXXFLAGS = $(WARNING_CXXFLAGS) $(HARDEN_CFLAGS) $(MISC_CXXFLAGS) $(CODE_COVERAGE_CXXFLAGS) -Wno-error SUFFIXES = .proto .pb.cc noinst_LIBRARIES = libmoshprotos.a libmoshprotos_a_SOURCES = $(source) nodist_libmoshprotos_a_SOURCES = $(source:.proto=.pb.cc) $(source:.proto=.pb.h) BUILT_SOURCES = $(source:.proto=.pb.cc) CLEANFILES = $(source:.proto=.pb.cc) $(source:.proto=.pb.h) all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .proto .pb.cc .cc .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/protobufs/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/protobufs/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): clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libmoshprotos.a: $(libmoshprotos_a_OBJECTS) $(libmoshprotos_a_DEPENDENCIES) $(EXTRA_libmoshprotos_a_DEPENDENCIES) $(AM_V_at)-rm -f libmoshprotos.a $(AM_V_AR)$(libmoshprotos_a_AR) libmoshprotos.a $(libmoshprotos_a_OBJECTS) $(libmoshprotos_a_LIBADD) $(AM_V_at)$(RANLIB) libmoshprotos.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hostinput.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transportinstruction.pb.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/userinput.pb.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .cc.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -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: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(LIBRARIES) installdirs: install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) 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: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || 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." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/hostinput.pb.Po -rm -f ./$(DEPDIR)/transportinstruction.pb.Po -rm -f ./$(DEPDIR)/userinput.pb.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-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)/hostinput.pb.Po -rm -f ./$(DEPDIR)/transportinstruction.pb.Po -rm -f ./$(DEPDIR)/userinput.pb.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: .MAKE: all check install install-am install-exec install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-noinstLIBRARIES 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-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 \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile .proto.pb.cc: $(AM_V_GEN)$(PROTOC) --cpp_out=. -I$(srcdir) $< # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: mosh-1.4.0/src/protobufs/userinput.proto0000644000175000017500000000065013103401307015331 00000000000000syntax = "proto2"; option optimize_for = LITE_RUNTIME; package ClientBuffers; message UserMessage { repeated Instruction instruction = 1; } message Instruction { extensions 2 to max; } message Keystroke { optional bytes keys = 4; } message ResizeMessage { optional int32 width = 5; optional int32 height = 6; } extend Instruction { optional Keystroke keystroke = 2; optional ResizeMessage resize = 3; } mosh-1.4.0/src/protobufs/transportinstruction.proto0000644000175000017500000000052013103401307017625 00000000000000syntax = "proto2"; option optimize_for = LITE_RUNTIME; package TransportBuffers; message Instruction { optional uint32 protocol_version = 1; optional uint64 old_num = 2; optional uint64 new_num = 3; optional uint64 ack_num = 4; optional uint64 throwaway_num = 5; optional bytes diff = 6; optional bytes chaff = 7; } mosh-1.4.0/src/protobufs/Makefile.am0000664000175000017500000000104714272621034014256 00000000000000source = userinput.proto hostinput.proto transportinstruction.proto AM_CPPFLAGS = $(protobuf_CFLAGS) AM_CXXFLAGS = $(WARNING_CXXFLAGS) $(HARDEN_CFLAGS) $(MISC_CXXFLAGS) $(CODE_COVERAGE_CXXFLAGS) -Wno-error SUFFIXES = .proto .pb.cc .proto.pb.cc: $(AM_V_GEN)$(PROTOC) --cpp_out=. -I$(srcdir) $< noinst_LIBRARIES = libmoshprotos.a libmoshprotos_a_SOURCES = $(source) nodist_libmoshprotos_a_SOURCES = $(source:.proto=.pb.cc) $(source:.proto=.pb.h) BUILT_SOURCES = $(source:.proto=.pb.cc) CLEANFILES = $(source:.proto=.pb.cc) $(source:.proto=.pb.h) mosh-1.4.0/src/protobufs/hostinput.proto0000644000175000017500000000100513103401307015323 00000000000000syntax = "proto2"; option optimize_for = LITE_RUNTIME; package HostBuffers; message HostMessage { repeated Instruction instruction = 1; } message Instruction { extensions 2 to max; } message HostBytes { optional bytes hoststring = 4; } message ResizeMessage { optional int32 width = 5; optional int32 height = 6; } message EchoAck { optional uint64 echo_ack_num = 8; } extend Instruction { optional HostBytes hostbytes = 2; optional ResizeMessage resize = 3; optional EchoAck echoack = 7; } mosh-1.4.0/src/tests/0000775000175000017500000000000014327736673011440 500000000000000mosh-1.4.0/src/tests/is-utf8-locale.cc0000644000175000017500000000330713145365374014415 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include #include "locale_utils.h" int main( int argc __attribute__(( unused )), char **argv __attribute__(( unused ))) { set_native_locale(); if ( !is_utf8_locale() ) { fprintf( stderr, "not a UTF-8 locale\n" ); return 1; } return 0; } mosh-1.4.0/src/tests/inpty.cc0000644000175000017500000000704413103401307013003 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include "config.h" #include #include #include #include #include #include #include #include #include #if HAVE_PTY_H #include #elif HAVE_UTIL_H #include #endif #if FORKPTY_IN_LIBUTIL #include #endif #include "pty_compat.h" #include "swrite.h" int main( int argc, char *argv[] ) { if (argc < 2) { fprintf( stderr, "usage: inpty COMMAND [ARGS...]\n" ); return 1; } struct winsize winsize; memset( &winsize, 0, sizeof( winsize ) ); winsize.ws_col = 80; winsize.ws_row = 24; int saved_stderr = dup(STDERR_FILENO); if ( saved_stderr < 0 ) { perror( "dup" ); return 1; } int master; pid_t child = forkpty( &master, NULL, NULL, &winsize ); if ( child == -1 ) { perror( "forkpty" ); /* The Debian and Ubuntu build systems fail to set up a working * /dev/ptmx (https://bugs.debian.org/817236). There is not much * we can do about that except skip the test. In the future when * this is fixed, we should turn this into an failure. */ return 77; } else if ( child == 0 ) { if ( dup2( saved_stderr, STDERR_FILENO ) < 0 ) { perror( "dup2" ); exit( 1 ); } if ( close( saved_stderr ) < 0 ) { perror( "close" ); exit( 1 ); } if ( execvp( argv[1], argv + 1 ) < 0 ) { perror( "execve" ); exit( 1 ); } exit( 0 ); } while ( 1 ) { char buf[ 1024 ]; ssize_t bytes_read = read( master, buf, sizeof( buf ) ); if ( bytes_read == 0 || ( bytes_read < 0 && errno == EIO ) ) { /* EOF */ break; } else if ( bytes_read < 0 ) { perror( "read" ); return 1; } swrite( STDOUT_FILENO, buf, bytes_read ); } int wstatus; if ( waitpid( child, &wstatus, 0 ) < 0 ) { perror( "waitpid" ); return 1; } if ( WIFSIGNALED( wstatus ) ) { fprintf( stderr, "inpty: child exited with signal %d\n", WTERMSIG( wstatus ) ); raise( WTERMSIG( wstatus ) ); return -1; } else { return WIFEXITED( wstatus ) ? WEXITSTATUS( wstatus ) : -1; } } mosh-1.4.0/src/tests/Makefile.in0000664000175000017500000016111614327736660013427 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 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)) 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 = : check_PROGRAMS = ocb-aes$(EXEEXT) encrypt-decrypt$(EXEEXT) \ base64$(EXEEXT) nonce-incr$(EXEEXT) inpty$(EXEEXT) \ is-utf8-locale$(EXEEXT) TESTS = ocb-aes$(EXEEXT) encrypt-decrypt$(EXEEXT) base64$(EXEEXT) \ nonce-incr$(EXEEXT) local.test $(displaytests) subdir = src/tests ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ $(top_srcdir)/m4/ax_ac_print_to_file.m4 \ $(top_srcdir)/m4/ax_add_am_macro_static.m4 \ $(top_srcdir)/m4/ax_am_macros_static.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_gnu_make.m4 \ $(top_srcdir)/m4/ax_check_library.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_code_coverage.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ $(top_srcdir)/m4/ax_file_escapes.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 $(top_srcdir)/m4/pkg.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 = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am_base64_OBJECTS = base64-base64.$(OBJEXT) \ base64-base64_vector.$(OBJEXT) base64_OBJECTS = $(am_base64_OBJECTS) am__DEPENDENCIES_1 = am__DEPENDENCIES_2 = ../crypto/libmoshcrypto.a ../util/libmoshutil.a \ $(am__DEPENDENCIES_1) base64_DEPENDENCIES = $(am__DEPENDENCIES_2) am_encrypt_decrypt_OBJECTS = \ encrypt_decrypt-encrypt-decrypt.$(OBJEXT) \ encrypt_decrypt-test_utils.$(OBJEXT) encrypt_decrypt_OBJECTS = $(am_encrypt_decrypt_OBJECTS) encrypt_decrypt_DEPENDENCIES = ../crypto/libmoshcrypto.a \ ../util/libmoshutil.a $(am__DEPENDENCIES_1) am_inpty_OBJECTS = inpty-inpty.$(OBJEXT) inpty_OBJECTS = $(am_inpty_OBJECTS) inpty_DEPENDENCIES = ../util/libmoshutil.a am_is_utf8_locale_OBJECTS = is_utf8_locale-is-utf8-locale.$(OBJEXT) is_utf8_locale_OBJECTS = $(am_is_utf8_locale_OBJECTS) is_utf8_locale_DEPENDENCIES = ../util/libmoshutil.a am_nonce_incr_OBJECTS = nonce_incr-nonce-incr.$(OBJEXT) nonce_incr_OBJECTS = $(am_nonce_incr_OBJECTS) nonce_incr_DEPENDENCIES = ../network/libmoshnetwork.a \ ../crypto/libmoshcrypto.a ../util/libmoshutil.a \ $(am__DEPENDENCIES_1) am_ocb_aes_OBJECTS = ocb_aes-ocb-aes.$(OBJEXT) \ ocb_aes-test_utils.$(OBJEXT) ocb_aes_OBJECTS = $(am_ocb_aes_OBJECTS) ocb_aes_DEPENDENCIES = ../crypto/libmoshcrypto.a ../util/libmoshutil.a \ $(am__DEPENDENCIES_1) 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)/src/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/base64-base64.Po \ ./$(DEPDIR)/base64-base64_vector.Po \ ./$(DEPDIR)/encrypt_decrypt-encrypt-decrypt.Po \ ./$(DEPDIR)/encrypt_decrypt-test_utils.Po \ ./$(DEPDIR)/inpty-inpty.Po \ ./$(DEPDIR)/is_utf8_locale-is-utf8-locale.Po \ ./$(DEPDIR)/nonce_incr-nonce-incr.Po \ ./$(DEPDIR)/ocb_aes-ocb-aes.Po \ ./$(DEPDIR)/ocb_aes-test_utils.Po am__mv = mv -f AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) am__v_CXX_0 = @echo " CXX " $@; am__v_CXX_1 = CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) am__v_CXXLD_0 = @echo " CXXLD " $@; am__v_CXXLD_1 = 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 = $(base64_SOURCES) $(encrypt_decrypt_SOURCES) \ $(inpty_SOURCES) $(is_utf8_locale_SOURCES) \ $(nonce_incr_SOURCES) $(ocb_aes_SOURCES) DIST_SOURCES = $(base64_SOURCES) $(encrypt_decrypt_SOURCES) \ $(inpty_SOURCES) $(is_utf8_locale_SOURCES) \ $(nonce_incr_SOURCES) $(ocb_aes_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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__tty_colors_dummy = \ mgn= red= grn= lgn= blu= brg= std=; \ am__color_tests=no am__tty_colors = { \ $(am__tty_colors_dummy); \ if test "X$(AM_COLOR_TESTS)" = Xno; then \ am__color_tests=no; \ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ am__color_tests=yes; \ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ am__color_tests=yes; \ fi; \ if test $$am__color_tests = yes; then \ red=''; \ grn=''; \ lgn=''; \ blu=''; \ mgn=''; \ brg=''; \ std=''; \ fi; \ } 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 -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__recheck_rx = ^[ ]*:recheck:[ ]* am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* # A command that, given a newline-separated list of test names on the # standard input, print the name of the tests that are to be re-run # upon "make recheck". am__list_recheck_tests = $(AWK) '{ \ recheck = 1; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ { \ if ((getline line2 < ($$0 ".log")) < 0) \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ { \ recheck = 0; \ break; \ } \ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ { \ break; \ } \ }; \ if (recheck) \ print $$0; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # A command that, given a newline-separated list of test names on the # standard input, create the global log from their .trs and .log files. am__create_global_log = $(AWK) ' \ function fatal(msg) \ { \ print "fatal: making $@: " msg | "cat >&2"; \ exit 1; \ } \ function rst_section(header) \ { \ print header; \ len = length(header); \ for (i = 1; i <= len; i = i + 1) \ printf "="; \ printf "\n\n"; \ } \ { \ copy_in_global_log = 1; \ global_test_result = "RUN"; \ while ((rc = (getline line < ($$0 ".trs"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".trs"); \ if (line ~ /$(am__global_test_result_rx)/) \ { \ sub("$(am__global_test_result_rx)", "", line); \ sub("[ ]*$$", "", line); \ global_test_result = line; \ } \ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ copy_in_global_log = 0; \ }; \ if (copy_in_global_log) \ { \ rst_section(global_test_result ": " $$0); \ while ((rc = (getline line < ($$0 ".log"))) != 0) \ { \ if (rc < 0) \ fatal("failed to read from " $$0 ".log"); \ print line; \ }; \ printf "\n"; \ }; \ close ($$0 ".trs"); \ close ($$0 ".log"); \ }' # Restructured Text title. am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it # by disabling -e (using the XSI extension "set +e") if it's set. am__sh_e_setup = case $$- in *e*) set +e;; esac # Default flags passed to test drivers. am__common_driver_flags = \ --color-tests "$$am__color_tests" \ --enable-hard-errors "$$am__enable_hard_errors" \ --expect-failure "$$am__expect_failure" # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory # containing $f, in $tst the test, in $log the log. Executes the # developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and # passes TESTS_ENVIRONMENT. Set up options for the wrapper that # will run the test scripts (or their associated LOG_COMPILER, if # thy have one). am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ $(am__tty_colors); \ srcdir=$(srcdir); export srcdir; \ case "$@" in \ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ *) am__odir=.;; \ esac; \ test "x$$am__odir" = x"." || test -d "$$am__odir" \ || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; \ if test -n '$(DISABLE_HARD_ERRORS)'; then \ am__enable_hard_errors=no; \ else \ am__enable_hard_errors=yes; \ fi; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ am__expect_failure=yes;; \ *) \ am__expect_failure=no;; \ esac; \ $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) # A shell command to get the names of the tests scripts with any registered # extension removed (i.e., equivalently, the names of the test logs, with # the '.log' extension removed). The result is saved in the shell variable # '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, # we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", # since that might cause problem with VPATH rewrites for suffix-less tests. # See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)' RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck TEST_SUITE_LOG = test-suite.log TEST_EXTENSIONS = @EXEEXT@ .test LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) am__set_b = \ case '$@' in \ */*) \ case '$*' in \ */*) b='$*';; \ *) b=`echo '$@' | sed 's/\.log$$//'`; \ esac;; \ *) \ b='$*';; \ esac am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.test.log=.log) TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ $(TEST_LOG_FLAGS) am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ $(top_srcdir)/test-driver README.md DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@ CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@ CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@ CPPFLAGS = @CPPFLAGS@ CRYPTO_CFLAGS = @CRYPTO_CFLAGS@ CRYPTO_LIBS = @CRYPTO_LIBS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CURSES_LIB = @CURSES_LIB@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FUZZING_CFLAGS = @FUZZING_CFLAGS@ GCOV = @GCOV@ GENHTML = @GENHTML@ HARDEN_CFLAGS = @HARDEN_CFLAGS@ HARDEN_LDFLAGS = @HARDEN_LDFLAGS@ HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LCOV = @LCOV@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MISC_CXXFLAGS = @MISC_CXXFLAGS@ MKDIR_P = @MKDIR_P@ Nettle_CFLAGS = @Nettle_CFLAGS@ Nettle_LIBS = @Nettle_LIBS@ OBJEXT = @OBJEXT@ OpenSSL_CFLAGS = @OpenSSL_CFLAGS@ OpenSSL_LIBS = @OpenSSL_LIBS@ 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@ PICKY_CXXFLAGS = @PICKY_CXXFLAGS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROTOC = @PROTOC@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TINFO_CFLAGS = @TINFO_CFLAGS@ TINFO_CPPFLAGS = @TINFO_CPPFLAGS@ TINFO_LDFLAGS = @TINFO_LDFLAGS@ TINFO_LIBS = @TINFO_LIBS@ VERSION = @VERSION@ WARNING_CXXFLAGS = @WARNING_CXXFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ completions = @completions@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ ifGNUmake = @ifGNUmake@ ifnGNUmake = @ifnGNUmake@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ protobuf_CFLAGS = @protobuf_CFLAGS@ protobuf_LIBS = @protobuf_LIBS@ 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@ EXTRA_DIST = \ hold-stdin print-exitstatus \ e2e-test e2e-test-server \ e2e-test-subrs \ mosh-client mosh-server \ local.test \ $(displaytests) \ emulation-attributes.test AM_CXXFLAGS = $(WARNING_CXXFLAGS) $(PICKY_CXXFLAGS) $(HARDEN_CFLAGS) $(MISC_CXXFLAGS) $(CODE_COVERAGE_CXXFLAGS) AM_LDFLAGS = $(HARDEN_LDFLAGS) $(CODE_COVERAGE_LIBS) displaytests = \ e2e-success.test \ e2e-failure.test \ emulation-ascii-iso-8859.test \ emulation-80th-column.test \ emulation-attributes-vt100.test \ emulation-attributes-16color.test \ emulation-attributes-256color8.test \ emulation-attributes-256color248.test \ emulation-attributes-truecolor.test \ emulation-attributes-bce.test \ emulation-back-tab.test \ emulation-cursor-motion.test \ emulation-multiline-scroll.test \ emulation-scroll.test \ emulation-wrap-across-frames.test \ network-no-diff.test \ prediction-unicode.test \ pty-deadlock.test \ repeat.test \ repeat-with-input.test \ server-network-timeout.test \ server-signal-timeout.test \ window-resize.test \ unicode-combine-fallback-assert.test \ unicode-later-combining.test \ window-resize.test XFAIL_TESTS = \ e2e-failure.test \ emulation-attributes-256color8.test ocb_aes_SOURCES = ocb-aes.cc test_utils.cc test_utils.h ocb_aes_CPPFLAGS = -I$(srcdir)/../crypto -I$(srcdir)/../util $(CRYPTO_CFLAGS) ocb_aes_LDADD = ../crypto/libmoshcrypto.a ../util/libmoshutil.a $(CRYPTO_LIBS) encrypt_decrypt_SOURCES = encrypt-decrypt.cc test_utils.cc test_utils.h encrypt_decrypt_CPPFLAGS = -I$(srcdir)/../crypto -I$(srcdir)/../util encrypt_decrypt_LDADD = ../crypto/libmoshcrypto.a ../util/libmoshutil.a $(CRYPTO_LIBS) base64_SOURCES = base64.cc base64_vector.cc base64_vector.h genbase64.pl base64_CPPFLAGS = $(ocb_aes_CPPFLAGS) base64_LDADD = $(ocb_aes_LDADD) nonce_incr_SOURCES = nonce-incr.cc nonce_incr_CPPFLAGS = -I$(srcdir)/../network -I$(srcdir)/../crypto -I$(srcdir)/../util $(CRYPTO_CFLAGS) nonce_incr_LDADD = ../network/libmoshnetwork.a ../crypto/libmoshcrypto.a ../util/libmoshutil.a $(CRYPTO_LIBS) inpty_SOURCES = inpty.cc inpty_CPPFLAGS = -I$(srcdir)/../util inpty_LDADD = ../util/libmoshutil.a is_utf8_locale_SOURCES = is-utf8-locale.cc is_utf8_locale_CPPFLAGS = -I$(srcdir)/../util is_utf8_locale_LDADD = ../util/libmoshutil.a $(LIBUTIL) CLEANFILES = base64_vector.cc all: all-am .SUFFIXES: .SUFFIXES: .cc .log .o .obj .test .test$(EXEEXT) .trs $(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/tests/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/tests/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): clean-checkPROGRAMS: -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) base64$(EXEEXT): $(base64_OBJECTS) $(base64_DEPENDENCIES) $(EXTRA_base64_DEPENDENCIES) @rm -f base64$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(base64_OBJECTS) $(base64_LDADD) $(LIBS) encrypt-decrypt$(EXEEXT): $(encrypt_decrypt_OBJECTS) $(encrypt_decrypt_DEPENDENCIES) $(EXTRA_encrypt_decrypt_DEPENDENCIES) @rm -f encrypt-decrypt$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(encrypt_decrypt_OBJECTS) $(encrypt_decrypt_LDADD) $(LIBS) inpty$(EXEEXT): $(inpty_OBJECTS) $(inpty_DEPENDENCIES) $(EXTRA_inpty_DEPENDENCIES) @rm -f inpty$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(inpty_OBJECTS) $(inpty_LDADD) $(LIBS) is-utf8-locale$(EXEEXT): $(is_utf8_locale_OBJECTS) $(is_utf8_locale_DEPENDENCIES) $(EXTRA_is_utf8_locale_DEPENDENCIES) @rm -f is-utf8-locale$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(is_utf8_locale_OBJECTS) $(is_utf8_locale_LDADD) $(LIBS) nonce-incr$(EXEEXT): $(nonce_incr_OBJECTS) $(nonce_incr_DEPENDENCIES) $(EXTRA_nonce_incr_DEPENDENCIES) @rm -f nonce-incr$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(nonce_incr_OBJECTS) $(nonce_incr_LDADD) $(LIBS) ocb-aes$(EXEEXT): $(ocb_aes_OBJECTS) $(ocb_aes_DEPENDENCIES) $(EXTRA_ocb_aes_DEPENDENCIES) @rm -f ocb-aes$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(ocb_aes_OBJECTS) $(ocb_aes_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base64-base64.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base64-base64_vector.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encrypt_decrypt-encrypt-decrypt.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encrypt_decrypt-test_utils.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inpty-inpty.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/is_utf8_locale-is-utf8-locale.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nonce_incr-nonce-incr.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ocb_aes-ocb-aes.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ocb_aes-test_utils.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .cc.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` base64-base64.o: base64.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(base64_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT base64-base64.o -MD -MP -MF $(DEPDIR)/base64-base64.Tpo -c -o base64-base64.o `test -f 'base64.cc' || echo '$(srcdir)/'`base64.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/base64-base64.Tpo $(DEPDIR)/base64-base64.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='base64.cc' object='base64-base64.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(base64_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o base64-base64.o `test -f 'base64.cc' || echo '$(srcdir)/'`base64.cc base64-base64.obj: base64.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(base64_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT base64-base64.obj -MD -MP -MF $(DEPDIR)/base64-base64.Tpo -c -o base64-base64.obj `if test -f 'base64.cc'; then $(CYGPATH_W) 'base64.cc'; else $(CYGPATH_W) '$(srcdir)/base64.cc'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/base64-base64.Tpo $(DEPDIR)/base64-base64.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='base64.cc' object='base64-base64.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(base64_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o base64-base64.obj `if test -f 'base64.cc'; then $(CYGPATH_W) 'base64.cc'; else $(CYGPATH_W) '$(srcdir)/base64.cc'; fi` base64-base64_vector.o: base64_vector.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(base64_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT base64-base64_vector.o -MD -MP -MF $(DEPDIR)/base64-base64_vector.Tpo -c -o base64-base64_vector.o `test -f 'base64_vector.cc' || echo '$(srcdir)/'`base64_vector.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/base64-base64_vector.Tpo $(DEPDIR)/base64-base64_vector.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='base64_vector.cc' object='base64-base64_vector.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(base64_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o base64-base64_vector.o `test -f 'base64_vector.cc' || echo '$(srcdir)/'`base64_vector.cc base64-base64_vector.obj: base64_vector.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(base64_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT base64-base64_vector.obj -MD -MP -MF $(DEPDIR)/base64-base64_vector.Tpo -c -o base64-base64_vector.obj `if test -f 'base64_vector.cc'; then $(CYGPATH_W) 'base64_vector.cc'; else $(CYGPATH_W) '$(srcdir)/base64_vector.cc'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/base64-base64_vector.Tpo $(DEPDIR)/base64-base64_vector.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='base64_vector.cc' object='base64-base64_vector.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(base64_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o base64-base64_vector.obj `if test -f 'base64_vector.cc'; then $(CYGPATH_W) 'base64_vector.cc'; else $(CYGPATH_W) '$(srcdir)/base64_vector.cc'; fi` encrypt_decrypt-encrypt-decrypt.o: encrypt-decrypt.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(encrypt_decrypt_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT encrypt_decrypt-encrypt-decrypt.o -MD -MP -MF $(DEPDIR)/encrypt_decrypt-encrypt-decrypt.Tpo -c -o encrypt_decrypt-encrypt-decrypt.o `test -f 'encrypt-decrypt.cc' || echo '$(srcdir)/'`encrypt-decrypt.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/encrypt_decrypt-encrypt-decrypt.Tpo $(DEPDIR)/encrypt_decrypt-encrypt-decrypt.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='encrypt-decrypt.cc' object='encrypt_decrypt-encrypt-decrypt.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(encrypt_decrypt_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o encrypt_decrypt-encrypt-decrypt.o `test -f 'encrypt-decrypt.cc' || echo '$(srcdir)/'`encrypt-decrypt.cc encrypt_decrypt-encrypt-decrypt.obj: encrypt-decrypt.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(encrypt_decrypt_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT encrypt_decrypt-encrypt-decrypt.obj -MD -MP -MF $(DEPDIR)/encrypt_decrypt-encrypt-decrypt.Tpo -c -o encrypt_decrypt-encrypt-decrypt.obj `if test -f 'encrypt-decrypt.cc'; then $(CYGPATH_W) 'encrypt-decrypt.cc'; else $(CYGPATH_W) '$(srcdir)/encrypt-decrypt.cc'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/encrypt_decrypt-encrypt-decrypt.Tpo $(DEPDIR)/encrypt_decrypt-encrypt-decrypt.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='encrypt-decrypt.cc' object='encrypt_decrypt-encrypt-decrypt.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(encrypt_decrypt_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o encrypt_decrypt-encrypt-decrypt.obj `if test -f 'encrypt-decrypt.cc'; then $(CYGPATH_W) 'encrypt-decrypt.cc'; else $(CYGPATH_W) '$(srcdir)/encrypt-decrypt.cc'; fi` encrypt_decrypt-test_utils.o: test_utils.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(encrypt_decrypt_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT encrypt_decrypt-test_utils.o -MD -MP -MF $(DEPDIR)/encrypt_decrypt-test_utils.Tpo -c -o encrypt_decrypt-test_utils.o `test -f 'test_utils.cc' || echo '$(srcdir)/'`test_utils.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/encrypt_decrypt-test_utils.Tpo $(DEPDIR)/encrypt_decrypt-test_utils.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='test_utils.cc' object='encrypt_decrypt-test_utils.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(encrypt_decrypt_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o encrypt_decrypt-test_utils.o `test -f 'test_utils.cc' || echo '$(srcdir)/'`test_utils.cc encrypt_decrypt-test_utils.obj: test_utils.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(encrypt_decrypt_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT encrypt_decrypt-test_utils.obj -MD -MP -MF $(DEPDIR)/encrypt_decrypt-test_utils.Tpo -c -o encrypt_decrypt-test_utils.obj `if test -f 'test_utils.cc'; then $(CYGPATH_W) 'test_utils.cc'; else $(CYGPATH_W) '$(srcdir)/test_utils.cc'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/encrypt_decrypt-test_utils.Tpo $(DEPDIR)/encrypt_decrypt-test_utils.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='test_utils.cc' object='encrypt_decrypt-test_utils.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(encrypt_decrypt_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o encrypt_decrypt-test_utils.obj `if test -f 'test_utils.cc'; then $(CYGPATH_W) 'test_utils.cc'; else $(CYGPATH_W) '$(srcdir)/test_utils.cc'; fi` inpty-inpty.o: inpty.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(inpty_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT inpty-inpty.o -MD -MP -MF $(DEPDIR)/inpty-inpty.Tpo -c -o inpty-inpty.o `test -f 'inpty.cc' || echo '$(srcdir)/'`inpty.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/inpty-inpty.Tpo $(DEPDIR)/inpty-inpty.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='inpty.cc' object='inpty-inpty.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(inpty_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o inpty-inpty.o `test -f 'inpty.cc' || echo '$(srcdir)/'`inpty.cc inpty-inpty.obj: inpty.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(inpty_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT inpty-inpty.obj -MD -MP -MF $(DEPDIR)/inpty-inpty.Tpo -c -o inpty-inpty.obj `if test -f 'inpty.cc'; then $(CYGPATH_W) 'inpty.cc'; else $(CYGPATH_W) '$(srcdir)/inpty.cc'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/inpty-inpty.Tpo $(DEPDIR)/inpty-inpty.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='inpty.cc' object='inpty-inpty.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(inpty_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o inpty-inpty.obj `if test -f 'inpty.cc'; then $(CYGPATH_W) 'inpty.cc'; else $(CYGPATH_W) '$(srcdir)/inpty.cc'; fi` is_utf8_locale-is-utf8-locale.o: is-utf8-locale.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(is_utf8_locale_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT is_utf8_locale-is-utf8-locale.o -MD -MP -MF $(DEPDIR)/is_utf8_locale-is-utf8-locale.Tpo -c -o is_utf8_locale-is-utf8-locale.o `test -f 'is-utf8-locale.cc' || echo '$(srcdir)/'`is-utf8-locale.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/is_utf8_locale-is-utf8-locale.Tpo $(DEPDIR)/is_utf8_locale-is-utf8-locale.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='is-utf8-locale.cc' object='is_utf8_locale-is-utf8-locale.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(is_utf8_locale_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o is_utf8_locale-is-utf8-locale.o `test -f 'is-utf8-locale.cc' || echo '$(srcdir)/'`is-utf8-locale.cc is_utf8_locale-is-utf8-locale.obj: is-utf8-locale.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(is_utf8_locale_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT is_utf8_locale-is-utf8-locale.obj -MD -MP -MF $(DEPDIR)/is_utf8_locale-is-utf8-locale.Tpo -c -o is_utf8_locale-is-utf8-locale.obj `if test -f 'is-utf8-locale.cc'; then $(CYGPATH_W) 'is-utf8-locale.cc'; else $(CYGPATH_W) '$(srcdir)/is-utf8-locale.cc'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/is_utf8_locale-is-utf8-locale.Tpo $(DEPDIR)/is_utf8_locale-is-utf8-locale.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='is-utf8-locale.cc' object='is_utf8_locale-is-utf8-locale.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(is_utf8_locale_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o is_utf8_locale-is-utf8-locale.obj `if test -f 'is-utf8-locale.cc'; then $(CYGPATH_W) 'is-utf8-locale.cc'; else $(CYGPATH_W) '$(srcdir)/is-utf8-locale.cc'; fi` nonce_incr-nonce-incr.o: nonce-incr.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nonce_incr_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT nonce_incr-nonce-incr.o -MD -MP -MF $(DEPDIR)/nonce_incr-nonce-incr.Tpo -c -o nonce_incr-nonce-incr.o `test -f 'nonce-incr.cc' || echo '$(srcdir)/'`nonce-incr.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nonce_incr-nonce-incr.Tpo $(DEPDIR)/nonce_incr-nonce-incr.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='nonce-incr.cc' object='nonce_incr-nonce-incr.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nonce_incr_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nonce_incr-nonce-incr.o `test -f 'nonce-incr.cc' || echo '$(srcdir)/'`nonce-incr.cc nonce_incr-nonce-incr.obj: nonce-incr.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nonce_incr_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT nonce_incr-nonce-incr.obj -MD -MP -MF $(DEPDIR)/nonce_incr-nonce-incr.Tpo -c -o nonce_incr-nonce-incr.obj `if test -f 'nonce-incr.cc'; then $(CYGPATH_W) 'nonce-incr.cc'; else $(CYGPATH_W) '$(srcdir)/nonce-incr.cc'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nonce_incr-nonce-incr.Tpo $(DEPDIR)/nonce_incr-nonce-incr.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='nonce-incr.cc' object='nonce_incr-nonce-incr.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nonce_incr_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nonce_incr-nonce-incr.obj `if test -f 'nonce-incr.cc'; then $(CYGPATH_W) 'nonce-incr.cc'; else $(CYGPATH_W) '$(srcdir)/nonce-incr.cc'; fi` ocb_aes-ocb-aes.o: ocb-aes.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ocb_aes_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ocb_aes-ocb-aes.o -MD -MP -MF $(DEPDIR)/ocb_aes-ocb-aes.Tpo -c -o ocb_aes-ocb-aes.o `test -f 'ocb-aes.cc' || echo '$(srcdir)/'`ocb-aes.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ocb_aes-ocb-aes.Tpo $(DEPDIR)/ocb_aes-ocb-aes.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ocb-aes.cc' object='ocb_aes-ocb-aes.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ocb_aes_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ocb_aes-ocb-aes.o `test -f 'ocb-aes.cc' || echo '$(srcdir)/'`ocb-aes.cc ocb_aes-ocb-aes.obj: ocb-aes.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ocb_aes_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ocb_aes-ocb-aes.obj -MD -MP -MF $(DEPDIR)/ocb_aes-ocb-aes.Tpo -c -o ocb_aes-ocb-aes.obj `if test -f 'ocb-aes.cc'; then $(CYGPATH_W) 'ocb-aes.cc'; else $(CYGPATH_W) '$(srcdir)/ocb-aes.cc'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ocb_aes-ocb-aes.Tpo $(DEPDIR)/ocb_aes-ocb-aes.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ocb-aes.cc' object='ocb_aes-ocb-aes.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ocb_aes_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ocb_aes-ocb-aes.obj `if test -f 'ocb-aes.cc'; then $(CYGPATH_W) 'ocb-aes.cc'; else $(CYGPATH_W) '$(srcdir)/ocb-aes.cc'; fi` ocb_aes-test_utils.o: test_utils.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ocb_aes_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ocb_aes-test_utils.o -MD -MP -MF $(DEPDIR)/ocb_aes-test_utils.Tpo -c -o ocb_aes-test_utils.o `test -f 'test_utils.cc' || echo '$(srcdir)/'`test_utils.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ocb_aes-test_utils.Tpo $(DEPDIR)/ocb_aes-test_utils.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='test_utils.cc' object='ocb_aes-test_utils.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ocb_aes_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ocb_aes-test_utils.o `test -f 'test_utils.cc' || echo '$(srcdir)/'`test_utils.cc ocb_aes-test_utils.obj: test_utils.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ocb_aes_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ocb_aes-test_utils.obj -MD -MP -MF $(DEPDIR)/ocb_aes-test_utils.Tpo -c -o ocb_aes-test_utils.obj `if test -f 'test_utils.cc'; then $(CYGPATH_W) 'test_utils.cc'; else $(CYGPATH_W) '$(srcdir)/test_utils.cc'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ocb_aes-test_utils.Tpo $(DEPDIR)/ocb_aes-test_utils.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='test_utils.cc' object='ocb_aes-test_utils.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ocb_aes_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ocb_aes-test_utils.obj `if test -f 'test_utils.cc'; then $(CYGPATH_W) 'test_utils.cc'; else $(CYGPATH_W) '$(srcdir)/test_utils.cc'; fi` 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 # Recover from deleted '.trs' file; this should ensure that # "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create # both 'foo.log' and 'foo.trs'. Break the recipe in two subshells # to avoid problems with "make -n". .log.trs: rm -f $< $@ $(MAKE) $(AM_MAKEFLAGS) $< # Leading 'am--fnord' is there to ensure the list of targets does not # expand to empty, as could happen e.g. with make check TESTS=''. am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) am--force-recheck: @: $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__set_TESTS_bases); \ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ redo_bases=`for i in $$bases; do \ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ done`; \ if test -n "$$redo_bases"; then \ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ if $(am__make_dryrun); then :; else \ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ fi; \ fi; \ if test -n "$$am__remaking_logs"; then \ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ "recursion detected" >&2; \ elif test -n "$$redo_logs"; then \ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ fi; \ if $(am__make_dryrun); then :; else \ st=0; \ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ for i in $$redo_bases; do \ test -f $$i.trs && test -r $$i.trs \ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ test -f $$i.log && test -r $$i.log \ || { echo "$$errmsg $$i.log" >&2; st=1; }; \ done; \ test $$st -eq 0 || exit 1; \ fi @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ ws='[ ]'; \ results=`for b in $$bases; do echo $$b.trs; done`; \ test -n "$$results" || results=/dev/null; \ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ if test `expr $$fail + $$xpass + $$error` -eq 0; then \ success=true; \ else \ success=false; \ fi; \ br='==================='; br=$$br$$br$$br$$br; \ result_count () \ { \ if test x"$$1" = x"--maybe-color"; then \ maybe_colorize=yes; \ elif test x"$$1" = x"--no-color"; then \ maybe_colorize=no; \ else \ echo "$@: invalid 'result_count' usage" >&2; exit 4; \ fi; \ shift; \ desc=$$1 count=$$2; \ if test $$maybe_colorize = yes && test $$count -gt 0; then \ color_start=$$3 color_end=$$std; \ else \ color_start= color_end=; \ fi; \ echo "$${color_start}# $$desc $$count$${color_end}"; \ }; \ create_testsuite_report () \ { \ result_count $$1 "TOTAL:" $$all "$$brg"; \ result_count $$1 "PASS: " $$pass "$$grn"; \ result_count $$1 "SKIP: " $$skip "$$blu"; \ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ result_count $$1 "FAIL: " $$fail "$$red"; \ result_count $$1 "XPASS:" $$xpass "$$red"; \ result_count $$1 "ERROR:" $$error "$$mgn"; \ }; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ create_testsuite_report --no-color; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for b in $$bases; do echo $$b; done \ | $(am__create_global_log); \ } >$(TEST_SUITE_LOG).tmp || exit 1; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if $$success; then \ col="$$grn"; \ else \ col="$$red"; \ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ if $$success; then :; else \ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ fi; \ echo "$$col$$br$$std"; \ fi; \ $$success || exit 1 check-TESTS: $(check_PROGRAMS) @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ log_list=`for i in $$bases; do echo $$i.log; done`; \ trs_list=`for i in $$bases; do echo $$i.trs; done`; \ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ exit $$?; recheck: all $(check_PROGRAMS) @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @set +e; $(am__set_TESTS_bases); \ bases=`for i in $$bases; do echo $$i; done \ | $(am__list_recheck_tests)` || exit 1; \ log_list=`for i in $$bases; do echo $$i.log; done`; \ log_list=`echo $$log_list`; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ am__force_recheck=am--force-recheck \ TEST_LOGS="$$log_list"; \ exit $$? ocb-aes.log: ocb-aes$(EXEEXT) @p='ocb-aes$(EXEEXT)'; \ b='ocb-aes'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) encrypt-decrypt.log: encrypt-decrypt$(EXEEXT) @p='encrypt-decrypt$(EXEEXT)'; \ b='encrypt-decrypt'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) base64.log: base64$(EXEEXT) @p='base64$(EXEEXT)'; \ b='base64'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) nonce-incr.log: nonce-incr$(EXEEXT) @p='nonce-incr$(EXEEXT)'; \ b='nonce-incr'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) .test.log: @p='$<'; \ $(am__set_b); \ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) @am__EXEEXT_TRUE@.test$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; \ @am__EXEEXT_TRUE@ $(am__set_b); \ @am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ @am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) 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 $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile installdirs: 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: -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || 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-checkPROGRAMS clean-generic clean-local mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/base64-base64.Po -rm -f ./$(DEPDIR)/base64-base64_vector.Po -rm -f ./$(DEPDIR)/encrypt_decrypt-encrypt-decrypt.Po -rm -f ./$(DEPDIR)/encrypt_decrypt-test_utils.Po -rm -f ./$(DEPDIR)/inpty-inpty.Po -rm -f ./$(DEPDIR)/is_utf8_locale-is-utf8-locale.Po -rm -f ./$(DEPDIR)/nonce_incr-nonce-incr.Po -rm -f ./$(DEPDIR)/ocb_aes-ocb-aes.Po -rm -f ./$(DEPDIR)/ocb_aes-test_utils.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-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)/base64-base64.Po -rm -f ./$(DEPDIR)/base64-base64_vector.Po -rm -f ./$(DEPDIR)/encrypt_decrypt-encrypt-decrypt.Po -rm -f ./$(DEPDIR)/encrypt_decrypt-test_utils.Po -rm -f ./$(DEPDIR)/inpty-inpty.Po -rm -f ./$(DEPDIR)/is_utf8_locale-is-utf8-locale.Po -rm -f ./$(DEPDIR)/nonce_incr-nonce-incr.Po -rm -f ./$(DEPDIR)/ocb_aes-ocb-aes.Po -rm -f ./$(DEPDIR)/ocb_aes-test_utils.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: .MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \ check-am clean clean-checkPROGRAMS clean-generic clean-local \ 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-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 maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am recheck tags tags-am \ uninstall uninstall-am .PRECIOUS: Makefile base64_vector.cc: $(srcdir)/genbase64.pl $(AM_V_GEN)echo '#include "base64_vector.h"' > base64_vector.cc || rm base64_vector.cc $(AM_V_GEN)perl $(srcdir)/genbase64.pl >> base64_vector.cc || rm base64_vector.cc clean-local: clean-local-check .PHONY: clean-local-check clean-local-check: -for i in $(displaytests); do rm -rf $$i.d/; done # 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: mosh-1.4.0/src/tests/emulation-scroll.test0000755000175000017500000000310013145365374015536 00000000000000#!/bin/sh # # This is a regression test for a bug in Mosh: it would move the # cursor for the SCROLL UP and SCROLL DOWN commands, though it should # not. # # shellcheck source=e2e-test-subrs . "$(dirname "$0")/e2e-test-subrs" PATH=$PATH:.:$srcdir # Top-level wrapper. if [ $# -eq 0 ]; then e2e-test "$0" baseline post exit fi # OK, we have arguments, we're one of the test hooks. if [ $# -ne 1 ]; then fail "bad arguments %s\n" "$@" fi baseline() { # Clear printf '\033[H\033[J' # Fill with sample text for i in $(seq 1 24); do printf '\ntext %s' "$i" done # Scroll up 4 lines printf '\033[4S' # Then down 2 printf '\033[2T' # The cursor should not have moved and this should print on the # last line, and not overprint 'line 24' printf '\rBad line' # Overprint on line 24 printf '\033[24;1HLast line' # and line 1 printf '\033[HFirst line\n' } post() { local capture capture="$(basename "$0").d/baseline.capture" # 'Bad line' should have been overwritten if grep -q '^Bad line$' "$capture"; then exit 1 fi # The first four lines should have scrolled off if grep -q '^text [1-4]$' "$capture"; then exit 1 fi # The last line should not have scrolled off or been overwritten if ! grep -q '^text 24$' "$capture"; then exit 1 fi # 20 lines of the original text should remain if [ "$(grep -c '^text' "$capture")" -ne 20 ]; then exit 1 fi exit 0 } case $1 in baseline) baseline;; post) post;; *) fail "unknown test argument %s\n" "$1";; esac mosh-1.4.0/src/tests/e2e-failure.test0000755000175000017500000000071313103401307014331 00000000000000#!/bin/sh # shellcheck source=e2e-test-subrs . "$(dirname "$0")/e2e-test-subrs" PATH=$PATH:.:$srcdir # Top-level wrapper. if [ $# -eq 0 ]; then e2e-test "$0" baseline variant different exit fi # OK, we have arguments, we're one of the test hooks. if [ $# -ne 1 ]; then fail "bad arguments %s\n" "$@" fi baseline() { printf "\033[H\033[J" } case $1 in baseline|variant) baseline;; *) fail "unknown test argument %s\n" "$1";; esac mosh-1.4.0/src/tests/prediction-unicode.test0000755000175000017500000000465413103401307016025 00000000000000#!/bin/sh # # This is a regression test for a bug seen where mosh-client's # prediction code would sometimes show "gück" when "glück" was typed. # mosh-client would output a predicted Unicode input character # first as an 8-bit character containing the lowest 8 bits of the # Unicode code point, then redraw it correctly with its UTF-8 sequence # when the prediction is validated. For many accented Latin # characters, the 8-bit character is an illegal UTF-8 code sequence. # Most terminal emulators will output the Unicode replacement # character, which is only visible until validation. urxvt, however, # draws no character and does not change the cursor location on an # illegal UTF-8 sequence, causing this bug to be visible as ongoing # display corruption. A subset of wide characters (including CJK) # will show display corruption with all terminal emulators, because a # narrow replacement character will be drawn when a wide character # should have been. # # tmux draws a replacement character for invalid UTF-8, and we # depend on that in this test. # # Another similar failing case is typing "faĩl". In this case the "ĩ" # would be predicted as ")" before being replaced by the # correct character. # # shellcheck source=e2e-test-subrs . "$(dirname "$0")/e2e-test-subrs" PATH=$PATH:.:$srcdir # Top-level wrapper. if [ $# -eq 0 ]; then e2e-test "$0" tmux baseline mosh-args post exit fi tmux_commands() { for x in $(seq 1 5); do for y in $(seq 1 5); do for i in "gl" ü "ck fa" ĩ "l "; do printf "send-keys '%s'\n" "$i" sleepf done done printf "send-keys 0x0d\n" done printf "send-keys 0x0d\n" sleep 1 printf "send-keys 0x04\n" # Unreliable on Cygwin under load, it seems. sleep 1 printf "send-keys 0x04\n" # This will get killed by SIGPIPE. while printf "show-options\n" && sleep 1; do : done } tmux_stdin() { tmux_commands | "$@" exit } baseline() { # Just receive and toss input in canonical mode. cat > /dev/null } post() { # Look for bad output: ')' or \374 ( unset LC_ALL unset LC_CTYPE unset LANGUAGE ! env LANG=C egrep -q "%output %0 (\)|$(printf \\374))" "$(basename "$0").d/baseline.tmux.log" # Implicit exitcode return. ) return $? } case $1 in tmux) shift; tmux_stdin "$@";; baseline) baseline;; mosh-args) printf "%s\n" "--predict=always";; post) post;; *) fail "unknown test argument %s\n" "$1";; esac mosh-1.4.0/src/tests/emulation-attributes-vt100.test0000775000175000017500000000767114326375453017322 00000000000000#!/bin/sh # # This validates VT100, 16-color, 256-color and true color attributes # against tmux. It is not run directly, but as subtests based on the # executable's name for vt100, 16color, 256color8, 256color248 and # truecolor. # This is because Mosh internally represents the first 8 values of the # 256color space as though they were the 16-color values they are # equivalent to. tmux does not filter this out on its redisplay, so # compares on these values fail though they are visually identical. # # shellcheck source=e2e-test-subrs . "$(dirname "$0")/e2e-test-subrs" PATH=$PATH:.:$srcdir # Need 2.3 for true-color support (2.2 may work also) if [ "$(basename "$0")" = emulation-attributes-truecolor.test ] && ! tmux_check 2 3; then printf "tmux does not support true color\n" >&2 exit 77 fi # Need 2.4 for BCE support if [ "$(basename "$0")" = emulation-attributes-bce.test ] && ! tmux_check 2 4; then printf "tmux does not support BCE\n" >&2 exit 77 fi # tmux 3.3a has a behavior change in how BCE is handled, which has # been reverted: https://github.com/tmux/tmux/issues/3339 if [ "$(basename "$0")" = emulation-attributes-bce.test ] && tmux_check 3 3a && ! tmux_check 3 3b; then printf "tmux 3.3a has incompatible BCE behavior\n" >&2 exit 77 fi # Top-level wrapper. if [ $# -eq 0 ]; then e2e-test "$0" baseline direct verify exit fi # OK, we have arguments, we're one of the test hooks. if [ $# -ne 1 ]; then fail "bad arguments %s\n" "$@" fi test_true_color() { s=$(printf "\033[0") for i in $@; do s="$s;$i" done s="${s}m" for attr in $(seq 0 76); do r=$((255-(attr*255/76))) g=$((attr*510/76)) b=$((attr*255/76)) if [ $g -gt 255 ]; then g=$((510-g)) fi invr=$((255-r)) invg=$((255-g)) invb=$((255-b)) c="E" printf "%s" "$s" printf "\033[48;2;%d;%d;%dm" $r $g $b; printf "\033[38;2;%d;%d;%dm" $invr $invg $invb printf "%s\033[m" "$c" done printf "\n" } baseline() { # Strip our name to the last dash-separated word before the .test suffix. testname=$(basename "$1") testname=${testname%%.test} testname=${testname##*-} printf '\033[H\033[J' case $testname in # Traditional ancient VT100 attributes. vt100) for attr in 0 1 4 5 7; do printf '\033[%dmE\033[m ' $attr done ;; # 16-color attributes. 16color) for attr in $(seq 30 37) $(seq 39 47) 49; do printf '\033[%dmE\033[m ' "$attr" done ;; # First 8 256-color attributes. Comparing mosh and tmux fails. 256color8) for attr in $(seq 0 7); do printf '\033[38;5;%dmE\033[m ' "$attr" printf '\033[48;5;%dmM\033[m ' "$attr" done ;; # Last 248 256-color attributes. 256color248) for attr in $(seq 8 255); do printf '\033[38;5;%dmE\033[m ' "$attr" printf '\033[48;5;%dmM\033[m ' "$attr" done ;; # True color. # See https://gist.github.com/XVilka/8346728 for the test case truecolor) echo "Normal:" test_true_color echo "Bold:" test_true_color 1 echo "Italic:" test_true_color 3 echo "Underline:" test_true_color 4 echo "Blink:" test_true_color 5 echo "Inverse:" test_true_color 7 echo "Invisible:" test_true_color 8 echo "Bold, italic and underline:" test_true_color 1 3 4 ;; # BCE in combination with various color modes. bce) # True color. printf '\033[48;2;255;0;255m\033[H\033[JTrue color\n' printf '\033[48;5;32m\033[J256 color\n' printf '\033[42m\033[J16 color\n' printf '\033[0mdone\n' ;; *) fail "unknown test name %s\n" "$1" ;; esac printf '\033[mend\n' } case $1 in baseline|direct) baseline "$0";; *) fail "unknown test argument %s\n" "$1";; esac mosh-1.4.0/src/tests/nonce-incr.cc0000644000175000017500000000466613103401307013702 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ /* Tests that the Mosh network layer seems to be using unique nonces */ #include #include #include #include "network.h" int main() { std::set nonces; const unsigned int NUM_EXAMPLES = 1000000; for ( unsigned int i = 0; i < NUM_EXAMPLES; i++ ) { Network::Packet packet( Network::TO_CLIENT, 0, 0, "test" ); nonces.insert( packet.toMessage().nonce.val() ); } for ( unsigned int i = 0; i < NUM_EXAMPLES; i++ ) { Network::Packet packet( Network::TO_SERVER, 0, 0, "test" ); nonces.insert( packet.toMessage().nonce.val() ); } for ( unsigned int i = 0; i < NUM_EXAMPLES; i++ ) { { Network::Packet packet( Network::TO_SERVER, 0, 0, "test" ); nonces.insert( packet.toMessage().nonce.val() ); } { Network::Packet packet( Network::TO_CLIENT, 0, 0, "test" ); nonces.insert( packet.toMessage().nonce.val() ); } } if ( nonces.size() == 4 * NUM_EXAMPLES ) { return EXIT_SUCCESS; } return EXIT_FAILURE; } mosh-1.4.0/src/tests/emulation-attributes-16color.test0000775000175000017500000000767114326375453017735 00000000000000#!/bin/sh # # This validates VT100, 16-color, 256-color and true color attributes # against tmux. It is not run directly, but as subtests based on the # executable's name for vt100, 16color, 256color8, 256color248 and # truecolor. # This is because Mosh internally represents the first 8 values of the # 256color space as though they were the 16-color values they are # equivalent to. tmux does not filter this out on its redisplay, so # compares on these values fail though they are visually identical. # # shellcheck source=e2e-test-subrs . "$(dirname "$0")/e2e-test-subrs" PATH=$PATH:.:$srcdir # Need 2.3 for true-color support (2.2 may work also) if [ "$(basename "$0")" = emulation-attributes-truecolor.test ] && ! tmux_check 2 3; then printf "tmux does not support true color\n" >&2 exit 77 fi # Need 2.4 for BCE support if [ "$(basename "$0")" = emulation-attributes-bce.test ] && ! tmux_check 2 4; then printf "tmux does not support BCE\n" >&2 exit 77 fi # tmux 3.3a has a behavior change in how BCE is handled, which has # been reverted: https://github.com/tmux/tmux/issues/3339 if [ "$(basename "$0")" = emulation-attributes-bce.test ] && tmux_check 3 3a && ! tmux_check 3 3b; then printf "tmux 3.3a has incompatible BCE behavior\n" >&2 exit 77 fi # Top-level wrapper. if [ $# -eq 0 ]; then e2e-test "$0" baseline direct verify exit fi # OK, we have arguments, we're one of the test hooks. if [ $# -ne 1 ]; then fail "bad arguments %s\n" "$@" fi test_true_color() { s=$(printf "\033[0") for i in $@; do s="$s;$i" done s="${s}m" for attr in $(seq 0 76); do r=$((255-(attr*255/76))) g=$((attr*510/76)) b=$((attr*255/76)) if [ $g -gt 255 ]; then g=$((510-g)) fi invr=$((255-r)) invg=$((255-g)) invb=$((255-b)) c="E" printf "%s" "$s" printf "\033[48;2;%d;%d;%dm" $r $g $b; printf "\033[38;2;%d;%d;%dm" $invr $invg $invb printf "%s\033[m" "$c" done printf "\n" } baseline() { # Strip our name to the last dash-separated word before the .test suffix. testname=$(basename "$1") testname=${testname%%.test} testname=${testname##*-} printf '\033[H\033[J' case $testname in # Traditional ancient VT100 attributes. vt100) for attr in 0 1 4 5 7; do printf '\033[%dmE\033[m ' $attr done ;; # 16-color attributes. 16color) for attr in $(seq 30 37) $(seq 39 47) 49; do printf '\033[%dmE\033[m ' "$attr" done ;; # First 8 256-color attributes. Comparing mosh and tmux fails. 256color8) for attr in $(seq 0 7); do printf '\033[38;5;%dmE\033[m ' "$attr" printf '\033[48;5;%dmM\033[m ' "$attr" done ;; # Last 248 256-color attributes. 256color248) for attr in $(seq 8 255); do printf '\033[38;5;%dmE\033[m ' "$attr" printf '\033[48;5;%dmM\033[m ' "$attr" done ;; # True color. # See https://gist.github.com/XVilka/8346728 for the test case truecolor) echo "Normal:" test_true_color echo "Bold:" test_true_color 1 echo "Italic:" test_true_color 3 echo "Underline:" test_true_color 4 echo "Blink:" test_true_color 5 echo "Inverse:" test_true_color 7 echo "Invisible:" test_true_color 8 echo "Bold, italic and underline:" test_true_color 1 3 4 ;; # BCE in combination with various color modes. bce) # True color. printf '\033[48;2;255;0;255m\033[H\033[JTrue color\n' printf '\033[48;5;32m\033[J256 color\n' printf '\033[42m\033[J16 color\n' printf '\033[0mdone\n' ;; *) fail "unknown test name %s\n" "$1" ;; esac printf '\033[mend\n' } case $1 in baseline|direct) baseline "$0";; *) fail "unknown test argument %s\n" "$1";; esac mosh-1.4.0/src/tests/mosh-client0000775000175000017500000001615014174450057013520 00000000000000#!/bin/sh . "$(dirname "$0")/e2e-test-subrs" # # Validate that mosh produces expected output, using screen captures # in tmux. # log() { printf "$@" } error() { printf "$@" >&2 } dump_logs() { dir=$1 shift testname=$(basename "$dir" .d) for logfile in $dir/*.tmux.log; do printf "travis_fold:start:%s-%s\n" "$testname" "$(basename "$logfile")" cat "$logfile" printf "travis_fold:end:%s-%s\n" "$testname" "$(basename "$logfile")" done } test_success() { exit 0 } test_failure() { error "$@" exit 1 } test_skipped() { error "$@" exit 77 } test_error() { error "$@" exit 99 } test_exitstatus() { status=$1 shift error "$@" exit "$status" } ssh_localhost_check() { ssh localhost : if [ $? -ne 0 ]; then error "ssh to localhost failed\n" return 1 fi return 0 } # These two functions are wrappers for mosh-client/mosh-server to turn # on verbosity and log stderr. mosh_client() { if [ -z "$MOSH_CLIENT" ] || [ -z "$MOSH_E2E_TEST" ]; then test_error "mosh_client: variables missing\n" fi exec 2> "${MOSH_E2E_TEST}.client.stderr" exec "$MOSH_CLIENT" $MOSH_CLIENT_ARGS "$@" } mosh_server() { if [ -z "$MOSH_SERVER" ] || [ -z "$MOSH_E2E_TEST" ]; then test_error "mosh_server: variables missing\n" fi exec 2> "${MOSH_E2E_TEST}.server.stderr" exec "$MOSH_SERVER" new -vv $MOSH_SERVER_ARGS -@ "$@" } # main # Set up environment if [ -z "$srcdir" ]; then export srcdir=$PWD else srcdir="$(cd "$srcdir" && pwd)" if [ $? -ne 0 ]; then error "can't cd to srcdir: %s\n" "$srcdir" exit 99 fi fi # Wrappers. case "$(basename "$0")" in mosh-client) mosh_client "$@" exit ;; mosh-server) mosh_server "$@" exit ;; *) ;; esac if [ $# -lt 2 ]; then test_error "not enough args\n" fi # Get arguments (only one so far) test_name=$1 shift test_args=$@ # XXX could use AM testsubdir macro instead test_dir=$(basename "${test_name}").d test_script="${test_name}" tests_dir=$(dirname "${test_name}") if ! set_locale "${tests_dir}"; then test_error "e2e-test: no usable locale\n" fi # XXX this ignores $TMPDIR, because it results in an overlong pathname on OS X tmux_socket="/tmp/.tmux-mosh-test-$$" # need version 1.8 for capture-pane if ! tmux_check 1 8; then test_skipped "tmux unavailable\n" fi rm -rf "${test_dir}" mkdir "${test_dir}" on_exit() { rv=$? if test $rv -ne 0; then dump_logs "$test_dir" $test_args fi exit $rv } trap on_exit EXIT # Set up tests to run. server_tests= compare_tests= for i in $test_args; do case $i in baseline|direct|variant) server_tests="$server_tests $i";; verify|same|different) compare_tests="$compare_tests $i";; tmux) tmux=1;; client) client=1;; server) server=1;; post) post=1;; mosh-args) mosh_args=$("${test_script}" mosh-args);; client-args) MOSH_CLIENT_ARGS=$("${test_script}" client-args) export MOSH_CLIENT_ARGS;; server-args) MOSH_SERVER_ARGS=$("${test_script}" server-args) export MOSH_SERVER_ARGS;; *) error 'unknown test type argument %s\n' "$i" exit 99 ;; esac done # Run test(s). client_wrapper= if [ -n "$client" ]; then client_wrapper="${test_script} client" fi server_wrapper="\"${srcdir}/e2e-test-server\"" if [ -n "$server" ]; then server_wrapper="\"${srcdir}/${test_script}\" server" fi tmux_stdin="${srcdir}/hold-stdin" if [ -n "$tmux" ]; then tmux_stdin="${test_script} tmux" fi ln -fs "${tmux_socket}" "${test_dir}/tmux-socket" for run in $server_tests; do log "Running server test %s.\n" "$run" # These three variables are for the benefit of the mosh-client and mosh-server wrappers. export MOSH_CLIENT="$PWD/../frontend/mosh-client" export MOSH_SERVER="$PWD/../frontend/mosh-server" export MOSH_E2E_TEST="$PWD/${test_dir}/${run}" # XXX need to quote special chars in server pathname here somehow sut="../../scripts/mosh --client=${srcdir}/mosh-client --server=${srcdir}/mosh-server --local --bind-server=127.0.0.1 ${mosh_args} 127.0.0.1" if [ "$run" = "direct" ]; then sut="" fi # Actually execute code under test # XXX tmux 1.8 requires shell command as a single arg; once we move to 2.0, undo these quotes # tmux <= 2.5 ignore -x/-y, but the client sets the session to 80x24. # tmux from 2017-05-27 and later should default to an 80x24 session, # but do use -x/-y on control-master clients. ${tmux_stdin} tmux -f /dev/null -S "${tmux_socket}" -C new-session -x 80 -y 24 "${srcdir}/print-exitstatus ${client_wrapper} ${sut} ${server_wrapper} \"${PWD}/${test_dir}/${run}\" \"${PWD}/${test_script} ${run}\"" > "${test_dir}/${run}.tmux.log" rv=$? rm -f "${tmux_socket}" "${test_dir}/tmux-socket" if [ $rv -ne 0 ]; then test_error "tmux failure on test %s\n" "$run" fi # Check for mosh failures if ! grep -q "@@@ exitstatus: 0 @@@" "${test_dir}/${run}.tmux.log"; then test_error "mosh-client had non-zero exitstatus\n" fi # Check for server harness failures if [ -z "$server" ]; then if [ ! -s "${test_dir}/${run}.capture" ] \ || [ ! -s "${test_dir}/${run}.exitstatus" ]; then test_error "server harness failure on test %s\n" "$run" fi read -r server_rv < "${test_dir}/${run}.exitstatus" if [ "$server_rv" -ne 0 ]; then test_error "server harness exited with status %s\n" "$server_rv" fi fi if [ "${run}" != "direct" ]; then # Check for "round-trip" failures if grep -q "round-trip Instruction verification failed" "${test_dir}/${run}.server.stderr"; then test_error "Round-trip Instruction verification failed on server during %s\n" "$run" fi # Check for 0-timeout select() issue if egrep -q "(polls, rate limiting|consecutive polls)" "${test_dir}/${run}.server.stderr"; then if [ "osx" != "${TRAVIS_OS_NAME}" ]; then test_error "select() with zero timeout called too often on server during %s\n" "$run" fi fi # Check for assert() if egrep -q "assertion.*failed" "${test_dir}/${run}.server.stderr"; then test_error "assertion during %s\n" "$run" fi fi # XXX We'd also like to check for "target state Instruction # verification failed", a new check, but tmux's lack of BCE # support forces mosh to clear lines with spaces and change a # framebuffer in a way that causes this to fire spuriously. done for compare in $compare_tests; do log "Running server comparison %s.\n" "$compare" # Compare captures if [ "$compare" = verify ]; then test1="direct" test2="baseline" else test1="baseline" test2="variant" fi if diff -q "${test_dir}/${test1}.capture" "${test_dir}/${test2}.capture"; then differ=n else differ=y fi if [ "$compare" = different ]; then desired=y badresult=same else desired=n badresult=different fi if [ $differ != $desired ]; then test_failure "Output is %s between tests %s and %s\n" "$badresult" "$test1" "$test2" fi done # Run a post script (usually a custom validation of results) if [ -n "$post" ]; then "${test_script}" post status=$? if [ $status -ne 0 ]; then test_exitstatus $status "Post test failed with exitstatus %d\n" $status fi fi mosh-1.4.0/src/tests/base64.cc0000644000175000017500000001103113103401307012713 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ /* Test suite for the OCB-AES reference implementation included with Mosh. This tests cryptographic primitives implemented by others. It uses the same interfaces and indeed the same compiled object code as the Mosh client and server. It does not particularly test any code written for the Mosh project. */ #include #include #include #include "base64.h" #include "base64_vector.h" #include "crypto.h" #include "prng.h" #include "fatal_assert.h" // #include "test_utils.h" #define KEY_LEN 16 #define NONCE_LEN 12 #define TAG_LEN 16 bool verbose = false; static void test_base64( void ) { /* run through a test vector */ char encoded[25]; uint8_t decoded[16]; size_t b64_len = 24; size_t raw_len = 16; for ( base64_test_row *row = static_base64_vector; *row->native != '\0'; row++ ) { memset(encoded, '\0', sizeof encoded); memset(decoded, '\0', sizeof decoded); base64_encode(static_cast(row->native), raw_len, encoded, b64_len); fatal_assert( b64_len == 24 ); fatal_assert( !memcmp(row->encoded, encoded, sizeof encoded)); fatal_assert( base64_decode(row->encoded, b64_len, decoded, &raw_len )); fatal_assert( raw_len == 16 ); fatal_assert( !memcmp(row->native, decoded, sizeof decoded)); } if ( verbose ) { printf( "validation PASSED\n" ); } /* try 0..255 in the last byte; make sure the final two characters are output properly */ uint8_t source[16]; memset(source, '\0', sizeof source); for ( int i = 0; i < 256; i++ ) { source[15] = i; base64_encode(source, raw_len, encoded, b64_len); fatal_assert( b64_len == 24 ); fatal_assert( base64_decode(encoded, b64_len, decoded, &raw_len )); fatal_assert( raw_len == 16 ); fatal_assert( !memcmp(source, decoded, sizeof decoded)); } if ( verbose ) { printf( "last-byte PASSED\n" ); } /* randomly try keys */ PRNG prng; for ( int i = 0; i < ( 1<<17 ); i++ ) { Base64Key key1(prng); Base64Key key2(key1.printable_key()); fatal_assert( key1.printable_key() == key2.printable_key() && !memcmp(key1.data(), key2.data(), 16 )); } if ( verbose ) { printf( "random PASSED\n" ); } /* test bad keys */ const char *bad_keys[] = { "", "AAAAAAAAAAAAAAAAAAAAAA", "AAAAAAAAAAAAAAAAAAAAAA=", "AAAAAAAAAAAAAAAAAAAAA==", "AAAAAAAAAAAAAAAAAAAAAAA==", "AAAAAAAAAAAAAAAAAAAAAAAA==", "AAAAAAAAAAAAAAAAAAAAAA~=", "AAAAAAAAAAAAAAAAAAAAAA=~", "~AAAAAAAAAAAAAAAAAAAAA==", "AAAAAAAAAAAAAAAAAAAA~A==", "AAAAAAAAAAAAAAAAAAAAA~==", "AAAAAAAAAA~AAAAAAAAAAA==", "AAAAAAAAAA==", NULL, }; for ( const char **key = bad_keys; *key != NULL; key++ ) { b64_len = 24; raw_len = 16; fatal_assert( !base64_decode(*key, b64_len, decoded, &raw_len )); } if ( verbose ) { printf( "bad-keys PASSED\n" ); } } int main( int argc, char *argv[] ) { if ( argc >= 2 && strcmp( argv[ 1 ], "-v" ) == 0 ) { verbose = true; } try { test_base64(); } catch ( const std::exception &e ) { fprintf( stderr, "Error: %s\r\n", e.what() ); return 1; } return 0; } mosh-1.4.0/src/tests/base64_vector.cc0000664000175000017500000000163014327736673014335 00000000000000#include "base64_vector.h" base64_test_row static_base64_vector[] = { { "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", "AAAAAAAAAAAAAAAAAAAAAA==" }, { "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff", "/////////////////////w==" }, { "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff", "AAAAAAAAAAAAAAAAAAAA/w==" }, { "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00", "////////////////////AA==" }, { "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", "qqqqqqqqqqqqqqqqqqqqqg==" }, { "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\x55\x55\x55\x55\x55\x55\x55\x55", "qqqqqqqqqqpVVVVVVVVVVQ==" }, { "\x55\x55\x55\x55\x55\x55\x55\x55\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", "VVVVVVVVVVWqqqqqqqqqqg==" }, { "\x01\x02\x04\x08\x10\x20\x40\x80\xfe\xfd\xfb\xf7\xef\xdf\xbf\x7f", "AQIECBAgQID+/fv379+/fw==" }, { "", "" } }; mosh-1.4.0/src/tests/e2e-test-subrs0000664000175000017500000000501014326375453014055 00000000000000#!/bin/sh # # This is a library of subroutines mostly intended for test scripts. # fail() { printf "$@" 2>&1 exit 99 } skip() { printf "$@" 2>&1 exit 77 } sleepf() { (sleep .1 || sleep 1) > /dev/null 2>&1 } seq_function() { if [ $# -lt 1 ] || [ $# -gt 3 ]; then echo "bad args" >&2 fi first=$1 incr=1 last=0 case $# in 3) incr=$2 last=$3 ;; 2) last=$2 ;; 1) ;; esac while :; do printf '%d\n' "$first" first=$(( first + incr )) if [ "$first" -gt "$last" ]; then break fi done } if ! seq 1 > /dev/null 2>&1; then seq() { seq_function "$@" } fi chr() { printf '%b' "\\0$(printf %03o "$1")" } # If the locale is not set to a UTF-8 locale, set it to en_US.UTF-8 # or C.UTF-8. set_locale() { # Test for a usable locale. if ./is-utf8-locale 2> /dev/null; then return 0 fi # Attempt to find/set a usable locale. unset LANG LC_CTYPE LC_COLLATE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME LC_ALL for i in en_US.UTF-8 en_US.utf8 C.UTF-8; do if env LC_ALL=$i ./is-utf8-locale 2> /dev/null; then export LC_ALL=$i return 0 fi done # Fail. return 1 } # Given two versions, return success if the first version is less than # or equal to the second version. versionlte() { [ "$1" = "$(printf "$1\n$2\n" | sort -V | head -n1)" ] } versionlt() { if [ "$1" = "$2" ]; then return 1 fi versionlte "$1" "$2" } # Tmux check. tmux_check() { need_major="$1"; shift need_minor="$1"; shift # OpenBSD tmux does not have '-V'. if [ "$(uname -s)" = "OpenBSD" ]; then openbsd_major="$(uname -r)" openbsd_major="${openbsd_major%%.*}" if [ "${openbsd_major}" -ge 6 ]; then return 0 fi fi version=$(tmux -V) if [ $? != 0 ]; then error "tmux unavailable\n" return 1 fi if [ "$version" = "tmux master" ]; then return 0 fi version=${version##tmux } if versionlt "$version" "$need_major.$need_minor"; then printf "tmux version %s too old\n" "$version" >&2 return 1 fi # Finally, check that tmux actually works to some degree. # # Use a different socket name. On Cygwin, this tmux server is # slow to exit, and the actual test tmux can attach to it, causing # problems with missing environment variables. tmux_check_socket=$(mktemp -d /tmp/mosh-tmux-check.XXXXXXXX) tmux -f /dev/null -S "${tmux_check_socket}/s" -C new-session true rv=$? rm ${tmux_check_socket}/s rmdir ${tmux_check_socket} return $rv } mosh-1.4.0/src/tests/mosh-server0000775000175000017500000001615014174450057013550 00000000000000#!/bin/sh . "$(dirname "$0")/e2e-test-subrs" # # Validate that mosh produces expected output, using screen captures # in tmux. # log() { printf "$@" } error() { printf "$@" >&2 } dump_logs() { dir=$1 shift testname=$(basename "$dir" .d) for logfile in $dir/*.tmux.log; do printf "travis_fold:start:%s-%s\n" "$testname" "$(basename "$logfile")" cat "$logfile" printf "travis_fold:end:%s-%s\n" "$testname" "$(basename "$logfile")" done } test_success() { exit 0 } test_failure() { error "$@" exit 1 } test_skipped() { error "$@" exit 77 } test_error() { error "$@" exit 99 } test_exitstatus() { status=$1 shift error "$@" exit "$status" } ssh_localhost_check() { ssh localhost : if [ $? -ne 0 ]; then error "ssh to localhost failed\n" return 1 fi return 0 } # These two functions are wrappers for mosh-client/mosh-server to turn # on verbosity and log stderr. mosh_client() { if [ -z "$MOSH_CLIENT" ] || [ -z "$MOSH_E2E_TEST" ]; then test_error "mosh_client: variables missing\n" fi exec 2> "${MOSH_E2E_TEST}.client.stderr" exec "$MOSH_CLIENT" $MOSH_CLIENT_ARGS "$@" } mosh_server() { if [ -z "$MOSH_SERVER" ] || [ -z "$MOSH_E2E_TEST" ]; then test_error "mosh_server: variables missing\n" fi exec 2> "${MOSH_E2E_TEST}.server.stderr" exec "$MOSH_SERVER" new -vv $MOSH_SERVER_ARGS -@ "$@" } # main # Set up environment if [ -z "$srcdir" ]; then export srcdir=$PWD else srcdir="$(cd "$srcdir" && pwd)" if [ $? -ne 0 ]; then error "can't cd to srcdir: %s\n" "$srcdir" exit 99 fi fi # Wrappers. case "$(basename "$0")" in mosh-client) mosh_client "$@" exit ;; mosh-server) mosh_server "$@" exit ;; *) ;; esac if [ $# -lt 2 ]; then test_error "not enough args\n" fi # Get arguments (only one so far) test_name=$1 shift test_args=$@ # XXX could use AM testsubdir macro instead test_dir=$(basename "${test_name}").d test_script="${test_name}" tests_dir=$(dirname "${test_name}") if ! set_locale "${tests_dir}"; then test_error "e2e-test: no usable locale\n" fi # XXX this ignores $TMPDIR, because it results in an overlong pathname on OS X tmux_socket="/tmp/.tmux-mosh-test-$$" # need version 1.8 for capture-pane if ! tmux_check 1 8; then test_skipped "tmux unavailable\n" fi rm -rf "${test_dir}" mkdir "${test_dir}" on_exit() { rv=$? if test $rv -ne 0; then dump_logs "$test_dir" $test_args fi exit $rv } trap on_exit EXIT # Set up tests to run. server_tests= compare_tests= for i in $test_args; do case $i in baseline|direct|variant) server_tests="$server_tests $i";; verify|same|different) compare_tests="$compare_tests $i";; tmux) tmux=1;; client) client=1;; server) server=1;; post) post=1;; mosh-args) mosh_args=$("${test_script}" mosh-args);; client-args) MOSH_CLIENT_ARGS=$("${test_script}" client-args) export MOSH_CLIENT_ARGS;; server-args) MOSH_SERVER_ARGS=$("${test_script}" server-args) export MOSH_SERVER_ARGS;; *) error 'unknown test type argument %s\n' "$i" exit 99 ;; esac done # Run test(s). client_wrapper= if [ -n "$client" ]; then client_wrapper="${test_script} client" fi server_wrapper="\"${srcdir}/e2e-test-server\"" if [ -n "$server" ]; then server_wrapper="\"${srcdir}/${test_script}\" server" fi tmux_stdin="${srcdir}/hold-stdin" if [ -n "$tmux" ]; then tmux_stdin="${test_script} tmux" fi ln -fs "${tmux_socket}" "${test_dir}/tmux-socket" for run in $server_tests; do log "Running server test %s.\n" "$run" # These three variables are for the benefit of the mosh-client and mosh-server wrappers. export MOSH_CLIENT="$PWD/../frontend/mosh-client" export MOSH_SERVER="$PWD/../frontend/mosh-server" export MOSH_E2E_TEST="$PWD/${test_dir}/${run}" # XXX need to quote special chars in server pathname here somehow sut="../../scripts/mosh --client=${srcdir}/mosh-client --server=${srcdir}/mosh-server --local --bind-server=127.0.0.1 ${mosh_args} 127.0.0.1" if [ "$run" = "direct" ]; then sut="" fi # Actually execute code under test # XXX tmux 1.8 requires shell command as a single arg; once we move to 2.0, undo these quotes # tmux <= 2.5 ignore -x/-y, but the client sets the session to 80x24. # tmux from 2017-05-27 and later should default to an 80x24 session, # but do use -x/-y on control-master clients. ${tmux_stdin} tmux -f /dev/null -S "${tmux_socket}" -C new-session -x 80 -y 24 "${srcdir}/print-exitstatus ${client_wrapper} ${sut} ${server_wrapper} \"${PWD}/${test_dir}/${run}\" \"${PWD}/${test_script} ${run}\"" > "${test_dir}/${run}.tmux.log" rv=$? rm -f "${tmux_socket}" "${test_dir}/tmux-socket" if [ $rv -ne 0 ]; then test_error "tmux failure on test %s\n" "$run" fi # Check for mosh failures if ! grep -q "@@@ exitstatus: 0 @@@" "${test_dir}/${run}.tmux.log"; then test_error "mosh-client had non-zero exitstatus\n" fi # Check for server harness failures if [ -z "$server" ]; then if [ ! -s "${test_dir}/${run}.capture" ] \ || [ ! -s "${test_dir}/${run}.exitstatus" ]; then test_error "server harness failure on test %s\n" "$run" fi read -r server_rv < "${test_dir}/${run}.exitstatus" if [ "$server_rv" -ne 0 ]; then test_error "server harness exited with status %s\n" "$server_rv" fi fi if [ "${run}" != "direct" ]; then # Check for "round-trip" failures if grep -q "round-trip Instruction verification failed" "${test_dir}/${run}.server.stderr"; then test_error "Round-trip Instruction verification failed on server during %s\n" "$run" fi # Check for 0-timeout select() issue if egrep -q "(polls, rate limiting|consecutive polls)" "${test_dir}/${run}.server.stderr"; then if [ "osx" != "${TRAVIS_OS_NAME}" ]; then test_error "select() with zero timeout called too often on server during %s\n" "$run" fi fi # Check for assert() if egrep -q "assertion.*failed" "${test_dir}/${run}.server.stderr"; then test_error "assertion during %s\n" "$run" fi fi # XXX We'd also like to check for "target state Instruction # verification failed", a new check, but tmux's lack of BCE # support forces mosh to clear lines with spaces and change a # framebuffer in a way that causes this to fire spuriously. done for compare in $compare_tests; do log "Running server comparison %s.\n" "$compare" # Compare captures if [ "$compare" = verify ]; then test1="direct" test2="baseline" else test1="baseline" test2="variant" fi if diff -q "${test_dir}/${test1}.capture" "${test_dir}/${test2}.capture"; then differ=n else differ=y fi if [ "$compare" = different ]; then desired=y badresult=same else desired=n badresult=different fi if [ $differ != $desired ]; then test_failure "Output is %s between tests %s and %s\n" "$badresult" "$test1" "$test2" fi done # Run a post script (usually a custom validation of results) if [ -n "$post" ]; then "${test_script}" post status=$? if [ $status -ne 0 ]; then test_exitstatus $status "Post test failed with exitstatus %d\n" $status fi fi mosh-1.4.0/src/tests/server-signal-timeout.test0000755000175000017500000000554213103401307016503 00000000000000#!/bin/sh # # This test checks for operation of the MOSH_SERVER_NETWORK_TMOUT variable. # It does this by # * setting the variable # * killing the client (and its network traffic) # * waiting server-side, for the server to die # If it is killed, the test is successful. # If it survives that long and the server is still around, the test fails. # The client waits a bit longer than the server so that status can be collected # properly. # TIMEOUT=10 # shellcheck source=e2e-test-subrs . "$(dirname "$0")/e2e-test-subrs" PATH=$PATH:.:$srcdir # Top-level wrapper. if [ $# -eq 0 ]; then e2e-test "$0" client baseline exit fi # OK, we have arguments, we're one of the test hooks. client() { case "$myname" in server-network-timeout) export MOSH_SERVER_NETWORK_TMOUT=$TIMEOUT;; server-signal-timeout) export MOSH_SERVER_SIGNAL_TMOUT=$TIMEOUT;; *) fail "unexpected test name %s\n" "$myname" esac shift # Print this early, because the server is expected to die before # the normal time this is sent by e2e-test-server. printf "@@@ server complete @@@\n" >&2 # Run mosh SUT. eval "$@" # The client may be murdered. We need to expect that... retval=$? case $retval in 0|1) fail "mosh-client had a normal exit\n";; # test condition failed 9|137|265) # Aha, signal 9. Wait. sleep $(( TIMEOUT + 12 )) exit 0 ;; *) fail "unknown client wrapper failure, retval=%d\n" $retval ;; esac fail "client wrapper shouldnt get here\n" } baseline() { # check for our wonderful variable if [ -z "$MOSH_SERVER_NETWORK_TMOUT" ] && [ -z "$MOSH_SERVER_SIGNAL_TMOUT" ]; then env fail "Variable unset\n" fi # check for our client if [ -z "$MOSH_CLIENT_PID" ]; then env fail "Client pid unavailable\n" fi if ! kill -0 "$MOSH_CLIENT_PID"; then fail "mosh client is unexpectedly missing\n" fi # Set up for good return and cleanup on being killed trap "echo got killed >&2; sleep 1; exit 0" HUP TERM sleep 1 # Kill the client, to stop network traffic. kill -KILL "$MOSH_CLIENT_PID" case "$myname" in server-network-timeout) # Just wait. This is the hardest part. sleep $(( TIMEOUT + 7 )) ;; server-signal-timeout) # Wait for the timeout to expire. sleep $(( TIMEOUT + 2 )) # Tell the server to go away. kill -USR1 "$MOSH_SERVER_PID" sleep 5 ;; *) fail "unexpected test name %s\n" "$myname" esac # If we're still alive and the server is too, the test failed. # XXX the server is getting killed and we're getting here anyway. # Exit with error only if server is still around. sleep 1 ! kill -0 "$MOSH_SERVER_PID" exit } myname="$(basename "$0" .test)" case $1 in baseline|variant) baseline;; client) client "$@";; *) fail "unknown test argument %s\n" "$1";; esac mosh-1.4.0/src/tests/base64_vector.h0000644000175000017500000000026013103401307014141 00000000000000struct base64_test_row { const unsigned char native[17]; const char encoded[25]; }; typedef base64_test_row *base64_test_vector; extern base64_test_row static_base64_vector[]; mosh-1.4.0/src/tests/README.md0000644000175000017500000001545213103401307012612 00000000000000# Mosh Tests ## ocb-aes This is a unit test for the OCB-AES encryption used in mosh, including Rogaway's OCB implementation and some of mosh's surrounding C++ support code. ## encrypt-decrypt This is a simple functional test of mosh's implementation of encrypted messages. ## base64 This tests Mosh's homegrown base64 functionality. The associated `genbase64.pl` script is used to independently generate validated test vectors. ## e2e-test This is a test framework for end-to-end testing of mosh. It uses tmux to invoke mosh in a nicely stable interactive pty, and also uses tmux's `capture-pane` command to get a dump of the terminal screen that mosh-client has drawn, neatly getting around Mosh's somewhat non-deterministic display redraw. There are four essential parts to the framework: * your test script * `e2e-test` * `e2e-test-server` * `e2e-test-subrs` The test script has two roles: when invoked without arguments, it is a wrapper script for the overall test, and when invoked with an argument, it performs a testing-related action. In wrapper mode, it invokes e2e-test with action arguments, which are used to invoke the test script for actions at appropriate points by e2e-test. These provide a suite of behaviors that you can use to test various mosh behaviors. `e2e-test` is the heart of the framework. It runs actions as requested, logs their output, compares and/or validates their results, and generates the final result (exitstatus, mostly) for the Automake testing framework used by the mosh build. For test execution, it runs an action in an interactive session, in a tmux `screen`, to exercise some behavior. The action can optionally be run in a mosh session, or directly in tmux (doing both and comparing the result is a useful way to test complex terminal emulation behaviors). The action generally writes some output to the terminal that can later be verified by another action. Optionally, a client action can generate tty input or otherwise exercise mosh in some fashion (this capability is untested, but it's a useful place to use `expect` or other interactive simulations). The action is run by `e2e-test-server`, which is a relatively small wrapper script to capture errors, and capture the tmux screen. There are several different categories of actions: ### Execution `baseline` is an action that almost all tests will use. This invokes the test script inside mosh, where it can generate some output, and then captures the client-side tmux display with `tmux capture-pane`. `direct` is the same as the above, except that mosh is not used-- `e2e-wrapper-script` and the test script are invoked directly inside tmux. `variant` can be used to provide a slightly different action from `baseline`. ### Verification `verify` compares captures from the `baseline` and `direct` test actions, which are expected to be identical. `same` compares captures from the `baseline` and `variant` test actions, which are expected to be identical. `different` compares captures from the `baseline` and `variant` test actions, which are expected to be different. `post` is a catchall script hook which allows custom verification acions to be coded. ### Client wrappers `tmux` injects a wrapper command into the test command before tmux. If this is not run, a default command called `hold-stdin` is run instead. These commands are expected to hold tmux's stdin open, possibly injecting tmux commands, while the test runs. See `window-resize.test` for an example of this that manipulates tmux state. Alternately, this could use expect or something similar. `client` simply injects a wrapper command into the (long) test command between tmux and mosh. It's expected to interact with its wrapped command line as `expect` might do. This is not actually tested yet. ### Flags `mosh-args`, `client-args` and `server-args` inject extra arguments into the invocations of the respective commands. ## Logging and error reporting Each execution action is run, and recorded in `.test.d/.*`. `.exitstatus` is the exitstatus from the server wrapper. `.tmux.log` is the output of tmux for the entire test run for that action; `.capture` is a capture of the Mosh client screen after the test action is complete, generated with `tmux capture-pane`. In accordance with GNU Automake's test framework, the test should return these exit status values: * 0 test success * 1 test failure * 77 test skipped (tmux or ssh is unavailable if needed) * 99 hard error These values are also used internally between the various scripts; errors are conveyed out to the build test framework. ## Sample tests A few tests have been implemented so far to test the framework itself, and to provide examples for further development. `e2e-success` is a simple test that executes `baseline` and `direct` with the same stimulus (simply clearing the screen), and expects to see identical results. `e2e-failure` is similar to `e2e-success`, but expects to see different results from `baseline` and `variant`. Since it uses the same stimulus for the two execution action, it fails. A more realistic test might be to have `variant` execute some escape sequence that is absent from `baseline`; this would verify that the escape sequence actually does something. `emulation-back-tab` tests an escape sequence that mosh does not support. It expects the test to produce the output that would be generated if the escape sequence were implemented. If it gets output as expected when the escape sequence is *not* implemented, the test fails. But if the output does not match one of these two cases, the test returns an error. This is an example of error handling within the test framework. `unicode-later-combining` demonstrates mosh's handling of a Unicode edge case, a combining character drawn without a printing character in the same cell. It verifies the output in the `post` action; since there are a couple of different Unicode renderings that are reasonable in this case, a regex that covers both is used. It also implements an unused `variant` action that draws blank-space+combiner in a correct fashion. ## Notes The shell command `printf` is generally used in place of `echo` in this framework, because of its more precisely-specified and portable behavior. But beware, even `printf` varies between systems-- GNU printf, for example, implements `\e`, which is a non-POSIX extension unavailable in BSD implementations It's fairly simple to test each of these scripts independently, but the entire chain is a bit prone to behaving oddly in hard-to-debug ways. `set -x` is your friend here. The test scripts are a bit fragile about timeouts. They will generally run correctly on an unloaded machine without the `make -j` flag. Using `make -j` is obviously very convenient for development, and it works fine on faster machines, but I don't recommend it for automated testing. mosh-1.4.0/src/tests/emulation-cursor-motion.test0000755000175000017500000000143713103401307017050 00000000000000#!/bin/sh # # This test exercises a particular optimization involving small cursor # motions in Mosh. # # shellcheck source=e2e-test-subrs . "$(dirname "$0")/e2e-test-subrs" PATH=$PATH:.:$srcdir # Top-level wrapper. if [ $# -eq 0 ]; then e2e-test "$0" baseline direct verify exit fi # OK, we have arguments, we're one of the test hooks. if [ $# -ne 1 ]; then fail "bad arguments %s\n" "$@" fi baseline() { printf '\033[H\033[J' while read -r x y text; do printf '\033[%d;%dH%s' "$y" "$x" "$text" sleepf done <= 256) { $rc = $? >> 8; } else { $rc = ($? & 127) | 128; } exit $rc; mosh-1.4.0/src/tests/emulation-wrap-across-frames.test0000755000175000017500000000204013103401307017733 00000000000000#!/bin/sh # # This is a regression test for a bug seen where mosh-server's # round-trip verification failed if text was filled to column 80 on # frame N and then wrapped to the next line on frame N+1, because the # wrap flag used to be in the Cell class and caused miscompares # between cells. It got moved to the Rows class where it makes more # sense. # # shellcheck source=e2e-test-subrs . "$(dirname "$0")/e2e-test-subrs" PATH=$PATH:.:$srcdir # Top-level wrapper. if [ $# -eq 0 ]; then e2e-test "$0" baseline direct verify exit fi # OK, we have arguments, we're one of the test hooks. if [ $# -ne 1 ]; then fail "bad arguments %s\n" "$@" fi baseline() { printf '\033[H\033[J' for x in $(seq 1 10); do printf "abcdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX1234" sleepf printf "ABCDxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5678" sleepf done printf '\n' } case $1 in baseline|direct) baseline;; *) fail "unknown test argument %s\n" "$1";; esac mosh-1.4.0/src/tests/emulation-attributes-truecolor.test0000775000175000017500000000767114326375453020466 00000000000000#!/bin/sh # # This validates VT100, 16-color, 256-color and true color attributes # against tmux. It is not run directly, but as subtests based on the # executable's name for vt100, 16color, 256color8, 256color248 and # truecolor. # This is because Mosh internally represents the first 8 values of the # 256color space as though they were the 16-color values they are # equivalent to. tmux does not filter this out on its redisplay, so # compares on these values fail though they are visually identical. # # shellcheck source=e2e-test-subrs . "$(dirname "$0")/e2e-test-subrs" PATH=$PATH:.:$srcdir # Need 2.3 for true-color support (2.2 may work also) if [ "$(basename "$0")" = emulation-attributes-truecolor.test ] && ! tmux_check 2 3; then printf "tmux does not support true color\n" >&2 exit 77 fi # Need 2.4 for BCE support if [ "$(basename "$0")" = emulation-attributes-bce.test ] && ! tmux_check 2 4; then printf "tmux does not support BCE\n" >&2 exit 77 fi # tmux 3.3a has a behavior change in how BCE is handled, which has # been reverted: https://github.com/tmux/tmux/issues/3339 if [ "$(basename "$0")" = emulation-attributes-bce.test ] && tmux_check 3 3a && ! tmux_check 3 3b; then printf "tmux 3.3a has incompatible BCE behavior\n" >&2 exit 77 fi # Top-level wrapper. if [ $# -eq 0 ]; then e2e-test "$0" baseline direct verify exit fi # OK, we have arguments, we're one of the test hooks. if [ $# -ne 1 ]; then fail "bad arguments %s\n" "$@" fi test_true_color() { s=$(printf "\033[0") for i in $@; do s="$s;$i" done s="${s}m" for attr in $(seq 0 76); do r=$((255-(attr*255/76))) g=$((attr*510/76)) b=$((attr*255/76)) if [ $g -gt 255 ]; then g=$((510-g)) fi invr=$((255-r)) invg=$((255-g)) invb=$((255-b)) c="E" printf "%s" "$s" printf "\033[48;2;%d;%d;%dm" $r $g $b; printf "\033[38;2;%d;%d;%dm" $invr $invg $invb printf "%s\033[m" "$c" done printf "\n" } baseline() { # Strip our name to the last dash-separated word before the .test suffix. testname=$(basename "$1") testname=${testname%%.test} testname=${testname##*-} printf '\033[H\033[J' case $testname in # Traditional ancient VT100 attributes. vt100) for attr in 0 1 4 5 7; do printf '\033[%dmE\033[m ' $attr done ;; # 16-color attributes. 16color) for attr in $(seq 30 37) $(seq 39 47) 49; do printf '\033[%dmE\033[m ' "$attr" done ;; # First 8 256-color attributes. Comparing mosh and tmux fails. 256color8) for attr in $(seq 0 7); do printf '\033[38;5;%dmE\033[m ' "$attr" printf '\033[48;5;%dmM\033[m ' "$attr" done ;; # Last 248 256-color attributes. 256color248) for attr in $(seq 8 255); do printf '\033[38;5;%dmE\033[m ' "$attr" printf '\033[48;5;%dmM\033[m ' "$attr" done ;; # True color. # See https://gist.github.com/XVilka/8346728 for the test case truecolor) echo "Normal:" test_true_color echo "Bold:" test_true_color 1 echo "Italic:" test_true_color 3 echo "Underline:" test_true_color 4 echo "Blink:" test_true_color 5 echo "Inverse:" test_true_color 7 echo "Invisible:" test_true_color 8 echo "Bold, italic and underline:" test_true_color 1 3 4 ;; # BCE in combination with various color modes. bce) # True color. printf '\033[48;2;255;0;255m\033[H\033[JTrue color\n' printf '\033[48;5;32m\033[J256 color\n' printf '\033[42m\033[J16 color\n' printf '\033[0mdone\n' ;; *) fail "unknown test name %s\n" "$1" ;; esac printf '\033[mend\n' } case $1 in baseline|direct) baseline "$0";; *) fail "unknown test argument %s\n" "$1";; esac mosh-1.4.0/src/tests/e2e-test-server0000755000175000017500000000410013145365374014224 00000000000000#!/bin/sh # # Harness script for Mosh tests, server side. Runs test script and # then captures screen with `tmux capture-pane`. Captures exitstatus # of both and returns appropriate errors. # # If MOSH_E2E_WAIT is set, then the test will wait for another tmux # client to attach to the test session before starting, and will wait # for other tmux clients to detach before exiting. wait_for_clients() { if [ -z "$MOSH_E2E_WAIT" ]; then return fi expected=$1 while true; do n=$(tmux list-clients -F . | wc -l) if [ $expected -eq 1 ]; then if [ $n -eq 1 ]; then return fi elif [ $n -ne 1 ]; then return fi sleep 1 done } export MOSH_SERVER_PID=$PPID if [ $# -lt 2 ]; then printf "not enough args\n" >&2 exit 99 fi testname=$1 shift rm -f "$testname.capture" "$testname.exitstatus" trap ":" TERM HUP QUIT # If the session closes on us, let the test we're running drive. on_exit() { rv=$? echo $rv > "$testname.exitstatus" exit $rv } trap on_exit EXIT # check for tmux if [ -z "$TMUX_PANE" ]; then printf "not running under tmux\n" >&2 exit 99 fi wait_for_clients 2 # run harnessed command eval "$@" testret=$? # Capture mosh-server runtime if possible. runtime=$(ps -o time= $PPID 2>/dev/null) if [ $? -ne 0 ]; then # Cygwin... runtime=- fi # Wait for tmux client screen to become up to date. sleep 1 printf "@@@ server complete @@@" >&2 wait_for_clients 1 i=0 while [ $i -lt 60 ]; do if grep -q "@@@ server complete @@@" "$testname.tmux.log"; then break fi i=$((i+1)) sleep 1 done if [ $i -ge 60 ]; then printf "wait for tmux client update failed, erroring test\n" >&2 exit 99 fi # capture screen if ! tmux capture-pane -et "$TMUX_PANE"; then printf "tmux capture-pane failed, erroring test\n" >&2 exit 99 fi if ! tmux save-buffer "$testname.capture"; then printf "tmux save-buffer failed, erroring test\n" >&2 exit 99 fi # Dump runtime into tmux log. printf "@@@ runtime %s @@@\n" "$runtime" # return useful exitstatus from harnessed command if [ $testret -ne 0 ]; then exit 1 fi exit 0 mosh-1.4.0/src/tests/window-resize.test0000755000175000017500000000326113103401307015040 00000000000000#!/bin/sh # # This is a regression test for window resizing in Mosh. Making it # happen is a little kludgy: we have to create other panes in tmux and # resize them. But it works! # # shellcheck source=e2e-test-subrs . "$(dirname "$0")/e2e-test-subrs" PATH=$PATH:.:$srcdir # Top-level wrapper. if [ $# -eq 0 ]; then e2e-test "$0" tmux baseline exit fi tmux_resize_commands() { hv=$1 shrink=$2 grow=$3 # Split the window into two panes. printf "split-window -%s\n" "${hv}" # Shrink the pane we created for i in $(seq 1 10); do sleepf printf "resize-pane -%s\n" "${shrink}" done # And grow it for i in $(seq 1 10); do sleepf printf "resize-pane -%s\n" "${grow}" done sleep 1 # Remove the pane we created. printf "kill-pane\n" } tmux_commands() { # An interactive shell is waiting for us in the mosh session. # Start a full screen application that will redraw on window # resize. printf "send-keys 'less \"%s\"' 0x0d\n" "${srcdir}/e2e-test" sleep 1 # we control the horizontal... tmux_resize_commands v D U sleep 1 # and the vertical. tmux_resize_commands h L R sleep 1 # Exit less. printf "send-keys 'q'\n" sleep 1 # Exit mosh session shell. printf "send-keys 'exit 0' 0x0d\n" # need to sleep extra long here, to let child commands complete, # and not have tmux exit prematurely sleep 5 } tmux_stdin() { tmux_commands | "$@" exit } baseline() { # Just start an interactive shell and wait. The tmux action drives. sh } case $1 in tmux) shift; tmux_stdin "$@";; baseline) baseline;; *) fail "unknown test argument %s\n" "$1";; esac mosh-1.4.0/src/tests/genbase64.pl0000755000175000017500000000167713103401307013455 00000000000000#!/usr/bin/perl use strict; use warnings; use MIME::Base64; my @vectors = ( "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff", "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff", "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00", "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\x55\x55\x55\x55\x55\x55\x55\x55", "\x55\x55\x55\x55\x55\x55\x55\x55\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa", "\x01\x02\x04\x08\x10\x20\x40\x80\xfe\xfd\xfb\xf7\xef\xdf\xbf\x7f", ); print 'base64_test_row static_base64_vector[] = {' . "\n"; for my $v (@vectors) { print ' { "'; my @chars = split '', $v; for my $c (@chars) { printf "\\x%02x", ord($c); } print '", "' . encode_base64($v, "") . '" },' . "\n"; } print ' { "", "" }' . "\n"; print "};\n"; mosh-1.4.0/src/tests/emulation-attributes-256color248.test0000775000175000017500000000767114326375453020261 00000000000000#!/bin/sh # # This validates VT100, 16-color, 256-color and true color attributes # against tmux. It is not run directly, but as subtests based on the # executable's name for vt100, 16color, 256color8, 256color248 and # truecolor. # This is because Mosh internally represents the first 8 values of the # 256color space as though they were the 16-color values they are # equivalent to. tmux does not filter this out on its redisplay, so # compares on these values fail though they are visually identical. # # shellcheck source=e2e-test-subrs . "$(dirname "$0")/e2e-test-subrs" PATH=$PATH:.:$srcdir # Need 2.3 for true-color support (2.2 may work also) if [ "$(basename "$0")" = emulation-attributes-truecolor.test ] && ! tmux_check 2 3; then printf "tmux does not support true color\n" >&2 exit 77 fi # Need 2.4 for BCE support if [ "$(basename "$0")" = emulation-attributes-bce.test ] && ! tmux_check 2 4; then printf "tmux does not support BCE\n" >&2 exit 77 fi # tmux 3.3a has a behavior change in how BCE is handled, which has # been reverted: https://github.com/tmux/tmux/issues/3339 if [ "$(basename "$0")" = emulation-attributes-bce.test ] && tmux_check 3 3a && ! tmux_check 3 3b; then printf "tmux 3.3a has incompatible BCE behavior\n" >&2 exit 77 fi # Top-level wrapper. if [ $# -eq 0 ]; then e2e-test "$0" baseline direct verify exit fi # OK, we have arguments, we're one of the test hooks. if [ $# -ne 1 ]; then fail "bad arguments %s\n" "$@" fi test_true_color() { s=$(printf "\033[0") for i in $@; do s="$s;$i" done s="${s}m" for attr in $(seq 0 76); do r=$((255-(attr*255/76))) g=$((attr*510/76)) b=$((attr*255/76)) if [ $g -gt 255 ]; then g=$((510-g)) fi invr=$((255-r)) invg=$((255-g)) invb=$((255-b)) c="E" printf "%s" "$s" printf "\033[48;2;%d;%d;%dm" $r $g $b; printf "\033[38;2;%d;%d;%dm" $invr $invg $invb printf "%s\033[m" "$c" done printf "\n" } baseline() { # Strip our name to the last dash-separated word before the .test suffix. testname=$(basename "$1") testname=${testname%%.test} testname=${testname##*-} printf '\033[H\033[J' case $testname in # Traditional ancient VT100 attributes. vt100) for attr in 0 1 4 5 7; do printf '\033[%dmE\033[m ' $attr done ;; # 16-color attributes. 16color) for attr in $(seq 30 37) $(seq 39 47) 49; do printf '\033[%dmE\033[m ' "$attr" done ;; # First 8 256-color attributes. Comparing mosh and tmux fails. 256color8) for attr in $(seq 0 7); do printf '\033[38;5;%dmE\033[m ' "$attr" printf '\033[48;5;%dmM\033[m ' "$attr" done ;; # Last 248 256-color attributes. 256color248) for attr in $(seq 8 255); do printf '\033[38;5;%dmE\033[m ' "$attr" printf '\033[48;5;%dmM\033[m ' "$attr" done ;; # True color. # See https://gist.github.com/XVilka/8346728 for the test case truecolor) echo "Normal:" test_true_color echo "Bold:" test_true_color 1 echo "Italic:" test_true_color 3 echo "Underline:" test_true_color 4 echo "Blink:" test_true_color 5 echo "Inverse:" test_true_color 7 echo "Invisible:" test_true_color 8 echo "Bold, italic and underline:" test_true_color 1 3 4 ;; # BCE in combination with various color modes. bce) # True color. printf '\033[48;2;255;0;255m\033[H\033[JTrue color\n' printf '\033[48;5;32m\033[J256 color\n' printf '\033[42m\033[J16 color\n' printf '\033[0mdone\n' ;; *) fail "unknown test name %s\n" "$1" ;; esac printf '\033[mend\n' } case $1 in baseline|direct) baseline "$0";; *) fail "unknown test argument %s\n" "$1";; esac mosh-1.4.0/src/tests/encrypt-decrypt.cc0000664000175000017500000001034314174450057015011 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ /* Tests the Mosh crypto layer by encrypting and decrypting a bunch of random messages, interspersed with some random bad ciphertexts which we need to reject. */ #include #define __STDC_FORMAT_MACROS #include #include "crypto.h" #include "prng.h" #include "fatal_assert.h" #include "test_utils.h" using namespace Crypto; PRNG prng; const size_t MESSAGE_SIZE_MAX = (2048 - 16); const size_t MESSAGES_PER_SESSION = 256; const size_t NUM_SESSIONS = 64; bool verbose = false; #define NONCE_FMT "%016" PRIx64 static std::string random_payload( void ) { const size_t len = prng.uint32() % MESSAGE_SIZE_MAX; char buf[ MESSAGE_SIZE_MAX ]; prng.fill( buf, len ); std::string payload( buf, len ); return payload; } static void test_bad_decrypt( Session &decryption_session ) { std::string bad_ct = random_payload(); bool got_exn = false; try { decryption_session.decrypt( bad_ct ); } catch ( const CryptoException &e ) { got_exn = true; /* The "bad decrypt" exception needs to be non-fatal, otherwise we are vulnerable to an easy DoS. */ fatal_assert( ! e.fatal ); } if ( verbose ) { hexdump( bad_ct, "bad ct" ); } fatal_assert( got_exn ); } /* Generate a single key and initial nonce, then perform some encryptions. */ static void test_one_session( void ) { Base64Key key; Session encryption_session( key ); Session decryption_session( key ); uint64_t nonce_int = prng.uint64(); if ( verbose ) { hexdump( key.data(), 16, "key" ); } for ( size_t i=0; i= 2 && strcmp( argv[ 1 ], "-v" ) == 0 ) { verbose = true; } for ( size_t i=0; i&2 exit 99 fi set -eu out=$( TERM=xterm \ ./inpty \ ../../scripts/mosh \ --client="../frontend/mosh-client" \ --server="$PWD/../frontend/mosh-server" \ --local --bind-server=127.0.0.1 127.0.0.1 \ -- printf 'he%s\n' llo) case "$out" in *hello*) exit 0;; *) exit 1;; esac mosh-1.4.0/src/tests/unicode-combine-fallback-assert.test0000755000175000017500000000126113103401307020324 00000000000000#!/bin/sh # # This test is for Github issue 667 # https://github.com/mobile-shell/mosh/issues/667 # where mosh will assert when a combining character is printed on a # just-cleared cell. # # It just sends the offending output to mosh and expects it to not die. # shellcheck source=e2e-test-subrs . "$(dirname "$0")/e2e-test-subrs" PATH=$PATH:.:$srcdir # Top-level wrapper. if [ $# -eq 0 ]; then e2e-test "$0" baseline exit fi # OK, we have arguments, we're one of the test hooks. if [ $# -ne 1 ]; then fail "bad arguments %s\n" "$@" fi baseline() { printf '0\033[1J\xcc\xb4' } case $1 in baseline) baseline;; *) fail "unknown test argument %s\n" "$1";; esac mosh-1.4.0/src/tests/test_utils.cc0000664000175000017500000000423714272621034014053 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include #include "test_utils.h" void hexdump( const void *buf, size_t len, const char *name ) { const unsigned char *data = (const unsigned char *) buf; printf( DUMP_NAME_FMT, name ); for ( size_t i = 0; i < len; i++ ) { // Although data[i] is an unsigned char, it will be promoted to a signed int // when passed as an argument. Explicitly cast it back to an unsigned type // so it can be printed in hex. printf( "%02x", static_cast( data[ i ] ) ); } printf( "\n" ); } void hexdump( const Crypto::AlignedBuffer &buf, const char *name ) { hexdump( buf.data(), buf.len(), name ); } void hexdump( const std::string &buf, const char *name ) { hexdump( buf.data(), buf.size(), name ); } mosh-1.4.0/src/tests/network-no-diff.test0000755000175000017500000000224513103401307015244 00000000000000#!/bin/sh # # This is a regression test to ensure that Mosh does not spin # on updates that do not actually change the framebuffer. # # shellcheck source=e2e-test-subrs . "$(dirname "$0")/e2e-test-subrs" PATH=$PATH:.:$srcdir # Top-level wrapper. if [ $# -eq 0 ]; then e2e-test "$0" baseline post exit fi # OK, we have arguments, we're one of the test hooks. if [ $# -ne 1 ]; then fail "bad arguments %s\n" "$@" fi baseline() { # Generate updates that don't change the screen i=0 while [ $i -lt 10 ] && printf 'x\b' && sleep 1; do i=$((i + 1)) done } post() { # Extract server run time. runtime=$(sed -E -n 's/.*@@@ runtime: (.*) @@@.*/\1/p' "$(basename "$0").d/baseline.tmux.log") # If this system can't actually report runtime, bail. if [ -z "$runtime" ] || [ "$runtime" -eq "-" ]; then exit 0 fi # If we ran for more than one second, fail. seconds=${runtime##*:} bigger=${runtime%:*} onesec=$(echo "$seconds >= 1" | bc) if [ "$onesec" -eq 1 ] || [ "$bigger" -ne 0 ]; then exit 1 fi exit 0 } case $1 in baseline) baseline;; post) post;; *) fail "unknown test argument %s\n" "$1";; esac mosh-1.4.0/src/tests/repeat.test0000755000175000017500000000276413103401307013521 00000000000000#!/bin/sh # # Run mosh many times. If run as repeat-with-stdin.test, also send # input constantly, to try and trigger a bug where mosh-server would # exit on OS X if input was received after the client session had # exited. # # 100 iterations runs in comparable time to other tests. : ${REPEAT_TEST_LOOPCOUNT:=100} # shellcheck source=e2e-test-subrs . "$(dirname "$0")/e2e-test-subrs" PATH=$PATH:.:$srcdir # Top-level wrapper. if [ $# -eq 0 ]; then do_tmux= case $(basename "$0" .test) in repeat-with-input) do_tmux=tmux;; esac e2e-test "$0" baseline client server ${do_tmux} exit fi # Run mosh repeatedly client() { for i in $(seq 1 $REPEAT_TEST_LOOPCOUNT); do (sleep 15; kill $$) & killpid=$! if ! "$@"; then printf "### iteration %d failed\n" "$i" kill $killpid exit 1 fi kill $killpid done } # e2e-test-server is slow because of its screen capture; this simple # wrapper is faster. server() { shift eval "$@" } # Constantly send keyboard input. tmux_commands() { while printf "send-keys 0x0d\n" && sleepf; do : done } tmux_stdin() { tmux_commands | "$@" exit } baseline() { printf "@@@ done\n" } post() { if [ "$(grep -c "@@@ done" "$(basename "$0").d/baseline.tmux.log")" -lt $REPEAT_TEST_LOOPCOUNT ]; then exit 1 fi } case $1 in tmux) shift; tmux_stdin "$@";; baseline) baseline;; client) shift client "$@";; server) shift server "$@";; *) fail "unknown test argument %s\n" "$1";; esac mosh-1.4.0/src/tests/unicode-later-combining.test0000775000175000017500000000250614174450057016752 00000000000000#!/bin/sh # # This test is for the first Unicode issue described on the Mosh web # page, a combining character drawn on a cell after returning the # cursor to that cell. # # We print 'COMBINING CIRCUMFLEX ACCENT' (U+0302) onto an unused cell. # We expect Mosh to output U+0020, U+0302 for that character cell (or # possibly U+00A0, U+0302). # # XXX This test is fragile because it depends on tmux's unicode rendering. # The baseline and variant tests produce different (but valid) outputs # that are visually identical. The variant test is not run or validated. # # shellcheck source=e2e-test-subrs . "$(dirname "$0")/e2e-test-subrs" PATH=$PATH:.:$srcdir # Top-level wrapper. if [ $# -eq 0 ]; then e2e-test "$0" baseline post exit fi # OK, we have arguments, we're one of the test hooks. if [ $# -ne 1 ]; then fail "bad arguments %s\n" "$@" fi baseline() { printf 'abc\n\314\202\ndef\n' } variant() { printf 'abc\n \314\202\ndef\n' } post() { export LANG=C if [ "$(tmux -V)" = "tmux 2.4" ]; then skip "tmux 2.4 unicode combining bug breaks this test\n" fi if grep -q "$(printf '^\302\240\314\202$')" "$(basename "$0").d/baseline.capture"; then exit 0 fi exit 1 } case $1 in baseline) baseline;; variant) variant;; post) post;; *) fail "unknown test argument %s\n" "$1";; esac mosh-1.4.0/src/tests/emulation-ascii-iso-8859.test0000755000175000017500000000310513103401307016515 00000000000000#!/bin/sh # # This validates display of ASCII and ISO-8859-1 characters. # # shellcheck source=e2e-test-subrs . "$(dirname "$0")/e2e-test-subrs" PATH=$PATH:.:$srcdir # Top-level wrapper. if [ $# -eq 0 ]; then e2e-test "$0" baseline direct verify exit fi # OK, we have arguments, we're one of the test hooks. if [ $# -ne 1 ]; then fail "bad arguments %s\n" "$@" fi baseline() { printf '\033[H\033[J' cat <<'EOF' 20 21 ! 22 " 23 # 24 $ 25 % 26 & 27 ' 28 ( 29 ) 2a * 2b + 2c , 2d - 2e . 2f / 30 0 31 1 32 2 33 3 34 4 35 5 36 6 37 7 38 8 39 9 3a : 3b ; 3c < 3d = 3e > 3f ? 40 @ 41 A 42 B 43 C 44 D 45 E 46 F 47 G 48 H 49 I 4a J 4b K 4c L 4d M 4e N 4f O 50 P 51 Q 52 R 53 S 54 T 55 U 56 V 57 W 58 X 59 Y 5a Z 5b [ 5c \ 5d ] 5e ^ 5f _ 60 ` 61 a 62 b 63 c 64 d 65 e 66 f 67 g 68 h 69 i 6a j 6b k 6c l 6d m 6e n 6f o 70 p 71 q 72 r 73 s 74 t 75 u 76 v 77 w 78 x 79 y 7a z 7b { 7c | 7d } 7e ~ a0   a1 ¡ a2 ¢ a3 £ a4 ¤ a5 ¥ a6 ¦ a7 § a8 ¨ a9 © aa ª ab « ac ¬ ad ­ ae ® af ¯ b0 ° b1 ± b2 ² b3 ³ b4 ´ b5 µ b6 ¶ b7 · b8 ¸ b9 ¹ ba º bb » bc ¼ bd ½ be ¾ bf ¿ c0 À c1 Á c2 Â c3 Ã c4 Ä c5 Å c6 Æ c7 Ç c8 È c9 É ca Ê cb Ë cc Ì cd Í ce Î cf Ï d0 Ð d1 Ñ d2 Ò d3 Ó d4 Ô d5 Õ d6 Ö d7 × d8 Ø d9 Ù da Ú db Û dc Ü dd Ý de Þ df ß e0 à e1 á e2 â e3 ã e4 ä e5 å e6 æ e7 ç e8 è e9 é ea ê eb ë ec ì ed í ee î ef ï f0 ð f1 ñ f2 ò f3 ó f4 ô f5 õ f6 ö f7 ÷ f8 ø f9 ù fa ú fb û fc ü fd ý fe þ ff ÿ EOF } case $1 in baseline|direct) baseline;; *) fail "unknown test argument %s\n" "$1";; esac mosh-1.4.0/src/tests/e2e-success.test0000755000175000017500000000073313103401307014354 00000000000000#!/bin/sh # shellcheck source=e2e-test-subrs . "$(dirname "$0")/e2e-test-subrs" PATH=$PATH:.:$srcdir # Top-level wrapper. if [ $# -eq 0 ]; then e2e-test "$0" baseline direct variant verify same exit fi # OK, we have arguments, we're one of the test hooks. if [ $# -ne 1 ]; then fail "bad arguments %s\n" "$@" fi baseline() { printf "\033[H\033[J" } case $1 in baseline|direct|variant) baseline;; *) fail "unknown test argument %s\n" "$1";; esac mosh-1.4.0/src/tests/e2e-test0000775000175000017500000001615014174450057012726 00000000000000#!/bin/sh . "$(dirname "$0")/e2e-test-subrs" # # Validate that mosh produces expected output, using screen captures # in tmux. # log() { printf "$@" } error() { printf "$@" >&2 } dump_logs() { dir=$1 shift testname=$(basename "$dir" .d) for logfile in $dir/*.tmux.log; do printf "travis_fold:start:%s-%s\n" "$testname" "$(basename "$logfile")" cat "$logfile" printf "travis_fold:end:%s-%s\n" "$testname" "$(basename "$logfile")" done } test_success() { exit 0 } test_failure() { error "$@" exit 1 } test_skipped() { error "$@" exit 77 } test_error() { error "$@" exit 99 } test_exitstatus() { status=$1 shift error "$@" exit "$status" } ssh_localhost_check() { ssh localhost : if [ $? -ne 0 ]; then error "ssh to localhost failed\n" return 1 fi return 0 } # These two functions are wrappers for mosh-client/mosh-server to turn # on verbosity and log stderr. mosh_client() { if [ -z "$MOSH_CLIENT" ] || [ -z "$MOSH_E2E_TEST" ]; then test_error "mosh_client: variables missing\n" fi exec 2> "${MOSH_E2E_TEST}.client.stderr" exec "$MOSH_CLIENT" $MOSH_CLIENT_ARGS "$@" } mosh_server() { if [ -z "$MOSH_SERVER" ] || [ -z "$MOSH_E2E_TEST" ]; then test_error "mosh_server: variables missing\n" fi exec 2> "${MOSH_E2E_TEST}.server.stderr" exec "$MOSH_SERVER" new -vv $MOSH_SERVER_ARGS -@ "$@" } # main # Set up environment if [ -z "$srcdir" ]; then export srcdir=$PWD else srcdir="$(cd "$srcdir" && pwd)" if [ $? -ne 0 ]; then error "can't cd to srcdir: %s\n" "$srcdir" exit 99 fi fi # Wrappers. case "$(basename "$0")" in mosh-client) mosh_client "$@" exit ;; mosh-server) mosh_server "$@" exit ;; *) ;; esac if [ $# -lt 2 ]; then test_error "not enough args\n" fi # Get arguments (only one so far) test_name=$1 shift test_args=$@ # XXX could use AM testsubdir macro instead test_dir=$(basename "${test_name}").d test_script="${test_name}" tests_dir=$(dirname "${test_name}") if ! set_locale "${tests_dir}"; then test_error "e2e-test: no usable locale\n" fi # XXX this ignores $TMPDIR, because it results in an overlong pathname on OS X tmux_socket="/tmp/.tmux-mosh-test-$$" # need version 1.8 for capture-pane if ! tmux_check 1 8; then test_skipped "tmux unavailable\n" fi rm -rf "${test_dir}" mkdir "${test_dir}" on_exit() { rv=$? if test $rv -ne 0; then dump_logs "$test_dir" $test_args fi exit $rv } trap on_exit EXIT # Set up tests to run. server_tests= compare_tests= for i in $test_args; do case $i in baseline|direct|variant) server_tests="$server_tests $i";; verify|same|different) compare_tests="$compare_tests $i";; tmux) tmux=1;; client) client=1;; server) server=1;; post) post=1;; mosh-args) mosh_args=$("${test_script}" mosh-args);; client-args) MOSH_CLIENT_ARGS=$("${test_script}" client-args) export MOSH_CLIENT_ARGS;; server-args) MOSH_SERVER_ARGS=$("${test_script}" server-args) export MOSH_SERVER_ARGS;; *) error 'unknown test type argument %s\n' "$i" exit 99 ;; esac done # Run test(s). client_wrapper= if [ -n "$client" ]; then client_wrapper="${test_script} client" fi server_wrapper="\"${srcdir}/e2e-test-server\"" if [ -n "$server" ]; then server_wrapper="\"${srcdir}/${test_script}\" server" fi tmux_stdin="${srcdir}/hold-stdin" if [ -n "$tmux" ]; then tmux_stdin="${test_script} tmux" fi ln -fs "${tmux_socket}" "${test_dir}/tmux-socket" for run in $server_tests; do log "Running server test %s.\n" "$run" # These three variables are for the benefit of the mosh-client and mosh-server wrappers. export MOSH_CLIENT="$PWD/../frontend/mosh-client" export MOSH_SERVER="$PWD/../frontend/mosh-server" export MOSH_E2E_TEST="$PWD/${test_dir}/${run}" # XXX need to quote special chars in server pathname here somehow sut="../../scripts/mosh --client=${srcdir}/mosh-client --server=${srcdir}/mosh-server --local --bind-server=127.0.0.1 ${mosh_args} 127.0.0.1" if [ "$run" = "direct" ]; then sut="" fi # Actually execute code under test # XXX tmux 1.8 requires shell command as a single arg; once we move to 2.0, undo these quotes # tmux <= 2.5 ignore -x/-y, but the client sets the session to 80x24. # tmux from 2017-05-27 and later should default to an 80x24 session, # but do use -x/-y on control-master clients. ${tmux_stdin} tmux -f /dev/null -S "${tmux_socket}" -C new-session -x 80 -y 24 "${srcdir}/print-exitstatus ${client_wrapper} ${sut} ${server_wrapper} \"${PWD}/${test_dir}/${run}\" \"${PWD}/${test_script} ${run}\"" > "${test_dir}/${run}.tmux.log" rv=$? rm -f "${tmux_socket}" "${test_dir}/tmux-socket" if [ $rv -ne 0 ]; then test_error "tmux failure on test %s\n" "$run" fi # Check for mosh failures if ! grep -q "@@@ exitstatus: 0 @@@" "${test_dir}/${run}.tmux.log"; then test_error "mosh-client had non-zero exitstatus\n" fi # Check for server harness failures if [ -z "$server" ]; then if [ ! -s "${test_dir}/${run}.capture" ] \ || [ ! -s "${test_dir}/${run}.exitstatus" ]; then test_error "server harness failure on test %s\n" "$run" fi read -r server_rv < "${test_dir}/${run}.exitstatus" if [ "$server_rv" -ne 0 ]; then test_error "server harness exited with status %s\n" "$server_rv" fi fi if [ "${run}" != "direct" ]; then # Check for "round-trip" failures if grep -q "round-trip Instruction verification failed" "${test_dir}/${run}.server.stderr"; then test_error "Round-trip Instruction verification failed on server during %s\n" "$run" fi # Check for 0-timeout select() issue if egrep -q "(polls, rate limiting|consecutive polls)" "${test_dir}/${run}.server.stderr"; then if [ "osx" != "${TRAVIS_OS_NAME}" ]; then test_error "select() with zero timeout called too often on server during %s\n" "$run" fi fi # Check for assert() if egrep -q "assertion.*failed" "${test_dir}/${run}.server.stderr"; then test_error "assertion during %s\n" "$run" fi fi # XXX We'd also like to check for "target state Instruction # verification failed", a new check, but tmux's lack of BCE # support forces mosh to clear lines with spaces and change a # framebuffer in a way that causes this to fire spuriously. done for compare in $compare_tests; do log "Running server comparison %s.\n" "$compare" # Compare captures if [ "$compare" = verify ]; then test1="direct" test2="baseline" else test1="baseline" test2="variant" fi if diff -q "${test_dir}/${test1}.capture" "${test_dir}/${test2}.capture"; then differ=n else differ=y fi if [ "$compare" = different ]; then desired=y badresult=same else desired=n badresult=different fi if [ $differ != $desired ]; then test_failure "Output is %s between tests %s and %s\n" "$badresult" "$test1" "$test2" fi done # Run a post script (usually a custom validation of results) if [ -n "$post" ]; then "${test_script}" post status=$? if [ $status -ne 0 ]; then test_exitstatus $status "Post test failed with exitstatus %d\n" $status fi fi mosh-1.4.0/src/tests/repeat-with-input.test0000755000175000017500000000276413103401307015627 00000000000000#!/bin/sh # # Run mosh many times. If run as repeat-with-stdin.test, also send # input constantly, to try and trigger a bug where mosh-server would # exit on OS X if input was received after the client session had # exited. # # 100 iterations runs in comparable time to other tests. : ${REPEAT_TEST_LOOPCOUNT:=100} # shellcheck source=e2e-test-subrs . "$(dirname "$0")/e2e-test-subrs" PATH=$PATH:.:$srcdir # Top-level wrapper. if [ $# -eq 0 ]; then do_tmux= case $(basename "$0" .test) in repeat-with-input) do_tmux=tmux;; esac e2e-test "$0" baseline client server ${do_tmux} exit fi # Run mosh repeatedly client() { for i in $(seq 1 $REPEAT_TEST_LOOPCOUNT); do (sleep 15; kill $$) & killpid=$! if ! "$@"; then printf "### iteration %d failed\n" "$i" kill $killpid exit 1 fi kill $killpid done } # e2e-test-server is slow because of its screen capture; this simple # wrapper is faster. server() { shift eval "$@" } # Constantly send keyboard input. tmux_commands() { while printf "send-keys 0x0d\n" && sleepf; do : done } tmux_stdin() { tmux_commands | "$@" exit } baseline() { printf "@@@ done\n" } post() { if [ "$(grep -c "@@@ done" "$(basename "$0").d/baseline.tmux.log")" -lt $REPEAT_TEST_LOOPCOUNT ]; then exit 1 fi } case $1 in tmux) shift; tmux_stdin "$@";; baseline) baseline;; client) shift client "$@";; server) shift server "$@";; *) fail "unknown test argument %s\n" "$1";; esac mosh-1.4.0/src/tests/emulation-80th-column.test0000755000175000017500000000233113103401307016300 00000000000000#!/bin/sh # # This test validates the ancient VT100 behavior of positioning the # cursor at column 80 (and not wrapping) after 80 characters are # output, and behaving accordingly with subsequent cursor motion # commands (CR+LF in this state should not result in an extra blank # line). # # shellcheck source=e2e-test-subrs . "$(dirname "$0")/e2e-test-subrs" PATH=$PATH:.:$srcdir # Top-level wrapper. if [ $# -eq 0 ]; then e2e-test "$0" baseline post exit fi # OK, we have arguments, we're one of the test hooks. if [ $# -ne 1 ]; then fail "bad arguments %s\n" "$@" fi baseline() { # We need to control CR and LF individually for this test. TERMIO=$(stty -g) trap 'stty "$TERMIO"' EXIT stty raw printf '\033[H\033[J' for lines in $(seq 1 25); do for tencols in $(seq 1 8); do printf "EEEEEEEEEE" done printf "\r\n" done } post() { # If hidden 80th column is working properly, then the lines # will have no blank lines in between and we should see 23 # of them. if [ "$(grep -c "EEEEEEEEEE" "$(basename "$0").d/baseline.capture")" -ne 23 ]; then exit 1 fi } case $1 in baseline) baseline;; post) post;; *) fail "unknown test argument %s\n" "$1";; esac mosh-1.4.0/src/tests/Makefile.am0000664000175000017500000000540414272621034013376 00000000000000EXTRA_DIST = \ hold-stdin print-exitstatus \ e2e-test e2e-test-server \ e2e-test-subrs \ mosh-client mosh-server \ local.test \ $(displaytests) \ emulation-attributes.test AM_CXXFLAGS = $(WARNING_CXXFLAGS) $(PICKY_CXXFLAGS) $(HARDEN_CFLAGS) $(MISC_CXXFLAGS) $(CODE_COVERAGE_CXXFLAGS) AM_LDFLAGS = $(HARDEN_LDFLAGS) $(CODE_COVERAGE_LIBS) displaytests = \ e2e-success.test \ e2e-failure.test \ emulation-ascii-iso-8859.test \ emulation-80th-column.test \ emulation-attributes-vt100.test \ emulation-attributes-16color.test \ emulation-attributes-256color8.test \ emulation-attributes-256color248.test \ emulation-attributes-truecolor.test \ emulation-attributes-bce.test \ emulation-back-tab.test \ emulation-cursor-motion.test \ emulation-multiline-scroll.test \ emulation-scroll.test \ emulation-wrap-across-frames.test \ network-no-diff.test \ prediction-unicode.test \ pty-deadlock.test \ repeat.test \ repeat-with-input.test \ server-network-timeout.test \ server-signal-timeout.test \ window-resize.test \ unicode-combine-fallback-assert.test \ unicode-later-combining.test \ window-resize.test check_PROGRAMS = ocb-aes encrypt-decrypt base64 nonce-incr inpty is-utf8-locale TESTS = ocb-aes encrypt-decrypt base64 nonce-incr local.test $(displaytests) XFAIL_TESTS = \ e2e-failure.test \ emulation-attributes-256color8.test base64_vector.cc: $(srcdir)/genbase64.pl $(AM_V_GEN)echo '#include "base64_vector.h"' > base64_vector.cc || rm base64_vector.cc $(AM_V_GEN)perl $(srcdir)/genbase64.pl >> base64_vector.cc || rm base64_vector.cc ocb_aes_SOURCES = ocb-aes.cc test_utils.cc test_utils.h ocb_aes_CPPFLAGS = -I$(srcdir)/../crypto -I$(srcdir)/../util $(CRYPTO_CFLAGS) ocb_aes_LDADD = ../crypto/libmoshcrypto.a ../util/libmoshutil.a $(CRYPTO_LIBS) encrypt_decrypt_SOURCES = encrypt-decrypt.cc test_utils.cc test_utils.h encrypt_decrypt_CPPFLAGS = -I$(srcdir)/../crypto -I$(srcdir)/../util encrypt_decrypt_LDADD = ../crypto/libmoshcrypto.a ../util/libmoshutil.a $(CRYPTO_LIBS) base64_SOURCES = base64.cc base64_vector.cc base64_vector.h genbase64.pl base64_CPPFLAGS = $(ocb_aes_CPPFLAGS) base64_LDADD = $(ocb_aes_LDADD) nonce_incr_SOURCES = nonce-incr.cc nonce_incr_CPPFLAGS = -I$(srcdir)/../network -I$(srcdir)/../crypto -I$(srcdir)/../util $(CRYPTO_CFLAGS) nonce_incr_LDADD = ../network/libmoshnetwork.a ../crypto/libmoshcrypto.a ../util/libmoshutil.a $(CRYPTO_LIBS) inpty_SOURCES = inpty.cc inpty_CPPFLAGS = -I$(srcdir)/../util inpty_LDADD = ../util/libmoshutil.a is_utf8_locale_SOURCES = is-utf8-locale.cc is_utf8_locale_CPPFLAGS = -I$(srcdir)/../util is_utf8_locale_LDADD = ../util/libmoshutil.a $(LIBUTIL) clean-local: clean-local-check .PHONY: clean-local-check clean-local-check: -for i in $(displaytests); do rm -rf $$i.d/; done CLEANFILES = base64_vector.cc mosh-1.4.0/src/tests/emulation-multiline-scroll.test0000755000175000017500000000211313103401307017516 00000000000000#!/bin/sh # # This is a regression test for a crash seen in my development # of performance code for Mosh, involving insert/delete line. # It does insert/delete line from 0 to 2 more than the window height # 24 in this test environment). # # shellcheck source=e2e-test-subrs . "$(dirname "$0")/e2e-test-subrs" PATH=$PATH:.:$srcdir # Top-level wrapper. if [ $# -eq 0 ]; then e2e-test "$0" baseline exit fi # OK, we have arguments, we're one of the test hooks. if [ $# -ne 1 ]; then fail "bad arguments %s\n" "$@" fi baseline() { printf '\033[H\033[J' for dir in L M; do for i in $(seq 0 2) $(seq 22 26); do printf '%d\r' "$i" printf '\033[%d%s' "$i" "$dir" # On the one hand, we'd like to test that this works # properly on both client and server, which requires # delays so that each iteration percolates to the client # by itself. On the other hand, that makes the test take # a long time. Compromise on .1 second. sleepf done done } case $1 in baseline) baseline;; *) fail "unknown test argument %s\n" "$1";; esac mosh-1.4.0/src/tests/pty-deadlock.test0000755000175000017500000000417313103401307014615 00000000000000#!/bin/sh # # This is a regression test for a BSD pty bug in Mosh. On # FreeBSD/OpenBSD/OS X, a pty master can block on read() after # select() has informed us that there is data available, if a ^S is # written to the pty master between the select() and the read(). # # Unfortunately, everything attached to the pty gets stuck when this # happens. If this tests fails, you will need to do some manual # cleanup with kill -9. # # shellcheck source=e2e-test-subrs . "$(dirname "$0")/e2e-test-subrs" PATH=$PATH:.:$srcdir # Top-level wrapper. if [ $# -eq 0 ]; then e2e-test "$0" tmux baseline post exit fi tmux_commands() { # An interactive shell is waiting for us in the mosh session. # Start test... sleep 2 printf "send-keys 0x0d\n" sleep 5 # Stop output... printf "send-keys 0x13\n" sleep 10 # Restart output... printf "send-keys 0x11\n" sleep 10 # And stop the test script, so it produces its exit messge. printf "send-keys 0x0d\n" # This will get killed by SIGPIPE. while printf "show-options\n" && sleep 1; do : done } tmux_stdin() { tmux_commands | "$@" exit } baseline() { # Make a lot of noise on stdout to keep mosh busy, and exit # with a distinctive message when we get a CR. Exit after 10s in any case. blat=$(for i in $(seq 1 100); do printf 'a\nb\nc\nd\ne\nf\ng\nh\ni\nj\nk\nl\nm\nn\no\np\nq\nr\ns\nt\nu\nv\nw\nx\ny\nz\n' done) read -r x while printf '%s' "$blat"; do : done & printpid=$! (sleep 120; kill $$ $printpid) & killpid=$! read -r x kill $printpid # Try and make sure the printer stops writing before the following printf sleep 1 printf "\n=== normal exit ===\n" # Let tty queues drain, so the exit message gets to mosh-client # before we exit sleep 4 # Kill the killer and exit normally. kill $killpid } post() { if grep -q '=== normal exit ===' "$(basename "$0").d/baseline.capture"; then exit 0 fi exit 1 } case $1 in tmux) shift; tmux_stdin "$@";; baseline) baseline;; post) post;; *) fail "unknown test argument %s\n" "$1";; esac mosh-1.4.0/src/tests/emulation-attributes-bce.test0000775000175000017500000000767114326375453017201 00000000000000#!/bin/sh # # This validates VT100, 16-color, 256-color and true color attributes # against tmux. It is not run directly, but as subtests based on the # executable's name for vt100, 16color, 256color8, 256color248 and # truecolor. # This is because Mosh internally represents the first 8 values of the # 256color space as though they were the 16-color values they are # equivalent to. tmux does not filter this out on its redisplay, so # compares on these values fail though they are visually identical. # # shellcheck source=e2e-test-subrs . "$(dirname "$0")/e2e-test-subrs" PATH=$PATH:.:$srcdir # Need 2.3 for true-color support (2.2 may work also) if [ "$(basename "$0")" = emulation-attributes-truecolor.test ] && ! tmux_check 2 3; then printf "tmux does not support true color\n" >&2 exit 77 fi # Need 2.4 for BCE support if [ "$(basename "$0")" = emulation-attributes-bce.test ] && ! tmux_check 2 4; then printf "tmux does not support BCE\n" >&2 exit 77 fi # tmux 3.3a has a behavior change in how BCE is handled, which has # been reverted: https://github.com/tmux/tmux/issues/3339 if [ "$(basename "$0")" = emulation-attributes-bce.test ] && tmux_check 3 3a && ! tmux_check 3 3b; then printf "tmux 3.3a has incompatible BCE behavior\n" >&2 exit 77 fi # Top-level wrapper. if [ $# -eq 0 ]; then e2e-test "$0" baseline direct verify exit fi # OK, we have arguments, we're one of the test hooks. if [ $# -ne 1 ]; then fail "bad arguments %s\n" "$@" fi test_true_color() { s=$(printf "\033[0") for i in $@; do s="$s;$i" done s="${s}m" for attr in $(seq 0 76); do r=$((255-(attr*255/76))) g=$((attr*510/76)) b=$((attr*255/76)) if [ $g -gt 255 ]; then g=$((510-g)) fi invr=$((255-r)) invg=$((255-g)) invb=$((255-b)) c="E" printf "%s" "$s" printf "\033[48;2;%d;%d;%dm" $r $g $b; printf "\033[38;2;%d;%d;%dm" $invr $invg $invb printf "%s\033[m" "$c" done printf "\n" } baseline() { # Strip our name to the last dash-separated word before the .test suffix. testname=$(basename "$1") testname=${testname%%.test} testname=${testname##*-} printf '\033[H\033[J' case $testname in # Traditional ancient VT100 attributes. vt100) for attr in 0 1 4 5 7; do printf '\033[%dmE\033[m ' $attr done ;; # 16-color attributes. 16color) for attr in $(seq 30 37) $(seq 39 47) 49; do printf '\033[%dmE\033[m ' "$attr" done ;; # First 8 256-color attributes. Comparing mosh and tmux fails. 256color8) for attr in $(seq 0 7); do printf '\033[38;5;%dmE\033[m ' "$attr" printf '\033[48;5;%dmM\033[m ' "$attr" done ;; # Last 248 256-color attributes. 256color248) for attr in $(seq 8 255); do printf '\033[38;5;%dmE\033[m ' "$attr" printf '\033[48;5;%dmM\033[m ' "$attr" done ;; # True color. # See https://gist.github.com/XVilka/8346728 for the test case truecolor) echo "Normal:" test_true_color echo "Bold:" test_true_color 1 echo "Italic:" test_true_color 3 echo "Underline:" test_true_color 4 echo "Blink:" test_true_color 5 echo "Inverse:" test_true_color 7 echo "Invisible:" test_true_color 8 echo "Bold, italic and underline:" test_true_color 1 3 4 ;; # BCE in combination with various color modes. bce) # True color. printf '\033[48;2;255;0;255m\033[H\033[JTrue color\n' printf '\033[48;5;32m\033[J256 color\n' printf '\033[42m\033[J16 color\n' printf '\033[0mdone\n' ;; *) fail "unknown test name %s\n" "$1" ;; esac printf '\033[mend\n' } case $1 in baseline|direct) baseline "$0";; *) fail "unknown test argument %s\n" "$1";; esac mosh-1.4.0/src/tests/server-network-timeout.test0000755000175000017500000000554213103401307016717 00000000000000#!/bin/sh # # This test checks for operation of the MOSH_SERVER_NETWORK_TMOUT variable. # It does this by # * setting the variable # * killing the client (and its network traffic) # * waiting server-side, for the server to die # If it is killed, the test is successful. # If it survives that long and the server is still around, the test fails. # The client waits a bit longer than the server so that status can be collected # properly. # TIMEOUT=10 # shellcheck source=e2e-test-subrs . "$(dirname "$0")/e2e-test-subrs" PATH=$PATH:.:$srcdir # Top-level wrapper. if [ $# -eq 0 ]; then e2e-test "$0" client baseline exit fi # OK, we have arguments, we're one of the test hooks. client() { case "$myname" in server-network-timeout) export MOSH_SERVER_NETWORK_TMOUT=$TIMEOUT;; server-signal-timeout) export MOSH_SERVER_SIGNAL_TMOUT=$TIMEOUT;; *) fail "unexpected test name %s\n" "$myname" esac shift # Print this early, because the server is expected to die before # the normal time this is sent by e2e-test-server. printf "@@@ server complete @@@\n" >&2 # Run mosh SUT. eval "$@" # The client may be murdered. We need to expect that... retval=$? case $retval in 0|1) fail "mosh-client had a normal exit\n";; # test condition failed 9|137|265) # Aha, signal 9. Wait. sleep $(( TIMEOUT + 12 )) exit 0 ;; *) fail "unknown client wrapper failure, retval=%d\n" $retval ;; esac fail "client wrapper shouldnt get here\n" } baseline() { # check for our wonderful variable if [ -z "$MOSH_SERVER_NETWORK_TMOUT" ] && [ -z "$MOSH_SERVER_SIGNAL_TMOUT" ]; then env fail "Variable unset\n" fi # check for our client if [ -z "$MOSH_CLIENT_PID" ]; then env fail "Client pid unavailable\n" fi if ! kill -0 "$MOSH_CLIENT_PID"; then fail "mosh client is unexpectedly missing\n" fi # Set up for good return and cleanup on being killed trap "echo got killed >&2; sleep 1; exit 0" HUP TERM sleep 1 # Kill the client, to stop network traffic. kill -KILL "$MOSH_CLIENT_PID" case "$myname" in server-network-timeout) # Just wait. This is the hardest part. sleep $(( TIMEOUT + 7 )) ;; server-signal-timeout) # Wait for the timeout to expire. sleep $(( TIMEOUT + 2 )) # Tell the server to go away. kill -USR1 "$MOSH_SERVER_PID" sleep 5 ;; *) fail "unexpected test name %s\n" "$myname" esac # If we're still alive and the server is too, the test failed. # XXX the server is getting killed and we're getting here anyway. # Exit with error only if server is still around. sleep 1 ! kill -0 "$MOSH_SERVER_PID" exit } myname="$(basename "$0" .test)" case $1 in baseline|variant) baseline;; client) client "$@";; *) fail "unknown test argument %s\n" "$1";; esac mosh-1.4.0/src/tests/test_utils.h0000644000175000017500000000337213103401307013701 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #ifndef TEST_UTILS_HPP #define TEST_UTILS_HPP #include #include "crypto.h" #define DUMP_NAME_FMT "%-10s " void hexdump( const void *buf, size_t len, const char *name ); void hexdump( const Crypto::AlignedBuffer &buf, const char *name ); void hexdump( const std::string &buf, const char *name ); #endif mosh-1.4.0/src/tests/print-exitstatus0000755000175000017500000000113313103401307014617 00000000000000#!/usr/bin/env perl # # Print exitstatus on stderr. # use warnings; use strict; my $rc = system(@ARGV); if ($? == -1) { die "system failed: %!\n"; } if ($? == 0) { $rc = 0; } elsif ($? >= 256) { $rc = $? >> 8; } else { $rc = ($? & 127) | 128; } print STDERR "@@@ exitstatus: ${rc} @@@\n"; # Now look for it in log file. my $grepfilename = $ENV{'MOSH_E2E_TEST'} . ".tmux.log"; for my $i (1..600) { open(my $grepfile, "<", $grepfilename) or die; while (<$grepfile>) { chomp; /@@@ exitstatus: .* @@@/ && goto gotit; } close($grepfile); sleep .1; } gotit: exit $rc; mosh-1.4.0/src/tests/emulation-attributes-256color8.test0000775000175000017500000000767114326375453020113 00000000000000#!/bin/sh # # This validates VT100, 16-color, 256-color and true color attributes # against tmux. It is not run directly, but as subtests based on the # executable's name for vt100, 16color, 256color8, 256color248 and # truecolor. # This is because Mosh internally represents the first 8 values of the # 256color space as though they were the 16-color values they are # equivalent to. tmux does not filter this out on its redisplay, so # compares on these values fail though they are visually identical. # # shellcheck source=e2e-test-subrs . "$(dirname "$0")/e2e-test-subrs" PATH=$PATH:.:$srcdir # Need 2.3 for true-color support (2.2 may work also) if [ "$(basename "$0")" = emulation-attributes-truecolor.test ] && ! tmux_check 2 3; then printf "tmux does not support true color\n" >&2 exit 77 fi # Need 2.4 for BCE support if [ "$(basename "$0")" = emulation-attributes-bce.test ] && ! tmux_check 2 4; then printf "tmux does not support BCE\n" >&2 exit 77 fi # tmux 3.3a has a behavior change in how BCE is handled, which has # been reverted: https://github.com/tmux/tmux/issues/3339 if [ "$(basename "$0")" = emulation-attributes-bce.test ] && tmux_check 3 3a && ! tmux_check 3 3b; then printf "tmux 3.3a has incompatible BCE behavior\n" >&2 exit 77 fi # Top-level wrapper. if [ $# -eq 0 ]; then e2e-test "$0" baseline direct verify exit fi # OK, we have arguments, we're one of the test hooks. if [ $# -ne 1 ]; then fail "bad arguments %s\n" "$@" fi test_true_color() { s=$(printf "\033[0") for i in $@; do s="$s;$i" done s="${s}m" for attr in $(seq 0 76); do r=$((255-(attr*255/76))) g=$((attr*510/76)) b=$((attr*255/76)) if [ $g -gt 255 ]; then g=$((510-g)) fi invr=$((255-r)) invg=$((255-g)) invb=$((255-b)) c="E" printf "%s" "$s" printf "\033[48;2;%d;%d;%dm" $r $g $b; printf "\033[38;2;%d;%d;%dm" $invr $invg $invb printf "%s\033[m" "$c" done printf "\n" } baseline() { # Strip our name to the last dash-separated word before the .test suffix. testname=$(basename "$1") testname=${testname%%.test} testname=${testname##*-} printf '\033[H\033[J' case $testname in # Traditional ancient VT100 attributes. vt100) for attr in 0 1 4 5 7; do printf '\033[%dmE\033[m ' $attr done ;; # 16-color attributes. 16color) for attr in $(seq 30 37) $(seq 39 47) 49; do printf '\033[%dmE\033[m ' "$attr" done ;; # First 8 256-color attributes. Comparing mosh and tmux fails. 256color8) for attr in $(seq 0 7); do printf '\033[38;5;%dmE\033[m ' "$attr" printf '\033[48;5;%dmM\033[m ' "$attr" done ;; # Last 248 256-color attributes. 256color248) for attr in $(seq 8 255); do printf '\033[38;5;%dmE\033[m ' "$attr" printf '\033[48;5;%dmM\033[m ' "$attr" done ;; # True color. # See https://gist.github.com/XVilka/8346728 for the test case truecolor) echo "Normal:" test_true_color echo "Bold:" test_true_color 1 echo "Italic:" test_true_color 3 echo "Underline:" test_true_color 4 echo "Blink:" test_true_color 5 echo "Inverse:" test_true_color 7 echo "Invisible:" test_true_color 8 echo "Bold, italic and underline:" test_true_color 1 3 4 ;; # BCE in combination with various color modes. bce) # True color. printf '\033[48;2;255;0;255m\033[H\033[JTrue color\n' printf '\033[48;5;32m\033[J256 color\n' printf '\033[42m\033[J16 color\n' printf '\033[0mdone\n' ;; *) fail "unknown test name %s\n" "$1" ;; esac printf '\033[mend\n' } case $1 in baseline|direct) baseline "$0";; *) fail "unknown test argument %s\n" "$1";; esac mosh-1.4.0/src/tests/emulation-attributes.test0000775000175000017500000000767114326375453016452 00000000000000#!/bin/sh # # This validates VT100, 16-color, 256-color and true color attributes # against tmux. It is not run directly, but as subtests based on the # executable's name for vt100, 16color, 256color8, 256color248 and # truecolor. # This is because Mosh internally represents the first 8 values of the # 256color space as though they were the 16-color values they are # equivalent to. tmux does not filter this out on its redisplay, so # compares on these values fail though they are visually identical. # # shellcheck source=e2e-test-subrs . "$(dirname "$0")/e2e-test-subrs" PATH=$PATH:.:$srcdir # Need 2.3 for true-color support (2.2 may work also) if [ "$(basename "$0")" = emulation-attributes-truecolor.test ] && ! tmux_check 2 3; then printf "tmux does not support true color\n" >&2 exit 77 fi # Need 2.4 for BCE support if [ "$(basename "$0")" = emulation-attributes-bce.test ] && ! tmux_check 2 4; then printf "tmux does not support BCE\n" >&2 exit 77 fi # tmux 3.3a has a behavior change in how BCE is handled, which has # been reverted: https://github.com/tmux/tmux/issues/3339 if [ "$(basename "$0")" = emulation-attributes-bce.test ] && tmux_check 3 3a && ! tmux_check 3 3b; then printf "tmux 3.3a has incompatible BCE behavior\n" >&2 exit 77 fi # Top-level wrapper. if [ $# -eq 0 ]; then e2e-test "$0" baseline direct verify exit fi # OK, we have arguments, we're one of the test hooks. if [ $# -ne 1 ]; then fail "bad arguments %s\n" "$@" fi test_true_color() { s=$(printf "\033[0") for i in $@; do s="$s;$i" done s="${s}m" for attr in $(seq 0 76); do r=$((255-(attr*255/76))) g=$((attr*510/76)) b=$((attr*255/76)) if [ $g -gt 255 ]; then g=$((510-g)) fi invr=$((255-r)) invg=$((255-g)) invb=$((255-b)) c="E" printf "%s" "$s" printf "\033[48;2;%d;%d;%dm" $r $g $b; printf "\033[38;2;%d;%d;%dm" $invr $invg $invb printf "%s\033[m" "$c" done printf "\n" } baseline() { # Strip our name to the last dash-separated word before the .test suffix. testname=$(basename "$1") testname=${testname%%.test} testname=${testname##*-} printf '\033[H\033[J' case $testname in # Traditional ancient VT100 attributes. vt100) for attr in 0 1 4 5 7; do printf '\033[%dmE\033[m ' $attr done ;; # 16-color attributes. 16color) for attr in $(seq 30 37) $(seq 39 47) 49; do printf '\033[%dmE\033[m ' "$attr" done ;; # First 8 256-color attributes. Comparing mosh and tmux fails. 256color8) for attr in $(seq 0 7); do printf '\033[38;5;%dmE\033[m ' "$attr" printf '\033[48;5;%dmM\033[m ' "$attr" done ;; # Last 248 256-color attributes. 256color248) for attr in $(seq 8 255); do printf '\033[38;5;%dmE\033[m ' "$attr" printf '\033[48;5;%dmM\033[m ' "$attr" done ;; # True color. # See https://gist.github.com/XVilka/8346728 for the test case truecolor) echo "Normal:" test_true_color echo "Bold:" test_true_color 1 echo "Italic:" test_true_color 3 echo "Underline:" test_true_color 4 echo "Blink:" test_true_color 5 echo "Inverse:" test_true_color 7 echo "Invisible:" test_true_color 8 echo "Bold, italic and underline:" test_true_color 1 3 4 ;; # BCE in combination with various color modes. bce) # True color. printf '\033[48;2;255;0;255m\033[H\033[JTrue color\n' printf '\033[48;5;32m\033[J256 color\n' printf '\033[42m\033[J16 color\n' printf '\033[0mdone\n' ;; *) fail "unknown test name %s\n" "$1" ;; esac printf '\033[mend\n' } case $1 in baseline|direct) baseline "$0";; *) fail "unknown test argument %s\n" "$1";; esac mosh-1.4.0/src/tests/ocb-aes.cc0000664000175000017500000006213314272621034013164 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ /* Test suite for the OCB-AES reference implementation included with Mosh. This tests cryptographic primitives implemented by others. It uses the same interfaces and indeed the same compiled object code as the Mosh client and server. It does not particularly test any code written for the Mosh project. */ #include #include #include #include "ae.h" #include "crypto.h" #include "prng.h" #include "fatal_assert.h" #include "test_utils.h" #include "shared.h" #define KEY_LEN 16 #define NONCE_LEN 12 #define TAG_LEN 16 using Crypto::AlignedBuffer; bool verbose = false; static bool equal( const AlignedBuffer &a, const AlignedBuffer &b ) { return ( a.len() == b.len() ) && !memcmp( a.data(), b.data(), a.len() ); } typedef shared::shared_ptr< AlignedBuffer > AlignedPointer; static AlignedBuffer *get_ctx( const AlignedBuffer &key ) { AlignedBuffer *ctx_buf = new AlignedBuffer( ae_ctx_sizeof() ); fatal_assert( ctx_buf ); fatal_assert( AE_SUCCESS == ae_init( (ae_ctx *)ctx_buf->data(), key.data(), key.len(), NONCE_LEN, TAG_LEN ) ); return ctx_buf; } static void scrap_ctx( AlignedBuffer &ctx_buf ) { fatal_assert( AE_SUCCESS == ae_clear( (ae_ctx *)ctx_buf.data() ) ); } static void test_encrypt( const AlignedBuffer &key, const AlignedBuffer &nonce, const AlignedBuffer &plaintext, const AlignedBuffer &assoc, const AlignedBuffer &expected_ciphertext ) { AlignedPointer ctx_buf( get_ctx( key ) ); ae_ctx *ctx = (ae_ctx *)ctx_buf->data(); AlignedBuffer observed_ciphertext( plaintext.len() + TAG_LEN ); const int ret = ae_encrypt( ctx, nonce.data(), plaintext.data(), plaintext.len(), assoc.data(), assoc.len(), observed_ciphertext.data(), NULL, AE_FINALIZE ); if ( verbose ) { printf( "ret %d\n", ret ); hexdump(observed_ciphertext, "obs ct" ); } fatal_assert( ret == int( expected_ciphertext.len() ) ); fatal_assert( equal( expected_ciphertext, observed_ciphertext ) ); scrap_ctx( *ctx_buf ); } static void test_decrypt( const AlignedBuffer &key, const AlignedBuffer &nonce, const AlignedBuffer &ciphertext, const AlignedBuffer &assoc, const AlignedBuffer &expected_plaintext, bool valid ) { AlignedPointer ctx_buf( get_ctx( key ) ); ae_ctx *ctx = (ae_ctx *)ctx_buf->data(); AlignedBuffer observed_plaintext( ciphertext.len() - TAG_LEN ); const int ret = ae_decrypt( ctx, nonce.data(), ciphertext.data(), ciphertext.len(), assoc.data(), assoc.len(), observed_plaintext.data(), NULL, AE_FINALIZE ); if ( verbose ) { printf( "ret %d\n", ret ); } if ( valid ) { if ( verbose ) { hexdump( observed_plaintext, "obs pt" ); } fatal_assert( ret == int( expected_plaintext.len() ) ); fatal_assert( equal( expected_plaintext, observed_plaintext ) ); } else { fatal_assert( ret == AE_INVALID ); } scrap_ctx( *ctx_buf ); } static void test_vector( const char *key_p, const char *nonce_p, size_t assoc_len, const char *assoc_p, size_t plaintext_len, const char *plaintext_p, size_t ciphertext_len, const char *ciphertext_p ) { AlignedBuffer key ( KEY_LEN, key_p ); AlignedBuffer nonce ( NONCE_LEN, nonce_p ); AlignedBuffer plaintext ( plaintext_len, plaintext_p ); AlignedBuffer assoc ( assoc_len, assoc_p ); AlignedBuffer ciphertext( ciphertext_len, ciphertext_p ); if ( verbose ) { hexdump( key, "key" ); hexdump( nonce, "nonce" ); hexdump( assoc, "assoc" ); hexdump( plaintext, "exp pt" ); hexdump( ciphertext, "exp ct" ); } test_encrypt( key, nonce, plaintext, assoc, ciphertext ); test_decrypt( key, nonce, ciphertext, assoc, plaintext, true ); /* Try some bad ciphertexts and make sure they don't validate. */ PRNG prng; for ( size_t i=0; i<64; i++ ) { AlignedBuffer bad_ct( ciphertext.len(), ciphertext.data() ); ( (uint8_t *) bad_ct.data() )[ prng.uint32() % bad_ct.len() ] ^= ( 1 << ( prng.uint8() % 8 ) ); test_decrypt( key, nonce, bad_ct, assoc, plaintext, false ); } if (verbose) { printf( "PASSED\n\n" ); } } #define TEST_VECTOR( _key, _nonce, _assoc, _pt, _ct ) \ test_vector( _key, _nonce, sizeof(_assoc)-1, _assoc, sizeof(_pt)-1, _pt, sizeof(_ct)-1, _ct ) static void test_all_vectors( void ) { /* Test vectors from http://tools.ietf.org/html/draft-krovetz-ocb-03#appendix-A */ const char ietf_key[] = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F"; const char ietf_nonce[] = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B"; TEST_VECTOR( ietf_key, ietf_nonce , "" /* associated data */ , "" /* plaintext */ /* ciphertext including tag */ , "\x19\x7B\x9C\x3C\x44\x1D\x3C\x83\xEA\xFB\x2B\xEF\x63\x3B\x91\x82" ); TEST_VECTOR( ietf_key, ietf_nonce , "\x00\x01\x02\x03\x04\x05\x06\x07" , "\x00\x01\x02\x03\x04\x05\x06\x07" , "\x92\xB6\x57\x13\x0A\x74\xB8\x5A\x16\xDC\x76\xA4\x6D\x47\xE1\xEA" "\xD5\x37\x20\x9E\x8A\x96\xD1\x4E" ); TEST_VECTOR( ietf_key, ietf_nonce , "\x00\x01\x02\x03\x04\x05\x06\x07" , "" , "\x98\xB9\x15\x52\xC8\xC0\x09\x18\x50\x44\xE3\x0A\x6E\xB2\xFE\x21" ); TEST_VECTOR( ietf_key, ietf_nonce , "" , "\x00\x01\x02\x03\x04\x05\x06\x07" , "\x92\xB6\x57\x13\x0A\x74\xB8\x5A\x97\x1E\xFF\xCA\xE1\x9A\xD4\x71" "\x6F\x88\xE8\x7B\x87\x1F\xBE\xED" ); TEST_VECTOR( ietf_key, ietf_nonce , "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" , "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" , "\xBE\xA5\xE8\x79\x8D\xBE\x71\x10\x03\x1C\x14\x4D\xA0\xB2\x61\x22" "\x77\x6C\x99\x24\xD6\x72\x3A\x1F\xC4\x52\x45\x32\xAC\x3E\x5B\xEB" ); TEST_VECTOR( ietf_key, ietf_nonce , "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" , "" , "\x7D\xDB\x8E\x6C\xEA\x68\x14\x86\x62\x12\x50\x96\x19\xB1\x9C\xC6" ); TEST_VECTOR( ietf_key, ietf_nonce , "" , "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" , "\xBE\xA5\xE8\x79\x8D\xBE\x71\x10\x03\x1C\x14\x4D\xA0\xB2\x61\x22" "\x13\xCC\x8B\x74\x78\x07\x12\x1A\x4C\xBB\x3E\x4B\xD6\xB4\x56\xAF"); TEST_VECTOR( ietf_key, ietf_nonce , "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" "\x10\x11\x12\x13\x14\x15\x16\x17" , "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" "\x10\x11\x12\x13\x14\x15\x16\x17" , "\xBE\xA5\xE8\x79\x8D\xBE\x71\x10\x03\x1C\x14\x4D\xA0\xB2\x61\x22" "\xFC\xFC\xEE\x7A\x2A\x8D\x4D\x48\x5F\xA9\x4F\xC3\xF3\x88\x20\xF1" "\xDC\x3F\x3D\x1F\xD4\xE5\x5E\x1C" ); TEST_VECTOR( ietf_key, ietf_nonce , "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" "\x10\x11\x12\x13\x14\x15\x16\x17" , "" , "\x28\x20\x26\xDA\x30\x68\xBC\x9F\xA1\x18\x68\x1D\x55\x9F\x10\xF6" ); TEST_VECTOR( ietf_key, ietf_nonce , "" , "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" "\x10\x11\x12\x13\x14\x15\x16\x17" , "\xBE\xA5\xE8\x79\x8D\xBE\x71\x10\x03\x1C\x14\x4D\xA0\xB2\x61\x22" "\xFC\xFC\xEE\x7A\x2A\x8D\x4D\x48\x6E\xF2\xF5\x25\x87\xFD\xA0\xED" "\x97\xDC\x7E\xED\xE2\x41\xDF\x68" ); TEST_VECTOR( ietf_key, ietf_nonce , "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" "\x10\x11\x12\x13\x14\x15\x16\x17" , "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" "\x10\x11\x12\x13\x14\x15\x16\x17" , "\xBE\xA5\xE8\x79\x8D\xBE\x71\x10\x03\x1C\x14\x4D\xA0\xB2\x61\x22" "\xFC\xFC\xEE\x7A\x2A\x8D\x4D\x48\x5F\xA9\x4F\xC3\xF3\x88\x20\xF1" "\xDC\x3F\x3D\x1F\xD4\xE5\x5E\x1C" ); TEST_VECTOR( ietf_key, ietf_nonce , "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17" , "" , "\x28\x20\x26\xDA\x30\x68\xBC\x9F\xA1\x18\x68\x1D\x55\x9F\x10\xF6"); TEST_VECTOR( ietf_key, ietf_nonce , "" , "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" "\x10\x11\x12\x13\x14\x15\x16\x17" , "\xBE\xA5\xE8\x79\x8D\xBE\x71\x10\x03\x1C\x14\x4D\xA0\xB2\x61\x22" "\xFC\xFC\xEE\x7A\x2A\x8D\x4D\x48\x6E\xF2\xF5\x25\x87\xFD\xA0\xED" "\x97\xDC\x7E\xED\xE2\x41\xDF\x68" ); TEST_VECTOR( ietf_key, ietf_nonce , "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F" , "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F" , "\xBE\xA5\xE8\x79\x8D\xBE\x71\x10\x03\x1C\x14\x4D\xA0\xB2\x61\x22" "\xCE\xAA\xB9\xB0\x5D\xF7\x71\xA6\x57\x14\x9D\x53\x77\x34\x63\xCB" "\xB2\xA0\x40\xDD\x3B\xD5\x16\x43\x72\xD7\x6D\x7B\xB6\x82\x42\x40" ); TEST_VECTOR( ietf_key, ietf_nonce , "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F" , "" , "\xE1\xE0\x72\x63\x3B\xAD\xE5\x1A\x60\xE8\x59\x51\xD9\xC4\x2A\x1B" ); TEST_VECTOR( ietf_key, ietf_nonce , "" , "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F" , "\xBE\xA5\xE8\x79\x8D\xBE\x71\x10\x03\x1C\x14\x4D\xA0\xB2\x61\x22" "\xCE\xAA\xB9\xB0\x5D\xF7\x71\xA6\x57\x14\x9D\x53\x77\x34\x63\xCB" "\x4A\x3B\xAE\x82\x44\x65\xCF\xDA\xF8\xC4\x1F\xC5\x0C\x7D\xF9\xD9" ); TEST_VECTOR( ietf_key, ietf_nonce , "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F" "\x20\x21\x22\x23\x24\x25\x26\x27" , "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F" "\x20\x21\x22\x23\x24\x25\x26\x27" , "\xBE\xA5\xE8\x79\x8D\xBE\x71\x10\x03\x1C\x14\x4D\xA0\xB2\x61\x22" "\xCE\xAA\xB9\xB0\x5D\xF7\x71\xA6\x57\x14\x9D\x53\x77\x34\x63\xCB" "\x68\xC6\x57\x78\xB0\x58\xA6\x35\x65\x9C\x62\x32\x11\xDE\xEA\x0D" "\xE3\x0D\x2C\x38\x18\x79\xF4\xC8" ); TEST_VECTOR( ietf_key, ietf_nonce , "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F" "\x20\x21\x22\x23\x24\x25\x26\x27" , "" , "\x7A\xEB\x7A\x69\xA1\x68\x7D\xD0\x82\xCA\x27\xB0\xD9\xA3\x70\x96" ); TEST_VECTOR( ietf_key, ietf_nonce , "" , "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F" "\x20\x21\x22\x23\x24\x25\x26\x27" , "\xBE\xA5\xE8\x79\x8D\xBE\x71\x10\x03\x1C\x14\x4D\xA0\xB2\x61\x22" "\xCE\xAA\xB9\xB0\x5D\xF7\x71\xA6\x57\x14\x9D\x53\x77\x34\x63\xCB" "\x68\xC6\x57\x78\xB0\x58\xA6\x35\x06\x0C\x84\x67\xF4\xAB\xAB\x5E" "\x8B\x3C\x20\x67\xA2\xE1\x15\xDC" ); /* Some big texts. These were originally encrypted using this program; they are regression tests. */ TEST_VECTOR( "\x06\xF8\x9F\x69\xDA\x49\xDA\xD7\x68\x48\xFF\xB3\x60\xB6\x8F\x00" , "\xDC\xBF\x85\x18\x23\xD9\x67\x85\x45\x59\x6F\xAD" , "" , "\xC4\x8E\x1F\x04\x10\x2F\xA5\x58\x68\x42\x62\xF3\x1B\xE7\x63\xA7" "\x77\x89\x64\x16\xE6\xB0\xF7\xFA\xFE\xF0\xB9\x50\x22\xDC\xCE\x78" "\xA5\x01\xA4\x2D\xA2\x0F\x50\xEA\x9A\xAE\x23\x60\x1C\xC9\x11\x84" "\x5F\xD0\x0A\x88\x99\xCD\xF1\x1B\x7C\xF9\x71\xC2\xD8\xE3\x7B\xB1" "\xBC\x91\xCE\x10\xDA\xED\xBF\xA5\xDF\x96\x69\x7A\xFA\xCA\x9A\x91" "\x40\xF9\x8F\xF1\xFE\x5A\x2B\x21\x17\xA5\xAE\x97\xBD\x0B\x68\xE0" "\x58\x7A\xB4\x10\x89\xDE\x30\x12\xB7\x14\xEB\xE8\xFA\xA5\x87\x7A" "\x7E\xEA\xD0\x34\x0B\xAF\x73\x0B\x1C\xA7\xC5\xCB\x84\x15\x5F\x45" "\x53\x8E\x27\xD7\xA0\x7D\xAF\x99\x05\x6E\x9F\xF4\xCD\xE5\xA1\x11" "\x43\xBD\x7A\x24\xA3\xB7\xB6\x92\x7C\xB7\xD8\x6F\x17\x78\xB3\x30" "\x53\x6E\x46\x14\x11\x86\xF6\x70\x2E\x25\x8E\x54\xF8\x70\x2F\x47" "\x2B\xF8\xF6\xC3\xEE\xFB\x9B\x7D\xF0\x73\xAD\x24\xC0\xE9\x58\xA8" "\x79\xDC\x92\x25\x6D\xF3\x9D\xA8\x8F\x07\xA3\xE7\xAB\xF4\xBC\x32" "\x29\xB6\xEF\xDB\x20\x42\x51\xCF\xD5\x57\xDA\x14\xC7\x2A\xB3\x19" "\xDE\x31\xF7\x77\x95\x8D\x33\x57\x1D\xEB\x9A\x80\x98\x4D\x95\x07" "\xEB\x38\x42\xEB\xE0\xAB\x2D\xF3\x9E\x16\xFA\x6D\x06\x62\x41\x58" "\x81\xBF\x3D\x01\x1A\xF7\xBA\x53\xCE\x60\xEF\x86\xC9\x11\xED\x89" "\x5B\xCF\x98\xB4\xD3\xD4\xAC\xB9\x71\x69\xEE\xF6\xA7\x77\x4E\x46" "\x0F\xF7\x1D\x7D\x36\x4E\x86\x15\xCD\xF3\xD3\x5C\xAA\x97\x74\xCC" "\x5D\xD6\xF0\x5C\x62\x27\x0D\x4B\x01\xDD\x8B\xE6\x2C\x72\x99\xBA" "\x5B\x95\x87\x0F\xB9\x9A\xBE\xA2\x42\x5E\x7D\x1B\x19\x08\xBC\xEF" "\x66\x24\x2F\xB3\xFC\xE7\xDA\xB1\x79\x51\xE9\x3B\x45\x66\xDC\xD8" "\x0F\xA7\x56\xBF\x56\x15\x4B\x15\xCC\x3E\x9F\x44\xB9\xED\xC2\x0A" "\x7C\xA9\x6D\x87\xCD\xE2\x00\x9F\x2F\x2C\xF0\xBC\x1B\xB0\x27\xE8" "\x46\x3E\x06\x1E\xD5\xB6\xB4\x82\xF7\x88\xB7\x48\xF3\x58\xB0\x23" "\x6D\xC2\xD3\x85\x9D\x1F\xE5\x30\xFC\xC8\x46\x62\xD1\xE1\xAE\x3B" "\x3A\xA9\x57\xE0\xD7\x8F\x7E\x4D\x59\x7D\x7A\xEB\xBF\xD3\x10\x00" "\xA0\xE4\x76\x76\xE3\xA8\x14\xD0\x03\xBF\x1F\x6A\xF9\x11\xCE\x98" "\x2C\x2A\x86\x25\x77\x85\x14\x76\xD4\x51\xAB\xC7\x3A\xA7\xE1\xF7" "\x23\xF7\x2B\xA3\xBA\xE4\x0B\xA4\x81\x9A\x83\x98\x69\xC3\x1C\x8A" "\xBD\x26\x12\x36\x22\x9D\xCE\x85\x5D\xA3\xA0\xDF\x66\xD0\x59\xF6" "\x47\xF2\xC5\x37\xF1\x62\x0D\x0C\x45\x5B\xE5\xFE\x3C\x8D\x28\x75" , "\xa1\xd8\xa0\xe0\x75\x5c\xb4\xf4\xab\x59\x6d\x14\xfc\x2e\x75\x54" "\xa3\x35\x4f\x57\x69\x48\x7a\x46\x17\x5f\xd9\x34\x50\xf9\x35\xe5" "\x6f\xee\x27\xdb\x28\x0f\x06\x0b\xaf\xd5\x50\x4e\x20\x78\x35\xd6" "\x4d\xa0\x18\xe8\x6c\x5b\x07\xbb\xb6\xd0\x3f\x4a\x0e\x14\x32\xaf" "\x0d\x6a\x5d\xb6\xe4\x36\xb0\x1c\xae\x2e\x75\x85\x19\x53\x9d\xf2" "\xc6\xc6\xf5\x29\x4a\x5d\x73\xd6\xcd\x3a\xec\x38\x15\x7b\x1f\x3d" "\x19\x8f\x7f\x85\x53\x75\xfe\x6c\x8a\x5d\x4f\x05\x3f\x16\x5e\x73" "\x9c\xbe\xbe\xdb\xe8\xb2\x3e\xea\x0f\x2e\x2c\xf3\x2c\x9c\x56\x5b" "\xf7\xf2\xed\x87\x07\xfb\x87\x74\x09\xda\xb8\xad\x57\xc0\xa0\x79" "\xc6\x69\x1c\x79\x08\x69\x35\x18\xc4\x54\xca\x6b\xed\x89\xa0\x27" "\x32\x19\x1f\xaf\xff\x12\x1c\x1b\x08\xa6\x9f\x0e\xe3\x01\x98\x77" "\xdb\x75\xdf\x87\x67\x6d\xd9\xb4\x23\x39\xd0\x81\x54\xf8\x89\x18" "\x5c\xbd\xb7\x4d\xf4\xb1\x8b\x37\x2e\x9b\x20\x29\x9f\x95\x9e\xdd" "\x73\x2c\xdb\x37\xe5\x7d\x9f\x8a\x79\xff\x8f\x5b\x99\x10\xe1\xe9" "\x1d\xcb\x1f\x17\xef\x7d\xb7\xd1\x50\x23\x4a\x38\x92\xfb\xbe\x1c" "\xff\x23\x68\x3a\xb9\xc8\xbc\xa0\xab\xa7\xbe\xc8\x84\xce\x66\xa7" "\x11\x17\xc6\x48\x91\x4d\x77\xe1\x64\xc4\x26\x08\xcd\xb4\xea\x10" "\x42\x60\x5a\x7c\x5a\x72\xba\xb4\x93\xf7\x02\xa1\xd4\x44\xdb\x1a" "\x4a\xc3\xb1\xea\x69\x74\xea\x18\xb3\x5a\x27\x09\x6f\x5b\x1f\x30" "\xe2\xeb\x2a\x37\x5e\xd2\xe2\x23\xec\xbc\xcb\xcb\x65\x41\xed\x0e" "\x23\xda\x71\x45\xf3\x3f\x7d\x44\x73\xd7\x14\x4d\xab\x03\xf7\x7d" "\x24\x33\x9d\x25\x83\x1f\x3d\xf3\xc9\x34\x42\x6c\x2f\x61\xa2\x83" "\xa0\x0f\xb6\x28\xe8\x27\xf0\x91\xf6\xc5\x7e\xa1\x74\x74\xaf\xa7" "\x7f\xba\x99\x29\xb2\x91\x9f\xf0\xf7\x71\x1f\xf0\x0b\xd6\xd9\xf9" "\x72\xaa\x04\x09\x5d\x75\x76\x5f\x18\xc8\xd5\xd5\x84\x1a\x40\x3f" "\xe5\x38\xe4\x38\xdf\xf9\x0d\x79\xdc\x71\xc8\xa8\xef\x86\x4e\x26" "\xf4\xc2\x46\xf4\xe0\x64\xd6\x5e\xfb\x1c\x47\x58\x3d\x87\x7c\xba" "\xa3\xf5\x98\xdc\xd5\xdf\xaf\x62\x96\xee\x4e\x39\x32\x4c\x6d\xd2" "\x0a\x6f\xf8\x34\x98\x76\xae\x21\xa1\x41\x3d\x96\xfc\x52\xdb\xdd" "\xf3\x9a\xb1\xf3\x78\x3d\xb8\x2f\xae\xae\x7d\xe0\x4b\xb2\xdf\x2b" "\x12\xac\xee\xfb\xf8\x54\x60\xea\x74\xd5\xde\x43\x7b\x38\x45\x5f" "\xa0\xb8\xe8\xcc\x8a\xe3\xcc\x0c\x92\xe6\xb1\xb0\xe2\xc1\x99\xca" "\x1b\xa1\xac\x6e\x7a\x8a\xa0\x20\x3d\xeb\x29\x8b\xf4\x55\x41\x62" ); TEST_VECTOR( "\x7A\x54\x0D\x3E\x56\x38\xF7\xC6\xCF\xAB\xF9\x56\xDC\xCA\x14\x23" , "\x9B\x0E\xC1\x15\xD5\xE6\xC9\xAB\xE6\x88\x2A\x18" , "" , "\x52\xDB\xA7\x44\x2B\x1C\x9C\x24\x4D\xF3\xA1\xE4\x53\x7B\x9B\xB2" "\x25\xC5\xA3\x81\x42\x23\xA9\xB4\x12\xF8\xFC\xE4\xF6\x8E\x20\xD4" "\x59\x7B\x39\x2D\x5D\x7C\x6E\xB7\x51\x02\x90\x7A\x8E\xAA\x30\xD0" "\xEB\xDF\x70\x09\x5A\xEC\xFB\xD4\xDB\x0B\xE9\x1B\x79\xAF\x40\xA3" "\xC9\xD1\x3F\x0E\x7E\x9B\xA8\xF2\x4E\xA2\xAE\x81\xE7\x8F\xE9\x4A" "\xF8\x84\x38\x20\x9B\xCB\x0D\x9E\x46\x87\xCC\x0C\x71\xF2\x4C\xE5" "\x57\x47\xFB\x52\x1D\x0C\x92\xCD\x9B\xD0\xA3\xA3\xFE\x44\x4F\x2A" "\x2D\x7D\xC8\x48\x87\x71\x8A\x83\x83\x43\x52\xD9\x87\x72\x0A\x1F" "\x72\x7D\xE0\x0D\xE4\xBA\x38\x2D\xAB\x89\x85\x34\xFE\x30\xE9\x47" "\x99\x69\x96\x37\x3B\x88\x0D\x08\x5B\x41\xF0\x55\x3A\x90\xB6\x5D" "\xC9\xB8\xFA\x22\xEB\x54\x67\x1B\x43\x3B\x2A\x13\xDF\x76\x71\xBF" "\x8F\xBA\xF6\x5F\xE0\xAE\x84\x80\xD3\x9A\x9E\xFE\x35\x29\x0C\x44" "\xB8\x3B\xC8\x58\x3F\x51\x18\xF0\x8E\x3F\xE0\xFE\xFF\x55\xE1\xFD" "\x79\xED\x71\x6D\xB9\xBE\xF0\x76\x25\x4E\x6F\xA2\x49\x5B\xEC\x20" "\x61\x95\x65\x67\xBF\xA3\x73\x18\x65\x7C\x2F\x94\x29\x3B\x57\x7D" "\x78\x6A\xBD\x22\x2B\x17\x5E\xDA\x2B\x4E\xC3\xA5\xF0\x9A\xD9\x1C" "\xCF\xC4\xDD\x7E\x07\xB4\xE6\x50\xD0\x9D\xAF\x86\x9D\x3F\xFE\x70" "\x64\x18\xBA\x32\x90\xE5\x63\xA0\x08\x3D\x1D\xCE\xB2\x77\x31\x59" "\xD4\xB4\x03\x2C\xE2\x15\x11\x17\xD1\xBA\x5E\x1E\x7D\x38\x09\xCF" "\x25\x3E\x3D\x89\x7E\x13\xAE\x11\xFA\xCD\x46\x23\x86\xC5\x78\xC8" "\x1A\xE8\x8F\x9A\x9C\xCE\xBE\x01\x5D\x70\x56\xA8\x84\x07\x07\x2A" "\x1C\xD4\x33\x8B\x2F\x01\x0F\xD0\xCC\xCD\x29\xEC\x73\x6E\xDE\xB2" "\xBC\xA7\x32\x6A\x12\x93\x13\xCD\xE0\xA9\x55\x97\x36\x6B\xDA\xC5" "\xC5\xD2\x44\x80\xBD\x00\x37\xD7\x21\x80\x27\x1F\x2E\x02\x76\x1A" "\x57\xA5\x5F\xCE\x8B\x20\x6A\x6A\x0F\x70\x9B\xDB\x07\x64\x96\x7B" "\x43\xFD\xCA\xBF\x9D\x52\xEB\x24\x7B\x1B\xEE\x43\x10\x2C\xDB\x92" "\xA1\xA8\xA9\xF7\x2F\xD2\x39\xA8\x85\x9C\xFE\x2C\x2A\xCF\x52\x73" "\xFB\xCA\x20\xAD\xC9\xDD\xFC\x4A\x91\x39\x6C\x7C\x84\x67\xC5\xE4" "\x9B\x3E\x3D\x6B\x56\x3B\x2B\xDC\x8A\x46\xF6\x7C\x36\xF9\x27\x29" "\x37\x38\x7C\x9D\xA0\x6E\x5D\x4C\xE5\xB2\x6F\x0C\xDC\xEF\xFE\x35" "\xFE\x3D\x56\x40\x7F\xBD\x4D\xDD\x40\x79\xDD\xA7\x0A\x7B\xA2\xCE" "\x22\x38\x94\xEA\x90\xF5\x95\xB6\xE6\x6F\x14\xFB\xA2" , "\xec\xa9\xcc\x30\x66\x6c\x04\x16\x21\x8d\xc8\x15\x47\xa2\x18\xcf" "\x19\x90\x4f\x82\x27\x25\xa2\x1e\xfa\x1c\xe4\x58\x78\x43\x52\x4c" "\xac\x24\xde\xcb\xad\x80\x05\x7a\xeb\x2d\xc0\x33\x05\x31\x25\x44" "\xd7\x11\xa1\xf2\xcb\x09\x6f\xf0\x14\x3c\x3f\xf2\xc7\x79\xfb\x3f" "\xb0\x0a\x65\xae\xd7\xe5\x5d\x35\x0c\xb4\x69\x7a\x89\x6b\xa9\xdc" "\x02\x69\x96\xd2\x9f\xe7\x3c\x99\xd4\xd3\x55\x97\xc4\x59\xad\xc4" "\x0c\x7b\xf8\x47\x1c\xbe\x36\x2a\x53\x6b\xb1\x21\x5f\xc1\x6e\xca" "\x0a\x4f\x16\x3a\xf0\xd4\x12\xa6\xf8\x68\x9f\x12\xad\x36\x4c\xd8" "\x5a\x5b\x17\xb8\xbd\xc7\x2c\x48\x51\x7d\x45\x74\x00\xb0\x02\xe9" "\x1b\xd6\x0c\x41\xa7\x5d\x65\xca\x68\xa7\x3e\x3c\xf5\xaa\x9b\xbd" "\x25\x98\x00\xd8\x4d\xbc\xd1\x7a\x25\x34\x92\x24\xa4\x84\x62\x63" "\x2c\x40\xa5\x58\x81\x90\xf1\x0f\x75\xaa\x70\xe4\x4e\x0f\xa3\x03" "\x90\xd1\x07\x18\x0a\x50\x9a\x3e\x28\x1f\x33\xb7\x11\xed\x3c\x2c" "\x40\xc8\xd7\xe3\x12\xdc\xef\x94\x93\x7b\x11\xc3\x24\x51\x61\xbf" "\x8b\xa4\xa4\x5c\x85\x0d\x50\x49\x45\x69\xbe\x5b\x36\x90\x84\x30" "\x66\x67\x76\x3d\xcc\x02\x8b\x9f\xb7\x90\x57\xef\xe1\x21\x34\x65" "\x3e\xca\xbf\x70\x1d\x76\x63\xbf\xae\x1f\xb2\x55\xf0\x87\x3e\x42" "\xf9\x71\x28\x02\x06\x9e\xf7\x6a\x47\x3b\xda\x38\x54\x66\xd9\xaf" "\xba\x7b\xec\xbf\xe3\x52\x63\x02\x8b\xa7\xad\x1d\x76\x16\xa2\x20" "\x38\xec\x40\xb7\xc8\x35\x6b\xc2\x80\x9d\x20\x02\xc6\x34\xdb\x65" "\xd8\x27\x0b\xc5\x2d\x85\xe4\xdc\x85\xae\x10\x36\x01\xdb\x4b\xaf" "\x44\x79\xea\x23\x21\xa0\x83\xa3\x91\xf5\xc5\x16\x9b\xeb\x43\x92" "\x1f\x88\xd2\x00\x60\x40\xe9\x52\x0b\x39\x86\x3b\x9e\x3b\x9a\x4a" "\x31\xdf\xb6\x57\x78\x38\xcf\x77\x7c\x0c\xf4\x14\x90\x25\xed\x27" "\xd2\x86\x20\x4c\x1a\x52\xeb\xbe\x1e\xac\x2b\xce\xb7\x72\x86\x87" "\xfd\xac\x11\x90\xc5\xea\x96\xcb\xdc\x89\xe9\x77\xf0\x83\xc3\xa7" "\xa7\xd1\xe1\xc9\x7e\x89\xb3\x4e\xf1\x12\xa3\x9c\xfe\x66\xcc\x5d" "\xcf\x1d\x5a\x11\x21\x2f\x10\x66\x37\x5f\xd7\x35\xeb\x09\x62\x99" "\xa6\xf8\xc7\xc7\xef\xd3\xf0\x56\x2b\xa7\x14\x65\x6a\xce\xa9\x68" "\xe7\xa4\x89\xb4\x1e\x16\x99\xbf\x8d\x2d\x5e\x67\xb4\x3a\x0b\xf3" "\x37\x14\x1e\x5d\xc6\xb4\xb5\x9e\xa5\x69\xa4\xaf\xcc\x0f\x46\xe9" "\xd5\xbb\x10\x49\x07\x0d\x92\x42\x0c\x04\xb9\xdf\xa4\xb5\xef\xcc" "\x05\x81\x3f\xc1\x21\x12\x2c\x33\xb7\x79\xfd\x5d\x8a" ); } /* http://tools.ietf.org/html/draft-krovetz-ocb-03#appendix-A also specifies an iterative test algorithm, which we implement here. */ static void test_iterative( void ) { /* Key is always all zeros */ AlignedBuffer key( KEY_LEN ); memset( key.data(), 0, KEY_LEN ); AlignedPointer ctx_buf( get_ctx( key ) ); ae_ctx *ctx = (ae_ctx *)ctx_buf->data(); AlignedBuffer nonce( NONCE_LEN ); memset( nonce.data(), 0, NONCE_LEN ); /* The loop below fills this buffer in order. Each iteration adds 2*i + 3*TAG_LEN bytes. */ AlignedBuffer accumulator( 22400 ); uint8_t *acc = (uint8_t *) accumulator.data(); for ( size_t i=0; i<128; i++ ) { /* i bytes of zeros */ AlignedBuffer s( i ); memset( s.data(), 0, s.len() ); /* Nonce is 11 bytes of zeros followed by 1 byte i */ ( (uint8_t *) nonce.data() )[ 11 ] = i; /* We can't write directly to acc because it might not be aligned. */ AlignedBuffer out( s.len() + TAG_LEN ); /* OCB-ENCRYPT(K,N,S,S) */ fatal_assert( 0 <= ae_encrypt( ctx, nonce.data(), s.data(), s.len(), s.data(), s.len(), out.data(), NULL, AE_FINALIZE ) ); memcpy( acc, out.data(), s.len() + TAG_LEN ); acc += s.len() + TAG_LEN; /* OCB-ENCRYPT(K,N,,S) */ fatal_assert( 0 <= ae_encrypt( ctx, nonce.data(), s.data(), s.len(), NULL, 0, out.data(), NULL, AE_FINALIZE ) ); memcpy( acc, out.data(), s.len() + TAG_LEN ); acc += s.len() + TAG_LEN; /* OCB-ENCRYPT(K,N,S,) */ fatal_assert( 0 <= ae_encrypt( ctx, nonce.data(), NULL, 0, s.data(), s.len(), out.data(), NULL, AE_FINALIZE ) ); memcpy( acc, out.data(), TAG_LEN ); acc += TAG_LEN; } /* OCB-ENCRYPT(K,N,C,) */ AlignedBuffer out( TAG_LEN ); memset( nonce.data(), 0, NONCE_LEN ); fatal_assert( 0 <= ae_encrypt( ctx, nonce.data(), NULL, 0, accumulator.data(), accumulator.len(), out.data(), NULL, AE_FINALIZE ) ); /* Check this final tag against the known value */ AlignedBuffer correct( TAG_LEN, "\xB2\xB4\x1C\xBF\x9B\x05\x03\x7D\xA7\xF1\x6C\x24\xA3\x5C\x1C\x94" ); fatal_assert( equal( out, correct ) ); if ( verbose ) { printf( "iterative PASSED\n\n" ); } scrap_ctx( *ctx_buf ); } int main( int argc, char *argv[] ) { if ( argc >= 2 && strcmp( argv[ 1 ], "-v" ) == 0 ) { verbose = true; } try { test_all_vectors(); test_iterative(); } catch ( const std::exception &e ) { fprintf( stderr, "Error: %s\r\n", e.what() ); return 1; } return 0; } mosh-1.4.0/src/tests/emulation-back-tab.test0000755000175000017500000000231413103401307015667 00000000000000#!/bin/sh # # This test is for issue 539 on github. # # shellcheck source=e2e-test-subrs . "$(dirname "$0")/e2e-test-subrs" PATH=$PATH:.:$srcdir # Top-level wrapper. if [ $# -eq 0 ]; then e2e-test "$0" baseline post exit fi # OK, we have arguments, we're one of the test hooks. if [ $# -ne 1 ]; then fail "bad arguments %s\n" "$@" fi baseline() { printf 'hello, wurld\033[Zo\n' printf 'hello, wurld\033[2Zo\n' printf 'hello, wurld\033[99Z9\n' printf 'hello, wurld\033[It\n' printf '\033[99I#\n' } post() { # Basic previously-failing case. if grep -q 'hello, wurldo' "$(basename "$0").d/baseline.capture"; then exit 1 fi if ! grep -q 'hello, world' "$(basename "$0").d/baseline.capture"; then exit 99 fi # New test cases for new code. if ! grep -q 'oello, wurld' "$(basename "$0").d/baseline.capture" || ! grep -q '9ello, wurld' "$(basename "$0").d/baseline.capture" || ! grep -q 'hello, wurld t' "$(basename "$0").d/baseline.capture" || ! grep -E -q '^ {79}#$' "$(basename "$0").d/baseline.capture"; then exit 1 fi exit 0 } case $1 in baseline) baseline;; post) post;; *) fail "unknown test argument %s\n" "$1";; esac mosh-1.4.0/src/include/0000775000175000017500000000000014327736673011721 500000000000000mosh-1.4.0/src/include/Makefile.in0000664000175000017500000003723514327736660013714 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 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)) 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 = : subdir = src/include ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ $(top_srcdir)/m4/ax_ac_print_to_file.m4 \ $(top_srcdir)/m4/ax_add_am_macro_static.m4 \ $(top_srcdir)/m4/ax_am_macros_static.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_gnu_make.m4 \ $(top_srcdir)/m4/ax_check_library.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_code_coverage.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ $(top_srcdir)/m4/ax_file_escapes.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 $(top_srcdir)/m4/pkg.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 = $(install_sh) -d CONFIG_HEADER = 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__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)` am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@ CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@ CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@ CPPFLAGS = @CPPFLAGS@ CRYPTO_CFLAGS = @CRYPTO_CFLAGS@ CRYPTO_LIBS = @CRYPTO_LIBS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CURSES_LIB = @CURSES_LIB@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FUZZING_CFLAGS = @FUZZING_CFLAGS@ GCOV = @GCOV@ GENHTML = @GENHTML@ HARDEN_CFLAGS = @HARDEN_CFLAGS@ HARDEN_LDFLAGS = @HARDEN_LDFLAGS@ HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LCOV = @LCOV@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MISC_CXXFLAGS = @MISC_CXXFLAGS@ MKDIR_P = @MKDIR_P@ Nettle_CFLAGS = @Nettle_CFLAGS@ Nettle_LIBS = @Nettle_LIBS@ OBJEXT = @OBJEXT@ OpenSSL_CFLAGS = @OpenSSL_CFLAGS@ OpenSSL_LIBS = @OpenSSL_LIBS@ 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@ PICKY_CXXFLAGS = @PICKY_CXXFLAGS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROTOC = @PROTOC@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TINFO_CFLAGS = @TINFO_CFLAGS@ TINFO_CPPFLAGS = @TINFO_CPPFLAGS@ TINFO_LDFLAGS = @TINFO_LDFLAGS@ TINFO_LIBS = @TINFO_LIBS@ VERSION = @VERSION@ WARNING_CXXFLAGS = @WARNING_CXXFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ completions = @completions@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ ifGNUmake = @ifGNUmake@ ifnGNUmake = @ifnGNUmake@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ protobuf_CFLAGS = @protobuf_CFLAGS@ protobuf_LIBS = @protobuf_LIBS@ 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@ BUILT_SOURCES = version.h nodist_INCLUDES = version.h all: $(BUILT_SOURCES) config.h $(MAKE) $(AM_MAKEFLAGS) 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 src/include/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/include/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): 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 @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status src/include/config.h $(srcdir)/config.h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 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: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile config.h installdirs: install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) 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: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || 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." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-am clean-am: clean-generic clean-local mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr 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-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 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: .MAKE: all check install install-am install-exec install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-local cscopelist-am ctags ctags-am distclean \ distclean-generic distclean-hdr distclean-tags 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-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 tags-am uninstall uninstall-am .PRECIOUS: Makefile clean-local: @rm -rf version.h version.h: ../../VERSION @test -s $< @printf '#define BUILD_VERSION "%s"\n' "$$(cat $<)" > $@.new @set -e; if ! diff -q $@ $@.new > /dev/null 2>&1; then \ mv -f $@.new $@; \ fi @rm -f $@.new # 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: mosh-1.4.0/src/include/config.h.in0000664000175000017500000002322614327736657013673 00000000000000/* src/include/config.h.in. Generated from configure.ac by autoheader. */ /* Define if FD_ISSET() fd_set argument is const. */ #undef FD_ISSET_IS_CONST /* Define if libutil.h necessary for forkpty(). */ #undef FORKPTY_IN_LIBUTIL /* Define to 1 if you have the `cfmakeraw' function. */ #undef HAVE_CFMAKERAW /* Define if clock_gettime() is available. */ #undef HAVE_CLOCK_GETTIME /* Define to 1 if you have the header file. */ #undef HAVE_COMMONCRYPTO_COMMONCRYPTO_H /* Define to 1 if a SysV or X/Open compatible Curses library is present */ #undef HAVE_CURSES /* Define to 1 if library supports color (enhanced functions) */ #undef HAVE_CURSES_COLOR /* Define to 1 if library supports X/Open Enhanced functions */ #undef HAVE_CURSES_ENHANCED /* Define to 1 if is present */ #undef HAVE_CURSES_H /* Define to 1 if library supports certain obsolete features */ #undef HAVE_CURSES_OBSOLETE /* define if the compiler supports basic C++11 syntax */ #undef HAVE_CXX11 /* Define to 1 if you have the declaration of `be64toh', and to 0 if you don't. */ #undef HAVE_DECL_BE64TOH /* Define to 1 if you have the declaration of `betoh64', and to 0 if you don't. */ #undef HAVE_DECL_BETOH64 /* Define to 1 if you have the declaration of `bswap64', and to 0 if you don't. */ #undef HAVE_DECL_BSWAP64 /* Define to 1 if you have the declaration of `ffs', and to 0 if you don't. */ #undef HAVE_DECL_FFS /* Define to 1 if you have the declaration of `__builtin_bswap64', and to 0 if you don't. */ #undef HAVE_DECL___BUILTIN_BSWAP64 /* Define to 1 if you have the declaration of `__builtin_ctz', and to 0 if you don't. */ #undef HAVE_DECL___BUILTIN_CTZ /* Define to 1 if you have the header file. */ #undef HAVE_ENDIAN_H /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define if you have forkpty(). */ #undef HAVE_FORKPTY /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define if IP_MTU_DISCOVER is a valid sockopt. */ #undef HAVE_IP_MTU_DISCOVER /* Define if IP_RECVTOS is a valid sockopt. */ #undef HAVE_IP_RECVTOS /* Define if IUTF8 is a defined termios mode. */ #undef HAVE_IUTF8 /* Define to 1 if you have the header file. */ #undef HAVE_LANGINFO_H /* Define to 1 if you have the header file. */ #undef HAVE_LIBUTIL_H /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define to 1 if you have the header file. */ #undef HAVE_LOCALE_H /* Define if mach_absolute_time is available. */ #undef HAVE_MACH_ABSOLUTE_TIME /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY /* Define to 1 if the Ncurses library is present */ #undef HAVE_NCURSES /* Define to 1 if the NcursesW library is present */ #undef HAVE_NCURSESW /* Define to 1 if is present */ #undef HAVE_NCURSESW_CURSES_H /* Define to 1 if is present */ #undef HAVE_NCURSESW_H /* Define to 1 if is present */ #undef HAVE_NCURSES_CURSES_H /* Define to 1 if is present */ #undef HAVE_NCURSES_H /* Define to 1 if you have the header file. */ #undef HAVE_NETDB_H /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_IN_H /* Define if OSSwapHostToBigInt64 and friends exist. */ #undef HAVE_OSX_SWAP /* Define to 1 if you have the header file. */ #undef HAVE_PATHS_H /* Define to 1 if you have the `pledge' function. */ #undef HAVE_PLEDGE /* Define to 1 if you have the `posix_memalign' function. */ #undef HAVE_POSIX_MEMALIGN /* Define to 1 if you have the `pselect' function. */ #undef HAVE_PSELECT /* Define to 1 if you have the header file. */ #undef HAVE_PTY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDDEF_H /* 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 if std::shared_ptr is available. */ #undef HAVE_STD_SHARED_PTR /* Define if std::tr1::shared_ptr is available. */ #undef HAVE_STD_TR1_SHARED_PTR /* 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 if syslog is available. */ #undef HAVE_SYSLOG /* Define to 1 if you have the header file. */ #undef HAVE_SYSLOG_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_ENDIAN_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_RESOURCE_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOCKET_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_TIME_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_SYS_UIO_H /* Define to 1 if you have the header file. */ #undef HAVE_TERMIOS_H /* Define to 1 if you have the header file. */ #undef HAVE_TERMIO_H /* Define to 1 if TINFO is found */ #undef HAVE_TINFO /* Define to 1 if you have the header file. */ #undef HAVE_TR1_MEMORY /* Define to 1 if the system has the type `uintptr_t'. */ #undef HAVE_UINTPTR_T /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define if libutempter is available. */ #undef HAVE_UTEMPTER /* Define to 1 if you have the header file. */ #undef HAVE_UTIL_H /* Define to 1 if you have the header file. */ #undef HAVE_UTMPX_H /* Define to 1 if you have the header file. */ #undef HAVE_WCHAR_H /* Define to 1 if you have the header file. */ #undef HAVE_WCTYPE_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 C90 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 /* Use Apple Common Crypto library */ #undef USE_APPLE_COMMON_CRYPTO_AES /* Use Nettle library */ #undef USE_NETTLE_AES /* Use OpenSSL library */ #undef USE_OPENSSL_AES /* Version number of package */ #undef VERSION /* Define for Solaris 2.5.1 so the uint32_t typedef from , , or is not used. If the typedef were allowed, the #define below would cause a syntax error. */ #undef _UINT32_T /* Define for Solaris 2.5.1 so the uint64_t typedef from , , or is not used. If the typedef were allowed, the #define below would cause a syntax error. */ #undef _UINT64_T /* Define for Solaris 2.5.1 so the uint8_t typedef from , , or is not used. If the typedef were allowed, the #define below would cause a syntax error. */ #undef _UINT8_T /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif /* Define to the type of a signed integer type of width exactly 64 bits if such a type exists and the standard includes do not define it. */ #undef int64_t /* Define as a signed integer type capable of holding a process identifier. */ #undef pid_t /* Define to the equivalent of the C99 'restrict' keyword, or to nothing if this is not supported. Do not define if restrict is supported only directly. */ #undef restrict /* Work around a bug in older versions of Sun C++, which did not #define __restrict__ or support _Restrict or __restrict__ even though the corresponding Sun C compiler ended up with "#define restrict _Restrict" or "#define restrict __restrict__" in the previous line. This workaround can be removed once we assume Oracle Developer Studio 12.5 (2016) or later. */ #if defined __SUNPRO_CC && !defined __RESTRICT && !defined __restrict__ # define _Restrict # define __restrict__ #endif /* Define to `unsigned int' if does not define. */ #undef size_t /* Define to `int' if does not define. */ #undef ssize_t /* Define to the type of an unsigned integer type of width exactly 16 bits if such a type exists and the standard includes do not define it. */ #undef uint16_t /* Define to the type of an unsigned integer type of width exactly 32 bits if such a type exists and the standard includes do not define it. */ #undef uint32_t /* Define to the type of an unsigned integer type of width exactly 64 bits if such a type exists and the standard includes do not define it. */ #undef uint64_t /* Define to the type of an unsigned integer type of width exactly 8 bits if such a type exists and the standard includes do not define it. */ #undef uint8_t /* Define to the type of an unsigned integer type wide enough to hold a pointer, if such a type exists, and if the system does not define it. */ #undef uintptr_t mosh-1.4.0/src/include/Makefile.am0000664000175000017500000000043714174450057013666 00000000000000BUILT_SOURCES = version.h nodist_INCLUDES = version.h clean-local: @rm -rf version.h version.h: ../../VERSION @test -s $< @printf '#define BUILD_VERSION "%s"\n' "$$(cat $<)" > $@.new @set -e; if ! diff -q $@ $@.new > /dev/null 2>&1; then \ mv -f $@.new $@; \ fi @rm -f $@.new mosh-1.4.0/src/fuzz/0000775000175000017500000000000014327736673011274 500000000000000mosh-1.4.0/src/fuzz/terminal_parser_fuzzer.cc0000664000175000017500000000043414272621034016277 00000000000000#include #include #include "parser.h" extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { Parser::UTF8Parser parser; Parser::Actions result; for (size_t i = 0; i < size; i++) { parser.input(data[i], result); } return 0; } mosh-1.4.0/src/fuzz/Makefile.in0000664000175000017500000006013514327736657013270 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 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)) 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 = : @ENABLE_FUZZING_TRUE@noinst_PROGRAMS = \ @ENABLE_FUZZING_TRUE@ terminal_parser_fuzzer$(EXEEXT) \ @ENABLE_FUZZING_TRUE@ terminal_fuzzer$(EXEEXT) subdir = src/fuzz ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ $(top_srcdir)/m4/ax_ac_print_to_file.m4 \ $(top_srcdir)/m4/ax_add_am_macro_static.m4 \ $(top_srcdir)/m4/ax_am_macros_static.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_gnu_make.m4 \ $(top_srcdir)/m4/ax_check_library.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_code_coverage.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ $(top_srcdir)/m4/ax_file_escapes.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 $(top_srcdir)/m4/pkg.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 = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = PROGRAMS = $(noinst_PROGRAMS) am_terminal_fuzzer_OBJECTS = \ terminal_fuzzer-terminal_fuzzer.$(OBJEXT) terminal_fuzzer_OBJECTS = $(am_terminal_fuzzer_OBJECTS) am__DEPENDENCIES_1 = terminal_fuzzer_DEPENDENCIES = ../terminal/libmoshterminal.a \ ../util/libmoshutil.a ../statesync/libmoshstatesync.a \ ../protobufs/libmoshprotos.a $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_terminal_parser_fuzzer_OBJECTS = \ terminal_parser_fuzzer-terminal_parser_fuzzer.$(OBJEXT) terminal_parser_fuzzer_OBJECTS = $(am_terminal_parser_fuzzer_OBJECTS) terminal_parser_fuzzer_DEPENDENCIES = ../terminal/libmoshterminal.a \ ../util/libmoshutil.a 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)/src/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/terminal_fuzzer-terminal_fuzzer.Po \ ./$(DEPDIR)/terminal_parser_fuzzer-terminal_parser_fuzzer.Po am__mv = mv -f AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) am__v_CXX_0 = @echo " CXX " $@; am__v_CXX_1 = CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) am__v_CXXLD_0 = @echo " CXXLD " $@; am__v_CXXLD_1 = SOURCES = $(terminal_fuzzer_SOURCES) $(terminal_parser_fuzzer_SOURCES) DIST_SOURCES = $(terminal_fuzzer_SOURCES) \ $(terminal_parser_fuzzer_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@ CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@ CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@ CPPFLAGS = @CPPFLAGS@ CRYPTO_CFLAGS = @CRYPTO_CFLAGS@ CRYPTO_LIBS = @CRYPTO_LIBS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CURSES_LIB = @CURSES_LIB@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FUZZING_CFLAGS = @FUZZING_CFLAGS@ GCOV = @GCOV@ GENHTML = @GENHTML@ HARDEN_CFLAGS = @HARDEN_CFLAGS@ HARDEN_LDFLAGS = @HARDEN_LDFLAGS@ HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LCOV = @LCOV@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MISC_CXXFLAGS = @MISC_CXXFLAGS@ MKDIR_P = @MKDIR_P@ Nettle_CFLAGS = @Nettle_CFLAGS@ Nettle_LIBS = @Nettle_LIBS@ OBJEXT = @OBJEXT@ OpenSSL_CFLAGS = @OpenSSL_CFLAGS@ OpenSSL_LIBS = @OpenSSL_LIBS@ 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@ PICKY_CXXFLAGS = @PICKY_CXXFLAGS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROTOC = @PROTOC@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TINFO_CFLAGS = @TINFO_CFLAGS@ TINFO_CPPFLAGS = @TINFO_CPPFLAGS@ TINFO_LDFLAGS = @TINFO_LDFLAGS@ TINFO_LIBS = @TINFO_LIBS@ VERSION = @VERSION@ WARNING_CXXFLAGS = @WARNING_CXXFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ completions = @completions@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ ifGNUmake = @ifGNUmake@ ifnGNUmake = @ifnGNUmake@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ protobuf_CFLAGS = @protobuf_CFLAGS@ protobuf_LIBS = @protobuf_LIBS@ 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@ AM_CXXFLAGS = $(WARNING_CXXFLAGS) $(PICKY_CXXFLAGS) $(HARDEN_CFLAGS) $(MISC_CXXFLAGS) $(CODE_COVERAGE_CXXFLAGS) $(FUZZING_CFLAGS) terminal_parser_fuzzer_CPPFLAGS = -I$(srcdir)/../terminal -I$(srcdir)/../util terminal_parser_fuzzer_LDADD = ../terminal/libmoshterminal.a ../util/libmoshutil.a terminal_parser_fuzzer_SOURCES = terminal_parser_fuzzer.cc terminal_fuzzer_CPPFLAGS = -I$(srcdir)/../terminal -I$(srcdir)/../util -I$(srcdir)/../statesync -I../protobufs terminal_fuzzer_LDADD = ../terminal/libmoshterminal.a ../util/libmoshutil.a ../statesync/libmoshstatesync.a ../protobufs/libmoshprotos.a $(TINFO_LIBS) $(protobuf_LIBS) terminal_fuzzer_SOURCES = terminal_fuzzer.cc all: all-am .SUFFIXES: .SUFFIXES: .cc .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/fuzz/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/fuzz/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): clean-noinstPROGRAMS: -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) terminal_fuzzer$(EXEEXT): $(terminal_fuzzer_OBJECTS) $(terminal_fuzzer_DEPENDENCIES) $(EXTRA_terminal_fuzzer_DEPENDENCIES) @rm -f terminal_fuzzer$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(terminal_fuzzer_OBJECTS) $(terminal_fuzzer_LDADD) $(LIBS) terminal_parser_fuzzer$(EXEEXT): $(terminal_parser_fuzzer_OBJECTS) $(terminal_parser_fuzzer_DEPENDENCIES) $(EXTRA_terminal_parser_fuzzer_DEPENDENCIES) @rm -f terminal_parser_fuzzer$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(terminal_parser_fuzzer_OBJECTS) $(terminal_parser_fuzzer_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/terminal_fuzzer-terminal_fuzzer.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/terminal_parser_fuzzer-terminal_parser_fuzzer.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .cc.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` terminal_fuzzer-terminal_fuzzer.o: terminal_fuzzer.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(terminal_fuzzer_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT terminal_fuzzer-terminal_fuzzer.o -MD -MP -MF $(DEPDIR)/terminal_fuzzer-terminal_fuzzer.Tpo -c -o terminal_fuzzer-terminal_fuzzer.o `test -f 'terminal_fuzzer.cc' || echo '$(srcdir)/'`terminal_fuzzer.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/terminal_fuzzer-terminal_fuzzer.Tpo $(DEPDIR)/terminal_fuzzer-terminal_fuzzer.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='terminal_fuzzer.cc' object='terminal_fuzzer-terminal_fuzzer.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(terminal_fuzzer_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o terminal_fuzzer-terminal_fuzzer.o `test -f 'terminal_fuzzer.cc' || echo '$(srcdir)/'`terminal_fuzzer.cc terminal_fuzzer-terminal_fuzzer.obj: terminal_fuzzer.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(terminal_fuzzer_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT terminal_fuzzer-terminal_fuzzer.obj -MD -MP -MF $(DEPDIR)/terminal_fuzzer-terminal_fuzzer.Tpo -c -o terminal_fuzzer-terminal_fuzzer.obj `if test -f 'terminal_fuzzer.cc'; then $(CYGPATH_W) 'terminal_fuzzer.cc'; else $(CYGPATH_W) '$(srcdir)/terminal_fuzzer.cc'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/terminal_fuzzer-terminal_fuzzer.Tpo $(DEPDIR)/terminal_fuzzer-terminal_fuzzer.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='terminal_fuzzer.cc' object='terminal_fuzzer-terminal_fuzzer.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(terminal_fuzzer_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o terminal_fuzzer-terminal_fuzzer.obj `if test -f 'terminal_fuzzer.cc'; then $(CYGPATH_W) 'terminal_fuzzer.cc'; else $(CYGPATH_W) '$(srcdir)/terminal_fuzzer.cc'; fi` terminal_parser_fuzzer-terminal_parser_fuzzer.o: terminal_parser_fuzzer.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(terminal_parser_fuzzer_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT terminal_parser_fuzzer-terminal_parser_fuzzer.o -MD -MP -MF $(DEPDIR)/terminal_parser_fuzzer-terminal_parser_fuzzer.Tpo -c -o terminal_parser_fuzzer-terminal_parser_fuzzer.o `test -f 'terminal_parser_fuzzer.cc' || echo '$(srcdir)/'`terminal_parser_fuzzer.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/terminal_parser_fuzzer-terminal_parser_fuzzer.Tpo $(DEPDIR)/terminal_parser_fuzzer-terminal_parser_fuzzer.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='terminal_parser_fuzzer.cc' object='terminal_parser_fuzzer-terminal_parser_fuzzer.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(terminal_parser_fuzzer_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o terminal_parser_fuzzer-terminal_parser_fuzzer.o `test -f 'terminal_parser_fuzzer.cc' || echo '$(srcdir)/'`terminal_parser_fuzzer.cc terminal_parser_fuzzer-terminal_parser_fuzzer.obj: terminal_parser_fuzzer.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(terminal_parser_fuzzer_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT terminal_parser_fuzzer-terminal_parser_fuzzer.obj -MD -MP -MF $(DEPDIR)/terminal_parser_fuzzer-terminal_parser_fuzzer.Tpo -c -o terminal_parser_fuzzer-terminal_parser_fuzzer.obj `if test -f 'terminal_parser_fuzzer.cc'; then $(CYGPATH_W) 'terminal_parser_fuzzer.cc'; else $(CYGPATH_W) '$(srcdir)/terminal_parser_fuzzer.cc'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/terminal_parser_fuzzer-terminal_parser_fuzzer.Tpo $(DEPDIR)/terminal_parser_fuzzer-terminal_parser_fuzzer.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='terminal_parser_fuzzer.cc' object='terminal_parser_fuzzer-terminal_parser_fuzzer.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(terminal_parser_fuzzer_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o terminal_parser_fuzzer-terminal_parser_fuzzer.obj `if test -f 'terminal_parser_fuzzer.cc'; then $(CYGPATH_W) 'terminal_parser_fuzzer.cc'; else $(CYGPATH_W) '$(srcdir)/terminal_parser_fuzzer.cc'; fi` 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) installdirs: 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: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || 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 clean-noinstPROGRAMS mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/terminal_fuzzer-terminal_fuzzer.Po -rm -f ./$(DEPDIR)/terminal_parser_fuzzer-terminal_parser_fuzzer.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-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)/terminal_fuzzer-terminal_fuzzer.Po -rm -f ./$(DEPDIR)/terminal_parser_fuzzer-terminal_parser_fuzzer.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: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ 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-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 \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .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: mosh-1.4.0/src/fuzz/Makefile.am0000664000175000017500000000137014272621034013230 00000000000000AM_CXXFLAGS = $(WARNING_CXXFLAGS) $(PICKY_CXXFLAGS) $(HARDEN_CFLAGS) $(MISC_CXXFLAGS) $(CODE_COVERAGE_CXXFLAGS) $(FUZZING_CFLAGS) if ENABLE_FUZZING noinst_PROGRAMS = terminal_parser_fuzzer terminal_fuzzer endif terminal_parser_fuzzer_CPPFLAGS = -I$(srcdir)/../terminal -I$(srcdir)/../util terminal_parser_fuzzer_LDADD = ../terminal/libmoshterminal.a ../util/libmoshutil.a terminal_parser_fuzzer_SOURCES = terminal_parser_fuzzer.cc terminal_fuzzer_CPPFLAGS = -I$(srcdir)/../terminal -I$(srcdir)/../util -I$(srcdir)/../statesync -I../protobufs terminal_fuzzer_LDADD = ../terminal/libmoshterminal.a ../util/libmoshutil.a ../statesync/libmoshstatesync.a ../protobufs/libmoshprotos.a $(TINFO_LIBS) $(protobuf_LIBS) terminal_fuzzer_SOURCES = terminal_fuzzer.cc mosh-1.4.0/src/fuzz/terminal_fuzzer.cc0000664000175000017500000000066314272621034014727 00000000000000#include #include #include "parser.h" #include "completeterminal.h" extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { Terminal::Display display(false); Terminal::Complete complete(80, 24); Terminal::Framebuffer state(80, 24); for (size_t i = 0; i < size; i++) { complete.act(Parser::UserByte(data[i])); } display.new_frame(true, state, complete.get_fb()); return 0; } mosh-1.4.0/src/Makefile.am0000664000175000017500000000014014272621034012224 00000000000000SUBDIRS = include protobufs util crypto terminal network statesync frontend examples tests fuzz mosh-1.4.0/src/statesync/0000775000175000017500000000000014327736673012313 500000000000000mosh-1.4.0/src/statesync/Makefile.in0000664000175000017500000004502214327736660014277 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 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)) 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 = : subdir = src/statesync ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ $(top_srcdir)/m4/ax_ac_print_to_file.m4 \ $(top_srcdir)/m4/ax_add_am_macro_static.m4 \ $(top_srcdir)/m4/ax_am_macros_static.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_gnu_make.m4 \ $(top_srcdir)/m4/ax_check_library.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_code_coverage.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ $(top_srcdir)/m4/ax_file_escapes.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 $(top_srcdir)/m4/pkg.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 = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) ARFLAGS = cru AM_V_AR = $(am__v_AR_@AM_V@) am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) am__v_AR_0 = @echo " AR " $@; am__v_AR_1 = libmoshstatesync_a_AR = $(AR) $(ARFLAGS) libmoshstatesync_a_LIBADD = am_libmoshstatesync_a_OBJECTS = completeterminal.$(OBJEXT) \ user.$(OBJEXT) libmoshstatesync_a_OBJECTS = $(am_libmoshstatesync_a_OBJECTS) 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)/src/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/completeterminal.Po \ ./$(DEPDIR)/user.Po am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) am__v_CXX_0 = @echo " CXX " $@; am__v_CXX_1 = CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) am__v_CXXLD_0 = @echo " CXXLD " $@; am__v_CXXLD_1 = 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 = $(libmoshstatesync_a_SOURCES) DIST_SOURCES = $(libmoshstatesync_a_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@ CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@ CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@ CPPFLAGS = @CPPFLAGS@ CRYPTO_CFLAGS = @CRYPTO_CFLAGS@ CRYPTO_LIBS = @CRYPTO_LIBS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CURSES_LIB = @CURSES_LIB@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FUZZING_CFLAGS = @FUZZING_CFLAGS@ GCOV = @GCOV@ GENHTML = @GENHTML@ HARDEN_CFLAGS = @HARDEN_CFLAGS@ HARDEN_LDFLAGS = @HARDEN_LDFLAGS@ HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LCOV = @LCOV@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MISC_CXXFLAGS = @MISC_CXXFLAGS@ MKDIR_P = @MKDIR_P@ Nettle_CFLAGS = @Nettle_CFLAGS@ Nettle_LIBS = @Nettle_LIBS@ OBJEXT = @OBJEXT@ OpenSSL_CFLAGS = @OpenSSL_CFLAGS@ OpenSSL_LIBS = @OpenSSL_LIBS@ 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@ PICKY_CXXFLAGS = @PICKY_CXXFLAGS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROTOC = @PROTOC@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TINFO_CFLAGS = @TINFO_CFLAGS@ TINFO_CPPFLAGS = @TINFO_CPPFLAGS@ TINFO_LDFLAGS = @TINFO_LDFLAGS@ TINFO_LIBS = @TINFO_LIBS@ VERSION = @VERSION@ WARNING_CXXFLAGS = @WARNING_CXXFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ completions = @completions@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ ifGNUmake = @ifGNUmake@ ifnGNUmake = @ifnGNUmake@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ protobuf_CFLAGS = @protobuf_CFLAGS@ protobuf_LIBS = @protobuf_LIBS@ 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@ AM_CPPFLAGS = -I$(srcdir)/../util -I$(srcdir)/../terminal -I../protobufs $(protobuf_CFLAGS) AM_CXXFLAGS = $(WARNING_CXXFLAGS) $(PICKY_CXXFLAGS) $(HARDEN_CFLAGS) $(MISC_CXXFLAGS) $(CODE_COVERAGE_CXXFLAGS) noinst_LIBRARIES = libmoshstatesync.a libmoshstatesync_a_SOURCES = completeterminal.cc completeterminal.h user.cc user.h all: all-am .SUFFIXES: .SUFFIXES: .cc .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/statesync/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/statesync/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): clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libmoshstatesync.a: $(libmoshstatesync_a_OBJECTS) $(libmoshstatesync_a_DEPENDENCIES) $(EXTRA_libmoshstatesync_a_DEPENDENCIES) $(AM_V_at)-rm -f libmoshstatesync.a $(AM_V_AR)$(libmoshstatesync_a_AR) libmoshstatesync.a $(libmoshstatesync_a_OBJECTS) $(libmoshstatesync_a_LIBADD) $(AM_V_at)$(RANLIB) libmoshstatesync.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/completeterminal.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/user.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .cc.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -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 $(LIBRARIES) installdirs: 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: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || 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 clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/completeterminal.Po -rm -f ./$(DEPDIR)/user.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-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)/completeterminal.Po -rm -f ./$(DEPDIR)/user.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: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-noinstLIBRARIES 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-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 \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .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: mosh-1.4.0/src/statesync/completeterminal.h0000664000175000017500000000627214174450057015744 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #ifndef COMPLETE_TERMINAL_HPP #define COMPLETE_TERMINAL_HPP #include #include #include "parser.h" #include "terminal.h" /* This class represents the complete terminal -- a UTF8Parser feeding Actions to an Emulator. */ namespace Terminal { class Complete { private: Parser::UTF8Parser parser; Terminal::Emulator terminal; Terminal::Display display; // Only used locally by act(), but kept here as a performance optimization, // to avoid construction/destruction. It must always be empty // outside calls to act() to keep horrible things from happening. Parser::Actions actions; typedef std::list< std::pair > input_history_type; input_history_type input_history; uint64_t echo_ack; static const int ECHO_TIMEOUT = 50; /* for late ack */ public: Complete( size_t width, size_t height ) : parser(), terminal( width, height ), display( false ), actions(), input_history(), echo_ack( 0 ) {} std::string act( const std::string &str ); std::string act( const Parser::Action &act ); const Framebuffer & get_fb( void ) const { return terminal.get_fb(); } void reset_input( void ) { parser.reset_input(); } uint64_t get_echo_ack( void ) const { return echo_ack; } bool set_echo_ack( uint64_t now ); void register_input_frame( uint64_t n, uint64_t now ); int wait_time( uint64_t now ) const; /* interface for Network::Transport */ void subtract( const Complete * ) const {} std::string diff_from( const Complete &existing ) const; std::string init_diff( void ) const; void apply_string( const std::string & diff ); bool operator==( const Complete &x ) const; bool compare( const Complete &other ) const; }; } #endif mosh-1.4.0/src/statesync/user.h0000664000175000017500000000621614174450057013354 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #ifndef USER_HPP #define USER_HPP #include #include #include #include #include "parseraction.h" namespace Network { using std::deque; using std::list; using std::string; enum UserEventType { UserByteType = 0, ResizeType = 1 }; class UserEvent { public: UserEventType type; Parser::UserByte userbyte; Parser::Resize resize; UserEvent( const Parser::UserByte & s_userbyte ) : type( UserByteType ), userbyte( s_userbyte ), resize( -1, -1 ) {} UserEvent( const Parser::Resize & s_resize ) : type( ResizeType ), userbyte( 0 ), resize( s_resize ) {} private: UserEvent(); public: bool operator==( const UserEvent &x ) const { return ( type == x.type ) && ( userbyte == x.userbyte ) && ( resize == x.resize ); } }; class UserStream { private: deque actions; public: UserStream() : actions() {} void push_back( const Parser::UserByte & s_userbyte ) { actions.push_back( UserEvent( s_userbyte ) ); } void push_back( const Parser::Resize & s_resize ) { actions.push_back( UserEvent( s_resize ) ); } bool empty( void ) const { return actions.empty(); } size_t size( void ) const { return actions.size(); } const Parser::Action &get_action( unsigned int i ) const; /* interface for Network::Transport */ void subtract( const UserStream *prefix ); string diff_from( const UserStream &existing ) const; string init_diff( void ) const { return diff_from( UserStream() ); }; void apply_string( const string &diff ); bool operator==( const UserStream &x ) const { return actions == x.actions; } bool compare( const UserStream & ) { return false; } }; } #endif mosh-1.4.0/src/statesync/completeterminal.cc0000664000175000017500000001557414174450057016107 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include "completeterminal.h" #include "fatal_assert.h" #include "hostinput.pb.h" #include using namespace std; using namespace Parser; using namespace Terminal; using namespace HostBuffers; string Complete::act( const string &str ) { for ( unsigned int i = 0; i < str.size(); i++ ) { /* parse octet into up to three actions */ parser.input( str[ i ], actions ); /* apply actions to terminal and delete them */ for ( Actions::iterator it = actions.begin(); it != actions.end(); it++ ) { Action &act = **it; act.act_on_terminal( &terminal ); } actions.clear(); } return terminal.read_octets_to_host(); } string Complete::act( const Action &act ) { /* apply action to terminal */ act.act_on_terminal( &terminal ); return terminal.read_octets_to_host(); } /* interface for Network::Transport */ string Complete::diff_from( const Complete &existing ) const { HostBuffers::HostMessage output; if ( existing.get_echo_ack() != get_echo_ack() ) { assert( get_echo_ack() >= existing.get_echo_ack() ); Instruction *new_echo = output.add_instruction(); new_echo->MutableExtension( echoack )->set_echo_ack_num( get_echo_ack() ); } if ( !(existing.get_fb() == get_fb()) ) { if ( (existing.get_fb().ds.get_width() != terminal.get_fb().ds.get_width()) || (existing.get_fb().ds.get_height() != terminal.get_fb().ds.get_height()) ) { Instruction *new_res = output.add_instruction(); new_res->MutableExtension( resize )->set_width( terminal.get_fb().ds.get_width() ); new_res->MutableExtension( resize )->set_height( terminal.get_fb().ds.get_height() ); } string update = display.new_frame( true, existing.get_fb(), terminal.get_fb() ); if ( !update.empty() ) { Instruction *new_inst = output.add_instruction(); new_inst->MutableExtension( hostbytes )->set_hoststring( update ); } } return output.SerializeAsString(); } string Complete::init_diff( void ) const { return diff_from( Complete( get_fb().ds.get_width(), get_fb().ds.get_height() )); } void Complete::apply_string( const string & diff ) { HostBuffers::HostMessage input; fatal_assert( input.ParseFromString( diff ) ); for ( int i = 0; i < input.instruction_size(); i++ ) { if ( input.instruction( i ).HasExtension( hostbytes ) ) { string terminal_to_host = act( input.instruction( i ).GetExtension( hostbytes ).hoststring() ); assert( terminal_to_host.empty() ); /* server never interrogates client terminal */ } else if ( input.instruction( i ).HasExtension( resize ) ) { act( Resize( input.instruction( i ).GetExtension( resize ).width(), input.instruction( i ).GetExtension( resize ).height() ) ); } else if ( input.instruction( i ).HasExtension( echoack ) ) { uint64_t inst_echo_ack_num = input.instruction( i ).GetExtension( echoack ).echo_ack_num(); assert( inst_echo_ack_num >= echo_ack ); echo_ack = inst_echo_ack_num; } } } bool Complete::operator==( Complete const &x ) const { // assert( parser == x.parser ); /* parser state is irrelevant for us */ return (terminal == x.terminal) && (echo_ack == x.echo_ack); } bool Complete::set_echo_ack( uint64_t now ) { bool ret = false; uint64_t newest_echo_ack = 0; for ( input_history_type::const_iterator i = input_history.begin(); i != input_history.end(); i++ ) { if ( i->second <= now - ECHO_TIMEOUT ) { newest_echo_ack = i->first; } } for ( input_history_type::iterator i = input_history.begin(); i != input_history.end(); ) { input_history_type::iterator i_next = i; i_next++; if ( i->first < newest_echo_ack ) { input_history.erase( i ); } i = i_next; } if ( echo_ack != newest_echo_ack ) { ret = true; } echo_ack = newest_echo_ack; return ret; } void Complete::register_input_frame( uint64_t n, uint64_t now ) { input_history.push_back( std::make_pair( n, now ) ); } int Complete::wait_time( uint64_t now ) const { if ( input_history.size() < 2 ) { return INT_MAX; } input_history_type::const_iterator it = input_history.begin(); it++; uint64_t next_echo_ack_time = it->second + ECHO_TIMEOUT; if ( next_echo_ack_time <= now ) { return 0; } return next_echo_ack_time - now; } bool Complete::compare( const Complete &other ) const { bool ret = false; const Framebuffer &fb = terminal.get_fb(); const Framebuffer &other_fb = other.terminal.get_fb(); const int height = fb.ds.get_height(); const int other_height = other_fb.ds.get_height(); const int width = fb.ds.get_width(); const int other_width = other_fb.ds.get_width(); if ( height != other_height || width != other_width ) { fprintf( stderr, "Framebuffer size (%dx%d, %dx%d) differs.\n", width, height, other_width, other_height ); return true; } for ( int y = 0; y < height; y++ ) { for ( int x = 0; x < width; x++ ) { if ( fb.get_cell( y, x )->compare( *other_fb.get_cell( y, x ) ) ) { fprintf( stderr, "Cell (%d, %d) differs.\n", y, x ); ret = true; } } } if ( (fb.ds.get_cursor_row() != other_fb.ds.get_cursor_row()) || (fb.ds.get_cursor_col() != other_fb.ds.get_cursor_col()) ) { fprintf( stderr, "Cursor mismatch: (%d, %d) vs. (%d, %d).\n", fb.ds.get_cursor_row(), fb.ds.get_cursor_col(), other_fb.ds.get_cursor_row(), other_fb.ds.get_cursor_col() ); ret = true; } /* XXX should compare other terminal state too (mouse mode, bell. etc.) */ return ret; } mosh-1.4.0/src/statesync/user.cc0000664000175000017500000001066614174450057013516 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include #include #include "user.h" #include "fatal_assert.h" #include "userinput.pb.h" using namespace Parser; using namespace Network; using namespace ClientBuffers; void UserStream::subtract( const UserStream *prefix ) { // if we are subtracting ourself from ourself, just clear the deque if ( this == prefix ) { actions.clear(); return; } for ( deque::const_iterator i = prefix->actions.begin(); i != prefix->actions.end(); i++ ) { assert( this != prefix ); assert( !actions.empty() ); assert( *i == actions.front() ); actions.pop_front(); } } string UserStream::diff_from( const UserStream &existing ) const { deque::const_iterator my_it = actions.begin(); for ( deque::const_iterator i = existing.actions.begin(); i != existing.actions.end(); i++ ) { assert( my_it != actions.end() ); assert( *i == *my_it ); my_it++; } ClientBuffers::UserMessage output; while ( my_it != actions.end() ) { switch ( my_it->type ) { case UserByteType: { char the_byte = my_it->userbyte.c; /* can we combine this with a previous Keystroke? */ if ( (output.instruction_size() > 0) && (output.instruction( output.instruction_size() - 1 ).HasExtension( keystroke )) ) { output.mutable_instruction( output.instruction_size() - 1 )->MutableExtension( keystroke )->mutable_keys()->append( string( &the_byte, 1 ) ); } else { Instruction *new_inst = output.add_instruction(); new_inst->MutableExtension( keystroke )->set_keys( &the_byte, 1 ); } } break; case ResizeType: { Instruction *new_inst = output.add_instruction(); new_inst->MutableExtension( resize )->set_width( my_it->resize.width ); new_inst->MutableExtension( resize )->set_height( my_it->resize.height ); } break; default: assert( !"unexpected event type" ); break; } my_it++; } return output.SerializeAsString(); } void UserStream::apply_string( const string &diff ) { ClientBuffers::UserMessage input; fatal_assert( input.ParseFromString( diff ) ); for ( int i = 0; i < input.instruction_size(); i++ ) { if ( input.instruction( i ).HasExtension( keystroke ) ) { string the_bytes = input.instruction( i ).GetExtension( keystroke ).keys(); for ( unsigned int loc = 0; loc < the_bytes.size(); loc++ ) { actions.push_back( UserEvent( UserByte( the_bytes.at( loc ) ) ) ); } } else if ( input.instruction( i ).HasExtension( resize ) ) { actions.push_back( UserEvent( Resize( input.instruction( i ).GetExtension( resize ).width(), input.instruction( i ).GetExtension( resize ).height() ) ) ); } } } const Parser::Action &UserStream::get_action( unsigned int i ) const { switch( actions[ i ].type ) { case UserByteType: return actions[ i ].userbyte; case ResizeType: return actions[ i ].resize; default: assert( !"unexpected action type" ); static const Parser::Ignore nothing = Parser::Ignore(); return nothing; } } mosh-1.4.0/src/statesync/Makefile.am0000664000175000017500000000050714272621034014250 00000000000000AM_CPPFLAGS = -I$(srcdir)/../util -I$(srcdir)/../terminal -I../protobufs $(protobuf_CFLAGS) AM_CXXFLAGS = $(WARNING_CXXFLAGS) $(PICKY_CXXFLAGS) $(HARDEN_CFLAGS) $(MISC_CXXFLAGS) $(CODE_COVERAGE_CXXFLAGS) noinst_LIBRARIES = libmoshstatesync.a libmoshstatesync_a_SOURCES = completeterminal.cc completeterminal.h user.cc user.h mosh-1.4.0/src/terminal/0000775000175000017500000000000014327736673012111 500000000000000mosh-1.4.0/src/terminal/Makefile.in0000664000175000017500000005117014327736660014076 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 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)) 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 = : subdir = src/terminal ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ $(top_srcdir)/m4/ax_ac_print_to_file.m4 \ $(top_srcdir)/m4/ax_add_am_macro_static.m4 \ $(top_srcdir)/m4/ax_am_macros_static.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_gnu_make.m4 \ $(top_srcdir)/m4/ax_check_library.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_code_coverage.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ $(top_srcdir)/m4/ax_file_escapes.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 $(top_srcdir)/m4/pkg.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 = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) ARFLAGS = cru AM_V_AR = $(am__v_AR_@AM_V@) am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) am__v_AR_0 = @echo " AR " $@; am__v_AR_1 = libmoshterminal_a_AR = $(AR) $(ARFLAGS) libmoshterminal_a_LIBADD = am_libmoshterminal_a_OBJECTS = parseraction.$(OBJEXT) parser.$(OBJEXT) \ parserstate.$(OBJEXT) terminal.$(OBJEXT) \ terminaldispatcher.$(OBJEXT) terminaldisplay.$(OBJEXT) \ terminaldisplayinit.$(OBJEXT) terminalframebuffer.$(OBJEXT) \ terminalfunctions.$(OBJEXT) terminaluserinput.$(OBJEXT) libmoshterminal_a_OBJECTS = $(am_libmoshterminal_a_OBJECTS) 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)/src/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/parser.Po \ ./$(DEPDIR)/parseraction.Po ./$(DEPDIR)/parserstate.Po \ ./$(DEPDIR)/terminal.Po ./$(DEPDIR)/terminaldispatcher.Po \ ./$(DEPDIR)/terminaldisplay.Po \ ./$(DEPDIR)/terminaldisplayinit.Po \ ./$(DEPDIR)/terminalframebuffer.Po \ ./$(DEPDIR)/terminalfunctions.Po \ ./$(DEPDIR)/terminaluserinput.Po am__mv = mv -f CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) am__v_CXX_0 = @echo " CXX " $@; am__v_CXX_1 = CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) am__v_CXXLD_0 = @echo " CXXLD " $@; am__v_CXXLD_1 = 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 = $(libmoshterminal_a_SOURCES) DIST_SOURCES = $(libmoshterminal_a_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@ CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@ CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@ CPPFLAGS = @CPPFLAGS@ CRYPTO_CFLAGS = @CRYPTO_CFLAGS@ CRYPTO_LIBS = @CRYPTO_LIBS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CURSES_LIB = @CURSES_LIB@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FUZZING_CFLAGS = @FUZZING_CFLAGS@ GCOV = @GCOV@ GENHTML = @GENHTML@ HARDEN_CFLAGS = @HARDEN_CFLAGS@ HARDEN_LDFLAGS = @HARDEN_LDFLAGS@ HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LCOV = @LCOV@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MISC_CXXFLAGS = @MISC_CXXFLAGS@ MKDIR_P = @MKDIR_P@ Nettle_CFLAGS = @Nettle_CFLAGS@ Nettle_LIBS = @Nettle_LIBS@ OBJEXT = @OBJEXT@ OpenSSL_CFLAGS = @OpenSSL_CFLAGS@ OpenSSL_LIBS = @OpenSSL_LIBS@ 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@ PICKY_CXXFLAGS = @PICKY_CXXFLAGS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROTOC = @PROTOC@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TINFO_CFLAGS = @TINFO_CFLAGS@ TINFO_CPPFLAGS = @TINFO_CPPFLAGS@ TINFO_LDFLAGS = @TINFO_LDFLAGS@ TINFO_LIBS = @TINFO_LIBS@ VERSION = @VERSION@ WARNING_CXXFLAGS = @WARNING_CXXFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ completions = @completions@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ ifGNUmake = @ifGNUmake@ ifnGNUmake = @ifnGNUmake@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ protobuf_CFLAGS = @protobuf_CFLAGS@ protobuf_LIBS = @protobuf_LIBS@ 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@ AM_CPPFLAGS = -I$(srcdir)/../util $(TINFO_CFLAGS) AM_CXXFLAGS = $(WARNING_CXXFLAGS) $(PICKY_CXXFLAGS) $(HARDEN_CFLAGS) $(MISC_CXXFLAGS) $(CODE_COVERAGE_CXXFLAGS) noinst_LIBRARIES = libmoshterminal.a libmoshterminal_a_SOURCES = parseraction.cc parseraction.h parser.cc parser.h parserstate.cc parserstatefamily.h parserstate.h parsertransition.h terminal.cc terminaldispatcher.cc terminaldispatcher.h terminaldisplay.cc terminaldisplayinit.cc terminaldisplay.h terminalframebuffer.cc terminalframebuffer.h terminalfunctions.cc terminal.h terminaluserinput.cc terminaluserinput.h all: all-am .SUFFIXES: .SUFFIXES: .cc .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/terminal/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/terminal/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): clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libmoshterminal.a: $(libmoshterminal_a_OBJECTS) $(libmoshterminal_a_DEPENDENCIES) $(EXTRA_libmoshterminal_a_DEPENDENCIES) $(AM_V_at)-rm -f libmoshterminal.a $(AM_V_AR)$(libmoshterminal_a_AR) libmoshterminal.a $(libmoshterminal_a_OBJECTS) $(libmoshterminal_a_LIBADD) $(AM_V_at)$(RANLIB) libmoshterminal.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parser.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parseraction.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parserstate.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/terminal.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/terminaldispatcher.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/terminaldisplay.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/terminaldisplayinit.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/terminalframebuffer.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/terminalfunctions.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/terminaluserinput.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .cc.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -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 $(LIBRARIES) installdirs: 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: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || 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 clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/parser.Po -rm -f ./$(DEPDIR)/parseraction.Po -rm -f ./$(DEPDIR)/parserstate.Po -rm -f ./$(DEPDIR)/terminal.Po -rm -f ./$(DEPDIR)/terminaldispatcher.Po -rm -f ./$(DEPDIR)/terminaldisplay.Po -rm -f ./$(DEPDIR)/terminaldisplayinit.Po -rm -f ./$(DEPDIR)/terminalframebuffer.Po -rm -f ./$(DEPDIR)/terminalfunctions.Po -rm -f ./$(DEPDIR)/terminaluserinput.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-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)/parser.Po -rm -f ./$(DEPDIR)/parseraction.Po -rm -f ./$(DEPDIR)/parserstate.Po -rm -f ./$(DEPDIR)/terminal.Po -rm -f ./$(DEPDIR)/terminaldispatcher.Po -rm -f ./$(DEPDIR)/terminaldisplay.Po -rm -f ./$(DEPDIR)/terminaldisplayinit.Po -rm -f ./$(DEPDIR)/terminalframebuffer.Po -rm -f ./$(DEPDIR)/terminalfunctions.Po -rm -f ./$(DEPDIR)/terminaluserinput.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: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-noinstLIBRARIES 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-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 \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .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: mosh-1.4.0/src/terminal/terminaluserinput.h0000644000175000017500000000367713103401307015755 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #ifndef TERMINALUSERINPUT_HPP #define TERMINALUSERINPUT_HPP #include #include "parseraction.h" namespace Terminal { class UserInput { public: enum UserInputState { Ground, ESC, SS3 }; private: UserInputState state; public: UserInput() : state( Ground ) {} std::string input( const Parser::UserByte *act, bool application_mode_cursor_keys ); bool operator==( const UserInput &x ) const { return state == x.state; } }; } #endif mosh-1.4.0/src/terminal/parserstatefamily.h0000644000175000017500000000554513103401307015716 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #ifndef PARSERSTATEFAMILY_HPP #define PARSERSTATEFAMILY_HPP #include "parserstate.h" namespace Parser { class StateFamily { public: Ground s_Ground; Escape s_Escape; Escape_Intermediate s_Escape_Intermediate; CSI_Entry s_CSI_Entry; CSI_Param s_CSI_Param; CSI_Intermediate s_CSI_Intermediate; CSI_Ignore s_CSI_Ignore; DCS_Entry s_DCS_Entry; DCS_Param s_DCS_Param; DCS_Intermediate s_DCS_Intermediate; DCS_Passthrough s_DCS_Passthrough; DCS_Ignore s_DCS_Ignore; OSC_String s_OSC_String; SOS_PM_APC_String s_SOS_PM_APC_String; StateFamily() : s_Ground(), s_Escape(), s_Escape_Intermediate(), s_CSI_Entry(), s_CSI_Param(), s_CSI_Intermediate(), s_CSI_Ignore(), s_DCS_Entry(), s_DCS_Param(), s_DCS_Intermediate(), s_DCS_Passthrough(), s_DCS_Ignore(), s_OSC_String(), s_SOS_PM_APC_String() { s_Ground.setfamily( this ); s_Escape.setfamily( this ); s_Escape_Intermediate.setfamily( this ); s_CSI_Entry.setfamily( this ); s_CSI_Param.setfamily( this ); s_CSI_Intermediate.setfamily( this ); s_CSI_Ignore.setfamily( this ); s_DCS_Entry.setfamily( this ); s_DCS_Param.setfamily( this ); s_DCS_Intermediate.setfamily( this ); s_DCS_Passthrough.setfamily( this ); s_DCS_Ignore.setfamily( this ); s_OSC_String.setfamily( this ); s_SOS_PM_APC_String.setfamily( this ); } }; } #endif mosh-1.4.0/src/terminal/terminaldisplayinit.cc0000664000175000017500000001036014174450064016410 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ /* This is in its own file because otherwise the ncurses #defines alias our own variable names. */ #include "config.h" #include "terminaldisplay.h" #include #include #if defined HAVE_NCURSESW_CURSES_H # include # include #elif defined HAVE_NCURSESW_H # include # include #elif defined HAVE_NCURSES_CURSES_H # include # include #elif defined HAVE_NCURSES_H # include # include #elif defined HAVE_CURSES_H # include # include #else # error "SysV or X/Open-compatible Curses header file required" #endif #include #include using namespace Terminal; static bool ti_flag( const char *capname ) { int val = tigetflag( const_cast( capname ) ); if ( val == -1 ) { throw std::invalid_argument( std::string( "Invalid terminfo boolean capability " ) + capname ); } return val; } static const char *ti_str( const char *capname ) { const char *val = tigetstr( const_cast( capname ) ); if ( val == (const char *)-1 ) { throw std::invalid_argument( std::string( "Invalid terminfo string capability " ) + capname ); } return val; } Display::Display( bool use_environment ) : has_ech( true ), has_bce( true ), has_title( true ), smcup( NULL ), rmcup( NULL ) { if ( use_environment ) { int errret = -2; int ret = setupterm( (char *)0, 1, &errret ); if ( ret != OK ) { switch ( errret ) { case 1: throw std::runtime_error( "Terminal is hardcopy and cannot be used by curses applications." ); break; case 0: throw std::runtime_error( "Unknown terminal type." ); break; case -1: throw std::runtime_error( "Terminfo database could not be found." ); break; default: throw std::runtime_error( "Unknown terminfo error." ); break; } } /* check for ECH */ has_ech = ti_str( "ech" ); /* check for BCE */ has_bce = ti_flag( "bce" ); /* Check if we can set the window title and icon name. terminfo does not have reliable information on this, so we hardcode a whitelist of terminal type prefixes. */ static const char * const title_term_types[] = { "xterm", "rxvt", "kterm", "Eterm", "alacritty", "screen", "tmux" }; has_title = false; const char *term_type = getenv( "TERM" ); if ( term_type ) { for ( size_t i = 0; i < sizeof( title_term_types ) / sizeof( const char * ); i++ ) { if ( 0 == strncmp( term_type, title_term_types[ i ], strlen( title_term_types[ i ] ) ) ) { has_title = true; break; } } } if ( !getenv( "MOSH_NO_TERM_INIT" ) ) { smcup = ti_str("smcup"); rmcup = ti_str("rmcup"); } } } mosh-1.4.0/src/terminal/parseraction.h0000664000175000017500000001216714174450057014670 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #ifndef PARSERACTION_HPP #define PARSERACTION_HPP #include #include #include "shared.h" namespace Terminal { class Emulator; } namespace Parser { class Action { public: wchar_t ch; bool char_present; virtual std::string name( void ) = 0; virtual void act_on_terminal( Terminal::Emulator * ) const {}; virtual bool ignore() const { return false; } Action() : ch( -1 ), char_present( false ) {}; virtual ~Action() {}; }; typedef shared::shared_ptr ActionPointer; typedef std::vector Actions; class Ignore : public Action { public: std::string name( void ) { return std::string( "Ignore" ); } bool ignore() const { return true; } }; class Print : public Action { public: std::string name( void ) { return std::string( "Print" ); } void act_on_terminal( Terminal::Emulator *emu ) const; }; class Execute : public Action { public: std::string name( void ) { return std::string( "Execute" ); } void act_on_terminal( Terminal::Emulator *emu ) const; }; class Clear : public Action { public: std::string name( void ) { return std::string( "Clear" ); } void act_on_terminal( Terminal::Emulator *emu ) const; }; class Collect : public Action { public: std::string name( void ) { return std::string( "Collect" ); } void act_on_terminal( Terminal::Emulator *emu ) const; }; class Param : public Action { public: std::string name( void ) { return std::string( "Param" ); } void act_on_terminal( Terminal::Emulator *emu ) const; }; class Esc_Dispatch : public Action { public: std::string name( void ) { return std::string( "Esc_Dispatch" ); } void act_on_terminal( Terminal::Emulator *emu ) const; }; class CSI_Dispatch : public Action { public: std::string name( void ) { return std::string( "CSI_Dispatch" ); } void act_on_terminal( Terminal::Emulator *emu ) const; }; class Hook : public Action { public: std::string name( void ) { return std::string( "Hook" ); } }; class Put : public Action { public: std::string name( void ) { return std::string( "Put" ); } }; class Unhook : public Action { public: std::string name( void ) { return std::string( "Unhook" ); } }; class OSC_Start : public Action { public: std::string name( void ) { return std::string( "OSC_Start" ); } void act_on_terminal( Terminal::Emulator *emu ) const; }; class OSC_Put : public Action { public: std::string name( void ) { return std::string( "OSC_Put" ); } void act_on_terminal( Terminal::Emulator *emu ) const; }; class OSC_End : public Action { public: std::string name( void ) { return std::string( "OSC_End" ); } void act_on_terminal( Terminal::Emulator *emu ) const; }; class UserByte : public Action { /* user keystroke -- not part of the host-source state machine*/ public: char c; /* The user-source byte. We don't try to interpret the charset */ std::string name( void ) { return std::string( "UserByte" ); } void act_on_terminal( Terminal::Emulator *emu ) const; UserByte( int s_c ) : c( s_c ) {} bool operator==( const UserByte &other ) const { return c == other.c; } }; class Resize : public Action { /* resize event -- not part of the host-source state machine*/ public: size_t width, height; std::string name( void ) { return std::string( "Resize" ); } void act_on_terminal( Terminal::Emulator *emu ) const; Resize( size_t s_width, size_t s_height ) : width( s_width ), height( s_height ) {} bool operator==( const Resize &other ) const { return ( width == other.width ) && ( height == other.height ); } }; } #endif mosh-1.4.0/src/terminal/parserstate.h0000664000175000017500000000737014174450057014533 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #ifndef PARSERSTATE_HPP #define PARSERSTATE_HPP #include "parsertransition.h" namespace Parser { class StateFamily; class State { protected: virtual Transition input_state_rule( wchar_t ch ) const = 0; StateFamily *family; private: Transition anywhere_rule( wchar_t ch ) const; public: void setfamily( StateFamily *s_family ) { family = s_family; } Transition input( wchar_t ch ) const; virtual ActionPointer enter( void ) const { return shared::make_shared< Ignore >(); } virtual ActionPointer exit( void ) const { return shared::make_shared< Ignore >(); } State() : family( NULL ) {}; virtual ~State() {}; State( const State & ); State & operator=( const State & ); }; class Ground : public State { Transition input_state_rule( wchar_t ch ) const; }; class Escape : public State { ActionPointer enter( void ) const; Transition input_state_rule( wchar_t ch ) const; }; class Escape_Intermediate : public State { Transition input_state_rule( wchar_t ch ) const; }; class CSI_Entry : public State { ActionPointer enter( void ) const; Transition input_state_rule( wchar_t ch ) const; }; class CSI_Param : public State { Transition input_state_rule( wchar_t ch ) const; }; class CSI_Intermediate : public State { Transition input_state_rule( wchar_t ch ) const; }; class CSI_Ignore : public State { Transition input_state_rule( wchar_t ch ) const; }; class DCS_Entry : public State { ActionPointer enter( void ) const; Transition input_state_rule( wchar_t ch ) const; }; class DCS_Param : public State { Transition input_state_rule( wchar_t ch ) const; }; class DCS_Intermediate : public State { Transition input_state_rule( wchar_t ch ) const; }; class DCS_Passthrough : public State { ActionPointer enter( void ) const; Transition input_state_rule( wchar_t ch ) const; ActionPointer exit( void ) const; }; class DCS_Ignore : public State { Transition input_state_rule( wchar_t ch ) const; }; class OSC_String : public State { ActionPointer enter( void ) const; Transition input_state_rule( wchar_t ch ) const; ActionPointer exit( void ) const; }; class SOS_PM_APC_String : public State { Transition input_state_rule( wchar_t ch ) const; }; } #endif mosh-1.4.0/src/terminal/parser.h0000644000175000017500000000464313103401307013451 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #ifndef PARSER_HPP #define PARSER_HPP /* Based on Paul Williams's parser, http://www.vt100.net/emu/dec_ansi_parser */ #include #include #include "parsertransition.h" #include "parseraction.h" #include "parserstate.h" #include "parserstatefamily.h" namespace Parser { extern const StateFamily family; class Parser { private: State const *state; public: Parser() : state( &family.s_Ground ) {} Parser( const Parser &other ); Parser & operator=( const Parser & ); ~Parser() {} void input( wchar_t ch, Actions &actions ); void reset_input( void ) { state = &family.s_Ground; } }; static const size_t BUF_SIZE = 8; class UTF8Parser { private: Parser parser; char buf[ BUF_SIZE ]; size_t buf_len; public: UTF8Parser(); void input( char c, Actions &actions ); void reset_input( void ) { parser.reset_input(); buf[0] = '\0'; buf_len = 0; } }; } #endif mosh-1.4.0/src/terminal/terminalframebuffer.h0000664000175000017500000003573014174450057016217 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #ifndef TERMINALFB_HPP #define TERMINALFB_HPP #include #include #include #include #include #include #include #include "shared.h" /* Terminal framebuffer */ namespace Terminal { using shared::shared_ptr; using shared::make_shared; typedef uint32_t color_type; class Renditions { public: typedef enum { bold, faint, italic, underlined, blink, inverse, invisible, SIZE } attribute_type; private: static const uint64_t true_color_mask = 0x1000000; uint64_t foreground_color : 25; uint64_t background_color : 25; uint64_t attributes : 8; public: Renditions( color_type s_background ); void set_foreground_color( int num ); void set_background_color( int num ); void set_rendition( color_type num ); std::string sgr( void ) const; static unsigned int make_true_color( unsigned int r, unsigned int g, unsigned int b ) { return true_color_mask | (r << 16) | (g << 8) | b; } static bool is_true_color(unsigned int color) { return (color & true_color_mask) != 0; } // unsigned int get_foreground_rendition() const { return foreground_color; } unsigned int get_background_rendition() const { return background_color; } bool operator==( const Renditions &x ) const { return ( attributes == x.attributes ) && ( foreground_color == x.foreground_color ) && ( background_color == x.background_color ); } void set_attribute( attribute_type attr, bool val ) { attributes = val ? ( attributes | (1 << attr) ) : ( attributes & ~(1 << attr) ); } bool get_attribute( attribute_type attr ) const { return attributes & ( 1 << attr ); } void clear_attributes() { attributes = 0; } }; class Cell { private: typedef std::string content_type; /* can be std::string, std::vector, or __gnu_cxx::__vstring */ content_type contents; Renditions renditions; unsigned int wide : 1; /* 0 = narrow, 1 = wide */ unsigned int fallback : 1; /* first character is combining character */ unsigned int wrap : 1; private: Cell(); public: Cell( color_type background_color ); void reset( color_type background_color ); bool operator==( const Cell &x ) const { return ( (contents == x.contents) && (fallback == x.fallback) && (wide == x.wide) && (renditions == x.renditions) && (wrap == x.wrap) ); } bool operator!=( const Cell &x ) const { return !operator==( x ); } /* Accessors for contents field */ std::string debug_contents( void ) const; bool empty( void ) const { return contents.empty(); } /* 32 seems like a reasonable limit on combining characters */ bool full( void ) const { return contents.size() >= 32; } void clear( void ) { contents.clear(); } bool is_blank( void ) const { // XXX fix. return ( contents.empty() || contents == " " || contents == "\xC2\xA0" ); } bool contents_match ( const Cell &other ) const { return ( is_blank() && other.is_blank() ) || ( contents == other.contents ); } bool compare( const Cell &other ) const; // Is this a printing ISO 8859-1 character? static bool isprint_iso8859_1( const wchar_t c ) { return ( c <= 0xff && c >= 0xa0 ) || ( c <= 0x7e && c >= 0x20 ); } static void append_to_str( std::string &dest, const wchar_t c ) { /* ASCII? Cheat. */ if ( static_cast(c) <= 0x7f ) { dest.push_back( static_cast(c) ); return; } static mbstate_t ps = mbstate_t(); char tmp[MB_LEN_MAX]; size_t ignore = wcrtomb(NULL, 0, &ps); (void)ignore; size_t len = wcrtomb(tmp, c, &ps); dest.append( tmp, len ); } void append( const wchar_t c ) { /* ASCII? Cheat. */ if ( static_cast(c) <= 0x7f ) { contents.push_back( static_cast(c) ); return; } static mbstate_t ps = mbstate_t(); char tmp[MB_LEN_MAX]; size_t ignore = wcrtomb(NULL, 0, &ps); (void)ignore; size_t len = wcrtomb(tmp, c, &ps); contents.insert( contents.end(), tmp, tmp+len ); } void print_grapheme( std::string &output ) const { if ( contents.empty() ) { output.append( 1, ' ' ); return; } /* * cells that begin with combining character get combiner * attached to no-break space */ if ( fallback ) { output.append( "\xC2\xA0" ); } output.append( contents ); } /* Other accessors */ const Renditions& get_renditions( void ) const { return renditions; } Renditions& get_renditions( void ) { return renditions; } void set_renditions( const Renditions& r ) { renditions = r; } bool get_wide( void ) const { return wide; } void set_wide( bool w ) { wide = w; } unsigned int get_width( void ) const { return wide + 1; } bool get_fallback( void ) const { return fallback; } void set_fallback( bool f ) { fallback = f; } bool get_wrap( void ) const { return wrap; } void set_wrap( bool f ) { wrap = f; } }; class Row { public: typedef std::vector cells_type; cells_type cells; // gen is a generation counter. It can be used to quickly rule // out the possibility of two rows being identical; this is useful // in scrolling. uint64_t gen; private: Row(); public: Row( const size_t s_width, const color_type background_color ); void insert_cell( int col, color_type background_color ); void delete_cell( int col, color_type background_color ); void reset( color_type background_color ); bool operator==( const Row &x ) const { return ( gen == x.gen && cells == x.cells ); } bool get_wrap( void ) const { return cells.back().get_wrap(); } void set_wrap( bool w ) { cells.back().set_wrap( w ); } uint64_t get_gen() const; }; class SavedCursor { public: int cursor_col, cursor_row; Renditions renditions; /* not implemented: character set shift state */ bool auto_wrap_mode; bool origin_mode; /* not implemented: state of selective erase */ SavedCursor(); }; class DrawState { private: int width, height; void new_grapheme( void ); void snap_cursor_to_border( void ); int cursor_col, cursor_row; int combining_char_col, combining_char_row; bool default_tabs; std::vector tabs; void reinitialize_tabs( unsigned int start ); int scrolling_region_top_row, scrolling_region_bottom_row; Renditions renditions; SavedCursor save; public: bool next_print_will_wrap; bool origin_mode; bool auto_wrap_mode; bool insert_mode; bool cursor_visible; bool reverse_video; bool bracketed_paste; enum MouseReportingMode { MOUSE_REPORTING_NONE = 0, MOUSE_REPORTING_X10 = 9, MOUSE_REPORTING_VT220 = 1000, MOUSE_REPORTING_VT220_HILIGHT = 1001, MOUSE_REPORTING_BTN_EVENT = 1002, MOUSE_REPORTING_ANY_EVENT = 1003 } mouse_reporting_mode; bool mouse_focus_event; // 1004 bool mouse_alternate_scroll; // 1007 enum MouseEncodingMode { MOUSE_ENCODING_DEFAULT = 0, MOUSE_ENCODING_UTF8 = 1005, MOUSE_ENCODING_SGR = 1006, MOUSE_ENCODING_URXVT = 1015 } mouse_encoding_mode; bool application_mode_cursor_keys; /* bold, etc. */ void move_row( int N, bool relative = false ); void move_col( int N, bool relative = false, bool implicit = false ); int get_cursor_col( void ) const { return cursor_col; } int get_cursor_row( void ) const { return cursor_row; } int get_combining_char_col( void ) const { return combining_char_col; } int get_combining_char_row( void ) const { return combining_char_row; } int get_width( void ) const { return width; } int get_height( void ) const { return height; } void set_tab( void ); void clear_tab( int col ); void clear_default_tabs( void ) { default_tabs = false; } /* Default tabs can't be restored without resetting the draw state. */ int get_next_tab( int count ) const; void set_scrolling_region( int top, int bottom ); int get_scrolling_region_top_row( void ) const { return scrolling_region_top_row; } int get_scrolling_region_bottom_row( void ) const { return scrolling_region_bottom_row; } int limit_top( void ) const; int limit_bottom( void ) const; void set_foreground_color( int x ) { renditions.set_foreground_color( x ); } void set_background_color( int x ) { renditions.set_background_color( x ); } void add_rendition( color_type x ) { renditions.set_rendition( x ); } const Renditions& get_renditions( void ) const { return renditions; } Renditions& get_renditions( void ) { return renditions; } int get_background_rendition( void ) const { return renditions.get_background_rendition(); } void save_cursor( void ); void restore_cursor( void ); void clear_saved_cursor( void ) { save = SavedCursor(); } void resize( int s_width, int s_height ); DrawState( int s_width, int s_height ); bool operator==( const DrawState &x ) const { /* only compare fields that affect display */ return ( width == x.width ) && ( height == x.height ) && ( cursor_col == x.cursor_col ) && ( cursor_row == x.cursor_row ) && ( cursor_visible == x.cursor_visible ) && ( reverse_video == x.reverse_video ) && ( renditions == x.renditions ) && ( bracketed_paste == x.bracketed_paste ) && ( mouse_reporting_mode == x.mouse_reporting_mode ) && ( mouse_focus_event == x.mouse_focus_event ) && ( mouse_alternate_scroll == x.mouse_alternate_scroll) && ( mouse_encoding_mode == x.mouse_encoding_mode ); } }; class Framebuffer { // To minimize copying of rows and cells, we use shared_ptr to // share unchanged rows between multiple Framebuffers. If we // write to a row in a Framebuffer and it is shared with other // owners, we copy it first. The shared_ptr naturally manages the // usage of the actual rows themselves. // // We gain a couple of free extras by doing this: // // * A quick check for equality between rows in different // Framebuffers is to simply compare the pointer values. If they // are equal, then the rows are obviously identical. // * If no row is shared, the frame has not been modified. public: typedef std::vector title_type; typedef shared_ptr row_pointer; typedef std::vector rows_type; /* can be either std::vector or std::deque */ private: rows_type rows; title_type icon_name; title_type window_title; title_type clipboard; unsigned int bell_count; bool title_initialized; /* true if the window title has been set via an OSC */ row_pointer newrow( void ) { const size_t w = ds.get_width(); const color_type c = ds.get_background_rendition(); return make_shared( w, c ); } public: Framebuffer( int s_width, int s_height ); Framebuffer( const Framebuffer &other ); Framebuffer &operator=( const Framebuffer &other ); DrawState ds; const rows_type &get_rows() const { return rows; } void scroll( int N ); void move_rows_autoscroll( int rows ); inline const Row *get_row( int row ) const { if ( row == -1 ) row = ds.get_cursor_row(); return rows.at( row ).get(); } inline const Cell *get_cell( int row = -1, int col = -1 ) const { if ( row == -1 ) row = ds.get_cursor_row(); if ( col == -1 ) col = ds.get_cursor_col(); return &rows.at( row )->cells.at( col ); } Row *get_mutable_row( int row ) { if ( row == -1 ) row = ds.get_cursor_row(); row_pointer &mutable_row = rows.at( row ); // If the row is shared, copy it. if (!mutable_row.unique()) { mutable_row = make_shared( *mutable_row ); } return mutable_row.get(); } Cell *get_mutable_cell( int row = -1, int col = -1 ) { if ( row == -1 ) row = ds.get_cursor_row(); if ( col == -1 ) col = ds.get_cursor_col(); return &get_mutable_row( row )->cells.at( col ); } Cell *get_combining_cell( void ); void apply_renditions_to_cell( Cell *cell ); void insert_line( int before_row, int count ); void delete_line( int row, int count ); void insert_cell( int row, int col ); void delete_cell( int row, int col ); void reset( void ); void soft_reset( void ); void set_title_initialized( void ) { title_initialized = true; } bool is_title_initialized( void ) const { return title_initialized; } void set_icon_name( const title_type &s ) { icon_name = s; } void set_window_title( const title_type &s ) { window_title = s; } void set_clipboard( const title_type &s ) { clipboard = s; } const title_type & get_icon_name( void ) const { return icon_name; } const title_type & get_window_title( void ) const { return window_title; } const title_type & get_clipboard( void ) const { return clipboard; } void prefix_window_title( const title_type &s ); void resize( int s_width, int s_height ); void reset_cell( Cell *c ) { c->reset( ds.get_background_rendition() ); } void reset_row( Row *r ) { r->reset( ds.get_background_rendition() ); } void ring_bell( void ) { bell_count++; } unsigned int get_bell_count( void ) const { return bell_count; } bool operator==( const Framebuffer &x ) const { return ( rows == x.rows ) && ( window_title == x.window_title ) && ( clipboard == x.clipboard ) && ( bell_count == x.bell_count ) && ( ds == x.ds ); } }; } #endif mosh-1.4.0/src/terminal/terminaluserinput.cc0000664000175000017500000000541114174450057016120 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include #include "terminaluserinput.h" using namespace Terminal; using std::string; string UserInput::input( const Parser::UserByte *act, bool application_mode_cursor_keys ) { /* The user will always be in application mode. If stm is not in application mode, convert user's cursor control function to an ANSI cursor control sequence */ /* We need to look ahead one byte in the SS3 state to see if the next byte will be A, B, C, or D (cursor control keys). */ /* This doesn't handle the 8-bit SS3 C1 control, which would be two octets in UTF-8. Fortunately nobody seems to send this. */ switch ( state ) { case Ground: if ( act->c == 0x1b ) { /* ESC */ state = ESC; } return string( &act->c, 1 ); case ESC: if ( act->c == 'O' ) { /* ESC O = 7-bit SS3 */ state = SS3; return string(); } state = Ground; return string( &act->c, 1 ); case SS3: state = Ground; if ( (!application_mode_cursor_keys) && (act->c >= 'A') && (act->c <= 'D') ) { char translated_cursor[ 2 ] = { '[', act->c }; return string( translated_cursor, 2 ); } else { char original_cursor[ 2 ] = { 'O', act->c }; return string( original_cursor, 2 ); } default: assert( !"unexpected state" ); state = Ground; return string(); } } mosh-1.4.0/src/terminal/terminaldisplay.cc0000664000175000017500000004123614174450057015534 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include #include "terminaldisplay.h" #include "terminalframebuffer.h" using namespace Terminal; /* Print a new "frame" to the terminal, using ANSI/ECMA-48 escape codes. */ static const Renditions & initial_rendition( void ) { const static Renditions blank = Renditions( 0 ); return blank; } std::string Display::open() const { return std::string( smcup ? smcup : "" ) + std::string( "\033[?1h" ); } std::string Display::close() const { return std::string( "\033[?1l\033[0m\033[?25h" "\033[?1003l\033[?1002l\033[?1001l\033[?1000l" "\033[?1015l\033[?1006l\033[?1005l" ) + std::string( rmcup ? rmcup : "" ); } std::string Display::new_frame( bool initialized, const Framebuffer &last, const Framebuffer &f ) const { FrameState frame( last ); char tmp[ 64 ]; /* has bell been rung? */ if ( f.get_bell_count() != frame.last_frame.get_bell_count() ) { frame.append( '\007' ); } typedef Terminal::Framebuffer::title_type title_type; /* has icon name or window title changed? */ if ( has_title && f.is_title_initialized() && ( (!initialized) || (f.get_icon_name() != frame.last_frame.get_icon_name()) || (f.get_window_title() != frame.last_frame.get_window_title()) ) ) { /* set icon name and window title */ if ( f.get_icon_name() == f.get_window_title() ) { /* write combined Icon Name and Window Title */ frame.append( "\033]0;" ); const title_type &window_title( f.get_window_title() ); for ( title_type::const_iterator i = window_title.begin(); i != window_title.end(); i++ ) { frame.append( *i ); } frame.append( '\007' ); /* ST is more correct, but BEL more widely supported */ } else { /* write Icon Name */ frame.append( "\033]1;" ); const title_type &icon_name( f.get_icon_name() ); for ( title_type::const_iterator i = icon_name.begin(); i != icon_name.end(); i++ ) { frame.append( *i ); } frame.append( '\007' ); frame.append( "\033]2;" ); const title_type &window_title( f.get_window_title() ); for ( title_type::const_iterator i = window_title.begin(); i != window_title.end(); i++ ) { frame.append( *i ); } frame.append( '\007' ); } } /* has clipboard changed? */ if (f.get_clipboard() != frame.last_frame.get_clipboard()) { frame.append( "\033]52;c;" ); const title_type &clipboard( f.get_clipboard() ); for ( title_type::const_iterator i = clipboard.begin(); i != clipboard.end(); i++ ) { frame.append( *i ); } frame.append( '\007' ); } /* has reverse video state changed? */ if ( (!initialized) || (f.ds.reverse_video != frame.last_frame.ds.reverse_video) ) { /* set reverse video */ snprintf( tmp, 64, "\033[?5%c", (f.ds.reverse_video ? 'h' : 'l') ); frame.append( tmp ); } /* has size changed? */ if ( (!initialized) || (f.ds.get_width() != frame.last_frame.ds.get_width()) || (f.ds.get_height() != frame.last_frame.ds.get_height()) ) { /* reset scrolling region */ frame.append( "\033[r" ); /* clear screen */ frame.append( "\033[0m\033[H\033[2J" ); initialized = false; frame.cursor_x = frame.cursor_y = 0; frame.current_rendition = initial_rendition(); } else { frame.cursor_x = frame.last_frame.ds.get_cursor_col(); frame.cursor_y = frame.last_frame.ds.get_cursor_row(); frame.current_rendition = frame.last_frame.ds.get_renditions(); } /* is cursor visibility initialized? */ if ( !initialized ) { frame.cursor_visible = false; frame.append( "\033[?25l" ); } int frame_y = 0; Framebuffer::row_pointer blank_row; Framebuffer::rows_type rows( frame.last_frame.get_rows() ); /* Extend rows if we've gotten a resize and new is wider than old */ if ( frame.last_frame.ds.get_width() < f.ds.get_width() ) { for ( Framebuffer::rows_type::iterator p = rows.begin(); p != rows.end(); p++ ) { *p = make_shared( **p ); (*p)->cells.resize( f.ds.get_width(), Cell( f.ds.get_background_rendition() ) ); } } /* Add rows if we've gotten a resize and new is taller than old */ if ( static_cast( rows.size() ) < f.ds.get_height() ) { // get a proper blank row const size_t w = f.ds.get_width(); const color_type c = 0; blank_row = make_shared( w, c ); rows.resize( f.ds.get_height(), blank_row ); } /* shortcut -- has display moved up by a certain number of lines? */ if ( initialized ) { int lines_scrolled = 0; int scroll_height = 0; for ( int row = 0; row < f.ds.get_height(); row++ ) { const Row *new_row = f.get_row( 0 ); const Row *old_row = &*rows.at( row ); if ( ! ( new_row == old_row || *new_row == *old_row ) ) { continue; } /* if row 0, we're looking at ourselves and probably didn't scroll */ if ( row == 0 ) { break; } /* found a scroll */ lines_scrolled = row; scroll_height = 1; /* how big is the region that was scrolled? */ for ( int region_height = 1; lines_scrolled + region_height < f.ds.get_height(); region_height++ ) { if ( *f.get_row( region_height ) == *rows.at( lines_scrolled + region_height ) ) { scroll_height = region_height + 1; } else { break; } } break; } if ( scroll_height ) { frame_y = scroll_height; if ( lines_scrolled ) { /* Now we need a proper blank row. */ if ( blank_row.get() == NULL ) { const size_t w = f.ds.get_width(); const color_type c = 0; blank_row = make_shared( w, c ); } frame.update_rendition( initial_rendition(), true ); int top_margin = 0; int bottom_margin = top_margin + lines_scrolled + scroll_height - 1; assert( bottom_margin < f.ds.get_height() ); /* Common case: if we're already on the bottom line and we're scrolling the whole * screen, just do a CR and LFs. */ if ( scroll_height + lines_scrolled == f.ds.get_height() && frame.cursor_y + 1 == f.ds.get_height() ) { frame.append( '\r' ); frame.append( lines_scrolled, '\n' ); frame.cursor_x = 0; } else { /* set scrolling region */ snprintf( tmp, 64, "\033[%d;%dr", top_margin + 1, bottom_margin + 1); frame.append( tmp ); /* go to bottom of scrolling region */ frame.cursor_x = frame.cursor_y = -1; frame.append_silent_move( bottom_margin, 0 ); /* scroll */ frame.append( lines_scrolled, '\n' ); /* reset scrolling region */ frame.append( "\033[r" ); /* invalidate cursor position after unsetting scrolling region */ frame.cursor_x = frame.cursor_y = -1; } /* do the move in our local index */ for ( int i = top_margin; i <= bottom_margin; i++ ) { if ( i + lines_scrolled <= bottom_margin ) { rows.at( i ) = rows.at( i + lines_scrolled ); } else { rows.at( i ) = blank_row; } } } } } /* Now update the display, row by row */ bool wrap = false; for ( ; frame_y < f.ds.get_height(); frame_y++ ) { wrap = put_row( initialized, frame, f, frame_y, *rows.at( frame_y ), wrap ); } /* has cursor location changed? */ if ( (!initialized) || (f.ds.get_cursor_row() != frame.cursor_y) || (f.ds.get_cursor_col() != frame.cursor_x) ) { frame.append_move( f.ds.get_cursor_row(), f.ds.get_cursor_col() ); } /* has cursor visibility changed? */ if ( (!initialized) || (f.ds.cursor_visible != frame.cursor_visible) ) { if ( f.ds.cursor_visible ) { frame.append( "\033[?25h" ); } else { frame.append( "\033[?25l" ); } } /* have renditions changed? */ frame.update_rendition( f.ds.get_renditions(), !initialized ); /* has bracketed paste mode changed? */ if ( (!initialized) || (f.ds.bracketed_paste != frame.last_frame.ds.bracketed_paste) ) { frame.append( f.ds.bracketed_paste ? "\033[?2004h" : "\033[?2004l" ); } /* has mouse reporting mode changed? */ if ( (!initialized) || (f.ds.mouse_reporting_mode != frame.last_frame.ds.mouse_reporting_mode) ) { if (f.ds.mouse_reporting_mode == DrawState::MOUSE_REPORTING_NONE) { frame.append("\033[?1003l"); frame.append("\033[?1002l"); frame.append("\033[?1001l"); frame.append("\033[?1000l"); } else { if (frame.last_frame.ds.mouse_reporting_mode != DrawState::MOUSE_REPORTING_NONE) { snprintf(tmp, sizeof(tmp), "\033[?%dl", frame.last_frame.ds.mouse_reporting_mode); frame.append(tmp); } snprintf(tmp, sizeof(tmp), "\033[?%dh", f.ds.mouse_reporting_mode); frame.append(tmp); } } /* has mouse focus mode changed? */ if ( (!initialized) || (f.ds.mouse_focus_event != frame.last_frame.ds.mouse_focus_event) ) { frame.append( f.ds.mouse_focus_event ? "\033[?1004h" : "\033[?1004l" ); } /* has mouse encoding mode changed? */ if ( (!initialized) || (f.ds.mouse_encoding_mode != frame.last_frame.ds.mouse_encoding_mode) ) { if (f.ds.mouse_encoding_mode == DrawState::MOUSE_ENCODING_DEFAULT) { frame.append("\033[?1015l"); frame.append("\033[?1006l"); frame.append("\033[?1005l"); } else { if (frame.last_frame.ds.mouse_encoding_mode != DrawState::MOUSE_ENCODING_DEFAULT) { snprintf(tmp, sizeof(tmp), "\033[?%dl", frame.last_frame.ds.mouse_encoding_mode); frame.append(tmp); } snprintf(tmp, sizeof(tmp), "\033[?%dh", f.ds.mouse_encoding_mode); frame.append(tmp); } } return frame.str; } bool Display::put_row( bool initialized, FrameState &frame, const Framebuffer &f, int frame_y, const Row &old_row, bool wrap ) const { char tmp[ 64 ]; int frame_x = 0; const Row &row = *f.get_row( frame_y ); const Row::cells_type &cells = row.cells; const Row::cells_type &old_cells = old_row.cells; /* If we're forced to write the first column because of wrap, go ahead and do so. */ if ( wrap ) { const Cell &cell = cells.at( 0 ); frame.update_rendition( cell.get_renditions() ); frame.append_cell( cell ); frame_x += cell.get_width(); frame.cursor_x += cell.get_width(); } /* If rows are the same object, we don't need to do anything at all. */ if (initialized && &row == &old_row ) { return false; } const bool wrap_this = row.get_wrap(); const int row_width = f.ds.get_width(); int clear_count = 0; bool wrote_last_cell = false; Renditions blank_renditions = initial_rendition(); /* iterate for every cell */ while ( frame_x < row_width ) { const Cell &cell = cells.at( frame_x ); /* Does cell need to be drawn? Skip all this. */ if ( initialized && !clear_count && ( cell == old_cells.at( frame_x ) ) ) { frame_x += cell.get_width(); continue; } /* Slurp up all the empty cells */ if ( cell.empty() ) { if ( !clear_count ) { blank_renditions = cell.get_renditions(); } if ( cell.get_renditions() == blank_renditions ) { /* Remember run of blank cells */ clear_count++; frame_x++; continue; } } /* Clear or write cells within the row (not to end). */ if ( clear_count ) { /* Move to the right position. */ frame.append_silent_move( frame_y, frame_x - clear_count ); frame.update_rendition( blank_renditions ); bool can_use_erase = has_bce || ( frame.current_rendition == initial_rendition() ); if ( can_use_erase && has_ech && clear_count > 4 ) { snprintf( tmp, 64, "\033[%dX", clear_count ); frame.append( tmp ); } else { frame.append( clear_count, ' ' ); frame.cursor_x = frame_x; } clear_count = 0; // If the current character is *another* empty cell in a different rendition, // we restart counting and continue here if ( cell.empty() ) { blank_renditions = cell.get_renditions(); clear_count = 1; frame_x++; continue; } } /* Now draw a character cell. */ /* Move to the right position. */ const int cell_width = cell.get_width(); /* If we are about to print the last character in a wrapping row, trash the cursor position to force explicit positioning. We do this because our input terminal state may have the cursor on the autowrap column ("column 81"), but our output terminal states always snap the cursor to the true last column ("column 80"), and we want to be able to apply the diff to either, for verification. */ if ( wrap_this && frame_x + cell_width >= row_width ) { frame.cursor_x = frame.cursor_y = -1; } frame.append_silent_move( frame_y, frame_x ); frame.update_rendition( cell.get_renditions() ); frame.append_cell( cell ); frame_x += cell_width; frame.cursor_x += cell_width; if ( frame_x >= row_width ) { wrote_last_cell = true; } } /* End of line. */ /* Clear or write empty cells at EOL. */ if ( clear_count ) { /* Move to the right position. */ frame.append_silent_move( frame_y, frame_x - clear_count ); frame.update_rendition( blank_renditions ); bool can_use_erase = has_bce || ( frame.current_rendition == initial_rendition() ); if ( can_use_erase && !wrap_this ) { frame.append( "\033[K" ); } else { frame.append( clear_count, ' ' ); frame.cursor_x = frame_x; wrote_last_cell = true; } } if ( ! ( wrote_last_cell && (frame_y < f.ds.get_height() - 1) ) ) { return false; } /* To hint that a word-select should group the end of one line with the beginning of the next, we let the real cursor actually wrap around in cases where it wrapped around for us. */ if ( wrap_this ) { /* Update our cursor, and ask for wrap on the next row. */ frame.cursor_x = 0; frame.cursor_y++; return true; } /* Resort to CR/LF and update our cursor. */ frame.append( "\r\n" ); frame.cursor_x = 0; frame.cursor_y++; return false; } FrameState::FrameState( const Framebuffer &s_last ) : str(), cursor_x(0), cursor_y(0), current_rendition( 0 ), cursor_visible( s_last.ds.cursor_visible ), last_frame( s_last ) { /* Preallocate for better performance. Make a guess-- doesn't matter for correctness */ str.reserve( last_frame.ds.get_width() * last_frame.ds.get_height() * 4 ); } void FrameState::append_silent_move( int y, int x ) { if ( cursor_x == x && cursor_y == y ) return; /* turn off cursor if necessary before moving cursor */ if ( cursor_visible ) { append( "\033[?25l" ); cursor_visible = false; } append_move( y, x ); } void FrameState::append_move( int y, int x ) { const int last_x = cursor_x; const int last_y = cursor_y; cursor_x = x; cursor_y = y; // Only optimize if cursor pos is known if ( last_x != -1 && last_y != -1 ) { // Can we use CR and/or LF? They're cheap and easier to trace. if ( x == 0 && y - last_y >= 0 && y - last_y < 5 ) { if ( last_x != 0 ) { append( '\r' ); } append( y - last_y, '\n' ); return; } // Backspaces are good too. if ( y == last_y && x - last_x < 0 && x - last_x > -5 ) { append( last_x - x, '\b' ); return; } // More optimizations are possible. } char tmp[ 64 ]; snprintf( tmp, 64, "\033[%d;%dH", y + 1, x + 1 ); append( tmp ); } void FrameState::update_rendition(const Renditions &r, bool force) { if ( force || !(current_rendition == r) ) { /* print renditions */ append_string( r.sgr() ); current_rendition = r; } } mosh-1.4.0/src/terminal/parserstate.cc0000664000175000017500000002404014174450057014662 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include "parserstate.h" #include "parserstatefamily.h" #include "shared.h" using namespace Parser; Transition State::anywhere_rule( wchar_t ch ) const { if ( (ch == 0x18) || (ch == 0x1A) || ((0x80 <= ch) && (ch <= 0x8F)) || ((0x91 <= ch) && (ch <= 0x97)) || (ch == 0x99) || (ch == 0x9A) ) { return Transition( shared::make_shared(), &family->s_Ground ); } else if ( ch == 0x9C ) { return Transition( &family->s_Ground ); } else if ( ch == 0x1B ) { return Transition( &family->s_Escape ); } else if ( (ch == 0x98) || (ch == 0x9E) || (ch == 0x9F) ) { return Transition( &family->s_SOS_PM_APC_String ); } else if ( ch == 0x90 ) { return Transition( &family->s_DCS_Entry ); } else if ( ch == 0x9D ) { return Transition( &family->s_OSC_String ); } else if ( ch == 0x9B ) { return Transition( &family->s_CSI_Entry ); } return Transition(( State * )NULL, ActionPointer() ); /* don't allocate an Ignore action */ } Transition State::input( wchar_t ch ) const { /* Check for immediate transitions. */ Transition anywhere = anywhere_rule( ch ); if ( anywhere.next_state ) { anywhere.action->char_present = true; anywhere.action->ch = ch; return anywhere; } /* Normal X.364 state machine. */ /* Parse high Unicode codepoints like 'A'. */ Transition ret = this->input_state_rule( ch >= 0xA0 ? 0x41 : ch ); ret.action->char_present = true; ret.action->ch = ch; return ret; } static bool C0_prime( wchar_t ch ) { return (ch <= 0x17) || (ch == 0x19) || ( (0x1C <= ch) && (ch <= 0x1F) ); } static bool GLGR ( wchar_t ch ) { return ( (0x20 <= ch) && (ch <= 0x7F) ) /* GL area */ || ( (0xA0 <= ch) && (ch <= 0xFF) ); /* GR area */ } Transition Ground::input_state_rule( wchar_t ch ) const { if ( C0_prime( ch ) ) { return Transition( shared::make_shared< Execute >() ); } if ( GLGR( ch ) ) { return Transition( shared::make_shared< Print >() ); } return Transition(); } ActionPointer Escape::enter( void ) const { return shared::make_shared< Clear >(); } Transition Escape::input_state_rule( wchar_t ch ) const { if ( C0_prime( ch ) ) { return Transition( shared::make_shared< Execute >() ); } if ( (0x20 <= ch) && (ch <= 0x2F) ) { return Transition( shared::make_shared< Collect >(), &family->s_Escape_Intermediate ); } if ( ( (0x30 <= ch) && (ch <= 0x4F) ) || ( (0x51 <= ch) && (ch <= 0x57) ) || ( ch == 0x59 ) || ( ch == 0x5A ) || ( ch == 0x5C ) || ( (0x60 <= ch) && (ch <= 0x7E) ) ) { return Transition( shared::make_shared< Esc_Dispatch >(), &family->s_Ground ); } if ( ch == 0x5B ) { return Transition( &family->s_CSI_Entry ); } if ( ch == 0x5D ) { return Transition( &family->s_OSC_String ); } if ( ch == 0x50 ) { return Transition( &family->s_DCS_Entry ); } if ( (ch == 0x58) || (ch == 0x5E) || (ch == 0x5F) ) { return Transition( &family->s_SOS_PM_APC_String ); } return Transition(); } Transition Escape_Intermediate::input_state_rule( wchar_t ch ) const { if ( C0_prime( ch ) ) { return Transition( shared::make_shared< Execute >() ); } if ( (0x20 <= ch) && (ch <= 0x2F) ) { return Transition( shared::make_shared< Collect >() ); } if ( (0x30 <= ch) && (ch <= 0x7E) ) { return Transition( shared::make_shared< Esc_Dispatch >(), &family->s_Ground ); } return Transition(); } ActionPointer CSI_Entry::enter( void ) const { return shared::make_shared< Clear >(); } Transition CSI_Entry::input_state_rule( wchar_t ch ) const { if ( C0_prime( ch ) ) { return Transition( shared::make_shared< Execute >() ); } if ( (0x40 <= ch) && (ch <= 0x7E) ) { return Transition( shared::make_shared< CSI_Dispatch >(), &family->s_Ground ); } if ( ( (0x30 <= ch) && (ch <= 0x39) ) || ( ch == 0x3B ) ) { return Transition( shared::make_shared< Param >(), &family->s_CSI_Param ); } if ( (0x3C <= ch) && (ch <= 0x3F) ) { return Transition( shared::make_shared< Collect >(), &family->s_CSI_Param ); } if ( ch == 0x3A ) { return Transition( &family->s_CSI_Ignore ); } if ( (0x20 <= ch) && (ch <= 0x2F) ) { return Transition( shared::make_shared< Collect >(), &family->s_CSI_Intermediate ); } return Transition(); } Transition CSI_Param::input_state_rule( wchar_t ch ) const { if ( C0_prime( ch ) ) { return Transition( shared::make_shared< Execute >() ); } if ( ( (0x30 <= ch) && (ch <= 0x39) ) || ( ch == 0x3B ) ) { return Transition( shared::make_shared< Param >() ); } if ( ( ch == 0x3A ) || ( (0x3C <= ch) && (ch <= 0x3F) ) ) { return Transition( &family->s_CSI_Ignore ); } if ( (0x20 <= ch) && (ch <= 0x2F) ) { return Transition( shared::make_shared< Collect >(), &family->s_CSI_Intermediate ); } if ( (0x40 <= ch) && (ch <= 0x7E) ) { return Transition( shared::make_shared< CSI_Dispatch >(), &family->s_Ground ); } return Transition(); } Transition CSI_Intermediate::input_state_rule( wchar_t ch ) const { if ( C0_prime( ch ) ) { return Transition( shared::make_shared< Execute >() ); } if ( (0x20 <= ch) && (ch <= 0x2F) ) { return Transition( shared::make_shared< Collect >() ); } if ( (0x40 <= ch) && (ch <= 0x7E) ) { return Transition( shared::make_shared< CSI_Dispatch >(), &family->s_Ground ); } if ( (0x30 <= ch) && (ch <= 0x3F) ) { return Transition( &family->s_CSI_Ignore ); } return Transition(); } Transition CSI_Ignore::input_state_rule( wchar_t ch ) const { if ( C0_prime( ch ) ) { return Transition( shared::make_shared< Execute >() ); } if ( (0x40 <= ch) && (ch <= 0x7E) ) { return Transition( &family->s_Ground ); } return Transition(); } ActionPointer DCS_Entry::enter( void ) const { return shared::make_shared< Clear >(); } Transition DCS_Entry::input_state_rule( wchar_t ch ) const { if ( (0x20 <= ch) && (ch <= 0x2F) ) { return Transition( shared::make_shared< Collect >(), &family->s_DCS_Intermediate ); } if ( ch == 0x3A ) { return Transition( &family->s_DCS_Ignore ); } if ( ( (0x30 <= ch) && (ch <= 0x39) ) || ( ch == 0x3B ) ) { return Transition( shared::make_shared< Param >(), &family->s_DCS_Param ); } if ( (0x3C <= ch) && (ch <= 0x3F) ) { return Transition( shared::make_shared< Collect >(), &family->s_DCS_Param ); } if ( (0x40 <= ch) && (ch <= 0x7E) ) { return Transition( &family->s_DCS_Passthrough ); } return Transition(); } Transition DCS_Param::input_state_rule( wchar_t ch ) const { if ( ( (0x30 <= ch) && (ch <= 0x39) ) || ( ch == 0x3B ) ) { return Transition( shared::make_shared< Param >() ); } if ( ( ch == 0x3A ) || ( (0x3C <= ch) && (ch <= 0x3F) ) ) { return Transition( &family->s_DCS_Ignore ); } if ( (0x20 <= ch) && (ch <= 0x2F) ) { return Transition( shared::make_shared< Collect >(), &family->s_DCS_Intermediate ); } if ( (0x40 <= ch) && (ch <= 0x7E) ) { return Transition( &family->s_DCS_Passthrough ); } return Transition(); } Transition DCS_Intermediate::input_state_rule( wchar_t ch ) const { if ( (0x20 <= ch) && (ch <= 0x2F) ) { return Transition( shared::make_shared< Collect >() ); } if ( (0x40 <= ch) && (ch <= 0x7E) ) { return Transition( &family->s_DCS_Passthrough ); } if ( (0x30 <= ch) && (ch <= 0x3F) ) { return Transition( &family->s_DCS_Ignore ); } return Transition(); } ActionPointer DCS_Passthrough::enter( void ) const { return shared::make_shared< Hook >(); } ActionPointer DCS_Passthrough::exit( void ) const { return shared::make_shared< Unhook >(); } Transition DCS_Passthrough::input_state_rule( wchar_t ch ) const { if ( C0_prime( ch ) || ( (0x20 <= ch) && (ch <= 0x7E) ) ) { return Transition( shared::make_shared< Put >() ); } if ( ch == 0x9C ) { return Transition( &family->s_Ground ); } return Transition(); } Transition DCS_Ignore::input_state_rule( wchar_t ch ) const { if ( ch == 0x9C ) { return Transition( &family->s_Ground ); } return Transition(); } ActionPointer OSC_String::enter( void ) const { return shared::make_shared< OSC_Start >(); } ActionPointer OSC_String::exit( void ) const { return shared::make_shared< OSC_End >(); } Transition OSC_String::input_state_rule( wchar_t ch ) const { if ( (0x20 <= ch) && (ch <= 0x7F) ) { return Transition( shared::make_shared< OSC_Put >() ); } if ( (ch == 0x9C) || (ch == 0x07) ) { /* 0x07 is xterm non-ANSI variant */ return Transition( &family->s_Ground ); } return Transition(); } Transition SOS_PM_APC_String::input_state_rule( wchar_t ch ) const { if ( ch == 0x9C ) { return Transition( &family->s_Ground ); } return Transition(); } mosh-1.4.0/src/terminal/terminal.h0000644000175000017500000000630413103401307013764 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #ifndef TERMINAL_CPP #define TERMINAL_CPP #include #include #include #include #include "parseraction.h" #include "terminalframebuffer.h" #include "terminaldispatcher.h" #include "terminaluserinput.h" #include "terminaldisplay.h" namespace Terminal { class Emulator { friend void Parser::Print::act_on_terminal( Emulator * ) const; friend void Parser::Execute::act_on_terminal( Emulator * ) const; friend void Parser::Clear::act_on_terminal( Emulator * ) const; friend void Parser::Param::act_on_terminal( Emulator * ) const; friend void Parser::Collect::act_on_terminal( Emulator * ) const; friend void Parser::CSI_Dispatch::act_on_terminal( Emulator * ) const; friend void Parser::Esc_Dispatch::act_on_terminal( Emulator * ) const; friend void Parser::OSC_Start::act_on_terminal( Emulator * ) const; friend void Parser::OSC_Put::act_on_terminal( Emulator * ) const; friend void Parser::OSC_End::act_on_terminal( Emulator * ) const; friend void Parser::UserByte::act_on_terminal( Emulator * ) const; friend void Parser::Resize::act_on_terminal( Emulator * ) const; private: Framebuffer fb; Dispatcher dispatch; UserInput user; /* action methods */ void print( const Parser::Print *act ); void execute( const Parser::Execute *act ); void CSI_dispatch( const Parser::CSI_Dispatch *act ); void Esc_dispatch( const Parser::Esc_Dispatch *act ); void OSC_end( const Parser::OSC_End *act ); void resize( size_t s_width, size_t s_height ); public: Emulator( size_t s_width, size_t s_height ); std::string read_octets_to_host( void ); const Framebuffer & get_fb( void ) const { return fb; } bool operator==( Emulator const &x ) const; }; } #endif mosh-1.4.0/src/terminal/terminaldispatcher.h0000644000175000017500000000721213103401307016032 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #ifndef TERMINALDISPATCHER_HPP #define TERMINALDISPATCHER_HPP #include #include #include namespace Parser { class Action; class Param; class Collect; class Clear; class Esc_Dispatch; class CSI_Dispatch; class Execute; class OSC_Start; class OSC_Put; class OSC_End; } namespace Terminal { class Framebuffer; class Dispatcher; enum Function_Type { ESCAPE, CSI, CONTROL }; class Function { public: Function() : function( NULL ), clears_wrap_state( true ) {} Function( Function_Type type, const std::string & dispatch_chars, void (*s_function)( Framebuffer *, Dispatcher * ), bool s_clears_wrap_state = true ); void (*function)( Framebuffer *, Dispatcher * ); bool clears_wrap_state; }; typedef std::map dispatch_map_t; class DispatchRegistry { public: dispatch_map_t escape; dispatch_map_t CSI; dispatch_map_t control; DispatchRegistry() : escape(), CSI(), control() {} }; DispatchRegistry & get_global_dispatch_registry( void ); class Dispatcher { private: std::string params; std::vector parsed_params; bool parsed; std::string dispatch_chars; std::vector OSC_string; /* only used to set the window title */ void parse_params( void ); public: static const int PARAM_MAX = 65535; /* prevent evil escape sequences from causing long loops */ std::string terminal_to_host; /* this is the reply string */ Dispatcher(); int getparam( size_t N, int defaultval ); int param_count( void ); void newparamchar( const Parser::Param *act ); void collect( const Parser::Collect *act ); void clear( const Parser::Clear *act ); std::string str( void ); void dispatch( Function_Type type, const Parser::Action *act, Framebuffer *fb ); std::string get_dispatch_chars( void ) const { return dispatch_chars; } std::vector get_OSC_string( void ) const { return OSC_string; } void OSC_put( const Parser::OSC_Put *act ); void OSC_start( const Parser::OSC_Start *act ); void OSC_dispatch( const Parser::OSC_End *act, Framebuffer *fb ); bool operator==( const Dispatcher &x ) const; }; } #endif mosh-1.4.0/src/terminal/parser.cc0000664000175000017500000001132014174450057013616 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include #include #include #include #include #include "parser.h" const Parser::StateFamily Parser::family; static void append_or_delete( Parser::ActionPointer act, Parser::Actions &vec ) { assert( act ); if ( !act->ignore() ) { vec.push_back( act ); } } void Parser::Parser::input( wchar_t ch, Actions &ret ) { Transition tx = state->input( ch ); if ( tx.next_state != NULL ) { append_or_delete( state->exit(), ret ); } append_or_delete( tx.action, ret ); if ( tx.next_state != NULL ) { append_or_delete( tx.next_state->enter(), ret ); state = tx.next_state; } } Parser::UTF8Parser::UTF8Parser() : parser(), buf_len( 0 ) { assert( BUF_SIZE >= (size_t)MB_CUR_MAX ); buf[0] = '\0'; } void Parser::UTF8Parser::input( char c, Actions &ret ) { assert( buf_len < BUF_SIZE ); /* 1-byte UTF-8 character, aka ASCII? Cheat. */ if ( buf_len == 0 && static_cast(c) <= 0x7f ) { parser.input( static_cast(c), ret ); return; } buf[ buf_len++ ] = c; /* This function will only work in a UTF-8 locale. */ wchar_t pwc; mbstate_t ps = mbstate_t(); size_t total_bytes_parsed = 0; size_t orig_buf_len = buf_len; /* this routine is somewhat complicated in order to comply with Unicode 6.0, section 3.9, "Best Practices for using U+FFFD" */ while ( total_bytes_parsed != orig_buf_len ) { assert( total_bytes_parsed < orig_buf_len ); assert( buf_len > 0 ); size_t bytes_parsed = mbrtowc( &pwc, buf, buf_len, &ps ); /* this returns 0 when n = 0! */ if ( bytes_parsed == 0 ) { /* character was NUL, accept and clear buffer */ assert( buf_len == 1 ); buf_len = 0; pwc = L'\0'; bytes_parsed = 1; } else if ( bytes_parsed == (size_t) -1 ) { /* invalid sequence, use replacement character and try again with last char */ assert( errno == EILSEQ ); if ( buf_len > 1 ) { buf[ 0 ] = buf[ buf_len - 1 ]; bytes_parsed = buf_len - 1; buf_len = 1; } else { buf_len = 0; bytes_parsed = 1; } pwc = (wchar_t) 0xFFFD; } else if ( bytes_parsed == (size_t) -2 ) { /* can't parse incomplete multibyte character */ total_bytes_parsed += buf_len; continue; } else { /* parsed into pwc, accept */ assert( bytes_parsed <= buf_len ); memmove( buf, buf + bytes_parsed, buf_len - bytes_parsed ); buf_len = buf_len - bytes_parsed; } /* Cast to unsigned for checks, because some platforms (e.g. ARM) use uint32_t as wchar_t, causing compiler warning on "pwc > 0" check. */ const uint32_t pwcheck = pwc; if ( pwcheck > 0x10FFFF ) { /* outside Unicode range */ pwc = (wchar_t) 0xFFFD; } if ( (pwcheck >= 0xD800) && (pwcheck <= 0xDFFF) ) { /* surrogate code point */ /* OS X unfortunately allows these sequences without EILSEQ, but they are ill-formed UTF-8 and we shouldn't repeat them to the user's terminal. */ pwc = (wchar_t) 0xFFFD; } parser.input( pwc, ret ); total_bytes_parsed += bytes_parsed; } } Parser::Parser::Parser( const Parser &other ) : state( other.state ) {} Parser::Parser & Parser::Parser::operator=( const Parser &other ) { state = other.state; return *this; } mosh-1.4.0/src/terminal/parsertransition.h0000664000175000017500000000473414174450057015606 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #ifndef PARSERTRANSITION_HPP #define PARSERTRANSITION_HPP #include #include "parseraction.h" namespace Parser { class State; class Transition { public: // Transition is only a courier for an Action; it should // never create/delete one on its own. ActionPointer action; State *next_state; Transition( const Transition &x ) : action( x.action ), next_state( x.next_state ) {} Transition & operator=( const Transition &t ) { action = t.action; next_state = t.next_state; return *this; } Transition( ActionPointer s_action=shared::make_shared< Ignore >(), State *s_next_state=NULL ) : action( s_action ), next_state( s_next_state ) {} // This is only ever used in the 1-argument form; // we use this instead of an initializer to // tell Coverity the object never owns *action. Transition( State *s_next_state, ActionPointer s_action=shared::make_shared< Ignore >() ) : action( s_action ), next_state( s_next_state ) {} }; } #endif mosh-1.4.0/src/terminal/parseraction.cc0000664000175000017500000000544514174450057015027 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include #include #include "parseraction.h" #include "terminal.h" using namespace Parser; void Print::act_on_terminal( Terminal::Emulator *emu ) const { emu->print( this ); } void Execute::act_on_terminal( Terminal::Emulator *emu ) const { emu->execute( this ); } void Clear::act_on_terminal( Terminal::Emulator *emu ) const { emu->dispatch.clear( this ); } void Param::act_on_terminal( Terminal::Emulator *emu ) const { emu->dispatch.newparamchar( this ); } void Collect::act_on_terminal( Terminal::Emulator *emu ) const { emu->dispatch.collect( this ); } void CSI_Dispatch::act_on_terminal( Terminal::Emulator *emu ) const { emu->CSI_dispatch( this ); } void Esc_Dispatch::act_on_terminal( Terminal::Emulator *emu ) const { emu->Esc_dispatch( this ); } void OSC_Put::act_on_terminal( Terminal::Emulator *emu ) const { emu->dispatch.OSC_put( this ); } void OSC_Start::act_on_terminal( Terminal::Emulator *emu ) const { emu->dispatch.OSC_start( this ); } void OSC_End::act_on_terminal( Terminal::Emulator *emu ) const { emu->OSC_end( this ); } void UserByte::act_on_terminal( Terminal::Emulator *emu ) const { emu->dispatch.terminal_to_host.append( emu->user.input( this, emu->fb.ds.application_mode_cursor_keys ) ); } void Resize::act_on_terminal( Terminal::Emulator *emu ) const { emu->resize( width, height ); } mosh-1.4.0/src/terminal/Makefile.am0000664000175000017500000000110414272621034014040 00000000000000AM_CPPFLAGS = -I$(srcdir)/../util $(TINFO_CFLAGS) AM_CXXFLAGS = $(WARNING_CXXFLAGS) $(PICKY_CXXFLAGS) $(HARDEN_CFLAGS) $(MISC_CXXFLAGS) $(CODE_COVERAGE_CXXFLAGS) noinst_LIBRARIES = libmoshterminal.a libmoshterminal_a_SOURCES = parseraction.cc parseraction.h parser.cc parser.h parserstate.cc parserstatefamily.h parserstate.h parsertransition.h terminal.cc terminaldispatcher.cc terminaldispatcher.h terminaldisplay.cc terminaldisplayinit.cc terminaldisplay.h terminalframebuffer.cc terminalframebuffer.h terminalfunctions.cc terminal.h terminaluserinput.cc terminaluserinput.h mosh-1.4.0/src/terminal/terminal.cc0000664000175000017500000001276214174450057014150 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include #include #include #include #include #include "terminal.h" using namespace Terminal; Emulator::Emulator( size_t s_width, size_t s_height ) : fb( s_width, s_height ), dispatch(), user() {} std::string Emulator::read_octets_to_host( void ) { std::string ret = dispatch.terminal_to_host; dispatch.terminal_to_host.clear(); return ret; } void Emulator::execute( const Parser::Execute *act ) { dispatch.dispatch( CONTROL, act, &fb ); } void Emulator::print( const Parser::Print *act ) { assert( act->char_present ); const wchar_t ch = act->ch; /* * Check for printing ISO 8859-1 first, it's a cheap way to detect * some common narrow characters. */ const int chwidth = ch == L'\0' ? -1 : ( Cell::isprint_iso8859_1( ch ) ? 1 : wcwidth( ch )); Cell *this_cell = fb.get_mutable_cell(); switch ( chwidth ) { case 1: /* normal character */ case 2: /* wide character */ if ( fb.ds.auto_wrap_mode && fb.ds.next_print_will_wrap ) { fb.get_mutable_row( -1 )->set_wrap( true ); fb.ds.move_col( 0 ); fb.move_rows_autoscroll( 1 ); this_cell = NULL; } else if ( fb.ds.auto_wrap_mode && (chwidth == 2) && (fb.ds.get_cursor_col() == fb.ds.get_width() - 1) ) { /* wrap 2-cell chars if no room, even without will-wrap flag */ fb.reset_cell( this_cell ); fb.get_mutable_row( -1 )->set_wrap( false ); /* There doesn't seem to be a consistent way to get the downstream terminal emulator to set the wrap-around copy-and-paste flag on a row that ends with an empty cell because a wide char was wrapped to the next line. */ fb.ds.move_col( 0 ); fb.move_rows_autoscroll( 1 ); this_cell = NULL; } if ( fb.ds.insert_mode ) { for ( int i = 0; i < chwidth; i++ ) { fb.insert_cell( fb.ds.get_cursor_row(), fb.ds.get_cursor_col() ); } this_cell = NULL; } if (!this_cell) { this_cell = fb.get_mutable_cell(); } fb.reset_cell( this_cell ); this_cell->append( ch ); this_cell->set_wide( chwidth == 2 ); /* chwidth had better be 1 or 2 here */ fb.apply_renditions_to_cell( this_cell ); if ( chwidth == 2 && fb.ds.get_cursor_col() + 1 < fb.ds.get_width() ) { /* erase overlapped cell */ fb.reset_cell( fb.get_mutable_cell( fb.ds.get_cursor_row(), fb.ds.get_cursor_col() + 1 ) ); } fb.ds.move_col( chwidth, true, true ); break; case 0: /* combining character */ { Cell *combining_cell = fb.get_combining_cell(); /* can be null if we were resized */ if ( combining_cell == NULL ) { /* character is now offscreen */ break; } if ( combining_cell->empty() ) { /* cell starts with combining character */ /* ... but isn't necessarily the target for a new base character [e.g. start of line], if the combining character has been cleared with a sequence like ED ("J") or EL ("K") */ assert( !combining_cell->get_wide() ); combining_cell->set_fallback( true ); fb.ds.move_col( 1, true, true ); } if ( !combining_cell->full() ) { combining_cell->append( ch ); } } break; case -1: /* unprintable character */ break; default: assert( !"unexpected character width from wcwidth()" ); break; } } void Emulator::CSI_dispatch( const Parser::CSI_Dispatch *act ) { dispatch.dispatch( CSI, act, &fb ); } void Emulator::OSC_end( const Parser::OSC_End *act ) { dispatch.OSC_dispatch( act, &fb ); } void Emulator::Esc_dispatch( const Parser::Esc_Dispatch *act ) { /* handle 7-bit ESC-encoding of C1 control characters */ if ( (dispatch.get_dispatch_chars().size() == 0) && (0x40 <= act->ch) && (act->ch <= 0x5F) ) { Parser::Esc_Dispatch act2 = *act; act2.ch += 0x40; dispatch.dispatch( CONTROL, &act2, &fb ); } else { dispatch.dispatch( ESCAPE, act, &fb ); } } void Emulator::resize( size_t s_width, size_t s_height ) { fb.resize( s_width, s_height ); } bool Emulator::operator==( Emulator const &x ) const { /* dispatcher and user are irrelevant for us */ return fb == x.fb; } mosh-1.4.0/src/terminal/terminaldispatcher.cc0000664000175000017500000001533514174450057016216 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include #include #include #include #include #include "terminaldispatcher.h" #include "parseraction.h" #include "terminalframebuffer.h" using namespace Terminal; static const size_t MAXIMUM_CLIPBOARD_SIZE = 16*1024; Dispatcher::Dispatcher() : params(), parsed_params(), parsed( false ), dispatch_chars(), OSC_string(), terminal_to_host() {} void Dispatcher::newparamchar( const Parser::Param *act ) { assert( act->char_present ); assert( (act->ch == ';') || ( (act->ch >= '0') && (act->ch <= '9') ) ); if ( params.length() < 100 ) { /* enough for 16 five-char params plus 15 semicolons */ params.push_back( act->ch ); } parsed = false; } void Dispatcher::collect( const Parser::Collect *act ) { assert( act->char_present ); if ( ( dispatch_chars.length() < 8 ) /* never should need more than 2 */ && ( act->ch <= 255 ) ) { /* ignore non-8-bit */ dispatch_chars.push_back( act->ch ); } } void Dispatcher::clear( const Parser::Clear *act __attribute((unused)) ) { params.clear(); dispatch_chars.clear(); parsed = false; } void Dispatcher::parse_params( void ) { if ( parsed ) { return; } parsed_params.clear(); const char *str = params.c_str(); const char *segment_begin = str; while ( 1 ) { const char *segment_end = strchr( segment_begin, ';' ); if ( segment_end == NULL ) { break; } errno = 0; char *endptr; long val = strtol( segment_begin, &endptr, 10 ); if ( endptr == segment_begin ) { val = -1; } if ( val > PARAM_MAX || errno == ERANGE ) { val = -1; errno = 0; } if ( errno == 0 || segment_begin == endptr ) { parsed_params.push_back( val ); } segment_begin = segment_end + 1; } /* get last param */ errno = 0; char *endptr; long val = strtol( segment_begin, &endptr, 10 ); if ( endptr == segment_begin ) { val = -1; } if ( val > PARAM_MAX || errno == ERANGE ) { val = -1; errno = 0; } if ( errno == 0 || segment_begin == endptr ) { parsed_params.push_back( val ); } parsed = true; } int Dispatcher::getparam( size_t N, int defaultval ) { int ret = defaultval; if ( !parsed ) { parse_params(); } if ( parsed_params.size() > N ) { ret = parsed_params[ N ]; } if ( ret < 1 ) ret = defaultval; return ret; } int Dispatcher::param_count( void ) { if ( !parsed ) { parse_params(); } return parsed_params.size(); } std::string Dispatcher::str( void ) { char assum[ 64 ]; snprintf( assum, 64, "[dispatch=\"%s\" params=\"%s\"]", dispatch_chars.c_str(), params.c_str() ); return std::string( assum ); } /* construct on first use to avoid static initialization order crash */ DispatchRegistry & Terminal::get_global_dispatch_registry( void ) { static DispatchRegistry global_dispatch_registry; return global_dispatch_registry; } static void register_function( Function_Type type, const std::string & dispatch_chars, Function f ) { switch ( type ) { case ESCAPE: get_global_dispatch_registry().escape.insert( dispatch_map_t::value_type( dispatch_chars, f ) ); break; case CSI: get_global_dispatch_registry().CSI.insert( dispatch_map_t::value_type( dispatch_chars, f ) ); break; case CONTROL: get_global_dispatch_registry().control.insert( dispatch_map_t::value_type( dispatch_chars, f ) ); break; } } Function::Function( Function_Type type, const std::string & dispatch_chars, void (*s_function)( Framebuffer *, Dispatcher * ), bool s_clears_wrap_state ) : function( s_function ), clears_wrap_state( s_clears_wrap_state ) { register_function( type, dispatch_chars, *this ); } void Dispatcher::dispatch( Function_Type type, const Parser::Action *act, Framebuffer *fb ) { /* add final char to dispatch key */ if ( (type == ESCAPE) || (type == CSI) ) { assert( act->char_present ); Parser::Collect act2; act2.char_present = true; act2.ch = act->ch; collect( &act2 ); } dispatch_map_t *map = NULL; switch ( type ) { case ESCAPE: map = &get_global_dispatch_registry().escape; break; case CSI: map = &get_global_dispatch_registry().CSI; break; case CONTROL: map = &get_global_dispatch_registry().control; break; } std::string key = dispatch_chars; if ( type == CONTROL ) { assert( act->ch <= 255 ); char ctrlstr[ 2 ] = { (char)act->ch, 0 }; key = std::string( ctrlstr, 1 ); } dispatch_map_t::const_iterator i = map->find( key ); if ( i == map->end() ) { /* unknown function */ fb->ds.next_print_will_wrap = false; return; } if ( i->second.clears_wrap_state ) { fb->ds.next_print_will_wrap = false; } i->second.function( fb, this ); } void Dispatcher::OSC_put( const Parser::OSC_Put *act ) { assert( act->char_present ); if ( OSC_string.size() < MAXIMUM_CLIPBOARD_SIZE) { OSC_string.push_back( act->ch ); } } void Dispatcher::OSC_start( const Parser::OSC_Start *act __attribute((unused)) ) { OSC_string.clear(); } bool Dispatcher::operator==( const Dispatcher &x ) const { return ( params == x.params ) && ( parsed_params == x.parsed_params ) && ( parsed == x.parsed ) && ( dispatch_chars == x.dispatch_chars ) && ( OSC_string == x.OSC_string ) && ( terminal_to_host == x.terminal_to_host ); } mosh-1.4.0/src/terminal/terminaldisplay.h0000664000175000017500000000610214174450057015367 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #ifndef TERMINALDISPLAY_HPP #define TERMINALDISPLAY_HPP #include "terminalframebuffer.h" namespace Terminal { /* variables used within a new_frame */ class FrameState { public: std::string str; int cursor_x, cursor_y; Renditions current_rendition; bool cursor_visible; const Framebuffer &last_frame; FrameState( const Framebuffer &s_last ); void append( char c ) { str.append( 1, c ); } void append( size_t s, char c ) { str.append( s, c ); } void append( wchar_t wc ) { Cell::append_to_str( str, wc ); } void append( const char * s ) { str.append( s ); } void append_string( const std::string &append ) { str.append(append); } void append_cell(const Cell & cell) { cell.print_grapheme( str ); } void append_silent_move( int y, int x ); void append_move( int y, int x ); void update_rendition( const Renditions &r, bool force = false ); }; class Display { private: bool has_ech; /* erase character is part of vt200 but not supported by tmux (or by "screen" terminfo entry, which is what tmux advertises) */ bool has_bce; /* erases result in cell filled with background color */ bool has_title; /* supports window title and icon name */ const char *smcup, *rmcup; /* enter and exit alternate screen mode */ bool put_row( bool initialized, FrameState &frame, const Framebuffer &f, int frame_y, const Row &old_row, bool wrap ) const; public: std::string open() const; std::string close() const; std::string new_frame( bool initialized, const Framebuffer &last, const Framebuffer &f ) const; Display( bool use_environment ); }; } #endif mosh-1.4.0/src/terminal/terminalframebuffer.cc0000664000175000017500000004441614272621034016350 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include #include #include #include "terminalframebuffer.h" using namespace Terminal; Cell::Cell( color_type background_color ) : contents(), renditions( background_color ), wide( false ), fallback( false ), wrap( false ) {} void Cell::reset( color_type background_color ) { contents.clear(); renditions = Renditions( background_color ); wide = false; fallback = false; wrap = false; } void DrawState::reinitialize_tabs( unsigned int start ) { assert( default_tabs ); for ( unsigned int i = start; i < tabs.size(); i++ ) { tabs[ i ] = ( (i % 8) == 0 ); } } DrawState::DrawState( int s_width, int s_height ) : width( s_width ), height( s_height ), cursor_col( 0 ), cursor_row( 0 ), combining_char_col( 0 ), combining_char_row( 0 ), default_tabs( true ), tabs( s_width ), scrolling_region_top_row( 0 ), scrolling_region_bottom_row( height - 1 ), renditions( 0 ), save(), next_print_will_wrap( false ), origin_mode( false ), auto_wrap_mode( true ), insert_mode( false ), cursor_visible( true ), reverse_video( false ), bracketed_paste( false ), mouse_reporting_mode( MOUSE_REPORTING_NONE ), mouse_focus_event( false ), mouse_alternate_scroll( false ), mouse_encoding_mode( MOUSE_ENCODING_DEFAULT ), application_mode_cursor_keys( false ) { reinitialize_tabs( 0 ); } Framebuffer::Framebuffer( int s_width, int s_height ) : rows(), icon_name(), window_title(), clipboard(), bell_count( 0 ), title_initialized( false ), ds( s_width, s_height ) { assert( s_height > 0 ); assert( s_width > 0 ); const size_t w = s_width; const color_type c = 0; rows = rows_type(s_height, row_pointer(make_shared( w, c ))); } Framebuffer::Framebuffer( const Framebuffer &other ) : rows( other.rows ), icon_name( other.icon_name ), window_title( other.window_title ), clipboard( other.clipboard ), bell_count( other.bell_count ), title_initialized( other.title_initialized ), ds( other.ds ) { } Framebuffer & Framebuffer::operator=( const Framebuffer &other ) { if ( this != &other ) { rows = other.rows; icon_name = other.icon_name; window_title = other.window_title; clipboard = other.clipboard; bell_count = other.bell_count; title_initialized = other.title_initialized; ds = other.ds; } return *this; } void Framebuffer::scroll( int N ) { if ( N >= 0 ) { delete_line( ds.get_scrolling_region_top_row(), N ); } else { insert_line( ds.get_scrolling_region_top_row(), -N ); } } void DrawState::new_grapheme( void ) { combining_char_col = cursor_col; combining_char_row = cursor_row; } void DrawState::snap_cursor_to_border( void ) { if ( cursor_row < limit_top() ) cursor_row = limit_top(); if ( cursor_row > limit_bottom() ) cursor_row = limit_bottom(); if ( cursor_col < 0 ) cursor_col = 0; if ( cursor_col >= width ) cursor_col = width - 1; } void DrawState::move_row( int N, bool relative ) { if ( relative ) { cursor_row += N; } else { cursor_row = N + limit_top(); } snap_cursor_to_border(); new_grapheme(); next_print_will_wrap = false; } void DrawState::move_col( int N, bool relative, bool implicit ) { if ( implicit ) { new_grapheme(); } if ( relative ) { cursor_col += N; } else { cursor_col = N; } if ( implicit ) { next_print_will_wrap = (cursor_col >= width); } snap_cursor_to_border(); if ( !implicit ) { new_grapheme(); next_print_will_wrap = false; } } void Framebuffer::move_rows_autoscroll( int rows ) { /* don't scroll if outside the scrolling region */ if ( (ds.get_cursor_row() < ds.get_scrolling_region_top_row()) || (ds.get_cursor_row() > ds.get_scrolling_region_bottom_row()) ) { ds.move_row( rows, true ); return; } if ( ds.get_cursor_row() + rows > ds.get_scrolling_region_bottom_row() ) { int N = ds.get_cursor_row() + rows - ds.get_scrolling_region_bottom_row(); scroll( N ); ds.move_row( -N, true ); } else if ( ds.get_cursor_row() + rows < ds.get_scrolling_region_top_row() ) { int N = ds.get_cursor_row() + rows - ds.get_scrolling_region_top_row(); scroll( N ); ds.move_row( -N, true ); } ds.move_row( rows, true ); } Cell *Framebuffer::get_combining_cell( void ) { if ( (ds.get_combining_char_col() < 0) || (ds.get_combining_char_row() < 0) || (ds.get_combining_char_col() >= ds.get_width()) || (ds.get_combining_char_row() >= ds.get_height()) ) { return NULL; } /* can happen if a resize came in between */ return get_mutable_cell( ds.get_combining_char_row(), ds.get_combining_char_col() ); } void DrawState::set_tab( void ) { tabs[ cursor_col ] = true; } void DrawState::clear_tab( int col ) { tabs[ col ] = false; } int DrawState::get_next_tab( int count ) const { if ( count >= 0 ) { for ( int i = cursor_col + 1; i < width; i++ ) { if ( tabs[ i ] && --count == 0 ) { return i; } } return -1; } for ( int i = cursor_col - 1; i > 0; i-- ) { if ( tabs[ i ] && ++count == 0 ) { return i; } } return 0; } void DrawState::set_scrolling_region( int top, int bottom ) { if ( height < 1 ) { return; } scrolling_region_top_row = top; scrolling_region_bottom_row = bottom; if ( scrolling_region_top_row < 0 ) scrolling_region_top_row = 0; if ( scrolling_region_bottom_row >= height ) scrolling_region_bottom_row = height - 1; if ( scrolling_region_bottom_row < scrolling_region_top_row ) scrolling_region_bottom_row = scrolling_region_top_row; /* real rule requires TWO-line scrolling region */ if ( origin_mode ) { snap_cursor_to_border(); new_grapheme(); } } int DrawState::limit_top( void ) const { return origin_mode ? scrolling_region_top_row : 0; } int DrawState::limit_bottom( void ) const { return origin_mode ? scrolling_region_bottom_row : height - 1; } void Framebuffer::apply_renditions_to_cell( Cell *cell ) { if (!cell) { cell = get_mutable_cell(); } cell->set_renditions( ds.get_renditions() ); } SavedCursor::SavedCursor() : cursor_col( 0 ), cursor_row( 0 ), renditions( 0 ), auto_wrap_mode( true ), origin_mode( false ) {} void DrawState::save_cursor( void ) { save.cursor_col = cursor_col; save.cursor_row = cursor_row; save.renditions = renditions; save.auto_wrap_mode = auto_wrap_mode; save.origin_mode = origin_mode; } void DrawState::restore_cursor( void ) { cursor_col = save.cursor_col; cursor_row = save.cursor_row; renditions = save.renditions; auto_wrap_mode = save.auto_wrap_mode; origin_mode = save.origin_mode; snap_cursor_to_border(); /* we could have resized in between */ new_grapheme(); } void Framebuffer::insert_line( int before_row, int count ) { if ( (before_row < ds.get_scrolling_region_top_row()) || (before_row > ds.get_scrolling_region_bottom_row() + 1) ) { return; } int scroll = ds.get_scrolling_region_bottom_row() + 1 - before_row; if ( count < scroll ) { scroll = count; } if ( scroll == 0 ) { return; } // delete old rows rows_type::iterator start = rows.begin() + ds.get_scrolling_region_bottom_row() + 1 - scroll; rows.erase( start, start + scroll ); // insert new rows start = rows.begin() + before_row; rows.insert( start, scroll, newrow()); } void Framebuffer::delete_line( int row, int count ) { if ( (row < ds.get_scrolling_region_top_row()) || (row > ds.get_scrolling_region_bottom_row()) ) { return; } int scroll = ds.get_scrolling_region_bottom_row() + 1 - row; if ( count < scroll ) { scroll = count; } if ( scroll == 0 ) { return; } // delete old rows rows_type::iterator start = rows.begin() + row; rows.erase( start, start + scroll ); // insert a block of dummy rows start = rows.begin() + ds.get_scrolling_region_bottom_row() + 1 - scroll; rows.insert( start, scroll, newrow()); } Row::Row( const size_t s_width, const color_type background_color ) : cells( s_width, Cell( background_color ) ), gen( get_gen() ) {} uint64_t Row::get_gen() const { static uint64_t gen_counter = 0; return gen_counter++; } void Row::insert_cell( int col, color_type background_color ) { cells.insert( cells.begin() + col, Cell( background_color ) ); cells.pop_back(); } void Row::delete_cell( int col, color_type background_color ) { cells.push_back( Cell( background_color ) ); cells.erase( cells.begin() + col ); } void Framebuffer::insert_cell( int row, int col ) { get_mutable_row( row )->insert_cell( col, ds.get_background_rendition() ); } void Framebuffer::delete_cell( int row, int col ) { get_mutable_row( row )->delete_cell( col, ds.get_background_rendition() ); } void Framebuffer::reset( void ) { int width = ds.get_width(), height = ds.get_height(); ds = DrawState( width, height ); rows = rows_type( height, newrow() ); window_title.clear(); clipboard.clear(); /* do not reset bell_count */ } void Framebuffer::soft_reset( void ) { ds.insert_mode = false; ds.origin_mode = false; ds.cursor_visible = true; /* per xterm and gnome-terminal */ ds.application_mode_cursor_keys = false; ds.set_scrolling_region( 0, ds.get_height() - 1 ); ds.add_rendition( 0 ); ds.clear_saved_cursor(); } void Framebuffer::resize( int s_width, int s_height ) { assert( s_width > 0 ); assert( s_height > 0 ); int oldheight = ds.get_height(); int oldwidth = ds.get_width(); ds.resize( s_width, s_height ); row_pointer blankrow( newrow()); if ( oldheight != s_height ) { rows.resize( s_height, blankrow ); } if (oldwidth == s_width) { return; } for ( rows_type::iterator i = rows.begin(); i != rows.end() && *i != blankrow; i++ ) { *i = make_shared( **i ); (*i)->set_wrap( false ); (*i)->cells.resize( s_width, Cell( ds.get_background_rendition() ) ); } } void DrawState::resize( int s_width, int s_height ) { if ( (width != s_width) || (height != s_height) ) { /* reset entire scrolling region on any resize */ /* xterm and rxvt-unicode do this. gnome-terminal only resets scrolling region if it has to become smaller in resize */ scrolling_region_top_row = 0; scrolling_region_bottom_row = s_height - 1; } tabs.resize( s_width ); if ( default_tabs ) { reinitialize_tabs( width ); } width = s_width; height = s_height; snap_cursor_to_border(); /* saved cursor will be snapped to border on restore */ /* invalidate combining char cell if necessary */ if ( (combining_char_col >= width) || (combining_char_row >= height) ) { combining_char_col = combining_char_row = -1; } } Renditions::Renditions( color_type s_background ) : foreground_color( 0 ), background_color( s_background ), attributes( 0 ) {} /* This routine cannot be used to set a color beyond the 16-color set. */ void Renditions::set_rendition( color_type num ) { if ( num == 0 ) { clear_attributes(); foreground_color = background_color = 0; return; } if ( num == 39 ) { foreground_color = 0; return; } else if ( num == 49 ) { background_color = 0; return; } if ( (30 <= num) && (num <= 37) ) { /* foreground color in 8-color set */ foreground_color = num; return; } else if ( (40 <= num) && (num <= 47) ) { /* background color in 8-color set */ background_color = num; return; } else if ( (90 <= num) && (num <= 97) ) { /* foreground color in 16-color set */ foreground_color = num - 90 + 38; return; } else if ( (100 <= num) && (num <= 107) ) { /* background color in 16-color set */ background_color = num - 100 + 48; return; } bool value = num < 9; switch ( num ) { case 1: case 22: set_attribute(bold, value); break; case 3: case 23: set_attribute(italic, value); break; case 4: case 24: set_attribute(underlined, value); break; case 5: case 25: set_attribute(blink, value); break; case 7: case 27: set_attribute(inverse, value); break; case 8: case 28: set_attribute(invisible, value); break; default: break; /* ignore unknown rendition */ } } void Renditions::set_foreground_color( int num ) { if ( (0 <= num) && (num <= 255) ) { foreground_color = 30 + num; } else if ( is_true_color( num ) ) { foreground_color = num; } } void Renditions::set_background_color( int num ) { if ( (0 <= num) && (num <= 255) ) { background_color = 40 + num; } else if ( is_true_color( num ) ) { background_color = num; } } std::string Renditions::sgr( void ) const { std::string ret; char col[64]; ret.append( "\033[0" ); if ( get_attribute( bold ) ) ret.append( ";1" ); if ( get_attribute( italic ) ) ret.append( ";3" ); if ( get_attribute( underlined ) ) ret.append( ";4" ); if ( get_attribute( blink ) ) ret.append( ";5" ); if ( get_attribute( inverse ) ) ret.append( ";7" ); if ( get_attribute( invisible ) ) ret.append( ";8" ); if ( foreground_color ) { // Since foreground_color is a 25-bit field, it is promoted to an int when // manipulated. (See [conv.prom] in various C++ standards, e.g., // https://timsong-cpp.github.io/cppwp/n4659/conv.prom#5.) The correct // printf format specifier is thus %d. if ( is_true_color( foreground_color ) ) { snprintf( col, sizeof( col ), ";38;2;%d;%d;%d", (foreground_color >> 16) & 0xff, (foreground_color >> 8) & 0xff, foreground_color & 0xff); } else if ( foreground_color > 37 ) { /* use 256-color set */ snprintf( col, sizeof( col ), ";38;5;%d", foreground_color - 30 ); } else { /* ANSI foreground color */ // Unfortunately, some versions of GCC (notably including GCC 9.3) give // -Wformat warnings when relying on [conv.prom] to promote // foreground_color in calls to printf. Explicitly promote it to silence // the warning. int fg = foreground_color; snprintf( col, sizeof( col ), ";%d", fg ); } ret.append( col ); } if ( background_color ) { // See comment above about bit-field promotion; it applies here as well. if ( is_true_color( background_color ) ) { snprintf( col, sizeof( col ), ";48;2;%d;%d;%d", (background_color >> 16) & 0xff, (background_color >> 8) & 0xff, background_color & 0xff); } else if ( background_color > 47 ) { /* use 256-color set */ snprintf( col, sizeof( col ), ";48;5;%d", background_color - 40 ); } else { /* ANSI background color */ // See comment above about explicit promotion; it applies here as well. int bg = background_color; snprintf( col, sizeof( col ), ";%d", bg ); } ret.append( col ); } ret.append( "m" ); return ret; } void Row::reset( color_type background_color ) { gen = get_gen(); for ( cells_type::iterator i = cells.begin(); i != cells.end(); i++ ) { i->reset( background_color ); } } void Framebuffer::prefix_window_title( const title_type &s ) { if ( icon_name == window_title ) { /* preserve equivalence */ icon_name.insert(icon_name.begin(), s.begin(), s.end() ); } window_title.insert(window_title.begin(), s.begin(), s.end() ); } std::string Cell::debug_contents( void ) const { if ( contents.empty() ) { return "'_' ()"; } std::string chars( 1, '\'' ); print_grapheme( chars ); chars.append( "' [" ); const char *lazycomma = ""; char buf[64]; for ( content_type::const_iterator i = contents.begin(); i < contents.end(); i++ ) { snprintf( buf, sizeof buf, "%s0x%02x", lazycomma, static_cast(*i) ); chars.append( buf ); lazycomma = ", "; } chars.append( "]" ); return chars; } bool Cell::compare( const Cell &other ) const { bool ret = false; std::string grapheme, other_grapheme; print_grapheme( grapheme ); other.print_grapheme( other_grapheme ); if ( grapheme != other_grapheme ) { ret = true; fprintf( stderr, "Graphemes: '%s' vs. '%s'\n", grapheme.c_str(), other_grapheme.c_str() ); } if ( !contents_match( other ) ) { // ret = true; fprintf( stderr, "Contents: %s (%ld) vs. %s (%ld)\n", debug_contents().c_str(), static_cast( contents.size() ), other.debug_contents().c_str(), static_cast( other.contents.size() ) ); } if ( fallback != other.fallback ) { // ret = true; // Since fallback is a 1-bit field, it is promoted to an int when // manipulated. (See [conv.prom] in various C++ standards, e.g., // https://timsong-cpp.github.io/cppwp/n4659/conv.prom#5.) The correct // printf format specifier is thus %d. fprintf( stderr, "fallback: %d vs. %d\n", fallback, other.fallback ); } if ( wide != other.wide ) { ret = true; // See comment above about bit-field promotion; it applies here as well. fprintf( stderr, "width: %d vs. %d\n", wide, other.wide ); } if ( !(renditions == other.renditions) ) { ret = true; fprintf( stderr, "renditions differ\n" ); } if ( wrap != other.wrap ) { ret = true; // See comment above about bit-field promotion; it applies here as well. fprintf( stderr, "wrap: %d vs. %d\n", wrap, other.wrap ); } return ret; } mosh-1.4.0/src/terminal/terminalfunctions.cc0000664000175000017500000004564514174450057016107 00000000000000/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 . In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include #include #include #include #include "terminaldispatcher.h" #include "terminalframebuffer.h" #include "parseraction.h" using namespace Terminal; /* Terminal functions -- routines activated by CSI, escape or a control char */ static void clearline( Framebuffer *fb, int row, int start, int end ) { for ( int col = start; col <= end; col++ ) { fb->reset_cell( fb->get_mutable_cell( row, col ) ); } } /* erase in line */ static void CSI_EL( Framebuffer *fb, Dispatcher *dispatch ) { switch ( dispatch->getparam( 0, 0 ) ) { case 0: /* default: active position to end of line, inclusive */ clearline( fb, -1, fb->ds.get_cursor_col(), fb->ds.get_width() - 1 ); break; case 1: /* start of screen to active position, inclusive */ clearline( fb, -1, 0, fb->ds.get_cursor_col() ); break; case 2: /* all of line */ fb->reset_row( fb->get_mutable_row( -1 ) ); break; default: break; } } static Function func_CSI_EL( CSI, "K", CSI_EL ); /* erase in display */ static void CSI_ED( Framebuffer *fb, Dispatcher *dispatch ) { switch ( dispatch->getparam( 0, 0 ) ) { case 0: /* active position to end of screen, inclusive */ clearline( fb, -1, fb->ds.get_cursor_col(), fb->ds.get_width() - 1 ); for ( int y = fb->ds.get_cursor_row() + 1; y < fb->ds.get_height(); y++ ) { fb->reset_row( fb->get_mutable_row( y ) ); } break; case 1: /* start of screen to active position, inclusive */ for ( int y = 0; y < fb->ds.get_cursor_row(); y++ ) { fb->reset_row( fb->get_mutable_row( y ) ); } clearline( fb, -1, 0, fb->ds.get_cursor_col() ); break; case 2: /* entire screen */ for ( int y = 0; y < fb->ds.get_height(); y++ ) { fb->reset_row( fb->get_mutable_row( y ) ); } break; default: break; } } static Function func_CSI_ED( CSI, "J", CSI_ED ); /* cursor movement -- relative and absolute */ static void CSI_cursormove( Framebuffer *fb, Dispatcher *dispatch ) { int num = dispatch->getparam( 0, 1 ); switch ( dispatch->get_dispatch_chars()[ 0 ] ) { case 'A': fb->ds.move_row( -num, true ); break; case 'B': fb->ds.move_row( num, true ); break; case 'C': fb->ds.move_col( num, true ); break; case 'D': fb->ds.move_col( -num, true ); break; case 'H': case 'f': fb->ds.move_row( dispatch->getparam( 0, 1 ) - 1 ); fb->ds.move_col( dispatch->getparam( 1, 1 ) - 1 ); break; default: break; } } static Function func_CSI_cursormove_A( CSI, "A", CSI_cursormove ); static Function func_CSI_cursormove_B( CSI, "B", CSI_cursormove ); static Function func_CSI_cursormove_C( CSI, "C", CSI_cursormove ); static Function func_CSI_cursormove_D( CSI, "D", CSI_cursormove ); static Function func_CSI_cursormove_H( CSI, "H", CSI_cursormove ); static Function func_CSI_cursormove_f( CSI, "f", CSI_cursormove ); /* device attributes */ static void CSI_DA( Framebuffer *fb __attribute((unused)), Dispatcher *dispatch ) { dispatch->terminal_to_host.append( "\033[?62c" ); /* plain vt220 */ } static Function func_CSI_DA( CSI, "c", CSI_DA ); /* secondary device attributes */ static void CSI_SDA( Framebuffer *fb __attribute((unused)), Dispatcher *dispatch ) { dispatch->terminal_to_host.append( "\033[>1;10;0c" ); /* plain vt220 */ } static Function func_CSI_SDA( CSI, ">c", CSI_SDA ); /* screen alignment diagnostic */ static void Esc_DECALN( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) ) { for ( int y = 0; y < fb->ds.get_height(); y++ ) { for ( int x = 0; x < fb->ds.get_width(); x++ ) { fb->reset_cell( fb->get_mutable_cell( y, x ) ); fb->get_mutable_cell( y, x )->append( 'E' ); } } } static Function func_Esc_DECALN( ESCAPE, "#8", Esc_DECALN ); /* line feed */ static void Ctrl_LF( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) ) { fb->move_rows_autoscroll( 1 ); } /* same procedure for index, vertical tab, and form feed control codes */ static Function func_Ctrl_LF( CONTROL, "\x0a", Ctrl_LF ); static Function func_Ctrl_IND( CONTROL, "\x84", Ctrl_LF ); static Function func_Ctrl_VT( CONTROL, "\x0b", Ctrl_LF ); static Function func_Ctrl_FF( CONTROL, "\x0c", Ctrl_LF ); /* carriage return */ static void Ctrl_CR( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) ) { fb->ds.move_col( 0 ); } static Function func_Ctrl_CR( CONTROL, "\x0d", Ctrl_CR ); /* backspace */ static void Ctrl_BS( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) ) { fb->ds.move_col( -1, true ); } static Function func_Ctrl_BS( CONTROL, "\x08", Ctrl_BS ); /* reverse index -- like a backwards line feed */ static void Ctrl_RI( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) ) { fb->move_rows_autoscroll( -1 ); } static Function func_Ctrl_RI( CONTROL, "\x8D", Ctrl_RI ); /* newline */ static void Ctrl_NEL( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) ) { fb->ds.move_col( 0 ); fb->move_rows_autoscroll( 1 ); } static Function func_Ctrl_NEL( CONTROL, "\x85", Ctrl_NEL ); /* horizontal tab */ static void HT_n( Framebuffer *fb, size_t count ) { int col = fb->ds.get_next_tab( count ); if ( col == -1 ) { /* no tabs, go to end of line */ col = fb->ds.get_width() - 1; } /* A horizontal tab is the only operation that preserves but does not set the wrap state. It also starts a new grapheme. */ bool wrap_state_save = fb->ds.next_print_will_wrap; fb->ds.move_col( col, false ); fb->ds.next_print_will_wrap = wrap_state_save; } static void Ctrl_HT( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) ) { HT_n( fb, 1 ); } static Function func_Ctrl_HT( CONTROL, "\x09", Ctrl_HT, false ); static void CSI_CxT( Framebuffer *fb, Dispatcher *dispatch ) { int param = dispatch->getparam( 0, 1 ); if ( dispatch->get_dispatch_chars()[ 0 ] == 'Z' ) { param = -param; } if ( param == 0 ) { return; } HT_n( fb, param ); } static Function func_CSI_CHT( CSI, "I", CSI_CxT, false ); static Function func_CSI_CBT( CSI, "Z", CSI_CxT, false ); /* horizontal tab set */ static void Ctrl_HTS( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) ) { fb->ds.set_tab(); } static Function func_Ctrl_HTS( CONTROL, "\x88", Ctrl_HTS ); /* tabulation clear */ static void CSI_TBC( Framebuffer *fb, Dispatcher *dispatch ) { int param = dispatch->getparam( 0, 0 ); switch ( param ) { case 0: /* clear this tab stop */ fb->ds.clear_tab( fb->ds.get_cursor_col() ); break; case 3: /* clear all tab stops */ fb->ds.clear_default_tabs(); for ( int x = 0; x < fb->ds.get_width(); x++ ) { fb->ds.clear_tab( x ); } break; default: break; } } /* TBC preserves wrap state */ static Function func_CSI_TBC( CSI, "g", CSI_TBC, false ); static bool *get_DEC_mode( int param, Framebuffer *fb ) { switch ( param ) { case 1: /* cursor key mode */ return &(fb->ds.application_mode_cursor_keys); case 3: /* 80/132. Ignore but clear screen. */ /* clear screen */ fb->ds.move_row( 0 ); fb->ds.move_col( 0 ); for ( int y = 0; y < fb->ds.get_height(); y++ ) { fb->reset_row( fb->get_mutable_row( y ) ); } return NULL; case 5: /* reverse video */ return &(fb->ds.reverse_video); case 6: /* origin */ fb->ds.move_row( 0 ); fb->ds.move_col( 0 ); return &(fb->ds.origin_mode); case 7: /* auto wrap */ return &(fb->ds.auto_wrap_mode); case 25: return &(fb->ds.cursor_visible); case 1004: /* xterm mouse focus event */ return &(fb->ds.mouse_focus_event); case 1007: /* xterm mouse alternate scroll */ return &(fb->ds.mouse_alternate_scroll); case 2004: /* bracketed paste */ return &(fb->ds.bracketed_paste); default: break; } return NULL; } /* helper for CSI_DECSM and CSI_DECRM */ static void set_if_available( bool *mode, bool value ) { if ( mode ) { *mode = value; } } /* set private mode */ static void CSI_DECSM( Framebuffer *fb, Dispatcher *dispatch ) { for ( int i = 0; i < dispatch->param_count(); i++ ) { int param = dispatch->getparam( i, 0 ); if (param == 9 || (param >= 1000 && param <= 1003)) { fb->ds.mouse_reporting_mode = (Terminal::DrawState::MouseReportingMode) param; } else if (param == 1005 || param == 1006 || param == 1015) { fb->ds.mouse_encoding_mode = (Terminal::DrawState::MouseEncodingMode) param; } else { set_if_available( get_DEC_mode( param, fb ), true ); } } } /* clear private mode */ static void CSI_DECRM( Framebuffer *fb, Dispatcher *dispatch ) { for ( int i = 0; i < dispatch->param_count(); i++ ) { int param = dispatch->getparam( i, 0 ); if (param == 9 || (param >= 1000 && param <= 1003)) { fb->ds.mouse_reporting_mode = Terminal::DrawState::MOUSE_REPORTING_NONE; } else if (param == 1005 || param == 1006 || param == 1015) { fb->ds.mouse_encoding_mode = Terminal::DrawState::MOUSE_ENCODING_DEFAULT; } else { set_if_available( get_DEC_mode( param, fb ), false ); } } } /* These functions don't clear wrap state. */ static Function func_CSI_DECSM( CSI, "?h", CSI_DECSM, false ); static Function func_CSI_DECRM( CSI, "?l", CSI_DECRM, false ); static bool *get_ANSI_mode( int param, Framebuffer *fb ) { if ( param == 4 ) { /* insert/replace mode */ return &(fb->ds.insert_mode); } return NULL; } /* set mode */ static void CSI_SM( Framebuffer *fb, Dispatcher *dispatch ) { for ( int i = 0; i < dispatch->param_count(); i++ ) { bool *mode = get_ANSI_mode( dispatch->getparam( i, 0 ), fb ); if ( mode ) { *mode = true; } } } /* clear mode */ static void CSI_RM( Framebuffer *fb, Dispatcher *dispatch ) { for ( int i = 0; i < dispatch->param_count(); i++ ) { bool *mode = get_ANSI_mode( dispatch->getparam( i, 0 ), fb ); if ( mode ) { *mode = false; } } } static Function func_CSI_SM( CSI, "h", CSI_SM ); static Function func_CSI_RM( CSI, "l", CSI_RM ); /* set top and bottom margins */ static void CSI_DECSTBM( Framebuffer *fb, Dispatcher *dispatch ) { int top = dispatch->getparam( 0, 1 ); int bottom = dispatch->getparam( 1, fb->ds.get_height() ); if ( (bottom <= top) || (top > fb->ds.get_height()) || (top == 0 && bottom == 1) ) { return; /* invalid, xterm ignores */ } fb->ds.set_scrolling_region( top - 1, bottom - 1 ); fb->ds.move_row( 0 ); fb->ds.move_col( 0 ); } static Function func_CSI_DECSTMB( CSI, "r", CSI_DECSTBM ); /* terminal bell */ static void Ctrl_BEL( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) ) { fb->ring_bell(); } static Function func_Ctrl_BEL( CONTROL, "\x07", Ctrl_BEL ); /* select graphics rendition -- e.g., bold, blinking, etc. */ static void CSI_SGR( Framebuffer *fb, Dispatcher *dispatch ) { for ( int i = 0; i < dispatch->param_count(); i++ ) { int rendition = dispatch->getparam( i, 0 ); /* We need to special-case the handling of [34]8 ; 5 ; Ps, because Ps of 0 in that case does not mean reset to default, even though it means that otherwise (as usually renditions are applied in order). */ if ((rendition == 38 || rendition == 48) && (dispatch->param_count() - i >= 3) && (dispatch->getparam( i+1, -1 ) == 5)) { (rendition == 38) ? fb->ds.set_foreground_color( dispatch->getparam( i+2, 0 ) ) : fb->ds.set_background_color( dispatch->getparam( i+2, 0 ) ); i += 2; continue; } /* True color support: ESC[ ... [34]8;2;;; ... m */ if ( (rendition == 38 || rendition == 48) && (dispatch->param_count() - i >= 5) && (dispatch->getparam( i+1, -1 ) == 2)) { unsigned int red = dispatch->getparam(i+2, 0); unsigned int green = dispatch->getparam(i+3, 0); unsigned int blue = dispatch->getparam(i+4, 0); unsigned int color; color = Renditions::make_true_color( red, green, blue ); if ( rendition == 38 ) { fb->ds.set_foreground_color( color ); } else { fb->ds.set_background_color( color ); } i += 4; continue; } fb->ds.add_rendition( rendition ); } } static Function func_CSI_SGR( CSI, "m", CSI_SGR, false ); /* changing renditions doesn't clear wrap flag */ /* save and restore cursor */ static void Esc_DECSC( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) ) { fb->ds.save_cursor(); } static void Esc_DECRC( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) ) { fb->ds.restore_cursor(); } static Function func_Esc_DECSC( ESCAPE, "7", Esc_DECSC ); static Function func_Esc_DECRC( ESCAPE, "8", Esc_DECRC ); /* device status report -- e.g., cursor position (used by resize) */ static void CSI_DSR( Framebuffer *fb, Dispatcher *dispatch ) { int param = dispatch->getparam( 0, 0 ); switch ( param ) { case 5: /* device status report requested */ dispatch->terminal_to_host.append( "\033[0n" ); break; case 6: /* report of active position requested */ char cpr[ 32 ]; snprintf( cpr, 32, "\033[%d;%dR", fb->ds.get_cursor_row() + 1, fb->ds.get_cursor_col() + 1 ); dispatch->terminal_to_host.append( cpr ); break; default: break; } } static Function func_CSI_DSR( CSI, "n", CSI_DSR ); /* insert line */ static void CSI_IL( Framebuffer *fb, Dispatcher *dispatch ) { int lines = dispatch->getparam( 0, 1 ); fb->insert_line( fb->ds.get_cursor_row(), lines ); /* vt220 manual and Ecma-48 say to move to first column */ /* but xterm and gnome-terminal don't */ fb->ds.move_col( 0 ); } static Function func_CSI_IL( CSI, "L", CSI_IL ); /* delete line */ static void CSI_DL( Framebuffer *fb, Dispatcher *dispatch ) { int lines = dispatch->getparam( 0, 1 ); fb->delete_line( fb->ds.get_cursor_row(), lines ); /* same story -- xterm and gnome-terminal don't move to first column */ fb->ds.move_col( 0 ); } static Function func_CSI_DL( CSI, "M", CSI_DL ); /* insert characters */ static void CSI_ICH( Framebuffer *fb, Dispatcher *dispatch ) { int cells = dispatch->getparam( 0, 1 ); for ( int i = 0; i < cells; i++ ) { fb->insert_cell( fb->ds.get_cursor_row(), fb->ds.get_cursor_col() ); } } static Function func_CSI_ICH( CSI, "@", CSI_ICH ); /* delete character */ static void CSI_DCH( Framebuffer *fb, Dispatcher *dispatch ) { int cells = dispatch->getparam( 0, 1 ); for ( int i = 0; i < cells; i++ ) { fb->delete_cell( fb->ds.get_cursor_row(), fb->ds.get_cursor_col() ); } } static Function func_CSI_DCH( CSI, "P", CSI_DCH ); /* line position absolute */ static void CSI_VPA( Framebuffer *fb, Dispatcher *dispatch ) { int row = dispatch->getparam( 0, 1 ); fb->ds.move_row( row - 1 ); } static Function func_CSI_VPA( CSI, "d", CSI_VPA ); /* character position absolute */ static void CSI_HPA( Framebuffer *fb, Dispatcher *dispatch ) { int col = dispatch->getparam( 0, 1 ); fb->ds.move_col( col - 1 ); } static Function func_CSI_CHA( CSI, "G", CSI_HPA ); /* ECMA-48 name: CHA */ static Function func_CSI_HPA( CSI, "\x60", CSI_HPA ); /* ECMA-48 name: HPA */ /* erase character */ static void CSI_ECH( Framebuffer *fb, Dispatcher *dispatch ) { int num = dispatch->getparam( 0, 1 ); int limit = fb->ds.get_cursor_col() + num - 1; if ( limit >= fb->ds.get_width() ) { limit = fb->ds.get_width() - 1; } clearline( fb, -1, fb->ds.get_cursor_col(), limit ); } static Function func_CSI_ECH( CSI, "X", CSI_ECH ); /* reset to initial state */ static void Esc_RIS( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) ) { fb->reset(); } static Function func_Esc_RIS( ESCAPE, "c", Esc_RIS ); /* soft reset */ static void CSI_DECSTR( Framebuffer *fb, Dispatcher *dispatch __attribute((unused)) ) { fb->soft_reset(); } static Function func_CSI_DECSTR( CSI, "!p", CSI_DECSTR ); /* xterm uses an Operating System Command to set the window title */ void Dispatcher::OSC_dispatch( const Parser::OSC_End *act __attribute((unused)), Framebuffer *fb ) { /* handle osc copy clipboard sequence 52;c; */ if ( OSC_string.size() >= 5 && OSC_string[ 0 ] == L'5' && OSC_string[ 1 ] == L'2' && OSC_string[ 2 ] == L';' && OSC_string[ 3 ] == L'c' && OSC_string[ 4 ] == L';') { Terminal::Framebuffer::title_type clipboard( OSC_string.begin() + 5, OSC_string.end() ); fb->set_clipboard( clipboard ); /* handle osc terminal title sequence */ } else if ( OSC_string.size() >= 1 ) { long cmd_num = -1; int offset = 0; if ( OSC_string[ 0 ] == L';' ) { /* OSC of the form "\033];\007" */ cmd_num = 0; /* treat it as as a zero */ offset = 1; } else if ( (OSC_string.size() >= 2) && (OSC_string[ 1 ] == L';') ) { /* OSC of the form "\033]X;<title>\007" where X can be: * 0: set icon name and window title * 1: set icon name * 2: set window title */ cmd_num = OSC_string[ 0 ] - L'0'; offset = 2; } bool set_icon = cmd_num == 0 || cmd_num == 1; bool set_title = cmd_num == 0 || cmd_num == 2; if ( set_icon || set_title ) { fb->set_title_initialized(); int title_length = std::min(OSC_string.size(), (size_t)256); Terminal::Framebuffer::title_type newtitle( OSC_string.begin() + offset, OSC_string.begin() + title_length ); if ( set_icon ) { fb->set_icon_name( newtitle ); } if ( set_title ) { fb->set_window_title( newtitle ); } } } } /* scroll down or terminfo indn */ static void CSI_SD( Framebuffer *fb, Dispatcher *dispatch ) { fb->scroll( dispatch->getparam( 0, 1 ) ); } static Function func_CSI_SD( CSI, "S", CSI_SD ); /* scroll up or terminfo rin */ static void CSI_SU( Framebuffer *fb, Dispatcher *dispatch ) { fb->scroll( -dispatch->getparam( 0, 1 ) ); } static Function func_CSI_SU( CSI, "T", CSI_SU ); �������������������������������������������������������������������������������������������mosh-1.4.0/src/examples/����������������������������������������������������������������������������0000775�0001750�0001750�00000000000�14327736673�012114� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������mosh-1.4.0/src/examples/Makefile.in�����������������������������������������������������������������0000664�0001750�0001750�00000102641�14327736657�014107� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 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)) 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_EXAMPLES_TRUE@noinst_PROGRAMS = encrypt$(EXEEXT) \ @BUILD_EXAMPLES_TRUE@ decrypt$(EXEEXT) ntester$(EXEEXT) \ @BUILD_EXAMPLES_TRUE@ parse$(EXEEXT) termemu$(EXEEXT) \ @BUILD_EXAMPLES_TRUE@ benchmark$(EXEEXT) subdir = src/examples ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ $(top_srcdir)/m4/ax_ac_print_to_file.m4 \ $(top_srcdir)/m4/ax_add_am_macro_static.m4 \ $(top_srcdir)/m4/ax_am_macros_static.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_gnu_make.m4 \ $(top_srcdir)/m4/ax_check_library.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_code_coverage.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ $(top_srcdir)/m4/ax_file_escapes.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 $(top_srcdir)/m4/pkg.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 = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = PROGRAMS = $(noinst_PROGRAMS) am_benchmark_OBJECTS = benchmark-benchmark.$(OBJEXT) benchmark_OBJECTS = $(am_benchmark_OBJECTS) am__DEPENDENCIES_1 = benchmark_DEPENDENCIES = ../frontend/terminaloverlay.o \ ../statesync/libmoshstatesync.a ../terminal/libmoshterminal.a \ ../protobufs/libmoshprotos.a ../network/libmoshnetwork.a \ ../crypto/libmoshcrypto.a ../util/libmoshutil.a \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_decrypt_OBJECTS = decrypt-decrypt.$(OBJEXT) decrypt_OBJECTS = $(am_decrypt_OBJECTS) decrypt_DEPENDENCIES = ../crypto/libmoshcrypto.a $(am__DEPENDENCIES_1) am_encrypt_OBJECTS = encrypt-encrypt.$(OBJEXT) encrypt_OBJECTS = $(am_encrypt_OBJECTS) encrypt_DEPENDENCIES = ../crypto/libmoshcrypto.a $(am__DEPENDENCIES_1) am_ntester_OBJECTS = ntester-ntester.$(OBJEXT) ntester_OBJECTS = $(am_ntester_OBJECTS) ntester_DEPENDENCIES = ../statesync/libmoshstatesync.a \ ../terminal/libmoshterminal.a ../network/libmoshnetwork.a \ ../crypto/libmoshcrypto.a ../protobufs/libmoshprotos.a \ ../util/libmoshutil.a $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_parse_OBJECTS = parse-parse.$(OBJEXT) parse_OBJECTS = $(am_parse_OBJECTS) parse_DEPENDENCIES = ../terminal/libmoshterminal.a \ ../util/libmoshutil.a am_termemu_OBJECTS = termemu-termemu.$(OBJEXT) termemu_OBJECTS = $(am_termemu_OBJECTS) termemu_DEPENDENCIES = ../terminal/libmoshterminal.a \ ../util/libmoshutil.a ../statesync/libmoshstatesync.a \ ../protobufs/libmoshprotos.a $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) 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)/src/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/benchmark-benchmark.Po \ ./$(DEPDIR)/decrypt-decrypt.Po ./$(DEPDIR)/encrypt-encrypt.Po \ ./$(DEPDIR)/ntester-ntester.Po ./$(DEPDIR)/parse-parse.Po \ ./$(DEPDIR)/termemu-termemu.Po am__mv = mv -f AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_@AM_V@) am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) am__v_CXX_0 = @echo " CXX " $@; am__v_CXX_1 = CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) am__v_CXXLD_0 = @echo " CXXLD " $@; am__v_CXXLD_1 = SOURCES = $(benchmark_SOURCES) $(decrypt_SOURCES) $(encrypt_SOURCES) \ $(ntester_SOURCES) $(parse_SOURCES) $(termemu_SOURCES) DIST_SOURCES = $(benchmark_SOURCES) $(decrypt_SOURCES) \ $(encrypt_SOURCES) $(ntester_SOURCES) $(parse_SOURCES) \ $(termemu_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac 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 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@ CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@ CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@ CPPFLAGS = @CPPFLAGS@ CRYPTO_CFLAGS = @CRYPTO_CFLAGS@ CRYPTO_LIBS = @CRYPTO_LIBS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CURSES_LIB = @CURSES_LIB@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FUZZING_CFLAGS = @FUZZING_CFLAGS@ GCOV = @GCOV@ GENHTML = @GENHTML@ HARDEN_CFLAGS = @HARDEN_CFLAGS@ HARDEN_LDFLAGS = @HARDEN_LDFLAGS@ HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LCOV = @LCOV@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MISC_CXXFLAGS = @MISC_CXXFLAGS@ MKDIR_P = @MKDIR_P@ Nettle_CFLAGS = @Nettle_CFLAGS@ Nettle_LIBS = @Nettle_LIBS@ OBJEXT = @OBJEXT@ OpenSSL_CFLAGS = @OpenSSL_CFLAGS@ OpenSSL_LIBS = @OpenSSL_LIBS@ 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@ PICKY_CXXFLAGS = @PICKY_CXXFLAGS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROTOC = @PROTOC@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TINFO_CFLAGS = @TINFO_CFLAGS@ TINFO_CPPFLAGS = @TINFO_CPPFLAGS@ TINFO_LDFLAGS = @TINFO_LDFLAGS@ TINFO_LIBS = @TINFO_LIBS@ VERSION = @VERSION@ WARNING_CXXFLAGS = @WARNING_CXXFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ completions = @completions@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ ifGNUmake = @ifGNUmake@ ifnGNUmake = @ifnGNUmake@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ protobuf_CFLAGS = @protobuf_CFLAGS@ protobuf_LIBS = @protobuf_LIBS@ 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@ AM_CXXFLAGS = $(WARNING_CXXFLAGS) $(PICKY_CXXFLAGS) $(HARDEN_CFLAGS) $(MISC_CXXFLAGS) AM_LDFLAGS = $(HARDEN_LDFLAGS) encrypt_SOURCES = encrypt.cc encrypt_CPPFLAGS = -I$(srcdir)/../crypto encrypt_LDADD = ../crypto/libmoshcrypto.a $(CRYPTO_LIBS) decrypt_SOURCES = decrypt.cc decrypt_CPPFLAGS = -I$(srcdir)/../crypto decrypt_LDADD = ../crypto/libmoshcrypto.a $(CRYPTO_LIBS) parse_SOURCES = parse.cc parse_CPPFLAGS = -I$(srcdir)/../terminal -I$(srcdir)/../util parse_LDADD = ../terminal/libmoshterminal.a ../util/libmoshutil.a termemu_SOURCES = termemu.cc termemu_CPPFLAGS = -I$(srcdir)/../terminal -I$(srcdir)/../util -I$(srcdir)/../statesync -I../protobufs termemu_LDADD = ../terminal/libmoshterminal.a ../util/libmoshutil.a ../statesync/libmoshstatesync.a ../protobufs/libmoshprotos.a $(TINFO_LIBS) $(protobuf_LIBS) ntester_SOURCES = ntester.cc ntester_CPPFLAGS = -I$(srcdir)/../util -I$(srcdir)/../statesync -I$(srcdir)/../terminal -I$(srcdir)/../network -I$(srcdir)/../crypto -I../protobufs $(protobuf_CFLAGS) ntester_LDADD = ../statesync/libmoshstatesync.a ../terminal/libmoshterminal.a ../network/libmoshnetwork.a ../crypto/libmoshcrypto.a ../protobufs/libmoshprotos.a ../util/libmoshutil.a -lm $(protobuf_LIBS) $(CRYPTO_LIBS) benchmark_SOURCES = benchmark.cc benchmark_CPPFLAGS = -I$(srcdir)/../util -I$(srcdir)/../statesync -I$(srcdir)/../terminal -I../protobufs -I$(srcdir)/../frontend -I$(srcdir)/../crypto -I$(srcdir)/../network $(protobuf_CFLAGS) benchmark_LDADD = ../frontend/terminaloverlay.o ../statesync/libmoshstatesync.a ../terminal/libmoshterminal.a ../protobufs/libmoshprotos.a ../network/libmoshnetwork.a ../crypto/libmoshcrypto.a ../util/libmoshutil.a $(STDDJB_LDFLAGS) -lm $(TINFO_LIBS) $(protobuf_LIBS) $(CRYPTO_LIBS) all: all-am .SUFFIXES: .SUFFIXES: .cc .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/examples/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/examples/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): clean-noinstPROGRAMS: -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) benchmark$(EXEEXT): $(benchmark_OBJECTS) $(benchmark_DEPENDENCIES) $(EXTRA_benchmark_DEPENDENCIES) @rm -f benchmark$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(benchmark_OBJECTS) $(benchmark_LDADD) $(LIBS) decrypt$(EXEEXT): $(decrypt_OBJECTS) $(decrypt_DEPENDENCIES) $(EXTRA_decrypt_DEPENDENCIES) @rm -f decrypt$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(decrypt_OBJECTS) $(decrypt_LDADD) $(LIBS) encrypt$(EXEEXT): $(encrypt_OBJECTS) $(encrypt_DEPENDENCIES) $(EXTRA_encrypt_DEPENDENCIES) @rm -f encrypt$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(encrypt_OBJECTS) $(encrypt_LDADD) $(LIBS) ntester$(EXEEXT): $(ntester_OBJECTS) $(ntester_DEPENDENCIES) $(EXTRA_ntester_DEPENDENCIES) @rm -f ntester$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(ntester_OBJECTS) $(ntester_LDADD) $(LIBS) parse$(EXEEXT): $(parse_OBJECTS) $(parse_DEPENDENCIES) $(EXTRA_parse_DEPENDENCIES) @rm -f parse$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(parse_OBJECTS) $(parse_LDADD) $(LIBS) termemu$(EXEEXT): $(termemu_OBJECTS) $(termemu_DEPENDENCIES) $(EXTRA_termemu_DEPENDENCIES) @rm -f termemu$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(termemu_OBJECTS) $(termemu_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/benchmark-benchmark.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decrypt-decrypt.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encrypt-encrypt.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntester-ntester.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse-parse.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/termemu-termemu.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .cc.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< .cc.obj: @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` benchmark-benchmark.o: benchmark.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(benchmark_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT benchmark-benchmark.o -MD -MP -MF $(DEPDIR)/benchmark-benchmark.Tpo -c -o benchmark-benchmark.o `test -f 'benchmark.cc' || echo '$(srcdir)/'`benchmark.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/benchmark-benchmark.Tpo $(DEPDIR)/benchmark-benchmark.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='benchmark.cc' object='benchmark-benchmark.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(benchmark_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o benchmark-benchmark.o `test -f 'benchmark.cc' || echo '$(srcdir)/'`benchmark.cc benchmark-benchmark.obj: benchmark.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(benchmark_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT benchmark-benchmark.obj -MD -MP -MF $(DEPDIR)/benchmark-benchmark.Tpo -c -o benchmark-benchmark.obj `if test -f 'benchmark.cc'; then $(CYGPATH_W) 'benchmark.cc'; else $(CYGPATH_W) '$(srcdir)/benchmark.cc'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/benchmark-benchmark.Tpo $(DEPDIR)/benchmark-benchmark.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='benchmark.cc' object='benchmark-benchmark.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(benchmark_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o benchmark-benchmark.obj `if test -f 'benchmark.cc'; then $(CYGPATH_W) 'benchmark.cc'; else $(CYGPATH_W) '$(srcdir)/benchmark.cc'; fi` decrypt-decrypt.o: decrypt.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(decrypt_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT decrypt-decrypt.o -MD -MP -MF $(DEPDIR)/decrypt-decrypt.Tpo -c -o decrypt-decrypt.o `test -f 'decrypt.cc' || echo '$(srcdir)/'`decrypt.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/decrypt-decrypt.Tpo $(DEPDIR)/decrypt-decrypt.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='decrypt.cc' object='decrypt-decrypt.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(decrypt_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o decrypt-decrypt.o `test -f 'decrypt.cc' || echo '$(srcdir)/'`decrypt.cc decrypt-decrypt.obj: decrypt.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(decrypt_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT decrypt-decrypt.obj -MD -MP -MF $(DEPDIR)/decrypt-decrypt.Tpo -c -o decrypt-decrypt.obj `if test -f 'decrypt.cc'; then $(CYGPATH_W) 'decrypt.cc'; else $(CYGPATH_W) '$(srcdir)/decrypt.cc'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/decrypt-decrypt.Tpo $(DEPDIR)/decrypt-decrypt.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='decrypt.cc' object='decrypt-decrypt.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(decrypt_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o decrypt-decrypt.obj `if test -f 'decrypt.cc'; then $(CYGPATH_W) 'decrypt.cc'; else $(CYGPATH_W) '$(srcdir)/decrypt.cc'; fi` encrypt-encrypt.o: encrypt.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(encrypt_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT encrypt-encrypt.o -MD -MP -MF $(DEPDIR)/encrypt-encrypt.Tpo -c -o encrypt-encrypt.o `test -f 'encrypt.cc' || echo '$(srcdir)/'`encrypt.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/encrypt-encrypt.Tpo $(DEPDIR)/encrypt-encrypt.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='encrypt.cc' object='encrypt-encrypt.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(encrypt_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o encrypt-encrypt.o `test -f 'encrypt.cc' || echo '$(srcdir)/'`encrypt.cc encrypt-encrypt.obj: encrypt.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(encrypt_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT encrypt-encrypt.obj -MD -MP -MF $(DEPDIR)/encrypt-encrypt.Tpo -c -o encrypt-encrypt.obj `if test -f 'encrypt.cc'; then $(CYGPATH_W) 'encrypt.cc'; else $(CYGPATH_W) '$(srcdir)/encrypt.cc'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/encrypt-encrypt.Tpo $(DEPDIR)/encrypt-encrypt.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='encrypt.cc' object='encrypt-encrypt.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(encrypt_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o encrypt-encrypt.obj `if test -f 'encrypt.cc'; then $(CYGPATH_W) 'encrypt.cc'; else $(CYGPATH_W) '$(srcdir)/encrypt.cc'; fi` ntester-ntester.o: ntester.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ntester_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ntester-ntester.o -MD -MP -MF $(DEPDIR)/ntester-ntester.Tpo -c -o ntester-ntester.o `test -f 'ntester.cc' || echo '$(srcdir)/'`ntester.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ntester-ntester.Tpo $(DEPDIR)/ntester-ntester.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ntester.cc' object='ntester-ntester.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ntester_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ntester-ntester.o `test -f 'ntester.cc' || echo '$(srcdir)/'`ntester.cc ntester-ntester.obj: ntester.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ntester_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ntester-ntester.obj -MD -MP -MF $(DEPDIR)/ntester-ntester.Tpo -c -o ntester-ntester.obj `if test -f 'ntester.cc'; then $(CYGPATH_W) 'ntester.cc'; else $(CYGPATH_W) '$(srcdir)/ntester.cc'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ntester-ntester.Tpo $(DEPDIR)/ntester-ntester.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ntester.cc' object='ntester-ntester.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ntester_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ntester-ntester.obj `if test -f 'ntester.cc'; then $(CYGPATH_W) 'ntester.cc'; else $(CYGPATH_W) '$(srcdir)/ntester.cc'; fi` parse-parse.o: parse.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(parse_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT parse-parse.o -MD -MP -MF $(DEPDIR)/parse-parse.Tpo -c -o parse-parse.o `test -f 'parse.cc' || echo '$(srcdir)/'`parse.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/parse-parse.Tpo $(DEPDIR)/parse-parse.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='parse.cc' object='parse-parse.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(parse_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o parse-parse.o `test -f 'parse.cc' || echo '$(srcdir)/'`parse.cc parse-parse.obj: parse.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(parse_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT parse-parse.obj -MD -MP -MF $(DEPDIR)/parse-parse.Tpo -c -o parse-parse.obj `if test -f 'parse.cc'; then $(CYGPATH_W) 'parse.cc'; else $(CYGPATH_W) '$(srcdir)/parse.cc'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/parse-parse.Tpo $(DEPDIR)/parse-parse.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='parse.cc' object='parse-parse.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(parse_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o parse-parse.obj `if test -f 'parse.cc'; then $(CYGPATH_W) 'parse.cc'; else $(CYGPATH_W) '$(srcdir)/parse.cc'; fi` termemu-termemu.o: termemu.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(termemu_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT termemu-termemu.o -MD -MP -MF $(DEPDIR)/termemu-termemu.Tpo -c -o termemu-termemu.o `test -f 'termemu.cc' || echo '$(srcdir)/'`termemu.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/termemu-termemu.Tpo $(DEPDIR)/termemu-termemu.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='termemu.cc' object='termemu-termemu.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(termemu_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o termemu-termemu.o `test -f 'termemu.cc' || echo '$(srcdir)/'`termemu.cc termemu-termemu.obj: termemu.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(termemu_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT termemu-termemu.obj -MD -MP -MF $(DEPDIR)/termemu-termemu.Tpo -c -o termemu-termemu.obj `if test -f 'termemu.cc'; then $(CYGPATH_W) 'termemu.cc'; else $(CYGPATH_W) '$(srcdir)/termemu.cc'; fi` @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/termemu-termemu.Tpo $(DEPDIR)/termemu-termemu.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='termemu.cc' object='termemu-termemu.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(termemu_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o termemu-termemu.obj `if test -f 'termemu.cc'; then $(CYGPATH_W) 'termemu.cc'; else $(CYGPATH_W) '$(srcdir)/termemu.cc'; fi` 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) installdirs: 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: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || 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 clean-noinstPROGRAMS mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/benchmark-benchmark.Po -rm -f ./$(DEPDIR)/decrypt-decrypt.Po -rm -f ./$(DEPDIR)/encrypt-encrypt.Po -rm -f ./$(DEPDIR)/ntester-ntester.Po -rm -f ./$(DEPDIR)/parse-parse.Po -rm -f ./$(DEPDIR)/termemu-termemu.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-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)/benchmark-benchmark.Po -rm -f ./$(DEPDIR)/decrypt-decrypt.Po -rm -f ./$(DEPDIR)/encrypt-encrypt.Po -rm -f ./$(DEPDIR)/ntester-ntester.Po -rm -f ./$(DEPDIR)/parse-parse.Po -rm -f ./$(DEPDIR)/termemu-termemu.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: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ 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-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 \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .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: �����������������������������������������������������������������������������������������������mosh-1.4.0/src/examples/parse.cc��������������������������������������������������������������������0000664�0001750�0001750�00000012636�14174450057�013452� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 <http://www.gnu.org/licenses/>. In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include "config.h" #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <signal.h> #include <errno.h> #include <string.h> #include <locale.h> #include <wchar.h> #include <assert.h> #include <wctype.h> #include <typeinfo> #include <termios.h> #if HAVE_PTY_H #include <pty.h> #elif HAVE_UTIL_H #include <util.h> #elif HAVE_LIBUTIL_H #include <libutil.h> #endif #include "parser.h" #include "swrite.h" #include "locale_utils.h" #include "fatal_assert.h" #include "pty_compat.h" #include "select.h" const size_t buf_size = 1024; static void emulate_terminal( int fd ); static int copy( int src, int dest ); static int vt_parser( int fd, Parser::UTF8Parser *parser ); int main( int argc __attribute__((unused)), char *argv[] __attribute__((unused)), char *envp[] ) { int master; struct termios saved_termios, raw_termios, child_termios; set_native_locale(); fatal_assert( is_utf8_locale() ); if ( tcgetattr( STDIN_FILENO, &saved_termios ) < 0 ) { perror( "tcgetattr" ); exit( 1 ); } child_termios = saved_termios; #ifdef HAVE_IUTF8 if ( !(child_termios.c_iflag & IUTF8) ) { fprintf( stderr, "Warning: Locale is UTF-8 but termios IUTF8 flag not set. Setting IUTF8 flag.\n" ); child_termios.c_iflag |= IUTF8; } #else fprintf( stderr, "Warning: termios IUTF8 flag not defined. Character-erase of multibyte character sequence probably does not work properly on this platform.\n" ); #endif /* HAVE_IUTF8 */ pid_t child = forkpty( &master, NULL, &child_termios, NULL ); if ( child == -1 ) { perror( "forkpty" ); exit( 1 ); } if ( child == 0 ) { /* child */ char *my_argv[ 2 ]; my_argv[ 0 ] = strdup( "/bin/bash" ); assert( my_argv[ 0 ] ); my_argv[ 1 ] = NULL; if ( execve( "/bin/bash", my_argv, envp ) < 0 ) { perror( "execve" ); exit( 1 ); } exit( 0 ); } else { /* parent */ raw_termios = saved_termios; cfmakeraw( &raw_termios ); if ( tcsetattr( STDIN_FILENO, TCSANOW, &raw_termios ) < 0 ) { perror( "tcsetattr" ); exit( 1 ); } emulate_terminal( master ); if ( tcsetattr( STDIN_FILENO, TCSANOW, &saved_termios ) < 0 ) { perror( "tcsetattr" ); exit( 1 ); } } return 0; } static void emulate_terminal( int fd ) { Parser::UTF8Parser parser; Select &sel = Select::get_instance(); sel.add_fd( STDIN_FILENO ); sel.add_fd( fd ); while ( 1 ) { int active_fds = sel.select( -1 ); if ( active_fds <= 0 ) { perror( "select" ); return; } if ( sel.read( STDIN_FILENO ) ) { if ( copy( STDIN_FILENO, fd ) < 0 ) { return; } } else if ( sel.read( fd ) ) { if ( vt_parser( fd, &parser ) < 0 ) { return; } } else { fprintf( stderr, "select mysteriously woken up\n" ); } } } static int copy( int src, int dest ) { char buf[ buf_size ]; ssize_t bytes_read = read( src, buf, buf_size ); if ( bytes_read == 0 ) { /* EOF */ return -1; } else if ( bytes_read < 0 ) { perror( "read" ); return -1; } return swrite( dest, buf, bytes_read ); } static int vt_parser( int fd, Parser::UTF8Parser *parser ) { char buf[ buf_size ]; /* fill buffer if possible */ ssize_t bytes_read = read( fd, buf, buf_size ); if ( bytes_read == 0 ) { /* EOF */ return -1; } else if ( bytes_read < 0 ) { perror( "read" ); return -1; } /* feed to parser */ Parser::Actions actions; for ( int i = 0; i < bytes_read; i++ ) { parser->input( buf[ i ], actions ); for ( Parser::Actions::iterator j = actions.begin(); j != actions.end(); j++ ) { assert( *j ); Parser::Action &act = **j; if ( act.char_present ) { if ( iswprint( act.ch ) ) { printf( "%s(0x%02x=%lc) ", act.name().c_str(), (unsigned int)act.ch, (wint_t)act.ch ); } else { printf( "%s(0x%02x) ", act.name().c_str(), (unsigned int)act.ch ); } } else { printf( "[%s] ", act.name().c_str() ); } fflush( stdout ); } actions.clear(); } return 0; } ��������������������������������������������������������������������������������������������������mosh-1.4.0/src/examples/benchmark.cc����������������������������������������������������������������0000644�0001750�0001750�00000007364�13103401307�014253� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 <http://www.gnu.org/licenses/>. In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include "config.h" #include <errno.h> #include <locale.h> #include <string.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <sys/ioctl.h> #include <sys/types.h> #include <pwd.h> #include <signal.h> #include <time.h> #include <limits.h> #include <exception> #if HAVE_PTY_H #include <pty.h> #elif HAVE_UTIL_H #include <util.h> #endif #include "swrite.h" #include "completeterminal.h" #include "user.h" #include "terminaloverlay.h" #include "locale_utils.h" #include "fatal_assert.h" const int ITERATIONS = 100000; using namespace Terminal; int main( int argc, char **argv ) { try { int fbmod = 0; int width = 80, height = 24; int iterations = ITERATIONS; if (argc > 1) { iterations = atoi(argv[1]); if (iterations < 1 || iterations > 1000000000) { fprintf(stderr, "bogus iteration count\n"); exit(1); } } if (argc > 3) { width = atoi(argv[2]); height = atoi(argv[3]); if (width < 1 || width > 1000 || height < 1 || height > 1000) { fprintf(stderr, "bogus window size\n"); exit(1); } } Framebuffer local_framebuffers[ 2 ] = { Framebuffer(width,height), Framebuffer(width,height) }; Framebuffer *local_framebuffer = &(local_framebuffers[ fbmod ]); Framebuffer *new_state = &(local_framebuffers[ !fbmod ]); Overlay::OverlayManager overlays; Display display( true ); Complete local_terminal( width, height ); /* Adopt native locale */ set_native_locale(); fatal_assert( is_utf8_locale() ); for ( int i = 0; i < iterations; i++ ) { /* type a character */ overlays.get_prediction_engine().new_user_byte( i + 'x', *local_framebuffer ); /* fetch target state */ *new_state = local_terminal.get_fb(); /* apply local overlays */ overlays.apply( *new_state ); /* calculate minimal difference from where we are */ const string diff( display.new_frame( false, *local_framebuffer, *new_state ) ); /* make sure to use diff */ if ( diff.size() > INT_MAX ) { exit( 1 ); } fbmod = !fbmod; local_framebuffer = &(local_framebuffers[ fbmod ]); new_state = &(local_framebuffers[ !fbmod ]); } } catch ( const std::exception &e ) { fprintf( stderr, "Exception caught: %s\n", e.what() ); return 1; } return 0; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mosh-1.4.0/src/examples/encrypt.cc������������������������������������������������������������������0000664�0001750�0001750�00000004223�14174450057�014015� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 <http://www.gnu.org/licenses/>. In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include <stdio.h> #include <iostream> #include <sstream> #include "crypto.h" using namespace Crypto; int main( int argc, char *argv[] ) { if ( argc != 2 ) { fprintf( stderr, "Usage: %s NONCE\n", argv[ 0 ] ); return 1; } try { Base64Key key; Session session( key ); Nonce nonce( myatoi( argv[ 1 ] ) ); /* Read input */ std::ostringstream input; input << std::cin.rdbuf(); /* Encrypt message */ string ciphertext = session.encrypt( Message( nonce, input.str() ) ); std::cerr << "Key: " << key.printable_key() << std::endl; std::cout << ciphertext; } catch ( const CryptoException &e ) { std::cerr << e.what() << std::endl; exit( 1 ); } return 0; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mosh-1.4.0/src/examples/termemu.cc������������������������������������������������������������������0000664�0001750�0001750�00000021042�14174450057�014005� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 <http://www.gnu.org/licenses/>. In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include "config.h" #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <signal.h> #include <errno.h> #include <string.h> #include <locale.h> #include <wchar.h> #include <assert.h> #include <wctype.h> #include <typeinfo> #include <sys/ioctl.h> #include <sys/stat.h> #include <fcntl.h> #include <termios.h> #include <sys/types.h> #include <pwd.h> #include <sys/time.h> #include <exception> #if HAVE_PTY_H #include <pty.h> #elif HAVE_UTIL_H #include <util.h> #elif HAVE_LIBUTIL_H #include <libutil.h> #endif #include "parser.h" #include "completeterminal.h" #include "swrite.h" #include "fatal_assert.h" #include "pty_compat.h" #include "locale_utils.h" #include "select.h" const size_t buf_size = 16384; static void emulate_terminal( int fd ); int main( int argc, char *argv[] ) { int master; struct termios saved_termios, raw_termios, child_termios; set_native_locale(); fatal_assert( is_utf8_locale() ); if ( tcgetattr( STDIN_FILENO, &saved_termios ) < 0 ) { perror( "tcgetattr" ); exit( 1 ); } child_termios = saved_termios; #ifdef HAVE_IUTF8 if ( !(child_termios.c_iflag & IUTF8) ) { fprintf( stderr, "Warning: Locale is UTF-8 but termios IUTF8 flag not set. Setting IUTF8 flag.\n" ); child_termios.c_iflag |= IUTF8; } #else fprintf( stderr, "Warning: termios IUTF8 flag not defined. Character-erase of multibyte character sequence probably does not work properly on this platform.\n" ); #endif /* HAVE_IUTF8 */ pid_t child = forkpty( &master, NULL, &child_termios, NULL ); if ( child == -1 ) { perror( "forkpty" ); exit( 1 ); } if ( child == 0 ) { /* child */ if ( setenv( "TERM", "xterm-256color", true ) < 0 ) { perror( "setenv" ); exit( 1 ); } /* ask ncurses to send UTF-8 instead of ISO 2022 for line-drawing chars */ if ( setenv( "NCURSES_NO_UTF8_ACS", "1", true ) < 0 ) { perror( "setenv" ); exit( 1 ); } char *my_argv[ 2 ]; if ( argc > 1 ) { argv++; } else { /* get shell name */ my_argv[ 0 ] = getenv( "SHELL" ); if ( my_argv[ 0 ] == NULL || *my_argv[ 0 ] == '\0' ) { struct passwd *pw = getpwuid( getuid() ); if ( pw == NULL ) { perror( "getpwuid" ); exit( 1 ); } my_argv[ 0 ] = strdup( pw->pw_shell ); } assert( my_argv[ 0 ] ); my_argv[ 1 ] = NULL; argv = my_argv; } if ( execvp( argv[ 0 ], argv ) < 0 ) { perror( "execve" ); exit( 1 ); } exit( 0 ); } else { /* parent */ raw_termios = saved_termios; cfmakeraw( &raw_termios ); if ( tcsetattr( STDIN_FILENO, TCSANOW, &raw_termios ) < 0 ) { perror( "tcsetattr" ); exit( 1 ); } try { emulate_terminal( master ); } catch ( const std::exception &e ) { fprintf( stderr, "\r\nException caught: %s\r\n", e.what() ); } if ( tcsetattr( STDIN_FILENO, TCSANOW, &saved_termios ) < 0 ) { perror( "tcsetattr" ); exit( 1 ); } } printf( "[stm is exiting.]\n" ); return 0; } /* Print a frame if the last frame was more than 1/50 seconds ago */ static bool tick( Terminal::Framebuffer &state, Terminal::Framebuffer &new_frame, const Terminal::Display &display ) { static bool initialized = false; static struct timeval last_time; struct timeval this_time; if ( gettimeofday( &this_time, NULL ) < 0 ) { perror( "gettimeofday" ); } double diff = (this_time.tv_sec - last_time.tv_sec) + .000001 * (this_time.tv_usec - last_time.tv_usec); if ( (!initialized) || (diff >= 0.02) ) { std::string update = display.new_frame( initialized, state, new_frame ); swrite( STDOUT_FILENO, update.c_str() ); state = new_frame; initialized = true; last_time = this_time; return true; } return false; } /* This is the main loop. 1. New bytes from the user get applied to the terminal emulator as "UserByte" actions. 2. New bytes from the host get sent to the Parser, and then those actions are applied to the terminal. 3. Resize events (from a SIGWINCH signal) get turned into "Resize" actions and applied to the terminal. At every event from select(), we run the tick() function to possibly print a new frame (if we haven't printed one in the last 1/50 second). The new frames are "differential" -- they assume the previous frame was sent to the real terminal. */ static void emulate_terminal( int fd ) { /* get current window size */ struct winsize window_size; if ( ioctl( STDIN_FILENO, TIOCGWINSZ, &window_size ) < 0 ) { perror( "ioctl TIOCGWINSZ" ); return; } /* tell child process */ if ( ioctl( fd, TIOCSWINSZ, &window_size ) < 0 ) { perror( "ioctl TIOCSWINSZ" ); return; } /* open parser and terminal */ Terminal::Complete complete( window_size.ws_col, window_size.ws_row ); Terminal::Framebuffer state( window_size.ws_col, window_size.ws_row ); /* open display */ Terminal::Display display( true ); /* use TERM to initialize */ Select &sel = Select::get_instance(); sel.add_fd( STDIN_FILENO ); sel.add_fd( fd ); sel.add_signal( SIGWINCH ); swrite( STDOUT_FILENO, display.open().c_str() ); int timeout = -1; while ( 1 ) { int active_fds = sel.select( timeout ); if ( active_fds < 0 ) { perror( "select" ); break; } if ( sel.read( STDIN_FILENO ) ) { /* input from user */ char buf[ buf_size ]; /* fill buffer if possible */ ssize_t bytes_read = read( STDIN_FILENO, buf, buf_size ); if ( bytes_read == 0 ) { /* EOF */ return; } else if ( bytes_read < 0 ) { perror( "read" ); return; } std::string terminal_to_host; for ( int i = 0; i < bytes_read; i++ ) { terminal_to_host += complete.act( Parser::UserByte( buf[ i ] ) ); } if ( swrite( fd, terminal_to_host.c_str(), terminal_to_host.length() ) < 0 ) { break; } } else if ( sel.read( fd ) ) { /* input from host */ char buf[ buf_size ]; /* fill buffer if possible */ ssize_t bytes_read = read( fd, buf, buf_size ); if ( bytes_read == 0 ) { /* EOF */ return; } else if ( bytes_read < 0 ) { perror( "read" ); return; } std::string terminal_to_host = complete.act( std::string( buf, bytes_read ) ); if ( swrite( fd, terminal_to_host.c_str(), terminal_to_host.length() ) < 0 ) { break; } } else if ( sel.signal( SIGWINCH ) ) { /* get new size */ if ( ioctl( STDIN_FILENO, TIOCGWINSZ, &window_size ) < 0 ) { perror( "ioctl TIOCGWINSZ" ); return; } /* tell emulator */ complete.act( Parser::Resize( window_size.ws_col, window_size.ws_row ) ); /* tell child process */ if ( ioctl( fd, TIOCSWINSZ, &window_size ) < 0 ) { perror( "ioctl TIOCSWINSZ" ); return; } } Terminal::Framebuffer new_frame( complete.get_fb() ); if ( tick( state, new_frame, display ) ) { /* there was a frame */ timeout = -1; } else { timeout = 20; } } std::string update = display.new_frame( true, state, complete.get_fb() ); swrite( STDOUT_FILENO, update.c_str() ); swrite( STDOUT_FILENO, display.close().c_str() ); } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mosh-1.4.0/src/examples/Makefile.am�����������������������������������������������������������������0000644�0001750�0001750�00000003460�13145365374�014062� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������AM_CXXFLAGS = $(WARNING_CXXFLAGS) $(PICKY_CXXFLAGS) $(HARDEN_CFLAGS) $(MISC_CXXFLAGS) AM_LDFLAGS = $(HARDEN_LDFLAGS) if BUILD_EXAMPLES noinst_PROGRAMS = encrypt decrypt ntester parse termemu benchmark endif encrypt_SOURCES = encrypt.cc encrypt_CPPFLAGS = -I$(srcdir)/../crypto encrypt_LDADD = ../crypto/libmoshcrypto.a $(CRYPTO_LIBS) decrypt_SOURCES = decrypt.cc decrypt_CPPFLAGS = -I$(srcdir)/../crypto decrypt_LDADD = ../crypto/libmoshcrypto.a $(CRYPTO_LIBS) parse_SOURCES = parse.cc parse_CPPFLAGS = -I$(srcdir)/../terminal -I$(srcdir)/../util parse_LDADD = ../terminal/libmoshterminal.a ../util/libmoshutil.a termemu_SOURCES = termemu.cc termemu_CPPFLAGS = -I$(srcdir)/../terminal -I$(srcdir)/../util -I$(srcdir)/../statesync -I../protobufs termemu_LDADD = ../terminal/libmoshterminal.a ../util/libmoshutil.a ../statesync/libmoshstatesync.a ../protobufs/libmoshprotos.a $(TINFO_LIBS) $(protobuf_LIBS) ntester_SOURCES = ntester.cc ntester_CPPFLAGS = -I$(srcdir)/../util -I$(srcdir)/../statesync -I$(srcdir)/../terminal -I$(srcdir)/../network -I$(srcdir)/../crypto -I../protobufs $(protobuf_CFLAGS) ntester_LDADD = ../statesync/libmoshstatesync.a ../terminal/libmoshterminal.a ../network/libmoshnetwork.a ../crypto/libmoshcrypto.a ../protobufs/libmoshprotos.a ../util/libmoshutil.a -lm $(protobuf_LIBS) $(CRYPTO_LIBS) benchmark_SOURCES = benchmark.cc benchmark_CPPFLAGS = -I$(srcdir)/../util -I$(srcdir)/../statesync -I$(srcdir)/../terminal -I../protobufs -I$(srcdir)/../frontend -I$(srcdir)/../crypto -I$(srcdir)/../network $(protobuf_CFLAGS) benchmark_LDADD = ../frontend/terminaloverlay.o ../statesync/libmoshstatesync.a ../terminal/libmoshterminal.a ../protobufs/libmoshprotos.a ../network/libmoshnetwork.a ../crypto/libmoshcrypto.a ../util/libmoshutil.a $(STDDJB_LDFLAGS) -lm $(TINFO_LIBS) $(protobuf_LIBS) $(CRYPTO_LIBS) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mosh-1.4.0/src/examples/ntester.cc������������������������������������������������������������������0000664�0001750�0001750�00000011345�14174450057�014020� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 <http://www.gnu.org/licenses/>. In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include <termios.h> #include <unistd.h> #include "user.h" #include "fatal_assert.h" #include "pty_compat.h" #include "networktransport-impl.h" #include "select.h" #include "shared.h" using namespace Network; int main( int argc, char *argv[] ) { bool server = true; char *key; char *ip; char *port; UserStream me, remote; typedef shared::shared_ptr<Transport<UserStream, UserStream> > NetworkPointer; Transport<UserStream, UserStream> *raw_n; try { if ( argc > 1 ) { server = false; /* client */ key = argv[ 1 ]; ip = argv[ 2 ]; port = argv[ 3 ]; raw_n = new Transport<UserStream, UserStream>( me, remote, key, ip, port ); } else { raw_n = new Transport<UserStream, UserStream>( me, remote, NULL, NULL ); } } catch ( const std::exception &e ) { fprintf( stderr, "Fatal startup error: %s\n", e.what() ); exit( 1 ); } NetworkPointer n( raw_n ); fprintf( stderr, "Port bound is %s, key is %s\n", n->port().c_str(), n->get_key().c_str() ); if ( server ) { Select &sel = Select::get_instance(); uint64_t last_num = n->get_remote_state_num(); while ( true ) { try { sel.clear_fds(); std::vector< int > fd_list( n->fds() ); assert( fd_list.size() == 1 ); /* servers don't hop */ int network_fd = fd_list.back(); sel.add_fd( network_fd ); if ( sel.select( n->wait_time() ) < 0 ) { perror( "select" ); exit( 1 ); } n->tick(); if ( sel.read( network_fd ) ) { n->recv(); if ( n->get_remote_state_num() != last_num ) { fprintf( stderr, "[%d=>%d %s]", (int)last_num, (int)n->get_remote_state_num(), n->get_remote_diff().c_str() ); last_num = n->get_remote_state_num(); } } } catch ( const std::exception &e ) { fprintf( stderr, "Server error: %s\n", e.what() ); } } } else { struct termios saved_termios; struct termios the_termios; if ( tcgetattr( STDIN_FILENO, &the_termios ) < 0 ) { perror( "tcgetattr" ); exit( 1 ); } saved_termios = the_termios; cfmakeraw( &the_termios ); if ( tcsetattr( STDIN_FILENO, TCSANOW, &the_termios ) < 0 ) { perror( "tcsetattr" ); exit( 1 ); } Select &sel = Select::get_instance(); while( true ) { sel.clear_fds(); sel.add_fd( STDIN_FILENO ); std::vector< int > fd_list( n->fds() ); for ( std::vector< int >::const_iterator it = fd_list.begin(); it != fd_list.end(); it++ ) { sel.add_fd( *it ); } try { if ( sel.select( n->wait_time() ) < 0 ) { perror( "select" ); } n->tick(); if ( sel.read( STDIN_FILENO ) ) { char x; fatal_assert( read( STDIN_FILENO, &x, 1 ) == 1 ); n->get_current_state().push_back( Parser::UserByte( x ) ); } bool network_ready_to_read = false; for ( std::vector< int >::const_iterator it = fd_list.begin(); it != fd_list.end(); it++ ) { if ( sel.read( *it ) ) { /* packet received from the network */ /* we only read one socket each run */ network_ready_to_read = true; } } if ( network_ready_to_read ) { n->recv(); } } catch ( const std::exception &e ) { fprintf( stderr, "Client error: %s\n", e.what() ); } } if ( tcsetattr( STDIN_FILENO, TCSANOW, &saved_termios ) < 0 ) { perror( "tcsetattr" ); exit( 1 ); } } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mosh-1.4.0/src/examples/decrypt.cc������������������������������������������������������������������0000664�0001750�0001750�00000004156�14174450057�014010� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* Mosh: the mobile shell Copyright 2012 Keith Winstein 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 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 <http://www.gnu.org/licenses/>. In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. */ #include <stdio.h> #include <iostream> #include <sstream> #include "crypto.h" using namespace Crypto; int main( int argc, char *argv[] ) { if ( argc != 2 ) { fprintf( stderr, "Usage: %s KEY\n", argv[ 0 ] ); return 1; } try { Base64Key key( argv[ 1 ] ); Session session( key ); /* Read input */ std::ostringstream input; input << std::cin.rdbuf(); /* Decrypt message */ Message message = session.decrypt( input.str() ); fprintf( stderr, "Nonce = %ld\n", (long)message.nonce.val() ); std::cout << message.text; } catch ( const CryptoException &e ) { std::cerr << e.what() << std::endl; exit( 1 ); } return 0; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mosh-1.4.0/m4/��������������������������������������������������������������������������������������0000775�0001750�0001750�00000000000�14327736673�010027� 5����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������mosh-1.4.0/m4/ax_check_library.m4�������������������������������������������������������������������0000644�0001750�0001750�00000007321�13103401307�013451� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_check_library.html # =========================================================================== # # SYNOPSIS # # AX_CHECK_LIBRARY(VARIABLE-PREFIX, HEADER-FILE, LIBRARY-FILE, # [ACTION-IF-FOUND], [ACTION-IF-NOT_FOUND]) # # DESCRIPTION # # Provides a generic test for a given library, similar in concept to the # PKG_CHECK_MODULES macro used by pkg-config. # # Most simplest libraries can be checked against simply through the # presence of a header file and a library to link to. This macro allows to # wrap around the test so that it doesn't have to be recreated each time. # # Rather than define --with-$LIBRARY arguments, it uses variables in the # same way that PKG_CHECK_MODULES does. It doesn't, though, use the same # names, since you shouldn't provide a value for LIBS or CFLAGS but rather # for LDFLAGS and CPPFLAGS, to tell the linker and compiler where to find # libraries and headers respectively. # # If the library is find, HAVE_PREFIX is defined, and in all cases # PREFIX_LDFLAGS and PREFIX_CPPFLAGS are substituted. # # Example: # # AX_CHECK_LIBRARY([LIBEVENT], [event.h], [event], [], # [AC_MSG_ERROR([Unable to find libevent])]) # # LICENSE # # Copyright (c) 2010 Diego Elio Petteno` <flameeyes@gmail.com> # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation, either version 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 <http://www.gnu.org/licenses/>. # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure # scripts that are the output of Autoconf when processing the Macro. You # need not follow the terms of the GNU General Public License when using # or distributing such scripts, even though portions of the text of the # Macro appear in them. The GNU General Public License (GPL) does govern # all other use of the material that constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the Autoconf # Macro released by the Autoconf Archive. When you make and distribute a # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. #serial 4 AC_DEFUN([AX_CHECK_LIBRARY], [ AC_ARG_VAR($1[_CPPFLAGS], [C preprocessor flags for ]$1[ headers]) AC_ARG_VAR($1[_LDFLAGS], [linker flags for ]$1[ libraries]) AC_CACHE_VAL(AS_TR_SH([ax_cv_have_]$1), [save_CPPFLAGS="$CPPFLAGS" save_LDFLAGS="$LDFLAGS" save_LIBS="$LIBS" AS_IF([test "x$]$1[_CPPFLAGS" != "x"], [CPPFLAGS="$CPPFLAGS $]$1[_CPPFLAGS"]) AS_IF([test "x$]$1[_LDFLAGS" != "x"], [LDFLAGS="$LDFLAGS $]$1[_LDFLAGS"]) AC_CHECK_HEADER($2, [ AC_CHECK_LIB($3, [main], [AS_TR_SH([ax_cv_have_]$1)=yes], [AS_TR_SH([ax_cv_have_]$1)=no]) ], [AS_TR_SH([ax_cv_have_]$1)=no]) CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ]) AS_IF([test "$]AS_TR_SH([ax_cv_have_]$1)[" = "yes"], AC_DEFINE([HAVE_]$1, [1], [Define to 1 if ]$1[ is found]) [$4], [$5]) ]) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mosh-1.4.0/m4/ax_add_am_macro_static.m4�������������������������������������������������������������0000664�0001750�0001750�00000001525�14272621034�014620� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_add_am_macro_static.html # =========================================================================== # # SYNOPSIS # # AX_ADD_AM_MACRO_STATIC([RULE]) # # DESCRIPTION # # Adds the specified rule to $AMINCLUDE. # # LICENSE # # Copyright (c) 2009 Tom Howard <tomhoward@users.sf.net> # Copyright (c) 2009 Allan Caffee <allan.caffee@gmail.com> # # 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_ADD_AM_MACRO_STATIC],[ AC_REQUIRE([AX_AM_MACROS_STATIC]) AX_AC_APPEND_TO_FILE(AMINCLUDE_STATIC,[$1]) ]) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������mosh-1.4.0/m4/ax_check_link_flag.m4�����������������������������������������������������������������0000644�0001750�0001750�00000005760�13103401307�013740� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html # =========================================================================== # # SYNOPSIS # # AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS]) # # DESCRIPTION # # Check whether the given FLAG works with the linker 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 linker's default flags # when the check is done. The check is thus made with the flags: "LDFLAGS # EXTRA-FLAGS FLAG". This can for example be used to force the linker to # issue an error when a bad flag is given. # # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this # macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG. # # LICENSE # # Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de> # Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com> # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation, either version 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 <http://www.gnu.org/licenses/>. # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure # scripts that are the output of Autoconf when processing the Macro. You # need not follow the terms of the GNU General Public License when using # or distributing such scripts, even though portions of the text of the # Macro appear in them. The GNU General Public License (GPL) does govern # all other use of the material that constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the Autoconf # Macro released by the Autoconf Archive. When you make and distribute a # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. #serial 2 AC_DEFUN([AX_CHECK_LINK_FLAG], [AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [ ax_check_save_flags=$LDFLAGS LDFLAGS="$LDFLAGS $4 $1" AC_LINK_IFELSE([AC_LANG_PROGRAM()], [AS_VAR_SET(CACHEVAR,[yes])], [AS_VAR_SET(CACHEVAR,[no])]) LDFLAGS=$ax_check_save_flags]) AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes], [m4_default([$2], :)], [m4_default([$3], :)]) AS_VAR_POPDEF([CACHEVAR])dnl ])dnl AX_CHECK_LINK_FLAGS ����������������mosh-1.4.0/m4/ax_cxx_compile_stdcxx.m4��������������������������������������������������������������0000664�0001750�0001750�00000045456�14174450057�014613� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html # =========================================================================== # # SYNOPSIS # # AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional]) # # DESCRIPTION # # Check for baseline language coverage in the compiler for the specified # version of the C++ standard. If necessary, add switches to CXX and # CXXCPP to enable support. VERSION may be '11' (for the C++11 standard) # or '14' (for the C++14 standard). # # The second argument, if specified, indicates whether you insist on an # extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. # -std=c++11). If neither is specified, you get whatever works, with # preference for an extended mode. # # The third argument, if specified 'mandatory' or if left unspecified, # indicates that baseline support for the specified C++ standard is # required and that the macro should error out if no mode with that # support is found. If specified 'optional', then configuration proceeds # regardless, after defining HAVE_CXX${VERSION} if and only if a # supporting mode is found. # # LICENSE # # Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com> # Copyright (c) 2012 Zack Weinberg <zackw@panix.com> # Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu> # Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com> # Copyright (c) 2015 Paul Norman <penorman@mac.com> # Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu> # Copyright (c) 2016, 2018 Krzesimir Nowak <qdlacz@gmail.com> # # 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 10 dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro dnl (serial version number 13). AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"], [$1], [14], [ax_cxx_compile_alternatives="14 1y"], [$1], [17], [ax_cxx_compile_alternatives="17 1z"], [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl m4_if([$2], [], [], [$2], [ext], [], [$2], [noext], [], [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true], [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true], [$3], [optional], [ax_cxx_compile_cxx$1_required=false], [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])]) AC_LANG_PUSH([C++])dnl ac_success=no m4_if([$2], [noext], [], [dnl if test x$ac_success = xno; then for alternative in ${ax_cxx_compile_alternatives}; do switch="-std=gnu++${alternative}" cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, $cachevar, [ac_save_CXX="$CXX" CXX="$CXX $switch" AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], [eval $cachevar=yes], [eval $cachevar=no]) CXX="$ac_save_CXX"]) if eval test x\$$cachevar = xyes; then CXX="$CXX $switch" if test -n "$CXXCPP" ; then CXXCPP="$CXXCPP $switch" fi ac_success=yes break fi done fi]) m4_if([$2], [ext], [], [dnl if test x$ac_success = xno; then dnl HP's aCC needs +std=c++11 according to: dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf dnl Cray's crayCC needs "-h std=c++11" for alternative in ${ax_cxx_compile_alternatives}; do for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, $cachevar, [ac_save_CXX="$CXX" CXX="$CXX $switch" AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], [eval $cachevar=yes], [eval $cachevar=no]) CXX="$ac_save_CXX"]) if eval test x\$$cachevar = xyes; then CXX="$CXX $switch" if test -n "$CXXCPP" ; then CXXCPP="$CXXCPP $switch" fi ac_success=yes break fi done if test x$ac_success = xyes; then break fi done fi]) AC_LANG_POP([C++]) if test x$ax_cxx_compile_cxx$1_required = xtrue; then if test x$ac_success = xno; then AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.]) fi fi if test x$ac_success = xno; then HAVE_CXX$1=0 AC_MSG_NOTICE([No compiler with C++$1 support was found]) else HAVE_CXX$1=1 AC_DEFINE(HAVE_CXX$1,1, [define if the compiler supports basic C++$1 syntax]) fi AC_SUBST(HAVE_CXX$1) ]) dnl Test body for checking C++11 support m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11], _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 ) dnl Test body for checking C++14 support m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14], _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 ) m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17], _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 _AX_CXX_COMPILE_STDCXX_testbody_new_in_17 ) dnl Tests for new features in C++11 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[ // If the compiler admits that it is not ready for C++11, why torture it? // Hopefully, this will speed up the test. #ifndef __cplusplus #error "This is not a C++ compiler" #elif __cplusplus < 201103L #error "This is not a C++11 compiler" #else namespace cxx11 { namespace test_static_assert { template <typename T> struct check { static_assert(sizeof(int) <= sizeof(T), "not big enough"); }; } namespace test_final_override { struct Base { virtual void f() {} }; struct Derived : public Base { virtual void f() override {} }; } namespace test_double_right_angle_brackets { template < typename T > struct check {}; typedef check<void> single_type; typedef check<check<void>> double_type; typedef check<check<check<void>>> triple_type; typedef check<check<check<check<void>>>> quadruple_type; } namespace test_decltype { int f() { int a = 1; decltype(a) b = 2; return a + b; } } namespace test_type_deduction { template < typename T1, typename T2 > struct is_same { static const bool value = false; }; template < typename T > struct is_same<T, T> { static const bool value = true; }; template < typename T1, typename T2 > auto add(T1 a1, T2 a2) -> decltype(a1 + a2) { return a1 + a2; } int test(const int c, volatile int v) { static_assert(is_same<int, decltype(0)>::value == true, ""); static_assert(is_same<int, decltype(c)>::value == false, ""); static_assert(is_same<int, decltype(v)>::value == false, ""); auto ac = c; auto av = v; auto sumi = ac + av + 'x'; auto sumf = ac + av + 1.0; static_assert(is_same<int, decltype(ac)>::value == true, ""); static_assert(is_same<int, decltype(av)>::value == true, ""); static_assert(is_same<int, decltype(sumi)>::value == true, ""); static_assert(is_same<int, decltype(sumf)>::value == false, ""); static_assert(is_same<int, decltype(add(c, v))>::value == true, ""); return (sumf > 0.0) ? sumi : add(c, v); } } namespace test_noexcept { int f() { return 0; } int g() noexcept { return 0; } static_assert(noexcept(f()) == false, ""); static_assert(noexcept(g()) == true, ""); } namespace test_constexpr { template < typename CharT > unsigned long constexpr strlen_c_r(const CharT *const s, const unsigned long acc) noexcept { return *s ? strlen_c_r(s + 1, acc + 1) : acc; } template < typename CharT > unsigned long constexpr strlen_c(const CharT *const s) noexcept { return strlen_c_r(s, 0UL); } static_assert(strlen_c("") == 0UL, ""); static_assert(strlen_c("1") == 1UL, ""); static_assert(strlen_c("example") == 7UL, ""); static_assert(strlen_c("another\0example") == 7UL, ""); } namespace test_rvalue_references { template < int N > struct answer { static constexpr int value = N; }; answer<1> f(int&) { return answer<1>(); } answer<2> f(const int&) { return answer<2>(); } answer<3> f(int&&) { return answer<3>(); } void test() { int i = 0; const int c = 0; static_assert(decltype(f(i))::value == 1, ""); static_assert(decltype(f(c))::value == 2, ""); static_assert(decltype(f(0))::value == 3, ""); } } namespace test_uniform_initialization { struct test { static const int zero {}; static const int one {1}; }; static_assert(test::zero == 0, ""); static_assert(test::one == 1, ""); } namespace test_lambdas { void test1() { auto lambda1 = [](){}; auto lambda2 = lambda1; lambda1(); lambda2(); } int test2() { auto a = [](int i, int j){ return i + j; }(1, 2); auto b = []() -> int { return '0'; }(); auto c = [=](){ return a + b; }(); auto d = [&](){ return c; }(); auto e = [a, &b](int x) mutable { const auto identity = [](int y){ return y; }; for (auto i = 0; i < a; ++i) a += b--; return x + identity(a + b); }(0); return a + b + c + d + e; } int test3() { const auto nullary = [](){ return 0; }; const auto unary = [](int x){ return x; }; using nullary_t = decltype(nullary); using unary_t = decltype(unary); const auto higher1st = [](nullary_t f){ return f(); }; const auto higher2nd = [unary](nullary_t f1){ return [unary, f1](unary_t f2){ return f2(unary(f1())); }; }; return higher1st(nullary) + higher2nd(nullary)(unary); } } namespace test_variadic_templates { template <int...> struct sum; template <int N0, int... N1toN> struct sum<N0, N1toN...> { static constexpr auto value = N0 + sum<N1toN...>::value; }; template <> struct sum<> { static constexpr auto value = 0; }; static_assert(sum<>::value == 0, ""); static_assert(sum<1>::value == 1, ""); static_assert(sum<23>::value == 23, ""); static_assert(sum<1, 2>::value == 3, ""); static_assert(sum<5, 5, 11>::value == 21, ""); static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); } // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function // because of this. namespace test_template_alias_sfinae { struct foo {}; template<typename T> using member = typename T::member_type; template<typename T> void func(...) {} template<typename T> void func(member<T>*) {} void test(); void test() { func<foo>(0); } } } // namespace cxx11 #endif // __cplusplus >= 201103L ]]) dnl Tests for new features in C++14 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[ // If the compiler admits that it is not ready for C++14, why torture it? // Hopefully, this will speed up the test. #ifndef __cplusplus #error "This is not a C++ compiler" #elif __cplusplus < 201402L #error "This is not a C++14 compiler" #else namespace cxx14 { namespace test_polymorphic_lambdas { int test() { const auto lambda = [](auto&&... args){ const auto istiny = [](auto x){ return (sizeof(x) == 1UL) ? 1 : 0; }; const int aretiny[] = { istiny(args)... }; return aretiny[0]; }; return lambda(1, 1L, 1.0f, '1'); } } namespace test_binary_literals { constexpr auto ivii = 0b0000000000101010; static_assert(ivii == 42, "wrong value"); } namespace test_generalized_constexpr { template < typename CharT > constexpr unsigned long strlen_c(const CharT *const s) noexcept { auto length = 0UL; for (auto p = s; *p; ++p) ++length; return length; } static_assert(strlen_c("") == 0UL, ""); static_assert(strlen_c("x") == 1UL, ""); static_assert(strlen_c("test") == 4UL, ""); static_assert(strlen_c("another\0test") == 7UL, ""); } namespace test_lambda_init_capture { int test() { auto x = 0; const auto lambda1 = [a = x](int b){ return a + b; }; const auto lambda2 = [a = lambda1(x)](){ return a; }; return lambda2(); } } namespace test_digit_separators { constexpr auto ten_million = 100'000'000; static_assert(ten_million == 100000000, ""); } namespace test_return_type_deduction { auto f(int& x) { return x; } decltype(auto) g(int& x) { return x; } template < typename T1, typename T2 > struct is_same { static constexpr auto value = false; }; template < typename T > struct is_same<T, T> { static constexpr auto value = true; }; int test() { auto x = 0; static_assert(is_same<int, decltype(f(x))>::value, ""); static_assert(is_same<int&, decltype(g(x))>::value, ""); return x; } } } // namespace cxx14 #endif // __cplusplus >= 201402L ]]) dnl Tests for new features in C++17 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[ // If the compiler admits that it is not ready for C++17, why torture it? // Hopefully, this will speed up the test. #ifndef __cplusplus #error "This is not a C++ compiler" #elif __cplusplus < 201703L #error "This is not a C++17 compiler" #else #include <initializer_list> #include <utility> #include <type_traits> namespace cxx17 { namespace test_constexpr_lambdas { constexpr int foo = [](){return 42;}(); } namespace test::nested_namespace::definitions { } namespace test_fold_expression { template<typename... Args> int multiply(Args... args) { return (args * ... * 1); } template<typename... Args> bool all(Args... args) { return (args && ...); } } namespace test_extended_static_assert { static_assert (true); } namespace test_auto_brace_init_list { auto foo = {5}; auto bar {5}; static_assert(std::is_same<std::initializer_list<int>, decltype(foo)>::value); static_assert(std::is_same<int, decltype(bar)>::value); } namespace test_typename_in_template_template_parameter { template<template<typename> typename X> struct D; } namespace test_fallthrough_nodiscard_maybe_unused_attributes { int f1() { return 42; } [[nodiscard]] int f2() { [[maybe_unused]] auto unused = f1(); switch (f1()) { case 17: f1(); [[fallthrough]]; case 42: f1(); } return f1(); } } namespace test_extended_aggregate_initialization { struct base1 { int b1, b2 = 42; }; struct base2 { base2() { b3 = 42; } int b3; }; struct derived : base1, base2 { int d; }; derived d1 {{1, 2}, {}, 4}; // full initialization derived d2 {{}, {}, 4}; // value-initialized bases } namespace test_general_range_based_for_loop { struct iter { int i; int& operator* () { return i; } const int& operator* () const { return i; } iter& operator++() { ++i; return *this; } }; struct sentinel { int i; }; bool operator== (const iter& i, const sentinel& s) { return i.i == s.i; } bool operator!= (const iter& i, const sentinel& s) { return !(i == s); } struct range { iter begin() const { return {0}; } sentinel end() const { return {5}; } }; void f() { range r {}; for (auto i : r) { [[maybe_unused]] auto v = i; } } } namespace test_lambda_capture_asterisk_this_by_value { struct t { int i; int foo() { return [*this]() { return i; }(); } }; } namespace test_enum_class_construction { enum class byte : unsigned char {}; byte foo {42}; } namespace test_constexpr_if { template <bool cond> int f () { if constexpr(cond) { return 13; } else { return 42; } } } namespace test_selection_statement_with_initializer { int f() { return 13; } int f2() { if (auto i = f(); i > 0) { return 3; } switch (auto i = f(); i + 4) { case 17: return 2; default: return 1; } } } namespace test_template_argument_deduction_for_class_templates { template <typename T1, typename T2> struct pair { pair (T1 p1, T2 p2) : m1 {p1}, m2 {p2} {} T1 m1; T2 m2; }; void f() { [[maybe_unused]] auto p = pair{13, 42u}; } } namespace test_non_type_auto_template_parameters { template <auto n> struct B {}; B<5> b1; B<'a'> b2; } namespace test_structured_bindings { int arr[2] = { 1, 2 }; std::pair<int, int> pr = { 1, 2 }; auto f1() -> int(&)[2] { return arr; } auto f2() -> std::pair<int, int>& { return pr; } struct S { int x1 : 2; volatile double y1; }; S f3() { return {}; } auto [ x1, y1 ] = f1(); auto& [ xr1, yr1 ] = f1(); auto [ x2, y2 ] = f2(); auto& [ xr2, yr2 ] = f2(); const auto [ x3, y3 ] = f3(); } namespace test_exception_spec_type_system { struct Good {}; struct Bad {}; void g1() noexcept; void g2(); template<typename T> Bad f(T*, T*); template<typename T1, typename T2> Good f(T1*, T2*); static_assert (std::is_same_v<Good, decltype(f(g1, g2))>); } namespace test_inline_variables { template<class T> void f(T) {} template<class T> inline T g(T) { return T{}; } template<> inline void f<>(int) {} template<> int g<>(int) { return 5; } } } // namespace cxx17 #endif // __cplusplus < 201703L ]]) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mosh-1.4.0/m4/ax_file_escapes.m4��������������������������������������������������������������������0000664�0001750�0001750�00000001373�14272621034�013306� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_file_escapes.html # =========================================================================== # # SYNOPSIS # # AX_FILE_ESCAPES # # DESCRIPTION # # Writes the specified data to the specified file. # # LICENSE # # Copyright (c) 2008 Tom Howard <tomhoward@users.sf.net> # # 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_FILE_ESCAPES],[ AX_DOLLAR="\$" AX_SRB="\\135" AX_SLB="\\133" AX_BS="\\\\" AX_DQ="\"" ]) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mosh-1.4.0/m4/ax_check_compile_flag.m4��������������������������������������������������������������0000644�0001750�0001750�00000006251�13103401307�014427� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html # =========================================================================== # # SYNOPSIS # # AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS]) # # 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. # # 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 <guidod@gmx.de> # Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com> # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation, either version 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 <http://www.gnu.org/licenses/>. # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure # scripts that are the output of Autoconf when processing the Macro. You # need not follow the terms of the GNU General Public License when using # or distributing such scripts, even though portions of the text of the # Macro appear in them. The GNU General Public License (GPL) does govern # all other use of the material that constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the Autoconf # Macro released by the Autoconf Archive. When you make and distribute a # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. #serial 2 AC_DEFUN([AX_CHECK_COMPILE_FLAG], [AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [AS_VAR_SET(CACHEVAR,[yes])], [AS_VAR_SET(CACHEVAR,[no])]) _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes], [m4_default([$2], :)], [m4_default([$3], :)]) AS_VAR_POPDEF([CACHEVAR])dnl ])dnl AX_CHECK_COMPILE_FLAGS �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mosh-1.4.0/m4/ax_ac_append_to_file.m4���������������������������������������������������������������0000664�0001750�0001750�00000001622�14272621034�014274� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_ac_append_to_file.html # =========================================================================== # # SYNOPSIS # # AX_AC_APPEND_TO_FILE([FILE],[DATA]) # # DESCRIPTION # # Appends the specified data to the specified Autoconf is run. If you want # to append to a file when configure is run use AX_APPEND_TO_FILE instead. # # LICENSE # # Copyright (c) 2009 Allan Caffee <allan.caffee@gmail.com> # # 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 10 AC_DEFUN([AX_AC_APPEND_TO_FILE],[ AC_REQUIRE([AX_FILE_ESCAPES]) m4_esyscmd( AX_FILE_ESCAPES [ printf "%s" "$2" >> "$1" ]) ]) ��������������������������������������������������������������������������������������������������������������mosh-1.4.0/m4/ax_with_curses.m4���������������������������������������������������������������������0000644�0001750�0001750�00000060733�13103401307�013215� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# =========================================================================== # http://www.gnu.org/software/autoconf-archive/ax_with_curses.html # =========================================================================== # # SYNOPSIS # # AX_WITH_CURSES # # DESCRIPTION # # This macro checks whether a SysV or X/Open-compatible Curses library is # present, along with the associated header file. The NcursesW # (wide-character) library is searched for first, followed by Ncurses, # then the system-default plain Curses. The first library found is the # one returned. # # The following options are understood: --with-ncursesw, --with-ncurses, # --without-ncursesw, --without-ncurses. The "--with" options force the # macro to use that particular library, terminating with an error if not # found. The "--without" options simply skip the check for that library. # The effect on the search pattern is: # # (no options) - NcursesW, Ncurses, Curses # --with-ncurses --with-ncursesw - NcursesW only [*] # --without-ncurses --with-ncursesw - NcursesW only [*] # --with-ncursesw - NcursesW only [*] # --with-ncurses --without-ncursesw - Ncurses only [*] # --with-ncurses - NcursesW, Ncurses [**] # --without-ncurses --without-ncursesw - Curses only # --without-ncursesw - Ncurses, Curses # --without-ncurses - NcursesW, Curses # # [*] If the library is not found, abort the configure script. # # [**] If the second library (Ncurses) is not found, abort configure. # # The following preprocessor symbols may be defined by this macro if the # appropriate conditions are met: # # HAVE_CURSES - if any SysV or X/Open Curses library found # HAVE_CURSES_ENHANCED - if library supports X/Open Enhanced functions # HAVE_CURSES_COLOR - if library supports color (enhanced functions) # HAVE_CURSES_OBSOLETE - if library supports certain obsolete features # HAVE_NCURSESW - if NcursesW (wide char) library is to be used # HAVE_NCURSES - if the Ncurses library is to be used # # HAVE_CURSES_H - if <curses.h> is present and should be used # HAVE_NCURSESW_H - if <ncursesw.h> should be used # HAVE_NCURSES_H - if <ncurses.h> should be used # HAVE_NCURSESW_CURSES_H - if <ncursesw/curses.h> should be used # HAVE_NCURSES_CURSES_H - if <ncurses/curses.h> should be used # # (These preprocessor symbols are discussed later in this document.) # # The following output variable is defined by this macro; it is precious # and may be overridden on the ./configure command line: # # CURSES_LIB - library to add to xxx_LDADD # # The library listed in CURSES_LIB is NOT added to LIBS by default. You # need to add CURSES_LIB to the appropriate xxx_LDADD line in your # Makefile.am. For example: # # prog_LDADD = @CURSES_LIB@ # # If CURSES_LIB is set on the configure command line (such as by running # "./configure CURSES_LIB=-lmycurses"), then the only header searched for # is <curses.h>. The user may use the CPPFLAGS precious variable to # override the standard #include search path. If the user needs to # specify an alternative path for a library (such as for a non-standard # NcurseW), the user should use the LDFLAGS variable. # # The following shell variables may be defined by this macro: # # ax_cv_curses - set to "yes" if any Curses library found # ax_cv_curses_enhanced - set to "yes" if Enhanced functions present # ax_cv_curses_color - set to "yes" if color functions present # ax_cv_curses_obsolete - set to "yes" if obsolete features present # # ax_cv_ncursesw - set to "yes" if NcursesW library found # ax_cv_ncurses - set to "yes" if Ncurses library found # ax_cv_plaincurses - set to "yes" if plain Curses library found # ax_cv_curses_which - set to "ncursesw", "ncurses", "plaincurses" or "no" # # These variables can be used in your configure.ac to determine the level # of support you need from the Curses library. For example, if you must # have either Ncurses or NcursesW, you could include: # # AX_WITH_CURSES # if test "x$ax_cv_ncursesw" != xyes && test "x$ax_cv_ncurses" != xyes; then # AX_MSG_ERROR([requires either NcursesW or Ncurses library]) # fi # # If any Curses library will do (but one must be present and must support # color), you could use: # # AX_WITH_CURSES # if test "x$ax_cv_curses" != xyes || test "x$ax_cv_curses_color" != xyes; then # AC_MSG_ERROR([requires an X/Open-compatible Curses library with color]) # fi # # Certain preprocessor symbols and shell variables defined by this macro # can be used to determine various features of the Curses library. In # particular, HAVE_CURSES and ax_cv_curses are defined if the Curses # library found conforms to the traditional SysV and/or X/Open Base Curses # definition. Any working Curses library conforms to this level. # # HAVE_CURSES_ENHANCED and ax_cv_curses_enhanced are defined if the # library supports the X/Open Enhanced Curses definition. In particular, # the wide-character types attr_t, cchar_t and wint_t, the functions # wattr_set() and wget_wch() and the macros WA_NORMAL and _XOPEN_CURSES # are checked. The Ncurses library does NOT conform to this definition, # although NcursesW does. # # HAVE_CURSES_COLOR and ax_cv_curses_color are defined if the library # supports color functions and macros such as COLOR_PAIR, A_COLOR, # COLOR_WHITE, COLOR_RED and init_pair(). These are NOT part of the # X/Open Base Curses definition, but are part of the Enhanced set of # functions. The Ncurses library DOES support these functions, as does # NcursesW. # # HAVE_CURSES_OBSOLETE and ax_cv_curses_obsolete are defined if the # library supports certain features present in SysV and BSD Curses but not # defined in the X/Open definition. In particular, the functions # getattrs(), getcurx() and getmaxx() are checked. # # To use the HAVE_xxx_H preprocessor symbols, insert the following into # your system.h (or equivalent) header file: # # #if defined HAVE_NCURSESW_CURSES_H # # include <ncursesw/curses.h> # #elif defined HAVE_NCURSESW_H # # include <ncursesw.h> # #elif defined HAVE_NCURSES_CURSES_H # # include <ncurses/curses.h> # #elif defined HAVE_NCURSES_H # # include <ncurses.h> # #elif defined HAVE_CURSES_H # # include <curses.h> # #else # # error "SysV or X/Open-compatible Curses header file required" # #endif # # For previous users of this macro: you should not need to change anything # in your configure.ac or Makefile.am, as the previous (serial 10) # semantics are still valid. However, you should update your system.h (or # equivalent) header file to the fragment shown above. You are encouraged # also to make use of the extended functionality provided by this version # of AX_WITH_CURSES, as well as in the additional macros # AX_WITH_CURSES_PANEL, AX_WITH_CURSES_MENU and AX_WITH_CURSES_FORM. # # LICENSE # # Copyright (c) 2009 Mark Pulford <mark@kyne.com.au> # Copyright (c) 2009 Damian Pietras <daper@daper.net> # Copyright (c) 2012 Reuben Thomas <rrt@sc3d.org> # Copyright (c) 2011 John Zaitseff <J.Zaitseff@zap.org.au> # # 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 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 <http://www.gnu.org/licenses/>. # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure # scripts that are the output of Autoconf when processing the Macro. You # need not follow the terms of the GNU General Public License when using # or distributing such scripts, even though portions of the text of the # Macro appear in them. The GNU General Public License (GPL) does govern # all other use of the material that constitutes the Autoconf Macro. # # This special exception to the GPL applies to versions of the Autoconf # Macro released by the Autoconf Archive. When you make and distribute a # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. #serial 13 AU_ALIAS([MP_WITH_CURSES], [AX_WITH_CURSES]) AC_DEFUN([AX_WITH_CURSES], [ AC_ARG_VAR([CURSES_LIB], [linker library for Curses, e.g. -lcurses]) AC_ARG_WITH([ncurses], [AS_HELP_STRING([--with-ncurses], [force the use of Ncurses or NcursesW])], [], [with_ncurses=check]) AC_ARG_WITH([ncursesw], [AS_HELP_STRING([--without-ncursesw], [do not use NcursesW (wide character support)])], [], [with_ncursesw=check]) ax_saved_LIBS=$LIBS AS_IF([test "x$with_ncurses" = xyes || test "x$with_ncursesw" = xyes], [ax_with_plaincurses=no], [ax_with_plaincurses=check]) ax_cv_curses_which=no # Test for NcursesW AS_IF([test "x$CURSES_LIB" = x && test "x$with_ncursesw" != xno], [ LIBS="$ax_saved_LIBS -lncursesw" AC_CACHE_CHECK([for NcursesW wide-character library], [ax_cv_ncursesw], [ AC_LINK_IFELSE([AC_LANG_CALL([], [initscr])], [ax_cv_ncursesw=yes], [ax_cv_ncursesw=no]) ]) AS_IF([test "x$ax_cv_ncursesw" = xno && test "x$with_ncursesw" = xyes], [ AC_MSG_ERROR([--with-ncursesw specified but could not find NcursesW library]) ]) AS_IF([test "x$ax_cv_ncursesw" = xyes], [ ax_cv_curses=yes ax_cv_curses_which=ncursesw CURSES_LIB="-lncursesw" AC_DEFINE([HAVE_NCURSESW], [1], [Define to 1 if the NcursesW library is present]) AC_DEFINE([HAVE_CURSES], [1], [Define to 1 if a SysV or X/Open compatible Curses library is present]) AC_CACHE_CHECK([for working ncursesw/curses.h], [ax_cv_header_ncursesw_curses_h], [ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ @%:@define _XOPEN_SOURCE_EXTENDED 1 @%:@include <ncursesw/curses.h> ]], [[ chtype a = A_BOLD; int b = KEY_LEFT; chtype c = COLOR_PAIR(1) & A_COLOR; attr_t d = WA_NORMAL; cchar_t e; wint_t f; int g = getattrs(stdscr); int h = getcurx(stdscr) + getmaxx(stdscr); initscr(); init_pair(1, COLOR_WHITE, COLOR_RED); wattr_set(stdscr, d, 0, NULL); wget_wch(stdscr, &f); ]])], [ax_cv_header_ncursesw_curses_h=yes], [ax_cv_header_ncursesw_curses_h=no]) ]) AS_IF([test "x$ax_cv_header_ncursesw_curses_h" = xyes], [ ax_cv_curses_enhanced=yes ax_cv_curses_color=yes ax_cv_curses_obsolete=yes AC_DEFINE([HAVE_CURSES_ENHANCED], [1], [Define to 1 if library supports X/Open Enhanced functions]) AC_DEFINE([HAVE_CURSES_COLOR], [1], [Define to 1 if library supports color (enhanced functions)]) AC_DEFINE([HAVE_CURSES_OBSOLETE], [1], [Define to 1 if library supports certain obsolete features]) AC_DEFINE([HAVE_NCURSESW_CURSES_H], [1], [Define to 1 if <ncursesw/curses.h> is present]) ]) AC_CACHE_CHECK([for working ncursesw.h], [ax_cv_header_ncursesw_h], [ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ @%:@define _XOPEN_SOURCE_EXTENDED 1 @%:@include <ncursesw.h> ]], [[ chtype a = A_BOLD; int b = KEY_LEFT; chtype c = COLOR_PAIR(1) & A_COLOR; attr_t d = WA_NORMAL; cchar_t e; wint_t f; int g = getattrs(stdscr); int h = getcurx(stdscr) + getmaxx(stdscr); initscr(); init_pair(1, COLOR_WHITE, COLOR_RED); wattr_set(stdscr, d, 0, NULL); wget_wch(stdscr, &f); ]])], [ax_cv_header_ncursesw_h=yes], [ax_cv_header_ncursesw_h=no]) ]) AS_IF([test "x$ax_cv_header_ncursesw_h" = xyes], [ ax_cv_curses_enhanced=yes ax_cv_curses_color=yes ax_cv_curses_obsolete=yes AC_DEFINE([HAVE_CURSES_ENHANCED], [1], [Define to 1 if library supports X/Open Enhanced functions]) AC_DEFINE([HAVE_CURSES_COLOR], [1], [Define to 1 if library supports color (enhanced functions)]) AC_DEFINE([HAVE_CURSES_OBSOLETE], [1], [Define to 1 if library supports certain obsolete features]) AC_DEFINE([HAVE_NCURSESW_H], [1], [Define to 1 if <ncursesw.h> is present]) ]) AC_CACHE_CHECK([for working ncurses.h], [ax_cv_header_ncurses_h_with_ncursesw], [ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ @%:@define _XOPEN_SOURCE_EXTENDED 1 @%:@include <ncurses.h> ]], [[ chtype a = A_BOLD; int b = KEY_LEFT; chtype c = COLOR_PAIR(1) & A_COLOR; attr_t d = WA_NORMAL; cchar_t e; wint_t f; int g = getattrs(stdscr); int h = getcurx(stdscr) + getmaxx(stdscr); initscr(); init_pair(1, COLOR_WHITE, COLOR_RED); wattr_set(stdscr, d, 0, NULL); wget_wch(stdscr, &f); ]])], [ax_cv_header_ncurses_h_with_ncursesw=yes], [ax_cv_header_ncurses_h_with_ncursesw=no]) ]) AS_IF([test "x$ax_cv_header_ncurses_h_with_ncursesw" = xyes], [ ax_cv_curses_enhanced=yes ax_cv_curses_color=yes ax_cv_curses_obsolete=yes AC_DEFINE([HAVE_CURSES_ENHANCED], [1], [Define to 1 if library supports X/Open Enhanced functions]) AC_DEFINE([HAVE_CURSES_COLOR], [1], [Define to 1 if library supports color (enhanced functions)]) AC_DEFINE([HAVE_CURSES_OBSOLETE], [1], [Define to 1 if library supports certain obsolete features]) AC_DEFINE([HAVE_NCURSES_H], [1], [Define to 1 if <ncurses.h> is present]) ]) AS_IF([test "x$ax_cv_header_ncursesw_curses_h" = xno && test "x$ax_cv_header_ncursesw_h" = xno && test "x$ax_cv_header_ncurses_h_with_ncursesw" = xno], [ AC_MSG_WARN([could not find a working ncursesw/curses.h, ncursesw.h or ncurses.h]) ]) ]) ]) # Test for Ncurses AS_IF([test "x$CURSES_LIB" = x && test "x$with_ncurses" != xno && test "x$ax_cv_curses_which" = xno], [ LIBS="$ax_saved_LIBS -lncurses" AC_CACHE_CHECK([for Ncurses library], [ax_cv_ncurses], [ AC_LINK_IFELSE([AC_LANG_CALL([], [initscr])], [ax_cv_ncurses=yes], [ax_cv_ncurses=no]) ]) AS_IF([test "x$ax_cv_ncurses" = xno && test "x$with_ncurses" = xyes], [ AC_MSG_ERROR([--with-ncurses specified but could not find Ncurses library]) ]) AS_IF([test "x$ax_cv_ncurses" = xyes], [ ax_cv_curses=yes ax_cv_curses_which=ncurses CURSES_LIB="-lncurses" AC_DEFINE([HAVE_NCURSES], [1], [Define to 1 if the Ncurses library is present]) AC_DEFINE([HAVE_CURSES], [1], [Define to 1 if a SysV or X/Open compatible Curses library is present]) AC_CACHE_CHECK([for working ncurses/curses.h], [ax_cv_header_ncurses_curses_h], [ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ @%:@include <ncurses/curses.h> ]], [[ chtype a = A_BOLD; int b = KEY_LEFT; chtype c = COLOR_PAIR(1) & A_COLOR; int g = getattrs(stdscr); int h = getcurx(stdscr) + getmaxx(stdscr); initscr(); init_pair(1, COLOR_WHITE, COLOR_RED); ]])], [ax_cv_header_ncurses_curses_h=yes], [ax_cv_header_ncurses_curses_h=no]) ]) AS_IF([test "x$ax_cv_header_ncurses_curses_h" = xyes], [ ax_cv_curses_color=yes ax_cv_curses_obsolete=yes AC_DEFINE([HAVE_CURSES_COLOR], [1], [Define to 1 if library supports color (enhanced functions)]) AC_DEFINE([HAVE_CURSES_OBSOLETE], [1], [Define to 1 if library supports certain obsolete features]) AC_DEFINE([HAVE_NCURSES_CURSES_H], [1], [Define to 1 if <ncurses/curses.h> is present]) ]) AC_CACHE_CHECK([for working ncurses.h], [ax_cv_header_ncurses_h], [ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ @%:@include <ncurses.h> ]], [[ chtype a = A_BOLD; int b = KEY_LEFT; chtype c = COLOR_PAIR(1) & A_COLOR; int g = getattrs(stdscr); int h = getcurx(stdscr) + getmaxx(stdscr); initscr(); init_pair(1, COLOR_WHITE, COLOR_RED); ]])], [ax_cv_header_ncurses_h=yes], [ax_cv_header_ncurses_h=no]) ]) AS_IF([test "x$ax_cv_header_ncurses_h" = xyes], [ ax_cv_curses_color=yes ax_cv_curses_obsolete=yes AC_DEFINE([HAVE_CURSES_COLOR], [1], [Define to 1 if library supports color (enhanced functions)]) AC_DEFINE([HAVE_CURSES_OBSOLETE], [1], [Define to 1 if library supports certain obsolete features]) AC_DEFINE([HAVE_NCURSES_H], [1], [Define to 1 if <ncurses.h> is present]) ]) AS_IF([test "x$ax_cv_header_ncurses_curses_h" = xno && test "x$ax_cv_header_ncurses_h" = xno], [ AC_MSG_WARN([could not find a working ncurses/curses.h or ncurses.h]) ]) ]) ]) # Test for plain Curses (or if CURSES_LIB was set by user) AS_IF([test "x$with_plaincurses" != xno && test "x$ax_cv_curses_which" = xno], [ AS_IF([test "x$CURSES_LIB" != x], [ LIBS="$ax_saved_LIBS $CURSES_LIB" ], [ LIBS="$ax_saved_LIBS -lcurses" ]) AC_CACHE_CHECK([for Curses library], [ax_cv_plaincurses], [ AC_LINK_IFELSE([AC_LANG_CALL([], [initscr])], [ax_cv_plaincurses=yes], [ax_cv_plaincurses=no]) ]) AS_IF([test "x$ax_cv_plaincurses" = xyes], [ ax_cv_curses=yes ax_cv_curses_which=plaincurses AS_IF([test "x$CURSES_LIB" = x], [ CURSES_LIB="-lcurses" ]) AC_DEFINE([HAVE_CURSES], [1], [Define to 1 if a SysV or X/Open compatible Curses library is present]) # Check for base conformance (and header file) AC_CACHE_CHECK([for working curses.h], [ax_cv_header_curses_h], [ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ @%:@include <curses.h> ]], [[ chtype a = A_BOLD; int b = KEY_LEFT; initscr(); ]])], [ax_cv_header_curses_h=yes], [ax_cv_header_curses_h=no]) ]) AS_IF([test "x$ax_cv_header_curses_h" = xyes], [ AC_DEFINE([HAVE_CURSES_H], [1], [Define to 1 if <curses.h> is present]) # Check for X/Open Enhanced conformance AC_CACHE_CHECK([for X/Open Enhanced Curses conformance], [ax_cv_plaincurses_enhanced], [ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ @%:@define _XOPEN_SOURCE_EXTENDED 1 @%:@include <curses.h> @%:@ifndef _XOPEN_CURSES @%:@error "this Curses library is not enhanced" "this Curses library is not enhanced" @%:@endif ]], [[ chtype a = A_BOLD; int b = KEY_LEFT; chtype c = COLOR_PAIR(1) & A_COLOR; attr_t d = WA_NORMAL; cchar_t e; wint_t f; initscr(); init_pair(1, COLOR_WHITE, COLOR_RED); wattr_set(stdscr, d, 0, NULL); wget_wch(stdscr, &f); ]])], [ax_cv_plaincurses_enhanced=yes], [ax_cv_plaincurses_enhanced=no]) ]) AS_IF([test "x$ax_cv_plaincurses_enhanced" = xyes], [ ax_cv_curses_enhanced=yes ax_cv_curses_color=yes AC_DEFINE([HAVE_CURSES_ENHANCED], [1], [Define to 1 if library supports X/Open Enhanced functions]) AC_DEFINE([HAVE_CURSES_COLOR], [1], [Define to 1 if library supports color (enhanced functions)]) ]) # Check for color functions AC_CACHE_CHECK([for Curses color functions], [ax_cv_plaincurses_color], [ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ @%:@define _XOPEN_SOURCE_EXTENDED 1 @%:@include <curses.h> ]], [[ chtype a = A_BOLD; int b = KEY_LEFT; chtype c = COLOR_PAIR(1) & A_COLOR; initscr(); init_pair(1, COLOR_WHITE, COLOR_RED); ]])], [ax_cv_plaincurses_color=yes], [ax_cv_plaincurses_color=no]) ]) AS_IF([test "x$ax_cv_plaincurses_color" = xyes], [ ax_cv_curses_color=yes AC_DEFINE([HAVE_CURSES_COLOR], [1], [Define to 1 if library supports color (enhanced functions)]) ]) # Check for obsolete functions AC_CACHE_CHECK([for obsolete Curses functions], [ax_cv_plaincurses_obsolete], [ AC_LINK_IFELSE([AC_LANG_PROGRAM([[ @%:@include <curses.h> ]], [[ chtype a = A_BOLD; int b = KEY_LEFT; int g = getattrs(stdscr); int h = getcurx(stdscr) + getmaxx(stdscr); initscr(); ]])], [ax_cv_plaincurses_obsolete=yes], [ax_cv_plaincurses_obsolete=no]) ]) AS_IF([test "x$ax_cv_plaincurses_obsolete" = xyes], [ ax_cv_curses_obsolete=yes AC_DEFINE([HAVE_CURSES_OBSOLETE], [1], [Define to 1 if library supports certain obsolete features]) ]) ]) AS_IF([test "x$ax_cv_header_curses_h" = xno], [ AC_MSG_WARN([could not find a working curses.h]) ]) ]) ]) AS_IF([test "x$ax_cv_curses" != xyes], [ax_cv_curses=no]) AS_IF([test "x$ax_cv_curses_enhanced" != xyes], [ax_cv_curses_enhanced=no]) AS_IF([test "x$ax_cv_curses_color" != xyes], [ax_cv_curses_color=no]) AS_IF([test "x$ax_cv_curses_obsolete" != xyes], [ax_cv_curses_obsolete=no]) LIBS=$ax_saved_LIBS ])dnl �������������������������������������mosh-1.4.0/m4/ax_ac_print_to_file.m4����������������������������������������������������������������0000664�0001750�0001750�00000001611�14272621034�014157� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_ac_print_to_file.html # =========================================================================== # # SYNOPSIS # # AX_AC_PRINT_TO_FILE([FILE],[DATA]) # # DESCRIPTION # # Writes the specified data to the specified file when Autoconf is run. If # you want to print to a file when configure is run use AX_PRINT_TO_FILE # instead. # # LICENSE # # Copyright (c) 2009 Allan Caffee <allan.caffee@gmail.com> # # 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 10 AC_DEFUN([AX_AC_PRINT_TO_FILE],[ m4_esyscmd( AC_REQUIRE([AX_FILE_ESCAPES]) [ printf "%s" "$2" > "$1" ]) ]) �����������������������������������������������������������������������������������������������������������������������mosh-1.4.0/m4/ax_check_gnu_make.m4������������������������������������������������������������������0000664�0001750�0001750�00000007727�14272621034�013620� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_check_gnu_make.html # =========================================================================== # # SYNOPSIS # # AX_CHECK_GNU_MAKE([run-if-true],[run-if-false]) # # DESCRIPTION # # This macro searches for a GNU version of make. If a match is found: # # * The makefile variable `ifGNUmake' is set to the empty string, otherwise # it is set to "#". This is useful for including a special features in a # Makefile, which cannot be handled by other versions of make. # * The makefile variable `ifnGNUmake' is set to #, otherwise # it is set to the empty string. This is useful for including a special # features in a Makefile, which can be handled # by other versions of make or to specify else like clause. # * The variable `_cv_gnu_make_command` is set to the command to invoke # GNU make if it exists, the empty string otherwise. # * The variable `ax_cv_gnu_make_command` is set to the command to invoke # GNU make by copying `_cv_gnu_make_command`, otherwise it is unset. # * If GNU Make is found, its version is extracted from the output of # `make --version` as the last field of a record of space-separated # columns and saved into the variable `ax_check_gnu_make_version`. # * Additionally if GNU Make is found, run shell code run-if-true # else run shell code run-if-false. # # Here is an example of its use: # # Makefile.in might contain: # # # A failsafe way of putting a dependency rule into a makefile # $(DEPEND): # $(CC) -MM $(srcdir)/*.c > $(DEPEND) # # @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND))) # @ifGNUmake@ include $(DEPEND) # @ifGNUmake@ else # fallback code # @ifGNUmake@ endif # # Then configure.in would normally contain: # # AX_CHECK_GNU_MAKE() # AC_OUTPUT(Makefile) # # Then perhaps to cause gnu make to override any other make, we could do # something like this (note that GNU make always looks for GNUmakefile # first): # # if ! test x$_cv_gnu_make_command = x ; then # mv Makefile GNUmakefile # echo .DEFAULT: > Makefile ; # echo \ $_cv_gnu_make_command \$@ >> Makefile; # fi # # Then, if any (well almost any) other make is called, and GNU make also # exists, then the other make wraps the GNU make. # # LICENSE # # Copyright (c) 2008 John Darrington <j.darrington@elvis.murdoch.edu.au> # Copyright (c) 2015 Enrico M. Crisostomo <enrico.m.crisostomo@gmail.com> # # 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 12 AC_DEFUN([AX_CHECK_GNU_MAKE],dnl [AC_PROG_AWK AC_CACHE_CHECK([for GNU make],[_cv_gnu_make_command],[dnl _cv_gnu_make_command="" ; dnl Search all the common names for GNU make for a in "$MAKE" make gmake gnumake ; do if test -z "$a" ; then continue ; fi ; if "$a" --version 2> /dev/null | grep GNU 2>&1 > /dev/null ; then _cv_gnu_make_command=$a ; AX_CHECK_GNU_MAKE_HEADLINE=$("$a" --version 2> /dev/null | grep "GNU Make") ax_check_gnu_make_version=$(echo ${AX_CHECK_GNU_MAKE_HEADLINE} | ${AWK} -F " " '{ print $(NF); }') break ; fi done ;]) dnl If there was a GNU version, then set @ifGNUmake@ to the empty string, '#' otherwise AS_VAR_IF([_cv_gnu_make_command], [""], [AS_VAR_SET([ifGNUmake], ["#"])], [AS_VAR_SET([ifGNUmake], [""])]) AS_VAR_IF([_cv_gnu_make_command], [""], [AS_VAR_SET([ifnGNUmake], [""])], [AS_VAR_SET([ifnGNUmake], ["#"])]) AS_VAR_IF([_cv_gnu_make_command], [""], [AS_UNSET(ax_cv_gnu_make_command)], [AS_VAR_SET([ax_cv_gnu_make_command], [${_cv_gnu_make_command}])]) AS_VAR_IF([_cv_gnu_make_command], [""],[$2],[$1]) AC_SUBST([ifGNUmake]) AC_SUBST([ifnGNUmake]) ]) �����������������������������������������mosh-1.4.0/m4/ax_code_coverage.m4�������������������������������������������������������������������0000664�0001750�0001750�00000027616�14272621034�013461� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_code_coverage.html # =========================================================================== # # SYNOPSIS # # AX_CODE_COVERAGE() # # DESCRIPTION # # Defines CODE_COVERAGE_CPPFLAGS, CODE_COVERAGE_CFLAGS, # CODE_COVERAGE_CXXFLAGS and CODE_COVERAGE_LIBS which should be included # in the CPPFLAGS, CFLAGS CXXFLAGS and LIBS/LIBADD variables of every # build target (program or library) which should be built with code # coverage support. Also add rules using AX_ADD_AM_MACRO_STATIC; and # $enable_code_coverage which can be used in subsequent configure output. # CODE_COVERAGE_ENABLED is defined and substituted, and corresponds to the # value of the --enable-code-coverage option, which defaults to being # disabled. # # Test also for gcov program and create GCOV variable that could be # substituted. # # Note that all optimization flags in CFLAGS must be disabled when code # coverage is enabled. # # Usage example: # # configure.ac: # # AX_CODE_COVERAGE # # Makefile.am: # # include $(top_srcdir)/aminclude_static.am # # my_program_LIBS = ... $(CODE_COVERAGE_LIBS) ... # my_program_CPPFLAGS = ... $(CODE_COVERAGE_CPPFLAGS) ... # my_program_CFLAGS = ... $(CODE_COVERAGE_CFLAGS) ... # my_program_CXXFLAGS = ... $(CODE_COVERAGE_CXXFLAGS) ... # # clean-local: code-coverage-clean # distclean-local: code-coverage-dist-clean # # This results in a "check-code-coverage" rule being added to any # Makefile.am which do "include $(top_srcdir)/aminclude_static.am" # (assuming the module has been configured with --enable-code-coverage). # Running `make check-code-coverage` in that directory will run the # module's test suite (`make check`) and build a code coverage report # detailing the code which was touched, then print the URI for the report. # # This code was derived from Makefile.decl in GLib, originally licensed # under LGPLv2.1+. # # LICENSE # # Copyright (c) 2012, 2016 Philip Withnall # Copyright (c) 2012 Xan Lopez # Copyright (c) 2012 Christian Persch # Copyright (c) 2012 Paolo Borelli # Copyright (c) 2012 Dan Winship # Copyright (c) 2015,2018 Bastien ROUCARIES # # This library is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or (at # your option) any later version. # # This library 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 Lesser # General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. #serial 34 m4_define(_AX_CODE_COVERAGE_RULES,[ AX_ADD_AM_MACRO_STATIC([ # Code coverage # # Optional: # - CODE_COVERAGE_DIRECTORY: Top-level directory for code coverage reporting. # Multiple directories may be specified, separated by whitespace. # (Default: \$(top_builddir)) # - CODE_COVERAGE_OUTPUT_FILE: Filename and path for the .info file generated # by lcov for code coverage. (Default: # \$(PACKAGE_NAME)-\$(PACKAGE_VERSION)-coverage.info) # - CODE_COVERAGE_OUTPUT_DIRECTORY: Directory for generated code coverage # reports to be created. (Default: # \$(PACKAGE_NAME)-\$(PACKAGE_VERSION)-coverage) # - CODE_COVERAGE_BRANCH_COVERAGE: Set to 1 to enforce branch coverage, # set to 0 to disable it and leave empty to stay with the default. # (Default: empty) # - CODE_COVERAGE_LCOV_SHOPTS_DEFAULT: Extra options shared between both lcov # instances. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE) # - CODE_COVERAGE_LCOV_SHOPTS: Extra options to shared between both lcov # instances. (Default: $CODE_COVERAGE_LCOV_SHOPTS_DEFAULT) # - CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH: --gcov-tool pathtogcov # - CODE_COVERAGE_LCOV_OPTIONS_DEFAULT: Extra options to pass to the # collecting lcov instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH) # - CODE_COVERAGE_LCOV_OPTIONS: Extra options to pass to the collecting lcov # instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_DEFAULT) # - CODE_COVERAGE_LCOV_RMOPTS_DEFAULT: Extra options to pass to the filtering # lcov instance. (Default: empty) # - CODE_COVERAGE_LCOV_RMOPTS: Extra options to pass to the filtering lcov # instance. (Default: $CODE_COVERAGE_LCOV_RMOPTS_DEFAULT) # - CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT: Extra options to pass to the # genhtml instance. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE) # - CODE_COVERAGE_GENHTML_OPTIONS: Extra options to pass to the genhtml # instance. (Default: $CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT) # - CODE_COVERAGE_IGNORE_PATTERN: Extra glob pattern of files to ignore # # The generated report will be titled using the \$(PACKAGE_NAME) and # \$(PACKAGE_VERSION). In order to add the current git hash to the title, # use the git-version-gen script, available online. # Optional variables # run only on top dir if CODE_COVERAGE_ENABLED ifeq (\$(abs_builddir), \$(abs_top_builddir)) CODE_COVERAGE_DIRECTORY ?= \$(top_builddir) CODE_COVERAGE_OUTPUT_FILE ?= \$(PACKAGE_NAME)-\$(PACKAGE_VERSION)-coverage.info CODE_COVERAGE_OUTPUT_DIRECTORY ?= \$(PACKAGE_NAME)-\$(PACKAGE_VERSION)-coverage CODE_COVERAGE_BRANCH_COVERAGE ?= CODE_COVERAGE_LCOV_SHOPTS_DEFAULT ?= \$(if \$(CODE_COVERAGE_BRANCH_COVERAGE),\ --rc lcov_branch_coverage=\$(CODE_COVERAGE_BRANCH_COVERAGE)) CODE_COVERAGE_LCOV_SHOPTS ?= \$(CODE_COVERAGE_LCOV_SHOPTS_DEFAULT) CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH ?= --gcov-tool \"\$(GCOV)\" CODE_COVERAGE_LCOV_OPTIONS_DEFAULT ?= \$(CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH) CODE_COVERAGE_LCOV_OPTIONS ?= \$(CODE_COVERAGE_LCOV_OPTIONS_DEFAULT) CODE_COVERAGE_LCOV_RMOPTS_DEFAULT ?= CODE_COVERAGE_LCOV_RMOPTS ?= \$(CODE_COVERAGE_LCOV_RMOPTS_DEFAULT) CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT ?=\ \$(if \$(CODE_COVERAGE_BRANCH_COVERAGE),\ --rc genhtml_branch_coverage=\$(CODE_COVERAGE_BRANCH_COVERAGE)) CODE_COVERAGE_GENHTML_OPTIONS ?= \$(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT) CODE_COVERAGE_IGNORE_PATTERN ?= GITIGNOREFILES := \$(GITIGNOREFILES) \$(CODE_COVERAGE_OUTPUT_FILE) \$(CODE_COVERAGE_OUTPUT_DIRECTORY) code_coverage_v_lcov_cap = \$(code_coverage_v_lcov_cap_\$(V)) code_coverage_v_lcov_cap_ = \$(code_coverage_v_lcov_cap_\$(AM_DEFAULT_VERBOSITY)) code_coverage_v_lcov_cap_0 = @echo \" LCOV --capture\" \$(CODE_COVERAGE_OUTPUT_FILE); code_coverage_v_lcov_ign = \$(code_coverage_v_lcov_ign_\$(V)) code_coverage_v_lcov_ign_ = \$(code_coverage_v_lcov_ign_\$(AM_DEFAULT_VERBOSITY)) code_coverage_v_lcov_ign_0 = @echo \" LCOV --remove /tmp/*\" \$(CODE_COVERAGE_IGNORE_PATTERN); code_coverage_v_genhtml = \$(code_coverage_v_genhtml_\$(V)) code_coverage_v_genhtml_ = \$(code_coverage_v_genhtml_\$(AM_DEFAULT_VERBOSITY)) code_coverage_v_genhtml_0 = @echo \" GEN \" \"\$(CODE_COVERAGE_OUTPUT_DIRECTORY)\"; code_coverage_quiet = \$(code_coverage_quiet_\$(V)) code_coverage_quiet_ = \$(code_coverage_quiet_\$(AM_DEFAULT_VERBOSITY)) code_coverage_quiet_0 = --quiet # sanitizes the test-name: replaces with underscores: dashes and dots code_coverage_sanitize = \$(subst -,_,\$(subst .,_,\$(1))) # Use recursive makes in order to ignore errors during check check-code-coverage: -\$(AM_V_at)\$(MAKE) \$(AM_MAKEFLAGS) -k check \$(AM_V_at)\$(MAKE) \$(AM_MAKEFLAGS) code-coverage-capture # Capture code coverage data code-coverage-capture: code-coverage-capture-hook \$(code_coverage_v_lcov_cap)\$(LCOV) \$(code_coverage_quiet) \$(addprefix --directory ,\$(CODE_COVERAGE_DIRECTORY)) --capture --output-file \"\$(CODE_COVERAGE_OUTPUT_FILE).tmp\" --test-name \"\$(call code_coverage_sanitize,\$(PACKAGE_NAME)-\$(PACKAGE_VERSION))\" --no-checksum --compat-libtool \$(CODE_COVERAGE_LCOV_SHOPTS) \$(CODE_COVERAGE_LCOV_OPTIONS) \$(code_coverage_v_lcov_ign)\$(LCOV) \$(code_coverage_quiet) \$(addprefix --directory ,\$(CODE_COVERAGE_DIRECTORY)) --remove \"\$(CODE_COVERAGE_OUTPUT_FILE).tmp\" \"/tmp/*\" \$(CODE_COVERAGE_IGNORE_PATTERN) --output-file \"\$(CODE_COVERAGE_OUTPUT_FILE)\" \$(CODE_COVERAGE_LCOV_SHOPTS) \$(CODE_COVERAGE_LCOV_RMOPTS) -@rm -f \"\$(CODE_COVERAGE_OUTPUT_FILE).tmp\" \$(code_coverage_v_genhtml)LANG=C \$(GENHTML) \$(code_coverage_quiet) \$(addprefix --prefix ,\$(CODE_COVERAGE_DIRECTORY)) --output-directory \"\$(CODE_COVERAGE_OUTPUT_DIRECTORY)\" --title \"\$(PACKAGE_NAME)-\$(PACKAGE_VERSION) Code Coverage\" --legend --show-details \"\$(CODE_COVERAGE_OUTPUT_FILE)\" \$(CODE_COVERAGE_GENHTML_OPTIONS) @echo \"file://\$(abs_builddir)/\$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html\" code-coverage-clean: -\$(LCOV) --directory \$(top_builddir) -z -rm -rf \"\$(CODE_COVERAGE_OUTPUT_FILE)\" \"\$(CODE_COVERAGE_OUTPUT_FILE).tmp\" \"\$(CODE_COVERAGE_OUTPUT_DIRECTORY)\" -find . \\( -name \"*.gcda\" -o -name \"*.gcno\" -o -name \"*.gcov\" \\) -delete code-coverage-dist-clean: A][M_DISTCHECK_CONFIGURE_FLAGS := \$(A][M_DISTCHECK_CONFIGURE_FLAGS) --disable-code-coverage else # ifneq (\$(abs_builddir), \$(abs_top_builddir)) check-code-coverage: code-coverage-capture: code-coverage-capture-hook code-coverage-clean: code-coverage-dist-clean: endif # ifeq (\$(abs_builddir), \$(abs_top_builddir)) else #! CODE_COVERAGE_ENABLED # Use recursive makes in order to ignore errors during check check-code-coverage: @echo \"Need to reconfigure with --enable-code-coverage\" # Capture code coverage data code-coverage-capture: code-coverage-capture-hook @echo \"Need to reconfigure with --enable-code-coverage\" code-coverage-clean: code-coverage-dist-clean: endif #CODE_COVERAGE_ENABLED # Hook rule executed before code-coverage-capture, overridable by the user code-coverage-capture-hook: .PHONY: check-code-coverage code-coverage-capture code-coverage-dist-clean code-coverage-clean code-coverage-capture-hook ]) ]) AC_DEFUN([_AX_CODE_COVERAGE_ENABLED],[ AX_CHECK_GNU_MAKE([],[AC_MSG_ERROR([not using GNU make that is needed for coverage])]) AC_REQUIRE([AX_ADD_AM_MACRO_STATIC]) # check for gcov AC_CHECK_TOOL([GCOV], [$_AX_CODE_COVERAGE_GCOV_PROG_WITH], [:]) AS_IF([test "X$GCOV" = "X:"], [AC_MSG_ERROR([gcov is needed to do coverage])]) AC_SUBST([GCOV]) dnl Check if gcc is being used AS_IF([ test "$GCC" = "no" ], [ AC_MSG_ERROR([not compiling with gcc, which is required for gcov code coverage]) ]) AC_CHECK_PROG([LCOV], [lcov], [lcov]) AC_CHECK_PROG([GENHTML], [genhtml], [genhtml]) AS_IF([ test x"$LCOV" = x ], [ AC_MSG_ERROR([To enable code coverage reporting you must have lcov installed]) ]) AS_IF([ test x"$GENHTML" = x ], [ AC_MSG_ERROR([Could not find genhtml from the lcov package]) ]) dnl Build the code coverage flags dnl Define CODE_COVERAGE_LDFLAGS for backwards compatibility CODE_COVERAGE_CPPFLAGS="-DNDEBUG" CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage" CODE_COVERAGE_CXXFLAGS="-O0 -g -fprofile-arcs -ftest-coverage" CODE_COVERAGE_LIBS="-lgcov" AC_SUBST([CODE_COVERAGE_CPPFLAGS]) AC_SUBST([CODE_COVERAGE_CFLAGS]) AC_SUBST([CODE_COVERAGE_CXXFLAGS]) AC_SUBST([CODE_COVERAGE_LIBS]) ]) AC_DEFUN([AX_CODE_COVERAGE],[ dnl Check for --enable-code-coverage # allow to override gcov location AC_ARG_WITH([gcov], [AS_HELP_STRING([--with-gcov[=GCOV]], [use given GCOV for coverage (GCOV=gcov).])], [_AX_CODE_COVERAGE_GCOV_PROG_WITH=$with_gcov], [_AX_CODE_COVERAGE_GCOV_PROG_WITH=gcov]) AC_MSG_CHECKING([whether to build with code coverage support]) AC_ARG_ENABLE([code-coverage], AS_HELP_STRING([--enable-code-coverage], [Whether to enable code coverage support]),, enable_code_coverage=no) AM_CONDITIONAL([CODE_COVERAGE_ENABLED], [test "x$enable_code_coverage" = xyes]) AC_SUBST([CODE_COVERAGE_ENABLED], [$enable_code_coverage]) AC_MSG_RESULT($enable_code_coverage) AS_IF([ test "x$enable_code_coverage" = xyes ], [ _AX_CODE_COVERAGE_ENABLED ]) _AX_CODE_COVERAGE_RULES ]) ������������������������������������������������������������������������������������������������������������������mosh-1.4.0/m4/ax_am_macros_static.m4����������������������������������������������������������������0000664�0001750�0001750�00000002125�14272621034�014170� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# =========================================================================== # https://www.gnu.org/software/autoconf-archive/ax_am_macros_static.html # =========================================================================== # # SYNOPSIS # # AX_AM_MACROS_STATIC # # DESCRIPTION # # Adds support for macros that create Automake rules. You must manually # add the following line # # include $(top_srcdir)/aminclude_static.am # # to your Makefile.am files. # # LICENSE # # Copyright (c) 2009 Tom Howard <tomhoward@users.sf.net> # Copyright (c) 2009 Allan Caffee <allan.caffee@gmail.com> # # 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([AMINCLUDE_STATIC],[aminclude_static.am]) AC_DEFUN([AX_AM_MACROS_STATIC], [ AX_AC_PRINT_TO_FILE(AMINCLUDE_STATIC,[ # ]AMINCLUDE_STATIC[ generated automatically by Autoconf # from AX_AM_MACROS_STATIC on ]m4_esyscmd([LC_ALL=C date])[ ]) ]) �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mosh-1.4.0/m4/pkg.m4��������������������������������������������������������������������������������0000644�0001750�0001750�00000013023�13103401307�010735� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # serial 1 (pkg-config-0.24) # # Copyright © 2004 Scott James Remnant <scott@netsplit.com>. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # PKG_PROG_PKG_CONFIG([MIN-VERSION]) # ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])# PKG_PROG_PKG_CONFIG # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # # Check to see whether a particular set of modules exists. Similar # to PKG_CHECK_MODULES(), but does not set variables or print errors. # # Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) # only at the first occurence in configure.ac, so if the first place # it's called might be skipped (such as if it is within an "if", you # have to call PKG_CHECK_EXISTS manually # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_default([$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # --------------------------------------------- m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes ], [pkg_failed=yes]) else pkg_failed=untried fi[]dnl ])# _PKG_CONFIG # _PKG_SHORT_ERRORS_SUPPORTED # ----------------------------- AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])# _PKG_SHORT_ERRORS_SUPPORTED # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # # # Note that if there is a possibility the first call to # PKG_CHECK_MODULES might not happen, you should be sure to include an # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac # # # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $1]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD m4_default([$4], [AC_MSG_ERROR( [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl ]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) $3 fi[]dnl ])# PKG_CHECK_MODULES �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mosh-1.4.0/README.md��������������������������������������������������������������������������������0000664�0001750�0001750�00000016136�14272621034�010674� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������[![ci](https://github.com/mobile-shell/mosh/actions/workflows/ci.yml/badge.svg)](https://github.com/mobile-shell/mosh/actions/workflows/ci.yml) Mosh: the mobile shell ====================== Mosh is a remote terminal application that supports intermittent connectivity, allows roaming, and provides speculative local echo and line editing of user keystrokes. It aims to support the typical interactive uses of SSH, plus: * Mosh keeps the session alive if the client goes to sleep and wakes up later, or temporarily loses its Internet connection. * Mosh allows the client and server to "roam" and change IP addresses, while keeping the connection alive. Unlike SSH, Mosh can be used while switching between Wi-Fi networks or from Wi-Fi to cellular data to wired Ethernet. * The Mosh client runs a predictive model of the server's behavior in the background and tries to guess intelligently how each keystroke will affect the screen state. When it is confident in its predictions, it will show them to the user while waiting for confirmation from the server. Most typing and uses of the left- and right-arrow keys can be echoed immediately. As a result, Mosh is usable on high-latency links, e.g. on a cellular data connection or spotty Wi-Fi. In distinction from previous attempts at local echo modes in other protocols, Mosh works properly with full-screen applications such as emacs, vi, alpine, and irssi, and automatically recovers from occasional prediction errors within an RTT. On high-latency links, Mosh underlines its predictions while they are outstanding and removes the underline when they are confirmed by the server. Mosh does not support X forwarding or the non-interactive uses of SSH, including port forwarding. Other features -------------- * Mosh adjusts its frame rate so as not to fill up network queues on slow links, so "Control-C" always works within an RTT to halt a runaway process. * Mosh warns the user when it has not heard from the server in a while. * Mosh supports lossy links that lose a significant fraction of their packets. * Mosh handles some Unicode edge cases better than SSH and existing terminal emulators by themselves, but requires a UTF-8 environment to run. * Mosh leverages SSH to set up the connection and authenticate users. Mosh does not contain any privileged (root) code. Getting Mosh ------------ [The Mosh web site](https://mosh.org/#getting) has information about packages for many operating systems, as well as instructions for building from source. Note that `mosh-client` receives an AES session key as an environment variable. If you are porting Mosh to a new operating system, please make sure that a running process's environment variables are not readable by other users. We have confirmed that this is the case on GNU/Linux, OS X, and FreeBSD. Usage ----- The `mosh-client` binary must exist on the user's machine, and the `mosh-server` binary on the remote host. The user runs: $ mosh [user@]host If the `mosh-client` or `mosh-server` binaries live outside the user's `$PATH`, `mosh` accepts the arguments `--client=PATH` and `--server=PATH` to select alternate locations. More options are documented in the mosh(1) manual page. There are [more examples](https://mosh.org/#usage) and a [FAQ](https://mosh.org/#faq) on the Mosh web site. How it works ------------ The `mosh` program will SSH to `user@host` to establish the connection. SSH may prompt the user for a password or use public-key authentication to log in. From this point, `mosh` runs the `mosh-server` process (as the user) on the server machine. The server process listens on a high UDP port and sends its port number and an AES-128 secret key back to the client over SSH. The SSH connection is then shut down and the terminal session begins over UDP. If the client changes IP addresses, the server will begin sending to the client on the new IP address within a few seconds. To function, Mosh requires UDP datagrams to be passed between client and server. By default, `mosh` uses a port number between 60000 and 61000, but the user can select a particular port with the -p option. Please note that the -p option has no effect on the port used by SSH. Advice to distributors ---------------------- A note on compiler flags: Mosh is security-sensitive code. When making automated builds for a binary package, we recommend passing the option `--enable-compile-warnings=error` to `./configure`. On GNU/Linux with `g++` or `clang++`, the package should compile cleanly with `-Werror`. Please report a bug if it doesn't. Where available, Mosh builds with a variety of binary hardening flags such as `-fstack-protector-all`, `-D_FORTIFY_SOURCE=2`, etc. These provide proactive security against the possibility of a memory corruption bug in Mosh or one of the libraries it uses. For a full list of flags, search for `HARDEN` in `configure.ac`. The `configure` script detects which flags are supported by your compiler, and enables them automatically. To disable this detection, pass `--disable-hardening` to `./configure`. Please report a bug if you have trouble with the default settings; we would like as many users as possible to be running a configuration as secure as possible. Mosh ships with a default optimization setting of `-O2`. Some distributors have asked about changing this to `-Os` (which causes a compiler to prefer space optimizations to time optimizations). We have benchmarked with the included `src/examples/benchmark` program to test this. The results are that `-O2` is 40% faster than `-Os` with g++ 4.6 on GNU/Linux, and 16% faster than `-Os` with clang++ 3.1 on Mac OS X. In both cases, `-Os` did produce a smaller binary (by up to 40%, saving almost 200 kilobytes on disk). While Mosh is not especially CPU intensive and mostly sits idle when the user is not typing, we think the results suggest that `-O2` (the default) is preferable. Our Debian and Fedora packaging presents Mosh as a single package. Mosh has a Perl dependency that is only required for client use. For some platforms, it may make sense to have separate mosh-server and mosh-client packages to allow mosh-server usage without Perl. Notes for developers -------------------- Mosh supports producing code coverage reports by tests, but this feature is disabled by default. To enable it, make sure `lcov` is installed on your system. Then, configure and run tests: ``` $ ./configure --enable-code-coverage $ make check-code-coverage ``` This will run all tests and produce a coverage report in HTML form that can be opened with your favorite browser. Ideally, newly added code should strive for 90% (or better) incremental test coverage. More info --------- * Mosh Web site: <https://mosh.org> * `mosh-devel@mit.edu` mailing list: <https://mailman.mit.edu/mailman/listinfo/mosh-devel> * `mosh-users@mit.edu` mailing list: <https://mailman.mit.edu/mailman/listinfo/mosh-users> * `#mosh` channel on [Libera Chat](https://libera.chat/) https://web.libera.chat/#mosh ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������mosh-1.4.0/ocb-license.html�������������������������������������������������������������������������0000644�0001750�0001750�00000004160�13103401307�012445� �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<TITLE>OCB - An Authenticated-Encryption Scheme - GPL Patent Grant - Rogaway

OCB: Patent Grant for GNU GPL

Whereas I, Phillip Rogaway (hereinafter "Inventor") have sought patent protection for certain technology (hereinafter "Patented Technology"), and Inventor wishes to aid the Free Software Foundation in achieving its goals, and Inventor wishes to increase public awareness of Patented Technology, Inventor hereby grants a fully paid-up, nonexclusive, royalty-free license to practice any patents claiming priority to the patent applications below ("the Patents") if practiced by software distributed under the terms of any version of the GNU General Public License as published by the Free Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111. Inventor reserves all other rights, including without limitation licensing for software not distributed under the GNU General Public License.

The patents:

  • 09/918,615 - Method and Apparatus for Facilitating Efficient Authenticated Encryption.
  • 09/948,084 - Method and Apparatus for Realizing a Parallelizable Variable-Input-Length Pseudorandom Function.

June 12, 2012: Phillip Rogaway licensed the distribution of OCB in Mosh under the GPL with the OpenSSL linking exception and iOS waiver contained in the COPYING.iOS file.

"Mosh with the two GPL exemptions you specify in the attached note is freely licensed to use for any OCB-related IP that I own."
mosh-1.4.0/missing0000755000175000017500000001533614327736657011036 00000000000000#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1996-2021 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 autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # 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) 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'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; 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/>" ;; 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>" ;; 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/>" ;; 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/>" ;; *) 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 } 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: mosh-1.4.0/NEWS0000644000175000017500000000073013103401307010072 000000000000002012-04-26 ---------- * Version 1.2 released 2012-03-22 ---------- * Version 1.1 released 2012-03-12 ---------- * Version 1.0 released 2012-03-07 Release candidate (0.97): ------------------------------------ * Now builds on Mac OS X as well as GNU/Linux 2012-02-06 Initial release (0.9): --------------------------------- * Supports intermittent connectivity * Supports client and server IP roaming * Local echo supports typing and the left and right arrow keys mosh-1.4.0/AUTHORS0000644000175000017500000000015613103401307010445 00000000000000Keith Winstein Anders Kaseorg Quentin Smith Richard Tibbetts Keegan McAllister John Hood mosh-1.4.0/COPYING.iOS0000644000175000017500000000136313103401307011122 00000000000000The Mosh developers are aware that the terms of service that apply to apps distributed via Apple's App Store services may conflict with rights granted under Mosh's license, the GNU General Public License, version 3. The Mosh copyright holders do not wish this conflict to prevent the otherwise-compliant distribution of Mosh-derived apps via the App Store. Therefore, we have committed not to pursue any license violation that results solely from the conflict between the GPLv3 and the Apple App Store terms of service. In other words, as long as you comply with the GPL in all other respects, including its requirements to provide users with source code and the text of the license, we will not object to your distribution of Mosh through the App Store. mosh-1.4.0/scripts/0000775000175000017500000000000014327736673011176 500000000000000mosh-1.4.0/scripts/Makefile.in0000664000175000017500000004073214327736657013173 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 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)) 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 = : subdir = scripts ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ $(top_srcdir)/m4/ax_ac_print_to_file.m4 \ $(top_srcdir)/m4/ax_add_am_macro_static.m4 \ $(top_srcdir)/m4/ax_am_macros_static.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_gnu_make.m4 \ $(top_srcdir)/m4/ax_check_library.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_code_coverage.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ $(top_srcdir)/m4/ax_file_escapes.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 $(top_srcdir)/m4/pkg.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 = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = 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 -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(bindir)" SCRIPTS = $(bin_SCRIPTS) 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__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@ CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@ CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@ CPPFLAGS = @CPPFLAGS@ CRYPTO_CFLAGS = @CRYPTO_CFLAGS@ CRYPTO_LIBS = @CRYPTO_LIBS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CURSES_LIB = @CURSES_LIB@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FUZZING_CFLAGS = @FUZZING_CFLAGS@ GCOV = @GCOV@ GENHTML = @GENHTML@ HARDEN_CFLAGS = @HARDEN_CFLAGS@ HARDEN_LDFLAGS = @HARDEN_LDFLAGS@ HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LCOV = @LCOV@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MISC_CXXFLAGS = @MISC_CXXFLAGS@ MKDIR_P = @MKDIR_P@ Nettle_CFLAGS = @Nettle_CFLAGS@ Nettle_LIBS = @Nettle_LIBS@ OBJEXT = @OBJEXT@ OpenSSL_CFLAGS = @OpenSSL_CFLAGS@ OpenSSL_LIBS = @OpenSSL_LIBS@ 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@ PICKY_CXXFLAGS = @PICKY_CXXFLAGS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROTOC = @PROTOC@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TINFO_CFLAGS = @TINFO_CFLAGS@ TINFO_CPPFLAGS = @TINFO_CPPFLAGS@ TINFO_LDFLAGS = @TINFO_LDFLAGS@ TINFO_LIBS = @TINFO_LIBS@ VERSION = @VERSION@ WARNING_CXXFLAGS = @WARNING_CXXFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ completions = @completions@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ ifGNUmake = @ifGNUmake@ ifnGNUmake = @ifnGNUmake@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ protobuf_CFLAGS = @protobuf_CFLAGS@ protobuf_LIBS = @protobuf_LIBS@ 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@ EXTRA_DIST = wrap-compiler-for-flag-check mosh.pl @BUILD_CLIENT_TRUE@bin_SCRIPTS = mosh CLEANFILES = $(bin_SCRIPTS) 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 scripts/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign scripts/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-binSCRIPTS: $(bin_SCRIPTS) @$(NORMAL_INSTALL) @list='$(bin_SCRIPTS)'; 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 \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n' \ -e 'h;s|.*|.|' \ -e 'p;x;s,.*/,,;$(transform)' | 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; \ if (++n[d] == $(am__install_max)) { \ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ else { print "f", d "/" $$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_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir) installcheck-binSCRIPTS: $(bin_SCRIPTS) bad=0; pid=$$$$; list="$(bin_SCRIPTS)"; for p in $$list; do \ case ' $(AM_INSTALLCHECK_STD_OPTIONS_EXEMPT) ' in \ *" $$p "* | *" $(srcdir)/$$p "*) continue;; \ esac; \ f=`echo "$$p" | sed 's,^.*/,,;$(transform)'`; \ for opt in --help --version; do \ if "$(DESTDIR)$(bindir)/$$f" $$opt >c$${pid}_.out \ 2>c$${pid}_.err &2; bad=1; fi; \ done; \ done; rm -f c$${pid}_.???; exit $$bad 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 $(SCRIPTS) 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: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || 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-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binSCRIPTS 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: installcheck-binSCRIPTS 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-binSCRIPTS .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-binSCRIPTS \ 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 installcheck-binSCRIPTS \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags-am \ uninstall uninstall-am uninstall-binSCRIPTS .PRECIOUS: Makefile mosh: mosh.pl ../VERSION Makefile perl -Mdiagnostics -c $(srcdir)/mosh.pl @sed -e "s/\@VERSION\@/`cat ../VERSION`/" -e "s/\@PACKAGE_STRING\@/@PACKAGE_STRING@/" $(srcdir)/mosh.pl > mosh @chmod a+x mosh # 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: mosh-1.4.0/scripts/wrap-compiler-for-flag-check0000775000175000017500000000076514174450057016370 00000000000000#!/bin/sh # There is no way to make clang's "argument unused" warning fatal. So when # configure checks for supported flags, it runs $CXX and $LD via this # wrapper. # # Ideally the search string would also include 'clang: ' but this output might # depend on clang's argv[0]. if out=$("$@" 2>&1); then echo "$out" if echo "$out" | grep 'warning: argument unused' >/dev/null; then echo "$0: found clang warning" exit 1 else exit 0 fi else code=$? echo "$out" exit $code fi mosh-1.4.0/scripts/Makefile.am0000664000175000017500000000050614174450057013140 00000000000000EXTRA_DIST = wrap-compiler-for-flag-check mosh.pl if BUILD_CLIENT bin_SCRIPTS = mosh endif CLEANFILES = $(bin_SCRIPTS) mosh: mosh.pl ../VERSION Makefile perl -Mdiagnostics -c $(srcdir)/mosh.pl @sed -e "s/\@VERSION\@/`cat ../VERSION`/" -e "s/\@PACKAGE_STRING\@/@PACKAGE_STRING@/" $(srcdir)/mosh.pl > mosh @chmod a+x mosh mosh-1.4.0/scripts/mosh.pl0000775000175000017500000004007514174450064012415 00000000000000#!/usr/bin/env perl # Mosh: the mobile shell # Copyright 2012 Keith Winstein # # 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 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 . # # In addition, as a special exception, the copyright holders give # permission to link the code of portions of this program with the # OpenSSL library under certain conditions as described in each # individual source file, and distribute linked combinations including # the two. # # You must obey the GNU General Public License in all respects for all # of the code used other than OpenSSL. If you modify file(s) with this # exception, you may extend this exception to your version of the # file(s), but you are not obligated to do so. If you do not wish to do # so, delete this exception statement from your version. If you delete # this exception statement from all source files in the program, then # also delete it here. use 5.8.8; use warnings; use strict; use Getopt::Long; use IO::Socket; use Text::ParseWords; use Socket qw(IPPROTO_TCP); use Errno qw(EINTR); use POSIX qw(_exit); BEGIN { my @gai_reqs = qw( getaddrinfo getnameinfo AI_CANONNAME AI_NUMERICHOST NI_NUMERICHOST ); eval { Socket->import( @gai_reqs ); 1; } || (eval { require Socket::GetAddrInfo; 1; } && (eval { Socket::GetAddrInfo->import( ':newapi', @gai_reqs ); 1; } || eval { Socket::GetAddrInfo->import( '0.22', @gai_reqs ); 1; })) || die "$0 error: requires Perl 5.14 or Socket::GetAddrInfo.\n"; } my $have_ipv6 = eval { require IO::Socket::IP; IO::Socket::IP->import('-register'); 1; } || eval { require IO::Socket::INET6; 1; }; $|=1; my $client = 'mosh-client'; my $server = 'mosh-server'; my $predict = undef; my $overwrite = 0; my $bind_ip = undef; my $use_remote_ip = 'proxy'; my $family = 'prefer-inet'; my $port_request = undef; my @ssh = ('ssh'); my $term_init = 1; my $localhost = undef; my $ssh_pty = 1; my $help = undef; my $version = undef; my @cmdline = @ARGV; my $usage = qq{Usage: $0 [options] [--] [user@]host [command...] --client=PATH mosh client on local machine (default: "mosh-client") --server=COMMAND mosh server on remote machine (default: "mosh-server") --predict=adaptive local echo for slower links [default] -a --predict=always use local echo even on fast links -n --predict=never never use local echo --predict=experimental aggressively echo even when incorrect -o --predict-overwrite prediction overwrites instead of inserting -4 --family=inet use IPv4 only -6 --family=inet6 use IPv6 only --family=auto autodetect network type for single-family hosts only --family=all try all network types --family=prefer-inet use all network types, but try IPv4 first [default] --family=prefer-inet6 use all network types, but try IPv6 first -p PORT[:PORT2] --port=PORT[:PORT2] server-side UDP port or range (No effect on server-side SSH port) --bind-server={ssh|any|IP} ask the server to reply from an IP address (default: "ssh") --ssh=COMMAND ssh command to run when setting up session (example: "ssh -p 2222") (default: "ssh") --no-ssh-pty do not allocate a pseudo tty on ssh connection --no-init do not send terminal initialization string --local run mosh-server locally without using ssh --experimental-remote-ip=(local|remote|proxy) select the method for discovering the remote IP address to use for mosh (default: "proxy") --help this message --version version and copyright information Please report bugs to mosh-devel\@mit.edu. Mosh home page: https://mosh.org\n}; my $version_message = '@PACKAGE_STRING@ [build @VERSION@]' . qq{ Copyright 2012 Keith Winstein License GPLv3+: GNU GPL version 3 or later . This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.\n}; sub predict_check { my ( $predict, $env_set ) = @_; if ( not exists { adaptive => 0, always => 0, never => 0, experimental => 0 }->{ $predict } ) { my $explanation = $env_set ? " (MOSH_PREDICTION_DISPLAY in environment)" : ""; print STDERR qq{$0: Unknown mode \"$predict\"$explanation.\n\n}; die $usage; } } GetOptions( 'client=s' => \$client, 'server=s' => \$server, 'predict=s' => \$predict, 'predict-overwrite|o!' => \$overwrite, 'port=s' => \$port_request, 'a' => sub { $predict = 'always' }, 'n' => sub { $predict = 'never' }, 'family=s' => \$family, '4' => sub { $family = 'inet' }, '6' => sub { $family = 'inet6' }, 'p=s' => \$port_request, 'ssh=s' => sub { @ssh = shellwords($_[1]); }, 'ssh-pty!' => \$ssh_pty, 'init!' => \$term_init, 'local' => \$localhost, 'help' => \$help, 'version' => \$version, 'fake-proxy!' => \my $fake_proxy, 'bind-server=s' => \$bind_ip, 'experimental-remote-ip=s' => \$use_remote_ip) or die $usage; if ( defined $help ) { print $usage; exit; } if ( defined $version ) { print $version_message; exit; } if ( defined $predict ) { predict_check( $predict, 0 ); } elsif ( defined $ENV{ 'MOSH_PREDICTION_DISPLAY' } ) { $predict = $ENV{ 'MOSH_PREDICTION_DISPLAY' }; predict_check( $predict, 1 ); } else { $predict = 'adaptive'; predict_check( $predict, 0 ); } if ( not grep { $_ eq $use_remote_ip } qw { local remote proxy } ) { die "Unknown parameter $use_remote_ip"; } $family = lc( $family ); # Handle IPv4-only Perl installs. if (!$have_ipv6) { # Report failure if IPv6 needed and not available. if (defined($family) && $family eq "inet6") { die "$0: IPv6 sockets not available in this Perl install\n"; } # Force IPv4. $family = "inet"; } if ( $overwrite ) { $ENV{ "MOSH_PREDICTION_OVERWRITE" } = "yes"; } if ( defined $port_request ) { if ( $port_request =~ m{^(\d+)(:(\d+))?$} ) { my ( $low, $clause, $high ) = ( $1, $2, $3 ); # good port or port-range if ( $low < 0 or $low > 65535 ) { die "$0: Server-side (low) port ($low) must be within valid range [0..65535].\n"; } if ( defined $high ) { if ( $high <= 0 or $high > 65535 ) { die "$0: Server-side high port ($high) must be within valid range [1..65535].\n"; } if ( $low == 0 ) { die "$0: Server-side port ranges may not be used with starting port 0 ($port_request).\n"; } if ( $low > $high ) { die "$0: Server-side port range ($port_request): low port greater than high port.\n"; } } } else { die "$0: Server-side port or range ($port_request) is not valid.\n"; } } delete $ENV{ 'MOSH_PREDICTION_DISPLAY' }; my $userhost; my @command; my @bind_arguments; if ( ! defined $fake_proxy ) { if ( scalar @ARGV < 1 ) { die $usage; } $userhost = shift; @command = @ARGV; if ( not defined $bind_ip or $bind_ip =~ m{^ssh$}i ) { if ( not defined $localhost ) { push @bind_arguments, '-s'; } else { push @bind_arguments, ('-i', "$userhost"); } } elsif ( $bind_ip =~ m{^any$}i ) { # do nothing } else { push @bind_arguments, ('-i', "$bind_ip"); } } else { my ( $host, $port ) = @ARGV; my @res = resolvename( $host, $port, $family ); # Now try and connect to something. my $err; my $sock; my $addr_string; my $service; for my $ai ( @res ) { ( $err, $addr_string, $service ) = getnameinfo( $ai->{addr}, NI_NUMERICHOST ); next if $err; if ( $sock = IO::Socket->new( Domain => $ai->{family}, Family => $ai->{family}, PeerHost => $addr_string, PeerPort => $port, Proto => 'tcp' )) { print STDERR 'MOSH IP ', $addr_string, "\n"; last; } else { $err = $@; } } die "$0: Could not connect to ${host}, last tried ${addr_string}: ${err}\n" if !$sock; # Act like netcat binmode($sock); binmode(STDIN); binmode(STDOUT); sub cat { my ( $from, $to ) = @_; while ( my $n = $from->sysread( my $buf, 4096 ) ) { next if ( $n == -1 && $! == EINTR ); $n >= 0 or last; $to->write( $buf ) or last; } } defined( my $pid = fork ) or die "$0: fork: $!\n"; if ( $pid == 0 ) { close STDIN; cat $sock, \*STDOUT; $sock->shutdown( 0 ); _exit 0; } $SIG{ 'HUP' } = 'IGNORE'; close STDOUT; cat \*STDIN, $sock; $sock->shutdown( 1 ); close STDIN; waitpid $pid, 0; exit; } # Count colors open COLORCOUNT, '-|', $client, ('-c') or die "Can't count colors: $!\n"; my $colors = ""; { local $/ = undef; $colors = ; } close COLORCOUNT or die; chomp $colors; if ( (not defined $colors) or $colors !~ m{^[0-9]+$} or $colors < 0 ) { $colors = 0; } $ENV{ 'MOSH_CLIENT_PID' } = $$; # We don't support this, but it's useful for test and debug. # If we are using a locally-resolved address, we have to get it before we fork, # so both parent and child get it. my $ip; if ( $use_remote_ip eq 'local' ) { # "parse" the host from what the user gave us my ($user, $host) = $userhost =~ /^((?:.*@)?)(.*)$/; # get list of addresses my @res = resolvename( $host, 22, $family ); # Use only the first address as the Mosh IP my $hostaddr = $res[0]; if ( !defined $hostaddr ) { die( "could not find address for $host" ); } my ( $err, $addr_string, $service ) = getnameinfo( $hostaddr->{addr}, NI_NUMERICHOST ); if ( $err ) { die( "could not use address for $host" ); } $ip = $addr_string; $userhost = "$user$ip"; } my $pid = open(my $pipe, "-|"); die "$0: fork: $!\n" unless ( defined $pid ); if ( $pid == 0 ) { # child open(STDERR, ">&STDOUT") or die; my @sshopts = ( '-n' ); if ($ssh_pty) { push @sshopts, '-tt'; } my $ssh_connection = ""; if ( $use_remote_ip eq 'remote' ) { # Ask the server for its IP. The user's shell may not be # Posix-compatible so invoke sh explicitly. $ssh_connection = "sh -c " . shell_quote ( '[ -n "$SSH_CONNECTION" ] && printf "\nMOSH SSH_CONNECTION %s\n" "$SSH_CONNECTION"' ) . " ; "; # Only with 'remote', we may need to tell SSH which protocol to use. if ( $family eq 'inet' ) { push @sshopts, '-4'; } elsif ( $family eq 'inet6' ) { push @sshopts, '-6'; } } my @server = ( 'new' ); push @server, ( '-c', $colors ); push @server, @bind_arguments; if ( defined $port_request ) { push @server, ( '-p', $port_request ); } for ( &locale_vars ) { push @server, ( '-l', $_ ); } if ( scalar @command > 0 ) { push @server, '--', @command; } if ( defined( $localhost )) { delete $ENV{ 'SSH_CONNECTION' }; chdir; # $HOME print "MOSH IP ${userhost}\n"; exec( "$server " . shell_quote( @server ) ); die "Cannot exec $server: $!\n"; } if ( $use_remote_ip eq 'proxy' ) { # Non-standard shells and broken shrc files cause the ssh # proxy to break mysteriously. $ENV{ 'SHELL' } = '/bin/sh'; my $quoted_proxy_command = shell_quote( $0, "--family=$family" ); push @sshopts, ( '-S', 'none', '-o', "ProxyCommand=$quoted_proxy_command --fake-proxy -- %h %p" ); } my @exec_argv = ( @ssh, @sshopts, $userhost, '--', $ssh_connection . "$server " . shell_quote( @server ) ); exec @exec_argv; die "Cannot exec ssh: $!\n"; } else { # parent my ( $sship, $port, $key ); my $bad_udp_port_warning = 0; LINE: while ( <$pipe> ) { chomp; if ( m{^MOSH IP } ) { if ( defined $ip ) { die "$0 error: detected attempt to redefine MOSH IP.\n"; } ( $ip ) = m{^MOSH IP (\S+)\s*$} or die "Bad MOSH IP string: $_\n"; } elsif ( m{^MOSH SSH_CONNECTION } ) { my @words = split; if ( scalar @words == 6 ) { $sship = $words[4]; } else { die "Bad MOSH SSH_CONNECTION string: $_\n"; } } elsif ( m{^MOSH CONNECT } ) { if ( ( $port, $key ) = m{^MOSH CONNECT (\d+?) ([A-Za-z0-9/+]{22})\s*$} ) { last LINE; } else { die "Bad MOSH CONNECT string: $_\n"; } } else { if ( defined $port_request and $port_request =~ m{:} and m{Bad UDP port} ) { $bad_udp_port_warning = 1; } print "$_\n"; } } close $pipe; waitpid $pid, 0; if ( not defined $ip ) { if ( defined $sship ) { warn "$0: Using remote IP address ${sship} from \$SSH_CONNECTION for hostname ${userhost}\n"; $ip = $sship; } else { die "$0: Did not find remote IP address (is SSH ProxyCommand disabled?).\n"; } } if ( not defined $key or not defined $port ) { if ( $bad_udp_port_warning ) { die "$0: Server does not support UDP port range option.\n"; } die "$0: Did not find mosh server startup message. (Have you installed mosh on your server?)\n"; } # Now start real mosh client $ENV{ 'MOSH_KEY' } = $key; $ENV{ 'MOSH_PREDICTION_DISPLAY' } = $predict; $ENV{ 'MOSH_NO_TERM_INIT' } = '1' if !$term_init; exec {$client} ("$client", "-# @cmdline |", $ip, $port); } sub shell_quote { join ' ', map {(my $a = $_) =~ s/'/'\\''/g; "'$a'"} @_ } sub locale_vars { my @names = qw[LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION LC_ALL]; my @assignments; for ( @names ) { if ( defined $ENV{ $_ } ) { push @assignments, $_ . q{=} . $ENV{ $_ }; } } return @assignments; } sub resolvename { my ( $host, $port, $family ) = @_; my $err; my @res; my $af; # If the user selected a specific family, parse it. if ( defined( $family ) && ( $family eq 'inet' || $family eq 'inet6' )) { # Choose an address family, or cause pain. my $afstr = 'AF_' . uc( $family ); $af = eval { IO::Socket->$afstr } or die "$0: Invalid family $family\n"; } # First try the address as a numeric. my %hints = ( flags => AI_NUMERICHOST, socktype => SOCK_STREAM, protocol => IPPROTO_TCP ); if ( defined( $af )) { $hints{family} = $af; } ( $err, @res ) = getaddrinfo( $host, $port, \%hints ); if ( $err ) { # Get canonical name for this host. $hints{flags} = AI_CANONNAME; ( $err, @res ) = getaddrinfo( $host, $port, \%hints ); die "$0: could not get canonical name for $host: ${err}\n" if $err; # Then get final resolution of the canonical name. delete $hints{flags}; my @newres; ( $err, @newres ) = getaddrinfo( $res[0]{canonname}, $port, \%hints ); die "$0: could not resolve canonical name ${res[0]{canonname}} for ${host}: ${err}\n" if $err; @res = @newres; } if ( defined( $af )) { # If v4 or v6 was specified, reduce the host list. @res = grep {$_->{family} == $af} @res; } elsif ( $family =~ /^prefer-/ ) { # If prefer-* was specified, reorder the host list to put that family first. my $prefer_afstr = 'AF_' . uc( ($family =~ /prefer-(.*)/)[0] ); my $prefer_af = eval { IO::Socket->$prefer_afstr } or die "$0: Invalid preferred family $family\n"; @res = (grep({$_->{family} == $prefer_af} @res), grep({$_->{family} != $prefer_af} @res)); } elsif ( $family ne 'all' ) { # If v4/v6/all were not specified, verify that this host only has one address family available. for my $ai ( @res ) { if ( !defined( $af )) { $af = $ai->{family}; } else { die "$0: host has both IPv4 and IPv6 addresses, use --family to specify behavior\n" if $af != $ai->{family}; } } } return @res; } mosh-1.4.0/COPYING0000644000175000017500000010451313103401307010432 00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. 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 them 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 prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. 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. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey 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; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If 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 convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU 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 that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. 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. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 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. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. 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 state 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) 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 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 . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program 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, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU 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 Lesser General Public License instead of this License. But first, please read . mosh-1.4.0/aclocal.m40000664000175000017500000012737614327736656011310 00000000000000# generated automatically by aclocal 1.16.5 -*- Autoconf -*- # Copyright (C) 1996-2021 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.71],, [m4_warning([this file was generated for autoconf 2.71. 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-2021 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.16' 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.16.5], [], [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.16.5])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # Copyright (C) 2011-2021 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_AR([ACT-IF-FAIL]) # ------------------------- # Try to determine the archiver interface, and trigger the ar-lib wrapper # if it is needed. If the detection of archiver interface fails, run # ACT-IF-FAIL (default is to abort configure with a proper error message). AC_DEFUN([AM_PROG_AR], [AC_BEFORE([$0], [LT_INIT])dnl AC_BEFORE([$0], [AC_PROG_LIBTOOL])dnl AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([ar-lib])dnl AC_CHECK_TOOLS([AR], [ar lib "link -lib"], [false]) : ${AR=ar} AC_CACHE_CHECK([the archiver ($AR) interface], [am_cv_ar_interface], [AC_LANG_PUSH([C]) am_cv_ar_interface=ar AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int some_variable = 0;]])], [am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([am_ar_try]) if test "$ac_status" -eq 0; then am_cv_ar_interface=ar else am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([am_ar_try]) if test "$ac_status" -eq 0; then am_cv_ar_interface=lib else am_cv_ar_interface=unknown fi fi rm -f conftest.lib libconftest.a ]) AC_LANG_POP([C])]) case $am_cv_ar_interface in ar) ;; lib) # Microsoft lib, so override with the ar-lib wrapper script. # FIXME: It is wrong to rewrite AR. # 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__AR in this case, # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something # similar. AR="$am_aux_dir/ar-lib $AR" ;; unknown) m4_default([$1], [AC_MSG_ERROR([could not determine $AR interface])]) ;; esac AC_SUBST([AR])dnl ]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2021 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-2021 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-2021 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 thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [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-2021 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-2021 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 # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi fi 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-2021 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-2021 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-2021 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-2021 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-2021 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-2021 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) 2001-2021 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-2021 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_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [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). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file 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 if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # 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 grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi 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-2021 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([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [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 ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac 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]) 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 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 ]) # Copyright (C) 2001-2021 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-2021 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-2021 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 $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 $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 m4_include([m4/ax_ac_append_to_file.m4]) m4_include([m4/ax_ac_print_to_file.m4]) m4_include([m4/ax_add_am_macro_static.m4]) m4_include([m4/ax_am_macros_static.m4]) m4_include([m4/ax_check_compile_flag.m4]) m4_include([m4/ax_check_gnu_make.m4]) m4_include([m4/ax_check_library.m4]) m4_include([m4/ax_check_link_flag.m4]) m4_include([m4/ax_code_coverage.m4]) m4_include([m4/ax_cxx_compile_stdcxx.m4]) m4_include([m4/ax_file_escapes.m4]) m4_include([m4/ax_with_curses.m4]) m4_include([m4/pkg.m4]) mosh-1.4.0/man/0000775000175000017500000000000014327736673010262 500000000000000mosh-1.4.0/man/Makefile.in0000664000175000017500000003757614327736657012273 00000000000000# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2021 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)) 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_CLIENT_TRUE@am__append_1 = mosh.1 mosh-client.1 @BUILD_SERVER_TRUE@am__append_2 = mosh-server.1 subdir = man ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ $(top_srcdir)/m4/ax_ac_print_to_file.m4 \ $(top_srcdir)/m4/ax_add_am_macro_static.m4 \ $(top_srcdir)/m4/ax_am_macros_static.m4 \ $(top_srcdir)/m4/ax_check_compile_flag.m4 \ $(top_srcdir)/m4/ax_check_gnu_make.m4 \ $(top_srcdir)/m4/ax_check_library.m4 \ $(top_srcdir)/m4/ax_check_link_flag.m4 \ $(top_srcdir)/m4/ax_code_coverage.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ $(top_srcdir)/m4/ax_file_escapes.m4 \ $(top_srcdir)/m4/ax_with_curses.m4 $(top_srcdir)/m4/pkg.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 = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/include/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 -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } 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 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ CODE_COVERAGE_CPPFLAGS = @CODE_COVERAGE_CPPFLAGS@ CODE_COVERAGE_CXXFLAGS = @CODE_COVERAGE_CXXFLAGS@ CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ CODE_COVERAGE_LIBS = @CODE_COVERAGE_LIBS@ CPPFLAGS = @CPPFLAGS@ CRYPTO_CFLAGS = @CRYPTO_CFLAGS@ CRYPTO_LIBS = @CRYPTO_LIBS@ CSCOPE = @CSCOPE@ CTAGS = @CTAGS@ CURSES_LIB = @CURSES_LIB@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ FUZZING_CFLAGS = @FUZZING_CFLAGS@ GCOV = @GCOV@ GENHTML = @GENHTML@ HARDEN_CFLAGS = @HARDEN_CFLAGS@ HARDEN_LDFLAGS = @HARDEN_LDFLAGS@ HAVE_CXX11 = @HAVE_CXX11@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LCOV = @LCOV@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MISC_CXXFLAGS = @MISC_CXXFLAGS@ MKDIR_P = @MKDIR_P@ Nettle_CFLAGS = @Nettle_CFLAGS@ Nettle_LIBS = @Nettle_LIBS@ OBJEXT = @OBJEXT@ OpenSSL_CFLAGS = @OpenSSL_CFLAGS@ OpenSSL_LIBS = @OpenSSL_LIBS@ 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@ PICKY_CXXFLAGS = @PICKY_CXXFLAGS@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PROTOC = @PROTOC@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TINFO_CFLAGS = @TINFO_CFLAGS@ TINFO_CPPFLAGS = @TINFO_CPPFLAGS@ TINFO_LDFLAGS = @TINFO_LDFLAGS@ TINFO_LIBS = @TINFO_LIBS@ VERSION = @VERSION@ WARNING_CXXFLAGS = @WARNING_CXXFLAGS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ completions = @completions@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ ifGNUmake = @ifGNUmake@ ifnGNUmake = @ifnGNUmake@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ protobuf_CFLAGS = @protobuf_CFLAGS@ protobuf_LIBS = @protobuf_LIBS@ 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_man_MANS = $(am__append_1) $(am__append_2) 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: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || 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: mosh-1.4.0/man/mosh.10000664000175000017500000002723414174450057011227 00000000000000.\" Hey, EMACS: -*- nroff -*- .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) .TH MOSH 1 "April 2013" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME mosh \- mobile shell with roaming and intelligent local echo .SH SYNOPSIS .B mosh .RI [ options ] [--] [user@]host [command...] .br .SH DESCRIPTION \fBmosh\fP (mobile shell) is a remote terminal application that supports intermittent connectivity, allows roaming, and provides speculative local echo and line editing of user keystrokes. Compared with \fBssh\fP, \fBmosh\fP is more robust \(em its connections stay up across sleeps and changes in the client's IP address \(em and more responsive, because the protocol is tolerant of packet loss and the client can echo most keystrokes immediately, without waiting for a network round-trip. \fBmosh\fP uses \fBssh\fP to establish a connection to the remote host and authenticate with existing means (e.g., public-key authentication or a password). \fBmosh\fP executes the unprivileged \fBmosh-server\fP helper program on the server, then closes the SSH connection and starts the \fBmosh-client\fP, which establishes a long-lived datagram connection over UDP. To improve responsiveness, \fBmosh\fP runs a predictive model of the server's behavior in the background, trying to guess the effect of each keystroke on the screen. It makes predictions for normal typing, backspace, and the left- and right-arrow keys. When it is confident, \fBmosh\fP displays the predictions without waiting for the server. The predictive model must prove itself anew on each row of the terminal and after each control character, so \fBmosh\fP avoids echoing passwords or non-echoing editor commands. By default, \fBmosh\fP shows its predictions only on high-latency connections and to smooth out network glitches. (On longer-latency links, the predicted cells are underlined until confirmed by the server.) Occasional echo mistakes are corrected within a network round-trip and do not cause lasting effect. \fBmosh\fP does not support X forwarding or the non-interactive uses of SSH, including port forwarding or sshfs. \fBmosh\fP works through typical client-side network address translators but requires UDP to pass between client and server. By default, \fBmosh\fP uses the ports between 60000 and 61000, but allows the user to request a particular UDP port instead. Currently, \fBmosh\fP has limited support for IPv6, dual-stack networks, and servers with multiple addresses. At session start, it will select a single IPv4 or IPv6 server address to connect to for the lifetime of the session. \fBmosh\fP will do its best to arrange a UTF-8 character set locale on the client and server. The client must have locale-related environment variables that specify UTF-8. \fBmosh\fP will pass these client variables to the \fBmosh-server\fP on its command line, but in most cases they will not need to be used. \fBmosh-server\fP first attempts to use its own locale-related environment variables, which come from the system default configuration (sometimes /etc/default/locale) or from having been passed over the SSH connection. But if these variables don't call for the use of UTF-8, \fBmosh-server\fP will apply the locale-related environment variables from the client and try again. .SH OPTIONS Options named \fB \-\-experimental-*\fP are subject to change or removal in future versions of Mosh; their design or function is not yet final. .TP .B \fIcommand\fP Command to run on remote host. By default, \fBmosh\fP executes a login shell. .TP .B \-\-client=\fIPATH\fP path to client helper on local machine (default: "mosh-client") .TP .B \-\-server=\fICOMMAND\fP command to run server helper on remote machine (default: "mosh-server") The server helper is unprivileged and can be installed in the user's home directory. This option can be used to set environment variables for the server by using the .BR env (1) command to wrap the actual server command. See .BR mosh-server (1) for available environment variables. .TP .B \-\-ssh=\fICOMMAND\fP OpenSSH command to remotely execute mosh-server on remote machine (default: "ssh") An alternate ssh port can be specified with, \fIe.g.\fP, \-\-ssh="ssh \-p 2222". .TP .B \-\-ssh-pty\fP .B \-\-no-ssh-pty\fP Enable or disable ssh's use of a pty when connecting to a remote host. The default is enabled. .TP .B \-\-predict=\fIWHEN\fP Controls use of speculative local echo. WHEN defaults to `adaptive' (show predictions on slower links and to smooth out network glitches) and can also be `always` or `never'. The MOSH_PREDICTION_DISPLAY environment variable controls this setting permanently and can adopt the same three values. Even on `always', \fBmosh\fP will only show predictions when it is confident. This generally means a previous prediction on the same row of the terminal has been confirmed by the server, without any intervening control character keystrokes. .TP .B \-a Synonym for \-\-predict=always .TP .B \-n Synonym for \-\-predict=never .TP .B \-\-predict\-overwrite\fP When prediction is enabled, do not insert speculative local echo before existing text, but overwrite it instead. The MOSH_PREDICTION_OVERWRITE environment variable also enables this if its value is 'yes'. .TP .B \-o Synonym for \-\-predict\-overwrite .TP .B \-\-family=inet Only use IPv4 for the SSH connection and Mosh session. .TP .B \-\-family=inet6 Only use IPv6 for the SSH connection and Mosh session. This and the following modes require Perl's IO::Socket::IP or IO::Socket::INET6 modules. .TP .B \-\-family=auto Autodetect IPv4 or IPv6 for hosts that only have addresses in a single family. Hosts with both IPv4 and IPv6 addresses will raise an error, and require re-invocation of \fBmosh\fP with another \fB\-\-family\fP option. .TP .B \-\-family=all Choose an address from all available IPv4 or IPv6 address, even for dual-stack hosts. This is the most convenient option, but requires dual-stack connectivity, and Mosh 1.2.5 or later on the server, when roaming with dual-stack servers. .TP .B \-\-family=prefer-inet Similar to \fB\-\-family=all\fP, but attempt connects to the IPv4 addresses first. This is the default. .TP .B \-\-family=prefer-inet6 Similar to \fB\-\-family=all\fP, but attempt connects to the IPv6 addresses first. .TP .B \-4 Synonym for \-\-family=inet .TP .B \-6 Synonym for \-\-family=inet6 .TP .B \-p \fIPORT\fP[:\fIPORT2\fP], \-\-port=\fIPORT\fP[:\fIPORT2\fP] Use a particular server-side UDP port or port range, for example, if this is the only port that is forwarded through a firewall to the server. With \fB\-p 0\fP, the server will let the operating system pick an available UDP port. Otherwise, \fBmosh\fP will choose a port between 60000 and 61000. Please note that this option does not affect the server-side port used by SSH. .TP .B \-\-bind\-server={ssh|any|\fIIP\fP} Control the IP address that the \fBmosh-server\fP binds to. The default is `ssh', in which case the server will reply from the IP address that the SSH connection came from (as found in the \fBSSH_CONNECTION\fP environment variable). This is useful for multihomed servers. With \-\-bind\-server=any, the server will reply on the default interface and will not bind to a particular IP address. This can be useful if the connection is made through \fBsslh\fP or another tool that makes the SSH connection appear to come from localhost. With \-\-bind\-server=\fIIP\fP, the server will attempt to bind to the specified IP address. .TP .B \-\-no\-init Do not send the \fBsmcup\fP initialization string and \fBrmcup\fP deinitialization string to the client's terminal. On many terminals this disables alternate screen mode. .TP .B \-\-local Invoke \fBmosh-server\fP locally, without using \fBssh\fP. This option requires the \fBhost\fP argument to be a local, numeric IPv4/IPv6 address. This option is useful for testing. .TP .B \-\-experimental\-remote\-ip={proxy|local|remote} Select the method used to discover the IP address that the \fBmosh-client\fP connects to. The default is \fBproxy\fP, which uses SSH's .B \-\-ssh\-proxy\-command option to generate and report the exact address that \fBssh\fP uses to connect to the remote host. This option is generally the most compatible with hosts and other options configured in \fBssh\fP configuration files. However, this may not work for some configurations, or for environments where a \fBssh\fP bastion host forwards to a remote machine. It only works with \fBOpenSSH\fP. With \fBremote\fP, the server's .B SSH_CONNECTION environment variable will be used. This is useful for environments where \fBssh\fP forwarding is used, or the .B \-\-ssh\-proxy\-command option is used for other purposes. With \fBlocal\fP, Mosh resolves the hostname given on its command line, and uses that address for both \fBssh\fP and Mosh connections. This option ignores any configuration in .B ssh_config for the same hostname. .SH ESCAPE SEQUENCES The default escape character used by Mosh is ASCII RS (decimal 30). This is typically typed as \fBCtrl-^\fP or \fBCtrl-Shift-6\fP, on US English keyboards. Users of non-English keyboards may find it difficult or impossible to type the default escape character, and may need to change the escape character. See the description of MOSH_ESCAPE_KEY, below. In this description, the configured escape character is represented as \fBEsc\fP. There are two slightly different modes for escape sequences, depending whether the escape character is printable or not. If the escape character is a printable character, it must be prefixed with a newline, similar to \fBOpenSSH\fP. To send the escape character itself, type it twice. If the escape character is set to \fB~\fP, \fBmosh\fP will behave much like \fBOpenSSH\fP. If the escape character is a non-printable control character, no prefix is used and the escape character is recognized at any time. To send the escape character itself, type the escape character, then its corresponding ASCII character (for \fBCtrl-^\fP you would type \fB^\fP, for \fBCtrl-B\fP you would type \fBB\fP). The escape sequence to shut down the connection is \fBEsc .\fP. The sequence \fBEsc Ctrl-Z\fP suspends the client. Any other sequence passes both characters through to the server. .SH ENVIRONMENT VARIABLES These variables are not actually interpreted by .BR mosh (1) itself, but are passed through to .BR mosh-server (1). They are described here for ease of use. .TP .B MOSH_ESCAPE_KEY When set, this configures the escape character used for local commands. The escape character may be set to any ASCII character in the range 1-127. The variable must be set with a single literal ASCII character. Control characters are set with the actual ASCII control character, not with a printable representation such as "^B". .TP .B MOSH_PREDICTION_DISPLAY Controls local echo as described above. The command-line flag overrides this variable. .TP .B MOSH_TITLE_NOPREFIX When set, inhibits prepending "[mosh]" to window title. .SH SEE ALSO .BR mosh-client (1), .BR mosh-server (1). Project home page: .I https://mosh.org .br .SH AUTHOR mosh was written by Keith Winstein . .SH BUGS Please report bugs to \fImosh-devel@mit.edu\fP. Users may also subscribe to the .nh .I mosh-users@mit.edu .hy mailing list, at .br .nh .I http://mailman.mit.edu/mailman/listinfo/mosh-users .hy . mosh-1.4.0/man/mosh-client.10000664000175000017500000000534314174450057012500 00000000000000.\" Hey, EMACS: -*- nroff -*- .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) .TH MOSH 1 "February 2012" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME mosh-client \- client-side helper for mosh .SH SYNOPSIS MOSH_KEY=KEY .B mosh-client [\-v] IP PORT .br .B mosh-client \-c .br .SH DESCRIPTION \fBmosh-client\fP is a helper program for the .BR mosh (1) remote terminal application. \fBmosh\fP itself is a setup script that establishes an SSH connection, runs the server-side helper \fBmosh-server\fP, and collects the server's port number and session key. \fBmosh\fP then executes \fBmosh-client\fP with the server's IP address, port, and session key. \fBmosh-client\fP runs for the lifetime of the connection. The 22-byte base64 session key given by \fBmosh-server\fP is supplied in the MOSH_KEY environment variable. This represents a 128-bit AES key that protects the integrity and confidentiality of the session. For constructing new setup wrappers for remote execution facilities other than SSH, it may be necessary to invoke \fBmosh-client\fP directly. With the \-c option, \fBmosh-client\fP instead prints the number of colors of the terminal given by the TERM environment variable. The \-v option will print some debugging information on standard error. More instances of this flag will result in more debugging information. If standard error is not redirected from the terminal, the display will be corrupted and quickly become unusable. .SH ENVIRONMENT VARIABLES .TP .B MOSH_KEY This variable must be set, and must contain a Base64-encoded cryptographic key from .BR mosh-server (1). .TP .B MOSH_ESCAPE_KEY See .BR mosh (1). .TP .B MOSH_PREDICTION_DISPLAY Controls local echo as described in .BR mosh (1). .TP .B MOSH_PREDICTION_OVERWRITE Controls local echo insert/overwrite as described in .BR mosh (1). .TP .B MOSH_TITLE_NOPREFIX See .BR mosh (1). .SH SEE ALSO .BR mosh (1), .BR mosh-server (1). Project home page: .I https://mosh.org .br .SH AUTHOR mosh was written by Keith Winstein . .SH BUGS Please report bugs to \fImosh-devel@mit.edu\fP. Users may also subscribe to the .nh .I mosh-users@mit.edu .hy mailing list, at .br .nh .I http://mailman.mit.edu/mailman/listinfo/mosh-users .hy . mosh-1.4.0/man/Makefile.am0000644000175000017500000000020713103401307012201 00000000000000dist_man_MANS = if BUILD_CLIENT dist_man_MANS += mosh.1 mosh-client.1 endif if BUILD_SERVER dist_man_MANS += mosh-server.1 endif mosh-1.4.0/man/mosh-server.10000644000175000017500000001104113103401307012477 00000000000000.\" Hey, EMACS: -*- nroff -*- .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) .TH MOSH 1 "October 2012" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME mosh-server \- server-side helper for mosh .SH SYNOPSIS .B mosh-server new [\-s] [\-v] [\-i \fIIP\fP] [\-p \fIPORT\fP[:\fIPORT2\fP]] [\-c \fICOLORS\fP] [\-\- command...] .br .SH DESCRIPTION \fBmosh-server\fP is a helper program for the .BR mosh(1) remote terminal application. \fBmosh-server\fP binds to a high UDP port and chooses an encryption key to protect the session. It prints both on standard output, detaches from the terminal, and waits for the \fBmosh-client\fP to establish a connection. It will exit if no client has contacted it within 60 seconds. By default, \fBmosh-server\fP binds to a port between 60000 and 61000 and executes the user's login shell. On platforms with \fButempter\fP, \fBmosh-server\fP maintains an entry in the .BR utmp(5) file to indicate its process ID, whether the session is connected, and the client's current IP address. \fBmosh-server\fP exits when the client terminates the connection. .SH OPTIONS The argument "new" must be first on the command line to use command-line options. .TP .B \-s bind to the local interface used for an incoming SSH connection, given in the \fBSSH_CONNECTION\fP environment variable (for multihomed hosts) .TP .B \-v Print some debugging information even after detaching. More instances of this flag will result in more debugging information. .TP .B \-i \fIIP\fP IP address of the local interface to bind (for multihomed hosts) .TP .B \-p \fIPORT\fP[:\fIPORT2\fP] UDP port number or port-range to bind. \fB\-p 0\fP will let the operating system pick an available UDP port. .TP .B \-c \fICOLORS\fP Number of colors to advertise to applications through TERM (e.g. 8, 256) .TP .B \-l \fINAME=VALUE\fP Locale-related environment variable to try as part of a fallback environment, if the startup environment does not specify a character set of UTF-8. .SH ENVIRONMENT VARIABLES These variables allow server-side configuration of Mosh's behavior. They may be set by administrators in system login/rc files, /etc/login.conf, or similar mechanisms, or users in their shell's login/rc files. \fBmosh-server\fP passes these variables to the login session and shell that it starts, but changing them there will have no effect. .TP .B MOSH_SERVER_NETWORK_TMOUT If this variable is set to a positive integer number, it specifies how long (in seconds) \fBmosh-server\fP will wait to receive an update from the client before exiting. Since \fPmosh\fP is very useful for mobile clients with intermittent operation and connectivity, we suggest setting this variable to a high value, such as 604800 (one week) or 2592000 (30 days). Otherwise, \fBmosh-server\fP will wait indefinitely for a client to reappear. This variable is somewhat similar to the \fBTMOUT\fP variable found in many Bourne shells. However, it is not a login-session inactivity timeout; it only applies to network connectivity. .TP .B MOSH_SERVER_SIGNAL_TMOUT If this variable is set to a positive integer number, it specifies how long (in seconds) \fBmosh-server\fP will ignore SIGUSR1 while waiting to receive an update from the client. Otherwise, \fBSIGUSR1\fP will always terminate \fBmosh-server\fP. Users and administrators may implement scripts to clean up disconnected Mosh sessions. With this variable set, a user or administrator can issue .nf $ pkill -SIGUSR1 mosh-server .fi to kill disconnected sessions without killing connected login sessions. .SH EXAMPLE .nf $ mosh-server MOSH CONNECT 60001 UAkFedSsVJs2LfMeKyQB5g mosh-server (mosh 1.1) [...] (copyright notice omitted) [mosh-server detached, pid = 20443] .fi .SH SEE ALSO .BR mosh (1), .BR mosh-client (1). Project home page: .I https://mosh.org .br .SH AUTHOR mosh was written by Keith Winstein . .SH BUGS Please report bugs to \fImosh-devel@mit.edu\fP. Users may also subscribe to the .nh .I mosh-users@mit.edu .hy mailing list, at .br .nh .I http://mailman.mit.edu/mailman/listinfo/mosh-users .hy . mosh-1.4.0/Makefile.am0000664000175000017500000000504314272621034011444 00000000000000# Work around inconsistency in AX_CODE_COVERAGE defining # AM_DISTCHECK_CONFIGURE_FLAGS only in some branches if !CODE_COVERAGE_ENABLED AM_DISTCHECK_CONFIGURE_FLAGS = endif include $(top_srcdir)/aminclude_static.am ACLOCAL_AMFLAGS = -I m4 SUBDIRS = scripts src man conf EXTRA_DIST = autogen.sh ocb-license.html README.md COPYING.iOS BUILT_SOURCES = VERSION AM_DISTCHECK_CONFIGURE_FLAGS += --enable-compile-warnings=distcheck --enable-examples --enable-syslog # AX_CODE_COVERAGE configuration # Remove everything outside of this repository CODE_COVERAGE_IGNORE_PATTERN = "/usr/include/*" "/usr/lib/*" "*/src/tests/*" "*/src/protobufs/*" # Ensure coverage is relative to the top of the repository CODE_COVERAGE_DIRECTORY = $(abs_top_builddir) # non-Automake defines CPPCHECK_FLAGS = --enable=all --template=gcc --force # -j8 disables unused function checking. CLANG_SCAN_BUILD = scan-build BEAR = bear OCLINT_JCD = oclint-json-compilation-database OCLINT_OPTIONS = -enable-global-analysis -max-priority-2=1000 -max-priority-3=1000 \ -rc LONG_LINE=160 \ -rc LONG_VARIABLE_NAME=40 \ -rc SHORT_VARIABLE_NAME=1 \ -rc MINIMUM_CASES_IN_SWITCH=2 .PHONY: VERSION VERSION: @echo @PACKAGE_STRING@ > VERSION.dist @set -e; if git describe --dirty --always > VERSION.git 2>&1 && \ [ -z `git rev-parse --show-prefix` ]; then \ if ! diff -q VERSION.git VERSION > /dev/null 2>&1; then \ mv -f VERSION.git VERSION; \ fi; \ elif ! diff -q VERSION.dist VERSION > /dev/null 2>&1; then \ mv -f VERSION.dist VERSION; \ fi @rm -f VERSION.dist VERSION.git clean-local: @rm -rf VERSION cov-int mosh-coverity.txz compile_commands.json # Linters and static checkers, for development only. Not included in # build dependencies, and outside of Automake processing. cppcheck: cppcheck $(CPPCHECK_FLAGS) -include src/include/config.h -I src/include \ -I src/crypto -I src/frontend -I src/network -I src/protobufs \ -I src/statesync -I src/terminal -I src/util \ -I /usr/include -I /usr/include/google/protobuf -I/usr/include/openssl \ src # Coverity. cov-build: $(MAKE) clean rm -rf cov-int cov-build --dir cov-int $(MAKE) check TESTS= tar -caf mosh-coverity.txz cov-int # These two rules are for Bear + OCLint. # Don't *run* the tests, prediction-unicode.test generates arguments # with illegal UTF-8 that make Bear unhappy. compile_commands.json: $(MAKE) clean bear $(MAKE) check TESTS= oclint: compile_commands.json $(OCLINT_JCD) -e src/protobufs -- $(OCLINT_OPTIONS) # Clang's scan-build static checker. scan-build: $(MAKE) clean $(CLANG_SCAN_BUILD) $(MAKE) check TESTS= mosh-1.4.0/THANKS0000644000175000017500000000231613145365374010333 00000000000000* Hari Balakrishnan, who advised this work and came up with the name. * Paul Williams (www.vt100.net), whose reverse-engineered vt500 state diagram is the basis for the Mosh parser. * The anonymous users who contributed session logs for tuning and measuring Mosh's predictive echo. * Nickolai Zeldovich for helpful comments on the Mosh research paper. * Richard Stallman for helpful discussion about the capabilities of the SUPDUP Local Editing Protocol. * Nelson Elhage * Christine Spang * Stefie Tellex * Joseph Sokol-Margolis * Waseem Daher * Bill McCloskey * Austin Roach * Greg Hudson * Karl Ramm * Alexander Chernyakhovsky * Peter Iannucci * Evan Broder * Neha Narula * Katrina LaCurts * Ramesh Chandra * Peter Jeremy * Ed Schouten * Ryan Steinmetz * Jay Freeman * Dave Täht * Larry Doolittle * Daniel Drown * Timo Juhani Lindfors * Timo Sirainen * Ira Cooper * Felix Gröbert * Luke Mewburn * Anton Lundin * Philipp Haselwarter * Timo J. Rinne * Barosl Lee * Andrew Chin * Louis Kruger * Jérémie Courrèges-Anglas * Pasi Sjöholm * Richard Woodbury * Igor Bukanov * Geoffrey Thomas * Steve Dignam * HIGUCHI Yuta * Baruch Siach * Adrien Destugues * Giel van Schijndel