ncurses 6.2 - patch 20211002

+ use return-value from vsnprintf to reallocate as needed to allow for
  buffers larger than the screen size (report by "_RuRo_").
+ modify tset "-q" option to refrain from modifying terminal modes, to
  match the documentation.
+ add section on margins to terminfo.5, adapted from X/Open Curses.
+ make tput/tset warning messages consistently using alias names when
  those are used, rather than the underlying program's name.
+ improve tput usage message for aliases such as clear, by eliminating
  tput-specific portions.
+ add a check in toe to ensure that a "termcap file" is text rather
  than binary.
+ further build-fixes for OpenBSD 6.9, whose header files differ from
  the other BSDs.
This commit is contained in:
Thomas E. Dickey 2021-10-03 00:30:14 +00:00
parent f6b436c4fb
commit f9994a48d2
38 changed files with 410 additions and 118 deletions

17
NEWS
View File

@ -26,7 +26,7 @@
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
-- $Id: NEWS,v 1.3712 2021/09/24 19:45:04 tom Exp $
-- $Id: NEWS,v 1.3717 2021/10/02 22:25:41 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.
20211002
+ use return-value from vsnprintf to reallocate as needed to allow for
buffers larger than the screen size (report by "_RuRo_").
+ modify tset "-q" option to refrain from modifying terminal modes, to
match the documentation.
+ add section on margins to terminfo.5, adapted from X/Open Curses.
+ make tput/tset warning messages consistently using alias names when
those are used, rather than the underlying program's name.
+ improve tput usage message for aliases such as clear, by eliminating
tput-specific portions.
+ add a check in toe to ensure that a "termcap file" is text rather
than binary.
+ further build-fixes for OpenBSD 6.9, whose header files differ from
the other BSDs.
20210925
+ add kbeg to xterm+keypad to accommodate termcap applications -TD
+ add smglp and smgrp to vt420+lrmm, to provide useful data for the

View File

@ -1 +1 @@
5:0:10 6.2 20210925
5:0:10 6.2 20211002

View File

@ -26,7 +26,7 @@
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
# $Id: dist.mk,v 1.1437 2021/09/25 10:32:30 tom Exp $
# $Id: dist.mk,v 1.1438 2021/10/02 08:31:49 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 = 20210925
NCURSES_PATCH = 20211002
# 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 20210925).
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20211002).

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 20210925).
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20211002).
</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 20210925).
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20211002).

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 20210925).
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20211002).

View File

@ -514,7 +514,7 @@
https://invisible-island.net/ncurses/tctest.html
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20210925).
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20211002).
</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 20210925).
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20211002).
</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 20210925).
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20211002).

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 20210925).
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20211002).
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 20210925).
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20211002).

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 20210925).
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20211002).
</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 20210925).
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20211002).

View File

@ -62,7 +62,7 @@
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************
* @Id: terminfo.tail,v 1.106 2021/08/28 19:00:29 tom Exp @
* @Id: terminfo.tail,v 1.107 2021/10/02 20:54:06 tom Exp @
*.in -2
*.in +2
*.in -2
@ -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 20210925).
This manual describes <STRONG>ncurses</STRONG> version 6.2 (patch 20211002).
</PRE><H3><a name="h3-Terminfo-Entry-Syntax">Terminfo Entry Syntax</a></H3><PRE>
@ -1605,6 +1605,107 @@
outputting <STRONG>rmcup</STRONG>), specify <STRONG>nrrmc</STRONG>.
</PRE><H3><a name="h3-Margins">Margins</a></H3><PRE>
SVr4 (and X/Open Curses) list several string capabilities for setting
margins. Two were intended for use with terminals, and another six
were intended for use with printers.
<STRONG>o</STRONG> The two terminal capabilities assume that the terminal may have the
capability of setting the left and/or right margin at the current
cursor column position.
<STRONG>o</STRONG> The printer capabilities assume that the printer may have two types
of capability:
<STRONG>o</STRONG> the ability to set a top and/or bottom margin using the current
line position, and
<STRONG>o</STRONG> parameterized capabilities for setting the top, bottom, left,
right margins given the number of rows or columns.
In practice, the categorization into "terminal" and "printer" is not
suitable:
<STRONG>o</STRONG> The AT&amp;T SVr4 terminal database uses <STRONG>smgl</STRONG> four times, for AT&amp;T
hardware.
Three of the four are printers. They lack the ability to set
left/right margins by specifying the column.
<STRONG>o</STRONG> Other (non-AT&amp;T) terminals may support margins but using different
assumptions from AT&amp;T.
For instance, the DEC VT420 supports left/right margins, but only
using a column parameter. As an added complication, the VT420 uses
two settings to fully enable left/right margins (left/right margin
mode, and origin mode). The former enables the margins, which
causes printed text to wrap within margins, but the latter is
needed to prevent cursor-addressing outside those margins.
<STRONG>o</STRONG> Both DEC VT420 left/right margins are set with a single control
sequence. If either is omitted, the corresponding margin is set to
the left or right edge of the display (rather than leaving the
margin unmodified).
These are the margin-related capabilities:
<STRONG>Name</STRONG> <STRONG>Description</STRONG>
----------------------------------------------
smgl Set left margin at current column
smgr Set right margin at current column
smgb Set bottom margin at current line
smgt Set top margin at current line
smgbp Set bottom margin at line <EM>N</EM>
smglp Set left margin at column <EM>N</EM>
smgrp Set right margin at column <EM>N</EM>
smgtp Set top margin at line <EM>N</EM>
When writing an application that uses these string capabilities, the
pairs should be first checked to see if each capability in the pair is
set or only one is set:
<STRONG>o</STRONG> If both <STRONG>smglp</STRONG> and <STRONG>smgrp</STRONG> are set, each is used with a single
argument, <EM>N</EM>, that gives the column number of the left and right
margin, respectively.
<STRONG>o</STRONG> If both <STRONG>smgtp</STRONG> and <STRONG>smgbp</STRONG> are set, each is used to set the top and
bottom margin, respectively:
<STRONG>o</STRONG> <STRONG>smgtp</STRONG> is used with a single argument, <EM>N</EM>, the line number of the
top margin.
<STRONG>o</STRONG> <STRONG>smgbp</STRONG> is used with two arguments, <EM>N</EM> and <EM>M</EM>, that give the line
number of the bottom margin, the first counting from the top of
the page and the second counting from the bottom. This
accommodates the two styles of specifying the bottom margin in
different manufacturers' printers.
When designing a terminfo entry for a printer that has a settable
bottom margin, only the first or second argument should be used,
depending on the printer. When developing an application that uses
<STRONG>smgbp</STRONG> to set the bottom margin, both arguments must be given.
Conversely, when only one capability in the pair is set:
<STRONG>o</STRONG> If only one of <STRONG>smglp</STRONG> and <STRONG>smgrp</STRONG> is set, then it is used with two
arguments, the column number of the left and right margins, in that
order.
<STRONG>o</STRONG> Likewise, if only one of <STRONG>smgtp</STRONG> and <STRONG>smgbp</STRONG> is set, then it is used
with two arguments that give the top and bottom margins, in that
order, counting from the top of the page.
When designing a terminfo entry for a printer that requires setting
both left and right or top and bottom margins simultaneously, only
one capability in the pairs <STRONG>smglp</STRONG> and <STRONG>smgrp</STRONG> or <STRONG>smgtp</STRONG> and <STRONG>smgbp</STRONG>
should be defined, leaving the other unset.
When setting margins, the line- and column-values are zero-based.
The <STRONG>mgc</STRONG> string capability should be defined. Applications such as
<STRONG><A HREF="tabs.1.html">tabs(1)</A></STRONG> rely upon this to reset all margins.
</PRE><H3><a name="h3-Area-Clears">Area Clears</a></H3><PRE>
If the terminal can clear from the current position to the end of the
line, leaving the cursor where it is, this should be given as <STRONG>el</STRONG>. If
@ -1786,6 +1887,7 @@
<STRONG>tparm</STRONG> <STRONG>parameter</STRONG> <STRONG>attribute</STRONG> <STRONG>escape</STRONG> <STRONG>sequence</STRONG>
none none \E[0m
p1 standout \E[0;1;7m
p2 underline \E[0;4m
p3 reverse \E[0;7m
@ -2114,7 +2216,6 @@
solid square block ACS_BLOCK # 0 0x30
diamond ACS_DIAMOND + ` 0x60
checker board (stipple) ACS_CKBOARD : a 0x61
degree symbol ACS_DEGREE \ f 0x66
plus/minus ACS_PLMINUS # g 0x67
board of squares ACS_BOARD # h 0x68
@ -2132,6 +2233,7 @@
tee pointing right ACS_LTEE + t 0x74
tee pointing left ACS_RTEE + u 0x75
tee pointing up ACS_BTEE + v 0x76
tee pointing down ACS_TTEE + w 0x77
vertical line ACS_VLINE | x 0x78
less-than-or-equal-to ACS_LEQUAL &lt; y 0x79
@ -2565,6 +2667,7 @@
<li><a href="#h3-Basic-Capabilities">Basic Capabilities</a></li>
<li><a href="#h3-Parameterized-Strings">Parameterized Strings</a></li>
<li><a href="#h3-Cursor-Motions">Cursor Motions</a></li>
<li><a href="#h3-Margins">Margins</a></li>
<li><a href="#h3-Area-Clears">Area Clears</a></li>
<li><a href="#h3-Insert_delete-line-and-vertical-motions">Insert/delete line and vertical motions</a></li>
<li><a href="#h3-Insert_Delete-Character">Insert/Delete Character</a></li>

View File

@ -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 20210925).
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20211002).
</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 20210925).
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20211002).

View File

@ -28,7 +28,7 @@
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************
* @Id: tput.1,v 1.71 2021/09/19 00:34:23 tom Exp @
* @Id: tput.1,v 1.72 2021/10/02 21:41:00 tom Exp @
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<HTML>
@ -459,82 +459,83 @@
to analyze nonstandard <EM>capname</EM> operands.
Besides providing more reliable operation than AT&amp;T's utility, a
portability problem is introduced by this analysis. An OpenBSD
portability problem is introduced by this analysis: An OpenBSD
developer adapted the internal library function from ncurses to
allow <STRONG>tput</STRONG> to interpret multiple commands on a line. Portable
port NetBSD's termcap-based <STRONG>tput</STRONG> to terminfo. That had been
modified to interpret multiple commands on a line. Portable
applications should not rely upon this feature; ncurses provides it
to support applications written specifically for OpenBSD.
This implementation (unlike others) can accept both <EM>termcap</EM> and
<EM>terminfo</EM> names for the <EM>capname</EM> feature, if <EM>termcap</EM> support is compiled
in. However, the predefined <EM>termcap</EM> and <EM>terminfo</EM> names have two
<EM>terminfo</EM> names for the <EM>capname</EM> feature, if <EM>termcap</EM> support is compiled
in. However, the predefined <EM>termcap</EM> and <EM>terminfo</EM> names have two
ambiguities in this case (and the <EM>terminfo</EM> name is assumed):
<STRONG>o</STRONG> The <EM>termcap</EM> name <STRONG>dl</STRONG> corresponds to the <EM>terminfo</EM> name <STRONG>dl1</STRONG> (delete
<STRONG>o</STRONG> The <EM>termcap</EM> name <STRONG>dl</STRONG> corresponds to the <EM>terminfo</EM> name <STRONG>dl1</STRONG> (delete
one line).
The <EM>terminfo</EM> name <STRONG>dl</STRONG> corresponds to the <EM>termcap</EM> name <STRONG>DL</STRONG> (delete a
The <EM>terminfo</EM> name <STRONG>dl</STRONG> corresponds to the <EM>termcap</EM> name <STRONG>DL</STRONG> (delete a
given number of lines).
<STRONG>o</STRONG> The <EM>termcap</EM> name <STRONG>ed</STRONG> corresponds to the <EM>terminfo</EM> name <STRONG>rmdc</STRONG> (end
<STRONG>o</STRONG> The <EM>termcap</EM> name <STRONG>ed</STRONG> corresponds to the <EM>terminfo</EM> name <STRONG>rmdc</STRONG> (end
delete mode).
The <EM>terminfo</EM> name <STRONG>ed</STRONG> corresponds to the <EM>termcap</EM> name <STRONG>cd</STRONG> (clear to
The <EM>terminfo</EM> name <STRONG>ed</STRONG> corresponds to the <EM>termcap</EM> name <STRONG>cd</STRONG> (clear to
end of screen).
The <STRONG>longname</STRONG> and <STRONG>-S</STRONG> options, and the parameter-substitution features
used in the <STRONG>cup</STRONG> example, were not supported in BSD curses before
The <STRONG>longname</STRONG> and <STRONG>-S</STRONG> options, and the parameter-substitution features
used in the <STRONG>cup</STRONG> example, were not supported in BSD curses before
4.3reno (1989) or in AT&amp;T/USL curses before SVr4 (1988).
IEEE Std 1003.1/The Open Group Base Specifications Issue 7
(POSIX.1-2008) documents only the operands for <STRONG>clear</STRONG>, <STRONG>init</STRONG> and <STRONG>reset</STRONG>.
IEEE Std 1003.1/The Open Group Base Specifications Issue 7
(POSIX.1-2008) documents only the operands for <STRONG>clear</STRONG>, <STRONG>init</STRONG> and <STRONG>reset</STRONG>.
There are a few interesting observations to make regarding that:
<STRONG>o</STRONG> In this implementation, <STRONG>clear</STRONG> is part of the <EM>capname</EM> support. The
others (<STRONG>init</STRONG> and <STRONG>longname</STRONG>) do not correspond to terminal
<STRONG>o</STRONG> In this implementation, <STRONG>clear</STRONG> is part of the <EM>capname</EM> support. The
others (<STRONG>init</STRONG> and <STRONG>longname</STRONG>) do not correspond to terminal
capabilities.
<STRONG>o</STRONG> Other implementations of <STRONG>tput</STRONG> on SVr4-based systems such as
Solaris, IRIX64 and HPUX as well as others such as AIX and Tru64
Solaris, IRIX64 and HPUX as well as others such as AIX and Tru64
provide support for <EM>capname</EM> operands.
<STRONG>o</STRONG> A few platforms such as FreeBSD recognize termcap names rather than
terminfo capability names in their respective <STRONG>tput</STRONG> commands. Since
2010, NetBSD's <STRONG>tput</STRONG> uses terminfo names. Before that, it (like
2010, NetBSD's <STRONG>tput</STRONG> uses terminfo names. Before that, it (like
FreeBSD) recognized termcap names.
Beginning in 2021, FreeBSD uses the ncurses <STRONG>tput</STRONG>, configured for
Beginning in 2021, FreeBSD uses the ncurses <STRONG>tput</STRONG>, configured for
both terminfo (tested first) and termcap (as a fallback).
Because (apparently) <EM>all</EM> of the certified Unix systems support the full
set of capability names, the reasoning for documenting only a few may
set of capability names, the reasoning for documenting only a few may
not be apparent.
<STRONG>o</STRONG> X/Open Curses Issue 7 documents <STRONG>tput</STRONG> differently, with <EM>capname</EM> and
<STRONG>o</STRONG> X/Open Curses Issue 7 documents <STRONG>tput</STRONG> differently, with <EM>capname</EM> and
the other features used in this implementation.
<STRONG>o</STRONG> That is, there are two standards for <STRONG>tput</STRONG>: POSIX (a subset) and
X/Open Curses (the full implementation). POSIX documents a subset
to avoid the complication of including X/Open Curses and the
<STRONG>o</STRONG> That is, there are two standards for <STRONG>tput</STRONG>: POSIX (a subset) and
X/Open Curses (the full implementation). POSIX documents a subset
to avoid the complication of including X/Open Curses and the
terminal capabilities database.
<STRONG>o</STRONG> While it is certainly possible to write a <STRONG>tput</STRONG> program without
using curses, none of the systems which have a curses
implementation provide a <STRONG>tput</STRONG> utility which does not provide the
<STRONG>o</STRONG> While it is certainly possible to write a <STRONG>tput</STRONG> program without
using curses, none of the systems which have a curses
implementation provide a <STRONG>tput</STRONG> utility which does not provide the
<EM>capname</EM> feature.
X/Open Curses Issue 7 (2009) is the first version to document
utilities. However that part of X/Open Curses does not follow existing
practice (i.e., Unix features documented in SVID 3):
<STRONG>o</STRONG> It assigns exit code 4 to "invalid operand", which may be the same
as <EM>unknown</EM> <EM>capability</EM>. For instance, the source code for Solaris'
<STRONG>o</STRONG> It assigns exit code 4 to "invalid operand", which may be the same
as <EM>unknown</EM> <EM>capability</EM>. For instance, the source code for Solaris'
xcurses uses the term "invalid" in this case.
<STRONG>o</STRONG> It assigns exit code 255 to a numeric variable that is not
<STRONG>o</STRONG> It assigns exit code 255 to a numeric variable that is not
specified in the terminfo database. That likely is a documentation
error, confusing the <STRONG>-1</STRONG> written to the standard output for an
error, confusing the <STRONG>-1</STRONG> written to the standard output for an
absent or cancelled numeric value versus an (unsigned) exit code.
The various Unix systems (AIX, HPUX, Solaris) use the same exit-codes
The various Unix systems (AIX, HPUX, Solaris) use the same exit-codes
as ncurses.
NetBSD curses documents different exit codes which do not correspond to
@ -544,7 +545,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 20210925).
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20211002).

View File

@ -389,7 +389,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 20210925).
This describes <STRONG>ncurses</STRONG> version 6.2 (patch 20211002).

View File

@ -27,7 +27,7 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: terminfo.tail,v 1.106 2021/08/28 19:00:29 tom Exp $
.\" $Id: terminfo.tail,v 1.107 2021/10/02 20:54:06 tom Exp $
.ps +1
.SS User-Defined Capabilities
.
@ -647,6 +647,122 @@ If the \fBsmcup\fP sequence will not restore the screen after an
\fBrmcup\fP sequence is output (to the state prior to outputting
\fBrmcup\fP), specify \fBnrrmc\fP.
.PP
.SS Margins
SVr4 (and X/Open Curses)
list several string capabilities for setting margins.
Two were intended for use with terminals,
and another six were intended for use with printers.
.bP
The two terminal capabilities assume that the terminal may have
the capability of setting the left and/or right margin at the current
cursor column position.
.bP
The printer capabilities assume that the printer may have
two types of capability:
.RS
.bP
the ability to set a top and/or bottom margin using the current
line position, and
.bP
parameterized capabilities for setting the top, bottom, left, right margins
given the number of rows or columns.
.RE
.RE
.PP
In practice, the categorization into \*(``terminal\*('' and \*(``printer\*(''
is not suitable:
.bP
The AT&T SVr4 terminal database uses \fBsmgl\fP four times,
for AT&T hardware.
.IP
Three of the four are printers.
They lack the ability to set left/right margins by specifying the column.
.bP
Other (non-AT&T) terminals may support margins
but using different assumptions from AT&T.
.IP
For instance, the DEC VT420 supports left/right margins,
but only using a column parameter.
As an added complication, the VT420 uses two settings to fully enable
left/right margins (left/right margin mode, and origin mode).
The former enables the margins, which causes printed text
to wrap within margins, but the latter is needed to prevent
cursor-addressing outside those margins.
.bP
Both DEC VT420 left/right margins are set with a single control sequence.
If either is omitted, the corresponding margin is set to the left or
right edge of the display (rather than leaving the margin unmodified).
.PP
These are the margin-related capabilities:
.TS
center;
l l
_ _
lw8 lw18.
\fBName Description\fP
smgl Set left margin at current column
smgr Set right margin at current column
smgb Set bottom margin at current line
smgt Set top margin at current line
smgbp Set bottom margin at line \fIN\fP
smglp Set left margin at column \fIN\fP
smgrp Set right margin at column \fIN\fP
smgtp Set top margin at line \fIN\fP
.TE
.PP
When writing an application that
uses these string capabilities,
the pairs should be first checked to see
if each capability in the pair is set or only one is set:
.bP
If both \fBsmglp\fP and \fBsmgrp\fP are set,
each is used with a single argument, \fIN\fP,
that gives the column number of the left and right margin, respectively.
.bP
If both \fBsmgtp\fP and \fBsmgbp\fP are set,
each is used to set the top and bottom margin,
respectively:
.RS 4
.bP
\fBsmgtp\fP is used with a single argument, \fIN\fP,
the line number of the top margin.
.bP
\fBsmgbp\fP is used with two arguments, \fIN\fP and \fIM\fP,
that give the line number of the bottom margin,
the first counting from the top of the
page and the second counting from the bottom.
This accommodates the two styles of specifying
the bottom margin in different manufacturers' printers.
.RE
.IP
When designing a terminfo entry for a
printer that has a settable bottom margin,
only the first or second argument should be used, depending on the printer.
When developing an application that uses \fBsmgbp\fP to set the bottom margin,
both arguments must be given.
.PP
Conversely, when only one capability in the pair is set:
.bP
If only one of \fBsmglp\fP and \fBsmgrp\fP is set,
then it is used with two arguments,
the column number of the left and right margins, in that order.
.bP
Likewise, if only one of \fBsmgtp\fP and \fBsmgbp\fP is set, then it
is used with two arguments that give the top and bottom margins,
in that order, counting from the top of the page.
.IP
When designing a terminfo entry for a printer that requires setting both
left and right or top and bottom margins simultaneously,
only one capability in the pairs
\fBsmglp\fP and \fBsmgrp\fP or
\fBsmgtp\fP and \fBsmgbp\fP should be defined,
leaving the other unset.
.PP
When setting margins, the line- and column-values are zero-based.
.PP
The \fBmgc\fP string capability should be defined.
Applications such as \fBtabs\fP(1) rely upon this to reset all margins.
.\"
.SS Area Clears
.PP
If the terminal can clear from the current position to the end of the
@ -662,6 +778,7 @@ if a true
.B ed
is not available.)
.PP
.\"
.SS Insert/delete line and vertical motions
.PP
If the terminal can open a new blank line before the line where the cursor

View File

@ -28,7 +28,7 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: tput.1,v 1.71 2021/09/19 00:34:23 tom Exp $
.\" $Id: tput.1,v 1.72 2021/10/02 21:41:00 tom Exp $
.TH @TPUT@ 1 ""
.ds d @TERMINFO@
.ds n 1
@ -518,9 +518,10 @@ the standard \fIcapname\fR operands, and an internal library
function to analyze nonstandard \fIcapname\fR operands.
.IP
Besides providing more reliable operation than AT&T's utility,
a portability problem is introduced by this analysis.
a portability problem is introduced by this analysis:
An OpenBSD developer adapted the internal library function from ncurses
to allow \fBtput\fP to interpret multiple commands on a line.
to port NetBSD's termcap-based \fBtput\fP to terminfo.
That had been modified to interpret multiple commands on a line.
Portable applications should not rely upon this feature;
ncurses provides it to support applications written
specifically for OpenBSD.

View File

@ -2,7 +2,7 @@
#
# MKlib_gen.sh -- generate sources from curses.h macro definitions
#
# ($Id: MKlib_gen.sh,v 1.70 2021/09/24 19:23:20 tom Exp $)
# ($Id: MKlib_gen.sh,v 1.71 2021/09/26 22:08:53 tom Exp $)
#
##############################################################################
# Copyright 2018-2020,2021 Thomas E. Dickey #
@ -470,9 +470,9 @@ END {
if ( value !~ /P_POUNDC/ ) {
gsub(/[ \t]+/," ",value);
sub(/^[0-9a-zA-Z_]+ /,"",value);
sub(/^\* /,"",value);
gsub("struct [0-9a-zA-Z_]+ \*","",value);
gsub(/[0-9a-zA-Z_]+ \* /,"",value);
sub(/^[*][ \t]*/,"",value);
gsub("struct[ \t]*[0-9a-zA-Z_]+[ \t]*[*]","",value);
gsub(/[0-9a-zA-Z_]+[ \t]*[*][ \t]*/,"",value);
gsub(/ (const) /," ",value);
gsub(/ (int|short|attr_t|chtype|wchar_t|NCURSES_BOOL|NCURSES_OUTC|NCURSES_OUTC_sp|va_list) /," ",value);
gsub(/ void /,"",value);

View File

@ -49,7 +49,7 @@
#define CUR SP_TERMTYPE
#endif
MODULE_ID("$Id: lib_color.c,v 1.147 2021/05/08 15:11:48 tom Exp $")
MODULE_ID("$Id: lib_color.c,v 1.148 2021/10/02 22:55:48 tom Exp $")
#ifdef USE_TERM_DRIVER
#define CanChange InfoOf(SP_PARM).canchange
@ -831,7 +831,6 @@ static int
_nc_color_content(SCREEN *sp, int color, int *r, int *g, int *b)
{
int result = ERR;
int maxcolors;
T((T_CALLED("color_content(%p,%d,%p,%p,%p)"),
(void *) sp,
@ -841,7 +840,7 @@ _nc_color_content(SCREEN *sp, int color, int *r, int *g, int *b)
(void *) b));
if (sp != 0) {
maxcolors = MaxColors;
int maxcolors = MaxColors;
if (color >= 0 && OkColorHi(color) && sp->_coloron) {
int c_r, c_g, c_b;

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2018,2020 Thomas E. Dickey *
* Copyright 2018-2020,2021 Thomas E. Dickey *
* Copyright 1998-2012,2013 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -34,7 +34,7 @@
#include <curses.priv.h>
#include <ctype.h>
MODULE_ID("$Id: safe_sprintf.c,v 1.33 2020/02/02 23:34:34 tom Exp $")
MODULE_ID("$Id: safe_sprintf.c,v 1.35 2021/10/03 00:25:09 tom Exp $")
#if USE_SAFE_SPRINTF
@ -223,9 +223,9 @@ NCURSES_SP_NAME(_nc_printf_string) (NCURSES_SP_DCLx
const char *fmt,
va_list ap)
{
char *result = 0;
char *result = NULL;
if (SP_PARM != 0 && fmt != 0) {
if (SP_PARM != NULL && fmt != NULL) {
#if USE_SAFE_SPRINTF
va_list ap2;
int len;
@ -238,7 +238,7 @@ NCURSES_SP_NAME(_nc_printf_string) (NCURSES_SP_DCLx
my_length = (size_t) (2 * (len + 1));
my_buffer = typeRealloc(char, my_length, my_buffer);
}
if (my_buffer != 0) {
if (my_buffer != NULL) {
*my_buffer = '\0';
if (len >= 0) {
vsprintf(my_buffer, fmt, ap);
@ -255,21 +255,30 @@ NCURSES_SP_NAME(_nc_printf_string) (NCURSES_SP_DCLx
if (screen_columns(SP_PARM) > MyCols)
MyCols = screen_columns(SP_PARM);
my_length = (size_t) (MyRows * (MyCols + 1)) + 1;
if (my_length < 80)
my_length = 80;
my_buffer = typeRealloc(char, my_length, my_buffer);
}
if (my_buffer != 0) {
if (my_buffer != NULL) {
# if HAVE_VSNPRINTF
vsnprintf(my_buffer, my_length, fmt, ap); /* SUSv2, 1997 */
/* SUSv2, 1997 */
int used;
while ((used = vsnprintf(my_buffer, my_length, fmt, ap))
>= (int) my_length) {
my_length = (size_t) ((3 * used) / 2);
my_buffer = typeRealloc(char, my_length, my_buffer);
}
# else
vsprintf(my_buffer, fmt, ap); /* ISO/ANSI C, 1989 */
/* ISO/ANSI C, 1989 */
vsprintf(my_buffer, fmt, ap);
# endif
result = my_buffer;
}
#endif
} else if (my_buffer != 0) { /* see _nc_freeall() */
} else if (my_buffer != NULL) { /* see _nc_freeall() */
free(my_buffer);
my_buffer = 0;
my_buffer = NULL;
my_length = 0;
}
return result;

View File

@ -27,7 +27,7 @@
****************************************************************************/
/*
* $Id: term.priv.h,v 1.5 2021/09/24 16:42:04 tom Exp $
* $Id: term.priv.h,v 1.6 2021/09/26 20:43:08 tom Exp $
*
* term.priv.h
*
@ -55,6 +55,12 @@ extern "C" {
#include <time.h> /* time_t */
#include <term.h> /* time_t */
#ifdef USE_PTHREADS
#if USE_REENTRANT
#include <pthread.h>
#endif
#endif
/*
* State of tparm().
*/

View File

@ -1,8 +1,8 @@
ncurses6 (6.2+20210925) unstable; urgency=low
ncurses6 (6.2+20211002) unstable; urgency=low
* latest weekly patch
-- Thomas E. Dickey <dickey@invisible-island.net> Fri, 24 Sep 2021 15:17:49 -0400
-- Thomas E. Dickey <dickey@invisible-island.net> Sun, 26 Sep 2021 16:21:29 -0400
ncurses6 (5.9-20131005) unstable; urgency=low

View File

@ -1,8 +1,8 @@
ncurses6 (6.2+20210925) unstable; urgency=low
ncurses6 (6.2+20211002) unstable; urgency=low
* latest weekly patch
-- Thomas E. Dickey <dickey@invisible-island.net> Fri, 24 Sep 2021 15:17:49 -0400
-- Thomas E. Dickey <dickey@invisible-island.net> Sun, 26 Sep 2021 16:21:29 -0400
ncurses6 (5.9-20131005) unstable; urgency=low

View File

@ -1,8 +1,8 @@
ncurses6 (6.2+20210925) unstable; urgency=low
ncurses6 (6.2+20211002) unstable; urgency=low
* latest weekly patch
-- Thomas E. Dickey <dickey@invisible-island.net> Fri, 24 Sep 2021 15:17:49 -0400
-- Thomas E. Dickey <dickey@invisible-island.net> Sun, 26 Sep 2021 16:21:29 -0400
ncurses6 (5.9-20120608) unstable; urgency=low

View File

@ -1,4 +1,4 @@
; $Id: mingw-ncurses.nsi,v 1.479 2021/09/25 10:32:30 tom Exp $
; $Id: mingw-ncurses.nsi,v 1.480 2021/10/02 08:31:49 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 "0925"
!define VERSION_MMDD "1002"
!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: 20210925
Release: 20211002
License: X11
Group: Development/Libraries
Source: ncurses-%{version}-%{release}.tgz

View File

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

View File

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

View File

@ -53,7 +53,7 @@
#include <sys/ptem.h>
#endif
MODULE_ID("$Id: reset_cmd.c,v 1.27 2021/09/04 10:29:59 tom Exp $")
MODULE_ID("$Id: reset_cmd.c,v 1.28 2021/10/02 18:08:44 tom Exp $")
/*
* SCO defines TIOCGSIZE and the corresponding struct. Other systems (SunOS,
@ -193,7 +193,7 @@ out_char(int c)
* a child program dies in raw mode.
*/
void
reset_tty_settings(int fd, TTY * tty_settings)
reset_tty_settings(int fd, TTY * tty_settings, int noset)
{
GET_TTY(fd, tty_settings);
@ -329,7 +329,9 @@ reset_tty_settings(int fd, TTY * tty_settings)
);
#endif
SET_TTY(fd, tty_settings);
if (!noset) {
SET_TTY(fd, tty_settings);
}
}
/*

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2020 Thomas E. Dickey *
* Copyright 2020,2021 Thomas E. Dickey *
* Copyright 2016 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@ -32,7 +32,7 @@
****************************************************************************/
/*
* $Id: reset_cmd.h,v 1.8 2020/02/02 23:34:34 tom Exp $
* $Id: reset_cmd.h,v 1.9 2021/10/02 20:58:58 tom Exp $
*
* Utility functions for resetting terminal.
*/
@ -51,7 +51,7 @@ extern bool send_init_strings(int /* fd */, TTY * /* old_settings */);
extern void print_tty_chars(TTY * /* old_settings */, TTY * /* new_settings */);
extern void reset_flush(void);
extern void reset_start(FILE * /* fp */, bool /* is_reset */, bool /* is_init */ );
extern void reset_tty_settings(int /* fd */, TTY * /* tty_settings */);
extern void reset_tty_settings(int /* fd */, TTY * /* tty_settings */, int /* noset */);
extern void set_control_chars(TTY * /* tty_settings */, int /* erase */, int /* intr */, int /* kill */);
extern void set_conversions(TTY * /* tty_settings */);

View File

@ -49,7 +49,7 @@
#include <parametrized.h>
#include <transform.h>
MODULE_ID("$Id: tic.c,v 1.302 2021/09/04 10:29:59 tom Exp $")
MODULE_ID("$Id: tic.c,v 1.305 2021/10/02 11:13:50 tom Exp $")
#define STDIN_NAME "<stdin>"
@ -1338,7 +1338,7 @@ check_ansi_cursor(char *list[4])
if (j != k
&& !strcmp(list[j], list[k])) {
char *value = _nc_tic_expand(list[k], TRUE, 0);
_nc_warning("repeated cursor control %s\n", value);
_nc_warning("repeated cursor control %s", value);
repeated = TRUE;
}
}
@ -1367,19 +1367,19 @@ check_ansi_cursor(char *list[4])
continue;
if (memcmp(list[j], up, prefix)) {
char *value = _nc_tic_expand(list[j], TRUE, 0);
_nc_warning("inconsistent prefix for %s\n", value);
_nc_warning("inconsistent prefix for %s", value);
continue;
}
if (strlen(list[j]) < suffix) {
char *value = _nc_tic_expand(list[j], TRUE, 0);
_nc_warning("inconsistent length for %s, expected %d\n",
_nc_warning("inconsistent length for %s, expected %d",
value, (int) suffix + 1);
continue;
}
want = "BADC"[j];
if (list[j][suffix] != want) {
char *value = _nc_tic_expand(list[j], TRUE, 0);
_nc_warning("inconsistent suffix for %s, expected %c, have %c\n",
_nc_warning("inconsistent suffix for %s, expected %c, have %c",
value, want, list[j][suffix]);
}
}
@ -2085,10 +2085,13 @@ check_params(TERMTYPE2 *tp, const char *name, const char *value, int extended)
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)
if (_nc_tparm_err) {
_nc_warning("problem%s in tparm(%s, %d, ...)",
(_nc_tparm_err == 1) ? "" : "s",
name, n);
if (debug_level < 2)
break;
}
}
}
}

View File

@ -45,7 +45,7 @@
#include <hashed_db.h>
#endif
MODULE_ID("$Id: toe.c,v 1.83 2021/09/21 20:07:51 tom Exp $")
MODULE_ID("$Id: toe.c,v 1.84 2021/09/28 08:27:29 tom Exp $")
#define isDotname(name) (!strcmp(name, ".") || !strcmp(name, ".."))
@ -330,6 +330,26 @@ sorthook(int db_index, int db_limit, const char *term_name, TERMTYPE2 *tp)
}
#if NCURSES_USE_TERMCAP
/*
* Check if the buffer contents are printable ASCII, ensuring that we do not
* accidentally pick up incompatible binary content from a hashed database.
*/
static bool
is_termcap(char *buffer)
{
bool result = TRUE;
while (*buffer != '\0') {
int ch = UChar(*buffer++);
if (ch == '\t')
continue;
if (ch < ' ' || ch > '~') {
result = FALSE;
break;
}
}
return result;
}
static void
show_termcap(int db_index, int db_limit, char *buffer, DescHook hook)
{
@ -518,11 +538,13 @@ typelist(int eargc, char *eargv[],
db_array[1] = 0;
if (cgetfirst(&buffer, db_array) > 0) {
show_termcap(i, eargc, buffer, hook);
free(buffer);
while (cgetnext(&buffer, db_array) > 0) {
if (is_termcap(buffer)) {
show_termcap(i, eargc, buffer, hook);
free(buffer);
while (cgetnext(&buffer, db_array) > 0) {
show_termcap(i, eargc, buffer, hook);
free(buffer);
}
}
cgetclose();
continue;
@ -539,6 +561,8 @@ typelist(int eargc, char *eargv[],
if ((fp = safe_fopen(eargv[i], "r")) != 0) {
while (fgets(buffer, sizeof(buffer), fp) != 0) {
if (!is_termcap(buffer))
break;
if (*buffer == '#')
continue;
if (isspace(*buffer))

View File

@ -47,13 +47,12 @@
#include <transform.h>
#include <tty_settings.h>
MODULE_ID("$Id: tput.c,v 1.94 2021/09/19 00:06:44 tom Exp $")
MODULE_ID("$Id: tput.c,v 1.97 2021/10/02 18:09:23 tom Exp $")
#define PUTS(s) fputs(s, stdout)
const char *_nc_progname = "tput";
static char *prg_name;
static bool is_init = FALSE;
static bool is_reset = FALSE;
static bool is_clear = FALSE;
@ -64,7 +63,7 @@ quit(int status, const char *fmt, ...)
va_list argp;
va_start(argp, fmt);
fprintf(stderr, "%s: ", prg_name);
fprintf(stderr, "%s: ", _nc_progname);
vfprintf(stderr, fmt, argp);
fprintf(stderr, "\n");
va_end(argp);
@ -72,7 +71,7 @@ quit(int status, const char *fmt, ...)
}
static GCC_NORETURN void
usage(void)
usage(const char *optstring)
{
#define KEEP(s) s "\n"
static const char msg[] =
@ -91,8 +90,21 @@ usage(void)
KEEP(" capname unlike clear/init/reset, print value for capability \"capname\"")
};
#undef KEEP
(void) fprintf(stderr, "Usage: %s [options] [command]\n", prg_name);
fputs(msg, stderr);
(void) fprintf(stderr, "Usage: %s [options] [command]\n", _nc_progname);
if (optstring != NULL) {
const char *s = msg;
while (*s != '\0') {
fputc(UChar(*s), stderr);
if (!strncmp(s, " -", 3)) {
if (strchr(optstring, s[3]) == NULL)
s = strchr(s, '\n') + 1;
} else if (!strncmp(s, "\n\nC", 3))
break;
++s;
}
} else {
fputs(msg, stderr);
}
ExitProgram(ErrUsage);
}
@ -156,7 +168,7 @@ tput_cmd(int fd, TTY * settings, bool opt_x, int argc, char **argv, int *used)
if (is_reset) {
reset_start(stdout, TRUE, FALSE);
reset_tty_settings(fd, settings);
reset_tty_settings(fd, settings, FALSE);
} else {
reset_start(stdout, FALSE, TRUE);
}
@ -329,11 +341,12 @@ main(int argc, char **argv)
bool is_alias;
bool need_tty;
prg_name = check_aliases(_nc_rootname(argv[0]), TRUE);
_nc_progname = check_aliases(_nc_rootname(argv[0]), TRUE);
is_alias = (is_clear || is_reset || is_init);
term = getenv("TERM");
while ((c = getopt(argc, argv, "ST:Vx")) != -1) {
while ((c = getopt(argc, argv, is_alias ? "T:Vx" : "ST:Vx")) != -1) {
switch (c) {
case 'S':
cmdline = FALSE;
@ -350,12 +363,11 @@ main(int argc, char **argv)
opt_x = TRUE;
break;
default:
usage();
usage(is_alias ? "TVx" : NULL);
/* NOTREACHED */
}
}
is_alias = (is_clear || is_reset || is_init);
need_tty = ((is_reset || is_init) ||
(optind < argc &&
(!strcmp(argv[optind], "reset") ||
@ -369,7 +381,7 @@ main(int argc, char **argv)
argc -= optind;
argv += optind;
}
argv[0] = prg_name;
argv[0] = strdup(_nc_progname);
} else {
argc -= optind;
argv += optind;
@ -386,7 +398,7 @@ main(int argc, char **argv)
if (cmdline) {
int code = 0;
if ((argc <= 0) && !is_alias)
usage();
usage(NULL);
while (argc > 0) {
code = tput_cmd(fd, &tty_settings, opt_x, argc, argv, &used);
if (code != 0)

View File

@ -98,7 +98,7 @@
char *ttyname(int fd);
#endif
MODULE_ID("$Id: tset.c,v 1.128 2021/04/03 23:03:48 tom Exp $")
MODULE_ID("$Id: tset.c,v 1.130 2021/10/02 18:08:09 tom Exp $")
#ifndef environ
extern char **environ;
@ -775,6 +775,7 @@ main(int argc, char **argv)
bool opt_w = FALSE; /* set window-size */
TTY mode, oldmode;
_nc_progname = _nc_rootname(*argv);
obsolete(argv);
noinit = noset = quiet = Sflag = sflag = showterm = 0;
while ((ch = getopt(argc, argv, "a:cd:e:Ii:k:m:p:qQrSsVw")) != -1) {
@ -833,7 +834,6 @@ main(int argc, char **argv)
}
}
_nc_progname = _nc_rootname(*argv);
argc -= optind;
argv += optind;
@ -855,7 +855,7 @@ main(int argc, char **argv)
if (same_program(_nc_progname, PROG_RESET)) {
reset_start(stderr, TRUE, FALSE);
reset_tty_settings(my_fd, &mode);
reset_tty_settings(my_fd, &mode, noset);
} else {
reset_start(stderr, FALSE, TRUE);
}