snapshot of project "ncurses", label v6_2_20210821

This commit is contained in:
Thomas E. Dickey 2021-08-21 23:25:57 +00:00
parent 0eb574b55d
commit 0e6f2fbfaf
79 changed files with 1140 additions and 589 deletions

View File

@ -900,6 +900,7 @@
./ncurses/new_pair.h
./ncurses/report_hashing.c
./ncurses/report_offsets.c
./ncurses/term.priv.h
./ncurses/tinfo/MKcaptab.awk
./ncurses/tinfo/MKcaptab.sh
./ncurses/tinfo/MKcodes.awk

17
NEWS
View File

@ -26,7 +26,7 @@
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
-- $Id: NEWS,v 1.3694 2021/08/14 15:01:03 tom Exp $
-- $Id: NEWS,v 1.3698 2021/08/21 23:25:57 tom Exp $
-------------------------------------------------------------------------------
This is a log of changes that ncurses has gone through since Zeyd started
@ -46,6 +46,21 @@ 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.
20210821
+ improve tparm implementation of %P and %g, more closely matching
SVr4 terminfo.
+ move internals of TERMINAL structure to new header term.priv.h
+ add "check" rule for ncurses/Makefile
+ corrected tsl capability for terminator -TD
+ add check in tic to report instances where tparm would detect an
error in an expression (cf: 20201010).
+ correct a few places where SP->_pair_limit was used rather than
SP->_pair_alloc (cf: 20170812).
+ fix missing "%d" for setaf/setab code 8-15 in xterm+direct16 (report
by Florian Weimer) -TD
+ fix some documentation errata from OpenBSD changes.
+ update config.sub
20210814
+ add workaround for broken pcre2 package in Debian 10, from xterm #369.

View File

@ -1 +1 @@
5:0:10 6.2 20210814
5:0:10 6.2 20210821

View File

@ -1,5 +1,5 @@
<!--
$Id: announce.html.in,v 1.100 2021/06/17 21:30:22 tom Exp $
$Id: announce.html.in,v 1.101 2021/08/15 20:02:52 tom Exp $
****************************************************************************
* Copyright 2018-2020,2021 Thomas E. Dickey *
* *
@ -1605,7 +1605,7 @@ diff --git a/st.info b/st.info
<p>The <span class="main-name">ncurses</span> utilities have
options to allow you to filter terminfo entries for use with
less capable <em>curses</em>/<em>terminfo</em> versions such
as the HP/UX and AIX ports.</p>
as the HP-UX and AIX ports.</p>
</li>
</ul>

21
config.sub vendored
View File

@ -4,7 +4,7 @@
# shellcheck disable=SC2006,SC2268 # see below for rationale
timestamp='2021-07-03'
timestamp='2021-08-14'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@ -121,9 +121,11 @@ esac
# Split fields of configuration type
# shellcheck disable=SC2162
saved_IFS=$IFS
IFS="-" read field1 field2 field3 field4 <<EOF
$1
EOF
IFS=$saved_IFS
# Separate into logical components for further validation
case $1 in
@ -172,6 +174,10 @@ case $1 in
basic_machine=$field1
basic_os=$field2
;;
zephyr*)
basic_machine=$field1-unknown
basic_os=$field2
;;
# Manufacturers
dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \
| att* | 7300* | 3300* | delta* | motorola* | sun[234]* \
@ -931,9 +937,11 @@ case $basic_machine in
*-*)
# shellcheck disable=SC2162
saved_IFS=$IFS
IFS="-" read cpu vendor <<EOF
$basic_machine
EOF
IFS=$saved_IFS
;;
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
@ -1313,9 +1321,11 @@ case $basic_os in
;;
*-*)
# shellcheck disable=SC2162
saved_IFS=$IFS
IFS="-" read kernel os <<EOF
$basic_os
EOF
IFS=$saved_IFS
;;
# Default OS when just kernel was specified
nto*)
@ -1697,7 +1707,7 @@ fi
# Now, validate our (potentially fixed-up) OS.
case $os in
# Sometimes we do "kernel-libc", so those need to count as OSes.
musl* | newlib* | uclibc*)
musl* | newlib* | relibc* | uclibc*)
;;
# Likewise for "kernel-abi"
eabi* | gnueabi*)
@ -1738,7 +1748,7 @@ case $os in
| skyos* | haiku* | rdos* | toppers* | drops* | es* \
| onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
| midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
| nsk* | powerunix* | genode* | zvmoe* | qnx* | emx*)
| nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr*)
;;
# This one is extra strict with allowed versions
sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
@ -1755,11 +1765,12 @@ esac
# As a final step for OS-related things, validate the OS-kernel combination
# (given a valid OS), if there is a kernel.
case $kernel-$os in
linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* | linux-musl* | linux-uclibc* )
linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* \
| linux-musl* | linux-relibc* | linux-uclibc* )
;;
uclinux-uclibc* )
;;
-dietlibc* | -newlib* | -musl* | -uclibc* )
-dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* )
# These are just libc implementations, not actual OSes, and thus
# require a kernel.
echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2

View File

@ -26,7 +26,7 @@
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
# $Id: dist.mk,v 1.1430 2021/08/14 10:38:41 tom Exp $
# $Id: dist.mk,v 1.1431 2021/08/21 14:10:10 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 = 2
NCURSES_PATCH = 20210814
NCURSES_PATCH = 20210821
# We don't append the patch to the version, since this only applies to releases
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)

View File

@ -126,7 +126,7 @@
</PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
<STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20210710).
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20210821).

View File

@ -199,7 +199,7 @@
</PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
<STRONG><A HREF="infocmp.1m.html">infocmp(1m)</A></STRONG>, <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20210710).
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20210821).
</PRE><H2><a name="h2-AUTHOR">AUTHOR</a></H2><PRE>

View File

@ -150,7 +150,7 @@
</PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
<STRONG><A HREF="tput.1.html">tput(1)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20210710).
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20210821).

View File

@ -248,7 +248,7 @@
<STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG> and related pages whose names begin "form_" for detailed
descriptions of the entry points.
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20210710).
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20210821).

View File

@ -28,7 +28,7 @@
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************
* @Id: infocmp.1m,v 1.78 2021/06/17 21:30:22 tom Exp @
* @Id: infocmp.1m,v 1.79 2021/08/15 20:01:31 tom Exp @
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<HTML>
@ -383,7 +383,7 @@
<STRONG>-R</STRONG><EM>subset</EM>
Restrict output to a given subset. This option is for use with
archaic versions of terminfo like those on SVr1, Ultrix, or HP/UX
archaic versions of terminfo like those on SVr1, Ultrix, or HP-UX
that do not support the full set of SVR4/XSI Curses terminfo; and
variants such as AIX that have their own extensions incompatible
with SVr4/XSI.
@ -514,7 +514,7 @@
https://invisible-island.net/ncurses/tctest.html
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20210710).
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20210821).
</PRE><H2><a name="h2-AUTHOR">AUTHOR</a></H2><PRE>

View File

@ -91,7 +91,7 @@
</PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
<STRONG><A HREF="infocmp.1m.html">infocmp(1m)</A></STRONG>, <STRONG><A HREF="tic.1m.html">tic(1m)</A></STRONG>, <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20210710).
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20210821).
</PRE><H2><a name="h2-AUTHOR">AUTHOR</a></H2><PRE>

View File

@ -1,6 +1,6 @@
<!--
****************************************************************************
* Copyright 2020 Thomas E. Dickey *
* Copyright 2020,2021 Thomas E. Dickey *
* Copyright 2005-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -28,7 +28,7 @@
* authorization. *
****************************************************************************
* Author: Thomas E. Dickey
* @Id: legacy_coding.3x,v 1.8 2020/10/17 23:40:23 tom Exp @
* @Id: legacy_coding.3x,v 1.9 2021/08/15 19:32:05 tom Exp @
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<HTML>
@ -90,7 +90,7 @@
</PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
<STRONG>unctrl</STRONG>.
<STRONG><A HREF="unctrl.3x.html">unctrl(3x)</A></STRONG>.
</PRE><H2><a name="h2-AUTHOR">AUTHOR</a></H2><PRE>

View File

@ -223,7 +223,7 @@
<STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG> and related pages whose names begin "menu_" for detailed
descriptions of the entry points.
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20210710).
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20210821).

View File

@ -60,7 +60,7 @@
method of updating character screens with reasonable optimization.
This implementation is "new curses" (ncurses) and is the approved
replacement for 4.4BSD classic curses, which has been discontinued.
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20210710).
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20210821).
The <STRONG>ncurses</STRONG> library emulates the curses library of System V Release 4
UNIX, and XPG4 (X/Open Portability Guide) curses (also known as XSI

View File

@ -113,7 +113,7 @@
</PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
<STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20210710).
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20210821).

View File

@ -281,7 +281,7 @@
</PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
<STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="curs_variables.3x.html">curs_variables(3x)</A></STRONG>,
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20210710).
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20210821).
</PRE><H2><a name="h2-AUTHOR">AUTHOR</a></H2><PRE>

View File

@ -207,7 +207,7 @@
</PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
<STRONG><A HREF="infocmp.1m.html">infocmp(1m)</A></STRONG>, <STRONG><A HREF="tset.1.html">tset(1)</A></STRONG>, <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>.
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20210710).
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20210821).

View File

@ -1,6 +1,6 @@
<!--
****************************************************************************
* Copyright 2018-2019,2020 Thomas E. Dickey *
* Copyright 2018-2020,2021 Thomas E. Dickey *
* Copyright 1998-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -27,7 +27,7 @@
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************
* @Id: term.5,v 1.38 2020/07/25 21:56:02 tom Exp @
* @Id: term.5,v 1.40 2021/08/15 19:38:47 tom Exp @
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<HTML>
@ -249,7 +249,7 @@
</PRE><H3><a name="h3-setupterm">setupterm</a></H3><PRE>
Note that it is possible for <STRONG>setupterm</STRONG> to expect a different set of
capabilities than are actually present in the file. Either the
database may have been updated since <STRONG>setupterm</STRONG> has been recompiled
database may have been updated since <STRONG>setupterm</STRONG> was recompiled
(resulting in extra unrecognized entries in the file) or the program
may have been recompiled more recently than the database was updated
(resulting in missing entries). The routine <STRONG>setupterm</STRONG> must be prepared
@ -362,7 +362,7 @@
</PRE><H2><a name="h2-FILES">FILES</a></H2><PRE>
/usr/share/terminfo/*/* compiled terminal capability data base
/usr/share/terminfo/*/* compiled terminal capability database
</PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>

View File

@ -1,6 +1,6 @@
<!--
****************************************************************************
* Copyright 2018-2019,2020 Thomas E. Dickey *
* Copyright 2018-2020,2021 Thomas E. Dickey *
* Copyright 1998-2011,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -27,7 +27,7 @@
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************
* @Id: term.7,v 1.28 2020/02/02 23:34:34 tom Exp @
* @Id: term.7,v 1.30 2021/08/15 19:39:57 tom Exp @
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<HTML>
@ -72,7 +72,7 @@
termcap entry for your type is not compatible with yours, but this
situation is rare and can almost always be avoided by explicitly
exporting "vt100" (assuming you are in fact using a VT100-superset
console, terminal, or terminal emulator.)
console, terminal, or terminal emulator).
In any case, you are free to override the system <STRONG>TERM</STRONG> setting to your
taste in your shell profile. The <STRONG><A HREF="tset.1.html">tset(1)</A></STRONG> utility may be of assistance;
@ -202,7 +202,7 @@
</PRE><H2><a name="h2-FILES">FILES</a></H2><PRE>
/usr/share/terminfo/?/*
compiled terminal capability data base
compiled terminal capability database
/etc/inittab
tty line initialization (AT&amp;T-like UNIXes)

View File

@ -32,7 +32,7 @@
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************
* @Id: terminfo.head,v 1.40 2021/06/17 21:30:22 tom Exp @
* @Id: terminfo.head,v 1.41 2021/08/15 19:32:53 tom Exp @
* Head of terminfo man page ends here
****************************************************************************
* Copyright 2018-2020,2021 Thomas E. Dickey *
@ -62,7 +62,7 @@
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************
* @Id: terminfo.tail,v 1.101 2021/06/17 21:30:22 tom Exp @
* @Id: terminfo.tail,v 1.102 2021/08/21 22:55:23 tom Exp @
*.in -2
*.in +2
*.in -2
@ -87,7 +87,7 @@
</PRE><H2><a name="h2-NAME">NAME</a></H2><PRE>
terminfo - terminal capability data base
terminfo - terminal capability database
</PRE><H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
@ -95,7 +95,7 @@
</PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
<EM>Terminfo</EM> is a data base describing terminals, used by screen-oriented
<EM>Terminfo</EM> is a database describing terminals, used by screen-oriented
programs such as <STRONG>nvi(1)</STRONG>, <STRONG>lynx(1)</STRONG>, <STRONG>mutt(1)</STRONG>, and other curses
applications, using high-level calls to libraries such as <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>.
It is also used via low-level calls by non-curses applications which
@ -106,7 +106,7 @@
have, by specifying how to perform screen operations, and by specifying
padding requirements and initialization sequences.
This manual describes <STRONG>ncurses</STRONG> version 6.2 (patch 20210710).
This manual describes <STRONG>ncurses</STRONG> version 6.2 (patch 20210821).
</PRE><H3><a name="h3-Terminfo-Entry-Syntax">Terminfo Entry Syntax</a></H3><PRE>
@ -1475,7 +1475,27 @@
these are simply two different sets of variables, whose values are
not reset between calls to <STRONG><A HREF="curs_terminfo.3x.html">tparm(3x)</A></STRONG>. However, that fact is not
documented in other implementations. Relying on it will adversely
impact portability to other implementations.
impact portability to other implementations:
<STRONG>o</STRONG> SVr4 curses stores the <EM>static</EM> variables in the <STRONG>TERMINAL</STRONG>
structure (declared in <STRONG>term.h</STRONG>), and the <EM>dynamic</EM> <EM>variables</EM> on
the stack in the <STRONG>tparm</STRONG> function. The former are zeroed
automatically when the <STRONG>setupterm</STRONG> function allocates the data.
The latter are set only by a <STRONG>%P</STRONG> operator. A <STRONG>%g</STRONG> for a given
variable without first setting it with <STRONG>%P</STRONG> will give
unpredictable results.
<STRONG>o</STRONG> Solaris XPG4 curses does not distinguish between <EM>dynamic</EM> and
<EM>static</EM> variables. They are the same. Like SVr4 curses, XPG4
curses does not initialize these explicitly.
<STRONG>o</STRONG> Before version 6.3, ncurses stores both <EM>dynamic</EM> and <EM>static</EM>
variables in persistent storage, initialized to zeros.
<STRONG>o</STRONG> Beginning with version 6.3, ncurses stores <EM>static</EM> and <EM>dynamic</EM>
variables in the same manner as SVr4. Unlike other
implementations, ncurses zeros dynamic variables before the
first <STRONG>%g</STRONG> or <STRONG>%P</STRONG> operator.
<STRONG>%'</STRONG><EM>c</EM><STRONG>'</STRONG> char constant <EM>c</EM>
@ -2094,7 +2114,6 @@
board of squares ACS_BOARD # h 0x68
lantern symbol ACS_LANTERN # i 0x69
lower right corner ACS_LRCORNER + j 0x6a
upper right corner ACS_URCORNER + k 0x6b
upper left corner ACS_ULCORNER + l 0x6c
lower left corner ACS_LLCORNER + m 0x6d

View File

@ -27,7 +27,7 @@
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************
* @Id: tic.1m,v 1.79 2021/06/17 21:30:22 tom Exp @
* @Id: tic.1m,v 1.80 2021/08/15 20:01:19 tom Exp @
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<HTML>
@ -223,11 +223,11 @@
<STRONG>-R</STRONG><EM>subset</EM>
Restrict output to a given subset. This option is for use with
archaic versions of terminfo like those on SVr1, Ultrix, or
HP/UX that do not support the full set of SVR4/XSI Curses
terminfo; and outright broken ports like AIX 3.x that have their
own extensions incompatible with SVr4/XSI. Available subsets
are "SVr1", "Ultrix", "HP", "BSD" and "AIX"; see <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG> for
archaic versions of terminfo like those on SVr1, Ultrix, or HP-
UX that do not support the full set of SVR4/XSI Curses terminfo;
and outright broken ports like AIX 3.x that have their own
extensions incompatible with SVr4/XSI. Available subsets are
"SVr1", "Ultrix", "HP", "BSD" and "AIX"; see <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG> for
details.
<STRONG>-r</STRONG> Force entry resolution (so there are no remaining tc
@ -461,7 +461,7 @@
<STRONG><A HREF="captoinfo.1m.html">captoinfo(1m)</A></STRONG>, <STRONG><A HREF="infocmp.1m.html">infocmp(1m)</A></STRONG>, <STRONG><A HREF="infotocap.1m.html">infotocap(1m)</A></STRONG>, <STRONG><A HREF="toe.1m.html">toe(1m)</A></STRONG>, <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>,
<STRONG><A HREF="term.5.html">term(5)</A></STRONG>. <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>. <STRONG><A HREF="user_caps.5.html">user_caps(5)</A></STRONG>.
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20210710).
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20210821).
</PRE><H2><a name="h2-AUTHOR">AUTHOR</a></H2><PRE>

View File

@ -171,7 +171,7 @@
<STRONG><A HREF="captoinfo.1m.html">captoinfo(1m)</A></STRONG>, <STRONG><A HREF="infocmp.1m.html">infocmp(1m)</A></STRONG>, <STRONG><A HREF="infotocap.1m.html">infotocap(1m)</A></STRONG>, <STRONG><A HREF="tic.1m.html">tic(1m)</A></STRONG>, <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>,
<STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>.
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20210710).
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20210821).

View File

@ -526,7 +526,7 @@
</PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
<STRONG><A HREF="clear.1.html">clear(1)</A></STRONG>, <STRONG>stty(1)</STRONG>, <STRONG><A HREF="tabs.1.html">tabs(1)</A></STRONG>, <STRONG><A HREF="tset.1.html">tset(1)</A></STRONG>, <STRONG><A HREF="curs_termcap.3x.html">curs_termcap(3x)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>.
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20210710).
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20210821).

View File

@ -385,7 +385,7 @@
<STRONG>csh(1)</STRONG>, <STRONG>sh(1)</STRONG>, <STRONG>stty(1)</STRONG>, <STRONG><A HREF="curs_terminfo.3x.html">curs_terminfo(3x)</A></STRONG>, <STRONG>tty(4)</STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>,
<STRONG>ttys(5)</STRONG>, <STRONG>environ(7)</STRONG>
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20210710).
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20210821).

View File

@ -60,7 +60,7 @@ BEGIN {
print "/* and: Thomas E. Dickey 1995-on */"
print "/****************************************************************************/"
print ""
print "/* $Id: MKterm.h.awk.in,v 1.79 2021/03/20 16:08:03 tom Exp $ */"
print "/* $Id: MKterm.h.awk.in,v 1.81 2021/08/18 20:52:42 tom Exp $ */"
print ""
print "/*"
print "** term.h -- Definition of struct term"
@ -244,6 +244,9 @@ END {
print " * The only reason these structures are visible is for read-only use."
print " * Programs which modify the data are not, never were, portable across"
print " * curses implementations."
print " *"
print " * The first field in TERMINAL is used in macros."
print " * The remaining fields are private."
print " */"
print "#ifdef NCURSES_INTERNALS"
print ""
@ -253,19 +256,13 @@ END {
print "typedef TERMTYPE TERMTYPE2;"
}
print ""
print "typedef struct term TERMINAL;"
print "#else"
print ""
print "typedef struct term { /* describe an actual terminal */"
print " TERMTYPE type; /* terminal type description */"
print " short Filedes; /* file description being written to */"
print " TTY Ottyb; /* original state of the terminal */"
print " TTY Nttyb; /* current state of the terminal */"
print " int _baudrate; /* used to compute padding */"
print " char * _termname; /* used for termname() */"
if (@NCURSES_EXT_COLORS@) {
print " TERMTYPE2 type2; /* extended terminal type description */"
}
print "} TERMINAL;"
print "#else"
print "typedef struct term TERMINAL;"
print ""
print "#endif /* NCURSES_INTERNALS */"
print ""
print ""

View File

@ -34,7 +34,7 @@
****************************************************************************/
/*
* $Id: tic.h,v 1.82 2021/03/20 16:06:15 tom Exp $
* $Id: tic.h,v 1.84 2021/08/21 00:24:45 tom Exp $
* tic.h - Global variables and structures for the terminfo compiler.
*/
@ -337,7 +337,8 @@ extern NCURSES_EXPORT_VAR(const struct tinfo_fkeys) _nc_tinfo_fkeys[];
extern NCURSES_EXPORT_VAR(int) _nc_tparm_err;
extern NCURSES_EXPORT(int) _nc_tparm_analyze(const char *, char **, int *);
extern NCURSES_EXPORT(int) _nc_tparm_analyze(TERMINAL *, const char *, char **, int *);
extern NCURSES_EXPORT(void) _nc_reset_tparm(TERMINAL *);
/* lib_trace.c */
extern NCURSES_EXPORT_VAR(unsigned) _nc_tracing;

View File

@ -28,7 +28,7 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: infocmp.1m,v 1.78 2021/06/17 21:30:22 tom Exp $
.\" $Id: infocmp.1m,v 1.79 2021/08/15 20:01:31 tom Exp $
.TH @INFOCMP@ 1M ""
.ie \n(.g .ds `` \(lq
.el .ds `` ``
@ -476,7 +476,7 @@ Omit the \*(``Reconstructed from\*('' comment for source listings.
\fB\-R\fR\fIsubset\fR
Restrict output to a given subset.
This option is for use with archaic
versions of terminfo like those on SVr1, Ultrix, or HP/UX that do not support
versions of terminfo like those on SVr1, Ultrix, or HP-UX that do not support
the full set of SVR4/XSI Curses terminfo; and variants such as AIX
that have their own extensions incompatible with SVr4/XSI.
.RS

View File

@ -1,5 +1,5 @@
.\"***************************************************************************
.\" Copyright 2020 Thomas E. Dickey *
.\" Copyright 2020,2021 Thomas E. Dickey *
.\" Copyright 2005-2016,2017 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@ -29,7 +29,7 @@
.\"
.\" Author: Thomas E. Dickey
.\"
.\" $Id: legacy_coding.3x,v 1.8 2020/10/17 23:40:23 tom Exp $
.\" $Id: legacy_coding.3x,v 1.9 2021/08/15 19:32:05 tom Exp $
.TH legacy_coding 3X ""
.SH NAME
\fBuse_legacy_coding\fR \- override locale-encoding checks
@ -70,6 +70,6 @@ It was not supported on Version 7, BSD or System V implementations.
It is recommended that any code depending on ncurses extensions
be conditioned using NCURSES_VERSION.
.SH SEE ALSO
\fBunctrl\fR.
\fBunctrl\fR(3X).
.SH AUTHOR
Thomas Dickey (to support lynx's font-switching feature).

View File

@ -1,5 +1,5 @@
.\"***************************************************************************
.\" Copyright 2018-2019,2020 Thomas E. Dickey *
.\" Copyright 2018-2020,2021 Thomas E. Dickey *
.\" Copyright 1998-2016,2017 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@ -27,7 +27,7 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: term.5,v 1.38 2020/07/25 21:56:02 tom Exp $
.\" $Id: term.5,v 1.40 2021/08/15 19:38:47 tom Exp $
.TH term 5
.ie \n(.g .ds `` \(lq
.el .ds `` ``
@ -286,7 +286,7 @@ to expect a different set of capabilities
than are actually present in the file.
Either the database may have been updated since
.B setupterm
has been recompiled
was recompiled
(resulting in extra unrecognized entries in the file)
or the program may have been recompiled more recently
than the database was updated
@ -400,7 +400,7 @@ Compiled entries are limited to 32768 bytes because offsets into the
The legacy format could have supported 32768-byte entries,
but was limited a virtual memory page's 4096 bytes.
.SH FILES
\*d/*/* compiled terminal capability data base
\*d/*/* compiled terminal capability database
.SH SEE ALSO
\fBcurses\fR(3X), \fBterminfo\fR(\*n).
.SH AUTHORS

View File

@ -1,5 +1,5 @@
.\"***************************************************************************
.\" Copyright 2018-2019,2020 Thomas E. Dickey *
.\" Copyright 2018-2020,2021 Thomas E. Dickey *
.\" Copyright 1998-2011,2017 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@ -27,7 +27,7 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: term.7,v 1.28 2020/02/02 23:34:34 tom Exp $
.\" $Id: term.7,v 1.30 2021/08/15 19:39:57 tom Exp $
.TH term 7
.ie \n(.g .ds `` \(lq
.el .ds `` ``
@ -61,7 +61,7 @@ There can be problems if the remote terminfo or termcap entry
for your type is not compatible with yours, but this situation is rare and
can almost always be avoided by explicitly exporting \*(``vt100\*(''
(assuming you are in fact using a VT100-superset console,
terminal, or terminal emulator.)
terminal, or terminal emulator).
.PP
In any case, you are free to override the system \fBTERM\fR setting to your
taste in your shell profile.
@ -213,7 +213,7 @@ should be unique within the first 14 characters.
.SH FILES
.TP 5
\*d/?/*
compiled terminal capability data base
compiled terminal capability database
.TP 5
/etc/inittab
tty line initialization (AT&T-like UNIXes)

View File

@ -27,7 +27,7 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: terminfo.head,v 1.40 2021/06/17 21:30:22 tom Exp $
.\" $Id: terminfo.head,v 1.41 2021/08/15 19:32:53 tom Exp $
.TH terminfo 5 "" "" "File Formats"
.ds n 5
.ds d @TERMINFO@
@ -54,12 +54,12 @@
.el .in -2
..
.SH NAME
terminfo \- terminal capability data base
terminfo \- terminal capability database
.SH SYNOPSIS
\*d/*/*
.SH DESCRIPTION
.I Terminfo
is a data base describing terminals,
is a database describing terminals,
used by screen-oriented programs such as
\fBnvi\fR(1),
\fBlynx\fR(1),

View File

@ -27,7 +27,7 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: terminfo.tail,v 1.101 2021/06/17 21:30:22 tom Exp $
.\" $Id: terminfo.tail,v 1.102 2021/08/21 22:55:23 tom Exp $
.ps +1
.SS User-Defined Capabilities
.
@ -483,7 +483,31 @@ The terms \*(``static\*('' and \*(``dynamic\*('' are misleading.
Historically, these are simply two different sets of variables,
whose values are not reset between calls to \fBtparm\fP(3X).
However, that fact is not documented in other implementations.
Relying on it will adversely impact portability to other implementations.
Relying on it will adversely impact portability to other implementations:
.RS
.bP
SVr4 curses stores the \fIstatic\fP variables in the \fBTERMINAL\fP
structure (declared in \fBterm.h\fP), and the \fIdynamic variables\fP
on the stack in the \fBtparm\fP function.
The former are zeroed automatically when the \fBsetupterm\fP function
allocates the data.
The latter are set only by a \fB%P\fP operator.
A \fB%g\fP for a given variable without first setting it with \fB%P\fP
will give unpredictable results.
.bP
Solaris XPG4 curses does not distinguish between \fIdynamic\fP and
\fIstatic\fP variables.
They are the same.
Like SVr4 curses, XPG4 curses does not initialize these explicitly.
.bP
Before version 6.3, ncurses stores both \fIdynamic\fP and \fIstatic\fP
variables in persistent storage, initialized to zeros.
.bP
Beginning with version 6.3, ncurses stores \fIstatic\fP and \fIdynamic\fP
variables in the same manner as SVr4.
Unlike other implementations, ncurses zeros dynamic variables
before the first \fB%g\fP or \fB%P\fP operator.
.RE
.TP
\fB%'\fP\fIc\fP\fB'\fP
char constant \fIc\fP

View File

@ -27,7 +27,7 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: tic.1m,v 1.79 2021/06/17 21:30:22 tom Exp $
.\" $Id: tic.1m,v 1.80 2021/08/15 20:01:19 tom Exp $
.TH @TIC@ 1M ""
.ie \n(.g .ds `` \(lq
.el .ds `` ``
@ -279,7 +279,7 @@ Suppress comments and blank lines when showing translated source.
\fB\-R\fR\fIsubset\fR
Restrict output to a given subset.
This option is for use with archaic
versions of terminfo like those on SVr1, Ultrix, or HP/UX that do not support
versions of terminfo like those on SVr1, Ultrix, or HP-UX that do not support
the full set of SVR4/XSI Curses terminfo; and outright broken ports like AIX 3.x
that have their own extensions incompatible with SVr4/XSI.
Available subsets

View File

@ -6,8 +6,8 @@
# Report bugs and new terminal descriptions to
# bug-ncurses@gnu.org
#
# $Revision: 1.907 $
# $Date: 2021/08/01 00:06:57 $
# $Revision: 1.909 $
# $Date: 2021/08/17 00:26:19 $
#
# 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
@ -5244,12 +5244,12 @@ nsterm-direct|nsterm with direct-color indexing,
xterm+direct16|xterm with direct-color indexing,
CO#16,
setab=\E[%?%p1%{8}%<%t4%p1%d%e%?%p1%{16}%<%t%p1%{92}%+%e48:2
::%p1%{65536}%/%d:%p1%{256}%/%{255}%&%d:%p1%{255}%&%d
setab=\E[%?%p1%{8}%<%t4%p1%d%e%?%p1%{16}%<%t%p1%{92}%+%d%e48
:2::%p1%{65536}%/%d:%p1%{256}%/%{255}%&%d:%p1%{255}%&
%d%;%;m,
setaf=\E[%?%p1%{8}%<%t3%p1%d%e%?%p1%{16}%<%t%p1%'R'%+%d%e38:
2::%p1%{65536}%/%d:%p1%{256}%/%{255}%&%d:%p1%{255}%&%d
%;%;m,
setaf=\E[%?%p1%{8}%<%t3%p1%d%e%?%p1%{16}%<%t%p1%'R'%+%e38:2:
:%p1%{65536}%/%d:%p1%{256}%/%{255}%&%d:%p1%{255}%&%d%;
%;m,
setb@, setf@, use=xterm+direct,
xterm-direct16|xterm with direct-colors and 16 indexed colors,
@ -7238,7 +7238,7 @@ terminator|Terminator no line wrap,
sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p5%t;2%;%?%p1%p3%|%t;7
%;m%?%p9%t\E(0%e\E(B%;,
sgr0=\E[m\E(B, smacs=\E(0, smir=\E[4h, smso=\E[7m,
smul=\E[4m, tbc=\E[3g, tsl=\E]2;%p1, vpa=\E[%i%p1%dd,
smul=\E[4m, tbc=\E[3g, tsl=\E]2;, vpa=\E[%i%p1%dd,
use=vt220+pcedit, use=ecma+italics, use=ecma+index,
use=xterm+256setaf, use=xterm+sl-twm,
use=xterm+alt1049, use=vt220+cvis,
@ -27178,4 +27178,11 @@ v3220|LANPAR Vision II model 3220/3221/3222,
# but cancel the non-working Cr and Ms capabilities -TD
# + add foot and foot-direct -TD
#
# 2021-08-15
# + fix missing "%d" for setaf/setab code 8-15 in xterm+direct16 (report
# by Florian Weimer) -TD
#
# 2021-08-16
# + corrected tsl capability for terminator -TD
#
######## SHANTIH! SHANTIH! SHANTIH!

View File

@ -1,4 +1,4 @@
# $Id: mk-1st.awk,v 1.122 2021/07/18 18:47:20 tom Exp $
# $Id: mk-1st.awk,v 1.123 2021/08/15 20:01:44 tom Exp $
##############################################################################
# Copyright 2018-2020,2021 Thomas E. Dickey #
# Copyright 1998-2016,2017 Free Software Foundation, Inc. #
@ -62,7 +62,7 @@
# Notes:
# CLIXs nawk does not like underscores in command-line variable names.
# Mixed-case variable names are ok.
# HP/UX requires shared libraries to have executable permissions.
# HP-UX requires shared libraries to have executable permissions.
#
function is_ticlib() {
return ( subset ~ /^ticlib$/ );

View File

@ -1,4 +1,4 @@
# $Id: Makefile.in,v 1.180 2021/07/03 15:27:09 tom Exp $
# $Id: Makefile.in,v 1.182 2021/08/19 23:43:40 tom Exp $
##############################################################################
# Copyright 2018-2020,2021 Thomas E. Dickey #
# Copyright 1998-2017,2018 Free Software Foundation, Inc. #
@ -193,7 +193,8 @@ HEADER_DEPS = @INTERNALS_HDR@ \
$(INCDIR)/nc_win32.h \
$(INCDIR)/term_entry.h \
$(srcdir)/curses.priv.h \
$(srcdir)/new_pair.h
$(srcdir)/new_pair.h \
$(srcdir)/term.priv.h
TEST_DEPS = ../lib/@LIB_PREFIX@ncurses@DFT_DEP_SUFFIX@
TEST_ARGS = @LDFLAGS_STATIC@ @TEST_ARGS@ @LDFLAGS_SHARED@
@ -219,6 +220,7 @@ win32con = $(srcdir)/win32con
################################################################################
@MAKE_PHONY@.PHONY : all
@MAKE_PHONY@.PHONY : check
@MAKE_PHONY@.PHONY : clean
@MAKE_PHONY@.PHONY : distclean
@MAKE_PHONY@.PHONY : libs
@ -327,6 +329,7 @@ realclean :: distclean
( cd ../include && $(MAKE) $(TOP_MFLAGS) )
# These rules build test-programs for the modules that have test-drivers
@MAKE_PHONY@.PHONY : test_progs
test_progs : $(TEST_PROGS)
./link_test.c : $(base)/MKlib_gen.sh ../include/curses.h
@ -357,6 +360,23 @@ report_hashing$x : \
$(srcdir)/report_hashing.c $(TEST_DEPS)
@ECHO_LD@ $(CC) -o $@ $(CFLAGS_DEFAULT) report_hashing.c $(TEST_LDFLAGS)
# Verify that each header-file can be compiled without including another.
@MAKE_PHONY@.PHONY : check_headers
check_headers:
@$(SHELL) -c "for header in *.h;\
do \
echo \"** testing \$${header}\" ; \
echo \"#include <\$${header}>\" >headers.c; \
echo \"int main(void) { return 0; }\" >>headers.c; \
$(CC) -c $(CFLAGS) $(CPPFLAGS) headers.c; \
done"
-@rm -f headers.*
@MAKE_PHONY@.PHONY : check_objects
check_objects: test_progs
check :: check_headers check_objects
###############################################################################
# The remainder of this file is automatically generated during configuration
###############################################################################

View File

@ -61,7 +61,7 @@
#endif
MODULE_ID("$Id: new_pair.c,v 1.22 2021/05/08 15:26:34 tom Exp $")
MODULE_ID("$Id: new_pair.c,v 1.23 2021/08/16 22:11:26 tom Exp $")
#if NCURSES_EXT_COLORS
@ -106,7 +106,7 @@ dumpit(SCREEN *sp, int pair, const char *tag)
size_t have = sizeof(bigbuf);
_nc_STRCPY(p, tag, have);
for (n = 0; n < sp->_pair_limit; ++n) {
for (n = 0; n < sp->_pair_alloc; ++n) {
if (list[n].mode != cpFREE) {
p += strlen(p);
if ((size_t) (p - bigbuf) + 50 > have)

View File

@ -35,7 +35,7 @@
****************************************************************************/
/*
* $Id: curses.priv.h,v 1.642 2021/06/26 20:23:20 tom Exp $
* $Id: curses.priv.h,v 1.644 2021/08/18 21:55:42 tom Exp $
*
* curses.priv.h
*
@ -396,7 +396,7 @@ typedef union {
#include <nc_panel.h>
#include <term.h>
#include <term.priv.h>
#include <nc_termios.h>
#define IsPreScreen(sp) (((sp) != 0) && sp->_prescreen)
@ -799,12 +799,6 @@ typedef struct _SLK {
#endif /* USE_TERMLIB */
typedef struct {
WINDOW *win; /* the window used in the hook */
int line; /* lines to take, < 0 => from bottom*/
int (*hook)(WINDOW *, int); /* callback for user */
} ripoff_t;
#if USE_GPM_SUPPORT
#undef buttons /* term.h defines this, and gpm uses it! */
#include <gpm.h>
@ -832,16 +826,6 @@ typedef int (*TYPE_Gpm_GetEvent) (Gpm_Event *);
#endif /* HAVE_LIBDL */
#endif /* USE_GPM_SUPPORT */
typedef struct {
long sequence;
bool last_used;
char *fix_sgr0; /* this holds the filtered sgr0 string */
char *last_bufp; /* help with fix_sgr0 leak */
TERMINAL *last_term;
} TGETENT_CACHE;
#define TGETENT_MAX 4
/*
* When converting from terminfo to termcap, check for cases where we can trim
* octal escapes down to 2-character form. It is useful for terminfo format
@ -852,46 +836,6 @@ typedef struct {
#define isoctal(c) ((c) >= '0' && (c) <= '7')
/*
* State of tparm().
*/
#define STACKSIZE 20
typedef struct {
union {
int num;
char *str;
} data;
bool num_type;
} STACK_FRAME;
#define NUM_VARS 26
typedef struct {
const char *tparam_base;
STACK_FRAME stack[STACKSIZE];
int stack_ptr;
char *out_buff;
size_t out_size;
size_t out_used;
char *fmt_buff;
size_t fmt_size;
int dynamic_var[NUM_VARS];
int static_vars[NUM_VARS];
#ifdef TRACE
const char *tname;
#endif
} TPARM_STATE;
typedef struct {
char *text;
size_t size;
} TRACEBUF;
/*
* The filesystem database normally uses a single-letter for the lower level
* of directories. Use a hexadecimal code for filesystems which do not
@ -922,132 +866,8 @@ struct DriverTCB; /* Terminal Control Block forward declaration */
#define INIT_TERM_DRIVER() /* nothing */
#endif
typedef struct {
const char *name;
char *value;
} ITERATOR_VARS;
/*
* Global data which is not specific to a screen.
*/
typedef struct {
SIG_ATOMIC_T have_sigtstp;
SIG_ATOMIC_T have_sigwinch;
SIG_ATOMIC_T cleanup_nested;
bool init_signals;
bool init_screen;
char *comp_sourcename;
char *comp_termtype;
bool have_tic_directory;
bool keep_tic_directory;
const char *tic_directory;
char *dbi_list;
int dbi_size;
char *first_name;
char **keyname_table;
int init_keyname;
int slk_format;
int getstr_limit; /* getstr_limit based on POSIX LINE_MAX */
char *safeprint_buf;
size_t safeprint_used;
TGETENT_CACHE tgetent_cache[TGETENT_MAX];
int tgetent_index;
long tgetent_sequence;
char *dbd_blob; /* string-heap for dbd_list[] */
char **dbd_list; /* distinct places to look for data */
int dbd_size; /* length of dbd_list[] */
time_t dbd_time; /* cache last updated */
ITERATOR_VARS dbd_vars[dbdLAST];
#if HAVE_TSEARCH
void *cached_tparm;
int count_tparm;
#endif /* HAVE_TSEARCH */
#ifdef USE_TERM_DRIVER
int (*term_driver)(struct DriverTCB*, const char*, int*);
#endif
#ifndef USE_SP_WINDOWLIST
WINDOWLIST *_nc_windowlist;
#define WindowList(sp) _nc_globals._nc_windowlist
#endif
#if USE_HOME_TERMINFO
char *home_terminfo;
#endif
#if !USE_SAFE_SPRINTF
int safeprint_cols;
int safeprint_rows;
#endif
#ifdef USE_PTHREADS
pthread_mutex_t mutex_curses;
pthread_mutex_t mutex_prescreen;
pthread_mutex_t mutex_screen;
pthread_mutex_t mutex_update;
pthread_mutex_t mutex_tst_tracef;
pthread_mutex_t mutex_tracef;
int nested_tracef;
int use_pthreads;
#define _nc_use_pthreads _nc_globals.use_pthreads
#if USE_PTHREADS_EINTR
pthread_t read_thread; /* The reading thread */
#endif
#endif
#if USE_WIDEC_SUPPORT
char key_name[MB_LEN_MAX + 1];
#endif
#ifdef TRACE
bool trace_opened;
char trace_fname[PATH_MAX];
int trace_level;
FILE *trace_fp;
int trace_fd;
char *tracearg_buf;
size_t tracearg_used;
TRACEBUF *tracebuf_ptr;
size_t tracebuf_used;
char tracechr_buf[40];
char *tracedmp_buf;
size_t tracedmp_used;
unsigned char *tracetry_buf;
size_t tracetry_used;
char traceatr_color_buf[2][80];
int traceatr_color_sel;
int traceatr_color_last;
#if !defined(USE_PTHREADS) && USE_REENTRANT
int nested_tracef;
#endif
#endif /* TRACE */
#if NO_LEAKS
bool leak_checking;
#endif
} NCURSES_GLOBALS;
extern NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals;
#define N_RIPS 5
/* The limit reserves one byte for a terminating NUL */
#define my_getstr_limit (_nc_globals.getstr_limit - 1)
#define _nc_getstr_limit(n) \
@ -1057,54 +877,6 @@ extern NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals;
? my_getstr_limit \
: (n)))
#ifdef USE_PTHREADS
typedef struct _prescreen_list {
struct _prescreen_list *next;
pthread_t id;
struct screen *sp;
} PRESCREEN_LIST;
#endif
/*
* Global data which can be swept up into a SCREEN when one is created.
* It may be modified before the next SCREEN is created.
*/
typedef struct {
#ifdef USE_PTHREADS
PRESCREEN_LIST *allocated;
#else
struct screen * allocated;
#endif
bool use_env;
bool filter_mode;
attr_t previous_attr;
TPARM_STATE tparm_state;
TTY *saved_tty; /* savetty/resetty information */
bool use_tioctl;
NCURSES_SP_OUTC _outch; /* output handler if not putc */
#ifndef USE_SP_RIPOFF
ripoff_t rippedoff[N_RIPS];
ripoff_t *rsp;
#endif
#if NCURSES_NO_PADDING
bool _no_padding; /* flag to set if padding disabled */
#endif
#if BROKEN_LINKER || USE_REENTRANT
chtype *real_acs_map;
int _LINES;
int _COLS;
int _TABSIZE;
int _ESCDELAY;
TERMINAL *_cur_term;
#endif
#ifdef TRACE
#if BROKEN_LINKER || USE_REENTRANT
long _outchars;
const char *_tputs_trace;
#endif
#endif
} NCURSES_PRESCREEN;
/*
* Use screen-specific ripoff data (for softkeys) rather than global.
*/

View File

@ -2805,6 +2805,19 @@ NCURSES_BOOL _nc_is_file_path(
int _nc_env_access(void)
{ return(*(int *)0); }
#undef _nc_safe_fopen
FILE *_nc_safe_fopen(
const char *path,
const char *mode)
{ return(*(FILE **)0); }
#undef _nc_safe_open3
int _nc_safe_open3(
const char *path,
int flags,
mode_t mode)
{ return(*(int *)0); }
/* ./tinfo/add_tries.c */
#undef _nc_add_to_try
@ -3615,6 +3628,7 @@ int _nc_tparm_err;
#undef _nc_tparm_analyze
int _nc_tparm_analyze(
TERMINAL *term,
const char *string,
char **p_is_s,
int *_nc_popcount)
@ -3639,6 +3653,11 @@ char *_nc_tiparm(
...)
{ return(*(char **)0); }
#undef _nc_reset_tparm
void _nc_reset_tparm(
TERMINAL *term)
{ /* void */ }
/* ./tinfo/lib_tputs.c */
#undef PC
@ -4201,7 +4220,7 @@ ENTRY *_nc_copy_entry(
#undef _nc_save_str
char *_nc_save_str(
const char *const string)
const char *string)
{ return(*(char **)0); }
#undef _nc_wrap_entry

View File

@ -2814,6 +2814,19 @@ NCURSES_BOOL _nc_is_file_path(
int _nc_env_access(void)
{ return(*(int *)0); }
#undef _nc_safe_fopen
FILE *_nc_safe_fopen(
const char *path,
const char *mode)
{ return(*(FILE **)0); }
#undef _nc_safe_open3
int _nc_safe_open3(
const char *path,
int flags,
mode_t mode)
{ return(*(int *)0); }
/* ./tinfo/add_tries.c */
#undef _nc_add_to_try
@ -3700,6 +3713,7 @@ int _nc_tparm_err;
#undef _nc_tparm_analyze
int _nc_tparm_analyze(
TERMINAL *term,
const char *string,
char **p_is_s,
int *_nc_popcount)
@ -3724,6 +3738,11 @@ char *_nc_tiparm(
...)
{ return(*(char **)0); }
#undef _nc_reset_tparm
void _nc_reset_tparm(
TERMINAL *term)
{ /* void */ }
/* ./tinfo/lib_tputs.c */
#undef PC
@ -4322,7 +4341,7 @@ ENTRY *_nc_copy_entry(
#undef _nc_save_str
char *_nc_save_str(
const char *const string)
const char *string)
{ return(*(char **)0); }
#undef _nc_wrap_entry

View File

@ -3753,6 +3753,19 @@ NCURSES_BOOL _nc_is_file_path(
int _nc_env_access(void)
{ return(*(int *)0); }
#undef _nc_safe_fopen
FILE *_nc_safe_fopen(
const char *path,
const char *mode)
{ return(*(FILE **)0); }
#undef _nc_safe_open3
int _nc_safe_open3(
const char *path,
int flags,
mode_t mode)
{ return(*(int *)0); }
/* ./tinfo/add_tries.c */
#undef _nc_add_to_try
@ -4661,6 +4674,7 @@ int _nc_tparm_err;
#undef _nc_tparm_analyze
int _nc_tparm_analyze(
TERMINAL *term,
const char *string,
char **p_is_s,
int *_nc_popcount)
@ -4685,6 +4699,11 @@ char *_nc_tiparm(
...)
{ return(*(char **)0); }
#undef _nc_reset_tparm
void _nc_reset_tparm(
TERMINAL *term)
{ /* void */ }
/* ./tinfo/lib_tputs.c */
#undef PC
@ -5323,7 +5342,7 @@ ENTRY *_nc_copy_entry(
#undef _nc_save_str
char *_nc_save_str(
const char *const string)
const char *string)
{ return(*(char **)0); }
#undef _nc_wrap_entry

View File

@ -3744,6 +3744,19 @@ NCURSES_BOOL _nc_is_file_path(
int _nc_env_access(void)
{ return(*(int *)0); }
#undef _nc_safe_fopen
FILE *_nc_safe_fopen(
const char *path,
const char *mode)
{ return(*(FILE **)0); }
#undef _nc_safe_open3
int _nc_safe_open3(
const char *path,
int flags,
mode_t mode)
{ return(*(int *)0); }
/* ./tinfo/add_tries.c */
#undef _nc_add_to_try
@ -4576,6 +4589,7 @@ int _nc_tparm_err;
#undef _nc_tparm_analyze
int _nc_tparm_analyze(
TERMINAL *term,
const char *string,
char **p_is_s,
int *_nc_popcount)
@ -4600,6 +4614,11 @@ char *_nc_tiparm(
...)
{ return(*(char **)0); }
#undef _nc_reset_tparm
void _nc_reset_tparm(
TERMINAL *term)
{ /* void */ }
/* ./tinfo/lib_tputs.c */
#undef PC
@ -5202,7 +5221,7 @@ ENTRY *_nc_copy_entry(
#undef _nc_save_str
char *_nc_save_str(
const char *const string)
const char *string)
{ return(*(char **)0); }
#undef _nc_wrap_entry

View File

@ -48,7 +48,7 @@ ENTRY *_nc_copy_entry(
#undef _nc_save_str
char *_nc_save_str(
const char *const string)
const char *string)
{ return(*(char **)0); }
#undef _nc_wrap_entry

View File

@ -48,7 +48,7 @@ ENTRY *_nc_copy_entry(
#undef _nc_save_str
char *_nc_save_str(
const char *const string)
const char *string)
{ return(*(char **)0); }
#undef _nc_wrap_entry

View File

@ -48,7 +48,7 @@ ENTRY *_nc_copy_entry(
#undef _nc_save_str
char *_nc_save_str(
const char *const string)
const char *string)
{ return(*(char **)0); }
#undef _nc_wrap_entry

View File

@ -48,7 +48,7 @@ ENTRY *_nc_copy_entry(
#undef _nc_save_str
char *_nc_save_str(
const char *const string)
const char *string)
{ return(*(char **)0); }
#undef _nc_wrap_entry

View File

@ -76,6 +76,19 @@ NCURSES_BOOL _nc_is_file_path(
int _nc_env_access(void)
{ return(*(int *)0); }
#undef _nc_safe_fopen
FILE *_nc_safe_fopen(
const char *path,
const char *mode)
{ return(*(FILE **)0); }
#undef _nc_safe_open3
int _nc_safe_open3(
const char *path,
int flags,
mode_t mode)
{ return(*(int *)0); }
/* ./tinfo/add_tries.c */
#undef _nc_add_to_try
@ -886,6 +899,7 @@ int _nc_tparm_err;
#undef _nc_tparm_analyze
int _nc_tparm_analyze(
TERMINAL *term,
const char *string,
char **p_is_s,
int *_nc_popcount)
@ -910,6 +924,11 @@ char *_nc_tiparm(
...)
{ return(*(char **)0); }
#undef _nc_reset_tparm
void _nc_reset_tparm(
TERMINAL *term)
{ /* void */ }
/* ./tinfo/lib_tputs.c */
#undef PC

View File

@ -76,6 +76,19 @@ NCURSES_BOOL _nc_is_file_path(
int _nc_env_access(void)
{ return(*(int *)0); }
#undef _nc_safe_fopen
FILE *_nc_safe_fopen(
const char *path,
const char *mode)
{ return(*(FILE **)0); }
#undef _nc_safe_open3
int _nc_safe_open3(
const char *path,
int flags,
mode_t mode)
{ return(*(int *)0); }
/* ./tinfo/add_tries.c */
#undef _nc_add_to_try
@ -962,6 +975,7 @@ int _nc_tparm_err;
#undef _nc_tparm_analyze
int _nc_tparm_analyze(
TERMINAL *term,
const char *string,
char **p_is_s,
int *_nc_popcount)
@ -986,6 +1000,11 @@ char *_nc_tiparm(
...)
{ return(*(char **)0); }
#undef _nc_reset_tparm
void _nc_reset_tparm(
TERMINAL *term)
{ /* void */ }
/* ./tinfo/lib_tputs.c */
#undef PC

View File

@ -76,6 +76,19 @@ NCURSES_BOOL _nc_is_file_path(
int _nc_env_access(void)
{ return(*(int *)0); }
#undef _nc_safe_fopen
FILE *_nc_safe_fopen(
const char *path,
const char *mode)
{ return(*(FILE **)0); }
#undef _nc_safe_open3
int _nc_safe_open3(
const char *path,
int flags,
mode_t mode)
{ return(*(int *)0); }
/* ./tinfo/add_tries.c */
#undef _nc_add_to_try
@ -984,6 +997,7 @@ int _nc_tparm_err;
#undef _nc_tparm_analyze
int _nc_tparm_analyze(
TERMINAL *term,
const char *string,
char **p_is_s,
int *_nc_popcount)
@ -1008,6 +1022,11 @@ char *_nc_tiparm(
...)
{ return(*(char **)0); }
#undef _nc_reset_tparm
void _nc_reset_tparm(
TERMINAL *term)
{ /* void */ }
/* ./tinfo/lib_tputs.c */
#undef PC

View File

@ -76,6 +76,19 @@ NCURSES_BOOL _nc_is_file_path(
int _nc_env_access(void)
{ return(*(int *)0); }
#undef _nc_safe_fopen
FILE *_nc_safe_fopen(
const char *path,
const char *mode)
{ return(*(FILE **)0); }
#undef _nc_safe_open3
int _nc_safe_open3(
const char *path,
int flags,
mode_t mode)
{ return(*(int *)0); }
/* ./tinfo/add_tries.c */
#undef _nc_add_to_try
@ -908,6 +921,7 @@ int _nc_tparm_err;
#undef _nc_tparm_analyze
int _nc_tparm_analyze(
TERMINAL *term,
const char *string,
char **p_is_s,
int *_nc_popcount)
@ -932,6 +946,11 @@ char *_nc_tiparm(
...)
{ return(*(char **)0); }
#undef _nc_reset_tparm
void _nc_reset_tparm(
TERMINAL *term)
{ /* void */ }
/* ./tinfo/lib_tputs.c */
#undef PC

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2018,2020 Thomas E. Dickey *
* Copyright 2018-2020,2021 Thomas E. Dickey *
* Copyright 2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -34,13 +34,20 @@
/*
* Common type definitions and macros for new_pair.c, lib_color.c
*
* $Id: new_pair.h,v 1.11 2020/04/11 16:43:47 tom Exp $
* $Id: new_pair.h,v 1.12 2021/08/18 19:18:12 tom Exp $
*/
#ifndef NEW_PAIR_H
#define NEW_PAIR_H 1
/* *INDENT-OFF* */
#include <ncurses_cfg.h>
#include <ncurses_dll.h>
#include <sys/types.h>
typedef struct screen SCREEN;
#define LIMIT_TYPED(n,t) \
(t)(((n) > MAX_OF_TYPE(t)) \
? MAX_OF_TYPE(t) \

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2018,2020 Thomas E. Dickey *
* Copyright 2018-2020,2021 Thomas E. Dickey *
* Copyright 2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -33,7 +33,7 @@
#include <curses.priv.h>
MODULE_ID("$Id: report_offsets.c,v 1.21 2020/02/02 23:34:34 tom Exp $")
MODULE_ID("$Id: report_offsets.c,v 1.22 2021/08/19 19:51:33 tom Exp $")
#define show_size(type) \
flag = 0; \
@ -175,6 +175,7 @@ main(void)
show_offset(TERMINAL, Nttyb);
show_offset(TERMINAL, _baudrate);
show_offset(TERMINAL, _termname);
show_offset(TERMINAL, tparm_state);
#if HAVE_INIT_EXTENDED_COLOR
show_COLORS(TERMINAL, type2);
#endif
@ -186,6 +187,15 @@ main(void)
show_OPTION(TERMTYPE, ext_Strings);
#endif
printf("\n");
show_size(TPARM_STATE);
show_offset(TPARM_STATE, stack);
show_offset(TPARM_STATE, stack_ptr);
show_offset(TPARM_STATE, out_buff);
show_offset(TPARM_STATE, fmt_buff);
show_offset(TPARM_STATE, static_vars);
show_TRACES(TPARM_STATE, tname);
printf("\n");
show_size(WINDOW);
show_WIDECH(WINDOW, _bkgrnd);
@ -194,6 +204,11 @@ main(void)
printf("\n");
show_size(NCURSES_GLOBALS);
show_offset(NCURSES_GLOBALS, init_signals);
show_offset(NCURSES_GLOBALS, tgetent_cache);
show_offset(NCURSES_GLOBALS, dbd_vars);
#if HAVE_TSEARCH
show_offset(NCURSES_GLOBALS, cached_tparm);
#endif
show_DRIVER(NCURSES_GLOBALS, term_driver);
show_NORMAL(NCURSES_GLOBALS, _nc_windowlist);
#if USE_HOME_TERMINFO
@ -212,10 +227,13 @@ main(void)
printf("\n");
show_size(NCURSES_PRESCREEN);
show_offset(NCURSES_PRESCREEN, tparm_state);
show_offset(NCURSES_PRESCREEN, saved_tty);
show_offset(NCURSES_PRESCREEN, use_tioctl);
show_offset(NCURSES_PRESCREEN, _outch);
#ifndef USE_SP_RIPOFF
show_NORMAL(NCURSES_PRESCREEN, rippedoff);
#endif
#if NCURSES_NO_PADDING
show_OPTION(NCURSES_PRESCREEN, _no_padding);
#endif
@ -224,6 +242,9 @@ main(void)
#else
show_REENTR(NCURSES_PRESCREEN, real_acs_map);
#endif
#if BROKEN_LINKER || USE_REENTRANT
show_TRACES(NCURSES_PRESCREEN, _outchars);
#endif
return EXIT_SUCCESS;
}

330
ncurses/term.priv.h Normal file
View File

@ -0,0 +1,330 @@
/****************************************************************************
* Copyright 2021 Thomas E. Dickey *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "Software"), to deal in the Software without restriction, including *
* without limitation the rights to use, copy, modify, merge, publish, *
* distribute, distribute with modifications, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included *
* in all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/*
* $Id: term.priv.h,v 1.4 2021/08/19 20:02:09 tom Exp $
*
* term.priv.h
*
* Header file for terminfo library objects which are private to
* the library.
*
*/
#ifndef _TERM_PRIV_H
#define _TERM_PRIV_H 1
/* *INDENT-OFF* */
#ifdef __cplusplus
extern "C" {
#endif
#include <ncurses_cfg.h>
#undef NCURSES_OPAQUE
#define NCURSES_INTERNALS 1
#define NCURSES_OPAQUE 0
#include <limits.h> /* PATH_MAX */
#include <signal.h> /* sig_atomic_t */
#include <time.h> /* time_t */
#include <term.h> /* time_t */
/*
* State of tparm().
*/
#define STACKSIZE 20
typedef struct {
union {
int num;
char * str;
} data;
bool num_type;
} STACK_FRAME;
#define NUM_VARS 26
typedef struct {
const char * tparam_base;
STACK_FRAME stack[STACKSIZE];
int stack_ptr;
char * out_buff;
size_t out_size;
size_t out_used;
char * fmt_buff;
size_t fmt_size;
int static_vars[NUM_VARS];
#ifdef TRACE
const char * tname;
#endif
} TPARM_STATE;
typedef struct {
char * text;
size_t size;
} TRACEBUF;
typedef struct {
const char * name;
char * value;
} ITERATOR_VARS;
/*
* Internals for term.h
*/
#if NCURSES_EXT_COLORS
typedef struct termtype2 TERMTYPE2;
#endif
typedef struct term { /* describe an actual terminal */
TERMTYPE type; /* terminal type description */
short Filedes; /* file description being written to */
TTY Ottyb; /* original state of the terminal */
TTY Nttyb; /* current state of the terminal */
int _baudrate; /* used to compute padding */
char * _termname; /* used for termname() */
TPARM_STATE tparm_state;
#if NCURSES_EXT_COLORS
TERMTYPE2 type2; /* extended terminal type description */
#endif
} TERMINAL;
/*
* Internals for soft-keys
*/
typedef struct {
WINDOW * win; /* the window used in the hook */
int line; /* lines to take, < 0 => from bottom*/
int (*hook)(WINDOW *, int); /* callback for user */
} ripoff_t;
/*
* Internals for tgetent
*/
typedef struct {
long sequence;
bool last_used;
char * fix_sgr0; /* this holds the filtered sgr0 string */
char * last_bufp; /* help with fix_sgr0 leak */
TERMINAL * last_term;
} TGETENT_CACHE;
#define TGETENT_MAX 4
#include <term_entry.h> /* dbdLAST */
#ifdef USE_TERM_DRIVER
struct DriverTCB; /* Terminal Control Block forward declaration */
#endif
/*
* Global data which is not specific to a screen.
*/
typedef struct {
SIG_ATOMIC_T have_sigtstp;
SIG_ATOMIC_T have_sigwinch;
SIG_ATOMIC_T cleanup_nested;
bool init_signals;
bool init_screen;
char * comp_sourcename;
char * comp_termtype;
bool have_tic_directory;
bool keep_tic_directory;
const char * tic_directory;
char * dbi_list;
int dbi_size;
char * first_name;
char ** keyname_table;
int init_keyname;
int slk_format;
int getstr_limit; /* getstr_limit based on POSIX LINE_MAX */
char * safeprint_buf;
size_t safeprint_used;
TGETENT_CACHE tgetent_cache[TGETENT_MAX];
int tgetent_index;
long tgetent_sequence;
char * dbd_blob; /* string-heap for dbd_list[] */
char ** dbd_list; /* distinct places to look for data */
int dbd_size; /* length of dbd_list[] */
time_t dbd_time; /* cache last updated */
ITERATOR_VARS dbd_vars[dbdLAST];
#if HAVE_TSEARCH
void * cached_tparm;
int count_tparm;
#endif /* HAVE_TSEARCH */
#ifdef USE_TERM_DRIVER
int (*term_driver)(struct DriverTCB*, const char*, int*);
#endif
#define WINDOWLIST struct _win_list
#ifndef USE_SP_WINDOWLIST
WINDOWLIST * _nc_windowlist;
#define WindowList(sp) _nc_globals._nc_windowlist
#endif
#if USE_HOME_TERMINFO
char * home_terminfo;
#endif
#if !USE_SAFE_SPRINTF
int safeprint_cols;
int safeprint_rows;
#endif
#ifdef USE_PTHREADS
pthread_mutex_t mutex_curses;
pthread_mutex_t mutex_prescreen;
pthread_mutex_t mutex_screen;
pthread_mutex_t mutex_update;
pthread_mutex_t mutex_tst_tracef;
pthread_mutex_t mutex_tracef;
int nested_tracef;
int use_pthreads;
#define _nc_use_pthreads _nc_globals.use_pthreads
#if USE_PTHREADS_EINTR
pthread_t read_thread; /* The reading thread */
#endif
#endif
#if USE_WIDEC_SUPPORT
char key_name[MB_LEN_MAX + 1];
#endif
#ifdef TRACE
bool trace_opened;
char trace_fname[PATH_MAX];
int trace_level;
FILE * trace_fp;
int trace_fd;
char * tracearg_buf;
size_t tracearg_used;
TRACEBUF * tracebuf_ptr;
size_t tracebuf_used;
char tracechr_buf[40];
char * tracedmp_buf;
size_t tracedmp_used;
unsigned char * tracetry_buf;
size_t tracetry_used;
char traceatr_color_buf[2][80];
int traceatr_color_sel;
int traceatr_color_last;
#if !defined(USE_PTHREADS) && USE_REENTRANT
int nested_tracef;
#endif
#endif /* TRACE */
#if NO_LEAKS
bool leak_checking;
#endif
} NCURSES_GLOBALS;
extern NCURSES_EXPORT_VAR(NCURSES_GLOBALS) _nc_globals;
#define N_RIPS 5
#ifdef USE_PTHREADS
typedef struct _prescreen_list {
struct _prescreen_list *next;
pthread_t id;
struct screen * sp;
} PRESCREEN_LIST;
#endif
/*
* Global data which can be swept up into a SCREEN when one is created.
* It may be modified before the next SCREEN is created.
*/
typedef struct {
#ifdef USE_PTHREADS
PRESCREEN_LIST *allocated;
#else
struct screen * allocated;
#endif
bool use_env;
bool filter_mode;
attr_t previous_attr;
TPARM_STATE tparm_state;
TTY * saved_tty; /* savetty/resetty information */
bool use_tioctl;
NCURSES_SP_OUTC _outch; /* output handler if not putc */
#ifndef USE_SP_RIPOFF
ripoff_t rippedoff[N_RIPS];
ripoff_t * rsp;
#endif
#if NCURSES_NO_PADDING
bool _no_padding; /* flag to set if padding disabled */
#endif
#if BROKEN_LINKER || USE_REENTRANT
chtype * real_acs_map;
int _LINES;
int _COLS;
int _TABSIZE;
int _ESCDELAY;
TERMINAL * _cur_term;
#endif
#ifdef TRACE
#if BROKEN_LINKER || USE_REENTRANT
long _outchars;
const char * _tputs_trace;
#endif
#endif
} NCURSES_PRESCREEN;
extern NCURSES_EXPORT_VAR(NCURSES_PRESCREEN) _nc_prescreen;
#ifdef __cplusplus
}
#endif
/* *INDENT-ON* */
#endif /* _TERM_PRIV_H */

View File

@ -43,7 +43,7 @@
#include <curses.priv.h>
MODULE_ID("$Id: lib_data.c,v 1.81 2020/06/13 22:01:14 tom Exp $")
MODULE_ID("$Id: lib_data.c,v 1.84 2021/08/19 08:01:33 tom Exp $")
/*
* OS/2's native linker complains if we don't initialize public data when
@ -251,7 +251,6 @@ NCURSES_EXPORT_VAR(NCURSES_PRESCREEN) _nc_prescreen = {
NULL, /* fmt_buff */
0, /* fmt_size */
NUM_VARS_0s, /* dynamic_var */
NUM_VARS_0s, /* static_vars */
#ifdef TRACE
NULL, /* tname */

View File

@ -53,7 +53,7 @@
#include <ctype.h>
#include <tic.h>
MODULE_ID("$Id: lib_tparm.c,v 1.131 2021/04/03 22:05:59 tom Exp $")
MODULE_ID("$Id: lib_tparm.c,v 1.134 2021/08/21 21:52:08 tom Exp $")
/*
* char *
@ -117,9 +117,14 @@ MODULE_ID("$Id: lib_tparm.c,v 1.131 2021/04/03 22:05:59 tom Exp $")
NCURSES_EXPORT_VAR(int) _nc_tparm_err = 0;
#define TPS(var) _nc_prescreen.tparm_state.var
#define TPS(var) tps->var
#define popcount _nc_popcount /* workaround for NetBSD 6.0 defect */
#define get_tparm_state(term) \
(term != NULL \
? &(term->tparm_state) \
: &(_nc_prescreen.tparm_state))
#define isUPPER(c) ((c) >= 'A' && (c) <= 'Z')
#define isLOWER(c) ((c) >= 'a' && (c) <= 'z')
#define tc_BUMP() if (level < 0 && number < 2) number++
@ -171,6 +176,7 @@ visit_nodes(const void *nodep, const VISIT which, const int depth)
NCURSES_EXPORT(void)
_nc_free_tparm(void)
{
TPARM_STATE *tps = get_tparm_state(cur_term); /* FIXME */
#if HAVE_TSEARCH
if (MyCount != 0) {
delete_tparm = typeCalloc(TPARM_DATA *, MyCount);
@ -200,105 +206,156 @@ _nc_free_tparm(void)
}
#endif
static NCURSES_INLINE void
get_space(size_t need)
static int
tparm_error(TPARM_STATE *tps, const char *message)
{
need += TPS(out_used);
if (need > TPS(out_size)) {
TPS(out_size) = need * 2;
TYPE_REALLOC(char, TPS(out_size), TPS(out_buff));
}
DEBUG(2, ("%s: %s", message, _nc_visbuf(TPS(tparam_base))));
return ++_nc_tparm_err;
}
static NCURSES_INLINE void
save_text(const char *fmt, const char *s, int len)
{
size_t s_len = (size_t) len + strlen(s) + strlen(fmt);
get_space(s_len + 1);
_nc_SPRINTF(TPS(out_buff) + TPS(out_used),
_nc_SLIMIT(TPS(out_size) - TPS(out_used))
fmt, s);
TPS(out_used) += strlen(TPS(out_buff) + TPS(out_used));
#define get_space(tps, need) \
{ \
size_t need2get = need + TPS(out_used); \
if (need2get > TPS(out_size)) { \
TPS(out_size) = need2get * 2; \
TYPE_REALLOC(char, TPS(out_size), TPS(out_buff)); \
} \
}
#if NCURSES_EXPANDED
static NCURSES_INLINE void
save_number(const char *fmt, int number, int len)
{
size_t s_len = (size_t) len + 30 + strlen(fmt);
get_space(s_len + 1);
_nc_SPRINTF(TPS(out_buff) + TPS(out_used),
_nc_SLIMIT(TPS(out_size) - TPS(out_used))
fmt, number);
TPS(out_used) += strlen(TPS(out_buff) + TPS(out_used));
(get_space) (TPARM_STATE *tps, size_t need) {
get_space(tps, need);
}
static NCURSES_INLINE void
save_char(int c)
{
if (c == 0)
c = 0200;
get_space((size_t) 1);
TPS(out_buff)[TPS(out_used)++] = (char) c;
#undef get_space
#endif
#define save_text(tps, fmt, s, len) \
{ \
size_t s_len = (size_t) len + strlen(s) + strlen(fmt); \
get_space(tps, s_len + 1); \
_nc_SPRINTF(TPS(out_buff) + TPS(out_used), \
_nc_SLIMIT(TPS(out_size) - TPS(out_used)) \
fmt, s); \
TPS(out_used) += strlen(TPS(out_buff) + TPS(out_used)); \
}
#if NCURSES_EXPANDED
static NCURSES_INLINE void
npush(int x)
{
if (TPS(stack_ptr) < STACKSIZE) {
TPS(stack)[TPS(stack_ptr)].num_type = TRUE;
TPS(stack)[TPS(stack_ptr)].data.num = x;
TPS(stack_ptr)++;
} else {
DEBUG(2, ("npush: stack overflow: %s", _nc_visbuf(TPS(tparam_base))));
_nc_tparm_err++;
}
(save_text) (TPARM_STATE *tps, const char *fmt, const char *s, int len) {
save_text(tps, fmt, s, len);
}
#undef save_text
#endif
#define save_number(tps, fmt, number, len) \
{ \
size_t s_len = (size_t) len + 30 + strlen(fmt); \
get_space(tps, s_len + 1); \
_nc_SPRINTF(TPS(out_buff) + TPS(out_used), \
_nc_SLIMIT(TPS(out_size) - TPS(out_used)) \
fmt, number); \
TPS(out_used) += strlen(TPS(out_buff) + TPS(out_used)); \
}
#if NCURSES_EXPANDED
static NCURSES_INLINE void
(save_number) (TPARM_STATE *tps, const char *fmt, int number, int len) {
save_number(tps, fmt, number, len);
}
#undef save_number
#endif
#define save_char(tps, c) \
{ \
get_space(tps, (size_t) 1); \
TPS(out_buff)[TPS(out_used)++] = (char) ((c == 0) ? 0200 : c); \
}
#if NCURSES_EXPANDED
static NCURSES_INLINE void
(save_char) (TPARM_STATE *tps, int c) {
save_char(tps, c);
}
#undef save_char
#endif
#define npush(tps, x) \
{ \
if (TPS(stack_ptr) < STACKSIZE) { \
TPS(stack)[TPS(stack_ptr)].num_type = TRUE; \
TPS(stack)[TPS(stack_ptr)].data.num = x; \
TPS(stack_ptr)++; \
} else { \
(void) tparm_error(tps, "npush: stack overflow"); \
} \
}
#if NCURSES_EXPANDED
static NCURSES_INLINE void
(npush) (TPARM_STATE *tps, int x) {
npush(tps, x);
}
#undef npush
#endif
#define spush(tps, x) \
{ \
if (TPS(stack_ptr) < STACKSIZE) { \
TPS(stack)[TPS(stack_ptr)].num_type = FALSE; \
TPS(stack)[TPS(stack_ptr)].data.str = x; \
TPS(stack_ptr)++; \
} else { \
(void) tparm_error(tps, "spush: stack overflow"); \
} \
}
#if NCURSES_EXPANDED
static NCURSES_INLINE void
(spush) (TPARM_STATE *tps, char *x) {
spush(tps, x);
}
#undef spush
#endif
#define npop(tps) \
((TPS(stack_ptr)-- > 0) \
? ((TPS(stack)[TPS(stack_ptr)].num_type) \
? TPS(stack)[TPS(stack_ptr)].data.num \
: 0) \
: (tparm_error(tps, "npop: stack underflow"), \
TPS(stack_ptr) = 0))
#if NCURSES_EXPANDED
static NCURSES_INLINE int
npop(void)
{
int result = 0;
if (TPS(stack_ptr) > 0) {
TPS(stack_ptr)--;
if (TPS(stack)[TPS(stack_ptr)].num_type)
result = TPS(stack)[TPS(stack_ptr)].data.num;
} else {
DEBUG(2, ("npop: stack underflow: %s", _nc_visbuf(TPS(tparam_base))));
_nc_tparm_err++;
}
return result;
(npop) (TPARM_STATE *tps) {
return npop(tps);
}
#undef npop
#endif
static NCURSES_INLINE void
spush(char *x)
{
if (TPS(stack_ptr) < STACKSIZE) {
TPS(stack)[TPS(stack_ptr)].num_type = FALSE;
TPS(stack)[TPS(stack_ptr)].data.str = x;
TPS(stack_ptr)++;
} else {
DEBUG(2, ("spush: stack overflow: %s", _nc_visbuf(TPS(tparam_base))));
_nc_tparm_err++;
}
}
#define spop(tps) \
((TPS(stack_ptr)-- > 0) \
? ((!TPS(stack)[TPS(stack_ptr)].num_type \
&& TPS(stack)[TPS(stack_ptr)].data.str != 0) \
? TPS(stack)[TPS(stack_ptr)].data.str \
: dummy) \
: (tparm_error(tps, "spop: stack underflow"), \
dummy))
#if NCURSES_EXPANDED
static NCURSES_INLINE char *
spop(void)
{
char *result = dummy;
if (TPS(stack_ptr) > 0) {
TPS(stack_ptr)--;
if (!TPS(stack)[TPS(stack_ptr)].num_type
&& TPS(stack)[TPS(stack_ptr)].data.str != 0)
result = TPS(stack)[TPS(stack_ptr)].data.str;
} else {
DEBUG(2, ("spop: stack underflow: %s", _nc_visbuf(TPS(tparam_base))));
_nc_tparm_err++;
}
return result;
(spop) (TPARM_STATE *tps) {
return spop(tps);
}
#undef spop
#endif
static NCURSES_INLINE const char *
parse_format(const char *s, char *format, int *len)
@ -407,8 +464,9 @@ parse_format(const char *s, char *format, int *len)
* may be cases that we cannot see the explicit parameter numbers.
*/
NCURSES_EXPORT(int)
_nc_tparm_analyze(const char *string, char **p_is_s, int *popcount)
_nc_tparm_analyze(TERMINAL *term, const char *string, char **p_is_s, int *popcount)
{
TPARM_STATE *tps = get_tparm_state(term);
size_t len2;
int i;
int lastpop = -1;
@ -541,8 +599,9 @@ _nc_tparm_analyze(const char *string, char **p_is_s, int *popcount)
* TODO: cache the result so that this is done once per capability per term.
*/
static int
tparm_setup(const char *string, TPARM_DATA * result)
tparm_setup(TERMINAL *term, const char *string, TPARM_DATA *result)
{
TPARM_STATE *tps = get_tparm_state(term);
int rc = OK;
TPS(out_used) = 0;
@ -558,8 +617,15 @@ tparm_setup(const char *string, TPARM_DATA * result)
result->format = string;
if ((ft = tfind(result, &MyCache, cmp_format)) != 0) {
size_t len2;
fs = *(TPARM_DATA **) ft;
*result = *fs;
if ((len2 = strlen(string)) + 2 > TPS(fmt_size)) {
TPS(fmt_size) += len2 + 2;
TPS(fmt_buff) = typeRealloc(char, TPS(fmt_size), TPS(fmt_buff));
if (TPS(fmt_buff) == 0)
return ERR;
}
} else
#endif
{
@ -568,7 +634,7 @@ tparm_setup(const char *string, TPARM_DATA * result)
* string. Use this value to limit the number of arguments copied
* from the variable-length argument list.
*/
result->num_parsed = _nc_tparm_analyze(string,
result->num_parsed = _nc_tparm_analyze(term, string,
result->p_is_s,
&(result->num_popped));
if (TPS(fmt_buff) == 0) {
@ -619,7 +685,7 @@ tparm_setup(const char *string, TPARM_DATA * result)
* long's, which is consistent with our va_arg() usage.
*/
static void
tparm_copy_valist(TPARM_DATA * data, int use_TPARM_ARG, va_list ap)
tparm_copy_valist(TPARM_DATA *data, int use_TPARM_ARG, va_list ap)
{
int i;
@ -646,7 +712,7 @@ tparm_copy_valist(TPARM_DATA * data, int use_TPARM_ARG, va_list ap)
* will expand termcap strings OK.
*/
static bool
tparm_tc_compat(TPARM_DATA * data)
tparm_tc_compat(TPARM_STATE *tps, TPARM_DATA *data)
{
bool termcap_hack = FALSE;
@ -657,10 +723,11 @@ tparm_tc_compat(TPARM_DATA * data)
termcap_hack = TRUE;
for (i = data->num_parsed - 1; i >= 0; i--) {
if (data->p_is_s[i])
spush(data->p_is_s[i]);
else
npush((int) data->param[i]);
if (data->p_is_s[i]) {
spush(tps, data->p_is_s[i]);
} else {
npush(tps, (int) data->param[i]);
}
}
}
return termcap_hack;
@ -668,20 +735,20 @@ tparm_tc_compat(TPARM_DATA * data)
#ifdef TRACE
static void
tparm_trace_call(const char *string, TPARM_DATA * data)
tparm_trace_call(TPARM_STATE *tps, const char *string, TPARM_DATA *data)
{
if (USE_TRACEF(TRACE_CALLS)) {
int i;
for (i = 0; i < data->num_actual; i++) {
if (data->p_is_s[i] != 0) {
save_text(", %s", _nc_visbuf(data->p_is_s[i]), 0);
save_text(tps, ", %s", _nc_visbuf(data->p_is_s[i]), 0);
} else if ((long) data->param[i] > MAX_OF_TYPE(NCURSES_INT2) ||
(long) data->param[i] < 0) {
_tracef("BUG: problem with tparm parameter #%d of %d",
i + 1, data->num_actual);
break;
} else {
save_number(", %d", (int) data->param[i], 0);
save_number(tps, ", %d", (int) data->param[i], 0);
}
}
_tracef(T_CALLED("%s(%s%s)"), TPS(tname), _nc_visbuf(string), TPS(out_buff));
@ -691,27 +758,49 @@ tparm_trace_call(const char *string, TPARM_DATA * data)
}
#else
#define tparm_trace_call(string, data) /* nothing */
#define tparm_trace_call(tps, string, data) /* nothing */
#endif /* TRACE */
#define init_vars(name) \
if (!name##_used) { \
name##_used = TRUE; \
memset(name##_vars, 0, sizeof(name##_vars)); \
}
static NCURSES_INLINE char *
tparam_internal(const char *string, TPARM_DATA * data)
tparam_internal(TPARM_STATE *tps, const char *string, TPARM_DATA *data)
{
int number;
int len;
int level;
int x, y;
int i;
const char *s;
const char *cp = string;
size_t len2 = strlen(cp);
bool incremented_two = FALSE;
bool termcap_hack = tparm_tc_compat(data);
bool termcap_hack = tparm_tc_compat(tps, data);
/*
* SVr4 curses stores variables 'A' to 'Z' in the TERMINAL structure (so
* they are initialized once to zero), and variables 'a' to 'z' on the
* stack in tparm, referring to the former as "static" and the latter as
* "dynamic". However, it makes no check to ensure that the "dynamic"
* variables are initialized.
*
* Solaris xpg4 curses makes no distinction between the upper/lower, and
* stores the common set of 26 variables on the stack, without initializing
* them.
*
* In ncurses, both sets of variables are initialized on the first use.
*/
bool dynamic_used = FALSE;
int dynamic_vars[NUM_VARS];
tparm_trace_call(string, data);
tparm_trace_call(tps, string, data);
while ((cp - string) < (int) len2) {
if (*cp != '%') {
save_char(UChar(*cp));
save_char(tps, UChar(*cp));
} else {
TPS(tparam_base) = cp++;
cp = parse_format(cp, TPS(fmt_buff), &len);
@ -719,40 +808,44 @@ tparam_internal(const char *string, TPARM_DATA * data)
default:
break;
case '%':
save_char('%');
save_char(tps, '%');
break;
case 'd': /* FALLTHRU */
case 'o': /* FALLTHRU */
case 'x': /* FALLTHRU */
case 'X': /* FALLTHRU */
save_number(TPS(fmt_buff), npop(), len);
x = npop(tps);
save_number(tps, TPS(fmt_buff), x, len);
break;
case 'c': /* FALLTHRU */
save_char(npop());
x = npop(tps);
save_char(tps, x);
break;
#ifdef EXP_XTERM_1005
case 'u':
{
unsigned char target[10];
unsigned source = (unsigned) npop();
unsigned source = (unsigned) npop(tps);
int rc = _nc_conv_to_utf8(target, source, (unsigned)
sizeof(target));
int n;
for (n = 0; n < rc; ++n) {
save_char(target[n]);
save_char(tps, target[n]);
}
}
break;
#endif
case 'l':
npush((int) strlen(spop()));
s = spop(tps);
npush(tps, (int) strlen(s));
break;
case 's':
save_text(TPS(fmt_buff), spop(), len);
s = spop(tps);
save_text(tps, TPS(fmt_buff), s, len);
break;
case 'p':
@ -760,9 +853,9 @@ tparam_internal(const char *string, TPARM_DATA * data)
i = (UChar(*cp) - '1');
if (i >= 0 && i < NUM_PARM) {
if (data->p_is_s[i]) {
spush(data->p_is_s[i]);
spush(tps, data->p_is_s[i]);
} else {
npush((int) data->param[i]);
npush(tps, (int) data->param[i]);
}
}
break;
@ -771,10 +864,11 @@ tparam_internal(const char *string, TPARM_DATA * data)
cp++;
if (isUPPER(*cp)) {
i = (UChar(*cp) - 'A');
TPS(static_vars)[i] = npop();
TPS(static_vars)[i] = npop(tps);
} else if (isLOWER(*cp)) {
i = (UChar(*cp) - 'a');
TPS(dynamic_var)[i] = npop();
init_vars(dynamic);
dynamic_vars[i] = npop(tps);
}
break;
@ -782,16 +876,17 @@ tparam_internal(const char *string, TPARM_DATA * data)
cp++;
if (isUPPER(*cp)) {
i = (UChar(*cp) - 'A');
npush(TPS(static_vars)[i]);
npush(tps, TPS(static_vars)[i]);
} else if (isLOWER(*cp)) {
i = (UChar(*cp) - 'a');
npush(TPS(dynamic_var)[i]);
init_vars(dynamic);
npush(tps, dynamic_vars[i]);
}
break;
case S_QUOTE:
cp++;
npush(UChar(*cp));
npush(tps, UChar(*cp));
cp++;
break;
@ -802,83 +897,95 @@ tparam_internal(const char *string, TPARM_DATA * data)
number = (number * 10) + (UChar(*cp) - '0');
cp++;
}
npush(number);
npush(tps, number);
break;
case '+':
npush(npop() + npop());
y = npop(tps);
x = npop(tps);
npush(tps, x + y);
break;
case '-':
y = npop();
x = npop();
npush(x - y);
y = npop(tps);
x = npop(tps);
npush(tps, x - y);
break;
case '*':
npush(npop() * npop());
y = npop(tps);
x = npop(tps);
npush(tps, x * y);
break;
case '/':
y = npop();
x = npop();
npush(y ? (x / y) : 0);
y = npop(tps);
x = npop(tps);
npush(tps, y ? (x / y) : 0);
break;
case 'm':
y = npop();
x = npop();
npush(y ? (x % y) : 0);
y = npop(tps);
x = npop(tps);
npush(tps, y ? (x % y) : 0);
break;
case 'A':
y = npop();
x = npop();
npush(y && x);
y = npop(tps);
x = npop(tps);
npush(tps, y && x);
break;
case 'O':
y = npop();
x = npop();
npush(y || x);
y = npop(tps);
x = npop(tps);
npush(tps, y || x);
break;
case '&':
npush(npop() & npop());
y = npop(tps);
x = npop(tps);
npush(tps, x & y);
break;
case '|':
npush(npop() | npop());
y = npop(tps);
x = npop(tps);
npush(tps, x | y);
break;
case '^':
npush(npop() ^ npop());
y = npop(tps);
x = npop(tps);
npush(tps, x ^ y);
break;
case '=':
y = npop();
x = npop();
npush(x == y);
y = npop(tps);
x = npop(tps);
npush(tps, x == y);
break;
case '<':
y = npop();
x = npop();
npush(x < y);
y = npop(tps);
x = npop(tps);
npush(tps, x < y);
break;
case '>':
y = npop();
x = npop();
npush(x > y);
y = npop(tps);
x = npop(tps);
npush(tps, x > y);
break;
case '!':
npush(!npop());
x = npop(tps);
npush(tps, !x);
break;
case '~':
npush(~npop());
x = npop(tps);
npush(tps, ~x);
break;
case 'i':
@ -908,7 +1015,7 @@ tparam_internal(const char *string, TPARM_DATA * data)
break;
case 't':
x = npop();
x = npop(tps);
if (!x) {
/* scan forward for %e or %; at level zero */
cp++;
@ -967,7 +1074,7 @@ tparam_internal(const char *string, TPARM_DATA * data)
cp++;
} /* endwhile (*cp) */
get_space((size_t) 1);
get_space(tps, (size_t) 1);
TPS(out_buff)[TPS(out_used)] = '\0';
if (TPS(stack_ptr) && !_nc_tparm_err) {
@ -986,22 +1093,23 @@ tparam_internal(const char *string, TPARM_DATA * data)
NCURSES_EXPORT(char *)
tparm(const char *string, ...)
{
TPARM_STATE *tps = get_tparm_state(cur_term);
TPARM_DATA myData;
char *result = NULL;
_nc_tparm_err = 0;
#ifdef TRACE
TPS(tname) = "tparm";
tps->tname = "tparm";
#endif /* TRACE */
if (tparm_setup(string, &myData) == OK) {
if (tparm_setup(cur_term, string, &myData) == OK) {
va_list ap;
va_start(ap, string);
tparm_copy_valist(&myData, TRUE, ap);
va_end(ap);
result = tparam_internal(string, &myData);
result = tparam_internal(tps, string, &myData);
}
return result;
}
@ -1020,15 +1128,16 @@ tparm(const char *string,
TPARM_ARG a8,
TPARM_ARG a9)
{
TPARM_STATE *tps = get_tparm_state(cur_term);
TPARM_DATA myData;
char *result = NULL;
_nc_tparm_err = 0;
#ifdef TRACE
TPS(tname) = "tparm";
tps->tname = "tparm";
#endif /* TRACE */
if (tparm_setup(string, &myData) == OK) {
if (tparm_setup(cur_term, string, &myData) == OK) {
myData.param[0] = a1;
myData.param[1] = a2;
@ -1040,7 +1149,7 @@ tparm(const char *string,
myData.param[7] = a8;
myData.param[8] = a9;
result = tparam_internal(string, &myData);
result = tparam_internal(tps, string, &myData);
}
return result;
}
@ -1050,22 +1159,23 @@ tparm(const char *string,
NCURSES_EXPORT(char *)
tiparm(const char *string, ...)
{
TPARM_STATE *tps = get_tparm_state(cur_term);
TPARM_DATA myData;
char *result = NULL;
_nc_tparm_err = 0;
#ifdef TRACE
TPS(tname) = "tiparm";
tps->tname = "tiparm";
#endif /* TRACE */
if (tparm_setup(string, &myData) == OK) {
if (tparm_setup(cur_term, string, &myData) == OK) {
va_list ap;
va_start(ap, string);
tparm_copy_valist(&myData, FALSE, ap);
va_end(ap);
result = tparam_internal(string, &myData);
result = tparam_internal(tps, string, &myData);
}
return result;
}
@ -1076,15 +1186,16 @@ tiparm(const char *string, ...)
NCURSES_EXPORT(char *)
_nc_tiparm(int expected, const char *string, ...)
{
TPARM_STATE *tps = get_tparm_state(cur_term);
TPARM_DATA myData;
char *result = NULL;
_nc_tparm_err = 0;
#ifdef TRACE
TPS(tname) = "_nc_tiparm";
tps->tname = "_nc_tiparm";
#endif /* TRACE */
if (tparm_setup(string, &myData) == OK
if (tparm_setup(cur_term, string, &myData) == OK
&& myData.num_actual <= expected
&& myData.tparm_type == 0) {
va_list ap;
@ -1093,7 +1204,18 @@ _nc_tiparm(int expected, const char *string, ...)
tparm_copy_valist(&myData, FALSE, ap);
va_end(ap);
result = tparam_internal(string, &myData);
result = tparam_internal(tps, string, &myData);
}
return result;
}
/*
* Improve tic's checks by resetting the terminfo "static variables" before
* calling functions which may update them.
*/
NCURSES_EXPORT(void)
_nc_reset_tparm(TERMINAL *term)
{
TPARM_STATE *tps = get_tparm_state(term);
memset(TPS(static_vars), 0, sizeof(TPS(static_vars)));
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2020 Thomas E. Dickey *
* Copyright 2020,2021 Thomas E. Dickey *
* Copyright 1998-2011,2015 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -40,7 +40,7 @@
#define USE_TERMLIB 1
#include <build.priv.h>
MODULE_ID("$Id: make_keys.c,v 1.22 2020/02/02 23:34:34 tom Exp $")
MODULE_ID("$Id: make_keys.c,v 1.23 2021/08/18 20:55:25 tom Exp $")
#include <names.c>
@ -128,11 +128,13 @@ main(int argc, char *argv[])
{
static const char *prefix[] =
{
"#ifndef NCU_KEYS_H",
"#define NCU_KEYS_H 1",
"#ifndef _INIT_KEYTRY_H",
"#define _INIT_KEYTRY_H 1",
"",
"/* This file was generated by MAKE_KEYS */",
"",
"#include <tic.h>",
"",
"#if BROKEN_LINKER",
"static",
"#endif",
@ -143,7 +145,7 @@ main(int argc, char *argv[])
{
"\t{ 0, 0} };",
"",
"#endif /* NCU_KEYS_H */",
"#endif /* _INIT_KEYTRY_H */",
0
};

View File

@ -51,7 +51,7 @@
#define TRACE_NUM(n) /* nothing */
#endif
MODULE_ID("$Id: write_entry.c,v 1.117 2021/06/26 20:43:19 tom Exp $")
MODULE_ID("$Id: write_entry.c,v 1.118 2021/08/15 20:07:11 tom Exp $")
static int total_written;
static int total_parts;
@ -190,7 +190,7 @@ make_db_root(const char *path)
#else
struct stat statbuf;
if ((rc = stat(path, &statbuf)) < 0) {
if ((rc = stat(path, &statbuf)) == -1) {
rc = mkdir(path
#ifndef _NC_WINDOWS
,0777
@ -442,7 +442,7 @@ _nc_write_entry(TERMTYPE2 *const tp)
write_file(filename, tp);
if (start_time == 0) {
if (stat(filename, &statbuf) < 0
if (stat(filename, &statbuf) == -1
|| (start_time = statbuf.st_mtime) == 0) {
_nc_syserr_abort("error obtaining time from %s/%s",
_nc_tic_dir(0), filename);

View File

@ -85,7 +85,7 @@
#include <ctype.h>
MODULE_ID("$Id: tty_update.c,v 1.310 2021/02/06 14:24:38 tom Exp $")
MODULE_ID("$Id: tty_update.c,v 1.311 2021/08/16 21:51:11 tom Exp $")
/*
* This define controls the line-breakout optimization. Every once in a
@ -1325,8 +1325,8 @@ TransformLine(NCURSES_SP_DCLx int const lineno)
newPair = GetPair(newLine[n]);
if (oldPair != newPair
&& unColor(oldLine[n]) == unColor(newLine[n])) {
if (oldPair < SP_PARM->_pair_limit
&& newPair < SP_PARM->_pair_limit
if (oldPair < SP_PARM->_pair_alloc
&& newPair < SP_PARM->_pair_alloc
&& (isSamePair(SP_PARM->_color_pairs[oldPair],
SP_PARM->_color_pairs[newPair]))) {
SetPair(oldLine[n], GetPair(newLine[n]));

View File

@ -59,6 +59,16 @@
* Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c
*/
#ifndef _WCWIDTH_H_incl
#define _WCWIDTH_H_incl 1
#ifdef __cplusplus
extern "C" {
#endif
#include <ncurses_cfg.h>
#include <ncurses_dll.h>
#include <wchar.h>
struct interval {
@ -310,3 +320,9 @@ NCURSES_EXPORT(int) mk_wcswidth_cjk(const wchar_t *pwcs, size_t n)
return width;
}
#ifdef __cplusplus
}
#endif
#endif /* _WCWIDTH_H_incl 1 */

View File

@ -1,8 +1,8 @@
ncurses6 (6.2+20210814) unstable; urgency=low
ncurses6 (6.2+20210821) unstable; urgency=low
* latest weekly patch
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 14 Aug 2021 06:38:41 -0400
-- Thomas E. Dickey <dickey@invisible-island.net> Mon, 16 Aug 2021 03:57:50 -0400
ncurses6 (5.9-20131005) unstable; urgency=low

View File

@ -1,8 +1,8 @@
ncurses6 (6.2+20210814) unstable; urgency=low
ncurses6 (6.2+20210821) unstable; urgency=low
* latest weekly patch
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 14 Aug 2021 06:38:41 -0400
-- Thomas E. Dickey <dickey@invisible-island.net> Mon, 16 Aug 2021 03:57:50 -0400
ncurses6 (5.9-20131005) unstable; urgency=low

View File

@ -1,8 +1,8 @@
ncurses6 (6.2+20210814) unstable; urgency=low
ncurses6 (6.2+20210821) unstable; urgency=low
* latest weekly patch
-- Thomas E. Dickey <dickey@invisible-island.net> Sat, 14 Aug 2021 06:38:41 -0400
-- Thomas E. Dickey <dickey@invisible-island.net> Mon, 16 Aug 2021 03:57:50 -0400
ncurses6 (5.9-20120608) unstable; urgency=low

View File

@ -1,4 +1,4 @@
; $Id: mingw-ncurses.nsi,v 1.472 2021/08/14 10:38:41 tom Exp $
; $Id: mingw-ncurses.nsi,v 1.473 2021/08/21 14:10:10 tom Exp $
; TODO add examples
; TODO bump ABI to 6
@ -10,7 +10,7 @@
!define VERSION_MAJOR "6"
!define VERSION_MINOR "2"
!define VERSION_YYYY "2021"
!define VERSION_MMDD "0814"
!define VERSION_MMDD "0821"
!define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD}
!define MY_ABI "5"

View File

@ -3,7 +3,7 @@
Summary: shared libraries for terminal handling
Name: mingw32-ncurses6
Version: 6.2
Release: 20210814
Release: 20210821
License: X11
Group: Development/Libraries
Source: ncurses-%{version}-%{release}.tgz

View File

@ -1,4 +1,4 @@
# $Id: ncurses.map,v 1.53 2021/06/26 20:31:59 tom Exp $
# $Id: ncurses.map,v 1.54 2021/08/19 23:49:21 tom Exp $
# script for shared library symbol-versioning using ld
#
# This file was generated by ncu-mapsyms
@ -1210,6 +1210,7 @@ NCURSES_TINFO_6.2.20200212 {
NCURSES_TINFO_6.2.current {
global:
_nc_reset_tparm;
_nc_safe_fopen;
_nc_safe_open3;
_nc_tiparm;

View File

@ -1,7 +1,7 @@
Summary: shared libraries for terminal handling
Name: ncurses6
Version: 6.2
Release: 20210814
Release: 20210821
License: X11
Group: Development/Libraries
Source: ncurses-%{version}-%{release}.tgz

View File

@ -1,4 +1,4 @@
# $Id: ncurses.sym,v 1.36 2021/06/26 20:31:59 tom Exp $
# $Id: ncurses.sym,v 1.37 2021/08/19 23:50:26 tom Exp $
# script for shared library symbol-visibility using libtool
#
# This file was generated by ncu-mapsyms
@ -176,6 +176,7 @@ _nc_read_entry_source
_nc_read_file_entry
_nc_read_termtype
_nc_reset_input
_nc_reset_tparm
_nc_resolve_uses
_nc_resolve_uses2
_nc_retrace_attr_t

View File

@ -1,4 +1,4 @@
# $Id: ncursest.map,v 1.51 2021/06/26 20:31:59 tom Exp $
# $Id: ncursest.map,v 1.52 2021/08/19 23:49:21 tom Exp $
# script for shared library symbol-versioning using ld
#
# This file was generated by ncu-mapsyms
@ -489,6 +489,7 @@ NCURSES_TINFO_6.2.20200212 {
NCURSES_TINFO_6.2.current {
global:
_nc_reset_tparm;
_nc_safe_fopen;
_nc_safe_open3;
_nc_tiparm;

View File

@ -1,7 +1,7 @@
Summary: Curses library with POSIX thread support.
Name: ncursest6
Version: 6.2
Release: 20210814
Release: 20210821
License: X11
Group: Development/Libraries
Source: ncurses-%{version}-%{release}.tgz

View File

@ -1,4 +1,4 @@
# $Id: ncursest.sym,v 1.40 2021/06/26 20:36:37 tom Exp $
# $Id: ncursest.sym,v 1.41 2021/08/19 23:50:26 tom Exp $
# script for shared library symbol-visibility using libtool
#
# This file was generated by ncu-mapsyms
@ -183,6 +183,7 @@ _nc_read_entry_source
_nc_read_file_entry
_nc_read_termtype
_nc_reset_input
_nc_reset_tparm
_nc_resolve_uses
_nc_resolve_uses2
_nc_retrace_attr_t

View File

@ -1,4 +1,4 @@
# $Id: ncursestw.map,v 1.54 2021/06/26 20:31:59 tom Exp $
# $Id: ncursestw.map,v 1.55 2021/08/19 23:49:21 tom Exp $
# script for shared library symbol-versioning using ld
#
# This file was generated by ncu-mapsyms
@ -495,6 +495,7 @@ NCURSES_TINFO_6.2.20200212 {
NCURSES_TINFO_6.2.current {
global:
_nc_reset_tparm;
_nc_tiparm;
_nc_safe_fopen;
_nc_safe_open3;

View File

@ -1,4 +1,4 @@
# $Id: ncursestw.sym,v 1.40 2021/06/26 20:31:59 tom Exp $
# $Id: ncursestw.sym,v 1.41 2021/08/19 23:50:26 tom Exp $
# script for shared library symbol-visibility using libtool
#
# This file was generated by ncu-mapsyms
@ -183,6 +183,7 @@ _nc_read_entry_source
_nc_read_file_entry
_nc_read_termtype
_nc_reset_input
_nc_reset_tparm
_nc_resolve_uses
_nc_resolve_uses2
_nc_retrace_attr_t

View File

@ -1,4 +1,4 @@
# $Id: ncursesw.map,v 1.57 2021/06/26 20:31:59 tom Exp $
# $Id: ncursesw.map,v 1.58 2021/08/19 23:49:21 tom Exp $
# script for shared library symbol-versioning using ld
#
# This file was generated by ncu-mapsyms
@ -489,6 +489,7 @@ NCURSES_TINFO_6.2.20200212 {
NCURSES_TINFO_6.2.current {
global:
_nc_reset_tparm;
_nc_tiparm;
_nc_safe_fopen;
_nc_safe_open3;

View File

@ -1,4 +1,4 @@
# $Id: ncursesw.sym,v 1.39 2021/06/26 20:31:59 tom Exp $
# $Id: ncursesw.sym,v 1.40 2021/08/19 23:50:26 tom Exp $
# script for shared library symbol-visibility using libtool
#
# This file was generated by ncu-mapsyms
@ -172,6 +172,7 @@ _nc_read_entry_source
_nc_read_file_entry
_nc_read_termtype
_nc_reset_input
_nc_reset_tparm
_nc_resolve_uses
_nc_resolve_uses2
_nc_retrace_attr_t

View File

@ -40,7 +40,7 @@
#include <termsort.h> /* this C file is generated */
#include <parametrized.h> /* so is this */
MODULE_ID("$Id: dump_entry.c,v 1.187 2021/06/12 22:06:55 tom Exp $")
MODULE_ID("$Id: dump_entry.c,v 1.188 2021/08/15 20:00:48 tom Exp $")
#define DISCARD(string) string = ABSENT_STRING
#define PRINTF (void) printf
@ -85,7 +85,7 @@ static int indent = 8;
/* cover various ports and variants of terminfo */
#define V_ALLCAPS 0 /* all capabilities (SVr4, XSI, ncurses) */
#define V_SVR1 1 /* SVR1, Ultrix */
#define V_HPUX 2 /* HP/UX */
#define V_HPUX 2 /* HP-UX */
#define V_AIX 3 /* AIX */
#define V_BSD 4 /* BSD */

View File

@ -49,7 +49,7 @@
#include <parametrized.h>
#include <transform.h>
MODULE_ID("$Id: tic.c,v 1.296 2021/06/26 19:44:08 tom Exp $")
MODULE_ID("$Id: tic.c,v 1.301 2021/08/21 00:24:45 tom Exp $")
#define STDIN_NAME "<stdin>"
@ -458,7 +458,7 @@ open_input(const char *filename, char *alt_file)
if (!strcmp(filename, "-")) {
fp = copy_input(stdin, STDIN_NAME, alt_file);
} else if (stat(filename, &sb) < 0) {
} else if (stat(filename, &sb) == -1) {
fprintf(stderr, "%s: %s %s\n", _nc_progname, filename, strerror(errno));
ExitProgram(EXIT_FAILURE);
} else if ((mode = (sb.st_mode & S_IFMT)) == S_IFDIR
@ -1922,19 +1922,63 @@ is_user_capability(const char *name)
return result;
}
static bool
line_capability(const char *name)
{
bool result = FALSE;
static const char *table[] =
{
"csr", /* change_scroll_region */
"clear", /* clear_screen */
"ed", /* clr_eos */
"cwin", /* create_window */
"cup", /* cursor_address */
"cud1", /* cursor_down */
"home", /* cursor_home */
"mrcup", /* cursor_mem_address */
"ll", /* cursor_to_ll */
"cuu1", /* cursor_up */
"dl1", /* delete_line */
"hd", /* down_half_line */
"flash", /* flash_screen */
"ff", /* form_feed */
"il1", /* insert_line */
"nel", /* newline */
"dl", /* parm_delete_line */
"cud", /* parm_down_cursor */
"indn", /* parm_index */
"il", /* parm_insert_line */
"rin", /* parm_rindex */
"cuu", /* parm_up_cursor */
"mc0", /* print_screen */
"vpa", /* row_address */
"ind", /* scroll_forward */
"ri", /* scroll_reverse */
"hu", /* up_half_line */
};
size_t n;
for (n = 0; n < SIZEOF(table); ++n) {
if (!strcmp(name, table[n])) {
result = TRUE;
break;
}
}
return result;
}
/*
* Make a quick sanity check for the parameters which are used in the given
* strings. If there are no "%p" tokens, then there should be no other "%"
* markers.
*/
static void
check_params(TERMTYPE2 *tp, const char *name, char *value, int extended)
check_params(TERMTYPE2 *tp, const char *name, const char *value, int extended)
{
int expected = expected_params(name);
int actual = 0;
int n;
bool params[1 + NUM_PARM];
char *s = value;
const char *s = value;
#ifdef set_top_margin_parm
if (!strcmp(name, "smgbp")
@ -2000,10 +2044,11 @@ check_params(TERMTYPE2 *tp, const char *name, char *value, int extended)
* may not have been fully translated. Also, tparm does its own analysis.
* Report differences here.
*/
_nc_reset_tparm(NULL);
if (actual >= 0) {
char *p_is_s[NUM_PARM];
int popcount;
int analyzed = _nc_tparm_analyze(value, p_is_s, &popcount);
int analyzed = _nc_tparm_analyze(NULL, value, p_is_s, &popcount);
if (analyzed < popcount) {
analyzed = popcount;
}
@ -2021,52 +2066,32 @@ check_params(TERMTYPE2 *tp, const char *name, char *value, int extended)
_nc_warning("tparm analyzed %d parameters for %s, expected %d",
analyzed, name, actual);
}
}
}
}
} else if (expected > 0
&& actual == expected
&& guess_tparm_type(expected, p_is_s) == Numbers) {
int limit = 1;
static bool
line_capability(const char *name)
{
bool result = FALSE;
static const char *table[] =
{
"csr", /* change_scroll_region */
"clear", /* clear_screen */
"ed", /* clr_eos */
"cwin", /* create_window */
"cup", /* cursor_address */
"cud1", /* cursor_down */
"home", /* cursor_home */
"mrcup", /* cursor_mem_address */
"ll", /* cursor_to_ll */
"cuu1", /* cursor_up */
"dl1", /* delete_line */
"hd", /* down_half_line */
"flash", /* flash_screen */
"ff", /* form_feed */
"il1", /* insert_line */
"nel", /* newline */
"dl", /* parm_delete_line */
"cud", /* parm_down_cursor */
"indn", /* parm_index */
"il", /* parm_insert_line */
"rin", /* parm_rindex */
"cuu", /* parm_up_cursor */
"mc0", /* print_screen */
"vpa", /* row_address */
"ind", /* scroll_forward */
"ri", /* scroll_reverse */
"hu", /* up_half_line */
};
size_t n;
for (n = 0; n < SIZEOF(table); ++n) {
if (!strcmp(name, table[n])) {
result = TRUE;
break;
if (!strcmp(name, "setf")
|| !strcmp(name, "setb")
|| !strcmp(name, "setaf")
|| !strcmp(name, "setab")) {
if ((limit = max_colors) > 256)
limit = 256;
} else if (line_capability(name)) {
limit = 24;
} else if (is_user_capability(name) < 0) {
limit = 80;
}
for (n = 0; n < limit; ++n) {
_nc_reset_tparm(NULL);
(void) TPARM_9(value, n, n, n, n, n, n, n, n, n);
if (_nc_tparm_err)
_nc_warning("problem%s in tparm(%s, %d, ...)",
(_nc_tparm_err == 1) ? "" : "s",
name, n);
}
}
}
return result;
}
/*
@ -2206,8 +2231,9 @@ check_1_infotocap(const char *name, NCURSES_CONST char *value, int count)
next += strlen(next) + 1;
}
_nc_reset_tparm(NULL);
expect = tparm_type(name);
nparam = _nc_tparm_analyze(value, p_is_s, &ignored);
nparam = _nc_tparm_analyze(NULL, value, p_is_s, &ignored);
actual = guess_tparm_type(nparam, p_is_s);
if (expect != actual) {
@ -2215,6 +2241,7 @@ check_1_infotocap(const char *name, NCURSES_CONST char *value, int count)
actual = Other;
}
_nc_reset_tparm(NULL);
switch (actual) {
case Num_Str:
result = TPARM_2(value, numbers[1], strings[2]);
@ -2403,8 +2430,8 @@ check_infotocap(TERMTYPE2 *tp, int i, const char *value)
|| !strcmp(name, "setb")
|| !strcmp(name, "setaf")
|| !strcmp(name, "setab")) {
if ((limit = max_colors) > 16)
limit = 16;
if ((limit = max_colors) > 256)
limit = 256;
}
for (count = 0; count < limit; ++count) {
char *ti_check = check_1_infotocap(name, ti_value, count);

View File

@ -47,7 +47,7 @@
#include <transform.h>
#include <tty_settings.h>
MODULE_ID("$Id: tput.c,v 1.90 2021/04/18 17:18:19 tom Exp $")
MODULE_ID("$Id: tput.c,v 1.91 2021/08/21 00:24:45 tom Exp $")
#define PUTS(s) fputs(s, stdout)
@ -278,7 +278,7 @@ tput_cmd(int fd, TTY * saved_settings, bool opt_x, int argc, char *argv[])
case Other:
/* FALLTHRU */
default:
(void) _nc_tparm_analyze(s, p_is_s, &ignored);
(void) _nc_tparm_analyze(NULL, s, p_is_s, &ignored);
#define myParam(n) (p_is_s[n - 1] != 0 ? ((TPARM_ARG) strings[n]) : numbers[n])
s = TPARM_9(s,
myParam(1),

View File

@ -30,7 +30,7 @@
/*
* Author: Thomas E. Dickey (1998-on)
*
* $Id: ditto.c,v 1.51 2021/04/17 17:39:43 tom Exp $
* $Id: ditto.c,v 1.52 2021/08/15 20:07:11 tom Exp $
*
* The program illustrates how to set up multiple screens from a single
* program.
@ -182,7 +182,7 @@ open_tty(char *path)
#else
struct stat sb;
if (stat(path, &sb) < 0)
if (stat(path, &sb) == -1)
failed(path);
if ((sb.st_mode & S_IFMT) != S_IFCHR) {
errno = ENOTTY;