# ------------------------------------------------------------------------------
 #  Imakefile            |    6 
 #  Makefile.in          |    4 
 #  TekPrsTbl.c          |    8 
 #  Tekparse.h           |   22 ++
 #  Tekproc.c            |   64 ++---
 #  VTPrsTbl.c           |    2 
 #  VTparse.h            |   15 +
 #  aclocal.m4           |   37 +--
 #  button.c             |   34 +--
 #  charproc.c           |  472 ++++++++++++-------------------------------
 #  charsets.c           |   11 -
 #  configure            |  457 +++++++++++++++++++++++++-----------------
 #  cursor.c             |   10 
 #  data.c               |   11 -
 #  data.h               |    3 
 #  doublechr.c          |    9 
 #  input.c              |   10 
 #  main.c               |   36 +--
 #  menu.c               |   11 -
 #  menu.h               |    7 
 #  misc.c               |   33 +--
 #  os2main.c            |   11 -
 #  print.c              |   17 -
 #  proto.h              |    4 
 #  ptyx.h               |   40 ++-
 #  resize.c             |    2 
 #  screen.c             |   18 -
 #  scrollbar.c          |   28 --
 #  tabs.c               |   11 -
 #  terminfo             |    2 
 #  testxmc.c            |   12 -
 #  trace.c              |    4 
 #  trace.h              |    6 
 #  ttysvr.c             |   10 
 #  util.c               |   27 +-
 #  version.h            |    2 
 #  xterm-85/fontutils.c |  529 +++++++++++++++++++++++++++++++++++++++++++++++++
 #  xterm-85/fontutils.h |   46 ++++
 #  xterm.h              |   18 +
 #  xterm.log.html       |   22 ++
 #  xtermcfg.hin         |    1 
 #  41 files changed, 1270 insertions, 802 deletions
 # ------------------------------------------------------------------------------
 Index: Imakefile
--- xterm-84+/Imakefile Thu Aug 20 17:39:43 1998
 +++ xterm-85/Imakefile  Sun Oct 11 16:52:35 1998
 @@ -73,7 +73,7 @@
                   -DOSMINORVERSION=$(OSMINORVERSION)
    MISC_DEFINES = /* -DALLOWLOGGING -DALLOWLOGFILEEXEC */ 
     XKB_DEFINES = XkbClientDefines
-        DEFINES = $(XKB_DEFINES) $(TERMCAPDEFINES) $(FEATURE_DEFINES) $(SCROLLBAR_RIGHT)
 +        DEFINES = -I. $(XKB_DEFINES) $(TERMCAPDEFINES) $(FEATURE_DEFINES) $(SCROLLBAR_RIGHT)
  
 #ifdef OS2Architecture
           MAINSRC = os2main.c
@@ -83,12 +83,12 @@
           MAINOBJ = main.o
 #endif
           SRCS1 = button.c charproc.c charsets.c cursor.c \
-                 data.c doublechr.c input.c \
 +                 data.c doublechr.c fontutils.c input.c \
                   $(MAINSRC) menu.c misc.c print.c \
                  screen.c scrollbar.c tabs.c util.c \
                  TekPrsTbl.c Tekproc.c VTPrsTbl.c $(EXTRASRC)
           OBJS1 = button.o charproc.o charsets.o cursor.o \
-                 data.o doublechr.o input.o \
 +                 data.o doublechr.o fontutils.o input.o \
                   $(MAINOBJ) menu.o misc.o print.o \
                  screen.o scrollbar.o tabs.o util.o \
                  TekPrsTbl.o Tekproc.o VTPrsTbl.o $(EXTRAOBJ)
Index: Makefile.in
--- xterm-84+/Makefile.in       Sun Aug 30 06:43:03 1998
 +++ xterm-85/Makefile.in        Sun Oct 11 14:59:56 1998
 @@ -46,12 +46,12 @@
  EXTRAOBJ       = @EXTRAOBJS@
 
           SRCS1 = button.c charproc.c charsets.c cursor.c \
-                 data.c doublechr.c input.c \
 +                 data.c doublechr.c fontutils.c input.c \
                   $(MAINSRC) menu.c misc.c print.c \
                  screen.c scrollbar.c tabs.c util.c \
                  TekPrsTbl.c Tekproc.c VTPrsTbl.c $(EXTRASRC)
           OBJS1 = button.o charproc.o charsets.o cursor.o \
-                 data.o doublechr.o input.o \
 +                 data.o doublechr.o fontutils.o input.o \
                   main.o menu.o misc.o print.o \
                  screen.o scrollbar.o tabs.o util.o \
                  VTPrsTbl.o $(EXTRAOBJ)
Index: TekPrsTbl.c
--- xterm-84+/TekPrsTbl.c       Thu Jun  8 23:20:39 1995
 +++ xterm-85/TekPrsTbl.c        Sun Oct 11 20:38:48 1998
 @@ -26,13 +26,7 @@
   * SOFTWARE.
  */
 
-#include "Tekparse.h"
-
-#ifdef __STDC__
-#define Const const
-#else
-#define Const /**/
-#endif
+#include <Tekparse.h>
 
 Const int Talptable[] =                /* US (^_) normal alpha mode */
 {
Index: Tekparse.h
--- xterm-84+/Tekparse.h        Sun Jan  6 12:46:47 1991
 +++ xterm-85/Tekparse.h Sun Oct 11 21:09:26 1998
 @@ -28,6 +28,26 @@
  
 /* @(#)Tekparse.h      X10/6.6 11/7/86 */
 
+#ifndef included_Tekparse_h
+#define included_Tekparse_h 1
 +
+#ifndef Const
+# if defined(__STDC__) && !defined(__cplusplus)
 +#  define Const const
+# else
 +#  define Const /**/
+# endif
 +#endif
+
+extern Const int Talptable[];
+extern Const int Tbestable[];
 +extern Const int Tbyptable[];
+extern Const int Tesctable[];
 +extern Const int Tipltable[];
+extern Const int Tplttable[];
 +extern Const int Tpttable[];
+extern Const int Tspttable[];
 +
 /*
  * The following list of definitions is generated from Tekparse.def using the
  * following command line:
@@ -74,3 +94,5 @@
 #define CASE_SP 31
 #define CASE_PRINT 32
 #define CASE_OSC 33
+
+#endif /* included_Tekparse_h */
Index: Tekproc.c
 --- xterm-84+/Tekproc.c Sat Jul 18 13:11:26 1998
 +++ xterm-85/Tekproc.c  Sun Oct 11 21:10:48 1998
 @@ -56,11 +56,8 @@
  
 /* Tekproc.c */
 
-#ifdef HAVE_CONFIG_H
-#include <xtermcfg.h>
-#endif
 +#include <xterm.h>
 
-#include "ptyx.h"
 #include <X11/Xos.h>
 #include <X11/Xatom.h>
 #include <X11/Xutil.h>
@@ -74,12 +71,10 @@
 #include <setjmp.h>
 #include <signal.h>
 
-#include "xterm.h"
-
-#include "Tekparse.h"
-#include "data.h"
-#include "error.h"
-#include "menu.h"
+#include <Tekparse.h>
+#include <data.h>
 +#include <error.h>
+#include <menu.h>
 
 #ifdef X_NOT_STDC_ENV
 extern time_t time ();
@@ -173,17 +168,8 @@
 static TekLink *TekRecord;
 static XSegment *Tline;
 
-extern int Talptable[];
-extern int Tbestable[];
 -extern int Tbyptable[];
-extern int Tesctable[];
 -extern int Tipltable[];
-extern int Tplttable[];
 -extern int Tpttable[];
-extern int Tspttable[];
 -
-static int *curstate = Talptable;
 -static int *Tparsestate = Talptable;
 +static Const int *curstate = Talptable;
 +static Const int *Tparsestate = Talptable;
  
 static char defaultTranslations[] = "\
                 ~Meta<KeyPress>: insert-seven-bit() \n\
@@ -292,7 +278,7 @@
 static void TekDraw (int x, int y);
 static void TekEnq (int status, int x, int y);
 static void TekFlush (void);
-static void TekInitialize (Widget request, Widget new, ArgList args, Cardinal *num_args);
 +static void TekInitialize (Widget request, Widget wnew, ArgList args, Cardinal *num_args);
  static void TekPage (void);
 static void TekRealize (Widget gw, XtValueMask *valuemaskp, XSetWindowAttributes *values);
 
@@ -1075,12 +1061,12 @@
                TekFlush();
        }
        lp = line_pt++;
-       lp->x1 = x1 = x1 * TekScale(screen) + screen->border;
 -       lp->y1 = y1 = (TEKHEIGHT + TEKTOPPAD - y1) * TekScale(screen) +
 -        screen->border;
 -       lp->x2 = x2 = x2 * TekScale(screen) + screen->border;
 -       lp->y2 = y2 = (TEKHEIGHT + TEKTOPPAD - y2) * TekScale(screen) +
 -        screen->border;
 +       lp->x1 = x1 = (int) (x1 * TekScale(screen) + screen->border);
 +       lp->y1 = y1 = (int) ((TEKHEIGHT + TEKTOPPAD - y1) * TekScale(screen) +
 +                               screen->border);
 +       lp->x2 = x2 = (int) (x2 * TekScale(screen) + screen->border);
 +       lp->y2 = y2 = (int) ((TEKHEIGHT + TEKTOPPAD - y2) * TekScale(screen) +
 +                               screen->border);
         nplot++;
 }
 
@@ -1144,12 +1130,12 @@
            &rootx, &rooty,
            &mousex, &mousey,
            &mask);
-       if((mousex = (mousex - screen->border) / TekScale(screen)) < 0)
 +       if((mousex = (int)((mousex - screen->border) / TekScale(screen))) < 0)
                 mousex = 0;
        else if(mousex >= TEKWIDTH)
                mousex = TEKWIDTH - 1;
-       if((mousey = TEKHEIGHT + TEKTOPPAD - (mousey - screen->border) /
 -            TekScale(screen)) < 0)
 +       if((mousey = (int)(TEKHEIGHT + TEKTOPPAD - (mousey - screen->border) /
 +            TekScale(screen))) < 0)
                 mousey = 0;
        else if(mousey >= TEKHEIGHT)
                mousey = TEKHEIGHT - 1;
@@ -1252,20 +1238,20 @@
 
 static void TekInitialize(
     Widget request GCC_UNUSED,
-    Widget new GCC_UNUSED,
 +    Widget wnew GCC_UNUSED,
      ArgList args GCC_UNUSED,
     Cardinal *num_args GCC_UNUSED)
 {
     /* look for focus related events on the shell, because we need
      * to care about the shell's border being part of our focus.
      */
-    XtAddEventHandler(XtParent(new), EnterWindowMask, FALSE,
 +    XtAddEventHandler(XtParent(wnew), EnterWindowMask, FALSE,
                       HandleEnterWindow, (caddr_t)NULL);
-    XtAddEventHandler(XtParent(new), LeaveWindowMask, FALSE,
 +    XtAddEventHandler(XtParent(wnew), LeaveWindowMask, FALSE,
                       HandleLeaveWindow, (caddr_t)NULL);
-    XtAddEventHandler(XtParent(new), FocusChangeMask, FALSE,
 +    XtAddEventHandler(XtParent(wnew), FocusChangeMask, FALSE,
                       HandleFocusChange, (caddr_t)NULL);
-    XtAddEventHandler((Widget)new, PropertyChangeMask, FALSE,
 +    XtAddEventHandler((Widget)wnew, PropertyChangeMask, FALSE,
                       HandleBellPropertyChange, (Opaque)NULL);
 }
 
@@ -1655,9 +1641,9 @@
        cellheight = (unsigned) (tekWidget->tek.Tfont[c]->ascent + 
                                 tekWidget->tek.Tfont[c]->descent);
 
-       x = (screen->cur_X * TekScale(screen)) + screen->border;
 -       y = ((TEKHEIGHT + TEKTOPPAD - screen->cur_Y) * TekScale(screen)) +
 -           screen->border - tekWidget->tek.tobaseline[c];
 +       x = (int)((screen->cur_X * TekScale(screen)) + screen->border);
 +       y = (int)(((TEKHEIGHT + TEKTOPPAD - screen->cur_Y) * TekScale(screen))
 +           + screen->border - tekWidget->tek.tobaseline[c]);
  
        if (toggle == TOGGLE) {
           if (screen->select || screen->always_highlight) 
Index: VTPrsTbl.c
--- xterm-84+/VTPrsTbl.c        Sun Apr  5 23:48:23 1998
 +++ xterm-85/VTPrsTbl.c Sun Oct 11 17:27:18 1998
 @@ -30,7 +30,7 @@
  #include <xtermcfg.h>
 #endif
 
-#include "VTparse.h"
+#include <VTparse.h>
 
 #ifndef OPT_VT52_MODE
 #define OPT_VT52_MODE   1 /* true if xterm supports VT52 emulation */
Index: VTparse.h
--- xterm-84+/VTparse.h Wed Aug 13 09:29:16 1997
 +++ xterm-85/VTparse.h  Sun Oct 11 20:38:26 1998
 @@ -26,10 +26,15 @@
   * SOFTWARE.
  */
 
-#ifdef __STDC__
-#define Const const
-#else
-#define Const /**/
+#ifndef included_VTparse_h
+#define included_VTparse_h 1
+
 +#ifndef Const
+# if defined(__STDC__) && !defined(__cplusplus)
 +#  define Const const
+# else
 +#  define Const /**/
+# endif
  #endif
 
 /*
@@ -183,3 +188,5 @@
 #define CASE_DECSWL 111
 #define CASE_DECDWL 112
 #define CASE_DEC_MC 113
+
+#endif /* included_VTparse_h */
Index: aclocal.m4
 --- xterm-84+/aclocal.m4        Sun Aug 30 06:43:03 1998
 +++ xterm-85/aclocal.m4 Mon Oct 12 06:14:37 1998
 @@ -218,11 +218,10 @@
  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([
 +AC_CHECK_FUNC(memmove,,[
+AC_CHECK_FUNC(bcopy,[
+       AC_CACHE_CHECK(if bcopy does overlapping moves,cf_cv_good_bcopy,[
 +               AC_TRY_RUN([
  int main() {
        static char data[] = "abcdefghijklmnopqrstuwwxyz";
        char temp[40];
@@ -236,17 +235,13 @@
                [cf_cv_good_bcopy=no],
                [cf_cv_good_bcopy=unknown])
                ])
-               AC_MSG_RESULT($cf_cv_good_bcopy)
 -       else
-               cf_cv_good_bcopy=no
 -       fi
+       ],[cf_cv_good_bcopy=no])
         if test $cf_cv_good_bcopy = yes ; then
                AC_DEFINE(USE_OK_BCOPY)
        else
                AC_DEFINE(USE_MY_MEMMOVE)
        fi
-fi
-])dnl
+])])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
@@ -258,8 +253,9 @@
 cf_save_LIBS="$LIBS"
 cf_cv_lib_tgetent=no
 cf_TERMLIB="termcap termlib ncurses curses"
-for cf_termlib in $cf_TERMLIB ; do
 -       LIBS="$cf_save_LIBS -l$cf_termlib"
 +for cf_termlib in '' $cf_TERMLIB ; do
 +       LIBS="$cf_save_LIBS"
 +       test -n "$cf_termlib" && LIBS="$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
@@ -272,7 +268,11 @@
        tgetent(buffer, "vt100");
        exit(buffer[0] == 0); }],
        [echo "yes, there is a termcap/tgetent in $cf_termlib" 1>&AC_FD_CC
-        cf_cv_lib_tgetent="-l$cf_termlib"
 +        if test -n "$cf_termlib" ; then
 +               cf_cv_lib_tgetent="-l$cf_termlib"
 +        else
 +               cf_cv_lib_tgetent=yes
 +        fi
         break],
        [echo "no, there is no termcap/tgetent in $cf_termlib" 1>&AC_FD_CC],
        [echo "cross-compiling, cannot verify if a termcap/tgetent is present in $cf_termlib" 1>&AC_FD_CC])
@@ -284,8 +284,8 @@
 # (LIBS cannot be set inside AC_CACHE_CHECK; the commands there should
 # not have side effects other than setting the cache variable, because
 # they are not executed when a cached value exists.)
-if test $cf_cv_lib_tgetent != no ; then
 -       LIBS="$LIBS $cf_cv_lib_tgetent"
 +if test "$cf_cv_lib_tgetent" != no ; then
 +       test "$cf_cv_lib_tgetent" != yes && LIBS="$LIBS $cf_cv_lib_tgetent"
         AC_CHECK_HEADERS(termcap.h)
 else
         # If we didn't find a tgetent() that supports the buffer
@@ -305,7 +305,7 @@
        LIBS="$cf_save_LIBS"
        ])
 
-       if test $cf_cv_lib_part_tgetent != no ; then
 +       if test "$cf_cv_lib_part_tgetent" != no ; then
                 LIBS="$LIBS $cf_cv_lib_part_tgetent"
                AC_CHECK_HEADERS(termcap.h)
 
@@ -460,9 +460,10 @@
 # If it's installed properly, imake (or its wrapper, xmkmf) will point to the
 # config directory.
 if mkdir conftestdir; then
+       cf_makefile=`cd $srcdir;pwd`/Imakefile
         cd conftestdir
        echo >./Imakefile
-       test -f ../Imakefile && cat ../Imakefile >>./Imakefile
 +       test -f $cf_makefile && cat $cf_makefile >>./Imakefile
         cat >> ./Imakefile <<'CF_EOF'
 findstddefs:
        @echo 'IMAKE_CFLAGS="${ALLDEFINES} ifelse($1,,,$1)"'
Index: button.c
--- xterm-84+/button.c  Wed Sep 23 06:32:38 1998
 +++ xterm-85/button.c   Sun Oct 11 20:41:08 1998
 @@ -30,11 +30,7 @@
                                 J. Gettys.
 */
 
-#ifdef HAVE_CONFIG_H
-#include <xtermcfg.h>
-#endif
 -
-#include "ptyx.h"              /* Xlib headers included here. */
 +#include <xterm.h>
 
 #include <X11/Xatom.h>
 
@@ -47,12 +43,10 @@
 #include <X11/Xmu/Atoms.h>
 #include <X11/Xmu/StdSel.h>
 
-#include "data.h"
-#include "error.h"
-#include "menu.h"
-
-#include "xterm.h"
-#include "xcharmouse.h"
+#include <data.h>
+#include <error.h>
+#include <menu.h>
+#include <xcharmouse.h>
 
 #define KeyState(x) (((x) & (ShiftMask|ControlMask)) + (((x) & Mod1Mask) ? 2 : 0))
     /* adds together the bits:
@@ -412,7 +406,7 @@
        struct _SelectionList* list = (struct _SelectionList*)client_data;
        if (list != NULL) {
            _GetSelection(w, list->time, list->params, list->count);
-           XtFree(client_data);
 +           XtFree((char *)client_data);
         }
        return;
     }
@@ -433,8 +427,8 @@
     if (lag != end)
        v_write(pty, lag, end - lag);
 
-    XtFree(client_data);
-    XtFree(value);
 +    XtFree((char *)client_data);
 +    XtFree((char *)value);
 }
 
 
@@ -987,7 +981,7 @@
        register TScreen *screen = &term->screen;
        register Char *ptr;
        register int length;
-       register int class;
 +       register int cclass;
  
        if (Coordinate(startRow, startCol) <= Coordinate(endRow, endCol)) {
                startSRow = startRRow = startRow;
@@ -1019,7 +1013,7 @@
                        } else {
                                ptr = SCRN_BUF_CHARS(screen, startSRow+screen->topline)
                                 + startSCol;
-                               class = charClass[*ptr];
 +                               cclass = charClass[*ptr];
                                 do {
                                        --startSCol;
                                        --ptr;
@@ -1031,7 +1025,7 @@
                                                 + startSCol;
                                        }
                                } while (startSCol >= 0
-                                && charClass[*ptr] == class);
 +                                && charClass[*ptr] == cclass);
                                 ++startSCol;
                        }
                        if (endSCol > (LastTextCol(endSRow) + 1)) {
@@ -1041,7 +1035,7 @@
                                length = LastTextCol(endSRow);
                                ptr = SCRN_BUF_CHARS(screen, endSRow+screen->topline)
                                 + endSCol;
-                               class = charClass[*ptr];
 +                               cclass = charClass[*ptr];
                                 do {
                                        ++endSCol;
                                        ++ptr;
@@ -1054,7 +1048,7 @@
                                                 + endSCol;
                                        }
                                } while (endSCol <= length
-                                && charClass[*ptr] == class);
 +                                && charClass[*ptr] == cclass);
                                 /* Word select selects if pointing to any char
                                   in "word", especially in that it includes
                                   the last character in a word.  So no --endSCol
@@ -1225,7 +1219,7 @@
        /* now get some memory to save it in */
 
        if (screen->selection_size <= j) {
-           if((line = malloc((unsigned) j + 1)) == (char *)NULL)
 +           if((line = (char *)malloc((unsigned) j + 1)) == 0)
                 SysError(ERROR_BMALLOC2);
            XtFree(screen->selection);
            screen->selection = line;
Index: charproc.c
--- xterm-84+/charproc.c        Wed Oct  7 20:54:07 1998
 +++ xterm-85/charproc.c Sun Oct 11 20:58:52 1998
 @@ -54,11 +54,8 @@
  
 /* charproc.c */
 
-#ifdef HAVE_CONFIG_H
-#include <xtermcfg.h>
-#endif
 +#include <xterm.h>
 
-#include "ptyx.h"
 #include <X11/Xos.h>
 #include <X11/Xatom.h>
 #include <X11/Xutil.h>
@@ -84,13 +81,13 @@
 #define write(f,b,s) nbio_write(f,b,s)
 #endif
 
-#include "VTparse.h"
-#include "data.h"
-#include "error.h"
-#include "menu.h"
-#include "main.h"
-#include "xterm.h"
-#include "xcharmouse.h"
+#include <VTparse.h>
+#include <data.h>
+#include <error.h>
+#include <menu.h>
+#include <main.h>
+#include <fontutils.h>
+#include <xcharmouse.h>
  
 #ifndef NO_ACTIVE_ICON
 #include <X11/Shell.h>
@@ -115,7 +112,6 @@
 extern Widget toplevel;
 extern char *ProgramName;
 
-static int LoadNewFont (TScreen *screen, char *nfontname, char *bfontname, Bool doresize, int fontnum);
  static int in_put (void);
 static int set_character_class (char *s);
 static void FromAlternate (TScreen *screen);
@@ -131,9 +127,7 @@
 static void dpmodes (XtermWidget termw, void (*func)(unsigned *p, unsigned mask));
 static void restoremodes (XtermWidget termw);
 static void savemodes (XtermWidget termw);
-static void set_vt_box (TScreen *screen);
  static void unparseputn (unsigned int n, int fd);
-static void update_font_info (TScreen *screen, Bool doresize);
  static void window_ops (XtermWidget termw);
 
 #if OPT_BLINK_CURS
@@ -815,13 +809,13 @@
 #endif /* NO_ACTIVE_ICON */
 };
 
+static Boolean VTSetValues (Widget cur, Widget request, Widget new_arg, ArgList args, Cardinal *num_args);
  static void VTClassInit (void);
-static void VTInitialize (Widget wrequest, Widget wnew, ArgList args, Cardinal *num_args);
 -static void VTRealize (Widget w, XtValueMask *valuemask, XSetWindowAttributes *values);
 +static void VTDestroy (Widget w);
  static void VTExpose (Widget w, XEvent *event, Region region);
+static void VTInitialize (Widget wrequest, Widget new_arg, ArgList args, Cardinal *num_args);
 +static void VTRealize (Widget w, XtValueMask *valuemask, XSetWindowAttributes *values);
  static void VTResize (Widget w);
-static void VTDestroy (Widget w);
 -static Boolean VTSetValues (Widget cur, Widget request, Widget new, ArgList args, Cardinal *num_args);
  
 #if OPT_I18N_SUPPORT && OPT_INPUT_METHOD
 static void VTInitI18N (void);
@@ -2203,7 +2197,7 @@
                    /* still won't fit: get more space */
                    /* Don't use XtRealloc because an error is not fatal. */
                    int size = v_bufptr - v_buffer; /* save across realloc */
-                   v_buffer = realloc(v_buffer, size + len);
 +                   v_buffer = (char *)realloc(v_buffer, size + len);
                     if (v_buffer) {
 #ifdef DEBUG
                        if (debug)
@@ -2283,7 +2277,7 @@
            int size = v_bufptr - v_buffer;
            int allocsize = size ? size : 1;
 
-           v_buffer = realloc(v_buffer, allocsize);
 +           v_buffer = (char *)realloc(v_buffer, allocsize);
             if (v_buffer) {
                v_bufstr = v_buffer + start;
                v_bufptr = v_buffer + size;
@@ -2419,10 +2413,10 @@
                select_timeout.tv_usec = 0;
        else
                select_timeout.tv_usec = 50000;
-       i = select(max_plus1, &select_mask, &write_mask, NULL,
 +       i = select(max_plus1, &select_mask, &write_mask, 0,
                         (select_timeout.tv_usec == 0) || screen->awaitInput
                        ? &select_timeout
-                       : NULL);
 +                       : 0);
         if (i < 0) {
            if (errno != EINTR)
                SysError(ERROR_SELECT);
@@ -2642,7 +2636,7 @@
            icon_name = NULL;
            XtGetValues(toplevel,args,XtNumber(args));
            if( icon_name != NULL ) {
-               char    *buf = malloc(strlen(icon_name) + 1);
 +               char    *buf = (char *)malloc(strlen(icon_name) + 1);
                 if (buf == NULL) {
                        zIconBeep_flagged = True;
                        return;
@@ -3644,36 +3638,36 @@
 /* ARGSUSED */
 static void VTInitialize (
        Widget wrequest,
-       Widget wnew,
 +       Widget new_arg,
         ArgList args GCC_UNUSED,
        Cardinal *num_args GCC_UNUSED)
 {
    XtermWidget request = (XtermWidget) wrequest;
-   XtermWidget new     = (XtermWidget) wnew;
 +   XtermWidget wnew    = (XtermWidget) new_arg;
     int i;
 #if OPT_ISO_COLORS
    Boolean color_ok;
 #endif
 
-   /* Zero out the entire "screen" component of "new" widget, then do
 +   /* Zero out the entire "screen" component of "wnew" widget, then do
      * field-by-field assigment of "screen" fields that are named in the
     * resource list.
     */
-   bzero ((char *) &new->screen, sizeof(new->screen));
 +   bzero ((char *) &wnew->screen, sizeof(wnew->screen));
  
    /* dummy values so that we don't try to Realize the parent shell with height
     * or width of 0, which is illegal in X.  The real size is computed in the
     * xtermWidget's Realize proc, but the shell's Realize proc is called first,
     * and must see a valid size.
     */
-   new->core.height = new->core.width = 1;
 +   wnew->core.height = wnew->core.width = 1;
  
    /*
     * The definition of -rv now is that it changes the definition of
     * XtDefaultForeground and XtDefaultBackground.  So, we no longer
     * need to do anything special.
     */
-   new->screen.display = new->core.screen->display;
 +   wnew->screen.display = wnew->core.screen->display;
  
    /*
     * We use the default foreground/background colors to compare/check if a
@@ -3683,107 +3677,107 @@
 #define MyWhitePixel(dpy) WhitePixel(dpy,DefaultScreen(dpy))
 
    if (request->misc.re_verse) {
-       new->dft_foreground = MyWhitePixel(new->screen.display);
 -       new->dft_background = MyBlackPixel(new->screen.display);
 +       wnew->dft_foreground = MyWhitePixel(wnew->screen.display);
 +       wnew->dft_background = MyBlackPixel(wnew->screen.display);
     } else {
-       new->dft_foreground = MyBlackPixel(new->screen.display);
 -       new->dft_background = MyWhitePixel(new->screen.display);
 +       wnew->dft_foreground = MyBlackPixel(wnew->screen.display);
 +       wnew->dft_background = MyWhitePixel(wnew->screen.display);
     }
 
-   new->screen.mouse_button = -1;
 -   new->screen.mouse_row = -1;
 -   new->screen.mouse_col = -1;
 -
-   new->screen.c132 = request->screen.c132;
 -   new->screen.curses = request->screen.curses;
 -   new->screen.hp_ll_bc = request->screen.hp_ll_bc;
 +   wnew->screen.mouse_button = -1;
 +   wnew->screen.mouse_row = -1;
 +   wnew->screen.mouse_col = -1;
 +
+   wnew->screen.c132 = request->screen.c132;
 +   wnew->screen.curses = request->screen.curses;
 +   wnew->screen.hp_ll_bc = request->screen.hp_ll_bc;
  #if OPT_XMC_GLITCH
-   new->screen.xmc_glitch = request->screen.xmc_glitch;
 -   new->screen.xmc_attributes = request->screen.xmc_attributes;
 -   new->screen.xmc_inline = request->screen.xmc_inline;
 -   new->screen.move_sgr_ok = request->screen.move_sgr_ok;
 +   wnew->screen.xmc_glitch = request->screen.xmc_glitch;
 +   wnew->screen.xmc_attributes = request->screen.xmc_attributes;
 +   wnew->screen.xmc_inline = request->screen.xmc_inline;
 +   wnew->screen.move_sgr_ok = request->screen.move_sgr_ok;
  #endif
-   new->screen.foreground = request->screen.foreground;
 -   new->screen.cursorcolor = request->screen.cursorcolor;
 +   wnew->screen.foreground = request->screen.foreground;
 +   wnew->screen.cursorcolor = request->screen.cursorcolor;
  #if OPT_BLINK_CURS
-   new->screen.cursor_blink = request->screen.cursor_blink;
 +   wnew->screen.cursor_blink = request->screen.cursor_blink;
  #endif
-   new->screen.border = request->screen.border;
 -   new->screen.jumpscroll = request->screen.jumpscroll;
 -   new->screen.old_fkeys = request->screen.old_fkeys;
 +   wnew->screen.border = request->screen.border;
 +   wnew->screen.jumpscroll = request->screen.jumpscroll;
 +   wnew->screen.old_fkeys = request->screen.old_fkeys;
  #ifdef ALLOWLOGGING
-   new->screen.logfile = request->screen.logfile;
 +   wnew->screen.logfile = request->screen.logfile;
  #endif
-   new->screen.marginbell = request->screen.marginbell;
 -   new->screen.mousecolor = request->screen.mousecolor;
 -   new->screen.mousecolorback = request->screen.mousecolorback;
 -   new->screen.multiscroll = request->screen.multiscroll;
 -   new->screen.nmarginbell = request->screen.nmarginbell;
 -   new->screen.savelines = request->screen.savelines;
 -   new->screen.scrolllines = request->screen.scrolllines;
 -   new->screen.scrollttyoutput = request->screen.scrollttyoutput;
 -   new->screen.scrollkey = request->screen.scrollkey;
 -   new->screen.terminal_id = request->screen.terminal_id;
 -   if (new->screen.terminal_id < MIN_DECID)
 -       new->screen.terminal_id = MIN_DECID;
 -   if (new->screen.terminal_id > MAX_DECID)
 -       new->screen.terminal_id = MAX_DECID;
 -   new->screen.ansi_level = (new->screen.terminal_id / 100);
 -   new->screen.visualbell = request->screen.visualbell;
 +   wnew->screen.marginbell = request->screen.marginbell;
 +   wnew->screen.mousecolor = request->screen.mousecolor;
 +   wnew->screen.mousecolorback = request->screen.mousecolorback;
 +   wnew->screen.multiscroll = request->screen.multiscroll;
 +   wnew->screen.nmarginbell = request->screen.nmarginbell;
 +   wnew->screen.savelines = request->screen.savelines;
 +   wnew->screen.scrolllines = request->screen.scrolllines;
 +   wnew->screen.scrollttyoutput = request->screen.scrollttyoutput;
 +   wnew->screen.scrollkey = request->screen.scrollkey;
 +   wnew->screen.terminal_id = request->screen.terminal_id;
 +   if (wnew->screen.terminal_id < MIN_DECID)
 +       wnew->screen.terminal_id = MIN_DECID;
 +   if (wnew->screen.terminal_id > MAX_DECID)
 +       wnew->screen.terminal_id = MAX_DECID;
 +   wnew->screen.ansi_level = (wnew->screen.terminal_id / 100);
 +   wnew->screen.visualbell = request->screen.visualbell;
  #if OPT_TEK4014
-   new->screen.TekEmu = request->screen.TekEmu;
 +   wnew->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;
 -   new->screen.charClass = request->screen.charClass;
 -   new->screen.cutNewline = request->screen.cutNewline;
 -   new->screen.cutToBeginningOfLine = request->screen.cutToBeginningOfLine;
 -   new->screen.highlight_selection = request->screen.highlight_selection;
 -   new->screen.always_highlight = request->screen.always_highlight;
 -   new->screen.pointer_cursor = request->screen.pointer_cursor;
 -
-   new->screen.printer_command = request->screen.printer_command;
 -   new->screen.printer_autoclose = request->screen.printer_autoclose;
 -   new->screen.printer_extent = request->screen.printer_extent;
 -   new->screen.printer_formfeed = request->screen.printer_formfeed;
 -   new->screen.printer_controlmode = request->screen.printer_controlmode;
 +   wnew->misc.re_verse = request->misc.re_verse;
 +   wnew->screen.multiClickTime = request->screen.multiClickTime;
 +   wnew->screen.bellSuppressTime = request->screen.bellSuppressTime;
 +   wnew->screen.charClass = request->screen.charClass;
 +   wnew->screen.cutNewline = request->screen.cutNewline;
 +   wnew->screen.cutToBeginningOfLine = request->screen.cutToBeginningOfLine;
 +   wnew->screen.highlight_selection = request->screen.highlight_selection;
 +   wnew->screen.always_highlight = request->screen.always_highlight;
 +   wnew->screen.pointer_cursor = request->screen.pointer_cursor;
 +
+   wnew->screen.printer_command = request->screen.printer_command;
 +   wnew->screen.printer_autoclose = request->screen.printer_autoclose;
 +   wnew->screen.printer_extent = request->screen.printer_extent;
 +   wnew->screen.printer_formfeed = request->screen.printer_formfeed;
 +   wnew->screen.printer_controlmode = request->screen.printer_controlmode;
  #ifdef OPT_PRINT_COLORS
-   new->screen.print_attributes = request->screen.print_attributes;
 +   wnew->screen.print_attributes = request->screen.print_attributes;
  #endif
 
-   new->screen.input_eight_bits = request->screen.input_eight_bits;
 -   new->screen.output_eight_bits = request->screen.output_eight_bits;
 -   new->screen.control_eight_bits = request->screen.control_eight_bits;
 -   new->screen.backarrow_key = request->screen.backarrow_key;
 -   new->screen.allowSendEvents = request->screen.allowSendEvents;
 +   wnew->screen.input_eight_bits = request->screen.input_eight_bits;
 +   wnew->screen.output_eight_bits = request->screen.output_eight_bits;
 +   wnew->screen.control_eight_bits = request->screen.control_eight_bits;
 +   wnew->screen.backarrow_key = request->screen.backarrow_key;
 +   wnew->screen.allowSendEvents = request->screen.allowSendEvents;
  #ifndef NO_ACTIVE_ICON
-   new->screen.fnt_icon = request->screen.fnt_icon;
 +   wnew->screen.fnt_icon = request->screen.fnt_icon;
  #endif /* NO_ACTIVE_ICON */
-   new->misc.titeInhibit = request->misc.titeInhibit;
 -   new->misc.dynamicColors = request->misc.dynamicColors;
 +   wnew->misc.titeInhibit = request->misc.titeInhibit;
 +   wnew->misc.dynamicColors = request->misc.dynamicColors;
     for (i = fontMenu_font1; i <= fontMenu_lastBuiltin; i++) {
-       new->screen.menu_font_names[i] = request->screen.menu_font_names[i];
 +       wnew->screen.menu_font_names[i] = request->screen.menu_font_names[i];
     }
    /* set default in realize proc */
-   new->screen.menu_font_names[fontMenu_fontdefault] = NULL;
 -   new->screen.menu_font_names[fontMenu_fontescape] = NULL;
 -   new->screen.menu_font_names[fontMenu_fontsel] = NULL;
 -   new->screen.menu_font_number = fontMenu_fontdefault;
 +   wnew->screen.menu_font_names[fontMenu_fontdefault] = NULL;
 +   wnew->screen.menu_font_names[fontMenu_fontescape] = NULL;
 +   wnew->screen.menu_font_names[fontMenu_fontsel] = NULL;
 +   wnew->screen.menu_font_number = fontMenu_fontdefault;
  
 #if OPT_ISO_COLORS
-   new->screen.boldColors    = request->screen.boldColors;
 -   new->screen.colorAttrMode = request->screen.colorAttrMode;
 -   new->screen.colorBDMode   = request->screen.colorBDMode;
 -   new->screen.colorBLMode   = request->screen.colorBLMode;
 -   new->screen.colorMode     = request->screen.colorMode;
 -   new->screen.colorULMode   = request->screen.colorULMode;
 +   wnew->screen.boldColors    = request->screen.boldColors;
 +   wnew->screen.colorAttrMode = request->screen.colorAttrMode;
 +   wnew->screen.colorBDMode   = request->screen.colorBDMode;
 +   wnew->screen.colorBLMode   = request->screen.colorBLMode;
 +   wnew->screen.colorMode     = request->screen.colorMode;
 +   wnew->screen.colorULMode   = request->screen.colorULMode;
  
    for (i = 0, color_ok = False; i < MAXCOLORS; i++) {
-       new->screen.Acolors[i] = request->screen.Acolors[i];
 -       if (new->screen.Acolors[i] != new->dft_foreground
 -        && new->screen.Acolors[i] != request->screen.foreground
 -        && new->screen.Acolors[i] != request->core.background_pixel)
 +       wnew->screen.Acolors[i] = request->screen.Acolors[i];
 +       if (wnew->screen.Acolors[i] != wnew->dft_foreground
 +        && wnew->screen.Acolors[i] != request->screen.foreground
 +        && wnew->screen.Acolors[i] != request->core.background_pixel)
            color_ok = True;
    }
 
@@ -3793,41 +3787,41 @@
     * the resource lookup failed versus the user having misconfigured this).
     */
    if (!color_ok)
-       new->screen.colorMode = False;
 +       wnew->screen.colorMode = False;
  
-   new->num_ptrs = new->screen.colorMode ? 3 : 2;
 -   new->sgr_foreground = -1;
 +   wnew->num_ptrs = wnew->screen.colorMode ? 3 : 2;
 +   wnew->sgr_foreground = -1;
  #endif /* OPT_ISO_COLORS */
 
 #if OPT_HIGHLIGHT_COLOR
-   new->screen.highlightcolor = request->screen.highlightcolor;
 +   wnew->screen.highlightcolor = request->screen.highlightcolor;
  #endif
 
 #if OPT_DEC_CHRSET
-   new->num_ptrs = 5;
+   wnew->num_ptrs = 5;
  #endif
 
-   new->screen.underline = request->screen.underline;
 +   wnew->screen.underline = request->screen.underline;
  
-   new->cur_foreground = 0;
 -   new->cur_background = 0;
 +   wnew->cur_foreground = 0;
 +   wnew->cur_background = 0;
  
-   new->keyboard.flags = MODE_SRM;
 -   if (new->screen.backarrow_key)
 -          new->keyboard.flags |= MODE_DECBKM;
 +   wnew->keyboard.flags = MODE_SRM;
 +   if (wnew->screen.backarrow_key)
 +          wnew->keyboard.flags |= MODE_DECBKM;
  
    /* look for focus related events on the shell, because we need
     * to care about the shell's border being part of our focus.
     */
-   XtAddEventHandler(XtParent(new), EnterWindowMask, FALSE,
 +   XtAddEventHandler(XtParent(wnew), EnterWindowMask, FALSE,
                 HandleEnterWindow, (Opaque)NULL);
-   XtAddEventHandler(XtParent(new), LeaveWindowMask, FALSE,
 +   XtAddEventHandler(XtParent(wnew), LeaveWindowMask, FALSE,
                 HandleLeaveWindow, (Opaque)NULL);
-   XtAddEventHandler(XtParent(new), FocusChangeMask, FALSE,
 +   XtAddEventHandler(XtParent(wnew), FocusChangeMask, FALSE,
                 HandleFocusChange, (Opaque)NULL);
-   XtAddEventHandler((Widget)new, 0L, TRUE,
 +   XtAddEventHandler((Widget)wnew, 0L, TRUE,
                 VTNonMaskableEvent, (Opaque)NULL);
-   XtAddEventHandler((Widget)new, PropertyChangeMask, FALSE,
 +   XtAddEventHandler((Widget)wnew, PropertyChangeMask, FALSE,
                      HandleBellPropertyChange, (Opaque)NULL);
 
 #if OPT_ZICONBEEP
@@ -3835,32 +3829,32 @@
     * Put in a handler that will tell us when we get Map/Unmap events.
     */
    if ( zIconBeep )
-       XtAddEventHandler(XtParent(new), StructureNotifyMask, FALSE,
 +       XtAddEventHandler(XtParent(wnew), StructureNotifyMask, FALSE,
                          HandleMapUnmap, (Opaque)NULL);
 #endif /* OPT_ZICONBEEP */
 
-   new->screen.bellInProgress = FALSE;
 +   wnew->screen.bellInProgress = FALSE;
  
-   set_character_class (new->screen.charClass);
 +   set_character_class (wnew->screen.charClass);
  
    /* create it, but don't realize it */
-   ScrollBarOn (new, TRUE, FALSE);
 +   ScrollBarOn (wnew, TRUE, FALSE);
  
    /* make sure that the resize gravity acceptable */
-   if ( new->misc.resizeGravity != NorthWestGravity &&
 -        new->misc.resizeGravity != SouthWestGravity) {
 +   if ( wnew->misc.resizeGravity != NorthWestGravity &&
 +        wnew->misc.resizeGravity != SouthWestGravity) {
         Cardinal nparams = 1;
 
        XtAppWarningMsg(app_con, "rangeError", "resizeGravity", "XTermError",
                       "unsupported resizeGravity resource value (%d)",
-                      (String *) &(new->misc.resizeGravity), &nparams);
 -       new->misc.resizeGravity = SouthWestGravity;
 +                      (String *) &(wnew->misc.resizeGravity), &nparams);
 +       wnew->misc.resizeGravity = SouthWestGravity;
     }
 
 #ifndef NO_ACTIVE_ICON
-   new->screen.whichVwin = &new->screen.fullVwin;
 +   wnew->screen.whichVwin = &wnew->screen.fullVwin;
  #if OPT_TEK4014
-   new->screen.whichTwin = &new->screen.fullTwin;
 +   wnew->screen.whichTwin = &wnew->screen.fullTwin;
  #endif
 #endif /* NO_ACTIVE_ICON */
 
@@ -3889,12 +3883,12 @@
 
        screen->menu_font_names[fontMenu_fontdefault] = term->misc.f_n;
        screen->fnt_norm = screen->fnt_bold = NULL;
-       if (!LoadNewFont(screen, term->misc.f_n, term->misc.f_b, False, 0)) {
 +       if (!xtermLoadFont(screen, term->misc.f_n, term->misc.f_b, False, 0)) {
             if (XmuCompareISOLatin1(term->misc.f_n, "fixed") != 0) {
                fprintf (stderr,
                     "%s:  unable to open font \"%s\", trying \"fixed\"....\n",
                     xterm_name, term->misc.f_n);
-               (void) LoadNewFont (screen, "fixed", NULL, False, 0);
 +               (void) xtermLoadFont (screen, "fixed", NULL, False, 0);
                 screen->menu_font_names[fontMenu_fontdefault] = "fixed";
            }
        }
@@ -3925,7 +3919,7 @@
                             &width, &height);
        screen->max_col = (width - 1);  /* units in character cells */
        screen->max_row = (height - 1); /* units in character cells */
-       update_font_info (&term->screen, False);
 +       xtermUpdateFontInfo (&term->screen, False);
  
        width = screen->fullVwin.fullwidth;
        height = screen->fullVwin.fullheight;
@@ -4103,7 +4097,7 @@
 
        screen->do_wrap = 0;
        screen->scrolls = screen->incopy = 0;
-       set_vt_box (screen);
 +       xtermSetCursorBox (screen);
  
        screen->savedlines = 0;
 
@@ -4140,7 +4134,7 @@
     } else {
        s = term->misc.input_method;
        i = 5 + strlen(s);
-       t = MyStackAlloc(i, buf);
 +       t = (char *)MyStackAlloc(i, buf);
         if (t == NULL)
            SysError(ERROR_VINIT);
 
@@ -4247,12 +4241,12 @@
 static Boolean VTSetValues (
        Widget cur,
        Widget request GCC_UNUSED,
-       Widget new,
 +       Widget wnew,
         ArgList args GCC_UNUSED,
        Cardinal *num_args GCC_UNUSED)
 {
     XtermWidget curvt = (XtermWidget) cur;
-    XtermWidget newvt = (XtermWidget) new;
 +    XtermWidget newvt = (XtermWidget) wnew;
      Boolean refresh_needed = FALSE;
     Boolean fonts_redone = FALSE;
 
@@ -4263,7 +4257,7 @@
        || curvt->misc.f_n != newvt->misc.f_n) {
        if(curvt->misc.f_n != newvt->misc.f_n)
            newvt->screen.menu_font_names[fontMenu_fontdefault] = newvt->misc.f_n;
-       if (LoadNewFont(&newvt->screen,
 +       if (xtermLoadFont(&newvt->screen,
                         newvt->screen.menu_font_names[curvt->screen.menu_font_number],
                        newvt->screen.menu_font_names[curvt->screen.menu_font_number],
                        TRUE, newvt->screen.menu_font_number)) {
@@ -4790,8 +4784,8 @@
 
     len = strlen (params[0]) + 7;
 
-    pmapName  = MyStackAlloc(len, mapName);
 -    pmapClass = MyStackAlloc(len, mapClass);
 +    pmapName  = (char *)MyStackAlloc(len, mapName);
 +    pmapClass = (char *)MyStackAlloc(len, mapClass);
      if (pmapName == NULL
      || pmapClass == NULL)
        SysError(ERROR_KMMALLOC1);
@@ -4876,7 +4870,7 @@
           we are a little more liberal here. */
        if (len > 1000  ||  strchr(val, '\n'))
            return;
-       if (!LoadNewFont (&term->screen, val, NULL, True, fontMenu_fontsel))
 +       if (!xtermLoadFont (&term->screen, val, NULL, True, fontMenu_fontsel))
             Bell(XkbBI_MinorError,0);
     }
 }
@@ -4903,7 +4897,7 @@
     target = XmuInternAtom(XtDisplay(term), *pAtom);
     if (justprobe) {
        term->screen.menu_font_names[fontMenu_fontsel] =
-         XGetSelectionOwner(XtDisplay(term), target) ? _Font_Selected_ : NULL;
 +         XGetSelectionOwner(XtDisplay(term), target) ? _Font_Selected_ : 0;
      } else {
        XtGetSelectionValue((Widget)term, target, XA_STRING,
                            DoSetSelectedFont, NULL,
@@ -4987,196 +4981,10 @@
        return;
     }
     if (!name1) name1 = screen->menu_font_names[i];
-    if (!LoadNewFont(screen, name1, name2, doresize, i)) {
 +    if (!xtermLoadFont(screen, name1, name2, doresize, i)) {
         Bell(XkbBI_MinorError,0);
     }
     return;
-}
-
-static int
-LoadNewFont (
-       TScreen *screen,
 -       char *nfontname,
 -       char *bfontname,
 -       Bool doresize,
 -       int fontnum)
 -{
-    XFontStruct *nfs = NULL, *bfs = NULL;
 -    XGCValues xgcv;
-    unsigned long mask;
 -    GC new_normalGC = NULL, new_normalboldGC = NULL;
 -    GC new_reverseGC = NULL, new_reverseboldGC = NULL;
 -    Pixel new_normal, new_revers;
 -    char *tmpname = NULL;
 -    Boolean proportional = False;
 -
-    if (!nfontname) return 0;
 -
-    if (fontnum == fontMenu_fontescape &&
 -       nfontname != screen->menu_font_names[fontnum]) {
 -       tmpname = (char *) malloc (strlen(nfontname) + 1);
 -       if (!tmpname) return 0;
 -       strcpy (tmpname, nfontname);
 -    }
-
-    if (!(nfs = XLoadQueryFont (screen->display, nfontname))) goto bad;
 -    if (nfs->ascent + nfs->descent == 0  ||  nfs->max_bounds.width == 0)
 -       goto bad;               /* can't use a 0-sized font */
 -
-    if (!(bfontname &&
 -         (bfs = XLoadQueryFont (screen->display, bfontname))))
 -      bfs = nfs;
 -    else
-       if (bfs->ascent + bfs->descent == 0  ||  bfs->max_bounds.width == 0)
 -           goto bad;           /* can't use a 0-sized font */
 -
-    if (nfs->min_bounds.width != nfs->max_bounds.width
 -     || bfs->min_bounds.width != bfs->max_bounds.width
 -     || nfs->min_bounds.width != bfs->min_bounds.width
 -     || nfs->max_bounds.width != bfs->max_bounds.width) {
 -       TRACE(("Proportional font!\n"))
 -       proportional = True;
 -    }
-
-    mask = (GCFont | GCForeground | GCBackground | GCGraphicsExposures |
 -           GCFunction);
 -
-    new_normal = getXtermForeground(term->flags, term->cur_foreground);
 -    new_revers = getXtermBackground(term->flags, term->cur_background);
 -
-    xgcv.font = nfs->fid;
 -    xgcv.foreground = new_normal;
 -    xgcv.background = new_revers;
 -    xgcv.graphics_exposures = TRUE;    /* default */
 -    xgcv.function = GXcopy;
 -
-    new_normalGC = XtGetGC((Widget)term, mask, &xgcv);
 -    if (!new_normalGC) goto bad;
 -
-    if (nfs == bfs) {                  /* there is no bold font */
 -       new_normalboldGC = new_normalGC;
 -    } else {
-       xgcv.font = bfs->fid;
 -       new_normalboldGC = XtGetGC((Widget)term, mask, &xgcv);
 -       if (!new_normalboldGC) goto bad;
 -    }
-
-    xgcv.font = nfs->fid;
 -    xgcv.foreground = new_revers;
 -    xgcv.background = new_normal;
 -    new_reverseGC = XtGetGC((Widget)term, mask, &xgcv);
 -    if (!new_reverseGC) goto bad;
 -
-    if (nfs == bfs) {                  /* there is no bold font */
 -       new_reverseboldGC = new_reverseGC;
 -    } else {
-       xgcv.font = bfs->fid;
 -       new_reverseboldGC = XtGetGC((Widget)term, mask, &xgcv);
 -       if (!new_reverseboldGC) goto bad;
 -    }
-
-    if (NormalGC(screen) != NormalBoldGC(screen))
 -       XtReleaseGC ((Widget) term, NormalBoldGC(screen));
 -    XtReleaseGC ((Widget) term, NormalGC(screen));
 -    if (ReverseGC(screen) != ReverseBoldGC(screen))
 -       XtReleaseGC ((Widget) term, ReverseBoldGC(screen));
 -    XtReleaseGC ((Widget) term, ReverseGC(screen));
 -    NormalGC(screen) = new_normalGC;
 -    NormalBoldGC(screen) = new_normalboldGC;
 -    ReverseGC(screen) = new_reverseGC;
 -    ReverseBoldGC(screen) = new_reverseboldGC;
 -
-    /* If we're switching fonts, free the old ones.  Otherwise we'll leak the
 -     * memory that is associated with the old fonts. The XLoadQueryFont call
 -     * allocates a new XFontStruct.
 -     */
-    if (screen->fnt_bold != 0
 -     && screen->fnt_bold != screen->fnt_norm)
 -       XFreeFont(screen->display, screen->fnt_bold);
 -    if (screen->fnt_norm != 0)
 -       XFreeFont(screen->display, screen->fnt_norm);
 -
-    screen->fnt_norm = nfs;
 -    screen->fnt_bold = bfs;
 -    screen->fnt_prop = proportional;
 -
-    screen->enbolden = (nfs == bfs);
 -    set_menu_font (False);
-    screen->menu_font_number = fontnum;
 -    set_menu_font (True);
-    if (tmpname) {                     /* if setting escape or sel */
-       if (screen->menu_font_names[fontnum])
 -         free (screen->menu_font_names[fontnum]);
 -       screen->menu_font_names[fontnum] = tmpname;
 -       if (fontnum == fontMenu_fontescape) {
 -           set_sensitivity (term->screen.fontMenu,
 -                            fontMenuEntries[fontMenu_fontescape].widget,
 -                            TRUE);
 -       }
-    }
 -    set_cursor_gcs (screen);
 -    update_font_info (screen, doresize);
 -    return 1;
-
 -  bad:
-    if (tmpname) free (tmpname);
 -    if (new_normalGC)
-      XtReleaseGC ((Widget) term, screen->fullVwin.normalGC);
 -    if (new_normalGC && new_normalGC != new_normalboldGC)
 -      XtReleaseGC ((Widget) term, new_normalboldGC);
 -    if (new_reverseGC)
-      XtReleaseGC ((Widget) term, new_reverseGC);
 -    if (new_reverseGC && new_reverseGC != new_reverseboldGC)
 -      XtReleaseGC ((Widget) term, new_reverseboldGC);
 -    if (nfs) XFreeFont (screen->display, nfs);
 -    if (bfs && nfs != bfs) XFreeFont (screen->display, bfs);
 -    return 0;
-}
 -
-
-static void
-update_font_info (TScreen *screen, Bool doresize)
 -{
-    int i, j, width, height, scrollbar_width;
 -
-    screen->fullVwin.f_width = screen->fnt_norm->max_bounds.width;
 -    screen->fullVwin.f_height = (screen->fnt_norm->ascent +
 -                                screen->fnt_norm->descent);
 -    scrollbar_width = (term->misc.scrollbar ?
 -                      screen->scrollWidget->core.width +
 -                      screen->scrollWidget->core.border_width : 0);
 -    i = 2 * screen->border + scrollbar_width;
 -    j = 2 * screen->border;
 -    width = (screen->max_col + 1) * screen->fullVwin.f_width + i;
 -    height = (screen->max_row + 1) * screen->fullVwin.f_height + j;
 -    screen->fullVwin.fullwidth = width;
 -    screen->fullVwin.fullheight = height;
 -    screen->fullVwin.width = width - i;
 -    screen->fullVwin.height = height - j;
 -
-    if (doresize) {
-       if (VWindow(screen)) {
 -           XClearWindow (screen->display, VWindow(screen));
 -       }
-       DoResizeScreen (term);          /* set to the new natural size */
 -       if (screen->scrollWidget)
 -           ResizeScrollBar (screen);
 -       Redraw ();
 -    }
-    set_vt_box (screen);
-}
 -
-static void
-set_vt_box (TScreen *screen)
-{
 -       XPoint  *vp;
 -
-       vp = &VTbox[1];
 -       (vp++)->x = FontWidth(screen) - 1;
 -       (vp++)->y = FontHeight(screen) - 1;
 -       (vp++)->x = -(FontWidth(screen) - 1);
 -       vp->y = -(FontHeight(screen) - 1);
 -       screen->box = VTbox;
  }
 
 void
Index: charsets.c
--- xterm-84+/charsets.c        Sun Apr  5 23:48:23 1998
 +++ xterm-85/charsets.c Sun Oct 11 17:34:48 1998
 @@ -34,15 +34,8 @@
  
 ********************************************************/
 
-#ifdef HAVE_CONFIG_H
-#include <xtermcfg.h>
-#endif
 -
-#include <X11/Xos.h>
-
-#include "ptyx.h"
-#include "data.h"
-#include "xterm.h"
+#include <xterm.h>
+#include <data.h>
 
 /*
  * This module performs translation as needed to support the DEC VT220 national
Index: configure
--- xterm-84+/configure Sun Aug 30 06:43:03 1998
 +++ xterm-85/configure  Mon Oct 12 06:34:04 1998
 @@ -1344,19 +1344,108 @@
  done
 
 
-if test ".$ac_cv_func_memmove" != .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:1351: checking if bcopy does overlapping moves" >&5
 -               if eval "test \"`echo '$''{'cf_cv_good_bcopy'+set}'`\" = set"; then
 +echo $ac_n "checking for memmove""... $ac_c" 1>&6
 +echo "configure:1349: checking for memmove" >&5
 +if eval "test \"`echo '$''{'ac_cv_func_memmove'+set}'`\" = set"; then
    echo $ac_n "(cached) $ac_c" 1>&6
 else
+  cat > conftest.$ac_ext <<EOF
 +#line 1354 "configure"
+#include "confdefs.h"
 +/* System header to define __stub macros and hopefully few prototypes,
 +    which can conflict with char memmove(); below.  */
 +#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
 +/* We use char because int might match the return type of a gcc2
 +    builtin and then its argument prototype would still apply.  */
 +char memmove();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
 +    to always fail with ENOSYS.  Some functions are actually named
 +    something starting with __ and the normal name is an alias.  */
 +#if defined (__stub_memmove) || defined (__stub___memmove)
 +choke me
+#else
+memmove();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1377: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
 +  rm -rf conftest*
+  eval "ac_cv_func_memmove=yes"
 +else
+  echo "configure: failed program was:" >&5
 +  cat conftest.$ac_ext >&5
 +  rm -rf conftest*
+  eval "ac_cv_func_memmove=no"
 +fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'memmove`\" = yes"; then
 +  echo "$ac_t""yes" 1>&6
+  :
 +else
+  echo "$ac_t""no" 1>&6
+
 +echo $ac_n "checking for bcopy""... $ac_c" 1>&6
 +echo "configure:1396: checking for bcopy" >&5
 +if eval "test \"`echo '$''{'ac_cv_func_bcopy'+set}'`\" = set"; then
 +  echo $ac_n "(cached) $ac_c" 1>&6
 +else
+  cat > conftest.$ac_ext <<EOF
 +#line 1401 "configure"
+#include "confdefs.h"
 +/* System header to define __stub macros and hopefully few prototypes,
 +    which can conflict with char bcopy(); below.  */
 +#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
 +/* We use char because int might match the return type of a gcc2
 +    builtin and then its argument prototype would still apply.  */
 +char bcopy();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
 +    to always fail with ENOSYS.  Some functions are actually named
 +    something starting with __ and the normal name is an alias.  */
 +#if defined (__stub_bcopy) || defined (__stub___bcopy)
 +choke me
+#else
+bcopy();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1424: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
 +  rm -rf conftest*
+  eval "ac_cv_func_bcopy=yes"
 +else
+  echo "configure: failed program was:" >&5
 +  cat conftest.$ac_ext >&5
 +  rm -rf conftest*
+  eval "ac_cv_func_bcopy=no"
 +fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'bcopy`\" = yes"; then
 +  echo "$ac_t""yes" 1>&6
   
-                       if test "$cross_compiling" = yes; then
 +       echo $ac_n "checking if bcopy does overlapping moves""... $ac_c" 1>&6
 +echo "configure:1440: 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
+  
+               if test "$cross_compiling" = yes; then
    cf_cv_good_bcopy=unknown
 else
   cat > conftest.$ac_ext <<EOF
-#line 1360 "configure"
+#line 1449 "configure"
  #include "confdefs.h"
 
 int main() {
@@ -1369,7 +1458,7 @@
 }
                
 EOF
-if { (eval echo configure:1373: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 +if { (eval echo configure:1462: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
  then
   cf_cv_good_bcopy=yes
 else
@@ -1384,10 +1473,13 @@
                
 fi
 
-               echo "$ac_t""$cf_cv_good_bcopy" 1>&6
 -       else
-               cf_cv_good_bcopy=no
 -       fi
+echo "$ac_t""$cf_cv_good_bcopy" 1>&6
 +       
+else
 +  echo "$ac_t""no" 1>&6
+cf_cv_good_bcopy=no
 +fi
+
        if test $cf_cv_good_bcopy = yes ; then
                cat >> confdefs.h <<\EOF
 #define USE_OK_BCOPY 1
@@ -1399,11 +1491,12 @@
 EOF
 
        fi
+
 fi
 
 
 echo $ac_n "checking for full tgetent function""... $ac_c" 1>&6
-echo "configure:1407: checking for full tgetent function" >&5
 +echo "configure:1500: checking for full tgetent function" >&5
  if eval "test \"`echo '$''{'cf_cv_lib_tgetent'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1411,13 +1504,14 @@
 cf_save_LIBS="$LIBS"
 cf_cv_lib_tgetent=no
 cf_TERMLIB="termcap termlib ncurses curses"
-for cf_termlib in $cf_TERMLIB ; do
 -       LIBS="$cf_save_LIBS -l$cf_termlib"
 +for cf_termlib in '' $cf_TERMLIB ; do
 +       LIBS="$cf_save_LIBS"
 +       test -n "$cf_termlib" && LIBS="$LIBS -l$cf_termlib"
         if test "$cross_compiling" = yes; then
   echo "cross-compiling, cannot verify if a termcap/tgetent is present in $cf_termlib" 1>&5
 else
   cat > conftest.$ac_ext <<EOF
-#line 1421 "configure"
+#line 1515 "configure"
  #include "confdefs.h"
 
 /* terminfo implementations ignore the buffer argument, making it useless for
@@ -1431,10 +1525,14 @@
        tgetent(buffer, "vt100");
        exit(buffer[0] == 0); }
 EOF
-if { (eval echo configure:1435: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 +if { (eval echo configure:1529: \"$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 in $cf_termlib" 1>&5
-        cf_cv_lib_tgetent="-l$cf_termlib"
 +        if test -n "$cf_termlib" ; then
 +               cf_cv_lib_tgetent="-l$cf_termlib"
 +        else
 +               cf_cv_lib_tgetent=yes
 +        fi
         break
 else
   echo "configure: failed program was:" >&5
@@ -1456,23 +1554,23 @@
 # (LIBS cannot be set inside AC_CACHE_CHECK; the commands there should
 # not have side effects other than setting the cache variable, because
 # they are not executed when a cached value exists.)
-if test $cf_cv_lib_tgetent != no ; then
 -       LIBS="$LIBS $cf_cv_lib_tgetent"
 +if test "$cf_cv_lib_tgetent" != no ; then
 +       test "$cf_cv_lib_tgetent" != yes && LIBS="$LIBS $cf_cv_lib_tgetent"
         for ac_hdr in termcap.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1466: checking for $ac_hdr" >&5
 +echo "configure:1564: 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 1471 "configure"
+#line 1569 "configure"
  #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1476: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 +{ (eval echo configure:1574: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1505,7 +1603,7 @@
         # validate values for the TERM environment variable given to
         # child processes.
        echo $ac_n "checking for partial tgetent function""... $ac_c" 1>&6
-echo "configure:1509: checking for partial tgetent function" >&5
 +echo "configure:1607: checking for partial tgetent function" >&5
  if eval "test \"`echo '$''{'cf_cv_lib_part_tgetent'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1514,14 +1612,14 @@
        for cf_termlib in $cf_TERMLIB ; do
                LIBS="$cf_save_LIBS -l$cf_termlib"
                cat > conftest.$ac_ext <<EOF
-#line 1518 "configure"
+#line 1616 "configure"
  #include "confdefs.h"
 
 int main() {
 tgetent(0, 0)
 ; return 0; }
 EOF
-if { (eval echo configure:1525: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
 +if { (eval echo configure:1623: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
   echo "there is a terminfo/tgetent in $cf_termlib" 1>&5
                         cf_cv_lib_part_tgetent="-l$cf_termlib"
@@ -1538,23 +1636,23 @@
 
 echo "$ac_t""$cf_cv_lib_part_tgetent" 1>&6
 
-       if test $cf_cv_lib_part_tgetent != no ; then
 +       if test "$cf_cv_lib_part_tgetent" != no ; then
                 LIBS="$LIBS $cf_cv_lib_part_tgetent"
                for ac_hdr in termcap.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1548: checking for $ac_hdr" >&5
 +echo "configure:1646: 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 1553 "configure"
+#line 1651 "configure"
  #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1558: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 +{ (eval echo configure:1656: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1594,13 +1692,13 @@
 ###    checks for structures
 
 echo $ac_n "checking for declaration of fd_set""... $ac_c" 1>&6
-echo "configure:1598: checking for declaration of fd_set" >&5
 +echo "configure:1696: 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 1604 "configure"
+#line 1702 "configure"
  #include "confdefs.h"
 
 #include <sys/types.h>
@@ -1608,7 +1706,7 @@
 fd_set x
 ; return 0; }
 EOF
-if { (eval echo configure:1612: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
 +if { (eval echo configure:1710: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
   cf_cv_type_fd_set=sys/types.h
 else
@@ -1616,7 +1714,7 @@
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   cat > conftest.$ac_ext <<EOF
-#line 1620 "configure"
+#line 1718 "configure"
  #include "confdefs.h"
 
 #include <sys/types.h>
@@ -1625,7 +1723,7 @@
 fd_set x
 ; return 0; }
 EOF
-if { (eval echo configure:1629: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
 +if { (eval echo configure:1727: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
   cf_cv_type_fd_set=sys/select.h
 else
@@ -1652,13 +1750,13 @@
 
 
 echo $ac_n "checking declaration of errno""... $ac_c" 1>&6
-echo "configure:1656: checking declaration of errno" >&5
 +echo "configure:1754: checking declaration of errno" >&5
  if eval "test \"`echo '$''{'cf_cv_dcl_errno'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
     cat > conftest.$ac_ext <<EOF
-#line 1662 "configure"
+#line 1760 "configure"
  #include "confdefs.h"
 
 #if HAVE_STDLIB_H
@@ -1671,7 +1769,7 @@
 long x = (long) errno
 ; return 0; }
 EOF
-if { (eval echo configure:1675: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
 +if { (eval echo configure:1773: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
   eval 'cf_cv_dcl_'errno'=yes'
 else
@@ -1701,9 +1799,9 @@
 EOF
 
     echo $ac_n "checking existence of errno""... $ac_c" 1>&6
-echo "configure:1705: checking existence of errno" >&5
 +echo "configure:1803: checking existence of errno" >&5
          cat > conftest.$ac_ext <<EOF
-#line 1707 "configure"
+#line 1805 "configure"
  #include "confdefs.h"
 
 #undef errno
@@ -1713,7 +1811,7 @@
 errno = 2
 ; return 0; }
 EOF
-if { (eval echo configure:1717: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
 +if { (eval echo configure:1815: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
   eval 'cf_cv_have_'errno'=yes'
 else
@@ -1744,12 +1842,12 @@
 
 ###    checks for compiler characteristics
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:1748: checking for working const" >&5
 +echo "configure:1846: 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 1753 "configure"
+#line 1851 "configure"
  #include "confdefs.h"
 
 int main() {
@@ -1798,7 +1896,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:1802: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
 +if { (eval echo configure:1900: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -1820,7 +1918,7 @@
 
 
 echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6
-echo "configure:1824: checking for ${CC-cc} option to accept ANSI C" >&5
 +echo "configure:1922: 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
@@ -1844,7 +1942,7 @@
 do
        CFLAGS="$cf_save_CFLAGS $cf_arg"
        cat > conftest.$ac_ext <<EOF
-#line 1848 "configure"
+#line 1946 "configure"
  #include "confdefs.h"
 
 #ifndef CC_HAS_PROTOS
@@ -1860,7 +1958,7 @@
        struct s2 {int (*f) (double a);};
 ; return 0; }
 EOF
-if { (eval echo configure:1864: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
 +if { (eval echo configure:1962: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
   cf_cv_ansi_cc="$cf_arg"; break
 else
@@ -1890,12 +1988,12 @@
 ###    checks for system services and user specified options
 
 echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:1894: checking for sys/wait.h that is POSIX.1 compatible" >&5
 +echo "configure:1992: checking for sys/wait.h that is POSIX.1 compatible" >&5
  if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1899 "configure"
+#line 1997 "configure"
  #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/wait.h>
@@ -1911,7 +2009,7 @@
 s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
 ; return 0; }
 EOF
-if { (eval echo configure:1915: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
 +if { (eval echo configure:2013: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
   ac_cv_header_sys_wait_h=yes
 else
@@ -1937,7 +2035,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:1941: checking for X" >&5
 +echo "configure:2039: checking for X" >&5
  
 
 # Check whether --with-x or --without-x was given.
@@ -2000,12 +2098,12 @@
 
   # First, try using that file with no special directory specified.
 cat > conftest.$ac_ext <<EOF
-#line 2004 "configure"
+#line 2102 "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:2009: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 +{ (eval echo configure:2107: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2074,14 +2172,14 @@
   ac_save_LIBS="$LIBS"
   LIBS="-l$x_direct_test_library $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2078 "configure"
+#line 2176 "configure"
  #include "confdefs.h"
 
 int main() {
 ${x_direct_test_function}()
 ; return 0; }
 EOF
-if { (eval echo configure:2085: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
 +if { (eval echo configure:2183: \"$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.
@@ -2181,7 +2279,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:2185: checking for open in -lc_s" >&5
 +echo "configure:2283: 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
@@ -2189,7 +2287,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lc_s  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2193 "configure"
+#line 2291 "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
@@ -2200,7 +2298,7 @@
 open()
 ; return 0; }
 EOF
-if { (eval echo configure:2204: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
 +if { (eval echo configure:2302: \"$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
@@ -2217,7 +2315,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:2221: checking for gethostname in -lbsd" >&5
 +echo "configure:2319: 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
@@ -2225,7 +2323,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lbsd  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2229 "configure"
+#line 2327 "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
@@ -2236,7 +2334,7 @@
 gethostname()
 ; return 0; }
 EOF
-if { (eval echo configure:2240: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
 +if { (eval echo configure:2338: \"$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
@@ -2253,7 +2351,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:2257: checking for gethostname in -lnsl_s" >&5
 +echo "configure:2355: 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
@@ -2261,7 +2359,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl_s  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2265 "configure"
+#line 2363 "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
@@ -2272,7 +2370,7 @@
 gethostname()
 ; return 0; }
 EOF
-if { (eval echo configure:2276: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
 +if { (eval echo configure:2374: \"$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
@@ -2289,7 +2387,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:2293: checking for XOpenDisplay in -lX11_s" >&5
 +echo "configure:2391: 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
@@ -2297,7 +2395,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lX11_s  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2301 "configure"
+#line 2399 "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
@@ -2308,7 +2406,7 @@
 XOpenDisplay()
 ; return 0; }
 EOF
-if { (eval echo configure:2312: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
 +if { (eval echo configure:2410: \"$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
@@ -2325,7 +2423,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:2329: checking for XtAppInitialize in -lXt_s" >&5
 +echo "configure:2427: 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
@@ -2333,7 +2431,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lXt_s  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2337 "configure"
+#line 2435 "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 +2442,7 @@
 XtAppInitialize()
 ; 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:2446: \"$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
@@ -2385,7 +2483,7 @@
        ;;
 *)
        echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
-echo "configure:2389: checking for socket in -lsocket" >&5
 +echo "configure:2487: 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
@@ -2393,7 +2491,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2397 "configure"
+#line 2495 "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
@@ -2404,7 +2502,7 @@
 socket()
 ; return 0; }
 EOF
-if { (eval echo configure:2408: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
 +if { (eval echo configure:2506: \"$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
@@ -2432,7 +2530,7 @@
 fi
 
        echo $ac_n "checking for gethostname in -lnsl""... $ac_c" 1>&6
-echo "configure:2436: checking for gethostname in -lnsl" >&5
 +echo "configure:2534: 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
@@ -2440,7 +2538,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2444 "configure"
+#line 2542 "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
@@ -2451,7 +2549,7 @@
 gethostname()
 ; return 0; }
 EOF
-if { (eval echo configure:2455: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
 +if { (eval echo configure:2553: \"$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
@@ -2502,17 +2600,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:2506: checking whether -R must be followed by a space" >&5
 +echo "configure:2604: 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 2509 "configure"
+#line 2607 "configure"
  #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2516: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
 +if { (eval echo configure:2614: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
   ac_R_nospace=yes
 else
@@ -2528,14 +2626,14 @@
       else
        LIBS="$ac_xsave_LIBS -R $x_libraries"
        cat > conftest.$ac_ext <<EOF
-#line 2532 "configure"
+#line 2630 "configure"
  #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2539: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
 +if { (eval echo configure:2637: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
   ac_R_space=yes
 else
@@ -2567,7 +2665,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:2571: checking for dnet_ntoa in -ldnet" >&5
 +echo "configure:2669: 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
@@ -2575,7 +2673,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ldnet  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2579 "configure"
+#line 2677 "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
@@ -2586,7 +2684,7 @@
 dnet_ntoa()
 ; return 0; }
 EOF
-if { (eval echo configure:2590: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
 +if { (eval echo configure:2688: \"$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
@@ -2608,7 +2706,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:2612: checking for dnet_ntoa in -ldnet_stub" >&5
 +echo "configure:2710: 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
@@ -2616,7 +2714,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ldnet_stub  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2620 "configure"
+#line 2718 "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
@@ -2627,7 +2725,7 @@
 dnet_ntoa()
 ; return 0; }
 EOF
-if { (eval echo configure:2631: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
 +if { (eval echo configure:2729: \"$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
@@ -2656,12 +2754,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:2660: checking for gethostbyname" >&5
 +echo "configure:2758: 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 2665 "configure"
+#line 2763 "configure"
  #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gethostbyname(); below.  */
@@ -2684,7 +2782,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2688: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
 +if { (eval echo configure:2786: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
   eval "ac_cv_func_gethostbyname=yes"
 else
@@ -2705,7 +2803,7 @@
 
     if test $ac_cv_func_gethostbyname = no; then
       echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:2709: checking for gethostbyname in -lnsl" >&5
 +echo "configure:2807: 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
@@ -2713,7 +2811,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2717 "configure"
+#line 2815 "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
@@ -2724,7 +2822,7 @@
 gethostbyname()
 ; 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:2826: \"$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
@@ -2754,12 +2852,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:2758: checking for connect" >&5
 +echo "configure:2856: 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 2763 "configure"
+#line 2861 "configure"
  #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char connect(); below.  */
@@ -2782,7 +2880,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2786: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
 +if { (eval echo configure:2884: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
   eval "ac_cv_func_connect=yes"
 else
@@ -2803,7 +2901,7 @@
 
     if test $ac_cv_func_connect = no; then
       echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
-echo "configure:2807: checking for connect in -lsocket" >&5
 +echo "configure:2905: 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
@@ -2811,7 +2909,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2815 "configure"
+#line 2913 "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
@@ -2822,7 +2920,7 @@
 connect()
 ; return 0; }
 EOF
-if { (eval echo configure:2826: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
 +if { (eval echo configure:2924: \"$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
@@ -2846,12 +2944,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:2850: checking for remove" >&5
 +echo "configure:2948: 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 2855 "configure"
+#line 2953 "configure"
  #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char remove(); below.  */
@@ -2874,7 +2972,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2878: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
 +if { (eval echo configure:2976: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
   eval "ac_cv_func_remove=yes"
 else
@@ -2895,7 +2993,7 @@
 
     if test $ac_cv_func_remove = no; then
       echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6
-echo "configure:2899: checking for remove in -lposix" >&5
 +echo "configure:2997: 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
@@ -2903,7 +3001,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lposix  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2907 "configure"
+#line 3005 "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
@@ -2914,7 +3012,7 @@
 remove()
 ; return 0; }
 EOF
-if { (eval echo configure:2918: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
 +if { (eval echo configure:3016: \"$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
@@ -2938,12 +3036,12 @@
 
     # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
     echo $ac_n "checking for shmat""... $ac_c" 1>&6
-echo "configure:2942: checking for shmat" >&5
 +echo "configure:3040: 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 2947 "configure"
+#line 3045 "configure"
  #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char shmat(); below.  */
@@ -2966,7 +3064,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2970: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
 +if { (eval echo configure:3068: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
   eval "ac_cv_func_shmat=yes"
 else
@@ -2987,7 +3085,7 @@
 
     if test $ac_cv_func_shmat = no; then
       echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6
-echo "configure:2991: checking for shmat in -lipc" >&5
 +echo "configure:3089: 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
@@ -2995,7 +3093,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lipc  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2999 "configure"
+#line 3097 "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
@@ -3006,7 +3104,7 @@
 shmat()
 ; return 0; }
 EOF
-if { (eval echo configure:3010: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
 +if { (eval echo configure:3108: \"$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
@@ -3039,7 +3137,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:3043: checking for IceConnectionNumber in -lICE" >&5
 +echo "configure:3141: 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
@@ -3047,7 +3145,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lICE  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3051 "configure"
+#line 3149 "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
@@ -3058,7 +3156,7 @@
 IceConnectionNumber()
 ; return 0; }
 EOF
-if { (eval echo configure:3062: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
 +if { (eval echo configure:3160: \"$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
@@ -3085,7 +3183,7 @@
        LDFLAGS="$LDFLAGS $X_LIBS"
        CFLAGS="$CFLAGS $X_CFLAGS"
        echo $ac_n "checking for XOpenDisplay in -lX11""... $ac_c" 1>&6
-echo "configure:3089: checking for XOpenDisplay in -lX11" >&5
 +echo "configure:3187: 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
@@ -3093,7 +3191,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lX11 $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3097 "configure"
+#line 3195 "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
@@ -3104,7 +3202,7 @@
 XOpenDisplay()
 ; return 0; }
 EOF
-if { (eval echo configure:3108: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
 +if { (eval echo configure:3206: \"$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
@@ -3125,7 +3223,7 @@
 fi
 
        echo $ac_n "checking for XtAppInitialize in -lXt""... $ac_c" 1>&6
-echo "configure:3129: checking for XtAppInitialize in -lXt" >&5
 +echo "configure:3227: 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
@@ -3133,7 +3231,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3137 "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
@@ -3144,7 +3242,7 @@
 XtAppInitialize()
 ; return 0; }
 EOF
-if { (eval echo configure:3148: \"$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
@@ -3200,17 +3298,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3204: checking for $ac_hdr" >&5
 +echo "configure:3302: 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 3209 "configure"
+#line 3307 "configure"
  #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3214: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 +{ (eval echo configure:3312: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3260,17 +3358,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3264: checking for $ac_hdr" >&5
 +echo "configure:3362: 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 3269 "configure"
+#line 3367 "configure"
  #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3274: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 +{ (eval echo configure:3372: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3298,7 +3396,7 @@
 
 
 echo $ac_n "checking for XmuClientWindow in -lXmu""... $ac_c" 1>&6
-echo "configure:3302: checking for XmuClientWindow in -lXmu" >&5
 +echo "configure:3400: 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
@@ -3306,7 +3404,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lXmu  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3310 "configure"
+#line 3408 "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
@@ -3317,7 +3415,7 @@
 XmuClientWindow()
 ; return 0; }
 EOF
-if { (eval echo configure:3321: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
 +if { (eval echo configure:3419: \"$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
@@ -3344,7 +3442,7 @@
   echo "$ac_t""no" 1>&6
 
 echo $ac_n "checking for XmuClientWindow in -lXmu_s""... $ac_c" 1>&6
-echo "configure:3348: checking for XmuClientWindow in -lXmu_s" >&5
 +echo "configure:3446: 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
@@ -3352,7 +3450,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lXmu_s  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3356 "configure"
+#line 3454 "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
@@ -3363,7 +3461,7 @@
 XmuClientWindow()
 ; return 0; }
 EOF
-if { (eval echo configure:3367: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
 +if { (eval echo configure:3465: \"$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
@@ -3394,7 +3492,7 @@
 
 
 echo $ac_n "checking for XextCreateExtension in -lXext""... $ac_c" 1>&6
-echo "configure:3398: checking for XextCreateExtension in -lXext" >&5
 +echo "configure:3496: 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
@@ -3402,7 +3500,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lXext  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3406 "configure"
+#line 3504 "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
@@ -3413,7 +3511,7 @@
 XextCreateExtension()
 ; return 0; }
 EOF
-if { (eval echo configure:3417: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
 +if { (eval echo configure:3515: \"$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
@@ -3435,7 +3533,7 @@
 
 
 echo $ac_n "checking for XawSimpleMenuAddGlobalActions in -l$cf_x_athena""... $ac_c" 1>&6
-echo "configure:3439: checking for XawSimpleMenuAddGlobalActions in -l$cf_x_athena" >&5
 +echo "configure:3537: 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
@@ -3443,7 +3541,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-l$cf_x_athena  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3447 "configure"
+#line 3545 "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
@@ -3454,7 +3552,7 @@
 XawSimpleMenuAddGlobalActions()
 ; return 0; }
 EOF
-if { (eval echo configure:3458: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
 +if { (eval echo configure:3556: \"$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
@@ -3474,7 +3572,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:3478: checking for XawSimpleMenuAddGlobalActions in -l${cf_x_athena}_s" >&5
 +echo "configure:3576: 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
@@ -3482,7 +3580,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 3486 "configure"
+#line 3584 "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
@@ -3493,7 +3591,7 @@
 XawSimpleMenuAddGlobalActions()
 ; return 0; }
 EOF
-if { (eval echo configure:3497: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
 +if { (eval echo configure:3595: \"$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
@@ -3533,7 +3631,7 @@
 # Extract the first word of "xterm", so it can be a program name with args.
 set dummy xterm; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3537: checking for $ac_word" >&5
 +echo "configure:3635: checking for $ac_word" >&5
  if eval "test \"`echo '$''{'ac_cv_path_XTERM_PATH'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3562,8 +3660,8 @@
 fi
 
 XTERM_MODE=755
-echo $ac_n "checking for existing installation-mode""... $ac_c" 1>&6
 -echo "configure:3567: checking for existing installation-mode" >&5
 +echo $ac_n "checking for presumed installation-mode""... $ac_c" 1>&6
 +echo "configure:3665: checking for presumed installation-mode" >&5
  if test -f "$XTERM_PATH" ; then
        ls -l $XTERM_PATH >conftest.out
        read cf_mode cf_rest <conftest.out
@@ -3582,12 +3680,12 @@
        
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3586: checking for $ac_func" >&5
 +echo "configure:3684: 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 3591 "configure"
+#line 3689 "configure"
  #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3610,7 +3708,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:3614: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
 +if { (eval echo configure:3712: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
    rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -3636,7 +3734,7 @@
 
 
 echo $ac_n "checking if we should use imake to help""... $ac_c" 1>&6
-echo "configure:3640: checking if we should use imake to help" >&5
 +echo "configure:3738: 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
@@ -3661,7 +3759,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:3665: checking for $ac_word" >&5
 +echo "configure:3763: 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
@@ -3704,9 +3802,10 @@
 # If it's installed properly, imake (or its wrapper, xmkmf) will point to the
 # config directory.
 if mkdir conftestdir; then
+       cf_makefile=`cd $srcdir;pwd`/Imakefile
         cd conftestdir
        echo >./Imakefile
-       test -f ../Imakefile && cat ../Imakefile >>./Imakefile
 +       test -f $cf_makefile && cat $cf_makefile >>./Imakefile
         cat >> ./Imakefile <<'CF_EOF'
 findstddefs:
        @echo 'IMAKE_CFLAGS="${ALLDEFINES} $(MAIN_DEFINES)"'
@@ -3795,7 +3894,7 @@
 
 
 echo $ac_n "checking for default terminal-id""... $ac_c" 1>&6
-echo "configure:3799: checking for default terminal-id" >&5
 +echo "configure:3898: 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
@@ -3816,7 +3915,7 @@
 
 
 echo $ac_n "checking for default terminal-type""... $ac_c" 1>&6
-echo "configure:3820: checking for default terminal-type" >&5
 +echo "configure:3919: 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
@@ -3833,7 +3932,7 @@
 
 
 echo $ac_n "checking for private terminfo-directory""... $ac_c" 1>&6
-echo "configure:3837: checking for private terminfo-directory" >&5
 +echo "configure:3936: checking for private terminfo-directory" >&5
  
 # Check whether --with-own-terminfo or --without-own-terminfo was given.
 if test "${with_own_terminfo+set}" = set; then
@@ -3858,7 +3957,7 @@
 
 ###    checks for optional features
 echo $ac_n "checking if you want active-icons""... $ac_c" 1>&6
-echo "configure:3862: checking if you want active-icons" >&5
 +echo "configure:3961: 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
@@ -3884,7 +3983,7 @@
 fi
 
 echo $ac_n "checking if you want ANSI color""... $ac_c" 1>&6
-echo "configure:3888: checking if you want ANSI color" >&5
 +echo "configure:3987: 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
@@ -3908,7 +4007,7 @@
 
 
 echo $ac_n "checking if you want 16 colors like aixterm""... $ac_c" 1>&6
-echo "configure:3912: checking if you want 16 colors like aixterm" >&5
 +echo "configure:4011: 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
@@ -3932,7 +4031,7 @@
 
 
 echo $ac_n "checking if you want bold colors mapped like IBM PC""... $ac_c" 1>&6
-echo "configure:3936: checking if you want bold colors mapped like IBM PC" >&5
 +echo "configure:4035: 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
@@ -3956,7 +4055,7 @@
 
 
 echo $ac_n "checking if you want color-mode enabled by default""... $ac_c" 1>&6
-echo "configure:3960: checking if you want color-mode enabled by default" >&5
 +echo "configure:4059: 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
@@ -3980,7 +4079,7 @@
 
 
 echo $ac_n "checking if you want support for color highlighting""... $ac_c" 1>&6
-echo "configure:3984: checking if you want support for color highlighting" >&5
 +echo "configure:4083: checking if you want support for color highlighting" >&5
  
 # Check whether --enable-highlighting or --disable-highlighting was given.
 if test "${enable_highlighting+set}" = set; then
@@ -4004,7 +4103,7 @@
 
 
 echo $ac_n "checking if you want support for doublesize characters""... $ac_c" 1>&6
-echo "configure:4008: checking if you want support for doublesize characters" >&5
 +echo "configure:4107: checking if you want support for doublesize characters" >&5
  
 # Check whether --enable-doublechars or --disable-doublechars was given.
 if test "${enable_doublechars+set}" = set; then
@@ -4028,7 +4127,7 @@
 
 
 echo $ac_n "checking if you want support for input-method""... $ac_c" 1>&6
-echo "configure:4032: checking if you want support for input-method" >&5
 +echo "configure:4131: 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
@@ -4054,7 +4153,7 @@
 fi
 
 echo $ac_n "checking if you want support for internationalization""... $ac_c" 1>&6
-echo "configure:4058: checking if you want support for internationalization" >&5
 +echo "configure:4157: checking if you want support for internationalization" >&5
  
 # Check whether --enable-i18n or --disable-i18n was given.
 if test "${enable_i18n+set}" = set; then
@@ -4080,7 +4179,7 @@
 fi
 
 echo $ac_n "checking if you want support for logging""... $ac_c" 1>&6
-echo "configure:4084: checking if you want support for logging" >&5
 +echo "configure:4183: checking if you want support for logging" >&5
  
 # Check whether --enable-logging or --disable-logging was given.
 if test "${enable_logging+set}" = set; then
@@ -4104,7 +4203,7 @@
 EOF
 
        echo $ac_n "checking if you want to allow logging via a pipe""... $ac_c" 1>&6
-echo "configure:4108: checking if you want to allow logging via a pipe" >&5
 +echo "configure:4207: checking if you want to allow logging via a pipe" >&5
         
 # Check whether --enable-logfile-exec or --disable-logfile-exec was given.
 if test "${enable_logfile_exec+set}" = set; then
@@ -4131,7 +4230,7 @@
 fi
 
 echo $ac_n "checking if you want support for right-scrollbar""... $ac_c" 1>&6
-echo "configure:4135: checking if you want support for right-scrollbar" >&5
 +echo "configure:4234: 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
@@ -4157,7 +4256,7 @@
 fi
 
 echo $ac_n "checking if you want check for redundant name-change""... $ac_c" 1>&6
-echo "configure:4161: checking if you want check for redundant name-change" >&5
 +echo "configure:4260: checking if you want check for redundant name-change" >&5
  
 # Check whether --enable-samename or --disable-samename was given.
 if test "${enable_samename+set}" = set; then
@@ -4181,7 +4280,7 @@
 
 
 echo $ac_n "checking if you want support for tek4014""... $ac_c" 1>&6
-echo "configure:4185: checking if you want support for tek4014" >&5
 +echo "configure:4284: checking if you want support for tek4014" >&5
  
 # Check whether --enable-tek4014 or --disable-tek4014 was given.
 if test "${enable_tek4014+set}" = set; then
@@ -4211,7 +4310,7 @@
 fi
 
 echo $ac_n "checking if you want VT52 emulation""... $ac_c" 1>&6
-echo "configure:4215: checking if you want VT52 emulation" >&5
 +echo "configure:4314: checking if you want VT52 emulation" >&5
  
 # Check whether --enable-vt52 or --disable-vt52 was given.
 if test "${enable_vt52+set}" = set; then
@@ -4235,7 +4334,7 @@
 
 
 echo $ac_n "checking if you want -ziconbeep option""... $ac_c" 1>&6
-echo "configure:4239: checking if you want -ziconbeep option" >&5
 +echo "configure:4338: checking if you want -ziconbeep option" >&5
  
 # Check whether --enable-ziconbeep or --disable-ziconbeep was given.
 if test "${enable_ziconbeep+set}" = set; then
@@ -4260,7 +4359,7 @@
 
 # development/testing aids
 echo $ac_n "checking if you want debugging traces""... $ac_c" 1>&6
-echo "configure:4264: checking if you want debugging traces" >&5
 +echo "configure:4363: checking if you want debugging traces" >&5
  
 # Check whether --enable-trace or --disable-trace was given.
 if test "${enable_trace+set}" = set; then
@@ -4289,7 +4388,7 @@
 
 
 echo $ac_n "checking if you want to see long compiling messages""... $ac_c" 1>&6
-echo "configure:4293: checking if you want to see long compiling messages" >&5
 +echo "configure:4392: 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
@@ -4329,7 +4428,7 @@
 
 
 echo $ac_n "checking if you want magic cookie emulation""... $ac_c" 1>&6
-echo "configure:4333: checking if you want magic cookie emulation" >&5
 +echo "configure:4432: 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
@@ -4358,7 +4457,7 @@
 
 if test -n "$GCC" ; then
 echo $ac_n "checking if you want to turn on gcc warnings""... $ac_c" 1>&6
-echo "configure:4362: checking if you want to turn on gcc warnings" >&5
 +echo "configure:4461: 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
@@ -4398,9 +4497,9 @@
 if test -n "$GCC"
 then
        echo "checking for gcc __attribute__ directives" 1>&6
-echo "configure:4402: checking for gcc __attribute__ directives" >&5
 +echo "configure:4501: checking for gcc __attribute__ directives" >&5
         cat > conftest.$ac_ext <<EOF
-#line 4404 "configure"
+#line 4503 "configure"
  #include "confdefs.h"
 #include "conftest.h"
 #include "conftest.i"
@@ -4438,7 +4537,7 @@
 EOF
                        ;;
                esac
-               if { (eval echo configure:4442: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
 +               if { (eval echo configure:4541: \"$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
@@ -4455,11 +4554,11 @@
 if test -n "$GCC"
 then
                cat > conftest.$ac_ext <<EOF
-#line 4459 "configure"
+#line 4558 "configure"
  int main(int argc, char *argv[]) { return argv[argc-1] == 0; }
 EOF
                echo "checking for gcc warning options" 1>&6
-echo "configure:4463: checking for gcc warning options" >&5
 +echo "configure:4562: checking for gcc warning options" >&5
         cf_save_CFLAGS="$CFLAGS"
        EXTRA_CFLAGS="-W -Wall"
        cf_warn_CONST=""
@@ -4477,7 +4576,7 @@
                Wstrict-prototypes $cf_warn_CONST
        do
                CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
-               if { (eval echo configure:4481: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
 +               if { (eval echo configure:4580: \"$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"
Index: cursor.c
--- xterm-84+/cursor.c  Fri Jun  5 16:23:53 1998
 +++ xterm-85/cursor.c   Sun Oct 11 17:55:27 1998
 @@ -28,14 +28,8 @@
  
 /* cursor.c */
 
-#ifdef HAVE_CONFIG_H
-#include <xtermcfg.h>
-#endif
 -
-#include "ptyx.h"              /* also gets Xlib.h */
 -
-#include "data.h"
-#include "xterm.h"
+#include <xterm.h>
+#include <data.h>
 
 static void _CheckSelection (register TScreen *screen)
 {
Index: data.c
--- xterm-84+/data.c    Fri Jun  5 16:23:53 1998
 +++ xterm-85/data.c     Sun Oct 11 16:47:47 1998
 @@ -30,8 +30,8 @@
  #include <xtermcfg.h>
 #endif
 
-#include "ptyx.h"              /* gets Xt stuff, too */
 -#include "data.h"
+#include <ptyx.h>              /* gets Xt stuff, too */
 +#include <data.h>
 
 #include <setjmp.h>
 
@@ -80,13 +80,6 @@
 Char VTbuffer[BUF_SIZE];
 Char *bptr = VTbuffer;
 jmp_buf VTend;
-XPoint VTbox[NBOX] = {
-       {0, 0},
 -       {0, 0},
 -       {0, 0},
 -       {0, 0},
 -       {0, 0},
 -};
 
 #ifdef DEBUG
 int debug = 0;                 /* true causes error messages to be displayed */
Index: data.h
--- xterm-84+/data.h    Fri Jun  5 16:23:53 1998
 +++ xterm-85/data.h     Sun Oct 11 17:10:48 1998
 @@ -28,6 +28,8 @@
  #ifndef included_data_h
 #define included_data_h 1
 
+#include <ptyx.h>
+
 #if XtSpecificationRelease >= 6 && !defined(NO_XPOLL_H)
 #include <X11/Xpoll.h>
 #else
@@ -60,7 +62,6 @@
 extern int Ttoggled;
 #endif
 
-extern XPoint VTbox[];
 extern Char *bptr;
 #ifdef ALLOWLOGGING
 extern char log_def_name[];
Index: doublechr.c
--- xterm-84+/doublechr.c       Fri Jun  5 16:23:53 1998
 +++ xterm-85/doublechr.c        Sun Oct 11 17:52:30 1998
 @@ -34,13 +34,8 @@
  
 ********************************************************/
 
-#ifdef HAVE_CONFIG_H
-#include <xtermcfg.h>
-#endif
 -
-#include "ptyx.h"
-#include "data.h"
-#include "xterm.h"
+#include <xterm.h>
+#include <data.h>
 
 /*
  * The first column is all that matters for double-size characters (since the
Index: fontutils.c
--- /dev/null   Sun Jul 17 19:46:18 1994
 +++ xterm-85/fontutils.c        Sun Oct 11 19:15:13 1998
 @@ -0,0 +1,529 @@
 +/*
+ * $XFree86$
+ */
+
+/************************************************************
 +
+Copyright 1998 by Thomas E. Dickey <dickey@clark.net>
 +
+                        All Rights Reserved
 +
+Permission is hereby granted, free of charge, to any person obtaining a
 +copy of this software and associated documentation files (the
 +"Software"), to deal in the Software without restriction, including
 +without limitation the rights to use, copy, modify, merge, publish,
 +distribute, sublicense, and/or sell copies of the Software, and to
 +permit persons to whom the Software is furnished to do so, subject to
 +the following conditions:
+
 +The above copyright notice and this permission notice shall be included
 +in all copies or substantial portions of the Software.
 +
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 +IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
 +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 +
+Except as contained in this notice, the name(s) of the above copyright
 +holders shall not be used in advertising or otherwise to promote the
 +sale, use or other dealings in this Software without prior written
 +authorization.
+
+********************************************************/
 +
+/*
+ * A portion of this module (for FontNameProperties) is adapted from EMU 1.3;
 + * it constructs font names with specific properties changed, e.g., for bold
 + * and double-size characters.
+ */
 +
+#include <fontutils.h>
+
 +#include <data.h>
+#include <menu.h>
+#include <xterm.h>
+
+#include <stdio.h>
+
+#define MAX_FONTNAME 200
+
 +/*
+ * A structure to hold the relevant properties from a font
 + * we need to make a well formed font name for it.
 + */
+typedef struct {
+     /* registry, foundry, family */
 +     char *beginning;
+     char *width;
 +     /* slant, width, add_style */
 +     char *middle;
+     int pixel_size;
 +     char *point_size;
 +     int res_x;
+     int res_y;
 +     char *spacing;
+     /* charset registry, charset encoding */
 +     char *end;
+} FontNameProperties;
 +
+/*
+ * Returns the fields from start to stop in a dash- separated string.  This
 + * function will modify the source, putting '\0's in the appropiate place and
 + * moving the beginning forward to after the '\0'
 + *
+ * This will NOT work for the last field (but we won't need it).
 + */
+static char *
+n_fields(char **source, int start, int stop)
 +{
+       int i;
 +       char *str , *str1;
 +
+       /*
+       * find the start-1th dash
 +       */
+       for (i = start-1, str = *source; i; i--, str++)
 +               if ((str = strchr(str, '-')) == 0)
 +                       return 0;
 +
+       /*
+       * find the stopth dash
 +       */
+       for (i = stop - start + 1, str1 = str; i; i--, str1++)
 +               if ((str1 = strchr(str1, '-')) == 0)
 +                       return 0;
 +
+       /*
+       * put a \0 at the end of the fields
 +       */
+       *(str1 - 1) = '\0';
 +
+       /*
+       * move source forward
 +       */
+       *source = str1;
 +
+       return str;
 +}
+
+
+/*
+ * Gets the font properties from a given font structure.  We use the FONT name
 + * to find them out, since that seems easier.
 + *
+ * Returns a pointer to a static FontNameProperties structure
 + * or NULL on error.
+ */
 +static FontNameProperties *
+get_font_name_props(Display *dpy, XFontStruct *fs)
 +{
+       static FontNameProperties props;
 +
+       register XFontProp *fp;
 +       register int i;
 +       Atom fontatom = XInternAtom (dpy, "FONT", False);
 +       char *name;
 +       char *str;
 +
+       /*
+       * first get the full font name
 +       */
+       for (name = 0, i = 0, fp = fs->properties;
 +               i < fs->n_properties;
 +                       i++, fp++)
 +               if (fp->name == fontatom)
 +                       name = XGetAtomName (dpy, fp->card32);
 +
+       if (name == 0)
 +               return 0;
 +
+       /*
+       * Now split it up into parts and put them in
 +       * their places. Since we are using parts of
 +       * the original string, we must not free the Atom Name
 +       */
+
 +       /* registry, foundry, family */
 +       if ((props.beginning = n_fields(&name, 1, 3)) == 0)
 +               return 0;
 +
+       /* weight is the next */
 +       if ((props.width = n_fields(&name, 1, 1)) == 0)
 +               return 0;
 +
+       /* slant, width, add style */
 +       if ((props.middle = n_fields(&name, 1, 3)) == 0)
 +               return 0;
 +
+       /* pixel size */
 +       if ((str = n_fields(&name, 1, 1)) == 0)
 +               return 0;
 +       if ((props.pixel_size = atoi(str)) == 0)
 +               return 0;
 +
+       /* point size */
 +       if ((props.point_size = n_fields(&name, 1, 1)) == 0)
 +               return 0;
 +
+       /* res_x */
 +       if ((str = n_fields(&name, 1, 1)) == 0)
 +               return 0;
 +       if ((props.res_x = atoi(str)) == 0)
 +               return 0;
 +
+       /* res_y */
 +       if ((str = n_fields(&name, 1, 1)) == 0)
 +               return 0;
 +       if ((props.res_y = atoi(str)) == 0)
 +               return 0;
 +
+       /* spacing */
 +       if ((props.spacing = n_fields(&name, 1, 1)) == 0)
 +               return 0;
 +
+       /* skip the average width */
 +       if ((str = n_fields(&name, 1, 1)) == 0)
 +               return 0;
 +
+       /* the rest: charset registry and charset encoding */
 +       props.end = name;
 +
+       return &props;
 +}
+
+/*
+ * Take the given font props and try to make a well formed font name specifying
 + * the same base font and size and everything, but in bold.  The return value
 + * comes from a static variable, so be careful if you reuse it.
 + */
+static char *
+bold_font_name(FontNameProperties *props)
+{
 +     static char ret[MAX_FONTNAME];
 +
+     /*
+      * Put together something in the form
 +      * "<beginning>-bold-<middle>-<pixel_size>-<point_size>-<res_x>-<res_y>"\
 +      * "-<spacing>-*-<end>"
 +      */
+     sprintf(ret, "%s-bold-%s-%d-%s-%d-%d-%s-*-%s",
 +            props->beginning,
 +            props->middle,
 +            props->pixel_size,
 +            props->point_size,
 +            props->res_x,
 +            props->res_y,
 +            props->spacing,
 +            props->end);
 +
+     return ret;
+}
 +
+#if 0
+#ifdef OPT_DEC_CHRSET
+/*
+ * Take the given font props and try to make a well formed font name specifying
 + * the same base font but changed depending on the given attributes and lflags.
 + *
+ * For double width fonts, we just double the X-resolution, for double height
 + * fonts we double the pixel-size and Y-resolution
 + */
+char *
+special_font_name(FontNameProperties *props, unsigned char atts,
 +                 LineFlagsElem lflags)
 +{
+     char tmp[MAX_FONTNAME];
 +     char *ret;
+
 +     char *width;
+     int pixel_size = props->pixel_size;
 +     int res_x = props->res_x;
 +     int res_y = props->res_y;
 +
+     if (atts & ATT_BOLD)
 +         width = "bold";
 +     else
+         width = props->width;
 +
+     if (lflags & LINE_D_WIDE)
 +         res_x *= 2;
 +
+     if (lflags & (LINE_D_UPPER | LINE_D_LOWER)) {
 +         res_x *= 2;
 +         res_y *= 2;
 +         pixel_size *= 2;
 +     }
+
+     sprintf(tmp, "%s-%s-%s-%d-%s-%d-%d-%s-*-%s",
 +            props->beginning,
 +            width,
 +            props->middle,
 +            pixel_size,
 +            props->point_size,
 +            res_x,
 +            res_y,
 +            props->spacing,
 +            props->end);
 +
+     ret = XtMalloc(strlen(tmp) + 1);
 +     strcpy(ret, tmp);
 +
+     return ret;
+}
 +#endif /* OPT_DEC_CHRSET */
+#endif
 +
+/*
+ * Double-check the fontname that we asked for versus what the font server
 + * actually gave us.  The larger fixed fonts do not always have a matching bold
+ * font, and the font server may try to scale another font or otherwise
 + * substitute a mismatched font.
 + *
+ * If we cannot get what we requested, we will fallback to the original
 + * behavior, which simulates bold by overstriking each character at one pixel
 + * offset.
+ */
+static int
+got_bold_font(Display *dpy, XFontStruct *fs, char *fontname)
 +{
+       FontNameProperties *fp;
 +       char oldname[MAX_FONTNAME], *p = oldname;
 +       strcpy(p, fontname);
 +       if ((fp = get_font_name_props(dpy, fs)) == 0)
 +               return 0;
 +       fontname = bold_font_name(fp);
 +       while (*p && *fontname) {
 +               if (char2lower(*p++) != char2lower(*fontname++))
 +                       return 0;
 +       }
+       return (*p == *fontname);       /* both should be NUL */
 +}
+
+#define EmptyFont(fs) ((fs)->ascent + (fs)->descent == 0 \
 +                  ||  (fs)->max_bounds.width == 0)
 +
+int
+xtermLoadFont (
+       TScreen *screen,
 +       char *nfontname,
 +       char *bfontname,
 +       Bool doresize,
 +       int fontnum)
 +{
+       FontNameProperties *fp;
 +       XFontStruct *nfs = NULL;
 +       XFontStruct *bfs = NULL;
 +       XGCValues xgcv;
 +       unsigned long mask;
+       GC new_normalGC      = NULL;
 +       GC new_normalboldGC  = NULL;
 +       GC new_reverseGC     = NULL;
 +       GC new_reverseboldGC = NULL;
 +       Pixel new_normal;
 +       Pixel new_revers;
 +       char *tmpname = NULL;
 +       Boolean proportional = False;
 +
+       if (!nfontname) return 0;
 +
+       if (fontnum == fontMenu_fontescape
 +        && nfontname != screen->menu_font_names[fontnum]) {
 +               tmpname = (char *) malloc (strlen(nfontname) + 1);
 +               if (!tmpname)
 +                       return 0;
 +               strcpy (tmpname, nfontname);
 +       }
+
 +       TRACE(("xtermLoadFont normal %s\n", nfontname))
 +
+       if (!(nfs = XLoadQueryFont (screen->display, nfontname))) goto bad;
 +       if (EmptyFont(nfs))
 +               goto bad;               /* can't use a 0-sized font */
 +
+       if (bfontname == 0) {
 +               fp = get_font_name_props(screen->display, nfs);
 +               if (fp != 0) {
 +                       bfontname = bold_font_name(fp);
 +                       TRACE(("...derived bold %s\n", bfontname))
 +               }
 +               if (bfontname == 0
 +                || (bfs = XLoadQueryFont (screen->display, bfontname)) == 0) {
 +                       bfs = nfs;
 +                       TRACE(("...cannot load a matching bold font\n"))
 +               } else if (!got_bold_font(screen->display, bfs, bfontname)) {
 +                       XFreeFont(screen->display, bfs);
 +                       bfs = nfs;
 +                       TRACE(("...did not get a matching bold font\n"))
 +               }
 +       } else if ((bfs = XLoadQueryFont (screen->display, bfontname)) == 0) {
 +               bfs = nfs;
 +               TRACE(("...cannot load bold font %s\n", bfontname))
 +       }
+
 +       if (EmptyFont(bfs))
 +               goto bad;               /* can't use a 0-sized font */
 +
+       if (nfs->min_bounds.width != nfs->max_bounds.width
 +        || bfs->min_bounds.width != bfs->max_bounds.width
 +        || nfs->min_bounds.width != bfs->min_bounds.width
 +        || nfs->max_bounds.width != bfs->max_bounds.width) {
 +               TRACE(("Proportional font!\n"))
 +               proportional = True;
 +       }
+
 +       mask = (GCFont | GCForeground | GCBackground | GCGraphicsExposures |
 +       GCFunction);
 +
+       new_normal = getXtermForeground(term->flags, term->cur_foreground);
 +       new_revers = getXtermBackground(term->flags, term->cur_background);
 +
+       xgcv.font = nfs->fid;
 +       xgcv.foreground = new_normal;
 +       xgcv.background = new_revers;
 +       xgcv.graphics_exposures = TRUE; /* default */
 +       xgcv.function = GXcopy;
 +
+       new_normalGC = XtGetGC((Widget)term, mask, &xgcv);
 +       if (!new_normalGC) goto bad;
 +
+       if (nfs == bfs) {                       /* there is no bold font */
 +               new_normalboldGC = new_normalGC;
 +       } else {
 +               xgcv.font = bfs->fid;
 +               new_normalboldGC = XtGetGC((Widget)term, mask, &xgcv);
 +               if (!new_normalboldGC) goto bad;
 +       }
+
 +       xgcv.font = nfs->fid;
 +       xgcv.foreground = new_revers;
 +       xgcv.background = new_normal;
 +       new_reverseGC   = XtGetGC((Widget)term, mask, &xgcv);
 +       if (!new_reverseGC) goto bad;
 +
+       if (nfs == bfs) {                       /* there is no bold font */
 +               new_reverseboldGC = new_reverseGC;
 +       } else {
 +               xgcv.font = bfs->fid;
 +               new_reverseboldGC = XtGetGC((Widget)term, mask, &xgcv);
 +               if (!new_reverseboldGC) goto bad;
 +       }
+
 +       if (NormalGC(screen) != NormalBoldGC(screen))
 +               XtReleaseGC ((Widget) term, NormalBoldGC(screen));
 +       XtReleaseGC ((Widget) term, NormalGC(screen));
 +
+       if (ReverseGC(screen) != ReverseBoldGC(screen))
 +               XtReleaseGC ((Widget) term, ReverseBoldGC(screen));
 +       XtReleaseGC ((Widget) term, ReverseGC(screen));
 +
+       NormalGC(screen)      = new_normalGC;
 +       NormalBoldGC(screen)  = new_normalboldGC;
 +       ReverseGC(screen)     = new_reverseGC;
 +       ReverseBoldGC(screen) = new_reverseboldGC;
 +
+       /*
+        * If we're switching fonts, free the old ones.  Otherwise we'll leak
 +        * the memory that is associated with the old fonts.  The
 +        * XLoadQueryFont call allocates a new XFontStruct.
 +        */
+       if (screen->fnt_bold != 0
 +        && screen->fnt_bold != screen->fnt_norm)
 +               XFreeFont(screen->display, screen->fnt_bold);
 +       if (screen->fnt_norm != 0)
 +               XFreeFont(screen->display, screen->fnt_norm);
 +
+       screen->fnt_norm = nfs;
 +       screen->fnt_bold = bfs;
 +       screen->fnt_prop = proportional;
+
+       screen->enbolden = (nfs == bfs);
 +       set_menu_font (False);
 +       screen->menu_font_number = fontnum;
 +       set_menu_font (True);
 +       if (tmpname) {                  /* if setting escape or sel */
 +               if (screen->menu_font_names[fontnum])
 +                       free (screen->menu_font_names[fontnum]);
 +               screen->menu_font_names[fontnum] = tmpname;
 +               if (fontnum == fontMenu_fontescape) {
 +                       set_sensitivity (term->screen.fontMenu,
 +                               fontMenuEntries[fontMenu_fontescape].widget,
 +                               TRUE);
 +               }
 +       }
+       set_cursor_gcs (screen);
 +       xtermUpdateFontInfo (screen, doresize);
 +       return 1;
 +
+bad:
+       if (tmpname)
 +               free (tmpname);
 +       if (new_normalGC)
 +               XtReleaseGC ((Widget) term, screen->fullVwin.normalGC);
 +       if (new_normalGC && new_normalGC != new_normalboldGC)
 +               XtReleaseGC ((Widget) term, new_normalboldGC);
 +       if (new_reverseGC)
 +               XtReleaseGC ((Widget) term, new_reverseGC);
 +       if (new_reverseGC && new_reverseGC != new_reverseboldGC)
 +               XtReleaseGC ((Widget) term, new_reverseboldGC);
 +       if (nfs)
 +               XFreeFont (screen->display, nfs);
 +       if (bfs && nfs != bfs)
 +               XFreeFont (screen->display, bfs);
 +       return 0;
 +}
+
+/*
+ * Set the limits for the box that outlines the cursor.
 + */
+void
+xtermSetCursorBox (TScreen *screen)
+{
 +       static XPoint VTbox[NBOX];
 +       XPoint  *vp;
 +
+       vp = &VTbox[1];
 +       (vp++)->x = FontWidth(screen) - 1;
 +       (vp++)->y = FontHeight(screen) - 1;
 +       (vp++)->x = -(FontWidth(screen) - 1);
 +       vp->y = -(FontHeight(screen) - 1);
 +       screen->box = VTbox;
 +}
+
+/*
+ * After loading a new font, update the structures that use its size.
 + */
+void
+xtermUpdateFontInfo (TScreen *screen, Bool doresize)
 +{
+       int i, j, width, height, scrollbar_width;
 +
+       screen->fullVwin.f_width  = (screen->fnt_norm->max_bounds.width);
 +       screen->fullVwin.f_height = (screen->fnt_norm->ascent +
 +       screen->fnt_norm->descent);
 +       scrollbar_width = (term->misc.scrollbar
 +                       ? screen->scrollWidget->core.width +
 +                         screen->scrollWidget->core.border_width
 +                       : 0);
 +       i = 2 * screen->border + scrollbar_width;
 +       j = 2 * screen->border;
 +       width  = (screen->max_col + 1) * screen->fullVwin.f_width + i;
 +       height = (screen->max_row + 1) * screen->fullVwin.f_height + j;
 +       screen->fullVwin.fullwidth  = width;
 +       screen->fullVwin.fullheight = height;
 +       screen->fullVwin.width  = width - i;
 +       screen->fullVwin.height = height - j;
 +
+       if (doresize) {
 +               if (VWindow(screen)) {
 +                       XClearWindow (screen->display, VWindow(screen));
 +               }
 +               DoResizeScreen (term);  /* set to the new natural size */
 +               if (screen->scrollWidget)
 +                       ResizeScrollBar (screen);
 +               Redraw ();
 +       }
+       xtermSetCursorBox (screen);
 +}
Index: fontutils.h
--- /dev/null   Sun Jul 17 19:46:18 1994
 +++ xterm-85/fontutils.h        Sun Oct 11 18:13:40 1998
 @@ -0,0 +1,46 @@
 +/*
+ * $XFree86$
+ */
+
+/************************************************************
 +
+Copyright 1998 by Thomas E. Dickey <dickey@clark.net>
 +
+                        All Rights Reserved
 +
+Permission is hereby granted, free of charge, to any person obtaining a
 +copy of this software and associated documentation files (the
 +"Software"), to deal in the Software without restriction, including
 +without limitation the rights to use, copy, modify, merge, publish,
 +distribute, sublicense, and/or sell copies of the Software, and to
 +permit persons to whom the Software is furnished to do so, subject to
 +the following conditions:
+
 +The above copyright notice and this permission notice shall be included
 +in all copies or substantial portions of the Software.
 +
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
 +IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
 +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 +
+Except as contained in this notice, the name(s) of the above copyright
 +holders shall not be used in advertising or otherwise to promote the
 +sale, use or other dealings in this Software without prior written
 +authorization.
+
+********************************************************/
 +
+#ifndef included_fontutils_h
+#define included_fontutils_h 1
 +
+#include <ptyx.h>
+
+extern int xtermLoadFont (TScreen *screen, char *nfontname, char *bfontname, Bool doresize, int fontnum);
 +extern void xtermUpdateFontInfo (TScreen *screen, Bool doresize);
 +extern void xtermSetCursorBox (TScreen *screen);
 +
+#endif /* included_fontutils_h */
Index: input.c
 --- xterm-84+/input.c   Wed Sep 23 07:04:09 1998
 +++ xterm-85/input.c    Sun Oct 11 17:51:49 1998
 @@ -28,11 +28,7 @@
  
 /* input.c */
 
-#ifdef HAVE_CONFIG_H
-#include <xtermcfg.h>
-#endif
 -
-#include "ptyx.h"              /* gets Xt headers, too */
 +#include <xterm.h>
 
 #include <X11/keysym.h>
 #if HAVE_X11_DECKEYSYM_H
@@ -40,10 +36,8 @@
 #endif
 
 #include <X11/Xutil.h>
-#include <stdio.h>
 
-#include "xterm.h"
-#include "data.h"
+#include <data.h>
 
 static char *kypd_num = " XXXXXXXX\tXXX\rXXXxxxxXXXXXXXXXXXXXXXXXXXXX*+,-./0123456789XXX=";
 static char *kypd_apl = " ABCDEFGHIJKLMNOPQRSTUVWXYZ??????abcdefghijklmnopqrstuvwxyzXXX";
Index: main.c
--- xterm-84+/main.c    Wed Oct  7 20:56:04 1998
 +++ xterm-85/main.c     Sun Oct 11 20:48:16 1998
 @@ -69,12 +69,8 @@
  
 /* main.c */
 
-#ifdef HAVE_CONFIG_H
-#include <xtermcfg.h>
-#endif
 -
-#include "version.h"
-#include "ptyx.h"
+#include <version.h>
+#include <xterm.h>
 
 #include <X11/StringDefs.h>
 #include <X11/Shell.h>
@@ -87,10 +83,9 @@
 #include <pwd.h>
 #include <ctype.h>
 
-#include "data.h"
-#include "error.h"
-#include "menu.h"
-#include "xterm.h"
+#include <data.h>
+#include <error.h>
+#include <menu.h>
 
 #ifdef AMOEBA
 #include <amoeba.h>
@@ -214,6 +209,10 @@
 #define USE_TTY_GROUP
 #endif
 
+#ifdef USE_TTY_GROUP
+#include <grp.h>
+#endif
+
 #ifndef __CYGWIN32__
 #include <sys/ioctl.h>
 #endif
@@ -501,8 +500,16 @@
 
 int switchfb[] = {0, 2, 1, 3};
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern int tgetent (char *ptr, char *name);
 
+#ifdef __cplusplus
+       }
+#endif
 +
 static SIGNAL_T reapchild (int n);
 static char *base_name (char *name);
 static int pty_search (int *pty);
@@ -2626,7 +2633,7 @@
 
                        /* We have a new pty to try */
                        free(ttydev);
-                       ttydev = malloc((unsigned)
 +                       ttydev = (char *)malloc((unsigned)
                             (strlen(handshake.buffer) + 1));
                        if (ttydev == NULL) {
                            SysError(ERROR_SPREALLOC);
@@ -2640,7 +2647,7 @@
                if ((ptr = ttyname(tty)) != 0)
                {
                        /* it may be bigger */
-                       ttydev = realloc (ttydev,
 +                       ttydev = (char *)realloc (ttydev,
                                 (unsigned) (strlen(ptr) + 1));
                        if (ttydev == NULL) {
                            SysError(ERROR_SPREALLOC);
@@ -2655,7 +2662,6 @@
 
 #ifdef USE_TTY_GROUP
        {
-#include <grp.h>
                struct group *ttygrp;
                if ((ttygrp = getgrnam("tty")) != 0) {
                        /* change ownership of tty to real uid, "tty" gid */
@@ -3370,7 +3376,7 @@
                        shname++;
                else
                        shname = ptr;
-               shname_minus = malloc(strlen(shname) + 2);
 +               shname_minus = (char *)malloc(strlen(shname) + 2);
                 (void) strcpy(shname_minus, "-");
                (void) strcat(shname_minus, shname);
 #if !defined(USE_SYSV_TERMIO) && !defined(USE_POSIX_TERMIOS)
@@ -3452,7 +3458,7 @@
                        tslot = handshake.tty_slot;
 #endif /* USE_SYSV_UTMP */
                        free(ttydev);
-                       ttydev = malloc((unsigned) strlen(handshake.buffer) + 1);
 +                       ttydev = (char *)malloc((unsigned) strlen(handshake.buffer) + 1);
                         strcpy(ttydev, handshake.buffer);
                        break;
                default:
Index: menu.c
--- xterm-84+/menu.c    Fri Jun  5 16:23:53 1998
 +++ xterm-85/menu.c     Sun Oct 11 17:33:51 1998
 @@ -27,13 +27,10 @@
  
 */
 
-#ifdef HAVE_CONFIG_H
-#include <xtermcfg.h>
-#endif
 +#include <ptyx.h>
+#include <data.h>
+#include <menu.h>
 
-#include "ptyx.h"
-#include "data.h"
-#include "menu.h"
 #include <X11/StringDefs.h>
 #include <X11/Shell.h>
 #include <X11/Xmu/CharSet.h>
@@ -47,7 +44,7 @@
 #include <X11/Xos.h>
 #endif
 
-#include "xterm.h"
+#include <xterm.h>
 
 Arg menuArgs[2] = {{ XtNleftBitmap, (XtArgVal) 0 },
                   { XtNsensitive, (XtArgVal) 0 }};
Index: menu.h
--- xterm-84+/menu.h    Fri Jun  5 16:23:53 1998
 +++ xterm-85/menu.h     Sun Oct 11 17:07:37 1998
 @@ -33,7 +33,12 @@
  #ifndef included_menu_h
 #define included_menu_h
 
-#include "proto.h"
+#ifdef HAVE_CONFIG_H
+#include <xtermcfg.h>
+#endif
 +
+#include <X11/Intrinsic.h>
+#include <proto.h>
  
 typedef struct _MenuEntry {
     char *name;
Index: misc.c
--- xterm-84+/misc.c    Sun Aug 30 06:43:03 1998
 +++ xterm-85/misc.c     Sun Oct 11 20:42:30 1998
 @@ -26,11 +26,7 @@
   * SOFTWARE.
  */
 
-#ifdef HAVE_CONFIG_H
-#include <xtermcfg.h>
-#endif
 -
-#include "ptyx.h"              /* X headers included here. */
 +#include <xterm.h>
 
 #include <X11/Xos.h>
 #include <stdio.h>
@@ -47,13 +43,10 @@
 #include <X11/Xmu/SysUtil.h>
 #include <X11/Xmu/WinUtil.h>
 
-#include "xterm.h"
-#include "xcharmouse.h"
-
-#include "VTparse.h"
-#include "data.h"
-#include "error.h"
-#include "menu.h"
+#include <data.h>
+#include <error.h>
+#include <menu.h>
+#include <xcharmouse.h>
 
 #if XtSpecificationRelease < 6
 #ifndef X_GETTIMEOFDAY
@@ -62,8 +55,8 @@
 #endif
 
 #ifdef AMOEBA
-#include "amoeba.h"
-#include "module/proc.h"
+#include <amoeba.h>
+#include <module/proc.h>
 #endif
 
 #ifdef __EMX__
@@ -599,7 +592,7 @@
        static char *log_default;
 #ifdef ALLOWLOGFILEEXEC
        register char *cp;
-       register int i;
 +       register int i = 0;
  #ifdef SYSV
        /* SYSV has another pointer which should be part of the
        ** FILE structure but is actually a separate array.
@@ -614,13 +607,13 @@
                if(screen->logfile)
                        free(screen->logfile);
                if(log_default == NULL) {
-                       log_default = malloc(strlen(log_def_name) + 1);
 +                       log_default = (char *)malloc(strlen(log_def_name) + 1);
                         if (log_default == 0)
                                return;
                        strcpy(log_default, log_def_name);
                        mktemp(log_default);
                }
-               if((screen->logfile = malloc(strlen(log_default) + 1)) == NULL)
 +               if((screen->logfile = (char *)malloc(strlen(log_default) + 1)) == 0)
                         return;
                strcpy(screen->logfile, log_default);
        }
@@ -656,7 +649,7 @@
                        if ((((cp = getenv("SHELL")) == NULL || *cp == 0)
                          && ((pw = getpwuid(screen->uid)) == NULL
                           || *(cp = pw->pw_shell) == 0))
-                        || (shell = malloc(strlen(cp) + 1)) == NULL)
 +                        || (shell = (char *)malloc(strlen(cp) + 1)) == 0)
                                 shell = "/bin/sh";
                        else
                                strcpy(shell, cp);
@@ -941,7 +934,7 @@
                        reset_decudk();
 
                while (*cp) {
-                       char *str = malloc(strlen(cp) + 2);
 +                       char *str = (char *)malloc(strlen(cp) + 2);
                         int key = 0;
                        int len = 0;
 
@@ -1009,7 +1002,7 @@
 {
 #if OPT_ZICONBEEP      /* If warning should be given then give it */
     if ( zIconBeep && zIconBeep_flagged ) {
-       char *newname = malloc(strlen(name)+ 4 + 1);
 +       char *newname = (char *)malloc(strlen(name)+ 4 + 1);
         if (!newname) {
            fprintf(stderr, "malloc failed in Changename\n");
            return;
Index: os2main.c
--- xterm-84+/os2main.c Fri Jun  5 16:23:53 1998
 +++ xterm-85/os2main.c  Sun Oct 11 17:49:10 1998
 @@ -66,8 +66,8 @@
  #include <os2.h>
 #endif
 
-#include "version.h"
-#include "ptyx.h"
+#include <version.h>
+#include <xterm.h>
 
 #include <X11/StringDefs.h>
 #include <X11/Shell.h>
@@ -82,10 +82,9 @@
 #include <pwd.h>
 #include <ctype.h>
 
-#include "data.h"
-#include "error.h"
-#include "menu.h"
-#include "xterm.h"
+#include <data.h>
+#include <error.h>
+#include <menu.h>
 
 #include <sys/termio.h>
 
Index: print.c
--- xterm-84+/print.c   Fri Jun  5 16:23:53 1998
 +++ xterm-85/print.c    Sun Oct 11 20:25:06 1998
 @@ -34,16 +34,11 @@
  
 ********************************************************/
 
-#ifdef HAVE_CONFIG_H
-#include <xtermcfg.h>
-#endif
 -
 #include <stdio.h>
 
-#include "ptyx.h"
-#include "data.h"
-#include "error.h"
-#include "xterm.h"
+#include <xterm.h>
+#include <data.h>
+#include <error.h>
 
 #define SHIFT_IN  '\017'
 #define SHIFT_OUT '\016'
@@ -326,13 +321,13 @@
  * VT330/VT340 Programmer Reference Manual EK-VT3XX-TP-001 (Digital Equipment
  * Corp., March 1987).
  */
-void xtermMediaControl (int param, int private)
 +void xtermMediaControl (int param, int private_seq)
  {
        register TScreen *screen = &term->screen;
 
-       TRACE(("MediaCopy param=%d, private=%d\n", param, private))
 +       TRACE(("MediaCopy param=%d, private=%d\n", param, private_seq))
  
-       if (private) {
 +       if (private_seq) {
                 switch (param) {
                case  1:
                        printCursorLine();
Index: proto.h
--- xterm-84+/proto.h   Sun Jul  5 16:05:39 1998
 +++ xterm-85/proto.h    Sun Oct 11 16:49:05 1998
 @@ -3,7 +3,9 @@
  #ifndef included_proto_h
 #define included_proto_h
 
-#include <X11/Xfuncproto.h>
+#ifdef HAVE_CONFIG_H
 +#include <xtermcfg.h>
+#endif
  
 #define PROTO_XT_ACTIONS_ARGS \
        (Widget w, XEvent *event, String *params, Cardinal *num_params)
Index: ptyx.h
--- xterm-84+/ptyx.h    Sun Aug 30 06:43:03 1998
 +++ xterm-85/ptyx.h     Sun Oct 11 20:57:55 1998
 @@ -29,6 +29,10 @@
  #ifndef included_ptyx_h
 #define included_ptyx_h 1
 
+#ifdef HAVE_CONFIG_H
+#include <xtermcfg.h>
+#endif
 +
 /* ptyx.h */
 /* @(#)ptyx.h  X10/6.6 11/10/86 */
 
@@ -41,7 +45,7 @@
 #define MyStackAlloc(size, stack_cache_array)     \
     ((size) <= sizeof(stack_cache_array)         \
     ?  (XtPointer)(stack_cache_array)            \
-    :  malloc((unsigned)(size)))
 +    :  (XtPointer)malloc((unsigned)(size)))
  
 #define MyStackFree(pointer, stack_cache_array) \
     if ((pointer) != ((XtPointer)(stack_cache_array))) free(pointer)
@@ -470,7 +474,7 @@
 /***====================================================================***/
 
 #if OPT_TRACE
-#include "trace.h"
+#include <trace.h>
 #else
 #define TRACE(p) /*nothing*/
 #define TRACE_CHILD /*nothing*/
@@ -571,6 +575,22 @@
 #endif
 } SavedCursor;
 
+struct _vtwin {
+       Window  window;                 /* X window id                  */
 +       int     width;                  /* width of columns             */
 +       int     height;                 /* height of rows               */
 +       int     fullwidth;              /* full width of window         */
 +       int     fullheight;             /* full height of window        */
 +       int     f_width;                /* width of fonts in pixels     */
 +       int     f_height;               /* height of fonts in pixels    */
 +       int     scrollbar;              /* if > 0, width of scrollbar, and
 +                                               scrollbar is showing    */
 +       GC      normalGC;               /* normal painting              */
 +       GC      reverseGC;              /* reverse painting             */
 +       GC      normalboldGC;           /* normal painting, bold font   */
 +       GC      reverseboldGC;          /* reverse painting, bold font  */
 +};
+
 typedef struct {
 /* These parameters apply to both windows */
        Display         *display;       /* X display for screen         */
@@ -630,21 +650,7 @@
 
 /* VT window parameters */
        Boolean         Vshow;          /* VT window showing            */
-       struct _vtwin {
 -               Window  window;         /* X window id                  */
 -               int     width;          /* width of columns             */
 -               int     height;         /* height of rows               */
 -               int     fullwidth;      /* full width of window         */
 -               int     fullheight;     /* full height of window        */
 -               int     f_width;        /* width of fonts in pixels     */
 -               int     f_height;       /* height of fonts in pixels    */
 -               int     scrollbar;      /* if > 0, width of scrollbar, and
 -                                               scrollbar is showing    */
 -               GC      normalGC;       /* normal painting              */
 -               GC      reverseGC;      /* reverse painting             */
 -               GC      normalboldGC;   /* normal painting, bold font   */
 -               GC      reverseboldGC;  /* reverse painting, bold font  */
 -       } fullVwin;
 +       struct _vtwin fullVwin;
  #ifndef NO_ACTIVE_ICON
        struct _vtwin iconVwin;
        struct _vtwin *whichVwin;
Index: resize.c
--- xterm-84+/resize.c  Fri Jun  5 16:23:53 1998
 +++ xterm-85/resize.c   Sun Oct 11 17:29:02 1998
 @@ -242,7 +242,7 @@
  #endif /* TIOCSWINSZ */
 #endif /* sun */
 
-#include "proto.h"
+#include <proto.h>
 
 static SIGNAL_T onintr (int sig);
 static SIGNAL_T resize_timeout (int sig);
Index: screen.c
--- xterm-84+/screen.c  Fri Oct  9 06:29:03 1998
 +++ xterm-85/screen.c   Sun Oct 11 20:49:06 1998
 @@ -29,17 +29,11 @@
  
 /* screen.c */
 
-#ifdef HAVE_CONFIG_H
-#include <xtermcfg.h>
-#endif
 -
-#include "ptyx.h"
-#include "error.h"
-#include "data.h"
-#include "xterm.h"
-#include "xcharmouse.h"
+#include <xterm.h>
+#include <error.h>
+#include <data.h>
+#include <xcharmouse.h>
 
-#include <stdio.h>
 #include <signal.h>
 #ifdef SVR4
 #define SYSV
@@ -350,9 +344,9 @@
 
        if (len > screen->save_len) {
                if (screen->save_len)
-                       screen->save_ptr = realloc(screen->save_ptr, len);
 +                       screen->save_ptr = (Char **)realloc(screen->save_ptr, len);
                 else
-                       screen->save_ptr = malloc(len);
 +                       screen->save_ptr = (Char **)malloc(len);
                 screen->save_len = len;
                if (screen->save_ptr == 0)
                        SysError (ERROR_SAVE_PTR);
Index: scrollbar.c
--- xterm-84+/scrollbar.c       Sat Jul 18 13:11:26 1998
 +++ xterm-85/scrollbar.c        Sun Oct 11 20:28:06 1998
 @@ -26,26 +26,17 @@
   * SOFTWARE.
  */
 
-#ifdef HAVE_CONFIG_H
-#include <xtermcfg.h>
-#endif
 -
-#include "ptyx.h"              /* gets Xt headers, too */
 +#include <xterm.h>
 
-#include <stdio.h>
-#include <ctype.h>
 #include <X11/Xatom.h>
-
 #include <X11/StringDefs.h>
 #include <X11/Shell.h>
 
 #include <X11/Xaw/Scrollbar.h>
 
-#include "data.h"
-#include "error.h"
-#include "menu.h"
-
-#include "xterm.h"
+#include <data.h>
+#include <error.h>
+#include <menu.h>
 
 /* Event handlers */
 
@@ -433,7 +424,7 @@
    screen->topline    : -Number of lines above the last screen->max_row+1 lines
 */
 
-       thumbTop = *topPercent * (screen->savedlines + screen->max_row+1);
 +       thumbTop = (int) (*topPercent * (screen->savedlines + screen->max_row+1));
         newTopLine = thumbTop - screen->savedlines;
        WindowScroll(screen, newTopLine);
 }
@@ -473,15 +464,8 @@
     if (!a || !b) return 0;
 
     while (1) {
-       ca = *a;
 +       ca = char2lower(*a);
         cb = *b;
-       if (isascii(ca) && isupper(ca)) {               /* lowercasify */
 -#ifdef _tolower
-           ca = _tolower (ca);
 -#else
-           ca = tolower (ca);
 -#endif
-       }
        if (ca != cb || ca == '\0') break;  /* if not eq else both nul */
        a++, b++;
     }
Index: tabs.c
--- xterm-84+/tabs.c    Fri Jun  5 16:23:53 1998
 +++ xterm-85/tabs.c     Sun Oct 11 17:38:56 1998
 @@ -28,15 +28,8 @@
  
 /* tabs.c */
 
-#ifdef HAVE_CONFIG_H
-#include <xtermcfg.h>
-#endif
 -
-#include "ptyx.h"
-
-#include "xterm.h"
-
-extern XtermWidget term;
+#include <xterm.h>
 +#include <data.h>
 
 /*
  * This file presumes 32bits/word.  This is somewhat of a crock, and should
Index: terminfo
--- xterm-84+/terminfo  Thu Oct  8 21:10:50 1998
 +++ xterm-85/terminfo   Sun Oct 11 21:33:21 1998
 @@ -227,7 +227,7 @@
         smso=\E[7m,
        smul=\E[1m,
        use=xterm,
-xtermm|monochrome xterm (X Window System),
 +xterm-mono|monochrome xterm (X Window System),
         colors@,
        ncv@,
        pairs@,
Index: testxmc.c
--- xterm-84+/testxmc.c Tue Apr 28 15:01:01 1998
 +++ xterm-85/testxmc.c  Sun Oct 11 20:40:20 1998
 @@ -84,15 +84,9 @@
   *     The xmcAttributes resource should also apply to alternate character
  *     sets and to color.
  */
-#ifdef HAVE_CONFIG_H
-#include <xtermcfg.h>
-#endif
  
-#include <X11/Xos.h>
-
-#include "ptyx.h"
-#include "data.h"
-#include "xterm.h"
+#include <xterm.h>
+#include <data.h>
 
 #define MARK_ON(a)  (my_attrs & a) != 0 && (term->flags & (whichone = a)) == 0
 #define MARK_OFF(a) (my_attrs & a) != 0 && (term->flags & (whichone = a)) != 0
@@ -105,7 +99,7 @@
        Char whichone = 0;
 
        if (glitch == 0) {
-               glitch = malloc(screen->xmc_glitch);
 +               glitch = (Char *)malloc(screen->xmc_glitch);
                 memset(glitch, XMC_GLITCH, screen->xmc_glitch);
        }
        switch (param) {
Index: trace.c
--- xterm-84+/trace.c   Sun Aug 30 06:43:03 1998
 +++ xterm-85/trace.c    Sun Oct 11 17:13:49 1998
 @@ -38,9 +38,9 @@
  #include <time.h>
 #include <unistd.h>
 #include <sys/types.h>
-#include "trace.h"
-
 #include <stdarg.h>
+
+#include <trace.h>
 
 char *trace_who = "parent";
 
Index: trace.h
--- xterm-84+/trace.h   Fri Jun  5 16:23:53 1998
 +++ xterm-85/trace.h    Sun Oct 11 17:21:00 1998
 @@ -33,8 +33,12 @@
  #ifndef        included_trace_h
 #define        included_trace_h
 
+#ifdef HAVE_CONFIG_H
+#include <xtermcfg.h>
+#endif
 +
 extern void    Trace ( char *, ... )
-#if __GNUC__
+#ifdef GCC_PRINTF
        __attribute__ ((format(printf,1,2)))
 #endif
        ;
Index: ttysvr.c
--- xterm-84+/ttysvr.c  Tue Jun  3 16:05:50 1997
 +++ xterm-85/ttysvr.c   Sun Oct 11 17:59:00 1998
 @@ -9,13 +9,9 @@
   *     Leendert van Doorn, 1992
  */
 
-#ifdef HAVE_CONFIG_H
-#include <xtermcfg.h>
-#endif
 -
-#include "ptyx.h"
-#include "data.h"
-#include "error.h"
+#include <ptyx.h>
+#include <data.h>
+#include <error.h>
 #include <stdio.h>
 
 extern char *ProgramName;
Index: util.c
--- xterm-84+/util.c    Wed Oct  7 20:54:07 1998
 +++ xterm-85/util.c     Sun Oct 11 19:04:10 1998
 @@ -28,18 +28,13 @@
  
 /* util.c */
 
-#ifdef HAVE_CONFIG_H
-#include <xtermcfg.h>
-#endif
 +#include <xterm.h>
 
-#include <stdio.h>
+#include <data.h>
+#include <error.h>
+#include <menu.h>
 
-#include "ptyx.h"
-#include "data.h"
-#include "error.h"
-#include "menu.h"
-
-#include "xterm.h"
+#include <ctype.h>
 
 extern Bool waiting_for_initial_map;
 
@@ -1643,3 +1638,15 @@
 }
 #endif
 #endif
+
+int char2lower(int ch)
+{
 +       if (isascii(ch) && isupper(ch)) {               /* lowercasify */
 +#ifdef _tolower
+               ch = _tolower (ch);
 +#else
+               ch = tolower (ch);
 +#endif
+       }
+       return ch;
 +}
Index: version.h
--- xterm-84+/version.h Thu Oct  8 21:20:36 1998
 +++ xterm-85/version.h  Sun Oct 11 21:34:02 1998
 @@ -6,4 +6,4 @@
   * version of xterm has been built.  The number in parentheses is my patch
  * number (T.Dickey).
  */
-#define XTERM_VERSION "XFree86 3.9Ni(84)"
 +#define XTERM_VERSION "XFree86 3.9Nj(85)"
 Index: xterm.h
--- xterm-84+/xterm.h   Sun Jul  5 16:05:39 1998
 +++ xterm-85/xterm.h    Sun Oct 11 20:47:49 1998
 @@ -8,6 +8,10 @@
  #ifndef        included_xterm_h
 #define        included_xterm_h
 
+#ifdef HAVE_CONFIG_H
+#include <xtermcfg.h>
+#endif
 +
 #ifndef GCC_UNUSED
 #define GCC_UNUSED /* nothing */
 #endif
@@ -76,7 +80,12 @@
 
 /***====================================================================***/
 
-#include "proto.h"
+#include <proto.h>
+#include <ptyx.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /* Tekproc.c */
 extern int TekInit (void);
@@ -233,7 +242,7 @@
 /* print.c */
 extern int xtermPrinterControl (int chr);
 extern void xtermAutoPrint (int chr);
-extern void xtermMediaControl (int param, int private);
 +extern void xtermMediaControl (int param, int private_seq);
  extern void xtermPrintScreen (void);
 
 /* screen.c */
@@ -277,6 +286,7 @@
 extern GC updatedXtermGC (TScreen *screen, int flags, int fg_bg, Bool hilite);
 extern int AddToRefresh (TScreen *screen);
 extern int HandleExposure (TScreen *screen, XEvent *event);
+extern int char2lower(int ch);
 extern int drawXtermText (TScreen *screen, unsigned flags, GC gc, int x, int y, int chrset, Char *text, int len);
 extern void ChangeColors (XtermWidget tw, ScrnColors *pNew);
 extern void ClearRight (TScreen *screen, int n);
@@ -337,6 +347,10 @@
 extern void Mark_XMC (TScreen *screen, int param);
 extern void Jump_XMC (TScreen *screen);
 extern void Resolve_XMC (TScreen *screen);
+#endif
+
+#ifdef __cplusplus
+       }
 #endif
 
 #endif /* included_xterm_h */
Index: xterm.log.html
--- xterm-84+/xterm.log.html    Fri Oct  9 06:41:23 1998
 +++ xterm-85/xterm.log.html     Mon Oct 12 06:16:49 1998
 @@ -41,6 +41,7 @@
  xc/programs/Xserver/hw/xfree86).
 
 <UL>
+<LI><A HREF="#xterm_85">Patch #85 - 1998/10/12 - XFree86 3.9Nj and 3.3.2e</A>
  <LI><A HREF="#xterm_84">Patch #84 - 1998/10/9 - XFree86 3.9Ni and 3.3.2e</A>
 <LI><A HREF="#sync_83">Resync #83 - 1998/10/7 - XFree86 3.3.2e</A>
 <LI><A HREF="#xterm_83">Patch #83 - 1998/8/25 - XFree86 3.9Nb</A>
@@ -127,6 +128,27 @@
 <LI><A HREF="#xterm_02">Patch #2 - 1996/1/7</A>
 <LI><A HREF="#xterm_01">Patch #1 - 1996/1/6</A>
 </UL>
+
+<H1><A NAME="xterm_85">Patch #85 - 1998/10/12 - XFree86 3.9Nj and 3.3.2e</A></H1>
 +Some cleanup (I noticed the pixel droppings a few months ago after getting a
 +new 17" monitor):
+<ul>
+       <li>split-out the functions that load/reload fonts for xterm as new
 +         file fontutils.c to extend them to support automatic loading of
 +         bold font corresponding to the normal font.  Adapted logic from
 +         EMU 1.3 for this purpose.  This fixes most occurrences of pixel
 +         droppings from bold characters.
 +
+       <li>modified by renaming variables and adding casts to permit compile
 +         with g++.
 +
+       <li>modify headers so they can all be compiled without order
 +         dependencies, and use bracketed rather than quoting includes to allow
 +         compile from separate directory.
 +
+       <li>renamed xtermm terminfo entry to xterm-mono, to avoid conflict with
 +         Solaris entry now in ncurses.
 +</ul>
 
 <H1><A NAME="xterm_84">Patch #84 - 1998/10/9 - XFree86 3.9Ni</A> and 3.3.2e</H1>
 Several small fixes and enhancements, including a patch from
Index: xtermcfg.hin
--- xterm-84+/xtermcfg.hin      Fri Jun  5 16:23:53 1998
 +++ xterm-85/xtermcfg.hin       Sun Oct 11 17:18:52 1998
 @@ -70,6 +70,7 @@
  #undef size_t          /* AC_TYPE_SIZE_T */
 #undef time_t          /* AC_CHECK_TYPE(time_t, long) */
 
+#undef GCC_PRINTF
 #undef GCC_UNUSED
 
 #if USE_OK_BCOPY