xterm-125.patch.txt

# ------------------------------------------------------------------------------
#  Makefile.in                  |    5 
#  Tekproc.c                    |   96 +++++
#  button.c                     |   43 +-
#  charproc.c                   |  296 ++++++++++++----
#  charsets.c                   |    4 
#  ctlseqs.ms                   |    4 
#  cursor.c                     |    4 
#  data.c                       |   15 
#  data.h                       |   40 +-
#  doublechr.c                  |   18 -
#  fontutils.c                  |   42 +-
#  input.c                      |   99 ++---
#  main.c                       |  147 ++++----
#  menu.c                       |   72 +---
#  menu.h                       |   16 
#  misc.c                       |   84 +++-
#  os2main.c                    |   27 -
#  print.c                      |   61 ++-
#  ptydata.c                    |   10 
#  ptyx.h                       |   14 
#  screen.c                     |   20 -
#  scrollbar.c                  |   35 +
#  tabs.c                       |   30 +
#  termcap                      |    2 
#  terminfo                     |    1 
#  testxmc.c                    |    6 
#  trace.h                      |    2 
#  util.c                       |   60 +++
#  version.h                    |    4 
#  xterm-125/AAA_README_VMS.txt |   45 ++
#  xterm-125/MANIFEST           |  102 +++++
#  xterm-125/link_axp.com       |  106 +++++
#  xterm-125/make.com           |   88 ++++
#  xterm-125/vms.c              |  725 +++++++++++++++++++++++++++++++++++++++++
#  xterm-125/vms.h              |   39 ++
#  xterm-125/xterm.dat          |  153 ++++++++
#  xterm-125/xterm_axp.opt      |   28 +
#  xterm.h                      |   34 +
#  xterm.log.html               |   36 ++
#  xterm.man                    |    3 
#  xtermcfg.hin                 |    1 
#  41 files changed, 2204 insertions, 413 deletions
# ------------------------------------------------------------------------------
Index: AAA_README_VMS.txt
--- /dev/null   Sun Jul 17 19:46:18 1994
+++ xterm-125/AAA_README_VMS.txt        Sat Jan 29 15:47:10 2000
@@ -0,0 +1,45 @@
+http://www.clark.net/pub/dickey/xterm/xterm.html
+
+Downloaded 1.22 variant (current Linux version) on 18-JAN-2000.
+
+Port stalled for a few days because OpenVMS X11 lacks XtGravity.
+
+X11KIT shared libraries almost work, but missing _XA_ symbols
+for some reason.  
+
+Copied X11KIT [.xaw3d] and [.xmu] into [.lib], put together simplified
+build procedures.  Made a few mods.  Merged in some changes from
+Patrick Young.  Now these build mostly ok except for tons of bcopy
+related warnings and problems with LAYOUT.C. 
+
+Merged changes from Xterm021 into here.
+
+Made changes here and there to get it all to work.
+
+25-JAN-2000, more or less done.  Logging doesn't work but PRINT
+does, as does regular VT emulation, TEK emulation, 80 and 132 wide
+modes.  The resource file needs work.  Cleaned up a really nasty problem 
+with infinite loops on copy/paste in button.c (see tt_pasting).
+
+To build this, if you have DECC, DW 1.2-5 and VMS 7.2-1 (the latter
+probably doesn't matter) do:
+
+$ @make
+
+in the top directory.  Expect a bunch of I and W warnings, but nothing 
+worse.  Then define a foreign symbol for xterm for the resulting .exe.
+
+26-JAN-2000.  Enabled logging.  When this is turned on from the menu
+it creates a new file SYS$SCRATCH:XTERM_LOG.TXT and writes everything that
+goes to the screen into it.  This may slow down output a bit as each block
+of data read must be copied to disk.  The log file has RMS format stream-lf
+and typically has a <CR> at the end of each line. 
+
+27-JAN-2000.  Discovered a bug when doing an X11 paste into an EDT session,
+had to add a tt_start_read() in button.c after the paste to reenable the
+read AST.  Rearranged code in VMS.C to make the compiler happy and 
+eliminate warnings.
+
+David Mathog
+mathog@seqaxp.bio.caltech.edu
+Manager, sequence analysis facility, biology division, Caltech 
Index: MANIFEST
--- /dev/null   Sun Jul 17 19:46:18 1994
+++ xterm-125/MANIFEST  Mon Jan 31 20:35:21 2000
@@ -0,0 +1,102 @@
+MANIFEST for xterm-125, version xterm-125
+--------------------------------------------------------------------------------
+MANIFEST                        this file
+256colres.h                     resource-definitions for 256-color mode
+256colres.pl                    script to generate 256colres.h
+88colres.h                      resource definitions for 88-color mode
+88colres.pl                     script to generate 88colres.h
+AAA_README_VMS.txt              note for VMS port of 'xterm'
+INSTALL                         configure script: options and related install instructions
+Imakefile                       imake template for Makefile
+Makefile.in                     configure script template for Makefile
+README                          overview & caveats for 'xterm'
+README.os390                    overview for os390 (EBCDIC) port of 'xterm'
+TekPrsTbl.c                     Tek4014 parser state tables
+Tekparse.def                    template for generating Tekparse.h
+Tekparse.h                      Tek4014 parser-state definitions
+Tekproc.c                       Tek4014 parser-state functions
+Tests                           Useful tests for xterm-developers
+VTPrsTbl.c                      VT100 parser state tables
+VTparse.def                     template for generating VTparse.h
+VTparse.h                       VT100 parser-state definitions
+XTerm-col.ad                    color resource definitions for XTerm class
+XTerm.ad                        resource definitions for XTerm class
+aclocal.m4                      configure script: custom macros
+button.c                        mouse button and selection processing
+charproc.c                      VT100 parser functions
+charsets.c                      module to translate character-sets
+config.guess                    configure script: guess the system type
+config.sub                      configure script: validate system type
+configure.in                    template for generating configure script
+configure                       Configuration script for UNIX
+ctlseqs.ms                      documentation: Xterm Control Sequences
+cursor.c                        VT100 low-level cursor movement
+data.c                          global data declarations
+data.h                          global data external-definitions
+doublechr.c                     VT100 double-size character support
+error.h                         error-code definitions for 'xterm'
+fontutils.c                     xterm functions for (re)loading fonts
+fontutils.h                     interface of fontutils.c
+input.c                         VT100 key-symbol and function-key translation
+install.sh                      configure script: fallback install script
+keysym2ucs.c                    lookup-table for UTF-8 to keysyms
+keysym2ucs.h                    interface of keysym2ucs.c
+link_axp.com                    build-script for VMS port of xterm
+main.c                          main program of 'xterm'
+main.h                          default definitions for 'xterm'
+make.com                        build-script for VMS port of 'xterm'
+menu.c                          popup/pulldown menus for 'xterm'
+menu.h                          interface of menu.c
+misc.c                          miscellaneous utility functions for 'xterm'
+mkdirs.sh                       configure script: make directories for install process
+os2main.c                       main program for OS/2 EMX port of 'xterm'
+print.c                         VT100+ print support functions
+proto.h                         macros to simplify function prototypes
+ptydata.c                       functions to manipulate data read from pty
+ptyx.h                          structure-definitions for 'xterm'
+resize.c                        program to compute/modify xterm's window size
+resize.man                      manual page for 'resize'
+screen.c                        VT100 screen update functions
+scrollbar.c                     VT100 scrollbar support functions
+sinstall.sh                     install setuid if existing program was
+tabs.c                          VT100 tabstop support-functions
+termcap                         termcap entries for 'xterm'
+terminfo                        terminfo entries for 'xterm'
+testxmc.c                       testing: xmc/magic-cookies
+trace.c                         debugging trace functions for 'xterm'
+trace.h                         interface of trace.c
+ttysvr.c                        simple tty server for AMOEBA port of 'xterm'
+util.c                          miscellaneous utility functions for 'xterm'
+version.h                       version of xterm
+vms.c                           VMS version of xterm's spawn(), etc.
+vms.h                           system headers and definitions for vms.c
+xcharmouse.h                    Jason Bacon's mouse-defs, cleaned up a little
+xterm.dat                       application defaults for VMS port of 'xterm'
+xterm.h                         common includes, definitions and prototypes for 'xterm'
+xterm.man                       manual page for 'xterm'
+xterm_axp.opt                   linker options file for VMS port of 'xterm'
+xtermcfg.hin                    configure script: template for xtermcfg.h
+tektests                        subdirectory
+tektests/aitest.tek             tek4014 demo: draw a globe
+tektests/dmerc.tek              tek4014 demo: draws a Mercator projection with orbit
+tektests/fotest.tek             tek4014 demo: draw a scatterplot on log scale
+tektests/imtest.tek             tek4014 demo: draw a test pattern
+tektests/imtesth.tek            tek4014 demo: draw a test pattern
+tektests/ocpred.tek             tek4014 demo: an occultation prediction
+tektests/usmap.tek              tek4014 demo: a US map
+unicode                         subdirectory
+unicode/README                  description of files in ./unicode
+unicode/convmap.pl              perl script for generating the lookup table for UTF-8 to keysym
+unicode/keysym.map              keysym mapping from UTF-8
+vttests                         subdirectory
+vttests/16colors.sh             test-script to show 16-colors
+vttests/256colors.pl            script to illustrate 256-colors
+vttests/256colors2.pl           fancy test-script for 256-colors
+vttests/88colors.pl             sample script showing 88-colors
+vttests/88colors2.pl            sample script showing 88-colors
+vttests/8colors.sh              test-script to illustrate 8-colors
+vttests/doublechars.sh          test script to demonstrate doublesize chars
+vttests/dynamic.sh              script to illustrate the dynamic colors control sequence
+vttests/fonts.sh                script to demonstrate font-switching sequences
+vttests/resize.sh               script to demonstrate resizing
+vttests/title.sh                test-script to show title of xterm in action
Index: Makefile.in
--- xterm-124+/Makefile.in      Thu Oct 14 05:57:38 1999
+++ xterm-125/Makefile.in       Sun Jan 30 12:15:18 2000
@@ -169,3 +169,8 @@
        $(SHELL) ${srcdir}/mkdirs.sh $@
 
 ALWAYS:
+
+depend : $(TABLES)
+       makedepend -- $(CPPFLAGS) -- $(SRCS)
+
+# DO NOT DELETE THIS LINE -- make depend depends on it.
Index: Tekproc.c
--- xterm-124+/Tekproc.c        Sun Aug 22 14:20:13 1999
+++ xterm-125/Tekproc.c Sun Jan 30 14:42:37 2000
@@ -180,7 +180,7 @@
     { "insert-seven-bit",      HandleKeyPressed },
     { "insert-eight-bit",      HandleEightBitKeyPressed },
     { "gin-press",             HandleGINInput },
-    { "secure",                HandleSecure },
+    { "secure",                        HandleSecure },
     { "create-menu",           HandleCreateMenu },
     { "popup-menu",            HandlePopupMenu },
     /* menu actions */
@@ -226,7 +226,21 @@
 #define GIN_TERM_CR    1
 #define GIN_TERM_EOT   2
 
+#ifdef VMS
+#define DFT_FONT_SMALL "FIXED"
+#else
+#define DFT_FONT_SMALL "6x10"
+#endif
+
 static XtResource resources[] = {
+#ifdef VMS
+    {XtNbackground, XtCBackground, XtRPixel, sizeof(Pixel),
+       XtOffset(TekWidget, core.background_pixel),
+       XtRString, "White"},
+    {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
+       XtOffset(TekWidget, Tforeground),
+       XtRString, "Black"},
+#endif
     {XtNwidth, XtCWidth, XtRDimension, sizeof(Dimension),
         XtOffsetOf(CoreRec, core.width), XtRDimension, (caddr_t)&defOne},
     {XtNheight, XtCHeight, XtRDimension, sizeof(Dimension),
@@ -242,7 +256,7 @@
        XtRString, "8x13"},
     {"fontSmall", XtCFont, XtRFontStruct, sizeof(XFontStruct *),
        XtOffsetOf(TekWidgetRec, tek.Tfont[TEK_FONT_SMALL]),
-       XtRString, "6x10"},
+       XtRString, DFT_FONT_SMALL},
     {"initialFont", "InitialFont", XtRString, sizeof(char *),
        XtOffsetOf(TekWidgetRec, tek.initial_font),
        XtRString, "large"},
@@ -387,7 +401,7 @@
            } else
 #endif
              nextstate = Tparsestate[c];
-           TRACE(("parse %d -> %d\n", c, nextstate))
+           TRACE(("parse %d -> %d\n", c, nextstate));
 
            switch(nextstate) {
                 case CASE_REPORT:
@@ -716,7 +730,11 @@
 
 static int rcnt;
 static char *rptr;
+#ifdef VMS
+static int Tselect_mask;
+#else  /* VMS */
 static fd_set Tselect_mask;
+#endif /* VMS */
 
 static int Tinput(void)
 {
@@ -743,7 +761,11 @@
        if(Tbuffer->cnt-- <= 0) {
                if(nplot > 0)   /* flush line Tbuffer */
                        TekFlush();
+#ifdef VMS
+               Tselect_mask = pty_mask;        /* force a read */
+#else /* VMS */
                XFD_COPYSET (&pty_mask, &Tselect_mask);
+#endif /* VMS */
                for( ; ; ) {
 #ifdef CRAY
                        struct timeval crocktimeout;
@@ -753,18 +775,43 @@
                                       &Tselect_mask, NULL, NULL,
                                       &crocktimeout);
 #endif
+#ifdef VMS
+                       if(Tselect_mask & pty_mask) {
+#ifdef ALLOWLOGGING
+                          if(screen->logging)
+                                  FlushLog(screen);
+#endif
+                          if (read_queue.flink != 0) {
+                                  Tbuffer->cnt = tt_read(Tbuffer->ptr = Tbuffer->buf);
+                                  if(Tbuffer->cnt == 0) {
+                                          Panic("input: read returned zero\n", 0);
+                                  }
+                                  else { break; }
+                          }
+                          else { sys$hiber(); }
+                       }
+#else  /* VMS */
                        if (getPtyData(screen, &Tselect_mask, Tbuffer)) {
                            break;
                        }
+#endif /* VMS */
                        if (Ttoggled && curstate == Talptable) {
                                TCursorToggle(TOGGLE);
                                Ttoggled = FALSE;
                        }
 #ifndef AMOEBA
                        if(XtAppPending(app_con) & XtIMXEvent) {
+#ifdef VMS
+                               Tselect_mask = X_mask;
+#else /* VMS */
                                XFD_COPYSET (&X_mask, &Tselect_mask);
+#endif /* VMS */
                        } else {
                                XFlush(screen->display);
+#ifdef VMS
+                               Tselect_mask = Select_mask;
+
+#else /* VMS */
                                XFD_COPYSET (&Select_mask, &Tselect_mask);
                                if((i = Select(max_plus1,
                                               &Tselect_mask, NULL, NULL,
@@ -773,8 +820,9 @@
                                                SysError(ERROR_TSELECT);
                                        continue;
                                }
+#endif /* VMS */
                        }
-#else
+#else /* AMOEBA */
                        XFlush(screen->display);
                        i = _X11TransAmSelect(ConnectionNumber(screen->display),
                                              1);
@@ -793,11 +841,19 @@
                        if (cb_full(screen->tty_outq) <= 0)
                                SleepMainThread();
 #endif /* AMOEBA */
+#ifdef VMS
+                       if(Tselect_mask & X_mask) {
+                               xevents();
+                               if(Tbuffer->cnt > 0)
+                                       goto again;
+                       }
+#else /* VMS */
                        if(FD_ISSET (ConnectionNumber (screen->display), &Tselect_mask)) {
                                xevents();
                                if(Tbuffer->cnt > 0)
                                        goto again;
                        }
+#endif /* VMS */
                }
                Tbuffer->cnt--;
                if (!Ttoggled && curstate == Talptable) {
@@ -1170,8 +1226,11 @@
        cplot[len++] = '\r';
     if (screen->gin_terminator == GIN_TERM_EOT)
        cplot[len++] = '\004';
-
+#ifdef VMS
+    tt_write(cplot+adj, len-adj);
+#else /* VMS */
     v_write(screen->respond, cplot+adj, len-adj);
+#endif /* VMS */
 }
 
 void
@@ -1699,9 +1758,15 @@
 
        chldfunc = signal(SIGCHLD, SIG_DFL);
 #endif
+#ifdef VMS
+       register int tekcopyfd;
+       register TekLink *Tp;
+       char initbuf[5];
+#endif /* VMS */
 
        time(&l);
        tp = localtime(&l);
+       /* VMS needs alternate format??? DRM */
        sprintf(buf, "COPY%d-%02d-%02d.%02d:%02d:%02d", tp->tm_year + 1900,
         tp->tm_mon + 1, tp->tm_mday, tp->tm_hour, tp->tm_min, tp->tm_sec);
        if(access(buf, F_OK) >= 0) {    /* file exists */
@@ -1709,6 +1774,24 @@
                        Bell(XkbBI_MinorError,0);
                        return;
                }
+#ifdef VMS
+
+       if((tekcopyfd = open(buf, O_WRONLY | O_CREAT | O_TRUNC, 0644)) < 0) {
+               Bell(XkbBI_MinorError,0);
+               return;
+       }
+       chown(buf, screen->uid, screen->gid);
+       sprintf(initbuf, "%c%c%c%c",
+           ESC, screen->page.fontsize + '8',
+           ESC, screen->page.linetype + '`');
+       write(tekcopyfd, initbuf, 4);
+       Tp = &Tek0;
+       do {
+           write(tekcopyfd, (char *)Tp->data, Tp->count);
+           Tp = Tp->next;
+       } while(Tp);
+       close(tekcopyfd);
+#else /* VMS */
        } else if(access(".", W_OK) < 0) {      /* can't write in directory */
                Bell(XkbBI_MinorError,0);
                return;
@@ -1730,7 +1813,7 @@
            if (tekcopyfd < 0)
                _exit(1);
            sprintf(initbuf, "%c%c%c%c",
-               ESC, screen->page.fontsize + '8',
+               ESC, screen->page.fontsize + '8',
                ESC, screen->page.linetype + '`');
            write(tekcopyfd, initbuf, 4);
            Tp = &Tek0;
@@ -1759,5 +1842,6 @@
                    Cleanup(0);
            while ( (waited=nonblocking_wait()) > 0);
 #endif
+#endif /* VMS */
        }
 }
Index: button.c
--- xterm-124+/button.c Thu Dec 30 05:01:00 1999
+++ xterm-125/button.c  Sun Jan 30 14:25:05 2000
@@ -1,6 +1,6 @@
 /* $TOG: button.c /main/76 1997/07/30 16:56:19 kaleb $ */
 /*
- * Copyright 1999 by Thomas E. Dickey <dickey@clark.net>
+ * Copyright 1999-2000 by Thomas E. Dickey <dickey@clark.net>
  *
  *                         All Rights Reserved
  *
@@ -99,7 +99,9 @@
 
 #define        Coordinate(r,c)         ((r) * (term->screen.max_col+1) + (c))
 
+#if OPT_DEC_LOCATOR
 static ANSI reply;
+#endif
 
 /* Selection/extension variables */
 
@@ -802,7 +804,7 @@
        if ((*p & 0x80) == 0) {
            *q++ = *p++;
        } else if ((*p & 0x7C) == 0x40 && p < s + len - 1) {
-           *q++ = (*p & 0x03) << 6 | (p[1] & 0x3F);
+           *q++ = ((*p & 0x03) << 6) | (p[1] & 0x3F);
            p += 2;
        } else if ((*p & 0x60) == 0x40) {
            *q++ = '#';
@@ -854,11 +856,11 @@
            codepoint = *p & 0x7F;
            size = 1;
        } else if ((*p & 0x60) == 0x40 && p < s + len - 1) {
-           codepoint = (p[0] & 0x1F) << 6 | (p[1] & 0x3F);
+           codepoint = ((p[0] & 0x1F) << 6) | (p[1] & 0x3F);
            size = 2;
        } else if ((*p & 0x70) == 0x60 && p < s + len - 2) {
-           codepoint = (p[0] & 0x0F) << 12
-                     | (p[1] & 0x3F) << 6
+           codepoint = ((p[0] & 0x0F) << 12)
+                     | ((p[1] & 0x3F) << 6)
                      | (p[2] & 0x3F);
            size = 3;
        } else if ((*p & 0x78) == 0x70 && p < s + len - 3) {
@@ -928,7 +930,7 @@
       case XA_CUT_BUFFER7: cutbuffer = 7; break;
       default:            cutbuffer = -1;
     }
-    TRACE(("Cutbuffer: %d, utf8_failed: %d\n", cutbuffer, utf8_failed))
+    TRACE(("Cutbuffer: %d, utf8_failed: %d\n", cutbuffer, utf8_failed));
     if (cutbuffer >= 0) {
        int inbytes;
        unsigned long nbytes;
@@ -1043,18 +1045,39 @@
     /* Doing this one line at a time may no longer be necessary
        because v_write has been re-written. */
 
+  /* on VMS version if tt_pasting isn't set to TRUE then qio
+     reads aren't blocked and an infinite loop is entered, where
+     the pasted text shows up as new input, goes in again, shows
+     up again, ad nauseum. */
+
+#ifdef VMS
+    tt_pasting = TRUE;
+#endif
     end = &buf[len];
     lag = buf;
     for (cp = buf; cp != end; cp++)
     {
        if (*cp == '\n') {
            *cp = '\r';
+#ifdef VMS
+           tt_write(lag, cp - lag + 1);
+#else /* VMS */
            v_write(pty, lag, cp - lag + 1);
+#endif /* VMS */
            lag = cp + 1;
        }
     }
     if (lag != end)
+#ifdef VMS
+       tt_write(lag, end - lag);
+#else /* VMS */
        v_write(pty, lag, end - lag);
+#endif /* VMS */
+
+#ifdef VMS
+    tt_pasting = FALSE;
+    tt_start_read();  /* reenable reads or a character may be lost */
+#endif
 
     if_OPT_WIDE_CHARS(screen,{
        XtFree((char*)buf);
@@ -1195,7 +1218,7 @@
 {
        TScreen *screen = &term->screen;
 
-       TRACE(("StartSelect row=%d, col=%d\n", startrow, startcol))
+       TRACE(("StartSelect row=%d, col=%d\n", startrow, startcol));
        if (screen->cursor_state)
            HideCursor ();
        if (numberOfClicks == 1) {
@@ -1368,7 +1391,7 @@
 {
        int coord = Coordinate(row, col);
 
-       TRACE(("ExtendExtend row=%d, col=%d\n", row, col))
+       TRACE(("ExtendExtend row=%d, col=%d\n", row, col));
        if (eventMode == LEFTEXTENSION
         && (coord + (selectUnit!=SELECTCHAR)) > Coordinate(endSRow, endSCol)) {
                /* Whoops, he's changed his mind.  Do RIGHTEXTENSION */
@@ -1904,7 +1927,7 @@
     }
     *lp = '\0';                        /* make sure we have end marked */
 
-    TRACE(("Salted TEXT:%.*s\n", (char *)lp - line, line))
+    TRACE(("Salted TEXT:%.*s\n", (char *)lp - line, line));
     screen->selection_length = ((char *)lp - line);
     _OwnSelection(term, params, num_params);
 }
@@ -2377,7 +2400,7 @@
        line[count++] = ' ' + row + 1;
 
        TRACE(("mouse at %d,%d button+mask = %#x\n", row, col,
-               (screen->control_eight_bits) ? line[2] : line[3]))
+               (screen->control_eight_bits) ? line[2] : line[3]));
 
        /* Transmit key sequence to process running under xterm */
        v_write(pty, line, count);
Index: charproc.c
--- xterm-124+/charproc.c       Tue Jan 25 01:45:01 2000
+++ xterm-125/charproc.c        Mon Jan 31 19:22:53 2000
@@ -272,20 +272,20 @@
     { "create-menu",           HandleCreateMenu },
     { "dired-button",          DiredButton },
     { "hard-reset",            HandleHardReset },
-    { "ignore",                HandleIgnore },
-    { "insert",                HandleKeyPressed },  /* alias for insert-seven-bit */
+    { "ignore",                        HandleIgnore },
+    { "insert",                        HandleKeyPressed },  /* alias for insert-seven-bit */
     { "insert-eight-bit",      HandleEightBitKeyPressed },
     { "insert-selection",      HandleInsertSelection },
     { "insert-seven-bit",      HandleKeyPressed },
     { "interpret",             HandleInterpret },
-    { "keymap",                HandleKeymapChange },
+    { "keymap",                        HandleKeymapChange },
     { "popup-menu",            HandlePopupMenu },
-    { "print",                         HandlePrint },
+    { "print",                 HandlePrint },
     { "quit",                  HandleQuit },
-    { "redraw",                HandleRedraw },
+    { "redraw",                        HandleRedraw },
     { "scroll-back",           HandleScrollBack },
     { "scroll-forw",           HandleScrollForward },
-    { "secure",                HandleSecure },
+    { "secure",                        HandleSecure },
     { "select-cursor-end",     HandleKeyboardSelectEnd },
     { "select-cursor-start",   HandleKeyboardSelectStart },
     { "select-end",            HandleSelectEnd },
@@ -301,9 +301,9 @@
     { "set-autolinefeed",      HandleAutoLineFeed },
     { "set-autowrap",          HandleAutoWrap },
     { "set-backarrow",         HandleBackarrow },
-    { "set-cursesemul",        HandleCursesEmul },
-    { "set-jumpscroll",        HandleJumpscroll },
-    { "set-marginbell",        HandleMarginBell },
+    { "set-cursesemul",                HandleCursesEmul },
+    { "set-jumpscroll",                HandleJumpscroll },
+    { "set-marginbell",                HandleMarginBell },
     { "set-reverse-video",     HandleReverseVideo },
     { "set-reversewrap",       HandleReverseWrap },
     { "set-scroll-on-key",     HandleScrollKey },
@@ -317,7 +317,7 @@
     { "soft-reset",            HandleSoftReset },
     { "start-cursor-extend",   HandleKeyboardStartExtend },
     { "start-extend",          HandleStartExtend },
-    { "string",                HandleStringEvent },
+    { "string",                        HandleStringEvent },
     { "vi-button",             ViButton },
     { "visual-bell",           HandleVisualBell },
 #ifdef ALLOWLOGGING
@@ -350,7 +350,7 @@
 #endif
 #if OPT_TEK4014
     { "set-terminal-type",     HandleSetTerminalType },
-    { "set-visibility",        HandleVisibility },
+    { "set-visibility",                HandleVisibility },
     { "set-tek-text",          HandleSetTekText },
     { "tek-page",              HandleTekPage },
     { "tek-reset",             HandleTekReset },
@@ -508,9 +508,14 @@
 {XtNprinterControlMode, XtCPrinterControlMode, XtRInt, sizeof(int),
        XtOffsetOf(XtermWidgetRec, screen.printer_controlmode),
        XtRInt, (XtPointer) &defaultZERO},
+#ifdef VMS
+#define OS_DEPENDENT_PRINT_COMMAND "print/delete/noflag"
+#else  /* VMS */
+#define OS_DEPENDENT_PRINT_COMMAND "lpr"
+#endif /* VMS */
 {XtNprinterCommand,XtCPrinterCommand, XtRString, sizeof(String),
        XtOffsetOf(XtermWidgetRec, screen.printer_command),
-       XtRString, (XtPointer) "lpr"},
+       XtRString, (XtPointer) OS_DEPENDENT_PRINT_COMMAND},
 {XtNprinterExtent,XtCPrinterExtent, XtRBoolean, sizeof(Boolean),
        XtOffsetOf(XtermWidgetRec, screen.printer_extent),
        XtRBoolean, (XtPointer) &defaultFALSE},
@@ -774,7 +779,12 @@
 static void VTInitI18N (void);
 #endif
 
-static WidgetClassRec xtermClassRec = {
+#ifdef VMS
+globaldef {"xtermclassrec"} noshare
+#else
+static
+#endif /* VMS */
+WidgetClassRec xtermClassRec = {
   {
 /* core_class fields */
     /* superclass        */    (WidgetClass) &widgetClassRec,
@@ -812,6 +822,9 @@
   }
 };
 
+#ifdef VMS
+globaldef {"xtermwidgetclass"} noshare
+#endif /* VMS */
 WidgetClass xtermWidgetClass = (WidgetClass)&xtermClassRec;
 
 #if OPT_ISO_COLORS
@@ -902,6 +915,7 @@
         */
 #if OPT_PC_COLORS /* XXXJTL should be settable at runtime (resource or OSC?) */
        if (term->screen.boldColors
+        && (!term->sgr_extended)
         && (fg >= 0)
         && (fg < 8)
         && (term->flags & BOLD))
@@ -915,6 +929,7 @@
 reset_SGR_Foreground(void)
 {
        term->sgr_foreground = -1;
+       term->sgr_extended = 0;
        setExtendedFG();
 }
 
@@ -1046,7 +1061,7 @@
                } else if (parsestate == sos_table) {
                    c &= 0xffff;
                    if (c > 255) {
-                       TRACE(("Found code > 255 while in SOS state: %04X\n", c))
+                       TRACE(("Found code > 255 while in SOS state: %04X\n", c));
                        c = '?';
                    }
                } else {
@@ -1135,11 +1150,11 @@
                string_area[string_used++] = c;
            } else if (parsestate != esc_table) {
                /* if we were accumulating, we're not any more */
-               string_mode = 0;
+               string_mode = 0;
                string_used = 0;
            }
 
-           TRACE(("parse %04X -> %d\n", c, nextstate))
+           TRACE(("parse %04X -> %d\n", c, nextstate));
 
            switch (nextstate) {
                 case CASE_PRINT:
@@ -1213,7 +1228,7 @@
                         * form feed, line feed, vertical tab
                         */
                        xtermAutoPrint(c);
-                       Index(screen, 1);
+                       xtermIndex(screen, 1);
                        if (term->flags & LINEFEED)
                                CarriageReturn(screen);
                        do_xevents();
@@ -1512,7 +1527,7 @@
                                reply.a_param[count++] = 2; /* printer */
                                reply.a_param[count++] = 6; /* selective-erase */
 #if OPT_SUNPC_KBD
-                               if (sunKeyboard)
+                               if (term->keyboard.type == keyboardIsVT220)
 #endif
                                reply.a_param[count++] = 8; /* user-defined-keys */
                                reply.a_param[count++] = 9; /* national replacement charsets */
@@ -1660,13 +1675,14 @@
                                 case 37:
                                        if_OPT_ISO_COLORS(screen,{
                                          term->sgr_foreground = (param[row] - 30);
+                                         term->sgr_extended = 0;
                                          setExtendedFG();
                                        })
                                        break;
                                 case 38:
                                        /* This is more complicated than I'd
                                           like, but it should properly eat all
-                                          the parameters for unsupported modes
+                                          the parameters for unsupported modes
                                        */
                                        if_OPT_ISO_COLORS(screen,{
                                                row++;
@@ -1677,6 +1693,7 @@
                                                                if (row < nparam &&
                                                                    param[row] < NUM_ANSI_COLORS) {
                                                                        term->sgr_foreground = param[row];
+                                                                       term->sgr_extended = 1;
                                                                        setExtendedFG();
                                                                }
                                                                break;
@@ -1738,6 +1755,7 @@
                                 case 97:
                                        if_OPT_AIX_COLORS(screen,{
                                          term->sgr_foreground = (param[row] - 90 + 8);
+                                         term->sgr_extended = 0;
                                          setExtendedFG();
                                        })
                                        break;
@@ -1928,7 +1946,7 @@
                        break;
 
                 case CASE_GSETS:
-                       TRACE(("CASE_GSETS(%d) = '%c'\n", scstype, c))
+                       TRACE(("CASE_GSETS(%d) = '%c'\n", scstype, c));
                        screen->gsets[scstype] = c;
                        parsestate = groundtable;
                        break;
@@ -1962,7 +1980,7 @@
 
                 case CASE_CSI_QUOTE_STATE:
                        parsestate = csi_quo_table;
-                       break;
+                       break;
 
                        /* the ANSI conformance levels are noted in the
                         * vt400 user's manual (I assume they're the non-DEC
@@ -1998,7 +2016,7 @@
                                }
                        }
                        parsestate = groundtable;
-                       break;
+                       break;
 
                 case CASE_DECSCA:
                        screen->protected_mode = DEC_PROTECT;
@@ -2007,19 +2025,19 @@
                        else if (param[0] == 1)
                                term->flags |= PROTECTED;
                        parsestate = groundtable;
-                       break;
+                       break;
 
                 case CASE_DECSED:
                        /* DECSED */
                        do_erase_display(screen, param[0], DEC_PROTECT);
                        parsestate = groundtable;
-                       break;
+                       break;
 
                 case CASE_DECSEL:
                        /* DECSEL */
                        do_erase_line(screen, param[0], DEC_PROTECT);
                        parsestate = groundtable;
-                       break;
+                       break;
 
                 case CASE_ST:
                        if (!string_used)
@@ -2043,7 +2061,7 @@
                                break;
                        }
                        parsestate = groundtable;
-                       break;
+                       break;
 
                 case CASE_SOS:
                        /* Start of String */
@@ -2061,36 +2079,36 @@
                        /* Device Control String */
                        string_mode = DCS;
                        parsestate = sos_table;
-                       break;
+                       break;
 
                 case CASE_APC:
                        /* Application Program Command */
                        string_mode = APC;
                        parsestate = sos_table;
-                       break;
+                       break;
 
                 case CASE_SPA:
                        screen->protected_mode = ISO_PROTECT;
                        term->flags |= PROTECTED;
                        parsestate = groundtable;
-                       break;
+                       break;
 
                 case CASE_EPA:
                        term->flags &= ~PROTECTED;
                        parsestate = groundtable;
-                       break;
+                       break;
 
                 case CASE_SU:
                        /* SU */
                        if((count = param[0]) < 1)
                                count = 1;
-                       Scroll(screen, count);
+                       xtermScroll(screen, count);
                        parsestate = groundtable;
                        break;
 
                 case CASE_IND:
                        /* IND */
-                       Index(screen, 1);
+                       xtermIndex(screen, 1);
                        do_xevents();
                        parsestate = groundtable;
                        break;
@@ -2109,7 +2127,7 @@
 
                 case CASE_NEL:
                        /* NEL */
-                       Index(screen, 1);
+                       xtermIndex(screen, 1);
                        CarriageReturn(screen);
                        do_xevents();
                        parsestate = groundtable;
@@ -2242,7 +2260,7 @@
                 case CASE_S7C1T:
                        show_8bit_control(False);
                        parsestate = groundtable;
-                       break;
+                       break;
 
                 case CASE_S8C1T:
 #if OPT_VT52_MODE
@@ -2251,7 +2269,7 @@
 #endif
                        show_8bit_control(True);
                        parsestate = groundtable;
-                       break;
+                       break;
 
                 case CASE_OSC:
                        /* Operating System Command */
@@ -2363,7 +2381,7 @@
        int c = len;
 
        if (v_bufstr == NULL  &&  len > 0) {
-               v_buffer = (Char *) XtMalloc(len);
+               v_buffer = (Char *) XtMalloc(len);
                v_bufstr = v_buffer;
                v_bufptr = v_buffer;
                v_bufend = v_buffer + len;
@@ -2379,8 +2397,13 @@
 #endif
 
 #ifndef AMOEBA
+#if VMS
+       if ((1 << f) != pty_mask)
+               return(tt_write((char *)data, len));
+#else /* VMS */
        if (!FD_ISSET (f, &pty_mask))
                return(write(f, (char *)data, len));
+#endif /* VMS */
 #else
        if (term->screen.respond != f)
                return(write(f, (char *)data, len));
@@ -2458,9 +2481,15 @@
 
        if (v_bufptr > v_bufstr) {
 #ifndef AMOEBA
+#ifdef VMS
+           riten = tt_write(v_bufstr,v_bufptr - v_bufstr <=  VMS_TERM_BUFFER_SIZE ?
+                                     v_bufptr - v_bufstr : VMS_TERM_BUFFER_SIZE);
+           if (riten == 0) return(riten);
+#else /* VMS */
            riten = write(f, v_bufstr, v_bufptr - v_bufstr <= MAX_PTY_WRITE ?
-                                      v_bufptr - v_bufstr : MAX_PTY_WRITE);
+                                      v_bufptr - v_bufstr : MAX_PTY_WRITE);
            if (riten < 0)
+#endif /* VMS */
 #else
            riten = v_bufptr - v_bufstr <= MAX_PTY_WRITE ?
                    v_bufptr - v_bufstr : MAX_PTY_WRITE;
@@ -2510,6 +2539,125 @@
        return(c);
 }
 
+
+#ifdef VMS
+static int select_mask;
+static int write_mask;
+static int pty_read_bytes;
+
+#define        ptymask()       (v_bufptr > v_bufstr ? pty_mask : 0)
+
+static int
+in_put(void)
+{
+    int status;
+    Dimension replyWidth, replyHeight;
+    XtGeometryResult stat;
+
+    register TScreen *screen = &term->screen;
+    register char *cp;
+    register int i;
+
+    select_mask = pty_mask;    /* force initial read */
+    for ( ; ;)
+    {
+
+      /* if the terminal changed size, resize the widget */
+      if(tt_changed)
+       {
+         tt_changed = FALSE;
+
+         stat = XtMakeResizeRequest (
+                                       (Widget) term,
+                                       (Dimension) FontWidth(screen)
+                                       * (tt_width)
+                                       + 2*screen->border
+                                       + screen->fullVwin.scrollbar,
+                                       (Dimension) FontHeight(screen)
+                                       * (tt_length)
+                                       + 2 * screen->border,
+                                       &replyWidth, &replyHeight);
+
+         if (stat == XtGeometryYes || stat == XtGeometryDone)
+           {
+             term->core.width = replyWidth;
+             term->core.height = replyHeight;
+
+             ScreenResize (&term->screen,replyWidth,replyHeight,
+                           &term->flags);
+           }
+       }
+
+       if((select_mask & pty_mask) && (eventMode == NORMAL)) {
+#ifdef ALLOWLOGGING
+           if(screen->logging){
+               FlushLog(screen);
+           }
+#endif
+
+           if (read_queue.flink != 0) {
+               VTbuffer.cnt = tt_read(VTbuffer.ptr = VTbuffer.buf);
+               if(VTbuffer.cnt == 0)
+                   Panic("input: read returned zero\n", 0);
+               else
+               {
+                   /* strip parity bit */
+                   for(i = VTbuffer.cnt, cp = VTbuffer.ptr ; i > 0 ; i--)
+                       *cp++ &= 0177; /* originally CHAR */
+                       if(screen->scrollWidget && screen->scrollttyoutput &&
+                           screen->topline < 0)
+                           /* Scroll to bottom */
+                        WindowScroll(screen, 0);
+                       break;
+               }
+           }
+           else {
+               sys$hiber();
+           }
+
+       }
+       if(screen->scroll_amt)
+           FlushScroll(screen);
+       if(screen->cursor_set && (screen->cursor_col != screen->cur_col
+        || screen->cursor_row != screen->cur_row)) {
+           if(screen->cursor_state)
+               HideCursor();
+           ShowCursor();
+       } else if(screen->cursor_set != screen->cursor_state) {
+           if(screen->cursor_set)
+               ShowCursor();
+           else
+               HideCursor();
+       }
+
+       if (QLength(screen->display)){
+           select_mask = X_mask;
+       }
+       else {
+           write_mask = ptymask();
+           XFlush(screen->display);
+           select_mask = Select_mask;
+           if (eventMode != NORMAL)
+               select_mask = X_mask;
+       }
+       if (write_mask & ptymask()) {
+           v_write(screen->respond, 0, 0);     /* flush buffer */
+       }
+
+       if(select_mask & X_mask) {
+           if (VTbuffer.cnt <= 0) {
+               VTbuffer.cnt = 0;
+               VTbuffer.ptr = VTbuffer.buf;
+           }
+           xevents();
+           if (VTbuffer.cnt > 0)
+               break;
+       }
+    }
+    VTbuffer.cnt--;
+    return(*VTbuffer.ptr++);
+}
+#else /* VMS */
 static fd_set select_mask;
 static fd_set write_mask;
 static int pty_read_bytes;
@@ -2642,6 +2790,7 @@
     }
     return nextPtyData(&VTbuffer);
 }
+#endif /* VMS */
 
 /*
  * process a string of characters according to the character set indicated
@@ -2680,7 +2829,7 @@
                            /* mark that we had to wrap this line */
                            ScrnSetWrapped(screen, screen->cur_row);
                            xtermAutoPrint('\n');
-                           Index(screen, 1);
+                           xtermIndex(screen, 1);
                            screen->cur_col = 0;
                            screen->do_wrap = 0;
                            this_col = last_col + 1;
@@ -2770,7 +2919,7 @@
                screen->cur_row,
                screen->cur_col,
                curXtermChrSet(screen->cur_row),
-               len, visibleChars(PAIRED_CHARS(str, str2), len)))
+               len, visibleChars(PAIRED_CHARS(str, str2), len)));
 
        if(screen->cur_row - screen->topline <= screen->max_row) {
                if(screen->cursor_state)
@@ -2796,7 +2945,7 @@
                        TRACE(("%s @%d, calling drawXtermText (%d,%d)\n",
                                __FILE__, __LINE__,
                                screen->cur_col,
-                               screen->cur_row))
+                               screen->cur_row));
                        drawXtermText(screen, flags, currentGC,
                                CurCursorX(screen, screen->cur_row, screen->cur_col),
                                CursorY(screen, screen->cur_row),
@@ -2858,7 +3007,7 @@
 
     switch( event->type ){
     case MapNotify:
-       TRACE(("HandleStructNotify(MapNotify)\n"))
+       TRACE(("HandleStructNotify(MapNotify)\n"));
 #if OPT_ZICONBEEP
        if( zIconBeep_flagged ) {
            zIconBeep_flagged = False;
@@ -2879,11 +3028,11 @@
        mapstate = !IsUnmapped;
        break;
     case UnmapNotify:
-       TRACE(("HandleStructNotify(UnmapNotify)\n"))
+       TRACE(("HandleStructNotify(UnmapNotify)\n"));
        mapstate = IsUnmapped;
        break;
     case ConfigureNotify:
-       TRACE(("HandleStructNotify(ConfigureNotify)\n"))
+       TRACE(("HandleStructNotify(ConfigureNotify)\n"));
 #if OPT_TOOLBAR
        if (term->screen.Vshow) {
 #ifndef NO_ACTIVE_ICON
@@ -2895,13 +3044,13 @@
                XtVaGetValues(Vwin->menu_bar,
                    XtNheight,      &Vwin->menu_height,
                    NULL);
-               TRACE(("...menu_height %d\n", Vwin->menu_height))
+               TRACE(("...menu_height %d\n", Vwin->menu_height));
            }
        }
 #endif
        break;
     default:
-       TRACE(("HandleStructNotify(event %d)\n", event->type))
+       TRACE(("HandleStructNotify(event %d)\n", event->type));
        break;
     }
 }
@@ -2954,7 +3103,7 @@
        register int    i, j;
 
        for (i=0; i<nparam; ++i) {
-               TRACE(("%s %d\n", (func == bitset) ? "DECSET" : "DECRST", param[i]))
+               TRACE(("%s %d\n", (func == bitset) ? "DECSET" : "DECRST", param[i]));
                switch (param[i]) {
                case 1:                 /* DECCKM                       */
                        (*func)(&termw->keyboard.flags, MODE_DECCKM);
@@ -3164,26 +3313,23 @@
 #endif
                case 1048:
                        if (!termw->misc.titeInhibit) {
-                               if(func == bitset)
+                               if(func == bitset)
                                        CursorSave(termw);
                                else
                                        CursorRestore(termw);
                        }
                        break;
                case 1051:
-                       sunFunctionKeys = (func == bitset);
-                       update_sun_fkeys();
+                       set_keyboard_type(keyboardIsSun, func == bitset);
                        break;
 #if OPT_HP_FUNC_KEYS
                case 1052:
-                       hpFunctionKeys = (func == bitset);
-                       update_hp_fkeys();
+                       set_keyboard_type(keyboardIsHP, func == bitset);
                        break;
 #endif
 #if OPT_SUNPC_KBD
                case 1061:
-                       sunKeyboard = (func == bitset);
-                       update_sun_kbd();
+                       set_keyboard_type(keyboardIsVT220, func == bitset);
                        break;
 #endif
                }
@@ -3666,7 +3812,11 @@
                buf[1] = '\n';
                i++;
        }
+#ifdef VMS
+       tt_write(&buf, i);
+#else /* VMS */
        writePtyData(fd, buf, i);
+#endif /* VMS */
 
        /* If send/receive mode is reset, we echo characters locally */
        if ((term->keyboard.flags & MODE_SRM) == 0) {
@@ -3711,7 +3861,7 @@
 {
        if(screen->alternate)
                return;
-       TRACE(("ToAlternate\n"))
+       TRACE(("ToAlternate\n"));
        if(!screen->altbuf)
                screen->altbuf = Allocate(screen->max_row + 1, screen->max_col
                 + 1, &screen->abuf_address);
@@ -3725,7 +3875,7 @@
 {
        if(!screen->alternate)
                return;
-       TRACE(("FromAlternate\n"))
+       TRACE(("FromAlternate\n"));
        screen->alternate = FALSE;
        SwitchBufs(screen);
        update_altscreen();
@@ -3888,7 +4038,7 @@
        XtGeometryResult status;
        XWindowAttributes attrs;
 
-       TRACE(("RequestResize(rows=%d, cols=%d, text=%d)\n", rows, cols, text))
+       TRACE(("RequestResize(rows=%d, cols=%d, text=%d)\n", rows, cols, text));
 
        askedWidth  = cols;
        askedHeight = rows;
@@ -4037,11 +4187,11 @@
        wnew->dft_foreground = MyBlackPixel(wnew->screen.display);
        wnew->dft_background = MyWhitePixel(wnew->screen.display);
    }
-   TRACE(("Color resource initialization:\n"))
-   TRACE(("   Default foreground %#lx\n", wnew->dft_foreground))
-   TRACE(("   Default background %#lx\n", wnew->dft_background))
-   TRACE(("   Screen foreground  %#lx\n", request->screen.foreground))
-   TRACE(("   Screen background  %#lx\n", request->core.background_pixel))
+   TRACE(("Color resource initialization:\n"));
+   TRACE(("   Default foreground %#lx\n", wnew->dft_foreground));
+   TRACE(("   Default background %#lx\n", wnew->dft_background));
+   TRACE(("   Screen foreground  %#lx\n", request->screen.foreground));
+   TRACE(("   Screen background  %#lx\n", request->core.background_pixel));
 
    wnew->screen.mouse_button = -1;
    wnew->screen.mouse_row = -1;
@@ -4091,7 +4241,7 @@
        wnew->screen.terminal_id = MAX_DECID;
    TRACE(("term_id '%s' -> terminal_id %d\n",
        wnew->screen.term_id,
-       wnew->screen.terminal_id))
+       wnew->screen.terminal_id));
 
    wnew->screen.ansi_level = (wnew->screen.terminal_id / 100);
    wnew->screen.visualbell = request->screen.visualbell;
@@ -4135,7 +4285,7 @@
    wnew->screen.print_attributes = request->screen.print_attributes;
 #endif
 
-   TRACE(("keyboard_dialect:%s\n", request->screen.keyboard_dialect))
+   TRACE(("keyboard_dialect:%s\n", request->screen.keyboard_dialect));
    wnew->screen.keyboard_dialect = request->screen.keyboard_dialect;
 
    wnew->screen.input_eight_bits = request->screen.input_eight_bits;
@@ -4167,7 +4317,7 @@
        wnew->screen.font_doublesize = False;
    TRACE(("Doublesize%s enabled, up to %d fonts\n",
        wnew->screen.font_doublesize ? "" : " not",
-       wnew->screen.cache_doublesize))
+       wnew->screen.cache_doublesize));
 #endif
 
    wnew->num_ptrs = (OFF_ATTRS+1); /* OFF_FLAGS, OFF_CHARS, OFF_ATTRS */
@@ -4180,7 +4330,7 @@
    wnew->screen.colorULMode   = request->screen.colorULMode;
 
    for (i = 0, color_ok = False; i < MAXCOLORS; i++) {
-       TRACE(("Acolors[%d] = %#lx\n", i, request->screen.Acolors[i]))
+       TRACE(("Acolors[%d] = %#lx\n", i, request->screen.Acolors[i]));
        wnew->screen.Acolors[i] = request->screen.Acolors[i];
        if (wnew->screen.Acolors[i] != wnew->dft_foreground
        && wnew->screen.Acolors[i] != request->screen.foreground
@@ -4195,7 +4345,7 @@
     */
    if (!color_ok) {
        wnew->screen.colorMode = False;
-       TRACE(("All colors are foreground or background: disable colorMode\n"))
+       TRACE(("All colors are foreground or background: disable colorMode\n"));
    }
 
 #if OPT_EXT_COLORS
@@ -4204,6 +4354,7 @@
    wnew->num_ptrs = (OFF_COLOR+1);
 #endif
    wnew->sgr_foreground = -1;
+   wnew->sgr_extended = 0;
 #endif /* OPT_ISO_COLORS */
 
 #if OPT_HIGHLIGHT_COLOR
@@ -4231,6 +4382,7 @@
    wnew->cur_foreground = 0;
    wnew->cur_background = 0;
 
+   wnew->keyboard.type = keyboardIsDefault;
    wnew->keyboard.flags = MODE_SRM;
    if (wnew->screen.backarrow_key)
           wnew->keyboard.flags |= MODE_DECBKM;
@@ -4560,7 +4712,7 @@
               *t,
               *ns,
               *end,
-               buf[32];
+               buf[32];
     XIM                xim = (XIM) NULL;
     XIMStyles  *xim_styles;
     XIMStyle   input_style = 0;
@@ -4871,7 +5023,7 @@
        }
 
        TRACE(("%s @%d, ShowCursor calling drawXtermText cur(%d,%d)\n", __FILE__, __LINE__,
-               screen->cur_row, screen->cur_col))
+               screen->cur_row, screen->cur_col));
 
        drawXtermText(screen, flags, currentGC,
                x = CurCursorX(screen, screen->cur_row, screen->cur_col),
@@ -4884,7 +5036,7 @@
                screen->box->y = y;
                XDrawLines (screen->display, VWindow(screen),
                            screen->cursoroutlineGC ? screen->cursoroutlineGC
-                                                   : currentGC,
+                                                   : currentGC,
                            screen->box, NBOX, CoordModePrevious);
        }
        screen->cursor_state = ON;
@@ -4954,7 +5106,7 @@
        }
 
        TRACE(("%s @%d, HideCursor calling drawXtermText cur(%d,%d)\n", __FILE__, __LINE__,
-               screen->cursor_row, screen->cursor_col))
+               screen->cursor_row, screen->cursor_col));
        drawXtermText(screen, flags, currentGC,
                CurCursorX(screen, screen->cursor_row, screen->cursor_col),
                CursorY(screen, screen->cursor_row),
@@ -5084,13 +5236,13 @@
                update_jumpscroll();
 
                if(screen->c132 && (term->flags & IN132COLUMNS)) {
-                       Dimension junk;
+                       Dimension junk;
                        XtMakeResizeRequest(
                            (Widget) term,
                            (Dimension) 80*FontWidth(screen)
                                + 2 * screen->border + Scrollbar(screen),
                            (Dimension) FontHeight(screen)
-                               * (screen->max_row + 1) + 2 * screen->border,
+                               * (screen->max_row + 1) + 2 * screen->border,
                            &junk, &junk);
                        XSync(screen->display, FALSE);  /* synchronize */
                        if(XtAppPending(app_con))
Index: charsets.c
--- xterm-124+/charsets.c       Mon Sep 27 16:12:18 1999
+++ xterm-125/charsets.c        Sun Jan 30 14:25:07 2000
@@ -4,7 +4,7 @@
 
 /************************************************************
 
-Copyright 1998, 1999 by Thomas E. Dickey <dickey@clark.net>
+Copyright 1998-2000 by Thomas E. Dickey <dickey@clark.net>
 
                         All Rights Reserved
 
@@ -251,7 +251,7 @@
        TRACE(("CHARSET GL=%c(G%d) GR=%c(G%d) %s\n",
                leftset,  screen->curss ? screen->curss : screen->curgl,
                rightset, screen->curgr,
-               visibleIChar(buf, ptr-buf)))
+               visibleIChar(buf, ptr-buf)));
 
        for (s = buf; s < ptr; ++s) {
                int eight = CharOf(E2A(*s));
Index: ctlseqs.ms
--- xterm-124+/ctlseqs.ms       Thu Dec 30 05:01:00 1999
+++ xterm-125/ctlseqs.ms        Mon Jan 31 10:52:38 2000
@@ -749,7 +749,7 @@
 disabled by the \fBtiteInhibit\fP resource)
   \*(Ps = \*1\*0\*5\*1 \(-> Set Sun function-key mode.
   \*(Ps = \*1\*0\*5\*2 \(-> Set HP function-key mode.
-  \*(Ps = \*1\*0\*6\*1 \(-> Set Sun/PC keyboard mode.
+  \*(Ps = \*1\*0\*6\*1 \(-> Set Sun/PC keyboard emulation of VT220 keyboard.
 .
 .IP \\*(Cs\\*(Pm\\*s\\*i
 Media Copy (MC)
@@ -819,7 +819,7 @@
 disabled by the \fBtiteInhibit\fP resource)
   \*(Ps = \*1\*0\*5\*1 \(-> Reset Sun function-key mode.
   \*(Ps = \*1\*0\*5\*2 \(-> Reset HP function-key mode.
-  \*(Ps = \*1\*0\*6\*1 \(-> Reset Sun/PC keyboard mode.
+  \*(Ps = \*1\*0\*6\*1 \(-> Reset Sun/PC keyboard emulation of VT220 keyboard.
 .
 .IP \\*(Cs\\*(Pm\\*s\\*m
 Character Attributes (SGR)
Index: cursor.c
--- xterm-124+/cursor.c Thu Dec 30 05:01:00 1999
+++ xterm-125/cursor.c  Sat Jan 29 18:58:59 2000
@@ -158,7 +158,7 @@
  * Won't leave scrolling region. No carriage return.
  */
 void
-Index(register TScreen *screen, register int amount)
+xtermIndex(register TScreen *screen, register int amount)
 {
        register int j;
 
@@ -173,7 +173,7 @@
        }
 
        CursorDown(screen, j = screen->bot_marg - screen->cur_row);
-       Scroll(screen, amount - j);
+       xtermScroll(screen, amount - j);
 }
 
 /*
Index: data.c
--- xterm-124+/data.c   Mon Sep 27 16:12:18 1999
+++ xterm-125/data.c    Mon Jan 31 11:31:18 2000
@@ -60,13 +60,8 @@
 XtAppContext app_con;
 XtermWidget term;      /* master data structure for client */
 char *xterm_name;      /* argv[0] */
-Boolean sunFunctionKeys;
 int hold_screen;
 
-#if OPT_HP_FUNC_KEYS
-Boolean hpFunctionKeys;
-#endif
-
 #if OPT_ZICONBEEP
 int zIconBeep;  /* non-zero means beep; see charproc.c for details -IAN! */
 Boolean zIconBeep_flagged; /* True if the icon name has been changed */
@@ -78,15 +73,17 @@
                        the cost of an extra request to the server */
 #endif
 
-#if OPT_SUNPC_KBD
-Boolean sunKeyboard;
-#endif
-
 int am_slave = 0;      /* set to 1 if running as a slave process */
 int max_plus1;
+#ifdef VMS
+int Select_mask;
+int X_mask;
+int pty_mask;
+#else /* VMS */
 fd_set Select_mask;
 fd_set X_mask;
 fd_set pty_mask;
+#endif /* VMS */
 char *ptydev;
 char *ttydev;
 #ifdef ALLOWLOGGING
Index: data.h
--- xterm-124+/data.h   Thu Oct 14 05:57:38 1999
+++ xterm-125/data.h    Mon Jan 31 11:31:23 2000
@@ -34,6 +34,21 @@
 
 extern XtAppContext app_con;
 
+#ifdef VMS
+/* actually in vms.c */
+extern int tt_width;
+extern int tt_length;
+extern int tt_changed;
+extern int tt_pasting;
+extern int tt_new_output;
+#define VMS_TERM_BUFFER_SIZE   500
+struct q_head {
+       int flink;
+       int blink;
+};
+extern struct q_head read_queue;
+#endif
+
 #if OPT_TEK4014
 extern Char *Tpushb;
 extern Char *Tpushback;
@@ -54,24 +69,15 @@
 extern char *ptydev;
 extern char *ttydev;
 extern char *xterm_name;
-extern Boolean sunFunctionKeys;
 extern int hold_screen;
 
-#if OPT_HP_FUNC_KEYS
-extern Boolean hpFunctionKeys;
+#if OPT_ZICONBEEP
+extern int zIconBeep;
+extern Boolean zIconBeep_flagged;
 #endif
 
-#if OPT_ZICONBEEP 
-extern int zIconBeep; 
-extern Boolean zIconBeep_flagged; 
-#endif 
-
-#if OPT_SAME_NAME 
-extern Boolean sameName; 
-#endif 
-
-#if OPT_SUNPC_KBD
-extern Boolean sunKeyboard;
+#if OPT_SAME_NAME
+extern Boolean sameName;
 #endif
 
 extern PtyData VTbuffer;
@@ -83,9 +89,15 @@
 extern int debug;
 #endif /* DEBUG */
 
+#ifdef VMS
+extern int Select_mask;
+extern int X_mask;
+extern int pty_mask;
+#else /* VMS */
 extern fd_set Select_mask;
 extern fd_set X_mask;
 extern fd_set pty_mask;
+#endif /* VMS */
 
 extern int waitingForTrackInfo;
 
Index: doublechr.c
--- xterm-124+/doublechr.c      Mon Sep 27 16:12:18 1999
+++ xterm-125/doublechr.c       Sun Jan 30 14:25:09 2000
@@ -4,7 +4,7 @@
 
 /************************************************************
 
-Copyright 1997 by Thomas E. Dickey <dickey@clark.net>
+Copyright 1997-2000 by Thomas E. Dickey <dickey@clark.net>
 
                         All Rights Reserved
 
@@ -62,7 +62,7 @@
        if (oldChrSet == newChrSet)
                return;
 
-       TRACE(("repaint_line(%2d,%2d) (%d)\n", currow, screen->cur_col, newChrSet))
+       TRACE(("repaint_line(%2d,%2d) (%d)\n", currow, screen->cur_col, newChrSet));
        HideCursor();
 
        /* If switching from single-width, keep the cursor in the visible part
@@ -136,7 +136,7 @@
 discard_font(TScreen *screen, XTermFonts *data)
 {
        TRACE(("discard_font chrset=%d %s\n", data->chrset,
-               (data->fn != 0) ? data->fn : "<no-name>"))
+               (data->fn != 0) ? data->fn : "<no-name>"));
 
        data->chrset = 0;
        data->flags = 0;
@@ -162,14 +162,14 @@
        XTermFonts *data = screen->double_fonts;
 
        flags &= BOLD;
-       TRACE(("xterm_Double_index chrset=%#x, flags=%#x\n", chrset, flags))
+       TRACE(("xterm_Double_index chrset=%#x, flags=%#x\n", chrset, flags));
 
        for (n = 0; n < screen->fonts_used; n++) {
                if (data[n].chrset == chrset
                 && data[n].flags == flags) {
                        if (n != 0) {
                                XTermFonts save;
-                               TRACE(("...xterm_Double_index -> %d (OLD:%d)\n", n, screen->fonts_used))
+                               TRACE(("...xterm_Double_index -> %d (OLD:%d)\n", n, screen->fonts_used));
                                save = data[n];
                                while (n > 0) {
                                        data[n] = data[n-1];
@@ -183,7 +183,7 @@
 
        /* Not, found, push back existing fonts and create a new entry */
        if (screen->fonts_used >= screen->cache_doublesize) {
-               TRACE(("...xterm_Double_index: discard oldest\n"))
+               TRACE(("...xterm_Double_index: discard oldest\n"));
                discard_font(screen, &(data[screen->fonts_used - 1]));
        } else {
                screen->fonts_used += 1;
@@ -191,7 +191,7 @@
        for (n = screen->fonts_used; n > 0; n--)
                data[n] = data[n-1];
 
-       TRACE(("...xterm_Double_index -> (NEW:%d)\n", screen->fonts_used))
+       TRACE(("...xterm_Double_index -> (NEW:%d)\n", screen->fonts_used));
 
        data[0].chrset = chrset;
        data[0].flags = flags;
@@ -233,11 +233,11 @@
        }
        data->fn = name;
 
-       TRACE(("xterm_DoubleGC %s %d: %s\n", flags&BOLD ? "BOLD" : "NORM", n, name))
+       TRACE(("xterm_DoubleGC %s %d: %s\n", flags&BOLD ? "BOLD" : "NORM", n, name));
 
        if ((data->fs = XLoadQueryFont (screen->display, name)) == 0)
                return 0;
-       TRACE(("-> OK\n"))
+       TRACE(("-> OK\n"));
 
        gcv.graphics_exposures = TRUE;  /* default */
        gcv.font       = data->fs->fid;
Index: fontutils.c
--- xterm-124+/fontutils.c      Mon Sep 27 16:12:18 1999
+++ xterm-125/fontutils.c       Sun Jan 30 11:33:51 2000
@@ -4,7 +4,7 @@
 
 /************************************************************
 
-Copyright 1998 by Thomas E. Dickey <dickey@clark.net>
+Copyright 1998-2000 by Thomas E. Dickey <dickey@clark.net>
 
                         All Rights Reserved
 
@@ -317,12 +317,12 @@
         || old_props.res_x      != res_y
         || old_props.pixel_size != pixel_size
         || strcmp(old_props.spacing, props->spacing)) {
-               TRACE(("xtermSpecialFont(atts = %#x, chrset = %#x)\n", atts, chrset))
-               TRACE(("res_x      = %d\n", res_x))
-               TRACE(("res_y      = %d\n", res_y))
-               TRACE(("point_size = %s\n", props->point_size))
-               TRACE(("pixel_size = %d\n", pixel_size))
-               TRACE(("spacing    = %s\n", props->spacing))
+               TRACE(("xtermSpecialFont(atts = %#x, chrset = %#x)\n", atts, chrset));
+               TRACE(("res_x      = %d\n", res_x));
+               TRACE(("res_y      = %d\n", res_y));
+               TRACE(("point_size = %s\n", props->point_size));
+               TRACE(("pixel_size = %d\n", pixel_size));
+               TRACE(("spacing    = %s\n", props->spacing));
                old_props.res_x      = res_x;
                old_props.res_x      = res_y;
                old_props.pixel_size = pixel_size;
@@ -462,7 +462,7 @@
                strcpy (tmpname, nfontname);
        }
 
-       TRACE(("xtermLoadFont normal %s\n", nfontname))
+       TRACE(("xtermLoadFont normal %s\n", nfontname));
 
        if (!(nfs = XLoadQueryFont (screen->display, nfontname))) goto bad;
        if (EmptyFont(nfs))
@@ -473,21 +473,21 @@
                fp = get_font_name_props(screen->display, nfs, normal);
                if (fp != 0) {
                        bfontname = bold_font_name(fp);
-                       TRACE(("...derived bold %s\n", bfontname))
+                       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"))
+                       TRACE(("...cannot load a matching bold font\n"));
                } else if (!same_font_size(nfs, bfs)
                 || !got_bold_font(screen->display, bfs, bfontname)) {
                        XFreeFont(screen->display, bfs);
                        bfs = nfs;
-                       TRACE(("...did not get a matching bold font\n"))
+                       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))
+               TRACE(("...cannot load bold font %s\n", bfontname));
        }
 
        if (EmptyFont(bfs))
@@ -497,7 +497,7 @@
         && (is_fixed_font(nfs) && is_fixed_font(bfs))) {
                XFreeFont(screen->display, bfs);
                bfs = nfs;
-               TRACE(("...fixing mismatched normal/bold fonts\n"))
+               TRACE(("...fixing mismatched normal/bold fonts\n"));
                /*
                 * If we're given a nonnull bfontname here, it came from a
                 * resource setting.  Perhaps the user did something like set
@@ -525,7 +525,7 @@
                        nfs->min_bounds.width,
                        nfs->max_bounds.width,
                        bfs->min_bounds.width,
-                       bfs->max_bounds.width))
+                       bfs->max_bounds.width));
                proportional = True;
        }
 
@@ -620,7 +620,7 @@
 
        screen->enbolden = screen->bold_mode
                && ((nfs == bfs) || same_font_name(normal, bfontname));
-       TRACE(("Will %suse 1-pixel offset/overstrike to simulate bold\n", screen->enbolden ? "" : "not "))
+       TRACE(("Will %suse 1-pixel offset/overstrike to simulate bold\n", screen->enbolden ? "" : "not "));
 
        set_menu_font (False);
        screen->menu_font_number = fontnum;
@@ -750,7 +750,7 @@
                if (font->max_byte1 == 0) {
 #if OPT_WIDE_CHARS
                        if (ch > 255) {
-                               TRACE(("xtermMissingChar %#04x (row)\n", ch))
+                               TRACE(("xtermMissingChar %#04x (row)\n", ch));
                                return True;
                        }
 #endif
@@ -763,7 +763,7 @@
 #endif
 
                if (CI_NONEXISTCHAR(pc)) {
-                       TRACE(("xtermMissingChar %#04x (!exists)\n", ch))
+                       TRACE(("xtermMissingChar %#04x (!exists)\n", ch));
                        return True;
                }
        }
@@ -948,7 +948,7 @@
                         && !xtermMissingChar(n, (flags & BOLD)
                                  ? screen->fnt_bold
                                  : screen->fnt_norm)) {
-                               TRACE(("...use xterm-style linedrawing\n"))
+                               TRACE(("...use xterm-style linedrawing\n"));
                                ch = n;
                                break;
                        }
@@ -958,7 +958,7 @@
 
        TRACE(("DRAW_BOX(%d) cell %dx%d at %d,%d%s\n",
                ch, screen->fnt_high, screen->fnt_wide, y, x,
-               (ch < 0 || ch >= (int)(sizeof(lines)/sizeof(lines[0]))) ? "-BAD": ""))
+               (ch < 0 || ch >= (int)(sizeof(lines)/sizeof(lines[0]))) ? "-BAD": ""));
 
        if (!XGetGCValues(screen->display, gc, GCBackground, &values))
                return;
@@ -1049,7 +1049,7 @@
                        if (fs != 0) {
                                screen->menu_font_sizes[n] = FontSize(fs);
                                TRACE(("menu_font_sizes[%d] = %ld\n", n,
-                                       screen->menu_font_sizes[n]))
+                                       screen->menu_font_sizes[n]));
                                XFreeFont (screen->display, fs);
                        }
                }
@@ -1174,7 +1174,7 @@
 
     TRACE(("SetVTFont(i=%d, name1=%s, name2=%s)\n", i,
        name1 ? name1 : "<null>",
-       name2 ? name2 : "<null>"))
+       name2 ? name2 : "<null>"));
 
     if (i >= 0 && i < NMENUFONTS) {
        if (i == fontMenu_fontsel) {    /* go get the selection */
Index: input.c
--- xterm-124+/input.c  Sun Jan 30 18:41:54 2000
+++ xterm-125/input.c   Mon Jan 31 11:32:37 2000
@@ -60,6 +60,11 @@
 #include <xterm.h>
 
 #include <X11/keysym.h>
+
+#ifdef VMS
+#include <X11/keysymdef.h>
+#endif
+
 #ifdef HAVE_X11_DECKEYSYM_H
 #include <X11/DECkeysym.h>
 #endif
@@ -195,7 +200,7 @@
        for (n = 0; n < sizeof(table)/sizeof(table[0]); n++) {
                if (table[n].before == keysym) {
                        keysym = table[n].after;
-                       TRACE(("...Input keypad changed to %#04lx\n", keysym))
+                       TRACE(("...Input keypad changed to %#04lx\n", keysym));
                        break;
                }
        }
@@ -210,7 +215,7 @@
  */
 #define isModified(event) \
     (event->state & \
-       (Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask ))
+       (Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask ))
 
 #define VT52_KEYPAD \
        if_OPT_VT52_MODE(screen,{ \
@@ -363,7 +368,7 @@
                eightbit ? " 8bit" : " 7bit",
                IsFunctionKey(keysym)     ? " FKey"     : "",
                IsMiscFunctionKey(keysym) ? " MiscFKey" : "",
-               IsEditFunctionKey(keysym) ? " EditFkey" : ""))
+               IsEditFunctionKey(keysym) ? " EditFkey" : ""));
 
 #if OPT_SUNPC_KBD
        /*
@@ -371,12 +376,12 @@
         * Other (Sun, PC) keyboards commonly have keypad(+), but no keypad(,)
         * - it's a pain for users to work around.
         */
-       if (!sunFunctionKeys
+       if (term->keyboard.type != keyboardIsSun
         && (event->state & ShiftMask) == 0
-        && sunKeyboard
+        && term->keyboard.type == keyboardIsVT220
         && keysym == XK_KP_Add) {
                keysym = XK_KP_Separator;
-               TRACE(("...Input keypad(+), change keysym to %#04lx\n", keysym))
+               TRACE(("...Input keypad(+), change keysym to %#04lx\n", keysym));
        }
 #endif
 
@@ -399,7 +404,7 @@
         && ((term->misc.num_lock == 0)
          || (term->misc.num_lock & event->state) != 0)) {
                keypad_mode = 0;
-               TRACE(("...Input num_lock, force keypad_mode off\n"))
+               TRACE(("...Input num_lock, force keypad_mode off\n"));
        }
 #endif
 
@@ -412,9 +417,9 @@
         */
        if (screen->meta_sends_esc
         && !term->misc.meta_trans
-        && (event->state & term->misc.meta_left
-         || event->state & term->misc.meta_right)) {
-               TRACE(("...input is modified by META\n"))
+        && ((event->state & term->misc.meta_left) != 0
+         || (event->state & term->misc.meta_right)) != 0) {
+               TRACE(("...input is modified by META\n"));
                eightbit = False;
                unparseputc (ESC, pty);  /* escape */
        }
@@ -426,7 +431,7 @@
        if (event->state != 0
         && !(IsKeypadKey(keysym) && keypad_mode)
 #if OPT_SUNPC_KBD
-        && !sunKeyboard
+        && term->keyboard.type != keyboardIsVT220
 #endif
 #if OPT_VT52_MODE
         && screen->ansi_level != 0
@@ -436,8 +441,8 @@
            modify_parm = (event->state & ControlMask) ? ctl : normal
 #if OPT_NUM_LOCK
            if (term->misc.real_NumLock
-            && (event->state & term->misc.alt_left
-             || event->state & term->misc.alt_right)) {
+            && ((event->state & term->misc.alt_left) != 0
+             || (event->state & term->misc.alt_right)) != 0) {
                if (event->state & ShiftMask) {
                    ModifierParm(8, 4);
                } else {
@@ -475,12 +480,12 @@
           ^ ((event->state & ControlMask) != 0))
         && (keysym == XK_BackSpace)) {
                strbuf[0] = '\177';
-               TRACE(("...Input backarrow changed to %d\n", *strbuf))
+               TRACE(("...Input backarrow changed to %d\n", *strbuf));
        }
 
 #if OPT_SUNPC_KBD
        /* make an DEC editing-keypad from a Sun or PC editing-keypad */
-       if (sunKeyboard)
+       if (term->keyboard.type == keyboardIsVT220)
                keysym = TranslateFromSUNPC(keysym);
        else
 #endif
@@ -488,16 +493,16 @@
 #ifdef XK_KP_Home
        if (keysym >= XK_KP_Home && keysym <= XK_KP_Begin) {
                keysym += XK_Home - XK_KP_Home;
-               TRACE(("...Input keypad changed to %#04lx\n", keysym))
+               TRACE(("...Input keypad changed to %#04lx\n", keysym));
        }
 #endif
        }
 
 #if OPT_HP_FUNC_KEYS
-       if (hpFunctionKeys
+       if (term->keyboard.type == keyboardIsHP
         && (reply.a_final = hpfuncvalue (keysym)) != 0) {
                reply.a_type = ESC;
-               MODIFIER_PARM
+               MODIFIER_PARM;
                unparseseq(&reply, pty);
        } else
 #endif
@@ -505,13 +510,13 @@
                reply.a_type = SS3;
                reply.a_final = keysym-XK_KP_F1+'P';
                VT52_CURSOR_KEYS
-               MODIFIER_PARM
+               MODIFIER_PARM;
                unparseseq(&reply, pty);
                key = TRUE;
 #if 0  /* OPT_SUNPC_KBD should suppress - but only for vt220 compatibility */
-       } else if (sunKeyboard
-               && screen->old_fkeys == False
-               && screen->ansi_level <= 1
+       } else if (term->keyboard.type == keyboardIsVT220
+               && screen->old_fkeys == False
+               && screen->ansi_level <= 1
                && IsEditFunctionKey(keysym)) {
                key = FALSE;    /* ignore editing-keypad in vt100 mode */
 #endif
@@ -521,22 +526,24 @@
                        reply.a_type = SS3;
                        reply.a_final = curfinal[keysym-XK_Home];
                        VT52_CURSOR_KEYS
-                       MODIFIER_PARM
+                       MODIFIER_PARM;
                        unparseseq(&reply, pty);
                } else {
                        reply.a_type = CSI;
                        if_OPT_VT52_MODE(screen,{ reply.a_type = ESC; })
                        reply.a_final = curfinal[keysym-XK_Home];
-                       MODIFIER_PARM
+                       MODIFIER_PARM;
                        unparseseq(&reply, pty);
                }
                key = TRUE;
         } else if (IsFunctionKey(keysym)
                || IsMiscFunctionKey(keysym)
                || IsEditFunctionKey(keysym)
-               || (keysym == XK_Delete)) {
+               || (keysym == XK_Delete
+                && term->keyboard.type != keyboardIsSun 
+                && !screen->old_fkeys)) {
 #if OPT_SUNPC_KBD
-               if (sunKeyboard) {
+               if (term->keyboard.type == keyboardIsVT220) {
                        if ((event->state & ControlMask)
                         && (keysym >= XK_F1 && keysym <= XK_F12))
                                keysym += 12;
@@ -546,7 +553,7 @@
                dec_code = decfuncvalue(keysym);
                if ((event->state & ShiftMask)
 #if OPT_SUNPC_KBD
-                && sunKeyboard
+                && term->keyboard.type == keyboardIsVT220
 #endif
                 && ((string = (Char *)udk_lookup(dec_code, &nbytes)) != 0)) {
                        while (nbytes-- > 0)
@@ -556,14 +563,14 @@
                /*
                 * Interpret F1-F4 as PF1-PF4 for VT52, VT100
                 */
-               else if (!sunFunctionKeys
+               else if (term->keyboard.type != keyboardIsSun 
                 && screen->old_fkeys == False
                 && (dec_code >= 11 && dec_code <= 14))
                {
                        reply.a_type = SS3;
                        VT52_CURSOR_KEYS
                        reply.a_final = A2E(dec_code - 11 + E2A('P')) ;
-                       MODIFIER_PARM
+                       MODIFIER_PARM;
                        unparseseq(&reply, pty);
                }
 #endif
@@ -571,8 +578,8 @@
                        reply.a_type = CSI;
                        reply.a_nparam = 1;
                        reply.a_final = 0;
-                       MODIFIER_PARM
-                       if (sunFunctionKeys) {
+                       MODIFIER_PARM;
+                       if (term->keyboard.type == keyboardIsSun ) {
                                reply.a_param[0] = sunfuncvalue (keysym);
                                reply.a_final = 'z';
 #ifdef XK_ISO_Left_Tab
@@ -594,7 +601,7 @@
                        reply.a_type  = SS3;
                        reply.a_final = kypd_apl[keysym-XK_KP_Space];
                        VT52_KEYPAD
-                       MODIFIER_PARM
+                       MODIFIER_PARM;
                        unparseseq(&reply, pty);
                } else {
                        unparseputc(kypd_num[keysym-XK_KP_Space], pty);
@@ -618,9 +625,9 @@
                         */
                        if (eightbit
                         && screen->meta_sends_esc
-                        && (event->state & term->misc.meta_left
-                         || event->state & term->misc.meta_right)) {
-                               TRACE(("...input-char is modified by META\n"))
+                        && ((event->state & term->misc.meta_left) != 0
+                         || (event->state & term->misc.meta_right)) != 0) {
+                               TRACE(("...input-char is modified by META\n"));
                                eightbit = False;
                                unparseputc (ESC, pty);  /* escape */
                        }
@@ -629,7 +636,7 @@
                                if (CharOf(*string) < 128) {
                                        TRACE(("...input shift from %d to %d\n",
                                                CharOf(*string),
-                                               CharOf(*string) | 0x80))
+                                               CharOf(*string) | 0x80));
                                        *string |= 0x80;
                                }
                                eightbit = False;
@@ -642,7 +649,7 @@
                                        (CharOf(*string) == cmp)
                                                ? "unchanged"
                                                : "changed to",
-                                       CharOf(cmp)))
+                                       CharOf(cmp)));
                                *string = cmp;
                        } else if (eightbit) {
                                unparseputc (ESC, pty);  /* escape */
@@ -656,7 +663,7 @@
                key = TRUE;
        }
        if(key && !TEK4014_ACTIVE(screen))
-               AdjustAfterInput(screen);
+               AdjustAfterInput(screen);
 #ifdef ENABLE_PRINT
        if (keysym == XK_F2) TekPrint();
 #endif
@@ -668,7 +675,7 @@
 {
        int     pty     = screen->respond;
 
-       TRACE(("InputString %s\n", visibleChars(PAIRED_CHARS(string,0), nbytes)))
+       TRACE(("InputString %s\n", visibleChars(PAIRED_CHARS(string,0), nbytes)));
 #if OPT_TEK4014
        if(nbytes && screen->TekGIN) {
                TekEnqMouse(*string++);
@@ -679,7 +686,7 @@
        while (nbytes-- != 0)
                unparseputc(*string++, pty);
        if (!TEK4014_ACTIVE(screen))
-               AdjustAfterInput(screen);
+               AdjustAfterInput(screen);
 }
 
 /* These definitions are DEC-style (e.g., vt320) */
@@ -734,7 +741,7 @@
 static int
 hpfuncvalue (KeySym  keycode)
 {
-       switch (keycode) {
+       switch (keycode) {
                case XK_Up:             return('A');
                case XK_Down:           return('B');
                case XK_Right:          return('C');
@@ -771,7 +778,7 @@
 static int
 sunfuncvalue (KeySym  keycode)
 {
-       switch (keycode) {
+       switch (keycode) {
                case XK_F1:     return(224);
                case XK_F2:     return(225);
                case XK_F3:     return(226);
@@ -886,7 +893,7 @@
                        TRACE(("%s mask %#lx is%s modifier\n", \
                                #name, \
                                term->misc.name, \
-                               ModifierName(term->misc.name)))
+                               ModifierName(term->misc.name)));
 /*
  * Determine which modifier mask (if any) applies to the Num_Lock keysym.
  *
@@ -905,7 +912,7 @@
 
     if (keymap != 0) {
 
-       TRACE(("VTInitModifiers\n"))
+       TRACE(("VTInitModifiers\n"));
        for (i = k = 0, mask = 1; i < 8; i++, mask <<= 1) {
            for (j = 0; j < keymap->max_keypermod; j++) {
                KeyCode code = keymap->modifiermap[k];
@@ -935,7 +942,7 @@
          || term->misc.alt_right != 0)
         && (TranslationsUseKeyword(toplevel, "alt")
          || TranslationsUseKeyword((Widget)term, "alt"))) {
-           TRACE(("ALT is used as a modifier in translations (ignore mask)\n"))
+           TRACE(("ALT is used as a modifier in translations (ignore mask)\n"));
            term->misc.alt_left = 0;
            term->misc.alt_right = 0;
        }
@@ -948,7 +955,7 @@
          || term->misc.meta_right != 0)
         && (TranslationsUseKeyword(toplevel, "meta")
          || TranslationsUseKeyword((Widget)term, "meta"))) {
-           TRACE(("META is used as a modifier in translations\n"))
+           TRACE(("META is used as a modifier in translations\n"));
            term->misc.meta_trans = True;
        }
 
Index: link_axp.com
--- /dev/null   Sun Jul 17 19:46:18 1994
+++ xterm-125/link_axp.com      Sat Jan 29 15:47:10 2000
@@ -0,0 +1,106 @@
+$ SAVE_VERIFY='F$VERIFY(0)
+$ if p1 .Eqs. "CLEAN" then goto clean
+$ if p1 .Eqs. "CLOBBER" then goto clobber
+$ if p1 .Eqs. "INSTALL" then goto install
+$!
+$!     Compile the X11R4 Xterm application
+$!
+$ Set Symbol/Scope=NoGlobal
+$!
+$!  Define logicals pointing to the needed directories
+$!
+$ x11lib_device = f$parse("[.lib]",,,"DEVICE")
+$ x11lib_directory = f$parse("[.lib]",,,"DIRECTORY")
+$ define/nolog x11lib 'x11lib_device''x11lib_directory'
+$!
+$ x11inc_device = f$parse("[]",,,"DEVICE")
+$ x11inc_directory = f$parse("[]",,,"DIRECTORY")
+$ define/nolog x11inc 'x11inc_device''x11inc_directory'
+$!
+$ xmu_device = f$parse("[.lib.xmu]",,,"DEVICE")
+$ xmu_directory = f$parse("[.lib.xmu]",,,"DIRECTORY")
+$ define/nolog x11xmu 'xmu_device''xmu_directory'
+$!
+$ xbm_device = f$parse("[.lib.x11]",,,"DEVICE")
+$ xbm_directory = f$parse("[.lib.x11]",,,"DIRECTORY")
+$ define/nolog x11xbm 'xbm_device''xbm_directory'
+$!
+$ xaw_device = f$parse("[.lib.xaw]",,,"DEVICE")
+$ xaw_directory = f$parse("[.lib.xaw]",,,"DIRECTORY")
+$ define/nolog x11xaw 'xaw_device''xaw_directory'
+$!
+$ x11vms_device = f$parse("[.lib.misc]",,,"DEVICE")
+$ x11vms_directory = f$parse("[.lib.misc]",,,"DIRECTORY")
+$ define/nolog x11vms 'x11vms_device''x11vms_directory'
+$!
+$!  Get the compiler options via the logical name COPTS
+$!
+$ cc_options = f$trnlnm("COPTS")
+$!
+$!  Get the linker options via the logical name LOPTS
+$!
+$ link_options = f$trnlnm("LOPTS")
+$!
+$ write sys$output "Building XTERM Image"
+$ CALL MAKE XTERM.EXE  "LINK ''link_options' /EXE=XTERM.EXE_AXP/CROSS/FULL/MAP=XTERM.MAP XTERM_AXP/OPT" *.OBJ
+$!
+$ deassign x11lib
+$ deassign x11vms
+$ deassign x11xmu
+$ deassign x11xbm
+$ deassign x11xaw
+$!
+$ exit
+$!
+$ Clobber:     ! Delete executables, Purge directory and clean up object files and listings
+$ Delete/noconfirm/log *.exe;*
+$!
+$ Clean:       ! Purge directory, clean up object files and listings
+$ Purge
+$ Delete/noconfirm/log *.lis;*
+$ Delete/noconfirm/log *.obj;*
+$!
+$ exit
+$!
+$ Install:
+$ Copy/log *.exe x11bin:
+$ exit
+$!
+$MAKE: SUBROUTINE   !SUBROUTINE TO CHECK DEPENDENCIES
+$ V = 'F$Verify(0)
+$! P1 = What we are trying to make
+$! P2 = Command to make it
+$! P3 - P8  What it depends on
+$
+$ If F$Search(P1) .Eqs. "" Then Goto Makeit
+$ Time = F$CvTime(F$File(P1,"RDT"))
+$arg=3
+$Loop:
+$      Argument = P'arg
+$      If Argument .Eqs. "" Then Goto Exit
+$      El=0
+$Loop2:
+$      File = F$Element(El," ",Argument)
+$      If File .Eqs. " " Then Goto Endl
+$      AFile = ""
+$Loop3:
+$      OFile = AFile
+$      AFile = F$Search(File)
+$      If AFile .Eqs. "" .Or. AFile .Eqs. OFile Then Goto NextEl
+$      If F$CvTime(F$File(AFile,"RDT")) .Ges. Time Then Goto Makeit
+$      Goto Loop3
+$NextEL:
+$      El = El + 1
+$      Goto Loop2
+$EndL:
+$ arg=arg+1
+$ If arg .Le. 8 Then Goto Loop
+$ Goto Exit
+$
+$Makeit:
+$ Set Verify
+$ 'P2
+$ VV='F$Verify(0)
+$Exit:
+$ If V Then Set Verify
+$ENDSUBROUTINE
Index: main.c
--- xterm-124+/main.c   Sun Jan 30 18:41:54 2000
+++ xterm-125/main.c    Mon Jan 31 19:50:37 2000
@@ -344,6 +344,7 @@
 #else
 
 #ifndef linux
+#ifndef VMS
 #ifndef USE_POSIX_TERMIOS
 #ifndef USE_SYSV_TERMIO
 #include <sgtty.h>
@@ -358,6 +359,7 @@
 #ifdef __osf__
 #define setpgrp setpgid
 #endif
+#endif /* !VMS */
 #endif /* !linux */
 
 #endif /* __QNX__ */
@@ -385,7 +387,9 @@
 #define NOFILE OPEN_MAX
 #endif
 #elif !defined(MINIX) && !defined(WIN32) && !defined(Lynx) && !defined(__GNU__) && !defined(__MVS__)
+#ifndef VMS
 #include <sys/param.h> /* for NOFILE */
+#endif /* !VMS */
 #endif
 
 #if defined(BSD) && (BSD >= 199103)
@@ -525,12 +529,14 @@
        }
 #endif
 
+#ifndef VMS
 static SIGNAL_T reapchild (int n);
-static char *base_name (char *name);
-static int pty_search (int *pty);
 static int spawn (void);
-static void get_terminal (void);
+static int pty_search (int *pty);
 static void remove_termcap_entry (char *buf, char *str);
+#endif /* ! VMS */
+static char *base_name (char *name);
+static void get_terminal (void);
 static void resize (TScreen *s, char *oldtc, char *newtc);
 
 static Bool added_utmp_entry = False;
@@ -610,6 +616,7 @@
 #define CWERASE CONTROL('W')
 #endif
 
+#ifndef VMS
 #ifdef USE_SYSV_TERMIO
 /* The following structures are initialized in main() in order
 ** to eliminate any assumptions about the internal order of their
@@ -647,6 +654,7 @@
 };
 #endif /* sony */
 #endif /* USE_SYSV_TERMIO */
+#endif /* ! VMS */
 
 /*
  * SYSV has the termio.c_cc[V] and ltchars; BSD has tchars and ltchars;
@@ -1639,13 +1647,6 @@
 #endif
        hold_screen = resource.hold_screen ? 1 : 0;
        xterm_name = resource.xterm_name;
-       sunFunctionKeys = resource.sunFunctionKeys;
-#if OPT_SUNPC_KBD
-       sunKeyboard = resource.sunKeyboard;
-#endif
-#if OPT_HP_FUNC_KEYS
-       hpFunctionKeys = resource.hpFunctionKeys;
-#endif
        if (strcmp(xterm_name, "-") == 0) xterm_name = DFT_TERMTYPE;
        if (resource.icon_geometry != NULL) {
            int scr, junk;
@@ -1732,6 +1733,14 @@
                0);
            /* this causes the initialize method to be called */
 
+#if OPT_HP_FUNC_KEYS
+       init_keyboard_type(keyboardIsHP, resource.hpFunctionKeys);
+#endif
+       init_keyboard_type(keyboardIsSun, resource.sunFunctionKeys);
+#if OPT_SUNPC_KBD
+       init_keyboard_type(keyboardIsVT220, resource.sunKeyboard);
+#endif
+
        screen = &term->screen;
 
        inhibit = 0;
@@ -1780,7 +1789,7 @@
         so the debug feature is disabled by default. */
        int i = -1;
        if(debug) {
-               creat_as (getuid(), getgid(), "xterm.debug.log", 0666);
+               creat_as (getuid(), getgid(), "xterm.debug.log", 0666);
                i = open ("xterm.debug.log", O_WRONLY | O_TRUNC, 0666);
        }
        if(i >= 0) {
@@ -1818,6 +1827,7 @@
 
        spawn ();
 
+#ifndef VMS
        /* Child process is out there, let's catch its termination */
        (void) signal (SIGCHLD, reapchild);
 
@@ -1890,6 +1900,7 @@
                (1 + ConnectionNumber(screen->display)) :
                (1 + screen->respond);
 
+#endif /* !VMS */
 #ifdef DEBUG
        if (debug) printf ("debugging on\n");
 #endif /* DEBUG */
@@ -2252,6 +2263,7 @@
 #endif /* USE_HANDSHAKE else !USE_HANDSHAKE */
 
 
+#ifndef VMS
 #ifndef AMOEBA
 extern char **environ;
 
@@ -2427,21 +2439,21 @@
                                lmode = d_lmode;
 #endif /* TIOCLSET */
 #ifdef USE_SYSV_TERMIO
-                       if(ioctl(tty, TCGETA, &tio) == -1)
-                               tio = d_tio;
+                       if(ioctl(tty, TCGETA, &tio) == -1)
+                               tio = d_tio;
 #elif defined(USE_POSIX_TERMIOS)
                        if (tcgetattr(tty, &tio) == -1)
-                               tio = d_tio;
+                               tio = d_tio;
 #else   /* !USE_SYSV_TERMIO && !USE_POSIX_TERMIOS */
                        if(ioctl(tty, TIOCGETP, (char *)&sg) == -1)
-                               sg = d_sg;
+                               sg = d_sg;
                        if(ioctl(tty, TIOCGETC, (char *)&tc) == -1)
-                               tc = d_tc;
+                               tc = d_tc;
                        if(ioctl(tty, TIOCGETD, (char *)&discipline) == -1)
-                               discipline = d_disipline;
+                               discipline = d_disipline;
 #ifdef sony
                        if(ioctl(tty, TIOCKGET, (char *)&jmode) == -1)
-                               jmode = d_jmode;
+                               jmode = d_jmode;
                        if(ioctl(tty, TIOCKGETC, (char *)&jtc) == -1)
                                jtc = d_jtc;
 #endif /* sony */
@@ -2465,7 +2477,7 @@
                                __FILE__, __LINE__,
                                resource.ptyInitialErase,
                                resource.backarrow_is_erase,
-                               initial_erase))
+                               initial_erase));
 #endif
 
 #ifdef MINIX
@@ -2577,11 +2589,11 @@
        TRACE(("%s @%d, resource ptyInitialErase:%d, backspace_is_erase:%d\n",
                __FILE__, __LINE__,
                resource.ptyInitialErase,
-               resource.backarrow_is_erase))
+               resource.backarrow_is_erase));
        if (!resource.ptyInitialErase) {
                char temp[1024], *p = temp;
                char *s = tgetstr(TERMCAP_ERASE, &p);
-               TRACE(("extracting initial_erase value from termcap\n"))
+               TRACE(("extracting initial_erase value from termcap\n"));
                if (s != 0) {
                        if (*s == '^') {
                                if (*++s == '?') {
@@ -2598,7 +2610,7 @@
                                initial_erase = *s;
                        }
                        initial_erase = CharOf(initial_erase);
-                       TRACE(("... initial_erase:%d\n", initial_erase))
+                       TRACE(("... initial_erase:%d\n", initial_erase));
                }
        }
        if (resource.backarrow_is_erase && initial_erase == 127) {
@@ -3140,7 +3152,7 @@
                        __FILE__, __LINE__,
                        resource.ptyInitialErase,
                        override_tty_modes,
-                       ttymodelist[XTTYMODE_erase].set))
+                       ttymodelist[XTTYMODE_erase].set));
                if (! resource.ptyInitialErase
                 && !override_tty_modes
                 && !ttymodelist[XTTYMODE_erase].set) {
@@ -3166,7 +3178,7 @@
                /* copy the environment before Setenving */
                for (i = 0 ; environ [i] != NULL ; i++)
                    ;
-               /* compute number of Setenv() calls below */
+               /* compute number of xtermSetenv() calls below */
                envsize = 1;    /* (NULL terminating entry) */
                envsize += 3;   /* TERM, WINDOWID, DISPLAY */
 #ifdef HAVE_UTMP
@@ -3186,16 +3198,16 @@
                envnew = (char **) calloc ((unsigned) i + envsize, sizeof(char *));
                memmove( (char *)envnew, (char *)environ, i * sizeof(char *));
                environ = envnew;
-               Setenv ("TERM=", TermName);
+               xtermSetenv ("TERM=", TermName);
                if(!TermName)
                        *newtc = 0;
 
                sprintf (buf, "%lu",
                         ((unsigned long) XtWindow (XtParent(CURRENT_EMU(screen)))));
-               Setenv ("WINDOWID=", buf);
+               xtermSetenv ("WINDOWID=", buf);
 
                /* put the display into the environment of the shell*/
-               Setenv ("DISPLAY=", XDisplayString (screen->display));
+               xtermSetenv ("DISPLAY=", XDisplayString (screen->display));
 
                signal(SIGTERM, SIG_DFL);
 
@@ -3271,7 +3283,7 @@
 #ifdef HAVE_UTMP
                pw = getpwuid(screen->uid);
                if (pw && pw->pw_name)
-                   Setenv ("LOGNAME=", pw->pw_name); /* for POSIX */
+                   xtermSetenv ("LOGNAME=", pw->pw_name); /* for POSIX */
 #ifdef USE_SYSV_UTMP
                /* Set up our utmp entry now.  We need to do it here
                ** for the following reasons:
@@ -3331,7 +3343,7 @@
                (void) strncpy(buf, DisplayString(screen->display),
                               sizeof(buf));
 #ifndef linux
-               {
+               {
                    char *disfin = strrchr(buf, ':');
                    if (disfin)
                        *disfin = '\0';
@@ -3514,20 +3526,20 @@
                {
                char numbuf[12];
                sprintf (numbuf, "%d", screen->max_col + 1);
-               Setenv("COLUMNS=", numbuf);
+               xtermSetenv("COLUMNS=", numbuf);
                sprintf (numbuf, "%d", screen->max_row + 1);
-               Setenv("LINES=", numbuf);
+               xtermSetenv("LINES=", numbuf);
                }
 #ifdef HAVE_UTMP
                if (pw) {       /* SVR4 doesn't provide these */
                    if (!getenv("HOME"))
-                       Setenv("HOME=", pw->pw_dir);
+                       xtermSetenv("HOME=", pw->pw_dir);
                    if (!getenv("SHELL"))
-                       Setenv("SHELL=", pw->pw_shell);
+                       xtermSetenv("SHELL=", pw->pw_shell);
                }
 #endif /* HAVE_UTMP */
 #ifdef OWN_TERMINFO_DIR
-               Setenv("TERMINFO=", OWN_TERMINFO_DIR);
+               xtermSetenv("TERMINFO=", OWN_TERMINFO_DIR);
 #endif
 #else /* USE_SYSV_ENVVARS */
                if(!TEK4014_ACTIVE(screen) && *newtc) {
@@ -3556,19 +3568,19 @@
                }
 #endif
                if(*newtc)
-                   Setenv ("TERMCAP=", newtc);
+                   xtermSetenv ("TERMCAP=", newtc);
 #endif /* USE_SYSV_ENVVARS */
 
 
                /* need to reset after all the ioctl bashing we did above */
 #if defined(TIOCSSIZE) && (defined(sun) && !defined(SVR4))
                i = ioctl (0, TIOCSSIZE, &ts);
-               TRACE(("spawn TIOCSSIZE %dx%d return %d\n", ts.ts_lines, ts.ts_cols, i))
+               TRACE(("spawn TIOCSSIZE %dx%d return %d\n", ts.ts_lines, ts.ts_cols, i));
 #elif defined(TIOCSWINSZ)
                i = ioctl (0, TIOCSWINSZ, (char *)&ws);
-               TRACE(("spawn TIOCSWINSZ %dx%d return %d\n", ws.ws_row, ws.ws_col, i))
+               TRACE(("spawn TIOCSWINSZ %dx%d return %d\n", ws.ws_row, ws.ws_col, i));
 #else
-               TRACE(("spawn cannot tell pty its size\n"))
+               TRACE(("spawn cannot tell pty its size\n"));
 #endif /* sun vs TIOCSWINSZ */
 
                signal(SIGHUP, SIG_DFL);
@@ -3686,7 +3698,7 @@
                        break;
                default:
                        fprintf(stderr, "%s: unexpected handshake status %d\n",
-                               xterm_name, handshake.status);
+                               xterm_name, handshake.status);
                }
            }
            /* close our sides of the pipes */
@@ -3963,7 +3975,7 @@
     for (i = 0 ; environ[i] != NULL ; i++)
        ;
 
-    /* compute number of Setenv() calls below */
+    /* compute number of xtermSetenv() calls below */
     envsize = 1;       /* (NULL terminating entry) */
     envsize += 3;      /* TERM, WINDOWID, DISPLAY */
     envsize += 2;      /* HOME, SHELL */
@@ -3971,19 +3983,19 @@
     envnew = (char **) calloc ((unsigned) i + envsize, sizeof(char *));
     bcopy((char *)environ, (char *)envnew, i * sizeof(char *));
     environ = envnew;
-    Setenv ("TERM=", TermName);
+    xtermSetenv ("TERM=", TermName);
     if(!TermName) *newtc = 0;
 
     sprintf (buf, "%lu",
        ((unsigned long) XtWindow (XtParent(CURRENT_EMU(screen)))));
-    Setenv ("WINDOWID=", buf);
+    xtermSetenv ("WINDOWID=", buf);
 
     /* put the display into the environment of the shell*/
-    Setenv ("DISPLAY=", XDisplayString (screen->display));
+    xtermSetenv ("DISPLAY=", XDisplayString (screen->display));
 
     /* always provide a HOME and SHELL definition */
-    if (!getenv("HOME")) Setenv("HOME=", DEF_HOME);
-    if (!getenv("SHELL")) Setenv("SHELL=", DEF_SHELL);
+    if (!getenv("HOME")) xtermSetenv("HOME=", DEF_HOME);
+    if (!getenv("SHELL")) xtermSetenv("SHELL=", DEF_SHELL);
 
     if(!TEK4014_ACTIVE(screen) && *newtc) {
        strcpy (termcap, newtc);
@@ -4004,7 +4016,7 @@
            strcat (newtc, ":im=\\E[4h:ei=\\E[4l:mi:");
     }
     if (*newtc)
-       Setenv ("TERMCAP=", newtc);
+       xtermSetenv ("TERMCAP=", newtc);
 
     /*
      * Execute specified program or shell. Use find_program to
@@ -4243,7 +4255,7 @@
        register int li_first = 0;
        register char *temp;
 
-       TRACE(("resize %s\n", oldtc))
+       TRACE(("resize %s\n", oldtc));
        if ((ptr1 = strindex (oldtc, "co#")) == NULL){
                strcat (oldtc, "co#80:");
                ptr1 = strindex (oldtc, "co#");
@@ -4274,10 +4286,11 @@
                        : screen->max_row + 1);
        ptr2 = strchr(ptr2, ':');
        strcat (temp, ptr2);
-       TRACE(("   ==> %s\n", newtc))
+       TRACE(("   ==> %s\n", newtc));
 #endif /* USE_SYSV_ENVVARS */
 }
 
+#endif /* ! VMS */
 /*
  * Does a non-blocking wait for a child process.  If the system
  * doesn't support non-blocking wait, do nothing.
@@ -4306,6 +4319,8 @@
        return pid;
 }
 
+#ifndef VMS
+
 /* ARGSUSED */
 static SIGNAL_T reapchild (int n GCC_UNUSED)
 {
@@ -4332,6 +4347,7 @@
 
     SIGNAL_RETURN;
 }
+#endif /* !VMS */
 
 static void
 remove_termcap_entry (char *buf, char *str)
@@ -4341,7 +4357,7 @@
     int count = 0;
     size_t len = strlen(str);
 
-    TRACE(("*** remove_termcap_entry('%s', '%s')\n", str, buf))
+    TRACE(("*** remove_termcap_entry('%s', '%s')\n", str, buf));
 
     while (*buf != 0) {
        if (!count && !strncmp(buf, str, len)) {
@@ -4355,7 +4371,7 @@
            }
            while ((*first++ = *buf++) != 0)
                ;
-           TRACE(("...removed_termcap_entry('%s', '%s')\n", str, base))
+           TRACE(("...removed_termcap_entry('%s', '%s')\n", str, base));
            return;
        } else if (*buf == '\\') {
            buf++;
@@ -4368,7 +4384,7 @@
        if (*buf != 0)
            buf++;
     }
-    TRACE(("...cannot remove\n"))
+    TRACE(("...cannot remove\n"));
 }
 
 /*
@@ -4402,21 +4418,26 @@
            s++;
            c = ((*s == '?') ? 0177 : CONTROL(*s));
            if (*s == '-') {
-#if defined(HAVE_POSIX_VDISABLE)
-               c = _POSIX_VDISABLE;
-#elif defined(_PC_VDISABLE)
+               c = -1;
                errno = 0;
-               c = fpathconf(0, _PC_VDISABLE);
+#if defined(_POSIX_VDISABLE) && defined(HAVE_UNISTD_H)
+               c = _POSIX_VDISABLE;
+#endif
+#if defined(_PC_VDISABLE)
                if (c == -1) {
-                   if (errno != 0)
-                       continue;       /* skip this (error) */
-                   c = 0377;
+                   c = fpathconf(0, _PC_VDISABLE);
+                   if (c == -1) {
+                       if (errno != 0)
+                           continue;   /* skip this (error) */
+                       c = 0377;
+                   }
                }
 #elif defined(VDISABLE)
-               c = VDISABLE;
-#else
-               continue;               /* ignore */
+               if (c == -1)
+                   c = VDISABLE;
 #endif
+               if (c == -1)
+                   continue;           /* ignore */
            }
        } else {
            c = *s;
@@ -4428,6 +4449,7 @@
     }
 }
 
+#ifndef VMS /* don't use pipes on OpenVMS */
 int GetBytesAvailable (int fd)
 {
 #ifdef AMOEBA
@@ -4475,6 +4497,7 @@
     return poll (pollfds, 1, 0);
 #endif
 }
+#endif /* !VMS */
 
 /* Utility function to try to hide system differences from
    everybody who used to call killpg() */
@@ -4482,7 +4505,7 @@
 int
 kill_process_group(int pid, int sig)
 {
-    TRACE(("kill_process_group(pid=%d, sig=%d)\n", pid, sig))
+    TRACE(("kill_process_group(pid=%d, sig=%d)\n", pid, sig));
 #ifdef AMOEBA
     if (pid != 2) {
        fprintf(stderr, "%s:  unexpected process id %d.\n", ProgramName, pid);
Index: make.com
--- /dev/null   Sun Jul 17 19:46:18 1994
+++ xterm-125/make.com  Sat Jan 29 19:07:46 2000
@@ -0,0 +1,88 @@
+$! make.com
+$! 25-JAN-2000, David Mathog
+$! builds xaw3d, xmu, and then xterm.
+$!
+$!************************************************************
+$!
+$! set up logicals for XAW, XMU and so forth
+$!
+$ define x11_directory decw$include
+$ thisfile = f$environment("PROCEDURE")
+$ thisis   = f$parse(thisfile,,,"DEVICE") + f$parse(thisfile,,,"DIRECTORY")
+$ thisis = thisis - "]"
+$ define xaw_directory "''thisis'.lib.xaw3d]"
+$ define xmu_directory "''thisis'.lib.xmu]"
+$ define bitmap_directory "''thisis'.lib.bitmaps]"
+$ define/trans=(concealed) thisX11 "''thisis.lib.]"
+$ define X11 thisx11,decw$include
+$!
+$! note, ansi doesn't work with this variant of X11R5.
+$!
+$! don't build libs in debug mode
+$ if(P1 .eqs. "" .AND. P2 .eqs. "")
+$ then
+$!
+$! build XMU
+$!
+$ set ver
+$ set def [.lib.xmu]
+$ @make
+$!
+$! build XAW3D
+$!
+$ set def [-.xaw3d]
+$ @make
+$ set def [--]
+$ set nover
+$!
+$! move the two libraries to this level
+$!
+$ rename [.lib...]*.olb []
+$ endif
+$!
+$ if(P1 .nes. "")
+$ then
+$   ccstub := cc/standard=vaxc/include=[]/debug/noopt
+$   mylink :== link/debug
+$ else
+$   ccstub := cc/standard=vaxc/include=[]
+$   mylink :== link
+$ endif
+$ mycc :== 'ccstub' -
+/define=(VMS,OPT_TEK4014,ALLOWLOGGING,OPT_NUM_LOCK)
+$!
+$! OPT_TOOLBAR doesn't work - it pulls in calls through Xaw3d and Xmu for
+$! XSHAPECOMBINEMASK and XSHAPEQUERYEXTENSION
+$! which seem not to exist in DW MOtif 1.2-5
+$!
+$!
+$ set ver
+$ mycc BUTTON.C
+$ mycc CHARPROC.C
+$ mycc CHARSETS.C
+$ mycc CURSOR.C
+$ mycc DATA.C
+$ mycc DOUBLECHR.C
+$ mycc FONTUTILS.C
+$ mycc INPUT.C
+$ mycc KEYSYM2UCS.C
+$ mycc MAIN.C
+$ mycc MENU.C
+$ mycc MISC.C
+$ mycc PRINT.C
+$ mycc PTYDATA.C
+$! mycc RESIZE.C
+$ mycc SCREEN.C
+$ mycc SCROLLBAR.C
+$ mycc TABS.C
+$ mycc TEKPROC.C
+$ mycc TEKPRSTBL.C
+$ mycc TRACE.C
+$ mycc TTYSVR.C
+$ mycc UTIL.C
+$ mycc VMS.C
+$ mycc VTPRSTBL.C
+$!
+$ mylink/exe=xterm.exe xterm_axp.opt/option
+$ set nover
+$ exit
Index: menu.c
--- xterm-124+/menu.c   Thu Dec 30 05:01:00 1999
+++ xterm-125/menu.c    Mon Jan 31 11:40:11 2000
@@ -2,7 +2,7 @@
 /* $XFree86: xc/programs/xterm/menu.c,v 3.28 1999/12/30 02:05:54 robin Exp $ */
 /*
 
-Copyright 1999 by Thomas E. Dickey <dickey@clark.net>
+Copyright 1999-2000 by Thomas E. Dickey <dickey@clark.net>
 
                         All Rights Reserved
 
@@ -182,13 +182,13 @@
     { "num-lock",      do_num_lock,    NULL },
     { "meta-esc",      do_meta_esc,    NULL },
 #endif
+#if OPT_HP_FUNC_KEYS
+    { "hp function-keys",do_hp_fkeys,  NULL },
+#endif
     { "sun function-keys",do_sun_fkeys,        NULL },
 #if OPT_SUNPC_KBD
     { "sun keyboard",  do_sun_kbd,     NULL },
 #endif
-#if OPT_HP_FUNC_KEYS
-    { "hp function-keys",do_hp_fkeys,  NULL },
-#endif
     { "line2",         NULL,           NULL },
     { "suspend",       do_suspend,     NULL },
     { "continue",      do_continue,    NULL },
@@ -352,7 +352,7 @@
 
     Widget m;
     TScreen *screen = &xtw->screen;
-    MenuHeader *data = &menu_names[num]; 
+    MenuHeader *data = &menu_names[num];
     MenuList *list = select_menu(w, num);
     struct _MenuEntry *entries = data->entry_list;
     int nentries = data->entry_len;
@@ -590,10 +590,12 @@
 /* ARGSUSED */
 static void handle_send_signal (Widget gw GCC_UNUSED, int sig)
 {
+#ifndef VMS
     register TScreen *screen = &term->screen;
 
     if (hold_screen > 1) hold_screen = 0;
     if (screen->pid > 1) kill_process_group (screen->pid, sig);
+#endif
 }
 
 
@@ -715,15 +717,6 @@
     update_decbkm();
 }
 
-static void do_sun_fkeys (
-       Widget gw GCC_UNUSED,
-       XtPointer closure GCC_UNUSED,
-       XtPointer data GCC_UNUSED)
-{
-    sunFunctionKeys = ! sunFunctionKeys;
-    update_sun_fkeys();
-}
-
 #if OPT_NUM_LOCK
 static void do_num_lock (
        Widget gw GCC_UNUSED,
@@ -744,31 +737,37 @@
 }
 #endif
 
-
-#if OPT_SUNPC_KBD
-static void do_sun_kbd (
+#if OPT_HP_FUNC_KEYS
+static void do_hp_fkeys (
        Widget gw GCC_UNUSED,
        XtPointer closure GCC_UNUSED,
        XtPointer data GCC_UNUSED)
 {
-    sunKeyboard = ! sunKeyboard;
-    update_sun_kbd();
+    toggle_keyboard_type(keyboardIsHP);
 }
 #endif
 
+static void do_sun_fkeys (
+       Widget gw GCC_UNUSED,
+       XtPointer closure GCC_UNUSED,
+       XtPointer data GCC_UNUSED)
+{
+    toggle_keyboard_type(keyboardIsSun);
+}
 
-#if OPT_HP_FUNC_KEYS
-static void do_hp_fkeys (
+#if OPT_SUNPC_KBD
+/*
+ * This really means "Sun/PC keyboard emulating VT220".
+ */
+static void do_sun_kbd (
        Widget gw GCC_UNUSED,
        XtPointer closure GCC_UNUSED,
        XtPointer data GCC_UNUSED)
 {
-    hpFunctionKeys = ! hpFunctionKeys;
-    update_hp_fkeys();
+    toggle_keyboard_type(keyboardIsVT220);
 }
 #endif
 
-
 /*
  * The following cases use the pid instead of the process group so that we
  * don't get hosed by programs that change their process group
@@ -879,12 +878,7 @@
        XtPointer closure GCC_UNUSED,
        XtPointer data GCC_UNUSED)
 {
-    term->flags ^= REVERSE_VIDEO;
     ReverseVideo (term);
-
-    /* cancel out the internal state changes, so menus are decoupled */
-    term->flags ^= REVERSE_VIDEO;
-    term->misc.re_verse = !term->misc.re_verse;
 }
 
 
@@ -1479,7 +1473,7 @@
        String *params,
        Cardinal *param_count)
 {
-    handle_toggle (do_sun_fkeys, (int) sunFunctionKeys,
+    handle_toggle (do_sun_fkeys, term->keyboard.type == keyboardIsSun,
                   params, *param_count, w, (XtPointer)0, (XtPointer)0);
 }
 
@@ -1512,7 +1506,7 @@
        String *params,
        Cardinal *param_count)
 {
-    handle_toggle (do_sun_kbd, (int) sunKeyboard,
+    handle_toggle (do_sun_kbd, term->keyboard.type == keyboardIsVT220,
                   params, *param_count, w, (XtPointer)0, (XtPointer)0);
 }
 #endif
@@ -1524,7 +1518,7 @@
        String *params,
        Cardinal *param_count)
 {
-    handle_toggle (do_hp_fkeys, (int) hpFunctionKeys,
+    handle_toggle (do_hp_fkeys, term->keyboard.type == keyboardIsHP,
                   params, *param_count, w, (XtPointer)0, (XtPointer)0);
 }
 #endif
@@ -1893,7 +1887,7 @@
     { "insert",                        HandleKeyPressed }, /* alias */
     { "insert-eight-bit",      HandleEightBitKeyPressed },
     { "insert-seven-bit",      HandleKeyPressed },
-    { "secure",                HandleSecure },
+    { "secure",                        HandleSecure },
     { "string",                        HandleStringEvent },
 };
 
@@ -1913,7 +1907,7 @@
 
        params[0] = closure;
        params[1] = 0;
-       TRACE(("InitPopup(%s)\n", params[0]))
+       TRACE(("InitPopup(%s)\n", params[0]));
 
        domenu(gw, (XEvent *)0, params, &count);
 
@@ -1939,7 +1933,7 @@
        TRACE(("...SetupShell(%s) -> %s -> %#lx\n",
                menu_names[n].internal_name,
                external_name,
-               (long)shell[n].w))
+               (long)shell[n].w));
 
        sprintf(temp, "%sButton", menu_names[n].internal_name);
        menu_tops[n] = XtVaCreateManagedWidget (temp,
@@ -1961,7 +1955,7 @@
        Widget menu_tops[NUM_POPUP_MENUS];
 #endif
 
-       TRACE(("SetupMenus(%s)\n", shell == toplevel ? "vt100" : "tek4014"))
+       TRACE(("SetupMenus(%s)\n", shell == toplevel ? "vt100" : "tek4014"));
 
        if (shell == toplevel) {
            XawSimpleMenuAddGlobalActions (app_con);
@@ -2011,7 +2005,7 @@
        *menus = shell;
 #endif
 
-       TRACE(("...shell=%#lx\n", (long) shell))
-       TRACE(("...forms=%#lx\n", (long) *forms))
-       TRACE(("...menus=%#lx\n", (long) *menus))
+       TRACE(("...shell=%#lx\n", (long) shell));
+       TRACE(("...forms=%#lx\n", (long) *forms));
+       TRACE(("...menus=%#lx\n", (long) *menus));
 }
Index: menu.h
--- xterm-124+/menu.h   Thu Dec 30 05:01:00 1999
+++ xterm-125/menu.h    Mon Jan 31 11:16:37 2000
@@ -2,7 +2,7 @@
 /* $XFree86: xc/programs/xterm/menu.h,v 3.17 1999/12/30 02:05:55 robin Exp $ */
 /*
 
-Copyright 1999 by Thomas E. Dickey <dickey@clark.net>
+Copyright 1999-2000 by Thomas E. Dickey <dickey@clark.net>
 
                         All Rights Reserved
 
@@ -144,13 +144,13 @@
     mainMenu_num_lock,
     mainMenu_meta_esc,
 #endif
+#if OPT_HP_FUNC_KEYS
+    mainMenu_hp_fkeys,
+#endif
     mainMenu_sun_fkeys,
 #if OPT_SUNPC_KBD
     mainMenu_sun_kbd,
 #endif
-#if OPT_HP_FUNC_KEYS
-    mainMenu_hp_fkeys,
-#endif
     mainMenu_line2,
     mainMenu_suspend,
     mainMenu_continue,
@@ -315,20 +315,20 @@
 #define update_sun_fkeys() \
   update_menu_item (term->screen.mainMenu, \
                    mainMenuEntries[mainMenu_sun_fkeys].widget, \
-                   sunFunctionKeys)
+                   term->keyboard.type == keyboardIsSun)
 
 #if OPT_SUNPC_KBD
 #define update_sun_kbd() \
   update_menu_item (term->screen.mainMenu, \
                    mainMenuEntries[mainMenu_sun_kbd].widget, \
-                   sunKeyboard)
+                   term->keyboard.type == keyboardIsVT220)
 #endif
 
 #if OPT_HP_FUNC_KEYS
 #define update_hp_fkeys() \
   update_menu_item (term->screen.mainMenu, \
                    mainMenuEntries[mainMenu_hp_fkeys].widget, \
-                   hpFunctionKeys)
+                   term->keyboard.type == keyboardIsHP)
 #else
 #define update_hp_fkeys() /*nothing*/
 #endif
@@ -346,7 +346,7 @@
 #define update_reversevideo() \
   update_menu_item (term->screen.vtMenu, \
                    vtMenuEntries[vtMenu_reversevideo].widget, \
-                   (term->flags & REVERSE_VIDEO))
+                   (term->misc.re_verse))
 
 #define update_autowrap() \
   update_menu_item (term->screen.vtMenu, \
Index: misc.c
--- xterm-124+/misc.c   Tue Jan 25 01:45:01 2000
+++ xterm-125/misc.c    Sat Jan 29 19:54:59 2000
@@ -93,7 +93,14 @@
 #define environ gblenvp                /* circumvent a bug */
 #endif
 
-extern char **environ;         /* used in 'Setenv()' */
+#ifdef VMS
+#define XTERM_VMS_LOGFILE "SYS$SCRATCH:XTERM_LOG.TXT"
+#ifdef ALLOWLOGFILEEXEC
+#undef ALLOWLOGFILEEXEC
+#endif
+#endif /* VMS */
+
+extern char **environ;         /* used in 'xtermSetenv()' */
 
 #if OPT_TEK4014
 #define OUR_EVENT(event,Type) \
@@ -119,8 +126,14 @@
        register TScreen *screen = &term->screen;
 
        if (XtAppPending(app_con)
-       || GetBytesAvailable (ConnectionNumber(screen->display)) > 0)
-               xevents();
+       ||
+#if defined(VMS) || defined(__VMS)
+       screen->display->qlen > 0
+#else
+       GetBytesAvailable (ConnectionNumber(screen->display)) > 0
+#endif
+       )
+       xevents();
 }
 
 void
@@ -451,7 +464,7 @@
     struct timeval curtime;
     long now_msecs;
 
-    TRACE(("BELL %d\n", percent))
+    TRACE(("BELL %d\n", percent));
 
     /* has enough time gone by that we are allowed to ring
        the bell again? */
@@ -609,7 +622,7 @@
                root_y,
                *width,
                *height,
-               root_border))
+               root_border));
        *width -= (screen->border * 2),
        *height -= (screen->border * 2);
 
@@ -622,7 +635,7 @@
 
            TRACE(("QueryMaximize: WM hints max_w %#x max_h %#x\n",
                    hints.max_width,
-                   hints.max_height))
+                   hints.max_height));
 
            if ((unsigned) hints.max_width < *width)
                *width = hints.max_width;
@@ -662,7 +675,7 @@
                            screen->restore_x,
                            screen->restore_y,
                            screen->restore_width,
-                           screen->restore_height))
+                           screen->restore_height));
                }
 
                XMoveResizeWindow(screen->display,
@@ -679,7 +692,7 @@
                    screen->restore_x,
                    screen->restore_y,
                    screen->restore_width,
-                   screen->restore_height))
+                   screen->restore_height));
            screen->restore_data = False;
            XMoveResizeWindow(screen->display,
                              VShellWindow,
@@ -747,7 +760,7 @@
 #endif
 }
 
-#if defined(ALLOWLOGGING) || defined(DEBUG)
+#if (defined(ALLOWLOGGING) || defined(DEBUG)) && !defined(VMS)
 
 /*
  * create a file only if we could with the permissions of the real user id.
@@ -770,7 +783,7 @@
     SIGNAL_T (*chldfunc) (int);
 
     chldfunc = signal(SIGCHLD, SIG_DFL);
-#endif
+#endif /* HAVE_WAITPID */
 
     pid = fork();
     switch (pid)
@@ -784,12 +797,13 @@
            _exit(0);
        } else
            _exit(1);
+       /* NOTREACHED */
     case -1:                   /* error */
        return;
     default:                   /* parent */
 #ifdef HAVE_WAITPID
        waitpid(pid, NULL, 0);
-#else
+#else  /* HAVE_WAITPID */
        waited = wait(NULL);
        signal(SIGCHLD, chldfunc);
        /*
@@ -801,10 +815,10 @@
            if (waited == term->screen.pid)
                Cleanup(0);
        while ( (waited=nonblocking_wait()) > 0);
-#endif
+#endif /* HAVE_WAITPID */
     }
 }
-#endif
+#endif /* defined(ALLOWLOGGING) || defined(DEBUG) */
 
 #ifdef ALLOWLOGGING
 
@@ -843,6 +857,10 @@
 
        if(screen->logging || (screen->inhibit & I_LOG))
                return;
+#ifdef VMS  /* file name is fixed in VMS variant */
+       screen->logfd = open(XTERM_VMS_LOGFILE, O_CREAT|O_TRUNC|O_APPEND|O_RDWR, 0640);
+       if(screen->logfd < 0)return; /* open failed */
+#else /*VMS*/
        if(screen->logfile == NULL || *screen->logfile == 0) {
                if(screen->logfile)
                        free(screen->logfile);
@@ -931,6 +949,7 @@
                                         0644)) < 0)
                        return;
        }
+#endif /*VMS*/
        screen->logstart = CURRENT_EMU_VAL(screen, Tbuffer->ptr, VTbuffer.ptr);
        screen->logging = TRUE;
        update_logging();
@@ -953,6 +972,11 @@
        register IChar *cp;
        register int i;
 
+#ifdef VMS /* avoid logging output loops which otherwise occur sometimes
+             when there is no output and cp/screen->logstart are 1 apart */
+       if(!tt_new_output)return;
+       tt_new_output = FALSE;
+#endif /* VMS */
        cp = CURRENT_EMU_VAL(screen, Tbuffer->ptr, VTbuffer.ptr);
        if (screen->logstart != 0
         && (i = cp - screen->logstart) > 0) {
@@ -992,11 +1016,11 @@
        Colormap cmap = pTerm->core.colormap;
        char buffer[80];
 
-       TRACE(("ReportAnsiColorRequest %d\n", colornum))
+       TRACE(("ReportAnsiColorRequest %d\n", colornum));
        color.pixel = pTerm->screen.Acolors[colornum];
        XQueryColor(term->screen.display, cmap, &color);
        sprintf(buffer, "4;%d;rgb:%04x/%04x/%04x",
-                colornum,
+               colornum,
                color.red,
                color.green,
                color.blue);
@@ -1018,10 +1042,10 @@
     if (XParseColor(screen->display, cmap, name, &def)
      && XAllocColor(screen->display, cmap, &def)) {
        screen->Acolors[color] = def.pixel;
-       TRACE(("AllocateAnsiColor #%d: %s (pixel %#lx)\n", color, name, def.pixel))
+       TRACE(("AllocateAnsiColor #%d: %s (pixel %#lx)\n", color, name, def.pixel));
        return(TRUE);
     }
-    TRACE(("AllocateAnsiColor #%d: %s (failed)\n", color, name))
+    TRACE(("AllocateAnsiColor #%d: %s (failed)\n", color, name));
     return(FALSE);
 }
 
@@ -1035,7 +1059,7 @@
     int color;
     int r = False;
 
-    TRACE(("ChangeAnsiColorRequest string='%s'\n", buf))
+    TRACE(("ChangeAnsiColorRequest string='%s'\n", buf));
 
     while (buf && *buf) {
        name = strchr(buf, ';');
@@ -1146,7 +1170,7 @@
                 */
                if (buf != 0
                 && strcmp(buf, "?")
-                && ((cp = malloc((unsigned)strlen(buf) + 1)) != NULL) {
+                && ((cp = malloc((unsigned)strlen(buf) + 1)) != NULL)) {
                        strcpy(cp, buf);
                        if(screen->logfile)
                                free(screen->logfile);
@@ -1529,7 +1553,7 @@
 
        GetOldColors(pTerm);
        color.pixel = pOldColors->colors[ndx];
-       TRACE(("ReportColors %d: %#lx\n", ndx, pOldColors->colors[ndx]))
+       TRACE(("ReportColors %d: %#lx\n", ndx, pOldColors->colors[ndx]));
        XQueryColor(term->screen.display, cmap, &color);
        sprintf(buffer, "%d;rgb:%04x/%04x/%04x", ndx + 10,
                color.red,
@@ -1623,10 +1647,10 @@
        SET_COLOR_VALUE(pNew, ndx, def.pixel);
        strcpy(newName, name);
        SET_COLOR_NAME(pNew, ndx, newName);
-       TRACE(("AllocateColor #%d: %s (pixel %#lx)\n", ndx, newName, def.pixel))
+       TRACE(("AllocateColor #%d: %s (pixel %#lx)\n", ndx, newName, def.pixel));
        return(TRUE);
     }
-    TRACE(("AllocateColor #%d: %s (failed)\n", ndx, name))
+    TRACE(("AllocateColor #%d: %s (failed)\n", ndx, name));
     return(FALSE);
 }
 
@@ -1641,7 +1665,7 @@
 ScrnColors     newColors;
 int            i, ndx;
 
-    TRACE(("ChangeColorsRequest start=%d, names='%s'\n", start, names))
+    TRACE(("ChangeColorsRequest start=%d, names='%s'\n", start, names));
 
     if ((pOldColors == NULL)
      && (!GetOldColors(pTerm))) {
@@ -1742,7 +1766,7 @@
        }
        cleaning = TRUE;
 
-       TRACE(("Cleanup %d\n", code))
+       TRACE(("Cleanup %d\n", code));
 
        screen = &term->screen;
 
@@ -1773,12 +1797,12 @@
  * to have to do a realloc().
  */
 void
-Setenv (register char *var, register char *value)
+xtermSetenv (register char *var, register char *value)
 {
        register int envindex = 0;
        register size_t len = strlen(var);
 
-       TRACE(("Setenv(var=%s, value=%s)\n", var, value))
+       TRACE(("xtermSetenv(var=%s, value=%s)\n", var, value));
 
        while (environ [envindex] != NULL) {
            if (strncmp (environ [envindex], var, len) == 0) {
@@ -1791,7 +1815,7 @@
            envindex ++;
        }
 
-       TRACE(("...expanding env to %d\n", envindex+1))
+       TRACE(("...expanding env to %d\n", envindex+1));
 
        environ [envindex] = (char *) malloc ((unsigned)len + strlen (value) + 1);
        (void) strcpy (environ [envindex], var);
@@ -1859,7 +1883,7 @@
 #if OPT_TEK4014
 static void withdraw_window (Display *dpy, Window w, int scr)
 {
-    TRACE(("withdraw_window %#lx\n", (long)w))
+    TRACE(("withdraw_window %#lx\n", (long)w));
     (void) XmuUpdateMapHints (dpy, w, NULL);
     XWithdrawWindow (dpy, w, scr);
     return;
@@ -1871,7 +1895,7 @@
 {
     register TScreen *screen = &term->screen;
 
-    TRACE(("set_vt_visibility(%d)\n", on))
+    TRACE(("set_vt_visibility(%d)\n", on));
     if (on) {
        if (!screen->Vshow && term) {
            VTInit ();
@@ -1908,7 +1932,7 @@
 {
     register TScreen *screen = &term->screen;
 
-    TRACE(("set_tek_visibility(%d)\n", on))
+    TRACE(("set_tek_visibility(%d)\n", on));
     if (on) {
        if (!screen->Tshow && (tekWidget || TekInit())) {
            Widget tekParent = SHELL_OF(tekWidget);
Index: os2main.c
--- xterm-124+/os2main.c        Fri Nov 19 15:27:18 1999
+++ xterm-125/os2main.c Mon Jan 31 19:23:35 2000
@@ -927,13 +927,6 @@
         sameName = resource.sameName;
 #endif
        xterm_name = resource.xterm_name;
-       sunFunctionKeys = resource.sunFunctionKeys;
-#if OPT_SUNPC_KBD
-       sunKeyboard = resource.sunKeyboard;
-#endif
-#if OPT_HP_FUNC_KEYS
-       hpFunctionKeys = resource.hpFunctionKeys;
-#endif
        if (strcmp(xterm_name, "-") == 0) xterm_name = DFT_TERMTYPE;
        if (resource.icon_geometry != NULL) {
            int scr, junk;
@@ -1014,6 +1007,14 @@
                0);
            /* this causes the initialize method to be called */
 
+#if OPT_HP_FUNC_KEYS
+       init_keyboard_type(keyboardIsHP, resource.hpFunctionKeys);
+#endif
+       init_keyboard_type(keyboardIsSun, resource.sunFunctionKeys);
+#if OPT_SUNPC_KBD
+       init_keyboard_type(keyboardIsVT220, resource.sunKeyboard);
+#endif
+
         screen = &term->screen;
 
        inhibit = 0;
@@ -1560,7 +1561,7 @@
                        for (i = 0 ; gblenvp [i] != NULL ; i++)
                                ;
 
-                       /* compute number of Setenv() calls below */
+                       /* compute number of xtermSetenv() calls below */
                        envsize = 1;    /* (NULL terminating entry) */
                        envsize += 3;   /* TERM, WINDOWID, DISPLAY */
                        envsize += 2;   /* COLUMNS, LINES */
@@ -1568,16 +1569,16 @@
                        envnew = (char **) calloc ((unsigned) i + envsize, sizeof(char *));
                        memmove( (char *)envnew, (char *)gblenvp, i * sizeof(char *));
                        gblenvp = envnew;
-                       Setenv ("TERM=", TermName);
+                       xtermSetenv ("TERM=", TermName);
                        if(!TermName)
                                *newtc = 0;
 
                        sprintf (buf, "%lu",
                                ((unsigned long) XtWindow (XtParent(CURRENT_EMU(screen)))));
-                       Setenv ("WINDOWID=", buf);
+                       xtermSetenv ("WINDOWID=", buf);
 
                        /* put the display into the environment of the shell*/
-                       Setenv ("DISPLAY=", XDisplayString (screen->display));
+                       xtermSetenv ("DISPLAY=", XDisplayString (screen->display));
 
                        signal(SIGTERM, SIG_DFL);
 
@@ -1608,9 +1609,9 @@
                        }
 
                        sprintf (numbuf, "%d", screen->max_col + 1);
-                       Setenv("COLUMNS=", numbuf);
+                       xtermSetenv("COLUMNS=", numbuf);
                        sprintf (numbuf, "%d", screen->max_row + 1);
-                       Setenv("LINES=", numbuf);
+                       xtermSetenv("LINES=", numbuf);
 
                        /* reconstruct dead environ variable */
                        environ = gblenvp;
Index: print.c
--- xterm-124+/print.c  Fri Jan 21 19:19:54 2000
+++ xterm-125/print.c   Sun Jan 30 11:37:10 2000
@@ -4,7 +4,7 @@
 
 /************************************************************
 
-Copyright 1997,1998,1999 by Thomas E. Dickey <dickey@clark.net>
+Copyright 1997-2000 by Thomas E. Dickey <dickey@clark.net>
 
                         All Rights Reserved
 
@@ -55,6 +55,9 @@
 #define Strncmp(a,b,c) strncmp((char *)a,(char *)b,c)
 
 #define SGR_MASK (BOLD|BLINK|UNDERLINE|INVERSE)
+#ifdef VMS
+#define VMS_TEMP_PRINT_FILE "sys$scratch:xterm_print.txt"
+#endif
 
 static void charToPrinter (int chr);
 static void printLine (int row, int chr);
@@ -68,10 +71,23 @@
 
 static void closePrinter(void)
 {
+#ifdef VMS
+       register TScreen *screen = &term->screen;
+       char pcommand[256];
+       (void)sprintf(pcommand,"%s %s;",
+          screen->printer_command,
+          VMS_TEMP_PRINT_FILE);
+#endif
+
        if (Printer != 0) {
                fclose(Printer);
                TRACE(("closed printer, waiting...\n"));
+#ifdef VMS /* This is a quick hack, really should use spawn and check status
+             or system services and go straight to the queue */
+               (void) system(pcommand);
+#else /* VMS */
                while (nonblocking_wait() > 0)
+#endif /* VMS */
                        ;
                Printer = 0;
                initialized = 0;
@@ -82,7 +98,7 @@
 static void printCursorLine(void)
 {
        register TScreen *screen = &term->screen;
-       TRACE(("printCursorLine\n"))
+       TRACE(("printCursorLine\n"));
        printLine(screen->cur_row, '\n');
 }
 
@@ -224,7 +240,7 @@
        int bot = extent ? screen->max_row : screen->bot_marg;
        int was_open = initialized;
 
-       TRACE(("xtermPrintScreen, rows %d..%d\n", top, bot))
+       TRACE(("xtermPrintScreen, rows %d..%d\n", top, bot));
 
        while (top <= bot)
                printLine(top++, '\n');
@@ -252,7 +268,7 @@
        if (! screen->altbuf)
                top = - screen->savedlines;
 
-       TRACE(("xtermPrintEverything, rows %d..%d\n", top, bot))
+       TRACE(("xtermPrintEverything, rows %d..%d\n", top, bot));
        while (top <= bot)
                printLine(top++, '\n');
        if (screen->printer_formfeed)
@@ -308,7 +324,7 @@
 #if OPT_PC_COLORS
                if (term->screen.boldColors
                 && fg > 8
-                && attr & BOLD)
+                && (attr & BOLD) != 0)
                        fg -= 8;
 #endif
                sprintf(msg + strlen(msg), ";%d", (fg < 8) ? (30 + fg) : (82 + fg));
@@ -324,18 +340,30 @@
 static void charToPrinter(int chr)
 {
        if (!initialized) {
+#if defined(VMS)
+               /*
+                * This implementation only knows how to write to a file.  When
+                * the file is closed the print command executes.  Print
+                * command must be of the form:
+                *   print/que=name/delete [/otherflags].
+                */
+               Printer = fopen(VMS_TEMP_PRINT_FILE, "w");
+#else
+               /*
+                * This implementation only knows how to write to a pipe.
+                */
                FILE    *input;
                int     my_pipe[2];
                int     c;
                register TScreen *screen = &term->screen;
 
-               if (pipe(my_pipe))
+               if (pipe(my_pipe))
                        SysError (ERROR_FORK);
                if ((Printer_pid = fork()) < 0)
                        SysError (ERROR_FORK);
 
                if (Printer_pid == 0) {
-                       TRACE(((char *)0))
+                       TRACE(((char *)0));
                        close(my_pipe[1]);      /* printer is silent */
                        close (screen->respond);
 
@@ -363,8 +391,9 @@
                        close(my_pipe[0]);      /* won't read from printer */
                        Printer = fdopen(my_pipe[1], "w");
                        TRACE(("opened printer from pid %d/%d\n",
-                               (int)getpid(), Printer_pid))
+                               (int)getpid(), Printer_pid));
                }
+#endif
                initialized++;
        }
        if (Printer != 0) {
@@ -397,7 +426,7 @@
 {
        register TScreen *screen = &term->screen;
 
-       TRACE(("MediaCopy param=%d, private=%d\n", param, private_seq))
+       TRACE(("MediaCopy param=%d, private=%d\n", param, private_seq));
 
        if (private_seq) {
                switch (param) {
@@ -406,11 +435,11 @@
                        break;
                case  4:
                        screen->printer_controlmode = 0;
-                       TRACE(("Reset autoprint mode\n"))
+                       TRACE(("Reset autoprint mode\n"));
                        break;
                case  5:
                        screen->printer_controlmode = 1;
-                       TRACE(("Set autoprint mode\n"))
+                       TRACE(("Set autoprint mode\n"));
                        break;
                case  10:       /* VT320 */
                        xtermPrintScreen(FALSE);
@@ -427,11 +456,11 @@
                        break;
                case  4:
                        screen->printer_controlmode = 0;
-                       TRACE(("Reset printer controller mode\n"))
+                       TRACE(("Reset printer controller mode\n"));
                        break;
                case  5:
                        screen->printer_controlmode = 2;
-                       TRACE(("Set printer controller mode\n"))
+                       TRACE(("Set printer controller mode\n"));
                        break;
                }
        }
@@ -448,7 +477,7 @@
        register TScreen *screen = &term->screen;
 
        if (screen->printer_controlmode == 1) {
-               TRACE(("AutoPrint %d\n", chr))
+               TRACE(("AutoPrint %d\n", chr));
                printLine(screen->cursor_row, chr);
                if (Printer != 0)
                        fflush(Printer);
@@ -485,7 +514,7 @@
        static size_t length;
        size_t n;
 
-       TRACE(("In printer:%d\n", chr))
+       TRACE(("In printer:%d\n", chr));
 
        switch (chr) {
        case 0:
@@ -507,7 +536,7 @@
                         && Strcmp(bfr, tbl[n].seq) == 0) {
                                screen->printer_controlmode = tbl[n].active;
                                TRACE(("Set printer controller mode %sactive\n",
-                                       tbl[n].active ? "" : "in"))
+                                       tbl[n].active ? "" : "in"));
                                if (screen->printer_autoclose
                                 && screen->printer_controlmode == 0)
                                        closePrinter();
Index: ptydata.c
--- xterm-124+/ptydata.c        Thu Dec 30 05:01:00 1999
+++ xterm-125/ptydata.c Sun Jan 30 11:33:51 2000
@@ -4,7 +4,7 @@
 
 /************************************************************
 
-Copyright 1999 by Thomas E. Dickey <dickey@clark.net>
+Copyright 1999-2000 by Thomas E. Dickey <dickey@clark.net>
 
                         All Rights Reserved
 
@@ -168,7 +168,7 @@
                TRACE(("UTF-8 count %d, char %04X input %d/%d bytes\n",
                        screen->utf_count,
                        screen->utf_char,
-                       data->cnt, j))
+                       data->cnt, j));
                data->cnt = j;
            } else {
                for (i = 0; i < data->cnt; i++)
@@ -183,10 +183,10 @@
            }
 #if OPT_TRACE
            for (i = 0; i < data->cnt; i++) {
-               if (!(i%8)) TRACE(("%s", i ? "\n    " : "READ"))
-               TRACE((" %04X", data->ptr[i]))
+               if (!(i%8)) TRACE(("%s", i ? "\n    " : "READ"));
+               TRACE((" %04X", data->ptr[i]));
            }
-           TRACE(("\n"))
+           TRACE(("\n"));
 #endif
            return (data->cnt);
        }
Index: ptyx.h
--- xterm-124+/ptyx.h   Fri Jan 21 19:19:54 2000
+++ xterm-125/ptyx.h    Mon Jan 31 11:00:33 2000
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright 1999 by Thomas E. Dickey <dickey@clark.net>
+ * Copyright 1999-2000 by Thomas E. Dickey <dickey@clark.net>
  *
  *                         All Rights Reserved
  *
@@ -794,6 +794,7 @@
        int             cur_foreground; /* current foreground color     */
        int             cur_background; /* current background color     */
        int             sgr_foreground; /* current SGR foreground color */
+       Boolean         sgr_extended;   /* SGR set with extended codes? */
 #endif
 } SavedCursor;
 
@@ -1104,9 +1105,17 @@
 
 #define MULTICLICKTIME 250     /* milliseconds */
 
+typedef enum {
+    keyboardIsDefault,
+    keyboardIsHP,
+    keyboardIsSun,
+    keyboardIsVT220,
+} xtermKeyboardType;
+
 typedef struct
 {
-       unsigned        flags;
+    xtermKeyboardType type;
+    unsigned   flags;
 } TKeyboard;
 
 typedef struct _Misc {
@@ -1208,6 +1217,7 @@
     Pixel       dft_background;        /* default background color     */
 #if OPT_ISO_COLORS
     int         sgr_foreground;        /* current SGR foreground color */
+    Boolean     sgr_extended;  /* SGR set with extended codes? */
 #endif
 #if OPT_ISO_COLORS || OPT_DEC_CHRSET || OPT_WIDE_CHARS
     int         num_ptrs;      /* number of pointers per row in 'ScrnBuf' */
Index: screen.c
--- xterm-124+/screen.c Thu Dec 30 05:01:00 1999
+++ xterm-125/screen.c  Sun Jan 30 11:34:22 2000
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright 1999 by Thomas E. Dickey <dickey@clark.net>
+ * Copyright 1999-2000 by Thomas E. Dickey <dickey@clark.net>
  *
  *                         All Rights Reserved
  *
@@ -633,7 +633,7 @@
        TRACE(("ScrnRefresh (%d,%d) - (%d,%d)%s\n",
                toprow, leftcol,
                nrows, ncols,
-               force ? " force" : ""))
+               force ? " force" : ""));
 
        if(screen->cursor_col >= leftcol
        && screen->cursor_col <= (leftcol + ncols - 1)
@@ -818,7 +818,7 @@
                        lastind, col,
                        visibleChars(
                                PAIRED_CHARS(&chars[lastind], WIDEC_PTR(lastind)),
-                               col - lastind)))
+                               col - lastind)));
                   x = drawXtermText(screen, flags, gc, x, y,
                        cs,
                        PAIRED_CHARS(&chars[lastind], WIDEC_PTR(lastind)),
@@ -859,7 +859,7 @@
           TRACE(("%s @%d, calling drawXtermText %d..%d:%s\n",
                __FILE__, __LINE__,
                lastind, col,
-               visibleChars(PAIRED_CHARS(&chars[lastind], WIDEC_PTR(lastind)), col - lastind)))
+               visibleChars(PAIRED_CHARS(&chars[lastind], WIDEC_PTR(lastind)), col - lastind)));
           drawXtermText(screen, flags, gc, x, y,
                cs,
                PAIRED_CHARS(&chars[lastind], WIDEC_PTR(lastind)),
@@ -908,7 +908,7 @@
        register int row;
        register int flags = TERM_COLOR_FLAGS;
 
-       TRACE(("ClearBufRows %d..%d\n", first, last))
+       TRACE(("ClearBufRows %d..%d\n", first, last));
        for (row = first; row <= last; row++) {
            ScrnClrWrapped(screen, row);
            bzero (BUF_CHARS(buf, row), len);
@@ -963,7 +963,7 @@
 #endif /* sun vs TIOCSWINSZ */
        Window tw = VWindow (screen);
 
-       TRACE(("ScreenResize %dx%d\n", height, width))
+       TRACE(("ScreenResize %dx%d\n", height, width));
 
        /* clear the right and bottom internal border because of NorthWest
           gravity might have left junk on the right and bottom edges */
@@ -995,7 +995,7 @@
                 screen->savelines : 0;
                int delta_rows = rows - (screen->max_row + 1);
 
-               TRACE(("...ScreenResize chars %dx%d\n", rows, cols))
+               TRACE(("...ScreenResize chars %dx%d\n", rows, cols));
 
                if(screen->cursor_state)
                        HideCursor();
@@ -1081,7 +1081,7 @@
        ts.ts_lines = rows;
        ts.ts_cols = cols;
        code = ioctl (screen->respond, TIOCSSIZE, &ts);
-       TRACE(("return %d from TIOCSSIZE %dx%d\n", code, rows, cols))
+       TRACE(("return %d from TIOCSSIZE %dx%d\n", code, rows, cols));
 #ifdef SIGWINCH
        if(screen->pid > 1) {
                int     pgrp;
@@ -1097,7 +1097,7 @@
        ws.ws_xpixel = width;
        ws.ws_ypixel = height;
        code = ioctl (screen->respond, TIOCSWINSZ, (char *)&ws);
-       TRACE(("return %d from TIOCSWINSZ %dx%d\n", code, rows, cols))
+       TRACE(("return %d from TIOCSWINSZ %dx%d\n", code, rows, cols));
 #ifdef notdef  /* change to SIGWINCH if this doesn't work for you */
        if(screen->pid > 1) {
                int     pgrp;
@@ -1107,7 +1107,7 @@
        }
 #endif /* SIGWINCH */
 #else
-       TRACE(("ScreenResize cannot do anything to pty\n"))
+       TRACE(("ScreenResize cannot do anything to pty\n"));
 #endif /* sun vs TIOCSWINSZ */
        return (0);
 }
Index: scrollbar.c
--- xterm-124+/scrollbar.c      Sun Aug 22 14:20:13 1999
+++ xterm-125/scrollbar.c       Sun Jan 30 11:33:51 2000
@@ -4,6 +4,35 @@
  */
 
 /*
+ * Copyright 2000 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.
+ *
+ *
  * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
  *
  *                         All Rights Reserved
@@ -110,7 +139,7 @@
         */
 
        TRACE(("ResizeScreen(min_width=%d, min_height=%d) xw=%#lx\n",
-               min_width, min_height, (long) xw))
+               min_width, min_height, (long) xw));
 
 #ifndef nothack
        /*
@@ -155,13 +184,13 @@
        TRACE(("...requesting screensize chars %dx%d, pixels %dx%d\n",
                (screen->max_row + 1),
                (screen->max_col + 1),
-               reqHeight, reqWidth))
+               reqHeight, reqWidth));
 
        geomreqresult = XtMakeResizeRequest ((Widget)xw, reqWidth, reqHeight,
                                             &repWidth, &repHeight);
 
        if (geomreqresult == XtGeometryAlmost) {
-           TRACE(("...almost, retry screensize %dx%d\n", repHeight, repWidth))
+           TRACE(("...almost, retry screensize %dx%d\n", repHeight, repWidth));
            geomreqresult = XtMakeResizeRequest ((Widget)xw, repWidth,
                                                  repHeight, NULL, NULL);
        }
Index: tabs.c
--- xterm-124+/tabs.c   Sun Oct 25 13:31:39 1998
+++ xterm-125/tabs.c    Sat Jan 29 19:46:24 2000
@@ -4,6 +4,34 @@
  */
 
 /*
+ * Copyright 2000 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.
+ *
  * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
  *
  *                         All Rights Reserved
@@ -87,7 +115,7 @@
        register TScreen *screen = &term->screen;
 
        if(screen->curses && screen->do_wrap && (term->flags & WRAPAROUND)) {
-               Index(screen, 1);
+               xtermIndex(screen, 1);
                col = screen->cur_col = screen->do_wrap = 0;
        }
        for (++col; col<MAX_TABS; ++col)
Index: termcap
--- xterm-124+/termcap  Sun Jan 30 18:41:54 2000
+++ xterm-125/termcap   Mon Jan 31 19:37:02 2000
@@ -132,7 +132,7 @@
        :k5=\E[228z:k6=\E[229z:k7=\E[230z:k8=\E[231z:\
        :k9=\E[232z:k;=\E[233z:F1=\E[192z:F2=\E[193z:\
        :%1=\E[196z:&8=\E[195z:@0=\E[200z:kI=\E[2z:\
-       :kN=\E[222z:kP=\E[216z:kh=\E[214z:as@:ae@:ac@:tc=xterm:
+       :kN=\E[222z:kP=\E[216z:kh=\E[214z:kD=^?:as@:ae@:ac@:tc=xterm:
 #
 # vi may work better with this entry, because vi doesn't use insert mode much.
 # |xterm-ic|xterm-vi|xterm with insert character instead of insert mode:\
Index: terminfo
--- xterm-124+/terminfo Sun Jan 30 18:41:54 2000
+++ xterm-125/terminfo  Mon Jan 31 12:08:22 2000
@@ -343,6 +343,7 @@
        kcud1=\EOB,
        kcuf1=\EOC,
        kcuu1=\EOA,
+       kdch1=\177,
        kend=\E[220z,
        kent=\EOM,
        kf1=\E[224z,
Index: testxmc.c
--- xterm-124+/testxmc.c        Mon May  3 16:47:48 1999
+++ xterm-125/testxmc.c Sun Jan 30 11:34:22 2000
@@ -4,7 +4,7 @@
 
 /************************************************************
 
-Copyright 1997 by Thomas E. Dickey <dickey@clark.net>
+Copyright 1997-2000 by Thomas E. Dickey <dickey@clark.net>
 
                         All Rights Reserved
 
@@ -136,7 +136,7 @@
        if (found) {
                unsigned save = term->flags;
                term->flags ^= whichone;
-               TRACE(("XMC Writing glitch (%d/%d) after SGR %d\n", my_attrs, whichone, param))
+               TRACE(("XMC Writing glitch (%d/%d) after SGR %d\n", my_attrs, whichone, param));
                dotext(screen, '?', glitch, screen->xmc_glitch);
                term->flags = save;
        }
@@ -202,7 +202,7 @@
                changed ? "Ripple" : "Nochange",
                term->flags & my_attrs ? "on" : "off",
                my_attrs, start,
-               screen->cur_row, screen->cur_col, row, col))
+               screen->cur_row, screen->cur_col, row, col));
 
        if (changed) {
                ScrnRefresh (screen, screen->cur_row, 0, row + 1 - screen->cur_row, screen->max_col + 1, True);
Index: trace.h
--- xterm-124+/trace.h  Tue Jan 25 01:45:01 2000
+++ xterm-125/trace.h   Sun Jan 30 11:27:14 2000
@@ -46,7 +46,7 @@
        __attribute__ ((format(printf,1,2)))
 #endif
        ;
-#define TRACE(p) Trace p;
+#define TRACE(p) Trace p
 
 extern char *  visibleChars (PAIRED_CHARS(Char *buf, Char *buf2), unsigned len);
 extern char *  visibleIChar (IChar *, unsigned);
Index: util.c
--- xterm-124+/util.c   Fri Jan 21 19:19:54 2000
+++ xterm-125/util.c    Mon Jan 31 11:54:14 2000
@@ -4,7 +4,7 @@
  */
 
 /*
- * Copyright 1999 by Thomas E. Dickey <dickey@clark.net>
+ * Copyright 1999-2000 by Thomas E. Dickey <dickey@clark.net>
  *
  *                         All Rights Reserved
  *
@@ -64,6 +64,7 @@
 #include <menu.h>
 #include <fontutils.h>
 
+#include <stdio.h>
 #include <ctype.h>
 
 extern Bool waiting_for_initial_map;
@@ -191,7 +192,7 @@
  * requires: amount > 0
  */
 void
-Scroll(register TScreen *screen, register int amount)
+xtermScroll(register TScreen *screen, register int amount)
 {
        register int i = screen->bot_marg - screen->top_marg + 1;
        register int shift;
@@ -1088,7 +1089,7 @@
        register int toprow, leftcol, nrows, ncols;
 
        TRACE(("handle_translated_exposure (%d,%d) - (%d,%d)\n",
-               rect_y, rect_x, rect_height, rect_width))
+               rect_y, rect_x, rect_height, rect_width));
 
        toprow = (rect_y - screen->border) / FontHeight(screen);
        if(toprow < 0)
@@ -1401,7 +1402,7 @@
 
                TRACE(("DRAWTEXT%c[%4d,%4d] (%d) %d:%.*s\n",
                        screen->cursor_state == OFF ? ' ' : '*',
-                       y, x, chrset, len, (int)len, text))
+                       y, x, chrset, len, (int)len, text));
 
                if (gc2 != 0) { /* draw actual double-sized characters */
                        XFontStruct *fs = screen->double_fonts[xterm_Double_index(chrset, flags)].fs;
@@ -1476,7 +1477,7 @@
                                x += len * FontWidth(screen);
                        }
 
-                       TRACE(("drewtext [%4d,%4d]\n", y, x))
+                       TRACE(("drewtext [%4d,%4d]\n", y, x));
                        SAVE_FONT_INFO (screen);
 
                } else {        /* simulate double-sized characters */
@@ -1556,7 +1557,7 @@
                TRACE(("drawtext%c[%4d,%4d] (%d) %d:%s\n",
                        screen->cursor_state == OFF ? ' ' : '*',
                        y, x, chrset, len,
-                       visibleChars(PAIRED_CHARS(text, text2), len)))
+                       visibleChars(PAIRED_CHARS(text, text2), len)));
                y += FontAscent(screen);
 
 #if OPT_WIDE_CHARS
@@ -1890,4 +1891,51 @@
 #endif
        }
        return ch;
+}
+
+void set_keyboard_type(xtermKeyboardType type, Bool set)
+{
+    xtermKeyboardType save = term->keyboard.type;
+
+    if (set) {
+       term->keyboard.type = type;
+    } else {
+       term->keyboard.type = keyboardIsDefault;
+    }
+
+    if (save != term->keyboard.type) {
+       update_hp_fkeys();
+       update_sun_fkeys();
+       update_sun_kbd();
+    }
+}
+
+void toggle_keyboard_type(xtermKeyboardType type)
+{
+    xtermKeyboardType save = term->keyboard.type;
+
+    if (term->keyboard.type == type) {
+       term->keyboard.type = keyboardIsDefault;
+    } else {
+       term->keyboard.type = type;
+    }
+
+    if (save != term->keyboard.type) {
+       update_hp_fkeys();
+       update_sun_fkeys();
+       update_sun_kbd();
+    }
+}
+
+void init_keyboard_type(xtermKeyboardType type, Bool set)
+{
+    static Bool wasSet = False;
+
+    if (set) {
+       if (wasSet) {
+           fprintf(stderr, "Conflicting keyboard type option\n");
+       }
+       term->keyboard.type = type;
+       wasSet = True;
+    }
 }
Index: version.h
--- xterm-124+/version.h        Sun Jan 30 18:41:54 2000
+++ xterm-125/version.h Mon Jan 31 20:34:27 2000
@@ -6,5 +6,5 @@
  * XFree86 to which this version of xterm has been built.  The number in
  * parentheses is my patch number (T.Dickey).
  */
-#define XTERM_PATCH   124
-#define XFREE86_VERSION "XFree86 3.9.17b"
+#define XTERM_PATCH   125
+#define XFREE86_VERSION "XFree86 3.9.17c"
Index: vms.c
--- /dev/null   Sun Jul 17 19:46:18 1994
+++ xterm-125/vms.c     Sun Jan 30 14:47:04 2000
@@ -0,0 +1,725 @@
+/* $XFree86$ */
+
+/*  vms.c
+ *
+ * This module contains the VMS version of the routine SPAWN (from the module
+ * MAIN.C) and the routines that do IO to the pseudo terminal.
+ *
+ * Modification History:
+ * Stephan Jansen 1-Mar-1990  Original version
+ * Hal R. Brand   5-Sep-1990  Added code to propagate DECW$DISPLAY
+ * Aaron Leonard 11-Sep-1990  Fix string descriptor lengths
+ * Stephan Jansen 2-Dec-1991  Modify to use new Pseudo terminal drivers
+ *                            (patterned after photo.c by Forrest A. Kenney)
+ * Patrick Mahan  7-Jan-1991  Removed reference to <dvidef.h> from VMS.C
+ *                           Forced device type to be VT102 since that is
+ *                           what we are emulating.
+ */
+
+#include <libdef.h>
+#include <lnmdef.h>
+
+#include <stdio.h>
+#include <string.h>
+
+#include "ptyx.h"
+#include "data.h"
+#include "vms.h"
+
+#define PTD$C_SEND_XON         0       /* Pseudo Terminal Driver event      */
+#define PTD$C_SEND_BELL                1
+#define PTD$C_SEND_XOFF        2
+#define PTD$C_STOP_OUTPUT      3
+#define PTD$C_RESUME_OUTPUT    4
+#define PTD$C_CHAR_CHANGED     5
+#define PTD$C_ABORT_OUTPUT     6
+#define PTD$C_START_READ       7
+#define PTD$C_MIDDLE_READ      8
+#define PTD$C_END_READ                 9
+#define PTD$C_ENABLE_READ      10
+#define PTD$C_DISABLE_READ     11
+#define PTD$C_MAX_EVENTS       12
+
+#define        BUFFERS                 6
+#define        PAGE                    512
+
+typedef struct tt_buffer
+{
+unsigned int   flink;
+unsigned int   blink;
+short  int     status;
+short  int     length;
+char           data[VMS_TERM_BUFFER_SIZE];
+} TT_BUF_STRUCT;
+
+TT_BUF_STRUCT          *tt_w_buff;
+struct q_head           _align(QUADWORD)       buffer_queue = (0,0);
+struct q_head           _align(QUADWORD)       read_queue = (0,0);
+
+static char          tt_name[64];
+static $DESCRIPTOR   (tt_name_desc, &tt_name);
+
+static char          ws_name[64];
+static $DESCRIPTOR   (ws_name_desc, &ws_name);
+
+static struct        tt_char {
+   char        class;
+   char        type;
+   short int   page_width;
+   char        characteristics[3];
+   char        length;
+   int         extended;
+ } tt_mode, tt_chars, orig_tt_chars;
+
+struct mem_region
+{
+  TT_BUF_STRUCT *start;
+  TT_BUF_STRUCT *end;
+} ret_addr;
+
+int read_stopped = FALSE;
+int write_stopped = FALSE;
+
+int tt_width;
+int tt_length;
+int tt_changed;
+int tt_pasting=FALSE;         /* drm */
+int tt_new_output=FALSE;      /* Cleared by flushlog(), set whenever something new
+   goes to the screen through tt_write */
+
+int trnlnm(char *in,int id,char *out);
+int tt_write(char *tt_write_buf,int size);
+void spawn (void);
+
+static void tt_echo_ast(TT_BUF_STRUCT *buff_addr);
+static void tt_read_ast(TT_BUF_STRUCT *buff_addr);
+
+/*
+static void tt_start_read(void);
+*/
+void tt_start_read(void);
+int tt_read(char *buffer);
+static void send_xon(void);
+static void send_xoff(void);
+static void send_bell(void);
+static void char_change(void);
+static void freeBuff (TT_BUF_STRUCT *buff_addr);
+TT_BUF_STRUCT *getBuff(void);
+static void CloseDown(int exit_status);
+static void mbx_read_ast(void);
+static void mbx_read(void);
+
+
+
+#define DESCRIPTOR(name,string) struct dsc$descriptor_s name = \
+{ strlen(string), DSC$K_DTYPE_T, DSC$K_CLASS_S, string }
+
+int trnlnm(char *in, int id, char *out)
+{
+  int status, num, len, attr = LNM$M_CASE_BLIND, foo = id;
+  short outlen;
+  struct itemlist
+    {
+      short buffer_length;
+      short item_code;
+      char  *buffer_addr;
+      int   *return_length;
+    } itmlst[] =
+      {
+       4  , LNM$_INDEX    , &foo, 0,
+       255, LNM$_STRING   , out , &outlen,
+       4  , LNM$_MAX_INDEX, &num, &len,
+       0  , 0
+       };
+  DESCRIPTOR(lognam,in);
+  DESCRIPTOR(tabnam,"LNM$DCL_LOGICAL");
+
+  status = sys$trnlnm(&attr,&tabnam,&lognam,0,itmlst);
+  if(status != SS$_NORMAL) return(-1);   /* error status */
+  out[outlen] = 0;         /* terminate the output string */
+  return(++num);         /* return number of translations */
+}
+
+static int           pty;
+static int           Xsocket;
+
+void spawn (void)
+{
+  int                  status;
+  static $DESCRIPTOR   (dtime, "0 00:00:00.01");
+  static int           delta[2];
+  register TScreen     *screen = &term->screen;
+  static struct IOSB   iosb;
+  static unsigned int  flags;
+  static unsigned int  uic;
+  static char          imagename[64];
+  static int           privs;
+  static $DESCRIPTOR(device, "FTA0:");
+  static int           type;
+  static int           class;
+  static int           devdepend;
+  static int           mem_size;
+  int                  i;
+
+  /* if pid and mbx_chan are nonzero then close them in CloseDown() */
+  pid = 0;
+  mbx_chan = 0;
+
+  status = SYS$EXPREG (BUFFERS, &ret_addr, 0, 0);
+  if(!(status & SS$_NORMAL)) lib$signal(status);
+
+  tt_w_buff = (char *)ret_addr.end - PAGE + 1;
+
+  /* use one buffer for writing, the reset go in the free buffer queue */
+  for(i=0; i < BUFFERS-1; i++)
+    {
+      freeBuff((char *)ret_addr.start +i*PAGE);
+    }
+
+  /* avoid double MapWindow requests, for wm's that care... */
+  XtSetMappedWhenManaged( screen->TekEmu ? XtParent(tekWidget) :
+                        XtParent(term), False );
+  /* Realize the Tek or VT widget, depending on which mode we're in.
+     If VT mode, this calls VTRealize (the widget's Realize proc) */
+  XtRealizeWidget (screen->TekEmu ? XtParent(tekWidget) :
+                  XtParent(term));
+
+  /* get the default device characteristics of the pseudo terminal */
+
+  itemlist[0].buflen      = 4;
+  itemlist[0].code        = DVI$_DEVTYPE;
+  itemlist[0].buffer      = &type;
+  itemlist[0].return_addr = &tt_name_desc.dsc$w_length;
+
+  itemlist[1].buflen      = 4;
+  itemlist[1].code        = DVI$_DEVCLASS;
+  itemlist[1].buffer      = &class;
+  itemlist[1].return_addr = &tt_name_desc.dsc$w_length;
+
+  itemlist[2].buflen      = 4;
+  itemlist[2].code        = DVI$_DEVDEPEND;
+  itemlist[2].buffer      = &devdepend;
+  itemlist[2].return_addr = &tt_name_desc.dsc$w_length;
+
+  itemlist[3].buflen      = 4;
+  itemlist[3].code        = DVI$_DEVDEPEND2;
+  itemlist[3].buffer      = &tt_chars.extended;
+  itemlist[3].return_addr = &tt_name_desc.dsc$w_length;
+
+  itemlist[4].buflen      = 0;
+  itemlist[4].code        = 0;
+
+
+  status = sys$getdviw(0,0,&device,&itemlist,&iosb,0,0,0);
+  if(!(status & SS$_NORMAL)) lib$signal(status);
+  if(!(iosb.status & SS$_NORMAL)) lib$signal(iosb.status);
+
+  tt_chars.type        = DT$_VT102; /* XTerm supports VT102 mode */
+  tt_chars.class       = class;
+  tt_chars.page_width  = screen->max_col+1;
+  tt_chars.length      = screen->max_row+1;
+
+  /* copy the default char's along with the created window size */
+
+  bcopy(&devdepend, &tt_chars.characteristics, 3);
+
+  tt_chars.extended |= TT2$M_ANSICRT | TT2$M_AVO | TT2$M_DECCRT;
+
+
+  /* create the pseudo terminal with the proper char's */
+  status = ptd$create(&tt_chan,0,&tt_chars,12,0,0,0,&ret_addr);
+  if(!(status & SS$_NORMAL)) lib$signal(status);
+
+
+  /* get the device name of the Pseudo Terminal */
+
+  itemlist[0].buflen      = 64;
+  itemlist[0].code        = DVI$_DEVNAM;
+  itemlist[0].buffer      = &tt_name;
+  itemlist[0].return_addr = &tt_name_desc.dsc$w_length;
+
+  /* terminate the list */
+  itemlist[1].buflen      = 0;
+  itemlist[1].code        = 0;
+
+  status = sys$getdviw(0,tt_chan,0,&itemlist,&iosb,0,0,0);
+  if(!(status & SS$_NORMAL)) CloseDown(status);
+  if(!(iosb.status & SS$_NORMAL)) CloseDown(iosb.status);
+
+  /*
+   * set up AST's for XON, XOFF, BELL and characteristics change.
+   */
+
+  status = ptd$set_event_notification(tt_chan,&send_xon,0,0,PTD$C_SEND_XON);
+  if(!(status & SS$_NORMAL)) CloseDown(status);
+
+  status = ptd$set_event_notification(tt_chan,&send_xoff,0,0,PTD$C_SEND_XOFF);
+  if(!(status & SS$_NORMAL)) CloseDown(status);
+
+  status = ptd$set_event_notification(tt_chan,&send_bell,0,0,PTD$C_SEND_BELL);
+  if(!(status & SS$_NORMAL)) CloseDown(status);
+
+  status = ptd$set_event_notification(tt_chan,&char_change,0,0,PTD$C_CHAR_CHANGED);
+  if(!(status & SS$_NORMAL)) CloseDown(status);
+
+  /* create a mailbox for the detached process to detect hangup */
+
+  status = sys$crembx(0,&mbx_chan,ACC$K_TERMLEN,0,255,0,0);
+  if(!(status & SS$_NORMAL)) CloseDown(status);
+
+
+  /*
+   * get the device unit number for created process completion
+   * status to be sent to.
+   */
+
+  itemlist[0].buflen      = 4;
+  itemlist[0].code        = DVI$_UNIT;
+  itemlist[0].buffer      = &mbxunit;
+  itemlist[0].return_addr = 0;
+
+  /* terminate the list */
+  itemlist[1].buflen      = 0;
+  itemlist[1].code        = 0;
+
+  status = sys$getdviw(0,mbx_chan,0,&itemlist,&iosb,0,0,0);
+  if(!(status & SS$_NORMAL)) CloseDown(status);
+  if(!(iosb.status & SS$_NORMAL)) CloseDown(iosb.status);
+
+
+  tt_start_read();
+
+  /*
+   * find the current process's UIC so that it can be used in the
+   * call to sys$creprc
+   */
+  itemlist[0].buflen = 4;
+  itemlist[0].code = JPI$_UIC;
+  itemlist[0].buffer = &uic;
+  itemlist[0].return_addr = 0;
+
+  /* terminate the list */
+  itemlist[1].buflen      = 0;
+  itemlist[1].code        = 0;
+
+  status = sys$getjpiw(0,0,0,&itemlist,0,0,0);
+  if(!(status & SS$_NORMAL)) CloseDown(status);
+
+  /* Complete a descriptor for the WS (DECW$DISPLAY) device */
+
+  trnlnm("DECW$DISPLAY",0,ws_name);
+  ws_name_desc.dsc$w_length = strlen(ws_name);
+
+  /* create the process */
+  /*  Set sys$error to be the WS (DECW$DISPLAY) device. LOGINOUT  */
+  /*  has special code for DECWINDOWS that will:                  */
+  /*    1) do a DEFINE/JOB DECW$DISPLAY 'f$trnlnm(sys$error)'     */
+  /*    2) then redefine SYS$ERROR to match SYS$OUTPUT!           */
+  /*  This will propogate DECW$DISPLAY to the XTERM process!!!    */
+  /*  Thanks go to Joel M Snyder who posted this info to INFO-VAX */
+
+  flags = PRC$M_INTER | PRC$M_NOPASSWORD | PRC$M_DETACH;
+  status = sys$creprc(&pid,&image,&tt_name_desc,&tt_name_desc,
+                     &ws_name_desc,0,0,0,4,uic,mbxunit,flags);
+  if(!(status & SS$_NORMAL)) CloseDown(status);
+
+
+  /* hang a read on the mailbox waiting for completion */
+  mbx_read();
+
+
+/* set time value and schedule a periodic wakeup (every 1/100 of a second)
+ * this is used to prevent the controlling process from using up all the
+ * CPU.  The controlling process will hibernate at strategic points in
+ * the program when it is just waiting for input.
+ */
+
+  status = sys$bintim(&dtime,&delta);
+  if (!(status & SS$_NORMAL)) CloseDown(status);
+
+  status = sys$schdwk(0,0,&delta,&delta);
+  if (!(status & SS$_NORMAL)) CloseDown(status);
+
+
+  /*
+   * This is rather funky, but it saves me from having to totally
+   * rewrite some parts of the code (namely in_put in module CHARPROC.C)
+   */
+  pty = 1;
+  screen->respond = pty;
+  pty_mask = 1 << pty;
+  Select_mask = pty_mask;
+  X_mask = 1 << Xsocket;
+
+}
+
+
+/*
+ * This routine handles completion of write with echo.  It takes the
+ * echo buffer and puts it on the read queue.  It will then be processed
+ * by the routine tt_read.  If the echo buffer is empty, it is put back
+ * on the free buffer queue.
+ */
+
+static void tt_echo_ast(TT_BUF_STRUCT *buff_addr)
+{
+  int status;
+
+  if (buff_addr->length != 0)
+    {
+      status = LIB$INSQTI(buff_addr, &read_queue);
+      if((status != SS$_NORMAL) && (status != LIB$_ONEENTQUE))
+       {
+         CloseDown(status);
+       }
+    }
+  else
+    {
+      freeBuff(buff_addr);
+    }
+}
+
+
+/*
+ * This routine writes to the pseudo terminal.  If there is a free
+ * buffer then write with an echo buffer completing asyncronously, else
+ * write syncronously using the buffer reserved for writing.  All errors
+ *  are fatal, except DATAOVERUN and DATALOST,these errors can be ignored.
+
+ CAREFUL! Whatever calls this must NOT pass more than VMS_TERM_BUFFER_SIZE
+ bytes at a time.  This definition has been moved to VMS.H
+
+ */
+
+int tt_write(char *tt_write_buf, int size)
+{
+  int status;
+  TT_BUF_STRUCT *echoBuff;
+
+  /* if writing stopped, return 0 until Xon */
+  if(write_stopped) return (0);
+
+  memmove(&tt_w_buff->data,tt_write_buf,size);
+
+  echoBuff = getBuff();
+  if (echoBuff != LIB$_QUEWASEMP)
+    {
+      status = PTD$WRITE (tt_chan, &tt_echo_ast, echoBuff,
+                         &tt_w_buff->status, size,
+                         &echoBuff->status, VMS_TERM_BUFFER_SIZE);
+    }
+  else
+    {
+      status = PTD$WRITE (tt_chan, 0, 0, &tt_w_buff->status, size, 0, 0);
+    }
+  if (status & SS$_NORMAL)
+    {
+      if ((tt_w_buff->status != SS$_NORMAL) &&
+         (tt_w_buff->status != SS$_DATAOVERUN) &&
+         (tt_w_buff->status != SS$_DATALOST))
+       {
+         CloseDown(tt_w_buff->status);
+       }
+    }
+  else
+    {
+      CloseDown(status);
+    }
+
+  return(size);
+}
+
+
+/*
+ * This routine is called when a read to the pseudo terminal completes.
+ * Put the newly read buffer onto the read queue.  It will be processed
+ * and freed in the routine tt_read.
+ */
+
+static void tt_read_ast(TT_BUF_STRUCT *buff_addr)
+{
+  int status;
+
+  if (buff_addr->status & SS$_NORMAL)
+    {
+      status = LIB$INSQTI(buff_addr, &read_queue);
+      if ((status != SS$_NORMAL) && (status != LIB$_ONEENTQUE))
+       {
+         CloseDown(status);
+       }
+    }
+  else
+    CloseDown(buff_addr->status);
+
+  tt_start_read();
+  sys$wake(0,0);
+  return;
+}
+
+
+/*
+ * If there is a free buffer on the buffer queue then Start a read from
+ * the pseudo terminal, otherwise set a flag, the reading will be restarted
+ * in the routine freeBuff when a buffer is freed.
+ */
+
+void tt_start_read(void)
+{
+  int status;
+  static int size;
+  TT_BUF_STRUCT *buff_addr;
+
+  buff_addr = getBuff();
+  if (buff_addr != LIB$_QUEWASEMP)
+    {
+      if(!tt_pasting){
+      status = PTD$READ (0, tt_chan, &tt_read_ast, buff_addr,
+                        &buff_addr->status, VMS_TERM_BUFFER_SIZE);
+      if ((status & SS$_NORMAL) != SS$_NORMAL)
+       {
+         CloseDown(status);
+       }
+      }
+      }
+  else
+    {
+      read_stopped = TRUE;
+    }
+  return;
+}
+
+
+/*
+ * Get data from the pseudo terminal.  Return the data from the first item
+ * on the read queue, and put that buffer back onto the free buffer queue.
+ * Return the length or zero if the read queue is empty.
+ *
+ */
+
+int tt_read(char *buffer)
+{
+  TT_BUF_STRUCT *read_buff;
+  int status;
+  int len;
+
+   status = LIB$REMQHI(&read_queue, &read_buff);
+   if(status == LIB$_QUEWASEMP){
+     return(0);
+   }
+   else if (status & SS$_NORMAL)
+     {
+       len = read_buff->length;
+       memmove(buffer,&read_buff->data,len);
+       freeBuff(read_buff);
+       tt_new_output=TRUE; /* DRM something will be written */
+     }
+   else
+     CloseDown(status);
+
+   return(len);
+}
+
+
+/*
+ * if xon then it is safe to start writing again.
+ */
+
+static void send_xon(void)
+{
+  write_stopped = FALSE;
+}
+
+
+/*
+ * If Xoff then stop writing to the pseudo terminal until you get Xon.
+ */
+static void send_xoff(void)
+{
+  write_stopped = TRUE;
+}
+
+
+
+/*
+ * Beep the terminal to let the user know data will be lost because
+ * of too much data.
+ */
+
+static void send_bell(void)
+{
+   Bell();
+}
+
+/*
+ * if the pseudo terminal's characteristics change, check to see if the
+ * page size changed.  If it did, resize the widget, otherwise, ignore
+ * it!  This routine just gets the new term dimensions and sets a flag
+ * to indicate the term chars have changed.  The widget gets resized in
+ * the routine in_put in the module CHARPROC.C.  You cant resize the
+ * widget in this routine because this is an AST and X is not reenterent.
+ */
+
+static void char_change(void)
+{
+  int status;
+
+  /*
+   * Dont do anything if in Tek mode
+   */
+
+  if(!(term->screen.TekEmu))
+    {
+      status = sys$qiow(0,tt_chan,IO$_SENSEMODE,0,0,0,&tt_mode,8,0,0,0,0);
+      if(!(status & SS$_NORMAL)) CloseDown(status);
+
+      if((term->screen.max_row != tt_mode.length) ||
+        (term->screen.max_col != tt_mode.page_width))
+       {
+         tt_length = tt_mode.length;
+         tt_width =  tt_mode.page_width;
+
+         tt_changed = TRUE;
+
+       }
+    }
+}
+
+
+/*
+ * Put a free buffer back onto the buffer queue.  If reading was
+ * stopped for lack of free buffers, start reading again.
+ */
+
+static void freeBuff (TT_BUF_STRUCT *buff_addr)
+{
+  int ast_stat;
+  int status;
+
+  ast_stat = SYS$SETAST(0);
+  if (!read_stopped)
+    {
+      LIB$INSQHI(buff_addr, &buffer_queue);
+    }
+  else
+    {
+      status = PTD$READ (0, tt_chan, &tt_read_ast, buff_addr,
+                        &buff_addr->status, VMS_TERM_BUFFER_SIZE);
+      if (status & SS$_NORMAL)
+       {
+         read_stopped = FALSE;
+       }
+      else
+       {
+         CloseDown(status);
+       }
+    }
+  if (ast_stat == SS$_WASSET) ast_stat = SYS$SETAST(1);
+}
+
+
+/*
+ * return a free buffer from the buffer queue.
+ */
+
+TT_BUF_STRUCT *getBuff(void)
+{
+  int status;
+  TT_BUF_STRUCT *buff_addr;
+
+  status = LIB$REMQHI(&buffer_queue, &buff_addr);
+  if (status & SS$_NORMAL)
+    {
+      return(buff_addr);
+    }
+  else
+    {
+      return(status);
+    }
+}
+
+
+/*
+ * Close down and exit.  Kill the detached process (if it still
+ * exists), deassign mailbox channell (if assigned), cancel any
+ * waiting IO to the pseudo terminal and delete it, exit with any
+ * status information.
+ */
+
+static void CloseDown(int exit_status)
+{
+  int status;
+
+  /* if process has not terminated, do so now! */
+  if(pid != 0)
+    {
+      status = sys$forcex(&pid,0,0);
+      if(!(status & SS$_NORMAL)) lib$signal(status);
+    }
+
+  /* if mbx_chan is assigned, deassign it */
+  if(mbx_chan != 0)
+    {
+      sys$dassgn(mbx_chan);
+    }
+
+  /* cancel pseudo terminal IO requests */
+  status = ptd$cancel(tt_chan);
+  if(!(status & SS$_NORMAL)) lib$signal(status);
+
+  /* delete pseudo terminal */
+  status = ptd$delete(tt_chan);
+  if(!(status & SS$_NORMAL)) lib$signal(status);
+
+  if(!(exit_status & SS$_NORMAL)) lib$signal(exit_status);
+
+  exit(1);
+
+}
+
+
+/*
+ * This routine gets called when the detached process terminates (for
+ * whatever reason).  The mailbox buffer has final exit status.  Close
+ * down and exit.
+ */
+
+static void mbx_read_ast(void)
+{
+  int status;
+
+  pid = 0;
+
+  status = mbx_read_iosb.status;
+  if (!(status & SS$_NORMAL)) CloseDown(status);
+
+  status = (unsigned long int) mbx_buf.acc$l_finalsts;
+  if (!(status & SS$_NORMAL)) CloseDown(status);
+
+  CloseDown(1);
+
+}
+
+
+/*
+ * This routine starts a read on the mailbox associated with the detached
+ * process.  The AST routine gets called when the detached process terminates.
+ */
+
+static void mbx_read(void)
+{
+int status;
+static int size;
+
+   size = ACC$K_TERMLEN;
+   status = sys$qio(0,mbx_chan,
+          IO$_READVBLK,
+          &mbx_read_iosb,
+          &mbx_read_ast,
+          0,
+          &mbx_buf,
+          size,0,0,0,0);
+
+   if (!(status & SS$_NORMAL)) CloseDown(status);
+
+   return;
+}
Index: vms.h
--- /dev/null   Sun Jul 17 19:46:18 1994
+++ xterm-125/vms.h     Sun Jan 30 14:41:01 2000
@@ -0,0 +1,39 @@
+/* $XFree86$ */
+
+/* vms.h
+ */
+#include <ssdef.h>
+#include <iodef.h>
+#include <msgdef.h>
+#include <descrip.h>
+#include <dvidef.h>
+#include <jpidef.h>
+#include <prcdef.h>
+#include <dcdef.h>
+#include <ttdef.h>
+#include <tt2def.h>
+#include <accdef.h>
+#include <prvdef.h>
+
+struct IOSB
+{
+       short int status;
+       short int len;
+       int unused;
+} mbx_read_iosb,iosb;
+
+#define MAXITEMLIST   5
+
+short int      tt_chan;    /* channel to the Pseudo terminal */
+short int      mbx_chan;   /* channel to the mailbox */
+struct accdef  mbx_buf;    /* mailbox buffer */
+short int      mbxunit;    /* mailbox unit number */
+int            pid;            /* PID of created process */
+static $DESCRIPTOR  (image, "SYS$SYSTEM:LOGINOUT.EXE");
+
+static struct      items {
+       short int       buflen;
+       short int       code;
+       int             buffer;
+       int             return_addr;
+} itemlist[MAXITEMLIST];
Index: xterm.dat
--- /dev/null   Sun Jul 17 19:46:18 1994
+++ xterm-125/xterm.dat Sun Jan 30 11:15:59 2000
@@ -0,0 +1,153 @@
+*title: Xterm
+*iconName: Xterm
+*c132: TRUE
+*scrollBar: on
+*saveLines:    1000
+XTerm.JoinSession:False
+
+! turn off NumLock support - there is some conflict or problem on VMS
+*numLock: false
+
+*SimpleMenu*BackingStore: NotUseful
+*SimpleMenu*menuLabel.font: -adobe-helvetica-bold-r-normal--*-120-*-*-*-*-iso*-*
+*SimpleMenu*menuLabel.vertSpace:   100
+*SimpleMenu*HorizontalMargins: 16
+*SimpleMenu*Sme.height:    16
+*SimpleMenu*Cursor: left_ptr
+
+*mainMenu.Label:  Main Options
+*mainMenu*securekbd*Label:  Secure Keyboard
+*mainMenu*allowsends*Label:  Allow SendEvents
+*mainMenu*logging*Label:  Log to File
+*mainMenu*print*Label:  Print Window
+*mainMenu*redraw*Label:  Redraw Window
+*mainMenu*8-bit control*Label: 8-Bit Controls
+*mainMenu*backarrow key*Label: Backarrow Key
+*mainMenu*num-lock*Label: Alt/NumLock Modifiers
+*mainMenu*meta-esc*Label: Meta Sends Escape
+*mainMenu*sun function-keys*Label: Sun Function-Keys
+*mainMenu*sun keyboard*Label: VT220 Keyboard
+*mainMenu*hp function-keys*Label: HP Function-Keys
+*mainMenu*suspend*Label:  Send STOP Signal
+*mainMenu*suspend*Sensitive: FALSE
+*mainMenu*continue*Label:  Send CONT Signal
+*mainMenu*continue*Sensitive: FALSE
+*mainMenu*interrupt*Label:  Send INT Signal
+*mainMenu*interrupt*Sensitive: FALSE
+*mainMenu*hangup*Label:  Send HUP Signal
+*mainMenu*hangup*Sensitive: FALSE
+*mainMenu*terminate*Label:  Send TERM Signal
+*mainMenu*terminate*Sensitive:  FALSE
+*mainMenu*kill*Label:  Send KILL Signal
+*mainMenu*kill*Sensitive:  FALSE
+*mainMenu*quit*Label:  Quit
+
+*vtMenu.Label:  VT Options
+*vtMenu*scrollbar*Label:  Enable Scrollbar
+*vtMenu*jumpscroll*Label:  Enable Jump Scroll
+*vtMenu*reversevideo*Label:  Enable Reverse Video
+*vtMenu*autowrap*Label:  Enable Auto Wraparound
+*vtMenu*reversewrap*Label:  Enable Reverse Wraparound
+*vtMenu*autolinefeed*Label:  Enable Auto Linefeed
+*vtMenu*appcursor*Label:  Enable Application Cursor Keys
+*vtMenu*appkeypad*Label:  Enable Application Keypad
+*vtMenu*scrollkey*Label:  Scroll to Bottom on Key Press
+*vtMenu*scrollttyoutput*Label:  Scroll to Bottom on Tty Output
+*vtMenu*allow132*Label: Allow 80/132 Column Switching
+*vtMenu*cursesemul*Label:  Enable Curses Emulation
+*vtMenu*visualbell*Label:  Enable Visual Bell
+*vtMenu*marginbell*Label:  Enable Margin Bell
+*vtMenu*cursorblink*Label: Enable Blinking Cursor
+*vtMenu*titeInhibit*Label:  Enable Alternate Screen Switching
+*vtMenu*activeicon*Label: Enable Active Icon
+*vtMenu*softreset*Label:  Do Soft Reset
+*vtMenu*hardreset*Label:  Do Full Reset
+*vtMenu*clearsavedlines*Label:  Reset and Clear Saved Lines
+*vtMenu*tekshow*Label:  Show Tek Window
+*vtMenu*tekmode*Label:  Switch to Tek Mode
+*vtMenu*vthide*Label:  Hide VT Window
+*vtMenu*altscreen*Label:  Show Alternate Screen
+
+*fontMenu.Label:  VT Fonts
+*fontMenu*fontdefault*Label:       Default
+*VT100*font:               -bitstream-terminal-medium-r-normal-gs-18-180-75-75-c-110-iso8859-1
+*fontMenu*font1*Label:     Tiny
+*VT100*font1:              -misc-fixed-medium-r-normal--8-60-*-*-c-50-iso8859-1
+*fontMenu*font2*Label:     Small
+*VT100*font2:              -misc-fixed-medium-r-normal--10-70-*-*-c-60-iso8859-1
+*fontMenu*font3*Label:     Medium
+*VT100*font3:              -misc-fixed-medium-r-normal--13-120-*-*-c-70-iso8859-1
+*fontMenu*font4*Label:     Large
+*VT100*font4:              -bitstream-terminal-medium-r-normal-gs-18-180-75-75-c-110-iso8859-1
+*fontMenu*font5*Label:     Huge
+*VT100*font5:              -bitstream-terminal-medium-r-normal-gs-36-280-100-100-c-220-iso8859-1
+*fontMenu*font6*Label:     Large-Narrow
+*VT100*font6:              -bitstream-terminal-medium-r-narrow--18-180-75-75-c-70-iso8859-1
+*fontMenu*fontescape*Label:        Escape Sequence
+*fontMenu*fontsel*Label:           Selection
+!fontescape and fontsel overridden by application
+*fontMenu*font-doublesize*Label: Doublesized Characters
+*fontMenu*font-loadable*Label: VT220 Soft Fonts
+
+*tekMenu.Label:  Tek Options
+*tekMenu*tektextlarge*Label:  Large Characters
+*tekMenu*tektext2*Label:  #2 Size Characters
+*tekMenu*tektext3*Label:  #3 Size Characters
+*tekMenu*tektextsmall*Label:  Small Characters
+*tekMenu*tekpage*Label:  PAGE
+*tekMenu*tekreset*Label:  RESET
+*tekMenu*tekcopy*Label:  COPY
+*tekMenu*vtshow*Label:  Show VT Window
+*tekMenu*vtmode*Label:  Switch to VT Mode
+*tekMenu*tekhide*Label:  Hide Tek Window
+
+*tek4014*fontLarge: -misc-fixed-medium-r-normal--15-140-*-*-c-90-iso8859-1
+*tek4014*font2: -misc-fixed-medium-r-normal--13-120-*-*-c-70-iso8859-1
+*tek4014*font3: -misc-fixed-medium-r-normal--10-100-*-*-c-60-iso8859-1
+*tek4014*fontSmall: -misc-fixed-medium-r-normal--8-80-*-*-c-50-iso8859-1
+
+! Enable Colour by default.
+
+*VT100*colorMode: on
+*VT100*boldColors: on
+*VT100*dynamicColors: on
+
+*VT100*highlightColor: red
+*VT100*cursorColor: white
+!bold text color
+*VT100*colorBDMode: on
+*VT100*colorBD: green
+!blinking text color
+*VT100*colorBLMode: on
+*VT100*colorBL: red
+
+
+! Uncomment this use color for underline attribute
+!*VT100*colorULMode: on
+!*VT100*underLine: off
+
+! Uncomment this to use color for the bold attribute
+*VT100*colorBDMode: on
+
+! Uncomment this to use the bold/underline colors in preference to other colors
+*VT100*colorAttrMode: on
+
+*VT100*color0: black
+*VT100*color1: red3
+*VT100*color2: green3
+*VT100*color3: yellow3
+*VT100*color4: blue3
+*VT100*color5: magenta3
+*VT100*color6: cyan3
+*VT100*color7: gray90
+*VT100*color8: gray30
+*VT100*color9: red
+*VT100*color10: green
+*VT100*color11: yellow
+*VT100*color12: blue
+*VT100*color13: magenta
+*VT100*color14: cyan
+*VT100*color15: white
+*VT100*colorUL: yellow
+*VT100*colorBD: white
+
Index: xterm.h
--- xterm-124+/xterm.h  Sun Jan 30 18:41:54 2000
+++ xterm-125/xterm.h   Mon Jan 31 19:50:44 2000
@@ -2,7 +2,7 @@
 
 /************************************************************
 
-Copyright 1999 by Thomas E. Dickey <dickey@clark.net>
+Copyright 1999-2000 by Thomas E. Dickey <dickey@clark.net>
 
                         All Rights Reserved
 
@@ -201,16 +201,6 @@
 
 /***====================================================================***/
 
-#ifndef HAVE_CONFIG_H
-
-#if defined(_POSIX_VDISABLE) && (_POSIX_VDISABLE != -1) && defined(HAVE_UNISTD_H)
-#define HAVE_POSIX_VDISABLE 1
-#endif
-
-#endif /* HAVE_CONFIG_H */
-
-/***====================================================================***/
-
 #define XtNallowSendEvents     "allowSendEvents"
 #define XtNalwaysHighlight     "alwaysHighlight"
 #define XtNanswerbackString    "answerbackString"
@@ -396,6 +386,15 @@
 #define XtCGeometry            "Geometry"
 #endif
 
+#ifdef VMS
+#define        XtCbackground           "background"
+#define        XtCbordercolor          "borderColor"
+#define        XtCborderwidth          "borderWidth"
+#define        XtCforeground           "foreground"
+#define        XtCfont                 "font"
+#define        XtCiconic               "iconic"
+#endif
+
 /***====================================================================***/
 
 #ifdef __cplusplus
@@ -488,8 +487,8 @@
 extern void CursorSave (XtermWidget tw);
 extern void CursorSet (TScreen *screen, int row, int col, unsigned flags);
 extern void CursorUp (TScreen *screen, int  n);
-extern void Index (TScreen *screen, int amount);
 extern void RevIndex (TScreen *screen, int amount);
+extern void xtermIndex (TScreen *screen, int amount);
 
 /* doublechr.c */
 extern void xterm_DECDHL (Bool top);
@@ -557,9 +556,6 @@
 extern void Panic (char *s, int a);
 extern void Redraw (void);
 extern void ReverseOldColors (void);
-extern void Setenv (char *var, char *value);
-extern void SysError (int i);
-extern void VisualBell (void);
 extern void creat_as (int uid, int gid, char *pathname, int mode);
 extern void do_dcs (Char *buf, size_t len);
 extern void do_osc (Char *buf, int len, int final);
@@ -572,7 +568,10 @@
 extern void set_tek_visibility (Boolean on);
 extern void set_vt_visibility (Boolean on);
 extern void switch_modes (Bool tovt);
+extern void SysError (int i);
+extern void VisualBell (void);
 extern void xevents (void);
+extern void xtermSetenv (char *var, char *value);
 extern void xt_error (String message);
 
 #if OPT_MAXIMIZE
@@ -677,12 +676,15 @@
 extern void InsertLine (TScreen *screen, int n);
 extern void RevScroll (TScreen *screen, int amount);
 extern void ReverseVideo (XtermWidget termw);
-extern void Scroll (TScreen *screen, int amount);
 extern void do_erase_display (TScreen *screen, int param, int mode);
 extern void do_erase_line (TScreen *screen, int param, int mode);
+extern void init_keyboard_type (xtermKeyboardType, Bool set);
 extern void recolor_cursor (Cursor cursor, unsigned long fg, unsigned long bg);
 extern void resetXtermGC (TScreen *screen, int flags, Bool hilite);
 extern void scrolling_copy_area (TScreen *screen, int firstline, int nlines, int amount);
+extern void set_keyboard_type (xtermKeyboardType type, Bool set);
+extern void toggle_keyboard_type (xtermKeyboardType type);
+extern void xtermScroll (TScreen *screen, int amount);
 
 #if OPT_ISO_COLORS
 
Index: xterm.log.html
--- xterm-124+/xterm.log.html   Sun Jan 30 18:41:54 2000
+++ xterm-125/xterm.log.html    Mon Jan 31 19:55:24 2000
@@ -41,6 +41,7 @@
 xc/programs/Xserver/hw/xfree86).
 
 <UL>
+<LI><A HREF="#xterm_125">Patch #125 - 2000/1/31 - XFree86 3.9.17c</A>
 <LI><A HREF="#xterm_124">Patch #124 - 2000/1/27 - XFree86 3.9.17b</A>
 <LI><A HREF="#xterm_123">Patch #123 - 2000/1/22 - XFree86 3.9.17a</A>
 <LI><A HREF="#xterm_122">Patch #122 - 1999/12/28 - XFree86 3.9.16f</A>
@@ -167,6 +168,41 @@
 <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_125">Patch #125 - 2000/1/31 - XFree86 3.9.17c</A></H1>
+<ul>
+       <li>integrate patch by David Mathog
+         &lt;mathog@seqaxp.bio.caltech.edu&gt; to make this work on OpenVMS
+
+       <li>rename some functions, e.g., <code>Index</code> to
+         <code>xtermIndex</code> so that ports such as VMS which link
+         externals ignoring case will not have library conflicts (reported by
+         David Mathog).
+
+       <li>correct logic of <code>do_reversevideo()</code>, which did not
+         update the corresponding popup menu check mark (reported by David
+         Mathog, this was a detail overlooked in patch #94).
+
+       <li>change TRACE macro so semicolon is not within definition, making
+         <em>indent</em> and similar programs work better.
+
+       <li>add <code>depend</code> rule to Makefile.in
+
+       <li>modify logic of boldColors resource to suppress it if an extended
+         color control has been used, e.g., for 88-color or 256-color mode
+         (patch by Todd Larason).
+
+       <li>revise logic that handles menus and input translation for keyboard
+         type so only one can be selected at a time.
+
+       <li>restore kdch1=\177 for the Sun function-key type, and make the
+         the Delete key send DEL (\177) if the oldXtermFKeys resource is set.
+
+       <li>rephrase logic and ifdef's for POSIX VDISABLE to avoid preprocessor
+         expression that will not compile on NetBSD/x86 1.4.1 (reported by
+         Takaaki Nomura &lt;amadeus@yk.rim.or.jp&gt;).
+
+</ul>
 
 <H1><A NAME="xterm_124">Patch #124 - 2000/1/27 - XFree86 3.9.17b</A></H1>
 <ul>
Index: xterm.man
--- xterm-124+/xterm.man        Sun Jan 30 18:41:54 2000
+++ xterm-125/xterm.man Mon Jan 31 12:03:54 2000
@@ -2,7 +2,7 @@
 .\" $XFree86: xc/programs/xterm/xterm.man,v 3.55 2000/01/29 18:58:43 dawes Exp $
 .\"
 .\"
-.\" Copyright 1999 by Thomas E. Dickey <dickey@clark.net>
+.\" Copyright 1999-2000 by Thomas E. Dickey <dickey@clark.net>
 .\"
 .\"                         All Rights Reserved
 .\"
@@ -1228,6 +1228,7 @@
 If ``true'', xterm will use old-style control sequences for function keys F1 to F4,
 for compatibility with X Consortium xterm.  Otherwise, it uses the VT100-style
 codes for PF1 to PF4.
+Also, if ``true'', the Delete key sends DEL (127).
 The default is ``false.''
 .TP 8
 .B "pointerColor (\fPclass\fB Foreground)"
Index: xterm_axp.opt
--- /dev/null   Sun Jul 17 19:46:18 1994
+++ xterm-125/xterm_axp.opt     Sat Jan 29 15:47:10 2000
@@ -0,0 +1,28 @@
+BUTTON.OBJ
+CHARPROC.OBJ
+CHARSETS.OBJ
+CURSOR.OBJ
+DATA.OBJ
+DOUBLECHR.OBJ
+FONTUTILS.OBJ
+INPUT.OBJ
+KEYSYM2UCS.OBJ
+MAIN.OBJ
+MENU.OBJ
+MISC.OBJ
+PRINT.OBJ
+PTYDATA.OBJ
+SCREEN.OBJ
+SCROLLBAR.OBJ
+TABS.OBJ
+TEKPROC.OBJ
+TEKPRSTBL.OBJ
+TRACE.OBJ
+TTYSVR.OBJ
+UTIL.OBJ
+VMS.OBJ
+VTPRSTBL.OBJ
+XAW3DLIB.OLB/LIB
+XMULIB.OLB/LIB
+SYS$SHARE:DECW$XTLIBSHRR5.EXE/SHARE
+SYS$SHARE:DECW$XLIBSHR.EXE/SHARE
Index: xtermcfg.hin
--- xterm-124+/xtermcfg.hin     Thu Jan 27 21:01:34 2000
+++ xterm-125/xtermcfg.hin      Mon Jan 31 19:51:57 2000
@@ -41,7 +41,6 @@
 #undef DFT_TERMTYPE            /* AC_ARG_WITH(default-term-type) */
 #undef HAVE_LASTLOG_H          /* CF_LASTLOG */
 #undef HAVE_PATHS_H            /* CF_LASTLOG */
-#undef HAVE_POSIX_VDISABLE     /* CF_POSIX_VDISABLE */
 #undef HAVE_STDLIB_H           /* AC_CHECK_HEADERS(stdlib.h) */
 #undef HAVE_STRERROR           /* AC_CHECK_FUNCS(strerror) */
 #undef HAVE_SYS_WAIT_H         /* AC_HEADER_SYS_WAIT */