Patch #367 - 2021/03/26

     * add  OSC 22 to allow programs to select different pointer cursor at
       runtime.
     * change  configuration for no-return functions to use _Noreturn when
       it  is  available, because clang --analyze does not properly handle
       the gcc noreturn attribute.
     * add  cursorTheme resource to provide a way to enable or disable the
       cursor theme feature.
     * modified  CopyWait  event retries to use shorter sleeps, to improve
       responsiveness (tmux #2556).
     * improve quoting/escaping in demo-scripts per shellcheck.
     * add  resizeByPixel  resource,  to  permit  disabling window manager
       resizing-hints (patch by Tim Oehl).
     * corrected  printOptsImmediate  handling of alternate-screen (report
       by Abhijit Dasgupta).
     * update sample terminfo to more closely match ncurses.
     * add/improve limit-checks for Xlib calls (report by Roman Fiedler).
     * fix a typo in the help-message (report by Tomas Korbar).


ok ? comments ?

Index: MANIFEST
===================================================================
RCS file: /cvs/xenocara/app/xterm/MANIFEST,v
retrieving revision 1.47
diff -u -p -u -r1.47 MANIFEST
--- MANIFEST    14 Feb 2021 09:14:06 -0000      1.47
+++ MANIFEST    27 Mar 2021 09:21:21 -0000
@@ -1,4 +1,4 @@
-MANIFEST for xterm-366, version xterm-366
+MANIFEST for xterm-367, version xterm-367
 
--------------------------------------------------------------------------------
 MANIFEST                        this file
 256colres.h                     resource-definitions for 256-color mode
Index: NEWS
===================================================================
RCS file: /cvs/xenocara/app/xterm/NEWS,v
retrieving revision 1.7
diff -u -p -u -r1.7 NEWS
--- NEWS        14 Feb 2021 09:14:06 -0000      1.7
+++ NEWS        27 Mar 2021 09:21:21 -0000
@@ -1,20 +1,23 @@
 The NEWS file was generated from xterm.log.html, which serves as the changelog
 for xterm.
 
--------------------------------------------------------------------------------
-                            Patch #366 - 2021/02/10
+                            Patch #367 - 2021/03/26
 
-     * correct   a  compiler-warning  fix  in  patch  #352  which  allowed
-       sign-extension of coordinate values (report by "CismonX").
-     * correct  upper-limit for selection buffer, accounting for combining
-       characters (report/testcase by Tavis Ormandy).
-     * with alwaysHighlight true, xterm does not properly track focus. The
-       screen->select   FOCUS  flag  remains  always  on,  which  prevents
-       bellIsUrgent  from  working, as the urgent WM_HINT flag is only set
-       in  setXUrgency()  when  the  window  is  not  focused. Fix this by
-       updating screen->select in unselectwindow() regardless of the value
-       of always_highlight (patch by Jiri Bohac).
-     * improve  fix  for  interaction between SRM and ENQ (report by Grant
-       Taylor).
-     * build-fix   for  --with-Xaw3dxft,  needed  when  --with-toolbar  is
-       omitted (report by Jimmy Olgeni, Emanuel Haupt).
+     * add  OSC 22 to allow programs to select different pointer cursor at
+       runtime.
+     * change  configuration for no-return functions to use _Noreturn when
+       it  is  available, because clang --analyze does not properly handle
+       the gcc noreturn attribute.
+     * add  cursorTheme resource to provide a way to enable or disable the
+       cursor theme feature.
+     * modified  CopyWait  event retries to use shorter sleeps, to improve
+       responsiveness (tmux #2556).
+     * improve quoting/escaping in demo-scripts per shellcheck.
+     * add  resizeByPixel  resource,  to  permit  disabling window manager
+       resizing-hints (patch by Tim Oehl).
+     * corrected  printOptsImmediate  handling of alternate-screen (report
+       by Abhijit Dasgupta).
+     * update sample terminfo to more closely match ncurses.
+     * add/improve limit-checks for Xlib calls (report by Roman Fiedler).
+     * fix a typo in the help-message (report by Tomas Korbar).
 
Index: THANKS
===================================================================
RCS file: /cvs/xenocara/app/xterm/THANKS,v
retrieving revision 1.15
diff -u -p -u -r1.15 THANKS
--- THANKS      14 Feb 2021 09:14:06 -0000      1.15
+++ THANKS      27 Mar 2021 09:21:21 -0000
@@ -1,4 +1,4 @@
--- $XTermId: THANKS,v 1.30 2021/02/09 01:32:10 tom Exp $
+-- $XTermId: THANKS,v 1.31 2021/03/01 22:00:49 tom Exp $
 -- vile:txtmode fk=utf-8
 There's no AUTHORS file in this distribution; it would be redundant since
 I (Thomas E. Dickey) have done more than 80% of the work on xterm since 1996.
@@ -225,6 +225,7 @@ Thierry Reding
 Thomas Wolff
 Thorsten Glaser
 Tim Adye
+Tim Oehl
 Tim Pope
 Tobias Stoeckmann
 Todd Eigenschink
Index: Tekproc.c
===================================================================
RCS file: /cvs/xenocara/app/xterm/Tekproc.c,v
retrieving revision 1.29
diff -u -p -u -r1.29 Tekproc.c
--- Tekproc.c   14 Feb 2021 09:14:06 -0000      1.29
+++ Tekproc.c   27 Mar 2021 09:21:21 -0000
@@ -1,4 +1,4 @@
-/* $XTermId: Tekproc.c,v 1.241 2021/02/02 00:19:32 tom Exp $ */
+/* $XTermId: Tekproc.c,v 1.243 2021/03/21 22:08:46 tom Exp $ */
 
 /*
  * Copyright 2001-2020,2021 by Thomas E. Dickey
@@ -81,7 +81,6 @@
 
 #include <X11/Xatom.h>
 #include <X11/Xutil.h>
-#include <X11/cursorfont.h>
 #include <X11/Xmu/CharSet.h>
 
 #if OPT_TOOLBAR
@@ -1517,11 +1516,15 @@ TekInitialize(Widget wrequest,
     min_height = (unsigned) (TEKMINHEIGHT + border);
 
     TRACE(("parsing T_geometry %s\n", NonNull(xw->misc.T_geometry)));
-    pr = XParseGeometry(xw->misc.T_geometry,
-                       &winX,
-                       &winY,
-                       &width,
-                       &height);
+    if (strlen(xw->misc.T_geometry) <= MAX_U_STRING) {
+       pr = XParseGeometry(xw->misc.T_geometry,
+                           &winX,
+                           &winY,
+                           &width,
+                           &height);
+    } else {
+       pr = 0;
+    }
 
     /* window-manager hints will do this anyway... */
     if (height < min_height) {
Index: charproc.c
===================================================================
RCS file: /cvs/xenocara/app/xterm/charproc.c,v
retrieving revision 1.48
diff -u -p -u -r1.48 charproc.c
--- charproc.c  14 Feb 2021 09:14:06 -0000      1.48
+++ charproc.c  27 Mar 2021 09:21:22 -0000
@@ -1,4 +1,4 @@
-/* $XTermId: charproc.c,v 1.1825 2021/02/10 00:49:52 tom Exp $ */
+/* $XTermId: charproc.c,v 1.1830 2021/03/21 22:45:24 tom Exp $ */
 
 /*
  * Copyright 1999-2020,2021 by Thomas E. Dickey
@@ -83,7 +83,6 @@
 
 #include <X11/Xatom.h>
 #include <X11/Xutil.h>
-#include <X11/cursorfont.h>
 #include <X11/Xmu/Atoms.h>
 #include <X11/Xmu/CharSet.h>
 #include <X11/Xmu/Converters.h>
@@ -481,6 +480,7 @@ static XtResource xterm_resources[] =
     Bres(XtNprinterFormFeed, XtCPrinterFormFeed, SPS.printer_formfeed, False),
     Bres(XtNprinterNewLine, XtCPrinterNewLine, SPS.printer_newline, True),
     Bres(XtNquietGrab, XtCQuietGrab, screen.quiet_grab, False),
+    Bres(XtNresizeByPixel, XtCResizeByPixel, misc.resizeByPixel, False),
     Bres(XtNreverseVideo, XtCReverseVideo, misc.re_verse, False),
     Bres(XtNreverseWrap, XtCReverseWrap, misc.reverseWrap, False),
     Bres(XtNscrollBar, XtCScrollBar, misc.scrollbar, False),
@@ -2831,8 +2831,8 @@ doparsing(XtermWidget xw, unsigned c, st
            if (nparam > 0) {
                value = zero_if_default(nparam - 1);
                SetParam(nparam - 1, (10 * value) + ((int) c - '0'));
-               if (GetParam(nparam - 1) > 65535)
-                   SetParam(nparam - 1, 65535);
+               if (GetParam(nparam - 1) > MAX_I_PARAM)
+                   SetParam(nparam - 1, MAX_I_PARAM);
                if (sp->parsestate == csi_table)
                    sp->parsestate = csi2_table;
            }
@@ -8188,7 +8188,7 @@ VTResize(Widget w)
     }
 }
 
-#define okDimension(src,dst) ((src <= 32767) \
+#define okDimension(src,dst) ((src <= MAX_U_COORD) \
                          && ((dst = (Dimension) src) == src))
 
 static void
@@ -9503,8 +9503,8 @@ VTInitialize(Widget wrequest,
 
 #ifndef NO_ACTIVE_ICON
     init_Sres(screen.icon_fontname);
-    getIconicFont(screen)->fs = XLoadQueryFont(screen->display,
-                                              screen->icon_fontname);
+    getIconicFont(screen)->fs = xtermLoadQueryFont(wnew,
+                                                  screen->icon_fontname);
     TRACE(("iconFont '%s' %sloaded successfully\n",
           screen->icon_fontname,
           getIconicFont(screen)->fs ? "" : "NOT "));
@@ -9522,6 +9522,7 @@ VTInitialize(Widget wrequest,
     init_Bres(misc.cdXtraScroll);
     init_Bres(misc.color_inner_border);
     init_Bres(misc.dynamicColors);
+    init_Bres(misc.resizeByPixel);
 
 #if OPT_DEC_CHRSET
     for (i = 0; i < NUM_CHRSET; i++) {
@@ -10845,108 +10846,6 @@ initBorderGC(XtermWidget xw, VTwin *win)
     }
 #endif
 }
-
-/* adapted from <X11/cursorfont.h> */
-static int
-LookupCursorShape(const char *name)
-{
-#define DATA(name) { XC_##name, #name }
-    static struct {
-       int code;
-       const char name[25];
-    } table[] = {
-       DATA(X_cursor),
-           DATA(arrow),
-           DATA(based_arrow_down),
-           DATA(based_arrow_up),
-           DATA(boat),
-           DATA(bogosity),
-           DATA(bottom_left_corner),
-           DATA(bottom_right_corner),
-           DATA(bottom_side),
-           DATA(bottom_tee),
-           DATA(box_spiral),
-           DATA(center_ptr),
-           DATA(circle),
-           DATA(clock),
-           DATA(coffee_mug),
-           DATA(cross),
-           DATA(cross_reverse),
-           DATA(crosshair),
-           DATA(diamond_cross),
-           DATA(dot),
-           DATA(dotbox),
-           DATA(double_arrow),
-           DATA(draft_large),
-           DATA(draft_small),
-           DATA(draped_box),
-           DATA(exchange),
-           DATA(fleur),
-           DATA(gobbler),
-           DATA(gumby),
-           DATA(hand1),
-           DATA(hand2),
-           DATA(heart),
-           DATA(icon),
-           DATA(iron_cross),
-           DATA(left_ptr),
-           DATA(left_side),
-           DATA(left_tee),
-           DATA(leftbutton),
-           DATA(ll_angle),
-           DATA(lr_angle),
-           DATA(man),
-           DATA(middlebutton),
-           DATA(mouse),
-           DATA(pencil),
-           DATA(pirate),
-           DATA(plus),
-           DATA(question_arrow),
-           DATA(right_ptr),
-           DATA(right_side),
-           DATA(right_tee),
-           DATA(rightbutton),
-           DATA(rtl_logo),
-           DATA(sailboat),
-           DATA(sb_down_arrow),
-           DATA(sb_h_double_arrow),
-           DATA(sb_left_arrow),
-           DATA(sb_right_arrow),
-           DATA(sb_up_arrow),
-           DATA(sb_v_double_arrow),
-           DATA(shuttle),
-           DATA(sizing),
-           DATA(spider),
-           DATA(spraycan),
-           DATA(star),
-           DATA(target),
-           DATA(tcross),
-           DATA(top_left_arrow),
-           DATA(top_left_corner),
-           DATA(top_right_corner),
-           DATA(top_side),
-           DATA(top_tee),
-           DATA(trek),
-           DATA(ul_angle),
-           DATA(umbrella),
-           DATA(ur_angle),
-           DATA(watch),
-           DATA(xterm),
-    };
-#undef DATA
-    Cardinal j;
-    int result = -1;
-    if (!IsEmpty(name)) {
-       for (j = 0; j < XtNumber(table); ++j) {
-           if (!strcmp(name, table[j].name)) {
-               result = table[j].code;
-               break;
-           }
-       }
-    }
-    return result;
-}
-
 #if USE_DOUBLE_BUFFER
 static Boolean
 allocateDbe(XtermWidget xw, VTwin *target)
@@ -11040,28 +10939,7 @@ VTRealize(Widget w,
     }
 #endif
 
-    /* making cursor */
-    if (screen->pointer_cursor == None) {
-       unsigned shape = XC_xterm;
-       int other = LookupCursorShape(screen->pointer_shape);
-
-       TRACE(("looked up shape index %d from shape name \"%s\"\n", other,
-              NonNull(screen->pointer_shape)));
-       if (other >= 0)
-           shape = (unsigned) other;
-
-       TRACE(("creating text pointer cursor from shape %d\n", shape));
-       screen->pointer_cursor =
-           make_colored_cursor(shape,
-                               T_COLOR(screen, MOUSE_FG),
-                               T_COLOR(screen, MOUSE_BG));
-    } else {
-       TRACE(("recoloring existing text pointer cursor\n"));
-       recolor_cursor(screen,
-                      screen->pointer_cursor,
-                      T_COLOR(screen, MOUSE_FG),
-                      T_COLOR(screen, MOUSE_BG));
-    }
+    xtermSetupPointer(xw, screen->pointer_shape);
 
     /* set defaults */
     pos.x = 1;
@@ -11210,8 +11088,7 @@ VTRealize(Widget w,
     screen->icon_fontnum = -1;
     if (getIconicFont(screen)->fs == 0) {
        getIconicFont(screen)->fs =
-           XLoadQueryFont(screen->display,
-                          screen->MenuFontName(fontMenu_font1));
+           xtermLoadQueryFont(xw, screen->MenuFontName(fontMenu_font1));
        ReportIcons(("%susing font1 '%s' as iconFont\n",
                     (getIconicFont(screen)->fs
                      ? ""
Index: configure.in
===================================================================
RCS file: /cvs/xenocara/app/xterm/configure.in,v
retrieving revision 1.33
diff -u -p -u -r1.33 configure.in
--- configure.in        14 Feb 2021 09:14:06 -0000      1.33
+++ configure.in        27 Mar 2021 09:21:22 -0000
@@ -1,4 +1,4 @@
-dnl $XTermId: configure.in,v 1.378 2021/01/06 20:58:29 tom Exp $
+dnl $XTermId: configure.in,v 1.379 2021/03/21 16:48:26 tom Exp $
 dnl
 dnl 
-----------------------------------------------------------------------------
 dnl this file is part of xterm
@@ -288,8 +288,20 @@ CF_TYPE_FD_MASK
 CF_TERMIO_C_ISPEED
 CF_TERMIOS_TYPES
 
-# If we notice Xcursor, there is a workaround needed.
-AC_CHECK_LIB(Xcursor, XcursorGetTheme,[AC_DEFINE(HAVE_LIB_XCURSOR,1,[Define to 
1 if we have the Xcursor library])])
+# The Xcursor library is normally (weakly) linked via the X11 library rather
+# than directly to applications.  xterm can select a cursor theme; users can
+# also use environment variables to select cursor size.  We would only notice
+# the library if there are development files for it.  Provide a way to disable
+# the feature if it is unwanted.
+AC_MSG_CHECKING(if we expect to use the Xcursor library)
+CF_ARG_DISABLE(xcursor,
+       [  --disable-xcursor        disable cursorTheme resource],
+       [enable_xcursor=no],
+       [enable_xcursor=yes])
+AC_MSG_RESULT($enable_xcursor)
+if test "$enable_xcursor" = yes; then
+       AC_DEFINE(HAVE_LIB_XCURSOR,1,[Define to 1 if we expect to use the 
Xcursor library])
+fi
 
 LIBS="$LIBS $X_EXTRA_LIBS"
 
Index: ctlseqs.ms
===================================================================
RCS file: /cvs/xenocara/app/xterm/ctlseqs.ms,v
retrieving revision 1.31
diff -u -p -u -r1.31 ctlseqs.ms
--- ctlseqs.ms  10 Jan 2021 09:23:57 -0000      1.31
+++ ctlseqs.ms  27 Mar 2021 09:21:22 -0000
@@ -1,9 +1,9 @@
 .\"#! troff -ms $1             -*- Nroff -*-
 .\" "Xterm Control Sequences" document
-.\" $XTermId: ctlseqs.ms,v 1.609 2020/12/25 14:17:03 tom Exp $
+.\" $XTermId: ctlseqs.ms,v 1.612 2021/03/24 00:41:44 tom Exp $
 .\"
 .\"
-.\" Copyright 1996-2019,2020 by Thomas E. Dickey
+.\" Copyright 1996-2020,2021 by Thomas E. Dickey
 .\"
 .\"                         All Rights Reserved
 .\"
@@ -69,8 +69,8 @@
 .\"
 .ds XT XTerm
 .ds xt xterm
-.ds LF Patch #363
-.ds RF 2020/12/25
+.ds LF Patch #367
+.ds RF 2021/03/23
 .\"
 .if n .pl 9999v                \" no page breaks in nroff
 .ND
@@ -346,7 +346,7 @@ X Consortium (1994)
 Thomas Dickey
 .AI
 XFree86 Project (1996-2006)
-invisible-island.net (2006-2020)
+invisible-island.net (2006-2021)
 updated for \*(XT \*(LF (\*(RF)
 .AU
 .
@@ -2457,6 +2457,8 @@ be given in one control sequence, \fI\*(
   \*(Ps = \*1\*7 \(-> Change highlight background color to \*(Pt.
   \*(Ps = \*1\*8 \(-> Change Tektronix cursor color to \*(Pt.
   \*(Ps = \*1\*9 \(-> Change highlight foreground color to \*(Pt.
+.sp
+  \*(Ps = \*2\*2 \(-> Change pointer cursor to \*(Pt.
 .sP
   \*(Ps = \*4\*6 \(-> Change Log File to \*(Pt.
 This is normally disabled by a compile-time option.
Index: ctlseqs.txt
===================================================================
RCS file: /cvs/xenocara/app/xterm/ctlseqs.txt,v
retrieving revision 1.31
diff -u -p -u -r1.31 ctlseqs.txt
--- ctlseqs.txt 10 Jan 2021 09:23:57 -0000      1.31
+++ ctlseqs.txt 27 Mar 2021 09:21:22 -0000
@@ -20,8 +20,8 @@
 
                              Thomas Dickey
                       XFree86 Project (1996-2006)
-                    invisible-island.net (2006-2020)
-               updated for XTerm Patch #363 (2020/12/25)
+                    invisible-island.net (2006-2021)
+               updated for XTerm Patch #367 (2021/03/23)
 
 
 
@@ -1751,6 +1751,8 @@ OSC Ps ; Pt ST
             Ps = 1 7  -> Change highlight background color to Pt.
             Ps = 1 8  -> Change Tektronix cursor color to Pt.
             Ps = 1 9  -> Change highlight foreground color to Pt.
+
+            Ps = 2 2  -> Change pointer cursor to Pt.
 
             Ps = 4 6  -> Change Log File to Pt.  This is normally
           disabled by a compile-time option.
Index: data.h
===================================================================
RCS file: /cvs/xenocara/app/xterm/data.h,v
retrieving revision 1.20
diff -u -p -u -r1.20 data.h
--- data.h      29 Dec 2019 08:54:03 -0000      1.20
+++ data.h      27 Mar 2021 09:21:22 -0000
@@ -1,7 +1,7 @@
-/* $XTermId: data.h,v 1.138 2019/10/06 20:16:02 tom Exp $ */
+/* $XTermId: data.h,v 1.139 2021/03/09 01:08:15 tom Exp $ */
 
 /*
- * Copyright 2002-2018,2019 by Thomas E. Dickey
+ * Copyright 2002-2019,2021 by Thomas E. Dickey
  *
  *                         All Rights Reserved
  *
@@ -164,6 +164,10 @@ typedef struct XTERM_RESOURCE {
     Boolean utmpInhibit;
     Boolean utmpDisplayId;
     Boolean messages;
+
+#ifdef HAVE_LIB_XCURSOR
+    String cursorTheme;
+#endif
 
     String menuLocale;
     String omitTranslation;
Index: fontutils.c
===================================================================
RCS file: /cvs/xenocara/app/xterm/fontutils.c,v
retrieving revision 1.36
diff -u -p -u -r1.36 fontutils.c
--- fontutils.c 14 Feb 2021 09:14:06 -0000      1.36
+++ fontutils.c 27 Mar 2021 09:21:23 -0000
@@ -1,4 +1,4 @@
-/* $XTermId: fontutils.c,v 1.701 2021/02/02 00:40:30 tom Exp $ */
+/* $XTermId: fontutils.c,v 1.703 2021/03/02 00:25:24 tom Exp $ */
 
 /*
  * Copyright 1998-2020,2021 by Thomas E. Dickey
@@ -1020,6 +1020,20 @@ noUsableXft(XtermWidget xw, const char *
 }
 #endif
 
+XFontStruct *
+xtermLoadQueryFont(XtermWidget xw, const char *name)
+{
+    XFontStruct *result = NULL;
+    size_t have = strlen(name);
+    if (have == 0 || have > MAX_U_STRING) {
+       ;                       /* just ignore it */
+    } else {
+       TScreen *screen = TScreenOf(xw);
+       result = XLoadQueryFont(screen->display, name);
+    }
+    return result;
+}
+
 /*
  * Open the given font and verify that it is non-empty.  Return a null on
  * failure.
@@ -1031,12 +1045,11 @@ xtermOpenFont(XtermWidget xw,
              Bool force)
 {
     Bool code = False;
-    TScreen *screen = TScreenOf(xw);
 
     TRACE(("xtermOpenFont %d:%d '%s'\n",
           result->warn, xw->misc.fontWarnings, NonNull(name)));
     if (!IsEmpty(name)) {
-       if ((result->fs = XLoadQueryFont(screen->display, name)) != 0) {
+       if ((result->fs = xtermLoadQueryFont(xw, name)) != 0) {
            code = True;
            if (EmptyFont(result->fs)) {
                xtermCloseFont(xw, result);
@@ -5105,7 +5118,7 @@ save2FontList(XtermWidget xw,
                    next[count++] = value;
                    next[count] = 0;
                    *list = next;
-                   TRACE(("... saved %s %s %lu:%s\n",
+                   TRACE(("... saved \"%s\" \"%s\" %lu:\"%s\"\n",
                           whichFontList(xw, target),
                           whichFontList2(xw, *list),
                           (unsigned long) count,
@@ -5163,7 +5176,8 @@ allocFontList(XtermWidget xw,
        int pass;
        char **list = 0;
 
-       TRACE(("allocFontList %s %s '%s'\n", whichFontEnum(which), name, blob));
+       TRACE(("allocFontList %s name=\"%s\" source=\"%s\"\n",
+              whichFontEnum(which), name, blob));
 
        for (pass = 0; pass < 2; ++pass) {
            unsigned count = 0;
Index: fontutils.h
===================================================================
RCS file: /cvs/xenocara/app/xterm/fontutils.h,v
retrieving revision 1.18
diff -u -p -u -r1.18 fontutils.h
--- fontutils.h 10 Jan 2021 09:23:57 -0000      1.18
+++ fontutils.h 27 Mar 2021 09:21:23 -0000
@@ -1,7 +1,7 @@
-/* $XTermId: fontutils.h,v 1.136 2020/10/30 00:09:09 tom Exp $ */
+/* $XTermId: fontutils.h,v 1.137 2021/02/25 23:03:24 tom Exp $ */
 
 /*
- * Copyright 1998-2019,2020 by Thomas E. Dickey
+ * Copyright 1998-2020,2021 by Thomas E. Dickey
  *
  *                         All Rights Reserved
  *
@@ -38,6 +38,7 @@
 
 extern Bool xtermLoadDefaultFonts (XtermWidget /* xw */);
 extern Bool xtermOpenFont (XtermWidget /* xw */, const char */* name */, 
XTermFonts * /* result */, Bool /* force */);
+extern XFontStruct * xtermLoadQueryFont(XtermWidget /* xw */, const char * 
/*name */);
 extern XTermFonts * getDoubleFont (TScreen * /* screen */, int /* which */);
 extern XTermFonts * getItalicFont (TScreen * /* screen */, int /* which */);
 extern XTermFonts * getNormalFont (TScreen * /* screen */, int /* which */);
Index: graphics.c
===================================================================
RCS file: /cvs/xenocara/app/xterm/graphics.c,v
retrieving revision 1.12
diff -u -p -u -r1.12 graphics.c
--- graphics.c  10 Jan 2021 09:23:57 -0000      1.12
+++ graphics.c  27 Mar 2021 09:21:23 -0000
@@ -1,8 +1,8 @@
-/* $XTermId: graphics.c,v 1.92 2020/10/12 17:58:12 Walter.Harms Exp $ */
+/* $XTermId: graphics.c,v 1.94 2021/02/25 23:42:01 tom Exp $ */
 
 /*
- * Copyright 2013-2019,2020 by Ross Combs
- * Copyright 2013-2019,2020 by Thomas E. Dickey
+ * Copyright 2013-2020,2021 by Ross Combs
+ * Copyright 2013-2020,2021 by Thomas E. Dickey
  *
  *                         All Rights Reserved
  *
@@ -852,7 +852,7 @@ get_new_or_matching_graphic(XtermWidget 
     return graphic;
 }
 
-#define ScaleForXColor(s) (unsigned short) ((long)(s) * 65535 / CHANNEL_MAX)
+#define ScaleForXColor(s) (unsigned short) ((long)(s) * MAX_U_COLOR / 
CHANNEL_MAX)
 
 static int
 save_allocated_color(const ColorRegister *reg, XtermWidget xw, Pixel *pix)
@@ -1054,9 +1054,9 @@ outline_refresh(TScreen const *screen,
              BASEX(draw_w - 1), BASEY(draw_h - 1),
              BASEX(0), BASEY(0));
 
-    def.red = (short) (0.7 * 65535.0);
-    def.green = (short) (0.1 * 65535.0);
-    def.blue = (short) (1.0 * 65535.0);
+    def.red = (short) (0.7 * MAX_U_COLOR);
+    def.green = (short) (0.1 * MAX_U_COLOR);
+    def.blue = (short) (1.0 * MAX_U_COLOR);
     def.flags = DoRed | DoGreen | DoBlue;
     if (allocateBestRGB(graphic->xw, &def)) {
        xgcv.foreground = def.pixel;
Index: graphics_regis.c
===================================================================
RCS file: /cvs/xenocara/app/xterm/graphics_regis.c,v
retrieving revision 1.12
diff -u -p -u -r1.12 graphics_regis.c
--- graphics_regis.c    10 Jan 2021 09:23:57 -0000      1.12
+++ graphics_regis.c    27 Mar 2021 09:21:23 -0000
@@ -1,8 +1,8 @@
-/* $XTermId: graphics_regis.c,v 1.126 2020/10/14 19:04:43 tom Exp $ */
+/* $XTermId: graphics_regis.c,v 1.128 2021/02/25 23:17:48 tom Exp $ */
 
 /*
- * Copyright 2014-2019,2020 by Ross Combs
- * Copyright 2014-2019,2020 by Thomas E. Dickey
+ * Copyright 2014-2020,2021 by Ross Combs
+ * Copyright 2014-2020,2021 by Thomas E. Dickey
  *
  *                         All Rights Reserved
  *
@@ -6177,7 +6177,7 @@ parse_regis_option(RegisParseState *stat
                           fragment_to_tempstr(&delayarg)));
                    break;
                }
-               if (delay < 0 || delay > 32767) {
+               if (delay < 0 || delay > MAX_I_DELAY) {
                    TRACE(("DATA_ERROR: delay out of range: \"%d\"\n", delay));
                    break;
                }
Index: html.c
===================================================================
RCS file: /cvs/xenocara/app/xterm/html.c,v
retrieving revision 1.6
diff -u -p -u -r1.6 html.c
--- html.c      10 Jan 2021 09:23:57 -0000      1.6
+++ html.c      27 Mar 2021 09:21:23 -0000
@@ -1,7 +1,7 @@
-/* $XTermId: html.c,v 1.19 2020/06/02 23:24:26 tom Exp $ */
+/* $XTermId: html.c,v 1.21 2021/02/25 23:19:16 tom Exp $ */
 
 /*
- * Copyright 2018-2019,2020    Thomas E. Dickey
+ * Copyright 2018-2020,2021    Thomas E. Dickey
  * Copyright 2015,2018         Jens Schweikhardt
  *
  * All Rights Reserved
@@ -181,8 +181,8 @@ dumpHtmlLine(XtermWidget xw, int row, FI
 
        if (ld->attribs[col] & BLINK) {
            /* White on red. */
-           fgcolor.red = fgcolor.green = fgcolor.blue = 65535u;
-           bgcolor.red = 65535u;
+           fgcolor.red = fgcolor.green = fgcolor.blue = MAX_U_COLOR;
+           bgcolor.red = MAX_U_COLOR;
            bgcolor.green = bgcolor.blue = 0u;
        }
 #if OPT_WIDE_ATTRS
Index: linedata.c
===================================================================
RCS file: /cvs/xenocara/app/xterm/linedata.c,v
retrieving revision 1.12
diff -u -p -u -r1.12 linedata.c
--- linedata.c  29 Dec 2019 08:54:03 -0000      1.12
+++ linedata.c  27 Mar 2021 09:21:23 -0000
@@ -1,7 +1,7 @@
-/* $XTermId: linedata.c,v 1.97 2019/06/30 19:10:53 tom Exp $ */
+/* $XTermId: linedata.c,v 1.99 2021/03/08 00:24:12 tom Exp $ */
 
 /*
- * Copyright 2009-2018,2019 by Thomas E. Dickey
+ * Copyright 2009-2019,2021 by Thomas E. Dickey
  *
  *                         All Rights Reserved
  *
@@ -251,7 +251,7 @@ saveCellData(TScreen *screen,
                              && (limits == NULL
                                  || (column + 1) >= limits->right)));
            if (blank) {
-               item->charData = (Char) ' ';
+               item->charData = (CharData) ' ';
            }
            item->combSize = blank ? 0 : ld->combSize;
            for_each_combData(off, item) {
Index: main.c
===================================================================
RCS file: /cvs/xenocara/app/xterm/main.c,v
retrieving revision 1.48
diff -u -p -u -r1.48 main.c
--- main.c      14 Feb 2021 09:14:06 -0000      1.48
+++ main.c      27 Mar 2021 09:21:24 -0000
@@ -1,4 +1,4 @@
-/* $XTermId: main.c,v 1.872 2021/02/10 00:33:22 tom Exp $ */
+/* $XTermId: main.c,v 1.877 2021/03/21 22:09:06 tom Exp $ */
 
 /*
  * Copyright 2002-2020,2021 by Thomas E. Dickey
@@ -93,8 +93,6 @@
 #include <version.h>
 #include <graphics.h>
 
-#include <X11/cursorfont.h>
-
 #if OPT_TOOLBAR
 
 #if defined(HAVE_LIB_XAW)
@@ -143,9 +141,9 @@
 #include <grp.h>               /* initgroups() */
 #endif
 
-static void hungtty(int) GCC_NORETURN;
-static void Syntax(char *) GCC_NORETURN;
-static void HsSysError(int) GCC_NORETURN;
+static GCC_NORETURN void hungtty(int);
+static GCC_NORETURN void Syntax(char *);
+static GCC_NORETURN void HsSysError(int);
 
 #if defined(__SCO__) || defined(SVR4) || defined(_POSIX_SOURCE) || ( 
defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 1) )
 #define USE_POSIX_SIGNALS
@@ -904,6 +902,9 @@ static XtResource application_resources[
     Sres("menuLocale", "MenuLocale", menuLocale, DEF_MENU_LOCALE),
     Sres("omitTranslation", "OmitTranslation", omitTranslation, NULL),
     Sres("keyboardType", "KeyboardType", keyboardType, "unknown"),
+#ifdef HAVE_LIB_XCURSOR
+    Sres("cursorTheme", "CursorTheme", cursorTheme, "none"),
+#endif
 #if OPT_PRINT_ON_EXIT
     Ires("printModeImmediate", "PrintModeImmediate", printModeNow, 0),
     Ires("printOptsImmediate", "PrintOptsImmediate", printOptsNow, 9),
@@ -1395,7 +1396,7 @@ static OptionHelp xtermOptions[] = {
 { "-/+sm",                 "turn on/off the session-management support" },
 #endif
 #if OPT_MAXIMIZE
-{"-/+maximized",           "turn on/off maxmize on startup" },
+{"-/+maximized",           "turn on/off maximize on startup" },
 {"-/+fullscreen",          "turn on/off fullscreen on startup" },
 #endif
 { NULL, NULL }};
@@ -2477,6 +2478,18 @@ main(int argc, char *argv[]ENVP_ARG)
                                  application_resources,
                                  XtNumber(application_resources), NULL, 0);
        TRACE_XRES();
+#ifdef HAVE_LIB_XCURSOR
+       if (!strcmp(resource.cursorTheme, "none")) {
+           TRACE(("startup with no cursorTheme\n"));
+           init_colored_cursor(XtDisplay(toplevel));
+       } else {
+           const char *theme = resource.cursorTheme;
+           if (IsEmpty(theme))
+               theme = "default";
+           TRACE(("startup with \"%s\" cursorTheme\n", theme));
+           xtermSetenv("XCURSOR_THEME", theme);
+       }
+#endif
 #if USE_DOUBLE_BUFFER
        if (resource.buffered_fps <= 0)
            resource.buffered_fps = DEF_BUFFER_RATE;
Index: menu.c
===================================================================
RCS file: /cvs/xenocara/app/xterm/menu.c,v
retrieving revision 1.31
diff -u -p -u -r1.31 menu.c
--- menu.c      10 Jan 2021 09:23:57 -0000      1.31
+++ menu.c      27 Mar 2021 09:21:24 -0000
@@ -1,7 +1,7 @@
-/* $XTermId: menu.c,v 1.364 2020/10/13 08:07:27 tom Exp $ */
+/* $XTermId: menu.c,v 1.365 2021/03/21 20:03:03 tom Exp $ */
 
 /*
- * Copyright 1999-2019,2020 by Thomas E. Dickey
+ * Copyright 1999-2020,2021 by Thomas E. Dickey
  *
  *                         All Rights Reserved
  *
@@ -149,14 +149,12 @@ static void do_autolinefeed    PROTO_XT_
 static void do_autowrap        PROTO_XT_CALLBACK_ARGS;
 static void do_backarrow       PROTO_XT_CALLBACK_ARGS;
 static void do_bellIsUrgent    PROTO_XT_CALLBACK_ARGS;
-static void do_clearsavedlines PROTO_XT_CALLBACK_ARGS GCC_NORETURN;
 static void do_continue        PROTO_XT_CALLBACK_ARGS;
 static void do_delete_del      PROTO_XT_CALLBACK_ARGS;
 #if OPT_SCREEN_DUMPS
 static void do_dump_html       PROTO_XT_CALLBACK_ARGS;
 static void do_dump_svg        PROTO_XT_CALLBACK_ARGS;
 #endif
-static void do_hardreset       PROTO_XT_CALLBACK_ARGS GCC_NORETURN;
 static void do_interrupt       PROTO_XT_CALLBACK_ARGS;
 static void do_jumpscroll      PROTO_XT_CALLBACK_ARGS;
 static void do_keepClipboard   PROTO_XT_CALLBACK_ARGS;
@@ -166,7 +164,6 @@ static void do_old_fkeys       PROTO_XT_
 static void do_poponbell       PROTO_XT_CALLBACK_ARGS;
 static void do_print           PROTO_XT_CALLBACK_ARGS;
 static void do_print_redir     PROTO_XT_CALLBACK_ARGS;
-static void do_quit            PROTO_XT_CALLBACK_ARGS GCC_NORETURN;
 static void do_redraw          PROTO_XT_CALLBACK_ARGS;
 static void do_reversevideo    PROTO_XT_CALLBACK_ARGS;
 static void do_reversewrap     PROTO_XT_CALLBACK_ARGS;
@@ -175,12 +172,16 @@ static void do_scrollkey       PROTO_XT_
 static void do_scrollttyoutput PROTO_XT_CALLBACK_ARGS;
 static void do_securekbd       PROTO_XT_CALLBACK_ARGS;
 static void do_selectClipboard PROTO_XT_CALLBACK_ARGS;
-static void do_softreset       PROTO_XT_CALLBACK_ARGS GCC_NORETURN;
 static void do_suspend         PROTO_XT_CALLBACK_ARGS;
 static void do_terminate       PROTO_XT_CALLBACK_ARGS;
 static void do_titeInhibit     PROTO_XT_CALLBACK_ARGS;
 static void do_visualbell      PROTO_XT_CALLBACK_ARGS;
 static void do_vtfont          PROTO_XT_CALLBACK_ARGS;
+
+static GCC_NORETURN void do_clearsavedlines PROTO_XT_CALLBACK_ARGS;
+static GCC_NORETURN void do_hardreset       PROTO_XT_CALLBACK_ARGS;
+static GCC_NORETURN void do_quit            PROTO_XT_CALLBACK_ARGS;
+static GCC_NORETURN void do_softreset       PROTO_XT_CALLBACK_ARGS;
 
 #ifdef ALLOWLOGGING
 static void do_logging         PROTO_XT_CALLBACK_ARGS;
Index: menu.h
===================================================================
RCS file: /cvs/xenocara/app/xterm/menu.h,v
retrieving revision 1.18
diff -u -p -u -r1.18 menu.h
--- menu.h      10 Jan 2021 09:23:57 -0000      1.18
+++ menu.h      27 Mar 2021 09:21:24 -0000
@@ -1,7 +1,7 @@
-/* $XTermId: menu.h,v 1.145 2020/09/15 11:09:06 tom Exp $ */
+/* $XTermId: menu.h,v 1.146 2021/03/21 20:03:03 tom Exp $ */
 
 /*
- * Copyright 1999-2019,2020 by Thomas E. Dickey
+ * Copyright 1999-2020,2021 by Thomas E. Dickey
  *
  *                         All Rights Reserved
  *
@@ -95,7 +95,6 @@ extern void HandleAutoLineFeed     PROTO
 extern void HandleAutoWrap         PROTO_XT_ACTIONS_ARGS;
 extern void HandleBackarrow        PROTO_XT_ACTIONS_ARGS;
 extern void HandleBellIsUrgent     PROTO_XT_ACTIONS_ARGS;
-extern void HandleClearSavedLines  PROTO_XT_ACTIONS_ARGS GCC_NORETURN;
 extern void HandleCreateMenu       PROTO_XT_ACTIONS_ARGS;
 extern void HandleCursesEmul       PROTO_XT_ACTIONS_ARGS;
 extern void HandleCursorBlink      PROTO_XT_ACTIONS_ARGS;
@@ -107,7 +106,6 @@ extern void HandleFontDoublesize   PROTO
 extern void HandleFontLoading      PROTO_XT_ACTIONS_ARGS;
 extern void HandleFontPacked       PROTO_XT_ACTIONS_ARGS;
 extern void HandleFullscreen       PROTO_XT_ACTIONS_ARGS;
-extern void HandleHardReset        PROTO_XT_ACTIONS_ARGS GCC_NORETURN;
 extern void HandleHpFunctionKeys   PROTO_XT_ACTIONS_ARGS;
 extern void HandleJumpscroll       PROTO_XT_ACTIONS_ARGS;
 extern void HandleKeepClipboard    PROTO_XT_ACTIONS_ARGS;
@@ -123,7 +121,6 @@ extern void HandlePrintEverything  PROTO
 extern void HandlePrintImmediate   PROTO_XT_ACTIONS_ARGS;
 extern void HandlePrintOnError     PROTO_XT_ACTIONS_ARGS;
 extern void HandlePrintScreen      PROTO_XT_ACTIONS_ARGS;
-extern void HandleQuit             PROTO_XT_ACTIONS_ARGS GCC_NORETURN;
 extern void HandleRedraw           PROTO_XT_ACTIONS_ARGS;
 extern void HandleRenderFont       PROTO_XT_ACTIONS_ARGS;
 extern void HandleReverseVideo     PROTO_XT_ACTIONS_ARGS;
@@ -141,7 +138,6 @@ extern void HandleSetTekText       PROTO
 extern void HandleSetTerminalType  PROTO_XT_ACTIONS_ARGS;
 extern void HandleSetVisualBell    PROTO_XT_ACTIONS_ARGS;
 extern void HandleSixelScrolling   PROTO_XT_ACTIONS_ARGS;
-extern void HandleSoftReset        PROTO_XT_ACTIONS_ARGS GCC_NORETURN;
 extern void HandleSunFunctionKeys  PROTO_XT_ACTIONS_ARGS;
 extern void HandleSunKeyboard      PROTO_XT_ACTIONS_ARGS;
 extern void HandleTekCopy          PROTO_XT_ACTIONS_ARGS;
@@ -155,6 +151,11 @@ extern void HandleUTF8Title        PROTO
 extern void HandleVisibility       PROTO_XT_ACTIONS_ARGS;
 extern void HandleWriteError       PROTO_XT_ACTIONS_ARGS;
 extern void HandleWriteNow         PROTO_XT_ACTIONS_ARGS;
+
+extern GCC_NORETURN void HandleClearSavedLines  PROTO_XT_ACTIONS_ARGS;
+extern GCC_NORETURN void HandleHardReset        PROTO_XT_ACTIONS_ARGS;
+extern GCC_NORETURN void HandleQuit             PROTO_XT_ACTIONS_ARGS;
+extern GCC_NORETURN void HandleSoftReset        PROTO_XT_ACTIONS_ARGS;
 
 extern void SetupMenus (Widget /*shell*/, Widget */*forms*/, Widget 
*/*menus*/, Dimension * /*menu_high*/);
 
Index: misc.c
===================================================================
RCS file: /cvs/xenocara/app/xterm/misc.c,v
retrieving revision 1.42
diff -u -p -u -r1.42 misc.c
--- misc.c      14 Feb 2021 09:14:06 -0000      1.42
+++ misc.c      27 Mar 2021 09:21:24 -0000
@@ -1,4 +1,4 @@
-/* $XTermId: misc.c,v 1.968 2021/02/10 00:50:59 tom Exp $ */
+/* $XTermId: misc.c,v 1.979 2021/03/24 00:27:48 tom Exp $ */
 
 /*
  * Copyright 1999-2020,2021 by Thomas E. Dickey
@@ -67,7 +67,6 @@
 
 #include <X11/keysym.h>
 #include <X11/Xatom.h>
-#include <X11/cursorfont.h>
 
 #include <X11/Xmu/Error.h>
 #include <X11/Xmu/SysUtil.h>
@@ -220,7 +219,7 @@ unselectwindow(XtermWidget xw, int flag)
 
     if (screen->hide_pointer && screen->pointer_mode < pFocused) {
        screen->hide_pointer = False;
-       xtermDisplayCursor(xw);
+       xtermDisplayPointer(xw);
     }
 
     screen->select &= ~flag;
@@ -314,16 +313,16 @@ do_xevents(XtermWidget xw)
 }
 
 void
-xtermDisplayCursor(XtermWidget xw)
+xtermDisplayPointer(XtermWidget xw)
 {
     TScreen *screen = TScreenOf(xw);
 
     if (screen->Vshow) {
        if (screen->hide_pointer) {
-           TRACE(("Display hidden_cursor\n"));
+           TRACE(("Display text pointer (hidden)\n"));
            XDefineCursor(screen->display, VWindow(screen), 
screen->hidden_cursor);
        } else {
-           TRACE(("Display pointer_cursor\n"));
+           TRACE(("Display text pointer (visible)\n"));
            recolor_cursor(screen,
                           screen->pointer_cursor,
                           T_COLOR(screen, MOUSE_FG),
@@ -366,7 +365,7 @@ xtermShowPointer(XtermWidget xw, Bool en
     if (enable) {
        if (screen->hide_pointer) {
            screen->hide_pointer = False;
-           xtermDisplayCursor(xw);
+           xtermDisplayPointer(xw);
            switch (screen->send_mouse_pos) {
            case ANY_EVENT_MOUSE:
                break;
@@ -384,7 +383,7 @@ xtermShowPointer(XtermWidget xw, Bool en
        } else {
            tried = 0;
            screen->hide_pointer = True;
-           xtermDisplayCursor(xw);
+           xtermDisplayPointer(xw);
            MotionOn(screen, xw);
        }
     }
@@ -717,9 +716,9 @@ make_hidden_cursor(XtermWidget xw)
      * server insists on drawing _something_.
      */
     TRACE(("Ask for nil2 font\n"));
-    if ((fn = XLoadQueryFont(dpy, "nil2")) == 0) {
+    if ((fn = xtermLoadQueryFont(xw, "nil2")) == 0) {
        TRACE(("...Ask for fixed font\n"));
-       fn = XLoadQueryFont(dpy, DEFFONT);
+       fn = xtermLoadQueryFont(xw, DEFFONT);
     }
 
     if (fn != None) {
@@ -739,10 +738,10 @@ make_hidden_cursor(XtermWidget xw)
  * default theme.  Testing seems to show that we only have to provide this
  * until the window is initialized.
  */
+#ifdef HAVE_LIB_XCURSOR
 void
 init_colored_cursor(Display *dpy)
 {
-#ifdef HAVE_LIB_XCURSOR
     static const char theme[] = "index.theme";
     static const char pattern[] = "xtermXXXXXXXX";
     char *env = getenv("XCURSOR_THEME");
@@ -753,7 +752,11 @@ init_colored_cursor(Display *dpy)
      */
     if (IsEmpty(env)) {
        env = XGetDefault(dpy, "Xcursor", "theme");
+       TRACE(("XGetDefault Xcursor theme \"%s\"\n", NonNull(env)));
+    } else {
+       TRACE(("getenv(XCURSOR_THEME) \"%s\"\n", NonNull(env)));
     }
+
     /*
      * If neither found, provide our own default theme.
      */
@@ -762,6 +765,8 @@ init_colored_cursor(Display *dpy)
        char *filename;
        size_t needed;
 
+       TRACE(("init_colored_cursor will make an empty Xcursor theme\n"));
+
        if ((tmp_dir = getenv("TMPDIR")) == 0) {
            tmp_dir = P_tmpdir;
        }
@@ -790,21 +795,25 @@ init_colored_cursor(Display *dpy)
 
                strcat(leaf, "/");
                strcat(leaf, theme);
+
                if ((fp = fopen(xterm_cursor_theme, "w")) != 0) {
                    fprintf(fp, "[Icon Theme]\n");
                    fclose(fp);
                    *leaf = '\0';
                    xtermSetenv("XCURSOR_PATH", xterm_cursor_theme);
                    *leaf = '/';
+
+                   TRACE(("...initialized xterm_cursor_theme \"%s\"\n",
+                          xterm_cursor_theme));
+                   atexit(cleanup_colored_cursor);
+               } else {
+                   FreeAndNull(xterm_cursor_theme);
                }
-               atexit(cleanup_colored_cursor);
            }
        }
     }
-#else
-    (void) dpy;
-#endif /* HAVE_LIB_XCURSOR */
 }
+#endif /* HAVE_LIB_XCURSOR */
 
 /*
  * Once done, discard the file and directory holding it.
@@ -821,9 +830,8 @@ cleanup_colored_cursor(void)
            && (sb.st_mode & S_IFMT) == S_IFDIR) {
            unlink(xterm_cursor_theme);
            rmdir(my_path);
-           free(xterm_cursor_theme);
-           xterm_cursor_theme = 0;
        }
+       FreeAndNull(xterm_cursor_theme);
     }
 #endif /* HAVE_LIB_XCURSOR */
 }
@@ -843,7 +851,8 @@ make_colored_cursor(unsigned c_index,               /
 
        /* adapted from XCreateFontCursor(), which hardcodes the font name */
        TRACE(("loading cursor from alternate cursor font\n"));
-       if ((myFont.fs = XLoadQueryFont(dpy, screen->cursor_font_name)) != 0) {
+       myFont.fs = xtermLoadQueryFont(term, screen->cursor_font_name);
+       if (myFont.fs != NULL) {
            if (!xtermMissingChar(c_index, &myFont)
                && !xtermMissingChar(c_index + 1, &myFont)) {
 #define DATA(c) { 0UL, c, c, c, 0, 0 }
@@ -881,6 +890,148 @@ make_colored_cursor(unsigned c_index,             /
     return c;
 }
 
+/* adapted from <X11/cursorfont.h> */
+static int
+LookupCursorShape(const char *name)
+{
+#define DATA(name) { XC_##name, #name }
+    static struct {
+       int code;
+       const char name[25];
+    } table[] = {
+       DATA(X_cursor),
+           DATA(arrow),
+           DATA(based_arrow_down),
+           DATA(based_arrow_up),
+           DATA(boat),
+           DATA(bogosity),
+           DATA(bottom_left_corner),
+           DATA(bottom_right_corner),
+           DATA(bottom_side),
+           DATA(bottom_tee),
+           DATA(box_spiral),
+           DATA(center_ptr),
+           DATA(circle),
+           DATA(clock),
+           DATA(coffee_mug),
+           DATA(cross),
+           DATA(cross_reverse),
+           DATA(crosshair),
+           DATA(diamond_cross),
+           DATA(dot),
+           DATA(dotbox),
+           DATA(double_arrow),
+           DATA(draft_large),
+           DATA(draft_small),
+           DATA(draped_box),
+           DATA(exchange),
+           DATA(fleur),
+           DATA(gobbler),
+           DATA(gumby),
+           DATA(hand1),
+           DATA(hand2),
+           DATA(heart),
+           DATA(icon),
+           DATA(iron_cross),
+           DATA(left_ptr),
+           DATA(left_side),
+           DATA(left_tee),
+           DATA(leftbutton),
+           DATA(ll_angle),
+           DATA(lr_angle),
+           DATA(man),
+           DATA(middlebutton),
+           DATA(mouse),
+           DATA(pencil),
+           DATA(pirate),
+           DATA(plus),
+           DATA(question_arrow),
+           DATA(right_ptr),
+           DATA(right_side),
+           DATA(right_tee),
+           DATA(rightbutton),
+           DATA(rtl_logo),
+           DATA(sailboat),
+           DATA(sb_down_arrow),
+           DATA(sb_h_double_arrow),
+           DATA(sb_left_arrow),
+           DATA(sb_right_arrow),
+           DATA(sb_up_arrow),
+           DATA(sb_v_double_arrow),
+           DATA(shuttle),
+           DATA(sizing),
+           DATA(spider),
+           DATA(spraycan),
+           DATA(star),
+           DATA(target),
+           DATA(tcross),
+           DATA(top_left_arrow),
+           DATA(top_left_corner),
+           DATA(top_right_corner),
+           DATA(top_side),
+           DATA(top_tee),
+           DATA(trek),
+           DATA(ul_angle),
+           DATA(umbrella),
+           DATA(ur_angle),
+           DATA(watch),
+           DATA(xterm),
+    };
+#undef DATA
+    Cardinal j;
+    int result = -1;
+    if (!IsEmpty(name)) {
+       for (j = 0; j < XtNumber(table); ++j) {
+           if (!strcmp(name, table[j].name)) {
+               result = table[j].code;
+               break;
+           }
+       }
+    }
+    return result;
+}
+
+void
+xtermSetupPointer(XtermWidget xw, const char *theShape)
+{
+    TScreen *screen = TScreenOf(xw);
+    unsigned shape = XC_xterm;
+    int other = LookupCursorShape(theShape);
+    unsigned which;
+
+    if (other >= 0 && other < XC_num_glyphs)
+       shape = (unsigned) other;
+
+    TRACE(("looked up shape index %d from shape name \"%s\"\n", other,
+          NonNull(theShape)));
+
+    which = (unsigned) (shape / 2);
+    if (xw->work.pointer_cursors[which] == None) {
+       TRACE(("creating text pointer cursor from shape %d\n", shape));
+       xw->work.pointer_cursors[which] =
+           make_colored_cursor(shape,
+                               T_COLOR(screen, MOUSE_FG),
+                               T_COLOR(screen, MOUSE_BG));
+    } else {
+       TRACE(("updating text pointer cursor for shape %d\n", shape));
+       recolor_cursor(screen,
+                      screen->pointer_cursor,
+                      T_COLOR(screen, MOUSE_FG),
+                      T_COLOR(screen, MOUSE_BG));
+    }
+    if (screen->pointer_cursor != xw->work.pointer_cursors[which]) {
+       screen->pointer_cursor = xw->work.pointer_cursors[which];
+       TRACE(("defining text pointer cursor with shape %d\n", shape));
+       XDefineCursor(screen->display, VShellWindow(xw), 
screen->pointer_cursor);
+       if (XtIsRealized((Widget) xw)) {
+           /* briefly override pointerMode after changing the pointer */
+           if (screen->pointer_mode != pNever)
+               screen->hide_pointer = True;
+           xtermShowPointer(xw, True);
+       }
+    }
+}
+
 /* ARGSUSED */
 void
 HandleKeyPressed(Widget w GCC_UNUSED,
@@ -3092,8 +3243,13 @@ xtermAllocColor(XtermWidget xw, XColor *
     Boolean result = False;
     TScreen *screen = TScreenOf(xw);
     Colormap cmap = xw->core.colormap;
+    size_t have = strlen(spec);
 
-    if (XParseColor(screen->display, cmap, spec, def)) {
+    if (have == 0 || have > MAX_U_STRING) {
+       if (resource.reportColors) {
+           printf("color  (ignored, length %lu)\n", have);
+       }
+    } else if (XParseColor(screen->display, cmap, spec, def)) {
        XColor save_def = *def;
        if (resource.reportColors) {
            printf("color  %04x/%04x/%04x = \"%s\"\n",
@@ -4175,6 +4331,10 @@ do_osc(XtermWidget xw, Char *oscbuf, siz
        }
        break;
 
+    case 22:
+       xtermSetupPointer(xw, buf);
+       break;
+
     case 30:
     case 31:
        /* reserved for Konsole (Stephan Binner <[email protected]>) */
@@ -6919,8 +7079,6 @@ xtermOpenApplication(XtAppContext * app_
                             fallback_resources,
                             NULL, 0);
 #endif /* OPT_SESSION_MGT */
-    init_colored_cursor(XtDisplay(result));
-
     XtSetErrorHandler(NULL);
 
     return result;
Index: print.c
===================================================================
RCS file: /cvs/xenocara/app/xterm/print.c,v
retrieving revision 1.21
diff -u -p -u -r1.21 print.c
--- print.c     10 Jan 2021 09:23:57 -0000      1.21
+++ print.c     27 Mar 2021 09:21:24 -0000
@@ -1,7 +1,7 @@
-/* $XTermId: print.c,v 1.170 2020/09/19 16:28:48 Ross.Combs Exp $ */
+/* $XTermId: print.c,v 1.172 2021/03/02 00:19:13 tom Exp $ */
 
 /*
- * Copyright 1997-2017,2020 by Thomas E. Dickey
+ * Copyright 1997-2020,2021 by Thomas E. Dickey
  *
  *                         All Rights Reserved
  *
@@ -78,7 +78,7 @@ static void stringToPrinter(XtermWidget 
 static void setGraphicsPrintToHost(XtermWidget /* xw */ ,
                                   int /* enabled */ );
 #else
-#define setGraphicsPrintToHost(xw, enabled) /* nothing */
+#define setGraphicsPrintToHost(xw, enabled)    /* nothing */
 #endif
 
 static void
@@ -325,16 +325,16 @@ xtermPrintEverything(XtermWidget xw, Pri
            printLines(xw, -screen->savedlines, -(screen->topline + 1), p);
        }
        if (p->print_everything & 4) {
-           screen->whichBuf = 1;
+           SwitchBufPtrs(screen, 1);
            done_which |= 2;
            printLines(xw, 0, screen->max_row, p);
-           screen->whichBuf = save_which;
+           SwitchBufPtrs(screen, save_which);
        }
        if (p->print_everything & 2) {
-           screen->whichBuf = 0;
+           SwitchBufPtrs(screen, 0);
            done_which |= 1;
            printLines(xw, 0, screen->max_row, p);
-           screen->whichBuf = save_which;
+           SwitchBufPtrs(screen, save_which);
        }
        if (p->print_everything & 1) {
            if (!(done_which & (1 << screen->whichBuf))) {
@@ -836,6 +836,7 @@ xtermPrintImmediately(XtermWidget xw, St
 
        umask(save_umask);
        screen->printer_state = save_state;
+       free(my_filename);
     }
 }
 
Index: ptyx.h
===================================================================
RCS file: /cvs/xenocara/app/xterm/ptyx.h,v
retrieving revision 1.48
diff -u -p -u -r1.48 ptyx.h
--- ptyx.h      10 Jan 2021 09:23:57 -0000      1.48
+++ ptyx.h      27 Mar 2021 09:21:24 -0000
@@ -1,7 +1,7 @@
-/* $XTermId: ptyx.h,v 1.1026 2020/12/25 15:15:37 tom Exp $ */
+/* $XTermId: ptyx.h,v 1.1030 2021/03/21 22:11:10 tom Exp $ */
 
 /*
- * Copyright 1999-2019,2020 by Thomas E. Dickey
+ * Copyright 1999-2020,2021 by Thomas E. Dickey
  *
  *                         All Rights Reserved
  *
@@ -67,6 +67,8 @@
 #include <X11/Shell.h>         /* for XtNdieCallback, etc. */
 #include <X11/StringDefs.h>    /* for standard resource names */
 #include <X11/Xmu/Misc.h>      /* For Max() and Min(). */
+#include <X11/cursorfont.h>
+
 
 #undef bcopy
 #undef bzero
@@ -407,6 +409,12 @@ typedef struct {
 #define DFT_KBD_DIALECT "B"            /* default USASCII */
 #endif
 
+#define MAX_I_PARAM    65535           /* parameters */
+#define MAX_I_DELAY    32767           /* time-delay in ReGIS */
+#define MAX_U_COLOR    65535u          /* colors */
+#define MAX_U_COORD    32767u          /* coordinates */
+#define MAX_U_STRING   65535u          /* string-length */
+
 /* constants used for utf8 mode */
 #define UCS_REPL       0xfffd
 #define UCS_LIMIT      0x80000000U     /* both limit and flag for non-UCS */
@@ -2518,7 +2526,7 @@ typedef struct {
        int             pointer_mode0;  /* ...initial value             */
        Boolean         hide_pointer;   /* true to use "hidden_cursor"  */
        String          pointer_shape;  /* name of shape in cursor font */
-       Cursor          pointer_cursor; /* pointer cursor in window     */
+       Cursor          pointer_cursor; /* current pointer cursor       */
        Cursor          hidden_cursor;  /* hidden cursor in window      */
 
        String  answer_back;            /* response to ENQ              */
@@ -3112,6 +3120,7 @@ typedef struct _Misc {
     Boolean login_shell;
     Boolean re_verse;
     Boolean re_verse0;         /* initial value of "-rv" */
+    Boolean resizeByPixel;
     XtGravity resizeGravity;
     Boolean reverseWrap;
     Boolean autoWrap;
@@ -3177,6 +3186,8 @@ typedef struct _Work {
        char *str;
        int len;
     } user_keys[MAX_UDK];
+#define MAX_POINTER (XC_num_glyphs/2)
+    Cursor pointer_cursors[MAX_POINTER]; /* saved cursors      */
 #ifndef NO_ACTIVE_ICON
     int active_icon;           /* use application icon window  */
     char *wm_name;
Index: resize.c
===================================================================
RCS file: /cvs/xenocara/app/xterm/resize.c,v
retrieving revision 1.15
diff -u -p -u -r1.15 resize.c
--- resize.c    10 Jan 2021 09:23:57 -0000      1.15
+++ resize.c    27 Mar 2021 09:21:24 -0000
@@ -1,7 +1,7 @@
-/* $XTermId: resize.c,v 1.144 2020/06/03 00:26:23 tom Exp $ */
+/* $XTermId: resize.c,v 1.145 2021/03/21 20:03:17 tom Exp $ */
 
 /*
- * Copyright 2003-2018,2020 by Thomas E. Dickey
+ * Copyright 2003-2020,2021 by Thomas E. Dickey
  *
  *                         All Rights Reserved
  *
@@ -103,7 +103,6 @@ int ignore_unused;
 #define        SHELL_UNKNOWN   0
 #define        SHELL_C         1
 #define        SHELL_BOURNE    2
-
 /* *INDENT-OFF* */
 static struct {
     const char *name;
@@ -182,10 +181,10 @@ static const char *wsize[EMULATIONS] =
 };
 #endif /* USE_STRUCT_WINSIZE */
 
-static void failed(const char *) GCC_NORETURN;
-static void onintr(int) GCC_NORETURN;
-static void resize_timeout(int) GCC_NORETURN;
-static void Usage(void) GCC_NORETURN;
+static GCC_NORETURN void failed(const char *);
+static GCC_NORETURN void onintr(int);
+static GCC_NORETURN void resize_timeout(int);
+static GCC_NORETURN void Usage(void);
 
 static void
 failed(const char *s)
Index: screen.c
===================================================================
RCS file: /cvs/xenocara/app/xterm/screen.c,v
retrieving revision 1.30
diff -u -p -u -r1.30 screen.c
--- screen.c    14 Feb 2021 09:14:06 -0000      1.30
+++ screen.c    27 Mar 2021 09:21:25 -0000
@@ -1,4 +1,4 @@
-/* $XTermId: screen.c,v 1.597 2021/02/02 00:19:32 tom Exp $ */
+/* $XTermId: screen.c,v 1.598 2021/03/01 08:54:26 tom Exp $ */
 
 /*
  * Copyright 1999-2020,2021 by Thomas E. Dickey
@@ -3213,7 +3213,9 @@ FullScreen(XtermWidget xw, int new_ewmh_
            unset_resize_increments(xw);
            set_ewmh_hint(dpy, window, _NET_WM_STATE_ADD, newprop);
        } else if (xw->work.ewmh[which].mode && !new_ewmh_mode) {
-           set_resize_increments(xw);
+           if (!xw->misc.resizeByPixel) {
+               set_resize_increments(xw);
+           }
            set_ewmh_hint(dpy, window, _NET_WM_STATE_REMOVE, oldprop);
        } else {
            set_ewmh_hint(dpy, window, _NET_WM_STATE_REMOVE, oldprop);
Index: svg.c
===================================================================
RCS file: /cvs/xenocara/app/xterm/svg.c,v
retrieving revision 1.4
diff -u -p -u -r1.4 svg.c
--- svg.c       10 Jan 2021 09:23:57 -0000      1.4
+++ svg.c       27 Mar 2021 09:21:25 -0000
@@ -1,7 +1,7 @@
-/* $XTermId: svg.c,v 1.17 2020/06/02 23:24:31 tom Exp $ */
+/* $XTermId: svg.c,v 1.19 2021/02/25 23:20:05 tom Exp $ */
 
 /*
- * Copyright 2017-2019,2020    Thomas E. Dickey
+ * Copyright 2017-2020,2021    Thomas E. Dickey
  * Copyright 2015-2016,2017    Jens Schweikhardt
  *
  * All Rights Reserved
@@ -172,8 +172,8 @@ dumpSvgLine(XtermWidget xw, int row, FIL
 
        if (ld->attribs[col] & BLINK) {
            /* White on red. */
-           fgcolor.red = fgcolor.green = fgcolor.blue = 65535u;
-           bgcolor.red = 65535u;
+           fgcolor.red = fgcolor.green = fgcolor.blue = MAX_U_COLOR;
+           bgcolor.red = MAX_U_COLOR;
            bgcolor.green = bgcolor.blue = 0u;
        }
 #if OPT_WIDE_ATTRS
Index: terminfo
===================================================================
RCS file: /cvs/xenocara/app/xterm/terminfo,v
retrieving revision 1.11
diff -u -p -u -r1.11 terminfo
--- terminfo    10 Jan 2021 09:23:57 -0000      1.11
+++ terminfo    27 Mar 2021 09:21:25 -0000
@@ -1,10 +1,10 @@
-# $XTermId: terminfo,v 1.190 2020/12/11 09:23:14 tom Exp $
+# $XTermId: terminfo,v 1.197 2021/02/28 12:02:56 tom Exp $
 #
 # Updates/notes/new entries (e.g., xterm-8bit, xterm-16color, xterm-256color)
 # - Thomas E. Dickey
 #
 #------------------------------------------------------------------------------
-# Copyright 1996-2019,2020 by Thomas E. Dickey
+# Copyright 1996-2020,2021 by Thomas E. Dickey
 #
 #                         All Rights Reserved
 #
@@ -134,7 +134,8 @@ xterm-new|modern xterm terminal emulator
        indn=\E[%p1%dS,
        kcbt=\E[Z,
        kent=\EOM,
-       rin=\E[%p1%dT,
+       nel=\EE,
+       use=ecma+index,
        use=xterm+keypad,
        use=vt420+lrmm,
        use=xterm+sm+1006,
@@ -142,7 +143,7 @@ xterm-new|modern xterm terminal emulator
        use=ecma+strikeout,
        use=xterm+pcfkeys,
        use=xterm+tmux,
-       use=xterm-basic,
+       use=xterm+nofkeys,
 
 # Left/right margins are supported in xterm since patch #279 (2012/05/10)
 vt420+lrmm|VT420 left/right margins,
@@ -904,11 +905,21 @@ xterm+pce0|fragment with modifyCursorKey
        kPRV7=\E[5;7~,
        use=xterm+edit,
 
+ecma+italics|ECMA-48 italics,
+       ritm=\E[23m,
+       sitm=\E[3m,
+
 # The rmxx/smxx capabilities are an ncurses extension
 ecma+strikeout|ECMA-48 strikeout/crossed-out,
        rmxx=\E[29m,
        smxx=\E[9m,
 
+# ECMA-48 does not include the VT100 indexing and scroll-margins.  It has its
+# own variation.
+ecma+index|ECMA-48 scroll up/down,
+       indn=\E[%p1%dS,
+       rin=\E[%p1%dT,
+
 # The XM capability is an ncurses extension
 xterm+sm+1006|xterm SGR-mouse,
        kmous=\E[<,
@@ -1012,12 +1023,10 @@ xterm-basic|modern xterm terminal emulat
        mc5=\E[5i,
        meml=\El,
        memu=\Em,
-       nel=\EE,
        op=\E[39;49m,
        rc=\E8,
        rev=\E[7m,
        ri=\EM,
-       ritm=\E[23m,
        rmacs=\E(B,
        rmam=\E[?7l,
        rmir=\E[4l,
@@ -1098,7 +1107,6 @@ xterm-basic|modern xterm terminal emulat
                %;
                m,
        sgr0=\E(B\E[m,
-       sitm=\E[3m,
        smacs=\E(0,
        smam=\E[?7h,
        smir=\E[4h,
@@ -1112,6 +1120,21 @@ xterm-basic|modern xterm terminal emulat
        use=ansi+enq,
        use=xterm+alt+title,
        use=xterm+kbs,
+
+xterm+nofkeys|building block for xterm fkey-variants,
+       npc,
+       kcbt=\E[Z,
+       kent=\EOM,
+       nel=\EE,
+       use=ecma+index,
+       use=ansi+rep,
+       use=ecma+strikeout,
+       use=vt420+lrmm,
+       use=xterm+sm+1006,
+       use=xterm+tmux,
+       use=ecma+italics,
+       use=xterm+keypad,
+       use=xterm-basic,
 #
 # The xterm-new description has all of the features, but is not completely
 # compatible with vt220.  If you are using a Sun or PC keyboard, set the
@@ -1127,15 +1150,14 @@ xterm-basic|modern xterm terminal emulat
 # interferes with the DECUDK functionality.
 #
 xterm-vt220|xterm emulating vt220,
-       ka1=\EOw,
-       ka3=\EOy,
-       kb2=\EOu,
-       kc1=\EOq,
-       kc3=\EOs,
+       npc,
        kcbt=\E[Z,
+       kcub1=\EOD,
+       kcud1=\EOB,
+       kcuf1=\EOC,
+       kcuu1=\EOA,
        kend=\E[4~,
        kent=\EOM,
-       kf1=\EOP,
        kf10=\E[21~,
        kf11=\E[23~,
        kf12=\E[24~,
@@ -1146,10 +1168,7 @@ xterm-vt220|xterm emulating vt220,
        kf17=\E[31~,
        kf18=\E[32~,
        kf19=\E[33~,
-       kf2=\EOQ,
        kf20=\E[34~,
-       kf3=\EOR,
-       kf4=\EOS,
        kf5=\E[15~,
        kf6=\E[17~,
        kf7=\E[18~,
@@ -1157,14 +1176,20 @@ xterm-vt220|xterm emulating vt220,
        kf9=\E[20~,
        khome=\E[1~,
        kich1=\E[2~,
+       kmous=\E[M,
        knp=\E[6~,
        kpp=\E[5~,
-       ka2=\EOx,
-       kb1=\EOt,
-       kb3=\EOv,
-       kc2=\EOr,
+       nel=\EE,
        use=xterm+app,
        use=xterm+edit,
+       use=vt220+keypad,
+       use=ecma+italics,
+       use=ecma+index,
+       use=ansi+rep,
+       use=ecma+strikeout,
+       use=xterm+sm+1006,
+       use=xterm+tmux,
+       use=xterm+keypad,
        use=xterm-basic,
 #
 xterm-vt52|xterm emulating dec vt52,
@@ -1322,7 +1347,7 @@ xterm-sun|xterm with sun function keys,
        knp=\E[222z,
        kpp=\E[216z,
        kund=\E[195z,
-       use=xterm-basic,
+       use=xterm+nofkeys,
 #
 xterm-hp|xterm with hpterm function keys,
        kclr=\EJ,
@@ -1344,7 +1369,7 @@ xterm-hp|xterm with hpterm function keys
        kich1=\EQ,
        knp=\ES,
        kpp=\ET,
-       use=xterm-basic,
+       use=xterm+nofkeys,
 #
 # scoterm implements 48 function-keys using shift- and control-modifiers to
 # multiple 12 function-keys.  X has a hard-coded limit of 35 function-keys,
@@ -1415,7 +1440,7 @@ xterm-sco|xterm with SCO function keys,
        knp=\E[G,
        kpp=\E[I,
        use=xterm+noapp,
-       use=xterm-basic,
+       use=xterm+nofkeys,
 #
 # Other variants (these are all very old entries, from X11R5):
 xterm-24|xterms|vs100|xterm terminal emulator (X Window System),
@@ -1454,16 +1479,6 @@ xterm-boldso|xterm with bold for standou
        smso=\E[1m,
        use=xterm-old,
 xterm-mono|monochrome xterm,
-       bce@,
-       colors@,
-       ncv@,
-       pairs@,
-       op@,
-       setab@,
-       setaf@,
-       setb@,
-       setf@,
-       sgr@,
        use=xterm-old,
 #
 # VTxxx terminals are usually set up so that full-screen applications will use
@@ -1869,7 +1884,7 @@ xterm+256color|original xterm 256-color 
        colors#0x100,
        pairs#0x10000,
        initc=\E]4;
-               
%p1%d;rgb\:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\\,
+               
%p1%d;rgb:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\\,
        oc=\E]104\007,
        setab=\E[
                %?
@@ -1903,7 +1918,7 @@ xterm+256color2|xterm 256-color feature,
                %e
                        %p1%{16}%<
                        %t10%p1%{8}%-%d
-               %e48\:5\:
+               %e48:5:
                        %p1%d
                %;
                m,
@@ -1914,10 +1929,12 @@ xterm+256color2|xterm 256-color feature,
                %e
                        %p1%{16}%<
                        %t9%p1%{8}%-%d
-               %e38\:5\:
+               %e38:5:
                        %p1%d
                %;
                m,
+       setb@,
+       setf@,
        use=xterm+256color,
 xterm-256color|xterm with 256 colors,
        use=xterm+256color2,
@@ -1951,16 +1968,16 @@ xterm+direct|xterm with direct-color ind
                %?
                        %p1%{8}%<
                        %t4%p1%d
-               %e48\:2\:\:
-                       %p1%{65536}%/%d\:%p1%{256}%/%{255}%&%d\:%p1%{255}%&%d
+               %e48:2::
+                       %p1%{65536}%/%d:%p1%{256}%/%{255}%&%d:%p1%{255}%&%d
                %;
                m,
        setaf=\E[
                %?
                        %p1%{8}%<
                        %t3%p1%d
-               %e38\:2\:\:
-                       %p1%{65536}%/%d\:%p1%{256}%/%{255}%&%d\:%p1%{255}%&%d
+               %e38:2::
+                       %p1%{65536}%/%d:%p1%{256}%/%{255}%&%d:%p1%{255}%&%d
                %;
                m,
        setb@,
Index: trace.c
===================================================================
RCS file: /cvs/xenocara/app/xterm/trace.c,v
retrieving revision 1.33
diff -u -p -u -r1.33 trace.c
--- trace.c     14 Feb 2021 09:14:06 -0000      1.33
+++ trace.c     27 Mar 2021 09:21:25 -0000
@@ -1,4 +1,4 @@
-/* $XTermId: trace.c,v 1.232 2021/02/02 00:20:30 tom Exp $ */
+/* $XTermId: trace.c,v 1.233 2021/03/09 01:14:50 tom Exp $ */
 
 /*
  * Copyright 1997-2020,2021 by Thomas E. Dickey
@@ -1233,6 +1233,9 @@ TraceXtermResources(void)
     XRES_S(menuLocale);
     XRES_S(omitTranslation);
     XRES_S(keyboardType);
+#ifdef HAVE_LIB_XCURSOR
+    XRES_S(cursorTheme);
+#endif
 #if OPT_PRINT_ON_EXIT
     XRES_I(printModeNow);
     XRES_I(printModeOnXError);
Index: util.c
===================================================================
RCS file: /cvs/xenocara/app/xterm/util.c,v
retrieving revision 1.38
diff -u -p -u -r1.38 util.c
--- util.c      14 Feb 2021 09:14:06 -0000      1.38
+++ util.c      27 Mar 2021 09:21:25 -0000
@@ -1,4 +1,4 @@
-/* $XTermId: util.c,v 1.872 2021/01/31 18:12:09 tom Exp $ */
+/* $XTermId: util.c,v 1.877 2021/03/21 21:27:08 tom Exp $ */
 
 /*
  * Copyright 1999-2020,2021 by Thomas E. Dickey
@@ -2102,9 +2102,9 @@ CopyWait(XtermWidget xw)
                                  &reply)) {
                retries = 0;
            } else {
-               if (++retries >= 10)
+               if (++retries >= 1000)
                    return;
-               usleep(10000U); /* wait 10msec */
+               usleep(100U);   /* wait 0.1msec */
                continue;
            }
        } else
@@ -2804,7 +2804,7 @@ ReverseVideo(XtermWidget xw)
     TRACE(("...swapping done, set ReverseVideo %s\n", 
BtoS(xw->misc.re_verse)));
 
     if (XtIsRealized((Widget) xw)) {
-       xtermDisplayCursor(xw);
+       xtermDisplayPointer(xw);
     }
 #if OPT_TEK4014
     if (TEK4014_SHOWN(xw)) {
@@ -4638,8 +4638,13 @@ xtermSizeHints(XtermWidget xw, int scrol
     xw->hints.base_width += BorderWidth(xw) * 2;
 #endif
 
-    xw->hints.width_inc = FontWidth(screen);
-    xw->hints.height_inc = FontHeight(screen);
+    if (xw->misc.resizeByPixel) {
+       xw->hints.width_inc = 1;
+       xw->hints.height_inc = 1;
+    } else {
+       xw->hints.width_inc = FontWidth(screen);
+       xw->hints.height_inc = FontHeight(screen);
+    }
     xw->hints.min_width = xw->hints.base_width + xw->hints.width_inc;
     xw->hints.min_height = xw->hints.base_height + xw->hints.height_inc;
 
@@ -5503,7 +5508,9 @@ XParseXineramaGeometry(Display *display,
        parsestring = buf;
        parse_xinerama_screen(display, at + 1, ret);
     }
-    return XParseGeometry(parsestring, &ret->x, &ret->y, &ret->w, &ret->h);
+    return ((strlen(parsestring) <= MAX_U_STRING)
+           ? XParseGeometry(parsestring, &ret->x, &ret->y, &ret->w, &ret->h)
+           : 0);
 }
 
 #if USE_DOUBLE_BUFFER
Index: version.h
===================================================================
RCS file: /cvs/xenocara/app/xterm/version.h,v
retrieving revision 1.52
diff -u -p -u -r1.52 version.h
--- version.h   14 Feb 2021 09:14:06 -0000      1.52
+++ version.h   27 Mar 2021 09:21:25 -0000
@@ -1,4 +1,4 @@
-/* $XTermId: version.h,v 1.510 2021/02/10 22:28:30 tom Exp $ */
+/* $XTermId: version.h,v 1.512 2021/03/26 22:59:42 tom Exp $ */
 
 /*
  * Copyright 1998-2020,2021 by Thomas E. Dickey
@@ -38,8 +38,8 @@
  * version of X to which this version of xterm has been built.  The resulting
  * number in parentheses is my patch number (Thomas E. Dickey).
  */
-#define XTERM_PATCH   366
-#define XTERM_DATE    2021-02-10
+#define XTERM_PATCH   367
+#define XTERM_DATE    2021-03-26
 
 #ifndef __vendorversion__
 #define __vendorversion__ "XTerm/OpenBSD"
Index: xterm.appdata.xml
===================================================================
RCS file: /cvs/xenocara/app/xterm/xterm.appdata.xml,v
retrieving revision 1.6
diff -u -p -u -r1.6 xterm.appdata.xml
--- xterm.appdata.xml   14 Feb 2021 09:14:06 -0000      1.6
+++ xterm.appdata.xml   27 Mar 2021 09:21:25 -0000
@@ -35,7 +35,7 @@
     <keyword>terminal</keyword>
   </keywords>
   <releases>
-    <release version="366" date="2021-02-10"/>
+    <release version="367" date="2021-03-26"/>
   </releases>
   <url type="homepage">https://invisible-island.net/xterm/</url>
   <update_contact>[email protected]</update_contact>
Index: xterm.h
===================================================================
RCS file: /cvs/xenocara/app/xterm/xterm.h,v
retrieving revision 1.46
diff -u -p -u -r1.46 xterm.h
--- xterm.h     10 Jan 2021 09:23:57 -0000      1.46
+++ xterm.h     27 Mar 2021 09:21:25 -0000
@@ -1,7 +1,7 @@
-/* $XTermId: xterm.h,v 1.884 2020/12/23 00:21:44 tom Exp $ */
+/* $XTermId: xterm.h,v 1.890 2021/03/21 22:44:36 tom Exp $ */
 
 /*
- * Copyright 1999-2019,2020 by Thomas E. Dickey
+ * Copyright 1999-2020,2021 by Thomas E. Dickey
  *
  *                         All Rights Reserved
  *
@@ -273,6 +273,12 @@ extern int errno;
 
 #include <X11/Xlocale.h>
 
+#ifdef HAVE_STDNORETURN_H
+#include <stdnoreturn.h>
+#undef GCC_NORETURN
+#define GCC_NORETURN STDC_NORETURN
+#endif
+
 /*
  * FIXME:  Toggling logging from xterm hangs under Linux 2.0.29 with libc5 if
  * we use 'waitpid()', while 'wait()' seems to work properly.
@@ -590,6 +596,7 @@ extern char **environ;
 #define XtNregisDefaultFont    "regisDefaultFont"
 #define XtNregisScreenSize     "regisScreenSize"
 #define XtNrenderFont          "renderFont"
+#define XtNresizeByPixel       "resizeByPixel"
 #define XtNresizeGravity       "resizeGravity"
 #define XtNretryInputMethod    "retryInputMethod"
 #define XtNreverseWrap         "reverseWrap"
@@ -789,6 +796,7 @@ extern char **environ;
 #define XtCRegisDefaultFont    "RegisDefaultFont"
 #define XtCRegisScreenSize     "RegisScreenSize"
 #define XtCRenderFont          "RenderFont"
+#define XtCResizeByPixel       "ResizeByPixel"
 #define XtCResizeGravity       "ResizeGravity"
 #define XtCRetryInputMethod    "RetryInputMethod"
 #define XtCReverseWrap         "ReverseWrap"
@@ -994,7 +1002,7 @@ extern void ShowCursor (XtermWidget /* x
 extern void SwitchBufPtrs (TScreen * /* screen */, int /* toBuf */);
 extern void ToggleAlternate (XtermWidget /* xw */);
 extern void VTInitTranslations (void);
-extern void VTReset (XtermWidget /* xw */, int /* full */, int /* saved */) 
GCC_NORETURN;
+extern GCC_NORETURN void VTReset (XtermWidget /* xw */, int /* full */, int /* 
saved */);
 extern void VTRun (XtermWidget /* xw */);
 extern void dotext (XtermWidget /* xw */, DECNRCM_codes /* charset */, IChar * 
/* buf */, Cardinal  /* len */);
 extern void getKeymapResources(Widget /* w */, const char * /*mapName */, 
const char * /* mapClass */, const char * /* type */, void * /* result */, 
size_t /* size */);
@@ -1122,7 +1130,7 @@ extern void first_map_occurred (void);
 #define first_map_occurred() /* nothing */
 #endif
 
-extern void Exit (int /* n */) GCC_NORETURN;
+extern GCC_NORETURN void Exit (int /* n */);
 
 #ifndef SIG_ATOMIC_T
 #define SIG_ATOMIC_T int
@@ -1180,7 +1188,7 @@ extern void ChangeGroup(XtermWidget /* x
 extern void ChangeIconName (XtermWidget /* xw */, char * /* name */);
 extern void ChangeTitle (XtermWidget /* xw */, char * /* name */);
 extern void ChangeXprop (char * /* name */);
-extern void Cleanup (int /* code */) GCC_NORETURN;
+extern GCC_NORETURN void Cleanup (int /* code */);
 extern void HandleBellPropertyChange   PROTO_XT_EV_HANDLER_ARGS;
 extern void HandleEightBitKeyPressed   PROTO_XT_ACTIONS_ARGS;
 extern void HandleEnterWindow          PROTO_XT_EV_HANDLER_ARGS;
@@ -1194,7 +1202,7 @@ extern void NormalExit (void);
 extern void Panic (const char * /* s */, int /* a */);
 extern void Redraw (void);
 extern void ReverseOldColors (XtermWidget /* xw */);
-extern void SysError (int /* i */) GCC_NORETURN;
+extern GCC_NORETURN void SysError (int /* i */);
 extern void VisualBell (void);
 extern void cleanup_colored_cursor (void);
 extern void do_ansi_rqm (XtermWidget /* xw */, int /* nparam */, int * /* 
params */);
@@ -1207,7 +1215,7 @@ extern void end_vt_mode (void);
 extern void free_string(String value);
 extern void hide_tek_window (void);
 extern void hide_vt_window (void);
-extern void ice_error (IceConn /* iceConn */) GCC_NORETURN;
+extern GCC_NORETURN void ice_error (IceConn /* iceConn */);
 extern void init_colored_cursor (Display * /* dpy */);
 extern void reset_decudk (XtermWidget /* xw */);
 extern void set_tek_visibility (Bool /* on */);
@@ -1215,16 +1223,17 @@ extern void set_vt_visibility (Bool /* o
 extern void switch_modes (Bool /* tovt */);
 extern void timestamp_filename(char * /* dst */, const char * /* src */);
 extern void xevents (XtermWidget /* xw */);
-extern void xt_error (String /* message */) GCC_NORETURN;
+extern GCC_NORETURN void xt_error (String /* message */);
 extern void xtermBell(XtermWidget /* xw */, int /* which */, int /* percent 
*/);
 extern void xtermCopyEnv (char ** /* oldenv */);
-extern void xtermDisplayCursor (XtermWidget /* xw */);
+extern void xtermDisplayPointer (XtermWidget /* xw */);
 extern void xtermDeiconify (XtermWidget /* xw */);
 extern void xtermEmbedWindow (Window /* winToEmbedInfo */);
 extern void xtermIconify (XtermWidget /* xw */);
 extern void xtermLoadIcon (XtermWidget /* xw */, const char * /* icon_hint */);
 extern void xtermPerror (const char * /*fmt*/,...) GCC_PRINTFLIKE(1,2);
 extern void xtermSetenv (const char * /* var */, const char * /* value */);
+extern void xtermSetupPointer (XtermWidget /* xw */, const char * /* theShape 
*/);
 extern void xtermSetWinSize (XtermWidget /* xw */);
 extern void xtermShowPointer (XtermWidget /* xw */, Bool /* enable */);
 extern void xtermUnsetenv (const char * /* var */);
Index: xterm.log.html
===================================================================
RCS file: /cvs/xenocara/app/xterm/xterm.log.html,v
retrieving revision 1.48
diff -u -p -u -r1.48 xterm.log.html
--- xterm.log.html      14 Feb 2021 09:14:06 -0000      1.48
+++ xterm.log.html      27 Mar 2021 09:21:26 -0000
@@ -30,7 +30,7 @@
  * sale, use or other dealings in this Software without prior written        *
  * authorization.                                                            *
  *****************************************************************************
-  $XTermId: xterm.log.html,v 1.2313 2021/02/10 22:27:30 tom Exp $
+  $XTermId: xterm.log.html,v 1.2326 2021/03/26 23:02:54 tom Exp $
   -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
 <html>
@@ -70,6 +70,8 @@
   CHANGELOG</a>).</p>
 
   <ul>
+    <li><a href="#xterm_367">Patch #367 - 2021/03/26</a></li>
+
     <li><a href="#xterm_366">Patch #366 - 2021/02/10</a></li>
 
     <li><a href="#xterm_365">Patch #365 - 2021/02/03</a></li>
@@ -1010,6 +1012,43 @@
     <li><a href="#xterm_01">Patch #1 - 1996/1/6</a></li>
   </ul>
 
+  <h1><a name="xterm_367" id="xterm_367">Patch #367 -
+  2021/03/26</a></h1>
+
+  <ul>
+    <li>add <code>OSC&nbsp;22</code> to allow programs to select
+    different pointer cursor at runtime.</li>
+
+    <li>change configuration for <em>no-return</em> functions to
+    use <code>_Noreturn</code> when it is available, because
+    <code>clang --analyze</code> does not properly handle the gcc
+    noreturn attribute.</li>
+
+    <li>add <code>cursorTheme</code> resource to provide a way to
+    enable or disable the cursor theme feature.</li>
+
+    <li>modified <code>CopyWait</code> event retries to use shorter
+    sleeps, to improve responsiveness (tmux #2556).</li>
+
+    <li>improve quoting/escaping in demo-scripts per
+    shellcheck.</li>
+
+    <li>add <code>resizeByPixel</code> resource, to permit
+    disabling window manager resizing-hints (patch by Tim
+    Oehl).</li>
+
+    <li>corrected <code>printOptsImmediate</code> handling of
+    alternate-screen (report by Abhijit Dasgupta).</li>
+
+    <li>update sample terminfo to more closely match ncurses.</li>
+
+    <li>add/improve limit-checks for Xlib calls (report by Roman
+    Fiedler).</li>
+
+    <li>fix a typo in the help-message (report by Tomas
+    Korbar).</li>
+  </ul>
+
   <h1><a name="xterm_366" id="xterm_366">Patch #366 -
   2021/02/10</a></h1>
 
@@ -1260,7 +1299,7 @@
     <li>mention <code>decGraphicsID</code> in
     <code>ctlseqs.ms</code> (suggested by Thomas Wolff).</li>
 
-    <li>modify pixel-coordinate mouse reponse to use as origin the
+    <li>modify pixel-coordinate mouse response to use as origin the
     VT100-window rather than the underlying widget, which includes
     the scrollbar (report by Thomas Wolff).</li>
 
Index: xterm.man
===================================================================
RCS file: /cvs/xenocara/app/xterm/xterm.man,v
retrieving revision 1.53
diff -u -p -u -r1.53 xterm.man
--- xterm.man   14 Feb 2021 09:14:07 -0000      1.53
+++ xterm.man   27 Mar 2021 09:21:27 -0000
@@ -1,5 +1,5 @@
 '\" t
-.\" $XTermId: xterm.man,v 1.839 2021/02/02 00:24:46 tom Exp $
+.\" $XTermId: xterm.man,v 1.844 2021/03/26 23:11:13 tom Exp $
 .\"
 .\" Copyright 1996-2020,2021 by Thomas E. Dickey
 .\"
@@ -1627,6 +1627,34 @@ The default is
 \*(``40\*(''
 and is limited to the range 1 through 100.
 .TP 8
+.B "cursorTheme\fP (class\fB CursorTheme\fP)"
+The Xcursor(__miscmansuffix__) library provides a way to 
+The X11 library uses this library to extend the font- and glyph-cursor
+calls used by applications such as \fI\*n\fP  to substitute external
+files for the built-in \*(``core\*('' cursors provided by X.
+.IP
+\fI\*N\fP uses the \fBpointerShape\fP resource to select the X cursor shape.
+Most of the available sets of cursor themes provide an incomplete set
+of \*(``core\*('' cursors (while possibly adding other cursors).
+Because of this limitation, \fI\*n\fP disables the feature by default.
+.IP
+The cursor theme feature can be useful because X cursors are not scalable
+and on a high-resolution display, the cursors are hard to find.
+Some of the cursor themes include
+larger cursors to work around this limitation:
+.RS
+.bP
+The default core cursors are 8x8 pixels;
+.bP
+Some cursor themes include cursors up to the X server limit of 64x64 pixels.
+.RE
+.IP
+At startup, \fI\*n\fP sets the \fBXCURSOR_THEME\fP environment variable
+to enable or disable the cursor theme feature.
+The default value is \*(``none\*(''.
+Other values (including \*(``default\*('') are passed to the Xcursor
+library to select a cursor theme.
+.TP 8
 .B "fullscreen\fP (class\fB Fullscreen\fP)"
 Specifies whether or not \fI\*n\fP should ask the window manager to
 use a fullscreen layout on startup.
@@ -4449,6 +4477,94 @@ always.
 .B "pointerShape\fP (class\fB Cursor\fP)"
 Specifies the name of the shape of the pointer.
 The default is \*(``xterm\*(''.
+.IP
+Other shapes can be selected.
+Here is a list of the \*(``core\*('' (i.e., \fIstandard\fP) names
+extracted from <X11/cursorfont.h>:
+.RS 5
+.IP
+X_cursor,
+arrow,
+based_arrow_down,
+based_arrow_up,
+boat,
+bogosity,
+bottom_left_corner,
+bottom_right_corner,
+bottom_side,
+bottom_tee,
+box_spiral,
+center_ptr,
+circle,
+clock,
+coffee_mug,
+cross,
+cross_reverse,
+crosshair,
+diamond_cross,
+dot,
+dotbox,
+double_arrow,
+draft_large,
+draft_small,
+draped_box,
+exchange,
+fleur,
+gobbler,
+gumby,
+hand1,
+hand2,
+heart,
+icon,
+iron_cross,
+left_ptr,
+left_side,
+left_tee,
+leftbutton,
+ll_angle,
+lr_angle,
+man,
+middlebutton,
+mouse,
+pencil,
+pirate,
+plus,
+question_arrow,
+right_ptr,
+right_side,
+right_tee,
+rightbutton,
+rtl_logo,
+sailboat,
+sb_down_arrow,
+sb_h_double_arrow,
+sb_left_arrow,
+sb_right_arrow,
+sb_up_arrow,
+sb_v_double_arrow,
+shuttle,
+sizing,
+spider,
+spraycan,
+star,
+target,
+tcross,
+top_left_arrow,
+top_left_corner,
+top_right_corner,
+top_side,
+top_tee,
+trek,
+ul_angle,
+umbrella,
+ur_angle,
+watch,
+xterm
+.RE
+.IP
+If you are using a \fIcursor theme\fP,
+expect it to provide about a third of those names,
+while adding others.
 .TP 8
 .B "popOnBell\fP (class\fB PopOnBell\fP)"
 Specifies whether the window would be raised when Control-G is received.
@@ -4697,6 +4813,20 @@ then start by using the TrueType font ra
 .RE
 .RE
 .TP 8
+.B "resizeByPixel\fP (class\fB ResizeByPixel\fP)"
+Set this \*(``true\*(''
+to disable hints to the window manager that request resizing
+by character rather than pixels.
+.IP
+Most window managers provide visual feedback showing the size of a
+window as you resize it, using these hints.
+When you maximize \fI\*n\fP, it disables those hints to allow
+the window manager to make better use of fractional rows or columns.
+Setting this resource disables the hints all the time.
+.IP
+The default is
+\*(``false\*(''.
+.TP 8
 .B "resizeGravity\fP (class\fB ResizeGravity\fP)"
 Affects the behavior when the window is resized to be taller or shorter.
 \fBNorthWest\fP
@@ -6872,70 +7002,70 @@ UTF-8 mode, only the first 256 entries o
 The default table starts as follows \-
 .NS
 static int charClass[256] = {
-/\(** NUL  SOH  STX  ETX  EOT  ENQ  ACK  BEL */
+/* NUL  SOH  STX  ETX  EOT  ENQ  ACK  BEL */
     32,   1,   1,   1,   1,   1,   1,   1,
-/\(**  BS   HT   NL   VT   NP   CR   SO   SI */
+/*  BS   HT   NL   VT   NP   CR   SO   SI */
      1,  32,   1,   1,   1,   1,   1,   1,
-/\(** DLE  DC1  DC2  DC3  DC4  NAK  SYN  ETB */
+/* DLE  DC1  DC2  DC3  DC4  NAK  SYN  ETB */
      1,   1,   1,   1,   1,   1,   1,   1,
-/\(** CAN   EM  SUB  ESC   FS   GS   RS   US */
+/* CAN   EM  SUB  ESC   FS   GS   RS   US */
      1,   1,   1,   1,   1,   1,   1,   1,
-/\(**  SP    !    "    #    $    %    &    \*(AQ */
+/*  SP    !    "    #    $    %    &    \*(AQ */
 .\"   " <- for emacs autocolor to work well :-)
     32,  33,  34,  35,  36,  37,  38,  39,
-/\(**   (    )    *    +    ,    \-    .    / */
+/*   (    )    *    +    ,    \-    .    / */
     40,  41,  42,  43,  44,  45,  46,  47,
-/\(**   0    1    2    3    4    5    6    7 */
+/*   0    1    2    3    4    5    6    7 */
     48,  48,  48,  48,  48,  48,  48,  48,
-/\(**   8    9    :    ;    <    =    >    ? */
+/*   8    9    :    ;    <    =    >    ? */
     48,  48,  58,  59,  60,  61,  62,  63,
-/\(**   @    A    B    C    D    E    F    G */
+/*   @    A    B    C    D    E    F    G */
     64,  48,  48,  48,  48,  48,  48,  48,
-/\(**   H    I    J    K    L    M    N    O */
+/*   H    I    J    K    L    M    N    O */
     48,  48,  48,  48,  48,  48,  48,  48,
-/\(**   P    Q    R    S    T    U    V    W */
+/*   P    Q    R    S    T    U    V    W */
     48,  48,  48,  48,  48,  48,  48,  48,
-/\(**   X    Y    Z    [    \\    ]    ^    _ */
+/*   X    Y    Z    [    \\    ]    ^    _ */
     48,  48,  48,  91,  92,  93,  94,  48,
-/\(**   `    a    b    c    d    e    f    g */
+/*   `    a    b    c    d    e    f    g */
     96,  48,  48,  48,  48,  48,  48,  48,
-/\(**   h    i    j    k    l    m    n    o */
+/*   h    i    j    k    l    m    n    o */
     48,  48,  48,  48,  48,  48,  48,  48,
-/\(**   p    q    r    s    t    u    v    w */
+/*   p    q    r    s    t    u    v    w */
     48,  48,  48,  48,  48,  48,  48,  48,
-/\(**   x    y    z    {    |    }    ~  DEL */
+/*   x    y    z    {    |    }    ~  DEL */
     48,  48,  48, 123, 124, 125, 126,   1,
-/\(** x80  x81  x82  x83  IND  NEL  SSA  ESA */
+/* x80  x81  x82  x83  IND  NEL  SSA  ESA */
      1,   1,   1,   1,   1,   1,   1,   1,
-/\(** HTS  HTJ  VTS  PLD  PLU   RI  SS2  SS3 */
+/* HTS  HTJ  VTS  PLD  PLU   RI  SS2  SS3 */
      1,   1,   1,   1,   1,   1,   1,   1,
-/\(** DCS  PU1  PU2  STS  CCH   MW  SPA  EPA */
+/* DCS  PU1  PU2  STS  CCH   MW  SPA  EPA */
      1,   1,   1,   1,   1,   1,   1,   1,
-/\(** x98  x99  x9A  CSI   ST  OSC   PM  APC */
+/* x98  x99  x9A  CSI   ST  OSC   PM  APC */
      1,   1,   1,   1,   1,   1,   1,   1,
-/\(**   \-    i   c/    L   ox   Y\-    |   So */
+/*   \-    i   c/    L   ox   Y\-    |   So */
    160, 161, 162, 163, 164, 165, 166, 167,
-/\(**  ..   c0   ip   <<    _        R0    \- */
+/*  ..   c0   ip   <<    _        R0    \- */
    168, 169, 170, 171, 172, 173, 174, 175,
-/\(**   o   +\-    2    3    \*(AQ    u   q|    . */
+/*   o   +\-    2    3    \*(AQ    u   q|    . */
    176, 177, 178, 179, 180, 181, 182, 183,
-/\(**   ,    1    2   >>  1/4  1/2  3/4    ? */
+/*   ,    1    2   >>  1/4  1/2  3/4    ? */
    184, 185, 186, 187, 188, 189, 190, 191,
-/\(**  A`   A\*(AQ   A^   A~   A:   Ao   AE   C, */
+/*  A`   A\*(AQ   A^   A~   A:   Ao   AE   C, */
     48,  48,  48,  48,  48,  48,  48,  48,
-/\(**  E`   E\*(AQ   E^   E:   I`   I\*(AQ   I^   I: */
+/*  E`   E\*(AQ   E^   E:   I`   I\*(AQ   I^   I: */
     48,  48,  48,  48,  48,  48,  48,  48,
-/\(**  D\-   N~   O`   O\*(AQ   O^   O~   O:    X */
+/*  D\-   N~   O`   O\*(AQ   O^   O~   O:    X */
     48,  48,  48,  48,  48,  48,  48, 215,
-/\(**  O/   U`   U\*(AQ   U^   U:   Y\*(AQ    P    B */
+/*  O/   U`   U\*(AQ   U^   U:   Y\*(AQ    P    B */
     48,  48,  48,  48,  48,  48,  48,  48,
-/\(**  a`   a\*(AQ   a^   a~   a:   ao   ae   c, */
+/*  a`   a\*(AQ   a^   a~   a:   ao   ae   c, */
     48,  48,  48,  48,  48,  48,  48,  48,
-/\(**  e`   e\*(AQ   e^   e:   i`   i\*(AQ   i^   i: */
+/*  e`   e\*(AQ   e^   e:   i`   i\*(AQ   i^   i: */
     48,  48,  48,  48,  48,  48,  48,  48,
-/\(**   d   n~   o`   o\*(AQ   o^   o~   o:   \-: */
+/*   d   n~   o`   o\*(AQ   o^   o~   o:   \-: */
     48,  48,  48,  48,  48,  48,  48, 247,
-/\(**  o/   u`   u\*(AQ   u^   u:   y\*(AQ    P   y: */
+/*  o/   u`   u\*(AQ   u^   u:   y\*(AQ    P   y: */
     48,  48,  48,  48,  48,  48,  48,  48};
 .NE
 .IP
@@ -7130,15 +7260,15 @@ the data as in the \fBon2Clicks\fP resou
 .B "fullscreen(\fIon/off/toggle\fP)"
 This action sets, unsets or toggles the \fBfullscreen\fP resource.
 .TP 8
-.B "iconify()"
-Iconifies the window.
-.TP 8
 .B "hard\-reset()"
 This action resets the scrolling region, tabs, window size, and cursor keys
 and clears the screen.
 It is also invoked from the \fBhardreset\fP
 entry in \fIvtMenu\fP.
 .TP 8
+.B "iconify()"
+Iconifies the window.
+.TP 8
 .B "ignore()"
 This action ignores the event but checks for special pointer position
 escape sequences.
@@ -7371,11 +7501,6 @@ mouse reporting is enabled.
 This action is similar to \fBscroll\-back\fP except that it scrolls
 in the other direction.
 .TP 8
-.B "secure()"
-This action toggles the \fISecure Keyboard\fP mode
-(see \fBSECURITY\fP), and is invoked from the \fBsecurekbd\fP
-entry in \fImainMenu\fP.
-.TP 8
 .B "scroll\-lock(\fIon/off/toggle\fP)"
 This action sets, unsets or toggles internal state which tells
 \fI\*n\fP whether Scroll Lock is active,
@@ -7394,6 +7519,11 @@ Scroll to the beginning of the saved lin
 Scroll to the end of the saved lines, i.e., to the currently active page.
 .RE
 .TP 8
+.B "secure()"
+This action toggles the \fISecure Keyboard\fP mode
+(see \fBSECURITY\fP), and is invoked from the \fBsecurekbd\fP
+entry in \fImainMenu\fP.
+.TP 8
 .B "select\-cursor\-end(\fIdestname\fP [, \&...\&])"
 This action is similar to \fBselect\-end\fP except that it should be used
 with \fBselect\-cursor\-start\fP.
@@ -7481,26 +7611,18 @@ It is also invoked from the \fBbackarrow
 This action sets, unsets or toggles the \fBbellIsUrgent\fP resource.
 It is also invoked by the \fBbellIsUrgent\fP entry in \fIvtMenu\fP.
 .TP 8
-.B "set\-cursorblink(\fIon/off/toggle\fP)"
-This action sets, unsets or toggles the \fBcursorBlink\fP resource.
-It is also invoked from the \fBcursorblink\fP entry in \fIvtMenu\fP.
-.TP 8
 .B "set\-cursesemul(\fIon/off/toggle\fP)"
 This action sets, unsets or toggles the \fBcurses\fP resource.
 It is also invoked from the \fBcursesemul\fP entry in \fIvtMenu\fP.
 .TP 8
+.B "set\-cursorblink(\fIon/off/toggle\fP)"
+This action sets, unsets or toggles the \fBcursorBlink\fP resource.
+It is also invoked from the \fBcursorblink\fP entry in \fIvtMenu\fP.
+.TP 8
 .B "set\-font\-doublesize(\fIon/off/toggle\fP)"
 This action sets, unsets or toggles the \fBfontDoublesize\fP resource.
 It is also invoked by the \fBfont\-doublesize\fP entry in \fIfontMenu\fP.
 .TP 8
-.B "set\-hp\-function\-keys(\fIon/off/toggle\fP)"
-This action sets, unsets or toggles the \fBhpFunctionKeys\fP resource.
-It is also invoked by the \fBhpFunctionKeys\fP entry in \fImainMenu\fP.
-.TP 8
-.B "set\-jumpscroll(\fIon/off/toggle\fP)"
-This action sets, unsets or toggles the \fBjumpscroll\fP resource.
-It is also invoked by the \fBjumpscroll\fP entry in \fIvtMenu\fP.
-.TP 8
 .B "set\-font\-linedrawing(\fIon/off/toggle\fP)"
 This action sets, unsets or toggles the \fI\*n\fR's state regarding whether
 the current font has line-drawing characters and whether it should draw them
@@ -7518,6 +7640,14 @@ This action sets, unsets or toggles the 
 which controls use of the font's minimum or maximum glyph width.
 It is also invoked by the \fBfont\-packed\fP entry in \fIfontMenu\fP.
 .TP 8
+.B "set\-hp\-function\-keys(\fIon/off/toggle\fP)"
+This action sets, unsets or toggles the \fBhpFunctionKeys\fP resource.
+It is also invoked by the \fBhpFunctionKeys\fP entry in \fImainMenu\fP.
+.TP 8
+.B "set\-jumpscroll(\fIon/off/toggle\fP)"
+This action sets, unsets or toggles the \fBjumpscroll\fP resource.
+It is also invoked by the \fBjumpscroll\fP entry in \fIvtMenu\fP.
+.TP 8
 .B "set\-keep\-clipboard(\fIon/off/toggle\fP)"
 This action sets, unsets or toggles the \fBkeepClipboard\fP resource.
 .TP 8
@@ -7528,16 +7658,16 @@ It is also invoked by the \fBkeepSelecti
 .B "set\-logging(\fIon/off/toggle\fP)"
 This action sets, unsets or toggles the state of the logging option.
 .TP 8
-.B "set\-old\-function\-keys(\fIon/off/toggle\fP)"
-This action sets, unsets or toggles the state of legacy function keys.
-It is also invoked by the \fBoldFunctionKeys\fP entry in \fImainMenu\fP.
-.TP 8
 .B "set\-marginbell(\fIon/off/toggle\fP)"
 This action sets, unsets or toggles the \fBmarginBell\fP resource.
 .TP 8
 .B "set\-num\-lock(\fIon/off/toggle\fP)"
 This action toggles the state of the \fBnumLock\fP resource.
 .TP 8
+.B "set\-old\-function\-keys(\fIon/off/toggle\fP)"
+This action sets, unsets or toggles the state of legacy function keys.
+It is also invoked by the \fBoldFunctionKeys\fP entry in \fImainMenu\fP.
+.TP 8
 .B "set\-pop\-on\-bell(\fIon/off/toggle\fP)"
 This action sets, unsets or toggles the \fBpopOnBell\fP resource.
 It is also invoked by the \fBpoponbell\fP entry in \fIvtMenu\fP.
@@ -7557,6 +7687,10 @@ It is also invoked by the \fBreversevide
 This action sets, unsets or toggles the \fBreverseWrap\fP resource.
 It is also invoked by the \fBreversewrap\fP entry in \fIvtMenu\fP.
 .TP 8
+.B "set\-sco\-function\-keys(\fIon/off/toggle\fP)"
+This action sets, unsets or toggles the \fBscoFunctionKeys\fP resource.
+It is also invoked by the \fBscoFunctionKeys\fP entry in \fImainMenu\fP.
+.TP 8
 .B "set\-scroll\-on\-key(\fIon/off/toggle\fP)"
 This action sets, unsets or toggles the \fBscrollKey\fP resource.
 It is also invoked from the \fBscrollkey\fP entry in \fIvtMenu\fP.
@@ -7569,10 +7703,6 @@ It is also invoked from the \fBscrolltty
 This action sets, unsets or toggles the \fBscrollbar\fP resource.
 It is also invoked by the \fBscrollbar\fP entry in \fIvtMenu\fP.
 .TP 8
-.B "set\-sco\-function\-keys(\fIon/off/toggle\fP)"
-This action sets, unsets or toggles the \fBscoFunctionKeys\fP resource.
-It is also invoked by the \fBscoFunctionKeys\fP entry in \fImainMenu\fP.
-.TP 8
 .B "set\-select(\fIon/off/toggle\fP)"
 This action sets, unsets or toggles the \fBselectToClipboard\fP resource.
 It is also invoked by the \fBselectToClipboard\fP entry in \fIvtMenu\fP.
@@ -7697,14 +7827,14 @@ Otherwise, use the \fB$PATH\fP variable 
 If parameters are given in the action,
 pass them to the new \fI\*n\fP process.
 .TP 8
-.B "start\-extend()"
-This action is similar to \fBselect\-start\fP except that the
-selection is extended to the current pointer location.
-.TP 8
 .B "start\-cursor\-extend()"
 This action is similar to \fBselect\-extend\fP except that the
 selection is extended to the current text cursor position.
 .TP 8
+.B "start\-extend()"
+This action is similar to \fBselect\-start\fP except that the
+selection is extended to the current pointer location.
+.TP 8
 .B "string(\fIstring\fP)"
 This action inserts the specified text string as if it had been typed.
 Quotation is necessary if the string contains whitespace or
@@ -8652,6 +8782,7 @@ resize(__mansuffix__),
 luit(__mansuffix__),
 u\*n(__mansuffix__),
 X(__miscmansuffix__),
+Xcursor(__miscmansuffix__),
 pty(4),
 tty(4)
 .ad
Index: xtermcfg.hin
===================================================================
RCS file: /cvs/xenocara/app/xterm/xtermcfg.hin,v
retrieving revision 1.25
diff -u -p -u -r1.25 xtermcfg.hin
--- xtermcfg.hin        10 Jan 2021 09:23:57 -0000      1.25
+++ xtermcfg.hin        27 Mar 2021 09:21:27 -0000
@@ -1,7 +1,7 @@
-/* $XTermId: xtermcfg.hin,v 1.220 2020/10/05 22:42:06 tom Exp $ */
+/* $XTermId: xtermcfg.hin,v 1.221 2021/03/21 19:51:33 tom Exp $ */
 
 /*
- * Copyright 1997-2019,2020 by Thomas E. Dickey
+ * Copyright 1997-2020,2021 by Thomas E. Dickey
  *
  *                         All Rights Reserved
  *
@@ -97,6 +97,7 @@
 #undef HAVE_SETPGID            /* AC_CHECK_FUNCS(setpgid) */
 #undef HAVE_STDINT_H           /* AC_PROG_CC_STDC */
 #undef HAVE_STDLIB_H           /* AC_CHECK_HEADERS(stdlib.h) */
+#undef HAVE_STDNORETURN_H      /* CF_C11_NORETURN */
 #undef HAVE_STRFTIME           /* AC_CHECK_FUNCS(strftime) */
 #undef HAVE_SYS_TIME_H         /* AC_HEADER_TIME */
 #undef HAVE_SYS_TTYDEFAULTS_H  /* AC_CHECK_HEADERS(sys/ttydefaults.h) */
@@ -198,6 +199,7 @@
 #undef PROCFS_ROOT             /* CF_ARG_ENABLE(exec-xterm) */
 #undef SCROLLBAR_RIGHT         /* CF_ARG_ENABLE(rightbar) */
 #undef SIG_ATOMIC_T            /* CF_SIG_ATOMIC_T */
+#undef STDC_NORETURN           /* CF_C11_NORETURN */
 #undef SVR4                    /* CF_SVR4, imake */
 #undef SYSV                    /* CF_SYSV, imake */
 #undef TIME_WITH_SYS_TIME      /* AC_HEADER_TIME */
Index: package/xterm.spec
===================================================================
RCS file: /cvs/xenocara/app/xterm/package/xterm.spec,v
retrieving revision 1.31
diff -u -p -u -r1.31 xterm.spec
--- package/xterm.spec  14 Feb 2021 09:14:07 -0000      1.31
+++ package/xterm.spec  27 Mar 2021 09:21:27 -0000
@@ -1,11 +1,11 @@
-# $XTermId: xterm.spec,v 1.141 2021/02/08 20:30:49 tom Exp $
+# $XTermId: xterm.spec,v 1.142 2021/02/22 21:18:59 tom Exp $
 Summary: X terminal emulator (development version)
 %global my_middle xterm
 %global my_suffix -dev
 %global fullname %{my_middle}%{my_suffix}
 %global my_class XTermDev
 Name: %{fullname}
-Version: 366
+Version: 367
 Release: 1
 License: X11
 Group: User Interface/X
Index: package/debian/changelog
===================================================================
RCS file: /cvs/xenocara/app/xterm/package/debian/changelog,v
retrieving revision 1.32
diff -u -p -u -r1.32 changelog
--- package/debian/changelog    14 Feb 2021 09:14:07 -0000      1.32
+++ package/debian/changelog    27 Mar 2021 09:21:27 -0000
@@ -1,3 +1,9 @@
+xterm-dev (367) unstable; urgency=low
+
+  * maintenance updates
+
+ -- Thomas E. Dickey <[email protected]>  Mon, 22 Feb 2021 16:18:59 
-0500
+
 xterm-dev (366) unstable; urgency=low
 
   * maintenance updates
Index: package/freebsd/Makefile
===================================================================
RCS file: /cvs/xenocara/app/xterm/package/freebsd/Makefile,v
retrieving revision 1.21
diff -u -p -u -r1.21 Makefile
--- package/freebsd/Makefile    10 Jan 2021 09:23:58 -0000      1.21
+++ package/freebsd/Makefile    27 Mar 2021 09:21:27 -0000
@@ -1,4 +1,4 @@
-# $XTermId: Makefile,v 1.84 2020/11/15 16:38:35 tom Exp $
+# $XTermId: Makefile,v 1.88 2021/02/22 21:18:59 tom Exp $
 # $FreeBSD: head/x11/xterm/Makefile 492827 2019-02-13 06:43:36Z ehaupt $
 
 # This is adapted from the FreeBSD port, installing as "xterm-dev" with
@@ -7,7 +7,7 @@
 # and "make makesum".
 
 PORTNAME=      xterm
-PORTVERSION=   363
+PORTVERSION=   367
 CATEGORIES=    x11
 MASTER_SITES=  ftp://ftp.invisible-island.net/xterm/:src1 \
                https://invisible-mirror.net/archives/xterm/:src1
Index: package/pkgsrc/Makefile
===================================================================
RCS file: /cvs/xenocara/app/xterm/package/pkgsrc/Makefile,v
retrieving revision 1.3
diff -u -p -u -r1.3 Makefile
--- package/pkgsrc/Makefile     10 Jan 2021 09:23:58 -0000      1.3
+++ package/pkgsrc/Makefile     27 Mar 2021 09:21:27 -0000
@@ -1,6 +1,6 @@
 # $NetBSD: Makefile,v 1.117 2018/03/12 11:18:00 wiz Exp $
 
-DISTNAME=      xterm-363
+DISTNAME=      xterm-367
 PKGREVISION=   1
 CATEGORIES=    x11
 MASTER_SITES=  ftp://ftp.invisible-island.net/xterm/
Index: vttests/16colors.sh
===================================================================
RCS file: /cvs/xenocara/app/xterm/vttests/16colors.sh,v
retrieving revision 1.2
diff -u -p -u -r1.2 16colors.sh
--- vttests/16colors.sh 14 Apr 2012 09:02:46 -0000      1.2
+++ vttests/16colors.sh 27 Mar 2021 09:21:27 -0000
@@ -1,12 +1,12 @@
 #!/bin/sh
-# $XTermId: 16colors.sh,v 1.14 2011/12/11 16:21:22 tom Exp $
+# $XTermId: 16colors.sh,v 1.19 2021/03/03 01:15:53 tom Exp $
 # -----------------------------------------------------------------------------
 # this file is part of xterm
 #
-# Copyright 1999-2003,2011 by Thomas E. Dickey
-# 
+# Copyright 1999-2011,2021 by Thomas E. Dickey
+#
 #                         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
@@ -14,10 +14,10 @@
 # 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.
@@ -25,7 +25,7 @@
 # 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
@@ -37,13 +37,14 @@
 # a '+' sign.
 
 ESC=""
+CSI="${ESC}["
 CMD='/bin/echo'
 OPT='-n'
 SUF=''
-TMP=/tmp/xterm$$
+TMP=`(mktemp) 2>/dev/null` || TMP=/tmp/xterm$$
 eval '$CMD $OPT >$TMP || echo fail >$TMP' 2>/dev/null
-( test ! -f $TMP || test -s $TMP ) &&
-for verb in printf print ; do
+{ test ! -f $TMP || test -s $TMP; } &&
+for verb in "printf" "print" ; do
     rm -f $TMP
     eval '$verb "\c" >$TMP || echo fail >$TMP' 2>/dev/null
     if test -f $TMP ; then
@@ -59,12 +60,12 @@ rm -f $TMP
 
 if ( trap "echo exit" EXIT 2>/dev/null ) >/dev/null
 then
-    trap '$CMD ""; exit' EXIT HUP INT TRAP TERM
+    trap '$CMD "${CSI}0m"; exit' EXIT HUP INT QUIT TERM
 else
-    trap '$CMD ""; exit' 0    1   2   5    15
+    trap '$CMD "${CSI}0m"; exit' 0    1   2   3    15
 fi
 
-echo ""
+echo "${CSI}0m"
 while true
 do
     for AT in 0 1 4 7
@@ -94,8 +95,8 @@ do
                else
                    color="+$fcolor"
                fi
-               $CMD $OPT "[0;${AT}m$attr$SUF"
-               $CMD $OPT "[${HI}${FG}m$color$SUF"
+               $CMD $OPT "${CSI}0;${AT}m$attr$SUF"
+               $CMD $OPT "${CSI}${HI}${FG}m$color$SUF"
                for BG in 1 2 3 4 5 6 7
                do
                    case $BG in
@@ -108,10 +109,10 @@ do
                    6) bcolor="CYN ";;
                    7) bcolor="WHT ";;
                    esac
-                   $CMD $OPT "[4${BG}m$bcolor$SUF"
-                   $CMD $OPT "[10${BG}m+$bcolor$SUF"
+                   $CMD $OPT "${CSI}4${BG}m$bcolor$SUF"
+                   $CMD $OPT "${CSI}10${BG}m+$bcolor$SUF"
                done
-               echo ""
+               echo "${CSI}0m"
            done
        done
        sleep 1
Index: vttests/8colors.sh
===================================================================
RCS file: /cvs/xenocara/app/xterm/vttests/8colors.sh,v
retrieving revision 1.2
diff -u -p -u -r1.2 8colors.sh
--- vttests/8colors.sh  14 Apr 2012 09:02:46 -0000      1.2
+++ vttests/8colors.sh  27 Mar 2021 09:21:27 -0000
@@ -1,12 +1,12 @@
 #!/bin/sh
-# $XTermId: 8colors.sh,v 1.14 2011/12/11 16:21:22 tom Exp $
+# $XTermId: 8colors.sh,v 1.19 2021/03/03 01:16:53 tom Exp $
 # -----------------------------------------------------------------------------
 # this file is part of xterm
 #
-# Copyright 1999-2003,2011 by Thomas E. Dickey
-# 
+# Copyright 1999-2011,2021 by Thomas E. Dickey
+#
 #                         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
@@ -14,10 +14,10 @@
 # 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.
@@ -25,7 +25,7 @@
 # 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
@@ -34,13 +34,14 @@
 # Show a simple 8-color test pattern
 
 ESC=""
+CSI="${ESC}["
 CMD='/bin/echo'
 OPT='-n'
 SUF=''
-TMP=/tmp/xterm$$
+TMP=`(mktemp) 2>/dev/null` || TMP=/tmp/xterm$$
 eval '$CMD $OPT >$TMP || echo fail >$TMP' 2>/dev/null
-( test ! -f $TMP || test -s $TMP ) &&
-for verb in printf print ; do
+{ test ! -f $TMP || test -s $TMP; } &&
+for verb in "printf" "print" ; do
     rm -f $TMP
     eval '$verb "\c" >$TMP || echo fail >$TMP' 2>/dev/null
     if test -f $TMP ; then
@@ -56,12 +57,12 @@ rm -f $TMP
 
 if ( trap "echo exit" EXIT 2>/dev/null ) >/dev/null
 then
-    trap '$CMD $OPT ""; exit' EXIT HUP INT TRAP TERM
+    trap '$CMD $OPT "${CSI}0m"; exit' EXIT HUP INT QUIT TERM
 else
-    trap '$CMD $OPT ""; exit' 0    1   2   5    15
+    trap '$CMD $OPT "${CSI}0m"; exit' 0    1   2   3    15
 fi
 
-echo ""
+echo "${CSI}0m"
 while true
 do
     for AT in 0 1 4 7
@@ -84,8 +85,8 @@ do
            6) fcolor="cyan    ";;
            7) fcolor="white   ";;
            esac
-           $CMD $OPT "[0;${AT}m$attr"
-           $CMD $OPT "[3${FG}m$fcolor"
+           $CMD $OPT "${CSI}0;${AT}m$attr${SUF}"
+           $CMD $OPT "${CSI}3${FG}m$fcolor${SUF}"
            for BG in 1 2 3 4 5 6 7
            do
                case $BG in
@@ -98,9 +99,9 @@ do
                6) bcolor="cyan    ";;
                7) bcolor="white   ";;
                esac
-               $CMD $OPT "[4${BG}m$bcolor"
+               $CMD $OPT "${CSI}4${BG}m$bcolor${SUF}"
            done
-           echo ""
+           echo "${CSI}0m"
        done
        sleep 1
     done
Index: vttests/acolors.sh
===================================================================
RCS file: /cvs/xenocara/app/xterm/vttests/acolors.sh,v
retrieving revision 1.2
diff -u -p -u -r1.2 acolors.sh
--- vttests/acolors.sh  14 Apr 2012 09:02:46 -0000      1.2
+++ vttests/acolors.sh  27 Mar 2021 09:21:27 -0000
@@ -1,12 +1,12 @@
 #!/bin/sh
-# $XTermId: acolors.sh,v 1.7 2011/12/11 16:21:22 tom Exp $
+# $XTermId: acolors.sh,v 1.12 2021/03/03 01:16:53 tom Exp $
 # -----------------------------------------------------------------------------
 # this file is part of xterm
 #
-# Copyright 2002-2003,2011 by Thomas E. Dickey
-# 
+# Copyright 2002-2011,2021 by Thomas E. Dickey
+#
 #                         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
@@ -14,10 +14,10 @@
 # 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.
@@ -25,7 +25,7 @@
 # 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
@@ -34,13 +34,14 @@
 # Demonstrate the use of the control sequence for changing ANSI colors.
 
 ESC=""
+CSI="${ESC}["
 CMD='/bin/echo'
 OPT='-n'
 SUF=''
-TMP=/tmp/xterm$$
+TMP=`(mktemp) 2>/dev/null` || TMP=/tmp/xterm$$
 eval '$CMD $OPT >$TMP || echo fail >$TMP' 2>/dev/null
-( test ! -f $TMP || test -s $TMP ) &&
-for verb in printf print ; do
+{ test ! -f $TMP || test -s $TMP; } &&
+for verb in "printf" "print" ; do
     rm -f $TMP
     eval '$verb "\c" >$TMP || echo fail >$TMP' 2>/dev/null
     if test -f $TMP ; then
@@ -67,14 +68,14 @@ original=${original}${SUF}
 
 if ( trap "echo exit" EXIT 2>/dev/null ) >/dev/null
 then
-    trap '$CMD $OPT "$original" >/dev/tty; exit' EXIT HUP INT TRAP TERM
+    trap '$CMD $OPT "$original" >/dev/tty; exit' EXIT HUP INT QUIT TERM
 else
-    trap '$CMD $OPT "$original" >/dev/tty; exit' 0    1   2   5    15
+    trap '$CMD $OPT "$original" >/dev/tty; exit' 0    1   2   3    15
 fi
 
-$CMD "${ESC}[0;1;34mThis message is BLUE"
-$CMD "${ESC}[0;1;31mThis message is RED ${ESC}[0;31m(sometimes)"
-$CMD "${ESC}[0;1;32mThis message is GREEN${ESC}[0m"
+echo "${CSI}0;1;34mThis message is BLUE"
+echo "${CSI}0;1;31mThis message is RED ${CSI}0;31m(sometimes)"
+echo "${CSI}0;1;32mThis message is GREEN${CSI}0m"
 while true
 do
     for R in $LIST
@@ -84,7 +85,7 @@ do
            for B in $LIST
            do
                # color "9" is bold-red
-               test $R != 00 && test $G = 00 && test $B = 00 && $CMD $OPT "" 
>/dev/tty
+               test "$R" != 00 && test "$G" = 00 && test "$B" = 00 && $CMD 
$OPT "" >/dev/tty
                $CMD $OPT "${ESC}]4;9;rgb:$R/$G/$B${SUF}" >/dev/tty
                sleep 1
            done
Index: vttests/doublechars.sh
===================================================================
RCS file: /cvs/xenocara/app/xterm/vttests/doublechars.sh,v
retrieving revision 1.2
diff -u -p -u -r1.2 doublechars.sh
--- vttests/doublechars.sh      14 Apr 2012 09:02:46 -0000      1.2
+++ vttests/doublechars.sh      27 Mar 2021 09:21:27 -0000
@@ -1,12 +1,12 @@
 #!/bin/sh
-# $XTermId: doublechars.sh,v 1.17 2011/12/11 16:21:22 tom Exp $
+# $XTermId: doublechars.sh,v 1.21 2021/03/03 01:16:53 tom Exp $
 # -----------------------------------------------------------------------------
 # this file is part of xterm
 #
-# Copyright 1999-2003,2011 by Thomas E. Dickey
-# 
+# Copyright 1999-2011,2021 by Thomas E. Dickey
+#
 #                         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
@@ -14,10 +14,10 @@
 # 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.
@@ -25,7 +25,7 @@
 # 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
@@ -38,13 +38,14 @@
 # the double-high lines will be split.
 
 ESC=""
+CSI="${ESC}["
 CMD='/bin/echo'
 OPT='-n'
 SUF=''
-TMP=/tmp/xterm$$
+TMP=`(mktemp) 2>/dev/null` || TMP=/tmp/xterm$$
 eval '$CMD $OPT >$TMP || echo fail >$TMP' 2>/dev/null
-( test ! -f $TMP || test -s $TMP ) &&
-for verb in printf print ; do
+{ test ! -f $TMP || test -s $TMP; } &&
+for verb in "printf" "print" ; do
     rm -f $TMP
     eval '$verb "\c" >$TMP || echo fail >$TMP' 2>/dev/null
     if test -f $TMP ; then
@@ -76,36 +77,36 @@ if test $SAVE = yes ; then
     old=`stty -g`
     stty raw -echo min 0  time 5
 
-    $CMD $OPT "${ESC}[18t${SUF}" > /dev/tty
+    $CMD $OPT "${CSI}18t${SUF}" > /dev/tty
     IFS=';' read junk high wide
 
     stty $old
 
-    wide=`echo $wide|sed -e 's/t.*//'`
-    original=${ESC}[8\;${high}\;${wide}t${SUF}
+    wide=`echo "$wide"|sed -e 's/t.*//'`
+    original=${CSI}8\;${high}\;${wide}t${SUF}
 
     if ( trap "echo exit" EXIT 2>/dev/null ) >/dev/null
     then
-       trap '$CMD $OPT "$original" >/dev/tty; exit' EXIT HUP INT TRAP TERM
+       trap '$CMD $OPT "$original" >/dev/tty; exit' EXIT HUP INT QUIT TERM
     else
-       trap '$CMD $OPT "$original" >/dev/tty; exit' 0    1   2   5    15
+       trap '$CMD $OPT "$original" >/dev/tty; exit' 0    1   2   3    15
     fi
 
 fi
 
 if test $WRAP = yes ; then
        # turn on wrapping and force the screen to 80 columns
-       $CMD $OPT "${ESC}[?7h" >/dev/tty
-       $CMD $OPT "${ESC}[?40l" >/dev/tty
+       $CMD $OPT "${CSI}?7h" >/dev/tty
+       $CMD $OPT "${CSI}?40l" >/dev/tty
 else
        # force the screen to 132 columns
-       $CMD $OPT "${ESC}[?40h" >/dev/tty
-       $CMD $OPT "${ESC}[?3h" >/dev/tty
+       $CMD $OPT "${CSI}?40h" >/dev/tty
+       $CMD $OPT "${CSI}?3h" >/dev/tty
 fi
 
 for SGR in 0 1 4 5 7
 do
-       $CMD $OPT "${ESC}[0;${SGR}m" >/dev/tty
+       $CMD $OPT "${CSI}0;${SGR}m" >/dev/tty
        for DBL in 5 3 4 6 5
        do
                $CMD $OPT "${ESC}#${DBL}" >/dev/tty
@@ -113,4 +114,4 @@ do
        done
        echo
 done
-$CMD $OPT "${ESC}[0m" >/dev/tty
+$CMD $OPT "${CSI}0m" >/dev/tty
Index: vttests/dynamic.sh
===================================================================
RCS file: /cvs/xenocara/app/xterm/vttests/dynamic.sh,v
retrieving revision 1.2
diff -u -p -u -r1.2 dynamic.sh
--- vttests/dynamic.sh  14 Apr 2012 09:02:46 -0000      1.2
+++ vttests/dynamic.sh  27 Mar 2021 09:21:27 -0000
@@ -1,12 +1,12 @@
 #!/bin/sh
-# $XTermId: dynamic.sh,v 1.17 2011/12/11 16:21:22 tom Exp $
+# $XTermId: dynamic.sh,v 1.21 2021/03/03 01:16:53 tom Exp $
 # -----------------------------------------------------------------------------
 # this file is part of xterm
 #
-# Copyright 1999-2003,2011 by Thomas E. Dickey
-# 
+# Copyright 1999-2011,2021 by Thomas E. Dickey
+#
 #                         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
@@ -14,10 +14,10 @@
 # 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.
@@ -25,7 +25,7 @@
 # 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
@@ -35,13 +35,14 @@
 # to different values.
 
 ESC=""
+OSC="${ESC}]"
 CMD='/bin/echo'
 OPT='-n'
 SUF=''
-TMP=/tmp/xterm$$
+TMP=`(mktemp) 2>/dev/null` || TMP=/tmp/xterm$$
 eval '$CMD $OPT >$TMP || echo fail >$TMP' 2>/dev/null
-( test ! -f $TMP || test -s $TMP ) &&
-for verb in printf print ; do
+{ test ! -f $TMP || test -s $TMP; } &&
+for verb in "printf" "print" ; do
     rm -f $TMP
     eval '$verb "\c" >$TMP || echo fail >$TMP' 2>/dev/null
     if test -f $TMP ; then
@@ -61,16 +62,16 @@ exec </dev/tty
 old=`stty -g`
 stty raw -echo min 0  time 5
 
-$CMD $OPT "${ESC}]11;?${SUF}" > /dev/tty
+$CMD $OPT "${OSC}11;?${SUF}" > /dev/tty
 read original
 stty $old
 original=${original}${SUF}
 
 if ( trap "echo exit" EXIT 2>/dev/null ) >/dev/null
 then
-    trap '$CMD $OPT "$original" >/dev/tty; exit' EXIT HUP INT TRAP TERM
+    trap '$CMD $OPT "$original" >/dev/tty; exit' EXIT HUP INT QUIT TERM
 else
-    trap '$CMD $OPT "$original" >/dev/tty; exit' 0    1   2   5    15
+    trap '$CMD $OPT "$original" >/dev/tty; exit' 0    1   2   3    15
 fi
 
 while true
@@ -81,7 +82,7 @@ do
        do
            for B in $LIST
            do
-               $CMD $OPT "${ESC}]11;rgb:$R/$G/$B${SUF}" >/dev/tty
+               $CMD $OPT "${OSC}11;rgb:$R/$G/$B${SUF}" >/dev/tty
                sleep 1
            done
        done
Index: vttests/dynamic2.sh
===================================================================
RCS file: /cvs/xenocara/app/xterm/vttests/dynamic2.sh,v
retrieving revision 1.2
diff -u -p -u -r1.2 dynamic2.sh
--- vttests/dynamic2.sh 14 Apr 2012 09:02:46 -0000      1.2
+++ vttests/dynamic2.sh 27 Mar 2021 09:21:27 -0000
@@ -1,12 +1,12 @@
 #!/bin/sh
-# $XTermId: dynamic2.sh,v 1.3 2011/12/11 16:21:22 tom Exp $
+# $XTermId: dynamic2.sh,v 1.7 2021/03/03 01:16:53 tom Exp $
 # -----------------------------------------------------------------------------
 # this file is part of xterm
 #
-# Copyright 2006,2011 by Thomas E. Dickey
-# 
+# Copyright 2006-2011,2021 by Thomas E. Dickey
+#
 #                         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
@@ -14,10 +14,10 @@
 # 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.
@@ -25,7 +25,7 @@
 # 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
@@ -35,13 +35,14 @@
 # successively to different values.
 
 ESC=""
+OSC="${ESC}]"
 CMD='/bin/echo'
 OPT='-n'
 SUF=''
-TMP=/tmp/xterm$$
+TMP=`(mktemp) 2>/dev/null` || TMP=/tmp/xterm$$
 eval '$CMD $OPT >$TMP || echo fail >$TMP' 2>/dev/null
-( test ! -f $TMP || test -s $TMP ) &&
-for verb in printf print ; do
+{ test ! -f $TMP || test -s $TMP; } &&
+for verb in "printf" "print" ; do
     rm -f $TMP
     eval '$verb "\c" >$TMP || echo fail >$TMP' 2>/dev/null
     if test -f $TMP ; then
@@ -67,18 +68,18 @@ stty raw -echo min 0  time 5
 original=
 for N in $FULL
 do
-    $CMD $OPT "${ESC}]$N;?${SUF}" > /dev/tty
+    $CMD $OPT "${OSC}$N;?${SUF}" > /dev/tty
     read reply
-    eval original$N='${reply}${SUF}'
+    eval original"$N"='${reply}${SUF}'
     original=${original}${reply}${SUF}
 done
 stty $old
 
 if ( trap "echo exit" EXIT 2>/dev/null ) >/dev/null
 then
-    trap '$CMD $OPT "$original" >/dev/tty; exit' EXIT HUP INT TRAP TERM
+    trap '$CMD $OPT "$original" >/dev/tty; exit' EXIT HUP INT QUIT TERM
 else
-    trap '$CMD $OPT "$original" >/dev/tty; exit' 0    1   2   5    15
+    trap '$CMD $OPT "$original" >/dev/tty; exit' 0    1   2   3    15
 fi
 
 while true
@@ -102,12 +103,12 @@ do
            do
                for B in $LIST
                do
-                   $CMD $OPT "${ESC}]$N;rgb:$R/$G/$B${SUF}" >/dev/tty
+                   $CMD $OPT "${OSC}$N;rgb:$R/$G/$B${SUF}" >/dev/tty
                    sleep 1
                done
            done
        done
-       eval 'restore=$'original$N
+       eval restore=\$original"$N"
        $CMD $OPT "$restore" >/dev/tty
        sleep 1
     done
Index: vttests/fonts.sh
===================================================================
RCS file: /cvs/xenocara/app/xterm/vttests/fonts.sh,v
retrieving revision 1.3
diff -u -p -u -r1.3 fonts.sh
--- vttests/fonts.sh    5 Sep 2015 14:11:46 -0000       1.3
+++ vttests/fonts.sh    27 Mar 2021 09:21:27 -0000
@@ -1,12 +1,12 @@
 #!/bin/sh
-# $XTermId: fonts.sh,v 1.12 2015/08/10 20:43:05 tom Exp $
+# $XTermId: fonts.sh,v 1.16 2021/03/03 01:16:53 tom Exp $
 # -----------------------------------------------------------------------------
 # this file is part of xterm
 #
-# Copyright 1999-2011,2015 by Thomas E. Dickey
-# 
+# Copyright 1999-2015,2021 by Thomas E. Dickey
+#
 #                         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
@@ -14,10 +14,10 @@
 # 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.
@@ -25,7 +25,7 @@
 # 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
@@ -34,13 +34,14 @@
 # Demonstrate control sequence which sets relative fonts.
 
 ESC=""
+CSI="${ESC}["
 CMD='/bin/echo'
 OPT='-n'
 SUF=''
-TMP=/tmp/xterm$$
+TMP=`(mktemp) 2>/dev/null` || TMP=/tmp/xterm$$
 eval '$CMD $OPT >$TMP || echo fail >$TMP' 2>/dev/null
-( test ! -f $TMP || test -s $TMP ) &&
-for verb in printf print ; do
+{ test ! -f $TMP || test -s $TMP; } &&
+for verb in "printf" "print" ; do
     rm -f $TMP
     eval '$verb "\c" >$TMP || echo fail >$TMP' 2>/dev/null
     if test -f $TMP ; then
@@ -66,9 +67,9 @@ original="${original}${SUF}"
 
 if ( trap "echo exit" EXIT 2>/dev/null ) >/dev/null
 then
-    trap '$CMD $OPT "$original" >/dev/tty; exit' EXIT HUP INT TRAP TERM
+    trap '$CMD $OPT "$original" >/dev/tty; exit' EXIT HUP INT QUIT TERM
 else
-    trap '$CMD $OPT "$original" >/dev/tty; exit' 0    1   2   5    15
+    trap '$CMD $OPT "$original" >/dev/tty; exit' 0    1   2   3    15
 fi
 
 F=1
@@ -77,7 +78,7 @@ T=6
 while true
 do
     $CMD $OPT "${ESC}]50;#$F${SUF}" >/dev/tty
-    #sleep 1
+    sleep 1
     if test .$D = .1 ; then
        test $F = $T && D=-1
     else
Index: vttests/other-sgr.sh
===================================================================
RCS file: /cvs/xenocara/app/xterm/vttests/other-sgr.sh,v
retrieving revision 1.1
diff -u -p -u -r1.1 other-sgr.sh
--- vttests/other-sgr.sh        24 Feb 2019 11:41:43 -0000      1.1
+++ vttests/other-sgr.sh        27 Mar 2021 09:21:27 -0000
@@ -1,9 +1,9 @@
 #!/bin/sh
-# $XTermId: other-sgr.sh,v 1.1 2018/09/12 22:45:06 tom Exp $
+# $XTermId: other-sgr.sh,v 1.6 2021/03/03 01:16:53 tom Exp $
 # -----------------------------------------------------------------------------
 # this file is part of xterm
 #
-# Copyright 2018 by Thomas E. Dickey
+# Copyright 2018,2021 by Thomas E. Dickey
 #
 #                         All Rights Reserved
 #
@@ -34,13 +34,14 @@
 # Show non-VTxx SGRs combined with the conventional VT100/VT220 SGRs
 
 ESC=""
+CSI="${ESC}["
 CMD='/bin/echo'
 OPT='-n'
 SUF=''
-TMP=/tmp/xterm$$
+TMP=`(mktemp) 2>/dev/null` || TMP=/tmp/xterm$$
 eval '$CMD $OPT >$TMP || echo fail >$TMP' 2>/dev/null
-( test ! -f $TMP || test -s $TMP ) &&
-for verb in printf print ; do
+{ test ! -f $TMP || test -s $TMP; } &&
+for verb in "printf" "print" ; do
     rm -f $TMP
     eval '$verb "\c" >$TMP || echo fail >$TMP' 2>/dev/null
     if test -f $TMP ; then
@@ -56,12 +57,12 @@ rm -f $TMP
 
 if ( trap "echo exit" EXIT 2>/dev/null ) >/dev/null
 then
-    trap '$CMD $OPT ""; exit' EXIT HUP INT TRAP TERM
+    trap '$CMD $OPT "${CSI}0m"; exit' EXIT HUP INT QUIT TERM
 else
-    trap '$CMD $OPT ""; exit' 0    1   2   5    15
+    trap '$CMD $OPT "${CSI}0m"; exit' 0    1   2   3    15
 fi
 
-echo ""
+echo "${CSI}0m"
 while true
 do
     # blink(5) and conceal(8) are omitted because they are distracting, but the
@@ -95,28 +96,28 @@ do
                # video attributes from the first two columns intentionally
                # "bleed through" to the other columns to help show some of
                # the possible combinations of attributes.
-               $CMD $OPT "$GRP:[${GRP}m$attr"
-               $CMD $OPT "[${ROW}m$rlabel"
+               $CMD $OPT "$GRP:${CSI}${GRP}m$attr${SUF}"
+               $CMD $OPT "${CSI}${ROW}m$rlabel${SUF}"
                for COL in $NUL "3" "9" "2;3" "2;9" "3;9" "2;3;9"
                do
                    END=""
                    case $COL in
                    "0")     clabel="normal  ";;
-                   "21")    clabel="double  "; END="";;
-                   "2")     clabel="dim     "; END="";;
-                   "3")     clabel="italic  "; END="";;
-                   "2;3")   clabel="di/it   "; END="";;
-                   "9")     clabel="crossout"; END="";;
-                   "2;9")   clabel="di/cr   "; END="";;
-                   "3;9")   clabel="it/cr   "; END="";;
-                   "2;3;9") clabel="di/it/cr"; END="";;
+                   "21")    clabel="double  "; END="${CSI}24m";;
+                   "2")     clabel="dim     "; END="${CSI}22m";;
+                   "3")     clabel="italic  "; END="${CSI}23m";;
+                   "2;3")   clabel="di/it   "; END="${CSI}22;23m";;
+                   "9")     clabel="crossout"; END="${CSI}29m";;
+                   "2;9")   clabel="di/cr   "; END="${CSI}22;29m";;
+                   "3;9")   clabel="it/cr   "; END="${CSI}23;29m";;
+                   "2;3;9") clabel="di/it/cr"; END="${CSI}23;29m";;
                    *)       clabel="UNKNOWN ";;
                    esac
                    # The remaining columns (try to) reset their respective
                    # attribute, to make the result somewhat readable.
-                   $CMD $OPT "[${COL}m$clabel${END}"
+                   $CMD $OPT "${CSI}${COL}m$clabel${END}${SUF}"
                done
-               echo ":$GRP"
+               echo "${CSI}0m:$GRP"
            done
        done
        [ -t 1 ] && sleep 3
Index: vttests/resize.sh
===================================================================
RCS file: /cvs/xenocara/app/xterm/vttests/resize.sh,v
retrieving revision 1.2
diff -u -p -u -r1.2 resize.sh
--- vttests/resize.sh   14 Apr 2012 09:02:46 -0000      1.2
+++ vttests/resize.sh   27 Mar 2021 09:21:27 -0000
@@ -1,12 +1,12 @@
 #!/bin/sh
-# $XTermId: resize.sh,v 1.17 2011/12/11 16:21:22 tom Exp $
+# $XTermId: resize.sh,v 1.21 2021/03/03 01:16:53 tom Exp $
 # -----------------------------------------------------------------------------
 # this file is part of xterm
 #
-# Copyright 1999-2003,2011 by Thomas E. Dickey
-# 
+# Copyright 1999-2011,2021 by Thomas E. Dickey
+#
 #                         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
@@ -14,10 +14,10 @@
 # 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.
@@ -25,7 +25,7 @@
 # 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
@@ -35,13 +35,14 @@
 # screen width/height, and restore the size.
 
 ESC=""
+CSI="${ESC}["
 CMD='/bin/echo'
 OPT='-n'
 SUF=''
-TMP=/tmp/xterm$$
+TMP=`(mktemp) 2>/dev/null` || TMP=/tmp/xterm$$
 eval '$CMD $OPT >$TMP || echo fail >$TMP' 2>/dev/null
-( test ! -f $TMP || test -s $TMP ) &&
-for verb in printf print ; do
+{ test ! -f $TMP || test -s $TMP; } &&
+for verb in "printf" "print" ; do
     rm -f $TMP
     eval '$verb "\c" >$TMP || echo fail >$TMP' 2>/dev/null
     if test -f $TMP ; then
@@ -59,26 +60,26 @@ exec </dev/tty
 old=`stty -g`
 stty raw -echo min 0  time 5
 
-$CMD $OPT "${ESC}[18t${SUF}" > /dev/tty
+$CMD $OPT "${CSI}18t${SUF}" > /dev/tty
 IFS=';' read junk high wide
 
-$CMD $OPT "${ESC}[19t${SUF}" > /dev/tty
+$CMD $OPT "${CSI}19t${SUF}" > /dev/tty
 IFS=';' read junk maxhigh maxwide
 
 stty $old
 
-wide=`echo $wide|sed -e 's/t.*//'`
-maxwide=`echo $maxwide|sed -e 's/t.*//'`
-original=${ESC}[8\;${high}\;${wide}t${SUF}
+wide=`echo "$wide"|sed -e 's/t.*//'`
+maxwide=`echo "$maxwide"|sed -e 's/t.*//'`
+original=${CSI}8\;${high}\;${wide}t${SUF}
 
-test $maxwide = 0 && maxwide=`expr $wide \* 2`
-test $maxhigh = 0 && maxhigh=`expr $high \* 2`
+test "$maxwide" = 0 && maxwide=`expr "$wide" \* 2`
+test "$maxhigh" = 0 && maxhigh=`expr "$high" \* 2`
 
 if ( trap "echo exit" EXIT 2>/dev/null ) >/dev/null
 then
-    trap '$CMD $OPT "$original" >/dev/tty; exit' EXIT HUP INT TRAP TERM
+    trap '$CMD $OPT "$original" >/dev/tty; exit' EXIT HUP INT QUIT TERM
 else
-    trap '$CMD $OPT "$original" >/dev/tty; exit' 0    1   2   5    15
+    trap '$CMD $OPT "$original" >/dev/tty; exit' 0    1   2   3    15
 fi
 
 w=$wide
@@ -87,25 +88,25 @@ a=1
 while true
 do
 #      sleep 1
-       echo resizing to $h by $w
-       $CMD $OPT "${ESC}[8;${h};${w}t" >/dev/tty
+       echo "resizing to $h by $w"
+       $CMD $OPT "${CSI}8;${h};${w}t" >/dev/tty
        if test $a = 1 ; then
-               if test $w = $maxwide ; then
-                       h=`expr $h + $a`
-                       if test $h = $maxhigh ; then
+               if test "$w" = "$maxwide" ; then
+                       h=`expr "$h" + "$a"`
+                       if test "$h" = "$maxhigh" ; then
                                a=-1
                        fi
                else
-                       w=`expr $w + $a`
+                       w=`expr "$w" + "$a"`
                fi
        else
-               if test $w = $wide ; then
-                       h=`expr $h + $a`
-                       if test $h = $high ; then
+               if test "$w" = "$wide" ; then
+                       h=`expr "$h" + "$a"`
+                       if test "$h" = "$high" ; then
                                a=1
                        fi
                else
-                       w=`expr $w + $a`
+                       w=`expr "$w" + "$a"`
                fi
        fi
 done
Index: vttests/title.sh
===================================================================
RCS file: /cvs/xenocara/app/xterm/vttests/title.sh,v
retrieving revision 1.2
diff -u -p -u -r1.2 title.sh
--- vttests/title.sh    14 Apr 2012 09:02:46 -0000      1.2
+++ vttests/title.sh    27 Mar 2021 09:21:27 -0000
@@ -1,12 +1,12 @@
 #!/bin/sh
-# $XTermId: title.sh,v 1.18 2011/12/11 16:21:22 tom Exp $
+# $XTermId: title.sh,v 1.22 2021/03/03 01:16:53 tom Exp $
 # -----------------------------------------------------------------------------
 # this file is part of xterm
 #
-# Copyright 1999-2003,2011 by Thomas E. Dickey
-# 
+# Copyright 1999-2021,2021 by Thomas E. Dickey
+#
 #                         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
@@ -14,10 +14,10 @@
 # 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.
@@ -25,7 +25,7 @@
 # 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
@@ -35,13 +35,14 @@
 # until this script is interrupted, then restore the title.
 
 ESC=""
+CSI="${ESC}["
 CMD='/bin/echo'
 OPT='-n'
 SUF=''
-TMP=/tmp/xterm$$
+TMP=`(mktemp) 2>/dev/null` || TMP=/tmp/xterm$$
 eval '$CMD $OPT >$TMP || echo fail >$TMP' 2>/dev/null
-( test ! -f $TMP || test -s $TMP ) &&
-for verb in printf print ; do
+{ test ! -f $TMP || test -s $TMP; } &&
+for verb in "printf" "print" ; do
     rm -f $TMP
     eval '$verb "\c" >$TMP || echo fail >$TMP' 2>/dev/null
     if test -f $TMP ; then
@@ -59,7 +60,7 @@ exec </dev/tty
 old=`stty -g`
 stty raw -echo min 0  time 5
 
-$CMD $OPT "${ESC}[21t${SUF}" > /dev/tty
+$CMD $OPT "${CSI}21t${SUF}" > /dev/tty
 read original
 
 stty $old
@@ -72,9 +73,9 @@ original=${ESC}]2\;"${original}"${SUF}
 
 if ( trap "echo exit" EXIT 2>/dev/null ) >/dev/null
 then
-    trap '$CMD $OPT "$original" >/dev/tty; exit' EXIT HUP INT TRAP TERM
+    trap '$CMD $OPT "$original" >/dev/tty; exit' EXIT HUP INT QUIT TERM
 else
-    trap '$CMD $OPT "$original" >/dev/tty; exit' 0    1   2   5    15
+    trap '$CMD $OPT "$original" >/dev/tty; exit' 0    1   2   3    15
 fi
 
 while true

-- 
Matthieu Herrb

Reply via email to