vttest-20140116/0000755000175100001440000000000012266055032012023 5ustar tomusersvttest-20140116/config.guess0000755000175100001440000013135512256772020014355 0ustar tomusers#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2013 Free Software Foundation, Inc. timestamp='2013-11-29' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # # Please send patches with a ChangeLog entry to config-patches@gnu.org. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "${UNAME_SYSTEM}" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval $set_cc_for_build cat <<-EOF > $dummy.c #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` ;; esac # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="gnulibc1" ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; or1k:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; or32:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-${LIBC} exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-${LIBC} exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval $set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub # that puts up a graphical alert prompting to install # developer tools. Any system running Mac OS X 10.7 or # later (Darwin 11 and later) is required to have a 64-bit # processor. This is not true of the ARM version of Darwin # that Apple uses in portable devices. UNAME_PROCESSOR=x86_64 fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: vttest-20140116/nonvt100.c0000644000175100001440000005216012266053610013560 0ustar tomusers/* $Id: nonvt100.c,v 1.64 2014/01/16 22:04:56 tom Exp $ */ /* * The list of non-VT320 codes was compiled using the list of non-VT320 codes * described in the Kermit 3.13 documentation, combined with the ISO-6429 * (ECMA-48) spec. */ #include #include #include #include int not_impl(MENU_ARGS) { vt_move(1, 1); printf("Sorry, test not implemented:\r\n\r\n %s", the_title); vt_move(max_lines - 1, 1); return MENU_HOLD; } /* * VT420 doesn't do this, VT510 does. * It is unaffected by left/right margins. */ int tst_CBT(MENU_ARGS) { int n; int count; int last = max_lines - 3; int row; int lft; int rgt; char temp[80]; test_with_margins(TRUE); lft = get_left_margin(); rgt = get_right_margin(); /* ignore left/right margins unless origin mode is set */ if (origin_mode) { count = ((rgt - lft) + TABWIDTH) / TABWIDTH; } else { count = (min_cols + (TABWIDTH - 1)) / TABWIDTH; } set_colors(WHITE_ON_BLUE); for (row = 1; row < last; ++row) { cup(row, min_cols); cbt(count + 1); print_chr('*'); for (n = 1; n <= count; n++) { int show = (count + 1 - n); cup(row, min_cols); cbt(n); slowly(); sprintf(temp, "%d", show); print_str(temp); } } set_colors(0); test_with_margins(FALSE); vt_move(last, 1); ruler(last, min_cols); vt_clear(0); println(the_title); if (origin_mode) { println("The tab-stops should be numbered consecutively starting at 1 in margins."); } else { println("The tab-stops should be numbered consecutively starting at 1 in screen."); } return MENU_HOLD; } /* Note: CHA and HPA have identical descriptions in ECMA-48 */ /* dtterm implements this (VT400 doesn't, VT510 does) */ int tst_CHA(MENU_ARGS) { int n; int last = max_lines - 4; int top; int lft; int bot; int rgt; BOX box; test_with_margins(TRUE); set_colors(WHITE_ON_BLUE); top = get_top_margin(); lft = get_left_margin(); rgt = get_right_margin(); bot = get_bottom_margin(last); if (origin_mode) { box.top = top + (bot - top + 1) / 4; box.left = lft + (rgt - lft + 1) / 4 - 1; box.right = rgt - (rgt - lft + 1) / 4 - 1; box.bottom = bot - (bot - top + 1) / 4; } else { box.top = (max_lines / 4); box.left = (min_cols / 4); box.right = (min_cols * 3) / 4 - 1; box.bottom = (max_lines * 3) / 4; } cup(box.top, box.left); for (n = box.left; n <= box.right; n++) { cha(n); print_chr('*'); } for (n = box.top; n <= box.bottom; n++) { cup(n, box.left + n); cha(box.right); print_chr('*'); cha(box.left); print_chr('*'); } cup(box.bottom, box.left); for (n = box.right; n >= box.left; --n) { cha(n); print_chr('*'); } set_colors(0); test_with_margins(FALSE); vt_move(last, 1); vt_clear(0); ruler(last, min_cols); println(the_title); if (origin_mode) { println("There should be a box-outline made of *'s in the middle of the margins."); } else { println("There should be a box-outline made of *'s in the middle of the screen."); } return MENU_HOLD; } /* * Kermit's documentation refers to this as CHI, ECMA-48 as CHT. * * VT420 doesn't do this, VT510 does */ int tst_CHT(MENU_ARGS) { int n; int last_tab; int last = max_lines - 4; int lft; int rgt; test_with_margins(TRUE); set_colors(WHITE_ON_BLUE); lft = get_left_margin(); rgt = get_right_margin(); last_tab = ((rgt * 2 - lft + 1) + (TABWIDTH - 1)) / TABWIDTH; vt_move(1, 1); println("CHT with param == 1:"); for (n = 0; n < last_tab; n++) { cht(1); printf("*"); } vt_move(4, 1); println("CHT with param != 1:"); for (n = 0; n < last_tab; n++) { cup(5, 1); cht(n); printf("+"); } vt_move(7, 1); println("Normal tabs:"); for (n = 0; n < last_tab; n++) { printf("\t*"); } set_colors(0); test_with_margins(FALSE); vt_move(last, 1); vt_clear(0); ruler(last, min_cols); println(the_title); println("The lines with *'s above should look the same (they wrap once)"); return MENU_HOLD; } /* VT420 doesn't do this, VT510 does */ int tst_CNL(MENU_ARGS) { int n; int last = max_lines - 3; test_with_margins(TRUE); set_colors(WHITE_ON_BLUE); vt_move(1, 1); printf("1."); for (n = 1; n <= last; n++) { cup(1, min_cols); cnl(n - 1); slowly(); printf("%d.", n); } set_colors(0); test_with_margins(FALSE); vt_move(last, 1); vt_clear(0); println(the_title); println("The lines above this should be numbered in sequence, from 1."); return MENU_HOLD; } /* * VT510 & up * * There's a comment in the MS-DOS Kermit 3.13 documentation that implies CPL * is used to replace RI (reverse-index). ECMA-48 doesn't specify scrolling * regions, DEC terminals do apparently, so for CPL and CNL we'll test this. */ int tst_CPL(MENU_ARGS) { int i; int last = max_lines - 3; test_with_margins(TRUE); set_colors(WHITE_ON_BLUE); vt_move(max_lines, 1); for (i = max_lines - 1; i > 0; i--) { cpl(1); slowly(); printf("%d.", i); } set_colors(0); test_with_margins(FALSE); vt_move(last, 1); vt_clear(0); println(the_title); println("The lines above this should be numbered in sequence, from 1."); return MENU_HOLD; } /* * VT420 doesn't do this, VT510 does. * VT510 ignores margins, but honors DECOM. */ int tst_HPA(MENU_ARGS) { int n; int last = max_lines - 4; int top; int lft; int bot; int rgt; BOX box; test_with_margins(TRUE); set_colors(WHITE_ON_BLUE); top = get_top_margin(); lft = get_left_margin(); rgt = get_right_margin(); bot = get_bottom_margin(last); if (origin_mode) { box.top = top + (bot - top + 1) / 4; box.left = lft + (rgt - lft + 1) / 4 - 1; box.right = rgt - (rgt - lft + 1) / 4 - 1; box.bottom = bot - (bot - top + 1) / 4; } else { box.top = (max_lines / 4); box.left = (min_cols / 4); box.right = (min_cols * 3) / 4 - 1; box.bottom = (max_lines * 3) / 4; } cup(box.top, box.left); for (n = box.left; n <= box.right; n++) { hpa(n); print_chr('*'); } for (n = box.top; n <= box.bottom; n++) { cup(n, box.left + n); hpa(box.right); print_chr('*'); hpa(box.left); print_chr('*'); } cup(box.bottom, box.left); for (n = box.right; n >= box.left; --n) { hpa(n); print_chr('*'); } set_colors(0); test_with_margins(FALSE); vt_move(last, 1); vt_clear(0); ruler(last, min_cols); println(the_title); if (origin_mode) { println("There should be a box-outline made of *'s in the middle of the margins."); } else { println("There should be a box-outline made of *'s in the middle of the screen."); } return MENU_HOLD; } int tst_HPR(MENU_ARGS) { int n; int last = max_lines - 4; int top; int lft; int bot; int rgt; BOX box; test_with_margins(TRUE); set_colors(WHITE_ON_BLUE); top = get_top_margin(); lft = get_left_margin(); rgt = get_right_margin(); bot = get_bottom_margin(last); if (origin_mode) { box.top = top + (bot - top + 1) / 4; box.left = lft + (rgt - lft + 1) / 4 - 1; box.right = rgt - (rgt - lft + 1) / 4 - 1; box.bottom = bot - (bot - top + 1) / 4; } else { box.top = (max_lines / 4); box.left = (min_cols / 4); box.right = (min_cols * 3) / 4 - 1; box.bottom = (max_lines * 3) / 4; } cup(box.top, box.left); for (n = box.left; n <= box.right; n++) { if (n > box.left) { cup(box.top, box.left); hpr(n - box.left); } print_chr('*'); } for (n = box.top; n <= box.bottom; n++) { cup(n, 1); if (box.left > 1) hpr(box.left - 1); print_chr('*'); hpr(box.right - box.left - 1); print_chr('*'); } for (n = box.right; n >= box.left; --n) { if (n > box.left) { cup(box.bottom, box.left); hpr(n - box.left); } print_chr('*'); } set_colors(0); test_with_margins(FALSE); vt_move(last, 1); vt_clear(0); ruler(last, min_cols); println(the_title); if (origin_mode) { println("There should be a box-outline made of *'s in the middle of the margins."); } else { println("There should be a box-outline made of *'s in the middle of the screen."); } return MENU_HOLD; } /* * Neither VT420 nor VT510. */ static int tst_REP(MENU_ARGS) { int n; int last = max_lines - 5; test_with_margins(TRUE); vt_move(1, 1); for (n = 1; n < last; n++) { if (n > 1) { printf(" "); if (n > 2) rep(n - 2); } printf("+"); rep(1); /* make that 2 +'s */ rep(10); /* this should be ignored, since a control sequence precedes */ println(""); } test_with_margins(FALSE); vt_move(last, 1); for (n = 1; n <= min_cols; n++) printf("%c", (n == last || n == last + 1) ? '+' : '*'); vt_move(last + 1, 1); ruler(last + 1, min_cols); println(the_title); println("There should be a diagonal of 2 +'s down to the row of *'s above this message."); println("The ++ in the row of *'s is the target. If there are 11 +'s, ECMA-48 does"); println("not prohibit this, but treats it as undefined behavior (still nonstandard)."); return MENU_HOLD; } /* * Test the SD (scroll-down) by forcing characters written in a diagonal into * a horizontal row. * * VT400 and dtterm use the (incorrect?) escape sequence (ending with 'T' * instead of '^'), apparently someone misread 05/14 as 05/04 or vice versa. */ int tst_SD(MENU_ARGS) { int n; int last = max_lines - 3; for (n = 1; n < last; n++) { cup(n, n); printf("*"); slowly(); sd(1); } vt_move(last + 1, 1); ruler(last + 1, min_cols); vt_clear(0); println(the_title); println("There should be a horizontal row of *'s above, just above the message."); return MENU_HOLD; } /* * not in VT510 * * Test the SL (scroll-left) by forcing characters written in a diagonal into * a vertical line. */ static int tst_SL(MENU_ARGS) { int n; int last = max_lines - 3; for (n = 1; n < last; n++) { cup(n, min_cols / 2 + last - n); printf("*"); slowly(); sl(1); } vt_move(last, 1); ruler(last, min_cols); vt_clear(0); println(the_title); println("There should be a vertical column of *'s centered above."); return MENU_HOLD; } /* * not in VT510 * * Test the SR (scroll-right) by forcing characters written in a diagonal into * a vertical line. */ static int tst_SR(MENU_ARGS) { int n; int last = max_lines - 3; for (n = 1; n < last; n++) { cup(n, min_cols / 2 - last + n); printf("*"); slowly(); sr(1); } vt_move(last, 1); ruler(last, min_cols); vt_clear(0); println(the_title); println("There should be a vertical column of *'s centered above."); return MENU_HOLD; } /* * Test the SU (scroll-up) by forcing characters written in a diagonal into * a horizontal row. */ int tst_SU(MENU_ARGS) { int n; int last = max_lines - 3; for (n = 1; n < last; n++) { cup(last + 1 - n, n); printf("*"); slowly(); su(1); } vt_move(last + 1, 1); ruler(last, min_cols); vt_clear(0); println(the_title); println("There should be a horizontal row of *'s above, on the top row."); return MENU_HOLD; } /******************************************************************************/ static int erm_flag; static int toggle_ERM(MENU_ARGS) { erm_flag = !erm_flag; if (erm_flag) sm("6"); else rm("6"); return MENU_NOHOLD; } /* * Test SPA (set-protected area). */ static int tst_SPA(MENU_ARGS) { int pass; BOX box; if (make_box_params(&box, 5, 20) == 0) { for (pass = 0; pass < 2; pass++) { if (pass == 0) { esc("V"); /* SPA */ } /* make two passes so we can paint over the protected-chars in the second */ draw_box_filled(&box, '*'); if (pass == 0) { esc("W"); /* EPA */ cup(max_lines / 2, min_cols / 2); ed(0); /* after the cursor */ ed(1); /* before the cursor */ ed(2); /* the whole display */ el(0); /* after the cursor */ el(1); /* before the cursor */ el(2); /* the whole line */ ech(min_cols); __(cup(1, 1), println(the_title)); cup(max_lines - 4, 1); printf("There %s be an solid box made of *'s in the middle of the screen.\n", erm_flag ? "may" : "should"); println("note: DEC terminals do not implement ERM (erase mode)."); holdit(); } } } return MENU_NOHOLD; } static int tst_protected_area(MENU_ARGS) { static char erm_mesg[80]; /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { erm_mesg, toggle_ERM }, { "Test Protected-Areas (SPA)", tst_SPA }, { "", 0 }, }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printf("Protected-Areas Tests")); __(title(2), println("Choose test type:")); sprintf(erm_mesg, "%s ERM (erase mode)", STR_ENABLE(erm_flag)); } while (menu(my_menu)); if (erm_flag) toggle_ERM(PASS_ARGS); return MENU_NOHOLD; } /******************************************************************************/ /* * Kermit's documentation refers to this as CVA, ECMA-48 as VPA. * Move the cursor in the current column to the specified line. * * VT420 doesn't do this, VT510 does */ int tst_VPA(MENU_ARGS) { int n; int last = max_lines - 4; int top; int lft; int bot; int rgt; BOX box; test_with_margins(TRUE); set_colors(WHITE_ON_BLUE); top = get_top_margin(); lft = get_left_margin(); rgt = get_right_margin(); bot = get_bottom_margin(last); if (origin_mode) { box.top = top + (bot - top + 1) / 4; box.left = lft + (rgt - lft + 1) / 4 - 1; box.right = rgt - (rgt - lft + 1) / 4 - 1; box.bottom = bot - (bot - top + 1) / 4; } else { box.top = (max_lines / 4); box.left = (min_cols / 4); box.right = (min_cols * 3) / 4 - 1; box.bottom = (max_lines * 3) / 4; } /* * BS is affected by left/right margins, but VPA is unaffected by margins. * Both are affected by origin mode. */ if (lrmm_flag) { if ((box.left >= lft - 1) && (box.left < lft + 1) && (lft > 1)) { if (lft > 2) box.left = lft - 2; else box.left = lft + 1; } if ((box.right == rgt) && (rgt < min_cols)) box.right = rgt + 1; } cup(box.top, box.left); for (n = box.left; n <= box.right; n++) { print_str("*"); if (lrmm_flag && !origin_mode && (n == rgt) && (rgt < min_cols) && (n < box.right)) { cup(box.top, n + 1); } } print_str("\b"); for (n = box.top; n <= box.bottom; n++) { vpa(n); print_str("*\b"); } for (n = box.right; n >= box.left; n--) { if (lrmm_flag && !origin_mode && (((n == lft) && (lft > 1) && (n > box.left)) || ((n == lft + 1) && (lft > 1) && (n > box.left)) || ((n == lft - 1) && (lft > 1) && (n > box.left)) || ((n == rgt + 0) && (rgt < min_cols) && (n < box.right)))) { cup(box.bottom, n); print_chr('*'); cup(box.bottom, n); } else { print_str("\b*\b"); } } for (n = box.top; n <= box.bottom; n++) { vpa(n); print_str("*\b"); } set_colors(0); test_with_margins(FALSE); vt_move(last, 1); vt_clear(0); ruler(last, min_cols); println(the_title); if (origin_mode) { println("There should be a box-outline made of *'s in the middle of the margins."); } else { println("There should be a box-outline made of *'s in the middle of the screen."); } return MENU_HOLD; } int tst_VPR(MENU_ARGS) { int n; int last = max_lines - 4; int top; int lft; int bot; int rgt; BOX box; test_with_margins(TRUE); set_colors(WHITE_ON_BLUE); top = get_top_margin(); lft = get_left_margin(); rgt = get_right_margin(); bot = get_bottom_margin(last); if (origin_mode) { box.top = top + (bot - top + 1) / 4; box.left = lft + (rgt - lft + 1) / 4 - 1; box.right = rgt - (rgt - lft + 1) / 4 - 1; box.bottom = bot - (bot - top + 1) / 4; } else { box.top = (max_lines / 4); box.left = (min_cols / 4); box.right = (min_cols * 3) / 4 - 1; box.bottom = (max_lines * 3) / 4; } /* * BS is affected by left/right margins, but VPA is unaffected by margins. * Both are affected by origin mode. */ if (lrmm_flag) { if ((box.left >= lft - 1) && (box.left < lft + 1) && (lft > 1)) { if (lft > 2) box.left = lft - 2; else box.left = lft + 1; } if ((box.right == rgt) && (rgt < min_cols)) box.right = rgt + 1; } cup(box.top, box.left); for (n = box.left; n <= box.right; n++) { print_str("*"); if (lrmm_flag && !origin_mode && (n == rgt) && (rgt < min_cols) && (n < box.right)) { cup(box.top, n + 1); } } print_str("\b"); for (n = box.top; n <= box.bottom; n++) { if (n > box.top) { cup(box.top, box.right); vpr(n - box.top); } print_str("*\b"); } for (n = box.right; n > box.left; n--) { if (lrmm_flag && !origin_mode && (((n == lft) && (lft > 1) && (n > box.left)) || ((n == lft + 1) && (lft > 1) && (n > box.left)) || ((n == lft - 1) && (lft > 1) && (n > box.left)) || ((n == rgt + 0) && (rgt < min_cols) && (n < box.right)))) { cup(box.bottom, n); print_chr('*'); cup(box.bottom, n); } else { print_str("\b*\b"); } } for (n = box.bottom; n >= box.top; --n) { if (n > box.top) { cup(box.top, box.left); vpr(n - box.top); } print_str("*\b"); } set_colors(0); test_with_margins(FALSE); vt_move(last, 1); vt_clear(0); ruler(last, min_cols); println(the_title); if (origin_mode) { println("There should be a box-outline made of *'s in the middle of the margins."); } else { println("There should be a box-outline made of *'s in the middle of the screen."); } return MENU_HOLD; } /******************************************************************************/ /* * ECMA-48 mentions margins, but does not say how they might be set. VT420 * and up implement margins; look in vt520.c for tests of these features * which take into account margins. */ int tst_ecma48_curs(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Test Character-Position-Absolute (HPA)", tst_HPA }, { "Test Cursor-Back-Tab (CBT)", tst_CBT }, { "Test Cursor-Character-Absolute (CHA)", tst_CHA }, { "Test Cursor-Horizontal-Index (CHT)", tst_CHT }, { "Test Horizontal-Position-Relative (HPR)", tst_HPR }, { "Test Line-Position-Absolute (VPA)", tst_VPA }, { "Test Next-Line (CNL)", tst_CNL }, { "Test Previous-Line (CPL)", tst_CPL }, { "Test Vertical-Position-Relative (VPR)", tst_VPR }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printf("ISO-6429 (ECMA-48) Cursor-Movement")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } int tst_ecma48_misc(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Protected-Area Tests", tst_protected_area }, { "Test Repeat (REP)", tst_REP }, { "Test Scroll-Down (SD)", tst_SD }, { "Test Scroll-Left (SL)", tst_SL }, { "Test Scroll-Right (SR)", tst_SR }, { "Test Scroll-Up (SU)", tst_SU }, { "", 0 }, }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printf("Miscellaneous ISO-6429 (ECMA-48) Tests")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } /******************************************************************************/ int tst_nonvt100(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Test of VT220 features", tst_vt220 }, { "Test of VT320 features", tst_vt320 }, { "Test of VT420 features", tst_vt420 }, { "Test of VT520 features", tst_vt520 }, { "Test ISO-6429 cursor-movement", tst_ecma48_curs }, { "Test ISO-6429 colors", tst_colors }, { "Test other ISO-6429 features", tst_ecma48_misc }, { "Test XTERM special features", tst_xterm }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); title(0); printf("Non-VT100 Tests"); title(2); println("Choose test type:"); } while (menu(my_menu)); return MENU_NOHOLD; } vttest-20140116/esc.c0000644000175100001440000004734511751546131012761 0ustar tomusers/* $Id: esc.c,v 1.86 2012/05/06 19:09:13 tom Exp $ */ #include #include /* FIXME: for Solaris 2.5, which is broken */ #define FLUSH fflush(stdout) static int soft_scroll; /******************************************************************************/ static int pending_decstbm; static int pending_decslrm; static const char csi_7[] = {ESC, '[', 0}; static const unsigned char csi_8[] = {0x9b, 0}; const char * csi_input(void) { return input_8bits ? (const char *) csi_8 : csi_7; } const char * csi_output(void) { return output_8bits ? (const char *) csi_8 : csi_7; } /******************************************************************************/ static const char dcs_7[] = {ESC, 'P', 0}; static const unsigned char dcs_8[] = {0x90, 0}; const char * dcs_input(void) { return input_8bits ? (const char *) dcs_8 : dcs_7; } const char * dcs_output(void) { return output_8bits ? (const char *) dcs_8 : dcs_7; } /******************************************************************************/ static const char osc_7[] = {ESC, ']', 0}; static const unsigned char osc_8[] = {0x9d, 0}; const char * osc_input(void) { return input_8bits ? (const char *) osc_8 : osc_7; } const char * osc_output(void) { return output_8bits ? (const char *) osc_8 : osc_7; } /******************************************************************************/ static char ss3_7[] = {ESC, 'O', 0}; static unsigned char ss3_8[] = {0x8f, 0}; char * ss3_input(void) { return input_8bits ? (char *) ss3_8 : ss3_7; } char * ss3_output(void) { return output_8bits ? (char *) ss3_8 : ss3_7; } /******************************************************************************/ static char st_7[] = {ESC, '\\', 0}; static unsigned char st_8[] = {0x9c, 0}; char * st_input(void) { return input_8bits ? (char *) st_8 : st_7; } char * st_output(void) { return output_8bits ? (char *) st_8 : st_7; } /******************************************************************************/ /* * The actual number of nulls for padding is an estimate; it's working at * 9600bd. */ void padding(int msecs) { if (use_padding) { int count = (3 * msecs * tty_speed + DEFAULT_SPEED - 1) / DEFAULT_SPEED; while (count-- > 0) putchar(0); } } void extra_padding(int msecs) { if (use_padding) padding(soft_scroll ? (msecs * 4) : msecs); } int println(const char *s) { printf("%s\r\n", s); if (LOG_ENABLED) { fprintf(log_fp, "Text: %s\n", s); } return 1; } void put_char(FILE *fp, int c) { if (fp == stdout) putchar(c); else { c &= 0xff; if (c <= ' ' || c >= '\177') fprintf(fp, "<%d> ", c); else fprintf(fp, "%c ", c); } } void put_string(FILE *fp, const char *s) { while (*s != '\0') put_char(fp, (int) *s++); } static void va_out(FILE *fp, va_list ap, const char *fmt) { char temp[10]; while (*fmt != '\0') { if (*fmt == '%') { switch (*++fmt) { case 'c': put_char(fp, va_arg(ap, int)); break; case 'd': sprintf(temp, "%d", va_arg(ap, int)); put_string(fp, temp); break; case 'u': sprintf(temp, "%u", va_arg(ap, unsigned)); put_string(fp, temp); break; case 's': put_string(fp, va_arg(ap, char *)); break; } } else { put_char(fp, (int) *fmt); } fmt++; } } int tprintf(const char *fmt,...) { va_list ap; va_start(ap, fmt); va_out(stdout, ap, fmt); va_end(ap); FLUSH; if (LOG_ENABLED) { fputs("Text: ", log_fp); va_start(ap, fmt); va_out(log_fp, ap, fmt); va_end(ap); fputs("\n", log_fp); } return 1; } /* CSI xxx */ void do_csi(const char *fmt,...) { va_list ap; va_start(ap, fmt); fputs(csi_output(), stdout); va_out(stdout, ap, fmt); va_end(ap); FLUSH; if (LOG_ENABLED) { fputs("Send: ", log_fp); put_string(log_fp, csi_output()); va_start(ap, fmt); va_out(log_fp, ap, fmt); va_end(ap); fputs("\n", log_fp); } } /* DCS xxx ST */ void do_dcs(const char *fmt,...) { va_list ap; va_start(ap, fmt); fputs(dcs_output(), stdout); va_out(stdout, ap, fmt); va_end(ap); fputs(st_output(), stdout); FLUSH; if (LOG_ENABLED) { va_start(ap, fmt); fputs("Send: ", log_fp); put_string(log_fp, dcs_output()); va_out(log_fp, ap, fmt); va_end(ap); put_string(log_fp, st_output()); fputs("\n", log_fp); } } /* DCS xxx ST */ void do_osc(const char *fmt,...) { va_list ap; va_start(ap, fmt); fputs(osc_output(), stdout); va_out(stdout, ap, fmt); va_end(ap); fputs(st_output(), stdout); FLUSH; if (LOG_ENABLED) { va_start(ap, fmt); fputs("Send: ", log_fp); put_string(log_fp, osc_output()); va_out(log_fp, ap, fmt); va_end(ap); put_string(log_fp, st_output()); fputs("\n", log_fp); } } void print_chr(int c) { printf("%c", c); if (LOG_ENABLED) { fprintf(log_fp, "Send: "); put_char(log_fp, c); fputs("\n", log_fp); } } void print_str(const char *s) { printf("%s", s); if (LOG_ENABLED) { fprintf(log_fp, "Send: "); while (*s) { put_char(log_fp, *s++); } fputs("\n", log_fp); } } void esc(const char *s) { printf("%c%s", ESC, s); if (LOG_ENABLED) { fprintf(log_fp, "Send: "); put_char(log_fp, ESC); put_string(log_fp, s); fputs("\n", log_fp); } } void brc(int pn, int c) { do_csi("%d%c", pn, c); } void brc2(int pn1, int pn2, int c) { do_csi("%d;%d%c", pn1, pn2, c); } void brc3(int pn1, int pn2, int pn3, int c) { do_csi("%d;%d;%d%c", pn1, pn2, pn3, c); } /******************************************************************************/ void cbt(int pn) /* Cursor Back Tab */ { brc(pn, 'Z'); } void cha(int pn) /* Cursor Character Absolute */ { brc(pn, 'G'); } void cht(int pn) /* Cursor Forward Tabulation */ { brc(pn, 'I'); } void cnl(int pn) /* Cursor Next Line */ { brc(pn, 'E'); } void cpl(int pn) /* Cursor Previous Line */ { brc(pn, 'F'); } void cub(int pn) /* Cursor Backward */ { brc(pn, 'D'); padding(2); } void cud(int pn) /* Cursor Down */ { brc(pn, 'B'); extra_padding(2); } void cuf(int pn) /* Cursor Forward */ { brc(pn, 'C'); padding(2); } int cup(int pn1, int pn2) /* Cursor Position */ { brc2(pn1, pn2, 'H'); padding(5); /* 10 for vt220 */ return 1; /* used for indenting */ } void cuu(int pn) /* Cursor Up */ { brc(pn, 'A'); extra_padding(2); } void da(void) /* Device Attributes */ { brc(0, 'c'); } void decaln(void) /* Screen Alignment Display */ { esc("#8"); } void decarm(int flag) /* DECARM autorepeat */ { if (flag) sm("?8"); /* autorepeat */ else rm("?8"); /* no autorepeat */ } void decawm(int flag) /* DECAWM autowrap */ { if (flag) sm("?7"); /* autowrap */ else rm("?7"); /* no autowrap */ } void decbi(void) /* VT400: Back Index */ { esc("6"); padding(40); } void decbkm(int flag) /* VT400: Backarrow key */ { if (flag) sm("?67"); /* backspace */ else rm("?67"); /* delete */ } void decncsm(int flag) /* VT500: DECNCSM no clear on DECCOLM */ { if (flag) sm("?95"); /* no clear */ else rm("?95"); /* clear */ } void deccara(int top, int left, int bottom, int right, int attr) { do_csi("%d;%d;%d;%d;%d$r", top, left, bottom, right, attr); } void decckm(int flag) /* DECCKM Cursor Keys */ { if (flag) sm("?1"); /* application */ else rm("?1"); /* normal */ } void deccolm(int flag) /* DECCOLM 80/132 Columns */ { if (flag) sm("?3"); /* 132 columns */ else rm("?3"); /* 80 columns */ } void deccra(int Pts, int Pl, int Pbs, int Prs, int Pps, int Ptd, int Pld, int Ppd) { do_csi("%d;%d;%d;%d;%d;%d;%d;%d;$v", Pts, /* top-line border */ Pl, /* left-line border */ Pbs, /* bottom-line border */ Prs, /* right-line border */ Pps, /* source page number */ Ptd, /* destination top-line border */ Pld, /* destination left-line border */ Ppd); /* destination page number */ } int decdc(int pn) /* VT400 Delete Column */ { do_csi("%d'~", pn); padding(10 * pn); return 1; } void decefr(int top, int left, int bottom, int right) /* DECterm Enable filter rectangle */ { do_csi("%d;%d;%d;%d'w", top, left, bottom, right); } void decelr(int all_or_one, int pixels_or_cells) /* DECterm Enable Locator Reporting */ { do_csi("%d;%d'z", all_or_one, pixels_or_cells); } void decera(int top, int left, int bottom, int right) /* VT400 Erase Rectangular area */ { do_csi("%d;%d;%d;%d$z", top, left, bottom, right); } void decdhl(int lower) /* Double Height Line (also double width) */ { if (lower) esc("#4"); else esc("#3"); } void decdwl(void) /* Double Wide Line */ { esc("#6"); } void decfi(void) /* VT400: Forward Index */ { esc("9"); padding(40); } void decfra(int c, int top, int left, int bottom, int right) /* VT400 Fill Rectangular area */ { do_csi("%d;%d;%d;%d;%d$x", c, top, left, bottom, right); } void decid(void) /* required for VT52, not recommended above VT100 */ { esc("Z"); /* Identify */ } int decic(int pn) /* VT400 Insert Column */ { do_csi("%d'}", pn); padding(10 * pn); return 1; } void deckbum(int flag) /* VT400: Keyboard Usage */ { if (flag) sm("?68"); /* data processing */ else rm("?68"); /* typewriter */ } void deckpam(void) /* Keypad Application Mode */ { esc("="); } void deckpm(int flag) /* VT400: Keyboard Position */ { if (flag) sm("?81"); /* position reports */ else rm("?81"); /* character codes */ } void deckpnm(void) /* Keypad Numeric Mode */ { esc(">"); } void decll(const char *ps) /* Load LEDs */ { do_csi("%sq", ps); } void decnkm(int flag) /* VT400: Numeric Keypad */ { if (flag) sm("?66"); /* application */ else rm("?66"); /* numeric */ } void decom(int flag) /* DECOM Origin */ { if (flag) sm("?6"); /* relative */ else rm("?6"); /* absolute */ } void decpex(int flag) /* VT220: printer extent mode */ { if (flag) sm("?19"); /* full screen (page) */ else rm("?19"); /* scrolling region */ } void decpff(int flag) /* VT220: print form feed mode */ { if (flag) sm("?18"); /* form feed */ else rm("?18"); /* no form feed */ } void decnrcm(int flag) /* VT220: National replacement character set */ { if (flag) sm("?42"); /* national */ else rm("?42"); /* multinational */ } void decrara(int top, int left, int bottom, int right, int attr) { do_csi("%d;%d;%d;%d;%d$t", top, left, bottom, right, attr); } void decrc(void) /* Restore Cursor */ { esc("8"); } void decreqtparm(int pn) /* Request Terminal Parameters */ { brc(pn, 'x'); } void decrqlp(int mode) /* DECterm Request Locator Position */ { do_csi("%d'|", mode); } void decrqss(const char *pn) /* VT200 Request Status-String */ { do_dcs("$q%s", pn); } void decsace(int flag) /* VT400 Select attribute change extent */ { do_csi("%d*x", flag ? 2 : 0); } void decsasd(int pn) /* VT200 Select active status display */ { do_csi("%d$}", pn); } void decsc(void) /* Save Cursor */ { esc("7"); } void decsca(int pn1) /* VT200 select character attribute (protect) */ { do_csi("%d\"q", pn1); } void decsclm(int flag) /* Scrolling mode (smooth/jump) */ { if (flag) sm("?4"); /* smooth scrolling */ else rm("?4"); /* jump-scrolling scrolling */ soft_scroll = flag; } void decscnm(int flag) /* Screen mode (inverse-video) */ { if (flag) sm("?5"); /* inverse video */ else rm("?5"); /* normal video */ padding(200); } void decsed(int pn1) /* VT200 selective erase in display */ { do_csi("?%dJ", pn1); } void decsel(int pn1) /* VT200 selective erase in line */ { do_csi("?%dK", pn1); } void decsera(int top, int left, int bottom, int right) /* VT400 Selective erase rectangular area */ { do_csi("%d;%d;%d;%d${", top, left, bottom, right); } void decsle(int mode) /* DECterm Select Locator Events */ { do_csi("%d'{", mode); } void /* VT300 Set columns per page */ decscpp(int cols) { if (cols >= 0) { do_csi("%d$|", cols); } else { do_csi("$|"); } } void /* VT300 Set lines per page */ decslpp(int rows) { /* * DEC defines 24, 25, 36, 48, 72 and 144. * XTerm uses codes up to 24 for window operations, * and 24 and up for this feature. */ do_csi("%dt", rows); } void decsnls(int pn) /* VT400 Select number of lines per screen */ { do_csi("%d*|", pn); } void decssdt(int pn) /* VT200 Select status line type */ { do_csi("%d$~", pn); } void decstbm(int pn1, int pn2) /* Set Top and Bottom Margins */ { if (pn1 || pn2) { brc2(pn1, pn2, 'r'); pending_decstbm = 1; } else { esc("[r"); pending_decstbm = 0; } } void np(void) /* NP - next page */ { do_csi("U"); } void pp(void) /* PP - previous page */ { do_csi("V"); } void ppa(int n) /* PPA - Page Position Absolute */ { do_csi("%d P", n); } void ppb(int n) /* PPB - Page Position Backward */ { do_csi("%d R", n); } void ppr(int n) /* PPR - Page Position Relative */ { do_csi("%d Q", n); } /* * Reset top/bottom margins, but only if we set them to non-default. */ void reset_decstbm(void) { if (pending_decstbm) { decstbm(0, 0); } } void decslrm(int pn1, int pn2) /* Set Left and Right Margins */ { if (pn1 || pn2) { brc2(pn1, pn2, 's'); pending_decslrm = 1; } else { esc("[s"); pending_decslrm = 0; } } /* * Reset left/right margins, but only if we set them to non-default. */ void reset_decslrm(void) { if (pending_decslrm) { decslrm(0, 0); } } void decstr(void) /* VT200 Soft terminal reset */ { do_csi("!p"); } void decswl(void) /* Single Width Line */ { esc("#5"); } void dectst(int pn) /* Invoke Confidence Test */ { brc2(2, pn, 'y'); #ifdef UNIX fflush(stdout); #endif } void dsr(int pn) /* Device Status Report */ { brc(pn, 'n'); } void ed(int pn) /* Erase in Display */ { brc(pn, 'J'); padding(50); } void el(int pn) /* Erase in Line */ { brc(pn, 'K'); padding(3); /* 4 for vt400 */ } void ech(int pn) /* Erase character(s) */ { brc(pn, 'X'); } void hpa(int pn) /* HPA - Horizontal Position Absolute */ { brc(pn, '`'); } void hpr(int pn) /* HPR - Horizontal Position Relative */ { brc(pn, 'a'); } void hts(void) /* Horizontal Tabulation Set */ { esc("H"); } void hvp(int pn1, int pn2) /* Horizontal and Vertical Position */ { brc2(pn1, pn2, 'f'); } void ind(void) /* Index */ { esc("D"); padding(20); /* vt220 */ } /* The functions beginning "mc_" are variations of Media Copy (MC) */ void mc_autoprint(int flag) /* VT220: auto print mode */ { do_csi("?%di", flag ? 5 : 4); } void mc_printer_controller(int flag) /* VT220: printer controller mode */ { do_csi("%di", flag ? 5 : 4); } void mc_print_page(void) /* VT220: print page */ { do_csi("i"); } void mc_print_composed(void) /* VT300: print composed main display */ { do_csi("?10i"); } void mc_print_all_pages(void) /* VT300: print composed all pages */ { do_csi("?11i"); } void mc_print_cursor_line(void) /* VT220: print cursor line */ { do_csi("?1i"); } void mc_printer_start(int flag) /* VT300: start/stop printer-to-host session */ { do_csi("?%di", flag ? 9 : 8); } void mc_printer_assign(int flag) /* VT300: assign/release printer to active session */ { do_csi("?%di", flag ? 18 : 19); } void nel(void) /* Next Line */ { esc("E"); } void rep(int pn) /* Repeat */ { do_csi("%db", pn); } void ri(void) /* Reverse Index */ { esc("M"); extra_padding(5); /* 14 on vt220 */ } void ris(void) /* Reset to Initial State */ { esc("c"); #ifdef UNIX fflush(stdout); #endif } void rm(const char *ps) /* Reset Mode */ { do_csi("%sl", ps); } void s8c1t(int flag) /* Tell terminal to respond with 7-bit or 8-bit controls */ { if ((input_8bits = flag) != FALSE) esc(" G"); /* select 8-bit controls */ else esc(" F"); /* select 7-bit controls */ fflush(stdout); zleep(300); } /* * If g is zero, * designate G0 as character set c * designate G1 as character set B (ASCII) * shift-in (select G0 into GL). * If g is nonzero * designate G0 as character set B (ASCII) * designate G1 as character set c * shift-out (select G1 into GL). * See also scs_normal() and scs_graphics(). */ void scs(int g, int c) /* Select character Set */ { char temp[10]; sprintf(temp, "%c%c", g ? ')' : '(', c); esc(temp); sprintf(temp, "%c%c", g ? '(' : ')', 'B'); esc(temp); print_chr(g ? SO : SI); padding(4); } void sd(int pn) /* Scroll Down */ { brc(pn, 'T'); } void sgr(const char *ps) /* Select Graphic Rendition */ { do_csi("%sm", ps); padding(2); } void sl(int pn) /* Scroll Left */ { do_csi("%d @", pn); } void sm(const char *ps) /* Set Mode */ { do_csi("%sh", ps); } void sr(int pn) /* Scroll Right */ { do_csi("%d A", pn); } void srm(int flag) /* VT400: Send/Receive mode */ { if (flag) sm("12"); /* local echo off */ else rm("12"); /* local echo on */ } void su(int pn) /* Scroll Up */ { brc(pn, 'S'); extra_padding(5); } void tbc(int pn) /* Tabulation Clear */ { brc(pn, 'g'); } void dch(int pn) /* Delete character */ { brc(pn, 'P'); } void ich(int pn) /* Insert character -- not in VT102 */ { brc(pn, '@'); } void dl(int pn) /* Delete line */ { brc(pn, 'M'); } void il(int pn) /* Insert line */ { brc(pn, 'L'); } void vpa(int pn) /* Vertical Position Absolute */ { brc(pn, 'd'); } void vpr(int pn) /* Vertical Position Relative */ { brc(pn, 'e'); } void vt52cub1(void) /* cursor left */ { esc("D"); padding(5); } void vt52cud1(void) /* cursor down */ { esc("B"); padding(5); } void vt52cuf1(void) /* cursor right */ { esc("C"); padding(5); } void vt52cup(int l, int c) /* direct cursor address */ { char temp[10]; sprintf(temp, "Y%c%c", l + 31, c + 31); esc(temp); padding(5); } void vt52cuu1(void) /* cursor up */ { esc("A"); padding(5); } void vt52ed(void) /* erase to end of screen */ { esc("J"); padding(5); } void vt52el(void) /* erase to end of line */ { esc("K"); padding(5); } void vt52home(void) /* cursor to home */ { esc("H"); padding(5); } void vt52ri(void) /* reverse line feed */ { esc("I"); padding(5); } vttest-20140116/BUGS0000644000175100001440000000140607402000316012476 0ustar tomusers-- $Id: BUGS,v 1.6 2001/11/30 21:57:34 tom Exp $ Please report bugs to tom@invisible-island.net This is a list of known problems with VTTEST: + SD and SU tests pass with dtterm, but not with VT420, which uses a different scrolling model. + the skip_csi/skip_dcs functions are too permissive (they're allowing either 8-bit or 7-bit responses). + when I test the DECRQSS responses on a VT420, they usually come back with a code '1' (according to my manual, that's invalid), though the data looks correct otherwise. + testing on a VT420 (console on VMS), there's a problem with the VT52 test: I see highlighted glitches at the positions where erase line (ESC K) controls are printed. Increasing the padding doesn't change this behavior. vttest-20140116/README0000644000175100001440000000600410550217245012703 0ustar tomusers$Id: README,v 1.5 2007/01/07 16:24:05 tom Exp $ I extended the original vttest program (I've found no modifications) with several new features listed in CHANGES - Thomas E. Dickey -------------------------------------------------------------------------------- Updated address from 2007/1/2: Per Lindberg Norrhagsvägen 9A 18247 Enebyberg SWEDEN -------------------------------------------------------------------------------- The remainder of this file is the original README: -------------------------------------------------------------------------------- NOTES FROM THE MOD.SOURCES MODERATOR: I split the source up into the three separate pieces it now is. In doing this, I put lines like "int reading;" in a header file that both C modules include. If your Unix requires one of these to be "extern int reading;" then you will have some editing to do. Also note that this program uses FIONREAD, which must be implemented differently in SystemV, etc., and check out the setjmp() call... /Rich $alz Oh, yeah: I also wrote the Makefile and manpage, such as they are. ------------------------------------------------------------------- This is a program to test the compatibility (or to demonstrate the non-compatibility) of so-called "VT100-compatible" terminals. In conformance of the good old hacker traditions, the only documentation of this program is the source code itself. To understand it, you also need a copy of the original VT100 manual from DEC. Comments and bug reports: Since this is a release (via USENET) to the whole world, a lot of people are going to have opinions and fresh ideas about it. (What -- bugs in MY program? Aww...) I can't deal with everyone sending me a hacked version, but if you have found a serious bug, or ported it to VMS, do tell me. I can't promise any new version release, though. From this version on (1.7b) VTTEST will have to live its own life without its father holding its hand. My address is: Network-mail address: (mcvax,seismo)!enea!suadb!lindberg Real-world-mail address: Per Lindberg QZ, Stockholm University Computing Center Box 27322 S - 102 54 Stockholm SWEDEN The original version of this program is written for the Sargasso C compiler for the DECsystem-10. Many thanks to all sales persons with quote VT100-compatible unquote terminals, who prompted me to write this program, and also to: -- Bo Kleve, LIDAC, Linkoping University, Sweden for the portation to DECSYSTEM-20 with the Sargasso C compiler -- Johan Widen, TTDS, Royal Institute of Technology, Stockholm, Sweden for the portation to various UNIX systems (incl. System III and Xenix) -- Russ Herman, AES Data Inc., Missisauga, Ont. Canada for fixes and code for the VT102 test Thanx also to JMR "Gremlin" at KTH, and Goran Wallberg at QZ for suggestions, bug fixes, etc. This program does not have support for all the different variations of VT100, like VT125, VT131 nor the new VT200 series. Feel free to add that yourself. Happy Hacking! /TMP vttest-20140116/color.c0000644000175100001440000004216712215370534013320 0ustar tomusers/* $Id: color.c,v 1.37 2013/09/15 17:41:48 tom Exp $ */ #include #include #include #define MAX_COLORS 8 #define COLOR_BLACK 0 #define COLOR_RED 1 #define COLOR_GREEN 2 #define COLOR_YELLOW 3 #define COLOR_BLUE 4 #define COLOR_MAGENTA 5 #define COLOR_CYAN 6 #define COLOR_WHITE 7 static const char *colors[MAX_COLORS] = { "black", /* 30, 40 */ "red", /* 31, 41 */ "green", /* 32, 42 */ "yellow", /* 33, 43 */ "blue", /* 34, 44 */ "magenta", /* 35, 45 */ "cyan", /* 36, 46 */ "white" /* 37, 47 */ }; int do_colors = FALSE; /* * Pick an unusual color combination for testing, just in case the user's * got the background set to something different. */ static void c_sgr(const char *s) { char temp[80]; char *t; int reset = FALSE; (void) strcpy(temp, s); if (*temp == ';' || *temp == 0) { reset = TRUE; } else { for (t = temp; *t != 0; t++) { if (((t[0] == '0') && (t == temp || t[-1] == ';') && (t[1] == 0 || t[1] == ';')) || ((t[0] == ';') && (t[1] == ';'))) { reset = TRUE; break; } } } if (reset && do_colors) { sprintf(temp + strlen(temp), ";%d;%d", COLOR_YELLOW + 30, COLOR_BLUE + 40); } sgr(temp); } /* * Some terminals will reset colors with SGR-0; I've added the 39, 49 codes for * those that are ISO compliant. (The black/white codes are for emulators * written by people who don't bother reading standards). */ static void reset_all_colors(void) { sgr("0;40;37;39;49"); sgr("0"); } static void set_background(int bg) { if (do_colors) { char temp[80]; (void) sprintf(temp, "4%d", bg); sgr(temp); } } static void set_color_pair(int fg, int bg) { if (do_colors) { char temp[80]; (void) sprintf(temp, "3%d;4%d", fg, bg); sgr(temp); } } static void set_foreground(int fg) { if (do_colors) { char temp[80]; (void) sprintf(temp, "3%d", fg); sgr(temp); } } static void set_test_colors(void) { c_sgr("0"); } static void reset_test_colors(void) { /* Now, set the background again just in case there's a glitch */ set_foreground(COLOR_WHITE); set_background(COLOR_BLACK); } /* Graphic rendition requires special handling with color, since SGR-0 * is supposed to reset the colors as well. */ static void show_graphic_rendition(void) { ed(2); /* *INDENT-OFF* */ cup( 1,20); printf("Color/Graphic rendition test pattern:"); cup( 4, 1); c_sgr("0"); printf("vanilla"); cup( 4,40); c_sgr("0;1"); printf("bold"); cup( 6, 6); c_sgr(";4"); printf("underline"); cup( 6,45); c_sgr(";1");c_sgr("4");printf("bold underline"); cup( 8, 1); c_sgr("0;5"); printf("blink"); cup( 8,40); c_sgr("0;5;1"); printf("bold blink"); cup(10, 6); c_sgr("0;4;5"); printf("underline blink"); cup(10,45); c_sgr("0;1;4;5"); printf("bold underline blink"); cup(12, 1); c_sgr("1;4;5;0;7"); printf("negative"); cup(12,40); c_sgr("0;1;7"); printf("bold negative"); cup(14, 6); c_sgr("0;4;7"); printf("underline negative"); cup(14,45); c_sgr("0;1;4;7"); printf("bold underline negative"); cup(16, 1); c_sgr("1;4;;5;7"); printf("blink negative"); cup(16,40); c_sgr("0;1;5;7"); printf("bold blink negative"); cup(18, 6); c_sgr("0;4;5;7"); printf("underline blink negative"); cup(18,45); c_sgr("0;1;4;5;7"); printf("bold underline blink negative"); cup(20, 6); c_sgr(""); set_foreground(9); printf("original foreground"); cup(20,45); c_sgr(""); set_background(9); printf("original background"); /* *INDENT-ON* */ c_sgr(""); /* same as c_sgr("0") */ decscnm(FALSE); /* Inverse video off */ cup(max_lines - 1, 1); el(0); printf("Dark background. "); holdit(); decscnm(TRUE); /* Inverse video */ cup(max_lines - 1, 1); el(0); printf("Light background. "); holdit(); decscnm(FALSE); } static void show_line_deletions(void) { int row; ed(2); cup(1, 1); printf("This test deletes every third line from a list, marking cursor with '*'.\n"); printf("The foreground and background should be yellow(orange) and blue, respectively.\n"); for (row = 5; row <= max_lines; row++) { cup(row, 1); printf(" row %3d: this is some text", row); } for (row = 7; row <= max_lines; row += 2 /* 3 - deletion */ ) { cup(row, 8); dl(1); putchar('*'); /* cursor should be in column 1 */ } cup(3, 1); holdit(); } static void show_line_insertions(void) { int row; ed(2); cup(1, 1); printf("This test inserts after every second line in a list, marking cursor with '*'.\n"); printf("The foreground and background should be yellow(orange) and blue, respectively.\n"); for (row = 5; row <= max_lines; row++) { cup(row, 1); printf(" row %3d: this is some text", row); } for (row = 7; row <= max_lines; row += 3 /* 2 + insertion */ ) { cup(row, 8); il(1); putchar('*'); /* cursor should be in column 1 */ } cup(3, 1); holdit(); } static int show_test_pattern(MENU_ARGS) /* generate a color test pattern */ { int i, j, k; reset_all_colors(); ed(2); cup(1, 1); printf("There are %d color combinations", MAX_COLORS * MAX_COLORS); for (k = 0; k <= 11; k += 11) { cup(k + 2, 1); printf("%dx%d matrix of foreground/background colors, bright *", MAX_COLORS, MAX_COLORS); if (k) { sgr("1"); printf("on"); sgr("0"); } else { printf("off"); } printf("*"); for (i = 0; i < MAX_COLORS; i++) { cup(k + 3, (i + 1) * 8 + 1); printf("%s", colors[i]); } for (i = 0; i < MAX_COLORS; i++) { cup(k + i + 4, 1); printf("%s", colors[i]); } for (i = 0; i < MAX_COLORS; i++) { for (j = 0; j < MAX_COLORS; j++) { if (k) sgr("1"); set_color_pair(j, i); cup(k + 4 + i, (j + 1) * 8 + 1); printf("Hello"); reset_all_colors(); } } } reset_all_colors(); cup(max_lines - 1, 1); return MENU_HOLD; } /* * Clear around the box for simple_bce_test(). */ static void simple_bce_erases(BOX *box) { int i; cup(box->top - 1, min_cols / 2); ed(1); /* clear from home to cursor */ cuf(1); el(0); /* clear from cursor to end of line */ cup(box->bottom + 1, min_cols / 2); ed(0); /* clear from cursor to end */ cub(1); el(1); /* clear to beginning of line */ for (i = box->top; i <= box->bottom; i++) { cup(i, box->left - 1); el(1); cup(i, box->right + 1); el(0); } } /* * "Real" color terminals support bce (background color erase). * * Set the foreground and background colors to something that's unusual. * Then clear the screen (the background should stick) and draw some nested * boxes (because that's simple). Use the ED, EL controls to clear away the * outer box, so we can exercise the various parameter combinations of each * of these. */ static int simple_bce_test(MENU_ARGS) { BOX box1; BOX box2; static const char *text1[] = { "The screen background should be blue, with a box made of asterisks", " and this caption, in orange (non-bold yellow). ", " There should be no cells with the default foreground or background.", 0 }; static const char *text2[] = { "The screen background should be black, with a box made of asterisks", " and this caption, in white (actually gray - it is not bold). ", " Only the asterisk box should be in color.", 0 }; if (make_box_params(&box1, 3, 10) < 0 || make_box_params(&box2, 7, 18) < 0) return MENU_NOHOLD; set_test_colors(); decaln(); draw_box_filled(&box1, 'X'); draw_box_outline(&box2, '*'); simple_bce_erases(&box2); draw_box_caption(&box2, 1, text1); cup(max_lines - 1, 1); holdit(); reset_test_colors(); simple_bce_erases(&box2); draw_box_caption(&box2, 1, text2); cup(max_lines - 1, 1); holdit(); reset_all_colors(); return MENU_NOHOLD; } /* * Clear around the box for fancy_bce_test(). */ static void fancy_bce_erases(BOX *box) { int i; int first; int limit; cup(box->top - 1, min_cols / 2); ed(1); /* clear from home to cursor */ cuf(1); el(0); /* clear from cursor to end of line */ cup(box->bottom + 1, min_cols / 2); ed(0); /* clear from cursor to end */ cub(1); el(1); /* clear to beginning of line */ for (i = box->top; i <= box->bottom; i++) { cup(i, box->left - 1); el(1); cup(i, box->right + 1); limit = min_cols - box->right; first = i + 1 - box->top; if (first > limit) first = limit; dch(first); limit -= first; if (limit > 0) ech(limit); } } /* * Scroll the box up/down to check if the colors are being shifted in. */ static void fancy_bce_shifts(BOX *box) { int i; int limit = box->top - 1; decsclm(TRUE); /* slow it down a little */ cup(1, 1); for (i = 0; i < limit; ++i) dl(1); for (i = 0; i < limit; ++i) ri(); decsclm(FALSE); } /* * Scroll the box up/down to check if the colors are being shifted in. Erase * the colors with ECH and DCH. */ static int fancy_bce_test(MENU_ARGS) { BOX box1; BOX box2; static const char *text1[] = { "The screen background should be blue, with a box made of asterisks", " and this caption, in orange (non-bold yellow). ", " There should be no cells with the default foreground or background.", 0 }; static const char *text2[] = { "The screen background should be black, with a box made of asterisks", " and this caption, in white (actually gray - it is not bold). ", " Only the asterisk box should be in color.", 0 }; if (make_box_params(&box1, 3, 10) < 0 || make_box_params(&box2, 7, 18) < 0) return MENU_NOHOLD; set_test_colors(); decaln(); draw_box_filled(&box1, 'X'); draw_box_outline(&box2, '*'); fancy_bce_erases(&box2); draw_box_caption(&box2, 1, text1); fancy_bce_shifts(&box2); cup(max_lines - 1, 1); holdit(); reset_test_colors(); fancy_bce_erases(&box2); draw_box_caption(&box2, 1, text2); fancy_bce_shifts(&box2); cup(max_lines - 1, 1); holdit(); reset_all_colors(); return MENU_NOHOLD; } static int test_color_movements(MENU_ARGS) { set_test_colors(); tst_movements(PASS_ARGS); reset_all_colors(); return MENU_NOHOLD; } static int test_color_screen(MENU_ARGS) { set_test_colors(); /* The rest of the test can be done nicely with the standard vt100 test * for insert/delete, since it doesn't modify SGR. */ tst_screen(PASS_ARGS); reset_all_colors(); return MENU_NOHOLD; } /* * Test the insert/delete line/character operations for color (bce) terminals * We'll test insert/delete line operations specially, because it is very hard * to see what is happening with the accordion test when it does not work. */ static int test_color_insdel(MENU_ARGS) { set_test_colors(); show_line_insertions(); show_line_deletions(); /* The rest of the test can be done nicely with the standard vt100 test * for insert/delete, since it doesn't modify SGR. */ tst_insdel(PASS_ARGS); reset_all_colors(); return MENU_NOHOLD; } /* * Test the other ECMA-48 features with color setup. */ static int test_ecma48_misc(MENU_ARGS) { set_test_colors(); tst_ecma48_misc(PASS_ARGS); reset_all_colors(); return MENU_NOHOLD; } static int test_bce_color(MENU_ARGS) { set_test_colors(); do_scrolling(); show_graphic_rendition(); reset_all_colors(); return MENU_NOHOLD; } /* * VT220 and higher implement the 22, 24, 25 and 27 codes. * VT510 implements concealed text. * * ISO 6429 specifies additional SGR codes so that one needn't use SGR 0 * to reset everything before switching, e.g., set/clear pairs are * bold 1/22 * faint 2/22 * italics 3/23 * underline 4/24 * blink 5/25 * inverse 7/27 * concealed 8/28 */ static int test_iso_6429_sgr(MENU_ARGS) { set_test_colors(); ed(2); /* *INDENT-OFF* */ cup( 1,20); printf("Extended/Graphic rendition test pattern:"); cup( 4, 1); c_sgr("0"); printf("vanilla"); cup( 4,40); c_sgr("0;1"); printf("bold"); cup( 6, 6); c_sgr("22;4"); printf("underline"); cup( 6,45); c_sgr("24;1;4"); printf("bold underline"); cup( 8, 1); c_sgr("22;24;5"); printf("blink"); cup( 8,40); c_sgr("25;5;1"); printf("bold blink"); cup(10, 6); c_sgr("22;4;5"); printf("underline blink"); cup(10,45); c_sgr("24;25;1;4;5"); printf("bold underline blink"); cup(12, 1); c_sgr("22;24;25;7"); printf("negative"); cup(12,40); c_sgr("1"); printf("bold negative"); cup(14, 6); c_sgr("22;4;7"); printf("underline negative"); cup(14,45); c_sgr("1;4;7"); printf("bold underline negative"); cup(16, 1); c_sgr("22;24;5;7"); printf("blink negative"); cup(16,40); c_sgr("1"); printf("bold blink negative"); cup(18, 6); c_sgr("22;4"); printf("underline blink negative"); cup(18,45); c_sgr("1"); printf("bold underline blink negative"); cup(20, 6); c_sgr(""); set_foreground(9); printf("original foreground"); cup(20,45); c_sgr(""); set_background(9); printf("original background"); cup(22, 1); c_sgr(";8"); printf("concealed"); cup(22,40); c_sgr("8;7"); printf("concealed negative"); /* *INDENT-ON* */ c_sgr(""); /* same as c_sgr("0") */ printf(" <- concealed text"); decscnm(FALSE); /* Inverse video off */ cup(max_lines - 1, 1); el(0); printf("Dark background. "); holdit(); decscnm(TRUE); /* Inverse video */ cup(max_lines - 1, 1); el(0); printf("Light background. "); holdit(); decscnm(FALSE); cup(max_lines - 1, 1); el(0); printf("Dark background. "); holdit(); reset_all_colors(); return MENU_NOHOLD; } /* */ static int test_SGR_0(MENU_ARGS) { vt_move(1, 1); println(the_title); println(""); println("ECMA-48 states that SGR 0 \"cancels the effect of any preceding occurrence"); println("of SGR in the data stream regardless of the setting of the graphic rendition"); println("combination mode (GRCM)\"."); println(""); println(""); reset_all_colors(); printf("You should see only black:"); sgr("30;40"); printf("SGR 30 and SGR 40 don't work"); reset_all_colors(); println(":up to here"); reset_all_colors(); printf("You should see only white:"); sgr("37;47"); printf("SGR 37 and SGR 47 don't work"); reset_all_colors(); println(":up to here"); reset_all_colors(); printf("You should see text here: "); sgr("30;40"); sgr("0"); printf("SGR 0 reset works (explicit 0)"); println(""); reset_all_colors(); printf("................and here: "); sgr("37;47"); sgr(""); printf("SGR 0 reset works (default param)"); println(""); reset_all_colors(); holdit(); return MENU_NOHOLD; } /* * Allow user to test the same screens w/o colors. */ int toggle_color_mode(MENU_ARGS) { do_colors = !do_colors; return MENU_NOHOLD; } /* * VT100s of course never did colors, ANSI or otherwise. This test is for * xterm. */ static int test_vt100_colors(MENU_ARGS) { /* *INDENT-OFF* */ static MENU colormenu[] = { { "Exit", 0 }, { "Test of cursor movements", test_color_movements }, { "Test of screen features", test_color_screen }, { "Test Insert/Delete Char/Line", test_color_insdel, }, { "", 0 } }; /* *INDENT-ON* */ do_colors = TRUE; do { vt_clear(2); __(title(0), println("Test VT102-style features with BCE")); __(title(2), println("Choose test type:")); } while (menu(colormenu)); do_colors = FALSE; return MENU_NOHOLD; } /* * For terminals that support ANSI/ISO colors, work through a graduated * set of tests that first display colors (if the terminal does indeed * support them), then exercise the associated reset, clear operations. */ int tst_colors(MENU_ARGS) { /* *INDENT-OFF* */ static MENU colormenu[] = { { "Exit", 0 }, { txt_override_color, toggle_color_mode, }, { "Display color test-pattern", show_test_pattern, }, { "Test SGR-0 color reset", test_SGR_0, }, { "Test BCE-style clear line/display (ED, EL)", simple_bce_test, }, { "Test BCE-style clear line/display (ECH, Indexing)", fancy_bce_test, }, { "Test of VT102-style features with BCE", test_vt100_colors, }, { "Test other ISO-6429 features with BCE", test_ecma48_misc }, { "Test screen features with BCE", test_bce_color, }, { "Test screen features with ISO 6429 SGR 22-27 codes", test_iso_6429_sgr, }, { "", 0 } }; /* *INDENT-ON* */ do_colors = TRUE; do { vt_clear(2); sprintf(txt_override_color, "%s color-switching", STR_ENABLE(do_colors)); __(title(0), println("ISO 6429 colors")); __(title(2), println("Choose test type:")); } while (menu(colormenu)); do_colors = FALSE; return MENU_NOHOLD; } vttest-20140116/ttymodes.h0000644000175100001440000000076306207036322014051 0ustar tomusers/* $Id: ttymodes.h,v 1.3 1996/08/22 10:56:18 tom Exp $ */ #ifndef TTYMODES_H #define TTYMODES_H 1 #ifdef DEBUG void log_ttymodes(char *file, int line); void dump_ttymodes(char *tag, int flag); #else #define log_ttymodes(file, line) /*nothing*/ #define dump_ttymodes(tag, flag) /*nothing*/ #endif void close_tty(void); void init_ttymodes(int pn); void restore_ttymodes(void); void set_tty_crmod(int enabled); void set_tty_echo(int enabled); void set_tty_raw(int enabled); #endif /* TTYMODES_H */ vttest-20140116/ttymodes.c0000644000175100001440000001530711667367247014067 0ustar tomusers/* $Id: ttymodes.c,v 1.21 2011/12/06 10:29:59 tom Exp $ */ #include #include #include /* inflush() */ #undef tabs #ifdef TAB3 # define tabs TAB3 #else # ifdef XTABS # define tabs XTABS # else # ifdef OXTABS # define tabs OXTABS # else # define tabs 0 # endif # endif #endif static TTY old_modes, new_modes; /* *INDENT-OFF* */ static struct { int name; int code; } speeds[] = { {B0, 0}, {B50, 50}, {B75, 75}, {B110, 110}, {B134, 134}, {B150, 150}, {B200, 200}, {B300, 300}, {B600, 600}, {B1200, 1200}, {B1800, 1800}, {B2400, 2400}, {B4800, 4800}, {B9600, 9600}, #ifdef B19200 {B19200, 19200}, #else #ifdef EXTA {EXTA, 19200}, #endif #endif #ifdef B38400 {B38400, 38400}, #else #ifdef EXTB {EXTB, 38400}, #endif #endif #ifdef B57600 {B57600, 57600}, #endif #ifdef B115200 {B115200, 115200}, #endif }; /* *INDENT-ON* */ #if !USE_POSIX_TERMIOS && !USE_TERMIO && USE_SGTTY static struct tchars old_tchars; static struct ltchars old_ltchars; #endif #if USE_POSIX_TERMIOS || USE_TERMIO static void disable_control_chars(TTY * modes) { # if USE_POSIX_TERMIOS int n; int temp; # ifdef HAVE_POSIX_VDISABLE temp = _POSIX_VDISABLE; # else errno = 0; temp = fpathconf(0, _PC_VDISABLE); if (temp == -1) { if (errno != 0) { restore_ttymodes(); fprintf(stderr, "Cannot disable special characters!\n"); exit(EXIT_FAILURE); } temp = 0377; } # endif for (n = 0; n < NCCS; n++) modes->c_cc[n] = (unsigned char) temp; # else /* USE_TERMIO */ # ifdef VSWTCH modes->c_cc[VSWTCH] = VDISABLE; # endif modes->c_cc[VSUSP] = VDISABLE; # if defined (VDSUSP) && defined(NCCS) && VDSUSP < NCCS modes->c_cc[VDSUSP] = VDISABLE; # endif modes->c_cc[VSTART] = VDISABLE; modes->c_cc[VSTOP] = VDISABLE; # endif modes->c_cc[VMIN] = 1; modes->c_cc[VTIME] = 0; } #endif static void set_ttymodes(TTY * modes) { # if USE_POSIX_TERMIOS fflush(stdout); tcsetattr(0, TCSAFLUSH, modes); # else # if USE_TERMIO tcsetattr(0, TCSETAF, modes); # else /* USE_SGTTY */ stty(0, modes); # endif # endif } #ifndef log_ttymodes void log_ttymodes(char *file, int line) { if (LOG_ENABLED) fprintf(log_fp, "%s @%d\n", file, line); } #endif #ifndef dump_ttymodes void dump_ttymodes(char *tag, int flag) { #ifdef UNIX TTY tmp_modes; if (LOG_ENABLED) { fprintf(log_fp, "%s (%d):\n", tag, flag); # if USE_POSIX_TERMIOS || USE_TERMIO tcgetattr(0, &tmp_modes); fprintf(log_fp, " iflag %08o\n", tmp_modes.c_iflag); fprintf(log_fp, " oflag %08o\n", tmp_modes.c_oflag); fprintf(log_fp, " lflag %08o\n", tmp_modes.c_lflag); if (!tmp_modes.c_lflag & ICANON) { fprintf(log_fp, " %d:min =%d\n", VMIN, tmp_modes.c_cc[VMIN]); fprintf(log_fp, " %d:time =%d\n", VTIME, tmp_modes.c_cc[VTIME]); } # else gtty(0, &tmp_modes); fprintf(log_fp, " flags %08o\n", tmp_modes.sg_flags); # endif } #endif } #endif void close_tty(void) { restore_ttymodes(); } void init_ttymodes(int pn) { int speed_code, n; dump_ttymodes("init_ttymodes", pn); #ifdef UNIX if (pn == 0) { fflush(stdout); # if USE_POSIX_TERMIOS || USE_TERMIO tcgetattr(0, &old_modes); speed_code = (int) cfgetospeed(&old_modes); # else # if USE_SGTTY gtty(0, &old_modes); ioctl(0, TIOCGETC, &old_tchars); ioctl(0, TIOCGLTC, &old_ltchars); speed_code = old_modes.sg_ospeed; # endif # endif new_modes = old_modes; for (n = 0; n < TABLESIZE(speeds); n++) { if (speeds[n].name == speed_code) { tty_speed = speeds[n].code; break; } } } else { putchar(BEL); fflush(stdout); inflush(); new_modes = old_modes; sleep(2); } # if USE_POSIX_TERMIOS || USE_TERMIO new_modes.c_iflag = BRKINT | old_modes.c_iflag; new_modes.c_oflag &= (unsigned) ~tabs; # else /* USE_SGTTY */ new_modes.sg_flags = old_modes.sg_flags | CBREAK; # endif set_ttymodes(&new_modes); # ifdef HAVE_FCNTL_H # ifndef O_NDELAY # define O_NDELAY O_NONBLOCK /* O_NONBLOCK is POSIX */ # endif close(2); open("/dev/tty", O_RDWR | O_NDELAY); # endif #endif /* UNIX */ dump_ttymodes("...init_ttymodes", pn); } void restore_ttymodes(void) { dump_ttymodes("restore_ttymodes", -1); #ifdef UNIX set_ttymodes(&old_modes); #endif dump_ttymodes("...restore_ttymodes", -1); } void set_tty_crmod(int enabled) { dump_ttymodes("set_tty_crmod", enabled); #ifdef UNIX # if USE_POSIX_TERMIOS || USE_TERMIO # if USE_POSIX_TERMIOS # define MASK_CRMOD ((unsigned) (ICRNL | IXON)) # else # define MASK_CRMOD ((unsigned) (ICRNL)) # endif if (enabled) { new_modes.c_iflag |= MASK_CRMOD; new_modes.c_lflag |= ICANON; memcpy(new_modes.c_cc, old_modes.c_cc, sizeof(new_modes.c_cc)); } else { new_modes.c_iflag &= ~MASK_CRMOD; new_modes.c_lflag &= (unsigned) ~ICANON; disable_control_chars(&new_modes); } # else if (enabled) new_modes.sg_flags |= CRMOD; else new_modes.sg_flags &= ~CRMOD; # endif set_ttymodes(&new_modes); #endif dump_ttymodes("...set_tty_crmod", enabled); } void set_tty_echo(int enabled) { dump_ttymodes("set_tty_echo", enabled); #ifdef UNIX # if USE_POSIX_TERMIOS || USE_TERMIO if (enabled) new_modes.c_lflag |= ECHO; else new_modes.c_lflag &= (unsigned) ~ECHO; # else /* USE_SGTTY */ if (enabled) new_modes.sg_flags |= ECHO; else new_modes.sg_flags &= (unsigned) ~ECHO; # endif set_ttymodes(&new_modes); #endif dump_ttymodes("...set_tty_echo", enabled); } void set_tty_raw(int enabled) { dump_ttymodes("set_tty_raw", enabled); if (enabled) { #ifdef UNIX # if USE_POSIX_TERMIOS || USE_TERMIO /* *INDENT-EQLS* */ new_modes.c_iflag = 0; new_modes.c_lflag = 0; new_modes.c_cc[VMIN] = 1; new_modes.c_cc[VTIME] = 0; set_ttymodes(&new_modes); set_tty_crmod(FALSE); # else /* USE_SGTTY */ # ifdef HAVE_FCNTL_H new_modes.sg_flags &= ~CBREAK; # endif new_modes.sg_flags |= RAW; set_ttymodes(&new_modes); { struct tchars tmp_tchars; struct ltchars tmp_ltchars; memset(&tmp_tchars, -1, sizeof(tmp_tchars)); memset(&tmp_ltchars, -1, sizeof(tmp_ltchars)); ioctl(0, TIOCSETC, &tmp_tchars); ioctl(0, TIOCSLTC, &tmp_ltchars); } # endif #endif } else { #ifdef UNIX # if USE_POSIX_TERMIOS || USE_TERMIO new_modes = old_modes; /* FIXME */ # else /* USE_SGTTY */ new_modes.sg_flags &= ~RAW; # ifdef HAVE_FCNTL_H new_modes.sg_flags |= CBREAK; # endif ioctl(0, TIOCSETC, &old_tchars); ioctl(0, TIOCSLTC, &old_ltchars); # endif set_ttymodes(&new_modes); #endif } dump_ttymodes("...set_tty_raw", enabled); } vttest-20140116/vms_io.c0000644000175100001440000002225711737007053013475 0ustar tomusers/* $Id: vms_io.c,v 1.26 2012/04/04 09:02:35 tom Exp $ */ #define DEBUG #include #include #include #include #include #include #include #include #include #include #include #include #include /* for float constants */ typedef struct { unsigned short int status; /* I/O completion status */ unsigned short int count; /* byte transfer count */ int dev_dep_data; /* device dependant data */ } QIO_SB; /* This is a QIO I/O Status Block */ #define NIBUF 1024 /* Input buffer size */ #define NOBUF 1024 /* MM says big buffers win! */ #define EFN 0 /* Event flag */ static char obuf[NOBUF]; /* Output buffer */ static int nobuf; /* # of bytes in above */ static char ibuf[NIBUF]; /* Input buffer */ static int nibuf; /* # of bytes in above */ static int oldmode[3]; /* Old TTY mode bits */ static int newmode[3]; /* New TTY mode bits */ static short iochan; /* TTY I/O channel */ static int in_flags; static int cr_flag = TRUE; static void give_up(int status) { if (LOG_ENABLED) fprintf(log_fp, "status=%#x\n", status); close_tty(); exit(status); } static int lookup_speed(int code) { /* *INDENT-OFF* */ static struct { int code; int speed; } table[] = { {TT$C_BAUD_50, 50 } ,{TT$C_BAUD_75, 75 } ,{TT$C_BAUD_110, 110 } ,{TT$C_BAUD_134, 134 } ,{TT$C_BAUD_150, 150 } ,{TT$C_BAUD_300, 300 } ,{TT$C_BAUD_600, 600 } ,{TT$C_BAUD_1200, 1200 } ,{TT$C_BAUD_1800, 1800 } ,{TT$C_BAUD_2000, 2000 } ,{TT$C_BAUD_2400, 2400 } ,{TT$C_BAUD_3600, 3600 } ,{TT$C_BAUD_4800, 4800 } ,{TT$C_BAUD_7200, 7200 } ,{TT$C_BAUD_9600, 9600 } ,{TT$C_BAUD_19200, 19200 } ,{TT$C_BAUD_38400, 38400 } #ifdef TT$C_BAUD_57600 ,{TT$C_BAUD_57600, 57600 } ,{TT$C_BAUD_76800, 76800 } ,{TT$C_BAUD_115200, 115200 } #endif }; /* *INDENT-ON* */ int n; int speed = DEFAULT_SPEED; for (n = 0; n < TABLESIZE(table); n++) { if (table[n].code == code) { if (table[n].speed > DEFAULT_SPEED) speed = table[n].speed; break; } } return speed; } /* * Read the tty-in. If we're looking for a single character, wait. Otherwise, * read whatever is available, assuming that it's queued and ready. * * The VMS terminal driver operates with a one-second timer, and (from the * manual) we must give at least two seconds for the timeout value. If we * give a 0-second timeout, we'll only get (from testing) 16 bytes, which * is enough for a CPR, but not for DA, etc. */ static void read_vms_tty(int length, int timed) { int status; QIO_SB iosb; int term[2] = {0, 0}; int my_flags = IO$_READLBLK | in_flags; int timeout = 0; if (length < 1) return; if (length > 1) { my_flags |= IO$M_TIMED; timeout = 1; /* seconds */ } if (timed) timeout = 2; /* seconds */ #ifdef DEBUG if (LOG_ENABLED) { fprintf(log_fp, "reading: len=%d, flags=%#x\n", length, my_flags); fflush(log_fp); } #endif status = sys$qiow(EFN, iochan, my_flags, &iosb, 0, 0, ibuf, length, timeout, term, 0, 0); #ifdef DEBUG if (LOG_ENABLED) { fprintf(log_fp, "read: st=%d, cnt=%#x, dev=%#x\n", iosb.status, iosb.count, iosb.dev_dep_data); fflush(log_fp); } #endif if (status != SS$_NORMAL || iosb.status == SS$_ENDOFFILE) give_up(status); nibuf = iosb.count + (iosb.dev_dep_data >> 16); } /******************************************************************************/ void reset_inchar(void) { /* FIXME */ } /* * Wait until a character is typed on the terminal then read it, without * waiting for CR. */ char inchar(void) { int c; fflush(stdout); read_vms_tty(1, FALSE); c = (ibuf[0] & 0xff); if (c == '\r' && cr_flag && !(in_flags & IO$M_NOFILTR)) { c = '\n'; if (in_flags & IO$M_NOECHO) putchar(c); } return c; } /* * Get an unfinished string from the terminal: wait until a character is typed * on the terminal, then read it, and all other available characters. Return a * pointer to that string. * * This function won't read long strings, but we use it for instances where * we only expect short (16 bytes or less) replies (i.e., a function-key). */ char * instr(void) { static char result[1024]; result[0] = inchar(); zleep(100); /* Wait 0.1 seconds */ fflush(stdout); read_vms_tty(sizeof(result) - 3, FALSE); memcpy(result + 1, ibuf, nibuf); result[1 + nibuf] = '\0'; if (LOG_ENABLED) { fputs("Reply: ", log_fp); put_string(log_fp, result); fputs("\n", log_fp); } return (result); } /* * Get an unfinished string from the terminal: wait until a character is typed * on the terminal, then read it, and all other available characters. Return a * pointer to that string. * * Unlike 'instr()', this will really read long strings. */ char * get_reply(void) { static char result[256]; result[0] = inchar(); zleep(100); /* Wait 0.1 seconds */ fflush(stdout); read_vms_tty(sizeof(result) - 3, TRUE); memcpy(result + 1, ibuf, nibuf); result[1 + nibuf] = '\0'; if (LOG_ENABLED) { fputs("Reply: ", log_fp); put_string(log_fp, result); fputs("\n", log_fp); } return (result); } /* * Read to the next newline, truncating the buffer at BUFSIZ-1 characters */ void inputline(char *s) { do { int ch; char *d = s; while ((ch = getchar()) != EOF && ch != '\n') { if ((d - s) < BUFSIZ - 2) *d++ = ch; } *d = 0; } while (!*s); } /* * Flush input buffer, make sure no pending input character */ void inflush(void) { nibuf = 0; } void outflush(void) { fflush(stdout); } void holdit(void) { inflush(); tprintf("Push "); readnl(); } void readnl(void) { fflush(stdout); while (inchar() != '\n') ; } /* * Sleep and do nothing (don't waste CPU) for t milliseconds */ void zleep(int t) { float seconds = t / 1000.; unsigned flags = 0; #ifdef USE_IEEE_FLOAT unsigned type = CVT$K_IEEE_S; #else unsigned type = CVT$K_VAX_F; #endif lib$wait(&seconds, &flags, &type); } /******************************************************************************/ void init_ttymodes(int pn) { struct dsc$descriptor idsc; struct dsc$descriptor odsc; char oname[40]; QIO_SB iosb; int status; /* *INDENT-EQLS* */ odsc.dsc$a_pointer = "TT"; odsc.dsc$w_length = strlen(odsc.dsc$a_pointer); odsc.dsc$b_dtype = DSC$K_DTYPE_T; odsc.dsc$b_class = DSC$K_CLASS_S; idsc.dsc$b_dtype = DSC$K_DTYPE_T; idsc.dsc$b_class = DSC$K_CLASS_S; do { /* *INDENT-EQLS* */ idsc.dsc$a_pointer = odsc.dsc$a_pointer; idsc.dsc$w_length = odsc.dsc$w_length; odsc.dsc$a_pointer = &oname[0]; odsc.dsc$w_length = sizeof(oname); status = lib$sys_trnlog(&idsc, &odsc.dsc$w_length, &odsc); if (status != SS$_NORMAL && status != SS$_NOTRAN) give_up(status); if (oname[0] == 0x1B) { odsc.dsc$a_pointer += 4; odsc.dsc$w_length -= 4; } } while (status == SS$_NORMAL); status = sys$assign(&odsc, &iochan, 0, 0); if (status != SS$_NORMAL) give_up(status); status = sys$qiow(EFN, iochan, IO$_SENSEMODE, &iosb, 0, 0, oldmode, sizeof(oldmode), 0, 0, 0, 0); if (status != SS$_NORMAL || iosb.status != SS$_NORMAL) give_up(status); #ifdef DEBUG if (LOG_ENABLED) fprintf(log_fp, "sense: st=%d, cnt=%#x, dev=%#x\n", iosb.status, iosb.count, iosb.dev_dep_data); #endif newmode[0] = oldmode[0]; newmode[1] = oldmode[1] | TT$M_EIGHTBIT; newmode[1] &= ~(TT$M_TTSYNC | TT$M_HOSTSYNC); /* FIXME: this assumes we're doing IO$_SETCHAR */ newmode[2] = oldmode[2] | TT2$M_PASTHRU; status = sys$qiow(EFN, iochan, IO$_SETMODE, &iosb, 0, 0, newmode, sizeof(newmode), 0, 0, 0, 0); if (status != SS$_NORMAL || iosb.status != SS$_NORMAL) give_up(status); max_lines = (newmode[1] >> 24); min_cols = newmode[0] >> 16; tty_speed = lookup_speed(iosb.count & 0xff); if (LOG_ENABLED) { fprintf(log_fp, "TTY modes %#x, %#x, %#x\n", oldmode[0], oldmode[1], oldmode[2]); fprintf(log_fp, "iosb.count = %#x\n", iosb.count); fprintf(log_fp, "iosb.dev_dep_data = %#x\n", iosb.dev_dep_data); fprintf(log_fp, "TTY speed = %d\n", tty_speed); } } /* * Restore state to "normal", for menu-prompting */ void restore_ttymodes(void) { outflush(); in_flags = 0; cr_flag = TRUE; } void close_tty(void) { int status; QIO_SB iosb; status = sys$qiow(EFN, iochan, IO$_SETMODE, &iosb, 0, 0, oldmode, sizeof(oldmode), 0, 0, 0, 0); if (status == SS$_IVCHAN) return; /* already closed it */ (void) sys$dassgn(iochan); } void set_tty_crmod(int enabled) { cr_flag = enabled; } void set_tty_echo(int enabled) { if (enabled) in_flags &= ~IO$M_NOECHO; else in_flags |= IO$M_NOECHO; } void set_tty_raw(int enabled) { if (enabled) in_flags |= IO$M_NOFILTR; else in_flags &= ~IO$M_NOFILTR; } vttest-20140116/patchlev.h0000644000175100001440000000017612266037415014013 0ustar tomusers/* $Id: patchlev.h,v 1.56 2014/01/16 20:20:29 tom Exp $ */ #define RELEASE 2 #define PATCHLEVEL 7 #define PATCH_DATE 20140116 vttest-20140116/vt420.c0000644000175100001440000016311712266055032013057 0ustar tomusers/* $Id: vt420.c,v 1.162 2014/01/16 22:15:54 tom Exp $ */ /* * Reference: Installing and Using the VT420 Video Terminal (North American * Model (EK-VT420-UG.002) */ #include #include #include #include typedef struct { int mode; char *name; } MODES; typedef enum { marNone = -1, marReset = 0, marFirst = 1, marLast = 2, marMiddle = 3, marEnd } MARS; int origin_mode = FALSE; char txt_override_color[80]; static int do_lines = FALSE; static int use_colors = FALSE; /******************************************************************************/ static void reset_colors(void) { if (use_colors) { sgr("0"); use_colors = FALSE; if (LOG_ENABLED) { fprintf(log_fp, "Note: turned off colors\n"); } } } void set_colors(const char *value) { if (do_colors) { if (value == 0) value = "0"; sgr(value); use_colors = strcmp(value, "0"); if (LOG_ENABLED) { fprintf(log_fp, "Note: turned %s colors\n", use_colors ? "on" : "off"); } } } /******************************************************************************/ int lrmm_flag; static MARS lr_marg_flag; static int lr_marg1, lr_marg2; static MARS tb_marg_flag; static int tb_marg1, tb_marg2; char origin_mode_mesg[80]; char lrmm_mesg[80]; char lr_marg_mesg[80]; char tb_marg_mesg[80]; int toggle_LRMM(MENU_ARGS) { lrmm_flag = !lrmm_flag; if (lrmm_flag) sm("?69"); else rm("?69"); return MENU_NOHOLD; } /* * The message tells what margins will be used in the test, not what their * value is while drawing the menu (since actually setting margins would * interfere with the menu). */ int toggle_STBM(MENU_ARGS) { switch (++tb_marg_flag) { default: tb_marg_flag = marReset; tb_marg1 = 0; tb_marg2 = 0; strcpy(tb_marg_mesg, "Top/Bottom margins are reset"); break; case marFirst: tb_marg1 = 1; tb_marg2 = max_lines / 2; strcpy(tb_marg_mesg, "Top/Bottom margins are set to top half of screen"); break; case marLast: tb_marg1 = max_lines / 2; tb_marg2 = max_lines; strcpy(tb_marg_mesg, "Top/Bottom margins are set to bottom half of screen"); break; case marMiddle: tb_marg1 = max_lines / 4; tb_marg2 = (3 * max_lines) / 4; strcpy(tb_marg_mesg, "Top/Bottom margins are set to middle half of screen"); break; } return MENU_NOHOLD; } int toggle_SLRM(MENU_ARGS) { switch (++lr_marg_flag) { default: lr_marg_flag = marReset; lr_marg1 = 0; lr_marg2 = 0; strcpy(lr_marg_mesg, "Left/right margins are reset"); break; case marFirst: lr_marg1 = 1; lr_marg2 = min_cols / 2; strcpy(lr_marg_mesg, "Left/right margins are set to left half of screen"); break; case marLast: lr_marg1 = (min_cols / 2) + 1; lr_marg2 = min_cols; strcpy(lr_marg_mesg, "Left/right margins are set to right half of screen"); break; case marMiddle: lr_marg1 = (min_cols / 4) + 1; lr_marg2 = (3 * min_cols) / 4; strcpy(lr_marg_mesg, "Left/right margins are set to middle half of screen"); break; } return MENU_NOHOLD; } int get_top_margin(void) { int result = (tb_marg1 ? tb_marg1 : 1); if (origin_mode) result = 1; return result; } int get_left_margin(void) { int result = ((lrmm_flag && lr_marg1) ? lr_marg1 : 1); if (origin_mode) result = 1; return result; } int get_right_margin(void) { int result = ((lrmm_flag && lr_marg2) ? lr_marg2 : min_cols); if (origin_mode) { result = (((lrmm_flag && lr_marg2) ? lr_marg2 : min_cols) - ((lrmm_flag && lr_marg1) ? lr_marg1 : 1) + 1); } return result; } int get_bottom_margin(int n) { int result = (tb_marg2 ? tb_marg2 : (n)); if (origin_mode) { result = ((tb_marg2 ? tb_marg2 : max_lines) - (tb_marg1 ? tb_marg1 : 1) + 1); } return result; } static int get_hold_col(void) { int hold_col = 1; if (lrmm_flag) { switch (lr_marg_flag) { default: break; case marFirst: hold_col = get_right_margin() + 1; break; case marMiddle: hold_col = get_left_margin(); break; } } return hold_col; } /* * Return a good row value at which to print a prompt, avoiding most overwrite * of test-results. */ static int get_hold_row(void) { int hold_row; switch (tb_marg_flag) { default: hold_row = max_lines / 2; break; case marFirst: hold_row = (origin_mode ? (max_lines - 4) : (get_bottom_margin(max_lines) + 1)); break; case marMiddle: hold_row = (max_lines > 16) ? (max_lines - 4) : (max_lines / 2); break; case marLast: hold_row = 1; break; } return hold_row; } static int hold_clear(void) { int result; switch (tb_marg_flag) { default: result = 0; break; case marFirst: result = 1; break; case marReset: case marLast: result = 0; break; } return result; } /* * Prompt as part of a multi-step test, temporarily resetting DECOM so we can * put the prompt anywhere. */ static void special_prompt(int row, int col, const char *msg) { if (origin_mode) decom(FALSE); vt_move(row, col); if (msg != 0) { printf("%s", msg); vt_move(row + 1, col); } holdit(); if (origin_mode) decom(TRUE); } /* * Fill area outside margins with given character, to help show that changes * are limited to the area within margins. */ static void fill_outside(int ch) { int row, col; if (LOG_ENABLED) { fprintf(log_fp, "Note: filling outside margins with '%c'\n", ch); } set_colors("0"); if (origin_mode) decom(FALSE); for (row = 1; row <= max_lines; ++row) { if (row < tb_marg1 || row > tb_marg2 || lr_marg1 > 1 || lr_marg2 < min_cols) { int first = 1; int next = 0; for (col = 1; col <= min_cols; ++col) { if ((lrmm_flag && lr_marg1 && col < lr_marg1) || (lrmm_flag && lr_marg2 && col > lr_marg2) || (tb_marg1 != 0 && row < tb_marg1) || (tb_marg2 != 0 && row > tb_marg2)) { if (first || (next != col)) { vt_move(row, col); first = 0; next = col + 1; } putchar(ch); ++next; } } } } if (origin_mode) decom(TRUE); } void test_with_margins(int enable) { switch (enable) { case 1: fill_outside('.'); /* FALLTHRU */ case 2: decstbm(tb_marg1, tb_marg2); decslrm(lr_marg1, lr_marg2); if (origin_mode) decom(TRUE); break; default: decstbm(0, 0); decslrm(0, 0); if (origin_mode) decom(FALSE); break; } } /* * Fill the area within margins with a test pattern. The top line is numbers, * the bottom line is alphas. In between, use asterisks. */ static void fill_margins(void) { int top = get_top_margin(); int bot = get_bottom_margin(max_lines); int lft = get_left_margin(); int rgt = get_right_margin(); int row, col; set_colors(WHITE_ON_BLUE); decawm(FALSE); /* do this to allow writing in lower-right */ for (row = top; row <= bot; ++row) { cup(row, lft); for (col = lft; col <= rgt; ++col) { if (row == top) { putchar((col - lft) % 10 + '0'); } else if (row == bot) { putchar((col - lft) % 26 + 'a'); } else { putchar('*'); } } } decawm(TRUE); } static void setup_rectangle(BOX *box, int last) { box->top = 5; box->left = 5; box->right = min_cols - 5; box->bottom = max_lines - 10; if (origin_mode) { int top = get_top_margin(); int lft = get_left_margin(); int rgt = get_right_margin(); int bot = get_bottom_margin(last - 1); int wide = (rgt - lft + 1); int high = (bot - top + 1); if (high > 20) { box->top = 5; box->bottom = high - 10; } else { box->top = 2; box->bottom = high - 2; } if (wide > 20) { box->left = 5; box->right = wide - 5; } else { box->left = 2; box->right = wide - 2; } } } #define DATA(name,level) { name, #name, level } static int show_DECLRMM(MENU_ARGS) { /* *INDENT-OFF* */ RQM_DATA dec_modes[] = { /* this list is sorted by code, not name */ DATA( DECLRMM, 4 /* left/right margin mode */), }; /* *INDENT-ON* */ int code; int old_DECRPM = set_DECRPM(4); code = any_RQM(PASS_ARGS, dec_modes, TABLESIZE(dec_modes), 1); set_DECRPM(old_DECRPM); return code; } #undef DATA /* * Allow user to test the same screens with/without lines. */ static int toggle_lines_mode(MENU_ARGS) { do_lines = !do_lines; return MENU_NOHOLD; } /* * Allow user to test the same screens with/without origin-mode. */ int toggle_DECOM(MENU_ARGS) { origin_mode = !origin_mode; return MENU_NOHOLD; } /* * DECALN does not set attributes; we want a colored screen for some tests. */ static void fill_screen(void) { int y, x; if (do_colors) { set_colors(WHITE_ON_BLUE); for (y = 0; y < max_lines - 4; ++y) { cup(y + 1, 1); for (x = 0; x < min_cols; ++x) putchar('E'); } /* make this a different color to show fill versus erase diffs */ set_colors(WHITE_ON_GREEN); } else { decaln(); /* fill the screen */ } } /******************************************************************************/ static int rpt_DECSACE(MENU_ARGS) { return any_decrqss(the_title, "*x"); } static int rpt_DECSNLS(MENU_ARGS) { return any_decrqss(the_title, "*|"); } static int rpt_DECSLRM(MENU_ARGS) { return any_decrqss(the_title, "s"); } static int rpt_DECELF(MENU_ARGS) { return any_decrqss(the_title, "+q"); } /* * VT420 manual shows "=}", but the terminal returns an error. VT510 sequences * show "*}". */ static int rpt_DECLFKC(MENU_ARGS) { return any_decrqss(the_title, "*}"); } static int rpt_DECSMKR(MENU_ARGS) { return any_decrqss(the_title, "+r"); } /******************************************************************************/ static void show_DataIntegrity(char *report) { int pos = 0; int code = scanto(report, &pos, 'n'); const char *show; switch (code) { case 70: show = "No communication errors"; break; case 71: show = "Communication errors"; break; case 73: show = "Not reported since last power-up or RIS"; break; default: show = SHOW_FAILURE; } show_result("%s", show); } static void show_keypress(int row, int col) { char *report; char last[BUFSIZ]; last[0] = '\0'; vt_move(row++, 1); println("When you are done, press any key twice to quit."); vt_move(row, col); fflush(stdout); while (strcmp(report = instr(), last)) { vt_move(row, col); vt_clear(0); chrprint(report); strcpy(last, report); } } static void show_MultisessionStatus(char *report) { int pos = 0; int Ps1 = scan_any(report, &pos, 'n'); int Ps2 = scanto(report, &pos, 'n'); const char *show; switch (Ps1) { case 80: show = "SSU sessions enabled (%d max)"; break; case 81: show = "SSU sessions available but pending (%d max)"; break; case 83: show = "SSU sessions not ready"; break; case 87: show = "Sessions on separate lines"; break; default: show = SHOW_FAILURE; } show_result(show, Ps2); } /******************************************************************************/ /* * VT400 & up. * DECBI - Back Index * This control function moves the cursor backward one column. If the cursor * is at the left margin, then all screen data within the margin moves one * column to the right. The column that shifted past the right margin is lost. * * Format: ESC 6 * Description: * DECBI adds a new column at the left margin with no visual attributes. DECBI * is not affected by the margins. If the cursor is at the left border of the * page when the terminal received DECBI, then the terminal ignores DECBI. */ static int tst_DECBI(MENU_ARGS) { int n, m; int last = max_lines - 4; int final; int top; int lft; int rgt; test_with_margins(1); top = get_top_margin(); lft = get_left_margin(); rgt = get_right_margin(); final = (rgt - lft + 1) / 4; set_colors(WHITE_ON_BLUE); for (n = final; n > 0; n--) { slowly(); cup(top, lft); if (n != final) { for (m = 0; m < 4; m++) decbi(); } printf("%3d", n); } reset_colors(); test_with_margins(0); vt_move(last, 1); vt_clear(0); println(the_title); println("If your terminal supports DECBI (backward index), then the top row"); printf("should be numbered 1 through %d.\n", final); return MENU_HOLD; } static int tst_DECBKM(MENU_ARGS) { char *report; vt_move(1, 1); println(the_title); set_tty_raw(TRUE); set_tty_echo(FALSE); reset_inchar(); decbkm(TRUE); println("Press the backspace key"); vt_move(3, 10); report = instr(); chrprint(report); show_result(!strcmp(report, "\010") ? SHOW_SUCCESS : SHOW_FAILURE); reset_inchar(); vt_move(5, 1); decbkm(FALSE); println("Press the backspace key again"); vt_move(6, 10); report = instr(); chrprint(report); show_result(!strcmp(report, "\177") ? SHOW_SUCCESS : SHOW_FAILURE); vt_move(max_lines - 1, 1); restore_ttymodes(); return MENU_HOLD; } /* * VT400 & up * Change Attributes in Rectangular Area */ static int tst_DECCARA(MENU_ARGS) { int last = max_lines - 4; BOX box; setup_rectangle(&box, last); test_with_margins(1); set_colors(WHITE_ON_BLUE); decsace(TRUE); fill_screen(); deccara(box.top, box.left, box.bottom, box.right, 7); /* invert a rectangle) */ deccara(box.top + 1, box.left + 1, box.bottom - 1, box.right - 1, 0); /* invert a rectangle) */ test_with_margins(0); sgr("0"); vt_move(last, 1); vt_clear(0); println(the_title); println("There should be an open rectangle formed by reverse-video E's"); holdit(); test_with_margins(2); decsace(FALSE); fill_screen(); deccara(box.top, box.left, box.bottom, box.right, 7); /* invert a rectangle) */ deccara(box.top + 1, box.left + 1, box.bottom - 1, box.right - 1, 0); /* invert a rectangle) */ sgr("0"); test_with_margins(0); vt_move(last, 1); vt_clear(0); println(the_title); println("There should be an open rectangle formed by reverse-video E's"); println("combined with wrapping at the margins."); return MENU_HOLD; } static int tst_DECCKSR(MENU_ARGS, int Pid, const char *the_csi) { char *report; int pos = 0; vt_move(1, 1); printf("Testing DECCKSR: %s\n", the_title); set_tty_raw(TRUE); set_tty_echo(FALSE); do_csi("%s", the_csi); report = get_reply(); vt_move(3, 10); chrprint(report); if ((report = skip_dcs(report)) != 0 && strip_terminator(report) && strlen(report) > 1 && scanto(report, &pos, '!') == Pid && report[pos++] == '~' && (report = skip_xdigits(report + pos + 1)) != 0 && *report == '\0') { show_result(SHOW_SUCCESS); } else { show_result(SHOW_FAILURE); } restore_ttymodes(); vt_move(max_lines - 1, 1); return MENU_HOLD; } /* * VT400 & up. * Copy Rectangular area */ static int tst_DECCRA(MENU_ARGS) { #define adj_y 3 #define adj_x 4 #define adj_DECCRA " (down %d, right %d)\r\n", box.bottom + 1 - box.top, box.right + 1 - box.left, adj_y, adj_x #define msg_DECCRA(msg) "The %dx%d box " msg adj_DECCRA BOX box; int hmargin = origin_mode ? ((get_right_margin() * 3) / 8) : 30; int vmargin = origin_mode ? ((get_bottom_margin(max_lines) * 2) / 5) : 10; int last = max_lines - 3; if (make_box_params(&box, vmargin, hmargin) == 0) { box.top = 5; box.left = 5; test_with_margins(1); if (do_colors) { set_colors(WHITE_ON_BLUE); } else { sgr(BLINK_REVERSE); } draw_box_outline(&box, do_lines ? -1 : '*'); sgr("0"); test_with_margins(0); vt_move(last, 1); println(the_title); tprintf(msg_DECCRA("will be copied")); holdit(); test_with_margins(2); deccra(box.top, box.left, box.bottom, box.right, 1, box.top + adj_y, box.left + adj_x, 1); test_with_margins(0); vt_move(last, 1); vt_clear(0); tprintf(msg_DECCRA("should be copied, overlapping")); holdit(); test_with_margins(2); make_box_params(&box, vmargin, hmargin); box.top = 5; box.left = 5; if (do_colors) { set_colors(YELLOW_ON_BLACK); } else { sgr("0;7"); /* fill the box in reverse */ } draw_box_filled(&box, -1); if (do_colors) { set_colors(WHITE_ON_BLUE); } else { sgr(BLINK_REVERSE); } draw_box_outline(&box, do_lines ? -1 : '*'); sgr("0"); test_with_margins(0); vt_move(last, 1); println(the_title); tprintf(msg_DECCRA("will be copied")); holdit(); test_with_margins(2); sgr("0;4"); /* set underline, to check if that leaks through */ deccra(box.top, box.left, box.bottom, box.right, 1, box.top + adj_y, box.left + adj_x, 1); sgr("0"); test_with_margins(0); vt_move(last, 1); vt_clear(0); tprintf(msg_DECCRA("should be copied, overlapping")); } return MENU_HOLD; } static int marker_of(int n) { return (n - 1) % 26 + 'a'; } /* * VT400 & up. * Delete column. */ static int tst_DECDC(MENU_ARGS) { int n; int last = max_lines - 3; int base_row; int base_col; int left_col; int last_row; int real_col; int top; int bot; int lft; int rgt; int final_dc; char mark_1st = 0; char mark_2nd = 0; test_with_margins(1); set_colors(WHITE_ON_BLUE); top = get_top_margin(); lft = get_left_margin(); rgt = get_right_margin(); bot = get_bottom_margin(last - 1); /* * Adjustments so that most of the initial line (before shifting) passes * through the area within margins. */ if (origin_mode) { base_row = 0; if (lrmm_flag) { left_col = 1; switch (tb_marg_flag) { default: last_row = bot; break; case marReset: case marLast: last_row = bot - 3; break; } base_col = rgt - (bot - top) + last_row; if (base_col < 0) base_col = 0; if (base_col > rgt) base_col = rgt; real_col = lr_marg1 + lft - (lr_marg1 != 0); } else { last_row = last; base_col = (2 * last); left_col = 1; real_col = lft; } } else { switch (lr_marg_flag) { default: base_col = (2 * last); left_col = 1; break; case marFirst: base_col = (min_cols / 2); left_col = 1; break; case marMiddle: base_col = (3 * min_cols) / 4; left_col = (min_cols / 4) + 1; break; case marLast: base_col = min_cols + 0; left_col = (min_cols / 2) + 1; break; } if (tb_marg_flag == marLast) { base_row = max_lines / 2; } else { base_row = 0; } last_row = last; real_col = lft; } final_dc = base_col - 1; for (n = 1; n < last_row; n++) { int row = base_row + n; int col = base_col - n; if (row <= last_row) { int mark = marker_of(n); if (row >= top && row <= bot && row < last_row) { mark_2nd = (char) mark; if (mark_1st == 0) { mark_1st = (char) mark; } } slowly(); __(cup(row, col), putchar(mark)); if (top > 1 || (lrmm_flag && lft > 1)) { __(cup(1, 1), decdc(1)); /* outside margins, should be ignored */ __(cup(row, col), putchar(mark)); } if (final_dc-- > left_col) __(cup(top, lft), decdc(1)); } } if (final_dc > left_col) { slowly(); __(cup(top, lft), decdc(final_dc - left_col)); } reset_colors(); test_with_margins(0); ruler(last, min_cols); vt_move(last + 1, 1); vt_clear(0); if (lrmm_flag) tprintf("If your terminal supports DECDC, letters %c-%c are on column %d\n", mark_1st, mark_2nd, real_col); else println("There should be a diagonal of letters from left near bottom to middle at top"); return MENU_HOLD; } /* * VT400 & up * Erase Rectangular area */ static int tst_DECERA(MENU_ARGS) { int last = max_lines - 3; BOX box; setup_rectangle(&box, last); fill_screen(); test_with_margins(1); set_colors(WHITE_ON_GREEN); decera(box.top, box.left, box.bottom, box.right); sgr("0"); test_with_margins(0); vt_move(last, 1); vt_clear(0); println(the_title); if (origin_mode) println("There should be a rectangle cleared in the middle of the margins."); else println("There should be a rectangle cleared in the middle of the screen."); return MENU_HOLD; } /* * This is two tests: IND (index) and RI (reverse index). For each test, we * start by filling the area inside (including) the margins with a test * pattern, and then after the user presses "return", update the screen so that * only one line of the test-pattern should remain visible. */ static int tst_IND_RI(MENU_ARGS) { int hold_row = get_hold_row(); int hold_col = get_hold_col(); /* where to put "Push RETURN" */ int row; int top = get_top_margin(); int bot = get_bottom_margin(max_lines); int lft = get_left_margin(); int rgt = get_right_margin(); test_with_margins(1); fill_margins(); set_colors(0); special_prompt(hold_row, hold_col, 0); set_colors(WHITE_ON_GREEN); cup(bot, (lft + rgt) / 2); for (row = top; row < bot; ++row) { slowly(); ind(); } set_colors(0); special_prompt(hold_row, hold_col, "\"abcd...\" should be at top. "); fill_margins(); fill_outside('.'); set_colors(0); special_prompt(hold_row, hold_col, 0); set_colors(WHITE_ON_GREEN); cup(top, (lft + rgt) / 2); for (row = top; row < bot; ++row) { slowly(); ri(); } set_colors(0); special_prompt(hold_row, hold_col, "\"0123...\" should be at bottom. "); test_with_margins(0); return MENU_NOHOLD; } static int tst_IL_DL(MENU_ARGS) { int hold_row = get_hold_row(); int hold_col = get_hold_col(); /* where to put "Push RETURN" */ int row; int top = get_top_margin(); int bot = get_bottom_margin(max_lines); int lft = get_left_margin(); int rgt = get_right_margin(); test_with_margins(1); fill_margins(); set_colors(0); special_prompt(hold_row, hold_col, 0); /* * This should be ignored because it is outside margins. */ set_colors(WHITE_ON_GREEN); if (!origin_mode) { if (top > 1) { cup(top - 1, lft); il(1); } else if (bot < max_lines) { cup(bot + 1, lft); il(1); } else if (lft > 1) { cup(top, lft - 1); il(1); } else if (rgt < min_cols) { cup(top, rgt + 1); il(1); } } cup(top, (lft + rgt) / 2); for (row = top; row < bot;) { int skip = (row % 2) + 1; row += skip; if (row >= bot) skip = 1; slowly(); il(skip); } set_colors(0); special_prompt(hold_row, hold_col, "\"0123...\" should be at bottom. "); fill_margins(); fill_outside('.'); set_colors(0); special_prompt(hold_row, hold_col, 0); set_colors(WHITE_ON_GREEN); cup(top, (lft + rgt) / 2); for (row = top; row < bot;) { int skip = (row % 2) + 1; row += skip; if (row >= bot) skip = 1; slowly(); dl(skip); } set_colors(0); special_prompt(hold_row, hold_col, "\"abcd...\" should be at top. "); test_with_margins(0); return MENU_NOHOLD; } static int tst_ICH_DCH(MENU_ARGS) { int n; int last = max_lines - 3; int base_row; int base_col; int last_row; int real_col; int top; int bot; int lft; int rgt; char mark_1st = 0; char mark_2nd = 0; test_with_margins(1); set_colors(WHITE_ON_BLUE); top = get_top_margin(); bot = get_bottom_margin(last - 1); lft = get_left_margin(); rgt = get_right_margin(); /* * Adjustments so that most of the initial line (before shifting) passes * through the area within margins. */ if (origin_mode) { base_row = 0; if (lrmm_flag) { base_col = rgt - (bot - top) - 2; if (base_col < 0) base_col = 0; switch (tb_marg_flag) { default: last_row = bot; break; case marReset: case marLast: last_row = bot - 3; break; } real_col = rgt + lr_marg1 - (lr_marg1 != 0); } else { last_row = last; base_col = (2 * last); real_col = rgt; } } else { switch (lr_marg_flag) { default: base_col = (2 * last); break; case marFirst: base_col = 0; break; case marMiddle: base_col = min_cols / 4; break; case marLast: base_col = (min_cols / 2); break; } if (tb_marg_flag == marLast) { base_row = max_lines / 2; } else { base_row = 0; } last_row = last; real_col = rgt; } for (n = 1; n < last_row; n++) { int row = base_row + n; int col = base_col + n; if (row < last_row) { int mark = marker_of(n); if (row >= top && row <= bot && row < last_row) { mark_2nd = (char) mark; if (mark_1st == 0) { mark_1st = (char) mark; } } slowly(); __(cup(row, col), putchar(mark)); if (col < rgt) { cup(row, lft); putchar('?'); cup(row, lft); ich(rgt - col - 1); } } } reset_colors(); test_with_margins(0); ruler(last, min_cols); vt_move(last + 1, 1); vt_clear(0); tprintf("If your terminal supports ICH, letters %c-%c are on column %d\n", mark_1st, mark_2nd, real_col); holdit(); vt_clear(0); test_with_margins(1); set_colors(WHITE_ON_BLUE); /* * Adjustments so that most of the initial line (before shifting) passes * through the area within margins. */ if (origin_mode) { base_row = 0; if (lrmm_flag) { switch (tb_marg_flag) { default: last_row = bot; break; case marReset: case marLast: last_row = bot - 3; break; } base_col = rgt - (bot - top) + last_row; if (base_col < 0) base_col = 0; if (base_col > rgt) base_col = rgt; real_col = lr_marg1 + lft - (lr_marg1 != 0); } else { last_row = last; base_col = (2 * last); real_col = lft; } } else { switch (lr_marg_flag) { default: base_col = (2 * last); break; case marFirst: base_col = (min_cols / 2); break; case marMiddle: base_col = (3 * min_cols) / 4; break; case marLast: base_col = min_cols + 0; break; } if (tb_marg_flag == marLast) { base_row = max_lines / 2; } else { base_row = 0; } last_row = last; real_col = lft; } for (n = 1; n < last_row; n++) { int row = base_row + n; int col = base_col - n; if (row <= last_row) { int mark = marker_of(n); if (row >= top && row <= bot && row < last_row) { mark_2nd = (char) mark; if (mark_1st == 0) { mark_1st = (char) mark; } } __(cup(row, col), putchar(mark)); slowly(); if (col < rgt) ech(rgt - col); if (col > lft) { cup(row, lft); dch(col - lft); } else { cup(row, 1); dch(col - 1); } } } reset_colors(); test_with_margins(0); ruler(last, min_cols); vt_move(last + 1, 1); vt_clear(0); tprintf("If your terminal supports DCH, letters %c-%c are on column %d\n", mark_1st, mark_2nd, real_col); return MENU_HOLD; } /* * Check to see if ASCII formatting controls (BS, HT, CR) are affected by * left/right margins. Do this by starting after the left-margin, and * backspacing "before" the left margin. Then fill the margins with a usable * test pattern. After that, use tabs to go to the right margin, adding * another usable test (+), and use carriage returns to go to the left margin, * adding another usable test (-). */ static int tst_ASCII_format(MENU_ARGS) { int last = max_lines - 4; int top; int bot; int lft; int rgt; int n; int tab; int size; test_with_margins(1); top = get_top_margin(); bot = get_bottom_margin(last - 1); lft = get_left_margin(); rgt = get_right_margin(); /* * This should stop at the left margin, and the result overwritten by a * fill-pattern. */ set_colors(WHITE_ON_BLUE); cup(top, rgt); for (n = 0; n < rgt; ++n) { printf("*%c%c", BS, BS); } /* * Fill the margins with a repeating pattern. Do it twice, to force it to * scroll up. */ set_colors(WHITE_ON_GREEN); size = 2 * (rgt - lft + 1) * (bot - top + 1); for (n = 0; n < size; ++n) { int ch = ((n % 10) ? ((n % 10) + '0') : '_'); putchar(ch); } /* * Mark the margins with '-' (left) and '+' (right). */ set_colors(YELLOW_ON_BLACK); cup(top, lft); for (n = top; n <= bot; ++n) { for (tab = 0; tab < (rgt - lft + 16) / TABWIDTH; ++tab) { putchar(TAB); } putchar('+'); putchar(CR); putchar('-'); putchar(TAB); putchar('*'); if (n < bot) { putchar(LF); } } test_with_margins(0); set_colors("0"); vt_move(last, 1); vt_clear(0); ruler(last, min_cols); println(the_title); println("A repeating \"0123456789_\" pattern should fall within the -/+ margins"); return MENU_HOLD; } /* * VT400 & up. * * DECFI - Forward Index * This control function moves the column forward one column. If the cursor is * at the right margin, then all screen data within the margins moves one * column to the left. The column shifted past the left margin is lost. * * Format: ESC 9 * Description: * DECFI adds a new column at the right margin with no visual attributes. * DECFI is not affected by the margins. If the cursor is at the right border * of the page when the terminal receives DECFI, then the terminal ignores * DECFI. */ static int tst_DECFI(MENU_ARGS) { int n, m; int last = max_lines - 4; int final; int top; int lft; int rgt; test_with_margins(1); set_colors(WHITE_ON_BLUE); top = get_top_margin(); lft = get_left_margin(); rgt = get_right_margin(); final = (rgt - lft + 1) / 4; for (n = 1; n <= final; n++) { slowly(); cup(top, rgt - 3); printf("%3d", n); /* leaves cursor in rightmost column */ if (n != final) { for (m = 0; m < 4; m++) decfi(); } } reset_colors(); test_with_margins(0); vt_move(last, 1); vt_clear(0); println(the_title); println("If your terminal supports DECFI (forward index), then the top row"); printf("should be numbered 1 through %d.\n", final); return MENU_HOLD; } /* * Demonstrate whether cursor movement is limited by margins. VT420 manual * says that CUU/CUD will stop on the margins, but if outside the margins * will proceed to the page border. So we can test this by * * a) moving to the margin, and cursor up/down toward the border, placing a * marker at the end of the cursor movement (to overwrite a prior marker placed * explicitly on the border). * * b) repeat the process, going from the border into the area within margins. * * c) Even for the no-margins case, this is useful, since it demonstrates * whether the cursor forces scrolling. */ static int tst_cursor_margins(MENU_ARGS) { BOX box; int last = get_hold_row(); int row; int col; test_with_margins(1); box.top = get_top_margin(); box.left = get_left_margin(); box.right = get_right_margin(); box.bottom = get_bottom_margin(max_lines); set_colors(WHITE_ON_BLUE); draw_box_filled(&box, ' '); draw_box_outline(&box, '*'); set_colors(WHITE_ON_GREEN); for (row = box.top; row <= box.bottom; ++row) { cup(row, box.left); for (col = min_cols; col > 0; col--) { cub(1); } putchar('l'); } for (row = box.top; row <= box.bottom; ++row) { cup(row, box.right); for (col = 1; col <= min_cols; col++) { cuf(1); } putchar('r'); } for (col = box.left; col <= box.right; ++col) { cup(box.top, col); for (row = box.top; row > 0; row--) { cuu(1); } putchar('u'); } for (col = box.left; col <= box.right; ++col) { cup(box.bottom, col); for (row = box.bottom; row <= max_lines; row++) { cud(1); } putchar('d'); } set_colors("0"); test_with_margins(0); vt_move(last, 1); if (last > box.bottom) vt_clear(0); println(the_title); println("A box of *'s was written on screen border, overwritten using margins (u/d/l/r)"); return MENU_HOLD; } /* * Test movement with other things than cursor controls, i.e., BS, HT, CR, LF, * to see how margins affect them. */ static int tst_other_margins(MENU_ARGS) { BOX box; int last = get_hold_row(); int row; int col; test_with_margins(1); box.top = get_top_margin(); box.left = get_left_margin(); box.right = get_right_margin(); box.bottom = get_bottom_margin(max_lines); set_colors(WHITE_ON_BLUE); draw_box_filled(&box, ' '); draw_box_outline(&box, '*'); set_colors(WHITE_ON_GREEN); for (row = box.top; row <= box.bottom; ++row) { cup(row, box.left); for (col = box.left; col > 0; col--) { putchar('\b'); } putchar('l'); } for (row = box.top; row <= box.bottom; ++row) { cup(row, box.right); for (col = 1; col <= min_cols; col++) { putchar('\t'); } putchar('r'); } for (col = box.left; col <= box.right; ++col) { cup(box.top, col); putchar('u'); for (row = box.bottom; row > box.top; row--) { ind(); } } for (col = box.left; col <= box.right; ++col) { switch (col % 4) { case 0: cup(box.bottom, col); putchar('d'); break; case 1: cup(box.top, col); for (row = box.top; row < box.bottom; row++) { putchar('\f'); } putchar('d'); break; case 2: cup(box.top, col); for (row = box.top; row < box.bottom; row++) { nel(); cuf(col - 1); } putchar('d'); break; case 3: cup(box.bottom, col); putchar('d'); for (row = box.top; row < box.bottom; row++) { ri(); } putchar('u'); break; } } set_colors("0"); test_with_margins(0); vt_move(last, 1); if (hold_clear()) vt_clear(0); println(the_title); println("A box of *'s was written on screen border, overwritten using margins (u/d/l/r)"); return MENU_HOLD; } /* * VT400 & up * Fill Rectangular area */ static int tst_DECFRA(MENU_ARGS) { int last = max_lines - 3; BOX box; setup_rectangle(&box, last); test_with_margins(1); if (do_colors) { set_colors(WHITE_ON_BLUE); vt_clear(2); /* xterm fills the whole screen's background */ set_colors(WHITE_ON_GREEN); } decfra('*', box.top, box.left, box.bottom, box.right); set_colors("0"); test_with_margins(0); vt_move(last, 1); vt_clear(0); println(the_title); if (origin_mode) println("There should be a rectangle of *'s in the middle of the margins."); else println("There should be a rectangle of *'s in the middle of the screen."); holdit(); test_with_margins(2); set_colors(WHITE_ON_BLUE); decfra(' ', box.top, box.left, box.bottom, box.right); sgr("0"); test_with_margins(0); vt_move(last, 1); vt_clear(0); println(the_title); println("The rectangle of *'s should be gone."); return MENU_HOLD; } /* * VT400 & up. * Insert column. */ static int tst_DECIC(MENU_ARGS) { int n; int last = max_lines - 3; int base_row; int base_col; int last_row; int last_col; int real_col; int top; int bot; int lft; int rgt; int final_ic; char mark_1st = 0; char mark_2nd = 0; test_with_margins(1); set_colors(WHITE_ON_BLUE); top = get_top_margin(); bot = get_bottom_margin(last - 1); lft = get_left_margin(); rgt = get_right_margin(); /* * Adjustments so that most of the initial line (before shifting) passes * through the area within margins. */ if (origin_mode) { base_row = 0; if (lrmm_flag) { base_col = rgt - (bot - top) - 2; if (base_col < 0) base_col = 0; last_col = rgt - 1; switch (tb_marg_flag) { default: last_row = bot; break; case marReset: case marLast: last_row = bot - 3; break; } real_col = rgt + lr_marg1 - (lr_marg1 != 0); } else { last_row = last; base_col = (2 * last); last_col = min_cols - 1; real_col = rgt; } } else { if (lrmm_flag) { switch (lr_marg_flag) { default: base_col = (2 * last); last_col = min_cols - 1; break; case marFirst: base_col = 0; last_col = min_cols / 2 - 1; break; case marMiddle: base_col = min_cols / 4; last_col = (3 * min_cols) / 4 - 1; break; case marLast: base_col = (min_cols / 2); last_col = min_cols - 1; break; } } else { base_col = (2 * last); last_col = min_cols - 1; } if (tb_marg_flag == marLast) { base_row = max_lines / 2; } else { base_row = 0; } last_row = last; real_col = rgt; } final_ic = base_col; for (n = 1; n < last_row; n++) { int row = base_row + n; int col = base_col + n; if (row < last_row) { int mark = marker_of(n); if (row >= top && row <= bot && row < last_row) { mark_2nd = (char) mark; if (mark_1st == 0) { mark_1st = (char) mark; } } slowly(); __(cup(row, col), putchar(mark)); if (!origin_mode && (top > 1 || (lrmm_flag && lft > 1))) { __(cup(1, 1), decic(1)); /* outside margins, should be ignored */ __(cup(row, col), putchar(mark)); } if (final_ic++ <= last_col) __(cup(top, lft), decic(1)); } } if (final_ic <= last_col) { slowly(); decic(last_col - final_ic); } reset_colors(); test_with_margins(0); ruler(last, min_cols); vt_move(last + 1, 1); vt_clear(0); if (lrmm_flag) tprintf("If your terminal supports DECIC, letters %c-%c are on column %d\n", mark_1st, mark_2nd, real_col); else println("There should be a diagonal of letters from left near top to middle at bottom"); return MENU_HOLD; } static int tst_DECIC_DECDC(MENU_ARGS) { tst_DECIC(PASS_ARGS); holdit(); vt_clear(2); tst_DECDC(PASS_ARGS); return MENU_HOLD; } static int tst_DECKBUM(MENU_ARGS) { vt_move(1, 1); println(the_title); set_tty_raw(TRUE); set_tty_echo(FALSE); deckbum(TRUE); println("The keyboard is set for data processing."); show_keypress(3, 10); vt_move(10, 1); deckbum(FALSE); println("The keyboard is set for normal (typewriter) processing."); show_keypress(11, 10); restore_ttymodes(); vt_move(max_lines - 1, 1); return MENU_HOLD; } static int tst_DECKPM(MENU_ARGS) { vt_move(1, 1); println(the_title); set_tty_raw(TRUE); set_tty_echo(FALSE); deckpm(TRUE); println("The keyboard is set for position reports."); show_keypress(3, 10); vt_move(10, 1); deckpm(FALSE); println("The keyboard is set for character codes."); show_keypress(11, 10); restore_ttymodes(); vt_move(max_lines - 1, 1); return MENU_HOLD; } static int tst_DECNKM(MENU_ARGS) { vt_move(1, 1); println(the_title); set_tty_raw(TRUE); set_tty_echo(FALSE); decnkm(FALSE); println("Press one or more keys on the keypad. They should generate numeric codes."); show_keypress(3, 10); vt_move(10, 1); decnkm(TRUE); println("Press one or more keys on the keypad. They should generate control codes."); show_keypress(11, 10); decnkm(FALSE); vt_move(max_lines - 1, 1); restore_ttymodes(); return MENU_HOLD; } /* * VT400 & up * Reverse Attributes in Rectangular Area */ static int tst_DECRARA(MENU_ARGS) { int last = max_lines - 4; BOX box; setup_rectangle(&box, last); decsace(TRUE); fill_screen(); test_with_margins(1); decrara(box.top, box.left, box.bottom, box.right, 7); /* invert a rectangle) */ decrara(box.top + 1, box.left + 1, box.bottom - 1, box.right - 1, 7); /* invert a rectangle) */ sgr("0"); test_with_margins(0); vt_move(last, 1); vt_clear(0); println(the_title); println("There should be an open rectangle formed by reverse-video E's"); holdit(); decsace(FALSE); fill_screen(); test_with_margins(1); decrara(box.top, box.left, box.bottom, box.right, 7); /* invert a rectangle) */ decrara(box.top + 1, box.left + 1, box.bottom - 1, box.right - 1, 7); /* invert a rectangle) */ sgr("0"); test_with_margins(0); vt_move(last, 1); vt_clear(0); println(the_title); println("There should be an open rectangle formed by reverse-video E's"); println("combined with wrapping at the margins."); return MENU_HOLD; } int tst_vt420_DECRQSS(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Test VT320 features (DECRQSS)", tst_vt320_DECRQSS }, { "Select attribute change extent (DECSACE)", rpt_DECSACE }, { "Set number of lines per screen (DECSNLS)", rpt_DECSNLS }, { "Set left and right margins (DECSLRM)", rpt_DECSLRM }, { "Enable local functions (DECELF)", rpt_DECELF }, { "Local function key control (DECLFKC)", rpt_DECLFKC }, { "Select modifier key reporting (DECSMKR)", rpt_DECSMKR }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printf("VT420 Status-Strings Reports")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } /* * Selective-Erase Rectangular area */ static int tst_DECSERA(MENU_ARGS) { int last = max_lines - 3; BOX box; setup_rectangle(&box, last); /* * Part 1: clear the borders of a rectangle, leaving protect inner rectangle. */ fill_screen(); test_with_margins(1); set_colors(WHITE_ON_GREEN); /* * Protect an area slightly smaller than we will erase. * * That way (since the SGR color at this point differs from the color used to * fill the screen), we can see whether the colors are modified by the erase, * and if so, whether they come from the SGR color. */ decfra('*', box.top, box.left, box.bottom, box.right); decsca(1); decfra('*', box.top + 1, box.left + 1, box.bottom - 1, box.right - 1); decsca(0); sgr("0"); test_with_margins(0); vt_move(last, 1); vt_clear(0); println(the_title); tprintf("Rectangle %d,%d - %d,%d was filled using DECFRA\n", box.top, box.left, box.bottom, box.right); holdit(); test_with_margins(2); /* reenable but do not paint margins */ set_colors(WHITE_ON_BLUE); decsera(box.top, box.left, box.bottom, box.right); /* erase the border */ sgr("0"); test_with_margins(0); vt_move(last, 1); vt_clear(0); println(the_title); tprintf("Border %d,%d - %d,%d is cleared using DECSERA\n", box.top, box.left, box.bottom, box.right); holdit(); /* * Part 2: clear within the borders instead of clearing the borders. */ fill_screen(); test_with_margins(1); set_colors(WHITE_ON_GREEN); /* * Protect a rectangle and overwrite an inner rectangle which is not * protected. * * That way (since the SGR color at this point differs from the color used to * fill the screen), we can see whether the colors are modified by the erase, * and if so, whether they come from the SGR color. */ decsca(1); decfra('*', box.top, box.left, box.bottom, box.right); decsca(0); decfra('*', box.top + 1, box.left + 1, box.bottom - 1, box.right - 1); sgr("0"); test_with_margins(0); vt_move(last, 1); vt_clear(0); println(the_title); tprintf("Rectangle %d,%d - %d,%d was filled using DECFRA\n", box.top, box.left, box.bottom, box.right); holdit(); test_with_margins(2); /* reenable but do not paint margins */ set_colors(WHITE_ON_BLUE); decsera(box.top, box.left, box.bottom, box.right); /* erase inside border */ sgr("0"); test_with_margins(0); vt_move(last, 1); vt_clear(0); println(the_title); tprintf("Inside %d,%d - %d,%d is cleared using DECSERA\n", box.top + 1, box.left + 1, box.bottom - 1, box.right - 1); return MENU_HOLD; } /* FIXME: use DECRQSS to get reports */ static int tst_DECSNLS(MENU_ARGS) { int rows; vt_move(1, 1); println("Testing Select Number of Lines per Screen (DECSNLS)"); for (rows = 48; rows >= 24; rows -= 12) { set_tty_raw(TRUE); set_tty_echo(FALSE); printf("%d Lines/Screen: ", rows); decsnls(rows); decrqss("*|"); chrprint(instr()); println(""); restore_ttymodes(); holdit(); } return MENU_NOHOLD; } static int tst_DSR_area_sum(MENU_ARGS) { /* compute a checksum on the title line, which contains some text */ return tst_DECCKSR(PASS_ARGS, 1, "1;1;1;1;2;80*y"); } static int tst_DSR_data_ok(MENU_ARGS) { return any_DSR(PASS_ARGS, "?75n", show_DataIntegrity); } static int tst_DSR_macrospace(MENU_ARGS) { char *report; const char *show; vt_move(1, 1); printf("Testing DECMSR: %s\n", the_title); set_tty_raw(TRUE); set_tty_echo(FALSE); do_csi("?62n"); report = instr(); vt_move(3, 10); chrprint(report); if ((report = skip_csi(report)) != 0 && (report = skip_digits(report)) != 0 && !strcmp(report, "*{")) { show = SHOW_SUCCESS; } else { show = SHOW_FAILURE; } show_result("%s", show); restore_ttymodes(); vt_move(max_lines - 1, 1); return MENU_HOLD; } static int tst_DSR_memory_sum(MENU_ARGS) { return tst_DECCKSR(PASS_ARGS, 1, "?63;1n"); } static int tst_DSR_multisession(MENU_ARGS) { return any_DSR(PASS_ARGS, "?85n", show_MultisessionStatus); } int tst_SRM(MENU_ARGS) { int oldc, newc; vt_move(1, 1); println(the_title); set_tty_raw(TRUE); set_tty_echo(FALSE); srm(FALSE); println("Local echo is enabled, remote echo disabled. Press any keys, repeat to quit."); vt_move(3, 10); oldc = -1; while ((newc = inchar()) != oldc) oldc = newc; set_tty_echo(TRUE); srm(TRUE); vt_move(10, 1); println("Local echo is disabled, remote echo enabled. Press any keys, repeat to quit."); vt_move(11, 10); oldc = -1; while ((newc = inchar()) != oldc) oldc = newc; vt_move(max_lines - 1, 1); restore_ttymodes(); return MENU_HOLD; } /******************************************************************************/ void setup_vt420_cursor(MENU_ARGS) { tb_marg_flag = marNone; toggle_STBM(PASS_ARGS); lr_marg_flag = marNone; toggle_SLRM(PASS_ARGS); } void menus_vt420_cursor(void) { sprintf(origin_mode_mesg, "%s DECOM (origin mode)", STR_ENABLE(origin_mode)); sprintf(lrmm_mesg, "%s DECLRMM (left/right mode)", STR_ENABLE(lrmm_flag)); sprintf(txt_override_color, "%s test-regions (xterm)", do_colors ? "Color" : "Do not color"); } void finish_vt420_cursor(MENU_ARGS) { reset_colors(); do_colors = FALSE; if (tb_marg_flag > marReset) decstbm(0, 0); if (lr_marg_flag > marReset) { if (!lrmm_flag) toggle_LRMM(PASS_ARGS); decslrm(0, 0); } if (lrmm_flag) toggle_LRMM(PASS_ARGS); if (origin_mode) { decom(FALSE); origin_mode = FALSE; } } /* * The main vt100 module tests CUP, HVP, CUF, CUB, CUU, CUD */ int tst_vt420_cursor(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Test VT320 features", tst_vt320_cursor }, { origin_mode_mesg, toggle_DECOM }, { lrmm_mesg, toggle_LRMM }, { tb_marg_mesg, toggle_STBM }, { lr_marg_mesg, toggle_SLRM }, { txt_override_color, toggle_color_mode, }, { "Test Back Index (DECBI)", tst_DECBI }, { "Test Forward Index (DECFI)", tst_DECFI }, { "Test cursor movement within margins", tst_cursor_margins }, { "Test other movement (CR/HT/LF/FF) within margins", tst_other_margins }, { "", 0 } }; /* *INDENT-ON* */ setup_vt420_cursor(PASS_ARGS); do { vt_clear(2); __(title(0), printf("VT420 Cursor-Movement Tests")); __(title(2), println("Choose test type:")); menus_vt420_cursor(); } while (menu(my_menu)); finish_vt420_cursor(PASS_ARGS); return MENU_NOHOLD; } /******************************************************************************/ static int show_DECSTBM(MENU_ARGS) { int code; decstbm(tb_marg1, tb_marg2); code = rpt_DECSTBM(PASS_ARGS); return code; } static int show_DECSLRM(MENU_ARGS) { int code; decslrm(lr_marg1, lr_marg2); code = rpt_DECSLRM(PASS_ARGS); return code; } /* * The main vt100 module tests IRM, DL, IL, DCH, ICH, ED, EL * The vt220 module tests ECH and DECSCA */ static int tst_VT420_editing(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { origin_mode_mesg, toggle_DECOM }, { lrmm_mesg, toggle_LRMM }, { tb_marg_mesg, toggle_STBM }, { lr_marg_mesg, toggle_SLRM }, { txt_override_color, toggle_color_mode, }, { "Show DECRQM response for DECLRMM", show_DECLRMM }, { "Show DECRQSS response for DECSTBM", show_DECSTBM }, { "Show DECRQSS response for DECSLRM", show_DECSLRM }, { "Test insert/delete column (DECIC, DECDC)", tst_DECIC_DECDC }, { "Test vertical scrolling (IND, RI)", tst_IND_RI }, { "Test insert/delete line (IL, DL)", tst_IL_DL }, { "Test insert/delete char (ICH, DCH)", tst_ICH_DCH }, { "Test ASCII formatting (BS, CR, TAB)", tst_ASCII_format }, { "", 0 } }; /* *INDENT-ON* */ setup_vt420_cursor(PASS_ARGS); do { vt_clear(2); __(title(0), printf("VT420 Editing Sequence Tests")); __(title(2), println("Choose test type:")); menus_vt420_cursor(); } while (menu(my_menu)); finish_vt420_cursor(PASS_ARGS); return MENU_NOHOLD; } /******************************************************************************/ /* * The main vt100 module tests LNM, DECKPAM, DECARM, DECAWM */ static int tst_VT420_keyboard_ctl(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Test Backarrow key (DECBKM)", tst_DECBKM }, { "Test Numeric keypad (DECNKM)", tst_DECNKM }, { "Test Keyboard usage (DECKBUM)", tst_DECKBUM }, { "Test Key position (DECKPM)", tst_DECKPM }, { "Test Enable Local Functions (DECELF)", not_impl }, { "Test Local Function-Key Control (DECLFKC)", not_impl }, { "Test Select Modifier-Key Reporting (DECSMKR)", not_impl }, /* DECEKBD */ { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printf("VT420 Keyboard-Control Tests")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } /******************************************************************************/ static int tst_VT420_rectangle(MENU_ARGS) { static char txt_override_lines[80]; /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { origin_mode_mesg, toggle_DECOM }, { lrmm_mesg, toggle_LRMM }, { tb_marg_mesg, toggle_STBM }, { lr_marg_mesg, toggle_SLRM }, { txt_override_color, toggle_color_mode, }, { txt_override_lines, toggle_lines_mode, }, { "Test Change-Attributes in Rectangular Area (DECCARA)", tst_DECCARA }, { "Test Copy Rectangular area (DECCRA)", tst_DECCRA }, { "Test Erase Rectangular area (DECERA)", tst_DECERA }, { "Test Fill Rectangular area (DECFRA)", tst_DECFRA }, { "Test Reverse-Attributes in Rectangular Area (DECRARA)", tst_DECRARA }, { "Test Selective-Erase Rectangular area (DECSERA)", tst_DECSERA }, { "", 0 } }; /* *INDENT-ON* */ setup_vt420_cursor(PASS_ARGS); do { vt_clear(2); __(title(0), printf("VT420 Rectangular Area Tests%s", ((terminal_id() < 400) ? " (should not work)" : ""))); __(title(2), println("Choose test type:")); menus_vt420_cursor(); sprintf(txt_override_lines, "%s line-drawing characters", do_lines ? "Use" : "Do not use"); } while (menu(my_menu)); finish_vt420_cursor(PASS_ARGS); return MENU_NOHOLD; } /******************************************************************************/ /* UDK and rectangle-checksum status are available only on VT400 */ int tst_vt420_device_status(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Test VT320 features", tst_vt320_device_status }, { "Test Printer Status", tst_DSR_printer }, { "Test UDK Status", tst_DSR_userkeys }, { "Test Keyboard Status", tst_DSR_keyboard }, { "Test Locator Status", tst_DSR_locator }, { "Test Macro Space", tst_DSR_macrospace }, { "Test Memory Checksum", tst_DSR_memory_sum }, { "Test Data Integrity", tst_DSR_data_ok }, { "Test Multiple Session Status", tst_DSR_multisession }, { "Test Checksum of Rectangular Area (DECRQCRA)", tst_DSR_area_sum }, { "Test Extended Cursor-Position (DECXCPR)", tst_DSR_cursor }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printf("VT420 Device Status Reports (DSR)")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } /******************************************************************************/ int tst_vt420_report_presentation(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Test VT320 features", tst_vt320_report_presentation }, { "Request Mode (DECRQM)/Report Mode (DECRPM)", tst_DECRPM }, { "Status-String Report (DECRQSS)", tst_vt420_DECRQSS }, { "", 0 } }; /* *INDENT-ON* */ int old_DECRPM = set_DECRPM(4); do { vt_clear(2); __(title(0), printf("VT420 Presentation State Reports")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); set_DECRPM(old_DECRPM); return MENU_NOHOLD; } int tst_vt420_reports(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Test VT320 features", tst_vt320_reports }, { "Test Presentation State Reports", tst_vt420_report_presentation }, { "Test Device Status Reports (DSR)", tst_vt420_device_status }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printf("VT420 Reports")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } /******************************************************************************/ static int tst_VT420_screen(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Test VT320 features", tst_vt320_screen }, { "Test Select Number of Lines per Screen (DECSNLS)", tst_DECSNLS }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printf("VT420 Screen-Display Tests")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } /******************************************************************************/ /* * These apply only to VT400's & above. */ int tst_vt420(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Test VT320 features", tst_vt320 }, { "Test cursor-movement", tst_vt420_cursor }, { "Test editing sequences", tst_VT420_editing }, { "Test keyboard-control", tst_VT420_keyboard_ctl }, { "Test macro-definition (DECDMAC)", not_impl }, { "Test rectangular area functions", tst_VT420_rectangle }, { "Test reporting functions", tst_vt420_reports }, { "Test screen-display functions", tst_VT420_screen }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printf("VT420 Tests")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } vttest-20140116/utf8.c0000644000175100001440000000664511436200340013060 0ustar tomusers/* $Id: utf8.c,v 1.1 2010/08/28 12:28:16 tom Exp $ */ #include int conv_to_utf8(unsigned char *target, unsigned source, unsigned limit) { #define CH(n) CharOf((source) >> ((n) * 8)) int rc = 0; if (source <= 0x0000007f) rc = 1; else if (source <= 0x000007ff) rc = 2; else if (source <= 0x0000ffff) rc = 3; else if (source <= 0x001fffff) rc = 4; else if (source <= 0x03ffffff) rc = 5; else /* (source <= 0x7fffffff) */ rc = 6; if ((unsigned) rc > limit) { /* whatever it is, we cannot decode it */ rc = 0; } if (target != 0) { switch (rc) { case 1: target[0] = CH(0); break; case 2: target[1] = CharOf(0x80 | (CH(0) & 0x3f)); target[0] = CharOf(0xc0 | (CH(0) >> 6) | ((CH(1) & 0x07) << 2)); break; case 3: target[2] = CharOf(0x80 | (CH(0) & 0x3f)); target[1] = CharOf(0x80 | (CH(0) >> 6) | ((CH(1) & 0x0f) << 2)); target[0] = CharOf(0xe0 | ((int) (CH(1) & 0xf0) >> 4)); break; case 4: target[3] = CharOf(0x80 | (CH(0) & 0x3f)); target[2] = CharOf(0x80 | (CH(0) >> 6) | ((CH(1) & 0x0f) << 2)); target[1] = CharOf(0x80 | ((int) (CH(1) & 0xf0) >> 4) | ((int) (CH(2) & 0x03) << 4)); target[0] = CharOf(0xf0 | ((int) (CH(2) & 0x1f) >> 2)); break; case 5: target[4] = CharOf(0x80 | (CH(0) & 0x3f)); target[3] = CharOf(0x80 | (CH(0) >> 6) | ((CH(1) & 0x0f) << 2)); target[2] = CharOf(0x80 | ((int) (CH(1) & 0xf0) >> 4) | ((int) (CH(2) & 0x03) << 4)); target[1] = CharOf(0x80 | (CH(2) >> 2)); target[0] = CharOf(0xf8 | (CH(3) & 0x03)); break; case 6: target[5] = CharOf(0x80 | (CH(0) & 0x3f)); target[4] = CharOf(0x80 | (CH(0) >> 6) | ((CH(1) & 0x0f) << 2)); target[3] = CharOf(0x80 | (CH(1) >> 4) | ((CH(2) & 0x03) << 4)); target[2] = CharOf(0x80 | (CH(2) >> 2)); target[1] = CharOf(0x80 | (CH(3) & 0x3f)); target[0] = CharOf(0xfc | ((int) (CH(3) & 0x40) >> 6)); break; } } return rc; /* number of bytes needed in target */ #undef CH } int conv_to_utf32(unsigned *target, const char *source, unsigned limit) { #define CH(n) CharOf((*target) >> ((n) * 8)) int rc = 0; int j; unsigned mask = 0; /* * Find the number of bytes we will need from the source. */ if ((*source & 0x80) == 0) { rc = 1; mask = (unsigned) *source; } else if ((*source & 0xe0) == 0xc0) { rc = 2; mask = (unsigned) (*source & 0x1f); } else if ((*source & 0xf0) == 0xe0) { rc = 3; mask = (unsigned) (*source & 0x0f); } else if ((*source & 0xf8) == 0xf0) { rc = 4; mask = (unsigned) (*source & 0x07); } else if ((*source & 0xfc) == 0xf8) { rc = 5; mask = (unsigned) (*source & 0x03); } else if ((*source & 0xfe) == 0xfc) { rc = 6; mask = (unsigned) (*source & 0x01); } if ((unsigned) rc > limit) { /* whatever it is, we cannot decode it */ rc = 0; } /* * sanity-check. */ if (rc > 1) { for (j = 1; j < rc; j++) { if ((source[j] & 0xc0) != 0x80) break; } if (j != rc) { rc = 0; } } if (target != 0) { int shift = 0; *target = 0; for (j = 1; j < rc; j++) { *target |= (unsigned) (source[rc - j] & 0x3f) << shift; shift += 6; } *target |= mask << shift; } return rc; #undef CH } vttest-20140116/vt520.c0000644000175100001440000003146211746224777013075 0ustar tomusers/* $Id: vt520.c,v 1.10 2012/04/26 10:57:03 tom Exp $ */ /* * Reference: VT520/VT525 Video Terminal Programmer Information * (EK-VT520-RM.A01) */ #include #include #include #include /******************************************************************************/ static struct { int code; const char *text; } tbl_decscusr[] = { { 1, "The cursor should be a blinking rectangle" }, { 0, "The cursor should be a blinking rectangle" }, { 2, "The cursor should be a nonblinking rectangle" }, { 3, "The cursor should be a blinking underline" }, { 4, "The cursor should be a nonblinking underline" }, { 2, "The cursor should be a rectangle again" } }; /******************************************************************************/ static int tst_vt520_cursor(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Test VT420 features", tst_vt420_cursor }, { origin_mode_mesg, toggle_DECOM }, { lrmm_mesg, toggle_LRMM }, { tb_marg_mesg, toggle_STBM }, { lr_marg_mesg, toggle_SLRM }, { txt_override_color, toggle_color_mode, }, { "Test Character-Position-Absolute (HPA)", tst_HPA }, { "Test Cursor-Back-Tab (CBT)", tst_CBT }, { "Test Cursor-Character-Absolute (CHA)", tst_CHA }, { "Test Cursor-Horizontal-Index (CHT)", tst_CHT }, { "Test Horizontal-Position-Relative (HPR)", tst_HPR }, { "Test Line-Position-Absolute (VPA)", tst_VPA }, { "Test Next-Line (CNL)", tst_CNL }, { "Test Previous-Line (CPL)", tst_CPL }, { "Test Vertical-Position-Relative (VPR)", tst_VPR }, { "", 0 } }; /* *INDENT-ON* */ setup_vt420_cursor(PASS_ARGS); do { vt_clear(2); __(title(0), printf("VT520 Cursor-Movement")); __(title(2), println("Choose test type:")); menus_vt420_cursor(); } while (menu(my_menu)); finish_vt420_cursor(PASS_ARGS); return MENU_NOHOLD; } /******************************************************************************/ /* * VT500 & up * * Test if terminal can control whether the screen is cleared when changing * DECCOLM. */ static int tst_DECNCSM(MENU_ARGS) { int last = max_lines - 4; char temp[80]; decaln(); deccolm(FALSE); vt_move(last, 1); ruler(last, min_cols); vt_clear(0); sprintf(temp, "Screen should be cleared (%d-columns)", min_cols); println(temp); holdit(); decaln(); deccolm(TRUE); vt_move(last, 1); ruler(last, max_cols); vt_clear(0); sprintf(temp, "Screen should be cleared (%d-columns)", max_cols); println(temp); holdit(); decncsm(TRUE); decaln(); deccolm(FALSE); vt_move(last, 1); ruler(last, min_cols); vt_clear(0); sprintf(temp, "Screen should be filled (%d-columns)", min_cols); println(temp); holdit(); decaln(); deccolm(TRUE); vt_move(last, 1); ruler(last, max_cols); vt_clear(0); sprintf(temp, "Screen should be filled (%d of %d-columns)", min_cols, max_cols); println(temp); holdit(); decncsm(FALSE); deccolm(FALSE); vt_move(last, 1); ruler(last, min_cols); vt_clear(0); sprintf(temp, "Screen should be cleared (%d-columns)", min_cols); println(temp); return MENU_HOLD; } /******************************************************************************/ static void decscusr(int parm) { do_csi("%d q", parm); } /* * VT500 & up * * Test if the terminal can change the cursor's appearance */ static int tst_DECSCUSR(MENU_ARGS) { size_t n; vt_move(1, 1); for (n = 0; n < TABLESIZE(tbl_decscusr); ++n) { if (n != 0) holdit(); decscusr(tbl_decscusr[n].code); println(tbl_decscusr[n].text); } return MENU_HOLD; } /******************************************************************************/ static int rpt_DECCRTST(MENU_ARGS) { return any_decrqss(the_title, "-q"); } static int rpt_DECDLDA(MENU_ARGS) { return any_decrqss(the_title, ",z"); } static int rpt_DECSEST(MENU_ARGS) { return any_decrqss(the_title, "-z"); } static int rpt_DECSCP(MENU_ARGS) { return any_decrqss(the_title, "*u"); } static int rpt_DECSCS(MENU_ARGS) { return any_decrqss(the_title, "*r"); } static int rpt_DECSDPT(MENU_ARGS) { return any_decrqss(the_title, "(p"); } static int rpt_DECSDDT(MENU_ARGS) { return any_decrqss(the_title, "$p"); } static int rpt_DECSFC(MENU_ARGS) { return any_decrqss(the_title, "*s"); } static int rpt_DECSPRTT(MENU_ARGS) { return any_decrqss(the_title, "$s"); } static int rpt_DECSPPCS(MENU_ARGS) { return any_decrqss(the_title, "*p"); } static int rpt_DECSSL(MENU_ARGS) { return any_decrqss(the_title, "p"); } static int rpt_DECSPMA(MENU_ARGS) { return any_decrqss(the_title, ",x"); } static int rpt_DECSPP(MENU_ARGS) { return any_decrqss(the_title, "+w"); } static int rpt_DECSSCLS(MENU_ARGS) { return any_decrqss(the_title, " p"); } static int rpt_DECSTRL(MENU_ARGS) { return any_decrqss(the_title, "\"u"); } /* * This list is separated from the main one, to keep the menu size fitting on * a 24x80 screen. */ static int tst_VT520_hardware_DECRQSS(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Test VT420 features (DECRQSS)", tst_vt420_DECRQSS }, { "CRT Saver Timing (DECCRTST)", rpt_DECCRTST }, { "Down Line Load Allocation (DECDLDA)", rpt_DECDLDA }, { "Energy Save Timing (DECSEST)", rpt_DECSEST }, { "Select Communication Port (DECSCP)", rpt_DECSCP }, { "Select Communication Speed (DECSCS)", rpt_DECSCS }, { "Select Digital Printed Data Type (DECSDPT)", rpt_DECSDPT }, { "Select Disconnect Delay Time (DECSDDT)", rpt_DECSDDT }, { "Select Flow Control Type (DECSFC)", rpt_DECSFC }, { "Select Printer Type (DECSPRTT)", rpt_DECSPRTT }, { "Select ProPrinter Character Set (DECSPPCS)", rpt_DECSPPCS }, { "Select Set-Up Language (DECSSL)", rpt_DECSSL }, { "Session Page Memory Allocation (DECSPMA)", rpt_DECSPMA }, { "Set Port Parameter (DECSPP)", rpt_DECSPP }, { "Set Scroll Speed (DECSSCLS)", rpt_DECSSCLS }, { "Set Transmit Rate Limit (DECSTRL)", rpt_DECSTRL }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printf("VT520 Status-Strings Reports (Hardware-oriented)")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } /******************************************************************************/ static int rpt_DECATR(MENU_ARGS) { return any_decrqss(the_title, ",}"); } static int rpt_DECAC(MENU_ARGS) { return any_decrqss(the_title, ",|"); } static int rpt_DECARR(MENU_ARGS) { return any_decrqss(the_title, "-p"); } static int rpt_DECSTGLT(MENU_ARGS) { return any_decrqss(the_title, "){"); } static int rpt_DECSZS(MENU_ARGS) { return any_decrqss(the_title, ",{"); } static int rpt_DECSCUSR(MENU_ARGS) { size_t n; vt_move(1, 1); for (n = 0; n < TABLESIZE(tbl_decscusr); ++n) { char expected[10]; if (n != 0) holdit(); vt_clear(2); decscusr(tbl_decscusr[n].code); sprintf(expected, "%d", tbl_decscusr[n].code ? tbl_decscusr[n].code : 1); (void) any_decrqss2(tbl_decscusr[n].text, " q", expected); } return MENU_HOLD; } static int rpt_DECSKCV(MENU_ARGS) { return any_decrqss(the_title, " r"); } static int rpt_DECSLCK(MENU_ARGS) { return any_decrqss(the_title, " v"); } static int rpt_DECSMBV(MENU_ARGS) { return any_decrqss(the_title, " u"); } static int rpt_DECSWBV(MENU_ARGS) { return any_decrqss(the_title, " t"); } static int rpt_DECTME(MENU_ARGS) { return any_decrqss(the_title, " ~"); } static int tst_VT520_DECRQSS(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Test VT420 features (DECRQSS)", tst_vt420_DECRQSS }, { "Test Hardware-oriented features", tst_VT520_hardware_DECRQSS }, { "Alternate Text Color (DECATR)", rpt_DECATR }, { "Assign Color (DECAC)", rpt_DECAC }, { "Select Auto Repeat Rate (DECARR)", rpt_DECARR }, { "Select Color Lookup Table (DECSTGLT)", rpt_DECSTGLT }, { "Select Zero Symbol (DECSZS)", rpt_DECSZS }, { "Set Cursor Style (DECSCUSR)", rpt_DECSCUSR }, { "Set Key Click Volume (DECSKCV)", rpt_DECSKCV }, { "Set Lock Key Style (DECSLCK)", rpt_DECSLCK }, { "Set Margin Bell Volume (DECSMBV)", rpt_DECSMBV }, { "Set Warning Bell Volume (DECSWBV)", rpt_DECSWBV }, { "Terminal Mode Emulation (DECTME)", rpt_DECTME }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printf("VT520 Status-Strings Reports")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } /******************************************************************************/ static int tst_VT520_report_presentation(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Test VT420 features", tst_vt420_report_presentation }, { "Request Mode (DECRQM)/Report Mode (DECRPM)", tst_DECRPM }, { "Status-String Report (DECRQSS)", tst_VT520_DECRQSS }, { "", 0 } }; /* *INDENT-ON* */ int old_DECRPM = set_DECRPM(5); do { vt_clear(2); __(title(0), printf("VT520 Presentation State Reports")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); set_DECRPM(old_DECRPM); return MENU_NOHOLD; } int tst_vt520_reports(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Test VT420 features", tst_vt420_reports }, { "Test Presentation State Reports", tst_VT520_report_presentation }, { "Test Device Status Reports (DSR)", tst_vt420_device_status }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printf("VT520 Reports")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } /******************************************************************************/ static int tst_vt520_screen(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Test No Clear on Column Change (DECNCSM)", tst_DECNCSM }, { "Test Set Cursor Style (DECSCUSR)", tst_DECSCUSR }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printf("VT520 Screen-Display Tests")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } /******************************************************************************/ /* * These apply only to VT500's & above. */ int tst_vt520(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Test VT420 features", tst_vt420 }, { "Test cursor-movement", tst_vt520_cursor }, { "Test editing sequences", not_impl }, { "Test keyboard-control", not_impl }, { "Test reporting functions", tst_vt520_reports }, { "Test screen-display functions", tst_vt520_screen }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printf("VT520 Tests")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } vttest-20140116/draw.c0000644000175100001440000000626511751503403013133 0ustar tomusers/* $Id: draw.c,v 1.11 2012/05/06 14:13:23 tom Exp $ */ #include #include #include /* * Useful drawing functions for vttest. */ static int check_box_params(BOX *box) { if (box->top >= box->bottom || box->left >= box->right) { printf("The screen is too small for box with margins %d,%d.", box->top, box->left); holdit(); return -1; } return 0; } /* * Compute box params for given vertical and horizontal margin, * returns -1 if the screen is too small, 0 otherwise. */ int make_box_params(BOX *box, int vmargin, int hmargin) { box->top = vmargin; box->bottom = get_bottom_margin(max_lines) - vmargin; box->left = hmargin; box->right = get_right_margin() - hmargin; return check_box_params(box); } void draw_box_outline(BOX *box, int mark) { int j; int tlc = (mark < 0) ? 'l' : mark; int trc = (mark < 0) ? 'k' : mark; int llc = (mark < 0) ? 'm' : mark; int lrc = (mark < 0) ? 'j' : mark; int vrt = (mark < 0) ? 'x' : mark; int hrz = (mark < 0) ? 'q' : mark; int dot; if (mark < 0) scs(0, '0'); for (j = box->top, dot = tlc; j < box->bottom; j++) { __(cup(j, box->left), putchar(dot)); dot = vrt; } for (j = box->top, dot = trc; j < box->bottom; j++) { __(cup(j, box->right), putchar(dot)); dot = vrt; } cup(box->top, box->left + 1); for (j = box->left + 1; j < box->right; j++) putchar(hrz); cup(box->bottom, box->left + 1); for (j = box->left + 1; j < box->right; j++) putchar(hrz); __(cup(box->bottom, box->left), putchar(llc)); __(cup(box->bottom, box->right), putchar(lrc)); if (mark < 0) scs(0, 'B'); } void draw_box_filled(BOX *box, int mark) { int i, j; int ch = (mark < 0) ? 'A' : mark; for (i = box->top; i < box->bottom; i++) { cup(i, box->left); for (j = box->left; j < box->right; j++) { putchar(ch); if (mark < 0) ch = ((ch - 'A' + 1) % 26) + 'A'; } } } static int next_word(const char *s) { const char *base; while (*s == ' ') s++; base = s; while (*s && *s != ' ') s++; return (int) (s - base); } void draw_box_caption(BOX *box, int margin, const char **c) { int x0 = (box->left + margin); int y0 = (box->top + margin); int x1 = (box->right - margin); int y1 = (box->bottom - margin); int x = x0; int y = y0; int t; const char *s; while ((s = *c++) != 0) { while ((t = *s++) != 0) { if (x == x0) { if (t == ' ') continue; cup(y, x++); putchar(' '); } putchar(t); x++; if ((t == ' ') && (next_word(s) > (x1 - x - 2))) { while (x < x1) { putchar(' '); x++; } } if (x >= x1) { putchar(' '); x = x0; y++; } } } while (y <= y1) { if (x == x0) { cup(y, x); } putchar(' '); if (++x >= x1) { putchar(' '); x = x0; y++; } } } void ruler(int row, int width) { int col; vt_move(row, 1); for (col = 1; col <= width; ++col) { int ch = (((col % 10) == 0) ? ('0' + (col / 10) % 10) : (((col % 5) == 0) ? '+' : '-')); putchar(ch); } putchar('\n'); } vttest-20140116/aclocal.m40000644000175100001440000010427712266040171013674 0ustar tomusersdnl $Id: aclocal.m4,v 1.24 2014/01/16 20:26:33 tom Exp $ dnl autoconf macros for vttest - T.E.Dickey dnl --------------------------------------------------------------------------- dnl Copyright: 1997-2013,2014 by Thomas E. Dickey dnl dnl Permission is hereby granted, free of charge, to any person obtaining a dnl copy of this software and associated documentation files (the dnl "Software"), to deal in the Software without restriction, including dnl without limitation the rights to use, copy, modify, merge, publish, dnl distribute, distribute with modifications, sublicense, and/or sell dnl copies of the Software, and to permit persons to whom the Software is dnl furnished to do so, subject to the following conditions: dnl dnl The above copyright notice and this permission notice shall be included dnl in all copies or portions of the Software. dnl dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE. dnl dnl Except as contained in this notice, the name(s) of the above copyright dnl holders shall not be used in advertising or otherwise to promote the dnl sale, use or other dealings in this Software without prior written dnl authorization. dnl --------------------------------------------------------------------------- dnl --------------------------------------------------------------------------- dnl CF_ACVERSION_CHECK version: 4 updated: 2013/03/04 19:52:56 dnl ------------------ dnl Conditionally generate script according to whether we're using a given autoconf. dnl dnl $1 = version to compare against dnl $2 = code to use if AC_ACVERSION is at least as high as $1. dnl $3 = code to use if AC_ACVERSION is older than $1. define([CF_ACVERSION_CHECK], [ ifdef([AC_ACVERSION], ,[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])dnl ifdef([m4_version_compare], [m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])], [CF_ACVERSION_COMPARE( AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])), AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl dnl --------------------------------------------------------------------------- dnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53 dnl -------------------- dnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1, dnl MAJOR2, MINOR2, TERNARY2, dnl PRINTABLE2, not FOUND, FOUND) define([CF_ACVERSION_COMPARE], [ifelse(builtin([eval], [$2 < $5]), 1, [ifelse([$8], , ,[$8])], [ifelse([$9], , ,[$9])])])dnl dnl --------------------------------------------------------------------------- dnl CF_ADD_CFLAGS version: 10 updated: 2010/05/26 05:38:42 dnl ------------- dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS dnl The second parameter if given makes this macro verbose. dnl dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS, dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily dnl confused by the quotes (which require backslashes to keep them usable). AC_DEFUN([CF_ADD_CFLAGS], [ cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in $1 do case $cf_fix_cppflags in no) case $cf_add_cflags in #(vi -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi case $cf_add_cflags in -D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'` test "${cf_add_cflags}" != "${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test $cf_fix_cppflags = yes ; then cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in *$cf_add_cflags) #(vi ;; *) #(vi case $cf_add_cflags in #(vi -D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags) ;; esac cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" ;; esac ;; *) cf_new_cflags="$cf_new_cflags $cf_add_cflags" ;; esac ;; yes) cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'` test "${cf_add_cflags}" != "${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)]) CFLAGS="$CFLAGS $cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)]) CPPFLAGS="$CPPFLAGS $cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)]) EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" fi AC_SUBST(EXTRA_CPPFLAGS) ])dnl dnl --------------------------------------------------------------------------- dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31 dnl -------------- dnl Allow user to disable a normally-on option. AC_DEFUN([CF_ARG_DISABLE], [CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl dnl --------------------------------------------------------------------------- dnl CF_ARG_OPTION version: 4 updated: 2010/05/26 05:38:42 dnl ------------- dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus dnl values. dnl dnl Parameters: dnl $1 = option name dnl $2 = help-string dnl $3 = action to perform if option is not default dnl $4 = action if perform if option is default dnl $5 = default option value (either 'yes' or 'no') AC_DEFUN([CF_ARG_OPTION], [AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes) if test "$enableval" != "$5" ; then ifelse([$3],,[ :]dnl ,[ $3]) ifelse([$4],,,[ else $4]) fi],[enableval=$5 ifelse([$4],,,[ $4 ])dnl ])])dnl dnl --------------------------------------------------------------------------- dnl CF_CC_ENV_FLAGS version: 1 updated: 2012/10/03 05:25:49 dnl --------------- dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content dnl into CC. This will not help with broken scripts that wrap the compiler with dnl options, but eliminates a more common category of user confusion. AC_DEFUN([CF_CC_ENV_FLAGS], [ # This should have been defined by AC_PROG_CC : ${CC:=cc} AC_MSG_CHECKING(\$CC variable) case "$CC" in #(vi *[[\ \ ]]-[[IUD]]*) AC_MSG_RESULT(broken) AC_MSG_WARN(your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options) # humor him... cf_flags=`echo "$CC" | sed -e 's/^[[^ ]]*[[ ]]//'` CC=`echo "$CC" | sed -e 's/[[ ]].*//'` CF_ADD_CFLAGS($cf_flags) ;; *) AC_MSG_RESULT(ok) ;; esac ])dnl dnl --------------------------------------------------------------------------- dnl CF_CHECK_CACHE version: 12 updated: 2012/10/02 20:55:03 dnl -------------- dnl Check if we're accidentally using a cache from a different machine. dnl Derive the system name, as a check for reusing the autoconf cache. dnl dnl If we've packaged config.guess and config.sub, run that (since it does a dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM dnl which is useful in cross-compiles. dnl dnl Note: we would use $ac_config_sub, but that is one of the places where dnl autoconf 2.5x broke compatibility with autoconf 2.13 AC_DEFUN([CF_CHECK_CACHE], [ if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then ifelse([$1],,[AC_CANONICAL_HOST],[$1]) system_name="$host_os" else system_name="`(uname -s -r) 2>/dev/null`" if test -z "$system_name" ; then system_name="`(hostname) 2>/dev/null`" fi fi test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[Define to the system name.]) AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"]) test -z "$system_name" && system_name="$cf_cv_system_name" test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name) if test ".$system_name" != ".$cf_cv_system_name" ; then AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)) AC_MSG_ERROR("Please remove config.cache and try again.") fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_CLANG_COMPILER version: 2 updated: 2013/11/19 19:23:35 dnl ----------------- dnl Check if the given compiler is really clang. clang's C driver defines dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does dnl not ignore some gcc options. dnl dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from dnl the wrappers for gcc and g++ warnings. dnl dnl $1 = GCC (default) or GXX dnl $2 = CLANG_COMPILER (default) dnl $3 = CFLAGS (default) or CXXFLAGS AC_DEFUN([CF_CLANG_COMPILER],[ ifelse([$2],,CLANG_COMPILER,[$2])=no if test "$ifelse([$1],,[$1],GCC)" = yes ; then AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler) cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -Qunused-arguments" AC_TRY_COMPILE([],[ #ifdef __clang__ #else make an error #endif ],[ifelse([$2],,CLANG_COMPILER,[$2])=yes cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments" ],[]) ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2])) fi ]) dnl --------------------------------------------------------------------------- dnl CF_DISABLE_ECHO version: 12 updated: 2012/10/06 16:30:28 dnl --------------- dnl You can always use "make -n" to see the actual options, but it's hard to dnl pick out/analyze warning messages when the compile-line is long. dnl dnl Sets: dnl ECHO_LT - symbol to control if libtool is verbose dnl ECHO_LD - symbol to prefix "cc -o" lines dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o) dnl SHOW_CC - symbol to put before explicit "cc -c" lines dnl ECHO_CC - symbol to put before any "cc" line dnl AC_DEFUN([CF_DISABLE_ECHO],[ AC_MSG_CHECKING(if you want to see long compiling messages) CF_ARG_DISABLE(echo, [ --disable-echo do not display "compiling" commands], [ ECHO_LT='--silent' ECHO_LD='@echo linking [$]@;' RULE_CC='@echo compiling [$]<' SHOW_CC='@echo compiling [$]@' ECHO_CC='@' ],[ ECHO_LT='' ECHO_LD='' RULE_CC='' SHOW_CC='' ECHO_CC='' ]) AC_MSG_RESULT($enableval) AC_SUBST(ECHO_LT) AC_SUBST(ECHO_LD) AC_SUBST(RULE_CC) AC_SUBST(SHOW_CC) AC_SUBST(ECHO_CC) ])dnl dnl --------------------------------------------------------------------------- dnl CF_FCNTL_VS_IOCTL version: 3 updated: 2004/08/03 20:29:33 dnl ----------------- dnl Test if we have a usable ioctl with FIONREAD, or if fcntl.h is preferred. AC_DEFUN([CF_FCNTL_VS_IOCTL], [ AC_MSG_CHECKING(if we may use FIONREAD) AC_CACHE_VAL(cf_cv_use_fionread,[ AC_TRY_COMPILE([ #if HAVE_SYS_FILIO_H # include /* FIONREAD */ #endif ],[ int l1; ioctl (0, FIONREAD, &l1); ], [cf_cv_use_fionread=yes], [cf_cv_use_fionread=no]) ]) AC_MSG_RESULT($cf_cv_use_fionread) test $cf_cv_use_fionread = yes && AC_DEFINE(USE_FIONREAD) ])dnl dnl --------------------------------------------------------------------------- dnl CF_GCC_ATTRIBUTES version: 16 updated: 2012/10/02 20:55:03 dnl ----------------- dnl Test for availability of useful gcc __attribute__ directives to quiet dnl compiler warnings. Though useful, not all are supported -- and contrary dnl to documentation, unrecognized directives cause older compilers to barf. AC_DEFUN([CF_GCC_ATTRIBUTES], [ if test "$GCC" = yes then cat > conftest.i < conftest.$ac_ext <&AC_FD_CC case $cf_attribute in #(vi printf) #(vi cf_printf_attribute=yes cat >conftest.h <conftest.h <conftest.h <>confdefs.h case $cf_attribute in #(vi noreturn) #(vi AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc]) ;; printf) #(vi cf_value='/* nothing */' if test "$cf_printf_attribute" != no ; then cf_value='__attribute__((format(printf,fmt,var)))' AC_DEFINE(GCC_PRINTF,1,[Define to 1 if the compiler supports gcc-like printf attribute.]) fi AC_DEFINE_UNQUOTED(GCC_PRINTFLIKE(fmt,var),$cf_value,[Define to printf-attribute for gcc]) ;; scanf) #(vi cf_value='/* nothing */' if test "$cf_scanf_attribute" != no ; then cf_value='__attribute__((format(scanf,fmt,var)))' AC_DEFINE(GCC_SCANF,1,[Define to 1 if the compiler supports gcc-like scanf attribute.]) fi AC_DEFINE_UNQUOTED(GCC_SCANFLIKE(fmt,var),$cf_value,[Define to sscanf-attribute for gcc]) ;; unused) #(vi AC_DEFINE_UNQUOTED(GCC_UNUSED,$cf_directive,[Define to unused-attribute for gcc]) ;; esac fi done else fgrep define conftest.i >>confdefs.h fi rm -rf conftest* fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_GCC_VERSION version: 7 updated: 2012/10/18 06:46:33 dnl -------------- dnl Find version of gcc AC_DEFUN([CF_GCC_VERSION],[ AC_REQUIRE([AC_PROG_CC]) GCC_VERSION=none if test "$GCC" = yes ; then AC_MSG_CHECKING(version of $CC) GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC[[^)]]*) //' -e 's/^.*(Debian[[^)]]*) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`" test -z "$GCC_VERSION" && GCC_VERSION=unknown AC_MSG_RESULT($GCC_VERSION) fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_GCC_WARNINGS version: 31 updated: 2013/11/19 19:23:35 dnl --------------- dnl Check if the compiler supports useful warning options. There's a few that dnl we don't use, simply because they're too noisy: dnl dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x) dnl -Wredundant-decls (system headers make this too noisy) dnl -Wtraditional (combines too many unrelated messages, only a few useful) dnl -Wwrite-strings (too noisy, but should review occasionally). This dnl is enabled for ncurses using "--enable-const". dnl -pedantic dnl dnl Parameter: dnl $1 is an optional list of gcc warning flags that a particular dnl application might want to use, e.g., "no-unused" for dnl -Wno-unused dnl Special: dnl If $with_ext_const is "yes", add a check for -Wwrite-strings dnl AC_DEFUN([CF_GCC_WARNINGS], [ AC_REQUIRE([CF_GCC_VERSION]) CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS) CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS) cat > conftest.$ac_ext <],[ #ifndef _XOPEN_SOURCE make an error #endif], [cf_cv_gnu_source=no], [cf_save="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" AC_TRY_COMPILE([#include ],[ #ifdef _XOPEN_SOURCE make an error #endif], [cf_cv_gnu_source=no], [cf_cv_gnu_source=yes]) CPPFLAGS="$cf_save" ]) ]) test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" ])dnl dnl --------------------------------------------------------------------------- dnl CF_INTEL_COMPILER version: 5 updated: 2013/02/10 10:41:05 dnl ----------------- dnl Check if the given compiler is really the Intel compiler for Linux. It dnl tries to imitate gcc, but does not return an error when it finds a mismatch dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK. dnl dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from dnl the wrappers for gcc and g++ warnings. dnl dnl $1 = GCC (default) or GXX dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS dnl $3 = CFLAGS (default) or CXXFLAGS AC_DEFUN([CF_INTEL_COMPILER],[ AC_REQUIRE([AC_CANONICAL_HOST]) ifelse([$2],,INTEL_COMPILER,[$2])=no if test "$ifelse([$1],,[$1],GCC)" = yes ; then case $host_os in linux*|gnu*) AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler) cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc" AC_TRY_COMPILE([],[ #ifdef __INTEL_COMPILER #else make an error #endif ],[ifelse([$2],,INTEL_COMPILER,[$2])=yes cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc" ],[]) ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2])) ;; esac fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_MAKE_DOCS version: 3 updated: 2014/01/05 13:21:25 dnl ------------ dnl $1 = name(s) to generate rules for dnl $2 = suffix of corresponding manpages used as input. define([CF_MAKE_DOCS],[ test -z "$cf_make_docs" && cf_make_docs=0 cf_output=makefile test -f "$cf_output" || cf_output=Makefile if test "$cf_make_docs" = 0 then cat >>$cf_output <<"CF_EOF" ################################################################################ .SUFFIXES : .html .$2 .man .ps .pdf .txt .$2.html : GROFF_NO_SGR=stupid [$](SHELL) -c "tbl [$]*.$2 | groff -P -o0 -I$*_ -Thtml -man" >[$]@ .$2.ps : [$](SHELL) -c "tbl [$]*.$2 | groff -man" >[$]@ .$2.txt : GROFF_NO_SGR=stupid [$](SHELL) -c "tbl [$]*.$2 | nroff -Tascii -man | col -bx" >[$]@ .ps.pdf : ps2pdf [$]*.ps CF_EOF cf_make_docs=1 fi for cf_name in $1 do cat >>$cf_output <conftest if test -f CONFTEST ; then cf_cv_mixedcase=no else cf_cv_mixedcase=yes fi rm -f conftest CONFTEST fi ]) test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.]) ])dnl dnl --------------------------------------------------------------------------- dnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32 dnl ---------- dnl Write a debug message to config.log, along with the line number in the dnl configure script. AC_DEFUN([CF_MSG_LOG],[ echo "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC ])dnl dnl --------------------------------------------------------------------------- dnl CF_POSIX_C_SOURCE version: 8 updated: 2010/05/26 05:38:42 dnl ----------------- dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed. dnl dnl POSIX.1-1990 _POSIX_SOURCE dnl POSIX.1-1990 and _POSIX_SOURCE and dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2 dnl Bindings Option dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L dnl X/Open 2000 _POSIX_C_SOURCE=200112L dnl dnl Parameters: dnl $1 is the nominal value for _POSIX_C_SOURCE AC_DEFUN([CF_POSIX_C_SOURCE], [ cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1]) cf_save_CFLAGS="$CFLAGS" cf_save_CPPFLAGS="$CPPFLAGS" CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE) CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE) AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[ CF_MSG_LOG(if the symbol is already defined go no further) AC_TRY_COMPILE([#include ],[ #ifndef _POSIX_C_SOURCE make an error #endif], [cf_cv_posix_c_source=no], [cf_want_posix_source=no case .$cf_POSIX_C_SOURCE in #(vi .[[12]]??*) #(vi cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" ;; .2) #(vi cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" cf_want_posix_source=yes ;; .*) cf_want_posix_source=yes ;; esac if test "$cf_want_posix_source" = yes ; then AC_TRY_COMPILE([#include ],[ #ifdef _POSIX_SOURCE make an error #endif],[], cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE") fi CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE) CFLAGS="$cf_trim_CFLAGS" CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" CF_MSG_LOG(if the second compile does not leave our definition intact error) AC_TRY_COMPILE([#include ],[ #ifndef _POSIX_C_SOURCE make an error #endif],, [cf_cv_posix_c_source=no]) CFLAGS="$cf_save_CFLAGS" CPPFLAGS="$cf_save_CPPFLAGS" ]) ]) if test "$cf_cv_posix_c_source" != no ; then CFLAGS="$cf_trim_CFLAGS" CPPFLAGS="$cf_trim_CPPFLAGS" CF_ADD_CFLAGS($cf_cv_posix_c_source) fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_POSIX_VDISABLE version: 6 updated: 2010/10/23 15:52:32 dnl ----------------- dnl Special test to workaround gcc 2.6.2, which cannot parse C-preprocessor dnl conditionals. dnl dnl AC_CHECK_HEADERS(termios.h unistd.h) dnl AC_CHECK_FUNCS(tcgetattr) dnl AC_DEFUN([CF_POSIX_VDISABLE], [ AC_MSG_CHECKING(if POSIX VDISABLE symbol should be used) AC_CACHE_VAL(cf_cv_posix_vdisable,[ AC_TRY_RUN([ #if defined(HAVE_TERMIOS_H) && defined(HAVE_TCGETATTR) #include #endif #ifdef HAVE_UNISTD_H #include #endif #if defined(_POSIX_VDISABLE) int main() { ${cf_cv_main_return:-return}(_POSIX_VDISABLE == -1); } #endif], [cf_cv_posix_vdisable=yes], [cf_cv_posix_vdisable=no], [AC_TRY_COMPILE([ #if defined(HAVE_TERMIOS_H) && defined(HAVE_TCGETATTR) #include #endif #ifdef HAVE_UNISTD_H #include #endif],[ #if defined(_POSIX_VDISABLE) && (_POSIX_VDISABLE != -1) int temp = _POSIX_VDISABLE; #else this did not work #endif], [cf_cv_posix_vdisable=yes], [cf_cv_posix_vdisable=no], )]) ]) AC_MSG_RESULT($cf_cv_posix_vdisable) test $cf_cv_posix_vdisable = yes && AC_DEFINE(HAVE_POSIX_VDISABLE) ])dnl dnl --------------------------------------------------------------------------- dnl CF_PROG_CC version: 3 updated: 2012/10/06 15:31:55 dnl ---------- dnl standard check for CC, plus followup sanity checks dnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name AC_DEFUN([CF_PROG_CC],[ ifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)]) CF_GCC_VERSION CF_ACVERSION_CHECK(2.52, [AC_PROG_CC_STDC], [CF_ANSI_CC_REQD]) CF_CC_ENV_FLAGS ])dnl dnl --------------------------------------------------------------------------- dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50 dnl ---------------- dnl Remove all -U and -D options that refer to the given symbol from a list dnl of C compiler options. This works around the problem that not all dnl compilers process -U and -D options from left-to-right, so a -U option dnl cannot be used to cancel the effect of a preceding -D option. dnl dnl $1 = target (which could be the same as the source variable) dnl $2 = source (including '$') dnl $3 = symbol to remove define([CF_REMOVE_DEFINE], [ $1=`echo "$2" | \ sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \ -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'` ])dnl dnl --------------------------------------------------------------------------- dnl CF_TRY_XOPEN_SOURCE version: 1 updated: 2011/10/30 17:09:50 dnl ------------------- dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we dnl can define it successfully. AC_DEFUN([CF_TRY_XOPEN_SOURCE],[ AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[ AC_TRY_COMPILE([ #include #include #include ],[ #ifndef _XOPEN_SOURCE make an error #endif], [cf_cv_xopen_source=no], [cf_save="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" AC_TRY_COMPILE([ #include #include #include ],[ #ifdef _XOPEN_SOURCE make an error #endif], [cf_cv_xopen_source=no], [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) CPPFLAGS="$cf_save" ]) ]) if test "$cf_cv_xopen_source" != no ; then CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE) CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE) cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" CF_ADD_CFLAGS($cf_temp_xopen_source) fi ]) dnl --------------------------------------------------------------------------- dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59 dnl -------- dnl Make an uppercase version of a variable dnl $1=uppercase($2) AC_DEFUN([CF_UPPER], [ $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` ])dnl dnl --------------------------------------------------------------------------- dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12 dnl ---------- dnl Use AC_VERBOSE w/o the warnings AC_DEFUN([CF_VERBOSE], [test -n "$verbose" && echo " $1" 1>&AC_FD_MSG CF_MSG_LOG([$1]) ])dnl dnl --------------------------------------------------------------------------- dnl CF_WITH_WARNINGS version: 5 updated: 2004/07/23 14:40:34 dnl ---------------- dnl Combine the checks for gcc features into a configure-script option dnl dnl Parameters: dnl $1 - see CF_GCC_WARNINGS AC_DEFUN([CF_WITH_WARNINGS], [ if ( test "$GCC" = yes || test "$GXX" = yes ) then AC_MSG_CHECKING(if you want to check for gcc warnings) AC_ARG_WITH(warnings, [ --with-warnings test: turn on gcc warnings], [cf_opt_with_warnings=$withval], [cf_opt_with_warnings=no]) AC_MSG_RESULT($cf_opt_with_warnings) if test "$cf_opt_with_warnings" != no ; then CF_GCC_ATTRIBUTES CF_GCC_WARNINGS([$1]) fi fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_XOPEN_SOURCE version: 45 updated: 2013/09/07 14:06:25 dnl --------------- dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, dnl or adapt to the vendor's definitions to get equivalent functionality, dnl without losing the common non-POSIX features. dnl dnl Parameters: dnl $1 is the nominal value for _XOPEN_SOURCE dnl $2 is the nominal value for _POSIX_C_SOURCE AC_DEFUN([CF_XOPEN_SOURCE],[ AC_REQUIRE([AC_CANONICAL_HOST]) cf_XOPEN_SOURCE=ifelse([$1],,500,[$1]) cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2]) cf_xopen_source= case $host_os in #(vi aix[[4-7]]*) #(vi cf_xopen_source="-D_ALL_SOURCE" ;; cygwin|msys) #(vi cf_XOPEN_SOURCE=600 ;; darwin[[0-8]].*) #(vi cf_xopen_source="-D_APPLE_C_SOURCE" ;; darwin*) #(vi cf_xopen_source="-D_DARWIN_C_SOURCE" cf_XOPEN_SOURCE= ;; freebsd*|dragonfly*) #(vi # 5.x headers associate # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L cf_POSIX_C_SOURCE=200112L cf_XOPEN_SOURCE=600 cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" ;; hpux11*) #(vi cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500" ;; hpux*) #(vi cf_xopen_source="-D_HPUX_SOURCE" ;; irix[[56]].*) #(vi cf_xopen_source="-D_SGI_SOURCE" cf_XOPEN_SOURCE= ;; linux*|gnu*|mint*|k*bsd*-gnu) #(vi CF_GNU_SOURCE ;; mirbsd*) #(vi # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks and other headers which use u_int / u_short types cf_XOPEN_SOURCE= CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) ;; netbsd*) #(vi cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw ;; openbsd[[4-9]]*) #(vi # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw cf_xopen_source="-D_BSD_SOURCE" cf_XOPEN_SOURCE=600 ;; openbsd*) #(vi # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw ;; osf[[45]]*) #(vi cf_xopen_source="-D_OSF_SOURCE" ;; nto-qnx*) #(vi cf_xopen_source="-D_QNX_SOURCE" ;; sco*) #(vi # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer ;; solaris2.*) #(vi cf_xopen_source="-D__EXTENSIONS__" ;; *) CF_TRY_XOPEN_SOURCE CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) ;; esac if test -n "$cf_xopen_source" ; then CF_ADD_CFLAGS($cf_xopen_source) fi dnl In anything but the default case, we may have system-specific setting dnl which is still not guaranteed to provide all of the entrypoints that dnl _XOPEN_SOURCE would yield. if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then AC_MSG_CHECKING(if _XOPEN_SOURCE really is set) AC_TRY_COMPILE([#include ],[ #ifndef _XOPEN_SOURCE make an error #endif], [cf_XOPEN_SOURCE_set=yes], [cf_XOPEN_SOURCE_set=no]) AC_MSG_RESULT($cf_XOPEN_SOURCE_set) if test $cf_XOPEN_SOURCE_set = yes then AC_TRY_COMPILE([#include ],[ #if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE make an error #endif], [cf_XOPEN_SOURCE_set_ok=yes], [cf_XOPEN_SOURCE_set_ok=no]) if test $cf_XOPEN_SOURCE_set_ok = no then AC_MSG_WARN(_XOPEN_SOURCE is lower than requested) fi else CF_TRY_XOPEN_SOURCE fi fi ]) vttest-20140116/install-sh0000755000175100001440000001572307762207755014057 0ustar tomusers#! /bin/sh # # install - install a program, script, or datafile # # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd=$cpprog shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd=$stripprog shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "$0: no input file specified" >&2 exit 1 else : fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d "$dst" ]; then instcmd=: chmodcmd="" else instcmd=$mkdirprog fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f "$src" ] || [ -d "$src" ] then : else echo "$0: $src does not exist" >&2 exit 1 fi if [ x"$dst" = x ] then echo "$0: no destination specified" >&2 exit 1 else : fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d "$dst" ] then dst=$dst/`basename "$src"` else : fi fi ## this sed command emulates the dirname command dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-$defaultIFS}" oIFS=$IFS # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` IFS=$oIFS pathcomp='' while [ $# -ne 0 ] ; do pathcomp=$pathcomp$1 shift if [ ! -d "$pathcomp" ] ; then $mkdirprog "$pathcomp" else : fi pathcomp=$pathcomp/ done fi if [ x"$dir_arg" != x ] then $doit $instcmd "$dst" && if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename "$dst"` else dstfile=`basename "$dst" $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename "$dst"` else : fi # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/#inst.$$# rmtmp=$dstdir/#rm.$$# # Trap to clean up temp files at exit. trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 trap '(exit $?); exit' 1 2 13 15 # Move or copy the file name to the temp name $doit $instcmd "$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 $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi && # Now remove or move aside any old file at destination location. We try this # two ways since rm can't unlink itself on some systems and the destination # file might be busy for other reasons. In this case, the final cleanup # might fail but the new file should still install successfully. { if [ -f "$dstdir/$dstfile" ] then $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null || { echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 (exit 1); exit } else : fi } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" fi && # The final little trick to "correctly" pass the exit status to the exit trap. { (exit 0); exit } vttest-20140116/unix_io.c0000644000175100001440000001003412266054433013643 0ustar tomusers/* $Id: unix_io.c,v 1.29 2014/01/16 22:11:39 tom Exp $ */ #include #include #include #include #define BUF_SIZE 1024 static void give_up(SIG_ARGS GCC_UNUSED) { if (LOG_ENABLED) { fprintf(log_fp, "** killing program due to timeout\n"); fflush(log_fp); } kill(getpid(), (int) SIGTERM); } static int last_char; void reset_inchar(void) { last_char = -1; } /* * Wait until a character is typed on the terminal then read it, without * waiting for CR. */ char inchar(void) { int lval; int ch = '\0'; char one_byte = '\0'; fflush(stdout); lval = last_char; brkrd = FALSE; reading = TRUE; #ifdef HAVE_ALARM signal(SIGALRM, give_up); alarm(60); /* timeout after 1 minute, in case user's keyboard is hung */ #endif if (read(0, &one_byte, (size_t) 1) < 0) ch = EOF; else ch = (int) one_byte; #ifdef HAVE_ALARM alarm(0); #endif reading = FALSE; #ifdef DEBUG { FILE *fp = fopen("ttymodes.log", "a"); if (fp != 0) { fprintf(fp, "%d>%#x\n", brkrd, ch); fclose(fp); } } #endif if (brkrd) last_char = 0177; else last_char = ch; if ((last_char == 0177) && (last_char == lval)) give_up(SIGTERM); return (char) (last_char); } static int read_buffer(char *result, int want) { #if USE_FIONREAD int l1; #endif int i = 0; /* Wait 0.1 seconds (1 second in vanilla UNIX) */ zleep(100); fflush(stdout); #ifdef HAVE_RDCHK while (rdchk(0)) { read(0, result + i, 1); if (i++ >= want) break; } #else #if USE_FIONREAD while (ioctl(0, FIONREAD, &l1), l1 > 0L) { while (l1-- > 0L) { read(0, result + i, (size_t) 1); if (i++ >= want) goto out1; } } out1: #else while (read(2, result + i, 1) == 1) if (i++ >= want) break; #endif #endif result[i] = '\0'; return i; } /* * Get an unfinished string from the terminal: wait until a character is typed * on the terminal, then read it, and all other available characters. Return a * pointer to that string. */ char * instr(void) { static char result[BUF_SIZE]; int i = 0; result[i++] = inchar(); (void) read_buffer(result + i, (int) sizeof(result) - 2); if (LOG_ENABLED) { fputs("Reply: ", log_fp); put_string(log_fp, result); fputs("\n", log_fp); } return (result); } /* cf: vms_io.c */ char * get_reply(void) { static char result[BUF_SIZE * 2]; int old_len = 0; int new_len = 0; result[old_len++] = inchar(); do { new_len = read_buffer(result + old_len, (int) sizeof(result) - 2 - old_len); old_len += new_len; } while (new_len != 0 && old_len < (BUF_SIZE - 2)); if (LOG_ENABLED) { fputs("Reply: ", log_fp); put_string(log_fp, result); fputs("\n", log_fp); } return (result); } /* * Read to the next newline, truncating the buffer at BUFSIZ-1 characters */ void inputline(char *s) { do { int ch; char *d = s; while ((ch = getchar()) != EOF && ch != '\n') { if ((d - s) < BUFSIZ - 2) *d++ = (char) ch; } *d = 0; } while (!*s); } /* * Flush input buffer, make sure no pending input character */ void inflush(void) { int val; #ifdef HAVE_RDCHK while (rdchk(0)) read(0, &val, 1); #else #if USE_FIONREAD int l1; ioctl(0, FIONREAD, &l1); while (l1-- > 0L) read(0, &val, (size_t) 1); #else while (read(2, &val, (size_t) 1) > 0) ; #endif #endif } void holdit(void) { inflush(); tprintf("Push "); readnl(); } void readnl(void) { int ch = '\0'; char one_byte = '\0'; fflush(stdout); brkrd = FALSE; reading = TRUE; do { if (read(0, &one_byte, (size_t) 1) < 0) { break; } else { ch = (int) one_byte; } } while (ch != '\n' && !brkrd); if (brkrd) give_up(SIGTERM); reading = FALSE; } /* * Sleep and do nothing (don't waste CPU) for t milliseconds */ void zleep(int t) { #ifdef HAVE_USLEEP unsigned msecs = (unsigned) (t * 1000); usleep(msecs); #else unsigned secs = (unsigned) (t / 1000); if (secs == 0) secs = 1; sleep(secs); /* UNIX can only sleep whole seconds */ #endif } vttest-20140116/vt320.c0000644000175100001440000006762111745753461013075 0ustar tomusers/* $Id: vt320.c,v 1.28 2012/04/25 10:51:29 tom Exp $ */ /* * Reference: VT330/VT340 Programmer Reference Manual (EK-VT3XX-TP-001) */ #include #include #include #include static void show_Locator_Status(char *report) { int pos = 0; int code = scanto(report, &pos, 'n'); const char *show; switch (code) { case 53: show = "No locator"; break; case 50: show = "Locator ready"; break; case 58: show = "Locator busy"; break; default: show = SHOW_FAILURE; } show_result("%s", show); } /* * Though some people refer to the locator controls as "vt220", it appears in * later terminals (documented in the vt320 manual, but introduced as in UWS). */ int tst_DSR_locator(MENU_ARGS) { return any_DSR(PASS_ARGS, "?53n", show_Locator_Status); } static void show_ExtendedCursorPosition(char *report) { int pos = 0; int Pl = scan_any(report, &pos, 'R'); int Pc = scan_any(report, &pos, 'R'); int Pp = scan_any(report, &pos, 'R'); if (Pl != 0 && Pc != 0) { if (Pp != 0) show_result("Line %d, Column %d, Page %d", Pl, Pc, Pp); else show_result("Line %d, Column %d (Page?)", Pl, Pc); } else show_result(SHOW_FAILURE); } /* vt340/vt420 & up */ int tst_DSR_cursor(MENU_ARGS) { return any_DSR(PASS_ARGS, "?6n", show_ExtendedCursorPosition); } /******************************************************************************/ int tst_vt320_device_status(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Test VT220 features", tst_vt220_device_status }, { "Test Keyboard Status", tst_DSR_keyboard }, { "Test Printer Status", tst_DSR_printer }, { "Test UDK Status", tst_DSR_userkeys }, { "Test Locator Status", tst_DSR_locator }, { "Test Extended Cursor-Position (DECXCPR)", tst_DSR_cursor }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printf("VT320 Device Status Reports (DSR)")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } /******************************************************************************/ /* * DECCIR returns single characters separated by semicolons. It's not clear * (unless you test on a DEC terminal) from the documentation, which only cites * their values. This function returns an equivalent-value, recovering from * the bogus implementations that return a decimal number. */ static int scan_chr(char *str, int *pos, int toc) { int value = 0; while (str[*pos] != '\0' && str[*pos] != toc) { value = (value * 256) + (unsigned char) str[*pos]; *pos += 1; } if (str[*pos] == toc) *pos += 1; return value; } /* * From Kermit 3.13 & VT220 pocket guide * * Request CSI 1 $ w cursor information report * Response DCS 1 $ u Pr; Pc; Pp; Srend; Satt; Sflag; Pgl; Pgr; Scss; Sdesig ST * where Pr is cursor row (counted from origin as 1,1) * Pc is cursor column * Pp is 1, video page, a constant for VT320s * Srend = 40h + 8 (rev video on) + 4 (blinking on) * + 2 (underline on) + 1 (bold on) * Satt = 40h + 1 (selective erase on) * Sflag = 40h + 8 (autowrap pending) + 4 (SS3 pending) * + 2 (SS2 pending) + 1 (Origin mode on) * Pgl = char set in GL (0 = G0, 1 = G1, 2 = G2, 3 = G3) * Pgr = char set in GR (same as for Pgl) * Scss = 40h + 8 (G3 is 96 char) + 4 (G2 is 96 char) * + 2 (G1 is 96 char) + 1 (G0 is 96 char) * Sdesig is string of character idents for sets G0...G3, with * no separators between set idents. * If NRCs are active the set idents (all 94 byte types) are: * British A Italian Y * Dutch 4 Norwegian/Danish ' (hex 60) or E or 6 * Finnish 5 or C Portuguese %6 or g or L * French R or f Spanish Z * French Canadian 9 or Q Swedish 7 or H * German K Swiss = * Hebrew %= * (MS Kermit uses any choice when there are multiple) */ #define show_DECCIR_flag(value, mask, string) \ if (value & mask) { value &= ~mask; show_result(string); } static void show_DECCIR(char *report) { int Pr, Pc, Pp, Srend, Satt, Sflag, Pgl, Pgr, Scss; int pos = 3; /* skip "1$u" */ int n; Pr = scanto(report, &pos, ';'); Pc = scanto(report, &pos, ';'); Pp = scanto(report, &pos, ';'); vt_move(5, 10); show_result("Cursor (%d,%d), page %d", Pr, Pc, Pp); Srend = scan_chr(report, &pos, ';'); vt_move(6, 10); if (Srend & 0x40) { show_DECCIR_flag(Srend, 0x40, "Rendition:"); if (Srend == 0) show_result(" normal"); show_DECCIR_flag(Srend, 0x08, " reverse"); show_DECCIR_flag(Srend, 0x04, " blinking"); show_DECCIR_flag(Srend, 0x02, " underline"); show_DECCIR_flag(Srend, 0x01, " bold"); } if (Srend) show_result(" -> unknown rendition (0x%x)", Srend); Satt = scan_chr(report, &pos, ';'); vt_move(7, 10); switch (Satt) { case 0x40: show_result("Selective erase: off"); break; case 0x41: show_result("Selective erase: ON"); break; default: show_result("Selective erase: unknown (0x%x)", Satt); } Sflag = scan_chr(report, &pos, ';'); vt_move(8, 10); if (Sflag & 0x40) { show_DECCIR_flag(Sflag, 0x40, "Flags:"); show_DECCIR_flag(Sflag, 0x08, " autowrap pending"); show_DECCIR_flag(Sflag, 0x04, " SS3 pending"); show_DECCIR_flag(Sflag, 0x02, " SS2 pending"); show_DECCIR_flag(Sflag, 0x01, " origin-mode on"); } else { show_result(" -> unknown flag (0x%x)", Sflag); } Pgl = scanto(report, &pos, ';'); Pgr = scanto(report, &pos, ';'); vt_move(9, 10); show_result("Char set in GL: G%d, Char set in GR: G%d", Pgl, Pgr); Scss = scan_chr(report, &pos, ';'); vt_move(10, 10); if (Scss & 0x40) { show_DECCIR_flag(Scss, 0x40, "Char set sizes:"); show_DECCIR_flag(Scss, 0x08, " G3 is 96 char"); show_DECCIR_flag(Scss, 0x04, " G2 is 96 char"); show_DECCIR_flag(Scss, 0x02, " G1 is 96 char"); show_DECCIR_flag(Scss, 0x01, " G0 is 96 char"); /* VT420 manual says this cannot happen */ } else { show_result(" -> unknown char set size (0x%x)", Scss); } n = 11; vt_move(n, 10); show_result("Character set idents for G0...G3: "); println(""); while (report[pos] != '\0') { const char *result = parse_Sdesig(report, &pos); show_result(" %s\n", result); println(""); } } /******************************************************************************/ /* * Request CSI 2 $ w tab stop report * Response DCS 2 $ u Pc/Pc/...Pc ST * Pc are column numbers (from 1) where tab stops occur. Note the * separator "/" occurs in a real VT320 but should have been ";". */ static void show_DECTABSR(char *report) { int pos = 3; /* skip "2$u" */ int stop; char *buffer = (char *) malloc(strlen(report)); *buffer = '\0'; strcat(report, "/"); /* simplify scanning */ while ((stop = scanto(report, &pos, '/')) != 0) { sprintf(buffer + strlen(buffer), " %d", stop); } println(""); show_result("Tab stops:%s", buffer); free(buffer); } /******************************************************************************/ int any_decrqpsr(MENU_ARGS, int Ps) { char *report; vt_move(1, 1); printf("Testing DECRQPSR: %s\n", the_title); set_tty_raw(TRUE); set_tty_echo(FALSE); do_csi("%d$w", Ps); report = get_reply(); vt_move(3, 10); chrprint(report); if ((report = skip_dcs(report)) != 0) { if (strip_terminator(report) && *report == Ps + '0' && !strncmp(report + 1, "$u", (size_t) 2)) { show_result("%s (valid request)", SHOW_SUCCESS); switch (Ps) { case 1: show_DECCIR(report); break; case 2: show_DECTABSR(report); break; } } else { show_result(SHOW_FAILURE); } } else { show_result(SHOW_FAILURE); } restore_ttymodes(); vt_move(max_lines - 1, 1); return MENU_HOLD; } static int tst_DECCIR(MENU_ARGS) { return any_decrqpsr(PASS_ARGS, 1); } static int tst_DECTABSR(MENU_ARGS) { return any_decrqpsr(PASS_ARGS, 2); } /* Test Window Report - VT340, VT420 */ static int tst_DECRQDE(MENU_ARGS) { char *report; char chr; int Ph, Pw, Pml, Pmt, Pmp; vt_move(1, 1); println("Testing DECRQDE/DECRPDE Window Report"); set_tty_raw(TRUE); set_tty_echo(FALSE); do_csi("\"v"); report = get_reply(); vt_move(3, 10); chrprint(report); if ((report = skip_csi(report)) != 0 && sscanf(report, "%d;%d;%d;%d;%d\"%c", &Ph, &Pw, &Pml, &Pmt, &Pmp, &chr) == 6 && chr == 'w') { vt_move(5, 10); show_result("lines:%d, cols:%d, left col:%d, top line:%d, page %d", Ph, Pw, Pml, Pmt, Pmp); } else { show_result(SHOW_FAILURE); } restore_ttymodes(); vt_move(max_lines - 1, 1); return MENU_HOLD; } /* Test User-Preferred Supplemental Set - VT320 */ static int tst_DECRQUPSS(MENU_ARGS) { char *report; const char *show; __(vt_move(1, 1), println("Testing DECRQUPSS/DECAUPSS Window Report")); set_tty_raw(TRUE); set_tty_echo(FALSE); do_csi("&u"); report = get_reply(); vt_move(3, 10); chrprint(report); if ((report = skip_dcs(report)) != 0 && strip_terminator(report)) { if (!strcmp(report, "0!u%5")) show = "DEC Supplemental Graphic"; else if (!strcmp(report, "1!uA")) show = "ISO Latin-1 supplemental"; else show = "unknown"; } else { show = SHOW_FAILURE; } show_result("%s", show); restore_ttymodes(); vt_move(max_lines - 1, 1); return MENU_HOLD; } /* Request Terminal State Report */ static int tst_DECRQTSR(MENU_ARGS) { char *report; const char *show; vt_move(1, 1); println("Testing Terminal State Reports (DECRQTSR/DECTSR)"); set_tty_raw(TRUE); set_tty_echo(FALSE); do_csi("1$u"); report = get_reply(); vt_move(3, 10); chrprint(report); if ((report = skip_dcs(report)) != 0 && strip_terminator(report) && !strncmp(report, "1$s", (size_t) 3)) { show = SHOW_SUCCESS; } else { show = SHOW_FAILURE; } show_result("%s", show); restore_ttymodes(); vt_move(max_lines - 1, 1); return MENU_HOLD; } /******************************************************************************/ static int use_DECRPM; int set_DECRPM(int level) { int result = use_DECRPM; use_DECRPM = level; return result; } #define DATA(name,level) { name, #name, level } int any_RQM(MENU_ARGS, RQM_DATA * table, int tablesize, int private) { int j, row, Pa, Ps; char chr; char *report; vt_move(1, 1); printf("Testing %s\n", the_title); set_tty_raw(TRUE); set_tty_echo(FALSE); for (j = row = 0; j < tablesize; j++) { if (use_DECRPM < table[j].level) continue; if (++row >= max_lines - 3) { restore_ttymodes(); cup(max_lines - 1, 1); holdit(); vt_clear(2); vt_move(row = 2, 1); set_tty_raw(TRUE); set_tty_echo(FALSE); } do_csi((private ? "?%d$p" : "%d$p"), table[j].mode); report = instr(); printf("\n %4d: %-10s", table[j].mode, table[j].name); if (LOG_ENABLED) fprintf(log_fp, "Testing %s\n", table[j].name); chrprint(report); if ((report = skip_csi(report)) != 0 && sscanf(report, (private ? "?%d;%d$%c" : "%d;%d$%c"), &Pa, &Ps, &chr) == 3 && Pa == table[j].mode && chr == 'y') { switch (Ps) { case 0: show_result(" unknown"); break; case 1: show_result(" set"); break; case 2: show_result(" reset"); break; case 3: show_result(" permanently set"); break; case 4: show_result(" permanently reset"); break; default: show_result(" ?"); break; } } else { show_result(SHOW_FAILURE); } } restore_ttymodes(); vt_move(max_lines - 1, 1); return MENU_HOLD; } static int tst_ISO_DECRPM(MENU_ARGS) { /* *INDENT-OFF* */ RQM_DATA ansi_modes[] = { /* this list is sorted by code, not name */ DATA( GATM, 3 /* guarded area transfer (disabled) */), DATA( KAM, 3 /* keyboard action */), DATA( CRM, 3 /* control representation (setup) */), DATA( IRM, 3 /* insert/replace */), DATA( SRTM, 3 /* status reporting transfer (disabled) */), DATA( ERM, 9 /* erasure mode (non-DEC) */), DATA( VEM, 3 /* vertical editing (disabled) */), DATA( BDSM, 9 /* bi-directional support mode (non-DEC) */), DATA( DCSM, 9 /* device component select mode (non-DEC) */), DATA( HEM, 3 /* horizontal editing (disabled) */), DATA( PUM, 3 /* positioning unit (disabled) */), DATA( SRM, 3 /* send/receive */), DATA( FEAM, 3 /* format effector action (disabled) */), DATA( FETM, 3 /* format effector transfer (disabled) */), DATA( MATM, 3 /* multiple area transfer (disabled) */), DATA( TTM, 3 /* transfer termination (disabled) */), DATA( SATM, 3 /* selected area transfer (disabled) */), DATA( TSM, 3 /* tabulation stop (disabled) */), DATA( EBM, 3 /* editing boundary (disabled) */), DATA( LNM, 3 /* line feed/new line */) }; /* *INDENT-ON* */ return any_RQM(PASS_ARGS, ansi_modes, TABLESIZE(ansi_modes), 0); } static int tst_DEC_DECRPM(MENU_ARGS) { /* *INDENT-OFF* */ RQM_DATA dec_modes[] = { /* this list is sorted by code, not name */ DATA( DECCKM, 3 /* cursor keys */), DATA( DECANM, 3 /* ANSI */), DATA( DECCOLM, 3 /* column */), DATA( DECSCLM, 3 /* scrolling */), DATA( DECSCNM, 3 /* screen */), DATA( DECOM, 3 /* origin */), DATA( DECAWM, 3 /* autowrap */), DATA( DECARM, 3 /* autorepeat */), DATA( DECEDM, 3 /* edit */), DATA( DECLTM, 3 /* line transmit */), DATA( DECSCFDM,3 /* space compression field delimiter */), DATA( DECTEM, 3 /* transmission execution */), DATA( DECEKEM, 3 /* edit key execution */), DATA( DECPFF, 3 /* print form feed */), DATA( DECPEX, 3 /* printer extent */), DATA( DECTCEM, 3 /* text cursor enable */), DATA( DECRLM, 5 /* left-to-right */), DATA( DECTEK, 3 /* 4010/4014 emulation */), DATA( DECHEM, 5 /* Hebrew encoding */), DATA( DECNRCM, 3 /* national replacement character set */), DATA( DECGEPM, 3 /* graphics expanded print */), DATA( DECGPCM, 3 /* graphics print color */), DATA( DECGPCS, 3 /* graphics print color syntax */), DATA( DECGPBM, 3 /* graphics print background */), DATA( DECGRPM, 3 /* graphics rotated print */), DATA( DEC131TM,3 /* VT131 transmit */), DATA( DECNAKB, 5 /* Greek/N-A Keyboard Mapping */), DATA( DECHCCM, 3 /* horizontal cursor coupling (disabled) */), DATA( DECVCCM, 3 /* vertical cursor coupling */), DATA( DECPCCM, 3 /* page cursor coupling */), DATA( DECNKM, 3 /* numeric keypad */), DATA( DECBKM, 3 /* backarrow key */), DATA( DECKBUM, 3 /* keyboard usage */), DATA( DECLRMM, 4 /* left/right margin mode */), DATA( DECXRLM, 3 /* transmit rate linking */), DATA( DECKPM, 4 /* keyboard positioning */), DATA( DECNCSM, 5 /* no clearing screen on column change */), DATA( DECRLCM, 5 /* right-to-left copy */), DATA( DECCRTSM,5 /* CRT save */), DATA( DECARSM, 5 /* auto resize */), DATA( DECMCM, 5 /* modem control */), DATA( DECAAM, 5 /* auto answerback */), DATA( DECCANSM,5 /* conceal answerback */), DATA( DECNULM, 5 /* null */), DATA( DECHDPXM,5 /* half duplex */), DATA( DECESKM, 5 /* enable secondary keyboard language */), DATA( DECOSCNM,5 /* overscan */), DATA( DECFWM, 5 /* framed windows */), DATA( DECRPL, 5 /* review previous lines */), DATA( DECHWUM, 5 /* host wake-up mode (CRT and energy saver) */), DATA( DECATCUM,5 /* alternate text color underline */), DATA( DECATCBM,5 /* alternate text color blink */), DATA( DECBBSM, 5 /* bold and blink style */), DATA( DECECM, 5 /* erase color */), }; /* *INDENT-ON* */ return any_RQM(PASS_ARGS, dec_modes, TABLESIZE(dec_modes), 1); } #undef DATA /******************************************************************************/ int tst_DECRPM(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "ANSI Mode Report (DECRPM)", tst_ISO_DECRPM }, { "DEC Mode Report (DECRPM)", tst_DEC_DECRPM }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printf("Request Mode (DECRQM)/Report Mode (DECRPM)")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } /******************************************************************************/ /* * FIXME: The VT420 manual says that a valid response begins "DCS 0 $ r", * however I see "DCS 1 $ r" on a real VT420, consistently. */ int any_decrqss2(const char *msg, const char *func, const char *expected) { char *report; const char *show; char buffer[80]; vt_move(1, 1); printf("Testing DECRQSS: %s\n", msg); set_tty_raw(TRUE); set_tty_echo(FALSE); decrqss(func); report = get_reply(); reset_decstbm(); reset_decslrm(); vt_move(3, 10); chrprint(report); switch (parse_decrqss(report, func)) { case 1: if (expected && strcmp(expected, report)) { sprintf(buffer, "ok (expect '%s', actual '%s')", expected, report); show = buffer; } else { show = "ok (valid request)"; } break; case 0: show = "invalid request"; break; default: show = SHOW_FAILURE; break; } show_result("%s", show); restore_ttymodes(); vt_move(max_lines - 1, 1); return MENU_HOLD; } int any_decrqss(const char *msg, const char *func) { return any_decrqss2(msg, func, (const char *) 0); } static int rpt_DECSASD(MENU_ARGS) { return any_decrqss(the_title, "$}"); } static int rpt_DECSCA(MENU_ARGS) { return any_decrqss(the_title, "\"q"); } static int rpt_DECSCL(MENU_ARGS) { return any_decrqss(the_title, "\"p"); } static int rpt_DECSCPP(MENU_ARGS) { return any_decrqss(the_title, "$|"); } static int rpt_DECSLPP(MENU_ARGS) { return any_decrqss(the_title, "t"); } static int rpt_DECSSDT(MENU_ARGS) { return any_decrqss(the_title, "$~"); } int rpt_DECSTBM(MENU_ARGS) { return any_decrqss(the_title, "r"); } static int rpt_SGR(MENU_ARGS) { return any_decrqss(the_title, "m"); } static int rpt_DECTLTC(MENU_ARGS) { return any_decrqss(the_title, "'s"); } static int rpt_DECTTC(MENU_ARGS) { return any_decrqss(the_title, "|"); } int tst_vt320_DECRQSS(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Select active status display (DECSASD)", rpt_DECSASD }, { "Set character attribute (DECSCA)", rpt_DECSCA }, { "Set conformance level (DECSCL)", rpt_DECSCL }, { "Set columns per page (DECSCPP)", rpt_DECSCPP }, { "Set lines per page (DECSLPP)", rpt_DECSLPP }, { "Set status line type (DECSSDT)", rpt_DECSSDT }, { "Set top and bottom margins (DECSTBM)", rpt_DECSTBM }, { "Select graphic rendition (SGR)", rpt_SGR }, { "Set transmit termination character (DECTTC)", rpt_DECTTC }, { "Transmission line termination character (DECTLTC)", rpt_DECTLTC }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printf("VT320 Status-String Reports")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } /******************************************************************************/ /* * The main vt100 module tests CUP, HVP, CUF, CUB, CUU, CUD */ int tst_vt320_cursor(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Test Pan down (SU)", tst_SU }, { "Test Pan up (SD)", tst_SD}, { "Test Vertical Cursor Coupling (DECVCCM)", not_impl }, { "Test Page Cursor Coupling (DECPCCM)", not_impl }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printf("VT320 Cursor-Movement Tests")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } /******************************************************************************/ static int tst_vt320_report_terminal(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Restore Terminal State (DECRSTS)", not_impl }, { "Terminal State Report (DECRQTS/DECTSR)", tst_DECRQTSR }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printf("VT320 Terminal State Reports")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } /******************************************************************************/ int tst_vt320_report_presentation(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Cursor Information Report (DECCIR)", tst_DECCIR }, { "Tab Stop Report (DECTABSR)", tst_DECTABSR }, { "Request Mode (DECRQM)/Report Mode (DECRPM)", tst_DECRPM }, { "Restore Presentation State (DECRSPS)", not_impl }, { "Status-String Report (DECRQSS)", tst_vt320_DECRQSS }, { "", 0 } }; /* *INDENT-ON* */ int old_DECRPM = set_DECRPM(3); do { vt_clear(2); __(title(0), printf("VT320 Presentation State Reports")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); set_DECRPM(old_DECRPM); return MENU_NOHOLD; } /******************************************************************************/ int tst_vt320_reports(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Test VT220 features", tst_vt220_reports }, { "Test Device Status Report (DSR)", tst_vt320_device_status }, { "Test Presentation State Reports", tst_vt320_report_presentation }, { "Test Terminal State Reports", tst_vt320_report_terminal }, { "Test User-Preferred Supplemental Set (DECAUPSS)", tst_DECRQUPSS }, { "Test Window Report (DECRPDE)", tst_DECRQDE }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printf("VT320 Reports")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } /******************************************************************************/ /* vt340/vt420 & up */ static int tst_DECSCPP(MENU_ARGS) { static const int table[] = {-1, 80, 80, 132}; size_t n; char temp[80]; int last = max_lines - 4; for (n = 0; n < TABLESIZE(table); ++n) { int width = (table[n] < 0) ? min_cols : table[n]; vt_clear(2); decaln(); decscpp(table[n]); vt_move(last, 1); ruler(last, width); vt_clear(0); sprintf(temp, "Screen should be filled (%d of %d columns)", min_cols, width); println(temp); holdit(); } decscpp(-1); vt_move(last, 1); vt_clear(0); println("Screen is reset to original width"); return MENU_HOLD; } static int tst_DECSLPP(MENU_ARGS) { static const int table[] = {24, 25, 36, 48, 72, 144}; size_t n; char temp[80]; int last = max_lines - 4; for (n = 0; n < TABLESIZE(table); ++n) { int high = (table[n] < 0) ? min_cols : table[n]; vt_clear(2); decaln(); decslpp(table[n]); vt_move(last, 1); ruler(last, min_cols); vt_clear(0); sprintf(temp, "Screen should be filled (%d of %d rows)", max_lines, high); println(temp); holdit(); } decslpp(max_lines); vt_move(last, 1); vt_clear(0); println("Screen is reset to original height"); return MENU_HOLD; } static int tst_PageFormat(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Test set columns per page (DECSCPP)", tst_DECSCPP }, { "Test set lines per page (DECSLPP)", tst_DECSLPP }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printf("Page Format Tests")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } /******************************************************************************/ /* vt340/vt420 & up */ static int tst_PageMovement(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Test Next Page (NP)", not_impl }, { "Test Preceding Page (PP)", not_impl }, { "Test Page Position Absolute (PPA)", not_impl }, { "Test Page Position Backward (PPB)", not_impl }, { "Test Page Position Relative (PPR)", not_impl }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printf("Page Format Tests")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } /******************************************************************************/ /* vt340/vt420 & up */ int tst_vt320_screen(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Test VT220 features", tst_vt220_screen }, { "Test Status line (DECSASD/DECSSDT)", tst_statusline }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printf("VT320 Screen-Display Tests")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } /******************************************************************************/ int tst_vt320(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Test VT220 features", tst_vt220 }, { "Test cursor-movement", tst_vt320_cursor }, { "Test page-format controls", tst_PageFormat }, { "Test page-movement controls", tst_PageMovement }, { "Test reporting functions", tst_vt320_reports }, { "Test screen-display functions", tst_vt320_screen }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printf("VT320 Tests")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } vttest-20140116/esc.h0000644000175100001440000002006711751546075012765 0ustar tomusers/* $Id: esc.h,v 1.65 2012/05/06 19:08:45 tom Exp $ */ #ifndef ESC_H #define ESC_H 1 #define BEL 0007 /* ^G */ #define BS 0010 /* \b */ #define TAB 0011 /* \t */ #define LF 0012 /* \n */ #define CR 0015 /* \r */ #define SO 0016 /* 14 */ #define SI 0017 /* 15 */ #define ESC 0033 #define CSI 0233 #define SS3 0217 #define DCS 0220 #define ST 0234 /* * "ANSI" modes for DECRQM, DECRPM, SM and RM are a subset of the modes listed * in ECMA-48. The ones noted as "non-DEC" are not implemented in any of * DEC's terminals. */ #define GATM 1 /* guarded area transfer (disabled) */ #define KAM 2 /* keyboard action */ #define CRM 3 /* control representation (setup) */ #define IRM 4 /* insert/replace */ #define SRTM 5 /* status reporting transfer (disabled) */ #define ERM 6 /* erasure mode (non-DEC) */ #define VEM 7 /* vertical editing (disabled) */ #define BDSM 8 /* bi-directional support mode (non-DEC) */ #define DCSM 9 /* device component select mode (non-DEC) */ #define HEM 10 /* horizontal editing (disabled) */ #define PUM 11 /* positioning unit (disabled) */ #define SRM 12 /* send/receive */ #define FEAM 13 /* format effector action (disabled) */ #define FETM 14 /* format effector transfer (disabled) */ #define MATM 15 /* multiple area transfer (disabled) */ #define TTM 16 /* transfer termination (disabled) */ #define SATM 17 /* selected area transfer (disabled) */ #define TSM 18 /* tabulation stop (disabled) */ #define EBM 19 /* editing boundary (disabled) */ #define LNM 20 /* line feed/new line */ /* DEC private modes for DECRQM, DECRPM, SM and RM, based on list from * VT520 reference manual, as well as dec_term_function_checklist.ps from * Shuford's archive. */ #define DECCKM 1 /* cursor keys */ #define DECANM 2 /* ANSI */ #define DECCOLM 3 /* column */ #define DECSCLM 4 /* scrolling */ #define DECSCNM 5 /* screen */ #define DECOM 6 /* origin */ #define DECAWM 7 /* autowrap */ #define DECARM 8 /* autorepeat */ #define DECEDM 10 /* edit */ #define DECLTM 11 /* line transmit */ #define DECSCFDM 13 /* space compression field delimiter */ #define DECTEM 14 /* transmission execution */ #define DECEKEM 16 /* edit key execution */ #define DECPFF 18 /* print form feed */ #define DECPEX 19 /* printer extent */ #define DECTCEM 25 /* text cursor enable */ #define DECRLM 34 /* left-to-right */ #define DECTEK 35 /* 4010/4014 emulation */ #define DECHEM 36 /* Hebrew encoding */ #define DECNRCM 42 /* national replacement character set */ #define DECGEPM 43 /* graphics expanded print */ #define DECGPCM 44 /* graphics print color */ #define DECGPCS 45 /* graphics print color syntax */ #define DECGPBM 46 /* graphics print background */ #define DECGRPM 47 /* graphics rotated print */ #define DEC131TM 53 /* VT131 transmit */ #define DECNAKB 57 /* Greek/N-A Keyboard Mapping */ #define DECHCCM 60 /* horizontal cursor coupling (disabled) */ #define DECVCCM 61 /* vertical cursor coupling */ #define DECPCCM 64 /* page cursor coupling */ #define DECNKM 66 /* numeric keypad */ #define DECBKM 67 /* backarrow key */ #define DECKBUM 68 /* keyboard usage */ #define DECLRMM 69 /* left/right margin mode */ #define DECXRLM 73 /* transmit rate linking */ #define DECKPM 81 /* keyboard positioning */ #define DECNCSM 95 /* no clearing screen on column change */ #define DECRLCM 96 /* right-to-left copy */ #define DECCRTSM 97 /* CRT save */ #define DECARSM 98 /* auto resize */ #define DECMCM 99 /* modem control */ #define DECAAM 100 /* auto answerback */ #define DECCANSM 101 /* conceal answerback */ #define DECNULM 102 /* null */ #define DECHDPXM 103 /* half duplex */ #define DECESKM 104 /* enable secondary keyboard language */ #define DECOSCNM 106 /* overscan */ #define DECFWM 111 /* framed windows */ #define DECRPL 112 /* review previous lines */ #define DECHWUM 113 /* host wake-up mode (CRT and energy saver) */ #define DECATCUM 114 /* alternate text color underline */ #define DECATCBM 115 /* alternate text color blink */ #define DECBBSM 116 /* bold and blink style */ #define DECECM 117 /* erase color */ /* esc.c */ const char *csi_input(void); const char *csi_output(void); const char *dcs_input(void); const char *dcs_output(void); char *get_reply(void); char *instr(void); const char *osc_input(void); const char *osc_output(void); char *ss3_input(void); char *ss3_output(void); char *st_input(void); char *st_output(void); char inchar(void); int cup(int pn1, int pn2); int decdc(int pn); int decic(int pn); int println(const char *s); int tprintf(const char *fmt,...) GCC_PRINTFLIKE(1,2); void brc(int pn, int c); void brc2(int pn1, int pn2, int c); void brc3(int pn1, int pn2, int pn3, int c); void cbt(int pn); void cha(int pn); void cht(int pn); void cnl(int pn); void cpl(int pn); void cub(int pn); void cud(int pn); void cuf(int pn); void cuu(int pn); void da(void); void dch(int pn); void decaln(void); void decarm(int flag); void decawm(int flag); void decbi(void); void decbkm(int flag); void deccara(int top, int left, int bottom, int right, int attr); void decckm(int flag); void deccolm(int flag); void deccra(int Pts, int Pl, int Pbs, int Prs, int Pps, int Ptd, int Pld, int Ppd); void decdhl(int lower); void decdwl(void); void decefr(int top, int left, int bottom, int right); void decelr(int all_or_one, int pixels_or_cells); void decera(int top, int left, int bottom, int right); void decfi(void); void decfra(int c, int top, int left, int bottom, int right); void decid(void); void deckbum(int flag); void deckpam(void); void deckpm(int flag); void deckpnm(void); void decll(const char *ps); void decncsm(int flag); void decnkm(int flag); void decnrcm(int flag); void decom(int flag); void decpex(int flag); void decpff(int flag); void decrara(int top, int left, int bottom, int right, int attr); void decrc(void); void decreqtparm(int pn); void decrqlp(int mode); void decrqss(const char *pn); void decsace(int flag); void decsasd(int pn); void decsc(void); void decsca(int pn1); void decsclm(int flag); void decscnm(int flag); void decscpp(int cols); void decsed(int pn1); void decsel(int pn1); void decsera(int top, int left, int bottom, int right); void decsle(int mode); void decslpp(int rows); void decslrm(int pn1, int pn2); void decsnls(int pn); void decssdt(int pn); void decstbm(int pn1, int pn2); void decstr(void); void decswl(void); void dectst(int pn); void dl(int pn); void do_csi(const char *fmt,...) GCC_PRINTFLIKE(1,2); void do_dcs(const char *fmt,...) GCC_PRINTFLIKE(1,2); void do_osc(const char *fmt,...) GCC_PRINTFLIKE(1,2); void dsr(int pn); void ech(int pn); void ed(int pn); void el(int pn); void esc(const char *s); void extra_padding(int msecs); void holdit(void); void hpa(int pn); void hpr(int pn); void hts(void); void hvp(int pn1, int pn2); void ich(int pn); void il(int pn); void ind(void); void inflush(void); void inputline(char *s); void mc_autoprint(int flag); void mc_print_all_pages(void); void mc_print_composed(void); void mc_print_cursor_line(void); void mc_print_page(void); void mc_printer_assign(int flag); void mc_printer_controller(int flag); void mc_printer_start(int flag); void nel(void); void np(void); void padding(int msecs); void pp(void); void ppa(int pn); void ppb(int pn); void ppr(int pn); void put_char(FILE *fp, int c); void put_string(FILE *fp, const char *s); void readnl(void); void rep(int pn); void reset_decslrm(void); void reset_decstbm(void); void reset_inchar(void); void ri(void); void ris(void); void rm(const char *ps); void s8c1t(int flag); void scs(int g, int c); void sd(int pn); void sgr(const char *ps); void sl(int pn); void sm(const char *ps); void sr(int pn); void srm(int flag); void su(int pn); void tbc(int pn); void vpa(int pn); void vpr(int pn); void vt52cub1(void); void vt52cud1(void); void vt52cuf1(void); void vt52cup(int l, int c); void vt52cuu1(void); void vt52ed(void); void vt52el(void); void vt52home(void); void vt52ri(void); void zleep(int t); #endif /* ESC_H */ vttest-20140116/MANIFEST0000644000175100001440000000676012266037415013172 0ustar tomusersMANIFEST for vttest-20140116, version t20140116 -------------------------------------------------------------------------------- MANIFEST this file BUGS current bug-list CHANGES record of changes I've made to vttest COPYING copyright notice README original version of vttest posted to comp.sources.unix, volume 7 aclocal.m4 local macros for autoconf script charsets.c character-set tests color.c color tests config.guess configure utility script config.hin template for config.h config.sub configure utility script configure generated autoconf script configure.in template for configure script descrip.mms VAX MMS script for VTTEST draw.c utilities for drawing boxes and their contents draw.h interface of draw.c esc.c escape-sequence formatting & I/O esc.h interface of esc.c install-sh install script, needed for configure keyboard.c test keyboard functions main.c main-program & most tests, for VTTEST makefile.in template for makefile mouse.c mouse tests for xterm nonvt100.c non-VT100 tests patchlev.h patch-level of VTTEST printer.c test printer functions reports.c test device-reports reset.c test-functions for terminal-reset setup.c modify test-parameters sixel.c tests for soft characters (sixel) status.c status-line tests tech.set DEC technical set font definition from VT220 toolkit tek4014.c tektronix tests ttymodes.c module for changing tty modes ttymodes.h interface of ttymodes.c unix_io.c UNIX-specific I/O support utf8.c convert to/from UTF-8 vms_io.c VMS I/O routines vmsbuild.com VMS DCL script for building VTTEST vt220.c vt220 tests vt320.c vt320 tests vt420.c vt420 tests vt52.c tests for VT52 vt520.c vt520-specific tests vttest.1 manual-page for VTTEST vttest.h renamed from header.h, common definitions of VTTEST xterm.c tests for xterm and clones package/debian subdirectory package/debian/changelog build-script package/debian/compat build-script package/debian/control build-script package/debian/copyright build-script package/debian/docs build-script package/debian/postinst build-script package/debian/preinst build-script package/debian/prerm build-script package/debian/rules build-script package/debian/source subdirectory package/debian/source/format build-script package/debian subdirectory package/debian/watch build-script package subdirectory package/vttest.spec build-script vttest-20140116/keyboard.c0000644000175100001440000010150012266043263013767 0ustar tomusers/* $Id: keyboard.c,v 1.35 2014/01/16 20:53:07 tom Exp $ */ #include #include #include /* Test of: - DECLL (Load LEDs) - Keyboard return messages - SM RM (Set/Reset Mode) - Cursor Keys - Auto repeat - DECKPAM (Keypad Application Mode) - DECKPNM (Keypad Numeric Mode) The standard VT100 keyboard layout: UP DN LE RI ESC 1! 2@ 3# 4$ 5% 6^ 7& 8* 9( 0) -_ =+ `~ BS TAB* qQ wW eE rR tT yY uU iI oO pP [{ ]} DEL ** ** aA sS dD fF gG hH jJ kK lL ;: ," RETN \| ** **** zZ xX cC vV bB nN mM ,< .> /? **** LF ****************SPACE BAR**************** PF1 PF2 PF3 PF4 *7* *8* *9* *-* *4* *5* *6* *,* *1* *2* *3* ***0*** *.* ENT The standard LK401 (VT420) keyboard layout: F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 Help Do F17 F18 F19 F20 `~ 1! 2@ 3# 4$ 5% 6^ 7& 8* 9( 0) -_ =+ DEL TAB* qQ wW eE rR tT yY uU iI oO pP [{ ]} Return ** ** aA sS dD fF gG hH jJ kK lL ;: ," \| ***** <> zZ xX cC vV bB nN mM ,< .> /? ****** ***** ***** ****************SPACE BAR**************** ****** ****** Find Insert Remove PF1 PF2 PF3 PF4 Select Prev Next *7* *8* *9* *-* Up *4* *5* *6* *,* Left Down Right *1* *2* *3* ***0*** *.* ENT */ /* *INDENT-OFF* */ static struct key { char c; int row; int col; const char *symbol; } VT100_keytab [] = { { ESC, 1, 0, "ESC" }, { '1', 1, 6, "1" }, { '!', 1, 7, "!" }, { '2', 1, 11, "2" }, { '@', 1, 12, "@" }, { '3', 1, 16, "3" }, { '#', 1, 17, "#" }, { '4', 1, 21, "4" }, { '$', 1, 22, "$" }, { '5', 1, 26, "5" }, { '%', 1, 27, "%" }, { '6', 1, 31, "6" }, { '^', 1, 32, "^" }, { '7', 1, 36, "7" }, { '&', 1, 37, "&" }, { '8', 1, 41, "8" }, { '*', 1, 42, "*" }, { '9', 1, 46, "9" }, { '(', 1, 47, "(" }, { '0', 1, 51, "0" }, { ')', 1, 52, ")" }, { '-', 1, 56, "-" }, { '_', 1, 57, "_" }, { '=', 1, 61, "=" }, { '+', 1, 62, "+" }, { '`', 1, 66, "`" }, { '~', 1, 67, "~" }, { 8, 1, 70, "BS" }, { 9, 2, 0, " TAB " }, { 'q', 2, 8, "q" }, { 'Q', 2, 9, "Q" }, { 'w', 2, 13, "w" }, { 'W', 2, 14, "W" }, { 'e', 2, 18, "e" }, { 'E', 2, 19, "E" }, { 'r', 2, 23, "r" }, { 'R', 2, 24, "R" }, { 't', 2, 28, "t" }, { 'T', 2, 29, "T" }, { 'y', 2, 33, "y" }, { 'Y', 2, 34, "Y" }, { 'u', 2, 38, "u" }, { 'U', 2, 39, "U" }, { 'i', 2, 43, "i" }, { 'I', 2, 44, "I" }, { 'o', 2, 48, "o" }, { 'O', 2, 49, "O" }, { 'p', 2, 53, "p" }, { 'P', 2, 54, "P" }, { '[', 2, 58, "[" }, { '{', 2, 59, "{" }, { ']', 2, 63, "]" }, { '}', 2, 64, "}" }, { 127, 2, 71, "DEL" }, { 'a', 3, 10, "a" }, { 'A', 3, 11, "A" }, { 's', 3, 15, "s" }, { 'S', 3, 16, "S" }, { 'd', 3, 20, "d" }, { 'D', 3, 21, "D" }, { 'f', 3, 25, "f" }, { 'F', 3, 26, "F" }, { 'g', 3, 30, "g" }, { 'G', 3, 31, "G" }, { 'h', 3, 35, "h" }, { 'H', 3, 36, "H" }, { 'j', 3, 40, "j" }, { 'J', 3, 41, "J" }, { 'k', 3, 45, "k" }, { 'K', 3, 46, "K" }, { 'l', 3, 50, "l" }, { 'L', 3, 51, "L" }, { ';', 3, 55, ";" }, { ':', 3, 56, ":" }, {'\'', 3, 60, "'" }, { '"', 3, 61,"\"" }, { 13, 3, 65, "RETN"}, {'\\', 3, 71,"\\" }, { '|', 3, 72, "|" }, { 'z', 4, 12, "z" }, { 'Z', 4, 13, "Z" }, { 'x', 4, 17, "x" }, { 'X', 4, 18, "X" }, { 'c', 4, 22, "c" }, { 'C', 4, 23, "C" }, { 'v', 4, 27, "v" }, { 'V', 4, 28, "V" }, { 'b', 4, 32, "b" }, { 'B', 4, 33, "B" }, { 'n', 4, 37, "n" }, { 'N', 4, 38, "N" }, { 'm', 4, 42, "m" }, { 'M', 4, 43, "M" }, { ',', 4, 47, "," }, { '<', 4, 48, "<" }, { '.', 4, 52, "." }, { '>', 4, 53, ">" }, { '/', 4, 57, "/" }, { '?', 4, 58, "?" }, { 10, 4, 69, "LF" }, { ' ', 5, 13, " SPACE BAR "}, {'\0', 0, 0, "" } }, LK401_keytab [] = { { '`', 1, 3, "`" }, { '~', 1, 4, "~" }, { '1', 1, 7, "1" }, { '!', 1, 8, "!" }, { '2', 1, 12, "2" }, { '@', 1, 13, "@" }, { '3', 1, 17, "3" }, { '#', 1, 18, "#" }, { '4', 1, 22, "4" }, { '$', 1, 23, "$" }, { '5', 1, 27, "5" }, { '%', 1, 28, "%" }, { '6', 1, 32, "6" }, { '^', 1, 33, "^" }, { '7', 1, 37, "7" }, { '&', 1, 38, "&" }, { '8', 1, 42, "8" }, { '*', 1, 43, "*" }, { '9', 1, 47, "9" }, { '(', 1, 48, "(" }, { '0', 1, 52, "0" }, { ')', 1, 53, ")" }, { '-', 1, 57, "-" }, { '_', 1, 58, "_" }, { '=', 1, 62, "=" }, { '+', 1, 63, "+" }, { 127, 1, 67, "DEL" }, { 9, 2, 0, "TAB " }, { 'q', 2, 9, "q" }, { 'Q', 2, 10, "Q" }, { 'w', 2, 14, "w" }, { 'W', 2, 15, "W" }, { 'e', 2, 19, "e" }, { 'E', 2, 20, "E" }, { 'r', 2, 24, "r" }, { 'R', 2, 25, "R" }, { 't', 2, 29, "t" }, { 'T', 2, 30, "T" }, { 'y', 2, 34, "y" }, { 'Y', 2, 35, "Y" }, { 'u', 2, 39, "u" }, { 'U', 2, 40, "U" }, { 'i', 2, 44, "i" }, { 'I', 2, 45, "I" }, { 'o', 2, 49, "o" }, { 'O', 2, 50, "O" }, { 'p', 2, 54, "p" }, { 'P', 2, 55, "P" }, { '[', 2, 59, "[" }, { '{', 2, 60, "{" }, { ']', 2, 64, "]" }, { '}', 2, 65, "}" }, { 13, 2, 69, "Return" }, { 'a', 3, 11, "a" }, { 'A', 3, 12, "A" }, { 's', 3, 16, "s" }, { 'S', 3, 17, "S" }, { 'd', 3, 21, "d" }, { 'D', 3, 22, "D" }, { 'f', 3, 26, "f" }, { 'F', 3, 27, "F" }, { 'g', 3, 31, "g" }, { 'G', 3, 32, "G" }, { 'h', 3, 36, "h" }, { 'H', 3, 37, "H" }, { 'j', 3, 41, "j" }, { 'J', 3, 42, "J" }, { 'k', 3, 46, "k" }, { 'K', 3, 47, "K" }, { 'l', 3, 51, "l" }, { 'L', 3, 52, "L" }, { ';', 3, 56, ";" }, { ':', 3, 57, ":" }, {'\'', 3, 61, "'" }, { '"', 3, 62,"\"" }, {'\\', 3, 66,"\\" }, { '|', 3, 67, "|" }, { '<', 4, 9, "<" }, { '>', 4, 10, ">" }, { 'z', 4, 13, "z" }, { 'Z', 4, 14, "Z" }, { 'x', 4, 18, "x" }, { 'X', 4, 19, "X" }, { 'c', 4, 23, "c" }, { 'C', 4, 24, "C" }, { 'v', 4, 28, "v" }, { 'V', 4, 29, "V" }, { 'b', 4, 33, "b" }, { 'B', 4, 34, "B" }, { 'n', 4, 38, "n" }, { 'N', 4, 39, "N" }, { 'm', 4, 43, "m" }, { 'M', 4, 44, "M" }, { ',', 4, 48, "," }, { '<', 4, 49, "<" }, { '.', 4, 53, "." }, { '>', 4, 54, ">" }, { '/', 4, 58, "/" }, { '?', 4, 59, "?" }, { ' ', 5, 14, " SPACE BAR "}, {'\0', 0, 0, "" } }, *keytab; /* *INDENT-ON* */ typedef struct { unsigned char prefix; const char *msg; } CTLKEY; /* *INDENT-OFF* */ static struct curkey { CTLKEY curkeymsg[3]; int curkeyrow; int curkeycol; const char *curkeysymbol; const char *curkeyname; } VT100_curkeytab [] = { /* A Reset, A Set, VT52 */ {{{CSI,"A"}, {SS3,"A"}, {ESC,"A"}}, 0, 56, "UP", "Up arrow" }, {{{CSI,"B"}, {SS3,"B"}, {ESC,"B"}}, 0, 61, "DN", "Down arrow" }, {{{CSI,"D"}, {SS3,"D"}, {ESC,"D"}}, 0, 66, "LT", "Left arrow" }, {{{CSI,"C"}, {SS3,"C"}, {ESC,"C"}}, 0, 71, "RT", "Right arrow"}, {{{0, ""}, {0, ""}, {0, "" }}, 0, 0, "", "" } }, LK401_curkeytab [] = { /* A Reset, A Set, VT52 */ {{{CSI,"A"}, {SS3,"A"}, {ESC,"A"}}, 8, 32, "Up", "Up arrow" }, {{{CSI,"B"}, {SS3,"B"}, {ESC,"B"}}, 9, 31, "Down", "Down arrow" }, {{{CSI,"D"}, {SS3,"D"}, {ESC,"D"}}, 9, 24, "Left", "Left arrow" }, {{{CSI,"C"}, {SS3,"C"}, {ESC,"C"}}, 9, 38, "Right", "Right arrow"}, {{{0, ""}, {0, ""}, {0, "" }}, 0, 0, "", "" } }, *curkeytab; static struct fnckey { CTLKEY fnkeymsg[2]; int fnkeyrow; int fnkeycol; const char *fnkeysymbol; const char *fnkeyname; } fnkeytab [] = { /* Normal, VT100/VT52 */ {{{CSI,"11~"}, {0,""}}, 0, 1, "F1", "F1 (xterm)" }, {{{CSI,"12~"}, {0,""}}, 0, 4, "F2", "F2 (xterm)" }, {{{CSI,"13~"}, {0,""}}, 0, 7, "F3", "F3 (xterm)" }, {{{CSI,"14~"}, {0,""}}, 0, 10, "F4", "F4 (xterm)" }, {{{CSI,"15~"}, {0,""}}, 0, 13, "F5", "F5 (xterm)" }, {{{CSI,"17~"}, {0,""}}, 0, 18, "F6", "F6" }, {{{CSI,"18~"}, {0,""}}, 0, 21, "F7", "F7" }, {{{CSI,"19~"}, {0,""}}, 0, 24, "F8", "F8" }, {{{CSI,"20~"}, {0,""}}, 0, 27, "F9", "F9" }, {{{CSI,"21~"}, {0,""}}, 0, 30, "F10", "F10" }, {{{CSI,"23~"}, {0,""}}, 0, 36, "F11", "F11" }, {{{CSI,"24~"}, {0,""}}, 0, 40, "F12", "F12" }, {{{CSI,"25~"}, {0,""}}, 0, 44, "F13", "F13" }, {{{CSI,"26~"}, {0,""}}, 0, 48, "F14", "F14" }, {{{CSI,"28~"}, {0,""}}, 0, 54, "Help", "Help (F15)" }, {{{CSI,"29~"}, {0,""}}, 0, 59, "Do", "Do (F16)" }, {{{CSI,"31~"}, {0,""}}, 0, 64, "F17", "F17" }, {{{CSI,"32~"}, {0,""}}, 0, 68, "F18", "F18" }, {{{CSI,"33~"}, {0,""}}, 0, 72, "F19", "F19" }, {{{CSI,"34~"}, {0,""}}, 0, 76, "F20", "F20" }, {{{0, ""}, {0,"" }}, 0, 0, "", "" } }, edt_keypadtab[] = { {{{CSI,"1~"}, {0,""}}, 6, 24, "Find" , "Find" }, {{{CSI,"2~"}, {0,""}}, 6, 30, "Insert", "Insert Here" }, {{{CSI,"3~"}, {0,""}}, 6, 37, "Remove", "Remove" }, {{{CSI,"4~"}, {0,""}}, 7, 23, "Select", "Select" }, {{{CSI,"5~"}, {0,""}}, 7, 31, "Prev", "Prev" }, {{{CSI,"6~"}, {0,""}}, 7, 38, "Next", "Next" }, {{{0, ""}, {0,""}}, 0, 0, "", "" } }; static struct fnkey { CTLKEY fnkeymsg[4]; int fnkeyrow; int fnkeycol; const char *fnkeysymbol; const char *fnkeyname; } num_keypadtab [] = { /* ANSI-num, ANSI-app, VT52-nu, VT52-ap, r, c, symb name */ {{{SS3,"P"}, {SS3,"P"}, {ESC,"P"}, {ESC,"P" }}, 6, 59, "PF1", "PF1" }, {{{SS3,"Q"}, {SS3,"Q"}, {ESC,"Q"}, {ESC,"Q" }}, 6, 63, "PF2", "PF2" }, {{{SS3,"R"}, {SS3,"R"}, {ESC,"R"}, {ESC,"R" }}, 6, 67, "PF3", "PF3" }, {{{SS3,"S"}, {SS3,"S"}, {ESC,"S"}, {ESC,"S" }}, 6, 71, "PF4", "PF4" }, {{{0, "7"}, {SS3,"w"}, {0, "7"}, {ESC,"?w"}}, 7, 59, " 7 ", "Numeric 7" }, {{{0, "8"}, {SS3,"x"}, {0, "8"}, {ESC,"?x"}}, 7, 63, " 8 ", "Numeric 8" }, {{{0, "9"}, {SS3,"y"}, {0, "9"}, {ESC,"?y"}}, 7, 67, " 9 ", "Numeric 9" }, {{{0, "-"}, {SS3,"m"}, {0, "-"}, {ESC,"?m"}}, 7, 71, " - ", "Minus" }, {{{0, "4"}, {SS3,"t"}, {0, "4"}, {ESC,"?t"}}, 8, 59, " 4 ", "Numeric 4" }, {{{0, "5"}, {SS3,"u"}, {0, "5"}, {ESC,"?u"}}, 8, 63, " 5 ", "Numeric 5" }, {{{0, "6"}, {SS3,"v"}, {0, "6"}, {ESC,"?v"}}, 8, 67, " 6 ", "Numeric 6" }, {{{0, ","}, {SS3,"l"}, {0, ","}, {ESC,"?l"}}, 8, 71, " , ", "Comma" }, {{{0, "1"}, {SS3,"q"}, {0, "1"}, {ESC,"?q"}}, 9, 59, " 1 ", "Numeric 1" }, {{{0, "2"}, {SS3,"r"}, {0, "2"}, {ESC,"?r"}}, 9, 63, " 2 ", "Numeric 2" }, {{{0, "3"}, {SS3,"s"}, {0, "3"}, {ESC,"?s"}}, 9, 67, " 3 ", "Numeric 3" }, {{{0, "0"}, {SS3,"p"}, {0, "0"}, {ESC,"?p"}},10, 59, " 0 ","Numeric 0"}, {{{0, "."}, {SS3,"n"}, {0, "."}, {ESC,"?n"}},10, 67, " . ", "Point" }, {{{0,"\015"},{SS3,"M"}, {0,"\015"},{ESC,"?M"}},10, 71, "ENT", "ENTER" }, {{{0, ""}, {0, ""}, {0, ""}, {0, ""}}, 0, 0, "", "" } }; /* *INDENT-ON* */ struct natkey { char natc; int natrow; int natcol; const char *natsymbol; }; static int same_CTLKEY(const char *response, CTLKEY *code); static int find_cursor_key(char *curkeystr, int ckeymode) { int i; for (i = 0; curkeytab[i].curkeysymbol[0] != '\0'; i++) { if (same_CTLKEY(curkeystr, &curkeytab[i].curkeymsg[ckeymode])) { return i; } } return -1; } static int find_editing_key(char *keypadstr, int fkeymode) { int i; for (i = 0; edt_keypadtab[i].fnkeysymbol[0] != '\0'; i++) { if (same_CTLKEY(keypadstr, &edt_keypadtab[i].fnkeymsg[fkeymode])) { return i; } } return -1; } static int find_function_key(char *keypadstr, int fkeymode) { int i; for (i = 0; fnkeytab[i].fnkeysymbol[0] != '\0'; i++) { if (same_CTLKEY(keypadstr, &fnkeytab[i].fnkeymsg[fkeymode])) { return i; } } return -1; } static int find_num_keypad_key(char *keypadstr, int fkeymode) { int i; for (i = 0; num_keypadtab[i].fnkeysymbol[0] != '\0'; i++) { if (same_CTLKEY(keypadstr, &num_keypadtab[i].fnkeymsg[fkeymode])) { return i; } } return -1; } static void set_keyboard_layout(struct natkey *table) { int i, j; for (j = 0; table[j].natc != '\0'; j++) { for (i = 0; keytab[i].c != '\0'; i++) { if (keytab[i].row == table[j].natrow && keytab[i].col == table[j].natcol) { keytab[i].c = table[j].natc; keytab[i].symbol = table[j].natsymbol; break; } } } } static int default_layout(MENU_ARGS) { /* FIXME: nothing resets the default keytab to original state */ return MENU_NOHOLD; } static int same_CTLKEY(const char *response, CTLKEY *code) { switch (code->prefix) { case CSI: if ((response = skip_csi_2(response)) == 0) return FALSE; break; case SS3: if ((response = skip_ss3_2(response)) == 0) return FALSE; break; case ESC: if (*response++ != ESC) return FALSE; /* FALLTHRU */ default: break; } return !strcmp(response, code->msg); } static int set_D47_layout(MENU_ARGS) { /* *INDENT-OFF* */ static struct natkey table[] = { { '"', 1, 12, "\""}, { '&', 1, 32, "&" }, { '/', 1, 37, "/" }, { '(', 1, 42, "(" }, { ')', 1, 47, ")" }, { '=', 1, 52, "=" }, { '+', 1, 56, "+" }, { '?', 1, 57, "?" }, { '`', 1, 61, "`" }, { '@', 1, 62, "@" }, { '<', 1, 66, "<" }, { '>', 1, 67, ">" }, { '}', 2, 58, "}" }, { ']', 2, 59, "]" }, { '^', 2, 63, "^" }, { '~', 2, 64, "~" }, { '|', 3, 55, "|" }, {'\\', 3, 56,"\\" }, { '{', 3, 60, "{" }, { '[', 3, 61, "[" }, {'\'', 3, 71, "'" }, { '*', 3, 72, "*" }, { ',', 4, 47, "," }, { ';', 4, 48, ";" }, { '.', 4, 52, "." }, { ':', 4, 53, ":" }, { '-', 4, 57, "-" }, { '_', 4, 58, "_" }, {'\0', 0, 0, "" } }; /* *INDENT-ON* */ set_keyboard_layout(table); return MENU_NOHOLD; } static int set_E47_layout(MENU_ARGS) { /* *INDENT-OFF* */ static struct natkey table[] = { { '"', 1, 12, "\""}, { '&', 1, 32, "&" }, { '/', 1, 37, "/" }, { '(', 1, 42, "(" }, { ')', 1, 47, ")" }, { '=', 1, 52, "=" }, { '+', 1, 56, "+" }, { '?', 1, 57, "?" }, { '`', 1, 61, "`" }, { '@', 1, 62, "@" }, { '<', 1, 66, "<" }, { '>', 1, 67, ">" }, { '}', 2, 58, "}" }, { ']', 2, 59, "]" }, { '~', 2, 63, "~" }, { '^', 2, 64, "^" }, { '|', 3, 55, "|" }, {'\\', 3, 56,"\\" }, { '{', 3, 60, "{" }, { '[', 3, 61, "[" }, {'\'', 3, 71, "'" }, { '*', 3, 72, "*" }, { ',', 4, 47, "," }, { ';', 4, 48, ";" }, { '.', 4, 52, "." }, { ':', 4, 53, ":" }, { '-', 4, 57, "-" }, { '_', 4, 58, "_" }, {'\0', 0, 0, "" } }; /* *INDENT-ON* */ set_keyboard_layout(table); return MENU_NOHOLD; } static void show_character(int i, char *scs_params, int hilite) { int special = ((scs_params != 0) && (strlen(keytab[i].symbol) == 1)); vt_move(1 + 2 * keytab[i].row, 1 + keytab[i].col); if (hilite) vt_hilite(TRUE); if (special) esc(scs_params); printf("%s", keytab[i].symbol); if (special) scs(0, 'B'); if (hilite) vt_hilite(FALSE); } static void show_cursor_keys(int flag) { int i; curkeytab = (terminal_id() < 200) ? VT100_curkeytab : LK401_curkeytab; for (i = 0; curkeytab[i].curkeysymbol[0] != '\0'; i++) { vt_move(1 + 2 * curkeytab[i].curkeyrow, 1 + curkeytab[i].curkeycol); if (flag) vt_hilite(TRUE); printf("%s", curkeytab[i].curkeysymbol); if (flag) vt_hilite(FALSE); } } static void show_editing_keypad(int flag) { if (terminal_id() >= 200) { int i; for (i = 0; edt_keypadtab[i].fnkeysymbol[0] != '\0'; i++) { vt_move(1 + 2 * edt_keypadtab[i].fnkeyrow, 1 + edt_keypadtab[i].fnkeycol); if (flag) vt_hilite(TRUE); printf("%s", edt_keypadtab[i].fnkeysymbol); if (flag) vt_hilite(FALSE); } } } static void show_function_keys(int flag) { if (terminal_id() >= 200) { int i; for (i = 0; fnkeytab[i].fnkeysymbol[0] != '\0'; i++) { vt_move(1 + 2 * fnkeytab[i].fnkeyrow, 1 + fnkeytab[i].fnkeycol); if (flag) vt_hilite(TRUE); printf("%s", fnkeytab[i].fnkeysymbol); if (flag) vt_hilite(FALSE); } } } static void show_keyboard(int flag GCC_UNUSED, char *scs_params) { int i; if (terminal_id() >= 200) /* LK201 _looks_ the same as LK401 (to me) */ keytab = LK401_keytab; else keytab = VT100_keytab; for (i = 0; keytab[i].c != '\0'; i++) { show_character(i, scs_params, TRUE); } } static void show_numeric_keypad(int flag) { int i; for (i = 0; num_keypadtab[i].fnkeysymbol[0] != '\0'; i++) { vt_move(1 + 2 * num_keypadtab[i].fnkeyrow, 1 + num_keypadtab[i].fnkeycol); if (flag) vt_hilite(TRUE); printf("%s", num_keypadtab[i].fnkeysymbol); if (flag) vt_hilite(FALSE); } } /******************************************************************************/ static int tst_AnswerBack(MENU_ARGS) { char *abmstr; set_tty_crmod(TRUE); vt_clear(2); vt_move(5, 1); println("Finally, a check of the ANSWERBACK MESSAGE, which can be sent"); println("by pressing CTRL-BREAK. The answerback message can be loaded"); println("in SET-UP B by pressing SHIFT-A and typing e.g."); println(""); println(" \" H e l l o , w o r l d Return \""); println(""); println("(the double-quote characters included). Do that, and then try"); println("to send an answerback message with CTRL-BREAK. If it works,"); println("the answerback message should be displayed in reverse mode."); println("Finish with a single RETURN."); set_tty_crmod(FALSE); do { vt_move(17, 1); inflush(); abmstr = get_reply(); vt_move(17, 1); vt_el(0); chrprint(abmstr); } while (strcmp(abmstr, "\r")); restore_ttymodes(); return MENU_NOHOLD; } static int tst_AutoRepeat(MENU_ARGS) { char arptstring[BUFSIZ]; vt_clear(2); vt_move(10, 1); println("Test of the AUTO REPEAT feature"); println(""); println("Hold down an alphanumeric key for a while, then push RETURN."); printf("%s", "Auto Repeat OFF: "); decarm(FALSE); /* DECARM */ inputline(arptstring); if (LOG_ENABLED) fprintf(log_fp, "Input: %s\n", arptstring); if (strlen(arptstring) == 0) println("No characters read!??"); else if (strlen(arptstring) == 1) println("OK."); else println("Too many characters read."); println(""); println("Hold down an alphanumeric key for a while, then push RETURN."); printf("%s", "Auto Repeat ON: "); decarm(TRUE); inputline(arptstring); if (LOG_ENABLED) fprintf(log_fp, "Input: %s\n", arptstring); if (strlen(arptstring) == 0) println("No characters read!??"); else if (strlen(arptstring) == 1) println("Not enough characters read."); else println("OK."); println(""); return MENU_HOLD; } static int tst_ControlKeys(MENU_ARGS) { int i, okflag; int kbdc; char temp[80]; char *kbds = strcpy(temp, " "); /* *INDENT-OFF* */ static struct { int ccount; const char *csymbol; } ckeytab [] = { { 0, "NUL (CTRL-@ or CTRL-Space)" }, { 0, "SOH (CTRL-A)" }, { 0, "STX (CTRL-B)" }, { 0, "ETX (CTRL-C)" }, { 0, "EOT (CTRL-D)" }, { 0, "ENQ (CTRL-E)" }, { 0, "ACK (CTRL-F)" }, { 0, "BEL (CTRL-G)" }, { 0, "BS (CTRL-H) (BACK SPACE)" }, { 0, "HT (CTRL-I) (TAB)" }, { 0, "LF (CTRL-J) (LINE FEED)" }, { 0, "VT (CTRL-K)" }, { 0, "FF (CTRL-L)" }, { 0, "CR (CTRL-M) (RETURN)" }, { 0, "SO (CTRL-N)" }, { 0, "SI (CTRL-O)" }, { 0, "DLE (CTRL-P)" }, { 0, "DC1 (CTRL-Q) (X-On)" }, { 0, "DC2 (CTRL-R)" }, { 0, "DC3 (CTRL-S) (X-Off)" }, { 0, "DC4 (CTRL-T)" }, { 0, "NAK (CTRL-U)" }, { 0, "SYN (CTRL-V)" }, { 0, "ETB (CTRL-W)" }, { 0, "CAN (CTRL-X)" }, { 0, "EM (CTRL-Y)" }, { 0, "SUB (CTRL-Z)" }, { 0, "ESC (CTRL-[) (ESCAPE)" }, { 0, "FS (CTRL-\\ or CTRL-? or CTRL-_)" }, { 0, "GS (CTRL-])" }, { 0, "RS (CTRL-^ or CTRL-~ or CTRL-`)" }, { 0, "US (CTRL-_ or CTRL-?)" } }; /* *INDENT-ON* */ vt_clear(2); for (i = 0; i < 32; i++) { vt_move(1 + (i % 16), 1 + 40 * (i / 16)); vt_hilite(TRUE); printf("%s", ckeytab[i].csymbol); vt_hilite(FALSE); } vt_move(19, 1); set_tty_crmod(TRUE); println( "Push each CTRL-key TWICE. Note that you should be able to send *all*"); println( "CTRL-codes twice, including CTRL-S (X-Off) and CTRL-Q (X-Off)!"); println( "Finish with DEL (also called DELETE or RUB OUT), or wait 1 minute."); set_tty_raw(TRUE); do { vt_move(max_lines - 1, 1); kbdc = inchar(); vt_move(max_lines - 1, 1); vt_el(0); if (kbdc < 32) { printf(" %s", ckeytab[kbdc].csymbol); if (LOG_ENABLED) fprintf(log_fp, "Key: %s\n", ckeytab[kbdc].csymbol); } else { sprintf(kbds, "%c", kbdc); chrprint(kbds); printf("%s", " -- not a CTRL key"); } if (kbdc < 32) ckeytab[kbdc].ccount++; if (ckeytab[kbdc].ccount == 2) { vt_move(1 + (kbdc % 16), 1 + 40 * (kbdc / 16)); printf("%s", ckeytab[kbdc].csymbol); } } while (kbdc != '\177'); restore_ttymodes(); vt_move(max_lines, 1); okflag = 1; for (i = 0; i < 32; i++) if (ckeytab[i].ccount < 2) okflag = 0; if (okflag) printf("%s", "OK. "); else printf("%s", "You have not been able to send all CTRL keys! "); return MENU_HOLD; } static int tst_CursorKeys(MENU_ARGS) { int i; int ckeymode; char *curkeystr; VTLEVEL save; static const char *curkeymodes[3] = { "ANSI / Cursor key mode RESET", "ANSI / Cursor key mode SET", "VT52 Mode" }; vt_clear(2); save_level(&save); show_keyboard(0, (char *) 0); show_function_keys(0); show_editing_keypad(0); show_numeric_keypad(0); vt_move(max_lines - 2, 1); set_tty_crmod(FALSE); set_tty_echo(FALSE); for (ckeymode = 0; ckeymode <= 2; ckeymode++) { decckm(ckeymode); /* DECCKM */ show_cursor_keys(1); vt_move(21, 1); printf("<%s>%20s", curkeymodes[ckeymode], ""); vt_move(max_lines - 2, 1); vt_el(0); vt_move(max_lines - 2, 1); printf("%s", "Press each cursor key. Finish with TAB."); for (;;) { vt_move(max_lines - 1, 1); if (ckeymode == 2) set_level(0); /* VT52 mode */ curkeystr = instr(); set_level(1); /* ANSI mode */ vt_move(max_lines - 1, 1); vt_el(0); vt_move(max_lines - 1, 1); chrprint(curkeystr); if (!strcmp(curkeystr, "\t")) break; if ((i = find_cursor_key(curkeystr, ckeymode)) >= 0) { vt_hilite(TRUE); show_result(" (%s key) ", curkeytab[i].curkeyname); vt_hilite(FALSE); vt_move(1 + 2 * curkeytab[i].curkeyrow, 1 + curkeytab[i].curkeycol); printf("%s", curkeytab[i].curkeysymbol); } else { vt_hilite(TRUE); show_result("%s", " (Unknown cursor key) "); vt_hilite(FALSE); } } } decckm(FALSE); restore_level(&save); vt_move(max_lines - 1, 1); vt_el(0); restore_ttymodes(); return MENU_MERGE; } static int tst_EditingKeypad(MENU_ARGS) { int i; int fkeymode; char *fnkeystr; VTLEVEL save; static const char *fnkeymodes[] = { "Normal mode", "VT100/VT52 mode (none should be recognized)" }; save_level(&save); show_keyboard(0, (char *) 0); show_cursor_keys(0); show_function_keys(0); show_numeric_keypad(0); vt_move(max_lines - 2, 1); if (terminal_id() < 200) { printf("Sorry, a real VT%d terminal doesn't have an editing keypad\n", terminal_id()); return MENU_HOLD; } set_tty_crmod(FALSE); set_tty_echo(FALSE); for (fkeymode = 0; fkeymode <= 1; fkeymode++) { show_editing_keypad(1); vt_move(21, 1); printf("<%s>%20s", fnkeymodes[fkeymode], ""); vt_move(max_lines - 2, 1); vt_el(0); vt_move(max_lines - 2, 1); printf("%s", "Press each function key. Finish with TAB."); for (;;) { vt_move(max_lines - 1, 1); if (fkeymode == 0) default_level(); if (fkeymode != 0) set_level(1); /* VT100 mode */ fnkeystr = instr(); vt_move(max_lines - 1, 1); vt_el(0); vt_move(max_lines - 1, 1); chrprint(fnkeystr); if (!strcmp(fnkeystr, "\t")) break; if ((i = find_editing_key(fnkeystr, fkeymode)) >= 0) { vt_hilite(TRUE); show_result(" (%s key) ", edt_keypadtab[i].fnkeyname); vt_hilite(FALSE); vt_move(1 + 2 * edt_keypadtab[i].fnkeyrow, 1 + edt_keypadtab[i].fnkeycol); printf("%s", edt_keypadtab[i].fnkeysymbol); } else { vt_hilite(TRUE); show_result("%s", " (Unknown function key) "); vt_hilite(FALSE); } } } vt_move(max_lines - 1, 1); vt_el(0); restore_level(&save); restore_ttymodes(); return MENU_MERGE; } static int tst_FunctionKeys(MENU_ARGS) { int i; int fkeymode; char *fnkeystr; VTLEVEL save; static const char *fnkeymodes[] = { "Normal mode (F6-F20, except xterm also F1-F5)", "VT100/VT52 mode (F11-F13 only)" }; save_level(&save); show_keyboard(0, (char *) 0); show_cursor_keys(0); show_editing_keypad(0); show_numeric_keypad(0); vt_move(max_lines - 2, 1); if (terminal_id() < 200) { printf("Sorry, a real VT%d terminal doesn't have function keys\n", terminal_id()); return MENU_HOLD; } set_tty_crmod(FALSE); set_tty_echo(FALSE); for (fkeymode = 0; fkeymode <= 1; fkeymode++) { show_function_keys(1); vt_move(21, 1); printf("<%s>%20s", fnkeymodes[fkeymode], ""); vt_move(max_lines - 2, 1); vt_el(0); vt_move(max_lines - 2, 1); printf("%s", "Press each function key. Finish with TAB."); for (;;) { vt_move(max_lines - 1, 1); if (fkeymode == 0) default_level(); if (fkeymode != 0) set_level(1); /* VT100 mode */ fnkeystr = instr(); vt_move(max_lines - 1, 1); vt_el(0); vt_move(max_lines - 1, 1); chrprint(fnkeystr); if (!strcmp(fnkeystr, "\t")) break; if ((i = find_function_key(fnkeystr, fkeymode)) >= 0) { vt_hilite(TRUE); show_result(" (%s key) ", fnkeytab[i].fnkeyname); vt_hilite(FALSE); vt_move(1 + 2 * fnkeytab[i].fnkeyrow, 1 + fnkeytab[i].fnkeycol); printf("%s", fnkeytab[i].fnkeysymbol); } else { vt_hilite(TRUE); show_result("%s", " (Unknown function key) "); vt_hilite(FALSE); } } } vt_move(max_lines - 1, 1); vt_el(0); restore_level(&save); restore_ttymodes(); return MENU_MERGE; } static int tst_NumericKeypad(MENU_ARGS) { int i; int fkeymode; char *fnkeystr; VTLEVEL save; static const char *fnkeymodes[4] = { "ANSI Numeric mode", "ANSI Application mode", "VT52 Numeric mode", "VT52 Application mode" }; vt_clear(2); save_level(&save); show_keyboard(0, (char *) 0); show_cursor_keys(0); show_function_keys(0); show_editing_keypad(0); vt_move(max_lines - 2, 1); set_tty_crmod(FALSE); set_tty_echo(FALSE); for (fkeymode = 0; fkeymode <= 3; fkeymode++) { show_numeric_keypad(1); vt_move(21, 1); printf("<%s>%20s", fnkeymodes[fkeymode], ""); vt_move(max_lines - 2, 1); vt_el(0); vt_move(max_lines - 2, 1); printf("%s", "Press each function key. Finish with TAB."); for (;;) { vt_move(max_lines - 1, 1); if (fkeymode >= 2) set_level(0); /* VT52 mode */ if (fkeymode % 2) deckpam(); /* Application mode */ else deckpnm(); /* Numeric mode */ fnkeystr = instr(); set_level(1); /* ANSI mode */ vt_move(max_lines - 1, 1); vt_el(0); vt_move(max_lines - 1, 1); chrprint(fnkeystr); if (!strcmp(fnkeystr, "\t")) break; if ((i = find_num_keypad_key(fnkeystr, fkeymode)) >= 0) { vt_hilite(TRUE); show_result(" (%s key) ", num_keypadtab[i].fnkeyname); vt_hilite(FALSE); vt_move(1 + 2 * num_keypadtab[i].fnkeyrow, 1 + num_keypadtab[i].fnkeycol); printf("%s", num_keypadtab[i].fnkeysymbol); } else { vt_hilite(TRUE); show_result("%s", " (Unknown function key) "); vt_hilite(FALSE); } } } deckpnm(); vt_move(max_lines - 1, 1); vt_el(0); restore_level(&save); restore_ttymodes(); return MENU_MERGE; } static int tst_KeyboardLayout(MENU_ARGS) { /* *INDENT-OFF* */ static MENU keyboardmenu[] = { { "Standard American ASCII layout", default_layout }, { "Swedish national layout D47", set_D47_layout }, { "Swedish national layout E47", set_E47_layout }, /* add new keyboard layouts here */ { "", 0 } }; /* *INDENT-ON* */ if (terminal_id() < 200) { vt_clear(2); keytab = VT100_keytab; title(0); println("Choose keyboard layout:"); (void) menu(keyboardmenu); } tst_keyboard_layout((char *) 0); return MENU_MERGE; } static int tst_LED_Lights(MENU_ARGS) { int i; const char *ledmsg[6], *ledseq[6]; /* *INDENT-OFF* */ ledmsg[0] = "L1 L2 L3 L4"; ledseq[0] = "1;2;3;4"; ledmsg[1] = " L2 L3 L4"; ledseq[1] = "1;0;4;3;2"; ledmsg[2] = " L2 L3"; ledseq[2] = "1;4;;2;3"; ledmsg[3] = "L1 L2"; ledseq[3] = ";;2;1"; ledmsg[4] = "L1"; ledseq[4] = "1"; ledmsg[5] = ""; ledseq[5] = ""; /* *INDENT-ON* */ #ifdef UNIX fflush(stdout); #endif vt_clear(2); vt_move(10, 1); println("These LEDs (\"lamps\") on the keyboard should be on:"); for (i = 0; i <= 5; i++) { vt_move(10, 52); vt_el(0); printf("%s", ledmsg[i]); decll("0"); decll(ledseq[i]); vt_move(12, 1); holdit(); } decll("0"); return MENU_NOHOLD; } /******************************************************************************/ int tst_keyboard_layout(char *scs_params) { int i; int kbdc; char temp[80]; char *kbds = strcpy(temp, " "); vt_clear(2); show_keyboard(1, scs_params); show_cursor_keys(0); show_function_keys(0); show_editing_keypad(0); show_numeric_keypad(0); vt_move(max_lines - 2, 1); set_tty_crmod(FALSE); set_tty_echo(FALSE); inflush(); printf("Press each key, both shifted and unshifted. Finish with RETURN:"); do { /* while (kbdc != 13) */ vt_move(max_lines - 1, 1); kbdc = inchar(); vt_move(max_lines - 1, 1); vt_el(0); if (scs_params != 0 && kbdc > ' ' && kbdc < '\177') { vt_hilite(TRUE); esc(scs_params); printf(" %c ", kbdc); scs(0, 'B'); printf("= %d ", kbdc); scs(0, 'B'); vt_hilite(FALSE); } else { sprintf(kbds, "%c", kbdc); chrprint(kbds); } for (i = 0; keytab[i].c != '\0'; i++) { if (keytab[i].c == kbdc) { show_character(i, scs_params, FALSE); /* LK401 keyboard will have more than one hit for '<' and '>' */ } } } while (kbdc != 13); vt_move(max_lines - 1, 1); vt_el(0); restore_ttymodes(); return MENU_MERGE; } /******************************************************************************/ int tst_keyboard(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "LED Lights", tst_LED_Lights }, { "Auto Repeat", tst_AutoRepeat }, { "KeyBoard Layout", tst_KeyboardLayout }, { "Cursor Keys", tst_CursorKeys }, { "Numeric Keypad", tst_NumericKeypad }, { "Editing Keypad", tst_EditingKeypad }, { "Function Keys", tst_FunctionKeys }, { "AnswerBack", tst_AnswerBack }, { "Control Keys", tst_ControlKeys }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printf("Keyboard Tests")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } vttest-20140116/draw.h0000644000175100001440000000062011745741024013133 0ustar tomusers/* $Id: draw.h,v 1.4 2012/04/25 09:21:24 tom Exp $ */ typedef struct { int top; int left; int bottom; int right; } BOX; extern int make_box_params(BOX *box, int vmargin, int hmargin); extern void draw_box_outline(BOX *box, int mark); extern void draw_box_filled(BOX *box, int mark); extern void draw_box_caption(BOX *box, int margin, const char **c); extern void ruler(int row, int width); vttest-20140116/CHANGES0000644000175100001440000004647712266047650013047 0ustar tomusers-- $Id: CHANGES,v 1.177 2014/01/16 21:31:20 tom Exp $ ------------------------------------------------------------------------------- 20140116 + cosmetic changes (suggested by Itay Chamiel): + clear screen just before resetting SCS in menu #3 character sets, in case a VT100 emulator does not simply ignore VT220 G2/G3 selections when it does not implement them. + add check for maximum operating level before deciding whether to send a DECSCL to set it to VT100-level. + adjust starting point of items for menu #9 "Test of known bugs" to avoid overwriting part of the description of the test. + add configure check for -Wlogical-op to gcc-warnings + update config.guess, config.sub 20130915 + when NRCS is active, suppress ISO Latin-1 from menu to avoid confusion with British NRCS. + do not highlight ISO Latin-1 for NRCS, since it is a 96-character set, not applicable to NRCS. + correct position of ruler for SD and REP screens, which obscured the result. + expand menu 11.6.6 to demonstrate bce with top-level menus 1 and 2 in addition to the existing menu 8. + correct description for DA response 24; it denotes VT320. + correct highlighting for French NRC mapping; "`" is not mapped. + add port-files from FreeBSD for test-builds. + add highlighting information for VT320 Portuguese NRC mapping. + add highlighting information for VT220 DEC Supplemental NRC mapping. + updated configure-macros to add msys changes from ncurses 20130907. + update config.guess, config.sub 20130818 + modify character-sets screens to optionally highlight the characters which do not correspond to ISO-8859-1. This makes the National Replacement Characters easier to see. + modify DSR cursor-position report to check if the terminal accounts for origin-mode. + support --datarootdir option in makefile.in, to match configure script updates. + updated configure macros: + change from byacc for autoheader + improved checks for gcc attributes + improved checks for gcc version + miscellaneous fixes in CF_XOPEN_SOURCE + update config.guess, config.sub 20120603 + change cursor-position before IL/DL in "Test of VT102-style features with BCE (Insert/Delete Char/Line)" to demonstrate whether the terminal sets the cursor to the first column as a side-effect, as noted in VT220 reference manual. 20120506 + build-fix in case compiler does not recognize gcc's __attribute__. + modify vt420 rectangle menu to allow testing with applications which misreport their operating level, e.g., Reflection which states that it is a vt340. The menu title shows "should not work" if the terminal says its operating level is below VT4xx. + add menu-entries for DECOM/DECLRMM to vt420 rectangle menu. + add menu-entries for DECOM/DECLRMM to vt420 cursor-movement menu. + add menu-entries for DECOM/DECLRMM to vt420 editing-controls menu. + add HPR and VPR test-screens. + add vt520 cursor-movement menu; most of the vt520's new features were based on ISO-6429 but allow for DECOM and DECLRMM interactions. + implement DECSCPP and DECSLPP test-screens. + add test-screen for DECNCSM. + add "-s" command-line option to initialize the time-delay feature. + add setup-menu feature to control whether a time delay is added in selected repeated cursor-movement and scrolling operations to make their behavior easier to see. + correct scanning of DECCKSR response; result is hexadecimal not decimal. + modify menu functions to provide for multipage menus, e.g., in the character set choices for vt420 and vt520 on a 24-line screen. + modify tests related to left/right margins to allow color to be set, as xterm-feature. + add test-screen for index/reverse index with left/right margins. + ensure that status-line is turned off when exiting status-line test. + add test-screen for VT420 & up for ASCII formatting controls with margins. + modify DECFI/DECBI tests to work with margins. + add menu entries for setting/showing the top/bottom and left/right margins, to modify the behavior of the DECIC/DECDC tests. + add menu entries for setting/showing DECLRMM state, needed for DECIC/DECDC tests. + change mnemomic DECVSSM to DECLRMM to reflect the latter's usage in vt420 and vt510 manuals. + modify DECRQSS test for DECSCUSR to show if the response is as expected. 20111210 + modify mouse menu's selection of coordinate mode to include xterm's 1006 and urxvt's 1015 controls. + add menu entry to allow miscellaneous ECMA-48 such as SD/SU to be tested with colors. 20110705 + fill in DEC mnemonics on some menus. 20110516 + fix inchar() function to work properly with big-endian machines (patch by David Kutalek). 20110506 + add some VT520-level menus, e.g., for DSR, DECRQSS. + add VT220 test for DSR Operating Status Report. 20100830 + modify mouse tests to show DECRPM results for the mouse modes, if DECRQM is enabled, i.e., level is VT300 and up. + modify mouse tests to work with xterm #262's UTF-8 coordinates. + add menu entries for xterm #224's focus-event and xterm #262's UTF-8 coordinates. + add xterm-specific screen for DECRQM/DECRPM. + modify configure script to support program name-transformation options. + drop mkdirs.sh, use "mkdir -p". + add RPM and Debian package scripts, for testing. 20100528 + correct check of fflush return code, which interfered with demo of xterm window-modification controls. + fix most strict compiler warnings, e.g., writable strings. + updated configure macros: + quoting fixes + improve portability for ctags + improve check for gcc version + simplify -D options in CF_XOPEN_SOURCE + update config.guess, config.sub 20100101 + add screen for vt520 features, e.g., DECSCUSR. + cosmetic for querying xterm-fonts. 20091231 + add test-screens for setting/querying xterm fonts. + improve display for 94-item character set tests by assuming that DEL would be ignored, and writing a blank after it rather than allowing a ')' to be mapped in the selected character set. + check whether terminal is vt220 or vt320 to decide which Latin-1 flavor to use for initializing the character set tests. + miscellaneous fixes for configure script macros. + updated config.guess, config.sub 20071216 + modify VT420 rectangle tests to provide ANSI/ISO colors and line-drawing as test-options. + miscellaneous updates to configure script macros. + updated config.guess, config.sub 20070304 + build-fix for Darwin 8.8 or OS X 10.4.x, (report by David Blanchard). 20070107 + contacted Per Lindberg (2007/1/2), received permission to change his copyright notice to a BSD-style license. 20061126 + add screen to DECCRA test to demonstrate if video attributes are copied along with the window, or supplied from the current attributes. + use CF_XOPEN_SOURCE in configure script to get prototype for usleep() on Linux. + updated config.guess, config.sub 20051020 + add suffix information to configure script to work with cygwin, etc. + modify window-reporting operations to handle result strings that may be longer than a single line. + improve configure script checks for Intel compiler warning options. + add "%u" format needed in va_out() to work with 20050107 change to mouse-highlight test. 20050107 + improve test for vt220 locking shifts, showing GL/GR side-by-side to demonstrate which are modified. + add logging for text which is part of test-screens 20041220 + modify configure script to work with Intel compiler. + improved parameterization of scrolling test for screen sizes other than 24x80. + add initialization to disable tab/space conversion during menu items 1 and 2, e.g., when "stty tab3" is set (report by Pavel Cahyna). 20041205 + add the ability to redraw the screen for mouse-tests, since some can produce lots of output, e.g., the any-event tracking. + modify function which reads replies, e.g., from DA, to retry as long as it has read data. This is needed for connecting to real VTxxx terminals vs emulators (report by Pavel Cahyna). 20041107 + modify lib$wait() call to work on IA64, which uses a different default float format than VAX and Alpha. + update vmsbuild.com and descrip.mms to build on IA64. + fix typo in vmsbuild.com 20040804 + change parameter for ioctl(fd, FIONREAD, ¶m) to an int. + add a test screen for BCE color behavior with ECH, DCH and scrolling. + add a demo of some of the VT100 autowrap behavior to menu 1. + add xterm's control sequence to disable reverse wraparound to the initialization (this would conflict with DECGPCS if that were tested, but eliminates some user confusion in menu-1). + add entries for VT520/VT525 DA2 responses. + decode DA1 response for VT125. + add note in REP test regarding undefined behavior from using two REP controls in a row (report by Brian Pence). + change SPA test to allow setting/unsetting ERM while running it (request by Brian Pence). + add VT420, VT520 entries to table for DECRPM test, and split that into VT320- and VT420-only tests. + add VT520 entries to character-set and keyboard dialect tables. + correct cleanup from menu 3 (see 990120), which left G1-G3 set to tested character sets rather than resetting to ASCII. + split-out vt320.c, modifying VT220- and VT420-menus to avoid most duplication by pointing to lower-level terminals in the menu. + correct message from check_rc() in xterm.c (report by Brian Pence). + add --disable-echo option to configure script + update configure script. 20030301 + add tek4014 test menu, for xterm. 20021208 + improved test for cursor-control sequences within escape sequences (patch by Paul Williams). 20020422 + modify keyboard tests for cursor- and keypad-application modes to reset the keyboard back to normal mode at the end of each test (reported by Takashi SHIRAI ). + modify test-screen for DEC locator events to add a function that checks for the screensize, used for XFree86 xterm to scale the pixel reports. + updates to configure script and makefile: omit dependencies on config.status and improve list of gcc warning options. 20011130 + add tests for xterm alternate screen + split-out xterm mouse tests into mouse.c menu. 20000208 + change coding of wheel-mouse events, XFree86 xterm patch #126. 991228 + modify to report wheel-mouse events for XFree86 xterm (patch #122). 991025 + clarify top-level reports menu, which mixes tests that apply to various models (VT100-VT420). + show decoded modifiers for the xterm mouse tests 991014 + modify position of cursor for printer tests, so autoprint tests work as expected. + correct escape sequence for mc_print_page(). 991007 + implement tests for Media Copy, e.g., transparent printing. + add examples for DEC locator events and DSR responses. + add DA responses for VT50 and VT55 (I'd forgotten that I once bought a DECscope booklet). 990712 + modify menu 3.12 (non-VT100 "Test Keyboard Layout with G0 Selection") to show numeric codes as well as the actual character. + remove spurious test for SD which indicated that ISO's coding differed from DEC's. The difference was a typographical error in ECMA-48 (reported by Paul Williams ). 990120 + correct initialization of G0, for character-set shift-in/shift-out test. + change keyboard layout screen so that, when invoked from the character set menu, it will display NRC characters properly. + correct logic of reset_charset() function, which used the wrong index for do_scs() (reported by Jeffrey Altman). + set/restore character set for keyboard layout test in character-set menu. 990119 + add menu entry for enabling NRC mode, and (for VT220 & up) a menu entry to allow testing keyboard layout with NRC mode enabled. + remove logic that sets NRC mode from setup for character-set tests, since that interferes with new menu entry. + change delimiting characters for single-shift test screen from "{" and "}" to "(" and ")" to avoid confusion (the DECterm program which I have tested with maps the curly braces even in an unshifted state according to the state of the NRC mode). + reset character-set of G0 after tst_vt100_charsets + restore terminal modes after answerback test. 980719 + add tests to illustrate any-event and button-event tracking in XFree86 xterm. 980328 + add logic to ensure we pick up the proper choice (e.g., in Norwegian) where the choice depends on the terminal id (e.g., VT220 vs VT320). + minor correction for VT220 vs VT320 logic in do_scs for Latin-1 vs British character set. 980327 + implement test for single-shift (SS2 and SS3). 980326 + implement shift-in/shift-out character-set tests oriented toward VT220. + several corrections to VT220 character-set tests, from reports by Kenneth R. Robinette : + move SCS strings to immediately before/after the tests to avoid conflict with menu selection, and to keep the tests distinct. + use 96-character control sequences only for character sets (Latin 1), and 94-character control sequences for the National Replacement Characters. + add ISO Latin-1 as a font option + add Swiss as a font option 980310 + decode known values for secondary DA response. + make mouse-highlight test a little clearer by putting '+' marks at the corners of the highlight-region. 970524 + eliminate 'gets()' calls, which can overflow buffer. 970520 + implement CF_FCNTL_VS_IOCTL check to make this build on SCO 3.x and CLIX, which are both non-POSIX systems. 970518 + add CF_POSIX_VDISABLE test to work around gcc 2.6.2 bug. 970419 + correct sign-extension in xterm mouse-position 961215 + correct err introduced between d960905 and v2_5 that broke test for IRM mode by using decsclm (reported by Jeffrey Altman). 961125 + add VT220 character-set tests for locking-shifts VERSION 2.7 961113 + corrected early return from test for DECRPM when badly-formatted reply is received. + add DA1 codes from VT500 manual (from Jeffrey Altman). + refined test to restore ANSI mode based on VT420 testing. 961029 + extend VT52 test to check operating level when restoring ANSI mode. 961028 + implemented tests for VT220/VT420 function keys, editing keypad. 961027 + set the terminal's default operating level to the maximum rather than VT100; this is slightly incompatible with VTTEST 1.7 (suggested by Jeffrey Altman) 960930 + amended reset_colors() to do SGR 0 at the end. 960928 + allow 8-bit input for keyboard (function keys, cursor keys) tests. + correct I/O modes on timeout + added padding, corrected some states on return from VT52 tests. + increase buffer size for DECTSR. 960927 + modified scan_chr (used in DECCIR test) to properly diagnose Pericom's 3.2 emulator. + check in setup-menu for VT52. + modify inputline to retain whitespace + modify 'reset_colors()' to accommodate grossly-nonstandard emulators that don't reset colors with SGR 0. + added test for SGR 0 960921 + implement REP test + corrected highlighting refresh in function-key test + use raw-mode for VT52 DECID test. VERSION 2.6 960911 + corrected DECBI, DECFI (documentation from Jeffrey Altman), SRM (on VT420) tests. 960908 + implement DECDLD tests. Tested with fonts from "The VT200 TOOLKIT" by Tabik & DiGiantomasso, Professional Software (available via DECUS). 960905 + implement DECCARA, DECRARA, DECSACE, DECSERA tests. 960901 + implement DECBKM, DECCRA, DECERA, DECFRA, DECKBUM, DECKPM, DECNKM, SRM tests 960830 + implement 2nd, 3rd DA, DECFI, DECBI, DECSNLS, DECRQTSR tests. 960828 + provide analysis of DECCIR + implement tests for DECSASD, DECSSDT 960825 + corrected error (I) introduced in tst_movements (main.c 1.6) that broke test of cursor-control characters inside ESC sequences (reported by Albert D. Cahalan). + implement DECDC, DECIC tests. 960825 + added -l (logging) option. + added -p (padding) option. + port to VAX/VMS, for testing VT420 960821 + Corrected test for DECUDK, omitted lock-parameter caused keys to be locked, so that only the first key definition was used (reported by Jeffrey Altman). + Corrected test for DECRPM, missing '?' (reported by Jeffrey Altman ). VERSION 2.5 960818 + implements most VT420 report-tests. + make menu-skeleton for VT420 tests (some are needed for xterm tests), marking the non-implemented entries with an '*'. 960817 + add tests/examples for xterm mouse controls 960816 + remove obsolete support for Sargasso C (TOPS-20) 960813 + use usleep() if the system has it, to make responses faster. + add menu-entry for toggling 7/8-bit input/output controls + split-out keyboard.c, organized by a set of submenus. + split-out reports.c, parameterized to allow testing 8-bit controls. make submenu for individual reports. + modified menu decoding to accept '*' to step through all submenus. VERSION 2.4 960807 + Implement test for VT5xx C7C1T and S8C1T + Remove check for scrolling-behavior in CPL and CNL (no one but kermit seems to consider doing this). + Modified tst_reports() to use raw mode (the original sgtty logic doesn't do this) so that termios works. Modified termios settings for crmod so it doesn't touch INLCR and IGNCR, and for raw mode to leave c_oflag alone - this works on Linux. + corrected some typos in DECSCA test. 960806 + Testing by Albert D. Cahalan with VT510, suggested initializing with the 80/132 mode enabled. Says real terminals need padding... 960804 + Implement tests for: SL, SD, SU, SR + Modified "Test of screen features with ISO 6429 SGR 22-27 codes" to test concealed text. VERSION 2.3 960803 + Implement tests for the following ISO 6429 controls: CBT, CHA, CHT, CNL, CPL, ECH, HPA, SL, SPA, SR, VPA. + Implement tests for DEC VT220 controls: DECSCA, DECTCEM 960802 + Restructure non-VT100 menus, making them separate from the base VT100 tests. VERSION 2.2 960721 + Initialize terminal with 80/132 switching enabled + Casper Dik explained why tests fail on Solaris 2.5 (can workaround with lots of fflush calls ;-) 960716 + Add tests for CDE-compatible xterm VERSION 2.1 960708 + Change background color to blue for tests (some yellows and greens are too close together). 960702 + Added extended graphic-rendition tests (ISO 6429) VERSION 2.0 960624 + Added color/graphic-rendition, and color-scrolling tests. 960623 + Implemented color tests (test-pattern, bce-test, insert/delete lines) 960621 + Implemented auto-config for termios (tested on SunOS 4.1.1, IRIX 5.2, Solaris 5.4). 960618 + Modified to support nonstandard screen geometry. For example, you can test Linux console (which has 25 lines) by typing 'vttest 25'. + Implemented auto-config for termio (tested on SunOS 4.1.1). 960617 + Corrected broken write-to-string-constant in tst_keyboard(). + Split-out logic for ttymodes.c + Converted to ANSI C (it's a lot easier to avoid breaking code when all of the interfaces are fully specified). + Split-out sargasso.h from header.h, to avoid nested-comment syntax. (I don't think anyone will be using that again, anyway). + from original version (I've found nothing more recent ;-), marked 1.7b 1985-04-19, begin making changes to support testing for ANSI color features. vttest-20140116/.vilerc0000644000175100001440000000030506742337541013320 0ustar tomusers; Maintain the C/H code w/o tabs source ~/.vilerc store-procedure my_read_hook ~if &loc cmode setl sw=2 setl ts=2 setl notabinsert ~endif HighlightFilter ~endm setv $read-hook "my_read_hook" vttest-20140116/printer.c0000644000175100001440000001117011667272506013665 0ustar tomusers/* $Id: printer.c,v 1.8 2011/12/06 01:52:06 tom Exp $ */ #include #include static int pex_mode; static int pff_mode; static int started; static int assigned; static int margin_lo; static int margin_hi; static void setup_printout(MENU_ARGS, int visible, const char *whole) { margin_lo = 7; margin_hi = max_lines - 5; vt_clear(2); cup(1, 1); println(the_title); println("Test screen for printing. We will set scrolling margins at"); printf("lines %d and %d, and write a test pattern there.\n", margin_lo, margin_hi); printf("The test pattern should be %s.\n", visible ? "visible" : "invisible"); printf("The %s should be in the printer's output.\n", whole); decstbm(margin_lo, margin_hi); cup(margin_lo, 1); } static void test_printout(void) { int row, col; vt_move(margin_hi, 1); for (row = 0; row < max_lines; row++) { printf("%3d:", row); for (col = 0; col < min_cols - 5; col++) { printf("%c", ((row + col) % 26) + 'a'); } printf("\n"); } } static void cleanup_printout(void) { decstbm(0, 0); vt_move(max_lines - 2, 1); } static int tst_Assign(MENU_ARGS) { mc_printer_assign(assigned = !assigned); return MENU_HOLD; } static int tst_DECPEX(MENU_ARGS) { decpex(pex_mode = !pex_mode); return MENU_HOLD; } static int tst_DECPFF(MENU_ARGS) { decpff(pff_mode = !pff_mode); return MENU_HOLD; } static int tst_Start(MENU_ARGS) { mc_printer_start(started = !started); return MENU_HOLD; } static int tst_autoprint(MENU_ARGS) { setup_printout(PASS_ARGS, TRUE, "scrolling region"); mc_autoprint(TRUE); test_printout(); mc_autoprint(FALSE); cleanup_printout(); return MENU_HOLD; } static int tst_printer_controller(MENU_ARGS) { setup_printout(PASS_ARGS, FALSE, "scrolling region"); mc_printer_controller(TRUE); test_printout(); mc_printer_controller(FALSE); cleanup_printout(); return MENU_HOLD; } static int tst_print_all_pages(MENU_ARGS) { setup_printout(PASS_ARGS, TRUE, "contents of all pages"); test_printout(); mc_print_all_pages(); cleanup_printout(); return MENU_HOLD; } static int tst_print_cursor(MENU_ARGS) { int row; setup_printout(PASS_ARGS, TRUE, "reverse of the scrolling region"); test_printout(); for (row = margin_hi; row >= margin_lo; row--) { vt_move(row, 1); mc_print_cursor_line(); } cleanup_printout(); return MENU_HOLD; } static int tst_print_display(MENU_ARGS) { setup_printout(PASS_ARGS, TRUE, "whole display"); test_printout(); mc_print_composed(); cleanup_printout(); return MENU_HOLD; } static int tst_print_page(MENU_ARGS) { setup_printout(PASS_ARGS, TRUE, pex_mode ? "whole page" : "scrolling region"); test_printout(); mc_print_page(); cleanup_printout(); return MENU_HOLD; } int tst_printing(MENU_ARGS) { static char pex_mesg[80]; static char pff_mesg[80]; static char assign_mesg[80]; static char start_mesg[80]; /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { assign_mesg, tst_Assign }, { start_mesg, tst_Start }, { pex_mesg, tst_DECPEX }, { pff_mesg, tst_DECPFF }, { "Test Auto-print mode (MC - DEC private mode)", tst_autoprint }, { "Test Printer-controller mode (MC)", tst_printer_controller }, { "Test Print-page (MC)", tst_print_page }, { "Test Print composed main-display (MC)", tst_print_display }, { "Test Print all pages (MC)", tst_print_all_pages }, { "Test Print cursor line (MC)", tst_print_cursor }, { "", 0 } }; /* *INDENT-ON* */ do { sprintf(pex_mesg, "%s Printer-Extent mode (DECPEX)", STR_ENABLE(pex_mode)); sprintf(pff_mesg, "%s Print Form Feed Mode (DECPFF)", STR_ENABLE(pff_mode)); strcpy(assign_mesg, assigned ? "Release printer (MC)" : "Assign printer to active session (MC)"); sprintf(start_mesg, "%s printer-to-host session (MC)", STR_START(started)); vt_clear(2); __(title(0), printf("Printing-Control Tests")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); if (pex_mode) decpex(pex_mode = 0); if (pff_mode) decpex(pff_mode = 0); if (assigned) mc_printer_start(assigned = 0); if (started) mc_printer_start(started = 0); return MENU_NOHOLD; } vttest-20140116/mouse.c0000644000175100001440000005064012266053521013325 0ustar tomusers/* $Id: mouse.c,v 1.33 2014/01/16 22:04:01 tom Exp $ */ #include #include #include #define MCHR(c) (unsigned)((unsigned)((c) - ' ') & 0xff) #define isQuit(c) (((c) == 'q') || ((c) == 'Q')) #define isReport(c) (get_level() >= 3 && (((c) == 'r') || ((c) == 'R'))) #define isClear(c) ((c) == ' ') #define ToData(n) vt_move(4 + n, 10) typedef enum { cDFT = 0, cUTF = 1005, cSGR = 1006, cURX = 1015 } COORDS; static int do_ExtCoords; static int do_FocusEvent; static int chars_high; static int chars_wide; static int pixels_high; static int pixels_wide; static const char * nameOfExtCoords(int code) { const char *result; switch (code) { case cUTF: result = "UTF-8"; break; case cSGR: result = "SGR"; break; case cURX: result = "urxvt-style"; break; default: result = "normal"; break; } return result; } static void show_mousehelp(void) { if (get_level() >= 3) println("Press 'q' to quit, 'r' to report modes, ' ' to clear."); else println("Press 'q' to quit, ' ' to clear."); } static unsigned xterm_coord(char *source, int *pos) { unsigned result; switch (do_ExtCoords) { case cUTF: { int used; char *real_src = source + *pos; unsigned limit = (unsigned) strlen(real_src); used = conv_to_utf32((unsigned *) 0, real_src, limit); if (used > 0) { (void) conv_to_utf32(&result, real_src, limit); *pos += used; if (result > ' ') result -= ' '; else result = 0; } else { result = 0; } } break; case cSGR: result = 0; break; case cURX: result = 0; break; default: { result = MCHR(source[*pos]); *pos += 1; } break; } return result; } static unsigned sgr_param(char **report, int final, unsigned offset) { unsigned result = 0; if (*report != 0) { char *base = *report; char *endp = 0; long value = strtol(base, &endp, 10); if (value >= (long) offset && (endp == 0 || (*endp == 0 || *endp == ';' || *endp == final))) { result = (unsigned) value - offset; if (endp != 0) { if (*endp == ';') ++endp; *report = endp; } else { *report = base + strlen(base); } } else { *report = 0; result = offset; } } return result; } static char * skip_params(char *report) { return report + strspn(report, "0123456789;"); } /* * Parse the mouse position report. This is the usual case, containing the 'M' * response (as well as variations on it). */ static char * parse_mouse_M(char *report, unsigned *b, unsigned *x, unsigned *y) { char *result = 0; char *finalp; if ((report = skip_csi(report)) != 0) { switch (do_ExtCoords) { default: case cUTF: if (*report == 'M' && strlen(report) >= 4) { int pos = 2; *b = MCHR(report[1]); *x = xterm_coord(report, &pos); *y = xterm_coord(report, &pos); result = report + pos; } break; case cSGR: if (*report++ == '<') { finalp = skip_params(report); if (*finalp == 'M') { /* pressed */ *b = sgr_param(&report, 'M', 0); *x = sgr_param(&report, 'M', 0); *y = sgr_param(&report, 'M', 0); result = ++finalp; } else if (*finalp == 'm') { /* released */ *b = sgr_param(&report, 'm', 0); *x = sgr_param(&report, 'm', 0); *y = sgr_param(&report, 'm', 0); result = ++finalp; } } break; case cURX: finalp = skip_params(report); if (*finalp == 'M') { *b = sgr_param(&report, 'M', 32); *x = sgr_param(&report, 'M', 0); *y = sgr_param(&report, 'M', 0); result = ++finalp; } break; } } return result; } /* * Parse the mouse report, looking for the 'T' response, which is part of * mouse highlight-tracking. */ static char * parse_mouse_T(char *report, unsigned *start_x, unsigned *start_y, unsigned *end_x, unsigned *end_y, unsigned *mouse_x, unsigned *mouse_y) { char *result = 0; char *finalp; if ((report = skip_csi(report)) != 0) { switch (do_ExtCoords) { default: case cUTF: if (*report == 'M' && strlen(report) >= 7) { int pos = 1; *start_x = xterm_coord(report, &pos); *start_y = xterm_coord(report, &pos); *end_x = xterm_coord(report, &pos); *end_y = xterm_coord(report, &pos); *mouse_x = xterm_coord(report, &pos); *mouse_y = xterm_coord(report, &pos); result = report + pos; } break; case cSGR: if (*report++ != '<') break; /* FALLTHRU */ case cURX: finalp = skip_params(report); if (*finalp == 'T') { *start_x = sgr_param(&report, 'T', 0); *start_y = sgr_param(&report, 'T', 0); *end_x = sgr_param(&report, 'T', 0); *end_y = sgr_param(&report, 'T', 0); *mouse_x = sgr_param(&report, 'T', 0); *mouse_y = sgr_param(&report, 'T', 0); result = ++finalp; } break; } } return result; } /* * Parse the mouse report, looking for the 't' response, which is part of mouse * highlight-tracking. */ static char * parse_mouse_t(char *report, unsigned *x, unsigned *y) { char *result = 0; char *finalp; if ((report = skip_csi(report)) != 0) { switch (do_ExtCoords) { default: case cUTF: if (*report == 't' && strlen(report) >= 3) { int pos = 1; *x = xterm_coord(report, &pos); *y = xterm_coord(report, &pos); } break; case cSGR: if (*report++ != '<') break; /* FALLTHRU */ case cURX: finalp = skip_params(report); if (*finalp == 't') { *x = sgr_param(&report, 't', 0); *y = sgr_param(&report, 't', 0); result = ++finalp; } break; } } return result; } static void cat_button(char *dst, const char *src) { if (*dst != '\0') strcat(dst, ", "); strcat(dst, src); } static char * locator_button(unsigned b) { static char result[80]; if (b) { result[0] = 0; if (b & 1) cat_button(result, "right"); if (b & 2) cat_button(result, "middle"); if (b & 4) cat_button(result, "left"); if (b & 8) cat_button(result, "M4"); } else { strcpy(result, "no buttons down"); } return result; } static const char * locator_event(int e) { const char *result; switch (e) { case 0: result = "locator unavailable"; break; case 1: result = "request - received a DECRQLP"; break; case 2: result = "left button down"; break; case 3: result = "left button up"; break; case 4: result = "middle button down"; break; case 5: result = "middle button up"; break; case 6: result = "right button down"; break; case 7: result = "right button up"; break; case 8: result = "M4 button down"; break; case 9: result = "M4 button up"; break; case 10: result = "locator outside filter rectangle"; break; default: result = "unknown event"; break; } return result; } static void show_click(unsigned y, unsigned x, int c) { cup((int) y, (int) x); putchar(c); vt_move((int) y, (int) x); fflush(stdout); } /* Print the corners of the highlight-region. Note that xterm doesn't use * the last row. */ static void show_hilite(int first, int last) { /* *INDENT-OFF* */ vt_move(first, 1); printf("+"); vt_move(last-1, 1); printf("+"); vt_move(first, min_cols); printf("+"); vt_move(last-1, min_cols); printf("+"); /* *INDENT-ON* */ fflush(stdout); } static void show_locator_rectangle(void) { const int first = 10; const int last = 20; decefr(first, 1, last, min_cols); show_hilite(first, last); } #define SCALED(value,range) \ ((value * (unsigned) range + (unsigned) (range - 1)) / (unsigned) range) static int show_locator_report(char *report, int row, int pixels) { int Pe, Pb, Pp; unsigned Pr, Pc; int now = row; ToData(0); vt_el(2); chrprint(report); while ((report = skip_csi(report)) != 0 && (sscanf(report, "%d;%d;%u;%u&w", &Pe, &Pb, &Pr, &Pc) == 4 || sscanf(report, "%d;%d;%u;%u;%d&w", &Pe, &Pb, &Pr, &Pc, &Pp) == 5)) { vt_move(row, 10); vt_el(2); show_result("%s - %s (%d,%d)", locator_event(Pe), locator_button((unsigned) Pb), Pr, Pc); vt_el(0); if (pixels) { if (pixels_high > 0 && pixels_wide > 0) { Pr = SCALED(Pr, pixels_high); Pc = SCALED(Pc, pixels_wide); show_click(Pr, Pc, '*'); } } else { show_click(Pr, Pc, '*'); } report = strchr(report, '&') + 2; now = row++; } return now; } static int get_screensize(MENU_ARGS) { char *report; char tmp = 0; set_tty_raw(TRUE); set_tty_echo(FALSE); brc(14, 't'); /* report window's pixel-size */ report = instr(); if ((report = skip_csi(report)) == 0 || sscanf(report, "4;%d;%d%c", &pixels_high, &pixels_wide, &tmp) != 3 || tmp != 't' || pixels_high <= 0 || pixels_wide <= 0) { pixels_high = -1; pixels_wide = -1; } brc(18, 't'); /* report window's char-size */ report = instr(); if ((report = skip_csi(report)) == 0 || sscanf(report, "8;%d;%d%c", &chars_high, &chars_wide, &tmp) != 3 || tmp != 't' || chars_high <= 0 || chars_wide <= 0) { chars_high = 24; chars_wide = 80; } restore_ttymodes(); return MENU_NOHOLD; } static void show_dec_locator_events(MENU_ARGS, int mode, int pixels) { int row, now; first: vt_move(1, 1); ed(0); println(the_title); show_mousehelp(); println("Mouse events will be marked with '*'"); decelr((mode > 0) ? mode : ((mode == 0) ? 2 : -mode), pixels ? 1 : 2); if (mode < 0) show_locator_rectangle(); else if (mode == 0) do_csi("'w"); /* see decefr() */ decsle(1); /* report button-down events */ decsle(3); /* report button-up events */ set_tty_raw(TRUE); set_tty_echo(FALSE); now = 4; for (;;) { char *report = instr(); if (isQuit(*report)) { decrqlp(1); report = instr(); show_locator_report(report, now + 1, pixels); break; } else if (isReport(*report)) { show_mousemodes(); goto first; } else if (isClear(*report)) { goto first; } row = 4; while (now > row) { vt_move(now, 1); vt_el(2); now--; } now = show_locator_report(report, row, pixels); if (mode == 0) { decelr(2, pixels ? 1 : 2); do_csi("'w"); /* see decefr() */ } } decelr(0, 0); restore_ttymodes(); vt_move(max_lines - 2, 1); } /* Normal Mouse Tracking */ static void show_mouse_tracking(MENU_ARGS, const char *the_mode) { unsigned y = 0, x = 0; unsigned b, xx, yy; first: vt_move(1, 1); ed(0); println(the_title); show_mousehelp(); println("Mouse events will be marked with the button number."); sm(the_mode); set_tty_raw(TRUE); set_tty_echo(FALSE); for (;;) { char *report = instr(); if (isQuit(*report)) { break; } else if (isReport(*report)) { show_mousemodes(); goto first; } else if (isClear(*report)) { goto first; } ToData(0); vt_el(2); chrprint(report); while ((report = parse_mouse_M(report, &b, &xx, &yy)) != 0) { unsigned adj = 1; ToData(1); vt_el(2); show_result("code 0x%x (%d,%d)", b, yy, xx); if (b & (unsigned) (~3)) { if (b & 4) printf(" shift"); if (b & 8) printf(" meta"); if (b & 16) printf(" control"); if (b & 32) printf(" motion"); if (b & 64) adj += 3; } b &= 3; if (b != 3) { b += adj; printf(" button %u", b); show_click(yy, xx, (int) (b + '0')); } else if (xx != x || yy != y) { printf(" release"); show_click(yy, xx, '*'); } x = xx; y = yy; report += 4; } } rm(the_mode); restore_ttymodes(); vt_move(max_lines - 2, 1); } static int test_dec_locator_event(MENU_ARGS) { show_dec_locator_events(PASS_ARGS, 2, FALSE); return MENU_HOLD; } static int test_dec_locator_events(MENU_ARGS) { show_dec_locator_events(PASS_ARGS, 1, FALSE); return MENU_HOLD; } static int test_dec_locator_event_p(MENU_ARGS) { show_dec_locator_events(PASS_ARGS, 2, TRUE); return MENU_HOLD; } static int test_dec_locator_events_p(MENU_ARGS) { show_dec_locator_events(PASS_ARGS, 1, TRUE); return MENU_HOLD; } static int test_dec_locator_rectangle(MENU_ARGS) { show_dec_locator_events(PASS_ARGS, -2, FALSE); return MENU_HOLD; } static int test_dec_locator_unfiltered(MENU_ARGS) { show_dec_locator_events(PASS_ARGS, 0, FALSE); return MENU_HOLD; } /* Any-Event Mouse Tracking */ static int test_mouse_any_event(MENU_ARGS) { show_mouse_tracking(PASS_ARGS, "?1003"); return MENU_HOLD; } /* Button-Event Mouse Tracking */ static int test_mouse_button_event(MENU_ARGS) { show_mouse_tracking(PASS_ARGS, "?1002"); return MENU_HOLD; } /* Mouse Highlight Tracking */ static int test_mouse_hilite(MENU_ARGS) { const int first = 10; const int last = 20; unsigned b; unsigned y = 0, x = 0; unsigned start_x, end_x; unsigned start_y, end_y; unsigned mouse_y, mouse_x; first: vt_move(1, 1); ed(0); println(the_title); show_mousehelp(); println("Mouse events will be marked with the button number."); printf("Highlighting range is [%d..%d)\n", first, last); show_hilite(first, last); sm("?1001"); set_tty_raw(TRUE); set_tty_echo(FALSE); for (;;) { char *report = instr(); if (isQuit(*report)) { break; } else if (isReport(*report)) { show_mousemodes(); goto first; } else if (isClear(*report)) { goto first; } show_hilite(first, last); ToData(1); vt_el(2); chrprint(report); if (parse_mouse_M(report, &b, &x, &y) != 0) { b &= 7; if (b != 3) { /* send the xterm the highlighting range (it MUST be done first) */ do_csi("1;%u;%u;%d;%d;T", x, y, 10, 20); /* now, show the mouse-click */ if (b < 3) b++; show_click(y, x, (int) (b + '0')); } /* interpret the event */ ToData(2); vt_el(2); show_result("tracking: code 0x%x (%d,%d)", b, y, x); fflush(stdout); } else if (parse_mouse_T(report, &start_x, &start_y, &end_x, &end_y, &mouse_x, &mouse_y)) { /* interpret the event */ ToData(2); vt_el(2); show_result("done: start(%d,%d), end(%d,%d), mouse(%d,%d)", start_y, start_x, end_y, end_x, mouse_y, mouse_x); if (start_y != y || start_x != x) show_click(start_y, start_x, 's'); if (end_y != y || end_x != x) show_click(end_y, end_x, 'e'); if (mouse_y != y || mouse_x != x) show_click(mouse_y, mouse_x, 'm'); } else if (parse_mouse_t(report, &end_x, &end_y)) { /* interpret the event */ ToData(2); vt_el(2); show_result("done: end(%d,%d)", end_y, end_x); if (end_y != y || end_x != x) show_click(end_y, end_x, 'e'); } } rm("?1001"); restore_ttymodes(); vt_move(max_lines - 2, 1); return MENU_HOLD; } /* Normal Mouse Tracking */ static int test_mouse_normal(MENU_ARGS) { show_mouse_tracking(PASS_ARGS, "?1000"); return MENU_HOLD; } /* X10 Mouse Compatibility */ static int test_X10_mouse(MENU_ARGS) { unsigned b, x, y; first: vt_move(1, 1); ed(0); println(the_title); show_mousehelp(); println("Mouse events will be marked with the button number."); sm("?9"); set_tty_raw(TRUE); set_tty_echo(FALSE); for (;;) { char *report = instr(); if (isQuit(*report)) { break; } else if (isReport(*report)) { show_mousemodes(); goto first; } else if (isClear(*report)) { goto first; } ToData(0); vt_el(2); chrprint(report); if ((report = parse_mouse_M(report, &b, &x, &y)) != 0) { cup((int) y, (int) x); printf("%u", b + 1); vt_move((int) y, (int) x); fflush(stdout); } } rm("?9"); restore_ttymodes(); vt_move(max_lines - 2, 1); return MENU_HOLD; } /* * DEC locator events are implemented on DECterm, to emulate VT220. */ static int tst_dec_locator_events(MENU_ARGS) { static char pixel_screensize[80]; /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "One-Shot", test_dec_locator_event }, { "Repeated", test_dec_locator_events }, { "One-Shot (pixels)", test_dec_locator_event_p }, { "Repeated (pixels)", test_dec_locator_events_p }, { "Filter Rectangle", test_dec_locator_rectangle }, { "Filter Rectangle (unfiltered)", test_dec_locator_unfiltered }, { pixel_screensize, get_screensize }, { "", 0 } }; /* *INDENT-ON* */ chars_high = 24; chars_wide = 80; pixels_high = -1; pixels_wide = -1; do { vt_clear(2); __(title(0), println("DEC Locator Events")); __(title(2), println("Choose test type:")); if (pixels_high > 0 && pixels_wide > 0) { sprintf(pixel_screensize, "XFree86 xterm: screensize %dx%d chars, %dx%d pixels", chars_high, chars_wide, pixels_high, pixels_wide); } else { strcpy(pixel_screensize, "XFree86 xterm: screensize unknown"); } } while (menu(my_menu)); return MENU_NOHOLD; } /* * Cycle through the different flavors of mouse-coordinates which are * recognized by xterm. */ static int toggle_ExtCoords(MENU_ARGS) { int old_ExtCoords = do_ExtCoords; char buffer[80]; switch (do_ExtCoords) { case cUTF: do_ExtCoords = cSGR; break; case cSGR: do_ExtCoords = cURX; break; case cURX: do_ExtCoords = cDFT; break; default: do_ExtCoords = cUTF; break; } if (LOG_ENABLED) { fprintf(log_fp, "Toggle: from %s to %s\n", nameOfExtCoords(old_ExtCoords), nameOfExtCoords(do_ExtCoords)); } if (old_ExtCoords) { sprintf(buffer, "?%d", old_ExtCoords); rm(buffer); } if (do_ExtCoords) { sprintf(buffer, "?%d", do_ExtCoords); sm(buffer); } return MENU_NOHOLD; } /* * The "focus-event" control adds an event when entering/leaving the window. */ static int toggle_FocusEvent(MENU_ARGS) { do_FocusEvent = !do_FocusEvent; if (do_FocusEvent) sm("?1004"); else rm("?1004"); return MENU_NOHOLD; } /* * xterm generally implements mouse escape sequences (except for dtterm and * DECterm). XFree86 xterm (and newer) implements additional controls. */ int tst_mouse(MENU_ARGS) { static char txt_Utf8Mouse[80]; static char txt_FocusEvent[80]; /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { txt_Utf8Mouse, toggle_ExtCoords }, { txt_FocusEvent, toggle_FocusEvent }, { "X10 Mouse Compatibility", test_X10_mouse }, { "Normal Mouse Tracking", test_mouse_normal }, { "Mouse Highlight Tracking", test_mouse_hilite }, { "Mouse Any-Event Tracking (XFree86 xterm)", test_mouse_any_event }, { "Mouse Button-Event Tracking (XFree86 xterm)", test_mouse_button_event }, { "DEC Locator Events (DECterm)", tst_dec_locator_events }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); sprintf(txt_Utf8Mouse, "Mode: %s coordinates", nameOfExtCoords(do_ExtCoords)); sprintf(txt_FocusEvent, "Mode: %sFocus-event", do_FocusEvent ? "" : "no"); __(title(0), println("XTERM mouse features")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } vttest-20140116/makefile.in0000644000175100001440000001074612266040676014150 0ustar tomusers# $Id: makefile.in,v 1.45 2014/01/16 20:31:58 tom Exp $ # Makefile-template for 'vttest' THIS = vttest #### Start of system configuration section. #### srcdir = @srcdir@ VPATH = @srcdir@ x = @EXEEXT@ o = .@OBJEXT@ CC = @CC@ CPP = @CPP@ LINK = $(CC) LINT = @LINT@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ transform = @program_transform_name@ LIBS = @LIBS@ CFLAGS = @CFLAGS@ @EXTRA_CFLAGS@ LDFLAGS = @LDFLAGS@ CTAGS = @CTAGS@ ETAGS = @ETAGS@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ datarootdir = @datarootdir@ mandir = @mandir@ manext = 1 BINDIR = $(DESTDIR)$(bindir) MANDIR = $(DESTDIR)$(mandir)/man$(manext) #### End of system configuration section. #### SHELL = /bin/sh CPPFLAGS = -DHAVE_CONFIG_H -I. -I$(srcdir) @CPPFLAGS@ ################################################################################ .SUFFIXES : $o .i .cat .c$o: @RULE_CC@ @ECHO_CC@$(CC) -c $(CPPFLAGS) $(CFLAGS) $< .c.i : @RULE_CC@ @ECHO_CC@$(CPP) -C $(CPPFLAGS) $*.c >$@ .$(manext).cat : - nroff -man $(srcdir)/$(THIS).$(manext) >$@ ################################################################################ C_SRC = \ charsets.c \ color.c \ draw.c \ esc.c \ keyboard.c \ main.c \ mouse.c \ nonvt100.c \ printer.c \ reports.c \ reset.c \ setup.c \ sixel.c \ status.c \ tek4014.c \ ttymodes.c \ unix_io.c \ utf8.c \ vt220.c \ vt320.c \ vt420.c \ vt52.c \ vt520.c \ xterm.c H_SRC = \ vttest.h \ draw.h \ esc.h \ ttymodes.h OBJS = \ charsets$o \ color$o \ draw$o \ esc$o \ keyboard$o \ main$o \ mouse$o \ nonvt100$o \ printer$o \ reports$o \ reset$o \ setup$o \ sixel$o \ status$o \ tek4014$o \ ttymodes$o \ unix_io$o \ utf8$o \ vt220$o \ vt320$o \ vt420$o \ vt52$o \ vt520$o \ xterm$o SRC = patchlev.h \ CHANGES COPYING README BUGS \ $(THIS).1 \ $(C_SRC) $(H_SRC) \ tech.set \ config.hin install.sh makefile.in configure.in TRANSFORM_BIN = sed 's/$x$$//' |sed '$(transform)'|sed 's/$$/$x/' TRANSFORM_MAN = sed 's/\.$(manext)$$//'|sed '$(transform)'|sed 's/$$/.$(manext)/' actual_bin = `echo $(THIS)$x | $(TRANSFORM_BIN)` actual_man = `echo $(THIS).$(manext)| $(TRANSFORM_MAN)` PROG = $(THIS)$x DISTFILES = MANIFEST configure $(SRC) all: $(PROG) $(PROG): $(OBJS) @ECHO_LD@$(LINK) $(CFLAGS) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIBS) $(OBJS): config.h $(THIS).h patchlev.h install: all installdirs $(INSTALL_PROGRAM) $(PROG) $(BINDIR)/$(actual_bin) $(INSTALL_DATA) $(srcdir)/$(THIS).1 $(MANDIR)/$(actual_man) installdirs: $(BINDIR) $(MANDIR) $(BINDIR) $(MANDIR) : mkdir -p $@ uninstall: rm -f $(BINDIR)/$(actual_bin) rm -f $(MANDIR)/$(actual_man) mostlyclean :: rm -f *.[oi] core *~ *.BAK *.trace *.atac clean :: mostlyclean rm -f $(PROG) distclean :: clean rm -f makefile config.log config.cache config.status config.h realclean :: distclean rm -f tags TAGS # don't remove configure! @MAKE_LOWER_TAGS@tags: $(C_SRC) $(HDRS) @MAKE_LOWER_TAGS@ $(CTAGS) $(C_SRC) $(HDRS) @MAKE_UPPER_TAGS@TAGS: $(C_SRC) $(HDRS) @MAKE_UPPER_TAGS@ $(ETAGS) $(C_SRC) $(HDRS) # I keep my sources in RCS, and assign a symbolic release to the current patch # level. The 'manifest' script knows how to build a list of files for a given # revision. MANIFEST: patchlev.h manifest -rd`fgrep PATCH_DATE patchlev.h | sed -e s'/^[^0-9]*//'` dist: MANIFEST - rm -f .fname .files fgrep PATCH_DATE patchlev.h | sed -e 's/[^0-9.]//g' -e 's/^/$(THIS)-/' >.fname cat MANIFEST | grep ' ' | egrep -v ' subdirectory$$' | sed -e 's/\ .*//' | uniq >.files rm -rf `cat .fname` TOP=`cat .fname`; mkdir $$TOP `cat .files | grep / | sed -e 's@/.*@@' | sed -e s@\^@$$TOP/@ | uniq` for file in `cat .files`; do \ ln $(srcdir)/$$file `cat .fname`/$$file \ || { echo copying $$file instead; cp $$file `cat .fname`/$$file; }; \ done tar -cf - `cat .fname` | gzip >`cat .fname`.tgz rm -rf `cat .fname` .fname .files # Some of the output will be uuencoded because the test scripts include # terminated ".bat" files for MS-DOS. dist-shar: MANIFEST - rm -f .fname .files fgrep PATCH_DATE patchlev.h | sed -e 's/[^0-9.]//g' -e 's/^/$(THIS)-/' >.fname cat MANIFEST | grep ' ' | egrep -v ' subdirectory$$' | sed -e 's/\ .*//' | uniq >.files shar -M -n`cat .fname` -opart -l50 `cat .files` - rm -f .fname .files $(THIS)$o: config.h ################################################################################ lint: $(LINT) $(CPPFLAGS) $(C_SRC) check: $(PROG) @echo 'Sorry -- You must run this interactively.' vttest-20140116/vmsbuild.com0000644000175100001440000001215711436177153014365 0ustar tomusers$! $Id: vmsbuild.com,v 1.19 2010/08/28 12:17:47 tom Exp $ $! VMS build-script for VTTEST. Requires installed C compiler $! $! Tested with: $! VMS system version 5.4-2 $! VAX-C version 3.2 $! $! Build the option-file $! $ open/write optf vms_link.opt $ write optf "Identification=""VtTest 2.7""" $ write optf "charsets.obj" $ write optf "color.obj" $ write optf "draw.obj" $ write optf "esc.obj" $ write optf "keyboard.obj" $ write optf "mouse.obj" $ write optf "nonvt100.obj" $ write optf "printer.obj" $ write optf "reports.obj" $ write optf "reset.obj" $ write optf "setup.obj" $ write optf "sixel.obj" $ write optf "status.obj" $ write optf "tek4014.obj" $ write optf "utf8.obj" $ write optf "vms_io.obj" $ write optf "vt220.obj" $ write optf "vt320.obj" $ write optf "vt420.obj" $ write optf "vt52.obj" $ write optf "vt520.obj" $ write optf "xterm.obj" $! $! Look for the compiler used $! $ CC = "CC" $ arch = "UNKNOWN" $! $ if f$getsyi("ARCH_NAME") .eqs. "Alpha" $ then $ arch = "__alpha__=1" $ comp = "__decc__=1" $ CFLAGS = "/prefix=all" $ DEFS = "HAVE_ALARM" $ if f$trnlnm("SYS").eqs."" then define sys sys$library: $ endif $! $ if f$getsyi("ARCH_NAME") .eqs. "IA64" $ then $ arch = "__ia64__=1" $ comp = "__decc__=1" $ CFLAGS = "/prefix=all" $ DEFS = "HAVE_ALARM,USE_IEEE_FLOAT" $ if f$trnlnm("SYS").eqs."" then define sys sys$library: $ endif $! $ if f$getsyi("ARCH_NAME") .eqs. "VAX" $ then $ arch = "__vax__=1" $ if f$search("SYS$SYSTEM:DECC$COMPILER.EXE").eqs."" $ then $ if f$trnlnm("SYS").eqs."" then define sys sys$library: $ DEFS = "HAVE_SYS_ERRLIST" $ write optf "sys$library:vaxcrtl.exe/share" $ if f$search("SYS$SYSTEM:VAXC.EXE").eqs."" $ then $ if f$trnlnm("GNU_CC").eqs."" $ then $ write sys$output "C compiler required to rebuild vttest" $ close optf $ exit $ else $ write optf "gnu_cc:[000000]gcclib.olb/lib" $ comp = "__gcc__=1" $ CC = "GCC" $ endif $ else $ comp = "__vaxc__=1" $ endif $ else $ if f$trnlnm("SYS").eqs."" then define sys decc$library_include: $ comp = "__decc__=1" $ endif $ endif $ $ if "''arch'" .eqs. "UNKNOWN" $ then $ write sys$output "Cannot determine architecture type" $ exit 1 $ endif $ $ close optf $ $! used /G_FLOAT with vaxcrtlg/share in vms_link.opt $! can also use /Debug /Listing, /Show=All $ $! -------------- vms_link.opt is created ------------- $ if f$edit("''p1'", "UPCASE") .eqs. "VMS_LINK.OPT" $ then $! mms called this script to build vms_link.opt. all done $ exit $ endif $ $ if f$search("SYS$SYSTEM:MMS.EXE").eqs."" $ then $ $ CFLAGS := 'CFLAGS/Diagnostics /Define=("''DEFS'") /Include=([]) $ $ if "''p1'" .nes. "" then goto 'p1 $ $ all : $ call make charsets $ call make color $ call make draw $ call make esc $ call make keyboard $ call make main $ call make mouse $ call make nonvt100 $ call make printer $ call make reports $ call make reset $ call make setup $ call make sixel $ call make status $ call make tek4014 $ call make utf8 $ call make vt220 $ call make vt320 $ call make vt420 $ call make vt52 $ call make vt520 $ call make vms_io $ call make xterm $ $ link /exec=VTTEST/map/cross main.obj, vms_link/opt $ goto build_last $ $ install : $ WRITE SYS$ERROR "** no rule for install" $ goto build_last $ $ clean : $ if f$search("*.obj") .nes. "" then delete *.obj;* $ if f$search("*.bak") .nes. "" then delete *.bak;* $ if f$search("*.lis") .nes. "" then delete *.lis;* $ if f$search("*.log") .nes. "" then delete *.log;* $ if f$search("*.map") .nes. "" then delete *.map;* $ if f$search("*.opt") .nes. "" then delete *.opt;* $ goto build_last $ $ clobber : $ if f$search("vttest.com") .nes. "" then delete vttest.com;* $ if f$search("*.exe") .nes. "" then delete *.exe;* $ goto build_last $ $ build_last : $ if f$search("*.dia") .nes. "" then delete *.dia;* $ if f$search("*.lis") .nes. "" then purge *.lis $ if f$search("*.obj") .nes. "" then purge *.obj $ if f$search("*.map") .nes. "" then purge *.map $ if f$search("*.opt") .nes. "" then purge *.opt $ if f$search("*.exe") .nes. "" then purge *.exe $ if f$search("*.log") .nes. "" then purge *.log $ exit $ $ vms_link_opt : $ exit 1 $! $! Runs VTTEST from the current directory (used for testing) $ vttest_com : $ if "''f$search("vttest.com")'" .nes. "" then delete vttest.com;* $ copy nl: vttest.com $ open/append test_script vttest.com $ write test_script "$ temp = f$environment(""procedure"")" $ write test_script "$ temp = temp -" $ write test_script " - f$parse(temp,,,""version"",""syntax_only"") -" $ write test_script " - f$parse(temp,,,""type"",""syntax_only"")" $ write test_script "$ vttest :== $ 'temp'.exe" $ write test_script "$ define/user_mode sys$input sys$command" $ write test_script "$ define/user_mode sys$output sys$command" $ write test_script "$ vttest 'p1 'p2 'p3 'p4 'p5 'p6 'p7 'p8" $ close test_script $ write sys$output "** made vttest.com" $ exit $! $! We have MMS installed $ else $ mms/macro=('comp','arch') 'p1 $ endif $ exit $ $ make: subroutine $ if f$search("''p1'.obj") .eqs. "" $ then $ write sys$output "compiling ''p1'" $ 'CC 'CFLAGS 'p1.c $ if f$search("''p1'.dia") .nes. "" then delete 'p1.dia;* $ endif $ exit $ endsubroutine vttest-20140116/config.sub0000755000175100001440000010541212232422400013777 0ustar tomusers#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2013 Free Software Foundation, Inc. timestamp='2013-10-01' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches with a ChangeLog entry to config-patches@gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 \ | or1k | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i686-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i686-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; c8051-*) os=-elf ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or1k-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: vttest-20140116/sixel.c0000644000175100001440000001616111667370543013333 0ustar tomusers/* $Id: sixel.c,v 1.14 2011/12/06 10:41:39 tom Exp $ */ #include #include #include #define is_inter(c) ((c) >= 0x20 && ((c) <= 0x2f)) #define is_final(c) ((c) >= 0x30 && ((c) <= 0x7e)) #define L_CURL '{' #define MAX_WIDTH 10 static char empty[1]; static const char *EraseCtl = ""; static const char *FontName = ""; static char *StartingCharPtr = empty; static const char *TextCell = ""; static const char *WidthAttr = ""; static char *font_string = empty; static int FontNumber; static int MatrixHigh; static int MatrixWide; static int StartingCharNum; /* * Lookup the given character 'chr' in the font-string and write a readable * display of the glyph */ static void decode_header(void) { int Pe, Pcms, Pw, Pt; char *s; switch (sscanf(font_string + 2, "%d;%d;%d;%d;%d;%d", &FontNumber, &StartingCharNum, &Pe, &Pcms, &Pw, &Pt)) { case 0: FontNumber = 0; /* FALLTHRU */ case 1: StartingCharNum = 0; /* FALLTHRU */ case 2: Pe = 0; /* FALLTHRU */ case 3: Pcms = 0; /* FALLTHRU */ case 4: Pw = 0; /* FALLTHRU */ case 5: Pt = 0; /* FALLTHRU */ case 6: break; } switch (Pcms) { case 1: MatrixWide = 0; MatrixHigh = 0; break; /* illegal */ case 2: MatrixWide = 5; MatrixHigh = 10; break; case 3: MatrixWide = 6; MatrixHigh = 10; break; case 0: case 4: MatrixWide = 7; MatrixHigh = 10; break; default: MatrixWide = Pcms; MatrixHigh = 10; break; /* 5 thru 10 */ } switch (Pe) { case 0: EraseCtl = "this DRCS set"; break; case 1: EraseCtl = "only reloaded chars"; break; case 2: EraseCtl = "all chars in all DRCS sets"; break; default: EraseCtl = "?"; break; } switch (Pw) { case 0: /* FALLTHRU */ case 1: WidthAttr = "80 cols, 24 lines"; break; case 2: WidthAttr = "132 cols, 24 lines"; break; case 11: WidthAttr = "80 cols, 36 lines"; break; case 12: WidthAttr = "132 cols, 36 lines"; break; case 21: WidthAttr = "80 cols, 24 lines"; break; case 22: WidthAttr = "132 cols, 48 lines"; break; default: WidthAttr = "?"; break; } if (Pt == 2) TextCell = "Full Cell"; else TextCell = "Text"; for (s = font_string; *s; s++) { if (*s == L_CURL) { char *t; char tmp[BUFSIZ]; size_t use = 0; for (t = s + 1; *t; t++) { if (is_inter(*t)) { tmp[use++] = *t; } if (is_final(*t)) { tmp[use++] = *t++; tmp[use] = '\0'; FontName = strcpy((char *) malloc(use + 1), tmp); StartingCharPtr = t; break; } } break; } } } static char * find_char(int chr) { char *s = StartingCharPtr; chr -= (' ' + StartingCharNum); if (chr < 0) return 0; while (chr > 0) { do { if (*s == '\0') return 0; } while (*s++ != ';'); chr--; } return s; } static void display_head(FILE *fp) { fprintf(fp, "Font %d:%s, Matrix %dx%d (%s, %s)\n", FontNumber, FontName, MatrixWide, MatrixHigh, WidthAttr, TextCell); fprintf(fp, "Start %d, Erase %s\n", StartingCharNum, EraseCtl); } static int display_char(FILE *fp, int chr) { char *s; int bit, n, high; char bits[6][MAX_WIDTH]; s = find_char(chr); if (s != 0) { fprintf(fp, "Glyph '%c'\n", chr); bit = 0; high = 0; do { if (*s >= '?' && *s <= '~') { for (n = 0; n < 6; n++) bits[n][bit] = (char) (((*s - '?') & 1 << n) ? 'O' : '.'); bit++; } else if ((*s == ';' || *s == '/') && bit) { for (n = 0; (n < 6) && (high++ < MatrixHigh); n++) { bits[n][bit] = '\0'; fprintf(fp, "%s\n", bits[n]); } bit = 0; } } while (*s++ != ';'); return TRUE; } return FALSE; } static int tst_DECDLD(MENU_ARGS) { char *s; vt_move(1, 1); printf("Working...\n"); for (s = font_string; *s; s++) { putchar(*s); if (*s == '\n') { fflush(stdout); padding(20); } } fflush(stdout); padding(20); printf("...done "); printf("%c*%s", ESC, FontName); /* designate G2 as the DRCS font */ padding(4); fflush(stdout); return MENU_HOLD; } static int tst_display(MENU_ARGS) { int d, c = -1; vt_move(1, 1); display_head(stdout); println(""); println("Press any key to display its soft-character. Repeat a key to quit."); set_tty_raw(TRUE); set_tty_echo(FALSE); do { d = c; c = inchar(); vt_move(6, 1); vt_clear(0); if (display_char(stdout, c)) { println(""); printf("Render: %cN%c", ESC, c); /* use SS2 to invoke G2 into GL */ } } while (c != d); restore_ttymodes(); return MENU_NOHOLD; } /* * Remove all characters in all DRCS sets (the " @" is a dummy name) */ static int tst_cleanup(MENU_ARGS) { do_dcs("1;1;2%c @", L_CURL); padding(20); return MENU_NOHOLD; } /* * Read a soft-character definition string from a file. Strip off garbage * at the beginning (to accommodate the "font2xx" output format). */ void setup_softchars(const char *filename) { FILE *fp; int c; size_t len = 1024; size_t use = 0; char *buffer = (char *) malloc(len); char *s; char *first = 0; char *last = 0; int save_8bits = input_8bits; input_8bits = FALSE; /* use the 7-bit input-parsing */ /* read the file into memory */ if ((fp = fopen(filename, "r")) == 0) { perror(filename); exit(EXIT_FAILURE); } while ((c = fgetc(fp)) != EOF) { if (use + 1 >= len) { buffer = (char *) realloc(buffer, len *= 2); } buffer[use++] = (char) c; } buffer[use] = '\0'; fclose(fp); /* find the DCS that begins the control string */ /* and the ST that ends the control string */ for (s = buffer; *s; s++) { if (first == 0) { if (skip_dcs(s) != 0) first = s; } else { if (!strncmp(s, st_input(), (size_t) 2)) { last = s + 2; *last = '\0'; break; } } } input_8bits = save_8bits; if (first == 0 || last == 0) { fprintf(stderr, "Not a vtXXX font description: %s\n", filename); exit(EXIT_FAILURE); } for (s = buffer; (*s++ = *first++) != '\0';) ; if (LOG_ENABLED && first != 0) fprintf(log_fp, "Font String:\n%s\n", buffer); font_string = buffer; decode_header(); } int tst_softchars(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Download the soft characters (DECDLD)", tst_DECDLD }, { "Examine the soft characters", tst_display }, { "Clear the soft characters", tst_cleanup }, { "", 0 } }; /* *INDENT-ON* */ vt_move(1, 1); if (font_string == 0 || *font_string == 0) { printf("You did not specify a font-file with the -f option\n"); return MENU_HOLD; } do { vt_clear(2); __(title(0), printf("Soft Character Sets")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } vttest-20140116/configure0000755000175100001440000045710312266040773013752 0ustar tomusers#! /bin/sh # From configure.in Revision: 1.23 . # Guess values for system-dependent variables and create Makefiles. # Generated by Autoconf 2.52.20121002. # # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # 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 # Sed expression to map a string onto a valid variable name. as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Name of the executable. as_me=`echo "$0" |sed 's,.*[\\/],,'` if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file as_executable_p="test -f" # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # NLS nuisances. $as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } $as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } $as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } $as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} ac_unique_file="esc.c" # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${datarootdir}/info' mandir='${datarootdir}/man' # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -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_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. build=$build_alias host=$host_alias target=$target_alias # FIXME: should be removed in autoconf 3.0. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_prog=$0 ac_confdir=`echo "$ac_prog" | sed 's%[\\/][^\\/][^\\/]*$%%'` test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat < if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. EOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_subdir in : $ac_subdirs_all; do test "x$ac_subdir" = x: && continue cd $ac_subdir # A "../" for each directory in /$ac_subdir. ac_dots=`echo $ac_subdir | sed 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g'` case $srcdir in .) # No --srcdir option. We are building in place. ac_sub_srcdir=$srcdir ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_sub_srcdir=$srcdir/$ac_subdir ;; *) # Relative path. ac_sub_srcdir=$ac_dots$srcdir/$ac_subdir ;; esac # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_sub_srcdir/configure.gnu; then echo $SHELL $ac_sub_srcdir/configure.gnu --help=recursive elif test -f $ac_sub_srcdir/configure; then echo $SHELL $ac_sub_srcdir/configure --help=recursive elif test -f $ac_sub_srcdir/configure.ac || test -f $ac_sub_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_subdir" >&2 fi cd $ac_popdir done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\EOF Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. EOF exit 0 fi exec 5>config.log cat >&5 </dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` PATH = $PATH _ASUNAME } >&5 cat >&5 <\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" ac_sep=" " ;; *) ac_configure_args="$ac_configure_args$ac_sep$ac_arg" ac_sep=" " ;; esac # Get rid of the leading space. done # 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. trap 'exit_status=$? # Save into config.log some information that might help in debugging. echo >&5 echo "## ----------------- ##" >&5 echo "## Cache variables. ##" >&5 echo "## ----------------- ##" >&5 echo >&5 # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } >&5 sed "/^$/d" confdefs.h >conftest.log if test -s conftest.log; then echo >&5 echo "## ------------ ##" >&5 echo "## confdefs.h. ##" >&5 echo "## ------------ ##" >&5 echo >&5 cat conftest.log >&5 fi (echo; echo) >&5 test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" >&5 echo "$as_me: exit $exit_status" >&5 rm -rf conftest* confdefs* core core.* *.core conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:849: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} cat "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:860: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:868: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:884: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:888: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:894: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:896: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:898: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. It doesn't matter if # we pass some twice (in addition to the command line arguments). if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ac_configure_args="$ac_configure_args '$ac_arg'" ;; *) ac_configure_args="$ac_configure_args $ac_var=$ac_new_val" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:917: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:919: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_main_return=return case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac echo "#! $SHELL" >conftest.sh echo "exit 0" >>conftest.sh chmod +x conftest.sh if { (echo "$as_me:940: PATH=\".;.\"; conftest.sh") >&5 (PATH=".;."; conftest.sh) 2>&5 ac_status=$? echo "$as_me:943: \$? = $ac_status" >&5 (exit $ac_status); }; then ac_path_separator=';' else ac_path_separator=: fi PATH_SEPARATOR="$ac_path_separator" rm -f conftest.sh ac_config_headers="$ac_config_headers config.h:config.hin" ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:971: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || { { echo "$as_me:981: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_config_sub" >&2;} { (exit 1); exit 1; }; } echo "$as_me:985: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6 if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_build_alias=$build_alias test -z "$ac_cv_build_alias" && ac_cv_build_alias=`$ac_config_guess` test -z "$ac_cv_build_alias" && { { echo "$as_me:994: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || { { echo "$as_me:998: error: $ac_config_sub $ac_cv_build_alias failed." >&5 echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed." >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:1003: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6 build=$ac_cv_build build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then echo "$as_me:1011: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6 if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_host_alias=$host_alias test -z "$ac_cv_host_alias" && ac_cv_host_alias=$ac_cv_build_alias ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || { { echo "$as_me:1020: error: $ac_config_sub $ac_cv_host_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:1025: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6 host=$ac_cv_host host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` system_name="$host_os" else system_name="`(uname -s -r) 2>/dev/null`" if test -z "$system_name" ; then system_name="`(hostname) 2>/dev/null`" fi fi test -n "$system_name" && cat >>confdefs.h <&6 else cf_cv_system_name="$system_name" fi test -z "$system_name" && system_name="$cf_cv_system_name" test -n "$cf_cv_system_name" && echo "$as_me:1051: result: Configuring for $cf_cv_system_name" >&5 echo "${ECHO_T}Configuring for $cf_cv_system_name" >&6 if test ".$system_name" != ".$cf_cv_system_name" ; then echo "$as_me:1055: result: Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&5 echo "${ECHO_T}Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&6 { { echo "$as_me:1057: error: \"Please remove config.cache and try again.\"" >&5 echo "$as_me: error: \"Please remove config.cache and try again.\"" >&2;} { (exit 1); exit 1; }; } fi test "$program_prefix" != NONE && program_transform_name="s,^,$program_prefix,;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s,\$,$program_suffix,;$program_transform_name" # Double any \ or $. echo might interpret backslashes. # By default was `s,x,x', remove it if useless. cat <<\_ACEOF >conftest.sed s/[\\$]/&&/g;s/;s,x,x,$// _ACEOF program_transform_name=`echo $program_transform_name | sed -f conftest.sed` rm conftest.sed ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_main_return=return if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:1084: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:1099: found $ac_dir/$ac_word" >&5 break done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:1107: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:1110: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:1119: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:1134: found $ac_dir/$ac_word" >&5 break done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:1142: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:1145: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:1158: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:1173: found $ac_dir/$ac_word" >&5 break done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:1181: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:1184: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:1193: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="cc" echo "$as_me:1208: found $ac_dir/$ac_word" >&5 break done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:1216: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:1219: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:1232: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:1252: found $ac_dir/$ac_word" >&5 break done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift set dummy "$ac_dir/$ac_word" ${1+"$@"} shift ac_cv_prog_CC="$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:1274: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:1277: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:1288: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:1303: found $ac_dir/$ac_word" >&5 break done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:1311: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:1314: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:1327: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:1342: found $ac_dir/$ac_word" >&5 break done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:1350: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:1353: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:1365: error: no acceptable cc found in \$PATH" >&5 echo "$as_me: error: no acceptable cc found in \$PATH" >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:1370:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:1373: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:1376: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:1378: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:1381: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:1383: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:1386: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF #line 1390 "configure" #include "confdefs.h" int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:1406: checking for C compiler default output" >&5 echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:1409: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:1412: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. for ac_file in `ls a.exe conftest.exe 2>/dev/null; ls a.out conftest 2>/dev/null; ls a.* conftest.* 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.dbg | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; a.out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 { { echo "$as_me:1435: error: C compiler cannot create executables" >&5 echo "$as_me: error: C compiler cannot create executables" >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:1441: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:1446: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:1452: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1455: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:1462: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:1470: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:1477: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:1479: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:1482: checking for executable suffix" >&5 echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6 if { (eval echo "$as_me:1484: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:1487: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.dbg | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:1503: error: cannot compute EXEEXT: cannot compile and link" >&5 echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:1509: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:1515: checking for object suffix" >&5 echo $ECHO_N "checking for object suffix... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 1521 "configure" #include "confdefs.h" int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:1533: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1536: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.dbg | *.pdb | *.xSYM | *.map | *.inf ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 { { echo "$as_me:1548: error: cannot compute OBJEXT: cannot compile" >&5 echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:1555: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:1559: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 1565 "configure" #include "confdefs.h" int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:1580: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1583: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:1586: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1589: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:1601: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:1607: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 1613 "configure" #include "confdefs.h" int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:1625: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1628: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:1631: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1634: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:1644: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:1671: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1674: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:1677: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1680: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ ''\ '#include ' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF #line 1692 "configure" #include "confdefs.h" #include $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:1705: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1708: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:1711: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1714: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 continue fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF #line 1724 "configure" #include "confdefs.h" $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:1736: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1739: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:1742: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1745: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext done rm -rf conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_main_return=return GCC_VERSION=none if test "$GCC" = yes ; then echo "$as_me:1775: checking version of $CC" >&5 echo $ECHO_N "checking version of $CC... $ECHO_C" >&6 GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC[^)]*) //' -e 's/^.*(Debian[^)]*) //' -e 's/^[^0-9.]*//' -e 's/[^0-9.].*//'`" test -z "$GCC_VERSION" && GCC_VERSION=unknown echo "$as_me:1779: result: $GCC_VERSION" >&5 echo "${ECHO_T}$GCC_VERSION" >&6 fi echo "$as_me:1783: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF #line 1791 "configure" #include "confdefs.h" #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:1840: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1843: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:1846: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1849: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:1866: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:1869: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # This should have been defined by AC_PROG_CC : ${CC:=cc} echo "$as_me:1877: checking \$CC variable" >&5 echo $ECHO_N "checking \$CC variable... $ECHO_C" >&6 case "$CC" in #(vi *[\ \ ]-[IUD]*) echo "$as_me:1881: result: broken" >&5 echo "${ECHO_T}broken" >&6 { echo "$as_me:1883: WARNING: your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options" >&5 echo "$as_me: WARNING: your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options" >&2;} # humor him... cf_flags=`echo "$CC" | sed -e 's/^[^ ]*[ ]//'` CC=`echo "$CC" | sed -e 's/[ ].*//'` cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in $cf_flags do case $cf_fix_cppflags in no) case $cf_add_cflags in #(vi -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi case $cf_add_cflags in -D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "${cf_add_cflags}" != "${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test $cf_fix_cppflags = yes ; then cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in *$cf_add_cflags) #(vi ;; *) #(vi case $cf_add_cflags in #(vi -D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` ;; esac cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" ;; esac ;; *) cf_new_cflags="$cf_new_cflags $cf_add_cflags" ;; esac ;; yes) cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` test "${cf_add_cflags}" != "${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then CFLAGS="$CFLAGS $cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then CPPFLAGS="$CPPFLAGS $cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" fi ;; *) echo "$as_me:1969: result: ok" >&5 echo "${ECHO_T}ok" >&6 ;; esac INTEL_COMPILER=no if test "$" = yes ; then case $host_os in linux*|gnu*) echo "$as_me:1979: checking if this is really Intel C compiler" >&5 echo $ECHO_N "checking if this is really Intel C compiler... $ECHO_C" >&6 cf_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -no-gcc" cat >conftest.$ac_ext <<_ACEOF #line 1984 "configure" #include "confdefs.h" int main () { #ifdef __INTEL_COMPILER #else make an error #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:2001: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2004: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:2007: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2010: \$? = $ac_status" >&5 (exit $ac_status); }; }; then INTEL_COMPILER=yes cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc" else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext CFLAGS="$cf_save_CFLAGS" echo "$as_me:2021: result: $INTEL_COMPILER" >&5 echo "${ECHO_T}$INTEL_COMPILER" >&6 ;; esac fi # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:2039: checking for a BSD compatible install" >&5 echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_IFS=$IFS; IFS=$ac_path_separator for ac_dir in $PATH; do IFS=$ac_save_IFS # Account for people who put trailing slashes in PATH elements. case $ac_dir/ in / | ./ | .// | /cC/* \ | /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* \ | /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do if $as_executable_p "$ac_dir/$ac_prog"; then if test $ac_prog = install && grep dspmsg "$ac_dir/$ac_prog" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$ac_dir/$ac_prog" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$ac_dir/$ac_prog -c" break 2 fi fi done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:2088: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo "$as_me:2099: checking if filesystem supports mixed-case filenames" >&5 echo $ECHO_N "checking if filesystem supports mixed-case filenames... $ECHO_C" >&6 if test "${cf_cv_mixedcase+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes ; then case $target_alias in #(vi *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*) #(vi cf_cv_mixedcase=no ;; *) cf_cv_mixedcase=yes ;; esac else rm -f conftest CONFTEST echo test >conftest if test -f CONFTEST ; then cf_cv_mixedcase=no else cf_cv_mixedcase=yes fi rm -f conftest CONFTEST fi fi echo "$as_me:2126: result: $cf_cv_mixedcase" >&5 echo "${ECHO_T}$cf_cv_mixedcase" >&6 test "$cf_cv_mixedcase" = yes && cat >>confdefs.h <<\EOF #define MIXEDCASE_FILENAMES 1 EOF for ac_prog in exctags ctags do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:2137: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CTAGS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CTAGS"; then ac_cv_prog_CTAGS="$CTAGS" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CTAGS="$ac_prog" echo "$as_me:2152: found $ac_dir/$ac_word" >&5 break done fi fi CTAGS=$ac_cv_prog_CTAGS if test -n "$CTAGS"; then echo "$as_me:2160: result: $CTAGS" >&5 echo "${ECHO_T}$CTAGS" >&6 else echo "$as_me:2163: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CTAGS" && break done for ac_prog in exetags etags do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:2174: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ETAGS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ETAGS"; then ac_cv_prog_ETAGS="$ETAGS" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ETAGS="$ac_prog" echo "$as_me:2189: found $ac_dir/$ac_word" >&5 break done fi fi ETAGS=$ac_cv_prog_ETAGS if test -n "$ETAGS"; then echo "$as_me:2197: result: $ETAGS" >&5 echo "${ECHO_T}$ETAGS" >&6 else echo "$as_me:2200: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ETAGS" && break done # Extract the first word of "${CTAGS:-ctags}", so it can be a program name with args. set dummy ${CTAGS:-ctags}; ac_word=$2 echo "$as_me:2209: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_MAKE_LOWER_TAGS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$MAKE_LOWER_TAGS"; then ac_cv_prog_MAKE_LOWER_TAGS="$MAKE_LOWER_TAGS" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_MAKE_LOWER_TAGS="yes" echo "$as_me:2224: found $ac_dir/$ac_word" >&5 break done test -z "$ac_cv_prog_MAKE_LOWER_TAGS" && ac_cv_prog_MAKE_LOWER_TAGS="no" fi fi MAKE_LOWER_TAGS=$ac_cv_prog_MAKE_LOWER_TAGS if test -n "$MAKE_LOWER_TAGS"; then echo "$as_me:2233: result: $MAKE_LOWER_TAGS" >&5 echo "${ECHO_T}$MAKE_LOWER_TAGS" >&6 else echo "$as_me:2236: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "$cf_cv_mixedcase" = yes ; then # Extract the first word of "${ETAGS:-etags}", so it can be a program name with args. set dummy ${ETAGS:-etags}; ac_word=$2 echo "$as_me:2243: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_MAKE_UPPER_TAGS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$MAKE_UPPER_TAGS"; then ac_cv_prog_MAKE_UPPER_TAGS="$MAKE_UPPER_TAGS" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_MAKE_UPPER_TAGS="yes" echo "$as_me:2258: found $ac_dir/$ac_word" >&5 break done test -z "$ac_cv_prog_MAKE_UPPER_TAGS" && ac_cv_prog_MAKE_UPPER_TAGS="no" fi fi MAKE_UPPER_TAGS=$ac_cv_prog_MAKE_UPPER_TAGS if test -n "$MAKE_UPPER_TAGS"; then echo "$as_me:2267: result: $MAKE_UPPER_TAGS" >&5 echo "${ECHO_T}$MAKE_UPPER_TAGS" >&6 else echo "$as_me:2270: result: no" >&5 echo "${ECHO_T}no" >&6 fi else MAKE_UPPER_TAGS=no fi if test "$MAKE_UPPER_TAGS" = yes ; then MAKE_UPPER_TAGS= else MAKE_UPPER_TAGS="#" fi if test "$MAKE_LOWER_TAGS" = yes ; then MAKE_LOWER_TAGS= else MAKE_LOWER_TAGS="#" fi for ac_prog in lint alint splint lclint do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:2294: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_LINT+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$LINT"; then ac_cv_prog_LINT="$LINT" # Let the user override the test. else ac_save_IFS=$IFS; IFS=$ac_path_separator ac_dummy="$PATH" for ac_dir in $ac_dummy; do IFS=$ac_save_IFS test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_LINT="$ac_prog" echo "$as_me:2309: found $ac_dir/$ac_word" >&5 break done fi fi LINT=$ac_cv_prog_LINT if test -n "$LINT"; then echo "$as_me:2317: result: $LINT" >&5 echo "${ECHO_T}$LINT" >&6 else echo "$as_me:2320: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$LINT" && break done echo "$as_me:2327: checking if you want to see long compiling messages" >&5 echo $ECHO_N "checking if you want to see long compiling messages... $ECHO_C" >&6 # Check whether --enable-echo or --disable-echo was given. if test "${enable_echo+set}" = set; then enableval="$enable_echo" test "$enableval" != no && enableval=yes if test "$enableval" != "yes" ; then ECHO_LT='--silent' ECHO_LD='@echo linking $@;' RULE_CC='@echo compiling $<' SHOW_CC='@echo compiling $@' ECHO_CC='@' else ECHO_LT='' ECHO_LD='' RULE_CC='' SHOW_CC='' ECHO_CC='' fi else enableval=yes ECHO_LT='' ECHO_LD='' RULE_CC='' SHOW_CC='' ECHO_CC='' fi; echo "$as_me:2361: result: $enableval" >&5 echo "${ECHO_T}$enableval" >&6 if ( test "$GCC" = yes || test "$GXX" = yes ) then echo "$as_me:2366: checking if you want to check for gcc warnings" >&5 echo $ECHO_N "checking if you want to check for gcc warnings... $ECHO_C" >&6 # Check whether --with-warnings or --without-warnings was given. if test "${with_warnings+set}" = set; then withval="$with_warnings" cf_opt_with_warnings=$withval else cf_opt_with_warnings=no fi; echo "$as_me:2376: result: $cf_opt_with_warnings" >&5 echo "${ECHO_T}$cf_opt_with_warnings" >&6 if test "$cf_opt_with_warnings" != no ; then if test "$GCC" = yes then cat > conftest.i <&5 echo "$as_me: checking for $CC __attribute__ directives..." >&6;} cat > conftest.$ac_ext <&5 case $cf_attribute in #(vi printf) #(vi cf_printf_attribute=yes cat >conftest.h <conftest.h <conftest.h <&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2453: \$? = $ac_status" >&5 (exit $ac_status); }; then test -n "$verbose" && echo "$as_me:2455: result: ... $cf_attribute" >&5 echo "${ECHO_T}... $cf_attribute" >&6 cat conftest.h >>confdefs.h case $cf_attribute in #(vi noreturn) #(vi cat >>confdefs.h <>confdefs.h <<\EOF #define GCC_PRINTF 1 EOF fi cat >>confdefs.h <>confdefs.h <<\EOF #define GCC_SCANF 1 EOF fi cat >>confdefs.h <>confdefs.h <>confdefs.h fi rm -rf conftest* fi INTEL_COMPILER=no if test "$GCC" = yes ; then case $host_os in linux*|gnu*) echo "$as_me:2519: checking if this is really Intel C compiler" >&5 echo $ECHO_N "checking if this is really Intel C compiler... $ECHO_C" >&6 cf_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -no-gcc" cat >conftest.$ac_ext <<_ACEOF #line 2524 "configure" #include "confdefs.h" int main () { #ifdef __INTEL_COMPILER #else make an error #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:2541: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2544: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:2547: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2550: \$? = $ac_status" >&5 (exit $ac_status); }; }; then INTEL_COMPILER=yes cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc" else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext CFLAGS="$cf_save_CFLAGS" echo "$as_me:2561: result: $INTEL_COMPILER" >&5 echo "${ECHO_T}$INTEL_COMPILER" >&6 ;; esac fi CLANG_COMPILER=no if test "$GCC" = yes ; then echo "$as_me:2570: checking if this is really Clang C compiler" >&5 echo $ECHO_N "checking if this is really Clang C compiler... $ECHO_C" >&6 cf_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Qunused-arguments" cat >conftest.$ac_ext <<_ACEOF #line 2575 "configure" #include "confdefs.h" int main () { #ifdef __clang__ #else make an error #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:2592: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2595: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:2598: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2601: \$? = $ac_status" >&5 (exit $ac_status); }; }; then CLANG_COMPILER=yes cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments" else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext CFLAGS="$cf_save_CFLAGS" echo "$as_me:2612: result: $CLANG_COMPILER" >&5 echo "${ECHO_T}$CLANG_COMPILER" >&6 fi cat > conftest.$ac_ext <&5 echo "$as_me: checking for $CC warning options..." >&6;} cf_save_CFLAGS="$CFLAGS" EXTRA_CFLAGS="-Wall" for cf_opt in \ wd1419 \ wd1683 \ wd1684 \ wd193 \ wd593 \ wd279 \ wd810 \ wd869 \ wd981 do CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" if { (eval echo "$as_me:2650: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2653: \$? = $ac_status" >&5 (exit $ac_status); }; then test -n "$verbose" && echo "$as_me:2655: result: ... -$cf_opt" >&5 echo "${ECHO_T}... -$cf_opt" >&6 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" fi done CFLAGS="$cf_save_CFLAGS" elif test "$GCC" = yes then { echo "$as_me:2664: checking for $CC warning options..." >&5 echo "$as_me: checking for $CC warning options..." >&6;} cf_save_CFLAGS="$CFLAGS" EXTRA_CFLAGS= cf_warn_CONST="" test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" cf_gcc_warnings="Wignored-qualifiers Wlogical-op Wvarargs" test "x$CLANG_COMPILER" = xyes && cf_gcc_warnings= for cf_opt in W Wall \ Wbad-function-cast \ Wcast-align \ Wcast-qual \ Wdeclaration-after-statement \ Wextra \ Winline \ Wmissing-declarations \ Wmissing-prototypes \ Wnested-externs \ Wpointer-arith \ Wshadow \ Wstrict-prototypes \ Wundef $cf_gcc_warnings $cf_warn_CONST do CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" if { (eval echo "$as_me:2688: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2691: \$? = $ac_status" >&5 (exit $ac_status); }; then test -n "$verbose" && echo "$as_me:2693: result: ... -$cf_opt" >&5 echo "${ECHO_T}... -$cf_opt" >&6 case $cf_opt in #(vi Wcast-qual) #(vi CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES" ;; Winline) #(vi case $GCC_VERSION in [34].*) test -n "$verbose" && echo " feature is broken in gcc $GCC_VERSION" 1>&6 echo "${as_me:-configure}:2704: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 continue;; esac ;; Wpointer-arith) #(vi case $GCC_VERSION in [12].*) test -n "$verbose" && echo " feature is broken in gcc $GCC_VERSION" 1>&6 echo "${as_me:-configure}:2714: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 continue;; esac ;; esac EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" fi done CFLAGS="$cf_save_CFLAGS" fi rm -rf conftest* fi fi cf_XOPEN_SOURCE=500 cf_POSIX_C_SOURCE=199506L cf_xopen_source= case $host_os in #(vi aix[4-7]*) #(vi cf_xopen_source="-D_ALL_SOURCE" ;; cygwin|msys) #(vi cf_XOPEN_SOURCE=600 ;; darwin[0-8].*) #(vi cf_xopen_source="-D_APPLE_C_SOURCE" ;; darwin*) #(vi cf_xopen_source="-D_DARWIN_C_SOURCE" cf_XOPEN_SOURCE= ;; freebsd*|dragonfly*) #(vi # 5.x headers associate # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L cf_POSIX_C_SOURCE=200112L cf_XOPEN_SOURCE=600 cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" ;; hpux11*) #(vi cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500" ;; hpux*) #(vi cf_xopen_source="-D_HPUX_SOURCE" ;; irix[56].*) #(vi cf_xopen_source="-D_SGI_SOURCE" cf_XOPEN_SOURCE= ;; linux*|gnu*|mint*|k*bsd*-gnu) #(vi echo "$as_me:2768: checking if we must define _GNU_SOURCE" >&5 echo $ECHO_N "checking if we must define _GNU_SOURCE... $ECHO_C" >&6 if test "${cf_cv_gnu_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 2775 "configure" #include "confdefs.h" #include int main () { #ifndef _XOPEN_SOURCE make an error #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:2790: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2793: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:2796: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2799: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_gnu_source=no else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 cf_save="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" cat >conftest.$ac_ext <<_ACEOF #line 2808 "configure" #include "confdefs.h" #include int main () { #ifdef _XOPEN_SOURCE make an error #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:2823: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2826: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:2829: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2832: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_gnu_source=no else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 cf_cv_gnu_source=yes fi rm -f conftest.$ac_objext conftest.$ac_ext CPPFLAGS="$cf_save" fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:2847: result: $cf_cv_gnu_source" >&5 echo "${ECHO_T}$cf_cv_gnu_source" >&6 test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" ;; mirbsd*) #(vi # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks and other headers which use u_int / u_short types cf_XOPEN_SOURCE= cf_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE cf_save_CFLAGS="$CFLAGS" cf_save_CPPFLAGS="$CPPFLAGS" cf_trim_CFLAGS=`echo "$cf_save_CFLAGS" | \ sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` cf_trim_CPPFLAGS=`echo "$cf_save_CPPFLAGS" | \ sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` echo "$as_me:2869: checking if we should define _POSIX_C_SOURCE" >&5 echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6 if test "${cf_cv_posix_c_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else echo "${as_me:-configure}:2875: testing if the symbol is already defined go no further ..." 1>&5 cat >conftest.$ac_ext <<_ACEOF #line 2878 "configure" #include "confdefs.h" #include int main () { #ifndef _POSIX_C_SOURCE make an error #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:2893: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2896: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:2899: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2902: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_posix_c_source=no else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 cf_want_posix_source=no case .$cf_POSIX_C_SOURCE in #(vi .[12]??*) #(vi cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" ;; .2) #(vi cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" cf_want_posix_source=yes ;; .*) cf_want_posix_source=yes ;; esac if test "$cf_want_posix_source" = yes ; then cat >conftest.$ac_ext <<_ACEOF #line 2923 "configure" #include "confdefs.h" #include int main () { #ifdef _POSIX_SOURCE make an error #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:2938: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2941: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:2944: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2947: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE" fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "${as_me:-configure}:2958: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 CFLAGS="$cf_trim_CFLAGS" CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" echo "${as_me:-configure}:2963: testing if the second compile does not leave our definition intact error ..." 1>&5 cat >conftest.$ac_ext <<_ACEOF #line 2966 "configure" #include "confdefs.h" #include int main () { #ifndef _POSIX_C_SOURCE make an error #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:2981: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2984: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:2987: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2990: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 cf_cv_posix_c_source=no fi rm -f conftest.$ac_objext conftest.$ac_ext CFLAGS="$cf_save_CFLAGS" CPPFLAGS="$cf_save_CPPFLAGS" fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:3006: result: $cf_cv_posix_c_source" >&5 echo "${ECHO_T}$cf_cv_posix_c_source" >&6 if test "$cf_cv_posix_c_source" != no ; then CFLAGS="$cf_trim_CFLAGS" CPPFLAGS="$cf_trim_CPPFLAGS" cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in $cf_cv_posix_c_source do case $cf_fix_cppflags in no) case $cf_add_cflags in #(vi -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi case $cf_add_cflags in -D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "${cf_add_cflags}" != "${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test $cf_fix_cppflags = yes ; then cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in *$cf_add_cflags) #(vi ;; *) #(vi case $cf_add_cflags in #(vi -D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` ;; esac cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" ;; esac ;; *) cf_new_cflags="$cf_new_cflags $cf_add_cflags" ;; esac ;; yes) cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` test "${cf_add_cflags}" != "${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then CFLAGS="$CFLAGS $cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then CPPFLAGS="$CPPFLAGS $cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" fi fi ;; netbsd*) #(vi cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw ;; openbsd[4-9]*) #(vi # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw cf_xopen_source="-D_BSD_SOURCE" cf_XOPEN_SOURCE=600 ;; openbsd*) #(vi # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw ;; osf[45]*) #(vi cf_xopen_source="-D_OSF_SOURCE" ;; nto-qnx*) #(vi cf_xopen_source="-D_QNX_SOURCE" ;; sco*) #(vi # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer ;; solaris2.*) #(vi cf_xopen_source="-D__EXTENSIONS__" ;; *) echo "$as_me:3119: checking if we should define _XOPEN_SOURCE" >&5 echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6 if test "${cf_cv_xopen_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 3126 "configure" #include "confdefs.h" #include #include #include int main () { #ifndef _XOPEN_SOURCE make an error #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:3145: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:3148: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:3151: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3154: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_xopen_source=no else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 cf_save="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" cat >conftest.$ac_ext <<_ACEOF #line 3163 "configure" #include "confdefs.h" #include #include #include int main () { #ifdef _XOPEN_SOURCE make an error #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:3182: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:3185: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:3188: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3191: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_xopen_source=no else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 cf_cv_xopen_source=$cf_XOPEN_SOURCE fi rm -f conftest.$ac_objext conftest.$ac_ext CPPFLAGS="$cf_save" fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:3206: result: $cf_cv_xopen_source" >&5 echo "${ECHO_T}$cf_cv_xopen_source" >&6 if test "$cf_cv_xopen_source" != no ; then CFLAGS=`echo "$CFLAGS" | \ sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` CPPFLAGS=`echo "$CPPFLAGS" | \ sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in $cf_temp_xopen_source do case $cf_fix_cppflags in no) case $cf_add_cflags in #(vi -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi case $cf_add_cflags in -D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "${cf_add_cflags}" != "${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test $cf_fix_cppflags = yes ; then cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in *$cf_add_cflags) #(vi ;; *) #(vi case $cf_add_cflags in #(vi -D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` ;; esac cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" ;; esac ;; *) cf_new_cflags="$cf_new_cflags $cf_add_cflags" ;; esac ;; yes) cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` test "${cf_add_cflags}" != "${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then CFLAGS="$CFLAGS $cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then CPPFLAGS="$CPPFLAGS $cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" fi fi cf_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE cf_save_CFLAGS="$CFLAGS" cf_save_CPPFLAGS="$CPPFLAGS" cf_trim_CFLAGS=`echo "$cf_save_CFLAGS" | \ sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` cf_trim_CPPFLAGS=`echo "$cf_save_CPPFLAGS" | \ sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` echo "$as_me:3314: checking if we should define _POSIX_C_SOURCE" >&5 echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6 if test "${cf_cv_posix_c_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else echo "${as_me:-configure}:3320: testing if the symbol is already defined go no further ..." 1>&5 cat >conftest.$ac_ext <<_ACEOF #line 3323 "configure" #include "confdefs.h" #include int main () { #ifndef _POSIX_C_SOURCE make an error #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:3338: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:3341: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:3344: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3347: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_posix_c_source=no else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 cf_want_posix_source=no case .$cf_POSIX_C_SOURCE in #(vi .[12]??*) #(vi cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" ;; .2) #(vi cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" cf_want_posix_source=yes ;; .*) cf_want_posix_source=yes ;; esac if test "$cf_want_posix_source" = yes ; then cat >conftest.$ac_ext <<_ACEOF #line 3368 "configure" #include "confdefs.h" #include int main () { #ifdef _POSIX_SOURCE make an error #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:3383: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:3386: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:3389: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3392: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE" fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "${as_me:-configure}:3403: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 CFLAGS="$cf_trim_CFLAGS" CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" echo "${as_me:-configure}:3408: testing if the second compile does not leave our definition intact error ..." 1>&5 cat >conftest.$ac_ext <<_ACEOF #line 3411 "configure" #include "confdefs.h" #include int main () { #ifndef _POSIX_C_SOURCE make an error #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:3426: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:3429: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:3432: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3435: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 cf_cv_posix_c_source=no fi rm -f conftest.$ac_objext conftest.$ac_ext CFLAGS="$cf_save_CFLAGS" CPPFLAGS="$cf_save_CPPFLAGS" fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:3451: result: $cf_cv_posix_c_source" >&5 echo "${ECHO_T}$cf_cv_posix_c_source" >&6 if test "$cf_cv_posix_c_source" != no ; then CFLAGS="$cf_trim_CFLAGS" CPPFLAGS="$cf_trim_CPPFLAGS" cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in $cf_cv_posix_c_source do case $cf_fix_cppflags in no) case $cf_add_cflags in #(vi -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi case $cf_add_cflags in -D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "${cf_add_cflags}" != "${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test $cf_fix_cppflags = yes ; then cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in *$cf_add_cflags) #(vi ;; *) #(vi case $cf_add_cflags in #(vi -D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` ;; esac cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" ;; esac ;; *) cf_new_cflags="$cf_new_cflags $cf_add_cflags" ;; esac ;; yes) cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` test "${cf_add_cflags}" != "${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then CFLAGS="$CFLAGS $cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then CPPFLAGS="$CPPFLAGS $cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" fi fi ;; esac if test -n "$cf_xopen_source" ; then cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in $cf_xopen_source do case $cf_fix_cppflags in no) case $cf_add_cflags in #(vi -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi case $cf_add_cflags in -D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "${cf_add_cflags}" != "${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test $cf_fix_cppflags = yes ; then cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in *$cf_add_cflags) #(vi ;; *) #(vi case $cf_add_cflags in #(vi -D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` ;; esac cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" ;; esac ;; *) cf_new_cflags="$cf_new_cflags $cf_add_cflags" ;; esac ;; yes) cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` test "${cf_add_cflags}" != "${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then CFLAGS="$CFLAGS $cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then CPPFLAGS="$CPPFLAGS $cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" fi fi if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then echo "$as_me:3624: checking if _XOPEN_SOURCE really is set" >&5 echo $ECHO_N "checking if _XOPEN_SOURCE really is set... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #line 3627 "configure" #include "confdefs.h" #include int main () { #ifndef _XOPEN_SOURCE make an error #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:3642: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:3645: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:3648: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3651: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_XOPEN_SOURCE_set=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 cf_XOPEN_SOURCE_set=no fi rm -f conftest.$ac_objext conftest.$ac_ext echo "$as_me:3660: result: $cf_XOPEN_SOURCE_set" >&5 echo "${ECHO_T}$cf_XOPEN_SOURCE_set" >&6 if test $cf_XOPEN_SOURCE_set = yes then cat >conftest.$ac_ext <<_ACEOF #line 3665 "configure" #include "confdefs.h" #include int main () { #if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE make an error #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:3680: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:3683: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:3686: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3689: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_XOPEN_SOURCE_set_ok=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 cf_XOPEN_SOURCE_set_ok=no fi rm -f conftest.$ac_objext conftest.$ac_ext if test $cf_XOPEN_SOURCE_set_ok = no then { echo "$as_me:3700: WARNING: _XOPEN_SOURCE is lower than requested" >&5 echo "$as_me: WARNING: _XOPEN_SOURCE is lower than requested" >&2;} fi else echo "$as_me:3705: checking if we should define _XOPEN_SOURCE" >&5 echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6 if test "${cf_cv_xopen_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 3712 "configure" #include "confdefs.h" #include #include #include int main () { #ifndef _XOPEN_SOURCE make an error #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:3731: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:3734: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:3737: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3740: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_xopen_source=no else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 cf_save="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" cat >conftest.$ac_ext <<_ACEOF #line 3749 "configure" #include "confdefs.h" #include #include #include int main () { #ifdef _XOPEN_SOURCE make an error #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:3768: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:3771: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:3774: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3777: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_xopen_source=no else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 cf_cv_xopen_source=$cf_XOPEN_SOURCE fi rm -f conftest.$ac_objext conftest.$ac_ext CPPFLAGS="$cf_save" fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:3792: result: $cf_cv_xopen_source" >&5 echo "${ECHO_T}$cf_cv_xopen_source" >&6 if test "$cf_cv_xopen_source" != no ; then CFLAGS=`echo "$CFLAGS" | \ sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` CPPFLAGS=`echo "$CPPFLAGS" | \ sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in $cf_temp_xopen_source do case $cf_fix_cppflags in no) case $cf_add_cflags in #(vi -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi case $cf_add_cflags in -D*) cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "${cf_add_cflags}" != "${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test $cf_fix_cppflags = yes ; then cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in *$cf_add_cflags) #(vi ;; *) #(vi case $cf_add_cflags in #(vi -D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CPPFLAGS=`echo "$CPPFLAGS" | \ sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` ;; esac cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" ;; esac ;; *) cf_new_cflags="$cf_new_cflags $cf_add_cflags" ;; esac ;; yes) cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` test "${cf_add_cflags}" != "${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then CFLAGS="$CFLAGS $cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then CPPFLAGS="$CPPFLAGS $cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" fi fi fi fi ### extra things that we'll substitute in the makefile echo "$as_me:3891: checking return type of signal handlers" >&5 echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 if test "${ac_cv_type_signal+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 3897 "configure" #include "confdefs.h" #include #include #ifdef signal # undef signal #endif #ifdef __cplusplus extern "C" void (*signal (int, void (*)(int)))(int); #else void (*signal ()) (); #endif int main () { int i; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:3919: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:3922: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:3925: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3928: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_signal=void else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_type_signal=int fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:3938: result: $ac_cv_type_signal" >&5 echo "${ECHO_T}$ac_cv_type_signal" >&6 cat >>confdefs.h <&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line 3972 "configure" #include "confdefs.h" #include Syntax error _ACEOF if { (eval echo "$as_me:3977: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:3983: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line 4006 "configure" #include "confdefs.h" #include _ACEOF if { (eval echo "$as_me:4010: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:4016: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:4053: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line 4063 "configure" #include "confdefs.h" #include Syntax error _ACEOF if { (eval echo "$as_me:4068: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:4074: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line 4097 "configure" #include "confdefs.h" #include _ACEOF if { (eval echo "$as_me:4101: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:4107: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:4135: error: C preprocessor \"$CPP\" fails sanity check" >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_main_return=return echo "$as_me:4147: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 4153 "configure" #include "confdefs.h" #include #include #include #include _ACEOF if { (eval echo "$as_me:4161: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:4167: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.err conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line 4189 "configure" #include "confdefs.h" #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -rf conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF #line 4207 "configure" #include "confdefs.h" #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -rf conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF #line 4228 "configure" #include "confdefs.h" #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) $ac_main_return(2); $ac_main_return (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:4254: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:4257: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:4259: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4262: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:4275: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\EOF #define STDC_HEADERS 1 EOF fi for ac_header in \ fcntl.h \ ioctl.h \ sgtty.h \ stdlib.h \ string.h \ sys/filio.h \ sys/ioctl.h \ termio.h \ termios.h \ unistd.h \ do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:4299: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 4305 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF if { (eval echo "$as_me:4309: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:4315: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.err conftest.$ac_ext fi echo "$as_me:4334: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 4358 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ #include /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func (); char (*f) (); int main () { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else f = $ac_func; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:4389: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:4392: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:4395: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4398: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:4408: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <&5 echo $ECHO_N "checking if POSIX VDISABLE symbol should be used... $ECHO_C" >&6 if test "${cf_cv_posix_vdisable+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then cat >conftest.$ac_ext <<_ACEOF #line 4428 "configure" #include "confdefs.h" #if defined(HAVE_TERMIOS_H) && defined(HAVE_TCGETATTR) #include #endif #ifdef HAVE_UNISTD_H #include #endif int main () { #if defined(_POSIX_VDISABLE) && (_POSIX_VDISABLE != -1) int temp = _POSIX_VDISABLE; #else this did not work #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:4451: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:4454: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:4457: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4460: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_posix_vdisable=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 cf_cv_posix_vdisable=no fi rm -f conftest.$ac_objext conftest.$ac_ext else cat >conftest.$ac_ext <<_ACEOF #line 4471 "configure" #include "confdefs.h" #if defined(HAVE_TERMIOS_H) && defined(HAVE_TCGETATTR) #include #endif #ifdef HAVE_UNISTD_H #include #endif #if defined(_POSIX_VDISABLE) int main() { ${cf_cv_main_return:-return}(_POSIX_VDISABLE == -1); } #endif _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:4485: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:4488: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:4490: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4493: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_posix_vdisable=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 cf_cv_posix_vdisable=no fi rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:4507: result: $cf_cv_posix_vdisable" >&5 echo "${ECHO_T}$cf_cv_posix_vdisable" >&6 test $cf_cv_posix_vdisable = yes && cat >>confdefs.h <<\EOF #define HAVE_POSIX_VDISABLE 1 EOF echo "$as_me:4513: checking if we may use FIONREAD" >&5 echo $ECHO_N "checking if we may use FIONREAD... $ECHO_C" >&6 if test "${cf_cv_use_fionread+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line 4520 "configure" #include "confdefs.h" #if HAVE_SYS_FILIO_H # include /* FIONREAD */ #endif int main () { int l1; ioctl (0, FIONREAD, &l1); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:4539: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:4542: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:4545: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4548: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_use_fionread=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 cf_cv_use_fionread=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:4560: result: $cf_cv_use_fionread" >&5 echo "${ECHO_T}$cf_cv_use_fionread" >&6 test $cf_cv_use_fionread = yes && cat >>confdefs.h <<\EOF #define USE_FIONREAD 1 EOF ### debugging/testing ### output makefile and config.h ac_config_files="$ac_config_files 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 overriden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if cmp -s $cache_file confcache; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi DEFS=-DHAVE_CONFIG_H : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:4649: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated automatically by configure. # 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 SHELL=\${CONFIG_SHELL-$SHELL} ac_cs_invocation="\$0 \$@" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # Name of the executable. as_me=`echo "$0" |sed 's,.*[\\/],,'` if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file as_executable_p="test -f" # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # NLS nuisances. $as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } $as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } $as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } $as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } exec 6>&1 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\EOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -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 Report bugs to ." EOF cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` shift set dummy "$ac_option" "$ac_optarg" ${1+"$@"} shift ;; -*);; *) # This is not an option, so the user has probably given explicit # arguments. ac_need_defaults=false;; esac case $1 in # Handling of the options. EOF cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:4822: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) shift CONFIG_FILES="$CONFIG_FILES $1" ac_need_defaults=false;; --header | --heade | --head | --hea ) shift CONFIG_HEADERS="$CONFIG_HEADERS $1" ac_need_defaults=false;; # This is an error. -*) { { echo "$as_me:4841: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done exec 5>>config.log cat >&5 << _ACEOF ## ----------------------- ## ## Running config.status. ## ## ----------------------- ## This file was extended by $as_me 2.52.20121002, executed with CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS > $ac_cs_invocation on `(hostname || uname -n) 2>/dev/null | sed 1q` _ACEOF EOF cat >>$CONFIG_STATUS <<\EOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "makefile" ) CONFIG_FILES="$CONFIG_FILES makefile" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h:config.hin" ;; *) { { echo "$as_me:4878: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. : ${TMPDIR=/tmp} { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=$TMPDIR/cs$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 { (exit 1); exit 1; } } EOF cat >>$CONFIG_STATUS <\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datarootdir@,$datarootdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@DEFS@,$DEFS,;t t s,@LIBS@,$LIBS,;t t s,@build@,$build,;t t s,@build_cpu@,$build_cpu,;t t s,@build_vendor@,$build_vendor,;t t s,@build_os@,$build_os,;t t s,@host@,$host,;t t s,@host_cpu@,$host_cpu,;t t s,@host_vendor@,$host_vendor,;t t s,@host_os@,$host_os,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@EXTRA_CPPFLAGS@,$EXTRA_CPPFLAGS,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@CTAGS@,$CTAGS,;t t s,@ETAGS@,$ETAGS,;t t s,@MAKE_LOWER_TAGS@,$MAKE_LOWER_TAGS,;t t s,@MAKE_UPPER_TAGS@,$MAKE_UPPER_TAGS,;t t s,@LINT@,$LINT,;t t s,@ECHO_LT@,$ECHO_LT,;t t s,@ECHO_LD@,$ECHO_LD,;t t s,@RULE_CC@,$RULE_CC,;t t s,@SHOW_CC@,$SHOW_CC,;t t s,@ECHO_CC@,$ECHO_CC,;t t s,@EXTRA_CFLAGS@,$EXTRA_CFLAGS,;t t s,@CPP@,$CPP,;t t CEOF EOF cat >>$CONFIG_STATUS <<\EOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" EOF cat >>$CONFIG_STATUS <<\EOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then { case "$ac_dir" in [\\/]* | ?:[\\/]* ) as_incr_dir=;; *) as_incr_dir=.;; esac as_dummy="$ac_dir" for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do case $as_mkdir_dir in # Skip DOS drivespec ?:) as_incr_dir=$as_mkdir_dir ;; *) as_incr_dir=$as_incr_dir/$as_mkdir_dir test -d "$as_incr_dir" || mkdir "$as_incr_dir" ;; esac done; } ac_dir_suffix="/`echo $ac_dir|sed 's,^\./,,'`" # A "../" for each directory in $ac_dir_suffix. ac_dots=`echo "$ac_dir_suffix" | sed 's,/[^/]*,../,g'` else ac_dir_suffix= ac_dots= fi case $srcdir in .) ac_srcdir=. if test -z "$ac_dots"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_dots | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_dots$srcdir$ac_dir_suffix ac_top_srcdir=$ac_dots$srcdir ;; esac case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_dots$INSTALL ;; esac if test x"$ac_file" != x-; then { echo "$as_me:5105: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated automatically by config.status. */ configure_input="Generated automatically from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:5123: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo $srcdir/$f else # /dev/null tree { { echo "$as_me:5136: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } EOF cat >>$CONFIG_STATUS <<\EOF ac_warn_datarootdir=no if test x"$ac_file" != x-; then for ac_item in $ac_file_inputs do ac_seen=`grep '@\(datadir\|mandir\|infodir\)@' $ac_item` if test -n "$ac_seen"; then ac_used=`grep '@datarootdir@' $ac_item` if test -z "$ac_used"; then { echo "$as_me:5152: WARNING: datarootdir was used implicitly but not set: $ac_seen" >&5 echo "$as_me: WARNING: datarootdir was used implicitly but not set: $ac_seen" >&2;} ac_warn_datarootdir=yes fi fi ac_seen=`grep '${datarootdir}' $ac_item` if test -n "$ac_seen"; then { echo "$as_me:5161: WARNING: datarootdir was used explicitly but not set: $ac_seen" >&5 echo "$as_me: WARNING: datarootdir was used explicitly but not set: $ac_seen" >&2;} ac_warn_datarootdir=yes fi done fi if test "x$ac_warn_datarootdir" = xyes; then ac_sed_cmds="$ac_sed_cmds | sed -e 's,@datarootdir@,\${prefix}/share,g' -e 's,\${datarootdir},\${prefix}/share,g'" fi EOF cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then cp $tmp/out $ac_file for ac_name in prefix exec_prefix datarootdir do ac_seen=`fgrep -n '${'$ac_name'[:=].*}' $ac_file` if test -n "$ac_seen"; then ac_init=`egrep '[ ]*'$ac_name'[ ]*=' $ac_file` if test -z "$ac_init"; then ac_seen=`echo "$ac_seen" |sed -e 's,^,'$ac_file':,'` { echo "$as_me:5198: WARNING: Variable $ac_name is used but was not set: $ac_seen" >&5 echo "$as_me: WARNING: Variable $ac_name is used but was not set: $ac_seen" >&2;} fi fi done egrep -n '@[a-z_][a-z_0-9]+@' $ac_file >$tmp/out egrep -n '@[A-Z_][A-Z_0-9]+@' $ac_file >>$tmp/out if test -s $tmp/out; then ac_seen=`sed -e 's,^,'$ac_file':,' < $tmp/out` { echo "$as_me:5209: WARNING: Some variables may not be substituted: $ac_seen" >&5 echo "$as_me: WARNING: Some variables may not be substituted: $ac_seen" >&2;} fi else cat $tmp/out fi rm -f $tmp/out done EOF cat >>$CONFIG_STATUS <<\EOF # # CONFIG_HEADER section. # # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_i turns "#undef NAME" with trailing blanks into "#define NAME VALUE". ac_iA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_iB='\([ ]\),\1#\2define\3' ac_iC=' ' ac_iD='\4,;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:5258: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:5269: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo $srcdir/$f else # /dev/null tree { { echo "$as_me:5282: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >$tmp/in EOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into # config.h.in to produce config.h. The first handles `#define' # templates, and the second `#undef' templates. # And first: Protect against being on the right side of a sed subst in # config.status. Protect against being in an unquoted here document # in config.status. rm -f conftest.defines conftest.undefs # Using a here document instead of a string reduces the quoting nightmare. # Putting comments in sed scripts is not portable. # # `end' is used to avoid that the second main sed command (meant for # 0-ary CPP macros) applies to n-ary macro definitions. # See the Autoconf documentation for `clear'. cat >confdef2sed.sed <<\EOF s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\(\([^ (][^ (]*\)([^)]*)\)[ ]*\(.*\)$,${ac_dA}\2${ac_dB}\1${ac_dC}\3${ac_dD},gp t end s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end EOF # If some macros were called several times there might be several times # the same #defines, which is useless. Nevertheless, we may not want to # sort them, since we want the *last* AC-DEFINE to be honored. uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs sed 's/ac_d/ac_i/g' conftest.defines >>conftest.undefs rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\EOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, EOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS echo ' if egrep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.defines >/dev/null do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/defines.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines echo ' fi # egrep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.undefs >/dev/null do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/undefs.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail rm -f conftest.undefs mv conftest.tail conftest.undefs done rm -f conftest.undefs cat >>$CONFIG_STATUS <<\EOF # 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 automatically by config.status. */ if test x"$ac_file" = x-; then echo "/* Generated automatically by configure. */" >$tmp/config.h else echo "/* $ac_file. Generated automatically by configure. */" >$tmp/config.h fi cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then if cmp -s $ac_file $tmp/config.h 2>/dev/null; then { echo "$as_me:5400: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then { case "$ac_dir" in [\\/]* | ?:[\\/]* ) as_incr_dir=;; *) as_incr_dir=.;; esac as_dummy="$ac_dir" for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do case $as_mkdir_dir in # Skip DOS drivespec ?:) as_incr_dir=$as_mkdir_dir ;; *) as_incr_dir=$as_incr_dir/$as_mkdir_dir test -d "$as_incr_dir" || mkdir "$as_incr_dir" ;; esac done; } fi rm -f $ac_file mv $tmp/config.h $ac_file fi else cat $tmp/config.h rm -f $tmp/config.h fi done EOF cat >>$CONFIG_STATUS <<\EOF { (exit 0); exit 0; } EOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: exec 5>/dev/null $SHELL $CONFIG_STATUS || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi test -z "$cf_make_docs" && cf_make_docs=0 cf_output=makefile test -f "$cf_output" || cf_output=Makefile if test "$cf_make_docs" = 0 then cat >>$cf_output <<"CF_EOF" ################################################################################ .SUFFIXES : .html .$(manext) .man .ps .pdf .txt .$(manext).html : GROFF_NO_SGR=stupid $(SHELL) -c "tbl $*.$(manext) | groff -P -o0 -I'$(THIS)',$(manext)_ -Thtml -man" >$@ .$(manext).ps : $(SHELL) -c "tbl $*.$(manext) | groff -man" >$@ .$(manext).txt : GROFF_NO_SGR=stupid $(SHELL) -c "tbl $*.$(manext) | nroff -Tascii -man | col -bx" >$@ .ps.pdf : ps2pdf $*.ps CF_EOF cf_make_docs=1 fi for cf_name in '$(THIS)' do cat >>$cf_output < #include #include static int testing(const char *name, int row) { char buffer[1024]; sprintf(buffer, "Testing %s. " "A real VT%d will not recognize %s at this point", name, terminal_id(), name); println(buffer); return row + 1; } static int isreturn(const char *reply) { return (*reply == '\r' || *reply == '\n'); } int tst_vt52(MENU_ARGS) { /* *INDENT-OFF* */ static struct { const char *rcode; const char *rmsg; } resptable[] = { { "\033/A", " -- OK (VT50)" }, { "\033/C", " -- OK (VT55)" }, { "\033/H", " -- OK (VT50H without copier)" }, { "\033/J", " -- OK (VT50H with copier)" }, { "\033/K", " -- OK (means Standard VT52)" }, { "\033/L", " -- OK (VT52 with copier)" }, { "\033/Z", " -- OK (means VT100 emulating VT52)" }, { "", " -- Unknown response"} }; /* *INDENT-ON* */ int i, j; char *response; const char *temp; VTLEVEL save; save_level(&save); set_level(0); /* Reset ANSI (VT100) mode, Set VT52 mode */ vt52home(); /* Cursor home */ vt52ed(); /* Erase to end of screen */ vt52home(); /* Cursor home */ for (i = 0; i <= max_lines - 1; i++) { for (j = 0; j <= 9; j++) printf("%s", "FooBar "); println("Bletch"); } vt52home(); /* Cursor home */ vt52ed(); /* Erase to end of screen */ vt52cup(7, 47); printf("nothing more."); for (i = 1; i <= 10; i++) printf("THIS SHOULD GO AWAY! "); for (i = 1; i <= 5; i++) { vt52cup(1, 1); printf("%s", "Back scroll (this should go away)"); vt52ri(); /* Reverse LineFeed (with backscroll!) */ } vt52cup(12, 60); vt52ed(); /* Erase to end of screen */ for (i = 2; i <= 6; i++) { vt52cup(i, 1); vt52el(); /* Erase to end of line */ } for (i = 2; i <= max_lines - 1; i++) { vt52cup(i, 70); printf("%s", "**Foobar"); } vt52cup(max_lines - 1, 10); for (i = max_lines - 1; i >= 2; i--) { printf("%s", "*"); printf("%c", 8); /* BS */ vt52ri(); /* Reverse LineFeed (LineStarve) */ } vt52cup(1, 70); for (i = 70; i >= 10; i--) { printf("%s", "*"); vt52cub1(); vt52cub1(); /* Cursor Left */ } vt52cup(max_lines, 10); for (i = 10; i <= 70; i++) { printf("%s", "*"); printf("%c", 8); /* BS */ vt52cuf1(); /* Cursor Right */ } vt52cup(2, 11); for (i = 2; i <= max_lines - 1; i++) { printf("%s", "!"); printf("%c", 8); /* BS */ vt52cud1(); /* Cursor Down */ } vt52cup(max_lines - 1, 69); for (i = max_lines - 1; i >= 2; i--) { printf("%s", "!"); printf("%c", 8); /* BS */ vt52cuu1(); /* Cursor Up */ } for (i = 2; i <= max_lines - 1; i++) { vt52cup(i, 71); vt52el(); /* Erase to end of line */ } vt52cup(10, 16); printf("%s", "The screen should be cleared, and have a centered"); vt52cup(11, 16); printf("%s", "rectangle of \"*\"s with \"!\"s on the inside to the"); vt52cup(12, 16); printf("%s", "left and right. Only this, and"); vt52cup(13, 16); holdit(); vt52home(); /* Cursor home */ vt52ed(); /* Erase to end of screen */ printf("%s", "This is the normal character set:"); for (j = 0; j <= 1; j++) { vt52cup(3 + j, 16); for (i = 0; i <= 47; i++) printf("%c", 32 + i + 48 * j); } vt52cup(6, 1); printf("%s", "This is the special graphics character set:"); esc("F"); /* Select Special Graphics character set */ for (j = 0; j <= 1; j++) { vt52cup(8 + j, 16); for (i = 0; i <= 47; i++) printf("%c", 32 + i + 48 * j); } esc("G"); /* Select ASCII character set */ vt52cup(12, 1); holdit(); vt52home(); /* Cursor home */ vt52ed(); /* Erase to end of screen */ println("Test of terminal response to IDENTIFY command"); /* * According to J.Altman, DECID isn't recognized by VT5xx terminals. Real * DEC terminals through VT420 do, though it isn't recommended. VT420's * emulation of VT52 does not recognize DA -- so we use DECID in this case. */ set_tty_raw(TRUE); decid(); /* Identify */ response = get_reply(); println(""); restore_level(&save); restore_ttymodes(); padding(10); /* some terminals miss part of the 'chrprint()' otherwise */ printf("Response was"); chrprint(response); for (i = 0; resptable[i].rcode[0] != '\0'; i++) { if (!strcmp(response, resptable[i].rcode)) { show_result("%s", resptable[i].rmsg); break; } } println(""); println(""); /* * Verify whether returning to ANSI mode restores the previous operating * level. If it was a VT220, we can check this by seeing if 8-bit controls * work; if a VT420 we can check the value of DECSCL. A real VT420 goes to * VT100 mode. */ if (terminal_id() >= 200) { int row = 8; set_level(0); /* Reset ANSI (VT100) mode, Set VT52 mode */ println("Verify operating level after restoring ANSI mode"); esc("<"); /* Enter ANSI mode (VT100 mode) */ set_tty_raw(TRUE); if (save.cur_level >= 3) { /* VT340 implements DECRQSS */ vt_move(row, 1); row = testing("DECSCL", row); println("You should have to press return to continue:"); println(""); decrqss("\"p"); response = get_reply(); vt_move(++row, 10); printf("Response was"); chrprint(response); if (isreturn(response)) { show_result(SHOW_SUCCESS); } else { if (parse_decrqss(response, "\"p") > 0) printf("DECSCL recognized --"); show_result(SHOW_FAILURE); } println(""); row++; } if (save.cur_level >= 2) { vt_move(++row, 1); row = testing("S8C1T", row); s8c1t(1); cup(1, 1); dsr(6); response = instr(); vt_move(row, 10); printf("Response to CUP(1,1)/DSR(6)"); chrprint(response); if ((temp = skip_prefix(csi_input(), response)) != 0) { if (!strcmp("1;1R", temp)) { printf("S8C1T recognized --"); show_result(SHOW_FAILURE); } else { printf("unknown response --"); show_result(SHOW_FAILURE); } } else { input_8bits = FALSE; /* we expect this anyway */ if ((temp = skip_prefix(csi_input(), response)) != 0 && !strcmp("1;1R", temp)) { show_result(SHOW_SUCCESS); } else { printf("unknown response --"); show_result(SHOW_FAILURE); } } } restore_level(&save); restore_ttymodes(); println(""); println(""); } return MENU_HOLD; } vttest-20140116/configure.in0000644000175100001440000000156512266040515014343 0ustar tomusersdnl Process this file with 'autoconf' to produce a 'configure' script dnl $Id: configure.in,v 1.23 2014/01/16 20:30:05 tom Exp $ AC_REVISION($Revision: 1.23 $) AC_INIT(esc.c) AC_CONFIG_HEADER(config.h:config.hin) CF_CHECK_CACHE AC_ARG_PROGRAM CF_PROG_CC CF_INTEL_COMPILER AC_PROG_INSTALL CF_MAKE_TAGS AC_CHECK_PROGS(LINT, lint alint splint lclint, []) AC_SUBST(LINT) CF_DISABLE_ECHO CF_WITH_WARNINGS CF_XOPEN_SOURCE ### extra things that we'll substitute in the makefile AC_TYPE_SIGNAL AC_STDC_HEADERS AC_HAVE_HEADERS( \ fcntl.h \ ioctl.h \ sgtty.h \ stdlib.h \ string.h \ sys/filio.h \ sys/ioctl.h \ termio.h \ termios.h \ unistd.h \ ) AC_HAVE_FUNCS( \ alarm \ rdchk \ tcgetattr \ usleep \ ) ### special configuration tests CF_POSIX_VDISABLE CF_FCNTL_VS_IOCTL ### debugging/testing ### output makefile and config.h AC_OUTPUT(makefile) CF_MAKE_DOCS(['$(THIS)'],[$(manext)]) vttest-20140116/charsets.c0000644000175100001440000004566412266043011014014 0ustar tomusers/* $Id: charsets.c,v 1.59 2014/01/16 20:50:17 tom Exp $ */ /* * Test character-sets (e.g., SCS control, DECNRCM mode) */ #include #include /* the values, where specified, correspond to the keyboard-language codes */ typedef enum { ASCII = 1, British = 2, Flemish = 3, French_Canadian = 4, Danish = 5, Finnish = 6, German = 7, Dutch = 8, Italian = 9, Swiss_French = 10, Swiss_German = 11, Swiss, Swedish = 12, Norwegian_Danish = 13, French = 14, Spanish = 15, Portugese = 16, Hebrew = 17, British_Latin_1, Cyrillic, DEC_Alt_Chars, DEC_Alt_Graphics, DEC_Spec_Graphic, DEC_Supp, DEC_Supp_Graphic, DEC_Tech, Greek, Greek_Supp, Hebrew_Supp, Latin_5_Supp, Latin_Cyrillic, Russian, Turkish, SCS_NRCS, Unknown } National; typedef struct { National code; /* internal name (chosen to sort 'name' member) */ int allow96; /* flag for 96-character sets (e.g., GR mapping) */ int order; /* check-column so we can mechanically-sort this table */ int first; /* first model: 0=base, 2=vt220, 3=vt320, etc. */ int last; /* lastmodel: 0=base, 2=vt220, 3=vt320, etc. */ const char *final; /* end of SCS string */ const char *name; /* the string we'll show the user */ const char *not11; /* cells which are not 1-1 with ISO-8859-1 */ } CHARSETS; /* *INDENT-OFF* */ /* compare mappings using only 7-bits */ #define Not11(a,b) (((a) & 0x7f) == ((b) & 0x7f)) /* * The VT220 and VT340 reference manuals show tables and details for the * character sets. The VT520 reference manual does not show these details, so * mappings for the VT5xx character sets are not highlighted by this program. */ static const char map_pound[] = "#"; static const char map_all94[] = "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; static const char map_DEC_Supp[] = "$&,-./48>GHIJKLMNOPW^pw}~"; static const char map_Spec_Graphic[] = "`abcdefghijklmnopqrstuvwxyz{|}~"; static const char map_Supp_Graphic[] = "$&,-./48>PW^p}~\177"; static const char map_Dutch[] = "#@[\\]{|}~"; static const char map_Finnish[] = "`[\\]^{|}~"; static const char map_French[] = "#@[\\]{|}~"; static const char map_French_Canadian[] = "@`[\\]^{|}~"; static const char map_German[] = "@[\\]{|}~"; static const char map_Italian[] = "#@`[\\]{|}~"; static const char map_Norwegian[] = "@`[\\]^{|}~"; static const char map_Portuguese[] = "[\\]{|}"; static const char map_Spanish[] = "@[\\]{|}"; static const char map_Swedish[] = "@`[\\]^{|}~"; static const char map_Swiss[] = "#@`[\\]^_{|}~"; static const CHARSETS KnownCharsets[] = { { ASCII, 0, 0, 0, 9, "B", "US ASCII", 0 }, { British, 0, 0, 0, 9, "A", "British", map_pound }, { British_Latin_1, 1, 0, 3, 9, "A", "ISO Latin-1", 0 }, { Cyrillic, 0, 0, 5, 9, "&4", "Cyrillic (DEC)", 0 }, { DEC_Spec_Graphic, 0, 0, 0, 9, "0", "DEC Special graphics and line drawing", map_Spec_Graphic }, { DEC_Alt_Chars, 0, 0, 0, 0, "1", "DEC Alternate character ROM standard characters", 0 }, { DEC_Alt_Graphics, 0, 0, 0, 0, "2", "DEC Alternate character ROM special graphics", 0 }, { DEC_Supp, 0, 0, 2, 9, "<", "DEC Supplemental", map_DEC_Supp }, { DEC_Supp_Graphic, 0, 0, 3, 9, "%5", "DEC Supplemental Graphic", map_Supp_Graphic }, { DEC_Tech, 0, 0, 3, 9, ">", "DEC Technical", map_all94 }, { Dutch, 0, 0, 2, 9, "4", "Dutch", map_Dutch }, { Finnish, 0, 0, 2, 9, "5", "Finnish", map_Finnish }, { Finnish, 0, 1, 2, 9, "C", "Finnish", map_French }, { French, 0, 0, 2, 9, "R", "French", map_French }, { French, 0, 1, 2, 9, "f", "French", map_French }, /* Kermit (vt340 model?) */ { French_Canadian, 0, 0, 2, 9, "Q", "French Canadian", map_French_Canadian }, { French_Canadian, 0, 1, 3, 9, "9", "French Canadian", map_French_Canadian }, { German, 0, 0, 2, 9, "K", "German", map_German }, { Greek, 0, 0, 5, 9, "\"?", "Greek (DEC)", 0 }, { Greek_Supp, 1, 0, 5, 9, "F", "ISO Greek Supplemental", 0 }, { Hebrew, 0, 0, 5, 9, "\"4", "Hebrew (DEC)", 0 }, { Hebrew, 0, 1, 5, 9, "%=", "Hebrew NRCS", 0 }, { Hebrew_Supp, 1, 0, 5, 9, "H", "ISO Hebrew Supplemental", 0 }, { Italian, 0, 0, 2, 9, "Y", "Italian", map_Italian }, { Latin_5_Supp, 1, 0, 5, 9, "M", "ISO Latin-5 Supplemental", 0 }, { Latin_Cyrillic, 1, 0, 5, 9, "L", "ISO Latin-Cyrillic", 0 }, { Norwegian_Danish, 0, 0, 3, 9, "`", "Norwegian/Danish", map_Norwegian }, { Norwegian_Danish, 0, 1, 2, 9, "E", "Norwegian/Danish", map_Norwegian }, { Norwegian_Danish, 0, 2, 2, 9, "6", "Norwegian/Danish", map_Norwegian }, { Portugese, 0, 0, 3, 9, "%6", "Portugese", map_Portuguese }, { Russian, 0, 0, 5, 9, "&5", "Russian", 0 }, { SCS_NRCS, 0, 0, 5, 9, "%3", "SCS NRCS", 0 }, { Spanish, 0, 0, 2, 9, "Z", "Spanish", map_Spanish }, { Swedish, 0, 0, 2, 9, "7", "Swedish", map_Swedish }, { Swedish, 0, 1, 2, 9, "H", "Swedish", map_Swedish }, { Swiss, 0, 0, 2, 9, "=", "Swiss", map_Swiss }, { Turkish, 0, 0, 5, 9, "%0", "Turkish (DEC)", 0 }, { Turkish, 0, 1, 5, 9, "%2", "Turkish NRCS", 0 }, { Unknown, 0, 0,-1,-1, "?", "Unknown", 0 } }; /* *INDENT-ON* */ static int hilite_not11; static int national; static int cleanup; static char sgr_hilite[10]; static char sgr_reset[10]; static int current_Gx[4]; static int lookupCode(National code) { int n; for (n = 0; n < TABLESIZE(KnownCharsets); n++) { if (KnownCharsets[n].code == code) return n; } return lookupCode(ASCII); } static const CHARSETS * lookupCharset(int g, int n) { const CHARSETS *result = 0; if (n >= 0 && n < TABLESIZE(KnownCharsets)) { if (!strcmp(KnownCharsets[n].final, "A")) { if (national || (g == 0)) { n = lookupCode(British); } else { n = lookupCode(British_Latin_1); } } result = &KnownCharsets[n]; } return result; } static const char * charset_name(int g, int n) { return lookupCharset(g, n)->name; } static int append_sgr(char *buffer, int used, const char *sgr_string) { strcpy(buffer + used, sgr_string); used += (int) strlen(sgr_string); return used; } static void send32(int row, int upper, const char *not11) { int col; int used = 0; int hilited = 0; char buffer[33 * 8]; if (LOG_ENABLED) { fprintf(log_fp, "Note: send32 row %d, upper %d, not11:%s\n", row, upper, not11 ? not11 : ""); } for (col = 0; col <= 31; col++) { char ch = (char) (row * 32 + upper + col); if (not11 != 0 && hilite_not11) { const char *p; int found = 0; for (p = not11; *p; ++p) { if (Not11(*p, ch)) { found = 1; break; } } if (found) { if (!hilited) { used = append_sgr(buffer, used, sgr_hilite); hilited = 1; } } else { if (hilited) { used = append_sgr(buffer, used, sgr_reset); hilited = 0; } } } buffer[used++] = ch; } if (hilited) { used = append_sgr(buffer, used, sgr_reset); } buffer[used] = 0; tprintf("%s", buffer); } static char * scs_params(char *dst, int g) { const CHARSETS *tbl = lookupCharset(g, current_Gx[g]); sprintf(dst, "%c%s", ((tbl->allow96 && get_level() > 2) ? "?-./"[g] : "()*+"[g]), tbl->final); return dst; } static void do_scs(int g) { char buffer[80]; esc(scs_params(buffer, g)); } /* reset given Gg back to sane setting */ static int sane_cs(int g) { return lookupCode(((g == 0) || (get_level() <= 1)) ? ASCII : (get_level() < 3 ? British : British_Latin_1)); /* ...to get 8-bit codes 128-255 */ } /* reset given Gg back to sane setting */ static int reset_scs(int g) { int n = sane_cs(g); do_scs(n); return n; } /* reset all of the Gn to sane settings */ static int reset_charset(MENU_ARGS) { int n, m; decnrcm(national = FALSE); for (n = 0; n < 4; n++) { m = sane_cs(cleanup ? 0 : n); if (m != current_Gx[n] || (m == 0)) { current_Gx[n] = m; do_scs(n); } } return MENU_NOHOLD; } static int the_code; static int the_list[TABLESIZE(KnownCharsets) + 2]; static int lookup_Gx(MENU_ARGS) { int n; the_code = -1; for (n = 0; n < TABLESIZE(KnownCharsets); n++) { if (the_list[n] && !strcmp(the_title, KnownCharsets[n].name)) { the_code = n; break; } } return MENU_NOHOLD; } static void specify_any_Gx(MENU_ARGS, int g) { MENU my_menu[TABLESIZE(KnownCharsets) + 2]; int n, m; /* * Build up a menu of the character sets we will allow the user to specify. * There are a couple of tentative table entries (the "?" ones), which we * won't show in any event. Beyond that, we limit some of the character sets * based on the emulation level (vt220 implements national replacement * character sets, for example, but not the 96-character ISO Latin-1). */ for (n = m = 0; n < TABLESIZE(KnownCharsets); n++) { the_list[n] = 0; if (!strcmp(KnownCharsets[n].final, "?")) continue; if (get_level() < KnownCharsets[n].first) continue; if (get_level() > KnownCharsets[n].last) continue; if (((g == 0) || national) && KnownCharsets[n].allow96) continue; if (((g != 0) && !national) && (KnownCharsets[n].code == British)) continue; if (m && !strcmp(my_menu[m - 1].description, KnownCharsets[n].name)) continue; my_menu[m].description = KnownCharsets[n].name; my_menu[m].dispatch = lookup_Gx; the_list[n] = 1; m++; } my_menu[m].description = ""; my_menu[m].dispatch = 0; do { vt_clear(2); __(title(0), println(the_title)); __(title(2), println("Choose character-set:")); } while (menu(my_menu) && the_code < 0); current_Gx[g] = the_code; } static int toggle_hilite(MENU_ARGS) { hilite_not11 = !hilite_not11; if (hilite_not11) { sprintf(sgr_hilite, "%s7m", csi_output()); sprintf(sgr_reset, "%sm", csi_output()); } return MENU_NOHOLD; } static int toggle_nrc(MENU_ARGS) { national = !national; decnrcm(national); return MENU_NOHOLD; } static int specify_G0(MENU_ARGS) { specify_any_Gx(PASS_ARGS, 0); return MENU_NOHOLD; } static int specify_G1(MENU_ARGS) { specify_any_Gx(PASS_ARGS, 1); return MENU_NOHOLD; } static int specify_G2(MENU_ARGS) { specify_any_Gx(PASS_ARGS, 2); return MENU_NOHOLD; } static int specify_G3(MENU_ARGS) { specify_any_Gx(PASS_ARGS, 3); return MENU_NOHOLD; } static int tst_layout(MENU_ARGS) { char buffer[80]; return tst_keyboard_layout(scs_params(buffer, 0)); } static int tst_vt100_charsets(MENU_ARGS) { /* Test of: * SCS (Select character Set) */ int i, g, count, cset; __(cup(1, 10), printf("Selected as G0 (with SI)")); __(cup(1, 48), printf("Selected as G1 (with SO)")); for (count = cset = 0; count < TABLESIZE(KnownCharsets); count++) { const CHARSETS *tbl = KnownCharsets + count; if (tbl->first == 0) { int row = 3 + (4 * cset); scs(1, 'B'); cup(row, 1); sgr("1"); tprintf("Character set %s (%s)", tbl->final, tbl->name); sgr("0"); for (g = 0; g <= 1; g++) { int set_nrc = (get_level() >= 2 && tbl->final[0] == 'A'); if (set_nrc) decnrcm(TRUE); scs(g, (int) tbl->final[0]); for (i = 1; i <= 3; i++) { cup(row + i, 10 + 38 * g); send32(i, 0, tbl->not11); } if (set_nrc != national) decnrcm(national); } ++cset; } } scs_normal(); __(cup(max_lines, 1), printf("These are the installed character sets. ")); return MENU_HOLD; } static int tst_shift_in_out(MENU_ARGS) { /* Test of: SCS (Select character Set) */ static const char *label[] = { "Selected as G0 (with SI)", "Selected as G1 (with SO)" }; int i, cset; char buffer[80]; __(cup(1, 10), printf("These are the G0 and G1 character sets.")); for (cset = 0; cset < 2; cset++) { const CHARSETS *tbl = lookupCharset(cset, current_Gx[cset]); int row = 3 + (4 * cset); scs(cset, 'B'); cup(row, 1); sgr("1"); tprintf("Character set %s (%s)", tbl->final, tbl->name); sgr("0"); cup(row, 48); tprintf("%s", label[cset]); esc(scs_params(buffer, cset)); for (i = 1; i <= 3; i++) { cup(row + i, 10); send32(i, 0, tbl->not11); } scs(cset, 'B'); } cup(max_lines, 1); return MENU_HOLD; } #define map_g1_to_gr() esc("~") /* LS1R */ static int tst_vt220_locking(MENU_ARGS) { /* *INDENT-OFF* */ static const struct { int upper; int mapped; const char *code; const char *msg; } table[] = { { 1, 1, "~", "G1 into GR (LS1R)" }, { 0, 2, "n", "G2 into GL (LS2)" }, /* "{" vi */ { 1, 2, "}", "G2 into GR (LS2R)" }, { 0, 3, "o", "G3 into GL (LS3)" }, { 1, 3, "|", "G3 into GR (LS3R)" }, }; /* *INDENT-ON* */ int i, cset; __(cup(1, 10), tprintf("Locking shifts, with NRC %s:", STR_ENABLED(national))); for (cset = 0; cset < TABLESIZE(table); cset++) { int row = 3 + (4 * cset); int map = table[cset].mapped; const CHARSETS *tbl = lookupCharset(map, current_Gx[map]); int map_gl = (strstr(table[cset].msg, "into GL") != 0); scs_normal(); cup(row, 1); sgr("1"); tprintf("Character set %s (%s) in G%d", tbl->final, tbl->name, map); sgr("0"); cup(row, 48); tprintf("Maps %s", table[cset].msg); for (i = 1; i <= 3; i++) { if (table[cset].upper) { scs_normal(); map_g1_to_gr(); } else { do_scs(map); esc(table[cset].code); } cup(row + i, 5); send32(i, 0, map_gl ? tbl->not11 : 0); if (table[cset].upper) { do_scs(map); esc(table[cset].code); } else { scs_normal(); map_g1_to_gr(); } cup(row + i, 40); send32(i, 128, map_gl ? 0 : tbl->not11); } reset_scs(cset); } scs_normal(); cup(max_lines, 1); return MENU_HOLD; } static int tst_vt220_single(MENU_ARGS) { int pass, x, y; for (pass = 0; pass < 2; pass++) { int g = pass + 2; const CHARSETS *tbl = lookupCharset(g, current_Gx[g]); vt_clear(2); cup(1, 1); tprintf("Testing single-shift G%d into GL (SS%d) with NRC %s\n", g, g, STR_ENABLED(national)); tprintf("G%d is %s", g, tbl->name); do_scs(g); for (y = 0; y < 16; y++) { for (x = 0; x < 6; x++) { int ch = y + (x * 16) + 32; int hilited = 0; cup(y + 5, (x * 12) + 5); tprintf("%3d: (", ch); esc(pass ? "O" : "N"); /* SS3 or SS2 */ if (tbl->not11 && hilite_not11) { const char *p; for (p = tbl->not11; *p; ++p) { if (Not11(*p, ch)) { tprintf("%s", sgr_hilite); hilited = 1; break; } } } tprintf("%c", ch); if (ch == 127 && !tbl->allow96) tprintf(" "); /* DEL should have been eaten - skip past */ if (hilited) { tprintf("%s", sgr_reset); } tprintf(")"); } } cup(max_lines, 1); holdit(); } return MENU_NOHOLD; } /******************************************************************************/ /* * For parsing DECCIR response. The end of the response consists of so-called * intermediate and final bytes as used by the SCS controls. Most of the * strings fit into that description, but note that '<', '=' and '>' do not, * since they are used to denote private parameters rather than final bytes. * (But ECMA-48 hedges this by stating that the format in those cases is not * specified). */ const char * parse_Sdesig(const char *source, int *offset) { int j; const char *first = source + (*offset); const char *result = 0; size_t limit = strlen(first); for (j = 0; j < TABLESIZE(KnownCharsets); ++j) { if (KnownCharsets[j].code != Unknown) { size_t check = strlen(KnownCharsets[j].final); if (check <= limit && !strncmp(KnownCharsets[j].final, first, check)) { result = KnownCharsets[j].name; *offset += (int) check; break; } } } if (result == 0) { static char temp[80]; sprintf(temp, "? %#x\n", *source); *offset += 1; result = temp; } return result; } /* * Reset G0 to ASCII * Reset G1 to ASCII * Shift-in. */ void scs_normal(void) { scs(0, 'B'); } /* * Set G0 to Line Graphics * Reset G1 to ASCII * Shift-in. */ void scs_graphics(void) { scs(0, '0'); } int tst_characters(MENU_ARGS) { static char whatis_Gx[4][80]; static char hilite_mesg[80]; static char nrc_mesg[80]; /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Reset (ASCII for G0, G1, no NRC mode)", reset_charset }, { hilite_mesg, toggle_hilite }, { nrc_mesg, toggle_nrc }, { whatis_Gx[0], specify_G0 }, { whatis_Gx[1], specify_G1 }, { whatis_Gx[2], specify_G2 }, { whatis_Gx[3], specify_G3 }, { "Test VT100 Character Sets", tst_vt100_charsets }, { "Test Shift In/Shift Out (SI/SO)", tst_shift_in_out }, { "Test VT220 Locking Shifts", tst_vt220_locking }, { "Test VT220 Single Shifts", tst_vt220_single }, { "Test Soft Character Sets", not_impl }, { "Test Keyboard Layout with G0 Selection", tst_layout }, { "", 0 } }; /* *INDENT-ON* */ int n; cleanup = 0; hilite_not11 = 1; toggle_hilite(PASS_ARGS); reset_charset(PASS_ARGS); /* make the menu consistent */ if (get_level() > 1 || input_8bits || output_8bits) { do { vt_clear(2); __(title(0), printf("Character-Set Tests")); __(title(2), println("Choose test type:")); sprintf(hilite_mesg, "%s highlighting of non-ISO-8859-1 mapping", STR_ENABLE(hilite_not11)); sprintf(nrc_mesg, "%s National Replacement Character (NRC) mode", STR_ENABLE(national)); for (n = 0; n < 4; n++) { sprintf(whatis_Gx[n], "Specify G%d (now %s)", n, charset_name(n, current_Gx[n])); } } while (menu(my_menu)); cleanup = 1; /* tidy in case a "vt100" emulator does not ignore SCS */ vt_clear(1); return reset_charset(PASS_ARGS); } else { return tst_vt100_charsets(PASS_ARGS); } } vttest-20140116/vttest.10000644000175100001440000000324711745113244013445 0ustar tomusers.\" $Id: vttest.1,v 1.14 2012/04/22 23:39:16 tom Exp $ .TH VTTEST 1 "LOCAL" . .SH NAME vttest \- test VT100-type terminal . .SH SYNOPSIS .B vttest \fI[options] [24x80.132] . .SH DESCRIPTION .I Vttest is a program designed to test the functionality of a VT100 terminal (or emulator thereof). It tests both display (escape sequence handling) and keyboard. .PP The program is menu-driven and contains full on-line operating instructions. .TP 3 - To run a given menu-item, you must enter its number. .TP 3 - Menu items start at zero; this is the "Exit" item in almost all cases. .TP 3 - You can run all menu-items (for a given level) by entering an asterisk, i.e, `*'. .TP 3 - You can force a repaint of the menu items by entering "?". .TP 3 - A few menus can be more than one page. Use "n" and "p" to switch to the next or previous page. .SH OPTIONS You can specify the screen geometry in the form \fI[24x80.132]\fP, i.e., 24 lines, 80 minimum columns, 132 maximum columns. If your terminal does not switch between 80 and 132 columns you may specify 24x80.80, for example, to avoid a misleading display. .PP Other options are: .TP 5 .BI -f " file" specify a file containing a DRCS (soft character definition) string. .TP 5 .B -l log test results to \fIvttest.log\fP. .TP 5 .B -p use padding, e.g., for a VT100 connected to a high-speed line. .TP 5 .B -s add time-delay in selected panning/scrolling options to show details. .TP 5 .B -8 use 8-bit controls (this can be changed with a menu option). . .SH AUTHOR Per Lindberg (mcvax,seismo)!enea!suadb!lindberg sometime 1985. Modified by Thomas Dickey from June 1996, to support nonstandard screen geometry, VT220-VT520, ISO color and xterm-specific tests. vttest-20140116/vt220.c0000644000175100001440000003310211667273113013051 0ustar tomusers/* $Id: vt220.c,v 1.23 2011/12/06 01:56:27 tom Exp $ */ /* * Reference: VT220 Programmer Pocket Guide (EK-VT220-HR-002). * Reference: VT220 Program Reference Manual (EK-VT220-RM-002). */ #include #include #include int any_DSR(MENU_ARGS, const char *text, void (*explain) (char *report)) { char *report; unsigned pmode = (unsigned) ((*text == '?') ? 1 : 0); vt_move(1, 1); printf("Testing DSR: %s\n", the_title); set_tty_raw(TRUE); set_tty_echo(FALSE); do_csi("%s", text); report = get_reply(); vt_move(3, 10); chrprint(report); if ((report = skip_csi(report)) != 0 && strlen(report) > (1 + pmode) && (!pmode || (*report++ == '?'))) { if (explain != 0) (*explain) (report); else show_result(SHOW_SUCCESS); } else { show_result(SHOW_FAILURE); } restore_ttymodes(); vt_move(max_lines - 1, 1); return MENU_HOLD; } static void report_ok(const char *ref, const char *tst) { if ((tst = skip_csi_2(tst)) == 0) tst = "?"; show_result(!strcmp(ref, tst) ? SHOW_SUCCESS : SHOW_FAILURE); } /* * Request CSI ? 26 n keyboard dialect * Response CSI ? 27; Ps n */ static void show_KeyboardStatus(char *report) { int pos = 0; int code; int save; const char *show = SHOW_FAILURE; if ((code = scanto(report, &pos, ';')) == 27 && (code = scan_any(report, &pos, 'n')) != 0) { /* *INDENT-OFF* */ switch(code) { case 1: show = "North American/ASCII"; break; case 2: show = "British"; break; case 3: show = "Flemish"; break; case 4: show = "French Canadian"; break; case 5: show = "Danish"; break; case 6: show = "Finnish"; break; case 7: show = "German"; break; case 8: show = "Dutch"; break; case 9: show = "Italian"; break; case 10: show = "Swiss (French)"; break; case 11: show = "Swiss (German)"; break; case 12: show = "Swedish"; break; case 13: show = "Norwegian/Danish"; break; case 14: show = "French/Belgian"; break; case 15: show = "Spanish Int."; break; case 16: show = "Portugese"; break; /* vt3XX */ case 19: show = "Hebrew"; break; /* vt5XX: kermit says 14 */ case 22: show = "Greek"; break; /* vt5XX */ case 28: show = "Canadian (English)"; break; /* vt4XX */ case 29: show = "Turkish Q/Turkish"; break; /* vt5XX */ case 30: show = "Turkish F/Turkish"; break; /* vt5XX */ case 31: show = "Hungarian"; break; /* vt5XX */ case 32: show = "Spanish National"; break; /* vt4XX in PC mode */ case 33: show = "Slovak"; break; /* vt5XX */ case 34: show = "Czech"; break; /* vt5XX */ case 35: show = "Polish"; break; /* vt5XX */ case 36: show = "Romanian"; break; /* vt5XX */ case 38: show = "SCS"; break; /* vt5XX */ case 39: show = "Russian"; break; /* vt5XX */ case 40: show = "Latin American"; break; /* vt5XX */ default: show = "unknown"; } /* *INDENT-ON* */ } show_result("%s", show); /* vt420 implements additional parameters past those reported by the VT220 */ save = pos; code = scan_any(report, &pos, 'n'); if (save != pos) { vt_move(5, 10); /* *INDENT-OFF* */ switch(code) { case 0: show = "keyboard ready"; break; case 3: show = "no keyboard"; break; case 8: show = "keyboard busy"; break; default: show = "unknown keyboard status"; } /* *INDENT-ON* */ show_result("%s", show); vt_move(6, 10); /* *INDENT-OFF* */ switch (scan_any(report, &pos, 'n')) { case 0: show = "LK201"; break; case 1: show = "LK401"; break; default: show = "unknown keyboard type"; } /* *INDENT-ON* */ show_result("%s", show); } } static void show_PrinterStatus(char *report) { int pos = 0; int code = scanto(report, &pos, 'n'); const char *show; /* *INDENT-OFF* */ switch (code) { case 13: show = "No printer"; break; case 10: show = "Printer ready"; break; case 11: show = "Printer not ready"; break; case 18: show = "Printer busy"; break; case 19: show = "Printer assigned to other session"; break; default: show = SHOW_FAILURE; } /* *INDENT-ON* */ show_result("%s", show); } static void show_UDK_Status(char *report) { int pos = 0; int code = scanto(report, &pos, 'n'); const char *show; /* *INDENT-OFF* */ switch(code) { case 20: show = "UDKs unlocked"; break; case 21: show = "UDKs locked"; break; default: show = SHOW_FAILURE; } /* *INDENT-ON* */ show_result("%s", show); } /* VT220 & up. */ static int tst_S8C1T(MENU_ARGS) { char *report; int flag = input_8bits; int pass; vt_move(1, 1); println(the_title); vt_move(5, 1); println("This tests the VT200+ control sequence to direct the terminal to emit 8-bit"); println("control-sequences instead of sequences."); set_tty_raw(TRUE); set_tty_echo(FALSE); for (pass = 0; pass < 2; pass++) { flag = !flag; s8c1t(flag); cup(1, 1); dsr(6); report = instr(); vt_move(10 + pass * 3, 1); printf("8-bit controls %s: ", STR_ENABLED(flag)); chrprint(report); report_ok("1;1R", report); } restore_ttymodes(); vt_move(max_lines - 1, 1); return MENU_HOLD; } /* * Test DEC's selective-erase (set-protected area) by drawing a box of * *'s that will remain, and a big X of *'s that gets cleared.. */ static int tst_DECSCA(MENU_ARGS) { int i, j, pass; int tmar = 5; int bmar = max_lines - 8; int lmar = 20; int rmar = min_cols - lmar; for (pass = 0; pass < 2; pass++) { if (pass == 0) decsca(1); for (i = tmar; i <= bmar; i++) { cup(i, lmar); for (j = lmar; j <= rmar; j++) { printf("*"); } } if (pass == 0) { decsca(0); for (j = 0; j <= 2; j++) { for (i = 1; i < tmar; i++) { cup(i, lmar - tmar + (i + j)); printf("*"); cup(i, rmar + tmar - (i + j)); printf("*"); } for (i = bmar + 1; i < max_lines; i++) { cup(i, lmar + bmar - i + j); printf("*"); cup(i, rmar - bmar + i - j); printf("*"); } cup(max_lines / 2, min_cols / 2); decsed(j); } for (i = rmar + 1; i <= min_cols; i++) { cup(tmar, i); printf("*"); cup(max_lines / 2, i); printf("*"); } cup(max_lines / 2, min_cols / 2); decsel(0); /* after the cursor */ for (i = 1; i < lmar; i++) { cup(tmar, i); printf("*"); cup(max_lines / 2, i); printf("*"); } cup(max_lines / 2, min_cols / 2); decsel(1); /* before the cursor */ cup(tmar, min_cols / 2); decsel(2); /* the whole line */ vt_move(max_lines - 3, 1); vt_clear(0); println("If your terminal supports DEC protected areas (DECSCA, DECSED, DECSEL),"); println("there will be an solid box made of *'s in the middle of the screen."); holdit(); } } return MENU_NOHOLD; } /* * VT220 & up * * Test if the terminal can make the cursor invisible */ static int tst_DECTCEM(MENU_ARGS) { vt_move(1, 1); rm("?25"); println("The cursor should be invisible"); holdit(); sm("?25"); println("The cursor should be visible again"); return MENU_HOLD; } static int tst_DECUDK(MENU_ARGS) { int key; /* *INDENT-OFF* */ static struct { int code; const char *name; } keytable[] = { /* xterm programs these: */ { 11, "F1" }, { 12, "F2" }, { 13, "F3" }, { 14, "F4" }, { 15, "F5" }, /* vt420 programs these: */ { 17, "F6" }, { 18, "F7" }, { 19, "F8" }, { 20, "F9" }, { 21, "F10" }, { 23, "F11" }, { 24, "F12" }, { 25, "F13" }, { 26, "F14" }, { 28, "F15" }, { 29, "F16" }, { 31, "F17" }, { 32, "F18" }, { 33, "F19" }, { 34, "F20" } }; /* *INDENT-ON* */ for (key = 0; key < TABLESIZE(keytable); key++) { char temp[80]; const char *s; temp[0] = '\0'; for (s = keytable[key].name; *s; s++) sprintf(temp + strlen(temp), "%02x", *s & 0xff); do_dcs("1;1|%d/%s", keytable[key].code, temp); } vt_move(1, 1); println(the_title); println("Press 'q' to quit. Function keys should echo their labels."); println("(On a DEC terminal you must press SHIFT as well)."); set_tty_raw(TRUE); set_tty_echo(FALSE); for (;;) { char *report = instr(); if (*report == 'q') break; vt_move(5, 10); vt_clear(0); chrprint(report); } do_dcs("0"); /* clear all keys */ restore_ttymodes(); vt_move(max_lines - 1, 1); return MENU_HOLD; } /* vt220 & up */ int tst_DSR_keyboard(MENU_ARGS) { return any_DSR(PASS_ARGS, "?26n", show_KeyboardStatus); } int tst_DSR_printer(MENU_ARGS) { return any_DSR(PASS_ARGS, "?15n", show_PrinterStatus); } int tst_DSR_userkeys(MENU_ARGS) { return any_DSR(PASS_ARGS, "?25n", show_UDK_Status); } static void show_OperatingStatus(char *report) { int pos = 0; int Ps1 = scan_any(report, &pos, 'n'); int Ps2 = scanto(report, &pos, 'n'); const char *show; switch (Ps1) { case 0: show = "Terminal is in good operating condition"; break; case 3: show = "Terminal has a malfunction"; break; default: show = SHOW_FAILURE; } show_result(show, Ps2); } static int tst_DSR_operating_status(MENU_ARGS) { return any_DSR(PASS_ARGS, "5n", show_OperatingStatus); } /* * VT200 and up * * Test to ensure that 'ech' (erase character) is honored, with no parameter, * explicit parameter, and longer than the screen width (to ensure that the * terminal doesn't try to wrap-around the erasure). */ static int tst_ECH(MENU_ARGS) { int i; int last = max_lines - 4; decaln(); for (i = 1; i <= max_lines; i++) { cup(i, min_cols - i - 2); do_csi("X"); /* make sure default-parameter works */ cup(i, min_cols - i - 1); printf("*"); ech(min_cols); printf("*"); /* this should be adjacent, in the upper-right corner */ } vt_move(last, 1); vt_clear(0); vt_move(last, min_cols - (last + 10)); println("diagonal: ^^ (clear)"); println("ECH test: there should be E's with a gap before diagonal of **'s"); println("The lower-right diagonal region should be cleared. Nothing else."); return MENU_HOLD; } /******************************************************************************/ int tst_vt220_device_status(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Test Keyboard Status", tst_DSR_keyboard }, { "Test Operating Status", tst_DSR_operating_status }, { "Test Printer Status", tst_DSR_printer }, { "Test UDK Status", tst_DSR_userkeys }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); title(0); printf("VT220 Device Status Reports"); title(2); println("Choose test type:"); } while (menu(my_menu)); return MENU_NOHOLD; } /******************************************************************************/ int tst_vt220_screen(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Test Send/Receive mode (SRM)", tst_SRM }, { "Test Visible/Invisible Cursor (DECTCEM)", tst_DECTCEM }, { "Test Erase Char (ECH)", tst_ECH }, { "Test Protected-Areas (DECSCA)", tst_DECSCA }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); title(0); printf("VT220 Screen-Display Tests"); title(2); println("Choose test type:"); } while (menu(my_menu)); return MENU_NOHOLD; } /******************************************************************************/ int tst_vt220_reports(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Test Device Status Report (DSR)", tst_vt220_device_status }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printf("VT220 Reports")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } /******************************************************************************/ int tst_vt220(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Test reporting functions", tst_vt220_reports }, { "Test screen-display functions", tst_vt220_screen }, { "Test 8-bit controls (S7C1T/S8C1T)", tst_S8C1T }, { "Test Printer (MC)", tst_printing }, { "Test Soft Character Sets (DECDLD)", tst_softchars }, { "Test Soft Terminal Reset (DECSTR)", tst_DECSTR }, { "Test User-Defined Keys (DECUDK)", tst_DECUDK }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); title(0); printf("VT220 Tests"); title(2); println("Choose test type:"); } while (menu(my_menu)); return MENU_NOHOLD; } vttest-20140116/COPYING0000644000175100001440000000225112266047726013071 0ustar tomusers$Id: COPYING,v 1.9 2014/01/16 21:32:06 tom Exp $ ----------------------------------------------------------------------------- Copyright 1996-2013,2014 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, 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. vttest-20140116/main.c0000644000175100001440000013254612266045747013142 0ustar tomusers/* $Id: main.c,v 1.105 2014/01/16 21:15:19 tom Exp $ */ /* VTTEST.C Written November 1983 - July 1984 by Per Lindberg, Stockholm University Computer Center (QZ), Sweden. THE MAD PROGRAMMER STRIKES AGAIN! Copyright (c) 1984, Per Lindberg All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of Per Lindberg nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include #include #include /* *INDENT-EQLS* */ FILE *log_fp = 0; int brkrd; int reading; int log_disabled = FALSE; int max_lines = 24; int max_cols = 132; int min_cols = 80; int input_8bits = FALSE; int output_8bits = FALSE; int slow_motion = FALSE; int tty_speed = DEFAULT_SPEED; /* nominal speed, for padding */ int use_padding = FALSE; jmp_buf intrenv; static char empty[1]; static char *current_menu = empty; static void usage(void) { fprintf(stderr, "Usage: vttest [-l] [-p] [-s] [-8] [-f font] [24x80.132]\n"); exit(EXIT_FAILURE); } int main(int argc, char *argv[]) { /* *INDENT-OFF* */ static MENU mainmenu[] = { { "Exit", 0 }, { "Test of cursor movements", tst_movements }, { "Test of screen features", tst_screen }, { "Test of character sets", tst_characters }, { "Test of double-sized characters", tst_doublesize }, { "Test of keyboard", tst_keyboard }, { "Test of terminal reports", tst_reports }, { "Test of VT52 mode", tst_vt52 }, { "Test of VT102 features (Insert/Delete Char/Line)", tst_insdel }, { "Test of known bugs", tst_bugs }, { "Test of reset and self-test", tst_rst }, { "Test non-VT100 (e.g., VT220, XTERM) terminals", tst_nonvt100 }, { "Modify test-parameters", tst_setup }, { "", 0 } }; /* *INDENT-ON* */ while (argc-- > 1) { const char *opt = *++argv; if (*opt == '-') { while (*++opt != '\0') { switch (*opt) { case 'f': if (!*++opt) { if (argc-- < 1) usage(); opt = *++argv; } setup_softchars(opt); opt = "?"; break; case 'l': enable_logging(); break; case 'p': use_padding = TRUE; break; case 's': slow_motion = TRUE; break; case '8': output_8bits = TRUE; break; default: usage(); } } } else { /* * Allow user to specify geometry of terminal to accommodate quasi-VT100 * terminals such as Linux console and xterm. */ char *p = argv[0]; char *q; int values[3], n, m; for (n = 0; n < 3; n++) { if (!*p) break; if ((m = (int) strtol(p, &q, 10)) > 0) { values[n] = m; p = q; if (*p) p++; } else { break; } } switch (n) { case 3: max_cols = values[2]; /* FALLTHRU */ case 2: min_cols = values[1]; /* FALLTHRU */ case 1: max_lines = values[0]; break; } if ((max_cols < min_cols) || (n == 0)) { usage(); } } } #ifdef UNIX initterminal(setjmp(intrenv)); signal(SIGINT, onbrk); signal(SIGTERM, onterm); reading = FALSE; #else initterminal(0); #endif do { vt_clear(2); __(title(0), printf("VT100 test program, version %d.%d", RELEASE, PATCHLEVEL)); #ifdef PATCH_DATE if (PATCH_DATE) printf(" (%d)", PATCH_DATE); #endif title(1); if (max_lines != 24 || min_cols != 80 || max_cols != 132) printf("Screen size %dx%d (%d max) ", max_lines, min_cols, max_cols); if (tty_speed != DEFAULT_SPEED) printf("Line speed %dbd ", tty_speed); if (use_padding) printf(" (padded)"); __(title(2), println("Choose test type:")); } while (menu(mainmenu)); bye(); return EXIT_SUCCESS; } int tst_movements(MENU_ARGS) { /* Test of: CUF (Cursor Forward) CUB (Cursor Backward) CUD (Cursor Down) IND (Index) NEL (Next Line) CUU (Cursor Up) RI (Reverse Index) CUP (Cursor Position) HVP (Horizontal and Vertical Position) ED (Erase in Display) EL (Erase in Line) DECALN (Screen Alignment Display) DECAWM (Autowrap) Cursor control characters inside CSI sequences */ int i, row, col, pass, width, hlfxtra; const char *ctext = "This is a correct sentence"; set_tty_crmod(TRUE); /* want to disable tab/space conversion */ for (pass = 0; pass <= 1; pass++) { int inner_l, inner_r; if (pass == 0) { deccolm(FALSE); width = min_cols; } else { deccolm(TRUE); width = max_cols; } /* Compute left/right columns for a 60-column box centered in 'width' */ inner_l = (width - 60) / 2; inner_r = 61 + inner_l; hlfxtra = (width - 80) / 2; if (LOG_ENABLED) fprintf(log_fp, "tst_movements box(%d cols)\n", pass ? max_cols : min_cols); decaln(); cup(9, inner_l); ed(1); cup(18, 60 + hlfxtra); ed(0); el(1); cup(9, inner_r); el(0); /* 132: 36..97 */ /* 80: 10..71 */ for (row = 10; row <= 16; row++) { cup(row, inner_l); el(1); cup(row, inner_r); el(0); } cup(17, 30); el(2); for (col = 1; col <= width; col++) { hvp(max_lines, col); printf("*"); hvp(1, col); printf("*"); } cup(2, 2); for (row = 2; row <= max_lines - 1; row++) { printf("+"); cub(1); ind(); } cup(max_lines - 1, width - 1); for (row = max_lines - 1; row >= 2; row--) { printf("+"); cub(1); ri(); } cup(2, 1); for (row = 2; row <= max_lines - 1; row++) { printf("*"); cup(row, width); printf("*"); cub(10); if (row < 10) nel(); else printf("\n"); } cup(2, 10); cub(42 + hlfxtra); cuf(2); for (col = 3; col <= width - 2; col++) { printf("+"); cuf(0); cub(2); cuf(1); } cup(max_lines - 1, inner_r - 1); cuf(42 + hlfxtra); cub(2); for (col = width - 2; col >= 3; col--) { printf("+"); cub(1); cuf(1); cub(0); printf("%c", 8); } cup(1, 1); cuu(10); cuu(1); cuu(0); cup(max_lines, width); cud(10); cud(1); cud(0); cup(10, 2 + inner_l); for (row = 10; row <= 15; row++) { for (col = 2 + inner_l; col <= inner_r - 2; col++) printf(" "); cud(1); cub(58); } cuu(5); cuf(1); printf("The screen should be cleared, and have an unbroken bor-"); cup(12, inner_l + 3); printf("der of *'s and +'s around the edge, and exactly in the"); cup(13, inner_l + 3); printf("middle there should be a frame of E's around this text"); cup(14, inner_l + 3); printf("with one (1) free position around it. "); holdit(); } deccolm(FALSE); /* DECAWM demo */ for (pass = 0; pass <= 1; pass++) { static char on_left[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; static char on_right[] = "abcdefghijklmnopqrstuvwxyz"; int height = sizeof(on_left) - 1; int region = max_lines - 6; if (LOG_ENABLED) fprintf(log_fp, "tst_movements wrap(%d cols)\n", pass ? max_cols : min_cols); /* note: DECCOLM clears the screen */ if (pass == 0) { deccolm(FALSE); width = min_cols; } else { deccolm(TRUE); width = max_cols; } println("Test of autowrap, mixing control and print characters."); println("The left/right margins should have letters in order:"); decstbm(3, region + 3); decom(TRUE); /* this also homes the cursor */ for (i = 0; i < height; ++i) { switch (i % 4) { case 0: /* draw characters as-is, for reference */ __(cup(region + 1, 1), printf("%c", on_left[i])); __(cup(region + 1, width), printf("%c", on_right[i])); printf("\n"); break; case 1: /* simple wrapping */ __(cup(region, width), printf("%c%c", on_right[i - 1], on_left[i])); /* backspace at right margin */ __(cup(region + 1, width), printf("%c%c %c", on_left[i], BS, on_right[i])); printf("\n"); break; case 2: /* tab to right margin */ __(cup(region + 1, width), printf("%c%c%c%c%c%c", on_left[i], BS, BS, TAB, TAB, on_right[i])); __(cup(region + 1, 2), printf("%c%c\n", BS, on_left[i])); break; default: /* newline at right margin */ __(cup(region + 1, width), printf("\n")); __(cup(region, 1), printf("%c", on_left[i])); __(cup(region, width), printf("%c", on_right[i])); break; } } decom(FALSE); decstbm(0, 0); cup(max_lines - 2, 1); holdit(); } deccolm(FALSE); /* 80 cols */ if (LOG_ENABLED) fprintf(log_fp, "tst_movements cursor-controls in ESC sequences\n"); vt_clear(2); vt_move(1, 1); println("Test of cursor-control characters inside ESC sequences."); println("Below should be four identical lines:"); println(""); println("A B C D E F G H I"); for (i = 1; i < 10; i++) { printf("%c", '@' + i); do_csi("2%cC", BS); /* Two forward, one backspace */ } println(""); /* Now put CR in CUF sequence. */ printf("A "); for (i = 2; i < 10; i++) printf("%s%c%dC%c", csi_output(), CR, 2 * i - 2, '@' + i); println(""); /* Now put VT in CUU sequence. */ rm("20"); for (i = 1; i < 10; i++) { printf("%c ", '@' + i); do_csi("1\013A"); } println(""); println(""); holdit(); if (LOG_ENABLED) fprintf(log_fp, "tst_movements leading zeros in ESC sequences\n"); vt_clear(2); vt_move(1, 1); println("Test of leading zeros in ESC sequences."); printf("Two lines below you should see the sentence \"%s\".", ctext); for (col = 1; *ctext; col++) printf("%s00000000004;00000000%dH%c", csi_output(), col, *ctext++); cup(20, 1); restore_ttymodes(); return MENU_HOLD; } /* Scrolling test (used also in color-testing) */ void do_scrolling(void) { int soft, first, last, down, i, pass; ed(2); decom(TRUE); /* Origin mode (relative) */ for (soft = -1; soft <= 0; soft++) { if (soft) decsclm(TRUE); else decsclm(FALSE); for (pass = 0; pass < 2; ++pass) { if (pass == 0) { first = max_lines / 2; last = first + 1; } else { first = 1; last = max_lines; } decstbm(first, last); ed(2); for (down = 0; down >= -1; down--) { if (down) cuu(max_lines); else cud(max_lines); for (i = 1; i <= max_lines + 5; i++) { printf("%s scroll %s region [%d..%d] size %d Line %d\n", soft ? "Soft" : "Jump", down ? "down" : "up", first, last, last - first + 1, i); if (down) { ri(); ri(); } else if (soft) extra_padding(10); } } holdit(); } } } int tst_screen(MENU_ARGS) { /* Test of: - DECSTBM (Set Top and Bottom Margins) - TBC (Tabulation Clear) - HTS (Horizontal Tabulation Set) - SM RM (Set/Reset mode): - 80/132 chars . - Origin: Relative/absolute . - Scroll: Smooth/jump . - Wraparound - SGR (Select Graphic Rendition) - SM RM (Set/Reset Mode) - Inverse - DECSC (Save Cursor) - DECRC (Restore Cursor) */ int i, j, cset, row, col, background; static const char *tststr = "*qx`"; static const char *attr[5] = { ";0", ";1", ";4", ";5", ";7" }; set_tty_crmod(TRUE); /* want to disable tab/space conversion */ cup(1, 1); decawm(TRUE); /* DECAWM: Wrap Around ON */ for (col = 1; col <= min_cols * 2; col++) printf("*"); decawm(FALSE); /* DECAWM: Wrap Around OFF */ cup(3, 1); for (col = 1; col <= min_cols * 2; col++) printf("*"); decawm(TRUE); /* DECAWM: Wrap Around ON */ cup(5, 1); println("This should be three identical lines of *'s completely filling"); println("the top of the screen without any empty lines between."); println("(Test of WRAP AROUND mode setting.)"); holdit(); ed(2); tbc(3); cup(1, 1); for (col = 1; col <= min_cols - 2; col += 3) { cuf(3); hts(); } cup(1, 4); for (col = 4; col <= min_cols - 2; col += 6) { tbc(0); cuf(6); } cup(1, 7); tbc(1); tbc(2); /* no-op */ cup(1, 1); for (col = 1; col <= min_cols - 2; col += 6) printf("%c*", TAB); cup(2, 2); for (col = 2; col <= min_cols - 2; col += 6) printf(" *"); cup(4, 1); println("Test of TAB setting/resetting. These two lines"); printf("should look the same. "); holdit(); for (background = 0; background <= 1; background++) { if (background) decscnm(FALSE); else decscnm(TRUE); deccolm(TRUE); /* 132 cols */ ed(2); /* VT100 clears screen on SM3/RM3, but not obviously, so... */ cup(1, 1); tbc(3); for (col = 1; col <= max_cols; col += TABWIDTH) { cuf(TABWIDTH); hts(); } cup(1, 1); for (col = 1; col <= max_cols; col += 10) printf("%.*s", (max_cols > col) ? (max_cols - col) : 10, "1234567890"); for (row = 3; row <= 20; row++) { cup(row, row); printf("This is %d column mode, %s background.", max_cols, background ? "dark" : "light"); } holdit(); deccolm(FALSE); /* 80 cols */ ed(2); /* VT100 clears screen on SM3/RM3, but not obviously, so... */ cup(1, 1); for (col = 1; col <= min_cols; col += 10) printf("%.*s", (min_cols > col) ? (min_cols - col) : 10, "1234567890"); for (row = 3; row <= 20; row++) { cup(row, row); printf("This is %d column mode, %s background.", min_cols, background ? "dark" : "light"); } holdit(); } do_scrolling(); ed(2); decstbm(max_lines - 1, max_lines); printf( "\nOrigin mode test. This line should be at the bottom of the screen."); cup(1, 1); printf("%s", "This line should be the one above the bottom of the screen. "); holdit(); ed(2); decom(FALSE); /* Origin mode (absolute) */ cup(max_lines, 1); printf( "Origin mode test. This line should be at the bottom of the screen."); cup(1, 1); printf("%s", "This line should be at the top of the screen. "); holdit(); decstbm(1, max_lines); ed(2); /* *INDENT-OFF* */ cup( 1,20); printf("Graphic rendition test pattern:"); cup( 4, 1); sgr("0"); printf("vanilla"); cup( 4,40); sgr("0;1"); printf("bold"); cup( 6, 6); sgr(";4"); printf("underline"); cup( 6,45);sgr(";1");sgr("4");printf("bold underline"); cup( 8, 1); sgr("0;5"); printf("blink"); cup( 8,40); sgr("0;5;1"); printf("bold blink"); cup(10, 6); sgr("0;4;5"); printf("underline blink"); cup(10,45); sgr("0;1;4;5"); printf("bold underline blink"); cup(12, 1); sgr("1;4;5;0;7"); printf("negative"); cup(12,40); sgr("0;1;7"); printf("bold negative"); cup(14, 6); sgr("0;4;7"); printf("underline negative"); cup(14,45); sgr("0;1;4;7"); printf("bold underline negative"); cup(16, 1); sgr("1;4;;5;7"); printf("blink negative"); cup(16,40); sgr("0;1;5;7"); printf("bold blink negative"); cup(18, 6); sgr("0;4;5;7"); printf("underline blink negative"); cup(18,45); sgr("0;1;4;5;7"); printf("bold underline blink negative"); /* *INDENT-ON* */ sgr(""); decscnm(FALSE); /* Inverse video off */ cup(max_lines - 1, 1); el(0); printf("Dark background. "); holdit(); decscnm(TRUE); /* Inverse video */ cup(max_lines - 1, 1); el(0); printf("Light background. "); holdit(); decscnm(FALSE); ed(2); /* *INDENT-OFF* */ cup(8,12); printf("normal"); cup(8,24); printf("bold"); cup(8,36); printf("underscored"); cup(8,48); printf("blinking"); cup(8,60); printf("reversed"); cup(10,1); printf("stars:"); cup(12,1); printf("line:"); cup(14,1); printf("x'es:"); cup(16,1); printf("diamonds:"); /* *INDENT-ON* */ for (cset = 0; cset <= 3; cset++) { for (i = 0; i <= 4; i++) { cup(10 + 2 * cset, 12 + 12 * i); sgr(attr[i]); if (cset == 0 || cset == 2) scs_normal(); else scs_graphics(); for (j = 0; j <= 4; j++) { printf("%c", tststr[cset]); } decsc(); cup(cset + 1, i + 1); sgr(""); scs_normal(); printf("A"); decrc(); for (j = 0; j <= 4; j++) { printf("%c", tststr[cset]); } } } sgr("0"); scs_normal(); cup(21, 1); println("Test of the SAVE/RESTORE CURSOR feature. There should"); println("be ten characters of each flavour, and a rectangle"); println("of 5 x 4 A's filling the top left of the screen."); restore_ttymodes(); return MENU_HOLD; } int tst_doublesize(MENU_ARGS) { /* Test of: DECSWL (Single Width Line) DECDWL (Double Width Line) DECDHL (Double Height Line) (also implicit double width) */ int col, i, w, w1; /* Print the test pattern in both 80 and 132 character width */ for (w = 0; w <= 1; w++) { w1 = 13 * w; ed(2); cup(1, 1); if (w) { deccolm(TRUE); printf("%3d column mode", max_cols); } else { deccolm(FALSE); printf("%3d column mode", min_cols); } cup(5, 3 + 2 * w1); printf("v------- left margin"); cup(7, 3 + 2 * w1); printf("This is a normal-sized line"); decdhl(0); decdhl(1); decdwl(); decswl(); cup(9, 2 + w1); printf("This is a Double-width line"); decswl(); decdhl(0); decdhl(1); decdwl(); cup(11, 2 + w1); decdwl(); decswl(); decdhl(1); decdhl(0); printf("This is a Double-width-and-height line"); cup(12, 2 + w1); decdwl(); decswl(); decdhl(0); decdhl(1); printf("This is a Double-width-and-height line"); cup(14, 2 + w1); decdwl(); decswl(); decdhl(1); decdhl(0); el(2); printf("This is another such line"); cup(15, 2 + w1); decdwl(); decswl(); decdhl(0); decdhl(1); printf("This is another such line"); cup(17, 3 + 2 * w1); printf("^------- left margin"); cup(21, 1); printf("This is not a double-width line"); for (i = 0; i <= 1; i++) { cup(21, 6); if (i) { printf("**is**"); decdwl(); } else { printf("is not"); decswl(); } cup(max_lines - 1, 1); holdit(); } } /* Set vanilla tabs for next test */ cup(1, 1); tbc(3); for (col = 1; col <= max_cols; col += TABWIDTH) { cuf(TABWIDTH); hts(); } deccolm(FALSE); ed(2); /* *INDENT-OFF* */ scs_graphics(); cup( 8,1); decdhl(0); printf("lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk"); cup( 9,1); decdhl(1); printf("lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk"); cup(10,1); decdhl(0); printf("x%c%c%c%c%cx",9,9,9,9,9); cup(11,1); decdhl(1); printf("x%c%c%c%c%cx",9,9,9,9,9); cup(12,1); decdhl(0); printf("x%c%c%c%c%cx",9,9,9,9,9); cup(13,1); decdhl(1); printf("x%c%c%c%c%cx",9,9,9,9,9); scs(1, '0'); /* should look the same as scs_graphics() */ cup(14,1); decdhl(0); printf("x x"); cup(15,1); decdhl(1); printf("x x"); cup(16,1); decdhl(0); printf("mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj"); cup(17,1); decdhl(1); printf("mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj"); scs_normal(); /* *INDENT-ON* */ sgr("1;5"); cup(12, 3); printf("* The mad programmer strikes again * "); cup(13, 3); printf("%c", 9); cub(6); printf("* The mad programmer strikes again *"); sgr("0"); cup(max_lines - 2, 1); println("Another test pattern... a frame with blinking bold text,"); printf("all in double-height double-width size. "); holdit(); decstbm(8, max_lines); /* Absolute origin mode, so cursor is set at (1,1) */ cup(8, 1); for (i = 1; i <= 12; i++) ri(); decstbm(0, 0); /* No scroll region */ cup(1, 1); printf("%s", "Exactly half of the box should remain. "); return MENU_HOLD; } int tst_insdel(MENU_ARGS) { /* Test of: SM/RM(4) (= IRM (Insertion/replacement mode)) ICH (Insert Character) DCH (Delete character) IL (Insert line) DL (Delete line) */ int i, row, col, sw, dblchr, scr132; for (scr132 = 0; scr132 <= 1; scr132++) { if (scr132) { deccolm(TRUE); sw = max_cols; } else { deccolm(FALSE); sw = min_cols; } ed(2); cup(1, 1); for (row = 1; row <= max_lines; row++) { cup(row, 1); for (col = 1; col <= sw; col++) printf("%c", 'A' - 1 + row); } cup(4, 1); printf("Screen accordion test (Insert & Delete Line). "); holdit(); ri(); el(2); decstbm(2, max_lines - 1); decom(TRUE); cup(1, 1); for (row = 1; row <= max_lines; row++) { il(row); dl(row); } decom(FALSE); decstbm(0, 0); cup(2, 1); printf("Top line: A's, bottom line: %c's, this line, nothing more. ", 'A' - 1 + max_lines); holdit(); cup(2, 1); ed(0); cup(1, 2); printf("B"); cub(1); sm("4"); for (col = 2; col <= sw - 1; col++) printf("*"); rm("4"); cup(4, 1); printf("Test of 'Insert Mode'. The top line should be 'A*** ... ***B'. "); holdit(); ri(); el(2); cup(1, 2); dch(sw - 2); cup(4, 1); printf("Test of 'Delete Character'. The top line should be 'AB'. "); holdit(); for (dblchr = 1; dblchr <= 2; dblchr++) { ed(2); for (row = 1; row <= max_lines; row++) { cup(row, 1); if (dblchr == 2) decdwl(); for (col = 1; col <= sw / dblchr; col++) printf("%c", 'A' - 1 + row); cup(row, sw / dblchr - row); dch(row); } cup(4, 1); println("The right column should be staggered "); printf("by one. "); holdit(); } ed(2); cup(1, 1); println("If your terminal has the ANSI 'Insert Character' function"); println("(the VT102 does not), then you should see a line like this"); println(" A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"); println("below:"); println(""); for (i = 'Z'; i >= 'A'; i--) { printf("%c%c", i, BS); ich(2); } cup(10, 1); holdit(); if (sw == max_cols) deccolm(FALSE); } return MENU_NOHOLD; } /* Test of some known VT100 bugs and misfeatures */ int tst_bugs(MENU_ARGS) { int i; /* *INDENT-OFF* */ static MENU menutable[] = { { "Exit to main menu", 0 }, { "Bug A: Smooth scroll to jump scroll", bug_a }, { "Bug B: Scrolling region", bug_b }, { "Bug C: Wide to narrow screen", bug_c }, { "Bug D: Narrow to wide screen", bug_d }, { "Bug E: Cursor move from double- to single-wide line", bug_e }, { "Bug F: Column mode escape sequence", bug_f }, { "Wrap around with cursor addressing", bug_w }, { "Erase right half of double width lines", bug_l }, { "Funny scroll regions", bug_s }, /* Add more here */ { "", 0 } }; /* *INDENT-ON* */ static const char *hmsg[] = { "Test of known bugs in the DEC VT100 series. The numbering of some of", "the bugs (A-F) refers to the article 'VT100 MAGIC' by Sami Tabih in", "the 'Proceedings of the DEC Users Society' at St. Louis, Missouri, May", "1983. To understand some of the tests, you have to look at the source", "code or the article. Of course, a good VT100-compatible terminal", "should not have these bugs (or have some means of disabling them)! If", "a bug appears, you might want to RESET the terminal before continuing", "the test. There is a test of the RESET function in the main menu.", ""}; do { vt_clear(2); vt_move(1, 1); for (i = 0; *hmsg[i]; i++) println(hmsg[i]); println(""); println(" Choose bug test number:"); } while (menu2(menutable, i + 1)); return MENU_NOHOLD; } /* Bug A: Smooth scroll to jump scroll */ int bug_a(MENU_ARGS) { int i; cup(10, 1); println("This is a test of the VT100 'Scroll while toggle softscroll'"); println("bug. The cursor may disappear, or move UP the screen, or"); println("multiple copies of some lines may appear."); holdit(); /* Invoke the bug */ esc("[24H"); /* Simplified cursor movement */ decsclm(FALSE); for (i = 1; i <= 20; i++) printf("\n"); decsclm(TRUE); for (i = 1; i <= 10; i++) printf("\n"); decsclm(FALSE); for (i = 1; i <= 5; i++) printf("\n"); /* That should be enough to show the bug. But we'll try another way: */ decsclm(TRUE); /* Set soft scroll */ nel(); /* "NextLine", move down */ decsclm(FALSE); /* Reset soft scroll */ nel(); /* "NextLine", move down */ for (i = 1; i <= 10; i++) { /* Show the bug */ printf("Softscroll bug test, line %d. ", i); holdit(); } println("That should have been enough to show the bug, if present."); return MENU_HOLD; } /* Bug B: Scrolling region */ int bug_b(MENU_ARGS) { char c; decaln(); cup(1, 1); el(0); printf("Line 11 should be double-wide, line 12 should be cleared."); cup(2, 1); el(0); printf("Then, the letters A-P should be written at the beginning"); cup(3, 1); el(0); printf("of lines 12-%d, and the empty line and A-E are scrolled away.", max_lines); cup(4, 1); el(0); printf("If the bug is present, some lines are confused, look at K-P."); cup(11, 1); decdwl(); decstbm(12, max_lines); cup(12, 1); el(0); printf("Here we go... "); holdit(); cup(12, 1); ri(); /* Bug comes here */ for (c = 'A'; c <= 'P'; c++) printf("%c\n", c); /* Bug shows here */ holdit(); decstbm(0, 0); /* No scr. region */ return MENU_NOHOLD; } /* Bug C: Wide to narrow screen */ int bug_c(MENU_ARGS) { deccolm(TRUE); /* 132 column mode */ cup(1, 81); deccolm(FALSE); /* 80 column mode */ cup(12, 5); printf("Except for this line, the screen should be blank. "); return MENU_HOLD; } /* Bug D: Narrow to wide screen */ int bug_d(MENU_ARGS) { int i; char result; /* Make the bug appear */ do { cup(14, 1); /* The original code in the article says * PRINT ESC$; "[13;1H"; CHR$(10%); * but I guess a cup(14,1); would do. * (To output a pure LF might be tricky). */ deccolm(TRUE); /* Make the bug visible */ cup(1, 9); decdwl(); println("You should see blinking text at the bottom line."); cup(3, 9); decdwl(); println("Enter 0 to exit, 1 to try to invoke the bug again."); cup(max_lines, 9); decdwl(); sgr("1;5;7"); printf("If you can see this then the bug did not appear."); sgr(""); cup(4, 9); decdwl(); result = inchar(); readnl(); deccolm(FALSE); } while (result == '1'); decsclm(TRUE); /* Syrup scroll */ cup(max_lines - 1, 1); for (i = 1; i <= 5; i++) println("If the bug is present, this should make things much worse!"); holdit(); decsclm(FALSE); /* Jump scroll */ return MENU_NOHOLD; } /* Bug E: Cursor move from double- to single-wide line */ int bug_e(MENU_ARGS) { int i; static const char *rend[2] = {"m", "7m"}; deccolm(TRUE); cup(1, 1); decdwl(); println("This test should put an 'X' at line 3 column 100."); for (i = 1; i <= 12; i++) printf("1234567890%s%s", csi_output(), rend[i & 1]); cup(1, 1); /* The bug appears when we jump from a double-wide line */ cup(3, 100); /* to a single-wide line, column > 66. */ printf("X"); cup(4, max_cols / 2); printf("! !"); cup(5, 1); printf("--------------------------- The 'X' should NOT be above here -"); printf("---+------------ but above here -----+"); cup(10, 1); decdwl(); holdit(); deccolm(FALSE); return MENU_NOHOLD; } /* Bug F: Column mode escape sequence */ int bug_f(MENU_ARGS) { /* * VT100 "toggle origin mode, forget rest" bug. If you try to set * (or clear) parameters and one of them is the "origin mode" * ("?6") parameter, parameters that appear after the "?6" * remain unaffected. This is also true on CIT-101 terminals. */ decscnm(TRUE); /* Set reverse mode */ deccolm(TRUE); /* Set 132 column mode */ println("Test VT100 'Toggle origin mode, forget rest' bug, part 1."); printf("The screen should be in reverse, %d column mode.\n", max_cols); holdit(); ed(2); rm("?6;5;3"); /* Reset (origin, reverse, 132 col) */ println("Test VT100 'Toggle origin mode, forget rest' bug, part 2.\n"); printf("The screen should be in non-reverse, %d column mode.\n", min_cols); return MENU_HOLD; } /* Bug W: * The dreaded "wraparound" bug! You CUP to col 80, write a char, * CUP to another line in col 80, write a char. And the brain-damaged * terminal thinks that "Hokay, so he's written a char in col 80, so * I stay in col 80 and wait for next character. Let's see now, here * comes another character, and I'm still in col 80, so I must make * a NewLine first." -- It doesn't clear that "still in col 80" flag * on a CUP. Argh! */ int bug_w(MENU_ARGS) { int row, col; cup(16, 1); println(" This illustrates the \"wrap around bug\" which exists on a"); println(" standard VT100. At the top of the screen there should be"); println(" a row of +'s, and the rightmost column should be filled"); println(" with *'s. But if the bug is present, some of the *'s may"); println(" be placed in other places, e.g. in the leftmost column,"); println(" and the top line of +'s may be scrolled away."); cup(1, 1); for (col = 1; col <= min_cols - 1; col++) printf("+"); for (row = 1; row <= max_lines; row++) { hvp(row, min_cols); printf("*"); } cup(max_lines, 1); return MENU_HOLD; } /* Bug L: * Check if the right half of double-width lines comes back * when a line is first set to single-width, filled with stuff, * set to double-width, and finally reset to single-width. * * A VT100 has this misfeature, and many others. Foo! */ int bug_l(MENU_ARGS) { cup(15, 1); printf("This-is-a-long-line-This-is-a-long-line-"); printf("This-is-a-long-line-This-is-a-long-line-"); cup(1, 1); printf("This is a test of what happens to the right half of double-width"); println(" lines."); printf("A common misfeature is that the right half does not come back"); println(" when a long"); printf("single-width line is set to double-width and then reset to"); println(" single-width."); cup(5, 1); println("Now the line below should contain 80 characters in single width."); holdit(); cup(15, 1); decdwl(); cup(8, 1); println("Now the line below should contain 40 characters in double width."); holdit(); cup(15, 1); decswl(); cup(11, 1); println("Now the line below should contain 80 characters in single width."); holdit(); /* ...and in 132 column mode */ deccolm(TRUE); ed(2); cup(15, 1); printf("This-is-a-long-line-This-is-a-long-line-"); printf("This-is-a-long-line-This-is-a-long-line-"); printf("This-is-a-long-line-This-is-a-long-line-"); printf("ending-here-"); cup(1, 1); printf("This is the same test in %d column mode.", max_cols); cup(5, 1); printf("Now the line below should contain %d characters in single width.\n", max_cols); holdit(); cup(15, 1); decdwl(); cup(8, 1); printf("Now the line below should contain %d characters in double width.\n", max_cols / 2); holdit(); cup(15, 1); decswl(); cup(11, 1); printf("Now the line below should contain %d characters in single width.\n", max_cols); holdit(); deccolm(FALSE); return MENU_NOHOLD; } int bug_s(MENU_ARGS) { int i; decstbm(20, 10); /* 20-10=-10, < 2, so no scroll region. */ cup(1, 1); for (i = 1; i <= 20; i++) printf("This is 20 lines of text (line %d), no scroll region.\n", i); holdit(); ed(2); decstbm(0, 1); /* Should be interpreted as decstbm(1,1) = none */ cup(1, 1); for (i = 1; i <= 20; i++) printf("This is 20 lines of text (line %d), no scroll region.\n", i); holdit(); decstbm(0, 0); /* No scroll region (just in case...) */ return MENU_NOHOLD; } void initterminal(int pn) { init_ttymodes(pn); setup_terminal(""); } /* Set up my personal prejudices */ int setup_terminal(MENU_ARGS) { if (LOG_ENABLED) fprintf(log_fp, "Setup Terminal with test-defaults\n"); default_level(); /* Enter ANSI mode (if in VT52 mode) */ decckm(FALSE); /* cursor keys normal */ deccolm(FALSE); /* 80 col mode */ decsclm(FALSE); /* Jump scroll */ decscnm(FALSE); /* Normal screen */ decom(FALSE); /* Absolute origin mode */ decawm(TRUE); /* Wrap around on */ decarm(FALSE); /* Auto repeat off */ sm("?40"); /* Enable 80/132 switch (xterm) */ rm("?45"); /* Disable reverse wrap (xterm) */ decstbm(0, 0); /* No scroll region */ sgr("0"); /* Normal character attributes */ return MENU_NOHOLD; } void bye(void) { /* Force my personal prejudices upon the poor luser */ if (LOG_ENABLED) fprintf(log_fp, "Cleanup & exit\n"); default_level(); /* Enter ANSI mode (if in VT52 mode) */ decckm(FALSE); /* cursor keys normal */ deccolm(FALSE); /* 80 col mode */ decscnm(FALSE); /* Normal screen */ decom(FALSE); /* Absolute origin mode */ decawm(TRUE); /* Wrap around on */ decarm(TRUE); /* Auto repeat on */ decstbm(0, 0); /* No scroll region */ sgr("0"); /* Normal character attributes */ /* Say goodbye */ vt_clear(2); vt_move(12, 30); printf("That's all, folks!\n"); printf("\n\n\n"); inflush(); close_tty(); exit(EXIT_SUCCESS); } #ifdef UNIX RETSIGTYPE onbrk(SIG_ARGS GCC_UNUSED) { signal(SIGINT, onbrk); if (reading) { brkrd = TRUE; #ifdef HAVE_ALARM alarm(0); #endif } else { longjmp(intrenv, 1); } } RETSIGTYPE onterm(SIG_ARGS GCC_UNUSED) { signal(SIGTERM, onterm); longjmp(intrenv, 1); } #endif int scanto(const char *str, int *pos, int toc) { char c; int result = 0; while (toc != (c = str[(*pos)])) { *pos += 1; if (isdigit(CharOf(c))) result = result * 10 + c - '0'; else break; } if (c == toc) { *pos += 1; /* point past delimiter */ return (result); } return (0); } int scan_any(char *str, int *pos, int toc) { int save = *pos; int value = scanto(str, pos, ';'); if (value == 0) { *pos = save; value = scanto(str, pos, toc); if (str[*pos] != '\0') value = 0; } return value; } static const char * push_menu(int number) { const char *saved = current_menu; current_menu = (char *) malloc(strlen(saved) + 10); sprintf(current_menu, "%s%s%d", saved, *saved ? "." : "", number); return saved; } static void pop_menu(const char *saved) { if (current_menu && *current_menu) free(current_menu); current_menu = (char *) saved; } #define end_of_menu(table, number) \ (table[number].description[0] == '\0') static void show_entry(MENU *table, int number) { printf(" %d%c %s\n", number, (table[number].dispatch == not_impl) ? '*' : '.', table[number].description); } static int next_menu(MENU *table, int top, int size) { int last; int next = top + size; for (last = top; last <= next && !end_of_menu(table, last); ++last) { ; } return (last >= next) ? next : top; } static int prev_menu(int top, int size) { return (top > 1) ? (top - size) : top; } int menu2(MENU *table, int top) { int i, tablesize, choice; char c; char storage[BUFSIZ]; int pagesize = max_lines - 7 - TITLE_LINE; int pagetop = 1; int redraw = FALSE; tablesize = 0; for (i = 0; !end_of_menu(table, i); i++) { tablesize++; } tablesize--; for (;;) { vt_move(top, 1); vt_clear(0); println(""); show_entry(table, 0); for (i = 0; i < pagesize; i++) { int j = pagetop + i; if (end_of_menu(table, j)) break; show_entry(table, pagetop + i); } printf("\n Enter choice number (0 - %d): ", tablesize); for (;;) { char *s = storage; inputline(s); choice = 0; redraw = FALSE; while ((c = *s++) != '\0') { if (c == '*') { choice = -1; break; } else if (c == '?') { redraw = TRUE; break; } else if (tablesize > pagesize && c == 'n') { pagetop = next_menu(table, pagetop, pagesize); redraw = TRUE; break; } else if (tablesize > pagesize && c == 'p') { pagetop = prev_menu(pagetop, pagesize); redraw = TRUE; break; } else if (c >= '0' && c <= '9') { choice = 10 * choice + c - '0'; } else { choice = tablesize + 1; break; } } if (redraw) break; if (choice < 0) { for (choice = 0; choice <= tablesize; choice++) { vt_clear(2); if (table[choice].dispatch != 0) { const char *save = push_menu(choice); const char *name = table[choice].description; if (LOG_ENABLED) fprintf(log_fp, "Menu %s: %s\n", current_menu, name); if ((*table[choice].dispatch) (name) == MENU_HOLD) holdit(); pop_menu(save); } } return 1; } else if (choice <= tablesize) { vt_clear(2); if (table[choice].dispatch != 0) { const char *save = push_menu(choice); const char *name = table[choice].description; if (LOG_ENABLED) fprintf(log_fp, "Menu %s: %s\n", current_menu, name); if ((*table[choice].dispatch) (name) != MENU_NOHOLD) holdit(); pop_menu(save); } return (table[choice].dispatch != 0); } printf(" Bad choice, try again: "); } } } int menu(MENU *table) { return menu2(table, 6); } /* * Return updated row-number based on the number of characters printed to the * screen, e.g., for test_report_ops() to handle very long results. */ int chrprint2(const char *s, int row, int col) { int i; int result = row; int tracks = (col += 2); char temp[80]; printf(" "); vt_hilite(TRUE); printf(" "); tracks += 3; for (i = 0; s[i] != '\0'; i++) { int c = (unsigned char) s[i]; if (c <= ' ' || c >= '\177') { sprintf(temp, "<%d> ", c); } else { sprintf(temp, "%c ", c); } tracks += (int) strlen(temp); if ((tracks > min_cols) && (col > 1)) { vt_move(++result, col); tracks = col + (int) strlen(temp); } fputs(temp, stdout); } vt_hilite(FALSE); return result + 1; } void chrprint(const char *s) { chrprint2(s, 1, 1); } /* * Returns a pointer past the prefix, or null if no match is found */ char * skip_prefix(const char *prefix, char *input) { while (*prefix != '\0') { if (*prefix++ != *input++) return 0; } return input; } char * skip_csi(char *input) { if ((unsigned char) *input == CSI) { return input + 1; } return skip_prefix(csi_input(), input); } char * skip_dcs(char *input) { if ((unsigned char) *input == DCS) { return input + 1; } return skip_prefix(dcs_input(), input); } char * skip_ss3(char *input) { if ((unsigned char) *input == SS3) { return input + 1; } return skip_prefix(ss3_input(), input); } /* * Variant with const params */ const char * skip_prefix_2(const char *prefix, const char *input) { while (*prefix != '\0') { if (*prefix++ != *input++) return 0; } return input; } const char * skip_csi_2(const char *input) { if ((unsigned char) *input == CSI) { return input + 1; } return skip_prefix_2(csi_input(), input); } const char * skip_dcs_2(const char *input) { if ((unsigned char) *input == DCS) { return input + 1; } return skip_prefix_2(dcs_input(), input); } const char * skip_ss3_2(const char *input) { if ((unsigned char) *input == SS3) { return input + 1; } return skip_prefix_2(ss3_input(), input); } /* * Returns a pointer past digits, or null if none are found */ char * skip_digits(char *src) { char *base = src; while (*src != '\0' && isdigit(CharOf(*src))) src++; return (base == src) ? 0 : src; } char * skip_xdigits(char *src) { char *base = src; while (*src != '\0' && isxdigit(CharOf(*src))) src++; return (base == src) ? 0 : src; } const char * skip_digits_2(const char *src) { const char *base = src; while (*src != '\0' && isdigit(CharOf(*src))) src++; return (base == src) ? 0 : src; } /* * Strip the string terminator (ST) from the given string, returning true if * we did this. */ int strip_suffix(char *src, const char *suffix) { int have = (int) strlen(src); int want = (int) strlen(suffix); if (have > want) { have -= want; if (!strcmp(src + have, suffix)) { src[have] = '\0'; return TRUE; } } return FALSE; } /* * Strip the string terminator (ST) from the given string, returning true if * we did this. */ int strip_terminator(char *src) { int ok = strip_suffix(src, st_input()); if (!ok) { int have = (int) strlen(src); if (have > 0 && (unsigned char) src[have - 1] == ST) { ok = TRUE; src[--have] = '\0'; } } if (!ok && LOG_ENABLED) fprintf(log_fp, "Missing ST\n"); return ok; } /* Parse the contents of a report from DECRQSS, returning the data as well */ int parse_decrqss(char *report, const char *func) { int code = -1; char *parse = report; if ((parse = skip_dcs(parse)) != 0 && strip_terminator(parse) && strip_suffix(parse, func)) { if (!strncmp(parse, "1$r", (size_t) 3)) code = 1; else if (!strncmp(parse, "0$r", (size_t) 3)) code = 0; } if (code >= 0) { while ((*report++ = parse[3]) != '\0') parse++; } return code; } int title(int offset) { vt_move(TITLE_LINE + offset, 10); if (offset == 0 && *current_menu) printf("Menu %s: ", current_menu); return 1; /* used for indenting */ } static void my_vfprintf(FILE *fp, va_list ap, const char *fmt) { while (*fmt != '\0') { if (*fmt == '%') { switch (*++fmt) { case 'c': fputc(va_arg(ap, int), fp); break; case 'x': fprintf(fp, "%x", va_arg(ap, int)); break; case 'd': fprintf(fp, "%d", va_arg(ap, int)); break; case 's': fputs(va_arg(ap, char *), fp); break; } } else if (*fmt != '\n') { fputc(*fmt, fp); } fmt++; } } /* * Show a test-result, optionally logging it as well. */ void show_result(const char *fmt,...) { va_list ap; if (*fmt != ' ') fputc(' ', stdout); va_start(ap, fmt); my_vfprintf(stdout, ap, fmt); va_end(ap); if (LOG_ENABLED) { fputs("Result: ", log_fp); va_start(ap, fmt); my_vfprintf(log_fp, ap, fmt); va_end(ap); fputc('\n', log_fp); } } /* * Use this to make some complex stuff (such as scrolling) slow enough to see. */ void slowly(void) { if (slow_motion) { #ifdef HAVE_USLEEP fflush(stdout); zleep(100); #endif } } /* * Bypass normal logging for control sequences that are used only to format * the test results. */ void vt_clear(int code) { log_disabled++; ed(code); log_disabled--; } void vt_el(int code) { log_disabled++; el(code); log_disabled--; } int vt_move(int row, int col) { log_disabled++; cup(row, col); log_disabled--; return 1; } void vt_hilite(int flag) { log_disabled++; sgr(flag ? "7" : ""); log_disabled--; } vttest-20140116/reset.c0000644000175100001440000000345411667370720013327 0ustar tomusers/* $Id: reset.c,v 1.7 2011/12/06 10:43:28 tom Exp $ */ #include #include static int did_reset = FALSE; int tst_DECSTR(MENU_ARGS) { vt_move(1, 1); println(the_title); println("(VT220 & up)"); println(""); println("The terminal will now soft-reset"); holdit(); decstr(); return MENU_HOLD; } static int tst_DECTST(MENU_ARGS) { vt_move(1, 1); println(the_title); println(""); if (did_reset) println("The terminal is now RESET. Next, the built-in confidence test"); else printf("The built-in confidence test "); printf("will be invoked. "); holdit(); vt_clear(2); dectst(1); zleep(5000); /* Wait 5.0 seconds */ vt_move(10, 1); println("If the built-in confidence test found any errors, a code"); printf("%s", "is visible above. "); did_reset = FALSE; return MENU_HOLD; } static int tst_RIS(MENU_ARGS) { vt_move(1, 1); println(the_title); println("(VT100 & up, not recommended)"); println(""); printf("The terminal will now be RESET. "); holdit(); ris(); zleep(5000); /* Wait 5.0 seconds */ did_reset = TRUE; reset_level(); input_8bits = FALSE; output_8bits = FALSE; return MENU_HOLD; } int tst_rst(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Reset to Initial State (RIS)", tst_RIS }, { "Invoke Terminal Test (DECTST)", tst_DECTST }, { "Soft Terminal Reset (DECSTR)", tst_DECSTR }, { "", 0 } }; /* *INDENT-ON* */ did_reset = FALSE; do { vt_clear(2); __(title(0), printf("%s", the_title)); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } vttest-20140116/xterm.c0000644000175100001440000004720011737011301013322 0ustar tomusers/* $Id: xterm.c,v 1.52 2012/04/04 09:22:09 tom Exp $ */ #include #include #include #define Pause(secs) fflush(stdout); sleep(secs) static void check_rc(int row, int col) { char *report; char *params; char expected[80]; sprintf(expected, "%d;%dR", row, col); set_tty_raw(TRUE); set_tty_echo(FALSE); do_csi("6n"); report = get_reply(); restore_ttymodes(); vt_move(row, 1); el(2); if ((params = skip_csi(report)) == 0 || strcmp(params, expected) != 0) { printf("cursor save/restore %s, got \"%s\", expected \"%s\"", SHOW_FAILURE, params, expected); } else { printf("cursor save/restore %s", SHOW_SUCCESS); } } static int test_altscrn_47(MENU_ARGS) { vt_move(1, 1); println(the_title); vt_move(3, 1); println("Test private setmode 47 (to/from alternate screen)"); vt_move(4, 1); println("The next screen will be filled with E's down to the prompt."); vt_move(7, 5); decsc(); cup(max_lines - 2, 1); holdit(); sm("?47"); decaln(); /* fill the screen */ vt_move(15, 7); decsc(); cup(max_lines - 2, 1); ed(0); holdit(); rm("?47"); decrc(); check_rc(7, 5); vt_move(4, 1); el(2); println("The original screen should be restored except for this line."); vt_move(max_lines - 2, 1); return MENU_HOLD; } static int test_altscrn_1047(MENU_ARGS) { vt_move(1, 1); println(the_title); vt_move(3, 1); println("Test private setmode 1047 (to/from alternate screen)"); vt_move(4, 1); println("The next screen will be filled with E's down to the prompt"); vt_move(5, 1); println("unless titeInhibit resource is set, or alternate-screen is disabled."); vt_move(7, 5); decsc(); vt_move(9, 7); /* move away from the place we saved with DECSC */ sm("?1048"); /* this saves the cursor position */ cup(max_lines - 2, 1); holdit(); sm("?1047"); decaln(); /* fill the screen */ vt_move(15, 7); decsc(); cup(max_lines - 2, 1); ed(0); holdit(); rm("?1047"); decrc(); rm("?1048"); check_rc(9, 7); vt_move(4, 1); el(2); println("The original screen should be restored except for this line"); vt_move(max_lines - 2, 1); return MENU_HOLD; } static int test_altscrn_1049(MENU_ARGS) { vt_move(1, 1); println(the_title); vt_move(3, 1); println("Test private setmode 1049 (to/from alternate screen)"); vt_move(4, 1); println("The next screen will be filled with E's down to the prompt."); vt_move(5, 1); println("unless titeInhibit resource is set, or alternate-screen is disabled."); vt_move(7, 5); decsc(); cup(max_lines - 2, 1); holdit(); /* cursor location will be one line down */ sm("?1049"); /* this saves the cursor location */ decaln(); /* fill the screen */ cup(max_lines - 2, 1); ed(0); holdit(); rm("?1049"); decrc(); check_rc(max_lines - 1, 1); vt_move(4, 1); el(2); println("The original screen should be restored except for this line"); vt_move(max_lines - 2, 1); return MENU_HOLD; } /* * Xterm implements an alternate screen, which is used to save the command-line * screen to restore it after running a full-screen application. * * The original scheme used separate save/restore-cursor and clear-screen * operations in conjunction with a toggle to/from the alternate screen * (private setmode 47). Since not all users want the feature, xterm also * implements the titeInhibit resource to make it populate the $TERMCAP * variable without the ti/te (smcup/rmcup) strings which hold those sequences. * The limitation of titeInhibit is that it cannot work for terminfo, because * that information is read from a file rather than the environment. I * implemented a corresponding set of strings for private setmode 1047 and 1048 * to model the termcap behavior in terminfo. * * The behavior of the save/restore cursor operations still proved * unsatisfactory since users would (even in the original private setmode 47) * occasionally run shell programs from within their full-screen application * which would do a save-cursor to a different location, causing the final * restore-cursor to place the cursor in an unexpected location. The private * setmode 1049 works around this by using a separate memory location to store * its version of the cursor location. */ static int tst_altscrn(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Switch to/from alternate screen (xterm)", test_altscrn_47 }, { "Improved alternate screen (XFree86 xterm mode 1047)", test_altscrn_1047 }, { "Better alternate screen (XFree86 xterm mode 1049)", test_altscrn_1049 }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), println("XTERM Alternate-Screen features")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } #define NUMFONTS 7 static int tst_modify_font(MENU_ARGS) { char temp[BUFSIZ]; vt_move(1, 1); println("Please enter the font name."); println("You can use '#' number to set fonts relative (with +/- sign) and"); println("absolute (with a number) based on the current font's position in"); println("the font-menu. Examples:"); println(" \"fixed\" to set the current font to \"fixed\""); println(" \"#fixed\" to set the current font to \"fixed\""); println(" \"#-fixed\" to set the previous font to \"fixed\""); println(" \"#-2 fixed\" to set the next-previous font to \"fixed\""); println(" \"#+fixed\" to set the following font to \"fixed\""); vt_move(11, 1); printf(">"); inputline(temp); do_osc("50;%s%c", temp, BEL); return MENU_HOLD; } static int tst_report_font(MENU_ARGS) { int n; char *report; int row = 1; int col = 1; set_tty_raw(TRUE); set_tty_echo(FALSE); vt_move(row, col); println("Current font:"); ++row; vt_move(row, col + 6); do_osc("50;?%c", BEL); report = instr(); row = chrprint2(report, row, col); ++row; vt_move(row, col); println("Absolute fonts:"); ++row; for (n = 0; n < NUMFONTS; ++n) { vt_move(row, col); do_osc("50;?%d%c", n, BEL); report = instr(); if (strchr(report, ';') != 0) { printf(" %2d: ", n); row = chrprint2(report, row, col); } } ++row; vt_move(row, col); println("Relative fonts (bell may sound):"); ++row; for (n = -NUMFONTS; n < NUMFONTS; ++n) { vt_move(row, col); do_osc("50;?%c%d%c", n >= 0 ? '+' : '-', n >= 0 ? n : -n, BEL); report = instr(); if (strchr(report, ';') != 0) { printf(" %2d: ", n); row = chrprint2(report, row, col); } else if (n >= 0) { break; } } restore_ttymodes(); return MENU_HOLD; } static int tst_font(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Modify font", tst_modify_font }, { "Report font(s)", tst_report_font }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), println("XTERM Font features")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } static int test_modify_ops(MENU_ARGS) { int n; int wide, high; char temp[100]; vt_move(1, 1); println("Test of Window modifying."); brc(2, 't'); /* iconify window */ println("Iconify"); Pause(2); brc(1, 't'); /* de-iconify window */ println("De-Iconify"); Pause(1); ed(2); for (n = 0; n <= 200; n += 5) { sprintf(temp, "Position (%d,%d)", n, n * 2); println(temp); esc("K"); /* Erase to end of line */ brc3(3, n, n * 2, 't'); fflush(stdout); } holdit(); ed(2); brc3(3, 0, 0, 't'); for (n = 0; n <= 200; n += 10) { wide = n + 20; high = n + 50; brc3(4, high, wide, 't'); sprintf(temp, "%d x %d pixels", high, wide); println(temp); fflush(stdout); } holdit(); ed(2); for (n = 0; n <= 200; n += 10) { high = n + 50; brc3(4, high, 0, 't'); sprintf(temp, "%d x (screen-width) pixels", high); println(temp); fflush(stdout); } holdit(); ed(2); for (n = 0; n <= 300; n += 10) { wide = n + 50; brc3(4, 0, wide, 't'); sprintf(temp, "(screen-height) x %d pixels", wide); println(temp); fflush(stdout); } holdit(); while (n >= 200) { wide = n + 50; high = 500 - n; brc3(4, high, wide, 't'); sprintf(temp, "%d x %d pixels", high, wide); println(temp); fflush(stdout); n -= 5; } holdit(); while (n <= 300) { wide = n + 50; high = 500 - n; brc3(4, high, wide, 't'); sprintf(temp, "%d x %d pixels", high, wide); println(temp); fflush(stdout); n += 5; } holdit(); ed(2); for (n = 5; n <= 20; n++) { wide = n * 4; high = n + 5; brc3(8, high, wide, 't'); sprintf(temp, "%d x %d chars", high, wide); while ((int) strlen(temp) < wide - 1) strcat(temp, "."); println(temp); fflush(stdout); } holdit(); ed(2); for (n = 5; n <= 24; n++) { high = n; brc3(8, high, 0, 't'); sprintf(temp, "%d x (screen-width) chars", high); println(temp); fflush(stdout); } holdit(); ed(2); for (n = 5; n <= 80; n++) { wide = n; brc3(8, 0, wide, 't'); sprintf(temp, "(screen-height) x %d chars", wide); println(temp); fflush(stdout); } holdit(); brc3(3, 200, 200, 't'); brc3(8, 24, 80, 't'); println("Reset to 24 x 80"); ed(2); println("Lower"); brc(6, 't'); holdit(); ed(2); println("Raise"); brc(5, 't'); return MENU_HOLD; } static int test_report_ops(MENU_ARGS) { char *report; int row = 3; int col = 10; vt_move(1, 1); println("Test of Window reporting."); set_tty_raw(TRUE); set_tty_echo(FALSE); vt_move(row++, 1); println("Report icon label:"); vt_move(row, col); brc(20, 't'); /* report icon label */ report = instr(); row = chrprint2(report, row, col); vt_move(row++, 1); println("Report window label:"); vt_move(row, col); brc(21, 't'); /* report window label */ report = instr(); row = chrprint2(report, row, col); vt_move(row++, 1); println("Report size of window (chars):"); vt_move(row++, col); brc(18, 't'); /* report window's text-size */ report = instr(); chrprint(report); vt_move(row++, 1); println("Report size of window (pixels):"); vt_move(row++, col); brc(14, 't'); /* report window's pixel-size */ report = instr(); chrprint(report); vt_move(row++, 1); println("Report position of window (pixels):"); vt_move(row++, col); brc(13, 't'); /* report window's pixel-size */ report = instr(); chrprint(report); vt_move(row++, 1); println("Report state of window (normal/iconified):"); vt_move(row, col); brc(11, 't'); /* report window's pixel-size */ report = instr(); chrprint(report); vt_move(20, 1); restore_ttymodes(); return MENU_HOLD; } /* Set window title */ static int test_window_name(MENU_ARGS) { char temp[BUFSIZ]; vt_move(1, 1); println("Please enter the new window name. Newer xterms may beep when setting the title."); inputline(temp); do_osc("0;%s%c", temp, BEL); return MENU_NOHOLD; } #define DATA(name,level) { name, #name, level } /* * xterm's DECRQM codes are based on VT320/VT420/VT520, but there are a few * conflicting modes (adapted from rxvt), as well as xterm's extensions. * Those are reflected in the naming conventions. * * The names chosen here are short, to keep display alignment. */ #define XT_MSE_X10 9 #define XT_TOOLBAR 10 #define XT_CBLINK 12 #define XT_SCRLBAR 30 #define XT_FONTSWT 35 #define XT_CURSES 41 #define XT_MARBELL 44 #define XT_REVWRAP 45 #define XT_LOGGING 46 #define XT_ALTSCRN 47 #define XT_MSE_X11 1000 #define XT_MSE_HL 1001 #define XT_MSE_BTN 1002 #define XT_MSE_ANY 1003 #define XT_MSE_WIN 1004 #define XT_MSE_UTF 1005 #define XT_TTY_OUT 1010 #define XT_SCRLKEY 1011 #define XT_IN_8BIT 1034 #define XT_NUMLOCK 1035 #define XT_METAESC 1036 #define XT_DELTDEL 1037 #define XT_ALT_ESC 1039 #define XT_KEEPSEL 1040 #define XT_SELTCLP 1041 #define XT_BELLURG 1042 #define XT_POPBELL 1043 #define XT_ALTS_47 1047 #define XT_ALTS_48 1048 #define XT_EXTSCRN 1049 #define XT_KT_TCAP 1050 #define XT_KT_SUN 1051 #define XT_KT_HP 1052 #define XT_KT_SCO 1053 #define XT_KT_OLD 1060 #define XT_KT_PC 1061 #define RL_BTN1 2001 #define RL_BTN2 2002 #define RL_DBTN3 2003 #define RL_BRACKET 2004 #define RL_QUOTE 2005 #define RL_LIT_NL 2006 static int tst_xterm_DECRPM(MENU_ARGS) { /* *INDENT-OFF* */ RQM_DATA dec_modes[] = { /* this list is sorted by code, not name */ DATA( DECCKM, 3 /* cursor keys */), DATA( DECANM, 3 /* ANSI */), DATA( DECCOLM, 3 /* column */), DATA( DECSCLM, 3 /* scrolling */), DATA( DECSCNM, 3 /* screen */), DATA( DECOM, 3 /* origin */), DATA( DECAWM, 3 /* autowrap */), DATA( DECARM, 3 /* autorepeat */), DATA( XT_MSE_X10, 3 /* X10 mouse */), DATA( XT_TOOLBAR, 3 /* rxvt toolbar vs DECEDM */), DATA( DECLTM, 3 /* line transmit */), DATA( XT_CBLINK, 3 /* att610: Start/stop blinking cursor */), DATA( DECSCFDM, 3 /* space compression field delimiter */), DATA( DECTEM, 3 /* transmission execution */), DATA( DECEKEM, 3 /* edit key execution */), DATA( DECPFF, 3 /* print form feed */), DATA( DECPEX, 3 /* printer extent */), DATA( DECTCEM, 3 /* text cursor enable */), DATA( XT_SCRLBAR, 3 /* rxvt scrollbar */), DATA( DECRLM, 5 /* left-to-right */), DATA( XT_FONTSWT, 3 /* rxvt font-switching vs DECTEK */), DATA( DECHEM, 5 /* Hebrew encoding */), DATA( XT_CURSES, 3 /* curses hack */), DATA( DECNRCM, 3 /* national replacement character set */), DATA( DECGEPM, 3 /* graphics expanded print */), DATA( XT_MARBELL, 3 /* margin bell vs DECGPCM */), DATA( XT_REVWRAP, 3 /* reverse-wrap vs DECGPCS */), DATA( XT_LOGGING, 3 /* logging vs DECGPBM */), DATA( XT_ALTSCRN, 3 /* alternate screen vs DECGRPM */), DATA( DEC131TM, 3 /* VT131 transmit */), DATA( DECNAKB, 5 /* Greek/N-A Keyboard Mapping */), DATA( DECHCCM, 3 /* horizontal cursor coupling (disabled) */), DATA( DECVCCM, 3 /* vertical cursor coupling */), DATA( DECPCCM, 3 /* page cursor coupling */), DATA( DECNKM, 3 /* numeric keypad */), DATA( DECBKM, 3 /* backarrow key */), DATA( DECKBUM, 3 /* keyboard usage */), DATA( DECLRMM, 4 /* left/right margin mode */), DATA( DECXRLM, 3 /* transmit rate linking */), DATA( DECKPM, 4 /* keyboard positioning */), DATA( DECNCSM, 5 /* no clearing screen on column change */), DATA( DECRLCM, 5 /* right-to-left copy */), DATA( DECCRTSM, 5 /* CRT save */), DATA( DECARSM, 5 /* auto resize */), DATA( DECMCM, 5 /* modem control */), DATA( DECAAM, 5 /* auto answerback */), DATA( DECCANSM, 5 /* conceal answerback */), DATA( DECNULM, 5 /* null */), DATA( DECHDPXM, 5 /* half duplex */), DATA( DECESKM, 5 /* enable secondary keyboard language */), DATA( DECOSCNM, 5 /* overscan */), DATA( DECFWM, 5 /* framed windows */), DATA( DECRPL, 5 /* review previous lines */), DATA( DECHWUM, 5 /* host wake-up mode (CRT and energy saver) */), DATA( DECATCUM, 5 /* alternate text color underline */), DATA( DECATCBM, 5 /* alternate text color blink */), DATA( DECBBSM, 5 /* bold and blink style */), DATA( DECECM, 5 /* erase color */), DATA( XT_MSE_X11, 3 /* VT200 mouse */), DATA( XT_MSE_HL, 3 /* VT200 highlight mouse */), DATA( XT_MSE_BTN, 3 /* button-event mouse */), DATA( XT_MSE_ANY, 3 /* any-event mouse */), DATA( XT_MSE_WIN, 3 /* focus-event mouse */), DATA( XT_MSE_UTF, 3 /* extended mouse-coordinates */), DATA( XT_TTY_OUT, 3 /* rxvt scroll tty output */), DATA( XT_SCRLKEY, 3 /* rxvt scroll key */), DATA( XT_IN_8BIT, 3 /* input eight bits */), DATA( XT_NUMLOCK, 3 /* real num lock */), DATA( XT_METAESC, 3 /* meta sends escape */), DATA( XT_DELTDEL, 3 /* delete is del */), DATA( XT_ALT_ESC, 3 /* alt sends escape */), DATA( XT_KEEPSEL, 3 /* keep selection */), DATA( XT_SELTCLP, 3 /* select to clipboard */), DATA( XT_BELLURG, 3 /* bell is urgent */), DATA( XT_POPBELL, 3 /* pop on bell */), DATA( XT_ALTS_47, 3 /* first extended alt-screen */), DATA( XT_EXTSCRN, 3 /* second extended alt-screen */), DATA( RL_BTN1, 3 /* click1 emit Esc seq to move point*/), DATA( RL_BTN2, 3 /* press2 emit Esc seq to move point*/), DATA( RL_DBTN3, 3 /* Double click-3 deletes */), DATA( RL_BRACKET, 3 /* Surround paste by escapes */), DATA( RL_QUOTE, 3 /* Quote each char during paste */), DATA( RL_LIT_NL, 3 /* Paste "\n" as C-j */), }; /* *INDENT-ON* */ int old_DECRPM = set_DECRPM(3); int code = any_RQM(PASS_ARGS, dec_modes, TABLESIZE(dec_modes), 1); set_DECRPM(old_DECRPM); return code; } /* * Show mouse-modes, offered as an option in the mouse test-screens (since that * is really where these can be tested). */ void show_mousemodes(void) { /* *INDENT-OFF* */ RQM_DATA mouse_modes[] = { /* this list is sorted by code, not name */ DATA( XT_MSE_X10, 3 /* X10 mouse */), DATA( XT_MSE_X11, 3 /* VT200 mouse */), DATA( XT_MSE_HL, 3 /* VT200 highlight mouse */), DATA( XT_MSE_BTN, 3 /* button-event mouse */), DATA( XT_MSE_ANY, 3 /* any-event mouse */), DATA( XT_MSE_WIN, 3 /* focus-event mouse */), DATA( XT_MSE_UTF, 3 /* extended mouse-coordinates */), }; /* *INDENT-ON* */ int old_DECRPM = set_DECRPM(3); vt_clear(2); (void) any_RQM("mouse modes", mouse_modes, TABLESIZE(mouse_modes), 1); set_DECRPM(old_DECRPM); holdit(); } #undef DATA static int tst_xterm_reports(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Test VT520 features", tst_vt520_reports }, { "Request Mode (DECRQM)/Report Mode (DECRPM)", tst_xterm_DECRPM }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), println("XTERM miscellaneous reports")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } /* * xterm (and derived programs such as hpterm, dtterm, rxvt) are the most * widely used vt100 near-compatible terminal emulators (other than modem * programs). dtterm emulates a vt220, as does XFree86 xterm. DECterm * emulates a vt320. */ int tst_xterm(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Test VT520 features", tst_vt520 }, { "Test reporting functions", tst_xterm_reports }, { "Set window title", test_window_name }, { "Font features", tst_font }, { "Mouse features", tst_mouse }, { "Tektronix 4014 features", tst_tek4014 }, { "Alternate-Screen features (xterm)", tst_altscrn }, { "Window modify-operations (dtterm)", test_modify_ops }, { "Window report-operations (dtterm)", test_report_ops }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), println("XTERM special features")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } vttest-20140116/vttest.h0000644000175100001440000002425112266045656013544 0ustar tomusers/* $Id: vttest.h,v 1.98 2014/01/16 21:14:22 tom Exp $ */ #ifndef VTTEST_H #define VTTEST_H 1 #define VERSION "1.7b 1985-04-19" #include /* Choose one of these */ #ifdef HAVE_CONFIG_H #include #define UNIX #else /* Assume ANSI and (minimal) Posix */ #define HAVE_STDLIB_H 1 #define HAVE_STRING_H 1 #define RETSIGTYPE void #endif #ifndef GCC_UNUSED #define GCC_UNUSED /* ARGSUSED */ #endif #define SIG_ARGS int sig /* FIXME: configure-test */ #include #include #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_STRING_H #include #endif #include #if defined(HAVE_TERMIOS_H) && defined(HAVE_TCGETATTR) # define USE_POSIX_TERMIOS 1 #else # ifdef HAVE_TERMIO_H # define USE_TERMIO 1 # else # ifdef HAVE_SGTTY_H # define USE_SGTTY 1 # define USE_FIONREAD 1 # else # ifdef VMS /* FIXME */ # else please fix me # endif # endif # endif #endif #ifndef USE_FIONREAD #define USE_FIONREAD 0 #endif #ifndef USE_POSIX_TERMIOS #define USE_POSIX_TERMIOS 0 #endif #ifndef USE_SGTTY #define USE_SGTTY 0 #endif #ifndef USE_TERMIO #define USE_TERMIO 0 #endif #include #include #if USE_POSIX_TERMIOS # include # define TTY struct termios #else # if USE_TERMIO # include /*# define TCSANOW TCSETA */ /*# define TCSADRAIN TCSETAW */ /*# define TCSAFLUSH TCSETAF */ # define TTY struct termio # define tcsetattr(fd, cmd, arg) ioctl(fd, cmd, arg) # define tcgetattr(fd, arg) ioctl(fd, TCGETA, arg) # define VDISABLE (unsigned char)(-1) # else # if USE_SGTTY # include # define TTY struct sgttyb # endif # endif #endif #ifdef HAVE_SYS_FILIO_H # include /* FIONREAD */ #endif #ifdef HAVE_FCNTL_H #include #endif #if !defined(sun) || !defined(NL0) # ifdef HAVE_IOCTL_H # include # else # ifdef HAVE_SYS_IOCTL_H # include # endif # endif #endif #include #define LOG_ENABLED ((log_fp != (FILE *) 0) && !log_disabled) #define CharOf(c) ((unsigned char)(c)) extern FILE *log_fp; extern int brkrd; extern int do_colors; extern int input_8bits; extern int log_disabled; extern int lrmm_flag; extern int max_cols; extern int max_lines; extern int min_cols; extern int origin_mode; extern int output_8bits; extern int reading; extern int slow_motion; extern int tty_speed; extern int use_padding; extern jmp_buf intrenv; #ifndef TRUE #define TRUE (1) #endif #ifndef FALSE #define FALSE (0) #endif #ifndef EXIT_SUCCESS #define EXIT_SUCCESS 0 #endif #ifndef EXIT_FAILURE #define EXIT_FAILURE 1 #endif #define SHOW_SUCCESS "ok" #define SHOW_FAILURE "failed" #undef __ #define __(a,b) (void)(a && b) #define TABLESIZE(table) (int)(sizeof(table)/sizeof(table[0])) #define DEFAULT_SPEED 9600 #define TABWIDTH 8 #define STR_ENABLE(flag) ((flag) ? "Disable" : "Enable") #define STR_ENABLED(flag) ((flag) ? "enabled" : "disabled") #define STR_START(flag) ((flag) ? "Stop" : "Start") #if !defined(__GNUC__) && !defined(__attribute__) #define __attribute__(p) /* nothing */ #endif #ifndef GCC_PRINTFLIKE #define GCC_PRINTFLIKE(fmt,var) /* nothing */ #endif #ifndef GCC_UNUSED #define GCC_UNUSED /* nothing */ #endif /* my SunOS 4.1.x doesn't have prototyped headers */ #if defined(__GNUC__) && defined(sun) && !defined(__SVR4) extern void perror(const char *s); extern int _flsbuf(int c, FILE *s); extern int fclose(FILE *s); extern int fflush(FILE *s); extern int fprintf(FILE *s, const char *fmt,...); extern int fgetc(FILE *s); extern int fputc(int c, FILE *s); extern int fputs(char *p, FILE *s); extern int ioctl(int fd, unsigned long mask, void *p); extern int printf(const char *fmt,...); extern int scanf(const char *fmt,...); extern int sscanf(const char *src, const char *fmt,...); extern long strtol(const char *src, char **dst, int base); #endif #define MENU_DECL const char * the_title #define MENU_ARGS const char * the_title GCC_UNUSED #define PASS_ARGS /* const char * */the_title typedef struct { const char *description; int (*dispatch) (MENU_ARGS); } MENU; typedef struct { int cur_level; int input_8bits; int output_8bits; } VTLEVEL; typedef struct { int mode; const char *name; int level; } RQM_DATA; #define MENU_NOHOLD 0 #define MENU_HOLD 1 #define MENU_MERGE 2 #define TITLE_LINE 3 #define WHITE_ON_BLUE "0;37;44" #define WHITE_ON_GREEN "0;37;42" #define YELLOW_ON_BLACK "0;33;40" #define BLINK_REVERSE "0;5;7" extern char origin_mode_mesg[80]; extern char lrmm_mesg[80]; extern char lr_marg_mesg[80]; extern char tb_marg_mesg[80]; extern char txt_override_color[80]; extern RETSIGTYPE onbrk(SIG_ARGS); extern RETSIGTYPE onterm(SIG_ARGS); extern char *skip_csi(char *input); extern char *skip_dcs(char *input); extern char *skip_digits(char *src); extern char *skip_prefix(const char *prefix, char *input); extern char *skip_ss3(char *input); extern char *skip_xdigits(char *src); extern const char *parse_Sdesig(const char *source, int *offset); extern const char *skip_csi_2(const char *input); extern const char *skip_dcs_2(const char *input); extern const char *skip_digits_2(const char *src); extern const char *skip_prefix_2(const char *prefix, const char *input); extern const char *skip_ss3_2(const char *input); extern int any_DSR(MENU_ARGS, const char *text, void (*explain) (char *report)); extern int any_RQM(MENU_ARGS, RQM_DATA * table, int tablesize, int private); extern int any_decrqpsr(MENU_ARGS, int Ps); extern int any_decrqss(const char *msg, const char *func); extern int any_decrqss2(const char *msg, const char *func, const char *expected); extern int bug_a(MENU_ARGS); extern int bug_b(MENU_ARGS); extern int bug_c(MENU_ARGS); extern int bug_d(MENU_ARGS); extern int bug_e(MENU_ARGS); extern int bug_f(MENU_ARGS); extern int bug_l(MENU_ARGS); extern int bug_s(MENU_ARGS); extern int bug_w(MENU_ARGS); extern int chrprint2(const char *s, int row, int col); extern int conv_to_utf32(unsigned *target, const char *source, unsigned limit); extern int conv_to_utf8(unsigned char *target, unsigned source, unsigned limit); extern int get_bottom_margin(int n); extern int get_left_margin(void); extern int get_level(void); extern int get_right_margin(void); extern int get_top_margin(void); extern int main(int argc, char *argv[]); extern int menu(MENU *table); extern int menu2(MENU *table, int tp); extern int not_impl(MENU_ARGS); extern int parse_decrqss(char *report, const char *func); extern int rpt_DECSTBM(MENU_ARGS); extern int scan_any(char *str, int *pos, int toc); extern int scanto(const char *str, int *pos, int toc); extern int set_DECRPM(int level); extern int set_level(int level); extern int setup_terminal(MENU_ARGS); extern int strip_suffix(char *src, const char *suffix); extern int strip_terminator(char *src); extern int terminal_id(void); extern int title(int offset); extern int toggle_DECOM(MENU_ARGS); extern int toggle_LRMM(MENU_ARGS); extern int toggle_SLRM(MENU_ARGS); extern int toggle_STBM(MENU_ARGS); extern int toggle_color_mode(MENU_ARGS); extern int tst_CBT(MENU_ARGS); extern int tst_CHA(MENU_ARGS); extern int tst_CHT(MENU_ARGS); extern int tst_CNL(MENU_ARGS); extern int tst_CPL(MENU_ARGS); extern int tst_DECRPM(MENU_ARGS); extern int tst_DECSTR(MENU_ARGS); extern int tst_DSR_cursor(MENU_ARGS); extern int tst_DSR_keyboard(MENU_ARGS); extern int tst_DSR_locator(MENU_ARGS); extern int tst_DSR_printer(MENU_ARGS); extern int tst_DSR_userkeys(MENU_ARGS); extern int tst_HPA(MENU_ARGS); extern int tst_HPR(MENU_ARGS); extern int tst_SD(MENU_ARGS); extern int tst_SRM(MENU_ARGS); extern int tst_SU(MENU_ARGS); extern int tst_VPA(MENU_ARGS); extern int tst_VPR(MENU_ARGS); extern int tst_bugs(MENU_ARGS); extern int tst_characters(MENU_ARGS); extern int tst_colors(MENU_ARGS); extern int tst_doublesize(MENU_ARGS); extern int tst_ecma48_curs(MENU_ARGS); extern int tst_ecma48_misc(MENU_ARGS); extern int tst_insdel(MENU_ARGS); extern int tst_keyboard(MENU_ARGS); extern int tst_keyboard_layout(char *scs_params); extern int tst_mouse(MENU_ARGS); extern int tst_movements(MENU_ARGS); extern int tst_nonvt100(MENU_ARGS); extern int tst_printing(MENU_ARGS); extern int tst_reports(MENU_ARGS); extern int tst_rst(MENU_ARGS); extern int tst_screen(MENU_ARGS); extern int tst_setup(MENU_ARGS); extern int tst_softchars(MENU_ARGS); extern int tst_statusline(MENU_ARGS); extern int tst_tek4014(MENU_ARGS); extern int tst_vt220(MENU_ARGS); extern int tst_vt220_device_status(MENU_ARGS); extern int tst_vt220_reports(MENU_ARGS); extern int tst_vt220_screen(MENU_ARGS); extern int tst_vt320(MENU_ARGS); extern int tst_vt320_DECRQSS(MENU_ARGS); extern int tst_vt320_cursor(MENU_ARGS); extern int tst_vt320_device_status(MENU_ARGS); extern int tst_vt320_report_presentation(MENU_ARGS); extern int tst_vt320_reports(MENU_ARGS); extern int tst_vt320_screen(MENU_ARGS); extern int tst_vt420(MENU_ARGS); extern int tst_vt420_DECRQSS(MENU_ARGS); extern int tst_vt420_cursor(MENU_ARGS); extern int tst_vt420_device_status(MENU_ARGS); extern int tst_vt420_report_presentation(MENU_ARGS); extern int tst_vt420_reports(MENU_ARGS); extern int tst_vt52(MENU_ARGS); extern int tst_vt520(MENU_ARGS); extern int tst_vt520_reports(MENU_ARGS); extern int tst_xterm(MENU_ARGS); extern int vt_move(int row, int col); extern void bye(void); extern void chrprint(const char *s); extern void default_level(void); extern void do_scrolling(void); extern void enable_logging(void); extern void finish_vt420_cursor(MENU_ARGS); extern void initterminal(int pn); extern void menus_vt420_cursor(void); extern void print_chr(int c); extern void print_str(const char *s); extern void reset_level(void); extern void restore_level(VTLEVEL *save); extern void save_level(VTLEVEL *save); extern void scs_graphics(void); extern void scs_normal(void); extern void set_colors(const char *value); extern void setup_softchars(const char *filename); extern void setup_vt420_cursor(MENU_ARGS); extern void show_mousemodes(void); extern void show_result(const char *fmt,...) GCC_PRINTFLIKE(1,2); extern void slowly(void); extern void test_with_margins(int enable); extern void vt_clear(int code); extern void vt_el(int code); extern void vt_hilite(int flag); #endif /* VTTEST_H */ vttest-20140116/tech.set0000644000175100001440000000346003672201500013460 0ustar tomusersWorking...P1;1;1;4{ @ __?~????/??@B????; ???wGGGG/???N????; GGGGGGGG/????????; ???}@@A?/???N????; ???~????/CGGF????; ???~????/???N????; ???}A???/???N????; ???~????/???FC???; ??A}????/???N????; ???~????/??CF????; ???{A@??/???N????; ???~????/???BCG??; ?@A{????/???N????; ???~????/?GCB????; ?_ON????/??@M????; ???NO_??/???M@???; ???WgGGG/?????@A?; ???GKIHG/????????; @ACGO_??/??????@?; ?_OGCA@?/@???????; GGGGGGW?/????????; GGGGGGK?/????????; @ACGo???/GCA@????; ????????/????????; ????????/????????; ????????/????????; ????????/????????; ?OWSQOO?/?@@@@@@?; ?ggwkig?/?A@?????; ?OOQSWO?/?@@@@@@?; ???}@@A?/CGGF????; ???C????/A?????A?; _OGGGOoG/?@AAA@@A; oGGo?Go?/@AA@?A@?; OOOSOOO?/???@????; ?oKAKo??/BAAAAAB?; KScCcSK?/???@????; Wcd~dcW?/??ABA???; ?@~@@B??/?ABA????; OGGO__O?/????????; GCCGOOG?/@@@@@@@?; wCQQQCw?/?@AAA@??; ?CgOgC??/?@???@??; ?oKAKo??/BA???AB?; gkigikg?/?@A?A@??; ?gggikg?/????A@??; ?gggggg?/?AAAAAA?; A}AAA}A?/?B???B??; MO_}_OM?/??ABA???; ????????/????????; AEiQAAA?/ABAAAAA?; ????????/????????; ????????/????????; _??_WEA?/?@A@????; wCAAACw?/AB???BA?; ?AQQQQA?/?AAAAAA?; CA?{AAC?/???B????; oGCCCCC?/?@AAAAA?; CCCCCGo?/AAAAA@??; wCAAACw?/B?????B?; }?????}?/?@AAA@??; ?oKAKo??/B?????B?; EW_?_WE?/??@A@???; ?GGGGGW?/????????; _OGGoOG?/?@AA@@A?; ?_WSqQK?/A@AAA@??; ?GGO__W?/GCA@?@M?; ?_O[QaC?/?@AAA@??; ?ogggG??/?@AAAA??; _OOOoOg?/HEABAA@?; GCGo?_O?/??KN@???; GGoOGGo?/??B???N?; ???w????/???@AA@?; oggggo??/@AAAA@??; C{?_OG??/?B@@AA??; ?CCgO_??/AA@???B?; ????????/????????; CcW??_[?/ABA@@???; CCcSGGo?/??@AAA@?; ?GwGGwG?/?A@??B??; _??w??_?/?@ANA@??; ??_OGGo?/KB??@@??; _OGGWgG?/@AAAA@??; OGGwGGC?/???BA???; ????????/????????; ???}PPA?/EGGF????; oG?_?Go?/@AA@AA@?; OgicCC??/?BAIIE??; Cw????w?/??@AA@??; cQIEEAA?/?@@DDB??; OwSOOOO?/??@?????; ?GC}CG??/???B????; OOOOSwO?/????@???; ?_?}?_??/??@B@???; \Characters Loaded. vttest-20140116/package/0000755000175100001440000000000012266050062013414 5ustar tomusersvttest-20140116/package/freebsd/0000755000175100001440000000000012266037415015035 5ustar tomusersvttest-20140116/package/freebsd/Makefile0000644000175100001440000000107412266037415016477 0ustar tomusers# New ports collection makefile for: vttest # Date created: 2005-07-21 # Whom: Nicola Vitale # # $FreeBSD: ports/sysutils/vttest/Makefile,v 1.8 2012/11/17 06:01:49 svnexp Exp $ # PORTNAME= vttest PORTVERSION= 2014.01.16 CATEGORIES= sysutils MASTER_SITES= ftp://invisible-island.net/vttest/ DISTNAME= ${PORTNAME}-${PORTVERSION:S,.,,g} EXTRACT_SUFX= .tgz MAINTAINER= nivit@FreeBSD.org COMMENT= A program to test "VT100-compatibility" of terminals GNU_CONFIGURE= yes MAKEFILE= makefile MAN1= vttest.1 PLIST_FILES= bin/vttest .include vttest-20140116/package/freebsd/pkg-descr0000644000175100001440000000030410550744502016630 0ustar tomusersThis is a program to test the compatibility (or to demonstrate the non-compatibility) of so-called "VT100-compatible" terminals. Author: Thomas E. Dickey WWW: http://invisible-island.net/vttest/ vttest-20140116/package/freebsd/distinfo0000644000175100001440000000020411773573057016604 0ustar tomusersSHA256 (vttest-20120506.tgz) = 9c03e8e917ab5b06f934c45923dd00a5943c6b36f0a32c38392f8f864d6b39e4 SIZE (vttest-20120506.tgz) = 183236 vttest-20140116/package/debian/0000755000175100001440000000000012266050062014636 5ustar tomusersvttest-20140116/package/debian/prerm0000644000175100001440000000023411435425422015710 0ustar tomusers#! /bin/sh # prerm script for vttest set -e if [ $1 != "upgrade" ]; then update-alternatives --remove vttest /usr/bin/vttest-cur fi #DEBHELPER# exit 0 vttest-20140116/package/debian/changelog0000644000175100001440000000305112266037415016516 0ustar tomusersvttest-cur (2.7.20140116) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Thu, 16 Jan 2014 15:20:29 -0500 vttest-cur (2.7.20130915) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Sun, 15 Sep 2013 09:38:13 -0400 vttest-cur (2.7.20130818) unstable; urgency=low * optionally highlight NRC mappings in character set tests. * minor change to show if cursor-position report accounts for origin-mode -- Thomas E. Dickey Fri, 09 Aug 2013 18:17:35 -0400 vttest-cur (2.7.20120603) unstable; urgency=low * minor change to show if cursor goes to first column on IL/DL -- Thomas E. Dickey Sun, 03 Jun 2012 12:55:59 -0400 vttest-cur (2.7.20120506) unstable; urgency=low * Add tests for DECLRMM left/right margin mode. * Improve DECSCUSR/DECRQSS test. -- Thomas E. Dickey Sun, 25 Mar 2012 15:23:22 -0400 vttest-cur (2.7.20111210) unstable; urgency=low * Add mouse tests for SGR 1006, 1015 -- Thomas E. Dickey Thu, 08 Dec 2011 20:24:31 -0500 vttest-cur (2.7.20110705) unstable; urgency=low * bug-fix for big-endian machines * Add DECRQSS for VT520 -- Thomas E. Dickey Fri, 06 May 2011 15:12:07 -0400 vttest-cur (2.7.20100830) unstable; urgency=low * Add package scripts to upstream source, for test-builds. -- Thomas E. Dickey Thu, 26 Aug 2010 04:45:46 -0400 vttest-20140116/package/debian/control0000644000175100001440000000127311435566204016253 0ustar tomusersSource: vttest-cur Maintainer: Thomas E. Dickey Section: utils Priority: optional Standards-Version: 3.8.4 Build-Depends: debhelper (>= 5) Homepage: http://invisible-island.net/vttest/ Package: vttest-cur Architecture: any Description: pattern scanning and text processing language Vttest is a program designed to test the functionality of a VT100 terminal (or emulator thereof). It tests both display (escape sequence handling) and keyboard. . The program is menu-driven and contains full on-line operating instructions. To run a given menu-item, you must enter its number. You can run all menu-items (for a given level) by entering an asterisk, i.e, `*'. vttest-20140116/package/debian/preinst0000644000175100001440000000072011435576414016257 0ustar tomusers#! /bin/sh # preinst script for vttest set -e PRI=10 ALT=vttest PKG=vttest-base BINDIR=/usr/bin MANDIR=/usr/share/man/man1 if [ ! -f /usr/bin/$PKG \ -a -f /usr/bin/$ALT \ -a ! -f /usr/bin/vttest-cur ] then mv $BINDIR/$ALT $BINDIR/$PKG mv $MANDIR/$ALT.1.gz $MANDIR/$PKG.1.gz update-alternatives \ --install \ $BINDIR/$ALT $ALT \ $BINDIR/$PKG $PRI \ --slave $MANDIR/$ALT.1.gz $ALT.1.gz \ $MANDIR/$PKG.1.gz fi #DEBHELPER# exit 0 vttest-20140116/package/debian/docs0000644000175100001440000000001411435425006015505 0ustar tomusersBUGS README vttest-20140116/package/debian/copyright0000644000175100001440000001320512266050062016572 0ustar tomusersUpstream source http://invisible-island.net/vttest/vttest.html ------------------------------------------------------------------------------- Copyright 1996-2013,2014 by Thomas E. Dickey All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, 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. ------------------------------------------------------------------------------- Files: aclocal.m4 Licence: other-BSD Copyright: 1997-2013,2014 by Thomas E. Dickey Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, distribute with modifications, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name(s) of the above copyright holders shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization. Files: install-sh Copyright: 1994 X Consortium Licence: other-BSD Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other deal- ings in this Software without prior written authorization from the X Consor- tium. FSF changes to this file are in the public domain. Calling this script install-sh is preferred over install.sh, to prevent `make' implicit rules from creating a file called install from it when there is no Makefile. This script is compatible with the BSD install script, but was written from scratch. It can only install one file at a time, a restriction shared with many OS's install programs. Files: debian/* Copyright: 2010 Thomas E. Dickey Licence: other-BSD Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the above listed copyright holder(s) not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL, 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. On Debian systems, the complete text of the GNU General Public License can be found in '/usr/share/common-licenses/GPL-2' vttest-20140116/package/debian/watch0000644000175100001440000000013711435424444015676 0ustar tomusersversion=3 opts=passive ftp://invisible-island.net/vttest/vttest-(\d+)\.tgz \ debian uupdate vttest-20140116/package/debian/source/0000755000175100001440000000000011435432073016141 5ustar tomusersvttest-20140116/package/debian/source/format0000644000175100001440000000001511435432073017350 0ustar tomusers3.0 (native) vttest-20140116/package/debian/postinst0000644000175100001440000000050511435425376016457 0ustar tomusers#! /bin/sh # postinst script for vttest set -e PRI=50 ALT=vttest PKG=vttest-cur BINDIR=/usr/bin MANDIR=/usr/share/man/man1 if [ $1 != "upgrade" ] then update-alternatives \ --install \ $BINDIR/$ALT $ALT \ $BINDIR/$PKG $PRI \ --slave $MANDIR/$ALT.1.gz $ALT.1.gz \ $MANDIR/$PKG.1.gz fi #DEBHELPER# exit 0 vttest-20140116/package/debian/compat0000644000175100001440000000000211363402276016041 0ustar tomusers5 vttest-20140116/package/debian/rules0000755000175100001440000000367211435443321015727 0ustar tomusers#!/usr/bin/make -f # MAde with the aid of dh_make, by Craig Small # Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess. # Some lines taken from debmake, by Cristoph Lameter. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # These are used for cross-compiling and for saving the configure script # from having to guess our platform (since we know it already) DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) CFLAGS = ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O0 else CFLAGS += -O2 endif ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) INSTALL_PROGRAM += -s endif configure: configure-stamp configure-stamp: dh_testdir CFLAGS="$(CFLAGS)" ./configure \ --host=$(DEB_HOST_GNU_TYPE) \ --build=$(DEB_BUILD_GNU_TYPE) \ --prefix=/usr \ --mandir=\$${prefix}/share/man \ --sysconfdir=/etc \ --program-suffix=-cur touch configure-stamp build: build-stamp build-stamp: configure-stamp dh_testdir $(MAKE) touch build-stamp clean: dh_testdir dh_testroot [ ! -f Makefile ] || $(MAKE) clean rm -f configure-stamp build-stamp install-stamp \ config.cache config.h config.status config.log makefile rm -f *.o yacc dh_clean install: install-stamp install-stamp: build-stamp dh_testdir dh_testroot dh_clean -k dh_installdirs $(MAKE) install DESTDIR=$(CURDIR)/debian/vttest-cur touch install-stamp # Build architecture-independent files here. binary-indep: build install # No binary-indep target. # Build architecture-dependent files here. binary-arch: build install dh_testdir dh_testroot dh_installdocs dh_installexamples dh_installchangelogs CHANGES dh_strip dh_compress dh_fixperms dh_installdeb dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install install-stamp vttest-20140116/package/vttest.spec0000644000175100001440000000273412266037415015636 0ustar tomusersSummary: vttest - test VT100-type terminal %define AppProgram vttest %define AppPatched 20140116 %define AppVersion 2.7.%{AppPatched} # $XTermId: vttest.spec,v 1.20 2014/01/16 20:20:29 tom Exp $ Name: %{AppProgram} Version: %{AppVersion} Release: 1 License: MIT Group: Applications/Development URL: ftp://invisible-island.net/%{AppProgram} Source0: %{AppProgram}-%{AppPatched}.tgz Packager: Thomas Dickey %description Vttest is a program designed to test the functionality of a VT100 terminal (or emulator thereof). It tests both display (escape sequence handling) and keyboard. The program is menu-driven and contains full on-line operating instructions. To run a given menu-item, you must enter its number. You can run all menu-items (for a given level) by entering an asterisk, i.e, `*'. %prep %setup -q -n %{AppProgram}-%{AppPatched} %build INSTALL_PROGRAM='${INSTALL}' \ ./configure \ --target %{_target_platform} \ --prefix=%{_prefix} \ --bindir=%{_bindir} \ --libdir=%{_libdir} \ --mandir=%{_mandir} make %install [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT make install DESTDIR=$RPM_BUILD_ROOT strip $RPM_BUILD_ROOT%{_bindir}/%{AppProgram} %clean [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) %{_prefix}/bin/%{AppProgram} %{_mandir}/man1/%{AppProgram}.* %changelog # each patch should add its ChangeLog entries here * Thu Aug 26 2010 Thomas Dickey - initial version vttest-20140116/status.c0000644000175100001440000000455011741566530013525 0ustar tomusers/* $Id: status.c,v 1.7 2012/04/12 14:57:28 tom Exp $ */ #include #include #include static void restore_status(void) { decsasd(0); /* main display */ decssdt(1); /* indicator (default) */ restore_ttymodes(); } static int simple_statusline(MENU_ARGS) { static char text[] = "TEXT IN THE STATUS LINE"; vt_move(1, 1); println("This is a simple test of the status-line"); println(""); decssdt(2); decsasd(1); printf("%s", text); decsasd(0); printf("There should be %s\r\n", text); holdit(); decssdt(0); println("There should be no status line"); holdit(); decssdt(1); println("The status line should be normal (i.e., indicator)"); holdit(); restore_status(); return MENU_NOHOLD; } static int SGR_statusline(MENU_ARGS) { vt_move(1, 1); println("This test writes SGR controls to the status-line"); holdit(); decssdt(2); decsasd(1); el(2); cup(1, 1); sgr("1"); printf("BOLD text "); sgr("0"); printf("NORMAL text "); decsasd(0); holdit(); restore_status(); holdit(); restore_status(); return MENU_NOHOLD; } /* VT200 & up * * CSI Ps $ } DECSASD Select active status display * Ps = 0 select main display * Ps = 1 select status line * Moves cursor to selected display area. This command will be ignored * unless the status line has been enabled by CSI 2 $ ~. When the * status line has been selected cursor remains there until the main * display is reselected by CSI 0 $ }. * * CSI Ps $ ~ DECSSDT Select Status Line Type * Ps meaning * 0 no status line (empty) * 1 indicator line * 2 host-writable line */ int tst_statusline(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Simple Status line Test", simple_statusline }, { "Test Graphic-Rendition in Status line", SGR_statusline }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), println(the_title)); __(title(2), println("Choose test type:")); } while (menu(my_menu)); decssdt(0); return MENU_NOHOLD; } vttest-20140116/setup.c0000644000175100001440000001605212266044434013337 0ustar tomusers/* $Id: setup.c,v 1.33 2014/01/16 21:03:24 tom Exp $ */ #include #include #include static int cur_level = -1; /* current operating level (VT100=1) */ static int max_level = -1; /* maximum operating level */ static int check_8bit_toggle(void) { char *report; set_tty_raw(TRUE); cup(1, 1); dsr(6); padding(5); /* FIXME: may not be needed */ report = get_reply(); restore_ttymodes(); if ((report = skip_csi(report)) != 0 && !strcmp(report, "1;1R")) return TRUE; return FALSE; } /* * Determine the current and maximum operating levels of the terminal */ static void find_levels(void) { char *report; set_tty_raw(TRUE); set_tty_echo(FALSE); da(); report = get_reply(); if (!strcmp(report, "\033/Z")) { cur_level = max_level = 0; /* must be a VT52 */ } else if ((report = skip_csi(report)) == 0 || strncmp(report, "?6", (size_t) 2) || !isdigit(CharOf(report[2])) || report[3] != ';') { cur_level = max_level = 1; /* must be a VT100 */ } else { /* "CSI ? 6 x ; ..." */ cur_level = max_level = report[2] - '0'; /* VT220=2, VT320=3, VT420=4 */ if (max_level >= 4) { decrqss("\"p"); report = get_reply(); if ((report = skip_dcs(report)) != 0 && isdigit(CharOf(*report++)) /* 0 or 1 (by observation, though 1 is an err) */ &&*report++ == '$' && *report++ == 'r' && *report++ == '6' && isdigit(CharOf(*report))) cur_level = *report - '0'; } } if (LOG_ENABLED) { fprintf(log_fp, "Max Operating Level: %d\n", max_level); fprintf(log_fp, "Cur Operating Level: %d\n", cur_level); } restore_ttymodes(); } static int toggle_DECSCL(MENU_ARGS) { int request = cur_level; if (max_level <= 1) { vt_move(1, 1); printf("Sorry, terminal supports only VT%d", terminal_id()); vt_move(max_lines - 1, 1); return MENU_HOLD; } if (++request > max_level) request = 1; set_level(request); restore_ttymodes(); return MENU_NOHOLD; } static int toggle_Logging(MENU_ARGS) { if (log_fp == 0) enable_logging(); else log_disabled = !log_disabled; return MENU_NOHOLD; } static int toggle_Padding(MENU_ARGS) { use_padding = !use_padding; return MENU_NOHOLD; } static int toggle_Slowly(MENU_ARGS) { slow_motion = !slow_motion; return MENU_NOHOLD; } static int toggle_8bit_in(MENU_ARGS) { int old = input_8bits; s8c1t(!old); fflush(stdout); if (!check_8bit_toggle()) { input_8bits = old; vt_clear(2); vt_move(1, 1); println("Sorry, this terminal does not support 8-bit input controls"); return MENU_HOLD; } return MENU_NOHOLD; } /* * This changes the CSI code to/from an escape sequence. */ static int toggle_8bit_out(MENU_ARGS) { int old = output_8bits; fflush(stdout); output_8bits = !output_8bits; if (!check_8bit_toggle()) { output_8bits = old; vt_clear(2); vt_move(1, 1); println("Sorry, this terminal does not support 8-bit output controls"); return MENU_HOLD; } return MENU_NOHOLD; } /******************************************************************************/ void enable_logging(void) { static char my_name[] = "vttest.log"; log_fp = fopen(my_name, "w"); if (log_fp == 0) { perror(my_name); exit(EXIT_FAILURE); } } void reset_level(void) { cur_level = max_level; } void restore_level(VTLEVEL *save) { set_level(save->cur_level); if (cur_level > 1 && save->input_8bits != input_8bits) /* just in case level didn't change */ s8c1t(save->input_8bits); output_8bits = save->output_8bits; /* in case we thought this was VT100 */ } void save_level(VTLEVEL *save) { save->cur_level = cur_level; save->input_8bits = input_8bits; save->output_8bits = output_8bits; if (LOG_ENABLED) fprintf(log_fp, "save_level(%d) in=%d, out=%d\n", cur_level, input_8bits ? 8 : 7, output_8bits ? 8 : 7); } int get_level(void) { return cur_level; } int set_level(int request) { if (cur_level < 0) find_levels(); if (LOG_ENABLED) fprintf(log_fp, "set_level(%d)\n", request); if (request > max_level) { printf("Sorry, this terminal supports only VT%d\n", terminal_id()); return FALSE; } if (request != cur_level) { if (request == 0) { rm("?2"); /* Reset ANSI (VT100) mode, Set VT52 mode */ input_8bits = FALSE; output_8bits = FALSE; } else { if (cur_level == 0) { esc("<"); /* Enter ANSI mode (VT100 mode) */ } if (request == 1) { input_8bits = FALSE; output_8bits = FALSE; } if (max_level > 1) { if (request > 1) do_csi("6%d;%d\"p", request, !input_8bits); else do_csi("61\"p"); } } padding(5); /* FIXME: may not be needed */ cur_level = request; } if (LOG_ENABLED) fprintf(log_fp, "...set_level(%d) in=%d, out=%d\n", cur_level, input_8bits ? 8 : 7, output_8bits ? 8 : 7); return TRUE; } /* * Set the terminal's operating level to the default (i.e., based on what the * terminal returns as a response to DA). */ void default_level(void) { if (max_level < 0) find_levels(); set_level(max_level); } int terminal_id(void) { if (max_level >= 1) return max_level * 100; else if (max_level == 0) return 52; return 100; } int tst_setup(MENU_ARGS) { static char txt_output[80] = "send 7/8"; static char txt_input8[80] = "receive 7/8"; static char txt_DECSCL[80] = "DECSCL"; static char txt_logging[80] = "logging"; static char txt_padded[80] = "padding"; static char txt_slowly[80]; /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Setup terminal to original test-configuration", setup_terminal }, { txt_output, toggle_8bit_out }, { txt_input8, toggle_8bit_in }, { txt_DECSCL, toggle_DECSCL }, { txt_logging, toggle_Logging }, { txt_padded, toggle_Padding }, { txt_slowly, toggle_Slowly }, { "", 0 } }; /* *INDENT-ON* */ if (cur_level < 0) find_levels(); do { sprintf(txt_output, "Send %d-bit controls", output_8bits ? 8 : 7); sprintf(txt_input8, "Receive %d-bit controls", input_8bits ? 8 : 7); sprintf(txt_DECSCL, "Operating level %d (VT%d)", cur_level, cur_level ? cur_level * 100 : 52); sprintf(txt_logging, "Logging %s", STR_ENABLED(LOG_ENABLED)); sprintf(txt_padded, "Padding %s", STR_ENABLED(use_padding)); sprintf(txt_slowly, "Slow-movement/scrolling %s", STR_ENABLED(slow_motion)); vt_clear(2); __(title(0), println("Modify test-parameters")); __(title(2), println("Select a number to modify it:")); } while (menu(my_menu)); return MENU_NOHOLD; } vttest-20140116/reports.c0000644000175100001440000003702512215341542013672 0ustar tomusers/* $Id: reports.c,v 1.35 2013/09/15 14:25:38 tom Exp $ */ #include #include #include #include /* *INDENT-OFF* */ static struct table { int key; const char *msg; } paritytable[] = { { 1, "NONE" }, { 4, "ODD" }, { 5, "EVEN" }, { -1, "" } },nbitstable[] = { { 1, "8" }, { 2, "7" }, { -1,"" } },speedtable[] = { { 0, "50" }, { 8, "75" }, { 16, "110" }, { 24, "134.5"}, { 32, "150" }, { 40, "200" }, { 48, "300" }, { 56, "600" }, { 64, "1200" }, { 72, "1800" }, { 80, "2000" }, { 88, "2400" }, { 96, "3600" }, { 104, "4800" }, { 112, "9600" }, { 120, "19200" }, { 128, "38400" }, { -1, "" } },operating_level[] = { { 6, "VT102" }, { 12, "VT125" }, { 61, "VT100 family" }, { 62, "VT200 family" }, { 63, "VT300 family" }, { 64, "VT400 family" }, { 65, "VT500 family" }, { -1, "" } },extensions[] = { { 1, "132 columns" }, /* vt400 */ { 2, "printer port" }, /* vt400 */ { 3, "ReGIS Graphics" }, /* kermit */ { 4, "Sixel Graphics" }, /* kermit */ { 6, "selective erase" }, /* vt400 */ { 7, "soft character set (DRCS)" }, /* vt400 */ { 8, "user-defined keys (UDK)" }, /* vt400 */ { 9, "national replacement character-sets" }, /* kermit */ { 10, "text ruling vector" }, /* ? */ { 11, "25th status line" }, /* ? */ { 12, "Serbo-Croatian (SCS)" }, /* vt500 */ { 13, "local editing mode" }, /* kermit */ { 14, "8-bit architecture" }, /* ? */ { 15, "DEC technical set" }, /* vt400 */ { 16, "locator device port (ReGIS)" }, /* kermit */ { 17, "terminal state reports" }, /* ? */ { 18, "user windows" }, /* vt400 */ { 19, "two sessions" }, /* vt400 */ { 21, "horizontal scrolling" }, /* vt400 */ { 22, "color" }, /* vt500 */ { 23, "Greek" }, /* vt500 */ { 24, "Turkish" }, /* vt500 */ { 29, "ANSI text locator" }, /* DXterm */ { 39, "page memory extension" }, /* ? */ { 42, "ISO Latin-2" }, /* vt500 */ { 44, "PC Term" }, /* vt500 */ { 45, "Soft key mapping" }, /* vt500 */ { 46, "ASCII Terminal emulation (WYSE,TVI,...)" }, /* vt500 */ { -1, "" } }; /* *INDENT-ON* */ static int legend(int n, const char *input, const char *word, const char *description) { int i; size_t len = strlen(word); char buf[BUFSIZ]; for (i = 0; input[i] != 0; i++) { if ((i == 0 || !isalpha(CharOf(input[i - 1]))) && !strncmp(word, input + i, len)) { sprintf(buf, "%-8s %-3s = %s", n ? "" : "Legend:", word, description); show_result("%s", buf); println(""); return n + 1; } } return n; } static const char * lookup(struct table t[], int k) { int i; for (i = 0; t[i].key != -1; i++) { if (t[i].key == k) return (t[i].msg); } return ("BAD VALUE"); } static int scan_DA(const char *str, int *pos) { int save = *pos; int value = scanto(str, pos, ';'); if (value == 0) { *pos = save; value = scanto(str, pos, 'c'); if (str[*pos] != '\0') value = 0; } return value; } /******************************************************************************/ static int tst_DA(MENU_ARGS) { int i, found; const char *report, *cmp; /* *INDENT-OFF* */ static const char *attributes[][2] = { /* after CSI */ { "?1;0c", "No options (vanilla VT100)" }, { "?1;1c", "VT100 with STP" }, { "?1;2c", "VT100 with AVO (could be a VT102)" }, { "?1;3c", "VT100 with STP and AVO" }, { "?1;4c", "VT100 with GPO" }, { "?1;5c", "VT100 with STP and GPO" }, { "?1;6c", "VT100 with AVO and GPO" }, { "?1;7c", "VT100 with STP, AVO and GPO" }, { "?1;11c", "VT100 with PP and AVO" }, { "?1;15c", "VT100 with PP, GPO and AVO" }, { "?2c", "VT102" }, { "?4;2c", "VT132 with AVO" }, { "?4;3c", "VT132 with AVO and STP" }, { "?4;6c", "VT132 with GPO and AVO" }, { "?4;7c", "VT132 with GPO, AVO, and STP" }, { "?4;11c", "VT132 with PP and AVO" }, { "?4;15c", "VT132 with PP, GPO and AVO" }, { "?6c", "VT102" }, { "?7c", "VT131" }, { "?12;5c", "VT125" }, /* VT125 also has ROM version */ { "?12;7c", "VT125 with AVO" }, /* number, so this won't work */ { "?5;0c", "VK100 (GIGI)" }, { "?5c", "VK100 (GIGI)" }, { "?62;1;2;4;6;8;9;15c", "VT220" }, { "?63;1;2;8;9c", "VT320" }, { "?63;1;2;4;6;8;9;15c", "VT320" }, { "?63;1;3;4;6;8;9;15;16;29c", "DXterm" }, { "", "" } }; /* *INDENT-ON* */ vt_move(1, 1); println("Test of Device Attributes report (what are you)"); set_tty_raw(TRUE); da(); report = get_reply(); vt_move(3, 1); vt_el(0); printf("Report is: "); chrprint(report); found = FALSE; if ((cmp = skip_csi_2(report)) != 0) { for (i = 0; *attributes[i][0] != '\0'; i++) { if (!strcmp(cmp, attributes[i][0])) { int n = 0; show_result(" -- means %s", attributes[i][1]); println(""); n = legend(n, attributes[i][1], "STP", "Processor Option"); n = legend(n, attributes[i][1], "AVO", "Advanced Video Option"); n = legend(n, attributes[i][1], "GPO", "Graphics Processor Option"); (void) legend(n, attributes[i][1], "PP", "Printer Port"); found = TRUE; break; } } } if (!found) { /* this could be a vt200+ with some options disabled */ if (cmp != 0 && *cmp == '?') { int reportpos = 1; int value = scan_DA(cmp, &reportpos); show_result("%s\n", lookup(operating_level, value)); println(""); if (value == 12) { if ((value = scan_DA(cmp, &reportpos)) != 0) { printf(" "); switch (value) { case 5: break; case 7: show_result("with AVO"); println(""); break; default: printf("unknown code %d", value); println(""); break; } } if ((value = scan_DA(cmp, &reportpos)) != 0) { printf(" "); switch (value) { case 1: show_result("with printer"); break; default: printf("unknown code %d", value); break; } println(""); } if ((value = scan_DA(cmp, &reportpos)) != 0) { printf(" ROM version %d", value); println(""); } } else { while ((value = scan_DA(cmp, &reportpos)) != 0) { printf(" "); show_result("%d = %s\n", value, lookup(extensions, value)); println(""); } } found = TRUE; } } if (!found) show_result(" -- Unknown response, refer to the manual"); restore_ttymodes(); vt_move(max_lines - 1, 1); return MENU_HOLD; } /* * Applies to VT220 & up (probably no VT100's). * Expected reply (from VT420 manual): * CSI > 4 1 ; Pv ; 0 c (Pv = firmware version) * From kermit: * CSI > 2 4 ; Pv ; 0 c (Pv = "0 ; 0 ; 0", for "0.0") * I've seen also: * CSI > 8 3 ; Pv ; 0 c (e.g., Pv = "3 0 7 0 1") */ static int tst_DA_2(MENU_ARGS) { /* *INDENT-OFF* */ static const struct { int Pp; const char *name; } tbl[] = { { 1, "VT220" }, { 18, "VT330" }, { 19, "VT340" }, { 24, "VT320" }, { 28, "DECterm" }, { 41, "VT420" }, { 64, "VT520" }, { 65, "VT525" }, }; /* *INDENT-ON* */ char *report; int Pp, Pv, Pc; char ch; const char *show = SHOW_FAILURE; size_t n; vt_move(1, 1); println("Testing Secondary Device Attributes (Firmware version)"); set_tty_raw(TRUE); do_csi(">c"); /* or "CSI > 0 c" */ report = get_reply(); vt_move(3, 10); chrprint(report); if ((report = skip_csi(report)) != 0) { if (sscanf(report, ">%d;%d;%d%c", &Pp, &Pv, &Pc, &ch) == 4 && ch == 'c') { const char *name = "unknown"; show = SHOW_SUCCESS; for (n = 0; n < TABLESIZE(tbl); n++) { if (Pp == tbl[n].Pp) { name = tbl[n].name; break; } } vt_move(4, 10); printf("Pp=%d (%s)", Pp, name); vt_move(5, 10); printf("Pv=%d, firmware version %d.%d", Pv, Pv / 10, Pv % 10); vt_move(6, 10); switch (Pp) { case 64: case 65: printf("Pc=%d, %s keyboard", Pc, Pc ? "PC" : "VT"); break; default: printf("Pc=%d, ROM cartridge registration number", Pc); break; } } } show_result("%s", show); restore_ttymodes(); vt_move(max_lines - 1, 1); return MENU_HOLD; } /* * VT400 (reply is a hexidecimal string) */ static int tst_DA_3(MENU_ARGS) { char *report; const char *show; vt_move(1, 1); println("Testing Tertiary Device Attributes (unit ID)"); set_tty_raw(TRUE); do_csi("=c"); /* or "CSI = 0 c" */ report = get_reply(); vt_move(3, 10); chrprint(report); if ((report = skip_dcs(report)) != 0 && strip_terminator(report) != 0 && *report++ == '!' && *report++ == '|' && strlen(report) != 0) { show = SHOW_SUCCESS; } else { show = SHOW_FAILURE; } show_result("%s", show); restore_ttymodes(); vt_move(max_lines - 1, 1); return MENU_HOLD; } /* Not supported above VT320 */ static int tst_DECREQTPARM(MENU_ARGS) { int parity, nbits, xspeed, rspeed, clkmul, flags; int reportpos; char *report, *report2, *cmp; set_tty_raw(TRUE); set_tty_echo(FALSE); vt_move(2, 1); println("Test of the \"Request Terminal Parameters\" feature, argument 0."); vt_move(3, 1); decreqtparm(0); report = get_reply(); vt_move(5, 1); vt_el(0); printf("Report is: "); chrprint(report); if ((cmp = skip_csi(report)) != 0) report = cmp; if (strlen(report) < 14 || report[0] != '2' || report[1] != ';') println(" -- Bad format"); else { reportpos = 2; /* *INDENT-EQLS* */ parity = scanto(report, &reportpos, ';'); nbits = scanto(report, &reportpos, ';'); xspeed = scanto(report, &reportpos, ';'); rspeed = scanto(report, &reportpos, ';'); clkmul = scanto(report, &reportpos, ';'); flags = scanto(report, &reportpos, 'x'); if (parity == 0 || nbits == 0 || clkmul == 0) println(" -- Bad format"); else println(" -- OK"); show_result( "This means: Parity %s, %s bits, xmitspeed %s, recvspeed %s.\n", lookup(paritytable, parity), lookup(nbitstable, nbits), lookup(speedtable, xspeed), lookup(speedtable, rspeed)); show_result("(CLoCk MULtiplier = %d, STP option flags = %d)\n", clkmul, flags); } vt_move(10, 1); println("Test of the \"Request Terminal Parameters\" feature, argument 1."); vt_move(11, 1); decreqtparm(1); /* Does the same as decreqtparm(0), reports "3" */ report2 = get_reply(); vt_move(13, 1); vt_el(0); printf("Report is: "); chrprint(report2); if ((cmp = skip_csi(report2)) != 0) report2 = cmp; if (strlen(report2) < 1 || report2[0] != '3') println(" -- Bad format"); else { report2[0] = '2'; if (!strcmp(report, report2)) println(" -- OK"); else println(" -- Bad format"); } vt_move(max_lines, 1); restore_ttymodes(); return MENU_HOLD; } static int tst_DSR(MENU_ARGS) { int found; int origin; char *report, *cmp; set_tty_raw(TRUE); vt_move(1, 1); printf("Test of Device Status Report 5 (report terminal status)."); vt_move(2, 1); dsr(5); report = get_reply(); vt_move(2, 1); vt_el(0); printf("Report is: "); chrprint(report); if ((cmp = skip_csi(report)) != 0) found = !strcmp(cmp, "0n") || !strcmp(cmp, "3n"); else found = 0; if (found) show_result(" -- means \"TERMINAL OK\""); else show_result(" -- Unknown response!"); vt_move(4, 1); println("Test of Device Status Report 6 (report cursor position)."); for (origin = 0; origin < 2; ++origin) { if (origin) { sm("?6"); decstbm(4, max_lines - 6); } vt_move(5, 1); dsr(6); report = get_reply(); vt_move(5, 1); vt_el(0); printf("Report is: "); chrprint(report); if ((cmp = skip_csi(report)) != 0) { found = (!strcmp(cmp, "5;1R") ? 1 : ((!strcmp(cmp, "8;1R") && origin) ? 2 : 0)); } else { found = 0; } switch (found) { case 2: show_result(" -- Ignores origin mode"); break; case 1: show_result(" -- OK"); break; default: show_result(" -- Unknown response!"); break; } } rm("?6"); decstbm(0, 0); vt_move(max_lines - 1, 1); restore_ttymodes(); return MENU_HOLD; } static int tst_ENQ(MENU_ARGS) { char *report; vt_move(5, 1); println("This is a test of the ANSWERBACK MESSAGE. (To load the A.B.M."); println("see the TEST KEYBOARD part of this program). Below here, the"); println("current answerback message in your terminal should be"); println("displayed. Finish this test with RETURN."); vt_move(10, 1); set_tty_raw(TRUE); set_tty_echo(FALSE); inflush(); printf("%c", 5); /* ENQ */ report = get_reply(); vt_move(10, 1); chrprint(report); vt_move(12, 1); restore_ttymodes(); return MENU_HOLD; } static int tst_NLM(MENU_ARGS) { char *report; vt_move(1, 1); println("Test of LineFeed/NewLine mode."); vt_move(3, 1); sm("20"); set_tty_crmod(FALSE); tprintf("NewLine mode set. Push the RETURN key: "); report = instr(); vt_move(4, 1); vt_el(0); chrprint(report); if (!strcmp(report, "\015\012")) show_result(" -- OK"); else show_result(" -- Not expected"); vt_move(6, 1); rm("20"); tprintf("NewLine mode reset. Push the RETURN key: "); report = instr(); vt_move(7, 1); vt_el(0); chrprint(report); if (!strcmp(report, "\015")) show_result(" -- OK"); else show_result(" -- Not expected"); vt_move(9, 1); restore_ttymodes(); return MENU_HOLD; } /******************************************************************************/ int tst_reports(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { " (AnswerBack Message)", tst_ENQ }, { "Set/Reset Mode - LineFeed / Newline", tst_NLM }, { "Device Status Report (DSR) VT100 & up", tst_DSR }, { "Primary Device Attributes (DA) VT100 & up", tst_DA }, { "Secondary Device Attributes (DA) VT220 & up", tst_DA_2 }, { "Tertiary Device Attributes (DA) VT420", tst_DA_3 }, { "Request Terminal Parameters (DECREQTPARM) VT100", tst_DECREQTPARM }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printf("Terminal Reports/Responses")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } vttest-20140116/tek4014.c0000644000175100001440000001620311667367635013310 0ustar tomusers/* $Id: tek4014.c,v 1.13 2011/12/06 10:34:05 tom Exp $ */ #include #include #include #define TEKHEIGHT 3072 #define TEKWIDTH 4096 #define FIVEBITS 037 #define HIBITS (FIVEBITS << SHIFTHI) #define LOBITS (FIVEBITS << SHIFTLO) #define SHIFTHI 7 #define SHIFTLO 2 #define TWOBITS 03 #undef GS #undef RS #undef US #define GS 0x001D #define RS 0x001E #define US 0x001F static char empty[1]; /* * Switch to/from tek4014/vt100 mode. */ static void tek_enable(int flag) { if (flag) do_csi("?38h"); else esc("\003"); } /* * Switch to GIN (graphics-in) mode. */ static void tek_GIN(void) { esc("\032"); } /* * Switch back to alpha (text) mode. */ static void tek_ALP(void) { printf("%c", US); } /* * Select a font */ static void tek_font(int code) { switch (code) { case 1: esc("8"); /* large */ break; case 2: esc("9"); /* #2 */ break; case 3: esc(":"); /* #3 */ break; default: esc(";"); /* small */ break; } } /* * Decode 2 bytes from a mouse report as a coordinate value. */ static int tek_coord(char *report, int offset) { int hi = FIVEBITS & CharOf(report[offset]); int lo = FIVEBITS & CharOf(report[offset + 1]); return (hi << 5) + lo; } /* * Send coordinates for a single point. xterm reads this info in getpoint(). * There are several possibilities for encoding the coordinates. */ static void tek_point(int pen, int y, int x) { char temp[20]; if (pen) { sprintf(temp, "%c\007", GS); } else { sprintf(temp, "%c", GS); } sprintf(temp + strlen(temp), "%c%c%c%c%c", 0x20 | (((y & HIBITS) >> SHIFTHI) & FIVEBITS), 0x60 | (((y & TWOBITS) << SHIFTLO) | (x & TWOBITS)), /* tests/sets lo_y */ 0x60 | (((y & LOBITS) >> SHIFTLO) & FIVEBITS), /* sets lo_y */ 0x20 | (((x & HIBITS) >> SHIFTHI) & FIVEBITS), 0x40 | (((x & LOBITS) >> SHIFTLO) & FIVEBITS)); /* must be last */ fprintf(stdout, "%s", temp); if (LOG_ENABLED) { fprintf(log_fp, "*Set point (%d,%d)\n", y, x); fputs("Send: ", log_fp); put_string(log_fp, temp); fputs("\n", log_fp); } } static void tek_linestyle(int style) { char temp[10]; sprintf(temp, "%c", 0x60 + style); esc(temp); } static void log_mouse_click(char *report) { if (LOG_ENABLED) { int new_x = tek_coord(report, 1); int new_y = tek_coord(report, 3); fprintf(log_fp, "Report: "); if ((report[0] & 0x80) != 0 && strchr("lmrLMR", report[0] & 0x7f) != 0) { fprintf(log_fp, "mouse %c", report[0] & 0x7f); } else { fprintf(log_fp, "key %d", CharOf(report[0])); } fprintf(log_fp, " (%d,%d)\n", new_y, new_x); fflush(log_fp); } } /* * Clear the display */ static int tek_clear(MENU_ARGS) { tek_enable(1); esc("\014"); tek_enable(0); return FALSE; } static int tek_hello(MENU_ARGS) { int n; tek_clear(PASS_ARGS); tek_enable(1); for (n = 0; n < 4; ++n) { tek_font(n); println("Hello world!\r"); } tek_enable(0); return FALSE; } /* * Wait for a mouse click, printing its coordinates. While in GIN mode, we * may also see keys pressed. Exit the test when we see the same event twice * in a row. */ static int tek_mouse_coords(MENU_ARGS) { char *report; char status[6]; int new_x = -1; int new_y = -1; tek_clear(PASS_ARGS); tek_enable(1); set_tty_raw(TRUE); set_tty_echo(FALSE); report = empty; println("Any key or mouse click twice to exit..."); do { strncpy(status, report, (size_t) 5)[5] = 0; /* * The graphics-in mode is reset each time users send a mouse click. So we * set it in the loop. */ tek_GIN(); log_mouse_click(report = instr()); new_x = tek_coord(report, 1); new_y = tek_coord(report, 3); /* * If we do not start a new line after reading the mouse, we will see no * text. So we do it before the rest of the report rather than after. */ printf("\r\n"); if ((report[0] & 0x80) != 0 && strchr("lmrLMR", report[0] & 0x7f) != 0) { printf("mouse %c:", report[0] & 0x7f); } else { printf("key: %d", CharOf(report[0])); } printf(" (%d,%d)", new_y, new_x); fflush(stdout); } while (strcmp(report, status)); tek_ALP(); restore_ttymodes(); tek_enable(0); return FALSE; } /* * Wait for a mouse click, drawing a line point-to-point from each click. * Ignore keys pressed. Exit the test when we see the same event twice * in a row. * * xterm pretends the screen is 4096 by 3072 (height by width). So the lines * appear in the lower-right of the screen. Since we cannot ask xterm how * large the screen actually is, we do not try to (cannot) scale the lines. */ static int tek_mouse_lines(MENU_ARGS) { char *report; char status[6]; int old_x = -1; int old_y = -1; int new_x = -1; int new_y = -1; tek_clear(PASS_ARGS); tek_enable(1); set_tty_raw(TRUE); set_tty_echo(FALSE); report = empty; println("Any mouse click twice to exit..."); do { strncpy(status, report, (size_t) 5)[5] = 0; if (old_x >= 0 && old_y >= 0) { tek_point(0, old_y, old_x); tek_point(1, new_y, new_x); fflush(stdout); } old_x = new_x; old_y = new_y; tek_GIN(); log_mouse_click(report = instr()); new_x = tek_coord(report, 1); new_y = tek_coord(report, 3); } while (strcmp(report, status)); restore_ttymodes(); tek_enable(0); return FALSE; } /* * Draw a grid using a different line-type for each line, if possible. */ static int tek_grid_demo(MENU_ARGS) { int y, x; int style = 0; tek_clear(PASS_ARGS); tek_enable(1); for (y = 0; y <= TEKHEIGHT; y += TEKHEIGHT / 16) { tek_linestyle(style++ % 4); tek_point(0, y, 0); tek_point(1, y, TEKWIDTH - 1); } for (x = 0; x <= TEKWIDTH; x += TEKWIDTH / 16) { tek_linestyle(style++ % 4); tek_point(0, 0, x); tek_point(1, TEKHEIGHT - 1, x); } tek_ALP(); /* flush the plot */ tek_enable(0); return FALSE; } /* * The common versions of xterm (X11R5, X11R6, XFree86) provide a Tektronix * 4014 emulation. It can be configured out of XFree86 xterm, but that fact is * ignored by the cretins who quote rxvt's misleading manpage. (The emulation * if unused accounts for 30kb of shared memory use). * * Other than its association with xterm, these tests do not really belong * in vttest, since the Tektronix is not even an ANSI terminal. */ int tst_tek4014(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", 0 }, { "Clear screen", tek_clear }, { "'Hello World!' in each font", tek_hello }, { "Get mouse-clicks, showing coordinates", tek_mouse_coords }, { "Get mouse-clicks, drawing lines between", tek_mouse_lines }, { "Draw a grid", tek_grid_demo }, { "", 0 } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), println("XTERM/tek4014 features")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } vttest-20140116/config.hin0000644000175100001440000000261111751550475014001 0ustar tomusers/* $Id: config.hin,v 1.12 2012/05/06 19:30:05 tom Exp $ */ /* define this if you have the alarm() function */ #undef HAVE_ALARM /* define this if you have */ #undef HAVE_FCNTL_H /* define this if you have */ #undef HAVE_IOCTL_H /* define this if you have the Xenix rdchk() function */ #undef HAVE_RDCHK /* define this if the POSIX VDISABLE symbol is defined, not equal to -1 */ #undef HAVE_POSIX_VDISABLE /* define this if you have */ #undef HAVE_SGTTY_H /* define this if you have */ #undef HAVE_STDLIB_H /* define this if you have */ #undef HAVE_STRING_H /* define this if you have */ #undef HAVE_SYS_FILIO_H /* define this if you have */ #undef HAVE_SYS_IOCTL_H /* define this if you have the tcgetattr() function */ #undef HAVE_TCGETATTR /* define this if you have */ #undef HAVE_TERMIO_H /* define this if you have */ #undef HAVE_TERMIOS_H /* define this if you have */ #undef HAVE_UNISTD_H /* define this if you have the usleep() function */ #undef HAVE_USLEEP /* define this to be the return-type of functions manipulated by 'signal()' */ #define RETSIGTYPE void /* define this if we can use ioctl(,FIONREAD,) */ #undef USE_FIONREAD /* define this for GCC's __attribute__((printf)) */ #undef GCC_PRINTFLIKE /* define this for GCC's __attribute__((unused)) */ #undef GCC_UNUSED