XFree86 3.2Xh - patch 1997/5/22 - T.Dickey <dickey@clark.net>
 
This implements a simple configuration script with autoconf (to which I'll
add more options later).  It does the following:
 
        + configures xterm to build with X11R5 (at least on SunOS 4.1, Solaris
          2.4, possibly IRIX - sorry network was down today, but I did test
          an earlier version yesterday).
 
        + enables/disables the configuration ifdefs for ANSI color and VT52
          emulation.
 
It does not make tests for the things that imake does (that's another project),
instead it uses a hybrid of the autoconf tests for libraries and adds imake's
compiler options (which are necessary in some cases to get main.c to compile).
 
--------------------------------------------------------------------------------
  Tekproc.c             |    4 
 button.c              |   10 
 charproc.c            |    6 
 cursor.c              |    4 
 data.c                |    4 
 input.c               |   27 
 main.c                |    4 
 menu.c                |    4 
 misc.c                |    4 
 ptyx.h                |   11 
 resize.c              |    5 
 screen.c              |    4 
 scrollbar.c           |    4 
 tabs.c                |    4 
 ttysvr.c              |    4 
 util.c                |   41 
 xterm-38/Makefile.in  |   95 +
 xterm-38/aclocal.m4   |  435 ++++++
 xterm-38/configure    | 3406 ++++++++++++++++++++++++++++++++++++++++++++++++
 xterm-38/configure.in |  160 ++
 xterm-38/install.sh   |  120 +
 xterm-38/mkdirs.sh    |   35 
 xterm-38/trace.c      |   82 +
 xterm-38/trace.h      |   45 
 xterm-38/xtermcfg.hin |   56 
 xterm.h               |    1 
 26 files changed, 4564 insertions, 11 deletions
--------------------------------------------------------------------------------
 Index: Makefile.in
--- /dev/null   Sun Jul 17 19:46:18 1994
 +++ xterm-38/Makefile.in        Wed May 21 21:30:22 1997
 @@ -0,0 +1,95 @@
 +#### Start of system configuration section. ####
 +
+srcdir         = @srcdir@
 +VPATH                  = @srcdir@
 +
+CC             = @CC@
 +LINK           = $(CC) $(CFLAGS)
 +INSTALL                = @INSTALL@
 +INSTALL_PROGRAM        = @INSTALL_PROGRAM@
 +INSTALL_DATA   = @INSTALL_DATA@
+
 +IMAKE_CFLAGS   = @IMAKE_CFLAGS@
+CFLAGS         = @CFLAGS@ $(IMAKE_CFLAGS)
 +LIBS           = @LIBS@
 +
+X_CFLAGS       = @X_CFLAGS@
 +X_LIBS         = @X_LIBS@
 +
+prefix         = @prefix@
 +exec_prefix    = @exec_prefix@
 +
+manext         = 1
 +bindir         = $(exec_prefix)/bin
 +libdir         = $(exec_prefix)/lib
 +mandir         = $(prefix)/man/man$(manext)
 +
+#### End of system configuration section. ####
 +
+SHELL          = /bin/sh
 +RM              = rm -f
 +
+CPPFLAGS       = -I. -I$(srcdir) -DHAVE_CONFIG_H $(X_CFLAGS) 
 +
+LDFLAGS                = 
 +
+INSTALL_DIRS    = $(bindir) $(libdir) $(mandir)
 +
+EXTRASRC       = @EXTRASRCS@
 +EXTRAOBJ       = @EXTRAOBJS@
 +
+          SRCS1 = button.c charproc.c cursor.c data.c input.c \
 +                 main.c menu.c misc.c screen.c scrollbar.c tabs.c \
 +                 TekPrsTbl.c Tekproc.c util.c VTPrsTbl.c $(EXTRASRC)
 +          OBJS1 = button.o charproc.o cursor.o data.o input.o \
 +                 main.o menu.o misc.o screen.o scrollbar.o tabs.o \
 +                 TekPrsTbl.o Tekproc.o 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
 +       PROGRAMS = xterm resize
 +
+all:   $(PROGRAMS)
+
 +xterm : $(OBJS1)
+       $(LINK) $(LDFLAGS) -o $@ $(OBJS1) $(X_LIBS) $(LIBS)
 +
+resize : $(OBJS2)
+       $(LINK) $(LDFLAGS) -o $@ $(OBJS2) $(X_LIBS) $(LIBS)
 +
+install: $(INSTALL_DIRS) \
+       $(bindir)/xterm \
 +       $(mandir)/xterm.$(manext) \
 +       @echo 'Completed installation.'
 +
+installdirs: $(INSTALL_DIRS)
+
 +uninstall:
+       -$(RM) $(bindir)/xterm \
 +               $(mandir)/xterm.$(manext)
+
+mostlyclean:
+       -$(RM) *.o core *~ *.BAK
 +
+clean: mostlyclean
+       -$(RM) $(PROGRAMS)
 +
+distclean: clean
+       -$(RM) Makefile config.status config.cache config.log xtermcfg.h
 +
+realclean: distclean
+       -$(RM) tags TAGS
 +
+tags:
+       ctags $(SRCS) $(HDRS)
 +
+TAGS:
+       etags $(SRCS) $(HDRS)
 +
+$(INSTALL_DIRS):
+       $(SHELL) ${srcdir}/mkdirs.sh $@
 +
+ALWAYS:
Index: Tekproc.c
--- xterm-37+/Tekproc.c Fri Dec 27 03:01:57 1996
 +++ xterm-38/Tekproc.c  Wed May 21 21:30:22 1997
 @@ -56,6 +56,10 @@
  
 /* Tekproc.c */
 
+#ifdef HAVE_CONFIG_H
+#include <xtermcfg.h>
+#endif
 +
 #include "ptyx.h"
 #include <X11/Xos.h>
 #include <X11/Xatom.h>
Index: aclocal.m4
--- /dev/null   Sun Jul 17 19:46:18 1994
 +++ xterm-38/aclocal.m4 Thu May 22 20:21:43 1997
 @@ -0,0 +1,435 @@
 +dnl
+dnl $XFree86$
+dnl
+dnl ---------------------------------------------------------------------------
 +dnl 
+dnl Copyright 1997 by Thomas E. Dickey <dickey@clark.net>
 +dnl 
+dnl                         All Rights Reserved
 +dnl 
+dnl Permission to use, copy, modify, and distribute this software and its
 +dnl documentation for any purpose and without fee is hereby granted,
 +dnl provided that the above copyright notice appear in all copies and that
 +dnl both that copyright notice and this permission notice appear in
 +dnl supporting documentation, and that the name of the above listed
 +dnl copyright holder(s) not be used in advertising or publicity pertaining
 +dnl to distribution of the software without specific, written prior
 +dnl permission.
+dnl 
+dnl THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
 +dnl TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 +dnl AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
 +dnl LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 +dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 +dnl ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 +dnl OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 +dnl 
+dnl ---------------------------------------------------------------------------
 +dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES'
 +dnl in the sharutils 4.2 distribution.
 +dnl
+AC_DEFUN([CF_ANSI_CC],
+[AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
 +AC_CACHE_VAL(cf_cv_ansi_cc,
+[cf_cv_ansi_cc=no
+cf_save_CFLAGS="$CFLAGS"
+# Don't try gcc -ansi; that turns off useful extensions and
 +# breaks some systems' header files.
 +# AIX                  -qlanglvl=ansi
 +# Ultrix and OSF/1     -std1
 +# HP-UX                        -Aa -D_HPUX_SOURCE
 +# SVR4                 -Xc
 +# UnixWare 1.2         (cannot use -Xc, since ANSI/POSIX clashes)
 +for cf_arg in "-DCC_HAS_PROTOS" "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" -Xc
 +do
+       CFLAGS="$cf_save_CFLAGS $cf_arg"
 +       AC_TRY_COMPILE(
 +[
+#ifndef CC_HAS_PROTOS
+#if !defined(__STDC__) || __STDC__ != 1
 +choke me
+#endif
+#endif
+], [int test (int i, double x);
 +struct s1 {int (*f) (int a);};
 +struct s2 {int (*f) (double a);};],
 +[cf_cv_ansi_cc="$cf_arg"; break])
+done
 +CFLAGS="$cf_save_CFLAGS"
+])
+AC_MSG_RESULT($cf_cv_ansi_cc)
+test ".$cf_cv_ansi_cc" != .no && AC_DEFINE(CC_HAS_PROTOS)
 +])dnl
+dnl ---------------------------------------------------------------------------
 +dnl Allow user to disable a normally-on option.
 +AC_DEFUN([CF_ARG_DISABLE],
+[CF_ARG_OPTION($1,[$2 (default: on)],[$3],[$4],yes)])dnl
 +dnl ---------------------------------------------------------------------------
 +dnl Allow user to enable a normally-off option.
 +AC_DEFUN([CF_ARG_ENABLE],
+[CF_ARG_OPTION($1,[$2 (default: off)],[$3],[$4],no)])dnl
 +dnl ---------------------------------------------------------------------------
 +dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus
 +dnl values.
+dnl
+dnl Parameters:
+dnl $1 = option name
+dnl $2 = help-string 
 +dnl $3 = action to perform if option is not default
 +dnl $4 = action if perform if option is default
 +dnl $5 = default option value (either 'yes' or 'no')
 +AC_DEFUN([CF_ARG_OPTION],
+[AC_ARG_ENABLE($1,[$2],[test "$enableval" != ifelse($5,no,yes,no) && enableval=ifelse($5,no,no,yes)
 +  if test "$enableval" != "$5" ; then
 +ifelse($3,,[    :]dnl
+,[    $3]) ifelse($4,,,[
 +  else
+    $4])
+  fi],[enableval=$5 ifelse($4,,,[
+  $4
 +])dnl
+  ])])dnl
+dnl ---------------------------------------------------------------------------
 +dnl Check if we're accidentally using a cache from a different machine.
 +dnl Derive the system name, as a check for reusing the autoconf cache.
 +dnl
+AC_DEFUN([CF_CHECK_CACHE],
+[
+system_name="`(uname -s -r) 2>/dev/null`"
 +if test -n "$system_name" ; then
 +       AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name")
 +else
+       system_name="`(hostname) 2>/dev/null`"
 +fi
+AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
 +test -z "$system_name" && system_name="$cf_cv_system_name"
 +test -n "$cf_cv_system_name" && AC_MSG_RESULT("Configuring for $cf_cv_system_name")
 +
+if test ".$system_name" != ".$cf_cv_system_name" ; then
 +       AC_MSG_RESULT("Cached system name does not agree with actual")
 +       AC_ERROR("Please remove config.cache and try again.")
 +fi
+])dnl
+dnl ---------------------------------------------------------------------------
 +dnl Check for memmove, or a bcopy that can handle overlapping copy.  If neither
 +dnl is found, add our own version of memmove to the list of objects.
 +AC_DEFUN([CF_FUNC_MEMMOVE],
+[
+if test ".$ac_cv_func_memmove" != .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([
 +int main() {
+       static char data[] = "abcdefghijklmnopqrstuwwxyz";
 +       char temp[40];
 +       bcopy(data, temp, sizeof(data));
 +       bcopy(temp+10, temp, 15);
 +       bcopy(temp+5, temp+15, 10);
 +       exit (strcmp(temp, "klmnopqrstuwwxypqrstuwwxyz"));
 +}
+               ],
 +               [cf_cv_good_bcopy=yes],
 +               [cf_cv_good_bcopy=no],
 +               [cf_cv_good_bcopy=unknown])
 +               ])
 +               AC_MSG_RESULT($cf_cv_good_bcopy)
 +       else
+               cf_cv_good_bcopy=no
 +       fi
+       if test $cf_cv_good_bcopy = yes ; then
 +               AC_DEFINE(USE_OK_BCOPY)
 +       else
+               AC_DEFINE(USE_MY_MEMMOVE)
 +       fi
+fi
 +])dnl
+dnl ---------------------------------------------------------------------------
 +dnl Check for tgetent function in termcap library.  If we cannot find this,
 +dnl we'll use the $LINES and $COLUMNS environment variables to pass screen
 +dnl size information to subprocesses.  (We cannot use terminfo's compatibility
 +dnl function, since it cannot provide the termcap-format data).
 +AC_DEFUN([CF_FUNC_TGETENT],
+[
+AC_MSG_CHECKING(for workable tgetent function)
 +AC_CACHE_VAL(cf_cv_func_tgetent,[
+cf_save_LIBS="$LIBS"
 +cf_cv_func_tgetent=no
+for cf_termlib in termcap termlib curses
 +do
+       LIBS="$cf_save_LIBS -l$cf_termlib"
 +       AC_TRY_RUN([
 +/* terminfo implementations ignore the buffer argument, making it useless for
 + * the xterm application, which uses this information to make a new $TERMCAP
 + */
+int main()
+{
+       char buffer[1024];
 +       buffer[0] = 0;
 +       tgetent(buffer, "vt100");
 +       exit(buffer[0] == 0); }],
 +       [cf_cv_func_tgetent=$cf_termlib
 +        break],
 +       [AC_TRY_LINK([],[tgetent(0, 0)],[break])],
 +       [echo trying link
 +        AC_TRY_LINK([],[tgetent(0, 0)],
 +               [cf_cv_func_tgetent=$cf_termlib
 +                break],
 +               [echo link failed
 +                LIBS="$cf_save_LIBS"])])
 +done
+])
+AC_MSG_RESULT($cf_cv_func_tgetent)
+])dnl
 +dnl ---------------------------------------------------------------------------
 +dnl Test for availability of useful gcc __attribute__ directives to quiet
 +dnl compiler warnings.  Though useful, not all are supported -- and contrary
 +dnl to documentation, unrecognized directives cause older compilers to barf.
 +AC_DEFUN([CF_GCC_ATTRIBUTES],
+[cat > conftest.i <<EOF
+#ifndef GCC_PRINTF
 +#define GCC_PRINTF 0
+#endif
+#ifndef GCC_SCANF
+#define GCC_SCANF 0
+#endif
+#ifndef GCC_NORETURN
+#define GCC_NORETURN /* nothing */
 +#endif
+#ifndef GCC_UNUSED
+#define GCC_UNUSED /* nothing */
 +#endif
+EOF
+if test -n "$GCC"
+then
 +       AC_CHECKING([for gcc __attribute__ directives])
 +       changequote(,)dnl
 +cat > conftest.$ac_ext <<EOF
 +#line __oline__ "configure"
+#include "confdefs.h"
 +#include "conftest.h"
+#include "conftest.i"
+#if    GCC_PRINTF
+#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
 +#else
+#define GCC_PRINTFLIKE(fmt,var) /*nothing*/
 +#endif
+#if    GCC_SCANF
+#define GCC_SCANFLIKE(fmt,var)  __attribute__((format(scanf,fmt,var)))
 +#else
+#define GCC_SCANFLIKE(fmt,var)  /*nothing*/
 +#endif
+extern void wow(char *,...) GCC_SCANFLIKE(1,2);
 +extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
 +extern void foo(void) GCC_NORETURN;
+int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) { return 0; }
 +EOF
+       changequote([,])dnl
 +       for cf_attribute in scanf printf unused noreturn
 +       do
+               CF_UPPERCASE($cf_attribute,CF_ATTRIBUTE)
 +               cf_directive="__attribute__(($cf_attribute))"
 +               echo "checking for gcc $cf_directive" 1>&AC_FD_CC
 +               case $cf_attribute in
 +               scanf|printf)
 +               cat >conftest.h <<EOF
 +#define GCC_$CF_ATTRIBUTE 1
+EOF
 +                       ;;
 +               *)
 +               cat >conftest.h <<EOF
 +#define GCC_$CF_ATTRIBUTE $cf_directive
+EOF
 +                       ;;
 +               esac
 +               if AC_TRY_EVAL(ac_compile); then
 +                       test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
 +                       cat conftest.h >>confdefs.h
 +#              else
 +#                      sed -e 's/__attr.*/\/*nothing*\//' conftest.h >>confdefs.h
 +               fi
 +       done
+else
 +       fgrep define conftest.i >>confdefs.h
 +fi
+rm -rf conftest*
+
+])dnl
+dnl ---------------------------------------------------------------------------
 +dnl Check if the compiler supports useful warning options.  There's a few that
 +dnl we don't use, simply because they're too noisy:
 +dnl
+dnl    -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
 +dnl    -Wredundant-decls (system headers make this too noisy)
 +dnl    -Wtraditional (combines too many unrelated messages, only a few useful)
 +dnl    -Wwrite-strings (too noisy, but should review occasionally)
 +dnl
+AC_DEFUN([CF_GCC_WARNINGS],
+[cf_warn_CFLAGS=""
+if test -n "$GCC"
+then
 +       CF_GCC_ATTRIBUTES
 +       changequote(,)dnl
 +       cat > conftest.$ac_ext <<EOF
 +#line __oline__ "configure"
+int main(int argc, char *argv[]) { return argv[argc-1] == 0; }
 +EOF
+       changequote([,])dnl
 +       AC_CHECKING([for gcc warning options])
 +       cf_save_CFLAGS="$CFLAGS"
 +       cf_warn_CFLAGS="-W -Wall"
 +       for cf_opt in \
 +               Wbad-fuvction-cast \
 +               Wcast-align \
 +               Wcast-qual \
 +               Winline \
 +               Wmissing-declarations \
 +               Wmissing-prototypes \
 +               Wnested-externs \
 +               Wpointer-arith \
 +               Wshadow \
 +               Wstrict-prototypes
 +       do
+               CFLAGS="$cf_save_CFLAGS $cf_warn_CFLAGS -$cf_opt"
 +               if AC_TRY_EVAL(ac_compile); then
 +                       test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
 +                       cf_warn_CFLAGS="$cf_warn_CFLAGS -$cf_opt"
 +                       test "$cf_opt" = Wcast-qual && cf_warn_CFLAGS="$cf_warn_CFLAGS -DXTSTRINGDEFINES"
 +               fi
 +       done
+       rm -f conftest*
 +       CFLAGS="$cf_save_CFLAGS"
 +fi
+])dnl
+dnl ---------------------------------------------------------------------------
 +dnl Use imake to obtain compiler flags.  We could, in principal, write tests to
 +dnl get these, but if imake is properly configured there is no point in doing
 +dnl this.
+AC_DEFUN([CF_IMAKE_CFLAGS],
+[
+rm -f Makefile Makefile.bak
+AC_PATH_PROGS(IMAKE,xmkmf imake)
 +case $IMAKE in # (vi
+*/imake)
 +       cf_imake_opts="-DUseInstalled=YES" # (vi
 +       ;;
+*)
 +       cf_imake_opts=
 +       ;;
+esac
 +
+# If it's installed properly, imake (or its wrapper, xmkmf) will point to the
 +# config directory.
+if ( $IMAKE $cf_imake_opts 1>/dev/null 2>&AC_FD_CC)
 +then
+       CF_VERBOSE(Using $IMAKE)
 +else
+       # sometimes imake doesn't have the config path compiled in.  Find it.
 +       cf_config=
 +       for cf_libpath in $X_LIBS $LIBS ; do
 +               case $cf_libpath in # (vi
 +               -L*)
 +                       cf_libpath=`echo .$cf_libpath | sed -e 's/^...//'`
 +                       cf_libpath=$cf_libpath/X11/config
 +                       if test -d $cf_libpath ; then
 +                               cf_config=$cf_libpath
 +                               break
 +                       fi
 +                       ;;
 +               esac
 +       done
+       if test -z $cf_config ; then
 +               AC_ERROR(Could not find imake config-directory)
 +       fi
+       cf_imake_opts="$cf_imake_opts -I$cf_config"
 +       if ( $IMAKE -v $cf_imake_opts 2>&AC_FD_CC)
 +       then
+               CF_VERBOSE(Using $IMAKE $cf_config)
 +       else
+               AC_ERROR(Cannot run imake)
 +       fi
+fi
 +
+# If we've gotten this far, we have a Makefile for xterm.  Some X11R5 config
 +# macros do not work well enough to actually use the Makefile for a build, but
 +# the definitions are usable (probably).
 +AC_MSG_CHECKING(for compiler options known to imake)
 +AC_CACHE_VAL(cf_cv_imake_cflags,[
+       test -n "$verbose" && echo working...
 +       cf_imake_cflags=`${MAKE-make} -n -f Makefile main.o RM=echo 2>/dev/null`
 +       for cf_opt in $cf_imake_cflags
 +       do
+               cf_found=no
 +               case $cf_opt in # (vi
 +changequote(,)dnl
+               -[focg]) cf_found=yes
 +                       ;; # (vi
 +               -[OID]*) #(vi
 +changequote([,])dnl
+                       for cf_opt2 in $CFLAGS
 +                       do
 +                               if test ".$cf_opt" = ".$cf_opt2" ; then
 +                                       cf_found=yes
 +                                       break
 +                               fi
 +                       done
 +                       ;;
 +               -*)     ;; #(vi
 +               $CC|main.*|echo)        cf_found=yes
 +                       ;;
 +               esac
 +               if test $cf_found = no ; then
 +                       CF_VERBOSE(flag:$cf_opt)
 +                       cf_cv_imake_cflags="$cf_cv_imake_cflags $cf_opt"
 +               else
 +                       CF_VERBOSE(skip:$cf_opt)
 +               fi
 +       done
+])
 +test -z "$verbose" && AC_MSG_RESULT(done)
 +IMAKE_CFLAGS="$cf_cv_imake_cflags"
+rm -f Makefile Makefile.bak
 +])dnl
+dnl ---------------------------------------------------------------------------
 +dnl Make an uppercase version of a given name
 +AC_DEFUN([CF_UPPERCASE],
+[
+changequote(,)dnl
+$2=`echo $1 |tr '[a-z]' '[A-Z]'`
 +changequote([,])dnl
+])dnl
+dnl ---------------------------------------------------------------------------
 +dnl Use AC_VERBOSE w/o the warnings
 +AC_DEFUN([CF_VERBOSE],
+[test -n "$verbose" && echo "  $1" 1>&AC_FD_MSG
 +])dnl
+dnl ---------------------------------------------------------------------------
 +dnl Check for Xaw (Athena) libraries
 +dnl
+AC_DEFUN([CF_X_ATHENA],
+[AC_REQUIRE([CF_X_TOOLKIT])
+AC_CHECK_HEADERS(X11/Xaw/SimpleMenu.h)
+AC_CHECK_LIB(Xmu, XmuClientWindow)
 +AC_CHECK_LIB(Xext,XextCreateExtension,[LIBS="-lXext $LIBS"])
 +AC_CHECK_LIB(Xaw, XawSimpleMenuAddGlobalActions, [LIBS="-lXaw $LIBS"],
 +       AC_ERROR(
+[Unable to successfully link Athena library (-lXaw)]),
 +       [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])
 +
+])dnl
+dnl ---------------------------------------------------------------------------
 +dnl Check for X Toolkit libraries
 +dnl
+AC_DEFUN([CF_X_TOOLKIT],
+[
+AC_CHECK_LIB(X11,XOpenDisplay,
+       [LIBS="-lX11 $LIBS"],,
 +       [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])
 +AC_CHECK_LIB(Xt, XtAppInitialize,
+       [AC_DEFINE(HAVE_LIBXT) LIBS="-lXt $X_PRE_LIBS $LIBS"],
 +       AC_WARN(
+[Unable to successfully link X Toolkit library (-lXt).
 +You will have to check and add the proper libraries by hand to Makefile.]),
 +       [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])
 +
+])dnl
Index: button.c
--- xterm-37+/button.c  Fri Dec 27 03:01:57 1996
 +++ xterm-38/button.c   Thu May 22 20:58:07 1997
 @@ -30,6 +30,10 @@
                                 J. Gettys.
 */
 
+#ifdef HAVE_CONFIG_H
+#include <xtermcfg.h>
+#endif
 +
 #include "ptyx.h"              /* Xlib headers included here. */
 
 #include <X11/Xatom.h>
@@ -1269,7 +1273,7 @@
 {
     register TScreen* screen = &((XtermWidget)w)->screen;
     register Atom* atomP;
-    int i;
+    Cardinal i;
      for (i = 0, atomP = screen->selection_atoms;
         i < screen->selection_count; i++, atomP++)
     {
@@ -1319,7 +1323,7 @@
     Cardinal count;
 {
     Atom* atoms = termw->screen.selection_atoms;
-    int i;
+    Cardinal i;
      Boolean have_selection = False;
 
     if (termw->screen.selection_length < 0) return;
@@ -1372,7 +1376,7 @@
 {
     Atom* atoms = termw->screen.selection_atoms;
     Cardinal count = termw->screen.selection_count;
-    int i;
+    Cardinal i;
  
     for (i = 0; i < count; i++) {
        int cutbuffer;
Index: charproc.c
--- xterm-37+/charproc.c        Sun Jan 26 11:17:56 1997
 +++ xterm-38/charproc.c Thu May 22 21:00:01 1997
 @@ -54,6 +54,10 @@
  
 /* charproc.c */
 
+#ifdef HAVE_CONFIG_H
+#include <xtermcfg.h>
+#endif
 +
 #include "ptyx.h"
 #include <X11/Xos.h>
 #include <X11/Xatom.h>
@@ -4464,7 +4468,7 @@
     if (*param_count == 0) {
        fontnum = fontMenu_fontdefault;
     } else {
-       int maxparams = 1;              /* total number of params allowed */
 +       Cardinal maxparams = 1;         /* total number of params allowed */
  
        switch (params[0][0]) {
          case 'd': case 'D': case '0':
Index: configure.in
--- /dev/null   Sun Jul 17 19:46:18 1994
 +++ xterm-38/configure.in       Wed May 21 21:30:22 1997
 @@ -0,0 +1,160 @@
 +dnl
+dnl $XFree86$
+dnl
+dnl ---------------------------------------------------------------------------
 +dnl 
+dnl Copyright 1997 by Thomas E. Dickey <dickey@clark.net>
 +dnl 
+dnl                         All Rights Reserved
 +dnl 
+dnl Permission to use, copy, modify, and distribute this software and its
 +dnl documentation for any purpose and without fee is hereby granted,
 +dnl provided that the above copyright notice appear in all copies and that
 +dnl both that copyright notice and this permission notice appear in
 +dnl supporting documentation, and that the name of the above listed
 +dnl copyright holder(s) not be used in advertising or publicity pertaining
 +dnl to distribution of the software without specific, written prior
 +dnl permission.
+dnl 
+dnl THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
 +dnl TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 +dnl AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
 +dnl LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 +dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 +dnl ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 +dnl OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 +dnl 
+dnl ---------------------------------------------------------------------------
 +dnl Process this file with autoconf to produce a configure script.
 +dnl
+AC_REVISION($Revision$)
+AC_PREREQ(2.12)
+AC_INIT(charproc.c)
+AC_CONFIG_HEADER(xtermcfg.h:xtermcfg.hin)
+CF_CHECK_CACHE
 +
+###    checks for alternative programs
 +AC_PROG_CC
+AC_PROG_CPP
+AC_GCC_TRADITIONAL
+AC_PROG_INSTALL
+
+###    checks for UNIX variants that set C preprocessor variables
 +AC_AIX
+AC_ISC_POSIX
+AC_MINIX
+
+###    checks for header files
 +AC_CHECK_HEADERS( \
+       termcap.h \
 +       )
+
 +###    checks for typedefs
 +AC_TYPE_SIZE_T
+AC_CHECK_TYPE(time_t, long)
+
 +###    checks for library functions
 +AC_CHECK_FUNCS( \
+       bcopy \
 +       memmove \
 +       strerror \
 +       )
+CF_FUNC_MEMMOVE
 +CF_FUNC_TGETENT
+
+###    checks for structures
 +
+###    checks for compiler characteristics
 +AC_CONST
+CF_ANSI_CC
+
+###    checks for system services and user specified options
 +
+AC_PATH_XTRA
+
+LDFLAGS="$LDFLAGS $X_LIBS"
+CFLAGS="$CFLAGS $X_CFLAGS"
+
+CF_X_ATHENA
+
+LIBS="$LIBS $X_EXTRA_LIBS"
+
+AC_MSG_CHECKING(if we should use imake to help)
 +CF_ARG_DISABLE(imake,
+       [  --without-imake         disable use of imake for definitions],
 +       [enable_imake=no],
 +       [enable_imake=yes])
 +AC_MSG_RESULT($enable_imake)
+if test $enable_imake = yes ; then
 +       CF_IMAKE_CFLAGS
 +fi
+AC_SUBST(IMAKE_CFLAGS)
+
+AC_MSG_CHECKING(for default terminal-id)
+AC_ARG_WITH(terminal-id,
 +       [  --with-terminal-id[=V]  set default decTerminalId (default: vt100)],
 +       [default_termid=$withval],
 +       [default_termid=vt100])
 +AC_MSG_RESULT($default_termid)
+case $default_termid in
+vt*)   default_termid=`echo $default_termid | sed -e 's/^..//'`
 +       ;;
+esac
 +AC_DEFINE_UNQUOTED(DFT_DECID,$default_termid)
+
 +###    checks for optional features
 +AC_MSG_CHECKING(if you want ANSI color)
 +CF_ARG_DISABLE(ansi-color,
+       [  --disable-ansi-color    disable ANSI color],
 +       [enable_ansi_color=no],
 +       [enable_ansi_color=yes])
 +AC_MSG_RESULT($enable_ansi_color)
+test $enable_ansi_color = no && AC_DEFINE(OPT_ISO_COLORS,0)
 +
+dnl AC_MSG_CHECKING(for default terminal-id)
 +dnl CF_ARG_ENABLE(color-mode,
+dnl    [  --enable-color-mode     set default colorMode resource ],
 +dnl    [default_colormode=$withval],
 +dnl    [default_colormode=vt100])
 +dnl AC_MSG_RESULT($default_colormode)
+dnl AC_DEFINE(DFT_COLORMODE,$default_colormode)
 +
+AC_MSG_CHECKING(if you want debugging traces)
 +CF_ARG_ENABLE(trace,
+       [  --enable-trace          set to enable debugging traces],
 +       [enable_trace=yes],
 +       [enable_trace=no])
 +AC_MSG_RESULT($enable_trace)
+if test $enable_trace = yes ; then
 +       AC_DEFINE(OPT_TRACE)
 +       EXTRASRCS="$EXTRASRCS trace.c"
 +       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)
 +
+if test -n "$GCC" ; then
+AC_MSG_CHECKING(if you want to turn on gcc warnings)
 +CF_ARG_ENABLE(warnings,
+       [  --enable-warnings       turn on GCC compiler warnings],
 +       [with_warnings=yes],
 +       [with_warnings=no])
 +AC_MSG_RESULT($with_warnings)
+if test "$with_warnings" = yes
+then
 +       CF_GCC_WARNINGS
 +       CFLAGS="$CFLAGS $cf_warn_CFLAGS"
 +fi
+fi
+
+AC_SUBST(EXTRASRCS)
+AC_SUBST(EXTRAOBJS)
+
+###    output Makefile and xtermcfg.h
 +AC_OUTPUT(Makefile)
Index: cursor.c
--- xterm-37+/cursor.c  Tue Aug 20 15:08:28 1996
 +++ xterm-38/cursor.c   Wed May 21 21:30:22 1997
 @@ -28,6 +28,10 @@
  
 /* cursor.c */
 
+#ifdef HAVE_CONFIG_H
+#include <xtermcfg.h>
+#endif
 +
 #include "ptyx.h"              /* also gets Xlib.h */
 
 #include "data.h"
Index: data.c
--- xterm-37+/data.c    Tue Aug 13 14:51:20 1996
 +++ xterm-38/data.c     Wed May 21 21:30:22 1997
 @@ -26,6 +26,10 @@
   * SOFTWARE.
  */
 
+#ifdef HAVE_CONFIG_H
+#include <xtermcfg.h>
+#endif
 +
 #include "ptyx.h"              /* gets Xt stuff, too */
 
 #if XtSpecificationRelease >= 6
Index: input.c
--- xterm-37+/input.c   Tue May 13 13:01:52 1997
 +++ xterm-38/input.c    Thu May 22 15:38:28 1997
 @@ -28,6 +28,10 @@
  
 /* input.c */
 
+#ifdef HAVE_CONFIG_H
+#include <xtermcfg.h>
+#endif
 +
 #include "ptyx.h"              /* gets Xt headers, too */
 #include <X11/keysym.h>
 #include <X11/DECkeysym.h>
@@ -105,9 +109,11 @@
        reply.a_nparam = 0;
        reply.a_inters = 0;
 
+#ifdef XK_KP_Home
        if (keysym >= XK_KP_Home && keysym <= XK_KP_Begin) {
            keysym += XK_Home - XK_KP_Home;
        }
+#endif
 
 #define VT52_KEYPAD \
        if_OPT_VT52_MODE(screen,{ \
@@ -140,10 +146,15 @@
                        unparseseq(&reply, pty);
                }
                key = TRUE;
-        } else if (IsFunctionKey(keysym) || IsMiscFunctionKey(keysym) ||
 -               keysym == XK_Prior || keysym == XK_Next ||
 -               keysym == DXK_Remove || keysym == XK_KP_Delete ||
 -               keysym == XK_KP_Insert) {
 +        } else if (IsFunctionKey(keysym) || IsMiscFunctionKey(keysym)
 +               || keysym == XK_Prior
 +               || keysym == XK_Next
 +               || keysym == DXK_Remove
 +#ifdef XK_KP_Delete
+               || keysym == XK_KP_Delete
 +               || keysym == XK_KP_Insert
 +#endif
+               ) {
                 int dec_code = funcvalue(keysym);
                if ((event->state & ShiftMask)
                 && ((string = udk_lookup(dec_code, &nbytes)) != 0)) {
@@ -269,9 +280,11 @@
 
                case XK_Find :  return(1);
                case XK_Insert: return(2);
-               case XK_KP_Insert: return(2);
                 case XK_Delete: return(3);
+#ifdef XK_KP_Insert
+               case XK_KP_Insert: return(2);
                 case XK_KP_Delete: return(3);
+#endif
                case DXK_Remove: return(3);
                case XK_Select: return(4);
                case XK_Prior:  return(5);
@@ -326,9 +339,11 @@
   
                case XK_Find :  return(1);
                case XK_Insert: return(2);
-               case XK_KP_Insert: return(2);
                 case XK_Delete: return(3);
+#ifdef XK_KP_Insert
+               case XK_KP_Insert: return(2);
                 case XK_KP_Delete: return(3);
+#endif
                case DXK_Remove: return(3);
                case XK_Select: return(4);
                case XK_Prior:  return(5);
Index: install.sh
--- /dev/null   Sun Jul 17 19:46:18 1994
 +++ xterm-38/install.sh Wed May 21 21:30:22 1997
 @@ -0,0 +1,120 @@
 +#!/bin/sh
+
+#
+# install - install a program, script, or datafile
 +# This comes from X11R5; it is not part of GNU.
 +#
+# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $
 +#
+# This script is compatible with the BSD install script, but was written
 +# from scratch.
+#
+# $Header: /usr2/foxharp/src/pgf/vile/RCS/install.sh,v 1.2 1994/07/11 22:56:20 pgf Exp $
 +
+
+# set DOITPROG to echo to test this script
 +
+# Don't use :- since 4.3BSD and earlier shells don't like it.
 +doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
 +
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+
+instcmd="$mvprog"
+chmodcmd=""
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+
+while [ x"$1" != x ]; do
 +    case $1 in
+       -c) instcmd="$cpprog"
 +           shift
 +           continue;;
 +
+       -m) chmodcmd="$chmodprog $2"
 +           shift
 +           shift
 +           continue;;
 +
+       -o) chowncmd="$chownprog $2"
 +           shift
 +           shift
 +           continue;;
 +
+       -g) chgrpcmd="$chgrpprog $2"
 +           shift
 +           shift
 +           continue;;
 +
+       -s) stripcmd="$stripprog"
 +           shift
 +           continue;;
 +
+       *)  if [ x"$src" = x ]
 +           then
 +               src=$1
 +           else
 +               dst=$1
 +           fi
 +           shift
 +           continue;;
 +    esac
+done
+
+if [ x"$src" = x ]
+then
 +       echo "install:  no input file specified"
 +       exit 1
 +fi
+
+if [ x"$dst" = x ]
+then
 +       echo "install:  no destination specified"
 +       exit 1
 +fi
+
+
+# If destination is a directory, append the input filename; if your system
 +# does not like double slashes in filenames, you may need to add some logic
 +
+if [ -d $dst ]
+then
 +       dst="$dst"/`basename $src`
 +fi
+
+# Make a temp file name in the proper directory.
 +
+dstdir=`dirname $dst`
+dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
 +
+$doit $instcmd $src $dsttmp
+
 +# and set any options; do chmod last to preserve setuid bits
 +
+if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi
 +if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi
 +if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi
 +if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi
 +
+# Now rename the file to the real destination.
 +
+$doit $rmcmd $dst
+$doit $mvcmd $dsttmp $dst
+
 +
+exit 0
Index: main.c
--- xterm-37+/main.c    Sat Jan 18 07:32:17 1997
 +++ xterm-38/main.c     Wed May 21 21:30:22 1997
 @@ -68,6 +68,10 @@
  
 /* main.c */
 
+#ifdef HAVE_CONFIG_H
+#include <xtermcfg.h>
+#endif
 +
 #include "ptyx.h"
 #include <X11/StringDefs.h>
 #include <X11/Shell.h>
Index: menu.c
--- xterm-37+/menu.c    Wed Jan  8 18:18:35 1997
 +++ xterm-38/menu.c     Wed May 21 21:30:22 1997
 @@ -27,6 +27,10 @@
  
 */
 
+#ifdef HAVE_CONFIG_H
+#include <xtermcfg.h>
+#endif
 +
 #include "ptyx.h"
 #include "data.h"
 #include "menu.h"
Index: misc.c
--- xterm-37+/misc.c    Wed Jan  8 18:18:35 1997
 +++ xterm-38/misc.c     Wed May 21 21:30:22 1997
 @@ -26,6 +26,10 @@
   * SOFTWARE.
  */
 
+#ifdef HAVE_CONFIG_H
+#include <xtermcfg.h>
+#endif
 +
 #include "ptyx.h"              /* X headers included here. */
 
 #include <X11/Xos.h>
Index: mkdirs.sh
--- /dev/null   Sun Jul 17 19:46:18 1994
 +++ xterm-38/mkdirs.sh  Wed May 21 21:30:22 1997
 @@ -0,0 +1,35 @@
 +#!/bin/sh
+# mkinstalldirs --- make directory hierarchy
 +# Author: Noah Friedman <friedman@prep.ai.mit.edu>
 +# Created: 1993-05-16
+# Last modified: 1994-03-25
+# Public domain
 +#
+# $Header: /usr2/foxharp/src/pgf/vile/RCS/mkdirs.sh,v 1.2 1994/07/11 22:56:20 pgf Exp $
 +#
+
+errstatus=0
+
+for file in ${1+"$@"} ; do 
 +   set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
 +   shift
+
+   pathcomp=
+   for d in ${1+"$@"} ; do
 +     pathcomp="$pathcomp$d"
 +     case "$pathcomp" in
 +       -* ) pathcomp=./$pathcomp ;;
 +     esac
+
 +     if test ! -d "$pathcomp"; then
 +        echo "mkdir $pathcomp" 1>&2
 +        mkdir "$pathcomp" || errstatus=$?
 +     fi
+
 +     pathcomp="$pathcomp/"
+   done
 +done
+
+exit $errstatus
+
+# mkinstalldirs ends here
Index: ptyx.h
 --- xterm-37+/ptyx.h    Wed Jan  8 18:18:35 1997
 +++ xterm-38/ptyx.h     Wed May 21 21:30:22 1997
 @@ -189,9 +189,12 @@
  #define        RDEL    0xFF
 
 #define MIN_DECID  52                  /* can emulate VT52 */
-#define DFT_DECID 100                  /* default VT100 */
  #define MAX_DECID 420                  /* ...through VT420 */
 
+#ifndef DFT_DECID
+#define DFT_DECID 100                  /* default VT100 */
 +#endif
+
 #define NMENUFONTS 9                   /* entries in fontMenu */
 
 #define        NBOX    5                       /* Number of Points in box      */
@@ -285,9 +288,15 @@
 
 /***====================================================================***/
 
+#ifndef OPT_ISO_COLORS
 #define OPT_ISO_COLORS  1 /* true if xterm is configured with ISO colors */
+#endif
+
 #define OPT_BLINK_CURS  0 /* FIXME: do this later (96/7/31) */
+
+#ifndef OPT_VT52_MODE
 #define OPT_VT52_MODE   1 /* true if xterm supports VT52 emulation */
+#endif
 
 /***====================================================================***/
 
Index: resize.c
--- xterm-37+/resize.c  Sat Jan 18 07:32:17 1997
 +++ xterm-38/resize.c   Thu May 22 20:09:12 1997
 @@ -29,6 +29,10 @@
  
 /* resize.c */
 
+#ifdef HAVE_CONFIG_H
+#include <xtermcfg.h>
+#endif
 +
 #include <X11/Xos.h>
 #include <stdio.h>
 #include <ctype.h>
@@ -43,6 +47,7 @@
 #endif
 
 #ifdef SVR4
+#undef  SYSV                   /* predefined on Solaris 2.4 */
  #define SYSV
 #define ATT
 #endif
Index: screen.c
--- xterm-37+/screen.c  Sat Jan 18 07:32:17 1997
 +++ xterm-38/screen.c   Wed May 21 21:30:22 1997
 @@ -28,6 +28,10 @@
  
 /* screen.c */
 
+#ifdef HAVE_CONFIG_H
+#include <xtermcfg.h>
+#endif
 +
 #include "ptyx.h"
 #include "error.h"
 #include "data.h"
Index: scrollbar.c
--- xterm-37+/scrollbar.c       Mon May 19 10:50:55 1997
 +++ xterm-38/scrollbar.c        Wed May 21 21:30:22 1997
 @@ -26,6 +26,10 @@
   * SOFTWARE.
  */
 
+#ifdef HAVE_CONFIG_H
+#include <xtermcfg.h>
+#endif
 +
 #include "ptyx.h"              /* gets Xt headers, too */
 
 #ifndef X_NOT_STDC_ENV
Index: tabs.c
--- xterm-37+/tabs.c    Tue Aug 13 14:51:20 1996
 +++ xterm-38/tabs.c     Wed May 21 21:30:22 1997
 @@ -28,6 +28,10 @@
  
 /* tabs.c */
 
+#ifdef HAVE_CONFIG_H
+#include <xtermcfg.h>
+#endif
 +
 #include "ptyx.h"
 
 #include "xterm.h"
Index: trace.c
--- /dev/null   Sun Jul 17 19:46:18 1994
 +++ xterm-38/trace.c    Wed May 21 21:30:22 1997
 @@ -0,0 +1,82 @@
 +/*
+ * $XFree86$
+ */
+
+/************************************************************
 +
+Copyright 1997 by Thomas E. Dickey <dickey@clark.net>
 +
+                        All Rights Reserved
 +
+Permission to use, copy, modify, and distribute this software and its
 +documentation for any purpose and without fee is hereby granted,
 +provided that the above copyright notice appear in all copies and that
 +both that copyright notice and this permission notice appear in
 +supporting documentation, and that the name of the above listed
 +copyright holder(s) not be used in advertising or publicity pertaining
 +to distribution of the software without specific, written prior
 +permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
 +TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 +AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
 +LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 +
+********************************************************/
 +
+/*
+ * debugging support via TRACE macro.
 + */
+#ifdef HAVE_CONFIG_H
+#include <xtermcfg.h>
+#endif
 +
+#include <stdio.h>
+#include "trace.h"
+
+#if __STDC__ || CC_HAS_PROTOS
+#define ANSI_VARARGS 1
 +#include <stdarg.h>
+#else
+#define ANSI_VARARGS 0
+#include <varargs.h>
 +#endif
+
+void
+#if    ANSI_VARARGS
+Trace(char *fmt, ...)
 +#else
+Trace(va_alist)
+va_dcl
+#endif
+{
+#if    !ANSI_VARARGS
+       register char *fmt;
 +#endif
+       static  FILE    *fp;
 +       va_list ap;
 +
+       if (!fp)
 +               fp = fopen("Trace.out", "w");
 +       if (!fp)
 +               abort();
 +
+#if    ANSI_VARARGS
+       va_start(ap,fmt);
 +#else
+       va_start(ap);
 +       fmt = va_arg(ap, char *);
 +#endif
+       if (fmt != 0) {
 +               vfprintf(fp, fmt, ap);
 +               va_end(ap);
 +               (void)fflush(fp);
 +       } else {
 +               (void)fclose(fp);
 +               (void)fflush(stdout);
 +               (void)fflush(stderr);
 +       }
+}
 Index: trace.h
--- /dev/null   Sun Jul 17 19:46:18 1994
 +++ xterm-38/trace.h    Wed May 21 21:30:22 1997
 @@ -0,0 +1,45 @@
 +/*
+ * $XFree86$
+ */
+
+/************************************************************
 +
+Copyright 1997 by Thomas E. Dickey <dickey@clark.net>
 +
+                        All Rights Reserved
 +
+Permission to use, copy, modify, and distribute this software and its
 +documentation for any purpose and without fee is hereby granted,
 +provided that the above copyright notice appear in all copies and that
 +both that copyright notice and this permission notice appear in
 +supporting documentation, and that the name of the above listed
 +copyright holder(s) not be used in advertising or publicity pertaining
 +to distribution of the software without specific, written prior
 +permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
 +TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 +AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
 +LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 +
+********************************************************/
 +
+/*
+ * Common/useful definitions for XTERM application
 + */
+#ifndef        included_trace_h
 +#define        included_trace_h
 +
+#include "proto.h"
+
+extern void    Trace PROTO(( char *, ... ))
 +#if __GNUC__
+       __attribute__ ((format(printf,1,2)))
 +#endif
+       ;
+#define TRACE(p) Trace p;
 +
+#endif /* included_trace_h */
Index: ttysvr.c
 --- xterm-37+/ttysvr.c  Wed Sep 14 10:02:53 1994
 +++ xterm-38/ttysvr.c   Wed May 21 21:30:22 1997
 @@ -9,6 +9,10 @@
   *     Leendert van Doorn, 1992
  */
 
+#ifdef HAVE_CONFIG_H
+#include <xtermcfg.h>
+#endif
 +
 #include "ptyx.h"
 #include "data.h"
 #include "error.h"
Index: util.c
--- xterm-37+/util.c    Wed Jan  8 18:18:35 1997
 +++ xterm-38/util.c     Wed May 21 21:30:22 1997
 @@ -28,6 +28,10 @@
  
 /* util.c */
 
+#ifdef HAVE_CONFIG_H
+#include <xtermcfg.h>
+#endif
 +
 #include "ptyx.h"
 #include "data.h"
 #include "error.h"
@@ -1486,3 +1490,40 @@
        useCurBackground(FALSE);
 }
 #endif /* OPT_ISO_COLORS */
+
+#if USE_MY_MEMMOVE
+char * my_memmove(s1, s2, n)
+       char *  s1;
 +       char *  s2;
 +       size_t  n;
 +{
+       if (n != 0) {
 +               if ((s1+n > s2) && (s2+n > s1)) {
 +                       static  char    *buffer;
 +                       static  size_t  length;
 +                       register int    j;
 +                       if (length < n) {
 +                               length = (n * 3) / 2;
 +                               buffer = doalloc(buffer, length = n);
 +                       }
 +                       for (j = 0; j < n; j++)
 +                               buffer[j] = s2[j];
 +                       s2 = buffer;
 +               }
 +               while (n-- != 0)
 +                       s1[n] = s2[n];
 +       }
+       return s1;
 +}
+#endif USE_MY_MEMMOVE
+
+#if !HAVE_STRERROR
+char *my_strerror(n)
+{
+       extern char *sys_errlist[];
 +       extern int sys_nerr;
 +       if (n > 0 && n < sys_nerr)
 +               return sys_errlist[n];
 +       return "?";
 +}
+#endif
Index: xterm.h
--- xterm-37+/xterm.h   Wed Jan  8 18:18:35 1997
 +++ xterm-38/xterm.h    Thu May 22 20:42:43 1997
 @@ -223,6 +223,7 @@
                 /* FIXME: Reverse-Video? */
 #define getXtermBackground(flags, color) term->core.background_pixel
 #define getXtermForeground(flags, color) term->screen.foreground
+#define xtermColorPair() 0
 
 #define useCurBackground(flag) /*nothing*/
 
Index: xtermcfg.hin
--- /dev/null   Sun Jul 17 19:46:18 1994
 +++ xterm-38/xtermcfg.hin       Thu May 22 15:53:22 1997
 @@ -0,0 +1,56 @@
 +/*
+ * $XFree86$
+ */
+
+/************************************************************
 +
+Copyright 1997 by Thomas E. Dickey <dickey@clark.net>
 +
+                        All Rights Reserved
 +
+Permission to use, copy, modify, and distribute this software and its
 +documentation for any purpose and without fee is hereby granted,
 +provided that the above copyright notice appear in all copies and that
 +both that copyright notice and this permission notice appear in
 +supporting documentation, and that the name of the above listed
 +copyright holder(s) not be used in advertising or publicity pertaining
 +to distribution of the software without specific, written prior
 +permission.
+
+THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
 +TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 +AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
 +LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 +
+********************************************************/
 +
+/* This is a template for <xtermcfg.h> */
 +
+#undef CC_HAS_PROTOS   /* CF_ANSI_CC */
 +#undef DFT_DECID       /* AC_ARG_WITH(default-terminal-id) */
 +#undef HAVE_STRERROR   /* AC_CHECK_FUNCS(strerror) */
 +#undef HAVE_TERMCAP_H  /* AC_CHECK_HEADERS(termcap.h) */
 +#undef OPT_ISO_COLORS  /* CF_ARG_DISABLE(ansi-color) */
 +#undef OPT_TRACE       /* CF_ARG_ENABLE(trace) */
 +#undef OPT_VT52_MODE   /* CF_ARG_DISABLE(vt52) */
 +#undef USE_MY_MEMMOVE  /* CF_FUNC_MEMMOVE */
 +#undef USE_OK_BCOPY    /* CF_FUNC_MEMMOVE */
 +#undef const           /* AC_CONST */
 +#undef size_t          /* AC_TYPE_SIZE_T */
 +#undef time_t          /* AC_CHECK_TYPE(time_t, long) */
 +
+#if USE_OK_BCOPY
+#define memmove(d,s,n) bcopy(s,d,n)
+#endif
 +
+#if !HAVE_STRERROR
+#define strerror(n) my_strerror(n)
+extern char *my_strerror();
 +#endif
+
+#if !HAVE_TERMCAP_H && !defined(NO_TERMCAP_H)
 +#define NO_TERMCAP_H
+#endif