vttest-20241208/0000755000000000000000000000000014725375322012017 5ustar rootrootvttest-20241208/vt220.c0000644000000000000000000004311314724173170013036 0ustar rootroot/* $Id: vt220.c,v 1.44 2024/12/05 00:40:24 tom Exp $ */ /* * Reference: VT220 Programmer Pocket Guide (EK-VT220-HR-002). * Reference: VT220 Program Reference Manual (EK-VT220-RM-002). * Reference: DEC STD 070 Video Systems Reference Manual. */ #include #include #include #include int any_DSR(MENU_ARGS, const char *text, void (*explain) (const char *report)) { int row, col; char *report; unsigned pmode = (unsigned) ((*text == '?') ? 1 : 0); vt_move(1, 1); printxx("Testing DSR: %s\n", the_title); set_tty_raw(TRUE); set_tty_echo(FALSE); do_csi("%s", text); report = get_reply(); vt_move(row = 3, col = 10); chrprint2(report, row, col); if ((report = skip_csi(report)) != NULL && strlen(report) > (1 + pmode) && (!pmode || (*report++ == '?'))) { if (explain != NULL) (*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)) == NULL) 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(const char *report) { int pos = 0; int code; int save; const char *show = SHOW_FAILURE; if (scanto(report, &pos, ';') == 27 && (save = pos) != 0 && (code = scan_any(report, &pos, 'n')) >= 0 && (pos != save)) { /* *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 = "Portuguese"; break; /* vt3XX */ case 17: show = "Katakana"; break; /* EK-VT382-RM-001 p 11-9 */ case 19: show = "Hebrew"; break; /* vt5XX: kermit says 14 */ case 22: show = "Greek"; break; /* vt5XX */ case 27: show = "Thai"; break; /* EK-VT38T-UG-001 p C-42 */ 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. * see: * EK-VT420-RM 002, p 239, 277 * EK-VT510-RM B01, p 4-30, 5-166 * EK-VT520-RM A01, p 4-28, 5-176 */ 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/LK301"; break; case 1: show = "LK401"; break; case 2: show = "LK443/LK444"; break; case 3: show = "LK421"; break; case 4: show = "LK411/LK450"; break; case 5: show = "PCXAL"; break; default: show = "unknown keyboard type"; } /* *INDENT-ON* */ show_result("%s", show); } } static void show_PrinterStatus(const 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(const 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; case 23: show = "UDKs unsupported"; break; default: show = SHOW_FAILURE; } /* *INDENT-ON* */ show_result("%s", show); } /* VT220 & up. */ static int tst_S8C1T(MENU_ARGS) { int flag = input_8bits; int pass; char temp[80]; 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++) { const char *report; int row, col; flag = !flag; s8c1t(flag); cup(1, 1); dsr(6); report = instr(); vt_move(row = 10 + pass * 3, col = 1); sprintf(temp, "8-bit controls %s:", STR_ENABLED(flag)); printxx("%s", temp); chrprint2(report, row, col + (int) strlen(temp)); 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 void tst_DECSCA_selective(MENU_ARGS) { BOX inner; if (make_box_params(&inner, 6, 20) == 0) { int pass; for (pass = 0; pass < 2; pass++) { int i; if (pass == 0) decsca(1); for (i = inner.top; i <= inner.bottom; i++) { int j; cup(i - 1, 1 + inner.left); for (j = inner.left; j <= inner.right; j++) { putchar('*'); } } if (pass == 0) { int j; decsca(0); for (j = 0; j <= 2; j++) { for (i = 1; i < inner.top - 1; i++) { cup(i, inner.left - inner.top + (i + j) + 3); putchar('*'); cup(i, inner.right + inner.top - (i + j) - 1); putchar('*'); } for (i = inner.bottom; i < max_lines; i++) { cup(i, (inner.left + inner.bottom) - (i - j) + 1); putchar('*'); cup(i, (inner.right - inner.bottom) + (i - j) + 1); putchar('*'); } cup((max_lines / 2) - 1, (min_cols / 2) - 1); decsed(j); } for (i = inner.right + 1; i <= min_cols; i++) { cup(inner.top + 1, 1 + i); putchar('*'); cup(max_lines / 2 + 1, 1 + i); putchar('*'); } cup(max_lines / 2 + 1, 1 + min_cols / 2); decsel(0); /* after the cursor */ for (i = 1; i < inner.left; i++) { cup(inner.top + 1, 1 + i); putchar('*'); cup(max_lines / 2 + 1, 1 + i); putchar('*'); } cup(max_lines / 2 + 1, 1 + min_cols / 2); decsel(1); /* before the cursor */ cup(inner.top + 1, 1 + 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(); } } } else { vt_move(max_lines - 3, 1); vt_clear(0); println("The screen is too small for this test"); holdit(); } } static void tst_DECSCA_edit_line(MENU_ARGS) { BOX outer; BOX inner; if (make_box_params(&outer, 0, 0) == 0 && make_box_params(&inner, 6, 20) == 0) { int i; decsca(1); for (i = outer.top; i <= outer.bottom; i++) { int j; cup(i + 1, 1 + outer.left); for (j = outer.left; j <= outer.right; j++) { putchar((i >= inner.top && i <= inner.bottom && j >= inner.left && j <= inner.right) ? '*' : '#'); } } cup(inner.top - 2, max_cols); ed(1); cup(inner.bottom, 1); ed(0); for (i = outer.top; i <= outer.bottom; i++) { cup(i + 1, inner.left); el(1); cup(i + 1, inner.right + 2); el(0); } decsca(0); vt_move(max_lines - 3, 1); vt_clear(0); println("If your terminal supports DEC protected areas (DECSCA, ignoring EL/ED),"); println("there will be an solid box made of *'s in the middle of the screen."); } else { vt_move(max_lines - 3, 1); vt_clear(0); println("The screen is too small for this test"); } holdit(); } static void tst_DECSCA_edit_char(MENU_ARGS) { BOX outer; BOX inner; if (make_box_params(&outer, 0, 0) == 0 && make_box_params(&inner, 6, 20) == 0) { int i; decsca(1); for (i = outer.top; i <= outer.bottom; i++) { int j; cup(i + 1, 1 + outer.left); for (j = outer.left; j <= outer.right; j++) { putchar((i >= inner.top && i <= inner.bottom && j >= inner.left && j <= inner.right) ? '*' : '#'); } } for (i = 1; i < inner.top - 1; ++i) { cup(i, 1); ech(min_cols); } for (i = inner.top; i <= inner.bottom; i++) { cup(i - 1, 1); ech(inner.left); cup(i - 1, inner.right + 2); if (i % 2) { ich(19); } else { dch(19); } } for (i = inner.bottom; i < outer.bottom; ++i) { cup(i, 1); dch(min_cols); } decsca(0); vt_move(max_lines - 3, 1); vt_clear(0); println("If your terminal supports DEC protected areas (DECSCA, ignoring ECH/ICH/DCH),"); println("there will be an solid box made of *'s in the middle of the screen."); } else { vt_move(max_lines - 3, 1); vt_clear(0); println("The screen is too small for this test"); } holdit(); } static int tst_DECSCA(MENU_ARGS) { tst_DECSCA_selective(PASS_ARGS); tst_DECSCA_edit_line(PASS_ARGS); tst_DECSCA_edit_char(PASS_ARGS); 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 (;;) { int row, col; const char *report = instr(); if (*report == 'q') break; vt_move(row = 5, col = 10); vt_clear(0); chrprint2(report, row, col); } 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(const char *report) { int pos = 0; int Ps1 = scan_any(report, &pos, 'n'); int Ps2 = scanto(report, &pos, 'n'); switch (Ps1) { case 0: show_result("Terminal is in good operating condition: %d", Ps2); break; case 3: show_result("Terminal has a malfunction: %d", Ps2); break; default: show_result(SHOW_FAILURE); } } 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); putchar('*'); ech(min_cols); putchar('*'); /* 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", NULL }, { "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 }, { "", NULL } }; /* *INDENT-ON* */ do { vt_clear(2); title(0); printxx("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", NULL }, { "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 }, { "", NULL } }; /* *INDENT-ON* */ do { vt_clear(2); title(0); printxx("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", NULL }, { "Test Device Status Report (DSR)", tst_vt220_device_status }, { "", NULL } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printxx("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", NULL }, { "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 }, { "", NULL } }; /* *INDENT-ON* */ do { vt_clear(2); title(0); printxx("VT220 Tests"); title(2); println("Choose test type:"); } while (menu(my_menu)); return MENU_NOHOLD; } vttest-20241208/configure.in0000644000000000000000000000157214672645652014344 0ustar rootrootdnl Process this file with 'autoconf' to produce a 'configure' script dnl $Id: configure.in,v 1.37 2024/09/18 21:52:42 tom Exp $ AC_REVISION($Revision: 1.37 $) AC_INIT(esc.c) AC_CONFIG_HEADER(config.h:config.hin) CF_CHECK_CACHE CF_WITH_SYSTYPE AC_ARG_PROGRAM CF_PROG_CC CF_WITHOUT_X AC_PROG_INSTALL CF_MAKE_PHONY CF_MAKE_TAGS CF_PROG_LINT CF_WITH_MAN2HTML CF_DISABLE_ECHO CF_ENABLE_WARNINGS CF_XOPEN_SOURCE ### extra things that we'll substitute in the makefile AC_CHECK_DECL(exit) AC_TYPE_SIGNAL AC_HAVE_HEADERS( \ fcntl.h \ ioctl.h \ sgtty.h \ sys/filio.h \ sys/ioctl.h \ termio.h \ termios.h \ ) AC_HAVE_FUNCS( \ alarm \ rdchk \ tcgetattr \ usleep \ vfprintf \ ) CF_LOCALE CF_STRERROR ### special configuration tests CF_POSIX_VDISABLE CF_FCNTL_VS_IOCTL AM_LANGINFO_CODESET ### debugging/testing ### output makefile and config.h AC_OUTPUT(makefile) CF_MAKE_DOCS(['$(THIS)'],1) vttest-20241208/config.guess0000755000000000000000000014306714651355010014340 0ustar rootroot#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2024 Free Software Foundation, Inc. # shellcheck disable=SC2006,SC2268 # see below for rationale timestamp='2024-07-27' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # https://git.savannah.gnu.org/cgit/config.git/plain/config.guess # # Please send patches to . # The "shellcheck disable" line above the timestamp inhibits complaints # about features and limitations of the classic Bourne shell that were # superseded or lifted in POSIX. However, this script identifies a wide # variety of pre-POSIX systems that do not have POSIX shells at all, and # even some reasonably current systems (Solaris 10 as case-in-point) still # have a pre-POSIX /bin/sh. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system '$me' is run on. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2024 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try '$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi # Just in case it came from the environment. GUESS= # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, 'CC_FOR_BUILD' used to be named 'HOST_CC'. We still # use 'HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. tmp= # shellcheck disable=SC2172 trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 set_cc_for_build() { # prevent multiple calls if $tmp is already set test "$tmp" && return 0 : "${TMPDIR=/tmp}" # shellcheck disable=SC2039,SC3028 { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } dummy=$tmp/dummy case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in ,,) echo "int x;" > "$dummy.c" for driver in cc gcc c17 c99 c89 ; do if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then CC_FOR_BUILD=$driver break fi done if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac } # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if test -f /.attbin/uname ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case $UNAME_SYSTEM in Linux|GNU|GNU/*) LIBC=unknown set_cc_for_build cat <<-EOF > "$dummy.c" #if defined(__ANDROID__) LIBC=android #else #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #elif defined(__GLIBC__) LIBC=gnu #elif defined(__LLVM_LIBC__) LIBC=llvm #else #include /* First heuristic to detect musl libc. */ #ifdef __DEFINED_va_list LIBC=musl #endif #endif #endif EOF cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` eval "$cc_set_libc" # Second heuristic to detect musl libc. if [ "$LIBC" = unknown ] && command -v ldd >/dev/null && ldd --version 2>&1 | grep -q ^musl; then LIBC=musl fi # If the system lacks a compiler, then just pick glibc. # We could probably try harder. if [ "$LIBC" = unknown ]; then LIBC=gnu fi ;; esac # Note: order is significant - the case branches are not exclusive. case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ echo unknown)` case $UNAME_MACHINE_ARCH in aarch64eb) machine=aarch64_be-unknown ;; armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; earmv*) arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` machine=${arch}${endian}-unknown ;; *) machine=$UNAME_MACHINE_ARCH-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently (or will in the future) and ABI. case $UNAME_MACHINE_ARCH in earm*) os=netbsdelf ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # Determine ABI tags. case $UNAME_MACHINE_ARCH in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case $UNAME_VERSION in Debian*) release='-gnu' ;; *) release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. GUESS=$machine-${os}${release}${abi-} ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE ;; *:SecBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE ;; *:MidnightBSD:*:*) GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE ;; *:ekkoBSD:*:*) GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE ;; *:SolidBSD:*:*) GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE ;; *:OS108:*:*) GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE ;; macppc:MirBSD:*:*) GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE ;; *:MirBSD:*:*) GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE ;; *:Sortix:*:*) GUESS=$UNAME_MACHINE-unknown-sortix ;; *:Twizzler:*:*) GUESS=$UNAME_MACHINE-unknown-twizzler ;; *:Redox:*:*) GUESS=$UNAME_MACHINE-unknown-redox ;; mips:OSF1:*.*) GUESS=mips-dec-osf1 ;; alpha:OSF1:*:*) # Reset EXIT trap before exiting to avoid spurious non-zero exit code. trap '' 0 case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case $ALPHA_CPU_TYPE in "EV4 (21064)") UNAME_MACHINE=alpha ;; "EV4.5 (21064)") UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") UNAME_MACHINE=alpha ;; "EV5 (21164)") UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` GUESS=$UNAME_MACHINE-dec-osf$OSF_REL ;; Amiga*:UNIX_System_V:4.0:*) GUESS=m68k-unknown-sysv4 ;; *:[Aa]miga[Oo][Ss]:*:*) GUESS=$UNAME_MACHINE-unknown-amigaos ;; *:[Mm]orph[Oo][Ss]:*:*) GUESS=$UNAME_MACHINE-unknown-morphos ;; *:OS/390:*:*) GUESS=i370-ibm-openedition ;; *:z/VM:*:*) GUESS=s390-ibm-zvmoe ;; *:OS400:*:*) GUESS=powerpc-ibm-os400 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) GUESS=arm-acorn-riscix$UNAME_RELEASE ;; arm*:riscos:*:*|arm*:RISCOS:*:*) GUESS=arm-unknown-riscos ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) GUESS=hppa1.1-hitachi-hiuxmpp ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. case `(/bin/universe) 2>/dev/null` in att) GUESS=pyramid-pyramid-sysv3 ;; *) GUESS=pyramid-pyramid-bsd ;; esac ;; NILE*:*:*:dcosx) GUESS=pyramid-pyramid-svr4 ;; DRS?6000:unix:4.0:6*) GUESS=sparc-icl-nx6 ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) GUESS=sparc-icl-nx7 ;; esac ;; s390x:SunOS:*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL ;; sun4H:SunOS:5.*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=sparc-hal-solaris2$SUN_REL ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=sparc-sun-solaris2$SUN_REL ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) GUESS=i386-pc-auroraux$UNAME_RELEASE ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) set_cc_for_build SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH=x86_64 fi fi SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=$SUN_ARCH-pc-solaris2$SUN_REL ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=sparc-sun-solaris3$SUN_REL ;; sun4*:SunOS:*:*) case `/usr/bin/arch -k` in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like '4.1.3-JL'. SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` GUESS=sparc-sun-sunos$SUN_REL ;; sun3*:SunOS:*:*) GUESS=m68k-sun-sunos$UNAME_RELEASE ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 case `/bin/arch` in sun3) GUESS=m68k-sun-sunos$UNAME_RELEASE ;; sun4) GUESS=sparc-sun-sunos$UNAME_RELEASE ;; esac ;; aushp:SunOS:*:*) GUESS=sparc-auspex-sunos$UNAME_RELEASE ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) GUESS=m68k-atari-mint$UNAME_RELEASE ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) GUESS=m68k-atari-mint$UNAME_RELEASE ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) GUESS=m68k-atari-mint$UNAME_RELEASE ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) GUESS=m68k-milan-mint$UNAME_RELEASE ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) GUESS=m68k-hades-mint$UNAME_RELEASE ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) GUESS=m68k-unknown-mint$UNAME_RELEASE ;; m68k:machten:*:*) GUESS=m68k-apple-machten$UNAME_RELEASE ;; powerpc:machten:*:*) GUESS=powerpc-apple-machten$UNAME_RELEASE ;; RISC*:Mach:*:*) GUESS=mips-dec-mach_bsd4.3 ;; RISC*:ULTRIX:*:*) GUESS=mips-dec-ultrix$UNAME_RELEASE ;; VAX*:ULTRIX*:*:*) GUESS=vax-dec-ultrix$UNAME_RELEASE ;; 2020:CLIX:*:* | 2430:CLIX:*:*) GUESS=clipper-intergraph-clix$UNAME_RELEASE ;; mips:*:*:UMIPS | mips:*:*:RISCos) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`"$dummy" "$dummyarg"` && { echo "$SYSTEM_NAME"; exit; } GUESS=mips-mips-riscos$UNAME_RELEASE ;; Motorola:PowerMAX_OS:*:*) GUESS=powerpc-motorola-powermax ;; Motorola:*:4.3:PL8-*) GUESS=powerpc-harris-powermax ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) GUESS=powerpc-harris-powermax ;; Night_Hawk:Power_UNIX:*:*) GUESS=powerpc-harris-powerunix ;; m88k:CX/UX:7*:*) GUESS=m88k-harris-cxux7 ;; m88k:*:4*:R4*) GUESS=m88k-motorola-sysv4 ;; m88k:*:3*:R3*) GUESS=m88k-motorola-sysv3 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 then if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ test "$TARGET_BINARY_INTERFACE"x = x then GUESS=m88k-dg-dgux$UNAME_RELEASE else GUESS=m88k-dg-dguxbcs$UNAME_RELEASE fi else GUESS=i586-dg-dgux$UNAME_RELEASE fi ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) GUESS=m88k-dolphin-sysv3 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 GUESS=m88k-motorola-sysv3 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) GUESS=m88k-tektronix-sysv3 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) GUESS=m68k-tektronix-bsd ;; *:IRIX*:*:*) IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'` GUESS=mips-sgi-irix$IRIX_REL ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) GUESS=i386-ibm-aix ;; ia64:AIX:*:*) if test -x /usr/bin/oslevel ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include int main () { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then GUESS=$SYSTEM_NAME else GUESS=rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then GUESS=rs6000-ibm-aix3.2.4 else GUESS=rs6000-ibm-aix3.2 fi ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if test -x /usr/bin/lslpp ; then IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \ awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi GUESS=$IBM_ARCH-ibm-aix$IBM_REV ;; *:AIX:*:*) GUESS=rs6000-ibm-aix ;; ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) GUESS=romp-ibm-bsd4.4 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) GUESS=rs6000-bull-bosx ;; DPX/2?00:B.O.S.:*:*) GUESS=m68k-bull-sysv3 ;; 9000/[34]??:4.3bsd:1.*:*) GUESS=m68k-hp-bsd ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) GUESS=m68k-hp-bsd4.4 ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` case $UNAME_MACHINE in 9000/31?) HP_ARCH=m68000 ;; 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if test -x /usr/bin/getconf; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case $sc_cpu_version in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case $sc_kernel_bits in 32) HP_ARCH=hppa2.0n ;; 64) HP_ARCH=hppa2.0w ;; '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi if test "$HP_ARCH" = ""; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if test "$HP_ARCH" = hppa2.0w then set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH=hppa2.0w else HP_ARCH=hppa64 fi fi GUESS=$HP_ARCH-hp-hpux$HPUX_REV ;; ia64:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` GUESS=ia64-hp-hpux$HPUX_REV ;; 3050*:HI-UX:*:*) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } GUESS=unknown-hitachi-hiuxwe2 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) GUESS=hppa1.1-hp-bsd ;; 9000/8??:4.3bsd:*:*) GUESS=hppa1.0-hp-bsd ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) GUESS=hppa1.0-hp-mpeix ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) GUESS=hppa1.1-hp-osf ;; hp8??:OSF1:*:*) GUESS=hppa1.0-hp-osf ;; i*86:OSF1:*:*) if test -x /usr/sbin/sysversion ; then GUESS=$UNAME_MACHINE-unknown-osf1mk else GUESS=$UNAME_MACHINE-unknown-osf1 fi ;; parisc*:Lites*:*:*) GUESS=hppa1.1-hp-lites ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) GUESS=c1-convex-bsd ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) GUESS=c34-convex-bsd ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) GUESS=c38-convex-bsd ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) GUESS=c4-convex-bsd ;; CRAY*Y-MP:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=ymp-cray-unicos$CRAY_REL ;; CRAY*[A-Z]90:*:*:*) echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=t90-cray-unicos$CRAY_REL ;; CRAY*T3E:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=alphaev5-cray-unicosmk$CRAY_REL ;; CRAY*SV1:*:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=sv1-cray-unicos$CRAY_REL ;; *:UNICOS/mp:*:*) CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` GUESS=craynv-cray-unicosmp$CRAY_REL ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE ;; sparc*:BSD/OS:*:*) GUESS=sparc-unknown-bsdi$UNAME_RELEASE ;; *:BSD/OS:*:*) GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE ;; arm:FreeBSD:*:*) UNAME_PROCESSOR=`uname -p` set_cc_for_build if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi else FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf fi ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`uname -p` case $UNAME_PROCESSOR in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL ;; i*:CYGWIN*:*) GUESS=$UNAME_MACHINE-pc-cygwin ;; *:MINGW64*:*) GUESS=$UNAME_MACHINE-pc-mingw64 ;; *:MINGW*:*) GUESS=$UNAME_MACHINE-pc-mingw32 ;; *:MSYS*:*) GUESS=$UNAME_MACHINE-pc-msys ;; i*:PW*:*) GUESS=$UNAME_MACHINE-pc-pw32 ;; *:SerenityOS:*:*) GUESS=$UNAME_MACHINE-pc-serenity ;; *:Interix*:*) case $UNAME_MACHINE in x86) GUESS=i586-pc-interix$UNAME_RELEASE ;; authenticamd | genuineintel | EM64T) GUESS=x86_64-unknown-interix$UNAME_RELEASE ;; IA64) GUESS=ia64-unknown-interix$UNAME_RELEASE ;; esac ;; i*:UWIN*:*) GUESS=$UNAME_MACHINE-pc-uwin ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) GUESS=x86_64-pc-cygwin ;; prep*:SunOS:5.*:*) SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` GUESS=powerpcle-unknown-solaris2$SUN_REL ;; *:GNU:*:*) # the GNU system GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'` GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'` GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL ;; *:GNU/*:*:*) # other systems with GNU libc and userland GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"` GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC ;; x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*) GUESS="$UNAME_MACHINE-pc-managarm-mlibc" ;; *:[Mm]anagarm:*:*) GUESS="$UNAME_MACHINE-unknown-managarm-mlibc" ;; *:Minix:*:*) GUESS=$UNAME_MACHINE-unknown-minix ;; aarch64:Linux:*:*) set_cc_for_build CPU=$UNAME_MACHINE LIBCABI=$LIBC if test "$CC_FOR_BUILD" != no_compiler_found; then ABI=64 sed 's/^ //' << EOF > "$dummy.c" #ifdef __ARM_EABI__ #ifdef __ARM_PCS_VFP ABI=eabihf #else ABI=eabi #endif #endif EOF cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` eval "$cc_set_abi" case $ABI in eabi | eabihf) CPU=armv8l; LIBCABI=$LIBC$ABI ;; esac fi GUESS=$CPU-unknown-linux-$LIBCABI ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; arm*:Linux:*:*) set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then GUESS=$UNAME_MACHINE-unknown-linux-$LIBC else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi else GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf fi fi ;; avr32*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; cris:Linux:*:*) GUESS=$UNAME_MACHINE-axis-linux-$LIBC ;; crisv32:Linux:*:*) GUESS=$UNAME_MACHINE-axis-linux-$LIBC ;; e2k:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; frv:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; hexagon:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; i*86:Linux:*:*) GUESS=$UNAME_MACHINE-pc-linux-$LIBC ;; ia64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; k1om:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; kvx:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; kvx:cos:*:*) GUESS=$UNAME_MACHINE-unknown-cos ;; kvx:mbr:*:*) GUESS=$UNAME_MACHINE-unknown-mbr ;; loongarch32:Linux:*:* | loongarch64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; m32r*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; m68*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; mips:Linux:*:* | mips64:Linux:*:*) set_cc_for_build IS_GLIBC=0 test x"${LIBC}" = xgnu && IS_GLIBC=1 sed 's/^ //' << EOF > "$dummy.c" #undef CPU #undef mips #undef mipsel #undef mips64 #undef mips64el #if ${IS_GLIBC} && defined(_ABI64) LIBCABI=gnuabi64 #else #if ${IS_GLIBC} && defined(_ABIN32) LIBCABI=gnuabin32 #else LIBCABI=${LIBC} #endif #endif #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 CPU=mipsisa64r6 #else #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 CPU=mipsisa32r6 #else #if defined(__mips64) CPU=mips64 #else CPU=mips #endif #endif #endif #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) MIPS_ENDIAN=el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) MIPS_ENDIAN= #else MIPS_ENDIAN= #endif #endif EOF cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'` eval "$cc_set_vars" test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } ;; mips64el:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; openrisc*:Linux:*:*) GUESS=or1k-unknown-linux-$LIBC ;; or32:Linux:*:* | or1k*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; padre:Linux:*:*) GUESS=sparc-unknown-linux-$LIBC ;; parisc64:Linux:*:* | hppa64:Linux:*:*) GUESS=hppa64-unknown-linux-$LIBC ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;; PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;; *) GUESS=hppa-unknown-linux-$LIBC ;; esac ;; ppc64:Linux:*:*) GUESS=powerpc64-unknown-linux-$LIBC ;; ppc:Linux:*:*) GUESS=powerpc-unknown-linux-$LIBC ;; ppc64le:Linux:*:*) GUESS=powerpc64le-unknown-linux-$LIBC ;; ppcle:Linux:*:*) GUESS=powerpcle-unknown-linux-$LIBC ;; riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; s390:Linux:*:* | s390x:Linux:*:*) GUESS=$UNAME_MACHINE-ibm-linux-$LIBC ;; sh64*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; sh*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; sparc:Linux:*:* | sparc64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; tile*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; vax:Linux:*:*) GUESS=$UNAME_MACHINE-dec-linux-$LIBC ;; x86_64:Linux:*:*) set_cc_for_build CPU=$UNAME_MACHINE LIBCABI=$LIBC if test "$CC_FOR_BUILD" != no_compiler_found; then ABI=64 sed 's/^ //' << EOF > "$dummy.c" #ifdef __i386__ ABI=x86 #else #ifdef __ILP32__ ABI=x32 #endif #endif EOF cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` eval "$cc_set_abi" case $ABI in x86) CPU=i686 ;; x32) LIBCABI=${LIBC}x32 ;; esac fi GUESS=$CPU-pc-linux-$LIBCABI ;; xtensa*:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. GUESS=i386-sequent-sysv4 ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION ;; i*86:OS/2:*:*) # If we were able to find 'uname', then EMX Unix compatibility # is probably installed. GUESS=$UNAME_MACHINE-pc-os2-emx ;; i*86:XTS-300:*:STOP) GUESS=$UNAME_MACHINE-unknown-stop ;; i*86:atheos:*:*) GUESS=$UNAME_MACHINE-unknown-atheos ;; i*86:syllable:*:*) GUESS=$UNAME_MACHINE-pc-syllable ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) GUESS=i386-unknown-lynxos$UNAME_RELEASE ;; i*86:*DOS:*:*) GUESS=$UNAME_MACHINE-pc-msdosdjgpp ;; i*86:*:4.*:*) UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL else GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL fi ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL else GUESS=$UNAME_MACHINE-pc-sysv32 fi ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. GUESS=i586-pc-msdosdjgpp ;; Intel:Mach:3*:*) GUESS=i386-pc-mach3 ;; paragon:*:*:*) GUESS=i860-intel-osf1 ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4 fi ;; mini*:CTIX:SYS*5:*) # "miniframe" GUESS=m68010-convergent-sysv ;; mc68k:UNIX:SYSTEM5:3.51m) GUESS=m68k-convergent-sysv ;; M680?0:D-NIX:5.3:*) GUESS=m68k-diab-dnix ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) GUESS=m68k-unknown-lynxos$UNAME_RELEASE ;; mc68030:UNIX_System_V:4.*:*) GUESS=m68k-atari-sysv4 ;; TSUNAMI:LynxOS:2.*:*) GUESS=sparc-unknown-lynxos$UNAME_RELEASE ;; rs6000:LynxOS:2.*:*) GUESS=rs6000-unknown-lynxos$UNAME_RELEASE ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) GUESS=powerpc-unknown-lynxos$UNAME_RELEASE ;; SM[BE]S:UNIX_SV:*:*) GUESS=mips-dde-sysv$UNAME_RELEASE ;; RM*:ReliantUNIX-*:*:*) GUESS=mips-sni-sysv4 ;; RM*:SINIX-*:*:*) GUESS=mips-sni-sysv4 ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` GUESS=$UNAME_MACHINE-sni-sysv4 else GUESS=ns32k-sni-sysv fi ;; PENTIUM:*:4.0*:*) # Unisys 'ClearPath HMP IX 4000' SVR4/MP effort # says GUESS=i586-unisys-sysv4 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm GUESS=hppa1.1-stratus-sysv4 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. GUESS=i860-stratus-sysv4 ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. GUESS=$UNAME_MACHINE-stratus-vos ;; *:VOS:*:*) # From Paul.Green@stratus.com. GUESS=hppa1.1-stratus-vos ;; mc68*:A/UX:*:*) GUESS=m68k-apple-aux$UNAME_RELEASE ;; news*:NEWS-OS:6*:*) GUESS=mips-sony-newsos6 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if test -d /usr/nec; then GUESS=mips-nec-sysv$UNAME_RELEASE else GUESS=mips-unknown-sysv$UNAME_RELEASE fi ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. GUESS=powerpc-be-beos ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. GUESS=powerpc-apple-beos ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. GUESS=i586-pc-beos ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. GUESS=i586-pc-haiku ;; ppc:Haiku:*:*) # Haiku running on Apple PowerPC GUESS=powerpc-apple-haiku ;; *:Haiku:*:*) # Haiku modern gcc (not bound by BeOS compat) GUESS=$UNAME_MACHINE-unknown-haiku ;; SX-4:SUPER-UX:*:*) GUESS=sx4-nec-superux$UNAME_RELEASE ;; SX-5:SUPER-UX:*:*) GUESS=sx5-nec-superux$UNAME_RELEASE ;; SX-6:SUPER-UX:*:*) GUESS=sx6-nec-superux$UNAME_RELEASE ;; SX-7:SUPER-UX:*:*) GUESS=sx7-nec-superux$UNAME_RELEASE ;; SX-8:SUPER-UX:*:*) GUESS=sx8-nec-superux$UNAME_RELEASE ;; SX-8R:SUPER-UX:*:*) GUESS=sx8r-nec-superux$UNAME_RELEASE ;; SX-ACE:SUPER-UX:*:*) GUESS=sxace-nec-superux$UNAME_RELEASE ;; Power*:Rhapsody:*:*) GUESS=powerpc-apple-rhapsody$UNAME_RELEASE ;; *:Rhapsody:*:*) GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE ;; arm64:Darwin:*:*) GUESS=aarch64-apple-darwin$UNAME_RELEASE ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac if command -v xcode-select > /dev/null 2> /dev/null && \ ! xcode-select --print-path > /dev/null 2> /dev/null ; then # Avoid executing cc if there is no toolchain installed as # cc will be a stub that puts up a graphical alert # prompting the user to install developer tools. CC_FOR_BUILD=no_compiler_found else set_cc_for_build fi if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_PPC >/dev/null then UNAME_PROCESSOR=powerpc fi elif test "$UNAME_PROCESSOR" = i386 ; then # uname -m returns i386 or x86_64 UNAME_PROCESSOR=$UNAME_MACHINE fi GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE ;; *:QNX:*:4*) GUESS=i386-pc-qnx ;; NEO-*:NONSTOP_KERNEL:*:*) GUESS=neo-tandem-nsk$UNAME_RELEASE ;; NSE-*:NONSTOP_KERNEL:*:*) GUESS=nse-tandem-nsk$UNAME_RELEASE ;; NSR-*:NONSTOP_KERNEL:*:*) GUESS=nsr-tandem-nsk$UNAME_RELEASE ;; NSV-*:NONSTOP_KERNEL:*:*) GUESS=nsv-tandem-nsk$UNAME_RELEASE ;; NSX-*:NONSTOP_KERNEL:*:*) GUESS=nsx-tandem-nsk$UNAME_RELEASE ;; *:NonStop-UX:*:*) GUESS=mips-compaq-nonstopux ;; BS2000:POSIX*:*:*) GUESS=bs2000-siemens-sysv ;; DS/*:UNIX_System_V:*:*) GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "${cputype-}" = 386; then UNAME_MACHINE=i386 elif test "x${cputype-}" != x; then UNAME_MACHINE=$cputype fi GUESS=$UNAME_MACHINE-unknown-plan9 ;; *:TOPS-10:*:*) GUESS=pdp10-unknown-tops10 ;; *:TENEX:*:*) GUESS=pdp10-unknown-tenex ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) GUESS=pdp10-dec-tops20 ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) GUESS=pdp10-xkl-tops20 ;; *:TOPS-20:*:*) GUESS=pdp10-unknown-tops20 ;; *:ITS:*:*) GUESS=pdp10-unknown-its ;; SEI:*:*:SEIUX) GUESS=mips-sei-seiux$UNAME_RELEASE ;; *:DragonFly:*:*) DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case $UNAME_MACHINE in A*) GUESS=alpha-dec-vms ;; I*) GUESS=ia64-dec-vms ;; V*) GUESS=vax-dec-vms ;; esac ;; *:XENIX:*:SysV) GUESS=i386-pc-xenix ;; i*86:skyos:*:*) SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'` GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL ;; i*86:rdos:*:*) GUESS=$UNAME_MACHINE-pc-rdos ;; i*86:Fiwix:*:*) GUESS=$UNAME_MACHINE-pc-fiwix ;; *:AROS:*:*) GUESS=$UNAME_MACHINE-unknown-aros ;; x86_64:VMkernel:*:*) GUESS=$UNAME_MACHINE-unknown-esx ;; amd64:Isilon\ OneFS:*:*) GUESS=x86_64-unknown-onefs ;; *:Unleashed:*:*) GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE ;; *:Ironclad:*:*) GUESS=$UNAME_MACHINE-unknown-ironclad ;; esac # Do we have a guess based on uname results? if test "x$GUESS" != x; then echo "$GUESS" exit fi # No uname command or uname output not recognized. set_cc_for_build cat > "$dummy.c" < #include #endif #if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) #if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) #include #if defined(_SIZE_T_) || defined(SIGLOST) #include #endif #endif #endif int main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) #if !defined (ultrix) #include #if defined (BSD) #if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); #else #if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); #else printf ("vax-dec-bsd\n"); exit (0); #endif #endif #else printf ("vax-dec-bsd\n"); exit (0); #endif #else #if defined(_SIZE_T_) || defined(SIGLOST) struct utsname un; uname (&un); printf ("vax-dec-ultrix%s\n", un.release); exit (0); #else printf ("vax-dec-ultrix\n"); exit (0); #endif #endif #endif #if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) #if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) #if defined(_SIZE_T_) || defined(SIGLOST) struct utsname *un; uname (&un); printf ("mips-dec-ultrix%s\n", un.release); exit (0); #else printf ("mips-dec-ultrix\n"); exit (0); #endif #endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } echo "$0: unable to guess system type" >&2 case $UNAME_MACHINE:$UNAME_SYSTEM in mips:Linux | mips64:Linux) # If we got here on MIPS GNU/Linux, output extra information. cat >&2 <&2 <&2 </dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = "$UNAME_MACHINE" UNAME_RELEASE = "$UNAME_RELEASE" UNAME_SYSTEM = "$UNAME_SYSTEM" UNAME_VERSION = "$UNAME_VERSION" EOF fi exit 1 # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: vttest-20241208/esc.c0000644000000000000000000006405514724173604012745 0ustar rootroot/* $Id: esc.c,v 1.119 2024/12/05 00:44:52 tom Exp $ */ #include #include /* This was needed for Solaris 2.5, whose standard I/O was broken */ #define FLUSH fflush(stdout) #define VA_OUT(fp, fmt, ap) do { \ va_start(ap, fmt); \ va_out(fp, fmt, ap); \ va_end(ap); \ } while (0) static int soft_scroll; /******************************************************************************/ static int pending_decstbm; static int pending_decslrm; static int putting_data; 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 ss2_7[] = {ESC, 'N', 0}; static unsigned char ss2_8[] = {0x8e, 0}; char * ss2_input(void) { return input_8bits ? (char *) ss2_8 : ss2_7; } char * ss2_output(void) { return output_8bits ? (char *) ss2_8 : ss2_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); } /* * Print ordinary text, ensuring that the logged text has a newlne. */ int printxx(const char *fmt, ...) { va_list ap; va_start(ap, fmt); vfprintf(stdout, fmt, ap); va_end(ap); if (LOG_ENABLED) { int endl = (strchr(fmt, '\n') != NULL ? 0 : 1); fprintf(log_fp, TELL_STR); va_start(ap, fmt); vfprintf(log_fp, fmt, ap); va_end(ap); if (endl) fputs("\n", log_fp); } return 1; } /* * Print a ordinary line of text, logging it. */ int println(const char *s) { printf("%s\r\n", s); if (LOG_ENABLED) { fprintf(log_fp, "%s%s\n", TELL_STR, s); } return 1; } void put_char(FILE *fp, int c) { c &= 0xff; if (fp == stdout) { if (parse_7bits && (putting_data > 0) && (c >= 32)) { /* * Construct two different tests, according to whether the locale hints * that the terminal uses UTF-8. */ if (assume_utf8) { /* * In the first case, we are told that the parser expects C2 where the * test sends a C1 character. Unicode.org inverted ECMA-48 to do away * with the possibility of using non-UTF-8 codes in C1. Since that * disagrees with the standard (by substituting a multibyte character * for a single byte), and because the first of those bytes is a 0xC2, * it is appropriate to refer to this situation as a C2 character. * * Progressing through the range 128..255, if the test happens to be * using ISO Latin-1 (ISO-8859-1), then the UTF-8 encoding happens to * look correct. That will not work for other character sets. */ if (parse_7bits == 2 && allows_utf8 && c >= 128 && c <= 255) { unsigned char buffer[10]; int rc = conv_to_utf8(buffer, (unsigned) c, sizeof(buffer)); if (rc > 1) { /* rc should be 0, 1 or 2 */ fwrite(buffer, (size_t) (rc - 1), 1, fp); c = buffer[rc - 1]; /* fall-thru with the last byte */ } } } else { /* * The second case is relevant to ECMA-48 in contrast to the above. * ECMA-48 makes it clear that both 7-bit controls and 8-bit control * are parsed using a 7-bit table. We can demonstrate whether the * terminal actually does this by mapping printable 7-bit characters * (32 to 126) to the 160..254 range. * * Because an ECMA-48 parser looks for the final character (or the * string terminator for APC, etc.) using a 7-bit table, it is possible * to match the final/terminating character in the 160..254 range. * Unicode.org could improve its documentation to clarify how it * differs from ECMA-48, and in doing so might state that the data * stream need not comply with ECMA-48 in this regard. * * ECMA-48 and ISO 6429 provide the same information; the former is * preferred because it is freely available. Unicode.org mentions ISO * 6429 in ~10 places without providing any information on control * sequences. */ if (parse_7bits == 1 && c <= 126) { c |= 128; } } } putchar(c); } else { c &= 0xff; if (putting_data < 0 && c == ESC) fprintf(fp, "BUG:"); 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++); } #define CHECK_FORMAT() \ if (form_len + 2 >= (int) sizeof(real_fmt)) { \ done = 2; \ break; \ } #define ADD_TO_FORMAT(c) \ real_fmt[form_len++] = (char) (c); \ real_fmt[form_len] = 0 #define PUT_FORMATTED(c,arg_type) \ CHECK_FORMAT(); \ ADD_TO_FORMAT(c); \ if (size_arg) { \ size_arg = va_arg(ap, int); \ sprintf(real_arg, real_fmt, size_arg, va_arg(ap, arg_type)); \ } else { \ sprintf(real_arg, real_fmt, va_arg(ap, arg_type)); \ } \ put_string(fp, real_arg); \ real_fmt[form_len = 0] = 0 /* * Do our own vfprintf, so that we can reformat and log the output. */ static void va_out(FILE *fp, const char *fmt, va_list ap) { while (*fmt != '\0') { if (*fmt == '%') { char real_fmt[20]; char real_arg[1024]; int form_len = 0; int size_arg = 0; int done = 0; real_fmt[0] = 0; ADD_TO_FORMAT(*fmt); do { int ch = *++fmt; done = 1; switch (ch) { case 'c': ch = va_arg(ap, int); /* FALLTHRU */ case '%': put_char(fp, ch); break; case 'd': PUT_FORMATTED(ch, int); break; case 'u': PUT_FORMATTED(ch, unsigned); break; case 's': PUT_FORMATTED(ch, char *); break; case 0: done = 2; break; default: /* provide for "%20s", etc. */ CHECK_FORMAT(); ADD_TO_FORMAT(ch); done = 0; if (ch == '*') { /* provide for "%.*s", etc. */ if (++size_arg > 1) { done = 2; } } break; } } while (!done); if (done > 1) { put_string(fp, real_fmt); /* bug */ } } else { put_char(fp, (int) *fmt); } fmt++; } } /* * Print ordinary (non-control) text, formatted. */ int tprintf(const char *fmt, ...) { va_list ap; putting_data = -1; /* check for unexpected controls */ VA_OUT(stdout, fmt, ap); FLUSH; if (LOG_ENABLED) { fputs(DATA_STR, log_fp); VA_OUT(log_fp, fmt, ap); fputs("\n", log_fp); } putting_data = 0; return 1; } /* * Print control text, formatted. */ int cprintf(const char *fmt, ...) { va_list ap; putting_data = 1; VA_OUT(stdout, fmt, ap); FLUSH; if (LOG_ENABLED) { fputs(SEND_STR, log_fp); VA_OUT(log_fp, fmt, ap); fputs("\n", log_fp); } putting_data = 0; return 1; } /* CSI xxx */ void do_csi(const char *fmt, ...) { va_list ap; putting_data = 1; put_string(stdout, csi_output()); VA_OUT(stdout, fmt, ap); FLUSH; if (LOG_ENABLED) { fputs(SEND_STR, log_fp); put_string(log_fp, csi_output()); VA_OUT(log_fp, fmt, ap); fputs("\n", log_fp); } putting_data = 0; } /* DCS xxx ST */ void do_dcs(const char *fmt, ...) { va_list ap; putting_data = 1; put_string(stdout, dcs_output()); VA_OUT(stdout, fmt, ap); put_string(stdout, st_output()); FLUSH; if (LOG_ENABLED) { fputs(SEND_STR, log_fp); put_string(log_fp, dcs_output()); VA_OUT(log_fp, fmt, ap); put_string(log_fp, st_output()); fputs("\n", log_fp); } putting_data = 0; } /* DCS xxx ST */ void do_osc(const char *fmt, ...) { va_list ap; putting_data = 1; put_string(stdout, osc_output()); VA_OUT(stdout, fmt, ap); put_string(stdout, st_output()); FLUSH; if (LOG_ENABLED) { fputs(SEND_STR, log_fp); put_string(log_fp, osc_output()); VA_OUT(log_fp, fmt, ap); put_string(log_fp, st_output()); fputs("\n", log_fp); } putting_data = 0; } int print_chr(int c) { printf("%c", c); if (LOG_ENABLED) { fprintf(log_fp, SEND_STR); put_char(log_fp, c); fputs("\n", log_fp); } return 1; } int print_str(const char *s) { int result = (int) strlen(s); printf("%s", s); if (LOG_ENABLED) { fprintf(log_fp, SEND_STR); while (*s) { put_char(log_fp, *s++); } fputs("\n", log_fp); } return result; } void esc(const char *s) { putting_data = 1; put_char(stdout, ESC); put_string(stdout, s); if (LOG_ENABLED) { fprintf(log_fp, SEND_STR); put_char(log_fp, ESC); put_string(log_fp, s); fputs("\n", log_fp); } putting_data = 0; } /* * Maps positive sequence to [-1,0,1], where -1 denotes the absence of a * parameter, 0 and 1 are different ways to express the default parameter * when it is 1. */ int default_1(int pn) { return ((pn % 3) - 1); } /* * Special case for xterm's use of CSI T for mouse-tracking. */ int default_1a(int pn) { if ((pn = default_1(pn)) == 0) pn = 1; return pn; } void brc(int pn, int c) { if (pn < 0) /* e.g., default_1() */ do_csi("%c", c); else 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 decac(int flag, int fg, int bg) /* DECAC - Assign Color EK-VT520-RM, p 5-16 */ { if (use_decac) { decac_fg = fg; decac_bg = bg; } do_csi("%d;%d;%d,|", flag, fg, bg); } 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 decatc(int flag, int fg, int bg) /* DECATC - Alternate Text Color EK-VT520-RM, p 5-22 */ { do_csi("%d;%d;%d,}", flag, fg, bg); } 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 decrqpsr(int mode) /* Request presentation report */ { do_csi("%d$w", 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 decstglt(int mode) /* DECSTGLT Select Color Look-Up Table */ { do_csi("%d){", mode); } 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 */ { if (pn < 0) do_csi("b"); else 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 */ { if (pn < 0) do_csi(" @"); else do_csi("%d @", pn); } void sm(const char *ps) /* Set Mode */ { do_csi("%sh", ps); } void sr(int pn) /* Scroll Right */ { if (pn < 0) do_csi(" A"); else 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-20241208/status.c0000644000000000000000000000704014724173170013503 0ustar rootroot/* $Id: status.c,v 1.12 2024/12/05 00:40:24 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); tprintf("%s", text); decsasd(0); printxx("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"); tprintf("BOLD "); sgr("0;4"); tprintf("Underlined "); sgr("0;7"); tprintf("Reverse "); sgr("0;5"); tprintf("Blink "); sgr("0"); tprintf("NORMAL text "); decsasd(0); holdit(); restore_status(); holdit(); restore_status(); return MENU_NOHOLD; } static int CUP_statusline(MENU_ARGS) { static struct { const char *codes; const char *value; } table[] = { { "0;1", "First " }, { "0;4", "Second " }, { "0;7", "Third " }, { "0;5", "Fourth " }, { "0", "Last word" }, }; size_t last; vt_move(1, 1); println("This test demonstrates cursor-movement in the status-line"); holdit(); decssdt(2); decsasd(1); /* * Write the words in reverse-order, using cursor-addressing. * We could also do something with backspacing, insert/delete, but this * suffices to illustrate. */ el(2); for (last = TABLESIZE(table); last != 0; --last) { size_t j; int cols = 0; for (j = 0; j + 1 < last; ++j) { cols += (int) strlen(table[j].value); } hpa(1 + cols); sgr(table[last - 1].codes); tprintf("%s", table[last - 1].value); } 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", NULL }, { "Simple Status line Test", simple_statusline }, { "Test Graphic-Rendition in Status line", SGR_statusline }, { "Test Cursor-movement in Status line", CUP_statusline }, { "", NULL } }; /* *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-20241208/draw.h0000644000000000000000000000064214677107762013136 0ustar rootroot/* $Id: draw.h,v 1.5 2024/10/02 00:12:34 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(const BOX *box, int mark); extern void draw_box_filled(const BOX *box, int mark); extern void draw_box_caption(const BOX *box, int margin, const char **c); extern void ruler(int row, int width); vttest-20241208/setup.c0000644000000000000000000003117214724173170013323 0ustar rootroot/* $Id: setup.c,v 1.55 2024/12/05 00:40:24 tom Exp $ */ #include #include #include #define PARSE_NAME(mode) \ ((mode > 1) \ ? "C2" \ : (mode == 1 \ ? "8-bit" \ : "7-bit")) static int cur_level = -1; /* current operating level (VT100=1) */ static int max_level = -1; /* maximum operating level */ static int check_8bit_toggle(void) { int result = FALSE; char *report; set_tty_raw(TRUE); pause_replay(); cup(1, 1); dsr(6); padding(5); /* may not be needed */ report = get_reply(); resume_replay(); restore_ttymodes(); if ((report = skip_csi(report)) != NULL && !strcmp(report, "1;1R")) result = TRUE; if (LOG_ENABLED) { fprintf(log_fp, NOTE_STR "%svalid response from DSR 6\n", result ? "" : "no "); } return result; } /* * Determine the current and maximum operating levels of the terminal */ static void find_levels(void) { char *report; int actual_id = -1; int has_color = 0; set_tty_raw(TRUE); set_tty_echo(FALSE); da(); report = get_reply(); cur_level = max_level = 1; /* assume a VT100 */ if (!strcmp(report, "\033/Z")) { actual_id = 52; cur_level = max_level = 0; /* must be a VT52 */ } else if ((report = skip_csi(report)) == NULL || strlen(report) < 3) { actual_id = 100; } else if (*report == '?') { int pos = 1; int check = scan_DA(report, &pos); switch (check) { default: case 1: actual_id = 100; break; case 2: case 6: actual_id = 102; break; case 4: actual_id = 132; break; case 7: actual_id = 131; break; case 12: actual_id = 125; break; case 62: actual_id = 220; break; case 63: actual_id = 320; break; case 64: actual_id = 420; break; case 65: actual_id = 520; break; } cur_level = max_level = (actual_id / 100); } if (max_level >= 4) { int pos = 1; /* index of first digit */ int check; /* * Check for color feature (see below) needed in initialization of VT525. * Other terminals may advertise this feature, but only VT525 will change * its response in DECRQCRA according to color. */ while ((check = scan_DA(report, &pos)) >= 0) { if (check == 22) { has_color = 1; break; } } decrqss("\"p"); report = get_reply(); if ((report = skip_dcs(report)) != NULL && 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 (max_level >= 2) { do_csi(">c"); /* or "CSI > 0 c" */ report = get_reply(); if ((report = skip_csi(report)) != NULL && *report == '>') { int pos = 1; /* index of first digit */ switch (scan_DA(report, &pos)) { case 1: actual_id = 220; break; case 2: actual_id = 240; break; case 18: actual_id = 330; break; case 19: actual_id = 340; break; case 24: actual_id = 320; break; case 28: actual_id = 330; break; case 32: actual_id = 382; break; case 48: actual_id = 382; break; case 41: actual_id = 420; break; case 61: actual_id = 510; break; case 64: actual_id = 520; break; case 65: actual_id = 525; break; } } } /* * If the terminal advertises color (a VT525 feature), initialize the * text color to the default values, to simplify the DECRQCRA test. * Defaults are documented in EK-VT520-RM, p 2-32. */ if (has_color && actual_id == 525) { use_decac = 1; decac(1, 7, 0); /* normal text: assign white-on-black */ } if (LOG_ENABLED) { fprintf(log_fp, NOTE_STR "Max Operating Level: %d\n", max_level); fprintf(log_fp, NOTE_STR "Cur Operating Level: %d\n", cur_level); fprintf(log_fp, NOTE_STR "Derived terminal-id: %d\n", actual_id); } restore_ttymodes(); } static int toggle_DECSCL(MENU_ARGS) { int request = cur_level; if (max_level <= 1) { vt_move(1, 1); printxx("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 == NULL) enable_logging(NULL); 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; } static int toggle_7bit_fsm(MENU_ARGS) { int save_7bits = parse_7bits; /* * See comment in put_char(). There are two cases for the parse_7bits value. * In both cases, 7-bit controls should work when parse_7bits is zero. The * tests relate to the nonzero value: * * parse_7bits == 1: * This is for the 8-bit environment, i.e., 8-bit controls should work. But * ECMA-49 section 9 comes into play because 7-bit controls are parsed * ignoring the 8th bit. The C1 controls have specific definitons which * override that, but by ignoring the 8th bit that guarantees that after the * initial C0 or C1 byte, all of the following characters will be parsed * without the 8th bit. * * This case is tested by setting the 8th bit in the controls to ensure that * the parser has to deal with that situation. * * parse_7bits == 2: * This is for the UTF-8 environment. C1 controls in put_char() are recoded * to UTF-8 to test if the terminal can interpret those. Normally vttest * resets UTF-8 mode on startup; the "-u" option suppresses that, allowing * this test. */ if (assume_utf8 && allows_utf8) { parse_7bits = parse_7bits ? 0 : 2; } else { parse_7bits = parse_7bits ? 0 : 1; } if (LOG_ENABLED) { fprintf(log_fp, NOTE_STR "toggle parser from %s to %s\n", PARSE_NAME(save_7bits), PARSE_NAME(parse_7bits)); } /* * If we're told to switch to 8-bit or C2 mode, check that we can do that. */ if (parse_7bits != 0) { int save_output = output_8bits; int rc; output_8bits = 1; rc = check_8bit_toggle(); output_8bits = save_output; if (!rc) { int requested = parse_7bits; char msg[80]; parse_7bits = save_7bits; vt_clear(2); vt_move(1, 1); sprintf(msg, "Sorry, this terminal does not fully support %s parsing", PARSE_NAME(requested)); println(msg); return MENU_HOLD; } output_8bits = save_output; } else { output_8bits = 0; } 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; } /******************************************************************************/ /* * While processing command-lines, "pathname" is non-null. After that, it can * be null to temporarily disable logging. */ void enable_logging(const char *pathname) { static char *my_name; if (pathname != NULL) { free(my_name); my_name = strdup(pathname); } if (my_name != NULL) { log_fp = fopen(my_name, "w"); if (log_fp == NULL) { failed(my_name); } } } void reset_level(void) { cur_level = max_level; } void restore_level(const 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 */ parse_7bits = save->parse_7bits; /* in case we ignored ECMA-48 */ } void save_level(VTLEVEL *save) { save->cur_level = cur_level; save->input_8bits = input_8bits; save->output_8bits = output_8bits; save->parse_7bits = parse_7bits; if (LOG_ENABLED) fprintf(log_fp, NOTE_STR "save_level(%d) in=%d, out=%d, fsm=%d\n", cur_level, input_8bits ? 8 : 7, output_8bits ? 8 : 7, parse_7bits ? 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, NOTE_STR "set_level(%d)\n", request); if (request > max_level) { printxx("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; parse_7bits = FALSE; } else { if (cur_level == 0) { esc("<"); /* Enter ANSI mode (VT100 mode) */ } if (request == 1) { input_8bits = FALSE; output_8bits = FALSE; parse_7bits = FALSE; } if (max_level > 1) { if (request > 1) do_csi("6%d;%d\"p", request, !input_8bits); else do_csi("61\"p"); } } padding(5); /* may not be needed */ cur_level = request; } if (LOG_ENABLED) fprintf(log_fp, NOTE_STR "...set_level(%d) in=%d, out=%d, fsm=%d\n", cur_level, input_8bits ? 8 : 7, output_8bits ? 8 : 7, parse_7bits ? 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_parse7[80] = "parser 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", NULL }, { "Setup terminal to original test-configuration", setup_terminal }, { txt_output, toggle_8bit_out }, { txt_input8, toggle_8bit_in }, { txt_parse7, toggle_7bit_fsm }, { txt_DECSCL, toggle_DECSCL }, { txt_logging, toggle_Logging }, { txt_padded, toggle_Padding }, { txt_slowly, toggle_Slowly }, { "", NULL } }; /* *INDENT-ON* */ if (cur_level < 0) find_levels(); do { sprintf(txt_output, "Send %s controls", (output_8bits ? ((parse_7bits > 1) ? "C2" : "8-bit") : "7-bit")); sprintf(txt_input8, "Receive %d-bit controls", input_8bits ? 8 : 7); switch (parse_7bits) { default: case 1: sprintf(txt_parse7, "Assume %d-bit parser (see ECMA-48 section 9)", parse_7bits ? 7 : 8); break; case 2: sprintf(txt_parse7, "Assume parser accepts C2 (Unicode.org two-byte encoding)"); break; } 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-20241208/vt52.c0000644000000000000000000001723214724541770012771 0ustar rootroot/* $Id: vt52.c,v 1.26 2024/12/06 09:29:28 tom Exp $ */ #include #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; int box_r = 71; char *response; 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++) tprintf("%s", "FooBar "); println("Bletch"); } vt52home(); /* Cursor home */ vt52ed(); /* Erase to end of screen */ vt52cup(7, 47); tprintf("nothing more."); for (i = 1; i <= 10; i++) tprintf("THIS SHOULD GO AWAY! "); for (i = 1; i <= 5; i++) { vt52cup(1, 1); tprintf("%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 */ } /* * Draw some text that we do not want to display. */ for (i = 2; i <= max_lines - 1; i++) { vt52cup(i, 70); tprintf("%s", "**Foobar"); } /* * Draw the left side of the box, going from bottom to top. */ vt52cup(max_lines - 1, 10); for (i = max_lines - 1; i >= 2; i--) { tprintf("%s", "*"); tprintf("%c", 8); /* BS */ vt52ri(); /* Reverse LineFeed (LineStarve) */ } /* * Draw the top of the box, going from right to left. * Make the movement a little more complicated by using cursor-addressing * which is out of bounds vertically so that only the column is updated. */ vt52cup(1, 70); for (i = 70; i >= 10; i--) { tprintf("%s", "*"); vt52cub1(); if (i % 2) vt52cup(max_lines + 3, i - 1); else vt52cub1(); /* Cursor Left */ } /* * Draw the bottom of the box, going from left to right. */ vt52cup(max_lines, 10); for (i = 10; i <= 70; i++) { tprintf("%s", "*"); tprintf("%c", 8); /* BS */ vt52cuf1(); /* Cursor Right */ } /* * Draw a column of "!" inside the left edge of the box. */ vt52cup(2, 11); for (i = 2; i <= max_lines - 1; i++) { tprintf("%s", "!"); tprintf("%c", 8); /* BS */ vt52cud1(); /* Cursor Down */ } /* * Draw a column of "!" inside the right edge of the box. */ vt52cup(max_lines - 1, 69); for (i = max_lines - 1; i >= 2; i--) { tprintf("%s", "!"); tprintf("%c", 8); /* BS */ vt52cuu1(); /* Cursor Up */ } /* * Erase the "*FooBar" on the right-side of the box, leaving just "*". * A real VT52 would leave a ragged right-margin; VT100 emulating VT52 won't. */ vt52cuf1(); /* Cursor Right */ vt52cuf1(); /* Cursor Right */ for (i = 2; i <= max_lines - 1; i++) { int adj = i % 3; if (adj) { vt52cup(i, min_cols + 1 + adj); /* past right-margin of row i */ } else vt52cup(i, box_r); vt52el(); /* Erase to end of line */ } vt52cup(10, 16); printxx("%s", "The screen should be cleared, and have a centered"); vt52cup(11, 16); printxx("%s", "rectangle of \"*\"s with \"!\"s on the inside to the"); vt52cup(12, 16); printxx("%s", "left and right. Only this, and"); vt52cup(13, 16); holdit(); vt52home(); /* Cursor home */ vt52ed(); /* Erase to end of screen */ printxx("%s", "This is the normal character set:"); for (j = 0; j <= 1; j++) { vt52cup(3 + j, 16); for (i = 0; i <= 47; i++) tprintf("%c", 32 + i + 48 * j); } vt52cup(6, 1); printxx("%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++) tprintf("%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 response otherwise */ printxx("Response was "); chrprint2(response, 2, 13); 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, col; 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 = instr(); vt_move(++row, col = 10); printxx("Response was"); chrprint2(response, row, col); if (isreturn(response)) { show_result(SHOW_SUCCESS); } else { if (parse_decrqss(response, "\"p") > 0) printxx("DECSCL recognized --"); show_result(SHOW_FAILURE); } println(""); row++; } if (save.cur_level >= 2) { const char *temp; vt_move(++row, 1); row = testing("S8C1T", row); s8c1t(1); cup(1, 1); dsr(6); response = instr(); vt_move(row, col = 10); printxx("Response to CUP(1,1)/DSR(6)"); chrprint2(response, row, col); if ((temp = skip_prefix(csi_input(), response)) != NULL) { if (!strcmp("1;1R", temp)) { printxx("S8C1T recognized --"); show_result(SHOW_FAILURE); } else { printxx("unknown response --"); show_result(SHOW_FAILURE); } } else { input_8bits = FALSE; /* we expect this anyway */ if ((temp = skip_prefix(csi_input(), response)) != NULL && !strcmp("1;1R", temp)) { show_result(SHOW_SUCCESS); } else { printxx("unknown response --"); show_result(SHOW_FAILURE); } } } restore_level(&save); restore_ttymodes(); println(""); println(""); } return MENU_HOLD; } vttest-20241208/draw.c0000644000000000000000000000631514724173024013117 0ustar rootroot/* $Id: draw.c,v 1.15 2024/12/05 00:38:44 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) { printxx("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(const 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(const 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(const 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; const char *s; while ((s = *c++) != NULL) { int t; 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-20241208/vms_io.c0000644000000000000000000002374114703603230013452 0ustar rootroot/* $Id: vms_io.c,v 1.32 2024/10/16 00:19:36 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 dependent 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, NOTE_STR "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, NOTE_STR "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, NOTE_STR "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); } if (active) pause_replay(); if (LOG_ENABLED) { fputs(READ_STR, log_fp); put_char(log_fp, c); fputs("\n", log_fp); } if (active) resume_replay(); 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[BUF_SIZE]; FILE *save = log_fp; pause_replay(); log_fp = NULL; result[0] = inchar(); zleep(100); /* Wait 0.1 seconds */ log_fp = save; read_vms_tty(sizeof(result) - 3, FALSE); memcpy(result + 1, ibuf, nibuf); result[1 + nibuf] = '\0'; if (LOG_ENABLED) { fputs(READ_STR, log_fp); put_string(log_fp, result); fputs("\n", log_fp); } resume_replay(); 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); pause_replay(); read_vms_tty(sizeof(result) - 3, TRUE); memcpy(result + 1, ibuf, nibuf); result[1 + nibuf] = '\0'; if (LOG_ENABLED) { fputs(READ_STR, log_fp); put_string(log_fp, result); fputs("\n", log_fp); } resume_replay(); return (result); } /* * Read to the next newline, truncating the buffer at BUF_SIZE-1 characters */ void inputline(char *s) { char *result = s; if (is_replaying() && (result = replay_string()) != NULL) { strcpy(s, result); puts(result); fflush(stdout); zleep(1000); } else { do { int ch; char *d = s; while ((ch = getchar()) != EOF && ch != '\n') { if ((d - s) < BUF_SIZE - 2) *d++ = ch; } *d = 0; } while (!*s); } if (LOG_ENABLED) fprintf(log_fp, READ_STR "%s\n", result); } /* * 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) { if (is_replaying() && (result = replay_string()) != NULL) { puts(result); fflush(stdout); zleep(1000); } else { fflush(stdout); while (inchar() != '\n') ; } if (LOG_ENABLED) fputs(READ_STR "\n", log_fp); } /* * 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, NOTE_STR "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); /* Note: 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, NOTE_STR "TTY modes %#x, %#x, %#x\n", oldmode[0], oldmode[1], oldmode[2]); fprintf(log_fp, NOTE_STR "iosb.count = %#x\n", iosb.count); fprintf(log_fp, NOTE_STR "iosb.dev_dep_data = %#x\n", iosb.dev_dep_data); fprintf(log_fp, NOTE_STR "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-20241208/package/0000755000000000000000000000000014724534252013410 5ustar rootrootvttest-20241208/package/vttest.spec0000644000000000000000000000307514724534252015622 0ustar rootrootSummary: Test VT100-type terminal %define AppProgram vttest %define AppPatched 20241208 %define AppVersion 2.7.%{AppPatched} # $XTermId: vttest.spec,v 1.73 2024/12/06 08:41:14 tom Exp $ Name: %{AppProgram} Version: %{AppVersion} Release: 1 License: MIT Group: Applications/Development URL: https://invisible-island.net/%{name}/ Source0: https://invisible-island.net/archives/%{name}/%{name}-%{AppPatched}.tgz %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 # no need for debugging symbols... %define debug_package %{nil} %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} %files %defattr(-,root,root) %{_prefix}/bin/%{AppProgram} %{_mandir}/man1/%{AppProgram}.* %changelog # each patch should add its ChangeLog entries here * Thu Dec 29 2022 Thomas E. Dickey - update URLs * Mon Jul 02 2018 Thomas E. Dickey - use recommended flags for build * Thu Aug 26 2010 Thomas E. Dickey - initial version vttest-20241208/package/freebsd/0000755000000000000000000000000014724534252015022 5ustar rootrootvttest-20241208/package/freebsd/Makefile0000644000000000000000000000104214724534252016457 0ustar rootroot# Created by: Nicola Vitale # $FreeBSD: head/sysutils/vttest/Makefile 478968 2018-09-04 16:47:01Z nivit $ PORTNAME= vttest PORTVERSION= 2024.12.08 CATEGORIES= sysutils MASTER_SITES= ftp://ftp.invisible-island.net/vttest/ DISTNAME= ${PORTNAME}-${PORTVERSION:S,.,,g} MAINTAINER= nivit@FreeBSD.org COMMENT= Program to test "VT100-compatibility" of terminals LICENSE= MIT LICENSE_FILE= ${WRKSRC}/COPYING USES= tar:tgz GNU_CONFIGURE= yes MAKEFILE= makefile PLIST_FILES= bin/vttest man/man1/vttest.1.gz .include vttest-20241208/package/freebsd/pkg-descr0000644000000000000000000000025312355414446016624 0ustar rootrootThis is a program to test the compatibility (or to demonstrate the non-compatibility) of so-called "VT100-compatible" terminals. WWW: http://invisible-island.net/vttest/ vttest-20241208/package/freebsd/distinfo0000644000000000000000000000023313343533405016555 0ustar rootrootTIMESTAMP = 1536078824 SHA256 (vttest-20180811.tgz) = 2ee8ecad0185fbd9fad4d192f04f93ac3c5b705aef85d4a4b92d26c5a71f8ed6 SIZE (vttest-20180811.tgz) = 201618 vttest-20241208/package/debian/0000755000000000000000000000000014724534252014632 5ustar rootrootvttest-20241208/package/debian/copyright0000644000000000000000000001321714564513254016572 0ustar rootrootUpstream source http://invisible-island.net/vttest/vttest.html ------------------------------------------------------------------------------- Copyright 1996-2023,2024 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-2022,2023 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-2015,2018 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-20241208/package/debian/docs0000644000000000000000000000000714701615716015502 0ustar rootrootREADME vttest-20241208/package/debian/compat0000644000000000000000000000000313731733660016032 0ustar rootroot11 vttest-20241208/package/debian/postinst0000644000000000000000000000050511435425376016442 0ustar rootroot#! /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-20241208/package/debian/prerm0000644000000000000000000000023411435425422015673 0ustar rootroot#! /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-20241208/package/debian/rules0000755000000000000000000000103614673350546015717 0ustar rootroot#!/usr/bin/make -f # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 export DEB_BUILD_MAINT_OPTIONS := hardening=+all qa=+bug reproducible=+all %: dh $@ # dh_autoreconf interferes with portability -- skip it override_dh_autoreconf: echo "skip: dh_autoreconf autoreconf-dickey -- -f -i" override_dh_auto_configure: dh_auto_configure -- --enable-warnings --verbose --program-suffix=-cur # install both the real changelog as well as the test package's changelog override_dh_installchangelogs: dh_installchangelogs CHANGES vttest-20241208/package/debian/control0000644000000000000000000000132314673347550016242 0ustar rootrootSource: vttest-cur Maintainer: Thomas E. Dickey Section: utils Priority: optional Standards-Version: 4.7.0 Build-Depends: debhelper (>= 5) Homepage: http://invisible-island.net/vttest/ Package: vttest-cur Architecture: any Depends: libc6 (>= 2.7) 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-20241208/package/debian/source/0000755000000000000000000000000011435432073016124 5ustar rootrootvttest-20241208/package/debian/source/format0000644000000000000000000000001511435432073017333 0ustar rootroot3.0 (native) vttest-20241208/package/debian/watch0000644000000000000000000000013711435424444015661 0ustar rootrootversion=3 opts=passive ftp://invisible-island.net/vttest/vttest-(\d+)\.tgz \ debian uupdate vttest-20241208/package/debian/preinst0000644000000000000000000000072011435576414016242 0ustar rootroot#! /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-20241208/package/debian/changelog0000644000000000000000000001550714724534252016514 0ustar rootrootvttest-cur (2.7.20241208) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Fri, 06 Dec 2024 03:41:14 -0500 vttest-cur (2.7.20241204) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Fri, 29 Nov 2024 19:23:34 -0500 vttest-cur (2.7.20241124) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Sat, 23 Nov 2024 19:29:34 -0500 vttest-cur (2.7.20241031) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Thu, 31 Oct 2024 03:45:36 -0400 vttest-cur (2.7.20241024) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Tue, 15 Oct 2024 21:51:21 -0400 vttest-cur (2.7.20241014) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Sun, 13 Oct 2024 15:01:26 -0400 vttest-cur (2.7.20241010) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Fri, 04 Oct 2024 03:48:12 -0400 vttest-cur (2.7.20240929) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Wed, 18 Sep 2024 16:12:59 -0400 vttest-cur (2.7.20240708) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Mon, 08 Jul 2024 18:31:59 -0400 vttest-cur (2.7.20240218) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Wed, 14 Feb 2024 19:53:03 -0500 vttest-cur (2.7.20231230) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Wed, 15 Nov 2023 17:25:42 -0500 vttest-cur (2.7.20230924) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Sun, 24 Sep 2023 06:10:41 -0400 vttest-cur (2.7.20230201) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Wed, 01 Feb 2023 17:00:04 -0500 vttest-cur (2.7.20221229) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Thu, 28 Dec 2022 17:14:39 -0500 vttest-cur (2.7.20221111) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Thu, 10 Nov 2022 17:35:19 -0500 vttest-cur (2.7.20220827) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Sat, 27 Aug 2022 09:32:52 -0400 vttest-cur (2.7.20220227) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Sat, 26 Feb 2022 11:16:32 -0500 vttest-cur (2.7.20220215) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Mon, 14 Feb 2022 20:09:18 -0500 vttest-cur (2.7.20210210) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Tue, 09 Feb 2021 18:29:04 -0500 vttest-cur (2.7.20201225) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Tue, 22 Dec 2020 16:34:29 -0500 vttest-cur (2.7.20200920) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Sun, 20 Sep 2020 11:54:13 -0400 vttest-cur (2.7.20200610) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Mon, 08 Jun 2020 15:21:34 -0400 vttest-cur (2.7.20200420) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Mon, 20 Apr 2020 04:10:16 -0400 vttest-cur (2.7.20200303) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Tue, 03 Mar 2020 21:06:08 -0500 vttest-cur (2.7.20191231) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Tue, 31 Dec 2019 17:33:17 -0500 vttest-cur (2.7.20190710) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Wed, 10 Jul 2019 18:05:30 -0400 vttest-cur (2.7.20190105) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Sat, 05 Jan 2019 09:41:23 -0500 vttest-cur (2.7.20181116) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Fri, 16 Nov 2018 17:18:27 -0500 vttest-cur (2.7.20180911) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Sat, 11 Aug 2018 08:03:11 -0400 vttest-cur (2.7.20180728) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Thu, 26 Jul 2018 17:41:54 -0400 vttest-cur (2.7.20180725) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Sun, 22 Jul 2018 16:51:19 -0400 vttest-cur (2.7.20180702) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Mon, 02 Jul 2018 06:51:59 -0400 vttest-cur (2.7.20150706) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Mon, 06 Jul 2015 05:29:15 -0400 vttest-cur (2.7.20140305) unstable; urgency=low * maintenance updates -- Thomas E. Dickey Wed, 05 Mar 2014 19:28:40 -0500 vttest-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-20241208/package/pkgsrc/0000755000000000000000000000000014724534252014701 5ustar rootrootvttest-20241208/package/pkgsrc/Makefile0000644000000000000000000000062714724534252016346 0ustar rootroot# $NetBSD: Makefile,v 1.14 2018/08/19 20:16:41 wiz Exp $ DISTNAME= vttest-20241208 CATEGORIES= misc benchmarks MASTER_SITES= ftp://ftp.invisible-island.net/vttest/ EXTRACT_SUFX= .tgz MAINTAINER= pkgsrc-users@NetBSD.org HOMEPAGE= https://invisible-island.net/vttest/vttest.html COMMENT= Utility to test vt100/vt220/xterm LICENSE= x11 GNU_CONFIGURE= yes MAKE_FILE= makefile .include "../../mk/bsd.pkg.mk" vttest-20241208/package/pkgsrc/DESCR0000644000000000000000000000050307370122620015451 0ustar rootrootThis 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. vttest-20241208/package/pkgsrc/distinfo0000644000000000000000000000061713414154036016440 0ustar rootroot$NetBSD: distinfo,v 1.9 2015/11/03 23:49:54 agc Exp $ SHA1 (vttest-20180911.tgz) = dd8f2849d1f391036edf10a96aed0fb3254144dd RMD160 (vttest-20180911.tgz) = d9fb895fc2afd0b1d640fe7a6bda0d1eef946991 SHA512 (vttest-20180911.tgz) = 8fbba34f3cc5b9eec3559a3b3113ac8867d2c20cd530c09e890cec2e995ae778934b8c2ea7349f82bf15468840dd8a4d4c34db666e1505c322e09ff9732868f0 Size (vttest-20180911.tgz) = 204433 bytes vttest-20241208/package/pkgsrc/PLIST0000644000000000000000000000013407370122620015504 0ustar rootroot@comment $NetBSD: PLIST,v 1.1 2001/11/01 01:29:52 zuntum Exp $ bin/vttest man/man1/vttest.1 vttest-20241208/nonvt100.c0000644000000000000000000005262414724172723013560 0ustar rootroot/* $Id: nonvt100.c,v 1.71 2024/12/05 00:37:39 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); printxx("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(NULL); 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(NULL); 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); tprintf("*"); } vt_move(4, 1); println("CHT with param != 1:"); for (n = 0; n < last_tab; n++) { cup(5, 1); cht(n); tprintf("+"); } vt_move(7, 1); println("Normal tabs:"); for (n = 0; n < last_tab; n++) { tprintf("\t*"); } set_colors(NULL); 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); tprintf("1."); /* this line should not be overwritten */ for (n = 1; n <= last - 3; n++) { hpa(min_cols); cnl(n - 1); /* CNL 0 should skip to the second line */ slowly(); tprintf("%d.", n + 1); vpa(2); /* subsequently, start from the second line */ } set_colors(NULL); 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(); tprintf("%d.", i); } set_colors(NULL); 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(NULL); 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(NULL); 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) { tprintf(" "); if (n > 2) rep(n - 2); } tprintf("+"); rep(default_1(n)); /* 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++) tprintf("%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); tprintf("*"); slowly(); sd(default_1a(n)); } 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); tprintf("*"); slowly(); sl(default_1(n)); } 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); tprintf("*"); slowly(); sr(default_1(n)); } 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); tprintf("*"); slowly(); su(default_1(n)); } 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) { BOX box; if (make_box_params(&box, 5, 20) == 0) { int pass; 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); printxx("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", NULL }, { erm_mesg, toggle_ERM }, { "Test Protected-Areas (SPA)", tst_SPA }, { "", NULL }, }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printxx("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(NULL); 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"); } if (box.right > box.left) { for (n = box.right; n > box.left; n--) { if (lrmm_flag && !origin_mode && (((n == lft) && (lft > 1)) || ((n == lft + 1) && (lft > 1)) || ((n == lft - 1) && (lft > 1)) || ((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(NULL); 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", NULL }, { "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 }, { "", NULL } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printxx("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", NULL }, { "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 }, { "", NULL }, }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printxx("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", NULL }, { "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 }, { "", NULL } }; /* *INDENT-ON* */ do { vt_clear(2); title(0); printxx("Non-VT100 Tests"); title(2); println("Choose test type:"); } while (menu(my_menu)); return MENU_NOHOLD; } vttest-20241208/charsets.c0000644000000000000000000007040014724173024013772 0ustar rootroot/* $Id: charsets.c,v 1.107 2024/12/05 00:38:44 tom Exp $ */ /* * Test character-sets (e.g., SCS control, DECNRCM mode) */ #include #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, Portuguese = 16, Hebrew = 17, British_Latin_1, Cyrillic_DEC, DEC_Alt_Chars, DEC_Alt_Graphics, DEC_Spec_Graphic, DEC_Supp, DEC_Supp_Graphic, DEC_Technical, DEC_UPSS, Greek, Greek_DEC, Greek_Supp, Hebrew_DEC, Hebrew_Supp, JIS_Roman, JIS_Katakana, Latin_2_Supp, Latin_5_Supp, Latin_Cyrillic, Russian, Turkish, Turkish_DEC, SCS_NRCS, Unknown } National; typedef struct { National code; /* internal name (chosen to sort 'name' member) */ int cs_type; /* 0=94-charset, 1=NRCS(94-charset), 2=96-charset */ int order; /* check-column so we can mechanically-sort this table */ int first; /* first model: 0=base, 2=vt220, 3=vt320, etc. */ int last; /* last model: 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 Only7(c) ((c) & 0x7f) #define Not11(a,b) (Only7(a) == Only7(b)) /* * User-preferred selection set is unknown until reset. */ static National current_upss = Unknown; /* * The "map_XXX" strings list the characters that should be replaced for the * given NRCS. Use that to highlight them for clarity. */ static const char map_pound[] = "#"; static const char map_all94[] = "!\"#$%&'()*+,-./0123456789:;<=>?" "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_" "`abcdefghijklmnopqrstuvwxyz{|}~"; static const char map_all96[] = " !\"#$%&'()*+,-./0123456789:;<=>?" "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_" "`abcdefghijklmnopqrstuvwxyz{|}~\177"; /* National Replacement Character Sets */ static const char map_DEC_Supp[] = "$&,-./48>GHIJKLMNOPW^pw}~"; static const char map_Spec_Graphic[] = "`abcdefghijklmnopqrstuvwxyz{|}~"; static const char map_Supp_Graphic[] = "$&(,-./48>PW]^pw}~\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_Greek[] = "abcdefghijklmnopqrstuvwxyz"; static const char map_Hebrew[] = "`abcdefghijklmnopqrstuvwxyz"; static const char map_Italian[] = "#@[\\]`{|}~"; static const char map_Norwegian[] = "@[\\]^`{|}~"; static const char map_Portuguese[] = "[\\]{|}"; static const char map_Russian[] = "`abcdefghijklmnopqrstuvwxyz{|}~"; static const char map_SCS[] = "@[\\]^`{|}~"; static const char map_Spanish[] = "#@[\\]{|}"; static const char map_Swedish[] = "@[\\]^`{|}~"; static const char map_Swiss[] = "#@[\\]^_`{|}~"; static const char map_Turkish[] = "&@[\\]^`{|}~"; /* DEC pre-ISO 94-Character Sets */ static const char map_DEC_Greek[] = "$&,-./48>" "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_" "`abcdefghijklmnopqrstuvwxyz{|}~"; static const char map_DEC_Hebrew[] = "$&,-./48>" "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_" "`abcdefghijklmnopqrstuvwxyz{|}~"; static const char map_DEC_Turkish[] = "$&,-./48>?" "PW]^" "pw~"; /* DEC VT382 94-character sets */ static const char map_JIS_Roman[] = "\\~"; static const char map_JIS_Katakana[] = "!\"#$%&'()*+,-./0123456789:;<=>?" "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"; /* ISO 96-Character Sets */ static const char map_ISO_Greek[] = "!\"$%*./45689:<>?" "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_" "`abcdefghijklmnopqrstuvwxyz{|}~\177"; static const char map_ISO_Hebrew[] = "!*:?" "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_" "`abcdefghijklmnopqrstuvwxyz{|}~\177"; static const char map_ISO_Latin_2[] = "!\"#%&)*+,./1235679:;<=>?" "@CEFHJLOPQRUXY[^" "`cefhjlopqruxy{~\177"; static const char map_ISO_Latin_5[] = "P]^p}~"; static const CHARSETS KnownCharsets[] = { { ASCII, 0, 0, 0, 9, "B", "US ASCII", NULL }, { British, 1, 0, 0, 9, "A", "British", map_pound }, { British_Latin_1, 2, 0, 3, 9, "A", "ISO Latin-1", NULL }, { Cyrillic_DEC, 1, 0, 5, 9, "&4", "Cyrillic (DEC)", map_all94 }, { 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", NULL }, { DEC_Alt_Graphics, 0, 0, 0, 0, "2", "DEC Alternate character ROM special graphics", NULL }, { DEC_Supp, 0, 0, 2, 2, "<", "DEC Supplemental", map_DEC_Supp }, { DEC_UPSS, 0, 0, 3, 9, "<", "User-preferred supplemental", NULL }, { DEC_Supp_Graphic, 1, 0, 3, 9, "%5", "DEC Supplemental Graphic", map_Supp_Graphic }, { DEC_Technical, 0, 0, 3, 9, ">", "DEC Technical", map_all94 }, { Dutch, 1, 0, 2, 9, "4", "Dutch", map_Dutch }, { Finnish, 1, 0, 2, 9, "5", "Finnish", map_Finnish }, { Finnish, 1, 1, 2, 9, "C", "Finnish", map_French }, { French, 1, 0, 2, 9, "R", "French", map_French }, { French, 1, 1, 2, 9, "f", "French", map_French }, /* Kermit (vt340 model?) */ { French_Canadian, 1, 0, 2, 9, "Q", "French Canadian", map_French_Canadian }, { French_Canadian, 1, 1, 3, 9, "9", "French Canadian", map_French_Canadian }, { German, 1, 0, 2, 9, "K", "German", map_German }, { Greek, 1, 0, 5, 9, "\">", "Greek", map_Greek }, { Greek_DEC, 1, 0, 5, 9, "\"?", "Greek (DEC)", map_DEC_Greek }, { Greek_Supp, 2, 0, 5, 9, "F", "ISO Greek Supplemental", map_ISO_Greek }, { Hebrew, 1, 0, 5, 9, "%=", "Hebrew", map_Hebrew }, { Hebrew_DEC, 1, 0, 5, 9, "\"4", "Hebrew (DEC)", map_DEC_Hebrew }, { Hebrew_Supp, 2, 0, 5, 9, "H", "ISO Hebrew Supplemental", map_ISO_Hebrew }, { Italian, 1, 0, 2, 9, "Y", "Italian", map_Italian }, { JIS_Roman, 0, 0, 3, 3, "J", "JIS-Roman", map_JIS_Roman }, { JIS_Katakana, 0, 0, 3, 3, "I", "JIS-Katakana", map_JIS_Katakana }, { Latin_2_Supp, 2, 0, 5, 9, "B", "ISO Latin-2 Supplemental", map_ISO_Latin_2 }, { Latin_5_Supp, 2, 0, 5, 9, "M", "ISO Latin-5 Supplemental", map_ISO_Latin_5 }, { Latin_Cyrillic, 2, 0, 5, 9, "L", "ISO Latin-Cyrillic", map_all96 }, { Norwegian_Danish, 1, 0, 3, 9, "`", "Norwegian/Danish", map_Norwegian }, { Norwegian_Danish, 1, 1, 2, 9, "E", "Norwegian/Danish", map_Norwegian }, { Norwegian_Danish, 1, 2, 2, 9, "6", "Norwegian/Danish", map_Norwegian }, { Portuguese, 1, 0, 3, 9, "%6", "Portuguese", map_Portuguese }, { Russian, 1, 0, 5, 9, "&5", "Russian", map_Russian }, { SCS_NRCS, 1, 0, 5, 9, "%3", "SCS", map_SCS }, { Spanish, 1, 0, 2, 9, "Z", "Spanish", map_Spanish }, { Swedish, 1, 0, 2, 9, "7", "Swedish", map_Swedish }, { Swedish, 1, 1, 2, 9, "H", "Swedish", map_Swedish }, { Swiss, 1, 0, 2, 9, "=", "Swiss", map_Swiss }, { Turkish, 1, 0, 5, 9, "%2", "Turkish", map_Turkish }, { Turkish_DEC, 1, 0, 5, 9, "%0", "Turkish (DEC)", map_DEC_Turkish }, { Unknown, 0, 0,-1,-1, "?", "Unknown", NULL } }; /* *INDENT-ON* */ static int hilite_not11; static char sgr_hilite[10]; static char sgr_reset[10]; int scs_national; /* true if NRCS should be tested */ 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 = NULL; if (n >= 0 && n < TABLESIZE(KnownCharsets)) { if (!strcmp(KnownCharsets[n].final, "A")) { if (scs_national || (g == 0)) { n = lookupCode(British); } else { n = lookupCode(British_Latin_1); } } result = &KnownCharsets[n]; } return result; } static const char * code2name(National code) { int n = lookupCode(code); return KnownCharsets[n].name; } 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_STR "send32 row %d, upper %d, not11:", row, upper); if (not11) { int lo = -1; int hi = -1; int nn; for (nn = 0; not11[nn]; ++nn) { int cc = Only7(not11[nn]); if (lo < 0) { lo = cc; } else if (cc > hi + 1) { /* a gap after the existing range? */ if (lo == hi) fprintf(log_fp, " %d", hi); else fprintf(log_fp, " %d-%d", lo, hi); lo = cc; } hi = cc; } if (lo > 0 && hi > 0) { if (lo == hi) fprintf(log_fp, " %d", hi); else fprintf(log_fp, " %d-%d", lo, hi); } } fprintf(log_fp, "\n"); } for (col = 0; col <= 31; col++) { char ch = (char) (row * 32 + upper + col); if (not11 != NULL && 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; cprintf("%s", buffer); } static char * scs_params(char *dst, int g) { const CHARSETS *tbl = lookupCharset(g, current_Gx[g]); sprintf(dst, "%c%s", (((g != 0) && (tbl->cs_type == 2) && (get_level() > 2)) ? "?-./"[g] : "()*+"[g]), tbl->final); return dst; } int do_scs(int g) { int rc = 0; char buffer[80]; scs_params(buffer, g); /* "?" is a placeholder: you cannot designate a 96-character set into G0 */ if (*buffer != '?') { esc(buffer); rc = 1; } return rc; } /* reset given Gg back to sane setting */ 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) { return do_scs(sane_cs(g)); } /* reset all of the Gn to sane settings */ int reset_charset(MENU_ARGS) { int n; scs_national = FALSE; decnrcm(scs_national); for (n = 0; n < 4; n++) { int m = sane_cs(n); if (m != current_Gx[n] || (m == 0)) { int save = current_Gx[n]; current_Gx[n] = n ? m : 0; if (!do_scs(n)) { current_Gx[n] = save; } } } 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 (scs_national && (KnownCharsets[n].cs_type == 2)) continue; if (!scs_national && (KnownCharsets[n].cs_type == 1)) 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 = NULL; 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; } int toggle_nrc(MENU_ARGS) { scs_national = !scs_national; decnrcm(scs_national); return MENU_NOHOLD; } int specify_G0(MENU_ARGS) { specify_any_Gx(PASS_ARGS, 0); return MENU_NOHOLD; } int specify_G1(MENU_ARGS) { specify_any_Gx(PASS_ARGS, 1); return MENU_NOHOLD; } int specify_G2(MENU_ARGS) { specify_any_Gx(PASS_ARGS, 2); return MENU_NOHOLD; } 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), printxx("Selected as G0 (with SI)")); __(cup(1, 48), printxx("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 != scs_national) decnrcm(scs_national); } ++cset; } } scs_normal(); __(cup(max_lines, 1), printxx("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), printxx("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); scs_normal(); 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(scs_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") != NULL); 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 : NULL); if (table[cset].upper) { do_scs(map); esc(table[cset].code); } else { scs_normal(); /* * That set G1 to ASCII, just like G0. While that works for VT100 (a * 7-bit device), the later 8-bit models use Latin-1 for the default * value of G1. */ switch (get_level()) { case 0: case 1: break; case 2: esc(")A"); /* select the 94-character NRCS, closest to MCS */ break; default: esc("-A"); /* select the 96-character set */ break; } map_g1_to_gr(); } cup(row + i, 40); send32(i, 128, map_gl ? NULL : 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(scs_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)) { cprintf("%s", sgr_hilite); hilited = 1; break; } } } tprintf("%c", ch); if (ch == 127 && (tbl->cs_type != 2)) tprintf(" "); /* DEL should have been eaten - skip past */ if (hilited) { cprintf("%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 = NULL; 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 && (strcmp(KnownCharsets[j].final, "A") || (scs_national != (KnownCharsets[j].cs_type == 2))) && !strncmp(KnownCharsets[j].final, first, check)) { result = KnownCharsets[j].name; *offset += (int) check; break; } } } if (result == NULL) { static char temp[80]; sprintf(temp, "? %#x\n", *source); *offset += 1; result = temp; } return result; } /* * Lookup character set name for DECRQUPSS. */ const char * parse_upss_name(const char *source, int size) { const char *result = NULL; int j; int allow96 = (size == 96); for (j = 0; j < TABLESIZE(KnownCharsets); ++j) { if (allow96 != (KnownCharsets[j].cs_type == 2)) continue; if (!strcmp(source, KnownCharsets[j].final)) { result = KnownCharsets[j].name; current_upss = KnownCharsets[j].code; break; } } /* * Work around a contradiction between DEC 070 and the reference manuals. */ if (result == NULL && allow96 && (!strcmp(source, "A") || !strcmp(source, "B"))) { result = parse_upss_name(source, 94); } 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'); } static void assign_upss(National code, int allow96) { if (code != current_upss) { int n; for (n = 0; n < TABLESIZE(KnownCharsets); ++n) { if (KnownCharsets[n].code == code) { if (get_level() >= KnownCharsets[n].first && get_level() <= KnownCharsets[n].last) { set_tty_raw(TRUE); set_tty_echo(FALSE); do_dcs("%d!u%s", allow96, KnownCharsets[n].final); current_upss = code; } break; } } } restore_ttymodes(); } static int reset_upss(MENU_ARGS) { assign_upss(DEC_Supp_Graphic, 0); return MENU_NOHOLD; } /* Test Assign User-Preferred Supplemental Set - VT320 and up */ static int tst_DECAUPSS(MENU_ARGS) { MENU my_menu[TABLESIZE(KnownCharsets) + 2]; int n, m; int level = get_level(); /* * Build up a menu of the character sets we will allow the user to specify. */ for (n = m = 0; n < TABLESIZE(KnownCharsets); n++) { the_list[n] = 0; if (!strcmp(KnownCharsets[n].final, "?")) continue; if (KnownCharsets[n].cs_type != 2) switch (KnownCharsets[n].code) { case ASCII: /* undocumented */ case DEC_Spec_Graphic: /* undocumented */ case DEC_Supp_Graphic: case DEC_Technical: /* undocumented */ case Greek_DEC: case Hebrew_DEC: case Turkish_DEC: case Cyrillic_DEC: break; default: continue; } if (KnownCharsets[n].first == 2) /* exclude NRCS */ continue; if (level < KnownCharsets[n].first) continue; if (level > KnownCharsets[n].last) 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 = NULL; do { vt_clear(2); __(title(0), println(the_title)); __(title(2), println("Choose character-set:")); } while (menu(my_menu) && the_code < 0); assign_upss(KnownCharsets[the_code].code, KnownCharsets[the_code].cs_type == 2); return MENU_HOLD; } /* Test Report User-Preferred Supplemental Set - VT320 and up */ static int tst_DECRQUPSS(MENU_ARGS) { int row, col; char *report; const char *show; char buffer[80]; __(vt_move(1, 1), println("Testing DECRQUPSS Window Report")); set_tty_raw(TRUE); set_tty_echo(FALSE); do_csi("&u"); report = get_reply(); vt_move(row = 3, col = 10); chrprint2(report, row, col); if ((report = skip_dcs(report)) != NULL && strip_terminator(report)) { int cs_size; const char *cs_name; if (*report == '0') cs_size = 94; else if (*report == '1') cs_size = 96; else cs_size = -1; show = "unknown"; if (cs_size > 0 && *++report == '!' && *++report == 'u' && (cs_name = parse_upss_name(++report, cs_size)) != NULL) { sprintf(buffer, "%s (%d characters)", cs_name, cs_size); show = buffer; } } else { show = SHOW_FAILURE; } show_result("%s", show); restore_ttymodes(); vt_move(max_lines - 1, 1); return MENU_HOLD; } 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", NULL }, { "Reset (G0 ASCII, G1 Latin-1, 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 }, { "", NULL } }; /* *INDENT-ON* */ hilite_not11 = 1; toggle_hilite(PASS_ARGS); reset_charset(PASS_ARGS); /* make the menu consistent */ if (get_level() > 1 || input_8bits || output_8bits) { int n; do { vt_clear(2); __(title(0), printxx("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(scs_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)); /* 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); } } int tst_upss(MENU_ARGS) { static char upss_mesg[120]; /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", NULL }, { "Test character sets", tst_characters }, { "Reset UPSS (User-Preferred Supplemental Sets)", reset_upss }, { upss_mesg, tst_DECAUPSS }, { "Test DECRQUPSS", tst_DECRQUPSS }, { "", NULL } }; /* *INDENT-ON* */ hilite_not11 = 1; toggle_hilite(PASS_ARGS); reset_charset(PASS_ARGS); /* make the menu consistent */ if (get_level() > 2) { do { sprintf(upss_mesg, "Assign UPSS (now %s)", code2name(current_upss)); vt_clear(2); __(title(0), printxx("User-Preferred Supplemental Sets Tests")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); /* tidy in case a "vt100" emulator does not ignore SCS */ vt_clear(1); return reset_upss(PASS_ARGS); } else { return tst_characters(PASS_ARGS); } } vttest-20241208/vttest.10000644000000000000000000001064314701705425013431 0ustar rootroot.\" $Id: vttest.1,v 1.25 2024/10/10 08:06:45 tom Exp $ .TH VTTEST 1 2024-10-10 "" "User commands" .\" Bulleted paragraph .de bP .ie n .IP \(bu 4 .el .IP \(bu 2 .. .ie \n(.g .ds : \: .el .ds : \" empty . .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq .\} .el \{\ .ie t .ds `` `` .el .ds `` "" .ie t .ds '' '' .el .ds '' "" .\}", .\" URL hyperlink support macros from groff's "an-ext.tmac" . .\" Save the automatic hyphenation mode. .\" .\" In AT&T troff, there was no register exposing the hyphenation mode, .\" and no way to save and restore it. Set `mH` to a reasonable value .\" for your implementation and preference. .de mY . ie !\\n(.g \ . nr mH 14 . el \ . do nr mH \\n[.hy] \" groff extension register .. . .\" Prepare link text for mail/web hyperlinks. `MT` and `UR` call this. .de mV . ds mU \\$1\" .. . .\" Emit hyperlink. The optional argument supplies trailing punctuation .\" after link text. `ME` and `UE` call this. .de mQ . mY . nh <\\*(mU>\\$1 . hy \\n(mH . rm mU .. . .\" Start URL. .\" .UR url .if !\n(.g \{\ .de UR . mV \\$1 .. .\} . .\" End URL. .\" .UE [punctuation] .if !\n(.g \{\ .de UE . mQ \\$1 .. .\} . .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. .bP To run a given menu-item, you must enter its number. .bP Menu items start at zero; this is the \*(``Exit\*('' item in almost all cases. .bP You can run all menu-items (for a given level) by entering an asterisk, i.e, \*(``*'. .bP You can force a repaint of the menu items by entering \*(``?\*(''. .bP 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., .bP 24 lines, .bP 80 minimum columns, and .bP 132 maximum columns. .PP 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 .B \-V print the program version, and exit. .TP 5 .BI \-c " commands" replay commands recorded by the logging option. Some keyboard and mouse input is required, depending on the tests, but otherwise menu selection and next-page responses are automated. .TP 5 .BI \-f " fontfile" 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 \-q show only the most recent part of a continuous response, e.g., any-event mouse tests, to improve readability of the test. .TP 5 .B \-s add time-delay in selected panning/scrolling options to show details. .TP 5 .B \-u suppress switch from UTF-8 mode on startup, and enable a third setting in the 7-bit/8-bit parsing test to allow for C2 controls as an alternate to 8-bit C1. .TP 5 .B \-8 use 8-bit controls (this can be changed with a menu option). . .SH ENVIRONMENT When \fBvttest\fP starts, it checks the locale (LC_ALL, etc.), to determine if the terminal uses UTF-8, and normally switches the terminal to ISO-8859\ 1. Use the \*(``\fB\-u\fR\*('' option to disable this switching, and provide some special cases where UTF-8 encoding is accepted. .PP For example, the Unicode specification does not document its relationship to ECMA-48 (ISO 6429) beyond listing C0 and C1 codes which Unicode treats as whitespace. The latter (i.e., NEL U+0085) is misleading because Unicode describes C1 controls only obliquely. It goes into a little more detail regarding ECMA-35 (ISO 2022). \fBvttest\fP allows for both the standard encoding of C1 (single byte) and the variant implied by Unicode, referred to here as C2 (two bytes) to distinguish the two encodings. . .SH AUTHORS Per Lindberg (mcvax,seismo)!enea!suadb!lindberg sometime 1985. Modified by Thomas E. Dickey from June 1996, to support nonstandard screen geometry, VT220-VT525, ISO color and xterm-specific tests. . .SH SEE ALSO .nf .I "XTerm Control Sequences" .UR https://\*:invisible\-\*:island\*:.net/\*:xterm/\*:ctlseqs/\*:ctlseqs\*:.html .UE .br .UR https://\*:github\*:.com/\*:mattiase/\*:wraptest/ .I "DEC VT terminal line-wrapping semantics" .UE .fi vttest-20241208/esc.h0000644000000000000000000002106314703250642012735 0ustar rootroot/* $Id: esc.h,v 1.80 2024/10/14 17:15:14 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 SS3 0217 #define DCS 0220 #define CSI 0233 #define ST 0234 #define OSC 0235 /* * "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 DECKANAM 12 /* Katakana shift */ #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 DECHEBM 35 /* Hebrew keyboard mapping (VT520) */ #define DECHEM 36 /* Hebrew encoding */ #define DECTEK 38 /* 4010/4014 emulation (VT240, VT330/VT340) */ #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 DECKKDM 59 /* Kanji/Katakana */ #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 (VT420) */ #define DECXRLM 73 /* transmit rate linking */ #define DECSDM 80 /* Sixel display */ #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); const char *osc_input(void); const char *osc_output(void); char *ss2_input(void); char *ss2_output(void); char *ss3_input(void); char *ss3_output(void); char *st_input(void); char *st_output(void); int cup(int pn1, int pn2); int decdc(int pn); int decic(int pn); int default_1(int pn); int default_1a(int pn); int println(const char *s); int printxx(const char *fmt, ...) GCC_PRINTFLIKE(1,2); int tprintf(const char *fmt, ...) GCC_PRINTFLIKE(1,2); int cprintf(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 decac(int flag, int fg, int bg); void decaln(void); void decarm(int flag); void decatc(int flag, int fg, int bg); 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 decrqpsr(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 decstglt(int mode); 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-20241208/mouse.c0000644000000000000000000005750414724172723013325 0ustar rootroot/* $Id: mouse.c,v 1.47 2024/12/05 00:37:39 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(report_row = 4 + n, report_col = 10) typedef enum { cDFT = 0, cUTF = 1005, cSGR = 1006, cURX = 1015, cSGRp = 1016 } COORDS; static int do_ExtCoords; static int do_ExtPixels; static int do_FocusEvent; static int chars_high; static int chars_wide; static int pixels_high; static int pixels_wide; static int pixels_xpos; static int pixels_ypos; static int pixels_xchr; static int pixels_ychr; /* * If the terminal responds to the window-size reports, use that to determine * the scaling for pixel-coordinates. */ static int can_do_pixels(void) { static int first = TRUE; int result = FALSE; if (first) { char *report; int reply; char final; char extra; first = FALSE; result = TRUE; set_tty_raw(TRUE); set_tty_echo(FALSE); brc(13, 't'); report = get_reply(); if ((report = skip_csi(report)) == NULL || sscanf(report, "%d;%d;%d%c%c", &reply, &pixels_ypos, &pixels_xpos, &final, &extra) != 4 || reply != 3 || pixels_ypos <= 0 || pixels_xpos <= 0 || final != 't') { result = FALSE; } else { brc(14, 't'); report = get_reply(); if ((report = skip_csi(report)) == NULL || sscanf(report, "%d;%d;%d%c%c", &reply, &pixels_high, &pixels_wide, &final, &extra) != 4 || reply != 4 || pixels_high <= 0 || pixels_wide <= 0 || final != 't') { result = FALSE; } else { brc(16, 't'); report = get_reply(); if ((report = skip_csi(report)) == NULL || sscanf(report, "%d;%d;%d%c%c", &reply, &pixels_ychr, &pixels_xchr, &final, &extra) != 4 || reply != 6 || pixels_ychr <= 0 || pixels_xchr <= 0 || final != 't') { result = FALSE; } } } restore_ttymodes(); if (result && LOG_ENABLED) { fprintf(log_fp, NOTE_STR "screen %dx%d at %d,%d (cell %dx%d)\n", pixels_high, pixels_wide, pixels_ypos, pixels_xpos, pixels_ychr, pixels_xchr); } } return result; } 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; case cSGRp: result = "SGR/pixels"; 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; const 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: case cSGRp: 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 != NULL) { char *base = *report; char *endp = NULL; long value = strtol(base, &endp, 10); if (value >= (long) offset && (endp == NULL || (*endp == 0 || *endp == ';' || *endp == final))) { result = (unsigned) value - offset; if (endp != NULL) { if (*endp == ';') ++endp; *report = endp; } else { *report = base + strlen(base); } } else { *report = NULL; 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 = NULL; if ((report = skip_csi(report)) != NULL) { char *finalp; 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: case cSGRp: 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 = NULL; if ((report = skip_csi(report)) != NULL) { char *finalp; 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: case cSGRp: 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 = NULL; if ((report = skip_csi(report)) != NULL) { char *finalp; 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: case cSGRp: 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) { if (do_ExtPixels) { y = (y + (unsigned) pixels_ychr - 1) / (unsigned) pixels_ychr; x = (x + (unsigned) pixels_xchr - 1) / (unsigned) pixels_xchr; } 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); tprintf("+"); vt_move(last-1, 1); tprintf("+"); vt_move(first, min_cols); tprintf("+"); vt_move(last-1, min_cols); tprintf("+"); /* *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; int report_row, report_col; ToData(0); vt_el(2); chrprint2(report, report_row, report_col); while ((report = skip_csi(report)) != NULL && (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 = get_reply(); if ((report = skip_csi(report)) == NULL || 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 = get_reply(); if ((report = skip_csi(report)) == NULL || 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; pause_replay(); loop: 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 loop; } else if (isClear(*report)) { goto loop; } 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() */ } } resume_replay(); 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; int report_row, report_col; loop: 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); pause_replay(); for (;;) { char *report = instr(); if (isQuit(*report)) { break; } else if (isReport(*report)) { show_mousemodes(); goto loop; } else if (isClear(*report)) { goto loop; } ToData(0); chrprint2(report, report_row, report_col); while ((report = parse_mouse_M(report, &b, &xx, &yy)) != NULL) { unsigned adj = 1; char result[80]; char modifiers[80]; sprintf(result, "code 0x%x (%u,%u)", b, yy, xx); *modifiers = '\0'; if (b & (unsigned) (~3)) { if (b & 4) strcat(modifiers, " shift"); if (b & 8) strcat(modifiers, " meta"); if (b & 16) strcat(modifiers, " control"); if (b & 32) strcat(modifiers, " motion"); if (b & 64) adj += 3; b &= 3; } if ((b == 3) && (adj == 1)) { if (xx != x || yy != y) { ToData(1); vt_el(2); show_result("%s release%s", result, modifiers); show_click(yy, xx, '*'); } } else { b += adj; ToData(1); vt_el(2); show_result("%s button %u%s", result, b, modifiers); show_click(yy, xx, (int) (b + '0')); } x = xx; y = yy; report += 4; } } resume_replay(); rm(the_mode); fflush(stdout); 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; int report_row, report_col; loop: vt_move(1, 1); ed(0); println(the_title); show_mousehelp(); println("Mouse events will be marked with the button number."); printxx("Highlighting range is [%d..%d)\n", first, last); show_hilite(first, last); sm("?1001"); fflush(stdout); set_tty_raw(TRUE); set_tty_echo(FALSE); pause_replay(); for (;;) { char *report = instr(); if (isQuit(*report)) { break; } else if (isReport(*report)) { show_mousemodes(); goto loop; } else if (isClear(*report)) { goto loop; } show_hilite(first, last); ToData(1); vt_el(2); chrprint2(report, report_row, report_col); if (parse_mouse_M(report, &b, &x, &y) != NULL) { 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'); } } resume_replay(); rm("?1001"); fflush(stdout); 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; int report_row, report_col; pause_replay(); loop: vt_move(1, 1); ed(0); println(the_title); show_mousehelp(); println("Mouse events will be marked with the button number."); sm("?9"); fflush(stdout); set_tty_raw(TRUE); set_tty_echo(FALSE); for (;;) { char *report = instr(); if (isQuit(*report)) { break; } else if (isReport(*report)) { show_mousemodes(); goto loop; } else if (isClear(*report)) { goto loop; } ToData(0); vt_el(2); chrprint2(report, report_row, report_col); if (parse_mouse_M(report, &b, &x, &y) != NULL) { cup((int) y, (int) x); tprintf("%u", b + 1); vt_move((int) y, (int) x); fflush(stdout); } } resume_replay(); rm("?9"); fflush(stdout); 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", NULL }, { "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 }, { "", NULL } }; /* *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]; do_ExtPixels = FALSE; switch (do_ExtCoords) { case cUTF: do_ExtCoords = cSGR; break; case cSGR: do_ExtCoords = cURX; break; case cURX: if (can_do_pixels()) { do_ExtCoords = cSGRp; do_ExtPixels = TRUE; } else { do_ExtCoords = cDFT; } break; case cSGRp: do_ExtCoords = cDFT; break; default: do_ExtCoords = cUTF; break; } if (LOG_ENABLED) { fprintf(log_fp, NOTE_STR "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"); fflush(stdout); 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", NULL }, { 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 }, { "", NULL } }; /* *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-20241208/makefile.in0000644000000000000000000000667114700624537014134 0ustar rootroot# $Id: makefile.in,v 1.50 2024/10/07 00:20:47 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@ LINT_OPTS = @LINT_OPTS@ 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 .$(manext) .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)/$< >$@ ################################################################################ C_SRC = \ charsets.c \ color.c \ draw.c \ esc.c \ keyboard.c \ main.c \ mouse.c \ nonvt100.c \ printer.c \ replay.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 \ replay$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 \ $(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) @MAKE_PHONY@.PHONY: all install installdirs uninstall mostlyclean clean distclean realclean lint check all: $(PROG) $(PROG): $(OBJS) @ECHO_LD@$(LINK) $(CFLAGS) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIBS) $(THIS)$o \ $(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 *~ *.cat *.BAK *.trace *.atac clean :: mostlyclean rm -f $(PROG) distclean :: clean rm -f makefile config.log config.cache config.status config.h man2html.tmp 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) ################################################################################ lint: $(LINT) $(LINT_OPTS) $(CPPFLAGS) $(C_SRC) check: $(PROG) @echo 'Sorry -- You must run this interactively.' vttest-20241208/color.c0000644000000000000000000004247114724173024013303 0ustar rootroot/* $Id: color.c,v 1.42 2024/12/05 00:38:44 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]; int reset = FALSE; (void) strcpy(temp, s); if (*temp == ';' || *temp == 0) { reset = TRUE; } else { char *t; 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); printxx("Color/Graphic rendition test pattern:"); cup( 4, 1); c_sgr("0"); tprintf("vanilla"); cup( 4,40); c_sgr("0;1"); tprintf("bold"); cup( 6, 6); c_sgr(";4"); tprintf("underline"); cup( 6,45); c_sgr(";1");c_sgr("4");tprintf("bold underline"); cup( 8, 1); c_sgr("0;5"); tprintf("blink"); cup( 8,40); c_sgr("0;5;1"); tprintf("bold blink"); cup(10, 6); c_sgr("0;4;5"); tprintf("underline blink"); cup(10,45); c_sgr("0;1;4;5"); tprintf("bold underline blink"); cup(12, 1); c_sgr("1;4;5;0;7"); tprintf("negative"); cup(12,40); c_sgr("0;1;7"); tprintf("bold negative"); cup(14, 6); c_sgr("0;4;7"); tprintf("underline negative"); cup(14,45); c_sgr("0;1;4;7"); tprintf("bold underline negative"); cup(16, 1); c_sgr("1;4;;5;7"); tprintf("blink negative"); cup(16,40); c_sgr("0;1;5;7"); tprintf("bold blink negative"); cup(18, 6); c_sgr("0;4;5;7"); tprintf("underline blink negative"); cup(18,45); c_sgr("0;1;4;5;7"); tprintf("bold underline blink negative"); cup(20, 6); c_sgr(""); set_foreground(9); tprintf("original foreground"); cup(20,45); c_sgr(""); set_background(9); tprintf("original background"); /* *INDENT-ON* */ c_sgr(""); /* same as c_sgr("0") */ decscnm(FALSE); /* Inverse video off */ cup(max_lines - 1, 1); el(0); tprintf("Dark background. "); holdit(); decscnm(TRUE); /* Inverse video */ cup(max_lines - 1, 1); el(0); tprintf("Light background. "); holdit(); decscnm(FALSE); } static void show_line_deletions(void) { int row; ed(2); cup(1, 1); printxx("This test deletes every third line from a list, marking cursor with '*'.\n"); printxx("The foreground and background should be yellow(orange) and blue, respectively.\n"); for (row = 5; row <= max_lines; row++) { cup(row, 1); tprintf(" 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); printxx("This test inserts after every second line in a list, marking cursor with '*'.\n"); printxx("The foreground and background should be yellow(orange) and blue, respectively.\n"); for (row = 5; row <= max_lines; row++) { cup(row, 1); tprintf(" 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); printxx("There are %d color combinations", MAX_COLORS * MAX_COLORS); for (k = 0; k <= 11; k += 11) { cup(k + 2, 1); tprintf("%dx%d matrix of foreground/background colors, bright *", MAX_COLORS, MAX_COLORS); if (k) { sgr("1"); tprintf("on"); sgr("0"); } else { tprintf("off"); } tprintf("*"); for (i = 0; i < MAX_COLORS; i++) { cup(k + 3, (i + 1) * 8 + 1); tprintf("%s", colors[i]); } for (i = 0; i < MAX_COLORS; i++) { cup(k + i + 4, 1); tprintf("%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); tprintf("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(const 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.", NULL }; 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.", NULL }; 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(const 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++) { int first; int limit; 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(const 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.", NULL }; 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.", NULL }; 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); printxx("Extended/Graphic rendition test pattern:"); cup( 4, 1); c_sgr("0"); tprintf("vanilla"); cup( 4,40); c_sgr("0;1"); tprintf("bold"); cup( 6, 6); c_sgr("22;4"); tprintf("underline"); cup( 6,45); c_sgr("24;1;4"); tprintf("bold underline"); cup( 8, 1); c_sgr("22;24;5"); tprintf("blink"); cup( 8,40); c_sgr("25;5;1"); tprintf("bold blink"); cup(10, 6); c_sgr("22;4;5"); tprintf("underline blink"); cup(10,45); c_sgr("24;25;1;4;5"); tprintf("bold underline blink"); cup(12, 1); c_sgr("22;24;25;7"); tprintf("negative"); cup(12,40); c_sgr("1"); tprintf("bold negative"); cup(14, 6); c_sgr("22;4;7"); tprintf("underline negative"); cup(14,45); c_sgr("1;4;7"); tprintf("bold underline negative"); cup(16, 1); c_sgr("22;24;5;7"); tprintf("blink negative"); cup(16,40); c_sgr("1"); tprintf("bold blink negative"); cup(18, 6); c_sgr("22;4"); tprintf("underline blink negative"); cup(18,45); c_sgr("1"); tprintf("bold underline blink negative"); cup(20, 6); c_sgr(""); set_foreground(9); tprintf("original foreground"); cup(20,45); c_sgr(""); set_background(9); tprintf("original background"); cup(22, 1); c_sgr(";8"); tprintf("concealed"); cup(22,40); c_sgr("8;7"); tprintf("concealed negative"); /* *INDENT-ON* */ c_sgr(""); /* same as c_sgr("0") */ tprintf(" <- concealed text"); decscnm(FALSE); /* Inverse video off */ cup(max_lines - 1, 1); el(0); tprintf("Dark background. "); holdit(); decscnm(TRUE); /* Inverse video */ cup(max_lines - 1, 1); el(0); tprintf("Light background. "); holdit(); decscnm(FALSE); cup(max_lines - 1, 1); el(0); tprintf("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(); printxx("You should see only black:"); sgr("30;40"); tprintf("SGR 30 and SGR 40 don't work"); reset_all_colors(); println(":up to here"); reset_all_colors(); printxx("You should see only white:"); sgr("37;47"); tprintf("SGR 37 and SGR 47 don't work"); reset_all_colors(); println(":up to here"); reset_all_colors(); printxx("You should see text here: "); sgr("30;40"); sgr("0"); tprintf("SGR 0 reset works (explicit 0)"); println(""); reset_all_colors(); printxx("................and here: "); sgr("37;47"); sgr(""); tprintf("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", NULL }, { "Test of cursor movements", test_color_movements }, { "Test of screen features", test_color_screen }, { "Test Insert/Delete Char/Line", test_color_insdel, }, { "", NULL } }; /* *INDENT-ON* */ int save_colors = do_colors; 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 = save_colors; 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", NULL }, { 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, }, { "", NULL } }; /* *INDENT-ON* */ int save_colors = do_colors; 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 = save_colors; return MENU_NOHOLD; } vttest-20241208/replay.c0000644000000000000000000000767214724172723013472 0ustar rootroot/* * $Id: replay.c,v 1.9 2024/12/05 00:37:39 tom Exp $ */ #include static FILE *rp; static int paused; static int marker; static char *buffer; static size_t length; static unsigned lineno; void setup_replay(const char *pathname) { close_replay(); rp = fopen(pathname, "rb"); lineno = 0; } void close_replay(void) { if (rp != NULL) { fclose(rp); rp = NULL; paused = 0; marker = 0; free(buffer); buffer = NULL; length = 0; } } int is_replaying(void) { return (rp != NULL && !paused); } /* Read the "next" line, skipping data, notes, etc., to return a "Read" line */ static char * next_line(void) { char *result = NULL; if (rp != NULL) { char *buf; char *tmp; size_t now = 0; if (buffer == NULL) buffer = malloc(length = BUF_SIZE); buf = buffer; while ((tmp = fgets(buf, BUF_SIZE, rp)) != NULL) { size_t len = strlen(buf); if (len != 0) { if (buf[len - 1] == '\n') break; if ((now + BUF_SIZE) >= length) { buffer = realloc(buffer, length += BUF_SIZE); } now += len; buf = buffer + now; } else { if (buf != buffer) /* just in case the file had no final \n */ tmp = NULL; break; } } if (tmp == NULL) close_replay(); if (buffer != NULL) ++lineno; if (LOG_ENABLED && debug_level > 1) { fprintf(log_fp, "[%04u]: %s", lineno, (tmp && buffer) ? buffer : "\n"); } result = buffer; } return result; } static void skip_to_tag(const char *tag) { size_t need = strlen(tag); char *check; int skip = 0; int jump = !strcmp(tag, WAIT_STR); while ((check = next_line()) != NULL) { if (LOG_ENABLED && debug_level > 0 && strncmp(check, SKIP_STR, need)) fprintf(log_fp, SKIP_STR "%s", check); if (!jump && !strncmp(check, WAIT_STR, need)) skip = 1; if (!skip && !strncmp(check, tag, need)) break; if (!jump && !strncmp(check, DONE_STR, need)) skip = 0; } } /* * Reverse the changes made by put_string/put_char */ static char * get_string(char *source) { size_t len = strlen(source); char *temp = malloc(len + 1); if (len != 0 && source[len - 1] == '\n') source[--len] = '\0'; if (temp != NULL) { char *s, *t; for (s = source, t = temp; *s != '\0'; ++s) { if (*s == '<' && isdigit(s[1])) { long value = strtol(++s, &s, 10); if (s == NULL) break; *t++ = (char) (value & 0xff); } else if (*s != ' ') { *t++ = *s; } } *t = '\0'; strcpy(source, temp); free(temp); } return source; } /* * Returns a single character, not replayable. */ int get_char(void) { int result; pause_replay(); result = inchar(); resume_replay(); return result; } #define READ_LEN (sizeof(READ_STR) - 1) /* * Returns the string from the next "Read", trimming the newline. */ char * replay_string(void) { char *result = NULL; skip_to_tag(READ_STR); if (buffer != NULL && !strncmp(buffer, READ_STR, READ_LEN)) { result = get_string(buffer + READ_LEN); } return result; } /* * Suspend command-replay when waiting for responses from the terminal, as well * as unpredictable user-initiated mouse and key events. The command-file can * hold several records; we only care about the "Done" line which happens when * replay is resumed. */ void pause_replay(void) { if (is_replaying()) skip_to_tag(WAIT_STR); paused++; if (LOG_ENABLED) { if (paused == 1) { fprintf(log_fp, WAIT_STR "%d\n", ++marker); fflush(log_fp); } } } /* * Pausing replay caused us to stop reading the command-file. Skip any unread * lines until the "Done" line. */ void resume_replay(void) { if (rp != NULL && paused == 1) skip_to_tag(DONE_STR); if (paused > 0) { --paused; } if (LOG_ENABLED) { if (paused == 0) { fprintf(log_fp, DONE_STR "%d\n", marker); fflush(log_fp); } } } vttest-20241208/tech.set0000644000000000000000000000346003672201500013443 0ustar rootrootWorking...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-20241208/config.hin0000644000000000000000000000554314672646514014000 0ustar rootroot/* config.hin. Generated automatically from configure.in by autoheader. */ /* Define to noreturn-attribute for gcc */ #undef GCC_NORETURN /* Define to 1 if the compiler supports gcc-like printf attribute. */ #undef GCC_PRINTF /* Define to printf-attribute for gcc */ #undef GCC_PRINTFLIKE /* Define to 1 if the compiler supports gcc-like scanf attribute. */ #undef GCC_SCANF /* Define to sscanf-attribute for gcc */ #undef GCC_SCANFLIKE /* Define to unused-attribute for gcc */ #undef GCC_UNUSED /* Define if you have the `alarm' function. */ #undef HAVE_ALARM /* Define if you have the header file. */ #undef HAVE_FCNTL_H /* Define if you have the header file. */ #undef HAVE_INTTYPES_H /* Define if you have the header file. */ #undef HAVE_IOCTL_H /* Define if you have and nl_langinfo(CODESET). */ #undef HAVE_LANGINFO_CODESET /* Define if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if POSIX VDISABLE symbol should be used */ #undef HAVE_POSIX_VDISABLE /* Define if you have the `rdchk' function. */ #undef HAVE_RDCHK /* Define if you have the header file. */ #undef HAVE_SGTTY_H /* Define if you have the header file. */ #undef HAVE_STDINT_H /* Define if you have the header file. */ #undef HAVE_STDLIB_H /* Define if header is available and working */ #undef HAVE_STDNORETURN_H /* Define if you have the `strerror' function. */ #undef HAVE_STRERROR /* Define if you have the header file. */ #undef HAVE_STRINGS_H /* Define if you have the header file. */ #undef HAVE_STRING_H /* Define if you have the header file. */ #undef HAVE_SYS_FILIO_H /* Define if you have the header file. */ #undef HAVE_SYS_IOCTL_H /* Define if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define if you have the `tcgetattr' function. */ #undef HAVE_TCGETATTR /* Define if you have the header file. */ #undef HAVE_TERMIOS_H /* Define if you have the header file. */ #undef HAVE_TERMIO_H /* Define if you have the header file. */ #undef HAVE_UNISTD_H /* Define if you have the `usleep' function. */ #undef HAVE_USLEEP /* Define if you have the `vfprintf' function. */ #undef HAVE_VFPRINTF /* Define to 1 if we have locale support */ #undef LOCALE /* Define to 1 if filesystem supports mixed-case filenames. */ #undef MIXEDCASE_FILENAMES /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE /* Define if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define if C11 _Noreturn keyword is supported */ #undef STDC_NORETURN /* Define to the system name. */ #undef SYSTEM_NAME /* Define to 1 if we may use FIONREAD */ #undef USE_FIONREAD vttest-20241208/README0000644000000000000000000000601010550217245012663 0ustar rootroot$Id: README,v 1.6 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-20241208/utf8.c0000644000000000000000000000665314724173170013057 0ustar rootroot/* $Id: utf8.c,v 1.2 2024/12/05 00:40:24 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 != NULL) { 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 != NULL) { 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-20241208/ttymodes.c0000644000000000000000000001547014705276052014040 0ustar rootroot/* $Id: ttymodes.c,v 1.28 2024/10/20 21:54:50 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(); failed("Cannot disable special characters!\n"); } 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, NOTE_STR "%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, NOTE_STR "%s (%d):\n", tag, flag); # if USE_POSIX_TERMIOS || USE_TERMIO tcgetattr(0, &tmp_modes); fprintf(log_fp, NOTE_STR " iflag %08o\n", tmp_modes.c_iflag); fprintf(log_fp, NOTE_STR " oflag %08o\n", tmp_modes.c_oflag); fprintf(log_fp, NOTE_STR " lflag %08o\n", tmp_modes.c_lflag); if (!(tmp_modes.c_lflag & ICANON)) { fprintf(log_fp, NOTE_STR " %d:min =%d\n", VMIN, tmp_modes.c_cc[VMIN]); fprintf(log_fp, NOTE_STR " %d:time =%d\n", VTIME, tmp_modes.c_cc[VTIME]); } # else gtty(0, &tmp_modes); fprintf(log_fp, NOTE_STR " flags %08o\n", tmp_modes.sg_flags); # endif } #endif } #endif void close_tty(void) { restore_ttymodes(); } void init_ttymodes(int pn) { dump_ttymodes("init_ttymodes", pn); #ifdef UNIX if (pn == 0) { int speed_code, n; 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); if (open("/dev/tty", O_RDWR | O_NDELAY) != 2) { restore_ttymodes(); failed("Cannot initialize tty modes!\n"); } # 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; # 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-20241208/CHANGES0000644000000000000000000007201714725375322013021 0ustar rootroot-- $Id: CHANGES,v 1.321 2024/12/08 20:00:18 tom Exp $ ------------------------------------------------------------------------------- 20241208 + modify sixel.c to show all of the font glyphs, for context, and also add a menu entry to quickly display the bitmap for each. + bracket keyboard-tests in keyboard.c with command-replay pause/resume. + bracket mouse-tests in tek4014.c with command-replay pause/resume. + amend change to VT52 cursor-addressing per DEC 070 (mintty #1299). 20241204 + add tests for XTTITLEPOS, XTSMTITLE and XTRMTITLE from xterm #396. + pause/resume replay while checking the 7-bit/8-bit/C2 toggle. + improve lint options in configure script 20241124 + correct check for end-of-options (cf: 20241010) + check after toggling 7-bit/8-bit/C2 parser, revert if the terminal does not appear to support the mode. + modify vt52 test to check behavior of out-of-bounds row-addressing 20241031 + add null-pointer check in window-modify tests when logging is not enabled (report/patch by Mark Peek). 20241024 + improve replay logic for skipping consecutive wait/done chunks as in the mouse test-screens. 20241014 + modify checks for cursor position after alternate-screen restoring the cursor position to work with command-replay. + modify send32() function to log the numeric values of non-mapped characters rather than the actual characters. + improve error-checking in test_window_opts(). + add test-screen for DECATC 20241010 + add "-c" option, which can replay the logfile, with exclusions for the places where vttest requires keyboard or mouse events. + change "-l" option to require a value, for consistency. + improve usage-message. + modify character-set tables to work with xterm #395 Russian and SCS NRCS. + add test-screen for XTVERSION 20240929 + add setting to demonstrate 7-bit parsing tables, as per ECMA-48 section 9. + check DA3 response for validity + add charset and reports table entries for VT382 + correct initialization for nl_langinfo() call (cf: 20231230). + improve configure-script handling of file pathnames + update config.guess, config.sub 20240708 + ensure stdout is flushed before getting response from DECID, fixing regression in 20231230 (report by James Holderness) 20240218 + other improvements (report by James Holderness) + modify DECAC test to include the window-frame + accept a 23/unsupported response for DSR status of UDK + improve/correct resetting of character-sets after tests: + improve use of current settings in the reset function + fix a case which tried to set a 96-character set in G0 + add a reset after SI/SO test (report by James Holderness) + update config.guess, config.sub 20231230 + modify get_reply() to wait only 0.1 seconds for a response, in case vttest is run on a terminal which is not VT100-compatible. + switch to/from ISO-2022 mode from UTF-8 if the user's locale is currently set to UTF-8. + add DECRQSS test for XTQMODKEYS + modify character set menus to filter out NRCS charsets when NRCS is not enabled. + improve DECRQSS tests for DECAC and DECATC + add DA2 code 48 for Thai VT382 + make separate VT510 DECRQSS menu to distinguish from VT520. + modify DECAUPSS/DECRQUPSS tests to exercise switching to valid combinations for VT320 and VT520, etc., to test xterm #389. + improve "-q" option, e.g., to avoid resetting the display of the response on string-terminator (cf: 20200920). > fixes/improvements (report by James Holderness) + correct code and comment for DECTEK mode (38) with DECRPM + remove redundant code for DECVSSM mode (69) + correct locator status query + add identify-locator query + correct final characters in DECSDDT, DECSDPT, DECSEST tests + correct mnemonic for VT520 alternate text color + add DECPRO test with VT320 DECRQSS + add DECSRFR test with VT520 DECRQSS + add DECUS test with VT520 DECRQSS + add keyboard status codes for VT382 + add keyboard types from VT420, VT510 and VT520 manuals + modify keyboard type parsing to report "unknown" for a zero + use VT525 DECAC to initialize that terminal to white-on-black 20230924 + modify DEC private mode table and lookup function to handle different interpretations of modes 35 and 69. + add xterm private modes 1014, 1016 to DECRQM tests + updated/improved configure macros + update config.guess, config.sub 20230201 + reduce compiler-warnings in configure-checks 20221229 + configure-script fixes: CF_XOPEN_SOURCE: amend the test for conflict between _XOPEN_SOURCE and _POSIX_C_SOURCE to allow for the former to be undefined because unneeded. CF_FCNTL_VS_IOCTL: include , for systems which may define FIONREAD there (Redhat #2151353) 20221111 + improve DECTABSR test by adding menu for changing/resetting tabs. + improve DECCIR test by adding character-set menu + replace va_out() with vfprintf() where available, fixing some recent changes which used formatting not handled in logging; improve va_out() as well, e.g., for VMS (report by James Holderness). + updated/improved configure macros + update install-sh + update config.guess, config.sub 20220827 + modify alternate-screen tests to demonstrate the effect of setting color, as well as making their use of DECALN optional. + updated/improved configure macros, i.e., for compiler-warnings + update config.guess 20220227 + improve checks for malloc failure, consolidating error-exits to use strerror. + fix several minor issues reported by coverity and clang; a couple of test results now handle zeroes in status results. 20220215 + add test-screen using cursor-addressing in the status line. + add underline and bold attributes to the test-screen for status-line. + improve logging, showing the test-strings to give better context for escape-sequences. + fix typos in keyboard.c and reports.c (patch by Kelvin Sherlock). + updated/improved configure macros, i.e., for compiler-warnings + update config.guess, config.sub 20210210 + improve test-screen for VT420 cursor movement, when left/right margins are enabled (prompted by discussion with Tom Szilagyi). + updated/improved configure macros, i.e., for shellcheck-warnings 20201225 + correct highlighting for ISO Greek, Hebrew and Latin-5. + correct highlighting for DEC Cyrillic, Greek and Hebrew. + add Latin-2 character set for VT510. + updated/improved configure macros, i.e., for compiler-warnings + update config.guess, config.sub 20200920 + add test for xterm's 1016 pixel-coordinates mouse-mode. + add "-q" option to display only the most recent part of a response, e.g., for any-event mouse tests. + remove obsolete MANIFEST, dist, dist-shar makefile targets, since those are done by external scripts. + use makefile ".PHONY" feature if available. + updated/improved configure macros, i.e., for compiler-warnings + update config.guess, config.sub 20200610 + modify DECSCA test to show whether EL/ED and ECH/ICH/DCH ignore DECSCA. + modify DECERA test to assume that the terminal uses bce, and prompt for an additional color-change/erase to demonstrate this. 20200420 + improve test-coverage for REP/SD/SL/SR/SU, exercising default params. + improve DA/DA2 reports for VT125, VT240, VT382, VT510 used in xterm. 20200303 + spelling fixes found with codespell. + correct a few other highlighting items for Turkish NRCS and DEC Supplemental Graphic NRCS. + correct highlighting for Spanish NRCS pound-sign in character-sets (report by James Holderness) + updated/improved configure macros 20191231 + updated/improved configure macros + update config.guess, config.sub 20190710 + improve alternate-screen test, with additional cursor-position check. + add extensions found in DEC standard 070 to the primary response table. + updated/improved configure macros + update config.guess, config.sub 20190105 + added/updated port-files from pkgsrc for test-builds. + updated port-files from FreeBSD for test-builds. + updated/improved configure macros CF_CC_ENV_FLAGS, CF_GNU_SOURCE, CF_POSIX_C_SOURCE, CF_XOPEN_SOURCE + update config.guess, config.sub 20181116 + improve mouse-tracking test, logging the decoded button- and modifier-information as well as fixing a special case for button 6. 20180911 + add "-V" option, for version information. + ensure logfile is flushed after each command. + demonstrate DECRQCRA with GR, checked with VT520 screenshot. + improve DECRQCRA test, demonstrating treatment of whitespace and video attributes by DEC terminals, seen in VT520 screenshots. + modify locking-shift test, changing the default GR character set to match hardware terminals more closely, e.g., setting it to Latin-1. + add/improve character-set table entries for xterm #336. + modify CNL test to demonstrate its treatment of zero as default. + revise DECRQCRA test to match VT520 screenshots from Markus Schmidt 20180811 + recent BSD-make mishandled .1.cat rule; fix 20180728 + update xterm DECRPM table 20180725 + remove obsolete message about diagonal in DECIC/DECDC test; since xterm #315 the test result is on the margin. + fix an off-by-one in right-margin for ICH/DCH test. + add tests for DECRSPS for xterm #334. + improve formatting of highlighted response-strings, fixing a problem with wrapping. 20180702 + updated test-packages to use recommended flags. + improved DECRQCRA check, updating to work with xterm #334. + add tests for xterm's extensions to DECSCUSR. + updated/improved configure macros + update config.guess, config.sub 20150706 + add configure option --with-man2html + update config.guess, config.sub 20140305 + save/restore color enable-flag for menu 11.6 in a couple of places so that the ISO-6429 tests do not reset it unexpectedly. + amend the REP test to not reset colors if it happens to be run via the menu entry for BCE-related tests. 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-20241208/tek4014.c0000644000000000000000000001644414724667776013310 0ustar rootroot/* $Id: tek4014.c,v 1.22 2024/12/06 21:43:26 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) { tprintf("%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(const 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, NOTE_STR "set point (%d,%d)\n", y, x); fputs(SEND_STR, 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) != NULL) { fprintf(log_fp, NOTE_STR "mouse %c", report[0] & 0x7f); } else { fprintf(log_fp, NOTE_STR "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]; 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..."); status[0] = '\0'; pause_replay(); do { int new_x; int new_y; 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. */ printxx("\r\n"); if ((report[0] & 0x80) != 0 && strchr("lmrLMR", report[0] & 0x7f) != NULL) { printxx("mouse %c:", report[0] & 0x7f); } else { printxx("key: %d", CharOf(report[0])); } printxx(" (%d,%d)", new_y, new_x); fflush(stdout); } while (strcmp(report, status)); tek_ALP(); resume_replay(); 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..."); status[0] = '\0'; pause_replay(); 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)); resume_replay(); 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", NULL }, { "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 }, { "", NULL } }; /* *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-20241208/vt520.c0000644000000000000000000004334314724173442013050 0ustar rootroot/* $Id: vt520.c,v 1.28 2024/12/05 00:43:14 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" }, { 5, "xterm: The cursor should be a blinking vertical bar" }, { 6, "xterm: The cursor should be a nonblinking vertical bar" }, { 2, "The cursor should be a rectangle again" } }; /******************************************************************************/ static int tst_vt520_cursor(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", NULL }, { "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 }, { "", NULL } }; /* *INDENT-ON* */ setup_vt420_cursor(PASS_ARGS); do { vt_clear(2); __(title(0), printxx("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; } /******************************************************************************/ #define A_BOLD (1 << 1) #define A_UNDERLINE (1 << 4) #define A_BLINK (1 << 5) #define A_REVERSE (1 << 7) /* * VT525 display alternate text colors */ static int tst_DECATC(MENU_ARGS) { /* *INDENT-OFF* */ static struct { int attr; } table[] = { { 0, }, { A_BOLD, }, { A_REVERSE, }, { A_UNDERLINE, }, { A_BLINK, }, { A_BOLD | A_REVERSE, }, { A_BOLD | A_UNDERLINE, }, { A_BOLD | A_BLINK, }, { A_REVERSE | A_UNDERLINE, }, { A_REVERSE | A_BLINK, }, { A_UNDERLINE | A_BLINK, }, { A_BOLD | A_REVERSE | A_UNDERLINE, }, { A_BOLD | A_REVERSE | A_BLINK, }, { A_BOLD | A_UNDERLINE | A_BLINK, }, { A_REVERSE | A_UNDERLINE | A_BLINK, }, { A_BOLD | A_REVERSE | A_UNDERLINE | A_BLINK, }, }; /* *INDENT-ON* */ size_t n; vt_move(1, 1); println(the_title); /* this test assumes that an application has used DECATC, etc., to set up * suitable colors, and simply displays what has been set up. */ for (n = 0; n < TABLESIZE(table); ++n) { char buffer[80]; vt_move((int) n + 3, 10); decstglt(1); printxx("%2d ", (int) n); if (table[n].attr & A_BOLD) sgr("1"); if (table[n].attr & A_REVERSE) sgr("7"); if (table[n].attr & A_UNDERLINE) sgr("4"); if (table[n].attr & A_BLINK) sgr("5"); printxx(" Testing "); sgr("0"); decstglt(3); *buffer = '\0'; if (table[n].attr & A_BOLD) strcat(buffer, " bold"); if (table[n].attr & A_REVERSE) strcat(buffer, " reverse"); if (table[n].attr & A_UNDERLINE) strcat(buffer, " underline"); if (table[n].attr & A_BLINK) strcat(buffer, " blink"); if (buffer[0] == 0) strcpy(buffer, " normal text"); buffer[1] = (char) toupper(CharOf(buffer[1])); printxx("%s", buffer); } vt_move(max_lines - 1, 1); 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, "-r"); } 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, "$q"); } 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_DECSRFR(MENU_ARGS) { return any_decrqss(the_title, "\"t"); } 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"); } /******************************************************************************/ static int rpt_DECATC(MENU_ARGS) { static const char *attributes[] = { "normal", "bold", "reverse", "underline", "blink", "bold reverse", "bold underline", "bold blink", "reverse underline", "reverse blink", "underline blink", "bold reverse underline", "bold reverse blink", "bold underline blink", "reverse underline blink", "bold reverse underline blink" }; int ps1; int row, col; const char *show; const char *suffix = ",}"; vt_move(1, 1); printxx("Testing DECRQSS: %s\n", the_title); set_tty_raw(TRUE); set_tty_echo(FALSE); reset_decstbm(); reset_decslrm(); row = 3; col = 10; for (ps1 = 0; ps1 < 16; ++ps1) { char func[80]; char *report; int fail = 1; int qps, qfg, qbg; sprintf(func, "%d%s", ps1, suffix); decrqss(func); report = get_reply(); vt_move(row, col); chrprint2(report, row++, col); switch (parse_decrqss(report, suffix)) { case 1: show = "ok (valid request)"; if (sscanf(report, "%d;%d;%d", &qps, &qfg, &qbg) == 3 && qps == ps1 && qfg >= 0 && qfg < 16 && qbg >= 0 && qbg < 16) { fail = 0; show = attributes[ps1]; } break; case 0: show = "invalid request"; break; default: show = SHOW_FAILURE; break; } show_result("%s", show); if (fail) break; } restore_ttymodes(); vt_move(max_lines - 1, 1); return MENU_HOLD; } static int rpt_DECAC(MENU_ARGS) { static const char *attributes[] = { "normal text", "window frame", }; int ps1; int row, col; const char *show; const char *suffix = ",|"; vt_move(1, 1); printxx("Testing DECRQSS: %s\n", the_title); set_tty_raw(TRUE); set_tty_echo(FALSE); reset_decstbm(); reset_decslrm(); row = 3; col = 10; for (ps1 = 1; ps1 <= 2; ++ps1) { char func[80]; char *report; int fail = 1; int qps, qfg, qbg; sprintf(func, "%d%s", ps1, suffix); decrqss(func); report = get_reply(); vt_move(row, col); chrprint2(report, row++, col); switch (parse_decrqss(report, suffix)) { case 1: show = "ok (valid request)"; if (sscanf(report, "%d;%d;%d", &qps, &qfg, &qbg) == 3 && qps == ps1 && qfg >= 0 && qfg < 16 && qbg >= 0 && qbg < 16) { fail = 0; show = attributes[ps1 - 1]; } break; case 0: show = "invalid request"; break; default: show = SHOW_FAILURE; break; } show_result("%s", show); if (fail) break; } restore_ttymodes(); vt_move(max_lines - 1, 1); return MENU_HOLD; } 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 rpt_DECUS(MENU_ARGS) { return any_decrqss(the_title, ",y"); } static int tst_VT510_DECRQSS(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", NULL }, { "Test VT420 features (DECRQSS)", tst_vt420_DECRQSS }, { "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 Refresh Rate Selection (DECSRFR)", rpt_DECSRFR }, { "Select Set-Up Language (DECSSL)", rpt_DECSSL }, { "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 Port Parameter (DECSPP)", rpt_DECSPP }, { "Set Scroll Speed (DECSSCLS)", rpt_DECSSCLS }, { "Set Transmit Rate Limit (DECSTRL)", rpt_DECSTRL }, { "Set Warning Bell Volume (DECSWBV)", rpt_DECSWBV }, { "", NULL } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printxx("VT510 Status-Strings Reports")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } int tst_vt520_DECRQSS(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", NULL }, { "Test VT510 features (DECRQSS)", tst_VT510_DECRQSS }, { "Alternate Text Color (DECATC)", rpt_DECATC }, { "Assign Color (DECAC)", rpt_DECAC }, { "CRT Saver Timing (DECCRTST)", rpt_DECCRTST }, { "Down Line Load Allocation (DECDLDA)", rpt_DECDLDA }, { "Energy Save Timing (DECSEST)", rpt_DECSEST }, { "Select Auto Repeat Rate (DECARR)", rpt_DECARR }, { "Select Color Lookup Table (DECSTGLT)", rpt_DECSTGLT }, { "Select Zero Symbol (DECSZS)", rpt_DECSZS }, { "Session Page Memory Allocation (DECSPMA)", rpt_DECSPMA }, { "Terminal Mode Emulation (DECTME)", rpt_DECTME }, { "Update Session (DECUS)", rpt_DECUS }, { "", NULL } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printxx("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", NULL }, { "Test VT420 features", tst_vt420_report_presentation }, { "Request Mode (DECRQM)/Report Mode (DECRPM)", tst_DECRPM }, { "Status-String Report (DECRQSS)", tst_vt520_DECRQSS }, { "", NULL } }; /* *INDENT-ON* */ int old_DECRPM = set_DECRPM(5); do { vt_clear(2); __(title(0), printxx("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", NULL }, { "Test VT420 features", tst_vt420_reports }, { "Test Presentation State Reports", tst_VT520_report_presentation }, { "Test Device Status Reports (DSR)", tst_vt420_device_status }, { "", NULL } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printxx("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", NULL }, { "Test No Clear on Column Change (DECNCSM)", tst_DECNCSM }, { "Test Set Cursor Style (DECSCUSR)", tst_DECSCUSR }, { "Test Alternate Text Color (DECATC)", tst_DECATC }, { "", NULL } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printxx("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", NULL }, { "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 }, { "", NULL } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printxx("VT520 Tests")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } vttest-20241208/MANIFEST0000644000000000000000000000763314724534252013157 0ustar rootrootMANIFEST for vttest, version t20241208 -------------------------------------------------------------------------------- MANIFEST this file 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 replay.c manage replaying of log files as a command-file 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/freebsd subdirectory package/freebsd/Makefile build-script package/freebsd/distinfo build-script package/freebsd/pkg-descr build-script package/pkgsrc subdirectory package/pkgsrc/DESCR build-script package/pkgsrc/Makefile build-script package/pkgsrc/PLIST build-script package/pkgsrc/distinfo build-script package subdirectory package/vttest.spec build-script vttest-20241208/reset.c0000644000000000000000000000351714724172723013312 0ustar rootroot/* $Id: reset.c,v 1.10 2024/12/05 00:37:39 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 printxx("The built-in confidence test "); printxx("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"); printxx("%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(""); printxx("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; parse_7bits = FALSE; return MENU_HOLD; } int tst_rst(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", NULL }, { "Reset to Initial State (RIS)", tst_RIS }, { "Invoke Terminal Test (DECTST)", tst_DECTST }, { "Soft Terminal Reset (DECSTR)", tst_DECSTR }, { "", NULL } }; /* *INDENT-ON* */ did_reset = FALSE; do { vt_clear(2); __(title(0), printxx("%s", the_title)); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } vttest-20241208/descrip.mms0000644000000000000000000000441114700624112014151 0ustar rootroot# $Id: descrip.mms,v 1.18 2024/10/07 00:16:10 tom Exp $ # VAX/VMS "mms" script for VTTEST THIS = vttest #### Start of system configuration section. #### DEFINES = /Define=(STDC_HEADERS) CFLAGS = /Listing /Include=([]) $(DEFINES) #### End of system configuration section. #### C_SRC = \ charsets.c \ color.c \ draw.c \ esc.c \ keyboard.c \ main.c \ mouse.c \ nonvt100.c \ printer.c \ replay.c \ reports.c \ reset.c \ setup.c \ sixel.c \ status.c \ tek4014.c \ ttymodes.c \ unix_io.c \ utf8.c \ vms_io.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.obj, \ color.obj, \ draw.obj, \ esc.obj, \ keyboard.obj, \ main.obj, \ mouse.obj, \ nonvt100.obj, \ printer.obj, \ replay.obj, \ reports.obj, \ reset.obj, \ setup.obj, \ sixel.obj, \ status.obj, \ tek4014.obj, \ utf8.obj, \ vms_io.obj, \ vt220.obj, \ vt320.obj, \ vt420.obj, \ vt52.obj, \ vt520.obj, \ xterm.obj SRC = patchlev.h \ CHANGES COPYING README \ $(THIS).1 \ $(C_SRC) $(H_SRC) \ config.hin install.sh mkdirs.sh makefile.in configure.in all : $(THIS).exe @ write sys$output "** produced $?" $(THIS).exe : $(OBJS), vms_link.opt $(LINK)/exec=$(THIS) main.obj, vms_link/opt vms_link.opt : @vmsbuild vms_link_opt $(THIS).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" clean : - if f$search("*.obj").nes."" then dele/nolog *.obj;* - if f$search("*.lis").nes."" then dele/nolog *.lis;* - if f$search("*.log").nes."" then dele/nolog *.log;* - if f$search("*.map").nes."" then dele/nolog *.map;* clobber : clean - if f$search("$(THIS).exe").nes."" then dele/nolog $(THIS).exe;* $(OBJS) : vttest.h vttest-20241208/ttymodes.h0000644000000000000000000000076306207036322014034 0ustar rootroot/* $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-20241208/config.sub0000755000000000000000000011544114627414553014011 0ustar rootroot#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2024 Free Software Foundation, Inc. # shellcheck disable=SC2006,SC2268,SC2162 # see below for rationale timestamp='2024-05-27' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # https://git.savannah.gnu.org/cgit/config.git/plain/config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. # The "shellcheck disable" line above the timestamp inhibits complaints # about features and limitations of the classic Bourne shell that were # superseded or lifted in POSIX. However, this script identifies a wide # variety of pre-POSIX systems that do not have POSIX shells at all, and # even some reasonably current systems (Solaris 10 as case-in-point) still # have a pre-POSIX /bin/sh. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2024 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try '$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; *local*) # First pass through any local machine types. echo "$1" exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Split fields of configuration type saved_IFS=$IFS IFS="-" read field1 field2 field3 field4 <&2 exit 1 ;; *-*-*-*) basic_machine=$field1-$field2 basic_os=$field3-$field4 ;; *-*-*) # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two # parts maybe_os=$field2-$field3 case $maybe_os in cloudabi*-eabi* \ | kfreebsd*-gnu* \ | knetbsd*-gnu* \ | kopensolaris*-gnu* \ | linux-* \ | managarm-* \ | netbsd*-eabi* \ | netbsd*-gnu* \ | nto-qnx* \ | os2-emx* \ | rtmk-nova* \ | storm-chaos* \ | uclinux-gnu* \ | uclinux-uclibc* \ | windows-* ) basic_machine=$field1 basic_os=$maybe_os ;; android-linux) basic_machine=$field1-unknown basic_os=linux-android ;; *) basic_machine=$field1-$field2 basic_os=$field3 ;; esac ;; *-*) case $field1-$field2 in # Shorthands that happen to contain a single dash convex-c[12] | convex-c3[248]) basic_machine=$field2-convex basic_os= ;; decstation-3100) basic_machine=mips-dec basic_os= ;; *-*) # Second component is usually, but not always the OS case $field2 in # Do not treat sunos as a manufacturer sun*os*) basic_machine=$field1 basic_os=$field2 ;; # Manufacturers 3100* \ | 32* \ | 3300* \ | 3600* \ | 7300* \ | acorn \ | altos* \ | apollo \ | apple \ | atari \ | att* \ | axis \ | be \ | bull \ | cbm \ | ccur \ | cisco \ | commodore \ | convergent* \ | convex* \ | cray \ | crds \ | dec* \ | delta* \ | dg \ | digital \ | dolphin \ | encore* \ | gould \ | harris \ | highlevel \ | hitachi* \ | hp \ | ibm* \ | intergraph \ | isi* \ | knuth \ | masscomp \ | microblaze* \ | mips* \ | motorola* \ | ncr* \ | news \ | next \ | ns \ | oki \ | omron* \ | pc533* \ | rebel \ | rom68k \ | rombug \ | semi \ | sequent* \ | siemens \ | sgi* \ | siemens \ | sim \ | sni \ | sony* \ | stratus \ | sun \ | sun[234]* \ | tektronix \ | tti* \ | ultra \ | unicom* \ | wec \ | winbond \ | wrs) basic_machine=$field1-$field2 basic_os= ;; zephyr*) basic_machine=$field1-unknown basic_os=$field2 ;; *) basic_machine=$field1 basic_os=$field2 ;; esac ;; esac ;; *) # Convert single-component short-hands not valid as part of # multi-component configurations. case $field1 in 386bsd) basic_machine=i386-pc basic_os=bsd ;; a29khif) basic_machine=a29k-amd basic_os=udi ;; adobe68k) basic_machine=m68010-adobe basic_os=scout ;; alliant) basic_machine=fx80-alliant basic_os= ;; altos | altos3068) basic_machine=m68k-altos basic_os= ;; am29k) basic_machine=a29k-none basic_os=bsd ;; amdahl) basic_machine=580-amdahl basic_os=sysv ;; amiga) basic_machine=m68k-unknown basic_os= ;; amigaos | amigados) basic_machine=m68k-unknown basic_os=amigaos ;; amigaunix | amix) basic_machine=m68k-unknown basic_os=sysv4 ;; apollo68) basic_machine=m68k-apollo basic_os=sysv ;; apollo68bsd) basic_machine=m68k-apollo basic_os=bsd ;; aros) basic_machine=i386-pc basic_os=aros ;; aux) basic_machine=m68k-apple basic_os=aux ;; balance) basic_machine=ns32k-sequent basic_os=dynix ;; blackfin) basic_machine=bfin-unknown basic_os=linux ;; cegcc) basic_machine=arm-unknown basic_os=cegcc ;; cray) basic_machine=j90-cray basic_os=unicos ;; crds | unos) basic_machine=m68k-crds basic_os= ;; da30) basic_machine=m68k-da30 basic_os= ;; decstation | pmax | pmin | dec3100 | decstatn) basic_machine=mips-dec basic_os= ;; delta88) basic_machine=m88k-motorola basic_os=sysv3 ;; dicos) basic_machine=i686-pc basic_os=dicos ;; djgpp) basic_machine=i586-pc basic_os=msdosdjgpp ;; ebmon29k) basic_machine=a29k-amd basic_os=ebmon ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson basic_os=ose ;; gmicro) basic_machine=tron-gmicro basic_os=sysv ;; go32) basic_machine=i386-pc basic_os=go32 ;; h8300hms) basic_machine=h8300-hitachi basic_os=hms ;; h8300xray) basic_machine=h8300-hitachi basic_os=xray ;; h8500hms) basic_machine=h8500-hitachi basic_os=hms ;; harris) basic_machine=m88k-harris basic_os=sysv3 ;; hp300 | hp300hpux) basic_machine=m68k-hp basic_os=hpux ;; hp300bsd) basic_machine=m68k-hp basic_os=bsd ;; hppaosf) basic_machine=hppa1.1-hp basic_os=osf ;; hppro) basic_machine=hppa1.1-hp basic_os=proelf ;; i386mach) basic_machine=i386-mach basic_os=mach ;; isi68 | isi) basic_machine=m68k-isi basic_os=sysv ;; m68knommu) basic_machine=m68k-unknown basic_os=linux ;; magnum | m3230) basic_machine=mips-mips basic_os=sysv ;; merlin) basic_machine=ns32k-utek basic_os=sysv ;; mingw64) basic_machine=x86_64-pc basic_os=mingw64 ;; mingw32) basic_machine=i686-pc basic_os=mingw32 ;; mingw32ce) basic_machine=arm-unknown basic_os=mingw32ce ;; monitor) basic_machine=m68k-rom68k basic_os=coff ;; morphos) basic_machine=powerpc-unknown basic_os=morphos ;; moxiebox) basic_machine=moxie-unknown basic_os=moxiebox ;; msdos) basic_machine=i386-pc basic_os=msdos ;; msys) basic_machine=i686-pc basic_os=msys ;; mvs) basic_machine=i370-ibm basic_os=mvs ;; nacl) basic_machine=le32-unknown basic_os=nacl ;; ncr3000) basic_machine=i486-ncr basic_os=sysv4 ;; netbsd386) basic_machine=i386-pc basic_os=netbsd ;; netwinder) basic_machine=armv4l-rebel basic_os=linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony basic_os=newsos ;; news1000) basic_machine=m68030-sony basic_os=newsos ;; necv70) basic_machine=v70-nec basic_os=sysv ;; nh3000) basic_machine=m68k-harris basic_os=cxux ;; nh[45]000) basic_machine=m88k-harris basic_os=cxux ;; nindy960) basic_machine=i960-intel basic_os=nindy ;; mon960) basic_machine=i960-intel basic_os=mon960 ;; nonstopux) basic_machine=mips-compaq basic_os=nonstopux ;; os400) basic_machine=powerpc-ibm basic_os=os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson basic_os=ose ;; os68k) basic_machine=m68k-none basic_os=os68k ;; paragon) basic_machine=i860-intel basic_os=osf ;; parisc) basic_machine=hppa-unknown basic_os=linux ;; psp) basic_machine=mipsallegrexel-sony basic_os=psp ;; pw32) basic_machine=i586-unknown basic_os=pw32 ;; rdos | rdos64) basic_machine=x86_64-pc basic_os=rdos ;; rdos32) basic_machine=i386-pc basic_os=rdos ;; rom68k) basic_machine=m68k-rom68k basic_os=coff ;; sa29200) basic_machine=a29k-amd basic_os=udi ;; sei) basic_machine=mips-sei basic_os=seiux ;; sequent) basic_machine=i386-sequent basic_os= ;; sps7) basic_machine=m68k-bull basic_os=sysv2 ;; st2000) basic_machine=m68k-tandem basic_os= ;; stratus) basic_machine=i860-stratus basic_os=sysv4 ;; sun2) basic_machine=m68000-sun basic_os= ;; sun2os3) basic_machine=m68000-sun basic_os=sunos3 ;; sun2os4) basic_machine=m68000-sun basic_os=sunos4 ;; sun3) basic_machine=m68k-sun basic_os= ;; sun3os3) basic_machine=m68k-sun basic_os=sunos3 ;; sun3os4) basic_machine=m68k-sun basic_os=sunos4 ;; sun4) basic_machine=sparc-sun basic_os= ;; sun4os3) basic_machine=sparc-sun basic_os=sunos3 ;; sun4os4) basic_machine=sparc-sun basic_os=sunos4 ;; sun4sol2) basic_machine=sparc-sun basic_os=solaris2 ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun basic_os= ;; sv1) basic_machine=sv1-cray basic_os=unicos ;; symmetry) basic_machine=i386-sequent basic_os=dynix ;; t3e) basic_machine=alphaev5-cray basic_os=unicos ;; t90) basic_machine=t90-cray basic_os=unicos ;; toad1) basic_machine=pdp10-xkl basic_os=tops20 ;; tpf) basic_machine=s390x-ibm basic_os=tpf ;; udi29k) basic_machine=a29k-amd basic_os=udi ;; ultra3) basic_machine=a29k-nyu basic_os=sym1 ;; v810 | necv810) basic_machine=v810-nec basic_os=none ;; vaxv) basic_machine=vax-dec basic_os=sysv ;; vms) basic_machine=vax-dec basic_os=vms ;; vsta) basic_machine=i386-pc basic_os=vsta ;; vxworks960) basic_machine=i960-wrs basic_os=vxworks ;; vxworks68) basic_machine=m68k-wrs basic_os=vxworks ;; vxworks29k) basic_machine=a29k-wrs basic_os=vxworks ;; xbox) basic_machine=i686-pc basic_os=mingw32 ;; ymp) basic_machine=ymp-cray basic_os=unicos ;; *) basic_machine=$1 basic_os= ;; esac ;; esac # Decode 1-component or ad-hoc basic machines case $basic_machine in # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) cpu=hppa1.1 vendor=winbond ;; op50n) cpu=hppa1.1 vendor=oki ;; op60c) cpu=hppa1.1 vendor=oki ;; ibm*) cpu=i370 vendor=ibm ;; orion105) cpu=clipper vendor=highlevel ;; mac | mpw | mac-mpw) cpu=m68k vendor=apple ;; pmac | pmac-mpw) cpu=powerpc vendor=apple ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) cpu=m68000 vendor=att ;; 3b*) cpu=we32k vendor=att ;; bluegene*) cpu=powerpc vendor=ibm basic_os=cnk ;; decsystem10* | dec10*) cpu=pdp10 vendor=dec basic_os=tops10 ;; decsystem20* | dec20*) cpu=pdp10 vendor=dec basic_os=tops20 ;; delta | 3300 | delta-motorola | 3300-motorola | motorola-delta | motorola-3300) cpu=m68k vendor=motorola ;; # This used to be dpx2*, but that gets the RS6000-based # DPX/20 and the x86-based DPX/2-100 wrong. See # https://oldskool.silicium.org/stations/bull_dpx20.htm # https://www.feb-patrimoine.com/english/bull_dpx2.htm # https://www.feb-patrimoine.com/english/unix_and_bull.htm dpx2 | dpx2[23]00 | dpx2[23]xx) cpu=m68k vendor=bull ;; dpx2100 | dpx21xx) cpu=i386 vendor=bull ;; dpx20) cpu=rs6000 vendor=bull ;; encore | umax | mmax) cpu=ns32k vendor=encore ;; elxsi) cpu=elxsi vendor=elxsi basic_os=${basic_os:-bsd} ;; fx2800) cpu=i860 vendor=alliant ;; genix) cpu=ns32k vendor=ns ;; h3050r* | hiux*) cpu=hppa1.1 vendor=hitachi basic_os=hiuxwe2 ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) cpu=m68000 vendor=hp ;; hp9k3[2-9][0-9]) cpu=m68k vendor=hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) cpu=hppa1.1 vendor=hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; i*86v32) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=sysv32 ;; i*86v4*) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=sysv4 ;; i*86v) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=sysv ;; i*86sol2) cpu=`echo "$1" | sed -e 's/86.*/86/'` vendor=pc basic_os=solaris2 ;; j90 | j90-cray) cpu=j90 vendor=cray basic_os=${basic_os:-unicos} ;; iris | iris4d) cpu=mips vendor=sgi case $basic_os in irix*) ;; *) basic_os=irix4 ;; esac ;; miniframe) cpu=m68000 vendor=convergent ;; *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) cpu=m68k vendor=atari basic_os=mint ;; news-3600 | risc-news) cpu=mips vendor=sony basic_os=newsos ;; next | m*-next) cpu=m68k vendor=next ;; np1) cpu=np1 vendor=gould ;; op50n-* | op60c-*) cpu=hppa1.1 vendor=oki basic_os=proelf ;; pa-hitachi) cpu=hppa1.1 vendor=hitachi basic_os=hiuxwe2 ;; pbd) cpu=sparc vendor=tti ;; pbb) cpu=m68k vendor=tti ;; pc532) cpu=ns32k vendor=pc532 ;; pn) cpu=pn vendor=gould ;; power) cpu=power vendor=ibm ;; ps2) cpu=i386 vendor=ibm ;; rm[46]00) cpu=mips vendor=siemens ;; rtpc | rtpc-*) cpu=romp vendor=ibm ;; sde) cpu=mipsisa32 vendor=sde basic_os=${basic_os:-elf} ;; simso-wrs) cpu=sparclite vendor=wrs basic_os=vxworks ;; tower | tower-32) cpu=m68k vendor=ncr ;; vpp*|vx|vx-*) cpu=f301 vendor=fujitsu ;; w65) cpu=w65 vendor=wdc ;; w89k-*) cpu=hppa1.1 vendor=winbond basic_os=proelf ;; none) cpu=none vendor=none ;; leon|leon[3-9]) cpu=sparc vendor=$basic_machine ;; leon-*|leon[3-9]-*) cpu=sparc vendor=`echo "$basic_machine" | sed 's/-.*//'` ;; *-*) saved_IFS=$IFS IFS="-" read cpu vendor <&2 exit 1 ;; esac ;; esac # Here we canonicalize certain aliases for manufacturers. case $vendor in digital*) vendor=dec ;; commodore*) vendor=cbm ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if test x"$basic_os" != x then # First recognize some ad-hoc cases, or perhaps split kernel-os, or else just # set os. obj= case $basic_os in gnu/linux*) kernel=linux os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` ;; os2-emx) kernel=os2 os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` ;; nto-qnx*) kernel=nto os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` ;; *-*) saved_IFS=$IFS IFS="-" read kernel os <&2 fi ;; *) echo "Invalid configuration '$1': OS '$os' not recognized" 1>&2 exit 1 ;; esac case $obj in aout* | coff* | elf* | pe*) ;; '') # empty is fine ;; *) echo "Invalid configuration '$1': Machine code format '$obj' not recognized" 1>&2 exit 1 ;; esac # Here we handle the constraint that a (synthetic) cpu and os are # valid only in combination with each other and nowhere else. case $cpu-$os in # The "javascript-unknown-ghcjs" triple is used by GHC; we # accept it here in order to tolerate that, but reject any # variations. javascript-ghcjs) ;; javascript-* | *-ghcjs) echo "Invalid configuration '$1': cpu '$cpu' is not valid with os '$os$obj'" 1>&2 exit 1 ;; esac # As a final step for OS-related things, validate the OS-kernel combination # (given a valid OS), if there is a kernel. case $kernel-$os-$obj in linux-gnu*- | linux-android*- | linux-dietlibc*- | linux-llvm*- \ | linux-mlibc*- | linux-musl*- | linux-newlib*- \ | linux-relibc*- | linux-uclibc*- | linux-ohos*- ) ;; uclinux-uclibc*- | uclinux-gnu*- ) ;; managarm-mlibc*- | managarm-kernel*- ) ;; windows*-msvc*-) ;; -dietlibc*- | -llvm*- | -mlibc*- | -musl*- | -newlib*- | -relibc*- \ | -uclibc*- ) # These are just libc implementations, not actual OSes, and thus # require a kernel. echo "Invalid configuration '$1': libc '$os' needs explicit kernel." 1>&2 exit 1 ;; -kernel*- ) echo "Invalid configuration '$1': '$os' needs explicit kernel." 1>&2 exit 1 ;; *-kernel*- ) echo "Invalid configuration '$1': '$kernel' does not support '$os'." 1>&2 exit 1 ;; *-msvc*- ) echo "Invalid configuration '$1': '$os' needs 'windows'." 1>&2 exit 1 ;; kfreebsd*-gnu*- | knetbsd*-gnu*- | netbsd*-gnu*- | kopensolaris*-gnu*-) ;; vxworks-simlinux- | vxworks-simwindows- | vxworks-spe-) ;; nto-qnx*-) ;; os2-emx-) ;; rtmk-nova-) ;; *-eabi*- | *-gnueabi*-) ;; none--*) # None (no kernel, i.e. freestanding / bare metal), # can be paired with an machine code file format ;; -*-) # Blank kernel with real OS is always fine. ;; --*) # Blank kernel and OS with real machine code file format is always fine. ;; *-*-*) echo "Invalid configuration '$1': Kernel '$kernel' not known to work with OS '$os'." 1>&2 exit 1 ;; esac # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. case $vendor in unknown) case $cpu-$os in *-riscix*) vendor=acorn ;; *-sunos* | *-solaris*) vendor=sun ;; *-cnk* | *-aix*) vendor=ibm ;; *-beos*) vendor=be ;; *-hpux*) vendor=hp ;; *-mpeix*) vendor=hp ;; *-hiux*) vendor=hitachi ;; *-unos*) vendor=crds ;; *-dgux*) vendor=dg ;; *-luna*) vendor=omron ;; *-genix*) vendor=ns ;; *-clix*) vendor=intergraph ;; *-mvs* | *-opened*) vendor=ibm ;; *-os400*) vendor=ibm ;; s390-* | s390x-*) vendor=ibm ;; *-ptx*) vendor=sequent ;; *-tpf*) vendor=ibm ;; *-vxsim* | *-vxworks* | *-windiss*) vendor=wrs ;; *-aux*) vendor=apple ;; *-hms*) vendor=hitachi ;; *-mpw* | *-macos*) vendor=apple ;; *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) vendor=atari ;; *-vos*) vendor=stratus ;; esac ;; esac echo "$cpu-$vendor${kernel:+-$kernel}${os:+-$os}${obj:+-$obj}" exit # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: vttest-20241208/install-sh0000755000000000000000000003577613761220263014035 0ustar rootroot#!/bin/sh # install - install a program, script, or datafile scriptversion=2020-11-14.01; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. tab=' ' nl=' ' IFS=" $tab$nl" # Set DOITPROG to "echo" to test this script. doit=${DOITPROG-} doit_exec=${doit:-exec} # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_mkdir= # Desired mode of installed file. mode=0755 # Create dirs (including intermediate dirs) using mode 755. # This is like GNU 'install' as of coreutils 8.32 (2020). mkdir_umask=22 backupsuffix= chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false is_target_a_directory=possibly usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -p pass -p to $cpprog. -s $stripprog installed files. -S SUFFIX attempt to back up existing files, with suffix SUFFIX. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG By default, rm is invoked with -f; when overridden with RMPROG, it's up to you to specify -f if you want it. If -S is not specified, no backups are attempted. Email bug reports to bug-automake@gnu.org. Automake home page: https://www.gnu.org/software/automake/ " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -p) cpprog="$cpprog -p";; -s) stripcmd=$stripprog;; -S) backupsuffix="$2" shift;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? # Don't chown directories that already exist. if test $dstdir_status = 0; then chowncmd="" fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dstbase=`basename "$src"` case $dst in */) dst=$dst$dstbase;; *) dst=$dst/$dstbase;; esac dstdir_status=0 else dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi fi case $dstdir in */) dstdirslash=$dstdir;; *) dstdirslash=$dstdir/;; esac obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false # The $RANDOM variable is not portable (e.g., dash). Use it # here however when possible just to lower collision chance. tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap ' ret=$? rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null exit $ret ' 0 # Because "mkdir -p" follows existing symlinks and we likely work # directly in world-writeable /tmp, make sure that the '$tmpdir' # directory is successfully created first before we actually test # 'mkdir -p'. if (umask $mkdir_umask && $mkdirprog $mkdir_mode "$tmpdir" && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. test_tmpdir="$tmpdir/a" ls_ld_tmpdir=`ls -ld "$test_tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null fi trap '' 0;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac oIFS=$IFS IFS=/ set -f set fnord $dstdir shift set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=${dstdirslash}_inst.$$_ rmtmp=${dstdirslash}_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && { test -z "$stripcmd" || { # Create $dsttmp read-write so that cp doesn't create it read-only, # which would cause strip to fail. if test -z "$doit"; then : >"$dsttmp" # No need to fork-exec 'touch'. else $doit touch "$dsttmp" fi } } && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # If $backupsuffix is set, and the file being installed # already exists, attempt a backup. Don't worry if it fails, # e.g., if mv doesn't support -f. if test -n "$backupsuffix" && test -f "$dst"; then $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null fi # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: vttest-20241208/printer.c0000644000000000000000000001132714724172723013651 0ustar rootroot/* $Id: printer.c,v 1.11 2024/12/05 00:37:39 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"); printxx("lines %d and %d, and write a test pattern there.\n", margin_lo, margin_hi); printxx("The test pattern should be %s.\n", visible ? "visible" : "invisible"); printxx("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++) { tprintf("%3d:", row); for (col = 0; col < min_cols - 5; col++) { tprintf("%c", ((row + col) % 26) + 'a'); } tprintf("\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", NULL }, { 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 }, { "", NULL } }; /* *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), printxx("Printing-Control Tests")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); if (pex_mode) { pex_mode = 0; decpex(pex_mode); } if (pff_mode) { pff_mode = 0; decpex(pff_mode); } if (assigned) { assigned = 0; mc_printer_start(assigned); } if (started) { started = 0; mc_printer_start(started); } return MENU_NOHOLD; } vttest-20241208/keyboard.c0000644000000000000000000010336714724672156014001 0ustar rootroot/* $Id: keyboard.c,v 1.48 2024/12/06 22:02:22 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; }; #define TR_BEGIN(func) \ if (LOG_ENABLED) \ fprintf(log_fp, NOTE_STR #func "(%s)\n", flag ? "hilite" : "") #define TR_ENDED(func) \ if (LOG_ENABLED) \ fprintf(log_fp, NOTE_STR "..." #func "(%s)\n", flag ? "hilite" : "") static int same_CTLKEY(const char *response, const CTLKEY *code); static int find_cursor_key(const 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(const 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(const 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(const 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, const CTLKEY *code) { switch (code->prefix) { case CSI: if ((response = skip_csi_2(response)) == NULL) return FALSE; break; case SS3: if ((response = skip_ss3_2(response)) == NULL) 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, const char *scs_params, int hilite) { int special = ((scs_params != NULL) && (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); tprintf("%s", keytab[i].symbol); if (special) scs(0, 'B'); if (hilite) vt_hilite(FALSE); } static void show_cursor_keys(int flag) { int i; TR_BEGIN(show_cursor_keys); 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); tprintf("%s", curkeytab[i].curkeysymbol); if (flag) vt_hilite(FALSE); } TR_ENDED(show_cursor_keys); } static void show_editing_keypad(int flag) { if (terminal_id() >= 200) { int i; TR_BEGIN(show_editing_keypad); 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); tprintf("%s", edt_keypadtab[i].fnkeysymbol); if (flag) vt_hilite(FALSE); } TR_ENDED(show_editing_keypad); } } static void show_function_keys(int flag) { if (terminal_id() >= 200) { int i; TR_BEGIN(show_function_keys); 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); tprintf("%s", fnkeytab[i].fnkeysymbol); if (flag) vt_hilite(FALSE); } TR_ENDED(show_function_keys); } } static void show_keyboard(int flag GCC_UNUSED, const char *scs_params) { int i; if (LOG_ENABLED) fprintf(log_fp, NOTE_STR "show_keyboard()\n"); 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); } if (LOG_ENABLED) fprintf(log_fp, NOTE_STR "...show_keyboard()\n"); } static void show_numeric_keypad(int flag) { int i; TR_BEGIN(show_numeric_keypad); 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); tprintf("%s", num_keypadtab[i].fnkeysymbol); if (flag) vt_hilite(FALSE); } TR_ENDED(show_numeric_keypad); } /******************************************************************************/ static int tst_AnswerBack(MENU_ARGS) { const 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 { int row, col; vt_move(row = 17, col = 1); inflush(); abmstr = get_reply(); vt_move(row, col); vt_el(0); chrprint2(abmstr, row, col); } while (strcmp(abmstr, "\r")); restore_ttymodes(); return MENU_NOHOLD; } static int tst_AutoRepeat(MENU_ARGS) { char arptstring[BUF_SIZE]; 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."); tprintf("%s", "Auto Repeat OFF: "); decarm(FALSE); /* DECARM */ inputline(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."); tprintf("%s", "Auto Repeat ON: "); decarm(TRUE); inputline(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); tprintf("%s", ckeytab[i].csymbol); vt_hilite(FALSE); } vt_move(19, 1); set_tty_crmod(TRUE); pause_replay(); 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-On)!"); println("Finish with DEL (also called DELETE or RUB OUT), or wait 1 minute."); set_tty_raw(TRUE); do { int row, col; vt_move(row = max_lines - 1, col = 1); kbdc = get_char(); if (kbdc < 0) break; vt_move(row, col); vt_el(0); if (kbdc < 32) { tprintf(" %s", ckeytab[kbdc].csymbol); if (LOG_ENABLED) fprintf(log_fp, "Key: %s\n", ckeytab[kbdc].csymbol); } else { sprintf(kbds, "%c", kbdc); chrprint2(kbds, row, col); tprintf("%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)); tprintf("%s", ckeytab[kbdc].csymbol); } } } while (kbdc != '\177'); resume_replay(); restore_ttymodes(); vt_move(max_lines, 1); okflag = 1; for (i = 0; i < 32; i++) if (ckeytab[i].ccount < 2) okflag = 0; if (okflag) printxx("%s", "OK. "); else printxx("%s", "You have not been able to send all CTRL keys! "); return MENU_HOLD; } static int tst_CursorKeys(MENU_ARGS) { int i; int ckeymode; int row, col; const 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); tprintf("<%s>%20s", curkeymodes[ckeymode], ""); vt_move(max_lines - 2, 1); vt_el(0); vt_move(max_lines - 2, 1); printxx("%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(row = max_lines - 1, col = 1); vt_el(0); vt_move(row, col); chrprint2(curkeystr, row, col); 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); tprintf("%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; int row, col; const 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) { printxx("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); tprintf("<%s>%20s", fnkeymodes[fkeymode], ""); vt_move(max_lines - 2, 1); vt_el(0); vt_move(max_lines - 2, 1); printxx("%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(row = max_lines - 1, col = 1); vt_el(0); vt_move(row, col); chrprint2(fnkeystr, row, col); 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); tprintf("%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; int row, col; const 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) { printxx("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); tprintf("<%s>%20s", fnkeymodes[fkeymode], ""); vt_move(max_lines - 2, 1); vt_el(0); vt_move(max_lines - 2, 1); printxx("%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(row = max_lines - 1, col = 1); vt_el(0); vt_move(row, col); chrprint2(fnkeystr, row, col); 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); tprintf("%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; int row, col; const 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); tprintf("<%s>%20s", fnkeymodes[fkeymode], ""); vt_move(max_lines - 2, 1); vt_el(0); vt_move(max_lines - 2, 1); printxx("%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(row = max_lines - 1, col = 1); vt_el(0); vt_move(row, col); chrprint2(fnkeystr, row, col); 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); tprintf("%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 */ { "", NULL } }; /* *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); printxx("%s", ledmsg[i]); decll("0"); decll(ledseq[i]); vt_move(12, 1); holdit(); } decll("0"); return MENU_NOHOLD; } /******************************************************************************/ int tst_keyboard_layout(const 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(); printxx("Press each key, both shifted and unshifted. Finish with RETURN:"); do { /* while (kbdc != 13) */ int row, col; vt_move(row = max_lines - 1, col = 1); kbdc = get_char(); vt_move(row, col); vt_el(0); if (scs_params != NULL && kbdc > ' ' && kbdc < '\177') { vt_hilite(TRUE); esc(scs_params); tprintf(" %c ", kbdc); scs(0, 'B'); tprintf("= %d ", kbdc); scs(0, 'B'); vt_hilite(FALSE); } else { sprintf(kbds, "%c", kbdc); chrprint2(kbds, row, col); } 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", NULL }, { "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 }, { "", NULL } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printxx("Keyboard Tests")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } vttest-20241208/vt420.c0000644000000000000000000020264414724173442013050 0ustar rootroot/* $Id: vt420.c,v 1.236 2024/12/05 00:43:14 tom Exp $ */ /* * Reference: Installing and Using the VT420 Video Terminal (North American * Model (EK-VT420-UG.002) */ #include #include #include #include typedef enum { marNone = -1, marReset = 0, marFirst = 1, marLast = 2, marMiddle = 3, marEnd } MARS; typedef enum { /* VT525 specific */ chkFOREGROUND = 0x1, chkBACKGROUND = 0x2, /* these are not visually distinct, not useful for testing */ chkPROTECTED = 0x4, /* DECSCA */ chkINVISIBLE = 0x8, /* SGR 8 */ /* these are visually distinct, used in the test */ chkUNDERLINE = 0x10, /* SGR 4 */ chkINVERSE = 0x20, /* SGR 7 */ chkBLINK = 0x40, /* SGR 5 */ chkBOLD = 0x80 /* SGR 1 */ } CHKS; int origin_mode = FALSE; char txt_override_color[80]; static int do_lines = FALSE; static int use_colors = FALSE; /******************************************************************************/ void reset_colors(void) { if (use_colors) { sgr("0"); use_colors = FALSE; if (LOG_ENABLED) { fprintf(log_fp, NOTE_STR "turned off colors\n"); } } } void set_colors(const char *value) { if (do_colors) { if (value == NULL) value = "0"; sgr(value); use_colors = strcmp(value, "0"); if (LOG_ENABLED) { fprintf(log_fp, NOTE_STR "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 != NULL) { printxx("%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_STR "filling outside margins with '%c'\n", ch); } if (!do_colors) 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) { if (do_colors) { int y, x; 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(const 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) { const char *report; char last[BUF_SIZE]; last[0] = '\0'; vt_move(row++, 1); println("When you are done, press any key twice to quit."); vt_move(row, col); fflush(stdout); pause_replay(); while (strcmp(report = instr(), last)) { vt_move(row, col); vt_clear(0); chrprint2(report, row, col); strncpy(last, report, sizeof(last) - 2)[sizeof(last) - 2] = '\0'; } resume_replay(); } static void show_MultisessionStatus(const char *report) { int pos = 0; int Ps1 = scan_any(report, &pos, 'n'); int Ps2 = scanto(report, &pos, 'n'); switch (Ps1) { case 80: show_result("SSU sessions enabled (%d max)", Ps2); break; case 81: show_result("SSU sessions available but pending (%d max)", Ps2); break; case 83: show_result("SSU sessions not ready"); break; case 87: show_result("Sessions on separate lines"); break; default: show_result(SHOW_FAILURE); } } /******************************************************************************/ /* * 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(); } printxx("%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"); printxx("should be numbered 1 through %d.\n", final); return MENU_HOLD; } static int tst_DECBKM(MENU_ARGS) { int row, col; const 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(row = 3, col = 10); report = instr(); chrprint2(report, row, col); 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(row = 6, col = 10); report = instr(); chrprint2(report, row, col); 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; } #define fmt_DECCKSR "Testing DECCKSR: %s" static int parse_DECCKSR(char *report, int Pid, int *digits, int *checksum) { int result = 0; int pos = 0; int actual; const char *after; const char *before; if ((report = skip_dcs(report)) != NULL && strip_terminator(report) && strlen(report) > 1 && scanto(report, &pos, '!') == Pid && report[pos++] == '~' && (after = skip_xdigits((before = report + pos), &actual)) != NULL && *after == '\0') { result = 1; *digits = (int) (after - before); *checksum = actual; } return result; } static char * check_DECCKSR(char *target, char *source, int Pid, int expected) { int digits; int actual; if (parse_DECCKSR(source, Pid, &digits, &actual)) { if (digits != 4) { sprintf(target, "%s: expected 4 digits", SHOW_FAILURE); } else if (expected < 0 || (actual == expected)) { strcpy(target, SHOW_SUCCESS); } else { sprintf(target, "expected %04X", (expected & 0xffff)); } } else { strcpy(target, SHOW_FAILURE); } return target; } static int tst_DECCKSR(MENU_ARGS, int Pid, const char *the_csi, int expected) { char *report; int row, col; char temp[80]; vt_move(1, 1); printxx(fmt_DECCKSR, the_title); set_tty_raw(TRUE); set_tty_echo(FALSE); do_csi("%s", the_csi); report = get_reply(); vt_move(row = 3, col = 10); chrprint2(report, row, col); show_result("%s", check_DECCKSR(temp, report, Pid, expected)); 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), print_chr(mark)); if (top > 1 || (lrmm_flag && lft > 1)) { __(cup(1, 1), decdc(1)); /* outside margins, should be ignored */ __(cup(row, col), print_chr(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); tprintf("If your terminal supports DECDC, letters %c-%c are on column %d\n", mark_1st, mark_2nd, real_col); return MENU_HOLD; } static void show_DECERA(MENU_ARGS, const char *color_name, const char *color_value) { int last = max_lines - 3; BOX box; setup_rectangle(&box, last); fill_screen(); test_with_margins(1); set_colors(color_value); 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); tprintf("There should be a%s rectangle cleared in the middle of the %s.\r\n", color_name, origin_mode ? "margins" : "screen"); } /* * VT400 & up * Erase Rectangular area */ static int tst_DECERA(MENU_ARGS) { if (do_colors) { show_DECERA(PASS_ARGS, " blue", WHITE_ON_BLUE); holdit(); show_DECERA(PASS_ARGS, " green", WHITE_ON_GREEN); } else { show_DECERA(PASS_ARGS, "", WHITE_ON_BLUE); } 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(NULL); special_prompt(hold_row, hold_col, NULL); set_colors(WHITE_ON_GREEN); cup(bot, (lft + rgt) / 2); for (row = top; row < bot; ++row) { slowly(); ind(); } set_colors(NULL); special_prompt(hold_row, hold_col, "\"abcd...\" should be at top. "); fill_margins(); fill_outside('.'); set_colors(NULL); special_prompt(hold_row, hold_col, NULL); set_colors(WHITE_ON_GREEN); cup(top, (lft + rgt) / 2); for (row = top; row < bot; ++row) { slowly(); ri(); } set_colors(NULL); 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(NULL); special_prompt(hold_row, hold_col, NULL); /* * 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(NULL); special_prompt(hold_row, hold_col, "\"0123...\" should be at bottom. "); fill_margins(); fill_outside('.'); set_colors(NULL); special_prompt(hold_row, hold_col, NULL); 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(NULL); 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) { mark_2nd = (char) mark; if (mark_1st == 0) { mark_1st = (char) mark; } } slowly(); __(cup(row, col), print_chr(mark)); if (col < rgt) { cup(row, lft); print_chr('?'); cup(row, lft); ich(rgt - col); } } } 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), print_chr(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) { tprintf("*%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); tprintf("%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"); printxx("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 = get_left_margin(); 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 - get_left_margin()); } 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) { mark_2nd = (char) mark; if (mark_1st == 0) { mark_1st = (char) mark; } } slowly(); __(cup(row, col), print_chr(mark)); if (!origin_mode && (top > 1 || (lrmm_flag && lft > 1))) { __(cup(1, 1), decic(1)); /* outside margins, should be ignored */ __(cup(row, col), print_chr(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); tprintf("If your terminal supports DECIC, letters %c-%c are on column %d\n", mark_1st, mark_2nd, real_col); 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", NULL }, { "Test VT320 features (DECRQSS)", tst_vt320_DECRQSS }, { "Enable local functions (DECELF)", rpt_DECELF }, { "Local function key control (DECLFKC)", rpt_DECLFKC }, { "Select attribute change extent (DECSACE)", rpt_DECSACE }, { "Select modifier key reporting (DECSMKR)", rpt_DECSMKR }, { "Set left and right margins (DECSLRM)", rpt_DECSLRM }, { "Set number of lines per screen (DECSNLS)", rpt_DECSNLS }, { "", NULL } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printxx("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; } static int tst_DECSNLS(MENU_ARGS) { int rows; int row; char temp[80]; vt_move(row = 1, 1); println("Testing Select Number of Lines per Screen (DECSNLS)"); println(""); for (rows = 48; rows >= 24; rows -= 12) { set_tty_raw(TRUE); set_tty_echo(FALSE); row += 2; sprintf(temp, "%d Lines/Screen:", rows); fputs(temp, stdout); decsnls(rows); decrqss("*|"); chrprint2(get_reply(), row, (int) strlen(temp)); println(""); restore_ttymodes(); holdit(); } return MENU_NOHOLD; } #define SOH 1 #define CHK(n) ((-(n)) & 0xffff) #define to_fill(ch) (((ch) == ' ') ? SOH : (ch)) #define from_fill(ch) (((ch) == SOH) ? ' ' : (ch)) static int tst_DSR_area_sum(MENU_ARGS, int g) { char buffer[1024]; /* allocate buffer for lines */ int expected = 0; int title_sum = 0; int first = TRUE; int pid = 1; int page = 1; int i, j; int r, c; int rows = 2; /* first two rows have known content */ int ch; int full = 0; int report_len; int mask_bg = (decac_bg >= 0 && decac_bg < 16) ? decac_bg : 0; int mask_fg = (decac_fg >= 0 && decac_fg < 16) ? (decac_fg << 4) : 0; int ch_1st = g ? 160 : 32; int ch_end = g ? 254 : 126; char *report; char **lines; /* keep track of "drawn" characters */ char temp[80]; char *temp2; /* make an array of blank lines, to track text on the screen */ if ((lines = calloc((size_t) max_lines, sizeof(char *))) == NULL) no_memory(); for (r = 0; r < max_lines; ++r) { if ((lines[r] = malloc((size_t) min_cols + 1)) == NULL) no_memory(); memset(lines[r], to_fill(' '), (size_t) min_cols); lines[r][min_cols] = '\0'; } sprintf(buffer, fmt_DECCKSR, the_title); memcpy(lines[0], buffer, strlen(buffer)); for (r = 0; r < rows; ++r) { for (c = 0; c < min_cols; ++c) { ch = from_fill((unsigned char) lines[r][c]); expected += ch + mask_fg + mask_bg; if (first || (ch != ' ')) title_sum = expected; first = FALSE; } } set_tty_raw(TRUE); set_tty_echo(FALSE); vt_move(1, 1); fputs(buffer, stdout); /* compute a checksum on the title line, which contains some text */ sprintf(buffer, "%d;%d;1;1;%d;%d*y", pid, page, rows, min_cols); do_csi("%s", buffer); report = get_reply(); vt_move(r = 3, c = 10); /* like chrprint2, but shadowed into the lines[][] array */ vt_hilite(TRUE); putchar(' '); lines[r - 1][c - 1] = ' '; report_len = 1; temp2 = chrformat(report, c, 1); for (i = 0, j = 1; temp2[i] != '\0'; ++i) { if (temp2[i] == '\n') { vt_move(++r, c); j = 0; } else { putchar(temp2[i]); lines[r - 1][c - 1 + j++] = temp2[i]; ++report_len; } } free(temp2); vt_hilite(FALSE); show_result("%s", check_DECCKSR(temp, report, pid, CHK(title_sum))); lines[r - 1][c - 1 + j++] = ' '; for (i = 0; temp[i] != '\0'; ++i) { lines[r - 1][c - 1 + j++] = temp[i]; } ch = ch_1st; for (c = 4; c < min_cols - 10; c += 12) { for (r = 5; r < max_lines - 3; ++r) { char *s; vt_move(r, c); if (ch > ch_end) { sgr("1;4"); sprintf(buffer, "All"); fputs(buffer, stdout); memcpy(&lines[r - 1][c - 1], buffer, strlen(buffer)); sgr("0;1"); sprintf(buffer, ": "); fputs(buffer, stdout); memcpy(&lines[r - 1][c + 2], buffer, strlen(buffer)); sgr("0"); /* request checksum of the entire page */ do_csi("%d;%d*y", pid, page); } else { sprintf(buffer, "%c %02X ", ch, ch); fputs(buffer, stdout); memcpy(&lines[r - 1][c - 1], buffer, strlen(buffer)); /* request checksum of the given cell at (r,c) */ do_csi("%d;%d;%d;%d;%d;%d*y", pid, page, r, c, r, c); } /* FIXME - use check_DECCKSR? */ report = get_reply(); if ((s = strchr(report, '!')) != NULL && (*++s == '~') && strlen(++s) > 4) { char test[5]; if (ch > ch_end) { int row_limit = r; int y, x; for (y = 0; y < row_limit; ++y) { /* * If trimming, count through space after ":" in "All:". * Otherwise, count the whole screen. */ int col_limit = (y < (r - 1)) ? min_cols : (c + 4); for (x = 0; x < col_limit; ++x) { int yx = (unsigned char) lines[y][x]; if (yx >= ' ') { full += yx; full += mask_bg; full += mask_fg; } /* * Tidy up the logfile (for debugging, turn this off). */ if (yx == SOH + 0) lines[y][x] = ' '; } if (y == 2) { /* add attributes for highlighted report-string */ full += report_len * (chkINVERSE); } if (y == (r - 1)) { /* add attributes for "All:" */ full += 3 * (chkBOLD | chkUNDERLINE); full += 2 * (chkBOLD); } if (LOG_ENABLED) { fprintf(log_fp, NOTE_STR "check %04X %2d:%s\n", CHK(full), y + 1, lines[y]); } } sprintf(test, "%04X", CHK(full)); } else { int part = ch + mask_bg + mask_fg; sprintf(test, "%04X", CHK(part)); } if (memcmp(test, s, (size_t) 4)) { vt_hilite(TRUE); sprintf(buffer, "%.4s", s); if (LOG_ENABLED) { unsigned actual; int ok = sscanf(s, "%x", &actual); fprintf(log_fp, NOTE_STR "actual %.4s%s\n", s, ok ? "" : " (ERR)"); fprintf(log_fp, NOTE_STR "expect %.4s\n", test); } fputs(buffer, stdout); vt_hilite(FALSE); } else { sprintf(buffer, "%.4s", test); fputs(buffer, stdout); } memcpy(&lines[r - 1][c + 4], buffer, (size_t) 4); } ++ch; if (ch > ch_end + 1) break; } if (ch > ch_end) break; } restore_ttymodes(); vt_move(max_lines - 2, 1); printxx("Checksum for individual character is highlighted if mismatched."); for (r = 0; r < max_lines; r++) { free(lines[r]); } free(lines); vt_move(max_lines - 1, 1); return MENU_HOLD; } static int tst_DSR_area_sum_gl(MENU_ARGS) { return tst_DSR_area_sum(PASS_ARGS, 0); } static int tst_DSR_area_sum_gr(MENU_ARGS) { switch (get_level()) { case 0: case 1: break; case 2: esc(")A"); /* select the 94-character NRCS, closest to MCS */ break; default: esc("-A"); /* select the 96-character set */ break; } esc("~"); return tst_DSR_area_sum(PASS_ARGS, 1); } static int tst_DSR_data_ok(MENU_ARGS) { return any_DSR(PASS_ARGS, "?75n", show_DataIntegrity); } static int tst_DSR_macrospace(MENU_ARGS) { int row, col; char *report; const char *show; vt_move(1, 1); printxx("Testing DECMSR: %s\n", the_title); set_tty_raw(TRUE); set_tty_echo(FALSE); do_csi("?62n"); report = get_reply(); vt_move(row = 3, col = 10); chrprint2(report, row, col); if ((report = skip_csi(report)) != NULL && (report = skip_digits(report)) != NULL && !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", -1); } 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; pause_replay(); while ((newc = inchar()) != oldc && newc > 0) oldc = newc; resume_replay(); 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; pause_replay(); while ((newc = inchar()) != oldc && newc > 0) oldc = newc; resume_replay(); 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", NULL }, { "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 }, { "", NULL } }; /* *INDENT-ON* */ setup_vt420_cursor(PASS_ARGS); do { vt_clear(2); __(title(0), printxx("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", NULL }, { 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 }, { "", NULL } }; /* *INDENT-ON* */ setup_vt420_cursor(PASS_ARGS); do { vt_clear(2); __(title(0), printxx("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", NULL }, { "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 */ { "", NULL } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printxx("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", NULL }, { 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 }, { "", NULL } }; /* *INDENT-ON* */ setup_vt420_cursor(PASS_ARGS); do { vt_clear(2); __(title(0), printxx("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", NULL }, { "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 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): GL", tst_DSR_area_sum_gl }, { "Test Checksum of Rectangular Area (DECRQCRA): GR", tst_DSR_area_sum_gr }, { "Test Extended Cursor-Position (DECXCPR)", tst_DSR_cursor }, { "", NULL } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printxx("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", NULL }, { "Test VT320 features", tst_vt320_report_presentation }, { "Request Mode (DECRQM)/Report Mode (DECRPM)", tst_DECRPM }, { "Status-String Report (DECRQSS)", tst_vt420_DECRQSS }, { "", NULL } }; /* *INDENT-ON* */ int old_DECRPM = set_DECRPM(4); do { vt_clear(2); __(title(0), printxx("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", NULL }, { "Test VT320 features", tst_vt320_reports }, { "Test Presentation State Reports", tst_vt420_report_presentation }, { "Test Device Status Reports (DSR)", tst_vt420_device_status }, { "", NULL } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printxx("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", NULL }, { "Test VT320 features", tst_vt320_screen }, { "Test Select Number of Lines per Screen (DECSNLS)", tst_DECSNLS }, { "", NULL } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printxx("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", NULL }, { "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 }, { "", NULL } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printxx("VT420 Tests")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } vttest-20241208/main.c0000644000000000000000000014702014724172723013112 0ustar rootroot/* $Id: main.c,v 1.155 2024/12/05 00:37:39 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 #ifdef LOCALE #include #endif #ifdef HAVE_LANGINFO_CODESET #include #endif /* *INDENT-EQLS* */ FILE *log_fp = NULL; int allows_utf8 = FALSE; int assume_utf8 = FALSE; int brkrd = FALSE; int debug_level = 0; int decac_bg = -1; int decac_fg = -1; int input_8bits = FALSE; int log_disabled = FALSE; int max_cols = 132; int max_lines = 24; int min_cols = 80; int output_8bits = FALSE; int parse_7bits = FALSE; int quick_reply = FALSE; int reading = FALSE; int slow_motion = FALSE; int tty_speed = DEFAULT_SPEED; /* nominal speed, for padding */ int use_decac = FALSE; int use_padding = FALSE; jmp_buf intrenv; static char *program; static char empty[1]; static char *current_menu = empty; GCC_NORETURN void failed(const char *msg) { #ifdef HAVE_STRERROR const char *why = strerror(errno); fprintf(stderr, "%s: %s: %s\n", program, msg, why ? why : "?"); #elif defined(HAVE_SYS_NERR) && defined(HAVE_SYS_ERRLIST) const char *why = (errno > 0 && errno < sys_nerr) ? sys_errlist[errno] : "?"; fprintf(stderr, "%s: %s: %s\n", program, msg, why ? why : "?"); #else perror(msg); #endif exit(EXIT_FAILURE); } GCC_NORETURN void no_memory(void) { failed("no memory"); } static void usage(void) { static const char *msg[] = { "Usage: vttest [options] [24x80.132]" ,"" ,"Options:" ," -V print the program version, and exit" ," -8 use 8-bit controls" ," -d debug (repeat for more detail)" ," -c cmdfile read commands from file" ," -f fontfile load DRCS data from file" ," -l logfile log test results to vttest.log" ," -p use padding" ," -q filter replies to show only the most recent" ," -s add time delay for scrolling" ," -u allow some tests to use UTF-8" }; size_t n; for (n = 0; n < TABLESIZE(msg); ++n) fprintf(stderr, "%s\n", msg[n]); exit(EXIT_FAILURE); } static int version(void) { printxx("VT100 test program, version %d.%d", RELEASE, PATCHLEVEL); #ifdef PATCH_DATE if (PATCH_DATE) printxx(" (%d)", PATCH_DATE); #endif return 1; /* used for indenting */ } int main(int argc, char *argv[]) { /* *INDENT-OFF* */ static MENU mainmenu[] = { { "Exit", NULL }, { "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 }, { "", NULL } }; /* *INDENT-ON* */ char *opt_command = NULL; char *opt_softchr = NULL; char *opt_logging = NULL; program = strrchr(argv[0], '/'); if (program != NULL) ++program; else program = argv[0]; #define OPT_ARG(value) \ do { \ if (!*++opt) { \ if (--argc < 1) \ usage(); \ value = *++argv; \ } \ opt = "?"; \ } while (0) while (argc-- > 1) { const char *opt = *++argv; if (*opt == '-') { while (*++opt != '\0') { switch (*opt) { case 'V': version(); putchar('\n'); exit(EXIT_SUCCESS); case 'c': OPT_ARG(opt_command); break; case 'd': debug_level++; break; case 'f': OPT_ARG(opt_softchr); break; case 'l': OPT_ARG(opt_logging); break; case 'p': use_padding = TRUE; break; case 'q': quick_reply = TRUE; break; case 's': slow_motion = TRUE; break; case 'u': allows_utf8 = 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; for (n = 0; n < 3; n++) { int m; 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(); } } } /* do this first, to capture results from other options */ if (opt_logging) enable_logging(opt_logging); if (opt_command) setup_replay(opt_command); if (opt_softchr) setup_softchars(opt_softchr); #ifdef UNIX initterminal(setjmp(intrenv)); signal(SIGINT, onbrk); signal(SIGTERM, onterm); reading = FALSE; #else initterminal(0); #endif do { vt_clear(2); __(title(0), version()); title(1); if (max_lines != 24 || min_cols != 80 || max_cols != 132) printxx("Screen size %dx%d (%d max) ", max_lines, min_cols, max_cols); if (tty_speed != DEFAULT_SPEED) printxx("Line speed %dbd ", tty_speed); if (use_padding) printxx(" (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; 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 hlfxtra; 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, NOTE_STR "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); tprintf("*"); hvp(1, col); tprintf("*"); } cup(2, 2); for (row = 2; row <= max_lines - 1; row++) { tprintf("+"); cub(1); ind(); } cup(max_lines - 1, width - 1); for (row = max_lines - 1; row >= 2; row--) { tprintf("+"); cub(1); ri(); } cup(2, 1); for (row = 2; row <= max_lines - 1; row++) { tprintf("*"); cup(row, width); tprintf("*"); cub(10); if (row < 10) nel(); else tprintf("\n"); } cup(2, 10); cub(42 + hlfxtra); cuf(2); for (col = 3; col <= width - 2; col++) { tprintf("+"); 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--) { tprintf("+"); cub(1); cuf(1); cub(0); tprintf("%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++) tprintf(" "); cud(1); cub(58); } cuu(5); cuf(1); printxx("The screen should be cleared, and have an unbroken bor-"); cup(12, inner_l + 3); printxx("der of *'s and +'s around the edge, and exactly in the"); cup(13, inner_l + 3); printxx("middle there should be a frame of E's around this text"); cup(14, inner_l + 3); printxx("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, NOTE_STR "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), tprintf("%c", on_left[i])); __(cup(region + 1, width), tprintf("%c", on_right[i])); tprintf("\n"); break; case 1: /* simple wrapping */ __(cup(region, width), tprintf("%c%c", on_right[i - 1], on_left[i])); /* backspace at right margin */ __(cup(region + 1, width), tprintf("%c%c %c", on_left[i], BS, on_right[i])); tprintf("\n"); break; case 2: /* tab to right margin */ __(cup(region + 1, width), tprintf("%c%c%c%c%c%c", on_left[i], BS, BS, TAB, TAB, on_right[i])); __(cup(region + 1, 2), tprintf("%c%c\n", BS, on_left[i])); break; default: /* newline at right margin */ __(cup(region + 1, width), tprintf("\n")); __(cup(region, 1), tprintf("%c", on_left[i])); __(cup(region, width), tprintf("%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, NOTE_STR "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++) { tprintf("%c", '@' + i); do_csi("2%cC", BS); /* Two forward, one backspace */ } println(""); /* Now put CR in CUF sequence. */ tprintf("A "); for (i = 2; i < 10; i++) { cprintf("%s%c%dC", csi_output(), CR, 2 * i - 2); tprintf("%c", '@' + i); } println(""); /* Now put VT in CUU sequence. */ rm("20"); for (i = 1; i < 10; i++) { tprintf("%c ", '@' + i); do_csi("1\013A"); } println(""); println(""); holdit(); if (LOG_ENABLED) fprintf(log_fp, NOTE_STR "tst_movements leading zeros in ESC sequences\n"); vt_clear(2); vt_move(1, 1); println("Test of leading zeros in ESC sequences."); printxx("Two lines below you should see the sentence \"%s\".", ctext); for (col = 1; *ctext; col++) { cprintf("%s00000000004;00000000%dH", csi_output(), col); tprintf("%c", *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++) { printxx("%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++) tprintf("*"); decawm(FALSE); /* DECAWM: Wrap Around OFF */ cup(3, 1); for (col = 1; col <= min_cols * 2; col++) tprintf("*"); 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) tprintf("%c*", TAB); cup(2, 2); for (col = 2; col <= min_cols - 2; col += 6) tprintf(" *"); cup(4, 1); println("Test of TAB setting/resetting. These two lines"); printxx("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) tprintf("%.*s", (max_cols > col) ? (max_cols - col) : 10, "1234567890"); for (row = 3; row <= 20; row++) { cup(row, row); tprintf("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) tprintf("%.*s", (min_cols > col) ? (min_cols - col) : 10, "1234567890"); for (row = 3; row <= 20; row++) { cup(row, row); tprintf("This is %d column mode, %s background.", min_cols, background ? "dark" : "light"); } holdit(); } do_scrolling(); ed(2); decstbm(max_lines - 1, max_lines); printxx( "\nOrigin mode test. This line should be at the bottom of the screen."); cup(1, 1); tprintf("%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); tprintf( "Origin mode test. This line should be at the bottom of the screen."); cup(1, 1); tprintf("%s", "This line should be at the top of the screen. "); holdit(); decstbm(1, max_lines); ed(2); /* *INDENT-OFF* */ cup( 1,20); tprintf("Graphic rendition test pattern:"); cup( 4, 1); sgr("0"); tprintf("vanilla"); cup( 4,40); sgr("0;1"); tprintf("bold"); cup( 6, 6); sgr(";4"); tprintf("underline"); cup( 6,45);sgr(";1");sgr("4");tprintf("bold underline"); cup( 8, 1); sgr("0;5"); tprintf("blink"); cup( 8,40); sgr("0;5;1"); tprintf("bold blink"); cup(10, 6); sgr("0;4;5"); tprintf("underline blink"); cup(10,45); sgr("0;1;4;5"); tprintf("bold underline blink"); cup(12, 1); sgr("1;4;5;0;7"); tprintf("negative"); cup(12,40); sgr("0;1;7"); tprintf("bold negative"); cup(14, 6); sgr("0;4;7"); tprintf("underline negative"); cup(14,45); sgr("0;1;4;7"); tprintf("bold underline negative"); cup(16, 1); sgr("1;4;;5;7"); tprintf("blink negative"); cup(16,40); sgr("0;1;5;7"); tprintf("bold blink negative"); cup(18, 6); sgr("0;4;5;7"); tprintf("underline blink negative"); cup(18,45); sgr("0;1;4;5;7"); tprintf("bold underline blink negative"); /* *INDENT-ON* */ sgr(""); decscnm(FALSE); /* Inverse video off */ cup(max_lines - 1, 1); el(0); tprintf("Dark background. "); holdit(); decscnm(TRUE); /* Inverse video */ cup(max_lines - 1, 1); el(0); tprintf("Light background. "); holdit(); decscnm(FALSE); ed(2); /* *INDENT-OFF* */ cup(8,12); tprintf("normal"); cup(8,24); tprintf("bold"); cup(8,36); tprintf("underscored"); cup(8,48); tprintf("blinking"); cup(8,60); tprintf("reversed"); cup(10,1); tprintf("stars:"); cup(12,1); tprintf("line:"); cup(14,1); tprintf("x'es:"); cup(16,1); tprintf("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++) { tprintf("%c", tststr[cset]); } decsc(); cup(cset + 1, i + 1); sgr(""); scs_normal(); tprintf("A"); decrc(); for (j = 0; j <= 4; j++) { tprintf("%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; /* Print the test pattern in both 80 and 132 character width */ for (w = 0; w <= 1; w++) { int w1 = 13 * w; ed(2); cup(1, 1); if (w) { deccolm(TRUE); tprintf("%3d column mode", max_cols); } else { deccolm(FALSE); tprintf("%3d column mode", min_cols); } cup(5, 3 + 2 * w1); tprintf("v------- left margin"); cup(7, 3 + 2 * w1); tprintf("This is a normal-sized line"); decdhl(0); decdhl(1); decdwl(); decswl(); cup(9, 2 + w1); tprintf("This is a Double-width line"); decswl(); decdhl(0); decdhl(1); decdwl(); cup(11, 2 + w1); decdwl(); decswl(); decdhl(1); decdhl(0); tprintf("This is a Double-width-and-height line"); cup(12, 2 + w1); decdwl(); decswl(); decdhl(0); decdhl(1); tprintf("This is a Double-width-and-height line"); cup(14, 2 + w1); decdwl(); decswl(); decdhl(1); decdhl(0); el(2); tprintf("This is another such line"); cup(15, 2 + w1); decdwl(); decswl(); decdhl(0); decdhl(1); tprintf("This is another such line"); cup(17, 3 + 2 * w1); tprintf("^------- left margin"); cup(21, 1); tprintf("This is not a double-width line"); for (i = 0; i <= 1; i++) { cup(21, 6); if (i) { tprintf("**is**"); decdwl(); } else { tprintf("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); tprintf("lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk"); cup( 9,1); decdhl(1); tprintf("lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk"); cup(10,1); decdhl(0); tprintf("x%c%c%c%c%cx",9,9,9,9,9); cup(11,1); decdhl(1); tprintf("x%c%c%c%c%cx",9,9,9,9,9); cup(12,1); decdhl(0); tprintf("x%c%c%c%c%cx",9,9,9,9,9); cup(13,1); decdhl(1); tprintf("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); tprintf("x x"); cup(15,1); decdhl(1); tprintf("x x"); cup(16,1); decdhl(0); tprintf("mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj"); cup(17,1); decdhl(1); tprintf("mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj"); scs_normal(); /* *INDENT-ON* */ sgr("1;5"); cup(12, 3); tprintf("* The mad programmer strikes again * "); cup(13, 3); tprintf("%c", 9); cub(6); tprintf("* The mad programmer strikes again *"); sgr("0"); cup(max_lines - 2, 1); println("Another test pattern... a frame with blinking bold text,"); printxx("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); printxx("%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++) tprintf("%c", 'A' - 1 + row); } cup(4, 1); printxx("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); printxx("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); tprintf("B"); cub(1); sm("4"); for (col = 2; col <= sw - 1; col++) tprintf("*"); rm("4"); cup(4, 1); printxx("Test of 'Insert Mode'. The top line should be 'A*** ... ***B'. "); holdit(); ri(); el(2); cup(1, 2); dch(sw - 2); cup(4, 1); printxx("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++) tprintf("%c", 'A' - 1 + row); cup(row, sw / dblchr - row); dch(row); } cup(4, 1); println("The right column should be staggered "); printxx("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--) { tprintf("%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", NULL }, { "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 */ { "", NULL } }; /* *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++) tprintf("\n"); decsclm(TRUE); for (i = 1; i <= 10; i++) tprintf("\n"); decsclm(FALSE); for (i = 1; i <= 5; i++) tprintf("\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 */ printxx("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); printxx("Line 11 should be double-wide, line 12 should be cleared."); cup(2, 1); el(0); printxx("Then, the letters A-P should be written at the beginning"); cup(3, 1); el(0); printxx("of lines 12-%d, and the empty line and A-E are scrolled away.", max_lines); cup(4, 1); el(0); printxx("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); printxx("Here we go... "); holdit(); cup(12, 1); ri(); /* Bug comes here */ for (c = 'A'; c <= 'P'; c++) tprintf("%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); printxx("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"); printxx("If you can see this then the bug did not appear."); sgr(""); cup(4, 9); decdwl(); result = (char) get_char(); 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++) tprintf("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. */ printxx("X"); cup(4, max_cols / 2); printxx("! !"); cup(5, 1); printxx("--------------------------- The 'X' should NOT be above here -"); printxx("---+------------ 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."); printxx("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"); printxx("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++) tprintf("+"); for (row = 1; row <= max_lines; row++) { hvp(row, min_cols); tprintf("*"); } 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); printxx("This-is-a-long-line-This-is-a-long-line-"); printxx("This-is-a-long-line-This-is-a-long-line-"); cup(1, 1); printxx("This is a test of what happens to the right half of double-width"); println(" lines."); printxx("A common misfeature is that the right half does not come back"); println(" when a long"); printxx("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); printxx("This-is-a-long-line-This-is-a-long-line-"); printxx("This-is-a-long-line-This-is-a-long-line-"); printxx("This-is-a-long-line-This-is-a-long-line-"); printxx("ending-here-"); cup(1, 1); printxx("This is the same test in %d column mode.", max_cols); cup(5, 1); printxx("Now the line below should contain %d characters in single width.\n", max_cols); holdit(); cup(15, 1); decdwl(); cup(8, 1); printxx("Now the line below should contain %d characters in double width.\n", max_cols / 2); holdit(); cup(15, 1); decswl(); cup(11, 1); printxx("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++) tprintf("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++) tprintf("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(""); } static void enable_iso2022(void) { const char *env; #ifdef HAVE_LANGINFO_CODESET (void) setlocale(LC_CTYPE, ""); env = nl_langinfo(CODESET); assume_utf8 = !strcmp(env, "UTF-8"); #else #if defined(LOCALE) /* * This is preferable to using getenv() since it ensures that we are using * the locale which was actually initialized by the application. */ env = setlocale(LC_CTYPE, 0); #else if (((env = getenv("LANG")) != 0 && *env != '\0') || ((env = getenv("LC_CTYPE")) != 0 && *env != '\0') || ((env = getenv("LC_ALL")) != 0 && *env != '\0')) { ; } #endif if (env != NULL && strstr(env, ".UTF-8") != NULL) { assume_utf8 = TRUE; } #endif if (assume_utf8) { if (LOG_ENABLED) { fprintf(log_fp, NOTE_STR "%senable ISO-2022 (%s)\n", allows_utf8 ? "Do not " : "", env); } if (!allows_utf8) esc("%@"); } else { if (LOG_ENABLED) { fprintf(log_fp, NOTE_STR "UTF-8 is not enabled\n"); } } } static void disable_iso2022(void) { if (assume_utf8 && !allows_utf8) { esc("%G"); } } /* Set up my personal prejudices */ int setup_terminal(MENU_ARGS) { if (LOG_ENABLED) fprintf(log_fp, NOTE_STR "Setup Terminal with test-defaults\n"); enable_iso2022(); 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 */ disable_iso2022(); return MENU_NOHOLD; } void bye(void) { /* Force my personal prejudices upon the poor luser */ if (LOG_ENABLED) fprintf(log_fp, NOTE_STR "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); printxx("That's all, folks!\n"); printxx("\n\n\n"); inflush(); close_tty(); if (LOG_ENABLED) { fclose(log_fp); } 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; int save = *pos; 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 */ } else { result = 0; *pos = save; } return (result); } int scan_DA(const char *str, int *pos) { int value = -1; if (str[*pos] != '\0') { int save = *pos; value = scanto(str, pos, ';'); if (value == 0 && *pos == save) { value = scanto(str, pos, 'c'); if (str[*pos] != '\0') value = -1; } } return value; } int scan_any(const char *str, int *pos, int toc) { int value = 0; if (str[*pos] != '\0') { int save = *pos; value = scanto(str, pos, ';'); if (value == 0 && (save == *pos)) { *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; if ((current_menu = (char *) malloc(strlen(saved) + 10)) == NULL) no_memory(); 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) { printxx(" %d%c %s\n", number, (table[number].dispatch == not_impl) ? '*' : '.', table[number].description); } static int next_menu(const 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[BUF_SIZE]; int pagesize = max_lines - 7 - TITLE_LINE; int pagetop = 1; 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); } println(""); printxx(" Enter choice number (0 - %d): ", tablesize); for (;;) { char *s = storage; int redraw = FALSE; inputline(s); choice = 0; 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) { if (LOG_ENABLED) fprintf(log_fp, NOTE_STR "Redrawing screen\n"); break; } if (choice < 0) { if (LOG_ENABLED) fprintf(log_fp, NOTE_STR "Selecting all choices\n"); for (choice = 0; choice <= tablesize; choice++) { vt_clear(2); if (table[choice].dispatch != NULL) { const char *save = push_menu(choice); const char *name = table[choice].description; if (LOG_ENABLED) fprintf(log_fp, NOTE_STR "choice %s: %s\n", current_menu, name); if ((*table[choice].dispatch) (name) == MENU_HOLD) holdit(); pop_menu(save); } } if (LOG_ENABLED) fflush(log_fp); return 1; } else if (choice <= tablesize) { vt_clear(2); if (table[choice].dispatch != NULL) { const char *save = push_menu(choice); const char *name = table[choice].description; if (LOG_ENABLED) fprintf(log_fp, NOTE_STR "choice %s: %s\n", current_menu, name); if ((*table[choice].dispatch) (name) != MENU_NOHOLD) holdit(); pop_menu(save); } if (LOG_ENABLED) fflush(log_fp); return (table[choice].dispatch != NULL); } printxx(" Bad choice, try again: "); } } } int menu(MENU *table) { return menu2(table, 6); } /* * Format a response-string, to highlight in chrprint2() and print. It may be * multi-line, depending on the length and the column limits. */ char * chrformat(const char *s, int col, int first) { int pass; int wrap = (min_cols - col); char *result = NULL; if (quick_reply) { const char *quicker = s; int j; for (j = 0; s[j] != '\0'; ++j) { int c = CharOf(s[j]); int d = CharOf(s[j + 1]); /* reset on CSI, OSC, DCS, SOS, PM, APC */ if ((strchr("\233\235\220\230\236\237", c) != NULL) || (c == '\033' && d != '\0' && strchr("[]PX^_", d) != NULL)) { if (j != 0) quicker = s + j; } else if (c == '\n') { if (s[j + 1] != '\0') quicker = s + j + 1; } } s = quicker; } for (pass = 0; pass < 2; ++pass) { int j, k; int base; for (j = k = base = 0; s[j] != '\0'; ++j) { int c = CharOf(s[j]); char temp[80]; if (c <= ' ' || c >= '\177') { sprintf(temp, "<%d> ", c); } else { sprintf(temp, "%c ", c); } if ((k + first - base) >= wrap) { if (pass) { result[k] = '\n'; } base = ++k; first = 0; } if (pass) { strcpy(result + k, temp); } k += (int) strlen(temp); } if (!pass) { if ((result = malloc((size_t) k + 2)) == NULL) no_memory(); *result = '\0'; } } return result; } /* * 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; char *temp; vt_hilite(TRUE); printxx(" "); temp = chrformat(s, col, 1); for (i = 0; temp[i] != '\0'; ++i) { if (temp[i] == '\n') { vt_move(++result, col); } else { putchar(temp[i]); } } if (quick_reply) vt_el(0); vt_hilite(FALSE); free(temp); return result + 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 NULL; } return input; } char * skip_csi(char *input) { if (CharOf(*input) == CSI) { return input + 1; } return skip_prefix(csi_input(), input); } char * skip_dcs(char *input) { if (CharOf(*input) == DCS) { return input + 1; } return skip_prefix(dcs_input(), input); } char * skip_osc(char *input) { if (CharOf(*input) == OSC) { return input + 1; } return skip_prefix(osc_input(), input); } char * skip_ss3(char *input) { if (CharOf(*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 NULL; } return input; } const char * skip_csi_2(const char *input) { if (CharOf(*input) == CSI) { return input + 1; } return skip_prefix_2(csi_input(), input); } const char * skip_dcs_2(const char *input) { if (CharOf(*input) == DCS) { return input + 1; } return skip_prefix_2(dcs_input(), input); } const char * skip_ss3_2(const char *input) { if (CharOf(*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) ? NULL : src; } #define xdigitOf(c) \ (((c) >= '0' && (c) <= '9') \ ? ((c) - '0') \ : (((c) >= 'A' && (c) <= 'F') \ ? ((c) + 10 - 'A') \ : ((c) + 10 - 'a'))) const char * skip_xdigits(const char *src, int *value) { const char *base = src; *value = 0; while (*src != '\0' && isxdigit(CharOf(*src))) { int ch = CharOf(*src); *value <<= 4; *value += xdigitOf(ch); src++; } return (base == src) ? NULL : src; } const char * skip_digits_2(const char *src) { const char *base = src; while (*src != '\0' && isdigit(CharOf(*src))) src++; return (base == src) ? NULL : 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 && CharOf(src[have - 1]) == ST) { ok = TRUE; src[--have] = '\0'; } } if (!ok && LOG_ENABLED) fprintf(log_fp, NOTE_STR "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)) != NULL && 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) printxx("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 'u': fprintf(fp, "%u", va_arg(ap, unsigned)); 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(NOTE_STR "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-20241208/reports.c0000644000000000000000000004240414724172723013664 0ustar rootroot/* $Id: reports.c,v 1.57 2024/12/05 00:37:39 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, vt382 */ { 2, "printer port" }, /* vt400, vt382 */ { 3, "ReGIS graphics" }, /* kermit */ { 4, "Sixel graphics" }, /* vt382, kermit */ { 5, "Katakana extension" }, /* vt382 */ { 6, "selective erase" }, /* vt400, vt382 */ { 7, "soft character set (DRCS)" }, /* vt400 */ { 8, "user-defined keys (UDK)" }, /* vt400, vt382 */ { 9, "national replacement character-sets" }, /* kermit */ { 10, "Two-bytes Kanji" }, /* vt382 */ { 11, "25th status line" }, /* ? */ { 12, "Serbo-Croatian (SCS)" }, /* vt500 */ { 13, "local editing mode" }, /* kermit */ { 14, "8-bit architecture" }, /* ? */ { 15, "DEC technical set" }, /* vt400, vt382 */ { 16, "locator device port (ReGIS)" }, /* kermit */ { 17, "terminal state reports" }, /* ? */ { 18, "user windows" }, /* vt400 */ { 19, "two sessions" }, /* vt400 */ { 20, "APL" }, /* vt400? */ { 21, "horizontal scrolling" }, /* vt400 */ { 22, "color" }, /* vt500 */ { 23, "Greek" }, /* vt500 */ { 24, "Turkish" }, /* vt500 */ { 25, "Arabic bilingual M1" }, /* vt400? */ { 26, "Arabic bilingual M2" }, /* vt400? */ { 27, "Arabic bilingual M3" }, /* vt400? */ { 28, "rectangular editing" }, /* vt400 */ { 29, "ANSI text locator" }, /* DXterm */ { 30, "Hanzi" }, /* vt400? */ { 32, "text macros" }, /* vt400? */ { 33, "Hangul Hanja" }, /* vt400? */ { 34, "Icelandic" }, /* vt400? */ { 35, "Arabic bilingual TC" }, /* vt400? */ { 36, "Arabic bilingual no TC" }, /* vt400? */ { 36, "Arabic bilingual no TC" }, /* vt400? */ { 37, "Thai" }, /* vt400? */ { 38, "character outlining" }, /* vt400? */ { 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[BUF_SIZE]; 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); putchar('\n'); 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 void report_is(const char *report, int row, int col) { const char *tag = "Report is:"; vt_move(row, col); vt_el(0); tprintf("%s", tag); chrprint2(report, row, col + (int) strlen(tag)); } /******************************************************************************/ static int tst_DA(MENU_ARGS) { int 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(); report_is(report, 3, 1); found = FALSE; if ((cmp = skip_csi_2(report)) != NULL) { int i; for (i = 0; *attributes[i][0] != '\0'; i++) { if (!strcmp(cmp, attributes[i][0])) { int n = 0; show_result(" -- means %s", attributes[i][1]); putchar('\n'); 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 != NULL && *cmp == '?') { int reportpos = 1; int value = scan_DA(cmp, &reportpos); show_result("%s\n", lookup(operating_level, value)); putchar('\n'); if (value == 12) { if ((value = scan_DA(cmp, &reportpos)) >= 0) { fputs(" ", stdout); switch (value) { case 2: show_result("no STP, AVO, no GPO (ReGIS)"); break; case 3: show_result("no STP, AVO, GPO (ReGIS)"); break; case 5: show_result("no AVO"); break; case 7: show_result("with AVO"); break; default: printxx("unknown code %d", value); break; } putchar('\n'); } if ((value = scan_DA(cmp, &reportpos)) >= 0) { fputs(" ", stdout); switch (value) { case 0: show_result("no printer"); break; case 1: show_result("with printer"); break; default: printxx("unknown code %d", value); break; } putchar('\n'); } if ((value = scan_DA(cmp, &reportpos)) >= 0) { tprintf(" ROM version %d", value); putchar('\n'); } } else { while ((value = scan_DA(cmp, &reportpos)) >= 0) { fputs(" ", stdout); show_result("%d = %s\n", value, lookup(extensions, value)); putchar('\n'); } } 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) { int row, col; /* *INDENT-OFF* */ static const struct { int Pp; const char *name; } tbl[] = { { 1, "VT220" }, { 2, "VT240" }, { 18, "VT330" }, { 19, "VT340" }, { 24, "VT320" }, { 32, "VT382" }, /* EK-VT382-RM-001, page 11-5 */ { 48, "VT382" }, /* EK-VT38T-UG-001, page C-40 */ { 28, "DECterm" }, { 41, "VT420" }, { 61, "VT510" }, { 64, "VT520" }, { 65, "VT525" }, }; /* *INDENT-ON* */ char *report; int Pp, Pv, Pc; char ch; const char *show = SHOW_FAILURE; 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(row = 3, col = 10); chrprint2(report, row, col); if ((report = skip_csi(report)) != NULL) { if (sscanf(report, ">%d;%d;%d%c", &Pp, &Pv, &Pc, &ch) == 4 && ch == 'c') { const char *name = "unknown"; size_t n; show = SHOW_SUCCESS; for (n = 0; n < TABLESIZE(tbl); n++) { if (Pp == tbl[n].Pp) { name = tbl[n].name; break; } } vt_move(4, 10); printxx("Pp=%d (%s)", Pp, name); vt_move(5, 10); printxx("Pv=%d, firmware version %d.%d", Pv, Pv / 10, Pv % 10); vt_move(6, 10); switch (Pp) { case 64: case 65: printxx("Pc=%d, %s keyboard", Pc, Pc ? "PC" : "VT"); break; default: printxx("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 hexadecimal string) */ static int tst_DA_3(MENU_ARGS) { int row, col; 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(row = 3, col = 10); chrprint2(report, row, col); show = SHOW_FAILURE; if (report == NULL || *report == '\0') { if (get_level() < 4) /* vt420 and up support this */ show = "not supported"; } else { char *content; if ((content = skip_dcs(report)) != NULL && strip_terminator(content) != 0 && *content++ == '!' && *content++ == '|' && strlen(content) != 0) { char *check; if (strlen(content) == 8) { (void) strtol(content, &check, 16); if (*check == '\0') show = SHOW_SUCCESS; } } } 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) { 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(); report_is(report, 5, 1); if ((cmp = skip_csi(report)) != NULL) report = cmp; if (strlen(report) < 14 || report[0] != '2' || report[1] != ';') println(" -- Bad format"); else { int reportpos = 2; /* *INDENT-EQLS* */ int parity = scanto(report, &reportpos, ';'); int nbits = scanto(report, &reportpos, ';'); int xspeed = scanto(report, &reportpos, ';'); int rspeed = scanto(report, &reportpos, ';'); int clkmul = scanto(report, &reportpos, ';'); int 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(); report_is(report2, 13, 1); if ((cmp = skip_csi(report2)) != NULL) 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; int row, col; char *report; const char *cmp; set_tty_raw(TRUE); vt_move(1, 1); printxx("Test of Device Status Report 5 (report terminal status)."); vt_move(row = 2, col = 1); dsr(5); report = get_reply(); report_is(report, row, col); if ((cmp = skip_csi(report)) != NULL) 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(row = 5, col = 1); dsr(6); report = get_reply(); report_is(report, row, col); if ((cmp = skip_csi(report)) != NULL) { 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) { int row, col; const 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(); tprintf("%c", 5); /* ENQ */ report = get_reply(); vt_move(row = 10, col = 1); chrprint2(report, row, col); vt_move(12, 1); restore_ttymodes(); return MENU_HOLD; } static int tst_NLM(MENU_ARGS) { int row, col; const 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(row = 4, col = 1); vt_el(0); chrprint2(report, row, col); 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(row = 7, col = 1); vt_el(0); chrprint2(report, row, col); 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", NULL }, { " (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 }, { "", NULL } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printxx("Terminal Reports/Responses")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } vttest-20241208/vmsbuild.com0000644000000000000000000001223414700623731014337 0ustar rootroot$! $Id: vmsbuild.com,v 1.20 2024/10/07 00:14:17 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 "replay.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 replay $ 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-20241208/unix_io.c0000644000000000000000000001171514705235525013640 0ustar rootroot/* $Id: unix_io.c,v 1.39 2024/10/20 17:18:13 tom Exp $ */ #include #include #include #include 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; char one_byte = '\0'; int active = is_replaying(); 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); if (active) pause_replay(); if (LOG_ENABLED) { fputs(READ_STR, log_fp); put_char(log_fp, last_char); fputs("\n", log_fp); } if (active) resume_replay(); 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) { if ((int) read(0, result + i, (size_t) 1) <= 0) goto out1; 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]; FILE *save = log_fp; int i = 0; pause_replay(); log_fp = NULL; result[i++] = inchar(); (void) read_buffer(result + i, (int) sizeof(result) - 2); log_fp = save; if (LOG_ENABLED) { fputs(READ_STR, log_fp); put_string(log_fp, result); fputs("\n", log_fp); } resume_replay(); return (result); } /* cf: vms_io.c */ char * get_reply(void) { static char result[BUF_SIZE * 2]; int old_len = 0; int new_len = 0; fflush(stdout); pause_replay(); zleep(100); 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(READ_STR, log_fp); put_string(log_fp, result); fputs("\n", log_fp); } resume_replay(); return (result); } /* * Read to the next newline, truncating the buffer at BUF_SIZE-1 characters */ void inputline(char *s) { char *result; if (is_replaying() && (result = replay_string()) != NULL) { strcpy(s, result); puts(result); fflush(stdout); zleep(1000); } else { do { int ch; char *d = s; result = s; while ((ch = getchar()) != EOF && ch != '\n') { if ((d - s) < BUF_SIZE - 2) *d++ = (char) ch; } *d = 0; } while (!*s); } if (LOG_ENABLED) { fputs(READ_STR, log_fp); put_string(log_fp, result); fputs("\n", log_fp); } } /* * 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) { if ((int) read(0, &val, (size_t) 1) <= 0) break; } #else while (read(2, &val, (size_t) 1) > 0) ; #endif #endif } void holdit(void) { inflush(); tprintf("Push "); readnl(); } void readnl(void) { char *result; if (is_replaying() && (result = replay_string()) != NULL) { puts(result); fflush(stdout); zleep(1000); } else { 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; } if (LOG_ENABLED) { fputs(READ_STR "\n", log_fp); } } /* * 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-20241208/xterm.c0000644000000000000000000007037114724173442013330 0ustar rootroot/* $Id: xterm.c,v 1.87 2024/12/05 00:43:14 tom Exp $ */ #include #include #include #define Pause(secs) fflush(stdout); sleep(secs) static int do_decaln; static int toggle_color(MENU_ARGS) { do_colors = !do_colors; return MENU_NOHOLD; } static int toggle_decaln(MENU_ARGS) { do_decaln = !do_decaln; return MENU_NOHOLD; } 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)) == NULL || strcmp(params, expected) != 0) { printxx("cursor save/restore %s, got \"%s\", expected \"%s\"", SHOW_FAILURE, params, expected); } else { printxx("cursor save/restore %s", SHOW_SUCCESS); } } static void begin_altscreen(MENU_ARGS, const char *explain, int except_tite) { vt_move(1, 1); println(the_title); vt_move(3, 1); println(explain); vt_move(4, 1); println("The next screen will be filled with E's down to the prompt."); if (except_tite) { vt_move(5, 1); println("unless titeInhibit resource is set, or alternate-screen is disabled."); } vt_move(7, 5); } static void fill_altscreen(void) { vt_move(12, 1); if (do_decaln) { println("This message should not be here."); decaln(); /* fill the screen */ } else { int y, x; for (y = 0; y < max_lines; ++y) { cup(y + 1, 1); for (x = 0; x < min_cols; ++x) putchar('E'); } vt_move(12, 1); } } static void finish_altscreen(void) { vt_move(4, 1); el(2); println("The original screen should be restored except for this line."); vt_move(max_lines - 2, 1); } static int test_altscrn_47(MENU_ARGS) { begin_altscreen(PASS_ARGS, "Test private setmode 47 (to/from alternate screen)", 0); decsc(); cup(max_lines - 2, 1); holdit(); if (do_colors) set_colors(WHITE_ON_BLUE); sm("?47"); fill_altscreen(); vt_move(15, 7); decsc(); cup(max_lines - 2, 1); ed(0); holdit(); rm("?47"); vt_move(max_lines - 2, 1); decrc(); check_rc(7, 5); finish_altscreen(); if (do_colors) reset_colors(); return MENU_HOLD; } static int test_altscrn_1047(MENU_ARGS) { begin_altscreen(PASS_ARGS, "Test private setmode 1047 (to/from alternate screen)", 1); 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(); if (do_colors) set_colors(WHITE_ON_BLUE); sm("?1047"); fill_altscreen(); vt_move(15, 7); decsc(); cup(max_lines - 2, 1); ed(0); holdit(); rm("?1047"); vt_move(max_lines - 2, 1); decrc(); rm("?1048"); check_rc(9, 7); finish_altscreen(); if (do_colors) reset_colors(); return MENU_HOLD; } static int test_altscrn_1049(MENU_ARGS) { begin_altscreen(PASS_ARGS, "Test private setmode 1049 (to/from alternate screen)", 1); decsc(); cup(max_lines - 2, 1); holdit(); /* cursor location will be one line down */ if (do_colors) set_colors(WHITE_ON_BLUE); sm("?1049"); /* this saves the cursor location */ fill_altscreen(); cup(max_lines - 2, 1); ed(0); holdit(); vt_move(max_lines - 2, 1); rm("?1049"); decrc(); check_rc(max_lines - 1, 1); finish_altscreen(); if (do_colors) reset_colors(); 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) { static char txt_do_colors[80]; static char txt_do_decaln[80]; /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", NULL }, { txt_do_colors, toggle_color }, { txt_do_decaln, toggle_decaln }, { "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 }, { "", NULL } }; /* *INDENT-ON* */ int save_colors = do_colors; do_decaln = 1; do { sprintf(txt_do_colors, "%s after switching to alternate", do_colors ? "Color" : "Do not color"); sprintf(txt_do_decaln, "%s after switching to alternate", do_decaln ? "Use DECALN" : "Do not use DECALN"); vt_clear(2); __(title(0), println("XTERM Alternate-Screen features")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); if (do_colors && !save_colors) reset_colors(); do_colors = save_colors; return MENU_NOHOLD; } #define NUMFONTS 7 static int tst_modify_font(MENU_ARGS) { char temp[BUF_SIZE]; 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); printxx(">"); inputline(temp); do_osc("50;%s", temp); 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;?"); report = get_reply(); 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", n); report = get_reply(); if (strchr(report, ';') != NULL) { printxx(" %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", n >= 0 ? '+' : '-', n >= 0 ? n : -n); report = get_reply(); if (strchr(report, ';') != NULL) { printxx(" %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", NULL }, { "Modify font", tst_modify_font }, { "Report font(s)", tst_report_font }, { "", NULL } }; /* *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'); /* * That window resizing can cause a terminal emulator to send lots of * SIGWINCH's, which may be queued up for delivery (and interrupt subsequent * system calls). Check if we can successfully receive replies from the * terminal before proceeding. */ set_tty_raw(TRUE); set_tty_echo(FALSE); vt_move(20, 1); pause_replay(); printxx("Working"); for (n = 0; n < 20; ++n) { char *report; char expect[20]; printxx("."); fflush(stdout); do_csi("6n"); sprintf(expect, "20;%dR", n + 9); report = get_reply(); fflush(stdout); if (LOG_ENABLED) { fprintf(log_fp, NOTE_STR "expect '%s'\n", expect); } if (report != NULL && (report = skip_csi(report)) != NULL && !strcmp(report, expect)) { break; } if (LOG_ENABLED) fflush(log_fp); zleep(1000); } resume_replay(); restore_ttymodes(); return MENU_HOLD; } static int test_report_ops(MENU_ARGS) { /* *INDENT-OFF* */ static struct { int csi_or_osc; int pprefix; const char *params; const char *testing; } table[] = { { 0, 0, "11", "state of window (normal/iconified)" }, { 0, 1, "13", "position of window in pixels" }, { 0, 1, "13;2", "position of text-area in pixels" }, { 0, 1, "14", "size of text-area in pixels" }, { 0, 1, "14;2", "size of window in pixels" }, { 0, 1, "15", "size of screen in pixels" }, { 0, 1, "16", "size of character in pixels" }, { 0, 1, "18", "size of window in chars" }, { 1, 0, "20", "icon label" }, { 1, 0, "21", "window label" }, }; /* *INDENT-ON* */ int row = 3; int col = 10; int test = 0; vt_move(1, 1); println("Test of Window reporting."); fflush(stdout); set_tty_raw(TRUE); set_tty_echo(FALSE); for (test = 0; test < TABLESIZE(table); ++test) { char *report; const char *params; char buffer[80]; if (row + 3 > max_lines - 3) { restore_ttymodes(); vt_move(row, 1); holdit(); vt_move(row = 3, 1); vt_clear(0); set_tty_raw(TRUE); set_tty_echo(FALSE); } vt_move(row++, 1); printxx("Report %s (%s):", table[test].testing, table[test].params); vt_move(row, col); do_csi("%st", table[test].params); report = get_reply(); row = chrprint2(report, row, col); vt_move(row++, col); if (!strcmp(table[test].params, "11")) { params = skip_csi(report); if (params != NULL && isdigit(CharOf(*params)) && !strcmp(params + 1, "t")) { switch (*params) { case '1': params = "normal"; break; case '2': params = "icon"; break; default: params = "?"; } } else { params = "?"; } } else if (table[test].csi_or_osc) { params = skip_osc(report); if (params == NULL) params = "?"; else if (!strip_suffix(report, st_input())) params = "?"; else if (*params == 'L') params = "icon label"; else if (*params == 'l') params = "window label"; else params = "?"; } else { params = skip_csi(report); if (params != NULL && table[test].pprefix) { if (params[0] == table[test].params[1] && params[1] == ';' && strip_suffix(report, "t")) { int high; int wide; int skip; if (sscanf(params, "%d;%d;%d", &skip, &high, &wide) == 3 && high > 0 && wide > 0) { sprintf(buffer, "%d high, %d wide", high, wide); params = buffer; } else { params = "?"; } } else params = "?"; } else { params = "? BUG"; } } if (*params == '?') printxx("ERR"); else printxx("OK: %s", params); fflush(stdout); } vt_move(20, 1); restore_ttymodes(); return MENU_HOLD; } /* Set window title */ static int test_window_name(MENU_ARGS) { char temp[BUF_SIZE]; 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", temp); return MENU_NOHOLD; } static int tst_xterm_VERSION(MENU_ARGS) { int step; set_tty_raw(TRUE); set_tty_echo(FALSE); vt_move(1, 1); println("Both testcases should all get the same response"); for (step = -1; step <= 0; ++step) { char *report; int row, col; vt_move(row = 3 + step, col = 3); if (step >= 0) do_csi(">%dq", step); else do_csi(">q"); report = get_reply(); if ((report = skip_dcs(report)) != NULL && strip_terminator(report) && !strncmp(report, ">|", 2)) { printxx(SHOW_SUCCESS); vt_move(row, col + 3); chrprint2(report + 2, row, col + 3); } else { printxx(SHOW_FAILURE); } } vt_move(20, 1); restore_ttymodes(); return MENU_HOLD; } static int tst_XTTITLEPOS(MENU_ARGS) { int now, top; int row = 3; int first = -1; int last = -1; int seen = -1; char *report; char expect; char ignore; vt_move(1, 1); println(the_title); set_tty_raw(TRUE); set_tty_echo(FALSE); vt_move(3, 3); do { do_csi("#S"); report = get_reply(); if ((report = skip_csi(report)) != NULL && sscanf(report, "%d;%d#%c%c", &now, &top, &expect, &ignore) == 3 && now >= seen && now >= 0 && top > now && expect == 'S') { vt_move(row++, 3); printxx("[%d:%d] " SHOW_SUCCESS, now, top); if (first < 0) { first = now; seen = now; last = top; } seen++; do_csi("22;0t"); do_osc("0;Title stack %d", seen); zleep(200); } else { printxx(SHOW_FAILURE); break; } } while (seen + 1 < last); while (seen-- > first) { do_csi("23;0t"); do_csi("#S"); report = get_reply(); if ((report = skip_csi(report)) != NULL && sscanf(report, "%d;%d#%c%c", &now, &top, &expect, &ignore) == 3 && now <= seen && now >= 0 && top == last && expect == 'S') { vt_move(--row, 30); printxx("[%d:%d] " SHOW_SUCCESS, now, last); zleep(200); } else { printxx(SHOW_FAILURE); break; } } vt_move(20, 1); restore_ttymodes(); return MENU_HOLD; } #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_OPTBLNK 13 #define XT_XORBLNK 14 #define XT_SCRLBAR 30 #define XT_FONTSWT 35 #define XT_TEK4014 38 #define XT_80_132 40 #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_MSE_SGR 1006 #define XT_ALTSCRL 1007 #define XT_TTY_OUT 1010 #define XT_SCRLKEY 1011 #define XT_FASTSCR 1014 #define XT_SGR_PXL 1016 #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_OLDCLIP 1044 #define XT_ALTS_OK 1046 #define XT_ALTS_47 1047 #define XT_ALTS_SC 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( XT_OPTBLNK, 3 /* blink-option via menu/resource */), DATA( XT_XORBLNK, 3 /* enable XOR or blinking cursoor control */), 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( XT_TEK4014, 3 /* Tektronix 4014 */), DATA( DECHEM, 5 /* Hebrew encoding */), DATA( XT_80_132, 3 /* 80/132 mode */), 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 (VT420) */), 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 /* UTF-8 extended mouse-coordinates */), DATA( XT_MSE_SGR, 3 /* SGR-style extended mouse-coordinates */), DATA( XT_ALTSCRL, 3 /* alternate-scroll */), DATA( XT_TTY_OUT, 3 /* rxvt scroll tty output */), DATA( XT_SCRLKEY, 3 /* rxvt scroll key */), DATA( XT_FASTSCR, 3 /* fast-scroll mode */), DATA( XT_SGR_PXL, 3 /* SGR mouse pixel mode */), 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_OK, 3 /* enable alt-screen switching */), DATA( XT_ALTS_47, 3 /* first extended alt-screen */), DATA( XT_ALTS_SC, 3 /* save cursor for 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; } static int rpt_XTQMODKEYS(MENU_ARGS) { int n; char full_title[80]; char command[80]; static const char *resource[] = { "modifyKeyboard", "modifyCursorKeys", "modifyFunctionKeys", "modifyOtherKeys", }; for (n = 0; n < 4; ++n) { int code = (n == 3) ? 4 : n; sprintf(full_title, "%s (%s)", the_title, resource[n]); sprintf(command, ">%dm", code); vt_move(1, 1); vt_clear(0); any_decrqss(full_title, command); holdit(); } return MENU_NOHOLD; } static int rpt_XTSMTITLE(MENU_ARGS) { int n; static const char *message[] = { "Set window/icon labels using hexadecimal", "Query window/icon labels using hexadecimal", "Set window/icon labels using UTF-8", "Query window/icon labels using UTF-8" }; for (n = 0; n < 4; ++n) { char full_title[80]; char command[80]; sprintf(full_title, "%s (%s)", the_title, message[n]); vt_move(1, 1); vt_clear(0); sprintf(command, ">%dt", n); /* set the value */ do_csi(">%dt", n); any_decrqss(full_title, command); zleep(500); /* reset the value */ do_csi(">%dT", n); any_decrqss(full_title, command); holdit(); } return MENU_NOHOLD; } static int tst_xterm_DECRQSS(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", NULL }, { "Test VT520 features (DECRQSS)", tst_vt520_DECRQSS }, { "Query Key Modifier Options", rpt_XTQMODKEYS }, { "Query Title Modes", rpt_XTSMTITLE }, { "", NULL } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printxx("XTerm Status-Strings Reports")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } /* * 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 /* UTF-8 extended mouse-coordinates */), DATA( XT_MSE_SGR, 3 /* SGR-style 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", NULL }, { "Test VT520 features", tst_vt520_reports }, { "Report version (XTVERSION)", tst_xterm_VERSION }, { "Request Mode (DECRQM)/Report Mode (DECRPM)", tst_xterm_DECRPM }, { "Status-String Report (DECRQSS)", tst_xterm_DECRQSS }, { "Title-Stack Position", tst_XTTITLEPOS }, { "", NULL } }; /* *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", NULL }, { "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 }, { "", NULL } }; /* *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-20241208/COPYING0000644000000000000000000000225214564513236013052 0ustar rootroot$Id: COPYING,v 1.16 2024/02/18 23:45:34 tom Exp $ ----------------------------------------------------------------------------- Copyright 1996-2023,2024 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-20241208/vttest.h0000644000000000000000000002667514720747612013541 0ustar rootroot/* $Id: vttest.h,v 1.128 2024/11/25 01:14:50 tom Exp $ */ #ifndef VTTEST_H #define VTTEST_H 1 /* original version... */ #define VERSION "1.7b 1985-04-19" /* the actual version is here */ #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 #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 #elif defined(HAVE_TERMIO_H) # define USE_TERMIO 1 #elif defined(HAVE_SGTTY_H) # define USE_SGTTY 1 # define USE_FIONREAD 1 #elif !defined(VMS) # error please fix me #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 allows_utf8; extern int assume_utf8; extern int brkrd; extern int debug_level; extern int decac_bg; extern int decac_fg; 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 parse_7bits; extern int reading; extern int slow_motion; extern int tty_speed; extern int use_decac; 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_NORETURN #define GCC_NORETURN /* nothing */ #endif #ifndef GCC_PRINTFLIKE #define GCC_PRINTFLIKE(fmt,var) /* nothing */ #endif #ifndef GCC_UNUSED #define GCC_UNUSED /* nothing */ #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; int parse_7bits; } 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 BUF_SIZE 1024 /* normal logging-prefixes */ #define READ_STR "Read: " /* use this for noting user-input */ #define NOTE_STR "Note: " /* use this for making notes (no data involved) */ #define SEND_STR "Send: " /* use this for control-sequences, sent */ #define DATA_STR "Data: " /* use this for test-data, sent */ #define TELL_STR "Text: " /* use this for test-instructions */ /* replay logging-prefixes */ #define WAIT_STR "Wait: " /* use this for suspending replay */ #define DONE_STR "Done: " /* use this for resuming replay */ #define SKIP_STR "Skip: " /* use this for debugging replay */ #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 int current_Gx[4]; extern int scs_national; extern RETSIGTYPE onbrk(SIG_ARGS); extern GCC_NORETURN RETSIGTYPE onterm(SIG_ARGS); extern char *chrformat(const char *s, int col, int first); extern char *get_reply(void); extern char *instr(void); extern char *replay_string(void); extern char *skip_csi(char *input); extern char *skip_dcs(char *input); extern char *skip_digits(char *src); extern char *skip_osc(char *input); extern char *skip_prefix(const char *prefix, char *input); extern char *skip_ss3(char *input); extern char inchar(void); extern const char *charset_name(int g, int n); extern const char *parse_Sdesig(const char *source, int *offset); extern const char *parse_upss_name(const char *source, int size); 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 const char *skip_xdigits(const char *src, int *value); extern int any_DSR(MENU_ARGS, const char *text, void (*explain) (const 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 do_scs(int g); extern int get_bottom_margin(int n); extern int get_char(void); 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 is_replaying(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 print_chr(int c); extern int print_str(const char *s); extern int reset_charset(MENU_ARGS); extern int rpt_DECSTBM(MENU_ARGS); extern int sane_cs(int g); extern int scan_DA(const char *str, int *pos); extern int scan_any(const 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 specify_G0(MENU_ARGS); extern int specify_G1(MENU_ARGS); extern int specify_G2(MENU_ARGS); extern int specify_G3(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 toggle_nrc(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_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(const 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_upss(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_DECRQSS(MENU_ARGS); extern int tst_vt520_reports(MENU_ARGS); extern int tst_xterm(MENU_ARGS); extern int vt_move(int row, int col); extern GCC_NORETURN void bye(void); extern void close_replay(void); extern void default_level(void); extern void dirty_charset(int state); extern void do_scrolling(void); extern void enable_logging(const char *filename); extern void finish_vt420_cursor(MENU_ARGS); extern void initterminal(int pn); extern void menus_vt420_cursor(void); extern void pause_replay(void); extern void reset_colors(void); extern void reset_level(void); extern void restore_level(const VTLEVEL *save); extern void resume_replay(void); 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_replay(const char *filename); 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); extern GCC_NORETURN void failed(const char *); extern GCC_NORETURN void no_memory(void); #endif /* VTTEST_H */ vttest-20241208/vt320.c0000644000000000000000000012764714724173442013060 0ustar rootroot/* $Id: vt320.c,v 1.102 2024/12/05 00:43:14 tom Exp $ */ /* * Reference: VT330/VT340 Programmer Reference Manual (EK-VT3XX-TP-001) */ #include #include #include #include static void show_Locator_Status(const 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); } static void show_Identify_Locator(const char *report) { int pos = 0; int Ps1 = scan_any(report, &pos, 'n'); int Ps2 = scanto(report, &pos, 'n'); const char *show = SHOW_FAILURE; if (Ps1 == 57) { switch (Ps2) { case 0: show = "Cannot identify locator"; break; case 1: show = "Locator is mouse"; break; case 2: show = "Locator is tablet"; break; } } show_result("%s", show); } /* * Though some people refer to the locator controls as "vt220", it appears in * later terminals (documented in the vt330 manual, but introduced as in UWS). */ static int tst_DSR_locator_status(MENU_ARGS) { return any_DSR(PASS_ARGS, "?55n", show_Locator_Status); } static int tst_DSR_identify_locator(MENU_ARGS) { return any_DSR(PASS_ARGS, "?56n", show_Identify_Locator); } static void show_ExtendedCursorPosition(const 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", NULL }, { "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_status }, { "Identify Locator", tst_DSR_identify_locator }, { "Test Extended Cursor-Position (DECXCPR)", tst_DSR_cursor }, { "", NULL } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printxx("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(const 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) */ typedef struct { /* position */ int row; int col; int page; /* current rendition */ int Srend; /* raw rendition information */ int reverse; int blinking; int underline; int bold; /* attributes */ int Satt; /* raw attribute information */ int selective_erase; /* flags */ int Sflag; /* raw flag-information */ int aw_pending; int ss3_pending; int ss2_pending; int origin_mode; /* character sets */ int gl; int gr; int Scss; char cs_suffix[4][3]; int cs_sizes[4]; const char *cs_names[4]; } DECCIR_REPORT; static int parse_DECCIR(const char *input, DECCIR_REPORT * output) { int valid = 1; int pos = 3; /* skip "1$u" */ int n; memset(output, 0, sizeof(*output)); /* *INDENT-EQLS* */ output->row = scanto(input, &pos, ';'); output->col = scanto(input, &pos, ';'); output->page = scanto(input, &pos, ';'); output->Srend = scan_chr(input, &pos, ';'); if (output->Srend & 0x40) { /* *INDENT-EQLS* */ output->reverse = ((output->Srend & 0x08) != 0); output->blinking = ((output->Srend & 0x04) != 0); output->underline = ((output->Srend & 0x02) != 0); output->bold = ((output->Srend & 0x01) != 0); } output->Satt = scan_chr(input, &pos, ';'); if (output->Satt & 0x40) { output->selective_erase = ((output->Satt & 1) != 0); } output->Sflag = scan_chr(input, &pos, ';'); if (output->Sflag & 0x40) { /* *INDENT-EQLS* */ output->aw_pending = ((output->Sflag & 0x08) != 0); output->ss3_pending = ((output->Sflag & 0x04) != 0); output->ss2_pending = ((output->Sflag & 0x02) != 0); output->origin_mode = ((output->Sflag & 0x01) != 0); } output->gl = scanto(input, &pos, ';'); output->gr = scanto(input, &pos, ';'); output->Scss = scan_chr(input, &pos, ';'); if (output->Scss & 0x40) { output->cs_sizes[3] = (output->Scss & 0x08) ? 96 : 94; output->cs_sizes[2] = (output->Scss & 0x04) ? 96 : 94; output->cs_sizes[1] = (output->Scss & 0x02) ? 96 : 94; output->cs_sizes[0] = (output->Scss & 0x01) ? 96 : 94; } n = 0; while (input[pos] != '\0') { strncpy(output->cs_suffix[n], input + pos, (size_t) 2)[2] = '\0'; if (output->cs_suffix[n][0] != '%') { output->cs_suffix[n][1] = '\0'; } output->cs_names[n++] = parse_Sdesig(input, &pos); if (n >= 4) break; } return valid; } static int read_DECCIR(DECCIR_REPORT * output) { char *report; int Ps = 1; do_csi("%d$w", Ps); report = get_reply(); if ((report = skip_dcs(report)) != NULL && strip_terminator(report) && *report == Ps + '0' && !strncmp(report + 1, "$u", (size_t) 2)) { return parse_DECCIR(report, output); } else { return 0; } } #define show_DECCIR_flag(value, mask, string) \ if (value & mask) { value &= ~mask; show_result(string); } static void show_DECCIR(const char *report) { int row; int n; DECCIR_REPORT data; parse_DECCIR(report, &data); vt_move(5, 10); show_result("Cursor (%d,%d), page %d", data.row, data.col, data.page); vt_move(6, 10); if ((data.Srend & 0x4f) == data.Srend) { printxx("Rendition:"); if (data.Srend == 0) { show_result(" normal"); } else { printxx("%s", data.reverse ? " reverse" : ""); printxx("%s", data.blinking ? " blinking" : ""); printxx("%s", data.underline ? " underline" : ""); printxx("%s", data.bold ? " bold" : ""); } } else { show_result(" -> unknown rendition (0x%x)", data.Srend); } vt_move(7, 10); if ((data.Satt & 0x4f) == data.Satt) { show_result("Selective erase: %s", data.selective_erase ? "ON" : "off"); } else { show_result(" -> unknown attribute (0x%x)", data.Satt); } vt_move(8, 10); if ((data.Sflag & 0x4f) == data.Sflag) { printxx("Flags:"); printxx("%s", data.aw_pending ? " autowrap pending" : ""); printxx("%s", data.ss3_pending ? " SS3 pending" : ""); printxx("%s", data.ss2_pending ? " SS2 pending" : ""); printxx("%s", data.origin_mode ? " origin-mode on" : ""); } else { show_result(" -> unknown flag (0x%x)", data.Sflag); } vt_move(9, 10); show_result("Character set in GL: G%d", data.gl); vt_move(10, 10); show_result("Character set in GR: G%d", data.gr); vt_move(11, 10); if ((data.Scss & 0x4f) == data.Scss) { printxx(" Character set sizes:"); for (n = 0; n <= 3; n++) { printxx(" G%d(%d)", n, data.cs_sizes[n]); } } else { show_result(" -> unknown char set size (0x%x)", data.Scss); } row = 12; vt_move(row, 10); show_result("Character set names for G0...G3: "); println(""); for (n = 0; n < 4; ++n) { show_result(" %s\n", (data.cs_names[n] ? data.cs_names[n] : "?")); println(""); } } /******************************************************************************/ static void setup_charset(void) { int g; for (g = 0; g <= 3; ++g) { if (current_Gx[g] != sane_cs(g)) do_scs(g); } } static void restore_charset(void) { int g; for (g = 0; g <= 3; ++g) { if (current_Gx[g]) { int save = current_Gx[g]; current_Gx[g] = sane_cs(g); do_scs(g); current_Gx[g] = save; } } } /******************************************************************************/ /* * 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 row) { int pos = 3; /* skip "2$u" */ int stop; int *stops; int n; int len = 0; int used = 0; if ((stops = (int *) malloc(sizeof(int) * (strlen(report) + 1))) == NULL) no_memory(); strcat(report, "/"); /* simplify scanning */ while ((stop = scanto(report, &pos, '/')) != 0) { stops[len++] = stop; } println(""); printxx("Tab stops:"); row += 2; ruler(row, min_cols); for (n = 0; n < len; ++n) { if (stops[n] <= min_cols && stops[n] > 0) { cup(row, stops[n]); print_chr('*'); } } cup(++row, 1); for (n = used = 0; n < len; ++n) { if (stops[n] <= min_cols && stops[n] > 0) { if (used) print_chr('\t'); print_chr('*'); ++used; } } free(stops); } /******************************************************************************/ int any_decrqpsr(MENU_ARGS, int Ps) { char *report; int row; vt_move(1, 1); printxx("Testing DECRQPSR: %s\n", the_title); set_tty_raw(TRUE); set_tty_echo(FALSE); vt_move(row = 3, 10); setup_charset(); do_csi("%d$w", Ps); report = get_reply(); restore_charset(); row = chrprint2(report, row, 1); if ((report = skip_dcs(report)) != NULL) { 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, row); 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_any_DECCIR(MENU_ARGS) { static char whatis_Gx[4][80]; static char nrc_mesg[80]; /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", NULL }, { "Reset (G0 ASCII, G1 Latin-1, no NRC mode)", reset_charset }, { nrc_mesg, toggle_nrc }, { whatis_Gx[0], specify_G0 }, { whatis_Gx[1], specify_G1 }, { whatis_Gx[2], specify_G2 }, { whatis_Gx[3], specify_G3 }, { "Cursor Information Report (DECCIR)", tst_DECCIR }, { "", NULL } }; /* *INDENT-ON* */ reset_charset(PASS_ARGS); /* make the menu consistent */ if (get_level() > 2) { int n; do { vt_clear(2); __(title(0), printxx("Character-Set Tests")); __(title(2), println("Choose test type:")); sprintf(nrc_mesg, "%s National Replacement Character (NRC) mode", STR_ENABLE(scs_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)); /* tidy in case a "vt100" emulator does not ignore SCS */ vt_clear(1); return reset_charset(PASS_ARGS); } else { vt_move(1, 1); printxx("Sorry, terminal supports only VT%d", terminal_id()); vt_move(max_lines - 1, 1); return MENU_HOLD; } } /******************************************************************************/ static void set_tabstops(int row, int stop) { int col; tbc(3); /* clear existing tab-stops */ for (col = 0; col < min_cols; col += stop) { cup(row, 1 + col); hts(); } } static int test_tabstop; static int reset_tabstops(MENU_ARGS) { set_tabstops(1, test_tabstop = 8); return MENU_NOHOLD; } static int toggle_tabstop(MENU_ARGS) { if (--test_tabstop < 4) test_tabstop = 10; return MENU_NOHOLD; } static int tst_DECTABSR(MENU_ARGS) { set_tabstops(1, test_tabstop); return any_decrqpsr(PASS_ARGS, 2); } static int tst_any_DECTABSR(MENU_ARGS) { static char msg_toggle_tabstop[80]; /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", NULL }, { "Reset Tab Stops", reset_tabstops }, { msg_toggle_tabstop, toggle_tabstop }, { "Tab Stop Report (DECTABSR)", tst_DECTABSR }, { "", NULL } }; /* *INDENT-ON* */ int last_tabstop = 0; reset_tabstops(PASS_ARGS); /* make the menu consistent */ do { vt_clear(2); __(title(0), printxx("Tab Stop Report (DECTABSR)")); __(title(2), println("Choose test type:")); if (last_tabstop != test_tabstop) sprintf(msg_toggle_tabstop, "Set Tabs: %d", last_tabstop = test_tabstop); } while (menu(my_menu)); vt_clear(1); return reset_tabstops(PASS_ARGS); } /******************************************************************************/ /* * The restore should move the cursor to 2,1; the relative move back to the * test-grid demonstrates that. */ static void tst_restore_cursor(const char *old_mode, int row, int col) { print_str(old_mode); fflush(stdout); /* ensure terminal is updated */ if (row > 2) cud(row - 2); if (col > 1) cuf(col - 1); } static int tst_DECRSPS_cursor(MENU_ARGS) { char *old_mode; char *s; DECCIR_REPORT actual; vt_move(1, 1); printxx("Testing %s\n", the_title); set_tty_raw(TRUE); set_tty_echo(FALSE); decrqpsr(1); old_mode = strdup(get_reply()); if ((s = strchr(old_mode, 'u')) != NULL) { int item; int row, col; int len; int j, k; int tries, fails; char temp[80]; println(""); println("Position/rendition:"); *s = 't'; for (item = 0; item < 16; ++item) { cup(row = item + 4, col = 10); sprintf(temp, "rendition[%2d]: ", item); len = print_str(temp); if (item == 0) { len += print_str(" none"); } else { if (item & 8) { len += print_chr(' '); sgr("7"); len += print_str("reverse"); } if (item & 4) { len += print_chr(' '); sgr("5"); len += print_str("blinking"); } if (item & 2) { len += print_chr(' '); sgr("4"); len += print_str("underline"); } if (item & 1) { len += print_chr(' '); sgr("1"); len += print_str("bold"); } } if (read_DECCIR(&actual)) { tst_restore_cursor(old_mode, row, col + len); if (actual.Srend != (0x40 | item)) { printxx(" (rendition?)"); } else if (actual.row != row) { printxx(" (row?)"); } else if (actual.col != (col + len)) { printxx(" (col?)"); } else { printxx(" (OK)"); } } else { tst_restore_cursor(old_mode, row, col + len); printxx(" (N/A)"); } } cup(max_lines - 1, 1); restore_ttymodes(); holdit(); set_tty_raw(TRUE); set_tty_echo(FALSE); vt_move(1, 1); printxx("Testing %s\n", the_title); ed(0); println(""); println("Flags:"); len = 42; vt_move(row = 4, col = 10); tprintf("%-*s", len, "Selective erase, should be blank:"); tst_restore_cursor(old_mode, row, col + len); tprintf("XXXXXX"); vt_move(row, col + len); decsel(0); vt_move(++row, col); tprintf("%-*s", len, "Selective erase, should not be blank:"); vt_move(row, col + len); decsca(1); tprintf("XXXXXX"); vt_move(row, col + len); decsel(0); fails = 0; tries = 0; for (j = ++row; j <= max_lines; ++j) { cup(j, min_cols - 1); for (k = 0; k < 3; k++) { print_chr('0' + k); fflush(stdout); if (read_DECCIR(&actual)) { tries++; if (actual.aw_pending ^ (k == 1)) fails += 1; } if (j >= max_lines && k > 0) break; } } vt_move(row, 1); ed(0); println(""); println("Modes:"); vt_move(row += 2, col); el(2); if (fails) { printxx("Autowrap-pending: failed %d of %d tries", fails, tries); } else { printxx("Autowrap-pending: OK"); } println(""); fails = 1; vt_move(++row, col); print_str(ss2_output()); if (read_DECCIR(&actual) && actual.ss2_pending) { print_chr(' '); if (read_DECCIR(&actual) && !actual.ss2_pending) { fails = 0; } } el(2); vt_move(row, col); if (fails) { println("SS2 pending: ERR"); } else { println("SS2 pending: OK"); } fails = 1; vt_move(++row, col); print_str(ss3_output()); if (read_DECCIR(&actual) && actual.ss3_pending) { print_chr(' '); if (read_DECCIR(&actual) && !actual.ss3_pending) { fails = 0; } } el(2); vt_move(row, col); if (fails) { println("SS3 pending: ERR"); } else { println("SS3 pending: OK"); } fails = 1; vt_move(++row, col); decom(1); if (read_DECCIR(&actual) && actual.origin_mode) { fails = 0; } print_str(old_mode); /* restore original settings */ vt_move(row, col); printxx("Origin mode: %s", fails ? "ERR" : "OK"); vt_move(++row, 1); ed(0); println(""); println("Character sets:"); esc("+A"); /* set G3 to British */ esc("o"); /* select that into GL */ esc("*0"); /* set G2 to DEC special graphics */ esc("}"); /* select that into GR */ esc("(<"); /* set G1 to DEC supplementary */ esc(")>"); /* set G0 to DEC technical */ read_DECCIR(&actual); print_str(old_mode); vt_move(row += 2, col); printxx("Current GL: %s", (actual.gl == 3) ? "OK" : "ERR"); vt_move(++row, col); printxx("Current GR: %s", (actual.gr == 2) ? "OK" : "ERR"); for (j = 0; j < 4; ++j) { static const char *my_suffix = "<>0A"; vt_move(++row, col); printxx("G%d suffix: '%.2s' %s (%s)", j, actual.cs_suffix[j], (actual.cs_suffix[j][0] == my_suffix[j]) ? "OK" : "ERR", actual.cs_names[j]); } print_str(old_mode); /* restore original settings */ } free(old_mode); restore_ttymodes(); vt_move(max_lines - 1, 1); ed(0); return MENU_HOLD; } /******************************************************************************/ static void tabstop_ruler(const char *tabsr, int row, int col) { int valid = 1; int n; int tabstops = 0; char *expect; const char *suffix; const char *s; if ((expect = malloc((size_t) min_cols + 1)) == NULL) no_memory(); vt_move(row, col); for (n = 0; n < min_cols; ++n) { expect[n] = '-'; if (((n + 1) % 10) == 0) { expect[n] = (char) ((((n + 1) / 10) % 10) + '0'); } else if (((n + 1) % 5) == 0) { expect[n] = '+'; } } expect[min_cols] = '\0'; if (!strncmp(tabsr, "\033P", (size_t) 2)) { suffix = "\033\\"; s = tabsr + 2; } else if ((unsigned char) *tabsr == 0x90) { suffix = "\234"; s = tabsr + 1; } else { suffix = NULL; s = NULL; } if (s != NULL && !strncmp(s, "2$u", (size_t) 2)) { int value = 0; s += 2; while (*++s != '\0') { if (*s >= '0' && *s <= '9') { value = (value * 10) + (*s - '0'); } else if (*s == '/' || !strcmp(s, suffix)) { if (value-- > 0 && value < min_cols) { if (expect[value] != '*') { expect[value] = '*'; ++tabstops; value = 0; } else { valid = 0; break; } } if (!strcmp(s, suffix)) break; } else { valid = 0; break; } } } else { valid = 0; } if (valid) { println(expect); print_chr('*'); for (n = 1; n < tabstops; ++n) { print_chr('\t'); print_chr('*'); } } else { println("Invalid:"); chrprint2(tabsr, row, col); } free(expect); } static int tst_DECRSPS_tabs(MENU_ARGS) { int row, stop; char *old_tabs; const char *new_tabs; char *s; vt_move(1, 1); printxx("Testing %s\n", the_title); set_tty_raw(TRUE); set_tty_echo(FALSE); println(""); println("Original:"); decrqpsr(2); old_tabs = strdup(get_reply()); tabstop_ruler(old_tabs, 4, 1); vt_move(row = 7, 1); println("Modified:"); ++row; for (stop = 7; stop >= 4; --stop) { set_tabstops(row, stop); decrqpsr(2); new_tabs = get_reply(); tabstop_ruler(new_tabs, row, 1); row += 2; } println(""); println(""); println("Restore:"); if ((s = strchr(old_tabs, 'u')) != NULL) *s = 't'; print_str(old_tabs); /* restore original tab-stops */ free(old_tabs); decrqpsr(2); new_tabs = get_reply(); tabstop_ruler(new_tabs, row + 2, 1); restore_ttymodes(); vt_move(max_lines - 1, 1); return MENU_HOLD; } /* Test Window Report - VT340, VT420 */ static int tst_DECRQDE(MENU_ARGS) { char *report; char chr; int Ph, Pw, Pml, Pmt, Pmp; int row, col; 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(row = 3, col = 10); chrprint2(report, row, col); if ((report = skip_csi(report)) != NULL && 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; } /* Request Terminal State Report */ static int tst_DECRQTSR(MENU_ARGS) { int row, col; 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(row = 3, col = 10); chrprint2(report, row, col); if ((report = skip_dcs(report)) != NULL && 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; int used = -1; char chr; char *report; vt_move(1, 1); printxx("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; /* table contains duplicates, sorted with descending levels */ if (used >= table[j].mode) continue; used = table[j].mode; 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 = get_reply(); printxx("\n %4d: %-10s ", table[j].mode, table[j].name); if (LOG_ENABLED) fprintf(log_fp, NOTE_STR "testing %s\n", table[j].name); chrprint2(report, row + 1, 23); if ((report = skip_csi(report)) != NULL && 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( DECKANAM, 3 /* vt382:Katana shift */), 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( DECHEBM, 5 /* Hebrew keyboard mapping (VT520) */), DATA( DECHEM, 5 /* Hebrew encoding */), DATA( DECTEK, 3 /* 4010/4014 emulation (VT240, VT330/VT340) */), 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( DECKKDM, 3 /* vt382:Kanji/Katakana */), 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 (VT420) */), DATA( DECXRLM, 3 /* transmit rate linking */), DATA( DECSDM, 3 /* vt382:Sixel display */), 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", NULL }, { "ANSI Mode Report (DECRPM)", tst_ISO_DECRPM }, { "DEC Mode Report (DECRPM)", tst_DEC_DECRPM }, { "", NULL } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printxx("Request Mode (DECRQM)/Report Mode (DECRPM)")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } /******************************************************************************/ /* * The VT420 manual says that a valid response begins "DCS 0 $ r", * however I see "DCS 1 $ r" on a real VT420, consistently --TD (1996/09/11) */ int any_decrqss2(const char *msg, const char *func, const char *expected) { int code; int row, col; char *report; const char *show; const char *suffix = NULL; const char *p; char buffer[80]; vt_move(1, 1); printxx("Testing DECRQSS: %s\n", msg); set_tty_raw(TRUE); set_tty_echo(FALSE); decrqss(func); report = get_reply(); reset_decstbm(); reset_decslrm(); vt_move(row = 3, col = 10); chrprint2(report, row, col); /* workaround for embedded parameter in XTQMODKEYS */ for (p = func; *p != '\0'; ++p) { if (isdigit(CharOf(*p))) suffix = NULL; else if (suffix == NULL) suffix = p; } if (suffix == NULL) suffix = ""; switch ((code = parse_decrqss(report, suffix))) { 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); if (code == 1) { const char *lead = output_8bits ? "\233" : "\033["; char *part = malloc(5 + strlen(report) + strlen(suffix)); if (part != NULL) { char *full; sprintf(part, "%s%s%s", lead, report, suffix); full = chrformat(part, col, 0); if (full != NULL) { vt_move(++row, col); tprintf("%s", full); free(full); } free(part); } } 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_DECPRO(MENU_ARGS) { return any_decrqss(the_title, "}"); } 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", NULL }, { "Protected fields attributes (DECPRO)", rpt_DECPRO }, { "Select active status display (DECSASD)", rpt_DECSASD }, { "Select graphic rendition (SGR)", rpt_SGR }, { "Set character attribute (DECSCA)", rpt_DECSCA }, { "Set columns per page (DECSCPP)", rpt_DECSCPP }, { "Set conformance level (DECSCL)", rpt_DECSCL }, { "Set lines per page (DECSLPP)", rpt_DECSLPP }, { "Set status line type (DECSSDT)", rpt_DECSSDT }, { "Set top and bottom margins (DECSTBM)", rpt_DECSTBM }, { "Set transmit termination character (DECTTC)", rpt_DECTTC }, { "Transmission line termination character (DECTLTC)", rpt_DECTLTC }, { "", NULL } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printxx("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", NULL }, { "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 }, { "", NULL } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printxx("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", NULL }, { "Restore Terminal State (DECRSTS)", not_impl }, { "Terminal State Report (DECRQTS/DECTSR)", tst_DECRQTSR }, { "", NULL } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printxx("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", NULL }, { "Cursor Information Report (DECCIR)", tst_any_DECCIR }, { "Tab Stop Report (DECTABSR)", tst_any_DECTABSR }, { "Request Mode (DECRQM)/Report Mode (DECRPM)", tst_DECRPM }, { "Restore Presentation State (DECRSPS): cursor", tst_DECRSPS_cursor }, { "Restore Presentation State (DECRSPS): tabstops", tst_DECRSPS_tabs }, { "Status-String Report (DECRQSS)", tst_vt320_DECRQSS }, { "", NULL } }; /* *INDENT-ON* */ int old_DECRPM = set_DECRPM(3); do { vt_clear(2); __(title(0), printxx("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", NULL }, { "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", tst_upss }, { "Test Window Report (DECRPDE)", tst_DECRQDE }, { "", NULL } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printxx("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", NULL }, { "Test set columns per page (DECSCPP)", tst_DECSCPP }, { "Test set lines per page (DECSLPP)", tst_DECSLPP }, { "", NULL } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printxx("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", NULL }, { "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 }, { "", NULL } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printxx("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", NULL }, { "Test VT220 features", tst_vt220_screen }, { "Test Status line (DECSASD/DECSSDT)", tst_statusline }, { "", NULL } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printxx("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", NULL }, { "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 }, { "", NULL } }; /* *INDENT-ON* */ do { vt_clear(2); __(title(0), printxx("VT320 Tests")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } vttest-20241208/sixel.c0000644000000000000000000002020414725362145013304 0ustar rootroot/* $Id: sixel.c,v 1.31 2024/12/08 18:24:37 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 through 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[BUF_SIZE]; size_t use = 0; for (t = s + 1; *t; t++) { if (is_inter(*t)) { tmp[use++] = *t; } if (is_final(*t)) { char *tmp2; tmp[use++] = *t++; tmp[use] = '\0'; if ((tmp2 = malloc(use + 1)) == NULL) { no_memory(); } else { FontName = strcpy(tmp2, tmp); StartingCharPtr = t; } break; } } break; } } } static char * find_char(int chr) { char *s = StartingCharPtr; chr -= (' ' + StartingCharNum); if (chr < 0) return NULL; while (chr > 0) { do { if (*s == '\0') return NULL; } 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; s = find_char(chr); if (s != NULL) { int bit = 0; int high = 0; int n; char bits[6][MAX_WIDTH]; for (n = 32; n < 127; ++n) { int row = 6 + (n % 16); int col = 8 * (n / 16); vt_move(row, col); if (n == chr) vt_hilite(1); cprintf("%d %cN%c", n, ESC, n); /* use SS2 to invoke G2 into GL */ if (n == chr) vt_hilite(0); } vt_move(6, 1); fprintf(fp, "Glyph '%c'\n", chr); 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); printxx("Working...\n"); for (s = font_string; *s; s++) { putchar(*s); if (*s == '\n') { fflush(stdout); padding(20); } } fflush(stdout); padding(20); printxx("...done "); tprintf("%c*%s", ESC, FontName); /* designate G2 as the DRCS font */ padding(4); fflush(stdout); return MENU_HOLD; } static int tst_display_one(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); pause_replay(); do { d = c; c = get_char(); if (c < 0) break; vt_move(6, 1); vt_clear(0); if (display_char(stdout, c)) { println(""); cprintf("Render: %cN%c", ESC, c); /* use SS2 to invoke G2 into GL */ } } while (c != d); resume_replay(); restore_ttymodes(); return MENU_NOHOLD; } static int tst_display_all(MENU_ARGS) { int c; vt_move(1, 1); display_head(stdout); set_tty_raw(TRUE); set_tty_echo(FALSE); for (c = 32; c < 127; ++c) { vt_move(6, 1); display_char(stderr, c); zleep(100); } restore_ttymodes(); vt_move(23, 1); return MENU_HOLD; } /* * 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 *s; const char *first = NULL; char *last = NULL; int save_8bits = input_8bits; input_8bits = FALSE; /* use the 7-bit input-parsing */ /* read the file into memory */ if ((fp = fopen(filename, "r")) == NULL) { failed(filename); } if ((buffer = malloc(len)) == NULL) no_memory(); while ((c = fgetc(fp)) != EOF) { if (use + 1 >= len) { char *check; if ((check = realloc(buffer, len *= 2)) == NULL) { no_memory(); } else { buffer = check; } } 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 == NULL) { if (skip_dcs(s) != NULL) first = s; } else { if (!strncmp(s, st_input(), (size_t) 2)) { last = s + 2; *last = '\0'; break; } } } input_8bits = save_8bits; if (first == NULL || last == NULL) { fprintf(stderr, "Not a vtXXX font description: %s\n", filename); exit(EXIT_FAILURE); } for (s = buffer; (*s++ = *first++) != '\0';) ; if (LOG_ENABLED && first != NULL) fprintf(log_fp, NOTE_STR "font string %s\n", buffer); font_string = buffer; decode_header(); } int tst_softchars(MENU_ARGS) { /* *INDENT-OFF* */ static MENU my_menu[] = { { "Exit", NULL }, { "Download the soft characters (DECDLD)", tst_DECDLD }, { "Examine the soft characters, one-by-one", tst_display_one }, { "Examine all the soft characters", tst_display_all }, { "Clear the soft characters", tst_cleanup }, { "", NULL } }; /* *INDENT-ON* */ vt_move(1, 1); if (font_string == NULL || *font_string == 0) { printxx("You did not specify a font-file with the -f option\n"); return MENU_HOLD; } do { vt_clear(2); __(title(0), printxx("Soft Character Sets")); __(title(2), println("Choose test type:")); } while (menu(my_menu)); return MENU_NOHOLD; } vttest-20241208/aclocal.m40000644000000000000000000017362614722664666013707 0ustar rootrootdnl $Id: aclocal.m4,v 1.50 2024/11/30 19:38:30 tom Exp $ dnl autoconf macros for vttest - T.E.Dickey dnl --------------------------------------------------------------------------- dnl Copyright: 1997-2023,2024 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 AM_LANGINFO_CODESET version: 7 updated: 2023/01/11 04:05:23 dnl ------------------- dnl Inserted as requested by gettext 0.10.40 dnl File from /usr/share/aclocal dnl codeset.m4 dnl ==================== dnl serial AM1 dnl dnl From Bruno Haible. AC_DEFUN([AM_LANGINFO_CODESET], [ AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, [AC_TRY_LINK([ $ac_includes_default #include ], [char* cs = nl_langinfo(CODESET); (void)cs], am_cv_langinfo_codeset=yes, am_cv_langinfo_codeset=no) ]) if test "$am_cv_langinfo_codeset" = yes; then AC_DEFINE(HAVE_LANGINFO_CODESET, 1, [Define if you have and nl_langinfo(CODESET).]) fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_ACVERSION_CHECK version: 5 updated: 2014/06/04 19:11:49 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], ,[ifdef([AC_AUTOCONF_VERSION],[m4_copy([AC_AUTOCONF_VERSION],[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: 15 updated: 2020/12/31 10:54:15 dnl ------------- dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS dnl $1 = flags to add dnl $2 = 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 (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case "$cf_add_cflags" in (-D*) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test "$cf_fix_cppflags" = yes ; then CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) continue elif test "${cf_tst_cflags}" = "\"'" ; then CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) continue fi ;; esac case "$CPPFLAGS" in (*$cf_add_cflags) ;; (*) case "$cf_add_cflags" in (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags) ;; esac CF_APPEND_TEXT(cf_new_cppflags,$cf_add_cflags) ;; esac ;; (*) CF_APPEND_TEXT(cf_new_cflags,$cf_add_cflags) ;; esac ;; (yes) CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[[^"]]*"'\''//'` test "x${cf_add_cflags}" != "x${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)]) CF_APPEND_TEXT(CFLAGS,$cf_new_cflags) fi if test -n "$cf_new_cppflags" ; then ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)]) CF_APPEND_TEXT(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)]) CF_APPEND_TEXT(EXTRA_CPPFLAGS,$cf_new_extra_cppflags) fi AC_SUBST(EXTRA_CPPFLAGS) ])dnl dnl --------------------------------------------------------------------------- dnl CF_APPEND_CFLAGS version: 3 updated: 2021/09/05 17:25:40 dnl ---------------- dnl Use CF_ADD_CFLAGS after first checking for potential redefinitions. dnl $1 = flags to add dnl $2 = if given makes this macro verbose. define([CF_APPEND_CFLAGS], [ for cf_add_cflags in $1 do case "x$cf_add_cflags" in (x-[[DU]]*) CF_REMOVE_CFLAGS($cf_add_cflags,CFLAGS,[$2]) CF_REMOVE_CFLAGS($cf_add_cflags,CPPFLAGS,[$2]) ;; esac CF_ADD_CFLAGS([$cf_add_cflags],[$2]) done ])dnl dnl --------------------------------------------------------------------------- dnl CF_APPEND_TEXT version: 1 updated: 2017/02/25 18:58:55 dnl -------------- dnl use this macro for appending text without introducing an extra blank at dnl the beginning define([CF_APPEND_TEXT], [ test -n "[$]$1" && $1="[$]$1 " $1="[$]{$1}$2" ])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_ENABLE version: 3 updated: 1999/03/30 17:24:31 dnl ------------- dnl Allow user to enable a normally-off option. AC_DEFUN([CF_ARG_ENABLE], [CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl dnl --------------------------------------------------------------------------- dnl CF_ARG_OPTION version: 5 updated: 2015/05/10 19:52:14 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_C11_NORETURN version: 4 updated: 2023/02/18 17:41:25 dnl --------------- AC_DEFUN([CF_C11_NORETURN], [ AC_MSG_CHECKING(if you want to use C11 _Noreturn feature) CF_ARG_ENABLE(stdnoreturn, [ --enable-stdnoreturn enable C11 _Noreturn feature for diagnostics], [enable_stdnoreturn=yes], [enable_stdnoreturn=no]) AC_MSG_RESULT($enable_stdnoreturn) if test $enable_stdnoreturn = yes; then AC_CACHE_CHECK([for C11 _Noreturn feature], cf_cv_c11_noreturn, [AC_TRY_COMPILE([ $ac_includes_default #include static _Noreturn void giveup(void) { exit(0); } ], [if (feof(stdin)) giveup()], cf_cv_c11_noreturn=yes, cf_cv_c11_noreturn=no) ]) else cf_cv_c11_noreturn=no, fi if test "$cf_cv_c11_noreturn" = yes; then AC_DEFINE(HAVE_STDNORETURN_H, 1,[Define if header is available and working]) AC_DEFINE_UNQUOTED(STDC_NORETURN,_Noreturn,[Define if C11 _Noreturn keyword is supported]) HAVE_STDNORETURN_H=1 else HAVE_STDNORETURN_H=0 fi AC_SUBST(HAVE_STDNORETURN_H) AC_SUBST(STDC_NORETURN) ])dnl dnl --------------------------------------------------------------------------- dnl CF_CC_ENV_FLAGS version: 11 updated: 2023/02/20 11:15:46 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 dnl with options, but eliminates a more common category of user confusion. dnl dnl In particular, it addresses the problem of being able to run the C dnl preprocessor in a consistent manner. dnl dnl Caveat: this also disallows blanks in the pathname for the compiler, but dnl the nuisance of having inconsistent settings for compiler and preprocessor dnl outweighs that limitation. AC_DEFUN([CF_CC_ENV_FLAGS], [ # This should have been defined by AC_PROG_CC : "${CC:=cc}" AC_MSG_CHECKING(\$CFLAGS variable) case "x$CFLAGS" in (*-[[IUD]]*) AC_MSG_RESULT(broken) AC_MSG_WARN(your environment uses the CFLAGS variable to hold CPPFLAGS options) cf_flags="$CFLAGS" CFLAGS= for cf_arg in $cf_flags do CF_ADD_CFLAGS($cf_arg) done ;; (*) AC_MSG_RESULT(ok) ;; esac AC_MSG_CHECKING(\$CC variable) case "$CC" in (*[[\ \ ]]-*) AC_MSG_RESULT(broken) AC_MSG_WARN(your environment uses the CC variable to hold CFLAGS/CPPFLAGS options) # humor him... cf_prog=`echo "$CC" | sed -e 's/ / /g' -e 's/[[ ]]* / /g' -e 's/[[ ]]*[[ ]]-[[^ ]].*//'` cf_flags=`echo "$CC" | sed -e "s%^$cf_prog%%"` CC="$cf_prog" for cf_arg in $cf_flags do case "x$cf_arg" in (x-[[IUDfgOW]]*) CF_ADD_CFLAGS($cf_arg) ;; (*) CC="$CC $cf_arg" ;; esac done CF_VERBOSE(resulting CC: '$CC') CF_VERBOSE(resulting CFLAGS: '$CFLAGS') CF_VERBOSE(resulting CPPFLAGS: '$CPPFLAGS') ;; (*) AC_MSG_RESULT(ok) ;; esac ])dnl dnl --------------------------------------------------------------------------- dnl CF_CHECK_CACHE version: 13 updated: 2020/12/31 10:54:15 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_CHECK_ERRNO version: 14 updated: 2023/02/18 17:41:25 dnl -------------- dnl Check for data that is usually declared in or , e.g., dnl the 'errno' variable. Define a DECL_xxx symbol if we must declare it dnl ourselves. dnl dnl $1 = the name to check dnl $2 = the assumed type AC_DEFUN([CF_CHECK_ERRNO], [ AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[ AC_TRY_COMPILE([ $ac_includes_default #include ], ifelse([$2],,int,[$2]) x = (ifelse([$2],,int,[$2])) $1; (void)x, [cf_cv_dcl_$1=yes], [cf_cv_dcl_$1=no]) ]) if test "$cf_cv_dcl_$1" = no ; then CF_UPPER(cf_result,decl_$1) AC_DEFINE_UNQUOTED($cf_result) fi # It's possible (for near-UNIX clones) that the data doesn't exist CF_CHECK_EXTERN_DATA($1,ifelse([$2],,int,[$2])) ])dnl dnl --------------------------------------------------------------------------- dnl CF_CHECK_EXTERN_DATA version: 5 updated: 2021/09/04 06:35:04 dnl -------------------- dnl Check for existence of external data in the current set of libraries. If dnl we can modify it, it is real enough. dnl $1 = the name to check dnl $2 = its type AC_DEFUN([CF_CHECK_EXTERN_DATA], [ AC_CACHE_CHECK(if external $1 exists, cf_cv_have_$1,[ AC_TRY_LINK([ #undef $1 extern $2 $1; ], [$1 = 2], [cf_cv_have_$1=yes], [cf_cv_have_$1=no]) ]) if test "$cf_cv_have_$1" = yes ; then CF_UPPER(cf_result,have_$1) AC_DEFINE_UNQUOTED($cf_result) fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_CLANG_COMPILER version: 9 updated: 2023/02/18 17:41:25 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])" AC_TRY_COMPILE([],[ #ifdef __clang__ #else #error __clang__ is not defined #endif ],[ifelse([$2],,CLANG_COMPILER,[$2])=yes ],[]) ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2])) fi CLANG_VERSION=none if test "x$ifelse([$2],,CLANG_COMPILER,[$2])" = "xyes" ; then case "$CC" in (c[[1-9]][[0-9]]|*/c[[1-9]][[0-9]]) AC_MSG_WARN(replacing broken compiler alias $CC) CFLAGS="$CFLAGS -std=`echo "$CC" | sed -e 's%.*/%%'`" CC=clang ;; esac AC_MSG_CHECKING(version of $CC) CLANG_VERSION="`$CC --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(CLANG[[^)]]*) //' -e 's/^.*(Debian[[^)]]*) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`" test -z "$CLANG_VERSION" && CLANG_VERSION=unknown AC_MSG_RESULT($CLANG_VERSION) for cf_clang_opt in \ -Qunused-arguments \ -Wno-error=implicit-function-declaration do AC_MSG_CHECKING(if option $cf_clang_opt works) cf_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $cf_clang_opt" AC_TRY_LINK([ #include ],[ printf("hello!\\n");],[ cf_clang_optok=yes],[ cf_clang_optok=no]) AC_MSG_RESULT($cf_clang_optok) CFLAGS="$cf_save_CFLAGS" if test "$cf_clang_optok" = yes; then CF_VERBOSE(adding option $cf_clang_opt) CF_APPEND_TEXT(CFLAGS,$cf_clang_opt) fi done fi ]) dnl --------------------------------------------------------------------------- dnl CF_DISABLE_ECHO version: 14 updated: 2021/09/04 06:35:04 dnl --------------- dnl You can always use "make -n" to see the actual options, but it is 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_ENABLE_WARNINGS version: 9 updated: 2021/01/05 19:40:50 dnl ------------------ dnl Configure-option to enable gcc warnings dnl dnl $1 = extra options to add, if supported dnl $2 = option for checking attributes. By default, this is done when dnl warnings are enabled. For other values: dnl yes: always do this, e.g., to use in generated library-headers dnl no: never do this AC_DEFUN([CF_ENABLE_WARNINGS],[ if test "$GCC" = yes || test "$GXX" = yes then CF_FIX_WARNINGS(CFLAGS) CF_FIX_WARNINGS(CPPFLAGS) CF_FIX_WARNINGS(LDFLAGS) AC_MSG_CHECKING(if you want to turn on gcc warnings) CF_ARG_ENABLE(warnings, [ --enable-warnings test: turn on gcc compiler warnings], [enable_warnings=yes], [enable_warnings=no]) AC_MSG_RESULT($enable_warnings) if test "$enable_warnings" = "yes" then ifelse($2,,[CF_GCC_ATTRIBUTES]) CF_GCC_WARNINGS($1) fi ifelse($2,yes,[CF_GCC_ATTRIBUTES]) fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_FCNTL_VS_IOCTL version: 5 updated: 2022/12/06 16:25:27 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 (BSDs) */ #endif #if HAVE_SYS_IOCTL_H # include /* FIONREAD (other...) */ #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,1,[Define to 1 if we may use FIONREAD]) ])dnl dnl --------------------------------------------------------------------------- dnl CF_FIX_WARNINGS version: 4 updated: 2021/12/16 18:22:31 dnl --------------- dnl Warning flags do not belong in CFLAGS, CPPFLAGS, etc. Any of gcc's dnl "-Werror" flags can interfere with configure-checks. Those go into dnl EXTRA_CFLAGS. dnl dnl $1 = variable name to repair define([CF_FIX_WARNINGS],[ if test "$GCC" = yes || test "$GXX" = yes then case [$]$1 in (*-Werror=*) cf_temp_flags= for cf_temp_scan in [$]$1 do case "x$cf_temp_scan" in (x-Werror=format*) CF_APPEND_TEXT(cf_temp_flags,$cf_temp_scan) ;; (x-Werror=*) CF_APPEND_TEXT(EXTRA_CFLAGS,$cf_temp_scan) ;; (*) CF_APPEND_TEXT(cf_temp_flags,$cf_temp_scan) ;; esac done if test "x[$]$1" != "x$cf_temp_flags" then CF_VERBOSE(repairing $1: [$]$1) $1="$cf_temp_flags" CF_VERBOSE(... fixed [$]$1) CF_VERBOSE(... extra $EXTRA_CFLAGS) fi ;; esac fi AC_SUBST(EXTRA_CFLAGS) ])dnl dnl --------------------------------------------------------------------------- dnl CF_GCC_ATTRIBUTES version: 24 updated: 2021/03/20 12:00:25 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], [AC_REQUIRE([AC_PROG_FGREP])dnl AC_REQUIRE([CF_C11_NORETURN])dnl if test "$GCC" = yes || test "$GXX" = yes then cat > conftest.i < "conftest.$ac_ext" < #include "confdefs.h" #include "conftest.h" #include "conftest.i" #if GCC_PRINTF #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) #else #define GCC_PRINTFLIKE(fmt,var) /*nothing*/ #endif #if GCC_SCANF #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) #else #define GCC_SCANFLIKE(fmt,var) /*nothing*/ #endif extern void wow(char *,...) GCC_SCANFLIKE(1,2); extern GCC_NORETURN void oops(char *,...) GCC_PRINTFLIKE(1,2); extern GCC_NORETURN void foo(void); int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { (void)argc; (void)argv; return 0; } EOF cf_printf_attribute=no cf_scanf_attribute=no for cf_attribute in scanf printf unused noreturn do CF_UPPER(cf_ATTRIBUTE,$cf_attribute) cf_directive="__attribute__(($cf_attribute))" echo "checking for $CC $cf_directive" 1>&AC_FD_CC case "$cf_attribute" in (printf) cf_printf_attribute=yes cat >conftest.h <conftest.h <conftest.h <>confdefs.h case "$cf_attribute" in (noreturn) AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc]) ;; (printf) 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) 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) AC_DEFINE_UNQUOTED(GCC_UNUSED,$cf_directive,[Define to unused-attribute for gcc]) ;; esac fi done else ${FGREP-fgrep} define conftest.i >>confdefs.h fi rm -rf ./conftest* fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_GCC_VERSION version: 9 updated: 2023/03/05 14:30:13 dnl -------------- dnl Find version of gcc, and (because icc/clang pretend to be gcc without being dnl compatible), attempt to determine if icc/clang is actually used. 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/^[[^(]]*([[^)]][[^)]]*) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`" test -z "$GCC_VERSION" && GCC_VERSION=unknown AC_MSG_RESULT($GCC_VERSION) fi CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS) CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS) ])dnl dnl --------------------------------------------------------------------------- dnl CF_GCC_WARNINGS version: 41 updated: 2021/01/01 16:53:59 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 -Winline (usually not worthwhile) 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]) if test "x$have_x" = xyes; then CF_CONST_X_STRING fi cat > "conftest.$ac_ext" <],[ #if __GLIBC__ > 0 && __GLIBC_MINOR__ >= 0 return 0; #elif __NEWLIB__ > 0 && __NEWLIB_MINOR__ >= 0 return 0; #else # error not GNU C library #endif], [cf_cv_gnu_library=yes], [cf_cv_gnu_library=no]) ]) if test x$cf_cv_gnu_library = xyes; then # With glibc 2.19 (13 years after this check was begun), _DEFAULT_SOURCE # was changed to help a little. newlib incorporated the change about 4 # years later. AC_CACHE_CHECK(if _DEFAULT_SOURCE can be used as a basis,cf_cv_gnu_library_219,[ cf_save="$CPPFLAGS" CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE) AC_TRY_COMPILE([#include ],[ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 19) || (__GLIBC__ > 2) return 0; #elif (__NEWLIB__ == 2 && __NEWLIB_MINOR__ >= 4) || (__GLIBC__ > 3) return 0; #else # error GNU C library __GLIBC__.__GLIBC_MINOR__ is too old #endif], [cf_cv_gnu_library_219=yes], [cf_cv_gnu_library_219=no]) CPPFLAGS="$cf_save" ]) if test "x$cf_cv_gnu_library_219" = xyes; then cf_save="$CPPFLAGS" AC_CACHE_CHECK(if _XOPEN_SOURCE=$cf_gnu_xopen_source works with _DEFAULT_SOURCE,cf_cv_gnu_dftsrc_219,[ CF_ADD_CFLAGS(-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=$cf_gnu_xopen_source) AC_TRY_COMPILE([ #include #include ],[ #if (_XOPEN_SOURCE >= $cf_gnu_xopen_source) && (MB_LEN_MAX > 1) return 0; #else # error GNU C library is too old #endif], [cf_cv_gnu_dftsrc_219=yes], [cf_cv_gnu_dftsrc_219=no]) ]) test "x$cf_cv_gnu_dftsrc_219" = "xyes" || CPPFLAGS="$cf_save" else cf_cv_gnu_dftsrc_219=maybe fi if test "x$cf_cv_gnu_dftsrc_219" != xyes; then AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[ AC_TRY_COMPILE([#include ],[ #ifndef _XOPEN_SOURCE #error expected _XOPEN_SOURCE to be defined #endif], [cf_cv_gnu_source=no], [cf_save="$CPPFLAGS" CF_ADD_CFLAGS(-D_GNU_SOURCE) AC_TRY_COMPILE([#include ],[ #ifdef _XOPEN_SOURCE #error expected _XOPEN_SOURCE to be undefined #endif], [cf_cv_gnu_source=no], [cf_cv_gnu_source=yes]) CPPFLAGS="$cf_save" ]) ]) if test "$cf_cv_gnu_source" = yes then AC_CACHE_CHECK(if we should also define _DEFAULT_SOURCE,cf_cv_default_source,[ CF_APPEND_TEXT(CPPFLAGS,-D_GNU_SOURCE) AC_TRY_COMPILE([#include ],[ #ifdef _DEFAULT_SOURCE #error expected _DEFAULT_SOURCE to be undefined #endif], [cf_cv_default_source=no], [cf_cv_default_source=yes]) ]) if test "$cf_cv_default_source" = yes then CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE) fi fi fi fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_INTEL_COMPILER version: 9 updated: 2023/02/18 17:41:25 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 #error __INTEL_COMPILER is not defined #endif ],[ifelse([$2],,INTEL_COMPILER,[$2])=yes cf_save_CFLAGS="$cf_save_CFLAGS -we147" ],[]) ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2])) ;; esac fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_LOCALE version: 7 updated: 2023/01/11 04:05:23 dnl --------- dnl Check if we have setlocale() and its header, dnl The optional parameter $1 tells what to do if we do have locale support. AC_DEFUN([CF_LOCALE], [ AC_MSG_CHECKING(for setlocale()) AC_CACHE_VAL(cf_cv_locale,[ AC_TRY_LINK([ $ac_includes_default #include ], [setlocale(LC_ALL, "")], [cf_cv_locale=yes], [cf_cv_locale=no]) ]) AC_MSG_RESULT($cf_cv_locale) test "$cf_cv_locale" = yes && { ifelse($1,,AC_DEFINE(LOCALE,1,[Define to 1 if we have locale support]),[$1]) } ])dnl dnl --------------------------------------------------------------------------- dnl CF_MAKE_DOCS version: 5 updated: 2021/01/10 16:05:11 dnl ------------ dnl $1 = name(s) to generate rules for dnl $2 = suffix of corresponding manpages used as input. dnl dnl This works best if called at the end of configure.in, following CF_WITH_MAN2HTML 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 <[\$]@ ${GROFF_NOTE}.ps.pdf : ${GROFF_NOTE} ps2pdf [\$]*.ps ${GROFF_NOTE} ${GROFF_NOTE}.$2.ps : ${GROFF_NOTE} [\$](SHELL) -c "tbl [\$]*.$2 | groff -man" >[\$]@ ${GROFF_NOTE} ${GROFF_NOTE}.$2.txt : ${GROFF_NOTE} GROFF_NO_SGR=stupid [\$](SHELL) -c "tbl [\$]*.$2 | nroff -rHY=0 -Tascii -man | col -bx" >[\$]@ ${MAN2HTML_NOTE}.$2.html : ${MAN2HTML_NOTE} ./${MAN2HTML_TEMP} [\$]* $2 man >[\$]@ CF_EOF cf_make_docs=1 fi for cf_name in $1 do cat >>$cf_output <makefile <<'CF_EOF' .PHONY: always DATA=0 always: always.out @echo "** making [$]@ [$](DATA)" once: once.out @echo "** making [$]@ [$](DATA)" always.out: @echo "** making [$]@ [$](DATA)" echo [$](DATA) > [$]@ once.out: @echo "** making [$]@ [$](DATA)" echo [$](DATA) > [$]@ CF_EOF for cf_data in 1 2 3 do ${MAKE:-make} always DATA=$cf_data ${MAKE:-make} once DATA=$cf_data ${MAKE:-make} -t always once if test -f always ; then echo "no (case 1)" > ../conftest.tmp elif test ! -f always.out ; then echo "no (case 2)" > ../conftest.tmp elif test ! -f once.out ; then echo "no (case 3)" > ../conftest.tmp elif ! cmp -s always.out once.out ; then echo "no (case 4)" > ../conftest.tmp diff always.out once.out else cf_check="`cat always.out`" if test "x$cf_check" != "x$cf_data" ; then echo "no (case 5)" > ../conftest.tmp else echo yes > ../conftest.tmp rm -f ./*.out continue fi fi break done ) >&AC_FD_CC 2>&1 cf_cv_make_PHONY="`cat conftest.tmp`" rm -rf conftest* ]) MAKE_NO_PHONY="#" MAKE_PHONY="#" test "x$cf_cv_make_PHONY" = xyes && MAKE_PHONY= test "x$cf_cv_make_PHONY" != xyes && MAKE_NO_PHONY= AC_SUBST(MAKE_NO_PHONY) AC_SUBST(MAKE_PHONY) ])dnl dnl --------------------------------------------------------------------------- dnl CF_MAKE_TAGS version: 6 updated: 2010/10/23 15:52:32 dnl ------------ dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have dnl a monocase filesystem. AC_DEFUN([CF_MAKE_TAGS],[ AC_REQUIRE([CF_MIXEDCASE_FILENAMES]) AC_CHECK_PROGS(CTAGS, exctags ctags) AC_CHECK_PROGS(ETAGS, exetags etags) AC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS:-ctags}, yes, no) if test "$cf_cv_mixedcase" = yes ; then AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS:-etags}, yes, no) 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 AC_SUBST(CTAGS) AC_SUBST(ETAGS) AC_SUBST(MAKE_UPPER_TAGS) AC_SUBST(MAKE_LOWER_TAGS) ])dnl dnl --------------------------------------------------------------------------- dnl CF_MIXEDCASE_FILENAMES version: 9 updated: 2021/01/01 16:53:59 dnl ---------------------- dnl Check if the file-system supports mixed-case filenames. If we're able to dnl create a lowercase name and see it as uppercase, it doesn't support that. AC_DEFUN([CF_MIXEDCASE_FILENAMES], [ AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[ if test "$cross_compiling" = yes ; then case "$target_alias" in (*-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*|darwin*) 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 ]) 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_PATH_SYNTAX version: 19 updated: 2024/08/03 13:08:58 dnl -------------- dnl Check the argument to see that it looks like a pathname. Rewrite it if it dnl begins with one of the prefix/exec_prefix variables, and then again if the dnl result begins with 'NONE'. This is necessary to work around autoconf's dnl delayed evaluation of those symbols. AC_DEFUN([CF_PATH_SYNTAX],[ AC_REQUIRE([CF_GLOB_FULLPATH])dnl if test "x$prefix" != xNONE; then cf_path_syntax="$prefix" else cf_path_syntax="$ac_default_prefix" fi case "x[$]$1" in (x\[$]\(*\)*|x\'*\'*) ;; (x.|x$GLOB_FULLPATH_POSIX|x$GLOB_FULLPATH_OTHER) ;; (x\[$]\{*prefix\}*|x\[$]\{*dir\}*) eval $1="[$]$1" case "x[$]$1" in (xNONE/*) $1=`echo "[$]$1" | sed -e s%NONE%$cf_path_syntax%` ;; esac ;; (xno|xNONE/*) $1=`echo "[$]$1" | sed -e s%NONE%$cf_path_syntax%` ;; (*) ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2) ;; esac ])dnl dnl --------------------------------------------------------------------------- dnl CF_POSIX_C_SOURCE version: 12 updated: 2023/02/18 17:41:25 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], [AC_REQUIRE([CF_POSIX_VISIBLE])dnl if test "$cf_cv_posix_visible" = no; then 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 #error _POSIX_C_SOURCE is not defined #endif], [cf_cv_posix_c_source=no], [cf_want_posix_source=no case .$cf_POSIX_C_SOURCE in (.[[12]]??*) cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" ;; (.2) 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 #error _POSIX_SOURCE is defined #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_APPEND_TEXT(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 #error _POSIX_C_SOURCE is not defined #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 fi # cf_cv_posix_visible ])dnl dnl --------------------------------------------------------------------------- dnl CF_POSIX_VDISABLE version: 8 updated: 2023/01/05 18:56:58 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([ $ac_includes_default #if defined(HAVE_TERMIOS_H) && defined(HAVE_TCGETATTR) #include #endif #if defined(_POSIX_VDISABLE) int main(void) { ${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,1,[Define to 1 if POSIX VDISABLE symbol should be used]) ])dnl dnl --------------------------------------------------------------------------- dnl CF_POSIX_VISIBLE version: 1 updated: 2018/12/31 20:46:17 dnl ---------------- dnl POSIX documents test-macros which an application may set before any system dnl headers are included to make features available. dnl dnl Some BSD platforms (originally FreeBSD, but copied by a few others) dnl diverged from POSIX in 2002 by setting symbols which make all of the most dnl recent features visible in the system header files unless the application dnl overrides the corresponding test-macros. Doing that introduces portability dnl problems. dnl dnl This macro makes a special check for the symbols used for this, to avoid a dnl conflicting definition. AC_DEFUN([CF_POSIX_VISIBLE], [ AC_CACHE_CHECK(if the POSIX test-macros are already defined,cf_cv_posix_visible,[ AC_TRY_COMPILE([#include ],[ #if defined(__POSIX_VISIBLE) && ((__POSIX_VISIBLE - 0L) > 0) \ && defined(__XSI_VISIBLE) && ((__XSI_VISIBLE - 0L) > 0) \ && defined(__BSD_VISIBLE) && ((__BSD_VISIBLE - 0L) > 0) \ && defined(__ISO_C_VISIBLE) && ((__ISO_C_VISIBLE - 0L) > 0) #error conflicting symbols found #endif ],[cf_cv_posix_visible=no],[cf_cv_posix_visible=yes]) ]) ])dnl dnl --------------------------------------------------------------------------- dnl CF_PROG_CC version: 5 updated: 2019/12/31 08:53:54 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],[ CF_ACVERSION_CHECK(2.53, [AC_MSG_WARN(this will incorrectly handle gnatgcc choice) AC_REQUIRE([AC_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_PROG_GROFF version: 3 updated: 2018/01/07 13:16:19 dnl ------------- dnl Check if groff is available, for cases (such as html output) where nroff dnl is not enough. AC_DEFUN([CF_PROG_GROFF],[ AC_PATH_PROG(GROFF_PATH,groff,no) AC_PATH_PROGS(NROFF_PATH,nroff mandoc,no) AC_PATH_PROG(TBL_PATH,tbl,cat) if test "x$GROFF_PATH" = xno then NROFF_NOTE= GROFF_NOTE="#" else NROFF_NOTE="#" GROFF_NOTE= fi AC_SUBST(GROFF_NOTE) AC_SUBST(NROFF_NOTE) ])dnl dnl --------------------------------------------------------------------------- dnl CF_PROG_LINT version: 7 updated: 2024/11/30 14:37:45 dnl ------------ AC_DEFUN([CF_PROG_LINT], [ AC_CHECK_PROGS(LINT, lint cppcheck splint) case "x$LINT" in (xlint|x*/lint) # NetBSD 10 test -z "$LINT_OPTS" && LINT_OPTS="-chapbrxzgFS -v -Ac11" ;; (xcppcheck|x*/cppcheck) test -z "$LINT_OPTS" && LINT_OPTS="--enable=all -D__CPPCHECK__" ;; esac AC_SUBST(LINT_OPTS) AC_SUBST(LINT_LIBS) ])dnl dnl --------------------------------------------------------------------------- dnl CF_REMOVE_CFLAGS version: 3 updated: 2021/09/05 17:25:40 dnl ---------------- dnl Remove a given option from CFLAGS/CPPFLAGS dnl $1 = option to remove dnl $2 = variable to update dnl $3 = nonempty to allow verbose message define([CF_REMOVE_CFLAGS], [ cf_tmp_cflag=`echo "x$1" | sed -e 's/^.//' -e 's/=.*//'` while true do cf_old_cflag=`echo "x[$]$2" | sed -e 's/^.//' -e 's/[[ ]][[ ]]*-/ -/g' -e "s%$cf_tmp_cflag\\(=[[^ ]][[^ ]]*\\)\?%%" -e 's/^[[ ]]*//' -e 's%[[ ]][[ ]]*-D% -D%g' -e 's%[[ ]][[ ]]*-I% -I%g'` test "[$]$2" != "$cf_old_cflag" || break ifelse([$3],,,[CF_VERBOSE(removing old option $1 from $2)]) $2="$cf_old_cflag" done ])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_STRERROR version: 2 updated: 2001/07/11 09:34:49 dnl ----------- dnl Check for strerror(), or it is not found, for the related data. POSIX dnl requires strerror(), so only old systems such as SunOS lack it. AC_DEFUN([CF_STRERROR],[ AC_CHECK_FUNCS(strerror, AC_DEFINE(HAVE_STRERROR),[CF_SYS_ERRLIST]) ])dnl dnl --------------------------------------------------------------------------- dnl CF_SYS_ERRLIST version: 6 updated: 2001/12/30 13:03:23 dnl -------------- dnl Check for declaration of sys_nerr and sys_errlist in one of stdio.h and dnl errno.h. Declaration of sys_errlist on BSD4.4 interferes with our dnl declaration. Reported by Keith Bostic. AC_DEFUN([CF_SYS_ERRLIST], [ CF_CHECK_ERRNO(sys_nerr) CF_CHECK_ERRNO(sys_errlist) ])dnl dnl --------------------------------------------------------------------------- dnl CF_TRY_XOPEN_SOURCE version: 4 updated: 2022/09/10 15:16:16 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(CF__XOPEN_SOURCE_HEAD,CF__XOPEN_SOURCE_BODY, [cf_cv_xopen_source=no], [cf_save="$CPPFLAGS" CF_APPEND_TEXT(CPPFLAGS,-D_XOPEN_SOURCE=$cf_XOPEN_SOURCE) AC_TRY_COMPILE(CF__XOPEN_SOURCE_HEAD,CF__XOPEN_SOURCE_BODY, [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_APPEND_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_WITHOUT_X version: 3 updated: 2021/01/13 16:51:52 dnl ------------ dnl Use this to cancel the check for X headers/libraries which would be pulled dnl in via CF_GCC_WARNINGS. define([CF_WITHOUT_X], AC_DEFUN([AC_PATH_XTRA],[]) AC_DEFUN([CF_SAVE_XTRA_FLAGS],[]) AC_DEFUN([CF_RESTORE_XTRA_FLAGS],[]) AC_DEFUN([CF_CONST_X_STRING],[echo "skipping X-const check";])dnl AC_SUBST(X_CFLAGS) AC_SUBST(X_LIBS) [])dnl dnl --------------------------------------------------------------------------- dnl CF_WITH_MAN2HTML version: 14 updated: 2024/09/09 17:17:46 dnl ---------------- dnl Check for man2html and groff. Prefer man2html over groff, but use groff dnl as a fallback. See dnl dnl https://invisible-island.net/scripts/man2html.html dnl dnl Generate a shell script which hides the differences between the two. dnl dnl We name that "man2html.tmp". dnl dnl The shell script can be removed later, e.g., using "make distclean". AC_DEFUN([CF_WITH_MAN2HTML],[ AC_REQUIRE([CF_PROG_GROFF])dnl AC_REQUIRE([AC_PROG_FGREP])dnl case "x${with_man2html}" in (xno) cf_man2html=no ;; (x|xyes) AC_PATH_PROG(cf_man2html,man2html,no) case "x$cf_man2html" in (x/*) AC_MSG_CHECKING(for the modified Earl Hood script) if ( $cf_man2html -help 2>&1 | grep 'Make an index of headers at the end' >/dev/null ) then cf_man2html_ok=yes else cf_man2html=no cf_man2html_ok=no fi AC_MSG_RESULT($cf_man2html_ok) ;; (*) cf_man2html=no ;; esac esac AC_MSG_CHECKING(for program to convert manpage to html) AC_ARG_WITH(man2html, [[ --with-man2html[=XXX] use XXX rather than groff]], [cf_man2html=$withval], [cf_man2html=$cf_man2html]) cf_with_groff=no case $cf_man2html in (yes) AC_MSG_RESULT(man2html) AC_PATH_PROG(cf_man2html,man2html,no) ;; (no|groff|*/groff*) cf_with_groff=yes cf_man2html=$GROFF_PATH AC_MSG_RESULT($cf_man2html) ;; (*) AC_MSG_RESULT($cf_man2html) ;; esac MAN2HTML_TEMP="man2html.tmp" cat >$MAN2HTML_TEMP <>$MAN2HTML_TEMP <conftest.in <conftest.out cf_man2html_1st="`${FGREP-fgrep} -n MARKER conftest.out |sed -e 's/^[[^0-9]]*://' -e 's/:.*//'`" cf_man2html_top=`expr "$cf_man2html_1st" - 2` cf_man2html_bot="`wc -l conftest.out |sed -e 's/[[^0-9]]//g'`" cf_man2html_bot=`expr "$cf_man2html_bot" - 2 - "$cf_man2html_top"` cf_man2html_top_bot="-topm=$cf_man2html_top -botm=$cf_man2html_bot" AC_MSG_RESULT($cf_man2html_top_bot) AC_MSG_CHECKING(for pagesize to use) for cf_block in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 do cat >>conftest.in <conftest.out cf_man2html_page="`${FGREP-fgrep} -n HEAD1 conftest.out |sed -n '$p' |sed -e 's/^[[^0-9]]*://' -e 's/:.*//'`" test -z "$cf_man2html_page" && cf_man2html_page=99999 test "$cf_man2html_page" -gt 100 && cf_man2html_page=99999 rm -rf conftest* AC_MSG_RESULT($cf_man2html_page) cat >>$MAN2HTML_TEMP < and other headers which use u_int / u_short types cf_XOPEN_SOURCE= CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) ;; (netbsd*) 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[[6-9]]*) # OpenBSD 6.x has broken locale support, both compile-time and runtime. # see https://www.mail-archive.com/bugs@openbsd.org/msg13200.html # Abusing the conformance level is a workaround. AC_MSG_WARN(this system does not provide usable locale support) cf_xopen_source="-D_BSD_SOURCE" cf_XOPEN_SOURCE=700 ;; (openbsd[[4-5]]*) # 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*) # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw ;; (osf[[45]]*) cf_xopen_source="-D_OSF_SOURCE" ;; (nto-qnx*) cf_xopen_source="-D_QNX_SOURCE" ;; (sco*) # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer ;; (solaris2.*) cf_xopen_source="-D__EXTENSIONS__" cf_cv_xopen_source=broken ;; (sysv4.2uw2.*) # Novell/SCO UnixWare 2.x (tested on 2.1.2) cf_XOPEN_SOURCE= cf_POSIX_C_SOURCE= ;; (*) CF_TRY_XOPEN_SOURCE cf_save_xopen_cppflags="$CPPFLAGS" CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) # Some of these niche implementations use copy/paste, double-check... if test "$cf_cv_xopen_source" = no ; then CF_VERBOSE(checking if _POSIX_C_SOURCE interferes with _XOPEN_SOURCE) AC_TRY_COMPILE(CF__XOPEN_SOURCE_HEAD,CF__XOPEN_SOURCE_BODY,,[ AC_MSG_WARN(_POSIX_C_SOURCE definition is not usable) CPPFLAGS="$cf_save_xopen_cppflags"]) fi ;; esac if test -n "$cf_xopen_source" ; then CF_APPEND_CFLAGS($cf_xopen_source,true) 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 #error _XOPEN_SOURCE is not defined #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 #error (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE #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 fi # cf_cv_posix_visible ]) dnl --------------------------------------------------------------------------- dnl CF__XOPEN_SOURCE_BODY version: 2 updated: 2023/02/18 17:41:25 dnl --------------------- dnl body of test when test-compiling for _XOPEN_SOURCE check define([CF__XOPEN_SOURCE_BODY], [ #ifndef _XOPEN_SOURCE #error _XOPEN_SOURCE is not defined #endif ]) dnl --------------------------------------------------------------------------- dnl CF__XOPEN_SOURCE_HEAD version: 2 updated: 2023/02/18 17:41:25 dnl --------------------- dnl headers to include when test-compiling for _XOPEN_SOURCE check define([CF__XOPEN_SOURCE_HEAD], [ $ac_includes_default ]) vttest-20241208/configure0000755000000000000000000066246114722664762013753 0ustar rootroot#! /bin/sh # From configure.in Revision: 1.37 . # Guess values for system-dependent variables and create Makefiles. # Generated by Autoconf 2.52.20240618. # # Copyright 2003-2022,2023 Thomas E. Dickey # 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" # Factoring default headers for most tests. ac_includes_default="\ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif" # 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' runstatedir='${localstatedir}/run' 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 ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst \ | --runs | --run | --ru) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* \ | --runs=* | --run=* | --ru=*) runstatedir=$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 ;; -*dir | -dvi* | -doc* | -html* | -local* | -pdf* | -ps* ) echo "$as_me: WARNING: unsupported option: $ac_option" >&2 ;; -*) { 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 2003-2022,2023 Thomas E. Dickey 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:907: 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:918: 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:926: 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:942: 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:946: 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:952: 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:954: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:956: 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:975: 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:977: 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" 2>/dev/null; echo 1,2,3`,`echo -n testing 2>/dev/null; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C= # newlines do not sed ;-) only broken shells would use this case anyway 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:1006: PATH=\".;.\"; conftest.sh") >&5 (PATH=".;."; conftest.sh) 2>&5 ac_status=$? echo "$as_me:1009: \$? = $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:1037: 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:1047: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_config_sub" >&2;} { (exit 1); exit 1; }; } echo "$as_me:1051: 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:1060: 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:1064: 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:1069: 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:1077: 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:1086: 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:1091: 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:1117: 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:1121: 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:1123: 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 if test -f "$srcdir/config.guess" || test -f "$ac_aux_dir/config.guess" ; then echo "$as_me:1129: checking target system type" >&5 echo $ECHO_N "checking target system type... $ECHO_C" >&6 if test "${ac_cv_target+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_target_alias=$target_alias test "x$ac_cv_target_alias" = "x" && ac_cv_target_alias=$ac_cv_host_alias ac_cv_target=`$ac_config_sub "$ac_cv_target_alias"` || { { echo "$as_me:1138: error: $ac_config_sub $ac_cv_target_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:1143: result: $ac_cv_target" >&5 echo "${ECHO_T}$ac_cv_target" >&6 target=$ac_cv_target target_cpu=`echo "$ac_cv_target" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` target_vendor=`echo "$ac_cv_target" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` target_os=`echo "$ac_cv_target" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` # The aliases save the names the user supplied, while $host etc. # will get canonicalized. test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- 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:1175: 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:1179: 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:1181: 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 # Check whether --with-system-type or --without-system-type was given. if test "${with_system_type+set}" = set; then withval="$with_system_type" { echo "$as_me:1189: WARNING: overriding system type to $withval" >&5 echo "$as_me: WARNING: overriding system type to $withval" >&2;} cf_cv_system_name=$withval host_os=$withval 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:1218: 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:1233: found $ac_dir/$ac_word" >&5 break done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:1241: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:1244: 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:1253: 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:1268: 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:1276: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:1279: 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:1292: 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:1307: found $ac_dir/$ac_word" >&5 break done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:1315: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:1318: 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: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="cc" 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 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:1366: 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:1386: 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:1408: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:1411: 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:1422: 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:1437: found $ac_dir/$ac_word" >&5 break done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:1445: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:1448: 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:1461: 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:1476: 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:1484: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:1487: 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:1499: 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:1504:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo "$2"` { (eval echo "$as_me:1507: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:1510: \$? = $ac_status" >&5 (exit "$ac_status"); } { (eval echo "$as_me:1512: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:1515: \$? = $ac_status" >&5 (exit "$ac_status"); } { (eval echo "$as_me:1517: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:1520: \$? = $ac_status" >&5 (exit "$ac_status"); } cat >"conftest.$ac_ext" <<_ACEOF #line 1524 "configure" #include "confdefs.h" int main (void) { ; 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:1540: 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:1543: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:1546: \$? = $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:1569: 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:1575: 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:1580: 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:1586: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1589: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:1596: 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:1604: 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:1611: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:1613: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:1616: checking for executable suffix" >&5 echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6 if { (eval echo "$as_me:1618: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:1621: \$? = $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:1637: 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:1643: 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:1649: 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 1655 "configure" #include "confdefs.h" int main (void) { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:1667: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1670: \$? = $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:1682: 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:1689: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:1693: 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 1699 "configure" #include "confdefs.h" int main (void) { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:1714: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1717: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:1720: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1723: \$? = $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:1735: 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:1741: 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 1747 "configure" #include "confdefs.h" int main (void) { ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:1759: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1762: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:1765: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1768: \$? = $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:1778: 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:1805: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1808: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:1811: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1814: \$? = $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 1826 "configure" #include "confdefs.h" #include $ac_declaration int main (void) { exit (42); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:1839: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1842: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:1845: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1848: \$? = $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 1858 "configure" #include "confdefs.h" $ac_declaration int main (void) { exit (42); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:1870: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1873: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:1876: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1879: \$? = $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:1909: 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/^[^(]*([^)][^)]*) //' -e 's/^[^0-9.]*//' -e 's/[^0-9.].*//'`" test -z "$GCC_VERSION" && GCC_VERSION=unknown echo "$as_me:1913: result: $GCC_VERSION" >&5 echo "${ECHO_T}$GCC_VERSION" >&6 fi INTEL_COMPILER=no if test "$GCC" = yes ; then case "$host_os" in (linux*|gnu*) echo "$as_me:1922: 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 1927 "configure" #include "confdefs.h" int main (void) { #ifdef __INTEL_COMPILER #else #error __INTEL_COMPILER is not defined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:1944: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1947: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:1950: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:1953: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then INTEL_COMPILER=yes cf_save_CFLAGS="$cf_save_CFLAGS -we147" 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:1964: result: $INTEL_COMPILER" >&5 echo "${ECHO_T}$INTEL_COMPILER" >&6 ;; esac fi CLANG_COMPILER=no if test "$GCC" = yes ; then echo "$as_me:1973: 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" cat >"conftest.$ac_ext" <<_ACEOF #line 1977 "configure" #include "confdefs.h" int main (void) { #ifdef __clang__ #else #error __clang__ is not defined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:1994: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:1997: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:2000: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2003: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then CLANG_COMPILER=yes 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:2013: result: $CLANG_COMPILER" >&5 echo "${ECHO_T}$CLANG_COMPILER" >&6 fi CLANG_VERSION=none if test "x$CLANG_COMPILER" = "xyes" ; then case "$CC" in (c[1-9][0-9]|*/c[1-9][0-9]) { echo "$as_me:2022: WARNING: replacing broken compiler alias $CC" >&5 echo "$as_me: WARNING: replacing broken compiler alias $CC" >&2;} CFLAGS="$CFLAGS -std=`echo "$CC" | sed -e 's%.*/%%'`" CC=clang ;; esac echo "$as_me:2029: checking version of $CC" >&5 echo $ECHO_N "checking version of $CC... $ECHO_C" >&6 CLANG_VERSION="`$CC --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(CLANG[^)]*) //' -e 's/^.*(Debian[^)]*) //' -e 's/^[^0-9.]*//' -e 's/[^0-9.].*//'`" test -z "$CLANG_VERSION" && CLANG_VERSION=unknown echo "$as_me:2033: result: $CLANG_VERSION" >&5 echo "${ECHO_T}$CLANG_VERSION" >&6 for cf_clang_opt in \ -Qunused-arguments \ -Wno-error=implicit-function-declaration do echo "$as_me:2040: checking if option $cf_clang_opt works" >&5 echo $ECHO_N "checking if option $cf_clang_opt works... $ECHO_C" >&6 cf_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $cf_clang_opt" cat >"conftest.$ac_ext" <<_ACEOF #line 2045 "configure" #include "confdefs.h" #include int main (void) { printf("hello!\\n"); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:2059: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:2062: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:2065: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2068: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_clang_optok=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_clang_optok=no fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" echo "$as_me:2079: result: $cf_clang_optok" >&5 echo "${ECHO_T}$cf_clang_optok" >&6 CFLAGS="$cf_save_CFLAGS" if test "$cf_clang_optok" = yes; then test -n "$verbose" && echo " adding option $cf_clang_opt" 1>&6 echo "${as_me:-configure}:2085: testing adding option $cf_clang_opt ..." 1>&5 test -n "$CFLAGS" && CFLAGS="$CFLAGS " CFLAGS="${CFLAGS}$cf_clang_opt" fi done fi echo "$as_me:2094: 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 2102 "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 (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 (void) { 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:2149: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:2152: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:2155: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:2158: \$? = $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:2175: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:2178: 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:2186: checking \$CFLAGS variable" >&5 echo $ECHO_N "checking \$CFLAGS variable... $ECHO_C" >&6 case "x$CFLAGS" in (*-[IUD]*) echo "$as_me:2190: result: broken" >&5 echo "${ECHO_T}broken" >&6 { echo "$as_me:2192: WARNING: your environment uses the CFLAGS variable to hold CPPFLAGS options" >&5 echo "$as_me: WARNING: your environment uses the CFLAGS variable to hold CPPFLAGS options" >&2;} cf_flags="$CFLAGS" CFLAGS= for cf_arg in $cf_flags do cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in $cf_arg do case "$cf_fix_cppflags" in (no) case "$cf_add_cflags" in (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case "$cf_add_cflags" in (-D*) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test "$cf_fix_cppflags" = yes ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in (*$cf_add_cflags) ;; (*) case "$cf_add_cflags" in (-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 test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" ;; esac ;; (*) test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " cf_new_cflags="${cf_new_cflags}$cf_add_cflags" ;; esac ;; (yes) test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[^"]*"'\''//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then test -n "$CFLAGS" && CFLAGS="$CFLAGS " CFLAGS="${CFLAGS}$cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" fi done ;; (*) echo "$as_me:2300: result: ok" >&5 echo "${ECHO_T}ok" >&6 ;; esac echo "$as_me:2305: checking \$CC variable" >&5 echo $ECHO_N "checking \$CC variable... $ECHO_C" >&6 case "$CC" in (*[\ \ ]-*) echo "$as_me:2309: result: broken" >&5 echo "${ECHO_T}broken" >&6 { echo "$as_me:2311: WARNING: your environment uses the CC variable to hold CFLAGS/CPPFLAGS options" >&5 echo "$as_me: WARNING: your environment uses the CC variable to hold CFLAGS/CPPFLAGS options" >&2;} # humor him... cf_prog=`echo "$CC" | sed -e 's/ / /g' -e 's/[ ]* / /g' -e 's/[ ]*[ ]-[^ ].*//'` cf_flags=`echo "$CC" | sed -e "s%^$cf_prog%%"` CC="$cf_prog" for cf_arg in $cf_flags do case "x$cf_arg" in (x-[IUDfgOW]*) cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in $cf_arg do case "$cf_fix_cppflags" in (no) case "$cf_add_cflags" in (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case "$cf_add_cflags" in (-D*) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test "$cf_fix_cppflags" = yes ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in (*$cf_add_cflags) ;; (*) case "$cf_add_cflags" in (-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 test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" ;; esac ;; (*) test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " cf_new_cflags="${cf_new_cflags}$cf_add_cflags" ;; esac ;; (yes) test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[^"]*"'\''//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then test -n "$CFLAGS" && CFLAGS="$CFLAGS " CFLAGS="${CFLAGS}$cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" fi ;; (*) CC="$CC $cf_arg" ;; esac done test -n "$verbose" && echo " resulting CC: '$CC'" 1>&6 echo "${as_me:-configure}:2428: testing resulting CC: '$CC' ..." 1>&5 test -n "$verbose" && echo " resulting CFLAGS: '$CFLAGS'" 1>&6 echo "${as_me:-configure}:2432: testing resulting CFLAGS: '$CFLAGS' ..." 1>&5 test -n "$verbose" && echo " resulting CPPFLAGS: '$CPPFLAGS'" 1>&6 echo "${as_me:-configure}:2436: testing resulting CPPFLAGS: '$CPPFLAGS' ..." 1>&5 ;; (*) echo "$as_me:2440: result: ok" >&5 echo "${ECHO_T}ok" >&6 ;; esac # 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:2457: 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:2506: 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:2517: checking for \".PHONY\" make-support" >&5 echo $ECHO_N "checking for \".PHONY\" make-support... $ECHO_C" >&6 if test "${cf_cv_make_PHONY+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else rm -rf conftest* ( mkdir conftest || exit 1 cd conftest cat >makefile <<'CF_EOF' .PHONY: always DATA=0 always: always.out @echo "** making $@ $(DATA)" once: once.out @echo "** making $@ $(DATA)" always.out: @echo "** making $@ $(DATA)" echo $(DATA) > $@ once.out: @echo "** making $@ $(DATA)" echo $(DATA) > $@ CF_EOF for cf_data in 1 2 3 do ${MAKE:-make} always DATA=$cf_data ${MAKE:-make} once DATA=$cf_data ${MAKE:-make} -t always once if test -f always ; then echo "no (case 1)" > ../conftest.tmp elif test ! -f always.out ; then echo "no (case 2)" > ../conftest.tmp elif test ! -f once.out ; then echo "no (case 3)" > ../conftest.tmp elif ! cmp -s always.out once.out ; then echo "no (case 4)" > ../conftest.tmp diff always.out once.out else cf_check="`cat always.out`" if test "x$cf_check" != "x$cf_data" ; then echo "no (case 5)" > ../conftest.tmp else echo yes > ../conftest.tmp rm -f ./*.out continue fi fi break done ) >&5 2>&1 cf_cv_make_PHONY="`cat conftest.tmp`" rm -rf conftest* fi echo "$as_me:2572: result: $cf_cv_make_PHONY" >&5 echo "${ECHO_T}$cf_cv_make_PHONY" >&6 MAKE_NO_PHONY="#" MAKE_PHONY="#" test "x$cf_cv_make_PHONY" = xyes && MAKE_PHONY= test "x$cf_cv_make_PHONY" != xyes && MAKE_NO_PHONY= echo "$as_me:2579: 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 (*-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*|darwin*) 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:2606: 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:2617: 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:2632: found $ac_dir/$ac_word" >&5 break done fi fi CTAGS=$ac_cv_prog_CTAGS if test -n "$CTAGS"; then echo "$as_me:2640: result: $CTAGS" >&5 echo "${ECHO_T}$CTAGS" >&6 else echo "$as_me:2643: 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:2654: 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:2669: found $ac_dir/$ac_word" >&5 break done fi fi ETAGS=$ac_cv_prog_ETAGS if test -n "$ETAGS"; then echo "$as_me:2677: result: $ETAGS" >&5 echo "${ECHO_T}$ETAGS" >&6 else echo "$as_me:2680: 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:2689: 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:2704: 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:2713: result: $MAKE_LOWER_TAGS" >&5 echo "${ECHO_T}$MAKE_LOWER_TAGS" >&6 else echo "$as_me:2716: 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:2723: 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:2738: 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:2747: result: $MAKE_UPPER_TAGS" >&5 echo "${ECHO_T}$MAKE_UPPER_TAGS" >&6 else echo "$as_me:2750: 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 cppcheck splint 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:2774: 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:2789: found $ac_dir/$ac_word" >&5 break done fi fi LINT=$ac_cv_prog_LINT if test -n "$LINT"; then echo "$as_me:2797: result: $LINT" >&5 echo "${ECHO_T}$LINT" >&6 else echo "$as_me:2800: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$LINT" && break done case "x$LINT" in (xlint|x*/lint) # NetBSD 10 test -z "$LINT_OPTS" && LINT_OPTS="-chapbrxzgFS -v -Ac11" ;; (xcppcheck|x*/cppcheck) test -z "$LINT_OPTS" && LINT_OPTS="--enable=all -D__CPPCHECK__" ;; esac # Extract the first word of "groff", so it can be a program name with args. set dummy groff; ac_word=$2 echo "$as_me:2818: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_GROFF_PATH+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $GROFF_PATH in [\\/]* | ?:[\\/]*) ac_cv_path_GROFF_PATH="$GROFF_PATH" # Let the user override the test with a path. ;; *) 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=. if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_GROFF_PATH="$ac_dir/$ac_word" echo "$as_me:2835: found $ac_dir/$ac_word" >&5 break fi done test -z "$ac_cv_path_GROFF_PATH" && ac_cv_path_GROFF_PATH="no" ;; esac fi GROFF_PATH=$ac_cv_path_GROFF_PATH if test -n "$GROFF_PATH"; then echo "$as_me:2847: result: $GROFF_PATH" >&5 echo "${ECHO_T}$GROFF_PATH" >&6 else echo "$as_me:2850: result: no" >&5 echo "${ECHO_T}no" >&6 fi for ac_prog in nroff mandoc 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:2858: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_NROFF_PATH+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $NROFF_PATH in [\\/]* | ?:[\\/]*) ac_cv_path_NROFF_PATH="$NROFF_PATH" # Let the user override the test with a path. ;; *) 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=. if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_NROFF_PATH="$ac_dir/$ac_word" echo "$as_me:2875: found $ac_dir/$ac_word" >&5 break fi done ;; esac fi NROFF_PATH=$ac_cv_path_NROFF_PATH if test -n "$NROFF_PATH"; then echo "$as_me:2886: result: $NROFF_PATH" >&5 echo "${ECHO_T}$NROFF_PATH" >&6 else echo "$as_me:2889: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$NROFF_PATH" && break done test -n "$NROFF_PATH" || NROFF_PATH="no" # Extract the first word of "tbl", so it can be a program name with args. set dummy tbl; ac_word=$2 echo "$as_me:2899: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_TBL_PATH+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $TBL_PATH in [\\/]* | ?:[\\/]*) ac_cv_path_TBL_PATH="$TBL_PATH" # Let the user override the test with a path. ;; *) 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=. if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_TBL_PATH="$ac_dir/$ac_word" echo "$as_me:2916: found $ac_dir/$ac_word" >&5 break fi done test -z "$ac_cv_path_TBL_PATH" && ac_cv_path_TBL_PATH="cat" ;; esac fi TBL_PATH=$ac_cv_path_TBL_PATH if test -n "$TBL_PATH"; then echo "$as_me:2928: result: $TBL_PATH" >&5 echo "${ECHO_T}$TBL_PATH" >&6 else echo "$as_me:2931: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "x$GROFF_PATH" = xno then NROFF_NOTE= GROFF_NOTE="#" else NROFF_NOTE="#" GROFF_NOTE= fi for ac_prog in ggrep grep 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:2948: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$GREP"; then ac_cv_prog_GREP="$GREP" # 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_GREP="$ac_prog" echo "$as_me:2963: found $ac_dir/$ac_word" >&5 break done fi fi GREP=$ac_cv_prog_GREP if test -n "$GREP"; then echo "$as_me:2971: result: $GREP" >&5 echo "${ECHO_T}$GREP" >&6 else echo "$as_me:2974: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$GREP" && break done test -n "$GREP" || GREP=": " echo "$as_me:2982: checking for fgrep" >&5 echo $ECHO_N "checking for fgrep... $ECHO_C" >&6 if test "${ac_cv_path_FGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else for ac_prog in gfgrep fgrep 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:2994: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_FGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $FGREP in [\\/]* | ?:[\\/]*) ac_cv_path_FGREP="$FGREP" # Let the user override the test with a path. ;; *) 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=. if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_FGREP="$ac_dir/$ac_word" echo "$as_me:3011: found $ac_dir/$ac_word" >&5 break fi done ;; esac fi FGREP=$ac_cv_path_FGREP if test -n "$FGREP"; then echo "$as_me:3022: result: $FGREP" >&5 echo "${ECHO_T}$FGREP" >&6 else echo "$as_me:3025: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$FGREP" && break done test -n "$FGREP" || FGREP=": " test "x$ac_cv_path_FGREP" = "x:" && { { echo "$as_me:3033: error: cannot find workable fgrep" >&5 echo "$as_me: error: cannot find workable fgrep" >&2;} { (exit 1); exit 1; }; } fi fi echo "$as_me:3038: result: $ac_cv_path_FGREP" >&5 echo "${ECHO_T}$ac_cv_path_FGREP" >&6 FGREP="$ac_cv_path_FGREP" case "$cf_cv_system_name" in (cygwin*|msys*|mingw32*|mingw64|os2*) GLOB_FULLPATH_POSIX='/*' GLOB_FULLPATH_OTHER='[a-zA-Z]:[\\/]*' ;; (*) GLOB_FULLPATH_POSIX='/*' GLOB_FULLPATH_OTHER=$GLOB_FULLPATH_POSIX ;; esac case "x${with_man2html}" in (xno) cf_man2html=no ;; (x|xyes) # Extract the first word of "man2html", so it can be a program name with args. set dummy man2html; ac_word=$2 echo "$as_me:3060: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_cf_man2html+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $cf_man2html in [\\/]* | ?:[\\/]*) ac_cv_path_cf_man2html="$cf_man2html" # Let the user override the test with a path. ;; *) 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=. if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_cf_man2html="$ac_dir/$ac_word" echo "$as_me:3077: found $ac_dir/$ac_word" >&5 break fi done test -z "$ac_cv_path_cf_man2html" && ac_cv_path_cf_man2html="no" ;; esac fi cf_man2html=$ac_cv_path_cf_man2html if test -n "$cf_man2html"; then echo "$as_me:3089: result: $cf_man2html" >&5 echo "${ECHO_T}$cf_man2html" >&6 else echo "$as_me:3092: result: no" >&5 echo "${ECHO_T}no" >&6 fi case "x$cf_man2html" in (x/*) echo "$as_me:3098: checking for the modified Earl Hood script" >&5 echo $ECHO_N "checking for the modified Earl Hood script... $ECHO_C" >&6 if ( $cf_man2html -help 2>&1 | grep 'Make an index of headers at the end' >/dev/null ) then cf_man2html_ok=yes else cf_man2html=no cf_man2html_ok=no fi echo "$as_me:3107: result: $cf_man2html_ok" >&5 echo "${ECHO_T}$cf_man2html_ok" >&6 ;; (*) cf_man2html=no ;; esac esac echo "$as_me:3116: checking for program to convert manpage to html" >&5 echo $ECHO_N "checking for program to convert manpage to html... $ECHO_C" >&6 # Check whether --with-man2html or --without-man2html was given. if test "${with_man2html+set}" = set; then withval="$with_man2html" cf_man2html=$withval else cf_man2html=$cf_man2html fi; cf_with_groff=no case $cf_man2html in (yes) echo "$as_me:3131: result: man2html" >&5 echo "${ECHO_T}man2html" >&6 # Extract the first word of "man2html", so it can be a program name with args. set dummy man2html; ac_word=$2 echo "$as_me:3135: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_cf_man2html+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $cf_man2html in [\\/]* | ?:[\\/]*) ac_cv_path_cf_man2html="$cf_man2html" # Let the user override the test with a path. ;; *) 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=. if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_cf_man2html="$ac_dir/$ac_word" echo "$as_me:3152: found $ac_dir/$ac_word" >&5 break fi done test -z "$ac_cv_path_cf_man2html" && ac_cv_path_cf_man2html="no" ;; esac fi cf_man2html=$ac_cv_path_cf_man2html if test -n "$cf_man2html"; then echo "$as_me:3164: result: $cf_man2html" >&5 echo "${ECHO_T}$cf_man2html" >&6 else echo "$as_me:3167: result: no" >&5 echo "${ECHO_T}no" >&6 fi ;; (no|groff|*/groff*) cf_with_groff=yes cf_man2html=$GROFF_PATH echo "$as_me:3175: result: $cf_man2html" >&5 echo "${ECHO_T}$cf_man2html" >&6 ;; (*) echo "$as_me:3179: result: $cf_man2html" >&5 echo "${ECHO_T}$cf_man2html" >&6 ;; esac MAN2HTML_TEMP="man2html.tmp" cat >$MAN2HTML_TEMP <>$MAN2HTML_TEMP <&5 echo $ECHO_N "checking if nroff is really groff... $ECHO_C" >&6 cf_check_groff="`$NROFF_PATH --version 2>/dev/null | grep groff`" test -n "$cf_check_groff" && cf_check_groff=yes test -n "$cf_check_groff" || cf_check_groff=no echo "$as_me:3225: result: $cf_check_groff" >&5 echo "${ECHO_T}$cf_check_groff" >&6 test "x$cf_check_groff" = xyes && NROFF_OPTS="-rHY=0" fi MAN2HTML_NOTE="" if test "x$prefix" != xNONE; then cf_path_syntax="$prefix" else cf_path_syntax="$ac_default_prefix" fi case "x$cf_man2html" in (x\$\(*\)*|x\'*\'*) ;; (x.|x$GLOB_FULLPATH_POSIX|x$GLOB_FULLPATH_OTHER) ;; (x\$\{*prefix\}*|x\$\{*dir\}*) eval cf_man2html="$cf_man2html" case "x$cf_man2html" in (xNONE/*) cf_man2html=`echo "$cf_man2html" | sed -e s%NONE%$cf_path_syntax%` ;; esac ;; (xno|xNONE/*) cf_man2html=`echo "$cf_man2html" | sed -e s%NONE%$cf_path_syntax%` ;; (*) { { echo "$as_me:3254: error: expected a pathname, not \"$cf_man2html\"" >&5 echo "$as_me: error: expected a pathname, not \"$cf_man2html\"" >&2;} { (exit 1); exit 1; }; } ;; esac MAN2HTML_PATH="$cf_man2html" echo "$as_me:3261: checking for $cf_man2html top/bottom margins" >&5 echo $ECHO_N "checking for $cf_man2html top/bottom margins... $ECHO_C" >&6 # for this example, expect 3 lines of content, the remainder is head/foot cat >conftest.in <conftest.out cf_man2html_1st="`${FGREP-fgrep} -n MARKER conftest.out |sed -e 's/^[^0-9]*://' -e 's/:.*//'`" cf_man2html_top=`expr "$cf_man2html_1st" - 2` cf_man2html_bot="`wc -l conftest.out |sed -e 's/[^0-9]//g'`" cf_man2html_bot=`expr "$cf_man2html_bot" - 2 - "$cf_man2html_top"` cf_man2html_top_bot="-topm=$cf_man2html_top -botm=$cf_man2html_bot" echo "$as_me:3279: result: $cf_man2html_top_bot" >&5 echo "${ECHO_T}$cf_man2html_top_bot" >&6 echo "$as_me:3282: checking for pagesize to use" >&5 echo $ECHO_N "checking for pagesize to use... $ECHO_C" >&6 for cf_block in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 do cat >>conftest.in <conftest.out cf_man2html_page="`${FGREP-fgrep} -n HEAD1 conftest.out |sed -n '$p' |sed -e 's/^[^0-9]*://' -e 's/:.*//'`" test -z "$cf_man2html_page" && cf_man2html_page=99999 test "$cf_man2html_page" -gt 100 && cf_man2html_page=99999 rm -rf conftest* echo "$as_me:3307: result: $cf_man2html_page" >&5 echo "${ECHO_T}$cf_man2html_page" >&6 cat >>$MAN2HTML_TEMP <&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:3360: result: $enableval" >&5 echo "${ECHO_T}$enableval" >&6 echo "$as_me:3363: checking if you want to use C11 _Noreturn feature" >&5 echo $ECHO_N "checking if you want to use C11 _Noreturn feature... $ECHO_C" >&6 # Check whether --enable-stdnoreturn or --disable-stdnoreturn was given. if test "${enable_stdnoreturn+set}" = set; then enableval="$enable_stdnoreturn" test "$enableval" != yes && enableval=no if test "$enableval" != "no" ; then enable_stdnoreturn=yes else enable_stdnoreturn=no fi else enableval=no enable_stdnoreturn=no fi; echo "$as_me:3380: result: $enable_stdnoreturn" >&5 echo "${ECHO_T}$enable_stdnoreturn" >&6 if test $enable_stdnoreturn = yes; then echo "$as_me:3384: checking for C11 _Noreturn feature" >&5 echo $ECHO_N "checking for C11 _Noreturn feature... $ECHO_C" >&6 if test "${cf_cv_c11_noreturn+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 3390 "configure" #include "confdefs.h" $ac_includes_default #include static _Noreturn void giveup(void) { exit(0); } int main (void) { if (feof(stdin)) giveup() ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:3406: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:3409: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:3412: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3415: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_c11_noreturn=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_c11_noreturn=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:3426: result: $cf_cv_c11_noreturn" >&5 echo "${ECHO_T}$cf_cv_c11_noreturn" >&6 else cf_cv_c11_noreturn=no, fi if test "$cf_cv_c11_noreturn" = yes; then cat >>confdefs.h <<\EOF #define HAVE_STDNORETURN_H 1 EOF cat >>confdefs.h <&6 echo "${as_me:-configure}:3482: testing repairing CFLAGS: $CFLAGS ..." 1>&5 CFLAGS="$cf_temp_flags" test -n "$verbose" && echo " ... fixed $CFLAGS" 1>&6 echo "${as_me:-configure}:3487: testing ... fixed $CFLAGS ..." 1>&5 test -n "$verbose" && echo " ... extra $EXTRA_CFLAGS" 1>&6 echo "${as_me:-configure}:3491: testing ... extra $EXTRA_CFLAGS ..." 1>&5 fi ;; esac fi if test "$GCC" = yes || test "$GXX" = yes then case $CPPFLAGS in (*-Werror=*) cf_temp_flags= for cf_temp_scan in $CPPFLAGS do case "x$cf_temp_scan" in (x-Werror=format*) test -n "$cf_temp_flags" && cf_temp_flags="$cf_temp_flags " cf_temp_flags="${cf_temp_flags}$cf_temp_scan" ;; (x-Werror=*) test -n "$EXTRA_CFLAGS" && EXTRA_CFLAGS="$EXTRA_CFLAGS " EXTRA_CFLAGS="${EXTRA_CFLAGS}$cf_temp_scan" ;; (*) test -n "$cf_temp_flags" && cf_temp_flags="$cf_temp_flags " cf_temp_flags="${cf_temp_flags}$cf_temp_scan" ;; esac done if test "x$CPPFLAGS" != "x$cf_temp_flags" then test -n "$verbose" && echo " repairing CPPFLAGS: $CPPFLAGS" 1>&6 echo "${as_me:-configure}:3530: testing repairing CPPFLAGS: $CPPFLAGS ..." 1>&5 CPPFLAGS="$cf_temp_flags" test -n "$verbose" && echo " ... fixed $CPPFLAGS" 1>&6 echo "${as_me:-configure}:3535: testing ... fixed $CPPFLAGS ..." 1>&5 test -n "$verbose" && echo " ... extra $EXTRA_CFLAGS" 1>&6 echo "${as_me:-configure}:3539: testing ... extra $EXTRA_CFLAGS ..." 1>&5 fi ;; esac fi if test "$GCC" = yes || test "$GXX" = yes then case $LDFLAGS in (*-Werror=*) cf_temp_flags= for cf_temp_scan in $LDFLAGS do case "x$cf_temp_scan" in (x-Werror=format*) test -n "$cf_temp_flags" && cf_temp_flags="$cf_temp_flags " cf_temp_flags="${cf_temp_flags}$cf_temp_scan" ;; (x-Werror=*) test -n "$EXTRA_CFLAGS" && EXTRA_CFLAGS="$EXTRA_CFLAGS " EXTRA_CFLAGS="${EXTRA_CFLAGS}$cf_temp_scan" ;; (*) test -n "$cf_temp_flags" && cf_temp_flags="$cf_temp_flags " cf_temp_flags="${cf_temp_flags}$cf_temp_scan" ;; esac done if test "x$LDFLAGS" != "x$cf_temp_flags" then test -n "$verbose" && echo " repairing LDFLAGS: $LDFLAGS" 1>&6 echo "${as_me:-configure}:3578: testing repairing LDFLAGS: $LDFLAGS ..." 1>&5 LDFLAGS="$cf_temp_flags" test -n "$verbose" && echo " ... fixed $LDFLAGS" 1>&6 echo "${as_me:-configure}:3583: testing ... fixed $LDFLAGS ..." 1>&5 test -n "$verbose" && echo " ... extra $EXTRA_CFLAGS" 1>&6 echo "${as_me:-configure}:3587: testing ... extra $EXTRA_CFLAGS ..." 1>&5 fi ;; esac fi echo "$as_me:3594: checking if you want to turn on gcc warnings" >&5 echo $ECHO_N "checking if you want to turn on gcc warnings... $ECHO_C" >&6 # Check whether --enable-warnings or --disable-warnings was given. if test "${enable_warnings+set}" = set; then enableval="$enable_warnings" test "$enableval" != yes && enableval=no if test "$enableval" != "no" ; then enable_warnings=yes else enable_warnings=no fi else enableval=no enable_warnings=no fi; echo "$as_me:3611: result: $enable_warnings" >&5 echo "${ECHO_T}$enable_warnings" >&6 if test "$enable_warnings" = "yes" then if test "$GCC" = yes || test "$GXX" = yes then cat > conftest.i <&5 echo "$as_me: checking for $CC __attribute__ directives..." >&6;} cat > "conftest.$ac_ext" < #include "confdefs.h" #include "conftest.h" #include "conftest.i" #if GCC_PRINTF #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) #else #define GCC_PRINTFLIKE(fmt,var) /*nothing*/ #endif #if GCC_SCANF #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) #else #define GCC_SCANFLIKE(fmt,var) /*nothing*/ #endif extern void wow(char *,...) GCC_SCANFLIKE(1,2); extern GCC_NORETURN void oops(char *,...) GCC_PRINTFLIKE(1,2); extern GCC_NORETURN void foo(void); int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) { (void)argc; (void)argv; return 0; } EOF cf_printf_attribute=no cf_scanf_attribute=no for cf_attribute in scanf printf unused noreturn do cf_ATTRIBUTE=`echo "$cf_attribute" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` cf_directive="__attribute__(($cf_attribute))" echo "checking for $CC $cf_directive" 1>&5 case "$cf_attribute" in (printf) cf_printf_attribute=yes cat >conftest.h <conftest.h <conftest.h <&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:3690: \$? = $ac_status" >&5 (exit "$ac_status"); }; then test -n "$verbose" && echo "$as_me:3692: result: ... $cf_attribute" >&5 echo "${ECHO_T}... $cf_attribute" >&6 cat conftest.h >>confdefs.h case "$cf_attribute" in (noreturn) 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 if test "x$have_x" = xyes; then echo "skipping X-const check"; fi cat > "conftest.$ac_ext" <&5 echo "$as_me: checking for $CC warning options..." >&6;} cf_save_CFLAGS="$CFLAGS" EXTRA_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:3785: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:3788: \$? = $ac_status" >&5 (exit "$ac_status"); }; then test -n "$verbose" && echo "$as_me:3790: 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 && test "$GCC_VERSION" != "unknown" then { echo "$as_me:3798: checking for $CC warning options..." >&5 echo "$as_me: checking for $CC warning options..." >&6;} cf_save_CFLAGS="$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 Wno-inline $cf_gcc_warnings $cf_warn_CONST do CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" if { (eval echo "$as_me:3821: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:3824: \$? = $ac_status" >&5 (exit "$ac_status"); }; then test -n "$verbose" && echo "$as_me:3826: result: ... -$cf_opt" >&5 echo "${ECHO_T}... -$cf_opt" >&6 case "$cf_opt" in (Winline) case "$GCC_VERSION" in ([34].*) test -n "$verbose" && echo " feature is broken in gcc $GCC_VERSION" 1>&6 echo "${as_me:-configure}:3834: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 continue;; esac ;; (Wpointer-arith) case "$GCC_VERSION" in ([12].*) test -n "$verbose" && echo " feature is broken in gcc $GCC_VERSION" 1>&6 echo "${as_me:-configure}:3844: 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 echo "$as_me:3861: checking if the POSIX test-macros are already defined" >&5 echo $ECHO_N "checking if the POSIX test-macros are already defined... $ECHO_C" >&6 if test "${cf_cv_posix_visible+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 3868 "configure" #include "confdefs.h" #include int main (void) { #if defined(__POSIX_VISIBLE) && ((__POSIX_VISIBLE - 0L) > 0) \ && defined(__XSI_VISIBLE) && ((__XSI_VISIBLE - 0L) > 0) \ && defined(__BSD_VISIBLE) && ((__BSD_VISIBLE - 0L) > 0) \ && defined(__ISO_C_VISIBLE) && ((__ISO_C_VISIBLE - 0L) > 0) #error conflicting symbols found #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:3887: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:3890: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:3893: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3896: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_posix_visible=no else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_posix_visible=yes fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:3907: result: $cf_cv_posix_visible" >&5 echo "${ECHO_T}$cf_cv_posix_visible" >&6 if test "$cf_cv_posix_visible" = no; then cf_XOPEN_SOURCE=500 cf_POSIX_C_SOURCE=199506L cf_xopen_source= case "$host_os" in (aix[4-7]*) cf_xopen_source="-D_ALL_SOURCE" ;; (darwin[0-8].*) cf_xopen_source="-D_APPLE_C_SOURCE" ;; (darwin*) cf_xopen_source="-D_DARWIN_C_SOURCE" cf_XOPEN_SOURCE= ;; (freebsd*|dragonfly*|midnightbsd*) # 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*) cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500" ;; (hpux*) cf_xopen_source="-D_HPUX_SOURCE" ;; (irix[56].*) cf_xopen_source="-D_SGI_SOURCE" cf_XOPEN_SOURCE= ;; (linux*gnu|linux*gnuabi64|linux*gnuabin32|linux*gnueabi|linux*gnueabihf|linux*gnux32|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin|msys|mingw*|linux*uclibc) cf_gnu_xopen_source=$cf_XOPEN_SOURCE echo "$as_me:3949: checking if this is the GNU C library" >&5 echo $ECHO_N "checking if this is the GNU C library... $ECHO_C" >&6 if test "${cf_cv_gnu_library+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 3956 "configure" #include "confdefs.h" #include int main (void) { #if __GLIBC__ > 0 && __GLIBC_MINOR__ >= 0 return 0; #elif __NEWLIB__ > 0 && __NEWLIB_MINOR__ >= 0 return 0; #else # error not GNU C library #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:3975: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:3978: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:3981: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:3984: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_gnu_library=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_gnu_library=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:3995: result: $cf_cv_gnu_library" >&5 echo "${ECHO_T}$cf_cv_gnu_library" >&6 if test x$cf_cv_gnu_library = xyes; then # With glibc 2.19 (13 years after this check was begun), _DEFAULT_SOURCE # was changed to help a little. newlib incorporated the change about 4 # years later. echo "$as_me:4003: checking if _DEFAULT_SOURCE can be used as a basis" >&5 echo $ECHO_N "checking if _DEFAULT_SOURCE can be used as a basis... $ECHO_C" >&6 if test "${cf_cv_gnu_library_219+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cf_save="$CPPFLAGS" test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}-D_DEFAULT_SOURCE" cat >"conftest.$ac_ext" <<_ACEOF #line 4015 "configure" #include "confdefs.h" #include int main (void) { #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 19) || (__GLIBC__ > 2) return 0; #elif (__NEWLIB__ == 2 && __NEWLIB_MINOR__ >= 4) || (__GLIBC__ > 3) return 0; #else # error GNU C library __GLIBC__.__GLIBC_MINOR__ is too old #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:4034: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:4037: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:4040: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4043: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_gnu_library_219=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_gnu_library_219=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" CPPFLAGS="$cf_save" fi echo "$as_me:4055: result: $cf_cv_gnu_library_219" >&5 echo "${ECHO_T}$cf_cv_gnu_library_219" >&6 if test "x$cf_cv_gnu_library_219" = xyes; then cf_save="$CPPFLAGS" echo "$as_me:4060: checking if _XOPEN_SOURCE=$cf_gnu_xopen_source works with _DEFAULT_SOURCE" >&5 echo $ECHO_N "checking if _XOPEN_SOURCE=$cf_gnu_xopen_source works with _DEFAULT_SOURCE... $ECHO_C" >&6 if test "${cf_cv_gnu_dftsrc_219+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=$cf_gnu_xopen_source do case "$cf_fix_cppflags" in (no) case "$cf_add_cflags" in (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case "$cf_add_cflags" in (-D*) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test "$cf_fix_cppflags" = yes ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in (*$cf_add_cflags) ;; (*) case "$cf_add_cflags" in (-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 test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" ;; esac ;; (*) test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " cf_new_cflags="${cf_new_cflags}$cf_add_cflags" ;; esac ;; (yes) test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[^"]*"'\''//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then test -n "$CFLAGS" && CFLAGS="$CFLAGS " CFLAGS="${CFLAGS}$cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" fi cat >"conftest.$ac_ext" <<_ACEOF #line 4165 "configure" #include "confdefs.h" #include #include int main (void) { #if (_XOPEN_SOURCE >= $cf_gnu_xopen_source) && (MB_LEN_MAX > 1) return 0; #else # error GNU C library is too old #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:4185: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:4188: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:4191: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4194: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_gnu_dftsrc_219=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_gnu_dftsrc_219=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:4205: result: $cf_cv_gnu_dftsrc_219" >&5 echo "${ECHO_T}$cf_cv_gnu_dftsrc_219" >&6 test "x$cf_cv_gnu_dftsrc_219" = "xyes" || CPPFLAGS="$cf_save" else cf_cv_gnu_dftsrc_219=maybe fi if test "x$cf_cv_gnu_dftsrc_219" != xyes; then echo "$as_me:4214: 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 4221 "configure" #include "confdefs.h" #include int main (void) { #ifndef _XOPEN_SOURCE #error expected _XOPEN_SOURCE to be defined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:4236: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:4239: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:4242: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4245: \$? = $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" cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in -D_GNU_SOURCE do case "$cf_fix_cppflags" in (no) case "$cf_add_cflags" in (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case "$cf_add_cflags" in (-D*) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test "$cf_fix_cppflags" = yes ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in (*$cf_add_cflags) ;; (*) case "$cf_add_cflags" in (-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 test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" ;; esac ;; (*) test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " cf_new_cflags="${cf_new_cflags}$cf_add_cflags" ;; esac ;; (yes) test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[^"]*"'\''//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then test -n "$CFLAGS" && CFLAGS="$CFLAGS " CFLAGS="${CFLAGS}$cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" fi cat >"conftest.$ac_ext" <<_ACEOF #line 4352 "configure" #include "confdefs.h" #include int main (void) { #ifdef _XOPEN_SOURCE #error expected _XOPEN_SOURCE to be undefined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:4367: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:4370: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:4373: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4376: \$? = $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:4391: result: $cf_cv_gnu_source" >&5 echo "${ECHO_T}$cf_cv_gnu_source" >&6 if test "$cf_cv_gnu_source" = yes then echo "$as_me:4396: checking if we should also define _DEFAULT_SOURCE" >&5 echo $ECHO_N "checking if we should also define _DEFAULT_SOURCE... $ECHO_C" >&6 if test "${cf_cv_default_source+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}-D_GNU_SOURCE" cat >"conftest.$ac_ext" <<_ACEOF #line 4406 "configure" #include "confdefs.h" #include int main (void) { #ifdef _DEFAULT_SOURCE #error expected _DEFAULT_SOURCE to be undefined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:4421: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:4424: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:4427: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4430: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_default_source=no else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_default_source=yes fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:4441: result: $cf_cv_default_source" >&5 echo "${ECHO_T}$cf_cv_default_source" >&6 if test "$cf_cv_default_source" = yes then test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}-D_DEFAULT_SOURCE" fi fi fi fi ;; linux*musl) cf_xopen_source="-D_BSD_SOURCE" ;; (minix*) cf_xopen_source="-D_NETBSD_SOURCE" # POSIX.1-2001 features are ifdef'd with this... ;; (mirbsd*) # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks and other headers which use u_int / u_short types cf_XOPEN_SOURCE= if test "$cf_cv_posix_visible" = no; then 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:4481: 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}:4487: testing if the symbol is already defined go no further ..." 1>&5 cat >"conftest.$ac_ext" <<_ACEOF #line 4490 "configure" #include "confdefs.h" #include int main (void) { #ifndef _POSIX_C_SOURCE #error _POSIX_C_SOURCE is not defined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:4505: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:4508: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:4511: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4514: \$? = $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 (.[12]??*) cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" ;; (.2) 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 4535 "configure" #include "confdefs.h" #include int main (void) { #ifdef _POSIX_SOURCE #error _POSIX_SOURCE is defined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:4550: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:4553: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:4556: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4559: \$? = $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}:4570: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 CFLAGS="$cf_trim_CFLAGS" CPPFLAGS="$cf_trim_CPPFLAGS" test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_cv_posix_c_source" echo "${as_me:-configure}:4578: testing if the second compile does not leave our definition intact error ..." 1>&5 cat >"conftest.$ac_ext" <<_ACEOF #line 4581 "configure" #include "confdefs.h" #include int main (void) { #ifndef _POSIX_C_SOURCE #error _POSIX_C_SOURCE is not defined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:4596: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:4599: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:4602: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4605: \$? = $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:4621: 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 (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case "$cf_add_cflags" in (-D*) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test "$cf_fix_cppflags" = yes ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in (*$cf_add_cflags) ;; (*) case "$cf_add_cflags" in (-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 test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" ;; esac ;; (*) test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " cf_new_cflags="${cf_new_cflags}$cf_add_cflags" ;; esac ;; (yes) test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[^"]*"'\''//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then test -n "$CFLAGS" && CFLAGS="$CFLAGS " CFLAGS="${CFLAGS}$cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" fi fi fi # cf_cv_posix_visible ;; (netbsd*) 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[6-9]*) # OpenBSD 6.x has broken locale support, both compile-time and runtime. # see https://www.mail-archive.com/bugs@openbsd.org/msg13200.html # Abusing the conformance level is a workaround. { echo "$as_me:4738: WARNING: this system does not provide usable locale support" >&5 echo "$as_me: WARNING: this system does not provide usable locale support" >&2;} cf_xopen_source="-D_BSD_SOURCE" cf_XOPEN_SOURCE=700 ;; (openbsd[4-5]*) # 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*) # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw ;; (osf[45]*) cf_xopen_source="-D_OSF_SOURCE" ;; (nto-qnx*) cf_xopen_source="-D_QNX_SOURCE" ;; (sco*) # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer ;; (solaris2.*) cf_xopen_source="-D__EXTENSIONS__" cf_cv_xopen_source=broken ;; (sysv4.2uw2.*) # Novell/SCO UnixWare 2.x (tested on 2.1.2) cf_XOPEN_SOURCE= cf_POSIX_C_SOURCE= ;; (*) echo "$as_me:4770: 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 4777 "configure" #include "confdefs.h" $ac_includes_default int main (void) { #ifndef _XOPEN_SOURCE #error _XOPEN_SOURCE is not defined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:4795: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:4798: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:4801: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4804: \$? = $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" test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}-D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" cat >"conftest.$ac_ext" <<_ACEOF #line 4816 "configure" #include "confdefs.h" $ac_includes_default int main (void) { #ifndef _XOPEN_SOURCE #error _XOPEN_SOURCE is not defined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:4834: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:4837: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:4840: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:4843: \$? = $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:4858: 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" for cf_add_cflags in $cf_temp_xopen_source do case "x$cf_add_cflags" in (x-[DU]*) cf_tmp_cflag=`echo "x$cf_add_cflags" | sed -e 's/^.//' -e 's/=.*//'` while true do cf_old_cflag=`echo "x$CFLAGS" | sed -e 's/^.//' -e 's/[ ][ ]*-/ -/g' -e "s%$cf_tmp_cflag\\(=[^ ][^ ]*\\)\?%%" -e 's/^[ ]*//' -e 's%[ ][ ]*-D% -D%g' -e 's%[ ][ ]*-I% -I%g'` test "$CFLAGS" != "$cf_old_cflag" || break CFLAGS="$cf_old_cflag" done cf_tmp_cflag=`echo "x$cf_add_cflags" | sed -e 's/^.//' -e 's/=.*//'` while true do cf_old_cflag=`echo "x$CPPFLAGS" | sed -e 's/^.//' -e 's/[ ][ ]*-/ -/g' -e "s%$cf_tmp_cflag\\(=[^ ][^ ]*\\)\?%%" -e 's/^[ ]*//' -e 's%[ ][ ]*-D% -D%g' -e 's%[ ][ ]*-I% -I%g'` test "$CPPFLAGS" != "$cf_old_cflag" || break CPPFLAGS="$cf_old_cflag" done ;; esac cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in $cf_add_cflags do case "$cf_fix_cppflags" in (no) case "$cf_add_cflags" in (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case "$cf_add_cflags" in (-D*) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test "$cf_fix_cppflags" = yes ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in (*$cf_add_cflags) ;; (*) case "$cf_add_cflags" in (-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 test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" ;; esac ;; (*) test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " cf_new_cflags="${cf_new_cflags}$cf_add_cflags" ;; esac ;; (yes) test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[^"]*"'\''//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then test -n "$CFLAGS" && CFLAGS="$CFLAGS " CFLAGS="${CFLAGS}$cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" fi done fi cf_save_xopen_cppflags="$CPPFLAGS" if test "$cf_cv_posix_visible" = no; then 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:5018: 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}:5024: testing if the symbol is already defined go no further ..." 1>&5 cat >"conftest.$ac_ext" <<_ACEOF #line 5027 "configure" #include "confdefs.h" #include int main (void) { #ifndef _POSIX_C_SOURCE #error _POSIX_C_SOURCE is not defined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:5042: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:5045: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:5048: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5051: \$? = $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 (.[12]??*) cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" ;; (.2) 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 5072 "configure" #include "confdefs.h" #include int main (void) { #ifdef _POSIX_SOURCE #error _POSIX_SOURCE is defined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:5087: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:5090: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:5093: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5096: \$? = $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}:5107: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 CFLAGS="$cf_trim_CFLAGS" CPPFLAGS="$cf_trim_CPPFLAGS" test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_cv_posix_c_source" echo "${as_me:-configure}:5115: testing if the second compile does not leave our definition intact error ..." 1>&5 cat >"conftest.$ac_ext" <<_ACEOF #line 5118 "configure" #include "confdefs.h" #include int main (void) { #ifndef _POSIX_C_SOURCE #error _POSIX_C_SOURCE is not defined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:5133: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:5136: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:5139: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5142: \$? = $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:5158: 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 (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case "$cf_add_cflags" in (-D*) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test "$cf_fix_cppflags" = yes ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in (*$cf_add_cflags) ;; (*) case "$cf_add_cflags" in (-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 test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" ;; esac ;; (*) test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " cf_new_cflags="${cf_new_cflags}$cf_add_cflags" ;; esac ;; (yes) test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[^"]*"'\''//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then test -n "$CFLAGS" && CFLAGS="$CFLAGS " CFLAGS="${CFLAGS}$cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" fi fi fi # cf_cv_posix_visible # Some of these niche implementations use copy/paste, double-check... if test "$cf_cv_xopen_source" = no ; then test -n "$verbose" && echo " checking if _POSIX_C_SOURCE interferes with _XOPEN_SOURCE" 1>&6 echo "${as_me:-configure}:5271: testing checking if _POSIX_C_SOURCE interferes with _XOPEN_SOURCE ..." 1>&5 cat >"conftest.$ac_ext" <<_ACEOF #line 5274 "configure" #include "confdefs.h" $ac_includes_default int main (void) { #ifndef _XOPEN_SOURCE #error _XOPEN_SOURCE is not defined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:5292: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:5295: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:5298: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5301: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then : else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 { echo "$as_me:5308: WARNING: _POSIX_C_SOURCE definition is not usable" >&5 echo "$as_me: WARNING: _POSIX_C_SOURCE definition is not usable" >&2;} CPPFLAGS="$cf_save_xopen_cppflags" fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi ;; esac if test -n "$cf_xopen_source" ; then for cf_add_cflags in $cf_xopen_source do case "x$cf_add_cflags" in (x-[DU]*) cf_tmp_cflag=`echo "x$cf_add_cflags" | sed -e 's/^.//' -e 's/=.*//'` while true do cf_old_cflag=`echo "x$CFLAGS" | sed -e 's/^.//' -e 's/[ ][ ]*-/ -/g' -e "s%$cf_tmp_cflag\\(=[^ ][^ ]*\\)\?%%" -e 's/^[ ]*//' -e 's%[ ][ ]*-D% -D%g' -e 's%[ ][ ]*-I% -I%g'` test "$CFLAGS" != "$cf_old_cflag" || break test -n "$verbose" && echo " removing old option $cf_add_cflags from CFLAGS" 1>&6 echo "${as_me:-configure}:5331: testing removing old option $cf_add_cflags from CFLAGS ..." 1>&5 CFLAGS="$cf_old_cflag" done cf_tmp_cflag=`echo "x$cf_add_cflags" | sed -e 's/^.//' -e 's/=.*//'` while true do cf_old_cflag=`echo "x$CPPFLAGS" | sed -e 's/^.//' -e 's/[ ][ ]*-/ -/g' -e "s%$cf_tmp_cflag\\(=[^ ][^ ]*\\)\?%%" -e 's/^[ ]*//' -e 's%[ ][ ]*-D% -D%g' -e 's%[ ][ ]*-I% -I%g'` test "$CPPFLAGS" != "$cf_old_cflag" || break test -n "$verbose" && echo " removing old option $cf_add_cflags from CPPFLAGS" 1>&6 echo "${as_me:-configure}:5343: testing removing old option $cf_add_cflags from CPPFLAGS ..." 1>&5 CPPFLAGS="$cf_old_cflag" done ;; esac cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in $cf_add_cflags do case "$cf_fix_cppflags" in (no) case "$cf_add_cflags" in (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case "$cf_add_cflags" in (-D*) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test "$cf_fix_cppflags" = yes ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in (*$cf_add_cflags) ;; (*) case "$cf_add_cflags" in (-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 test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" ;; esac ;; (*) test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " cf_new_cflags="${cf_new_cflags}$cf_add_cflags" ;; esac ;; (yes) test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[^"]*"'\''//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then test -n "$verbose" && echo " add to \$CFLAGS $cf_new_cflags" 1>&6 echo "${as_me:-configure}:5431: testing add to \$CFLAGS $cf_new_cflags ..." 1>&5 test -n "$CFLAGS" && CFLAGS="$CFLAGS " CFLAGS="${CFLAGS}$cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then test -n "$verbose" && echo " add to \$CPPFLAGS $cf_new_cppflags" 1>&6 echo "${as_me:-configure}:5441: testing add to \$CPPFLAGS $cf_new_cppflags ..." 1>&5 test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then test -n "$verbose" && echo " add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags" 1>&6 echo "${as_me:-configure}:5451: testing add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags ..." 1>&5 test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" fi done fi if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then echo "$as_me:5463: 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 5466 "configure" #include "confdefs.h" #include int main (void) { #ifndef _XOPEN_SOURCE #error _XOPEN_SOURCE is not defined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:5481: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:5484: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:5487: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5490: \$? = $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:5499: 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 5504 "configure" #include "confdefs.h" #include int main (void) { #if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE #error (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:5519: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:5522: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:5525: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5528: \$? = $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:5539: WARNING: _XOPEN_SOURCE is lower than requested" >&5 echo "$as_me: WARNING: _XOPEN_SOURCE is lower than requested" >&2;} fi else echo "$as_me:5544: 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 5551 "configure" #include "confdefs.h" $ac_includes_default int main (void) { #ifndef _XOPEN_SOURCE #error _XOPEN_SOURCE is not defined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:5569: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:5572: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:5575: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5578: \$? = $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" test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}-D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" cat >"conftest.$ac_ext" <<_ACEOF #line 5590 "configure" #include "confdefs.h" $ac_includes_default int main (void) { #ifndef _XOPEN_SOURCE #error _XOPEN_SOURCE is not defined #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:5608: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:5611: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:5614: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:5617: \$? = $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:5632: 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" for cf_add_cflags in $cf_temp_xopen_source do case "x$cf_add_cflags" in (x-[DU]*) cf_tmp_cflag=`echo "x$cf_add_cflags" | sed -e 's/^.//' -e 's/=.*//'` while true do cf_old_cflag=`echo "x$CFLAGS" | sed -e 's/^.//' -e 's/[ ][ ]*-/ -/g' -e "s%$cf_tmp_cflag\\(=[^ ][^ ]*\\)\?%%" -e 's/^[ ]*//' -e 's%[ ][ ]*-D% -D%g' -e 's%[ ][ ]*-I% -I%g'` test "$CFLAGS" != "$cf_old_cflag" || break CFLAGS="$cf_old_cflag" done cf_tmp_cflag=`echo "x$cf_add_cflags" | sed -e 's/^.//' -e 's/=.*//'` while true do cf_old_cflag=`echo "x$CPPFLAGS" | sed -e 's/^.//' -e 's/[ ][ ]*-/ -/g' -e "s%$cf_tmp_cflag\\(=[^ ][^ ]*\\)\?%%" -e 's/^[ ]*//' -e 's%[ ][ ]*-D% -D%g' -e 's%[ ][ ]*-I% -I%g'` test "$CPPFLAGS" != "$cf_old_cflag" || break CPPFLAGS="$cf_old_cflag" done ;; esac cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= cf_new_extra_cppflags= for cf_add_cflags in $cf_add_cflags do case "$cf_fix_cppflags" in (no) case "$cf_add_cflags" in (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) case "$cf_add_cflags" in (-D*) cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[^=]*='\''\"[^"]*//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes if test "$cf_fix_cppflags" = yes ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue elif test "${cf_tst_cflags}" = "\"'" ; then test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" continue fi ;; esac case "$CPPFLAGS" in (*$cf_add_cflags) ;; (*) case "$cf_add_cflags" in (-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 test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" ;; esac ;; (*) test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " cf_new_cflags="${cf_new_cflags}$cf_add_cflags" ;; esac ;; (yes) test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[^"]*"'\''//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=no ;; esac done if test -n "$cf_new_cflags" ; then test -n "$CFLAGS" && CFLAGS="$CFLAGS " CFLAGS="${CFLAGS}$cf_new_cflags" fi if test -n "$cf_new_cppflags" ; then test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" fi if test -n "$cf_new_extra_cppflags" ; then test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" fi done fi fi fi fi # cf_cv_posix_visible ### extra things that we'll substitute in the makefile echo "$as_me:5780: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else for ac_prog in gegrep egrep 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:5792: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $EGREP in [\\/]* | ?:[\\/]*) ac_cv_path_EGREP="$EGREP" # Let the user override the test with a path. ;; *) 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=. if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_EGREP="$ac_dir/$ac_word" echo "$as_me:5809: found $ac_dir/$ac_word" >&5 break fi done ;; esac fi EGREP=$ac_cv_path_EGREP if test -n "$EGREP"; then echo "$as_me:5820: result: $EGREP" >&5 echo "${ECHO_T}$EGREP" >&6 else echo "$as_me:5823: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$EGREP" && break done test -n "$EGREP" || EGREP=": " test "x$ac_cv_path_EGREP" = "x:" && { { echo "$as_me:5831: error: cannot find workable egrep" >&5 echo "$as_me: error: cannot find workable egrep" >&2;} { (exit 1); exit 1; }; } fi fi echo "$as_me:5836: result: $ac_cv_path_EGREP" >&5 echo "${ECHO_T}$ac_cv_path_EGREP" >&6 EGREP="$ac_cv_path_EGREP" 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:5846: checking how to run the C preprocessor" >&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 5867 "configure" #include "confdefs.h" #include Syntax error _ACEOF if { (eval echo "$as_me:5872: \"$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:5878: \$? = $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 5901 "configure" #include "confdefs.h" #include _ACEOF if { (eval echo "$as_me:5905: \"$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:5911: \$? = $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:5948: 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 5958 "configure" #include "confdefs.h" #include Syntax error _ACEOF if { (eval echo "$as_me:5963: \"$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:5969: \$? = $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 5992 "configure" #include "confdefs.h" #include _ACEOF if { (eval echo "$as_me:5996: \"$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:6002: \$? = $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:6030: 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:6042: 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 6048 "configure" #include "confdefs.h" #include #include #include #include _ACEOF if { (eval echo "$as_me:6056: \"$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:6062: \$? = $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 6084 "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 6102 "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 6123 "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 (void) { 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:6149: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:6152: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='"./conftest$ac_exeext"' { (eval echo "$as_me:6154: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6157: \$? = $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:6170: 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 # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:6186: 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 6192 "configure" #include "confdefs.h" $ac_includes_default #include <$ac_header> _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:6198: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6201: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:6204: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6207: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; 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.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:6217: 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 whether exit is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_exit+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 6233 "configure" #include "confdefs.h" $ac_includes_default int main (void) { #ifndef exit (void) exit; #endif ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:6248: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6251: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:6254: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6257: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then ac_cv_have_decl_exit=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 ac_cv_have_decl_exit=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:6267: result: $ac_cv_have_decl_exit" >&5 echo "${ECHO_T}$ac_cv_have_decl_exit" >&6 echo "$as_me:6270: 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 6276 "configure" #include "confdefs.h" #include #include #ifdef signal # undef signal #endif extern void (*signal (int, void (*)(int)))(int); int main (void) { int i = 0; (void) i ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:6294: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6297: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:6300: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6303: \$? = $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:6313: result: $ac_cv_type_signal" >&5 echo "${ECHO_T}$ac_cv_type_signal" >&6 cat >>confdefs.h <&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 6337 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF if { (eval echo "$as_me:6341: \"$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:6347: \$? = $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:6366: 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 6391 "configure" #include "confdefs.h" #define $ac_func autoconf_temporary #include /* least-intrusive standard header which defines gcc2 __stub macros */ #undef $ac_func #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 (void); int main (void) { /* The GNU C library defines stubs 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) #error found stub for $ac_func #endif return $ac_func (); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:6422: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:6425: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:6428: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6431: \$? = $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:6441: 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 for setlocale()... $ECHO_C" >&6 if test "${cf_cv_locale+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 6458 "configure" #include "confdefs.h" $ac_includes_default #include int main (void) { setlocale(LC_ALL, "") ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:6472: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:6475: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:6478: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6481: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_locale=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_locale=no fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" fi echo "$as_me:6493: result: $cf_cv_locale" >&5 echo "${ECHO_T}$cf_cv_locale" >&6 test "$cf_cv_locale" = yes && { cat >>confdefs.h <<\EOF #define LOCALE 1 EOF } for ac_func in strerror do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:6504: checking for $ac_func" >&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 6510 "configure" #include "confdefs.h" #define $ac_func autoconf_temporary #include /* least-intrusive standard header which defines gcc2 __stub macros */ #undef $ac_func #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 (void); int main (void) { /* The GNU C library defines stubs 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) #error found stub for $ac_func #endif return $ac_func (); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:6541: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:6544: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:6547: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6550: \$? = $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:6560: 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 <>confdefs.h <<\EOF #define HAVE_STRERROR 1 EOF else echo "$as_me:6572: checking if external sys_nerr is declared" >&5 echo $ECHO_N "checking if external sys_nerr is declared... $ECHO_C" >&6 if test "${cf_cv_dcl_sys_nerr+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 6579 "configure" #include "confdefs.h" $ac_includes_default #include int main (void) { int x = (int) sys_nerr; (void)x ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:6593: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6596: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:6599: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6602: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_dcl_sys_nerr=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_dcl_sys_nerr=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:6613: result: $cf_cv_dcl_sys_nerr" >&5 echo "${ECHO_T}$cf_cv_dcl_sys_nerr" >&6 if test "$cf_cv_dcl_sys_nerr" = no ; then cf_result=`echo "decl_sys_nerr" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` cat >>confdefs.h <&5 echo $ECHO_N "checking if external sys_nerr exists... $ECHO_C" >&6 if test "${cf_cv_have_sys_nerr+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 6635 "configure" #include "confdefs.h" #undef sys_nerr extern int sys_nerr; int main (void) { sys_nerr = 2 ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:6650: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:6653: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:6656: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6659: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_have_sys_nerr=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_have_sys_nerr=no fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" fi echo "$as_me:6670: result: $cf_cv_have_sys_nerr" >&5 echo "${ECHO_T}$cf_cv_have_sys_nerr" >&6 if test "$cf_cv_have_sys_nerr" = yes ; then cf_result=`echo "have_sys_nerr" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` cat >>confdefs.h <&5 echo $ECHO_N "checking if external sys_errlist is declared... $ECHO_C" >&6 if test "${cf_cv_dcl_sys_errlist+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 6690 "configure" #include "confdefs.h" $ac_includes_default #include int main (void) { int x = (int) sys_errlist; (void)x ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:6704: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6707: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:6710: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6713: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_dcl_sys_errlist=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_dcl_sys_errlist=no fi rm -f "conftest.$ac_objext" "conftest.$ac_ext" fi echo "$as_me:6724: result: $cf_cv_dcl_sys_errlist" >&5 echo "${ECHO_T}$cf_cv_dcl_sys_errlist" >&6 if test "$cf_cv_dcl_sys_errlist" = no ; then cf_result=`echo "decl_sys_errlist" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` cat >>confdefs.h <&5 echo $ECHO_N "checking if external sys_errlist exists... $ECHO_C" >&6 if test "${cf_cv_have_sys_errlist+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 6746 "configure" #include "confdefs.h" #undef sys_errlist extern int sys_errlist; int main (void) { sys_errlist = 2 ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:6761: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:6764: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:6767: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6770: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then cf_cv_have_sys_errlist=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 cf_cv_have_sys_errlist=no fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" fi echo "$as_me:6781: result: $cf_cv_have_sys_errlist" >&5 echo "${ECHO_T}$cf_cv_have_sys_errlist" >&6 if test "$cf_cv_have_sys_errlist" = yes ; then cf_result=`echo "have_sys_errlist" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` 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 6807 "configure" #include "confdefs.h" #if defined(HAVE_TERMIOS_H) && defined(HAVE_TCGETATTR) #include #endif #ifdef HAVE_UNISTD_H #include #endif int main (void) { #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:6830: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6833: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:6836: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6839: \$? = $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 6850 "configure" #include "confdefs.h" $ac_includes_default #if defined(HAVE_TERMIOS_H) && defined(HAVE_TCGETATTR) #include #endif #if defined(_POSIX_VDISABLE) int main(void) { ${cf_cv_main_return:-return}(_POSIX_VDISABLE == -1); } #endif _ACEOF rm -f "conftest$ac_exeext" if { (eval echo "$as_me:6864: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:6867: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='"./conftest$ac_exeext"' { (eval echo "$as_me:6869: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6872: \$? = $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:6886: 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:6893: 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 6900 "configure" #include "confdefs.h" #if HAVE_SYS_FILIO_H # include /* FIONREAD (BSDs) */ #endif #if HAVE_SYS_IOCTL_H # include /* FIONREAD (other...) */ #endif int main (void) { int l1; ioctl (0, FIONREAD, &l1); ; return 0; } _ACEOF rm -f "conftest.$ac_objext" if { (eval echo "$as_me:6922: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:6925: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest.$ac_objext"' { (eval echo "$as_me:6928: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6931: \$? = $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:6943: 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 echo "$as_me:6950: checking for nl_langinfo and CODESET" >&5 echo $ECHO_N "checking for nl_langinfo and CODESET... $ECHO_C" >&6 if test "${am_cv_langinfo_codeset+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >"conftest.$ac_ext" <<_ACEOF #line 6956 "configure" #include "confdefs.h" $ac_includes_default #include int main (void) { char* cs = nl_langinfo(CODESET); (void)cs ; return 0; } _ACEOF rm -f "conftest.$ac_objext" "conftest$ac_exeext" if { (eval echo "$as_me:6970: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:6973: \$? = $ac_status" >&5 (exit "$ac_status"); } && { ac_try='test -s "conftest$ac_exeext"' { (eval echo "$as_me:6976: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:6979: \$? = $ac_status" >&5 (exit "$ac_status"); }; }; then am_cv_langinfo_codeset=yes else echo "$as_me: failed program was:" >&5 cat "conftest.$ac_ext" >&5 am_cv_langinfo_codeset=no fi rm -f "conftest.$ac_objext" "conftest$ac_exeext" "conftest.$ac_ext" fi echo "$as_me:6990: result: $am_cv_langinfo_codeset" >&5 echo "${ECHO_T}$am_cv_langinfo_codeset" >&6 if test "$am_cv_langinfo_codeset" = yes; then cat >>confdefs.h <<\EOF #define HAVE_LANGINFO_CODESET 1 EOF fi ### 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 overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, 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:7083: 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. me=\`echo "\$0" | sed -e 's,.*\\/,,'\` debug=false SHELL=\${CONFIG_SHELL-$SHELL} ac_cs_invocation="\$0 \$@" CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS _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:7261: 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:7280: 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.20240618, 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:7317: 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,@X_CFLAGS@,$X_CFLAGS,;t t s,@X_LIBS@,$X_LIBS,;t t 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,@runstatedir@,$runstatedir,;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,@target@,$target,;t t s,@target_cpu@,$target_cpu,;t t s,@target_vendor@,$target_vendor,;t t s,@target_os@,$target_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,@MAKE_NO_PHONY@,$MAKE_NO_PHONY,;t t s,@MAKE_PHONY@,$MAKE_PHONY,;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,@LINT_OPTS@,$LINT_OPTS,;t t s,@LINT_LIBS@,$LINT_LIBS,;t t s,@GROFF_PATH@,$GROFF_PATH,;t t s,@NROFF_PATH@,$NROFF_PATH,;t t s,@TBL_PATH@,$TBL_PATH,;t t s,@GROFF_NOTE@,$GROFF_NOTE,;t t s,@NROFF_NOTE@,$NROFF_NOTE,;t t s,@GREP@,$GREP,;t t s,@FGREP@,$FGREP,;t t s,@cf_man2html@,$cf_man2html,;t t s,@GLOB_FULLPATH_POSIX@,$GLOB_FULLPATH_POSIX,;t t s,@GLOB_FULLPATH_OTHER@,$GLOB_FULLPATH_OTHER,;t t s,@MAN2HTML_NOTE@,$MAN2HTML_NOTE,;t t s,@MAN2HTML_PATH@,$MAN2HTML_PATH,;t t s,@MAN2HTML_TEMP@,$MAN2HTML_TEMP,;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,@HAVE_STDNORETURN_H@,$HAVE_STDNORETURN_H,;t t s,@STDC_NORETURN@,$STDC_NORETURN,;t t s,@CPP@,$CPP,;t t s,@EGREP@,$EGREP,;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' && sed -e 's/\\\\*$//g' -e 's/$/\\/' -e 's/;t t\\/;t t/' -e 't' -e '3,'$ac_max_sed_lines's/$/\\/' "$tmp"/subs.frag) >"$tmp"/subs-$ac_sed_frag.sed # It is possible to make a multiline substitution using escaped newlines. # Ensure that we do not split the substitution between script fragments. ac_BEG=$ac_end ac_END=`expr "$ac_end" + "$ac_max_sed_lines"` sed "1,${ac_BEG}d; ${ac_END}p; q" "$tmp"/subs.sed >"$tmp"/subs.next if test -s "$tmp"/subs.next; then grep '^s,@[^@,][^@,]*@,.*$' "$tmp"/subs.next | grep -v '^s,@.*;t t$' >"$tmp"/subs.edit if test ! -s "$tmp"/subs.edit; then grep "^s,@[^@,][^@,]*@,.*,;t t$" "$tmp"/subs.next >"$tmp"/subs.edit if test ! -s "$tmp"/subs.edit; then if test "$ac_beg" -gt 1; then ac_end=`expr "$ac_end" - 1` continue fi fi fi fi 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:7589: 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:7607: 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:7620: 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:7636: 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:7645: 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 EOF test -n "${FGREP}" || FGREP="grep -F" test -n "${EGREP}" || EGREP="grep -E" cat >>"$CONFIG_STATUS" <>"$CONFIG_STATUS" <<\EOF 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:7690: 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:7701: 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:7750: 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:7761: 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:7774: 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 ' test -n "${EGREP}" || EGREP="grep -E"' >>"$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 # grep' >>"$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:7893: $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 <\$@ ${GROFF_NOTE}.ps.pdf : ${GROFF_NOTE} ps2pdf \$*.ps ${GROFF_NOTE} ${GROFF_NOTE}.1.ps : ${GROFF_NOTE} \$(SHELL) -c "tbl \$*.1 | groff -man" >\$@ ${GROFF_NOTE} ${GROFF_NOTE}.1.txt : ${GROFF_NOTE} GROFF_NO_SGR=stupid \$(SHELL) -c "tbl \$*.1 | nroff -rHY=0 -Tascii -man | col -bx" >\$@ ${MAN2HTML_NOTE}.1.html : ${MAN2HTML_NOTE} ./${MAN2HTML_TEMP} \$* 1 man >\$@ CF_EOF cf_make_docs=1 fi for cf_name in '$(THIS)' do cat >>$cf_output <