xterm-57.patch.txt

XFree86 3.9Aa - xterm patch #57 - T.Dickey <dickey@clark.net>
 
This patch is mostly concerned with the standlone configure script; a few
minor corrections are added:
 
        + add configure option --disable-tek4014, to allow xterm to be built
          without the tek4014 emulation.
 
        + add configure option --with-terminal-type, to allow xterm to be
          compiled with default $TERM value other than "xterm" (e.g.,
          "xterm-16color") -- requested by Stephen Marley <stephen@memex.com>.
 
        + fix a typo in the configure --help message -- reported by Darren
          Heibert <darren@hmi.com>.
 
        + review diffs between main.c and os2main.c, to make them more alike.
          (applies some minor bugfixes to OS/2's version).
 
        + add missing quotes in memmove/bcopy configure test
 
--------------------------------------------------------------------------------
 Makefile.in  |    9 -
 aclocal.m4   |   10 -
 button.c     |    2 
 charproc.c   |   18 ++
 configure    |  459 ++++++++++++++++++++++++++++++++-------------------------
 configure.in |   44 ++++-
 data.c       |    9 -
 data.h       |   16 +
 input.c      |    8 
 main.c       |  159 +++++++++++--------
 menu.c       |   39 +++-
 menu.h       |   20 ++
 misc.c       |   72 ++++++--
 os2main.c    |  262 ++++++++++++++++++--------------
 ptyx.h       |   31 +++
 resize.c     |    8 
 util.c       |   23 ++
 xterm.h      |    4 
 xtermcfg.hin |    2 
 19 files changed, 738 insertions, 457 deletions
--------------------------------------------------------------------------------
Index: Makefile.in
--- xterm-56+/Makefile.in       Tue Sep 30 07:04:42 1997
+++ xterm-57/Makefile.in        Tue Dec  9 17:56:05 1997
@@ -39,21 +39,22 @@
 
 INSTALL_DIRS    = $(bindir) $(libdir) $(mandir)
 
+EXTRAHDR       = @EXTRAHDRS@
 EXTRASRC       = @EXTRASRCS@
 EXTRAOBJ       = @EXTRAOBJS@
 
           SRCS1 = button.c charproc.c cursor.c data.c doublechr.c input.c \
                  main.c menu.c misc.c print.c screen.c scrollbar.c tabs.c \
-                 TekPrsTbl.c Tekproc.c util.c VTPrsTbl.c $(EXTRASRC)
+                 util.c VTPrsTbl.c $(EXTRASRC)
           OBJS1 = button.o charproc.o cursor.o data.o doublechr.o input.o \
                  main.o menu.o misc.o print.o screen.o scrollbar.o tabs.o \
-                 TekPrsTbl.o Tekproc.o util.o VTPrsTbl.o $(EXTRAOBJ)
+                 util.o VTPrsTbl.o $(EXTRAOBJ)
           SRCS2 = resize.c
           OBJS2 = resize.o
            SRCS = $(SRCS1) $(SRCS2)
            OBJS = $(OBJS1) $(OBJS2)
-           HDRS = Tekparse.h VTparse.h data.h error.h main.h menu.h proto.h \
-                  ptyx.h xterm.h
+           HDRS = VTparse.h data.h error.h main.h menu.h proto.h \
+                  ptyx.h xterm.h $(EXTRAHDR)
        PROGRAMS = xterm resize
 
 all:   $(PROGRAMS)
Index: aclocal.m4
--- xterm-56+/aclocal.m4        Tue Sep 30 07:04:42 1997
+++ xterm-57/aclocal.m4 Tue Dec  9 19:28:00 1997
@@ -83,7 +83,7 @@
 dnl
 dnl Parameters:
 dnl $1 = option name
-dnl $2 = help-string 
+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')
@@ -122,7 +122,7 @@
 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 does not agree with actual")
+       AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
        AC_ERROR("Please remove config.cache and try again.")
 fi
 ])dnl
@@ -163,7 +163,7 @@
 AC_DEFUN([CF_FUNC_MEMMOVE],
 [
 if test ".$ac_cv_func_memmove" != .yes ; then
-       if test $ac_cv_func_bcopy = yes ; then
+       if test ".$ac_cv_func_bcopy" = ".yes" ; then
                AC_MSG_CHECKING(if bcopy does overlapping moves)
                AC_CACHE_VAL(cf_cv_good_bcopy,[
                        AC_TRY_RUN([
@@ -480,7 +480,7 @@
 dnl
 AC_DEFUN([CF_X_ATHENA],
 [AC_REQUIRE([CF_X_TOOLKIT])
-cf_x_athena=Xaw
+cf_x_athena=${cf_x_athena-Xaw}
 
 AC_ARG_WITH(Xaw3d,
        [  --with-Xaw3d            link with Xaw 3d library],
@@ -505,6 +505,8 @@
        AC_ERROR(
 [Unable to successfully link Athena library (-l$cf_x_athena) with test program]),
        [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
+CF_UPPER(CF_X_ATHENA_LIBS,HAVE_LIB_$cf_x_athena)
+AC_DEFINE_UNQUOTED($CF_X_ATHENA_LIBS)
 ])dnl
 dnl ---------------------------------------------------------------------------
 dnl Check for X Toolkit libraries
Index: button.c
--- xterm-56+/button.c  Sat Dec  6 10:24:45 1997
+++ xterm-57/button.c   Tue Dec  9 18:03:49 1997
@@ -1545,6 +1545,7 @@
 
 
 /*ARGSUSED*/
+#if OPT_TEK4014
 void HandleGINInput (w, event, param_list, nparamsp)
     Widget w GCC_UNUSED;
     XEvent *event GCC_UNUSED;
@@ -1567,6 +1568,7 @@
        Bell (XkbBI_MinorError,0);
     }
 }
+#endif /* OPT_TEK4014 */
 
 
 /* ARGSUSED */
Index: charproc.c
--- xterm-56+/charproc.c        Sat Dec  6 10:24:45 1997
+++ xterm-57/charproc.c Thu Dec 25 17:19:44 1997
@@ -455,12 +455,14 @@
     { "soft-reset",            HandleSoftReset },
     { "hard-reset",            HandleHardReset },
     { "clear-saved-lines",     HandleClearSavedLines },
+#if OPT_TEK4014
     { "set-terminal-type",     HandleSetTerminalType },
     { "set-visibility",                HandleVisibility },
     { "set-tek-text",          HandleSetTekText },
     { "tek-page",              HandleTekPage },
     { "tek-reset",             HandleTekReset },
     { "tek-copy",              HandleTekCopy },
+#endif
     { "visual-bell",           HandleVisualBell },
     { "dired-button",          DiredButton },
     { "vi-button",             ViButton },
@@ -640,6 +642,7 @@
 {XtNsignalInhibit,XtCSignalInhibit,XtRBoolean, sizeof(Boolean),
        XtOffsetOf(XtermWidgetRec, misc.signalInhibit),
        XtRBoolean, (XtPointer) &defaultFALSE},
+#if OPT_TEK4014
 {XtNtekInhibit, XtCTekInhibit, XtRBoolean, sizeof(Boolean),
        XtOffsetOf(XtermWidgetRec, misc.tekInhibit),
        XtRBoolean, (XtPointer) &defaultFALSE},
@@ -649,6 +652,7 @@
 {XtNtekStartup, XtCTekStartup, XtRBoolean, sizeof(Boolean),
        XtOffsetOf(XtermWidgetRec, screen.TekEmu),
        XtRBoolean, (XtPointer) &defaultFALSE},
+#endif
 {XtNtiteInhibit, XtCTiteInhibit, XtRBoolean, sizeof(Boolean),
        XtOffsetOf(XtermWidgetRec, misc.titeInhibit),
        XtRBoolean, (XtPointer) &defaultFALSE},
@@ -1729,8 +1733,10 @@
                        /* DECSET */
                        dpmodes(term, bitset);
                        parsestate = groundtable;
+#if OPT_TEK4014
                        if(screen->TekEmu)
                                return;
+#endif
                        break;
 
                 case CASE_DECRST:
@@ -2696,6 +2702,7 @@
                                screen->cursor_set = OFF;
                        break;
                case 38:                /* DECTEK                       */
+#if OPT_TEK4014
                        if(func == bitset && !(screen->inhibit & I_TEK)) {
 #ifdef ALLOWLOGGING
                                if(screen->logging) {
@@ -2705,6 +2712,7 @@
 #endif
                                screen->TekEmu = TRUE;
                        }
+#endif
                        break;
                case 40:                /* 132 column mode              */
                        screen->c132 = (func == bitset);
@@ -3335,7 +3343,9 @@
 VTRun()
 {
        register TScreen *screen = &term->screen;
+#if OPT_TEK4014
        register int i;
+#endif
        
        if (!screen->Vshow) {
            set_vt_visibility (TRUE);
@@ -3353,6 +3363,7 @@
 
        bcnt = 0;
        bptr = buffer;
+#if OPT_TEK4014
        while(Tpushb > Tpushback) {
                *bptr++ = *--Tpushb;
                bcnt++;
@@ -3361,6 +3372,7 @@
        for( ; i > 0 ; i--)
                *bptr++ = *Tbptr++;
        bptr = buffer;
+#endif
        if(!setjmp(VTend))
                VTparse();
        StopBlinking(screen);
@@ -3597,7 +3609,9 @@
        new->screen.terminal_id = MAX_DECID;
    new->screen.ansi_level = (new->screen.terminal_id / 100);
    new->screen.visualbell = request->screen.visualbell;
+#if OPT_TEK4014
    new->screen.TekEmu = request->screen.TekEmu;
+#endif
    new->misc.re_verse = request->misc.re_verse;
    new->screen.multiClickTime = request->screen.multiClickTime;
    new->screen.bellSuppressTime = request->screen.bellSuppressTime;
@@ -3717,7 +3731,9 @@
 
 #ifndef NO_ACTIVE_ICON
    new->screen.whichVwin = &new->screen.fullVwin;
+#if OPT_TEK4014
    new->screen.whichTwin = &new->screen.fullTwin;
+#endif
 #endif /* NO_ACTIVE_ICON */
 
    return;
@@ -3952,7 +3968,9 @@
           that the child process does not fork and exec with all the dynamic
           memory it will never use.  If we were to do it here, the
           swap space for new process would be huge for huge savelines. */
+#if OPT_TEK4014
        if (!tekWidget)                 /* if not called after fork */
+#endif
          screen->buf = screen->allbuf = NULL;
 
        screen->do_wrap = 0;
Index: configure
--- xterm-56+/configure Tue Oct 14 21:40:58 1997
+++ xterm-57/configure  Fri Dec 26 13:33:10 1997
@@ -1,7 +1,7 @@
 #! /bin/sh
 
 # Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.12 
+# Generated automatically using autoconf version 2.12.970309 
 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
 #
 # This configure script is free software; the Free Software Foundation
@@ -22,6 +22,8 @@
 ac_help="$ac_help
   --with-terminal-id[=V]  set default decTerminalID (default: vt100)"
 ac_help="$ac_help
+  --with-terminal-type=T  set default \$TERM (default: xterm)"
+ac_help="$ac_help
   --disable-active-icon   disable X11R6.3 active-icon feature (default: on)"
 ac_help="$ac_help
   --disable-ansi-color    disable ANSI color (default: on)"
@@ -40,12 +42,14 @@
 ac_help="$ac_help
   --enable-logging        enable logging (default: off)"
 ac_help="$ac_help
-  --disable-rightbar      enable logging (default: on)"
+  --disable-rightbar      disable right-scrollbar support (default: on)"
 ac_help="$ac_help
-  --enable-trace          test: set to enable debugging traces (default: off)"
+  --disable-tek4014       disable tek4014 emulation (default: on)"
 ac_help="$ac_help
   --disable-vt52          disable VT52 emulation (default: on)"
 ac_help="$ac_help
+  --enable-trace          test: set to enable debugging traces (default: off)"
+ac_help="$ac_help
   --disable-echo          test: display \"compiling\" commands (default: on)"
 ac_help="$ac_help
   --enable-xmc-glitch     test: enable xmc magic-cookie emulation (default: off)"
@@ -372,7 +376,7 @@
     verbose=yes ;;
 
   -version | --version | --versio | --versi | --vers)
-    echo "configure generated by autoconf version 2.12"
+    echo "configure generated by autoconf version 2.12.970309"
     exit 0 ;;
 
   -with-* | --with-*)
@@ -587,7 +591,7 @@
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:591: checking host system type" >&5
+echo "configure:595: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
@@ -629,7 +633,7 @@
 test -n "$cf_cv_system_name" && echo "$ac_t"""Configuring for $cf_cv_system_name"" 1>&6
 
 if test ".$system_name" != ".$cf_cv_system_name" ; then
-       echo "$ac_t"""Cached system name does not agree with actual"" 1>&6
+       echo "$ac_t""Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" 1>&6
        { echo "configure: error: "Please remove config.cache and try again."" 1>&2; exit 1; }
 fi
 
@@ -638,7 +642,7 @@
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:642: checking for $ac_word" >&5
+echo "configure:646: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -667,7 +671,7 @@
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:671: checking for $ac_word" >&5
+echo "configure:675: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -715,7 +719,7 @@
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:719: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:723: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -725,11 +729,11 @@
 cross_compiling=$ac_cv_prog_cc_cross
 
 cat > conftest.$ac_ext <<EOF
-#line 729 "configure"
+#line 733 "configure"
 #include "confdefs.h"
 main(){return(0);}
 EOF
-if { (eval echo configure:733: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:737: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -749,12 +753,12 @@
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:753: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:757: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:758: checking whether we are using GNU C" >&5
+echo "configure:762: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -763,7 +767,7 @@
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:767: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:771: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -778,7 +782,7 @@
   ac_save_CFLAGS="$CFLAGS"
   CFLAGS=
   echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:782: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:786: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -806,7 +810,7 @@
 fi
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:810: checking how to run the C preprocessor" >&5
+echo "configure:814: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -821,13 +825,13 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 825 "configure"
+#line 829 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:831: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:835: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -838,13 +842,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 842 "configure"
+#line 846 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:848: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:852: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -868,13 +872,13 @@
 
 if test $ac_cv_prog_gcc = yes; then
     echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:872: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:876: checking whether ${CC-cc} needs -traditional" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
     ac_pattern="Autoconf.*'x'"
   cat > conftest.$ac_ext <<EOF
-#line 878 "configure"
+#line 882 "configure"
 #include "confdefs.h"
 #include <sgtty.h>
 Autoconf TIOCGETP
@@ -892,7 +896,7 @@
 
   if test $ac_cv_prog_gcc_traditional = no; then
     cat > conftest.$ac_ext <<EOF
-#line 896 "configure"
+#line 900 "configure"
 #include "confdefs.h"
 #include <termio.h>
 Autoconf TCGETA
@@ -924,7 +928,7 @@
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:928: checking for a BSD compatible install" >&5
+echo "configure:932: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -976,9 +980,9 @@
 
 ###    checks for UNIX variants that set C preprocessor variables
 echo $ac_n "checking for AIX""... $ac_c" 1>&6
-echo "configure:980: checking for AIX" >&5
+echo "configure:984: checking for AIX" >&5
 cat > conftest.$ac_ext <<EOF
-#line 982 "configure"
+#line 986 "configure"
 #include "confdefs.h"
 #ifdef _AIX
   yes
@@ -1000,7 +1004,7 @@
 
 
 echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:1004: checking for POSIXized ISC" >&5
+echo "configure:1008: checking for POSIXized ISC" >&5
 if test -d /etc/conf/kconfig.d &&
   grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
 then
@@ -1022,17 +1026,17 @@
 
 ac_safe=`echo "minix/config.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6
-echo "configure:1026: checking for minix/config.h" >&5
+echo "configure:1030: checking for minix/config.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1031 "configure"
+#line 1035 "configure"
 #include "confdefs.h"
 #include <minix/config.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1036: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1040: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1074,12 +1078,12 @@
 
 ###    checks for typedefs
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1078: checking for ANSI C header files" >&5
+echo "configure:1082: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1083 "configure"
+#line 1087 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -1087,7 +1091,7 @@
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1091: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1095: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1104,7 +1108,7 @@
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 1108 "configure"
+#line 1112 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -1122,7 +1126,7 @@
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 1126 "configure"
+#line 1130 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -1143,7 +1147,7 @@
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 1147 "configure"
+#line 1151 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -1154,7 +1158,7 @@
 exit (0); }
 
 EOF
-if { (eval echo configure:1158: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1162: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -1178,12 +1182,12 @@
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:1182: checking for size_t" >&5
+echo "configure:1186: checking for size_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1187 "configure"
+#line 1191 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -1211,12 +1215,12 @@
 fi
 
 echo $ac_n "checking for time_t""... $ac_c" 1>&6
-echo "configure:1215: checking for time_t" >&5
+echo "configure:1219: checking for time_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_time_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1220 "configure"
+#line 1224 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -1252,12 +1256,12 @@
        
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1256: checking for $ac_func" >&5
+echo "configure:1260: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1261 "configure"
+#line 1265 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1280,7 +1284,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:1284: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1288: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -1306,9 +1310,9 @@
 
 
 if test ".$ac_cv_func_memmove" != .yes ; then
-       if test $ac_cv_func_bcopy = yes ; then
+       if test ".$ac_cv_func_bcopy" = ".yes" ; then
                echo $ac_n "checking if bcopy does overlapping moves""... $ac_c" 1>&6
-echo "configure:1312: checking if bcopy does overlapping moves" >&5
+echo "configure:1316: checking if bcopy does overlapping moves" >&5
                if eval "test \"`echo '$''{'cf_cv_good_bcopy'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1317,7 +1321,7 @@
   cf_cv_good_bcopy=unknown
 else
   cat > conftest.$ac_ext <<EOF
-#line 1321 "configure"
+#line 1325 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -1330,7 +1334,7 @@
 }
                
 EOF
-if { (eval echo configure:1334: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1338: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   cf_cv_good_bcopy=yes
 else
@@ -1364,7 +1368,7 @@
 
 
 echo $ac_n "checking for workable tgetent function""... $ac_c" 1>&6
-echo "configure:1368: checking for workable tgetent function" >&5
+echo "configure:1372: checking for workable tgetent function" >&5
 if eval "test \"`echo '$''{'cf_cv_func_tgetent'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1380,7 +1384,7 @@
         cf_cv_func_tgetent=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 1384 "configure"
+#line 1388 "configure"
 #include "confdefs.h"
 
 /* terminfo implementations ignore the buffer argument, making it useless for
@@ -1394,7 +1398,7 @@
        tgetent(buffer, "vt100");
        exit(buffer[0] == 0); }
 EOF
-if { (eval echo configure:1398: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1402: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   echo "yes, there is a termcap/tgetent present" 1>&5
         cf_cv_func_tgetent=yes
@@ -1415,14 +1419,14 @@
        for cf_termlib in $cf_TERMLIB
        do
                cat > conftest.$ac_ext <<EOF
-#line 1419 "configure"
+#line 1423 "configure"
 #include "confdefs.h"
 
 int main() {
 tgetent(0, 0)
 ; return 0; }
 EOF
-if { (eval echo configure:1426: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1430: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   echo "there is a terminfo/tgetent present" 1>&5
                         cf_cv_func_tgetent=$cf_termlib
@@ -1448,17 +1452,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1452: checking for $ac_hdr" >&5
+echo "configure:1456: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1457 "configure"
+#line 1461 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1462: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1466: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1496,13 +1500,13 @@
 ###    checks for structures
 
 echo $ac_n "checking for declaration of fd_set""... $ac_c" 1>&6
-echo "configure:1500: checking for declaration of fd_set" >&5
+echo "configure:1504: checking for declaration of fd_set" >&5
 if eval "test \"`echo '$''{'cf_cv_type_fd_set'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 cat > conftest.$ac_ext <<EOF
-#line 1506 "configure"
+#line 1510 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -1510,7 +1514,7 @@
 fd_set x
 ; return 0; }
 EOF
-if { (eval echo configure:1514: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1518: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_type_fd_set=sys/types.h
 else
@@ -1518,7 +1522,7 @@
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   cat > conftest.$ac_ext <<EOF
-#line 1522 "configure"
+#line 1526 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -1527,7 +1531,7 @@
 fd_set x
 ; return 0; }
 EOF
-if { (eval echo configure:1531: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1535: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_type_fd_set=sys/select.h
 else
@@ -1552,12 +1556,12 @@
 
 ###    checks for compiler characteristics
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:1556: checking for working const" >&5
+echo "configure:1560: checking for working const" >&5
 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1561 "configure"
+#line 1565 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -1606,7 +1610,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:1610: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1614: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -1628,7 +1632,7 @@
 
 
 echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6
-echo "configure:1632: checking for ${CC-cc} option to accept ANSI C" >&5
+echo "configure:1636: checking for ${CC-cc} option to accept ANSI C" >&5
 if eval "test \"`echo '$''{'cf_cv_ansi_cc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1646,7 +1650,7 @@
 do
        CFLAGS="$cf_save_CFLAGS $cf_arg"
        cat > conftest.$ac_ext <<EOF
-#line 1650 "configure"
+#line 1654 "configure"
 #include "confdefs.h"
 
 #ifndef CC_HAS_PROTOS
@@ -1662,7 +1666,7 @@
        struct s2 {int (*f) (double a);};
 ; return 0; }
 EOF
-if { (eval echo configure:1666: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1670: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cf_cv_ansi_cc="$cf_arg"; break
 else
@@ -1696,7 +1700,7 @@
 # Uses ac_ vars as temps to allow command line to override cache and checks.
 # --without-x overrides everything else, but does not touch the cache.
 echo $ac_n "checking for X""... $ac_c" 1>&6
-echo "configure:1700: checking for X" >&5
+echo "configure:1704: checking for X" >&5
 
 # Check whether --with-x or --without-x was given.
 if test "${with_x+set}" = set; then
@@ -1758,12 +1762,12 @@
 
   # First, try using that file with no special directory specified.
 cat > conftest.$ac_ext <<EOF
-#line 1762 "configure"
+#line 1766 "configure"
 #include "confdefs.h"
 #include <$x_direct_test_include>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1767: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1771: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1832,14 +1836,14 @@
   ac_save_LIBS="$LIBS"
   LIBS="-l$x_direct_test_library $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1836 "configure"
+#line 1840 "configure"
 #include "confdefs.h"
 
 int main() {
 ${x_direct_test_function}()
 ; return 0; }
 EOF
-if { (eval echo configure:1843: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1847: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   LIBS="$ac_save_LIBS"
 # We can link X programs with no special library path.
@@ -1939,7 +1943,7 @@
        # FIXME: modify the library lookup in autoconf to
        # allow _s.a suffix ahead of .a
        echo $ac_n "checking for open in -lc_s""... $ac_c" 1>&6
-echo "configure:1943: checking for open in -lc_s" >&5
+echo "configure:1947: checking for open in -lc_s" >&5
 ac_lib_var=`echo c_s'_'open | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1947,7 +1951,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lc_s  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1951 "configure"
+#line 1955 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1958,7 +1962,7 @@
 open()
 ; return 0; }
 EOF
-if { (eval echo configure:1962: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1966: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1975,7 +1979,7 @@
   echo "$ac_t""yes" 1>&6
   LIBS="-lc_s $LIBS"
        echo $ac_n "checking for gethostname in -lbsd""... $ac_c" 1>&6
-echo "configure:1979: checking for gethostname in -lbsd" >&5
+echo "configure:1983: checking for gethostname in -lbsd" >&5
 ac_lib_var=`echo bsd'_'gethostname | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1983,7 +1987,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lbsd  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1987 "configure"
+#line 1991 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1994,7 +1998,7 @@
 gethostname()
 ; return 0; }
 EOF
-if { (eval echo configure:1998: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2002: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2011,7 +2015,7 @@
   echo "$ac_t""yes" 1>&6
   LIBS="-lbsd $LIBS"
        echo $ac_n "checking for gethostname in -lnsl_s""... $ac_c" 1>&6
-echo "configure:2015: checking for gethostname in -lnsl_s" >&5
+echo "configure:2019: checking for gethostname in -lnsl_s" >&5
 ac_lib_var=`echo nsl_s'_'gethostname | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2019,7 +2023,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl_s  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2023 "configure"
+#line 2027 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2030,7 +2034,7 @@
 gethostname()
 ; return 0; }
 EOF
-if { (eval echo configure:2034: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2038: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2047,7 +2051,7 @@
   echo "$ac_t""yes" 1>&6
   LIBS="-lnsl_s $LIBS"
        echo $ac_n "checking for XOpenDisplay in -lX11_s""... $ac_c" 1>&6
-echo "configure:2051: checking for XOpenDisplay in -lX11_s" >&5
+echo "configure:2055: checking for XOpenDisplay in -lX11_s" >&5
 ac_lib_var=`echo X11_s'_'XOpenDisplay | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2055,7 +2059,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lX11_s  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2059 "configure"
+#line 2063 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2066,7 +2070,7 @@
 XOpenDisplay()
 ; return 0; }
 EOF
-if { (eval echo configure:2070: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2074: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2083,7 +2087,7 @@
   echo "$ac_t""yes" 1>&6
   LIBS="-lX11_s $LIBS"
        echo $ac_n "checking for XtAppInitialize in -lXt_s""... $ac_c" 1>&6
-echo "configure:2087: checking for XtAppInitialize in -lXt_s" >&5
+echo "configure:2091: checking for XtAppInitialize in -lXt_s" >&5
 ac_lib_var=`echo Xt_s'_'XtAppInitialize | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2091,7 +2095,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lXt_s  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2095 "configure"
+#line 2099 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2102,7 +2106,7 @@
 XtAppInitialize()
 ; return 0; }
 EOF
-if { (eval echo configure:2106: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2110: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2143,7 +2147,7 @@
        ;;
 *)
        echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
-echo "configure:2147: checking for socket in -lsocket" >&5
+echo "configure:2151: checking for socket in -lsocket" >&5
 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2151,7 +2155,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2155 "configure"
+#line 2159 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2162,7 +2166,7 @@
 socket()
 ; return 0; }
 EOF
-if { (eval echo configure:2166: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2170: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2190,7 +2194,7 @@
 fi
 
        echo $ac_n "checking for gethostname in -lnsl""... $ac_c" 1>&6
-echo "configure:2194: checking for gethostname in -lnsl" >&5
+echo "configure:2198: checking for gethostname in -lnsl" >&5
 ac_lib_var=`echo nsl'_'gethostname | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2198,7 +2202,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2202 "configure"
+#line 2206 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2209,7 +2213,7 @@
 gethostname()
 ; return 0; }
 EOF
-if { (eval echo configure:2213: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2217: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2260,17 +2264,17 @@
     case "`(uname -sr) 2>/dev/null`" in
     "SunOS 5"*)
       echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6
-echo "configure:2264: checking whether -R must be followed by a space" >&5
+echo "configure:2268: checking whether -R must be followed by a space" >&5
       ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries"
       cat > conftest.$ac_ext <<EOF
-#line 2267 "configure"
+#line 2271 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2274: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2278: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_R_nospace=yes
 else
@@ -2286,14 +2290,14 @@
       else
        LIBS="$ac_xsave_LIBS -R $x_libraries"
        cat > conftest.$ac_ext <<EOF
-#line 2290 "configure"
+#line 2294 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2297: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2301: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_R_space=yes
 else
@@ -2325,7 +2329,7 @@
     # libraries were built with DECnet support.  And karl@cs.umb.edu says
     # the Alpha needs dnet_stub (dnet does not exist).
     echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6
-echo "configure:2329: checking for dnet_ntoa in -ldnet" >&5
+echo "configure:2333: checking for dnet_ntoa in -ldnet" >&5
 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2333,7 +2337,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ldnet  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2337 "configure"
+#line 2341 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2344,7 +2348,7 @@
 dnet_ntoa()
 ; return 0; }
 EOF
-if { (eval echo configure:2348: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2352: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2366,7 +2370,7 @@
 
     if test $ac_cv_lib_dnet_dnet_ntoa = no; then
       echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6
-echo "configure:2370: checking for dnet_ntoa in -ldnet_stub" >&5
+echo "configure:2374: checking for dnet_ntoa in -ldnet_stub" >&5
 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2374,7 +2378,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ldnet_stub  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2378 "configure"
+#line 2382 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2385,7 +2389,7 @@
 dnet_ntoa()
 ; return 0; }
 EOF
-if { (eval echo configure:2389: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2393: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2414,12 +2418,12 @@
     # The nsl library prevents programs from opening the X display
     # on Irix 5.2, according to dickey@clark.net.
     echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:2418: checking for gethostbyname" >&5
+echo "configure:2422: checking for gethostbyname" >&5
 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2423 "configure"
+#line 2427 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gethostbyname(); below.  */
@@ -2442,7 +2446,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2446: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2450: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_gethostbyname=yes"
 else
@@ -2463,7 +2467,7 @@
 
     if test $ac_cv_func_gethostbyname = no; then
       echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:2467: checking for gethostbyname in -lnsl" >&5
+echo "configure:2471: checking for gethostbyname in -lnsl" >&5
 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2471,7 +2475,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2475 "configure"
+#line 2479 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2482,7 +2486,7 @@
 gethostbyname()
 ; return 0; }
 EOF
-if { (eval echo configure:2486: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2490: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2512,12 +2516,12 @@
     # -lsocket must be given before -lnsl if both are needed.
     # We assume that if connect needs -lnsl, so does gethostbyname.
     echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:2516: checking for connect" >&5
+echo "configure:2520: checking for connect" >&5
 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2521 "configure"
+#line 2525 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char connect(); below.  */
@@ -2540,7 +2544,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2544: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2548: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_connect=yes"
 else
@@ -2561,7 +2565,7 @@
 
     if test $ac_cv_func_connect = no; then
       echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
-echo "configure:2565: checking for connect in -lsocket" >&5
+echo "configure:2569: checking for connect in -lsocket" >&5
 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2569,7 +2573,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2573 "configure"
+#line 2577 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2580,7 +2584,7 @@
 connect()
 ; return 0; }
 EOF
-if { (eval echo configure:2584: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2588: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2604,12 +2608,12 @@
 
     # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX.
     echo $ac_n "checking for remove""... $ac_c" 1>&6
-echo "configure:2608: checking for remove" >&5
+echo "configure:2612: checking for remove" >&5
 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2613 "configure"
+#line 2617 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char remove(); below.  */
@@ -2632,7 +2636,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2636: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2640: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_remove=yes"
 else
@@ -2653,7 +2657,7 @@
 
     if test $ac_cv_func_remove = no; then
       echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6
-echo "configure:2657: checking for remove in -lposix" >&5
+echo "configure:2661: checking for remove in -lposix" >&5
 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2661,7 +2665,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lposix  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2665 "configure"
+#line 2669 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2672,7 +2676,7 @@
 remove()
 ; return 0; }
 EOF
-if { (eval echo configure:2676: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2680: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2696,12 +2700,12 @@
 
     # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
     echo $ac_n "checking for shmat""... $ac_c" 1>&6
-echo "configure:2700: checking for shmat" >&5
+echo "configure:2704: checking for shmat" >&5
 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2705 "configure"
+#line 2709 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char shmat(); below.  */
@@ -2724,7 +2728,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2728: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2732: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_shmat=yes"
 else
@@ -2745,7 +2749,7 @@
 
     if test $ac_cv_func_shmat = no; then
       echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6
-echo "configure:2749: checking for shmat in -lipc" >&5
+echo "configure:2753: checking for shmat in -lipc" >&5
 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2753,7 +2757,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lipc  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2757 "configure"
+#line 2761 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2764,7 +2768,7 @@
 shmat()
 ; return 0; }
 EOF
-if { (eval echo configure:2768: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2772: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2797,7 +2801,7 @@
   # libraries we check for below, so use a different variable.
   #  --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
   echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6
-echo "configure:2801: checking for IceConnectionNumber in -lICE" >&5
+echo "configure:2805: checking for IceConnectionNumber in -lICE" >&5
 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2805,7 +2809,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lICE  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2809 "configure"
+#line 2813 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2816,7 +2820,7 @@
 IceConnectionNumber()
 ; return 0; }
 EOF
-if { (eval echo configure:2820: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2824: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2843,7 +2847,7 @@
        LDFLAGS="$LDFLAGS $X_LIBS"
        CFLAGS="$CFLAGS $X_CFLAGS"
        echo $ac_n "checking for XOpenDisplay in -lX11""... $ac_c" 1>&6
-echo "configure:2847: checking for XOpenDisplay in -lX11" >&5
+echo "configure:2851: checking for XOpenDisplay in -lX11" >&5
 ac_lib_var=`echo X11'_'XOpenDisplay | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2851,7 +2855,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lX11 $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2855 "configure"
+#line 2859 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2862,7 +2866,7 @@
 XOpenDisplay()
 ; return 0; }
 EOF
-if { (eval echo configure:2866: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2870: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2883,7 +2887,7 @@
 fi
 
        echo $ac_n "checking for XtAppInitialize in -lXt""... $ac_c" 1>&6
-echo "configure:2887: checking for XtAppInitialize in -lXt" >&5
+echo "configure:2891: checking for XtAppInitialize in -lXt" >&5
 ac_lib_var=`echo Xt'_'XtAppInitialize | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2891,7 +2895,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2895 "configure"
+#line 2899 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2902,7 +2906,7 @@
 XtAppInitialize()
 ; return 0; }
 EOF
-if { (eval echo configure:2906: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2910: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2947,17 +2951,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2951: checking for $ac_hdr" >&5
+echo "configure:2955: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2956 "configure"
+#line 2960 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2961: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2965: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2985,7 +2989,7 @@
 
 
 
-cf_x_athena=Xaw
+cf_x_athena=${cf_x_athena-Xaw}
 
 # Check whether --with-Xaw3d or --without-Xaw3d was given.
 if test "${with_Xaw3d+set}" = set; then
@@ -3005,17 +3009,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3009: checking for $ac_hdr" >&5
+echo "configure:3013: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3014 "configure"
+#line 3018 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3019: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3023: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3043,7 +3047,7 @@
 
 
 echo $ac_n "checking for XmuClientWindow in -lXmu""... $ac_c" 1>&6
-echo "configure:3047: checking for XmuClientWindow in -lXmu" >&5
+echo "configure:3051: checking for XmuClientWindow in -lXmu" >&5
 ac_lib_var=`echo Xmu'_'XmuClientWindow | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3051,7 +3055,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lXmu  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3055 "configure"
+#line 3059 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3062,7 +3066,7 @@
 XmuClientWindow()
 ; return 0; }
 EOF
-if { (eval echo configure:3066: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3070: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3089,7 +3093,7 @@
   echo "$ac_t""no" 1>&6
 
 echo $ac_n "checking for XmuClientWindow in -lXmu_s""... $ac_c" 1>&6
-echo "configure:3093: checking for XmuClientWindow in -lXmu_s" >&5
+echo "configure:3097: checking for XmuClientWindow in -lXmu_s" >&5
 ac_lib_var=`echo Xmu_s'_'XmuClientWindow | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3097,7 +3101,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lXmu_s  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3101 "configure"
+#line 3105 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3108,7 +3112,7 @@
 XmuClientWindow()
 ; return 0; }
 EOF
-if { (eval echo configure:3112: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3116: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3139,7 +3143,7 @@
 
 
 echo $ac_n "checking for XextCreateExtension in -lXext""... $ac_c" 1>&6
-echo "configure:3143: checking for XextCreateExtension in -lXext" >&5
+echo "configure:3147: checking for XextCreateExtension in -lXext" >&5
 ac_lib_var=`echo Xext'_'XextCreateExtension | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3147,7 +3151,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lXext  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3151 "configure"
+#line 3155 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3158,7 +3162,7 @@
 XextCreateExtension()
 ; return 0; }
 EOF
-if { (eval echo configure:3162: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3166: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3180,7 +3184,7 @@
 
 
 echo $ac_n "checking for XawSimpleMenuAddGlobalActions in -l$cf_x_athena""... $ac_c" 1>&6
-echo "configure:3184: checking for XawSimpleMenuAddGlobalActions in -l$cf_x_athena" >&5
+echo "configure:3188: checking for XawSimpleMenuAddGlobalActions in -l$cf_x_athena" >&5
 ac_lib_var=`echo $cf_x_athena'_'XawSimpleMenuAddGlobalActions | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3188,7 +3192,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-l$cf_x_athena  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3192 "configure"
+#line 3196 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3199,7 +3203,7 @@
 XawSimpleMenuAddGlobalActions()
 ; return 0; }
 EOF
-if { (eval echo configure:3203: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3207: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3219,7 +3223,7 @@
   echo "$ac_t""no" 1>&6
 
 echo $ac_n "checking for XawSimpleMenuAddGlobalActions in -l${cf_x_athena}_s""... $ac_c" 1>&6
-echo "configure:3223: checking for XawSimpleMenuAddGlobalActions in -l${cf_x_athena}_s" >&5
+echo "configure:3227: checking for XawSimpleMenuAddGlobalActions in -l${cf_x_athena}_s" >&5
 ac_lib_var=`echo ${cf_x_athena}_s'_'XawSimpleMenuAddGlobalActions | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3227,7 +3231,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-l${cf_x_athena}_s $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3231 "configure"
+#line 3235 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3238,7 +3242,7 @@
 XawSimpleMenuAddGlobalActions()
 ; return 0; }
 EOF
-if { (eval echo configure:3242: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3246: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3262,11 +3266,18 @@
 fi
 
 
+CF_X_ATHENA_LIBS=`echo HAVE_LIB_$cf_x_athena | tr '[a-z]' '[A-Z]'`
+
+cat >> confdefs.h <<EOF
+#define $CF_X_ATHENA_LIBS 1
+EOF
+
+
 
 LIBS="$LIBS $X_EXTRA_LIBS"
 
 echo $ac_n "checking if we should use imake to help""... $ac_c" 1>&6
-echo "configure:3270: checking if we should use imake to help" >&5
+echo "configure:3281: checking if we should use imake to help" >&5
 # Check whether --enable-imake or --disable-imake was given.
 if test "${enable_imake+set}" = set; then
   enableval="$enable_imake"
@@ -3290,7 +3301,7 @@
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3294: checking for $ac_word" >&5
+echo "configure:3305: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_IMAKE'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3385,7 +3396,7 @@
 
 
 echo $ac_n "checking for default terminal-id""... $ac_c" 1>&6
-echo "configure:3389: checking for default terminal-id" >&5
+echo "configure:3400: checking for default terminal-id" >&5
 # Check whether --with-terminal-id or --without-terminal-id was given.
 if test "${with_terminal_id+set}" = set; then
   withval="$with_terminal_id"
@@ -3404,9 +3415,25 @@
 EOF
 
 
+echo $ac_n "checking for default terminal-type""... $ac_c" 1>&6
+echo "configure:3420: checking for default terminal-type" >&5
+# Check whether --with-terminal-type or --without-terminal-type was given.
+if test "${with_terminal_type+set}" = set; then
+  withval="$with_terminal_type"
+  default_TERM=$withval
+else
+  default_TERM=xterm
+fi
+
+echo "$ac_t""$default_TERM" 1>&6
+cat >> confdefs.h <<EOF
+#define DFT_TERMTYPE "$default_TERM"
+EOF
+
+
 ###    checks for optional features
 echo $ac_n "checking if you want active-icons""... $ac_c" 1>&6
-echo "configure:3410: checking if you want active-icons" >&5
+echo "configure:3437: checking if you want active-icons" >&5
 # Check whether --enable-active-icon or --disable-active-icon was given.
 if test "${enable_active_icon+set}" = set; then
   enableval="$enable_active_icon"
@@ -3431,7 +3458,7 @@
 fi
 
 echo $ac_n "checking if you want ANSI color""... $ac_c" 1>&6
-echo "configure:3435: checking if you want ANSI color" >&5
+echo "configure:3462: checking if you want ANSI color" >&5
 # Check whether --enable-ansi-color or --disable-ansi-color was given.
 if test "${enable_ansi_color+set}" = set; then
   enableval="$enable_ansi_color"
@@ -3454,7 +3481,7 @@
 
 
 echo $ac_n "checking if you want 16 colors like aixterm""... $ac_c" 1>&6
-echo "configure:3458: checking if you want 16 colors like aixterm" >&5
+echo "configure:3485: checking if you want 16 colors like aixterm" >&5
 # Check whether --enable-16-color or --disable-16-color was given.
 if test "${enable_16_color+set}" = set; then
   enableval="$enable_16_color"
@@ -3477,7 +3504,7 @@
 
 
 echo $ac_n "checking if you want bold colors mapped like IBM PC""... $ac_c" 1>&6
-echo "configure:3481: checking if you want bold colors mapped like IBM PC" >&5
+echo "configure:3508: checking if you want bold colors mapped like IBM PC" >&5
 # Check whether --enable-bold-color or --disable-bold-color was given.
 if test "${enable_bold_color+set}" = set; then
   enableval="$enable_bold_color"
@@ -3500,7 +3527,7 @@
 
 
 echo $ac_n "checking if you want color-mode enabled by default""... $ac_c" 1>&6
-echo "configure:3504: checking if you want color-mode enabled by default" >&5
+echo "configure:3531: checking if you want color-mode enabled by default" >&5
 # Check whether --enable-color-mode or --disable-color-mode was given.
 if test "${enable_color_mode+set}" = set; then
   enableval="$enable_color_mode"
@@ -3523,7 +3550,7 @@
 
 
 echo $ac_n "checking for doublesize characters""... $ac_c" 1>&6
-echo "configure:3527: checking for doublesize characters" >&5
+echo "configure:3554: checking for doublesize characters" >&5
 # Check whether --enable-doublechars or --disable-doublechars was given.
 if test "${enable_doublechars+set}" = set; then
   enableval="$enable_doublechars"
@@ -3546,7 +3573,7 @@
 
 
 echo $ac_n "checking if you want support for input-method""... $ac_c" 1>&6
-echo "configure:3550: checking if you want support for input-method" >&5
+echo "configure:3577: checking if you want support for input-method" >&5
 # Check whether --enable-input-method or --disable-input-method was given.
 if test "${enable_input_method+set}" = set; then
   enableval="$enable_input_method"
@@ -3571,7 +3598,7 @@
 fi
 
 echo $ac_n "checking if you want support for internationalization""... $ac_c" 1>&6
-echo "configure:3575: checking if you want support for internationalization" >&5
+echo "configure:3602: checking if you want support for internationalization" >&5
 # Check whether --enable-i18n or --disable-i18n was given.
 if test "${enable_i18n+set}" = set; then
   enableval="$enable_i18n"
@@ -3596,7 +3623,7 @@
 fi
 
 echo $ac_n "checking if you want support for logging""... $ac_c" 1>&6
-echo "configure:3600: checking if you want support for logging" >&5
+echo "configure:3627: checking if you want support for logging" >&5
 # Check whether --enable-logging or --disable-logging was given.
 if test "${enable_logging+set}" = set; then
   enableval="$enable_logging"
@@ -3621,7 +3648,7 @@
 fi
 
 echo $ac_n "checking if you want support for right-scrollbar""... $ac_c" 1>&6
-echo "configure:3625: checking if you want support for right-scrollbar" >&5
+echo "configure:3652: checking if you want support for right-scrollbar" >&5
 # Check whether --enable-rightbar or --disable-rightbar was given.
 if test "${enable_rightbar+set}" = set; then
   enableval="$enable_rightbar"
@@ -3645,35 +3672,37 @@
 
 fi
 
-echo $ac_n "checking if you want debugging traces""... $ac_c" 1>&6
-echo "configure:3650: checking if you want debugging traces" >&5
-# Check whether --enable-trace or --disable-trace was given.
-if test "${enable_trace+set}" = set; then
-  enableval="$enable_trace"
-  test "$enableval" != yes && enableval=no
-  if test "$enableval" != "no" ; then
-    enable_trace=yes 
+echo $ac_n "checking if you want support for tek4014""... $ac_c" 1>&6
+echo "configure:3677: checking if you want support for tek4014" >&5
+# Check whether --enable-tek4014 or --disable-tek4014 was given.
+if test "${enable_tek4014+set}" = set; then
+  enableval="$enable_tek4014"
+  test "$enableval" != no && enableval=yes
+  if test "$enableval" != "yes" ; then
+    enable_tek4014=no 
   else
-    enable_trace=no
+    enable_tek4014=yes
   fi
 else
-  enableval=no 
-  enable_trace=no
+  enableval=yes 
+  enable_tek4014=yes
   
 fi
 
-echo "$ac_t""$enable_trace" 1>&6
-if test $enable_trace = yes ; then
+echo "$ac_t""$enable_tek4014" 1>&6
+if test $enable_tek4014 = no ; then
        cat >> confdefs.h <<\EOF
-#define OPT_TRACE 1
+#define OPT_TEK4014 0
 EOF
 
-       EXTRASRCS="$EXTRASRCS trace.c"
-       EXTRAOBJS="$EXTRAOBJS trace.o"
+else
+       EXTRAHDRS="$EXTRAHDRS TekParse.h"
+       EXTRASRCS="$EXTRASRCS TekPrsTbl.c Tekproc.c"
+       EXTRAOBJS="$EXTRAOBJS TekPrsTbl.o Tekproc.o"
 fi
 
 echo $ac_n "checking if you want VT52 emulation""... $ac_c" 1>&6
-echo "configure:3677: checking if you want VT52 emulation" >&5
+echo "configure:3706: checking if you want VT52 emulation" >&5
 # Check whether --enable-vt52 or --disable-vt52 was given.
 if test "${enable_vt52+set}" = set; then
   enableval="$enable_vt52"
@@ -3696,9 +3725,36 @@
 
 
 # development/testing aids
+echo $ac_n "checking if you want debugging traces""... $ac_c" 1>&6
+echo "configure:3730: checking if you want debugging traces" >&5
+# Check whether --enable-trace or --disable-trace was given.
+if test "${enable_trace+set}" = set; then
+  enableval="$enable_trace"
+  test "$enableval" != yes && enableval=no
+  if test "$enableval" != "no" ; then
+    enable_trace=yes 
+  else
+    enable_trace=no
+  fi
+else
+  enableval=no 
+  enable_trace=no
+  
+fi
+
+echo "$ac_t""$enable_trace" 1>&6
+if test $enable_trace = yes ; then
+       cat >> confdefs.h <<\EOF
+#define OPT_TRACE 1
+EOF
+
+       EXTRASRCS="$EXTRASRCS trace.c"
+       EXTRAOBJS="$EXTRAOBJS trace.o"
+fi
+
 
 echo $ac_n "checking if you want to see long compiling messages""... $ac_c" 1>&6
-echo "configure:3702: checking if you want to see long compiling messages" >&5
+echo "configure:3758: checking if you want to see long compiling messages" >&5
 # Check whether --enable-echo or --disable-echo was given.
 if test "${enable_echo+set}" = set; then
   enableval="$enable_echo"
@@ -3737,7 +3793,7 @@
 
 
 echo $ac_n "checking if you want magic cookie emulation""... $ac_c" 1>&6
-echo "configure:3741: checking if you want magic cookie emulation" >&5
+echo "configure:3797: checking if you want magic cookie emulation" >&5
 # Check whether --enable-xmc-glitch or --disable-xmc-glitch was given.
 if test "${enable_xmc_glitch+set}" = set; then
   enableval="$enable_xmc_glitch"
@@ -3763,10 +3819,9 @@
        EXTRAOBJS="$EXTRAOBJS testxmc.o"
 fi
 
-
 if test -n "$GCC" ; then
 echo $ac_n "checking if you want to turn on gcc warnings""... $ac_c" 1>&6
-echo "configure:3770: checking if you want to turn on gcc warnings" >&5
+echo "configure:3825: checking if you want to turn on gcc warnings" >&5
 # Check whether --enable-warnings or --disable-warnings was given.
 if test "${enable_warnings+set}" = set; then
   enableval="$enable_warnings"
@@ -3805,9 +3860,9 @@
 if test -n "$GCC"
 then
        echo "checking for gcc __attribute__ directives" 1>&6
-echo "configure:3809: checking for gcc __attribute__ directives" >&5
+echo "configure:3864: checking for gcc __attribute__ directives" >&5
        cat > conftest.$ac_ext <<EOF
-#line 3811 "configure"
+#line 3866 "configure"
 #include "confdefs.h"
 #include "conftest.h"
 #include "conftest.i"
@@ -3845,7 +3900,7 @@
 EOF
                        ;;
                esac
-               if { (eval echo configure:3849: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+               if { (eval echo configure:3904: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
                        test -n "$verbose" && echo "$ac_t""... $cf_attribute" 1>&6
                        cat conftest.h >>confdefs.h
 #              else
@@ -3862,11 +3917,11 @@
 if test -n "$GCC"
 then
                cat > conftest.$ac_ext <<EOF
-#line 3866 "configure"
+#line 3921 "configure"
 int main(int argc, char *argv[]) { return argv[argc-1] == 0; }
 EOF
                echo "checking for gcc warning options" 1>&6
-echo "configure:3870: checking for gcc warning options" >&5
+echo "configure:3925: checking for gcc warning options" >&5
        cf_save_CFLAGS="$CFLAGS"
        EXTRA_CFLAGS="-W -Wall"
        cf_warn_CONST=""
@@ -3884,7 +3939,7 @@
                Wstrict-prototypes $cf_warn_CONST
        do
                CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
-               if { (eval echo configure:3888: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+               if { (eval echo configure:3943: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
                        test -n "$verbose" && echo "$ac_t""... -$cf_opt" 1>&6
                        EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
                        test "$cf_opt" = Wcast-qual && EXTRA_CFLAGS="$EXTRA_CFLAGS -DXTSTRINGDEFINES"
@@ -3902,6 +3957,7 @@
 
 
 
+
 ###    output Makefile and xtermcfg.h
 trap '' 1 2 15
 cat > confcache <<\EOF
@@ -3926,7 +3982,7 @@
 # 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) 2>&1` in
+  case `(ac_space=' '; set) 2>&1 | grep '^ac_space='` in
   *ac_space=\ *)
     # `set' does not quote correctly, so add quotes (double-quote substitution
     # turns \\\\ into \\, and sed turns \\ into \).
@@ -3993,7 +4049,7 @@
     echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
     exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
   -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
-    echo "$CONFIG_STATUS generated by autoconf version 2.12"
+    echo "$CONFIG_STATUS generated by autoconf version 2.12.970309"
     exit 0 ;;
   -help | --help | --hel | --he | --h)
     echo "\$ac_cs_usage"; exit 0 ;;
@@ -4054,6 +4110,7 @@
 s%@SHOW_CC@%$SHOW_CC%g
 s%@ECHO_CC@%$ECHO_CC%g
 s%@EXTRA_CFLAGS@%$EXTRA_CFLAGS%g
+s%@EXTRAHDRS@%$EXTRAHDRS%g
 s%@EXTRASRCS@%$EXTRASRCS%g
 s%@EXTRAOBJS@%$EXTRAOBJS%g
 
Index: configure.in
--- xterm-56+/configure.in      Tue Oct 14 21:40:58 1997
+++ xterm-57/configure.in       Fri Dec 26 13:33:00 1997
@@ -102,6 +102,14 @@
 esac
 AC_DEFINE_UNQUOTED(DFT_DECID,$default_termid)
 
+AC_MSG_CHECKING(for default terminal-type)
+AC_ARG_WITH(terminal-type,
+       [  --with-terminal-type=T  set default \$TERM (default: xterm)],
+       [default_TERM=$withval],
+       [default_TERM=xterm])
+AC_MSG_RESULT($default_TERM)
+AC_DEFINE_UNQUOTED(DFT_TERMTYPE,"$default_TERM")
+
 ###    checks for optional features
 AC_MSG_CHECKING(if you want active-icons)
 CF_ARG_DISABLE(active-icon,
@@ -185,7 +193,7 @@
 
 AC_MSG_CHECKING(if you want support for right-scrollbar)
 CF_ARG_DISABLE(rightbar,
-       [  --disable-rightbar      enable logging],
+       [  --disable-rightbar      disable right-scrollbar support],
        [enable_rightbar=no],
        [enable_rightbar=yes])
 AC_MSG_RESULT($enable_rightbar)
@@ -193,6 +201,29 @@
        AC_DEFINE(SCROLLBAR_RIGHT)
 fi
 
+AC_MSG_CHECKING(if you want support for tek4014)
+CF_ARG_DISABLE(tek4014,
+       [  --disable-tek4014       disable tek4014 emulation],
+       [enable_tek4014=no],
+       [enable_tek4014=yes])
+AC_MSG_RESULT($enable_tek4014)
+if test $enable_tek4014 = no ; then
+       AC_DEFINE(OPT_TEK4014,0)
+else
+       EXTRAHDRS="$EXTRAHDRS TekParse.h"
+       EXTRASRCS="$EXTRASRCS TekPrsTbl.c Tekproc.c"
+       EXTRAOBJS="$EXTRAOBJS TekPrsTbl.o Tekproc.o"
+fi
+
+AC_MSG_CHECKING(if you want VT52 emulation)
+CF_ARG_DISABLE(vt52,
+       [  --disable-vt52          disable VT52 emulation],
+       [enable_vt52=no],
+       [enable_vt52=yes])
+AC_MSG_RESULT($enable_vt52)
+test $enable_vt52 = no && AC_DEFINE(OPT_VT52_MODE,0)
+
+# development/testing aids
 AC_MSG_CHECKING(if you want debugging traces)
 CF_ARG_ENABLE(trace,
        [  --enable-trace          test: set to enable debugging traces],
@@ -205,15 +236,6 @@
        EXTRAOBJS="$EXTRAOBJS trace.o"
 fi
 
-AC_MSG_CHECKING(if you want VT52 emulation)
-CF_ARG_DISABLE(vt52,
-       [  --disable-vt52          disable VT52 emulation],
-       [enable_vt52=no],
-       [enable_vt52=yes])
-AC_MSG_RESULT($enable_vt52)
-test $enable_vt52 = no && AC_DEFINE(OPT_VT52_MODE,0)
-
-# development/testing aids
 CF_DISABLE_ECHO
 
 AC_MSG_CHECKING(if you want magic cookie emulation)
@@ -228,7 +250,6 @@
        EXTRAOBJS="$EXTRAOBJS testxmc.o"
 fi
 
-
 if test -n "$GCC" ; then
 AC_MSG_CHECKING(if you want to turn on gcc warnings)
 CF_ARG_ENABLE(warnings,
@@ -244,6 +265,7 @@
 fi
 
 AC_SUBST(EXTRA_CFLAGS)
+AC_SUBST(EXTRAHDRS)
 AC_SUBST(EXTRASRCS)
 AC_SUBST(EXTRAOBJS)
 
Index: data.c
--- xterm-56+/data.c    Tue Sep 30 07:04:42 1997
+++ xterm-57/data.c     Tue Dec  9 18:13:28 1997
@@ -35,6 +35,10 @@
 
 #include <setjmp.h>
 
+#if OPT_TEK4014
+TekWidget tekWidget;
+TekLink *TekRefresh;
+
 XPoint T_boxlarge[NBOX] = {
        {0, 0},
        {8, 0},
@@ -67,10 +71,11 @@
 int Tbcnt = 0;
 Char *Tbuffer;
 Char *Tbptr;
-TekLink *TekRefresh;
 Char *Tpushb;
 Char *Tpushback;
 int Ttoggled = 0;
+#endif
+
 int bcnt = 0;
 Char buffer[BUF_SIZE];
 Char *bptr = buffer;
@@ -116,5 +121,3 @@
 
 int VTgcFontMask = GCFont;
 int TEKgcFontMask = GCFont;
-
-TekWidget tekWidget;
Index: data.h
--- xterm-56+/data.h    Tue Sep 30 07:04:42 1997
+++ xterm-57/data.h     Thu Dec 25 13:36:48 1997
@@ -39,16 +39,25 @@
 
 extern XtAppContext app_con;
 
+#if OPT_TEK4014
 extern TekLink *TekRefresh;
+extern TekWidget tekWidget;
+
 extern XPoint T_box2[];
 extern XPoint T_box3[];
 extern XPoint T_boxlarge[];
 extern XPoint T_boxsmall[];
-extern XPoint VTbox[];
 extern Char *Tbptr;
 extern Char *Tbuffer;
 extern Char *Tpushb;
 extern Char *Tpushback;
+extern int T_lastx;
+extern int T_lasty;
+extern int Tbcnt;
+extern int Ttoggled;
+#endif
+
+extern XPoint VTbox[];
 extern Char *bptr;
 #ifdef ALLOWLOGGING
 extern char log_def_name[];
@@ -61,10 +70,6 @@
 extern Boolean sunKeyboard;
 #endif
 extern Char buffer[];
-extern int T_lastx;
-extern int T_lasty;
-extern int Tbcnt;
-extern int Ttoggled;
 extern int am_slave;
 extern int done_setuid;
 extern int bcnt;
@@ -88,7 +93,6 @@
 extern int TEKgcFontMask;
 
 extern XtermWidget term;
-extern TekWidget tekWidget;
 
 #ifdef XKB
 #include <X11/extensions/XKBbells.h>
Index: input.c
--- xterm-56+/input.c   Fri Sep 19 13:58:52 1997
+++ xterm-57/input.c    Tue Dec  9 18:18:21 1997
@@ -235,11 +235,13 @@
                        unparseputc(kypd_num[keysym-XK_KP_Space], pty);
                key = TRUE;
        } else if (nbytes > 0) {
+#if OPT_TEK4014
                if(screen->TekGIN) {
                        TekEnqMouse(*string++);
                        TekGINoff();
                        nbytes--;
                }
+#endif
                if ((nbytes == 1) && eightbit) {
                    if (screen->input_eight_bits)
                      *string |= 0x80;  /* turn on eighth bit */
@@ -250,7 +252,7 @@
                        unparseputc(*string++, pty);
                key = TRUE;
        }
-       if(key && !screen->TekEmu)
+       if(key && !TEK4014_ACTIVE(screen))
                AdjustAfterInput(screen);
 #ifdef ENABLE_PRINT
        if (keysym == XK_F2) TekPrint();
@@ -266,14 +268,16 @@
 {
        int     pty     = screen->respond;
 
+#if OPT_TEK4014
        if(nbytes && screen->TekGIN) {
                TekEnqMouse(*string++);
                TekGINoff();
                nbytes--;
        }
+#endif
        while (nbytes-- != 0)
                unparseputc(*string++, pty);
-       if(!screen->TekEmu)
+       if (!TEK4014_ACTIVE(screen))
                AdjustAfterInput(screen);
 }
 
Index: main.c
--- xterm-56+/main.c    Sat Dec  6 10:24:45 1997
+++ xterm-57/main.c     Fri Dec 26 13:37:00 1997
@@ -501,7 +501,6 @@
 static void Syntax PROTO((char *badOption));
 static void get_terminal PROTO((void));
 static void resize PROTO((TScreen *s, char *oldtc, char *newtc));
-
 static SIGNAL_T reapchild PROTO((int n));
 
 static Bool added_utmp_entry = False;
@@ -730,7 +729,7 @@
 
 static XtResource application_resources[] = {
     {"name", "Name", XtRString, sizeof(char *),
-       offset(xterm_name), XtRString, "xterm"},
+       offset(xterm_name), XtRString, DFT_TERMTYPE},
     {"iconGeometry", "IconGeometry", XtRString, sizeof(char *),
        offset(icon_geometry), XtRString, (caddr_t) NULL},
     {XtNtitle, XtCTitle, XtRString, sizeof(char *),
@@ -764,7 +763,9 @@
     "XTerm*mainMenu.Label:  Main Options (no app-defaults)",
     "XTerm*vtMenu.Label:  VT Options (no app-defaults)",
     "XTerm*fontMenu.Label:  VT Fonts (no app-defaults)",
+#if OPT_TEK4014
     "XTerm*tekMenu.Label:  Tek Options (no app-defaults)",
+#endif
     NULL
 };
 
@@ -930,7 +931,9 @@
 { "-/+sk",                 "turn on/off scroll-on-keypress" },
 { "-sl number",            "number of scrolled lines to save" },
 { "-/+sp",                 "turn on/off Sun/PC Function/Keypad mapping" },
+#if OPT_TEK4014
 { "-/+t",                  "turn on/off Tek emulation window" },
+#endif
 { "-tm string",            "terminal mode keywords and characters" },
 { "-tn name",              "TERM environment variable name" },
 { "-/+ulc",                "turn off/on display of underline as color" },
@@ -942,7 +945,9 @@
 { "-/+vb",                 "turn on/off visual bell" },
 { "-/+wf",                 "turn on/off wait for map before command exec" },
 { "-e command args ...",   "command to execute" },
+#if OPT_TEK4014
 { "%geom",                 "Tek window geometry" },
+#endif
 { "#geom",                 "icon window geometry" },
 { "-T string",             "title name for window" },
 { "-n string",             "icon name for window" },
@@ -1046,6 +1051,7 @@
     String *params GCC_UNUSED;
     Cardinal *num_params GCC_UNUSED;
 {
+#if OPT_TEK4014
   if (w == toplevel)
     if (term->screen.Tshow)
       hide_vt_window();
@@ -1055,6 +1061,7 @@
     if (term->screen.Vshow)
       hide_tek_window();
     else
+#endif
       do_hangup(w, (XtPointer)0, (XtPointer)0);
 }
 
@@ -1372,12 +1379,14 @@
 #endif
 
            toplevel = XtAppInitialize (&app_con, "XTerm", 
-                                   optionDescList, XtNumber(optionDescList), 
-                                   &argc, argv, fallback_resources, NULL, 0);
+                                       optionDescList,
+                                       XtNumber(optionDescList),
+                                       &argc, argv, fallback_resources,
+                                       NULL, 0);
 
            XtGetApplicationResources(toplevel, (XtPointer) &resource,
-                                 application_resources,
-                                 XtNumber(application_resources), NULL, 0);
+                                     application_resources,
+                                     XtNumber(application_resources), NULL, 0);
 
 #ifdef HAS_SAVED_IDS_AND_SETEUID
            if (seteuid(euid) == -1)
@@ -1390,7 +1399,6 @@
 #endif
        }
 
-
        waiting_for_initial_map = resource.wait_for_map;
 
        /*
@@ -1416,7 +1424,7 @@
 #if OPT_SUNPC_KBD
        sunKeyboard = resource.sunKeyboard;
 #endif
-       if (strcmp(xterm_name, "-") == 0) xterm_name = "xterm";
+       if (strcmp(xterm_name, "-") == 0) xterm_name = DFT_TERMTYPE;
        if (resource.icon_geometry != NULL) {
            int scr, junk;
            int ix, iy;
@@ -1494,7 +1502,7 @@
 
         term = (XtermWidget) XtCreateManagedWidget(
            "vt100", xtermWidgetClass, toplevel, NULL, 0);
-            /* this causes the initialize method to be called */
+           /* this causes the initialize method to be called */
 
         screen = &term->screen;
 
@@ -1520,10 +1528,12 @@
 
        inhibit = 0;
 #ifdef ALLOWLOGGING
-       if (term->misc.logInhibit)          inhibit |= I_LOG;
+       if (term->misc.logInhibit)              inhibit |= I_LOG;
 #endif
        if (term->misc.signalInhibit)           inhibit |= I_SIGNAL;
-       if (term->misc.tekInhibit)                      inhibit |= I_TEK;
+#if OPT_TEK4014
+       if (term->misc.tekInhibit)              inhibit |= I_TEK;
+#endif
 
        term->initflags = term->flags;
 
@@ -1558,12 +1568,13 @@
            XtSetValues (toplevel, args, 2);
        }
 
-
+#if OPT_TEK4014
        if(inhibit & I_TEK)
                screen->TekEmu = FALSE;
 
        if(screen->TekEmu && !TekInit())
                exit(ERROR_INIT);
+#endif
 
 #ifndef MINIX
 #ifdef DEBUG
@@ -1608,9 +1619,11 @@
 
        /* open a terminal for client */
        get_terminal ();
+
        spawn ();
+
        /* Child process is out there, let's catch its termination */
-       signal (SIGCHLD, reapchild);
+       (void) signal (SIGCHLD, reapchild);
 
        /* Realize procs have now been executed */
 
@@ -1619,9 +1632,7 @@
            char buf[80];
 
            buf[0] = '\0';
-           sprintf (buf, "%lx\n", 
-                    screen->TekEmu ? XtWindow (XtParent (tekWidget)) :
-                                     XtWindow (XtParent (term)));
+           sprintf (buf, "%lx\n", XtWindow (XtParent (CURRENT_EMU(screen))));
            write (screen->respond, buf, strlen (buf));
        }
 #endif /* !AMOEBA */
@@ -1701,11 +1712,12 @@
        }
 #endif
        for( ; ; ) {
-               if(screen->TekEmu) {
+#if OPT_TEK4014
+               if(screen->TekEmu)
                        TekRun();
-               } else {
+               else
+#endif
                        VTRun();
-               }
        }
 }
 
@@ -1924,6 +1936,7 @@
  * All of these are supported by xterm.
  */
 
+#if OPT_TEK4014
 static char *tekterm[] = {
        "tek4014",
        "tek4015",              /* 4014 with APL character set support */
@@ -1933,6 +1946,7 @@
        "dumb",
        0
 };
+#endif
 
 /* The VT102 is a VT100 with the Advanced Video Option included standard.
  * It also adds Escape sequences for insert/delete character/line.
@@ -1945,6 +1959,7 @@
 #ifdef USE_X11TERM
        "x11term",              /* for people who want special term name */
 #endif
+       DFT_TERMTYPE,           /* for people who want special term name */
        "xterm",                /* the prefered name, should be fastest */
        "vt102",
        "vt100",
@@ -2140,24 +2155,25 @@
        } else {
                Bool tty_got_hung;
 
-               /*
-                * Sometimes /dev/tty hangs on open (as in the case of a pty
-                * that has gone away).  Simply make up some reasonable
-                * defaults.
-                */
-               signal(SIGALRM, hungtty);
-               alarm(2);               /* alarm(1) might return too soon */
-               if (! setjmp(env)) {
-                       tty = open ("/dev/tty", O_RDWR, 0);
-                       alarm(0);
+               /*
+                * Sometimes /dev/tty hangs on open (as in the case of a pty
+                * that has gone away).  Simply make up some reasonable
+                * defaults.
+                */
+
+               signal(SIGALRM, hungtty);
+               alarm(2);               /* alarm(1) might return too soon */
+               if (! setjmp(env)) {
+                       tty = open ("/dev/tty", O_RDWR, 0);
+                       alarm(0);
                        tty_got_hung = False;
-               } else {
+               } else {
                        tty_got_hung = True;
-                       tty = -1;
-                       errno = ENXIO;
-               }
-               signal(SIGALRM, SIG_DFL);
- 
+                       tty = -1;
+                       errno = ENXIO;
+               }
+               signal(SIGALRM, SIG_DFL);
+
                /*
                 * Check results and ignore current control terminal if
                 * necessary.  ENXIO is what is normally returned if there is
@@ -2165,7 +2181,7 @@
                 * seem to return EIO.  Solaris 2.3 is said to return EINVAL.
                 */
                no_dev_tty = FALSE;
-               if (tty < 0) {
+               if (tty < 0) {
                        if (tty_got_hung || errno == ENXIO || errno == EIO ||
                            errno == EINVAL || errno == ENOTTY) {
                                no_dev_tty = TRUE;
@@ -2267,11 +2283,10 @@
        }
 
        /* avoid double MapWindow requests */
-       XtSetMappedWhenManaged( screen->TekEmu ? XtParent(tekWidget) :
-                               XtParent(term), False );
+       XtSetMappedWhenManaged(XtParent(CURRENT_EMU(screen)), False );
        wm_delete_window = XInternAtom(XtDisplay(toplevel), "WM_DELETE_WINDOW",
                                       False);
-       if (!screen->TekEmu)
+       if (!TEK4014_ACTIVE(screen))
            VTInit();           /* realize now so know window size for tty driver */
 #if defined(TIOCCONS) || defined(SRIOCSREDIR)
        if (Console) {
@@ -2282,15 +2297,19 @@
            XmuGetHostname (mit_console_name + MIT_CONSOLE_LEN, 255);
            mit_console = XInternAtom(screen->display, mit_console_name, False);
            /* the user told us to be the console, so we can use CurrentTime */
-           XtOwnSelection(screen->TekEmu ? XtParent(tekWidget) : XtParent(term),
+           XtOwnSelection(XtParent(CURRENT_EMU(screen)),
                           mit_console, CurrentTime,
                           ConvertConsoleSelection, NULL, NULL);
        }
 #endif
+#if OPT_TEK4014
        if(screen->TekEmu) {
                envnew = tekterm;
                ptr = newtc;
-       } else {
+       }
+       else
+#endif
+       {
                envnew = vtterm;
                ptr = termcap;
        }
@@ -2306,8 +2325,8 @@
        if (resource.term_name) {
            TermName = resource.term_name;
            if (tgetent (ptr, resource.term_name) == 1) {
-               if (*ptr) 
-                   if (!screen->TekEmu)
+               if (*ptr)
+                   if (!TEK4014_ACTIVE(screen))
                        resize (screen, termcap, newtc);
            }
        }
@@ -2322,7 +2341,7 @@
                if(tgetent(ptr, *envnew) == 1) {
                        TermName = *envnew;
                        if (*ptr) 
-                           if(!screen->TekEmu)
+                           if(!TEK4014_ACTIVE(screen))
                                resize(screen, termcap, newtc);
                        break;
                }
@@ -2332,7 +2351,7 @@
 
 #if defined(TIOCSSIZE) && (defined(sun) && !defined(SVR4))
        /* tell tty how big window is */
-       if(screen->TekEmu) {
+       if(TEK4014_ACTIVE(screen)) {
                ts.ts_lines = 38;
                ts.ts_cols = 81;
        } else {
@@ -2342,12 +2361,15 @@
 #else  /* not old SunOS */
 #ifdef TIOCSWINSZ
        /* tell tty how big window is */
-       if(screen->TekEmu) {
+#if OPT_TEK4014
+       if(TEK4014_ACTIVE(screen)) {
                ws.ws_row = 38;
                ws.ws_col = 81;
                ws.ws_xpixel = TFullWidth(screen);
                ws.ws_ypixel = TFullHeight(screen);
-       } else {
+       } else
+#endif
+       {
                ws.ws_row = screen->max_row + 1;
                ws.ws_col = screen->max_col + 1;
                ws.ws_xpixel = FullWidth(screen);
@@ -2410,12 +2432,15 @@
                close (screen->respond);
 #ifdef TIOCSWINSZ
                 /* tell tty how big window is */
-                if(screen->TekEmu) {
+#if OPT_TEK4014
+                if(TEK4014_ACTIVE(screen)) {
                         ws.ws_row = 24;
                         ws.ws_col = 80;
                         ws.ws_xpixel = TFullWidth(screen);
                         ws.ws_ypixel = TFullHeight(screen);
-                } else {
+                } else
+#endif
+               {
                         ws.ws_row = screen->max_row + 1;
                         ws.ws_col = screen->max_col + 1;
                         ws.ws_xpixel = FullWidth(screen);
@@ -2841,9 +2866,8 @@
                if(!TermName)
                        *newtc = 0;
 
-               sprintf (buf, "%lu", screen->TekEmu ? 
-                        ((unsigned long) XtWindow (XtParent(tekWidget))) :
-                        ((unsigned long) XtWindow (XtParent(term))));
+               sprintf (buf, "%lu",
+                        ((unsigned long) XtWindow (XtParent(CURRENT_EMU(screen)))));
                Setenv ("WINDOWID=", buf);
                /* put the display into the environment of the shell*/
                Setenv ("DISPLAY=", XDisplayString (screen->display));
@@ -3177,7 +3201,7 @@
                }
 #endif /* UTMP */
 #else /* USE_SYSV_ENVVAR */
-               if(!screen->TekEmu && *newtc) {
+               if(!TEK4014_ACTIVE(screen) && *newtc) {
                    strcpy (termcap, newtc);
                    resize (screen, termcap, newtc);
                }
@@ -3525,18 +3549,20 @@
     }
 
     /* avoid double MapWindow requests */
-    XtSetMappedWhenManaged( screen->TekEmu ? XtParent(tekWidget) :
-                                       XtParent(term), False );
+    XtSetMappedWhenManaged( XtParent(CURRENT_EMU(screen)), False );
     wm_delete_window = XInternAtom(XtDisplay(toplevel), "WM_DELETE_WINDOW",
                                        False);
 
     /* realize now so know window size for tty driver */
-    if (!screen->TekEmu) VTInit();
+    if (!TEK4014_ACTIVE(screen)) VTInit();
 
+#if OPT_TEK4014
     if (screen->TekEmu) {
        envnew = tekterm;
        ptr = newtc;
-    } else {
+    } else
+#endif
+    {
        envnew = vtterm;
        ptr = termcap;
     }
@@ -3547,7 +3573,7 @@
        TermName = resource.term_name;
        if (tgetent (ptr, resource.term_name) == 1) {
            if (*ptr)
-               if (!screen->TekEmu)
+               if (!TEK4014_ACTIVE(screen))
                    resize (screen, termcap, newtc);
     }
 
@@ -3557,7 +3583,7 @@
            if(tgetent(ptr, *envnew) == 1) {
                TermName = *envnew;
                if (*ptr)
-                   if(!screen->TekEmu)
+                   if(!TEK4014_ACTIVE(screen))
                        resize(screen, termcap, newtc);
                break;
            }
@@ -3617,9 +3643,8 @@
     Setenv ("TERM=", TermName);
     if(!TermName) *newtc = 0;
 
-    sprintf (buf, "%lu", screen->TekEmu ?
-       ((unsigned long) XtWindow (XtParent(tekWidget))) :
-       ((unsigned long) XtWindow (XtParent(term))));
+    sprintf (buf, "%lu",
+       ((unsigned long) XtWindow (XtParent(CURRENT_EMU(screen)))));
     Setenv ("WINDOWID=", buf);
 
     /* put the display into the environment of the shell*/
@@ -3629,7 +3654,7 @@
     if (!getenv("HOME")) Setenv("HOME=", DEF_HOME);
     if (!getenv("SHELL")) Setenv("SHELL=", DEF_SHELL);
 
-    if(!screen->TekEmu && *newtc) {
+    if(!TEK4014_ACTIVE(screen) && *newtc) {
        strcpy (termcap, newtc);
        resize (screen, termcap, newtc);
     }
@@ -3753,6 +3778,7 @@
 Exit(n)
        int n;
 {
+       register TScreen *screen = &term->screen;
 #ifdef UTMP
 #ifdef USE_SYSV_UTMP
 #if defined(SVR4) || defined(SCO325)
@@ -3855,8 +3881,8 @@
         close(term->screen.respond); /* close explicitly to avoid race with slave side */
 #endif
 #ifdef ALLOWLOGGING
-       if(term->screen.logging)
-               CloseLog(&term->screen);
+       if(screen->logging)
+               CloseLog(screen);
 #endif
 
 #ifndef AMOEBA
@@ -3962,7 +3988,8 @@
 
 #ifdef USE_SYSV_SIGNALS
     /* cannot re-enable signal before waiting for child
-       because then SVR4 loops.  Sigh.  HP-UX 9.01 too. */
+     * because then SVR4 loops.  Sigh.  HP-UX 9.01 too.
+     */
     (void) signal(SIGCHLD, reapchild);
 #endif
 
Index: menu.c
--- xterm-56+/menu.c    Sun Oct 26 16:05:57 1997
+++ xterm-57/menu.c     Thu Dec 25 13:40:36 1997
@@ -84,9 +84,17 @@
 static void do_sun_fkeys       PROTO_XT_CALLBACK_ARGS;
 static void do_sun_kbd         PROTO_XT_CALLBACK_ARGS;
 static void do_suspend         PROTO_XT_CALLBACK_ARGS;
+static void do_terminate       PROTO_XT_CALLBACK_ARGS;
+static void do_visualbell      PROTO_XT_CALLBACK_ARGS;
+static void do_vtfont          PROTO_XT_CALLBACK_ARGS;
+#ifndef NO_ACTIVE_ICON
+static void do_activeicon      PROTO_XT_CALLBACK_ARGS;
+#endif /* NO_ACTIVE_ICON */
+#if OPT_TEK4014
 static void do_tekcopy         PROTO_XT_CALLBACK_ARGS;
 static void do_tekhide         PROTO_XT_CALLBACK_ARGS;
 static void do_tekmode         PROTO_XT_CALLBACK_ARGS;
+static void do_tekonoff        PROTO_XT_CALLBACK_ARGS;
 static void do_tekpage         PROTO_XT_CALLBACK_ARGS;
 static void do_tekreset        PROTO_XT_CALLBACK_ARGS;
 static void do_tekshow         PROTO_XT_CALLBACK_ARGS;
@@ -94,15 +102,13 @@
 static void do_tektext3        PROTO_XT_CALLBACK_ARGS;
 static void do_tektextlarge    PROTO_XT_CALLBACK_ARGS;
 static void do_tektextsmall    PROTO_XT_CALLBACK_ARGS;
-static void do_terminate       PROTO_XT_CALLBACK_ARGS;
-static void do_visualbell      PROTO_XT_CALLBACK_ARGS;
-static void do_vtfont          PROTO_XT_CALLBACK_ARGS;
 static void do_vthide          PROTO_XT_CALLBACK_ARGS;
 static void do_vtmode          PROTO_XT_CALLBACK_ARGS;
+static void do_vtonoff         PROTO_XT_CALLBACK_ARGS;
 static void do_vtshow          PROTO_XT_CALLBACK_ARGS;
-#ifndef NO_ACTIVE_ICON
-static void do_activeicon      PROTO_XT_CALLBACK_ARGS;
-#endif /* NO_ACTIVE_ICON */
+static void handle_tekshow     PROTO((Widget gw, Bool allowswitch));
+static void handle_vtshow      PROTO((Widget gw, Bool allowswitch));
+#endif
 
 /*
  * The order of entries MUST match the values given in menu.h
@@ -152,10 +158,13 @@
     { "softreset",     do_softreset, NULL },           /* 17 */
     { "hardreset",     do_hardreset, NULL },           /* 18 */
     { "clearsavedlines",do_clearsavedlines, NULL },    /* 19 */
+#if OPT_TEK4014
     { "line2",         NULL, NULL },                   /* 20 */
     { "tekshow",       do_tekshow, NULL },             /* 21 */
     { "tekmode",       do_tekmode, NULL },             /* 22 */
-    { "vthide",                do_vthide, NULL }};             /* 23 */
+    { "vthide",                do_vthide, NULL },              /* 23 */
+#endif
+    };
 
 MenuEntry fontMenuEntries[] = {
     { "fontdefault",   do_vtfont, NULL },              /*  0 */
@@ -169,6 +178,7 @@
     { "fontsel",       do_vtfont, NULL }};             /*  8 */
     /* this should match NMENUFONTS in ptyx.h */
 
+#if OPT_TEK4014
 MenuEntry tekMenuEntries[] = {
     { "tektextlarge",  do_tektextlarge, NULL },        /*  0 */
     { "tektext2",      do_tektext2, NULL },            /*  1 */
@@ -182,6 +192,7 @@
     { "vtshow",                do_vtshow, NULL },              /*  9 */
     { "vtmode",                do_vtmode, NULL },              /* 10 */
     { "tekhide",       do_tekhide, NULL }};            /* 11 */
+#endif
 
 static Bool domenu
        PROTO((Widget w,
@@ -196,11 +207,7 @@
                struct _MenuEntry *entries,
                int nentries));
 
-static void do_tekonoff PROTO_XT_CALLBACK_ARGS;
-static void do_vtonoff PROTO_XT_CALLBACK_ARGS;
 static void handle_send_signal PROTO(( Widget gw, int sig));
-static void handle_tekshow PROTO(( Widget gw, Bool allowswitch));
-static void handle_vtshow PROTO((Widget gw, Bool allowswitch));
 
 static void handle_toggle 
        PROTO((void (*proc)PROTO_XT_CALLBACK_ARGS,
@@ -321,6 +328,7 @@
                          ? TRUE : FALSE));
        break;
 
+#if OPT_TEK4014
       case 't':
        if (!screen->tekMenu) {
            screen->tekMenu = create_menu (term, toplevel, "tekMenu",
@@ -329,6 +337,7 @@
            set_tekfont_menu_item (screen->cur.fontsize, TRUE);
        }
        break;
+#endif
 
       default:
        Bell(XkbBI_MinorError,0);
@@ -752,6 +761,7 @@
 }
 
 
+#if OPT_TEK4014
 static void handle_tekshow (gw, allowswitch)
     Widget gw GCC_UNUSED;
     Bool allowswitch;
@@ -782,6 +792,7 @@
 {
     handle_tekshow (gw, False);
 }
+#endif /* OPT_TEK4014 */
 
 /* ARGSUSED */
 static void do_altscreen (gw, closure, data)
@@ -839,6 +850,7 @@
 }
 
 
+#if OPT_TEK4014
 static void do_tekmode (gw, closure, data)
     Widget gw GCC_UNUSED;
     XtPointer closure GCC_UNUSED, data GCC_UNUSED;
@@ -855,6 +867,7 @@
 {
     hide_vt_window();
 }
+#endif /* OPT_TEK4014 */
 
 
 /*
@@ -882,6 +895,7 @@
  * tek menu
  */
 
+#if OPT_TEK4014
 static void do_tektextlarge (gw, closure, data)
     Widget gw GCC_UNUSED;
     XtPointer closure GCC_UNUSED, data GCC_UNUSED;
@@ -986,6 +1000,7 @@
 {
     hide_tek_window();
 }
+#endif /* OPT_TEK4014 */
 
 
 
@@ -1344,6 +1359,7 @@
     do_clearsavedlines(w, (XtPointer)0, (XtPointer)0);
 }
 
+#if OPT_TEK4014
 void HandleSetTerminalType(w, event, params, param_count)
     Widget w;
     XEvent *event GCC_UNUSED;
@@ -1445,3 +1461,4 @@
 {
     do_tekcopy(w, (XtPointer)0, (XtPointer)0);
 }
+#endif /* OPT_TEK4014 */
Index: menu.h
--- xterm-56+/menu.h    Sun Oct 26 16:05:57 1997
+++ xterm-57/menu.h     Thu Dec 25 15:29:34 1997
@@ -41,8 +41,12 @@
     Widget widget;
 } MenuEntry;
 
-extern MenuEntry mainMenuEntries[], vtMenuEntries[], tekMenuEntries[];
+extern MenuEntry mainMenuEntries[], vtMenuEntries[];
 extern MenuEntry fontMenuEntries[];
+#if OPT_TEK4014
+extern MenuEntry tekMenuEntries[];
+#endif
+
 extern Arg menuArgs[];
 
 extern void Handle8BitControl      PROTO_XT_ACTIONS_ARGS;
@@ -335,6 +339,7 @@
                    term->misc.active_icon)
 #endif /* NO_ACTIVE_ICON */
 
+#if OPT_TEK4014
 #define update_tekshow() \
   update_menu_item (term->screen.vtMenu, \
                    vtMenuEntries[vtMenu_tekshow].widget, \
@@ -353,7 +358,6 @@
                    tekMenuEntries[tekMenu_vtshow].widget, \
                    term->screen.Vshow)
 
-
 #define set_vthide_sensitivity() \
   set_sensitivity (term->screen.vtMenu, \
                   vtMenuEntries[vtMenu_vthide].widget, \
@@ -363,6 +367,14 @@
   set_sensitivity (term->screen.tekMenu, \
                   tekMenuEntries[tekMenu_tekhide].widget, \
                   term->screen.Vshow)
+#else
+#define update_tekshow() /*nothing*/
+#define update_vttekmode() /*nothing*/
+#define update_vtshow() /*nothing*/
+#define set_vthide_sensitivity() /*nothing*/
+#define set_tekhide_sensitivity() /*nothing*/
+#endif
+
 
 /*
  * macros for mapping font size to tekMenu placement
@@ -370,10 +382,14 @@
 #define FS2MI(n) (n)                   /* font_size_to_menu_item */
 #define MI2FS(n) (n)                   /* menu_item_to_font_size */
 
+#if OPT_TEK4014
 #define set_tekfont_menu_item(n,val) \
   update_menu_item (term->screen.tekMenu, \
                    tekMenuEntries[FS2MI(n)].widget, \
                    (val))
+#else
+#define set_tekfont_menu_item(n,val) /*nothing*/
+#endif
 
 #define set_menu_font(val) \
   update_menu_item (term->screen.fontMenu, \
Index: misc.c
--- xterm-56+/misc.c    Tue Oct 14 21:40:58 1997
+++ xterm-57/misc.c     Thu Dec 25 17:34:32 1997
@@ -84,6 +84,18 @@
 
 extern Widget toplevel;                /* used in 'ChangeGroup()' */
 
+#if OPT_TEK4014
+#define OUR_EVENT(event,Type) \
+               (event.type == Type && \
+                 (event.xcrossing.window == XtWindow(XtParent(term)) || \
+                   (tekWidget && \
+                    event.xcrossing.window == XtWindow(XtParent(tekWidget)))))
+#else
+#define OUR_EVENT(event,Type) \
+               (event.type == Type && \
+                  (event.xcrossing.window == XtWindow(XtParent(term))))
+#endif
+
 static Boolean AllocateColor PROTO((XtermWidget pTerm, ScrnColors *pNew, int ndx, char *name));
 static Boolean ChangeColorsRequest PROTO((XtermWidget pTerm, int start, char *names));
 static Boolean GetOldColors PROTO(( XtermWidget pTerm));
@@ -94,7 +106,10 @@
 static void DoSpecialLeaveNotify PROTO((XEnterWindowEvent *ev));
 static void selectwindow PROTO((TScreen *screen, int flag));
 static void unselectwindow PROTO((TScreen *screen, int flag));
+
+#if OPT_TEK4014
 static void withdraw_window PROTO((Display *dpy, Window w, int scr));
+#endif
 
 void
 do_xevents()
@@ -138,16 +153,10 @@
                 * looking at the event ourselves we make sure that we can
                 * do the right thing.
                 */
-               if(event.type == EnterNotify &&
-                  (event.xcrossing.window == XtWindow(XtParent(term)) ||
-                   (tekWidget &&
-                    event.xcrossing.window == XtWindow(XtParent(tekWidget)))))
+               if(OUR_EVENT(event, EnterNotify))
                  DoSpecialEnterNotify (&event.xcrossing);
                else 
-               if(event.type == LeaveNotify &&
-                  (event.xcrossing.window == XtWindow(XtParent(term)) ||
-                   (tekWidget &&
-                    event.xcrossing.window == XtWindow(XtParent(tekWidget)))))
+               if(OUR_EVENT(event, LeaveNotify))
                  DoSpecialLeaveNotify (&event.xcrossing);
 
                if (!event.xany.send_event ||
@@ -186,7 +195,7 @@
     register TScreen *screen = &term->screen;
 
 #ifdef ACTIVEWINDOWINPUTONLY
-    if (w == (screen->TekEmu ? (Widget)tekWidget : (Widget)term))
+    if (w == CURRENT_EMU(screen))
 #endif
        Input (&term->keyboard, screen, &event->xkey, False);
 }
@@ -201,7 +210,7 @@
     register TScreen *screen = &term->screen;
 
 #ifdef ACTIVEWINDOWINPUTONLY
-    if (w == (screen->TekEmu ? (Widget)tekWidget : (Widget)term))
+    if (w == CURRENT_EMU(screen))
 #endif
        Input (&term->keyboard, screen, &event->xkey, True);
 }
@@ -216,7 +225,8 @@
     register TScreen *screen = &term->screen;
 
 #ifdef ACTIVEWINDOWINPUTONLY
-    if (w != (screen->TekEmu ? (Widget)tekWidget : (Widget)term)) return;
+    if (w != CURRENT_EMU(screen))
+       return;
 #endif
 
     if (*nparams != 1) return;
@@ -247,8 +257,7 @@
     register TScreen *screen = &term->screen;
 
 #ifdef ACTIVEWINDOWINPUTONLY
-    if (ev->window == XtWindow(XtParent(screen->TekEmu ?
-                                       (Widget)tekWidget : (Widget)term)))
+    if (ev->window == XtWindow(XtParent(CURRENT_EMU(screen))))
 #endif
       if (((ev->detail) != NotifyInferior) &&
          ev->focus &&
@@ -273,8 +282,7 @@
     register TScreen *screen = &term->screen;
 
 #ifdef ACTIVEWINDOWINPUTONLY
-    if (ev->window == XtWindow(XtParent(screen->TekEmu ?
-                                       (Widget)tekWidget : (Widget)term)))
+    if (ev->window == XtWindow(XtParent(CURRENT_EMU(screen))))
 #endif
       if (((ev->detail) != NotifyInferior) &&
          ev->focus &&
@@ -327,6 +335,7 @@
 register TScreen *screen;
 register int flag;
 {
+#if OPT_TEK4014
        if(screen->TekEmu) {
                if(!Ttoggled)
                        TCursorToggle(TOGGLE);
@@ -334,7 +343,9 @@
                if(!Ttoggled)
                        TCursorToggle(TOGGLE);
                return;
-       } else {
+       } else
+#endif
+       {
                if (screen->xic)
                    XSetICFocus(screen->xic);
 
@@ -356,11 +367,14 @@
 {
     if (screen->always_highlight) return;
 
+#if OPT_TEK4014
     if(screen->TekEmu) {
        if(!Ttoggled) TCursorToggle(TOGGLE);
        screen->select &= ~flag;
        if(!Ttoggled) TCursorToggle(TOGGLE);
-    } else {
+    } else
+#endif
+    {
        if (screen->xic)
            XUnsetICFocus(screen->xic);
        screen->select &= ~flag;
@@ -416,7 +430,7 @@
           back.  If the server is suspending operations while the bell
           is being emitted (problematic for audio bell), this lets us
           know when the previous bell has finished */
-       Widget w = screen->TekEmu ? (Widget) tekWidget : (Widget) term;
+       Widget w = CURRENT_EMU(screen);
        XChangeProperty(XtDisplay(w), XtWindow(w),
                        XA_NOTICE, XA_NOTICE, 8, PropModeAppend, NULL, 0);
        screen->bellInProgress = TRUE;
@@ -434,6 +448,7 @@
     gcval.function = GXxor;
     gcval.foreground = xorPixel;
     visualGC = XtGetGC((Widget)term, GCFunction+GCForeground, &gcval);
+#if OPT_TEK4014
     if(screen->TekEmu) {
        XFillRectangle(
                       screen->display,
@@ -450,7 +465,9 @@
                       0, 0,
                       (unsigned) TFullWidth(screen),
                       (unsigned) TFullHeight(screen));
-    } else {
+    } else
+#endif
+    {
        XFillRectangle(
                       screen->display,
                       VWindow(screen), 
@@ -504,12 +521,14 @@
                        (*screen->scrollWidget->core.widget_class->core_class.expose)(screen->scrollWidget, (XEvent *)&event, NULL);
                }
 
+#if OPT_TEK4014
        if(TWindow(screen) && screen->Tshow) {
                event.window = TWindow(screen);
                event.width = tekWidget->core.width;
                event.height = tekWidget->core.height;
                TekExpose ((Widget)tekWidget, (XEvent *)&event, NULL);
        }
+#endif
 }
 
 #if defined(ALLOWLOGGING) || defined(DEBUG)
@@ -700,7 +719,7 @@
                                         0644)) < 0)
                        return;
        }
-       screen->logstart = screen->TekEmu ? Tbptr : bptr;
+       screen->logstart = CURRENT_EMU_VAL(screen, Tbptr, bptr);
        screen->logging = TRUE;
        update_logging();
 }
@@ -724,10 +743,10 @@
        register Char *cp;
        register int i;
 
-       cp = screen->TekEmu ? Tbptr : bptr;
+       cp = CURRENT_EMU_VAL(screen, Tbptr, bptr);
        if((i = cp - screen->logstart) > 0)
                write(screen->logfd, (char *)screen->logstart, i);
-       screen->logstart = screen->TekEmu ? Tbuffer : buffer;
+       screen->logstart = CURRENT_EMU_VAL(screen, Tbuffer, buffer);
 }
 
 #ifdef ALLOWLOGFILEEXEC
@@ -1369,6 +1388,7 @@
   return(0);
 }
 
+#if OPT_TEK4014
 static void withdraw_window (dpy, w, scr)
     Display *dpy;
     Window w;
@@ -1378,6 +1398,7 @@
     XWithdrawWindow (dpy, w, scr);
     return;
 }
+#endif
 
 
 void set_vt_visibility (on)
@@ -1391,7 +1412,9 @@
            XtMapWidget (term->core.parent);
            screen->Vshow = TRUE;
        }
-    } else {
+    }
+#if OPT_TEK4014
+    else {
        if (screen->Vshow && term) {
            withdraw_window (XtDisplay (term), 
                             XtWindow(XtParent(term)),
@@ -1404,9 +1427,11 @@
     update_vttekmode();
     update_tekshow();
     update_vtshow();
+#endif
     return;
 }
                                
+#if OPT_TEK4014
 extern Atom wm_delete_window;  /* for ICCCM delete window */
 
 void set_tek_visibility (on)
@@ -1502,3 +1527,4 @@
     TekRefresh = (TekLink *)0;
     if (screen->TekEmu) switch_modes (True);   /* does longjmp to vt mode */
 }
+#endif /* OPT_TEK4014 */
Index: os2main.c
--- xterm-56+/os2main.c Sat Dec  6 10:24:45 1997
+++ xterm-57/os2main.c  Fri Dec 26 13:36:54 1997
@@ -67,20 +67,21 @@
 #endif
 
 #include "ptyx.h"
-#include "data.h"
-#include "error.h"
-#include "menu.h"
 #include <X11/StringDefs.h>
 #include <X11/Shell.h>
-#ifdef I18N
-#include <X11/Xlocale.h>
-#endif
 
 #include <X11/Xos.h>
 #include <X11/cursorfont.h>
 #include <X11/Xaw/SimpleMenu.h>
+#ifdef I18N
+#include <X11/Xlocale.h>
+#endif
+
 #include <pwd.h>
 #include <ctype.h>
+#include "data.h"
+#include "error.h"
+#include "menu.h"
 
 #include <sys/termio.h>
 
@@ -106,17 +107,26 @@
 #define SIGNAL_T void
 #define SIGNAL_RETURN return
 
-SIGNAL_T Exit();
-
 #include <unistd.h>
 #include <stdlib.h>
 
 extern char *strindex ();
-extern void HandlePopupMenu();
+
+#include "xterm.h"
 
 int switchfb[] = {0, 2, 1, 3};
 
-static SIGNAL_T reapchild ();
+static char *base_name PROTO((char *name));
+static int pty_search PROTO((int *pty));
+static int remove_termcap_entry PROTO((char *buf, char *str));
+static int spawn PROTO((void));
+static void DeleteWindow PROTO_XT_ACTIONS_ARGS;
+static void Help PROTO((void));
+static void KeyboardMapping PROTO_XT_ACTIONS_ARGS;
+static void Syntax PROTO((char *badOption));
+static void get_terminal PROTO((void));
+static void resize PROTO((TScreen *s, char *oldtc, char *newtc));
+static SIGNAL_T reapchild PROTO((int n));
 
 static Bool added_utmp_entry = False;
 
@@ -163,7 +173,6 @@
 #define CSTART ('Q'&037)
 #endif
 
-static int parse_tty_modes ();
 /*
  * SYSV has the termio.c_cc[V] and ltchars; BSD has tchars and ltchars;
  * SVR4 has only termio.c_cc, but it includes everything from ltchars.
@@ -210,6 +219,8 @@
 { NULL, 0, 0, '\0' },                  /* end of data */
 };
 
+static int parse_tty_modes PROTO((char *s, struct _xttymodes *modelist));
+
 static int inhibit;
 static char passedPty[2];      /* name if pty if slave */
 
@@ -252,7 +263,7 @@
 
 static XtResource application_resources[] = {
     {"name", "Name", XtRString, sizeof(char *),
-       offset(xterm_name), XtRString, "xterm"},
+       offset(xterm_name), XtRString, DFT_TERMTYPE},
     {"iconGeometry", "IconGeometry", XtRString, sizeof(char *),
        offset(icon_geometry), XtRString, (caddr_t) NULL},
     {XtNtitle, XtCTitle, XtRString, sizeof(char *),
@@ -286,7 +297,9 @@
     "XTerm*mainMenu.Label:  Main Options (no app-defaults)",
     "XTerm*vtMenu.Label:  VT Options (no app-defaults)",
     "XTerm*fontMenu.Label:  VT Fonts (no app-defaults)",
+#if OPT_TEK4014
     "XTerm*tekMenu.Label:  Tek Options (no app-defaults)",
+#endif
     NULL
 };
 
@@ -444,15 +457,17 @@
 { "-/+s",                  "turn on/off multiscroll" },
 { "-/+sb",                 "turn on/off scrollbar" },
 #ifdef SCROLLBAR_RIGHT
-{ "-useRight",             "force scrollbar right (default left)" },
-{ "-useLeft",              "force scrollbar left" },
+{ "-rightbar",             "force scrollbar right (default left)" },
+{ "-leftbar",              "force scrollbar left" },
 #endif
 { "-/+sf",                 "turn on/off Sun Function Key escape codes" },
 { "-/+si",                 "turn on/off scroll-on-tty-output inhibit" },
 { "-/+sk",                 "turn on/off scroll-on-keypress" },
 { "-sl number",            "number of scrolled lines to save" },
 { "-/+sp",                 "turn on/off Sun/PC Function/Keypad mapping" },
+#if OPT_TEK4014
 { "-/+t",                  "turn on/off Tek emulation window" },
+#endif
 { "-tm string",            "terminal mode keywords and characters" },
 { "-tn name",              "TERM environment variable name" },
 { "-/+ulc",                "turn off/on display of underline as color" },
@@ -460,7 +475,9 @@
 { "-/+vb",                 "turn on/off visual bell" },
 { "-/+wf",                 "turn on/off wait for map before command exec" },
 { "-e command args ...",   "command to execute" },
+#if OPT_TEK4014
 { "%geom",                 "Tek window geometry" },
+#endif
 { "#geom",                 "icon window geometry" },
 { "-T string",             "title name for window" },
 { "-n string",             "icon name for window" },
@@ -543,11 +560,11 @@
 /* ARGSUSED */
 static Boolean
 ConvertConsoleSelection(w, selection, target, type, value, length, format)
-    Widget w;
-    Atom *selection, *target, *type;
-    XtPointer *value;
-    unsigned long *length;
-    int *format;
+    Widget w GCC_UNUSED;
+    Atom *selection GCC_UNUSED, *target GCC_UNUSED, *type GCC_UNUSED;
+    XtPointer *value GCC_UNUSED;
+    unsigned long *length GCC_UNUSED;
+    int *format GCC_UNUSED;
 {
     /* we don't save console output, so can't offer it */
     return False;
@@ -559,43 +576,41 @@
 };
 int number_ourTopLevelShellArgs = 2;
        
-XtAppContext app_con;
 Widget toplevel;
 Bool waiting_for_initial_map;
 
-extern void do_hangup();
-extern void xt_error();
-
 /*
  * DeleteWindow(): Action proc to implement ICCCM delete_window.
  */
 /* ARGSUSED */
-void
+static void
 DeleteWindow(w, event, params, num_params)
     Widget w;
-    XEvent *event;
-    String *params;
-    Cardinal *num_params;
+    XEvent *event GCC_UNUSED;
+    String *params GCC_UNUSED;
+    Cardinal *num_params GCC_UNUSED;
 {
+#if OPT_TEK4014
   if (w == toplevel)
     if (term->screen.Tshow)
       hide_vt_window();
     else
-      do_hangup(w);
+      do_hangup(w, (XtPointer)0, (XtPointer)0);
   else
     if (term->screen.Vshow)
       hide_tek_window();
     else
-      do_hangup(w);
+#endif
+      do_hangup(w, (XtPointer)0, (XtPointer)0);
 }
 
 /* ARGSUSED */
-void
+static void
 KeyboardMapping(w, event, params, num_params)
-    Widget w;
+    Widget w GCC_UNUSED;
     XEvent *event;
-    String *params;
-    Cardinal *num_params;
+    String *params GCC_UNUSED;
+    Cardinal *num_params GCC_UNUSED;
 {
     switch (event->type) {
        case MappingNotify:
@@ -605,8 +620,8 @@
 }
 
 XtActionsRec actionProcs[] = {
-    "DeleteWindow", DeleteWindow,
-    "KeyboardMapping", KeyboardMapping,
+    { "DeleteWindow", DeleteWindow },
+    { "KeyboardMapping", KeyboardMapping },
 };
 
 Atom wm_delete_window;
@@ -738,8 +753,6 @@
 {
        register TScreen *screen;
        int mode;
-       char *base_name();
-       int xerror(), xioerror();
        extern char **environ;
 
        /* XXX: for some obscure reason EMX seems to lose the value of 
@@ -789,7 +802,7 @@
            XtSetErrorHandler(xt_error);
            toplevel = XtAppInitialize (&app_con, "XTerm", 
                                        optionDescList,
-                                       XtNumber(optionDescList), 
+                                       XtNumber(optionDescList),
                                        &argc, argv, fallback_resources,
                                        NULL, 0);
 
@@ -823,7 +836,7 @@
 #if OPT_SUNPC_KBD
        sunKeyboard = resource.sunKeyboard;
 #endif
-       if (strcmp(xterm_name, "-") == 0) xterm_name = "xterm";
+       if (strcmp(xterm_name, "-") == 0) xterm_name = DFT_TERMTYPE;
        if (resource.icon_geometry != NULL) {
            int scr, junk;
            int ix, iy;
@@ -895,9 +908,10 @@
 
         term = (XtermWidget) XtCreateManagedWidget(
            "vt100", xtermWidgetClass, toplevel, NULL, 0);
+           /* this causes the initialize method to be called */
 
-       /* this causes the initialize method to be called */
         screen = &term->screen;
+
        if (screen->savelines < 0) screen->savelines = 0;
 
        term->flags = 0;
@@ -920,10 +934,12 @@
 
        inhibit = 0;
 #ifdef ALLOWLOGGING
-       if (term->misc.logInhibit)          inhibit |= I_LOG;
+       if (term->misc.logInhibit)              inhibit |= I_LOG;
 #endif
        if (term->misc.signalInhibit)           inhibit |= I_SIGNAL;
-       if (term->misc.tekInhibit)                      inhibit |= I_TEK;
+#if OPT_TEK4014
+       if (term->misc.tekInhibit)              inhibit |= I_TEK;
+#endif
 
        term->initflags = term->flags;
 
@@ -958,11 +974,13 @@
            XtSetValues (toplevel, args, 2);
        }
 
+#if OPT_TEK4014
        if(inhibit & I_TEK)
                screen->TekEmu = FALSE;
 
        if(screen->TekEmu && !TekInit())
                exit(ERROR_INIT);
+#endif
 
 #ifdef DEBUG
     {
@@ -978,7 +996,7 @@
                dup2(i,2);
 
                /* mark this file as close on exec */
-               fcntl(i, F_SETFD, 1);
+               (void) fcntl(i, F_SETFD, 1);
        }
     }
 #endif /* DEBUG */
@@ -989,7 +1007,7 @@
        spawn ();
 
        /* Child process is out there, let's catch its termination */
-       signal (SIGCHLD, reapchild);
+       (void) signal (SIGCHLD, reapchild);
 
        /* Realize procs have now been executed */
 
@@ -997,25 +1015,18 @@
            char buf[80];
 
            buf[0] = '\0';
-           sprintf (buf, "%lx\n", 
-                    screen->TekEmu ? XtWindow (XtParent (tekWidget)) :
-                                     XtWindow (XtParent (term)));
+           sprintf (buf, "%lx\n", XtWindow (XtParent (CURRENT_EMU(screen))));
            write (screen->respond, buf, strlen (buf));
        }
 
-#ifdef ALLOWLOGGING
-       if (term->misc.log_on) {
-               StartLog(screen);
-       }
-#endif
        screen->inhibit = inhibit;
 
        if (0 > (mode = fcntl(screen->respond, F_GETFL, 0)))
-               Error();
+               Error(1);
        mode |= O_NDELAY;
 
        if (fcntl(screen->respond, F_SETFL, mode))
-               Error();
+               Error(1);
 
        FD_ZERO (&pty_mask);
        FD_ZERO (&X_mask);
@@ -1044,11 +1055,12 @@
        }
 #endif
        for( ; ; ) {
-               if(screen->TekEmu) {
+#if OPT_TEK4014
+               if(screen->TekEmu)
                        TekRun();
-               } else {
+               else
+#endif
                        VTRun();
-               }
        }
 }
 
@@ -1069,6 +1081,7 @@
  * has problems, we can re-enter this function and get another one.
  */
 
+static int
 get_pty (pty)
     int *pty;
 {
@@ -1081,7 +1094,8 @@
  * a functional interface for allocating a pty.
  * Returns 0 if found a pty, 1 if fails.
  */
-int pty_search(pty)
+static int
+pty_search(pty)
     int *pty;
 {
        char namebuf[PTMS_BUFSZ];
@@ -1103,6 +1117,7 @@
        return 1;
 }
 
+static void
 get_terminal ()
 /* 
  * sets up X and initializes the terminal structure except for term.buf.fildes.
@@ -1128,6 +1143,7 @@
  * All of these are supported by xterm.
  */
 
+#if OPT_TEK4014
 static char *tekterm[] = {
        "tek4014",
        "tek4015",              /* 4014 with APL character set support */
@@ -1137,6 +1153,7 @@
        "dumb",
        0
 };
+#endif
 
 /* The VT102 is a VT100 with the Advanced Video Option included standard.
  * It also adds Escape sequences for insert/delete character/line.
@@ -1149,6 +1166,7 @@
 #ifdef USE_X11TERM
        "x11term",              /* for people who want special term name */
 #endif
+       DFT_TERMTYPE,           /* for people who want special term name */
        "xterm",                /* the prefered name, should be fastest */
        "vt102",
        "vt100",
@@ -1158,8 +1176,8 @@
 };
 
 /* ARGSUSED */
-SIGNAL_T hungtty(i)
-       int i;
+static SIGNAL_T hungtty(i)
+       int i GCC_UNUSED;
 {
        longjmp(env, 1);
        SIGNAL_RETURN;
@@ -1205,6 +1223,7 @@
        SIGNAL_RETURN;
 }
 
+static int
 spawn ()
 /* 
  *  Inits pty and tty and forks a login process.
@@ -1212,8 +1231,6 @@
  *  If slave, the pty named in passedPty is already open for use
  */
 {
-       extern char *SysErrorMsg();
-
        register TScreen *screen = &term->screen;
        int Xsocket = ConnectionNumber(screen->display);
 
@@ -1243,33 +1260,34 @@
                setgid (screen->gid);
                setuid (screen->uid);
        } else {
-               Bool tty_got_hung = False;
+               Bool tty_got_hung;
 
-               /*
-                * Sometimes /dev/tty hangs on open (as in the case of a pty
-                * that has gone away).  Simply make up some reasonable
-                * defaults.
-                */
-
-               signal(SIGALRM, hungtty);
-               alarm(2);               /* alarm(1) might return too soon */
-               if (! setjmp(env)) {
-                       tty = open ("/dev/tty", O_RDWR, 0);
-                       alarm(0);
-               } else {
+               /*
+                * Sometimes /dev/tty hangs on open (as in the case of a pty
+                * that has gone away).  Simply make up some reasonable
+                * defaults.
+                */
+
+               signal(SIGALRM, hungtty);
+               alarm(2);               /* alarm(1) might return too soon */
+               if (! setjmp(env)) {
+                       tty = open ("/dev/tty", O_RDWR, 0);
+                       alarm(0);
+                       tty_got_hung = False;
+               } else {
                        tty_got_hung = True;
-                       tty = -1;
-                       errno = ENXIO;
-               }
-               signal(SIGALRM, SIG_DFL);
- 
+                       tty = -1;
+                       errno = ENXIO;
+               }
+               signal(SIGALRM, SIG_DFL);
+
                /*
                 * Check results and ignore current control terminal if
                 * necessary.  ENXIO is what is normally returned if there is
                 * no controlling terminal, but some systems (e.g. SunOS 4.0)
                 * seem to return EIO.  Solaris 2.3 is said to return EINVAL.
                 */
-               if (tty < 0) {
+               if (tty < 0) {
                        if (tty_got_hung || errno == ENXIO || errno == EIO ||
                            errno == EINVAL || errno == ENOTTY) {
                                no_dev_tty = TRUE;
@@ -1299,13 +1317,12 @@
        }
 
        /* avoid double MapWindow requests */
-       XtSetMappedWhenManaged( screen->TekEmu ? XtParent(tekWidget) :
-                               XtParent(term), False );
+       XtSetMappedWhenManaged(XtParent(CURRENT_EMU(screen)), False );
 
        wm_delete_window = XInternAtom(XtDisplay(toplevel), "WM_DELETE_WINDOW",
                                       False);
 
-       if (!screen->TekEmu)
+       if (!TEK4014_ACTIVE(screen))
            VTInit();           /* realize now so know window size for tty driver */
 
        if (Console) {
@@ -1316,53 +1333,67 @@
            XmuGetHostname (mit_console_name + MIT_CONSOLE_LEN, 255);
            mit_console = XInternAtom(screen->display, mit_console_name, False);
            /* the user told us to be the console, so we can use CurrentTime */
-           XtOwnSelection(screen->TekEmu ? XtParent(tekWidget) : XtParent(term),
+           XtOwnSelection(XtParent(CURRENT_EMU(screen)),
                           mit_console, CurrentTime,
                           ConvertConsoleSelection, NULL, NULL);
        }
+#if OPT_TEK4014
        if(screen->TekEmu) {
                envnew = tekterm;
                ptr = newtc;
-       } else {
+       }
+       else
+#endif
+       {
                envnew = vtterm;
                ptr = termcap;
        }
+
+       /*
+        * This used to exit if no termcap entry was found for the specified
+        * terminal name.  That's a little unfriendly, so instead we'll allow
+        * the program to proceed (but not to set $TERMCAP) if the termcap
+        * entry is not found.
+        */
+       *ptr = 0;       /* initialize, in case we're using terminfo's tgetent */
        TermName = NULL;
        if (resource.term_name) {
+           TermName = resource.term_name;
            if (tgetent (ptr, resource.term_name) == 1) {
-               TermName = resource.term_name;
-               if (!screen->TekEmu)
-                   resize (screen, TermName, termcap, newtc);
-           } else {
-               fprintf (stderr, "%s:  invalid termcap entry \"%s\".\n",
-                        ProgramName, resource.term_name);
+               if (*ptr)
+                   if (!TEK4014_ACTIVE(screen))
+                       resize (screen, termcap, newtc);
            }
        }
 
+       /*
+        * This block is invoked only if there was no terminal name specified
+        * by the command-line option "-tn".
+        */
        if (!TermName) {
+           TermName = *envnew;
            while (*envnew != NULL) {
                if(tgetent(ptr, *envnew) == 1) {
                        TermName = *envnew;
-                       if(!screen->TekEmu)
-                           resize(screen, TermName, termcap, newtc);
+                       if (*ptr) 
+                           if(!TEK4014_ACTIVE(screen))
+                               resize(screen, termcap, newtc);
                        break;
                }
                envnew++;
            }
-           if (TermName == NULL) {
-               fprintf (stderr, "%s:  unable to find usable termcap entry.\n",
-                        ProgramName);
-               Exit (1);
-           }
        }
 
        /* tell tty how big window is */
-       if(screen->TekEmu) {
+#if OPT_TEK4014
+       if(TEK4014_ACTIVE(screen)) {
                ws.ws_row = 38;
                ws.ws_col = 81;
                ws.ws_xpixel = TFullWidth(screen);
                ws.ws_ypixel = TFullHeight(screen);
-       } else {
+       } else
+#endif
+       {
                ws.ws_row = screen->max_row + 1;
                ws.ws_col = screen->max_col + 1;
                ws.ws_xpixel = FullWidth(screen);
@@ -1475,9 +1506,8 @@
                        if(!TermName)
                                *newtc = 0;
 
-                       sprintf (buf, "%lu", screen->TekEmu ? 
-                               ((unsigned long) XtWindow (XtParent(tekWidget))) :
-                               ((unsigned long) XtWindow (XtParent(term))));
+                       sprintf (buf, "%lu",
+                               ((unsigned long) XtWindow (XtParent(CURRENT_EMU(screen)))));
                        Setenv ("WINDOWID=", buf);
 
                        /* put the display into the environment of the shell*/
@@ -1603,8 +1633,8 @@
  */
 
 /*     signal (SIGINT, SIG_IGN);*/
-signal(SIGINT, killit);
-signal(SIGTERM, killit);
+       signal(SIGINT, killit);
+       signal(SIGTERM, killit);
 
        /* hung shell problem */
        signal (SIGQUIT, SIG_IGN);
@@ -1637,9 +1667,9 @@
 }
 
 /* ARGSUSED */
-resize(screen, TermName, oldtc, newtc)
+static void
+resize(screen, oldtc, newtc)
 TScreen *screen;
-char *TermName;
 register char *oldtc, *newtc;
 {
 }
@@ -1660,16 +1690,16 @@
 
 /* ARGSUSED */
 static SIGNAL_T reapchild (n)
-    int n;
+    int n GCC_UNUSED;
 {
     int pid;
 
     pid = wait(NULL);
 
     /* cannot re-enable signal before waiting for child
-     * because then SVR4 loops.  Sigh.  HP-UX 9.01 too. 
+     * because then SVR4 loops.  Sigh.  HP-UX 9.01 too.
      */
-    signal(SIGCHLD, reapchild);
+    (void) signal(SIGCHLD, reapchild);
 
     do {
        if (pid == term->screen.pid) {
@@ -1683,11 +1713,12 @@
     SIGNAL_RETURN;
 }
 
+#if 0  /* this isn't used, but could be useful in debugging */
 /* VARARGS1 */
+void
 consolepr(fmt,x0,x1,x2,x3,x4,x5,x6,x7,x8,x9)
 char *fmt;
 {
-       extern char *SysErrorMsg();
        int oerrno;
        int f;
        char buf[ BUFSIZ ];
@@ -1709,8 +1740,9 @@
        }
 #endif /* TIOCNOTTY */
 }
+#endif
 
-
+static int
 remove_termcap_entry (buf, str)
     char *buf;
     char *str;
@@ -1774,14 +1806,12 @@
     }
 }
 
-
 int GetBytesAvailable (fd)
     int fd;
 {
-    static long arg;
+    long arg;
     ioctl (fd, FIONREAD, (char *) &arg);
     return (int) arg;
-
 }
 
 /* Utility function to try to hide system differences from
Index: ptyx.h
--- xterm-56+/ptyx.h    Sat Dec  6 10:24:45 1997
+++ xterm-57/ptyx.h     Thu Dec 25 17:30:03 1997
@@ -329,6 +329,10 @@
 #define OPT_SUNPC_KBD  1 /* true if xterm supports Sun/PC keyboard map */
 #endif
 
+#ifndef OPT_TEK4014
+#define OPT_TEK4014     1 /* true if we're using tek4014 emulation */
+#endif
+
 #ifndef OPT_TRACE
 #define OPT_TRACE       0 /* true if we're using debugging traces */
 #endif
@@ -426,6 +430,18 @@
 
 /***====================================================================***/
 
+#if OPT_TEK4014
+#define TEK4014_ACTIVE(screen) ((screen)->TekEmu)
+#define CURRENT_EMU_VAL(screen,tek,vt) (TEK4014_ACTIVE(screen) ? tek : vt)
+#define CURRENT_EMU(screen) CURRENT_EMU_VAL(screen, (Widget)tekWidget, (Widget)term)
+#else
+#define TEK4014_ACTIVE(screen) 0
+#define CURRENT_EMU_VAL(screen,tek,vt) (vt)
+#define CURRENT_EMU(screen) ((Widget)term)
+#endif
+
+/***====================================================================***/
+
 #if OPT_TRACE
 #include "trace.h"
 #else
@@ -554,6 +570,7 @@
        int             inhibit;        /* flags for inhibiting changes */
 
 /* VT window parameters */
+       Boolean         Vshow;          /* VT window showing            */
        struct _vtwin {
                Window  window;         /* X window id                  */
                int     width;          /* width of columns             */
@@ -665,6 +682,7 @@
        Boolean         move_sgr_ok;    /* SGR is reset on move         */
 #endif
 
+#if OPT_TEK4014
 /* Tektronix window parameters */
        GC              TnormalGC;      /* normal painting              */
        GC              TcursorGC;      /* normal cursor painting       */
@@ -672,7 +690,6 @@
        Pixel           Tbackground;    /* Background color             */
        Pixel           Tcursorcolor;   /* Cursor color                 */
        int             Tcolor;         /* colors used                  */
-       Boolean         Vshow;          /* VT window showing            */
        Boolean         Tshow;          /* Tek window showing           */
        Boolean         waitrefresh;    /* postpone refresh             */
        struct _tekwin {
@@ -698,6 +715,7 @@
        int             pen;            /* current Tektronix pen 0=up, 1=dn */
        char            *TekGIN;        /* nonzero if Tektronix GIN mode*/
        int             gin_terminator; /* Tek strap option */
+#endif /* OPT_TEK4014 */
 
        int             multiClickTime;  /* time between multiclick selects */
        int             bellSuppressTime; /* msecs after Bell before another allowed */
@@ -762,13 +780,15 @@
     Boolean autoWrap;
     Boolean logInhibit;
     Boolean signalInhibit;
+#if OPT_TEK4014
     Boolean tekInhibit;
+    Boolean tekSmall;  /* start tek window in small size */
+#endif
     Boolean scrollbar;
 #ifdef SCROLLBAR_RIGHT
     Boolean useRight;
 #endif
     Boolean titeInhibit;
-    Boolean tekSmall;  /* start tek window in small size */
     Boolean appcursorDefault;
     Boolean appkeypadDefault;
 #if OPT_INPUT_METHOD
@@ -796,10 +816,12 @@
 
 #define IsXtermWidget(w) (XtClass(w) == xtermWidgetClass)
 
+#if OPT_TEK4014
 typedef struct _TekClassRec {
     CoreClassPart core_class;
     TekClassPart tek_class;
 } TekClassRec;
+#endif
 
 /* define masks for keyboard.flags */
 #define MODE_KAM       0x01    /* keyboard action mode */
@@ -833,10 +855,12 @@
     Misc       misc;           /* miscellaneous parameters     */
 } XtermWidgetRec, *XtermWidget;
 
+#if OPT_TEK4014
 typedef struct _TekWidgetRec {
     CorePart core;
     TekPart tek;
 } TekWidgetRec, *TekWidget;
+#endif /* OPT_TEK4014 */
 
 #define BUF_SIZE 4096
 
@@ -969,7 +993,7 @@
 
 #define        WINDOWEVENTS    (TWINDOWEVENTS | PointerMotionMask)
 
-
+#if OPT_TEK4014
 #define TEK_LINK_BLOCK_SIZE 1024
 
 typedef struct Tek_Link
@@ -981,6 +1005,7 @@
        char *ptr;              /* current pointer into data */
        char data [TEK_LINK_BLOCK_SIZE];
 } TekLink;
+#endif /* OPT_TEK4014 */
 
 /* flags for cursors */
 #define        OFF             0
Index: resize.c
--- xterm-56+/resize.c  Wed Aug 27 06:48:32 1997
+++ xterm-57/resize.c   Wed Dec 24 11:27:08 1997
@@ -156,6 +156,10 @@
 #endif
 #endif
 
+#ifndef DFT_TERMTYPE
+#define DFT_TERMTYPE "xterm"
+#endif
+
 #ifndef GCC_UNUSED
 #define GCC_UNUSED /* nothing */
 #endif
@@ -376,7 +380,7 @@
        tty = fileno(ttyfp);
 #ifdef USE_TERMCAP
        if(!(env = getenv("TERM")) || !*env) {
-           env = "xterm";
+           env = DFT_TERMTYPE;
            if(SHELL_BOURNE == shell_type)
                setname = "TERM=xterm;\nexport TERM;\n";
            else
@@ -388,7 +392,7 @@
 #endif /* USE_TERMCAP */
 #ifdef USE_TERMINFO
        if(!(env = getenv("TERM")) || !*env) {
-               env = "xterm";
+               env = DFT_TERMTYPE;
                if(SHELL_BOURNE == shell_type)
                        setname = "TERM=xterm;\nexport TERM;\n";
                else    setname = "setenv TERM xterm;\n";
Index: util.c
--- xterm-56+/util.c    Sat Dec  6 10:24:45 1997
+++ xterm-57/util.c     Tue Dec  9 19:20:45 1997
@@ -1134,9 +1134,10 @@
        SET_COLOR_VALUE(pColors,TEXT_CURSOR,    screen->cursorcolor);
        SET_COLOR_VALUE(pColors,MOUSE_FG,       screen->mousecolor);
        SET_COLOR_VALUE(pColors,MOUSE_BG,       screen->mousecolorback);
-
+#if OPT_TEK4014
        SET_COLOR_VALUE(pColors,TEK_FG,         screen->Tforeground);
        SET_COLOR_VALUE(pColors,TEK_BG,         screen->Tbackground);
+#endif
 }
 
 void
@@ -1145,8 +1146,10 @@
        ScrnColors *pNew;
 {
        register TScreen *screen = &tw->screen;
-       Window tek = TWindow(screen);
        Bool    newCursor=      TRUE;
+#if OPT_TEK4014
+       Window tek = TWindow(screen);
+#endif
 
        if (COLOR_DEFINED(pNew,TEXT_BG)) {
            tw->core.background_pixel=  COLOR_VALUE(pNew,TEXT_BG);
@@ -1193,21 +1196,27 @@
                screen->mousecolor, screen->mousecolorback);
            XDefineCursor(screen->display, TextWindow(screen),
                                           screen->pointer_cursor);
+#if OPT_TEK4014
            if(tek)
                XDefineCursor(screen->display, tek, screen->arrow);
+#endif
        }
 
+#if OPT_TEK4014
        if ((tek)&&(COLOR_DEFINED(pNew,TEK_FG)||COLOR_DEFINED(pNew,TEK_BG))) {
            ChangeTekColors(screen,pNew);
        }
+#endif
        set_cursor_gcs(screen);
        XClearWindow(screen->display, TextWindow(screen));
        ScrnRefresh (screen, 0, 0, screen->max_row + 1,
         screen->max_col + 1, False);
+#if OPT_TEK4014
        if(screen->Tshow) {
            XClearWindow(screen->display, tek);
            TekExpose((Widget)NULL, (XEvent *)NULL, (Region)NULL);
        }
+#endif
 }
 
 /***====================================================================***/
@@ -1220,8 +1229,10 @@
 {
        register TScreen *screen = &termw->screen;
        GC tmpGC;
-       Window tek = TWindow(screen);
        Pixel tmp;
+#if OPT_TEK4014
+       Window tek = TWindow(screen);
+#endif
 
        /*
         * Swap SGR foreground and background colors.  By convention, these are
@@ -1265,8 +1276,10 @@
        termw->misc.re_verse = !termw->misc.re_verse;
 
        XDefineCursor(screen->display, TextWindow(screen), screen->pointer_cursor);
+#if OPT_TEK4014
        if(tek)
                XDefineCursor(screen->display, tek, screen->arrow);
+#endif
 
        if(screen->scrollWidget)
                ScrollBarReverseVideo(screen->scrollWidget);
@@ -1278,16 +1291,20 @@
         */
        XSetWindowBackground(screen->display, VShellWindow, termw->core.background_pixel);
 
+#if OPT_TEK4014
        if(tek) {
            TekReverseVideo(screen);
        }
+#endif
        XClearWindow(screen->display, TextWindow(screen));
        ScrnRefresh (screen, 0, 0, screen->max_row + 1,
         screen->max_col + 1, False);
+#if OPT_TEK4014
        if(screen->Tshow) {
            XClearWindow(screen->display, tek);
            TekExpose((Widget)NULL, (XEvent *)NULL, (Region)NULL);
        }
+#endif
        ReverseOldColors();
        update_reversevideo();
 }
Index: xterm.h
--- xterm-56+/xterm.h   Sat Dec  6 10:24:45 1997
+++ xterm-57/xterm.h    Wed Dec 24 11:31:14 1997
@@ -15,6 +15,10 @@
 #define HAVE_X11_DECKEYSYM_H 1
 #endif
 
+#ifndef DFT_TERMTYPE
+#define DFT_TERMTYPE "xterm"
+#endif
+
 #endif
 
 #include "proto.h"
Index: xtermcfg.hin
--- xterm-56+/xtermcfg.hin      Tue Oct 14 21:40:58 1997
+++ xterm-57/xtermcfg.hin       Thu Dec 25 12:34:29 1997
@@ -33,6 +33,7 @@
 #undef CC_HAS_PROTOS   /* CF_ANSI_CC */
 #undef DFT_COLORMODE   /* AC_ARG_WITH(default-color-mode) */
 #undef DFT_DECID       /* AC_ARG_WITH(default-terminal-id) */
+#undef DFT_TERMTYPE    /* AC_ARG_WITH(default-term-type) */
 #undef HAVE_STRERROR   /* AC_CHECK_FUNCS(strerror) */
 #undef HAVE_TERMCAP_H  /* AC_CHECK_HEADERS(termcap.h) */
 #undef HAVE_UNISTD_H   /* AC_CHECK_HEADERS(unistd.h) */
@@ -45,6 +46,7 @@
 #undef OPT_INPUT_METHOD        /* CF_ARG_DISABLE(input-method) */
 #undef OPT_ISO_COLORS  /* CF_ARG_DISABLE(ansi-color) */
 #undef OPT_PC_COLORS   /* CF_ARG_DISABLE(pc-color) */
+#undef OPT_TEK4014     /* CF_ARG_DISABLE(tek4014) */
 #undef OPT_TRACE       /* CF_ARG_ENABLE(trace) */
 #undef OPT_VT52_MODE   /* CF_ARG_DISABLE(vt52) */
 #undef OPT_XMC_GLITCH  /* CF_ARG_ENABLE(xmc-glitch) */