From 47c323416bb23200896a311ceadbea794b0eb3a6 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sun, 1 May 2022 00:03:53 +0000 Subject: [PATCH] ncurses 6.3 - patch 20220430 + modify samples for xterm mouse 1002/1003 modes to use 1006 mode, and also provide for focus in/out responses -TD + modify default case in handle_wheel() to always report button-release events, e.g., for xterm mouse mode 1003 (patch by Leonid S Usov). + improve valid_entryname() to disallow characters used in terminfo syntax: '#', '=', '|', '\'. + alter copy_termtype() to allocate new str_table and ext_str_table data rather than relying upon its callers. + use calloc in _nc_init_entry() when allocating stringbuf, to ensure it is initialized. + add library-level TYPE_CALLOC for consistency with TYPE_MALLOC. + add some debug-traces for tic/infocmp. --- NEWS | 16 ++++++- VERSION | 2 +- dist.mk | 4 +- misc/terminfo.src | 33 +++++++++++---- ncurses/base/lib_color.c | 10 ++--- ncurses/base/lib_mouse.c | 13 +++++- ncurses/curses.priv.h | 13 +++++- ncurses/tinfo/alloc_entry.c | 17 ++++++-- ncurses/tinfo/alloc_ttype.c | 71 ++++++++++++++++++++++++++------ ncurses/tinfo/comp_parse.c | 25 +++++++---- ncurses/tinfo/comp_scan.c | 16 +++++-- ncurses/tinfo/parse_entry.c | 51 +++++++++++++++++++---- ncurses/tinfo/read_entry.c | 25 +++++------ package/debian-mingw/changelog | 4 +- package/debian-mingw64/changelog | 4 +- package/debian/changelog | 4 +- package/mingw-ncurses.nsi | 4 +- package/mingw-ncurses.spec | 2 +- package/ncurses.spec | 2 +- package/ncursest.spec | 2 +- 20 files changed, 237 insertions(+), 81 deletions(-) diff --git a/NEWS b/NEWS index 0c1a85a3..f9eb4d02 100644 --- a/NEWS +++ b/NEWS @@ -26,7 +26,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: NEWS,v 1.3798 2022/04/23 23:26:44 tom Exp $ +-- $Id: NEWS,v 1.3801 2022/04/30 23:27:43 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -46,6 +46,20 @@ See the AUTHORS file for the corresponding full names. Changes through 1.9.9e did not credit all contributions; it is not possible to add this information. +20220430 + + modify samples for xterm mouse 1002/1003 modes to use 1006 mode, and + also provide for focus in/out responses -TD + + modify default case in handle_wheel() to always report button-release + events, e.g., for xterm mouse mode 1003 (patch by Leonid S Usov). + + improve valid_entryname() to disallow characters used in terminfo + syntax: '#', '=', '|', '\'. + + alter copy_termtype() to allocate new str_table and ext_str_table + data rather than relying upon its callers. + + use calloc in _nc_init_entry() when allocating stringbuf, to ensure + it is initialized. + + add library-level TYPE_CALLOC for consistency with TYPE_MALLOC. + + add some debug-traces for tic/infocmp. + 20220423 + in-progress work on invalid_merge(), disable it (cf: 20220402). + fix memory leak in _nc_tic_dir() when called from _nc_set_writedir(). diff --git a/VERSION b/VERSION index d25d1348..a099cae9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5:0:10 6.3 20220423 +5:0:10 6.3 20220430 diff --git a/dist.mk b/dist.mk index 28d52954..2c7e1874 100644 --- a/dist.mk +++ b/dist.mk @@ -26,7 +26,7 @@ # use or other dealings in this Software without prior written # # authorization. # ############################################################################## -# $Id: dist.mk,v 1.1476 2022/04/23 12:44:18 tom Exp $ +# $Id: dist.mk,v 1.1477 2022/04/30 12:58:59 tom Exp $ # Makefile for creating ncurses distributions. # # This only needs to be used directly as a makefile by developers, but @@ -38,7 +38,7 @@ SHELL = /bin/sh # These define the major/minor/patch versions of ncurses. NCURSES_MAJOR = 6 NCURSES_MINOR = 3 -NCURSES_PATCH = 20220423 +NCURSES_PATCH = 20220430 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/misc/terminfo.src b/misc/terminfo.src index 13b4e99d..c7fbc11f 100644 --- a/misc/terminfo.src +++ b/misc/terminfo.src @@ -6,8 +6,8 @@ # Report bugs and new terminal descriptions to # bug-ncurses@gnu.org # -# $Revision: 1.1001 $ -# $Date: 2022/03/27 19:32:34 $ +# $Revision: 1.1002 $ +# $Date: 2022/04/30 23:24:59 $ # # The original header is preserved below for reference. It is noted that there # is a "newer" version which differs in some cosmetic details (but actually @@ -5724,17 +5724,28 @@ xterm-x11hilite|X11 mouse with highlight, # xterm patch #83 (1998/10/7), added Jason Bacon's changes to provide an # "any-event" mouse mode. -xterm+sm+1002|xterm any-event mouse (building-block), - kmous=\E[M, XM=\E[?1002%?%p1%{1}%=%th%el%;, -xterm-1002|xterm any-event mouse, - use=xterm+sm+1002, use=xterm, +# +# These building blocks incorporate later features as well: +# xterm patch #224 (2007/2/11 added private mode 1004, for enabling/disabling +# focus in/out event reporting. +# xterm patch #277 (2012/01/07 added private mode 1006 -xterm+sm+1003|xterm any-button mouse (building-block), - kmous=\E[M, XM=\E[?1003%?%p1%{1}%=%th%el%;, +xterm+sm+1002|xterm any-button mouse, + kmous=\E[<, XM=\E[?1006;1004;1002%?%p1%{1}%=%th%el%;, + xm=\E[<%i%p3%d;%p1%d;%p2%d;%?%p4%tM%em%;, + use=xterm+focus, +xterm-1002|example of xterm any-button mouse, + use=xterm+sm+1002, use=xterm, -xterm-1003|xterm any-button mouse, +xterm+sm+1003|xterm any-event mouse, + XM=\E[?1006;1004;1003%?%p1%{1}%=%th%el%;, + use=xterm+sm+1002, +xterm-1003|example of xterm any-event mouse, use=xterm+sm+1003, use=xterm, +xterm+focus|xterm focus-in/out event "keys", + kxIN=\E[I, kxOUT=\E[O, + # xterm patch #116 (1999/9/25) added Stephen P Wall's changes to support DEC # locator mode. @@ -27501,4 +27512,8 @@ v3220|LANPAR Vision II model 3220/3221/3222, # 2022-03-27 # + make description-fields distinct -TD # +# 2022-04-30 +# + modify samples for xterm mouse 1002/1003 modes to use 1006 mode, and +# also provide for focus in/out responses -TD +# ######## SHANTIH! SHANTIH! SHANTIH! diff --git a/ncurses/base/lib_color.c b/ncurses/base/lib_color.c index e4dc79b5..b61d44a6 100644 --- a/ncurses/base/lib_color.c +++ b/ncurses/base/lib_color.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 2018-2021,2022 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -49,7 +49,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_color.c,v 1.148 2021/10/02 22:55:48 tom Exp $") +MODULE_ID("$Id: lib_color.c,v 1.149 2022/04/30 18:36:54 tom Exp $") #ifdef USE_TERM_DRIVER #define CanChange InfoOf(SP_PARM).canchange @@ -94,8 +94,6 @@ NCURSES_EXPORT_VAR(int) COLORS = 0; #define DATA(r,g,b) {r,g,b, 0,0,0, 0} -#define TYPE_CALLOC(type,elts) typeCalloc(type, (unsigned)(elts)) - #define MAX_PALETTE 8 #define OkColorHi(n) (((n) < COLORS) && ((n) < maxcolors)) @@ -412,7 +410,7 @@ NCURSES_SP_NAME(start_color) (NCURSES_SP_DCL0) if (init_direct_colors(NCURSES_SP_ARG)) { result = OK; } else { - SP_PARM->_color_table = TYPE_CALLOC(color_t, maxcolors); + TYPE_CALLOC(color_t, maxcolors, SP_PARM->_color_table); if (SP_PARM->_color_table != 0) { MakeColorPair(SP_PARM->_color_pairs[0], default_fg(NCURSES_SP_ARG), @@ -529,7 +527,7 @@ _nc_reserve_pairs(SCREEN *sp, int want) have = sp->_pair_limit; if (sp->_color_pairs == 0) { - sp->_color_pairs = TYPE_CALLOC(colorpair_t, have); + TYPE_CALLOC(colorpair_t, have, sp->_color_pairs); } else if (have > sp->_pair_alloc) { #if NCURSES_EXT_COLORS colorpair_t *next; diff --git a/ncurses/base/lib_mouse.c b/ncurses/base/lib_mouse.c index b2330c02..c70cb5a3 100644 --- a/ncurses/base/lib_mouse.c +++ b/ncurses/base/lib_mouse.c @@ -85,7 +85,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_mouse.c,v 1.194 2022/01/16 01:15:47 tom Exp $") +MODULE_ID("$Id: lib_mouse.c,v 1.196 2022/04/30 23:21:34 tom Exp $") #include @@ -969,6 +969,17 @@ handle_wheel(SCREEN *sp, MEVENT * eventp, int button, int wheel) PRESS_POSITION(3); break; default: + /* + * case 3 is sent when the mouse buttons are released. + * + * If the terminal uses xterm mode 1003, a continuous series of + * button-release events is sent as the mouse moves around the screen, + * or as the wheel mouse is rotated. + * + * Return false in this case, so that when running in X10 mode, we will + * recalculate bstate. + */ + eventp->bstate = REPORT_MOUSE_POSITION; result = FALSE; break; } diff --git a/ncurses/curses.priv.h b/ncurses/curses.priv.h index a72555c1..72847bc9 100644 --- a/ncurses/curses.priv.h +++ b/ncurses/curses.priv.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 2018-2021,2022 Thomas E. Dickey * * Copyright 1998-2017,2018 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -35,7 +35,7 @@ ****************************************************************************/ /* - * $Id: curses.priv.h,v 1.647 2021/10/23 16:13:16 tom Exp $ + * $Id: curses.priv.h,v 1.649 2022/04/30 18:32:29 tom Exp $ * * curses.priv.h * @@ -1506,6 +1506,13 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch; _nc_err_abort(MSG_NO_MEMORY); \ } while (0) +#define TYPE_CALLOC(type, size, name) \ + do { \ + name = typeCalloc(type, size); \ + if (name == 0) \ + _nc_err_abort(MSG_NO_MEMORY); \ + } while (0) + #define TYPE_REALLOC(type, size, name) \ do { \ name = typeRealloc(type, size, name); \ @@ -1619,6 +1626,8 @@ typedef void VoidFunc(void); #define returnWin(code) TRACE_RETURN1(code,win) #define returnDB(rc) do { TR(TRACE_DATABASE,(T_RETURN("code %d"), (rc))); return (rc); } while (0) +#define returnPtrDB(rc) do { TR(TRACE_DATABASE,(T_RETURN("%p"), (rc))); return (rc); } while (0) +#define returnVoidDB do { TR(TRACE_DATABASE,(T_RETURN(""))); return; } while (0) extern NCURSES_EXPORT(NCURSES_BOOL) _nc_retrace_bool (int); extern NCURSES_EXPORT(NCURSES_CONST void *) _nc_retrace_cvoid_ptr (NCURSES_CONST void *); diff --git a/ncurses/tinfo/alloc_entry.c b/ncurses/tinfo/alloc_entry.c index aed73943..48df0fd6 100644 --- a/ncurses/tinfo/alloc_entry.c +++ b/ncurses/tinfo/alloc_entry.c @@ -48,7 +48,7 @@ #include -MODULE_ID("$Id: alloc_entry.c,v 1.69 2022/04/16 22:46:53 tom Exp $") +MODULE_ID("$Id: alloc_entry.c,v 1.71 2022/04/30 18:36:01 tom Exp $") #define ABSENT_OFFSET -1 #define CANCELLED_OFFSET -2 @@ -60,6 +60,8 @@ NCURSES_EXPORT(void) _nc_init_entry(ENTRY * const tp) /* initialize a terminal type data block */ { + DEBUG(2, (T_CALLED("_nc_init_entry(tp=%p)"), tp)); + if (tp == NULL) { #if NO_LEAKS if (stringbuf != NULL) { @@ -72,23 +74,30 @@ _nc_init_entry(ENTRY * const tp) } if (stringbuf == NULL) - TYPE_MALLOC(char, (size_t) MAX_ENTRY_SIZE, stringbuf); + TYPE_CALLOC(char, (size_t) MAX_ENTRY_SIZE, stringbuf); next_free = 0; _nc_init_termtype(&(tp->tterm)); + + DEBUG(2, (T_RETURN(""))); } NCURSES_EXPORT(ENTRY *) _nc_copy_entry(ENTRY * oldp) { - ENTRY *newp = typeCalloc(ENTRY, 1); + ENTRY *newp; + DEBUG(2, (T_CALLED("_nc_copy_entry(oldp=%p)"), oldp)); + + newp = typeCalloc(ENTRY, 1); if (newp != NULL) { *newp = *oldp; _nc_copy_termtype2(&(newp->tterm), &(oldp->tterm)); } - return newp; + + DEBUG(2, (T_RETURN("%p"), newp)); + return (newp); } /* save a copy of string in the string buffer */ diff --git a/ncurses/tinfo/alloc_ttype.c b/ncurses/tinfo/alloc_ttype.c index cb824112..eef8170c 100644 --- a/ncurses/tinfo/alloc_ttype.c +++ b/ncurses/tinfo/alloc_ttype.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 2018-2021,2022 Thomas E. Dickey * * Copyright 1999-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -43,7 +43,7 @@ #include -MODULE_ID("$Id: alloc_ttype.c,v 1.35 2021/06/17 21:11:08 tom Exp $") +MODULE_ID("$Id: alloc_ttype.c,v 1.37 2022/04/30 17:00:05 tom Exp $") #if NCURSES_XNAMES /* @@ -377,6 +377,9 @@ adjust_cancels(TERMTYPE2 *to, TERMTYPE2 *from) int last = first + to->ext_Strings; int j, k; + DEBUG(3, (T_CALLED("adjust_cancels(%s), from(%s)"), + to ? NonNull(to->term_names) : "?", + from ? NonNull(from->term_names) : "?")); for (j = first; j < last;) { char *name = to->ext_Names[j]; int j_str = to->num_Strings - first - to->ext_Strings; @@ -413,6 +416,7 @@ adjust_cancels(TERMTYPE2 *to, TERMTYPE2 *from) j++; } } + DEBUG(3, (T_RETURN(""))); } NCURSES_EXPORT(void) @@ -425,7 +429,7 @@ _nc_align_termtype(TERMTYPE2 *to, TERMTYPE2 *from) na = to ? ((int) NUM_EXT_NAMES(to)) : 0; nb = from ? ((int) NUM_EXT_NAMES(from)) : 0; - DEBUG(2, ("align_termtype to(%d:%s), from(%d:%s)", + DEBUG(2, (T_CALLED("align_termtype to(%d:%s), from(%d:%s)"), na, to ? NonNull(to->term_names) : "?", nb, from ? NonNull(from->term_names) : "?")); @@ -507,6 +511,7 @@ _nc_align_termtype(TERMTYPE2 *to, TERMTYPE2 *from) if (!used_ext_Names) free(ext_Names); } + DEBUG(2, (T_RETURN(""))); } #endif @@ -520,15 +525,15 @@ _nc_align_termtype(TERMTYPE2 *to, TERMTYPE2 *from) static void copy_termtype(TERMTYPE2 *dst, const TERMTYPE2 *src, int mode) { -#if NCURSES_XNAMES || NCURSES_EXT_NUMBERS unsigned i; -#endif + int pass; + char *new_table; #if NCURSES_EXT_NUMBERS short *oldptr = 0; int *newptr = 0; #endif - DEBUG(2, ("copy_termtype")); + DEBUG(2, (T_CALLED("copy_termtype(dst=%p, src=%p, mode=%d)"), dst, src, mode)); *dst = *src; /* ...to copy the sizes and string-tables */ TYPE_MALLOC(NCURSES_SBOOL, NUM_BOOLEANS(dst), dst->Booleans); @@ -541,6 +546,26 @@ copy_termtype(TERMTYPE2 *dst, const TERMTYPE2 *src, int mode) src->Strings, NUM_STRINGS(dst) * sizeof(dst->Strings[0])); + new_table = NULL; + for (pass = 0; pass < 2; ++pass) { + size_t str_size = 0; + for (i = 0; i < NUM_STRINGS(dst); ++i) { + if (VALID_STRING(src->Strings[i])) { + if (pass) { + strcpy(new_table + str_size, src->Strings[i]); + dst->Strings[i] = new_table + str_size; + } + str_size += strlen(src->Strings[i]) + 1; + } + } + if (pass) { + dst->str_table = new_table; + } else { + ++str_size; + new_table = malloc(str_size); + } + } + #if NCURSES_EXT_NUMBERS if ((mode & dstINT) == 0) { DEBUG(2, ("...convert int ->short")); @@ -584,18 +609,35 @@ copy_termtype(TERMTYPE2 *dst, const TERMTYPE2 *src, int mode) NUM_NUMBERS(dst) * sizeof(dst->Numbers[0])); #endif - /* FIXME: we probably should also copy str_table and ext_str_table, - * but tic and infocmp are not written to exploit that (yet). - */ - #if NCURSES_XNAMES if ((i = NUM_EXT_NAMES(src)) != 0) { TYPE_MALLOC(char *, i, dst->ext_Names); memcpy(dst->ext_Names, src->ext_Names, i * sizeof(char *)); + + new_table = NULL; + for (pass = 0; pass < 2; ++pass) { + size_t str_size = 0; + for (i = 0; i < NUM_EXT_NAMES(dst); ++i) { + if (VALID_STRING(src->ext_Names[i])) { + if (pass) { + strcpy(new_table + str_size, src->ext_Names[i]); + dst->ext_Names[i] = new_table + str_size; + } + str_size += strlen(src->ext_Names[i]) + 1; + } + } + if (pass) { + dst->ext_str_table = new_table; + } else { + ++str_size; + new_table = malloc(str_size); + } + } } else { dst->ext_Names = 0; } #endif + DEBUG(2, (T_RETURN(""))); } /* @@ -604,16 +646,18 @@ copy_termtype(TERMTYPE2 *dst, const TERMTYPE2 *src, int mode) NCURSES_EXPORT(void) _nc_copy_termtype(TERMTYPE *dst, const TERMTYPE *src) { - DEBUG(2, ("_nc_copy_termtype...")); + DEBUG(2, (T_CALLED("_nc_copy_termtype(dst=%p, src=%p)"), dst, src)); copy_termtype((TERMTYPE2 *) dst, (const TERMTYPE2 *) src, 0); + DEBUG(2, (T_RETURN(""))); } #if NCURSES_EXT_NUMBERS NCURSES_EXPORT(void) _nc_copy_termtype2(TERMTYPE2 *dst, const TERMTYPE2 *src) { - DEBUG(2, ("_nc_copy_termtype2...")); + DEBUG(2, (T_CALLED("_nc_copy_termtype2(dst=%p, src=%p)"), dst, src)); copy_termtype(dst, src, srcINT | dstINT); + DEBUG(2, (T_RETURN(""))); } /* @@ -623,7 +667,8 @@ _nc_copy_termtype2(TERMTYPE2 *dst, const TERMTYPE2 *src) NCURSES_EXPORT(void) _nc_export_termtype2(TERMTYPE *dst, const TERMTYPE2 *src) { - DEBUG(2, ("_nc_export_termtype2...")); + DEBUG(2, (T_CALLED("_nc_export_termtype2(dst=%p, src=%p)"), dst, src)); copy_termtype((TERMTYPE2 *) dst, src, srcINT); + DEBUG(2, (T_RETURN(""))); } #endif /* NCURSES_EXT_NUMBERS */ diff --git a/ncurses/tinfo/comp_parse.c b/ncurses/tinfo/comp_parse.c index 4951377f..82672fa8 100644 --- a/ncurses/tinfo/comp_parse.c +++ b/ncurses/tinfo/comp_parse.c @@ -48,7 +48,7 @@ #include -MODULE_ID("$Id: comp_parse.c,v 1.116 2022/04/23 23:23:38 tom Exp $") +MODULE_ID("$Id: comp_parse.c,v 1.117 2022/04/30 15:57:27 tom Exp $") static void sanity_check2(TERMTYPE2 *, bool); NCURSES_IMPEXP void (NCURSES_API *_nc_check_termtype2) (TERMTYPE2 *, bool) = sanity_check2; @@ -59,8 +59,11 @@ static void enqueue(ENTRY * ep) /* add an entry to the in-core list */ { - ENTRY *newp = _nc_copy_entry(ep); + ENTRY *newp; + DEBUG(1, (T_CALLED("enqueue(ep=%p)"), ep)); + + newp = _nc_copy_entry(ep); if (newp == 0) _nc_err_abort(MSG_NO_MEMORY); @@ -217,6 +220,10 @@ _nc_read_entry_source(FILE *fp, char *buf, bool oldsuppress = _nc_suppress_warnings; int immediate = 0; + DEBUG(1, + (T_CALLED("_nc_read_entry_source(file=%p, buf=%p, literal=%d, silent=%d, hook=%p)"), + fp, buf, literal, silent, hook)); + if (silent) _nc_suppress_warnings = TRUE; /* shut the lexer up, too */ @@ -255,12 +262,12 @@ _nc_read_entry_source(FILE *fp, char *buf, for (_nc_head = _nc_tail; _nc_head->last; _nc_head = _nc_head->last) continue; - DEBUG(1, ("head = %s", _nc_head->tterm.term_names)); - DEBUG(1, ("tail = %s", _nc_tail->tterm.term_names)); + DEBUG(2, ("head = %s", _nc_head->tterm.term_names)); + DEBUG(2, ("tail = %s", _nc_tail->tterm.term_names)); } #ifdef TRACE else if (!immediate) - DEBUG(1, ("no entries parsed")); + DEBUG(2, ("no entries parsed")); #endif _nc_suppress_warnings = oldsuppress; @@ -392,7 +399,7 @@ _nc_resolve_uses2(bool fullresolve, bool literal) unsigned i, j; int unresolved, total_unresolved, multiples; - DEBUG(2, ("RESOLUTION BEGINNING")); + DEBUG(2, (T_CALLED("_nc_resolve_uses2"))); /* * Check for multiple occurrences of the same name. @@ -417,8 +424,10 @@ _nc_resolve_uses2(bool fullresolve, bool literal) } } } - if (multiples > 0) + if (multiples > 0) { + DEBUG(2, (T_RETURN("false"))); return (FALSE); + } DEBUG(2, ("NO MULTIPLE NAME OCCURRENCES")); @@ -509,6 +518,7 @@ _nc_resolve_uses2(bool fullresolve, bool literal) if (total_unresolved) { /* free entries read in off disk */ _nc_free_entries(lastread); + DEBUG(2, (T_RETURN("false"))); return (FALSE); } @@ -648,6 +658,7 @@ _nc_resolve_uses2(bool fullresolve, bool literal) DEBUG(2, ("SANITY CHECK FINISHED")); } + DEBUG(2, (T_RETURN("true"))); return (TRUE); } diff --git a/ncurses/tinfo/comp_scan.c b/ncurses/tinfo/comp_scan.c index 08e0e7e6..7f9075c7 100644 --- a/ncurses/tinfo/comp_scan.c +++ b/ncurses/tinfo/comp_scan.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * +,* Copyright 2020-2021,2022 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -51,7 +51,7 @@ #include #include -MODULE_ID("$Id: comp_scan.c,v 1.112 2021/10/04 23:56:28 tom Exp $") +MODULE_ID("$Id: comp_scan.c,v 1.115 2022/04/30 16:21:01 tom Exp $") /* * Maximum length of string capability we'll accept before raising an error. @@ -112,6 +112,9 @@ static FILE *yyin; /* scanner's input file descriptor */ NCURSES_EXPORT(void) _nc_reset_input(FILE *fp, char *buf) { + TR(TRACE_DATABASE, + (T_CALLED("_nc_reset_input(fp=%p, buf=%p)"), fp, buf)); + pushtype = NO_PUSHBACK; if (pushname != 0) pushname[0] = '\0'; @@ -121,6 +124,8 @@ _nc_reset_input(FILE *fp, char *buf) if (fp != 0) _nc_curr_line = 0; _nc_curr_col = 0; + + returnVoidDB; } /* @@ -367,6 +372,8 @@ _nc_get_token(bool silent) int old_col; #endif + DEBUG(3, (T_CALLED("_nc_get_token(silent=%d)"), silent)); + if (pushtype != NO_PUSHBACK) { int retval = pushtype; @@ -379,6 +386,7 @@ _nc_get_token(bool silent) pushname[0] = '\0'; /* currtok wasn't altered by _nc_push_token() */ + DEBUG(3, (T_RETURN("%d"), retval)); return (retval); } @@ -389,6 +397,7 @@ _nc_get_token(bool silent) if (_nc_curr_token.tk_name == tok_buf) _nc_curr_token.tk_name = 0; } + DEBUG(3, (T_RETURN("%d"), EOF)); return (EOF); } @@ -595,7 +604,7 @@ _nc_get_token(bool silent) } } else { after_list = tok_buf + strlen(tok_buf); - DEBUG(1, ("missing description")); + DEBUG(2, ("missing description")); } /* @@ -770,6 +779,7 @@ _nc_get_token(bool silent) : ""), type)); + DEBUG(3, (T_RETURN("%d"), type)); return (type); } diff --git a/ncurses/tinfo/parse_entry.c b/ncurses/tinfo/parse_entry.c index a77cd0b2..e39adade 100644 --- a/ncurses/tinfo/parse_entry.c +++ b/ncurses/tinfo/parse_entry.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 2018-2021,2022 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -48,7 +48,7 @@ #include #include -MODULE_ID("$Id: parse_entry.c,v 1.102 2021/09/04 10:54:35 tom Exp $") +MODULE_ID("$Id: parse_entry.c,v 1.106 2022/04/30 20:50:06 tom Exp $") #ifdef LINT static short const parametrized[] = @@ -214,16 +214,39 @@ expected_type(const char *name, int token_type, bool silent) } #endif /* NCURSES_XNAMES */ +/* + * A valid entry name uses characters from the "portable character set" + * (more commonly referred to as US-ASCII), and disallows some of the + * punctuation characters: + * + * '/' is a pathname separator + * '\' may be a pathname separator, but more important, is an escape + * '|' delimits names and description + * '#' denotes a numeric value + * '=' denotes a string value + * '@' denotes a cancelled symbol + * ',' separates terminfo capabilities + * ':' separates termcap capabilities + * + * Termcap capability names may begin with a '#' or '@' (since they have + * exactly two characters). + */ static bool valid_entryname(const char *name) { bool result = TRUE; + bool first = TRUE; int ch; while ((ch = UChar(*name++)) != '\0') { - if (ch <= ' ' || ch > '~' || ch == '/') { + if (ch <= ' ' || ch > '~' || strchr("/\\|=,:", ch) != NULL) { + result = FALSE; + break; + } + if (!first && strchr("#@", ch) != NULL) { result = FALSE; break; } + first = FALSE; } return result; } @@ -262,10 +285,14 @@ _nc_parse_entry(ENTRY * entryp, int literal, bool silent) const char *name; bool bad_tc_usage = FALSE; + TR(TRACE_DATABASE, + (T_CALLED("_nc_parse_entry(entry=%p, literal=%d, silent=%d)"), + entryp, literal, silent)); + token_type = _nc_get_token(silent); if (token_type == EOF) - return (EOF); + returnDB(EOF); if (token_type != NAMES) _nc_err_abort("Entry does not start with terminal names in column one"); @@ -301,9 +328,9 @@ _nc_parse_entry(ENTRY * entryp, int literal, bool silent) entryp->tterm.str_table = entryp->tterm.term_names = _nc_save_str(ptr); if (entryp->tterm.str_table == 0) - return (ERR); + returnDB(ERR); - DEBUG(1, ("Starting '%s'", ptr)); + DEBUG(2, ("Starting '%s'", ptr)); /* * We do this because the one-token lookahead in the parse loop @@ -605,7 +632,7 @@ _nc_parse_entry(ENTRY * entryp, int literal, bool silent) } _nc_wrap_entry(entryp, FALSE); - return (OK); + returnDB(OK); } NCURSES_EXPORT(int) @@ -737,6 +764,10 @@ postprocess_termcap(TERMTYPE2 *tp, bool has_base) char buf[MAX_LINE * 2 + 2]; string_desc result; + TR(TRACE_DATABASE, + (T_CALLED("postprocess_termcap(tp=%p, has_base=%d)"), + tp, has_base)); + /* * TERMCAP DEFAULTS AND OBSOLETE-CAPABILITY TRANSLATIONS * @@ -1023,11 +1054,16 @@ postprocess_termcap(TERMTYPE2 *tp, bool has_base) && PRESENT(exit_alt_charset_mode)) { acs_chars = _nc_save_str(VT_ACSC); } + returnVoidDB; } static void postprocess_terminfo(TERMTYPE2 *tp) { + TR(TRACE_DATABASE, + (T_CALLED("postprocess_terminfo(tp=%p)"), + tp)); + /* * TERMINFO-TO-TERMINFO MAPPINGS FOR SOURCE TRANSLATION * ---------------------------------------------------------------------- @@ -1064,6 +1100,7 @@ postprocess_terminfo(TERMTYPE2 *tp) /* * ---------------------------------------------------------------------- */ + returnVoidDB; } /* diff --git a/ncurses/tinfo/read_entry.c b/ncurses/tinfo/read_entry.c index 66e3d31e..d61e577b 100644 --- a/ncurses/tinfo/read_entry.c +++ b/ncurses/tinfo/read_entry.c @@ -42,9 +42,7 @@ #include -MODULE_ID("$Id: read_entry.c,v 1.162 2022/04/16 21:00:00 tom Exp $") - -#define TYPE_CALLOC(type,elts) typeCalloc(type, (unsigned)(elts)) +MODULE_ID("$Id: read_entry.c,v 1.163 2022/04/30 18:35:46 tom Exp $") #define MyNumber(n) (short) LOW_MSB(n) @@ -216,6 +214,8 @@ _nc_init_termtype(TERMTYPE2 *const tp) { unsigned i; + DEBUG(2, (T_CALLED("_nc_init_termtype(tp=%p)"), tp)); + #if NCURSES_XNAMES tp->num_Booleans = BOOLCOUNT; tp->num_Numbers = NUMCOUNT; @@ -239,6 +239,8 @@ _nc_init_termtype(TERMTYPE2 *const tp) for_each_string(i, tp) tp->Strings[i] = ABSENT_STRING; + + DEBUG(2, (T_RETURN(""))); } #if NCURSES_USE_DATABASE @@ -346,9 +348,8 @@ _nc_read_termtype(TERMTYPE2 *ptr, char *buffer, int limit) offset = (int) (have - MAX_NAME_SIZE); /* grab the booleans */ - if ((ptr->Booleans = TYPE_CALLOC(NCURSES_SBOOL, - max(BOOLCOUNT, bool_count))) == 0 - || Read(ptr->Booleans, (unsigned) bool_count) < bool_count) { + TYPE_CALLOC(NCURSES_SBOOL, max(BOOLCOUNT, bool_count), ptr->Booleans); + if (Read(ptr->Booleans, (unsigned) bool_count) < bool_count) { returnDB(TGETENT_NO); } @@ -361,15 +362,13 @@ _nc_read_termtype(TERMTYPE2 *ptr, char *buffer, int limit) even_boundary(name_size + bool_count); /* grab the numbers */ - if (!(ptr->Numbers = TYPE_CALLOC(NCURSES_INT2, max(NUMCOUNT, num_count))) - || !read_numbers(buf, num_count)) { + TYPE_CALLOC(NCURSES_INT2, max(NUMCOUNT, num_count), ptr->Numbers); + if (!read_numbers(buf, num_count)) { returnDB(TGETENT_NO); } convert_numbers(buf, ptr->Numbers, num_count); - if ((ptr->Strings = TYPE_CALLOC(char *, max(STRCOUNT, str_count))) == 0) { - returnDB(TGETENT_NO); - } + TYPE_CALLOC(char *, max(STRCOUNT, str_count), ptr->Strings); if (str_count) { /* grab the string offsets */ @@ -510,9 +509,7 @@ _nc_read_termtype(TERMTYPE2 *ptr, char *buffer, int limit) if (ext_str_count >= (max_entry_size / 2)) { returnDB(TGETENT_NO); } - if ((ptr->ext_Names = TYPE_CALLOC(char *, need)) == 0) { - returnDB(TGETENT_NO); - } + TYPE_CALLOC(char *, need, ptr->ext_Names); TR(TRACE_DATABASE, ("ext_NAMES starting @%d in extended_strings, first = %s", base, _nc_visbuf(ptr->ext_str_table + base))); diff --git a/package/debian-mingw/changelog b/package/debian-mingw/changelog index 2a2f2312..b7f2d584 100644 --- a/package/debian-mingw/changelog +++ b/package/debian-mingw/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.3+20220423) unstable; urgency=low +ncurses6 (6.3+20220430) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 23 Apr 2022 08:44:18 -0400 + -- Thomas E. Dickey Sat, 30 Apr 2022 08:58:59 -0400 ncurses6 (5.9-20131005) unstable; urgency=low diff --git a/package/debian-mingw64/changelog b/package/debian-mingw64/changelog index 2a2f2312..b7f2d584 100644 --- a/package/debian-mingw64/changelog +++ b/package/debian-mingw64/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.3+20220423) unstable; urgency=low +ncurses6 (6.3+20220430) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 23 Apr 2022 08:44:18 -0400 + -- Thomas E. Dickey Sat, 30 Apr 2022 08:58:59 -0400 ncurses6 (5.9-20131005) unstable; urgency=low diff --git a/package/debian/changelog b/package/debian/changelog index 8847c82c..511d023c 100644 --- a/package/debian/changelog +++ b/package/debian/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.3+20220423) unstable; urgency=low +ncurses6 (6.3+20220430) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Sat, 23 Apr 2022 08:44:18 -0400 + -- Thomas E. Dickey Sat, 30 Apr 2022 08:58:59 -0400 ncurses6 (5.9-20120608) unstable; urgency=low diff --git a/package/mingw-ncurses.nsi b/package/mingw-ncurses.nsi index b92882c3..65965bce 100644 --- a/package/mingw-ncurses.nsi +++ b/package/mingw-ncurses.nsi @@ -1,4 +1,4 @@ -; $Id: mingw-ncurses.nsi,v 1.516 2022/04/23 12:44:18 tom Exp $ +; $Id: mingw-ncurses.nsi,v 1.517 2022/04/30 12:58:59 tom Exp $ ; TODO add examples ; TODO bump ABI to 6 @@ -10,7 +10,7 @@ !define VERSION_MAJOR "6" !define VERSION_MINOR "3" !define VERSION_YYYY "2022" -!define VERSION_MMDD "0423" +!define VERSION_MMDD "0430" !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD} !define MY_ABI "5" diff --git a/package/mingw-ncurses.spec b/package/mingw-ncurses.spec index 9537593d..038dc1d5 100644 --- a/package/mingw-ncurses.spec +++ b/package/mingw-ncurses.spec @@ -3,7 +3,7 @@ Summary: shared libraries for terminal handling Name: mingw32-ncurses6 Version: 6.3 -Release: 20220423 +Release: 20220430 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/package/ncurses.spec b/package/ncurses.spec index e9e42a11..c6fee503 100644 --- a/package/ncurses.spec +++ b/package/ncurses.spec @@ -1,7 +1,7 @@ Summary: shared libraries for terminal handling Name: ncurses6 Version: 6.3 -Release: 20220423 +Release: 20220430 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/package/ncursest.spec b/package/ncursest.spec index d5529f16..9bdc2d1c 100644 --- a/package/ncursest.spec +++ b/package/ncursest.spec @@ -1,7 +1,7 @@ Summary: Curses library with POSIX thread support. Name: ncursest6 Version: 6.3 -Release: 20220423 +Release: 20220430 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz -- 2.44.0