ncurses 6.0 - patch 20171014

+ minor cleanup to test/view.c:
  + eliminate "-n" option by simply reading the whole file.
  + implement page up/down commands.
+ add check in tput for init/reset operands to ensure those use a
  terminal.
+ improve manual pages which discuss chtype, cchar_t types and the
  attribute values which can be stored in those types.
+ correct array-index when parsing "-T" command-line option in tabs
  program.
+ modify demo_new_pair.c to pass extended pairs to setcchar().
+ add test/dots_xcurses.c to illustrate a different approach used for
  extended colors which can be contrasted with dots_curses.c.
+ add a check in tic to note when a description uses non-mandatory
  delays without xon_xoff.  This is not an error, but some descriptions
  for a terminal emulator may use the combination incorrectly.
This commit is contained in:
Thomas E. Dickey 2017-10-15 01:25:24 +00:00
parent cd142df6d9
commit 7fa7badf32
48 changed files with 1064 additions and 360 deletions

View File

@ -1110,6 +1110,7 @@
./test/dots_curses.c ./test/dots_curses.c
./test/dots_mvcur.c ./test/dots_mvcur.c
./test/dots_termcap.c ./test/dots_termcap.c
./test/dots_xcurses.c
./test/echochar.c ./test/echochar.c
./test/edit_field.c ./test/edit_field.c
./test/edit_field.h ./test/edit_field.h

19
NEWS
View File

@ -25,7 +25,7 @@
-- sale, use or other dealings in this Software without prior written -- -- sale, use or other dealings in this Software without prior written --
-- authorization. -- -- authorization. --
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
-- $Id: NEWS,v 1.2966 2017/10/07 23:37:31 tom Exp $ -- $Id: NEWS,v 1.2975 2017/10/14 23:49:52 tom Exp $
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
This is a log of changes that ncurses has gone through since Zeyd started This is a log of changes that ncurses has gone through since Zeyd started
@ -45,6 +45,23 @@ See the AUTHORS file for the corresponding full names.
Changes through 1.9.9e did not credit all contributions; Changes through 1.9.9e did not credit all contributions;
it is not possible to add this information. it is not possible to add this information.
20171014
+ minor cleanup to test/view.c:
+ eliminate "-n" option by simply reading the whole file.
+ implement page up/down commands.
+ add check in tput for init/reset operands to ensure those use a
terminal.
+ improve manual pages which discuss chtype, cchar_t types and the
attribute values which can be stored in those types.
+ correct array-index when parsing "-T" command-line option in tabs
program.
+ modify demo_new_pair.c to pass extended pairs to setcchar().
+ add test/dots_xcurses.c to illustrate a different approach used for
extended colors which can be contrasted with dots_curses.c.
+ add a check in tic to note when a description uses non-mandatory
delays without xon_xoff. This is not an error, but some descriptions
for a terminal emulator may use the combination incorrectly.
20171007 20171007
+ modify "-T" option of clear and tput to call use_tioctl() to obtain + modify "-T" option of clear and tput to call use_tioctl() to obtain
the operating system's notion of the screensize if possible. the operating system's notion of the screensize if possible.

View File

@ -1 +1 @@
5:0:9 6.0 20171007 5:0:9 6.0 20171014

View File

@ -25,7 +25,7 @@
# use or other dealings in this Software without prior written # # use or other dealings in this Software without prior written #
# authorization. # # authorization. #
############################################################################## ##############################################################################
# $Id: dist.mk,v 1.1186 2017/10/02 01:01:40 tom Exp $ # $Id: dist.mk,v 1.1187 2017/10/08 23:38:02 tom Exp $
# Makefile for creating ncurses distributions. # Makefile for creating ncurses distributions.
# #
# This only needs to be used directly as a makefile by developers, but # This only needs to be used directly as a makefile by developers, but
@ -37,7 +37,7 @@ SHELL = /bin/sh
# These define the major/minor/patch versions of ncurses. # These define the major/minor/patch versions of ncurses.
NCURSES_MAJOR = 6 NCURSES_MAJOR = 6
NCURSES_MINOR = 0 NCURSES_MINOR = 0
NCURSES_PATCH = 20171007 NCURSES_PATCH = 20171014
# We don't append the patch to the version, since this only applies to releases # We don't append the patch to the version, since this only applies to releases
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)

View File

@ -125,7 +125,7 @@
</PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE> </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="ncurses.3x.html">curses(3x)</A></STRONG>
This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20171007). This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20171014).

View File

@ -190,7 +190,7 @@
</PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE> </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> <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.0 (patch 20171007). This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20171014).
</PRE><H2><a name="h2-AUTHOR">AUTHOR</a></H2><PRE> </PRE><H2><a name="h2-AUTHOR">AUTHOR</a></H2><PRE>

View File

@ -148,7 +148,7 @@
</PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE> </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> <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.0 (patch 20171007). This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20171014).

View File

@ -27,7 +27,8 @@
* sale, use or other dealings in this Software without prior written * * sale, use or other dealings in this Software without prior written *
* authorization. * * authorization. *
**************************************************************************** ****************************************************************************
* @Id: curs_attr.3x,v 1.53 2017/03/28 23:31:39 tom Exp @ * @Id: curs_attr.3x,v 1.60 2017/10/14 20:01:13 tom Exp @
* ---------------------------------------------------------------------------
* attr_get * attr_get
* .br * .br
* .br * .br
@ -40,6 +41,14 @@
* --------------------------------------------------------------------------- * ---------------------------------------------------------------------------
* --------------------------------------------------------------------------- * ---------------------------------------------------------------------------
* --------------------------------------------------------------------------- * ---------------------------------------------------------------------------
* ---------------------------------------------------------------------------
* ---------------------------------------------------------------------------
* ---------------------------------------------------------------------------
* ---------------------------------------------------------------------------
* ---------------------------------------------------------------------------
* ---------------------------------------------------------------------------
* ---------------------------------------------------------------------------
* ---------------------------------------------------------------------------
--> -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<HTML> <HTML>
@ -240,6 +249,126 @@
support more than 256 color pairs. support more than 256 color pairs.
</PRE><H2><a name="h2-HISTORY">HISTORY</a></H2><PRE>
X/Open Curses is largely based on SVr4 curses, adding support for
"wide-characters" (not specific to Unicode). Some of the X/Open dif-
ferences from SVr4 curses address the way video attributes can be ap-
plied to wide-characters. But aside from that, <STRONG>attrset</STRONG> and <STRONG>attr_set</STRONG>
are similar. SVr4 curses provided the basic features for manipulating
video attributes. However, earlier versions of curses provided a part
of these features.
As seen in 2.8BSD, curses assumed 7-bit characters, using the eighth
bit of a byte to represent the <EM>standout</EM> feature (often implemented as
bold and/or reverse video). The BSD curses library provided functions
<STRONG>standout</STRONG> and <STRONG>standend</STRONG> which were carried along into X/Open Curses due
to their pervasive use in legacy applications.
Some terminals in the 1980s could support a variety of video at-
tributes, although the BSD curses library could do nothing with those.
System V (1983) provided an improved curses library. It defined the <STRONG>A_</STRONG>
symbols for use by applications to manipulate the other attributes.
There are few useful references for the chronology.
Goodheart's book <EM>UNIX</EM> <EM>Curses</EM> <EM>Explained</EM> (1991) describes SVr3 (1987),
commenting on several functions:
<STRONG>o</STRONG> the <STRONG>attron</STRONG>, <STRONG>attroff</STRONG>, <STRONG>attrset</STRONG> functions (and most of the functions
found in SVr4 but not in BSD curses) were introduced by System V,
<STRONG>o</STRONG> the alternate character set feature with <STRONG>A_ALTCHARSET</STRONG> was added in
SVr2 and improved in SVr3 (by adding <STRONG>acs_map[]</STRONG>),
<STRONG>o</STRONG> <STRONG>start_color</STRONG> and related color-functions were introduced by System
V.3.2,
<STRONG>o</STRONG> pads, soft-keys were added in SVr3, and
Goodheart did not mention the background character or the <STRONG>cchar_t</STRONG> type.
Those are respectively SVr4 and X/Open features. He did mention the <STRONG>A_</STRONG>
constants, but did not indicate their values. Those were not the same
in different systems, even for those marked as System V.
Different Unix systems used different sizes for the bit-fields in
<STRONG>chtype</STRONG> for <EM>characters</EM> and <EM>colors</EM>, and took into account the different
integer sizes (32-bit versus 64-bit).
This table showing the number of bits for <STRONG>A_COLOR</STRONG> and <STRONG>A_CHARTEXT</STRONG> was
gleaned from the curses header files for various operating systems and
architectures. The inferred architecture and notes reflect the format
and size of the defined constants as well as clues such as the alter-
nate character set implementation. A 32-bit library can be used on a
64-bit system, but not necessarily the reverse.
<EM>Year</EM> <EM>System</EM> <EM>Arch</EM> <EM>Color</EM> <EM>Char</EM> <EM>Notes</EM>
----------------------------------------------------------------
1992 Solaris 5.2 32 6 17 SVr4 curses
1992 HPUX 9 32 no 8 SVr2 curses
1992 AIX 3.2 32 no 23 SVr2 curses
1994 OSF/1 r3 32 no 23 SVr2 curses
1995 HP-UX 10.00 32 6 16 SVr3 "curses_colr"
1995 HP-UX 10.00 32 6 8 SVr4, X/Open curses
1995 Solaris 5.4 32/64 7 16 X/Open curses
1996 AIX 4.2 32 7 16 X/Open curses
1996 OSF/1 r4 32 6 16 X/Open curses
1997 HP-UX 11.00 32 6 8 X/Open curses
2000 U/Win 32/64 7/31 16 uses <STRONG>chtype</STRONG>
Notes:
Regarding HP-UX,
<STRONG>o</STRONG> HP-UX 10.20 (1996) added support for 64-bit PA-RISC processors
in 1996.
<STRONG>o</STRONG> HP-UX 10.30 (1997) marked "curses_colr" obsolete. That version
of curses was dropped with HP-UX 11.30 in 2006.
Regarding OSF/1 (and Tru64),
<STRONG>o</STRONG> These used 64-bit hardware. Like ncurses, the OSF/1 curses in-
terface is not customized for 32-bit and 64-bit versions.
<STRONG>o</STRONG> Unlike other systems which evolved from AT&amp;T code, OSF/1 provid-
ed a new implementation for X/Open curses.
Regarding Solaris,
<STRONG>o</STRONG> The initial release of Solaris was in 1992.
<STRONG>o</STRONG> The <EM>xpg4</EM> (X/Open) curses was developed by MKS from 1990 to 1995.
Sun's copyright began in 1996.
<STRONG>o</STRONG> Sun updated the X/Open curses interface after 64-bit support was
introduced in 1997, but did not modify the SVr4 curses inter-
face.
Regarding U/Win,
<STRONG>o</STRONG> Development of the curses library began in 1991, stopped in
2000.
<STRONG>o</STRONG> Color support was added in 1998.
<STRONG>o</STRONG> The library uses only <STRONG>chtype</STRONG> (no <STRONG>cchar_t</STRONG>).
Once X/Open curses was adopted in the mid-1990s, the constraint of a
32-bit interface with many colors and wide-characters for <STRONG>chtype</STRONG> became
a moot point. The <STRONG>cchar_t</STRONG> structure (whose size and members are not
specified in X/Open Curses) could be extended as needed.
Other interfaces are rarely used now:
<STRONG>o</STRONG> BSD curses was improved slightly in 1993/1994 using Keith Bostic's
modification to make the library 8-bit clean for <STRONG>nvi</STRONG>. He moved
<EM>standout</EM> attribute to a structure member.
The resulting 4.4BSD curses was replaced by ncurses over the next
ten years.
<STRONG>o</STRONG> U/Win is rarely used now.
</PRE><H2><a name="h2-EXTENSIONS">EXTENSIONS</a></H2><PRE> </PRE><H2><a name="h2-EXTENSIONS">EXTENSIONS</a></H2><PRE>
This implementation provides the <STRONG>A_ITALIC</STRONG> attribute for terminals which This implementation provides the <STRONG>A_ITALIC</STRONG> attribute for terminals which
have the <STRONG>enter_italics_mode</STRONG> (<STRONG>sitm</STRONG>) and <STRONG>exit_italics_mode</STRONG> (<STRONG>ritm</STRONG>) capa- have the <STRONG>enter_italics_mode</STRONG> (<STRONG>sitm</STRONG>) and <STRONG>exit_italics_mode</STRONG> (<STRONG>ritm</STRONG>) capa-
@ -305,9 +434,25 @@
<STRONG>WA_BOLD</STRONG> Extra bright or bold <STRONG>WA_BOLD</STRONG> Extra bright or bold
<STRONG>WA_ALTCHARSET</STRONG> Alternate character set <STRONG>WA_ALTCHARSET</STRONG> Alternate character set
The XSI curses standard specifies that each pair of corresponding <STRONG>A_</STRONG> XSI curses does not assign values to these symbols, nor does it state
and <STRONG>WA_</STRONG>-using functions operates on the same current-highlight informa- whether or not they are related to the similarly-named A_NORMAL, etc.:
tion.
<STRONG>o</STRONG> The XSI curses standard specifies that each pair of corresponding
<STRONG>A_</STRONG> and <STRONG>WA_</STRONG>-using functions operates on the same current-highlight
information.
<STRONG>o</STRONG> However, in some implementations, those symbols have unrelated val-
ues.
For example, the Solaris <EM>xpg4</EM> (X/Open) curses declares <STRONG>attr_t</STRONG> to be
an unsigned short integer (16-bits), while <STRONG>chtype</STRONG> is a unsigned in-
teger (32-bits). The <STRONG>WA_</STRONG> symbols in this case are different from
the <STRONG>A_</STRONG> symbols because they are used for a smaller datatype which
does not represent <STRONG>A_CHARTEXT</STRONG> or <STRONG>A_COLOR</STRONG>.
In this implementation (as in many others), the values happen to be
the same because it simplifies copying information between <STRONG>chtype</STRONG>
and <STRONG>cchar_t</STRONG> variables.
The XSI standard extended conformance level adds new highlights <STRONG>A_HORI-</STRONG> The XSI standard extended conformance level adds new highlights <STRONG>A_HORI-</STRONG>
<STRONG>ZONTAL</STRONG>, <STRONG>A_LEFT</STRONG>, <STRONG>A_LOW</STRONG>, <STRONG>A_RIGHT</STRONG>, <STRONG>A_TOP</STRONG>, <STRONG>A_VERTICAL</STRONG> (and corresponding <STRONG>ZONTAL</STRONG>, <STRONG>A_LEFT</STRONG>, <STRONG>A_LOW</STRONG>, <STRONG>A_RIGHT</STRONG>, <STRONG>A_TOP</STRONG>, <STRONG>A_VERTICAL</STRONG> (and corresponding
@ -358,6 +503,7 @@
</li> </li>
<li><a href="#h2-VIDEO-ATTRIBUTES">VIDEO ATTRIBUTES</a></li> <li><a href="#h2-VIDEO-ATTRIBUTES">VIDEO ATTRIBUTES</a></li>
<li><a href="#h2-NOTES">NOTES</a></li> <li><a href="#h2-NOTES">NOTES</a></li>
<li><a href="#h2-HISTORY">HISTORY</a></li>
<li><a href="#h2-EXTENSIONS">EXTENSIONS</a></li> <li><a href="#h2-EXTENSIONS">EXTENSIONS</a></li>
<li><a href="#h2-PORTABILITY">PORTABILITY</a></li> <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
<li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li> <li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li>

View File

@ -1,7 +1,7 @@
<!-- <!--
* t * t
**************************************************************************** ****************************************************************************
* Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * * Copyright (c) 1998-2010,2017 Free Software Foundation, Inc. *
* * * *
* Permission is hereby granted, free of charge, to any person obtaining a * * Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the * * copy of this software and associated documentation files (the *
@ -27,7 +27,7 @@
* sale, use or other dealings in this Software without prior written * * sale, use or other dealings in this Software without prior written *
* authorization. * * authorization. *
**************************************************************************** ****************************************************************************
* @Id: curs_inch.3x,v 1.17 2010/12/04 18:36:44 tom Exp @ * @Id: curs_inch.3x,v 1.18 2017/10/14 19:14:47 tom Exp @
--> -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<HTML> <HTML>
@ -82,6 +82,10 @@
<STRONG>wmove</STRONG>, and return an error if the position is outside the window, or if <STRONG>wmove</STRONG>, and return an error if the position is outside the window, or if
the window pointer is null. the window pointer is null.
The <STRONG>winch</STRONG> function does not return an error if the window contains
characters larger than 8-bits (255). Only the low-order 8 bits of the
character are used by <STRONG>winch</STRONG>.
</PRE><H2><a name="h2-NOTES">NOTES</a></H2><PRE> </PRE><H2><a name="h2-NOTES">NOTES</a></H2><PRE>
Note that all of these routines may be macros. Note that all of these routines may be macros.
@ -90,12 +94,40 @@
</PRE><H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE> </PRE><H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
These functions are described in the XSI Curses standard, Issue 4. These functions are described in the XSI Curses standard, Issue 4.
Very old systems (before standardization) provide a different function
with the same name:
<STRONG>o</STRONG> The <STRONG>winch</STRONG> function was part of the original BSD curses library,
which stored a 7-bit character combined with the <EM>standout</EM>
attribute.
In BSD curses, <STRONG>winch</STRONG> returned only the character (as an integer)
with the <EM>standout</EM> attribute removed.
<STRONG>o</STRONG> System V curses added support for several video attributes which
could be combined with characters in the window.
Reflecting this improvment, the function was altered to return the
character combined with all video attributes in a <STRONG>chtype</STRONG> value.
X/Open Curses does not specify the size and layout of attributes, color
and character values in <STRONG>chtype</STRONG>; it is implementation-dependent. This
implementation uses 8 bits for character values. An application using
more bits, e.g., a Unicode value, should use the wide-character equiva-
lents to these functions.
</PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE> </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="ncurses.3x.html">curses(3x)</A></STRONG>
gives an overview of the WINDOW and <STRONG>chtype</STRONG> data types.
Comparable functions in the wide-character (ncursesw) library are <STRONG><A HREF="curs_attr.3x.html">curs_attr(3x)</A></STRONG>
described in <STRONG><A HREF="curs_in_wch.3x.html">curs_in_wch(3x)</A></STRONG>. goes into more detail, pointing out portability problems and con-
straints on the use of <STRONG>chtype</STRONG> for returning window information.
<STRONG><A HREF="curs_in_wch.3x.html">curs_in_wch(3x)</A></STRONG>
describes comparable functions for the wide-character (ncursesw)
library.

View File

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

View File

@ -476,7 +476,7 @@
http://invisible-island.net/ncurses/tctest.html http://invisible-island.net/ncurses/tctest.html
This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20171007). This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20171014).
</PRE><H2><a name="h2-AUTHOR">AUTHOR</a></H2><PRE> </PRE><H2><a name="h2-AUTHOR">AUTHOR</a></H2><PRE>

View File

@ -85,7 +85,7 @@
</PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE> </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="tic.1m.html">tic(1m)</A></STRONG>, <STRONG><A HREF="infocmp.1m.html">infocmp(1m)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG> <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="tic.1m.html">tic(1m)</A></STRONG>, <STRONG><A HREF="infocmp.1m.html">infocmp(1m)</A></STRONG>, <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>
This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20171007). This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20171014).
</PRE><H2><a name="h2-AUTHOR">AUTHOR</a></H2><PRE> </PRE><H2><a name="h2-AUTHOR">AUTHOR</a></H2><PRE>

View File

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

View File

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

View File

@ -112,7 +112,7 @@
</PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE> </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="ncurses.3x.html">curses(3x)</A></STRONG>
This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20171007). This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20171014).

View File

@ -194,7 +194,7 @@
</PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE> </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>, <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.0 (patch 20171007). This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20171014).
</PRE><H2><a name="h2-AUTHOR">AUTHOR</a></H2><PRE> </PRE><H2><a name="h2-AUTHOR">AUTHOR</a></H2><PRE>

View File

@ -164,7 +164,7 @@
</PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE> </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
<STRONG><A HREF="tset.1.html">tset(1)</A></STRONG>, <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>. <STRONG><A HREF="tset.1.html">tset(1)</A></STRONG>, <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.0 (patch 20171007). This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20171014).

View File

@ -74,7 +74,7 @@
<EM>Terminfo</EM> describes terminals by giving a set of capabilities which they <EM>Terminfo</EM> describes terminals by giving a set of capabilities which they
have, by specifying how to perform screen operations, and by specifying have, by specifying how to perform screen operations, and by specifying
padding requirements and initialization sequences. This describes padding requirements and initialization sequences. This describes
<STRONG>ncurses</STRONG> version 6.0 (patch 20171007). <STRONG>ncurses</STRONG> version 6.0 (patch 20171014).
</PRE><H3><a name="h3-Terminfo-Entry-Syntax">Terminfo Entry Syntax</a></H3><PRE> </PRE><H3><a name="h3-Terminfo-Entry-Syntax">Terminfo Entry Syntax</a></H3><PRE>

View File

@ -364,7 +364,7 @@
<STRONG><A HREF="infocmp.1m.html">infocmp(1m)</A></STRONG>, <STRONG><A HREF="captoinfo.1m.html">captoinfo(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="infocmp.1m.html">infocmp(1m)</A></STRONG>, <STRONG><A HREF="captoinfo.1m.html">captoinfo(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="term.5.html">term(5)</A></STRONG>. <STRONG><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>.
This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20171007). This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20171014).
</PRE><H2><a name="h2-AUTHOR">AUTHOR</a></H2><PRE> </PRE><H2><a name="h2-AUTHOR">AUTHOR</a></H2><PRE>

View File

@ -113,7 +113,7 @@
<STRONG><A HREF="tic.1m.html">tic(1m)</A></STRONG>, <STRONG><A HREF="infocmp.1m.html">infocmp(1m)</A></STRONG>, <STRONG><A HREF="captoinfo.1m.html">captoinfo(1m)</A></STRONG>, <STRONG><A HREF="infotocap.1m.html">infotocap(1m)</A></STRONG>, <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG>ter-</STRONG> <STRONG><A HREF="tic.1m.html">tic(1m)</A></STRONG>, <STRONG><A HREF="infocmp.1m.html">infocmp(1m)</A></STRONG>, <STRONG><A HREF="captoinfo.1m.html">captoinfo(1m)</A></STRONG>, <STRONG><A HREF="infotocap.1m.html">infotocap(1m)</A></STRONG>, <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG>ter-</STRONG>
<STRONG><A HREF="terminfo.5.html">minfo(5)</A></STRONG>. <STRONG><A HREF="terminfo.5.html">minfo(5)</A></STRONG>.
This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20171007). This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20171014).

View File

@ -482,7 +482,7 @@
</PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE> </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="terminfo.5.html">terminfo(5)</A></STRONG>, <STRONG><A HREF="curs_termcap.3x.html">curs_termcap(3x)</A></STRONG>. <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="terminfo.5.html">terminfo(5)</A></STRONG>, <STRONG><A HREF="curs_termcap.3x.html">curs_termcap(3x)</A></STRONG>.
This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20171007). This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20171014).

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>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> <STRONG>ttys(5)</STRONG>, <STRONG>environ(7)</STRONG>
This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20171007). This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20171014).

View File

@ -27,13 +27,18 @@
.\" authorization. * .\" authorization. *
.\"*************************************************************************** .\"***************************************************************************
.\" .\"
.\" $Id: curs_attr.3x,v 1.53 2017/03/28 23:31:39 tom Exp $ .\" $Id: curs_attr.3x,v 1.60 2017/10/14 20:01:13 tom Exp $
.TH curs_attr 3X "" .TH curs_attr 3X ""
.ie \n(.g .ds `` \(lq
.el .ds `` ``
.ie \n(.g .ds '' \(rq
.el .ds '' ''
.de bP .de bP
.IP \(bu 4 .IP \(bu 4
.. ..
.na .na
.hy 0 .hy 0
.\" ---------------------------------------------------------------------------
.SH NAME .SH NAME
.\" attr_get .\" attr_get
\fBattr_get\fR, \fBattr_get\fR,
@ -67,6 +72,7 @@
\fBwstandout\fR \- \fBcurses\fR character and window attribute control routines \fBwstandout\fR \- \fBcurses\fR character and window attribute control routines
.ad .ad
.hy .hy
.\" ---------------------------------------------------------------------------
.SH SYNOPSIS .SH SYNOPSIS
\fB#include <curses.h>\fR \fB#include <curses.h>\fR
.sp .sp
@ -120,6 +126,7 @@
\fBint standout(void);\fR \fBint standout(void);\fR
.br .br
\fBint wstandout(WINDOW *\fP\fIwin\fP\fB);\fR \fBint wstandout(WINDOW *\fP\fIwin\fP\fB);\fR
.\" ---------------------------------------------------------------------------
.SH DESCRIPTION .SH DESCRIPTION
.PP .PP
These routines manipulate the current attributes of the named window, These routines manipulate the current attributes of the named window,
@ -260,6 +267,7 @@ l l .
The return values of many of these routines are not meaningful (they are The return values of many of these routines are not meaningful (they are
implemented as macro-expanded assignments and simply return their argument). implemented as macro-expanded assignments and simply return their argument).
The SVr4 manual page claims (falsely) that these routines always return \fB1\fR. The SVr4 manual page claims (falsely) that these routines always return \fB1\fR.
.\" ---------------------------------------------------------------------------
.SH NOTES .SH NOTES
These functions may be macros: These functions may be macros:
.sp .sp
@ -274,6 +282,137 @@ The alternate functions such as \fBcolor_set\fP can pass a color pair
value directly. value directly.
However, ncurses ABI 4 and 5 simply OR this value within the alternate functions. However, ncurses ABI 4 and 5 simply OR this value within the alternate functions.
You must use ncurses ABI 6 to support more than 256 color pairs. You must use ncurses ABI 6 to support more than 256 color pairs.
.\" ---------------------------------------------------------------------------
.SH HISTORY
X/Open Curses is largely based on SVr4 curses,
adding support for \*(``wide-characters\*('' (not specific to Unicode).
Some of the X/Open differences from SVr4 curses address the way
video attributes can be applied to wide-characters.
But aside from that, \fBattrset\fP and \fBattr_set\fP are similar.
SVr4 curses provided the basic features for manipulating video attributes.
However, earlier versions of curses provided a part of these features.
.PP
As seen in 2.8BSD, curses assumed 7-bit characters,
using the eighth bit of a byte to represent the \fIstandout\fP
feature (often implemented as bold and/or reverse video).
The BSD curses library provided functions \fBstandout\fP and \fBstandend\fP
which were carried along into X/Open Curses due to their pervasive use
in legacy applications.
.PP
Some terminals in the 1980s could support a variety of video attributes,
although the BSD curses library could do nothing with those.
System V (1983) provided an improved curses library.
It defined the \fBA_\fP symbols for use by applications to manipulate the
other attributes.
There are few useful references for the chronology.
.PP
Goodheart's book
\fIUNIX Curses Explained\fP (1991) describes SVr3 (1987),
commenting on several functions:
.bP
the \fBattron\fP, \fBattroff\fP, \fBattrset\fP functions
(and most of the functions found in SVr4 but not in BSD curses) were
introduced by System V,
.bP
the alternate character set feature with \fBA_ALTCHARSET\fP was
added in SVr2 and improved in SVr3 (by adding \fBacs_map[]\fP),
.bP
\fBstart_color\fP and related color-functions were introduced by System V.3.2,
.bP
pads, soft-keys were added in SVr3, and
.PP
Goodheart did not mention the background character or the \fBcchar_t\fP type.
Those are respectively SVr4 and X/Open features.
He did mention the \fBA_\fP constants, but did not indicate their values.
Those were not the same in different systems,
even for those marked as System V.
.PP
Different Unix systems used different sizes for the bit-fields in \fBchtype\fP
for \fIcharacters\fP and \fIcolors\fP, and took into account the different
integer sizes (32-bit versus 64-bit).
.PP
This table showing the number of bits for \fBA_COLOR\fP
and \fBA_CHARTEXT\fP
was gleaned from the curses header files for
various operating systems and architectures.
The inferred architecture and notes reflect
the format and size of the defined constants
as well as clues such as the alternate character set implementation.
A 32-bit library can be used on a 64-bit system,
but not necessarily the reverse.
.RS
.TS
l l l l l l
_ _ _ _ _ _
l l l l l l .
\fIYear\fR \fISystem\fR \fIArch\fP \fIColor\fR \fIChar\fR \fINotes\fR
1992 Solaris 5.2 32 6 17 SVr4 curses
1992 HPUX 9 32 no 8 SVr2 curses
1992 AIX 3.2 32 no 23 SVr2 curses
1994 OSF/1 r3 32 no 23 SVr2 curses
1995 HP-UX 10.00 32 6 16 SVr3 \*(``curses_colr\*(''
1995 HP-UX 10.00 32 6 8 SVr4, X/Open curses
1995 Solaris 5.4 32/64 7 16 X/Open curses
1996 AIX 4.2 32 7 16 X/Open curses
1996 OSF/1 r4 32 6 16 X/Open curses
1997 HP-UX 11.00 32 6 8 X/Open curses
2000 U/Win 32/64 7/31 16 uses \fBchtype\fP
.TE
.RE
.PP
Notes:
.RS 3
.PP
Regarding HP-UX,
.bP
HP-UX 10.20 (1996) added support for 64-bit PA-RISC processors in 1996.
.bP
HP-UX 10.30 (1997) marked \*(``curses_colr\*('' obsolete.
That version of curses was dropped with HP-UX 11.30 in 2006.
.PP
Regarding OSF/1 (and Tru64),
.bP
These used 64-bit hardware.
Like ncurses, the OSF/1 curses interface is not customized for 32-bit
and 64-bit versions.
.bP
Unlike other systems which evolved from AT&T code,
OSF/1 provided a new implementation for X/Open curses.
.PP
Regarding Solaris,
.bP
The initial release of Solaris was in 1992.
.bP
The \fIxpg4\fP (X/Open) curses was developed by MKS from 1990 to 1995.
Sun's copyright began in 1996.
.bP
Sun updated the X/Open curses interface after 64-bit support was introduced in 1997,
but did not modify the SVr4 curses interface.
.PP
Regarding U/Win,
.bP
Development of the curses library began in 1991, stopped in 2000.
.bP
Color support was added in 1998.
.bP
The library uses only \fBchtype\fP (no \fBcchar_t\fP).
.RE
.PP
Once X/Open curses was adopted in the mid-1990s, the constraint of
a 32-bit interface with many colors and wide-characters for \fBchtype\fP
became a moot point. The \fBcchar_t\fP structure (whose size and
members are not specified in X/Open Curses) could be extended as needed.
.PP
Other interfaces are rarely used now:
.bP
BSD curses was improved slightly in 1993/1994 using Keith Bostic's
modification to make the library 8-bit clean for \fBnvi\fP.
He moved \fIstandout\fP attribute to a structure member.
.IP
The resulting 4.4BSD curses was replaced by ncurses over the next ten years.
.bP
U/Win is rarely used now.
.\" ---------------------------------------------------------------------------
.SH EXTENSIONS .SH EXTENSIONS
.PP .PP
This implementation provides the \fBA_ITALIC\fP attribute for terminals This implementation provides the \fBA_ITALIC\fP attribute for terminals
@ -307,6 +446,7 @@ The remaining functions which have \fIopts\fP,
but do not manipulate color, but do not manipulate color,
e.g., \fBwattr_on\fP and \fBwattr_off\fP e.g., \fBwattr_on\fP and \fBwattr_off\fP
are not used by this implementation except to check that they are \fBNULL\fP. are not used by this implementation except to check that they are \fBNULL\fP.
.\" ---------------------------------------------------------------------------
.SH PORTABILITY .SH PORTABILITY
These functions are supported in the XSI Curses standard, Issue 4. These functions are supported in the XSI Curses standard, Issue 4.
The standard defined the dedicated type for highlights, The standard defined the dedicated type for highlights,
@ -355,9 +495,26 @@ l l .
.TE .TE
.RE .RE
.PP .PP
XSI curses does not assign values to these symbols,
nor does it state whether or not they are related to the
similarly-named A_NORMAL, etc.:
.bP
The XSI curses standard specifies that each pair of corresponding \fBA_\fR The XSI curses standard specifies that each pair of corresponding \fBA_\fR
and \fBWA_\fR-using functions operates on the same current-highlight and \fBWA_\fR-using functions operates on the same current-highlight
information. information.
.bP
However, in some implementations, those symbols have unrelated values.
.IP
For example, the Solaris \fIxpg4\fP (X/Open) curses declares
\fBattr_t\fP to be an unsigned short integer (16-bits),
while \fBchtype\fP is a unsigned integer (32-bits).
The \fBWA_\fP symbols in this case are different from the \fBA_\fP symbols
because they are used for a smaller datatype which does not
represent \fBA_CHARTEXT\fP or \fBA_COLOR\fP.
.IP
In this implementation (as in many others), the values happen to be
the same because it simplifies copying information between
\fBchtype\fP and \fBcchar_t\fP variables.
.PP .PP
The XSI standard extended conformance level adds new highlights The XSI standard extended conformance level adds new highlights
\fBA_HORIZONTAL\fR, \fBA_LEFT\fR, \fBA_LOW\fR, \fBA_RIGHT\fR, \fBA_TOP\fR, \fBA_HORIZONTAL\fR, \fBA_LEFT\fR, \fBA_LOW\fR, \fBA_RIGHT\fR, \fBA_TOP\fR,
@ -365,6 +522,7 @@ The XSI standard extended conformance level adds new highlights
As of August 2013, As of August 2013,
no known terminal provides these highlights no known terminal provides these highlights
(i.e., via the \fBsgr1\fP capability). (i.e., via the \fBsgr1\fP capability).
.\" ---------------------------------------------------------------------------
.SH RETURN VALUE .SH RETURN VALUE
All routines return the integer \fBOK\fR on success, or \fBERR\fP on failure. All routines return the integer \fBOK\fR on success, or \fBERR\fP on failure.
.PP .PP
@ -383,6 +541,7 @@ used for retrieving attribute or color-pair values is \fBNULL\fP.
Functions with a "mv" prefix first perform a cursor movement using Functions with a "mv" prefix first perform a cursor movement using
\fBwmove\fP, and return an error if the position is outside the window, \fBwmove\fP, and return an error if the position is outside the window,
or if the window pointer is null. or if the window pointer is null.
.\" ---------------------------------------------------------------------------
.SH SEE ALSO .SH SEE ALSO
.na .na
\fBcurses\fR(3X), \fBcurses\fR(3X),

View File

@ -1,6 +1,6 @@
'\" t '\" t
.\"*************************************************************************** .\"***************************************************************************
.\" Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. * .\" Copyright (c) 1998-2010,2017 Free Software Foundation, Inc. *
.\" * .\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a * .\" Permission is hereby granted, free of charge, to any person obtaining a *
.\" copy of this software and associated documentation files (the * .\" copy of this software and associated documentation files (the *
@ -27,8 +27,11 @@
.\" authorization. * .\" authorization. *
.\"*************************************************************************** .\"***************************************************************************
.\" .\"
.\" $Id: curs_inch.3x,v 1.17 2010/12/04 18:36:44 tom Exp $ .\" $Id: curs_inch.3x,v 1.18 2017/10/14 19:14:47 tom Exp $
.TH curs_inch 3X "" .TH curs_inch 3X ""
.de bP
.IP \(bu 4
..
.SH NAME .SH NAME
\fBinch\fR, \fBinch\fR,
\fBwinch\fR, \fBwinch\fR,
@ -65,13 +68,44 @@ l l .
Functions with a "mv" prefix first perform a cursor movement using Functions with a "mv" prefix first perform a cursor movement using
\fBwmove\fP, and return an error if the position is outside the window, \fBwmove\fP, and return an error if the position is outside the window,
or if the window pointer is null. or if the window pointer is null.
.PP
The \fBwinch\fP function does not return an error if the window contains
characters larger than 8-bits (255).
Only the low-order 8 bits of the character are used by \fBwinch\fP.
.SH NOTES .SH NOTES
Note that all of these routines may be macros. Note that all of these routines may be macros.
.SH PORTABILITY .SH PORTABILITY
These functions are described in the XSI Curses standard, Issue 4. These functions are described in the XSI Curses standard, Issue 4.
.SH SEE ALSO
\fBcurses\fR(3X).
.PP .PP
Comparable functions in the wide-character (ncursesw) library are Very old systems (before standardization) provide a different function
described in with the same name:
\fBcurs_in_wch\fR(3X). .bP
The \fBwinch\fP function was part of the original BSD curses library,
which stored a 7-bit character combined with the \fIstandout\fP attribute.
.IP
In BSD curses, \fBwinch\fP returned only the character (as an integer)
with the \fIstandout\fP attribute removed.
.bP
System V curses added support for several video attributes which
could be combined with characters in the window.
.IP
Reflecting this improvment, the function was altered to return the
character combined with all video attributes in a \fBchtype\fP value.
.PP
X/Open Curses does not specify
the size and layout of attributes, color and character values in
\fBchtype\fP; it is implementation-dependent.
This implementation uses 8 bits for character values.
An application using more bits, e.g., a Unicode value,
should use the wide-character equivalents to these functions.
.SH SEE ALSO
.TP 5
\fBcurses\fR(3X)
gives an overview of the WINDOW and \fBchtype\fP data types.
.TP 5
\fBcurs_attr\fR(3X)
goes into more detail, pointing out portability problems and
constraints on the use of \fBchtype\fP for returning window information.
.TP 5
\fBcurs_in_wch\fR(3X)
describes comparable functions for the wide-character (ncursesw) library.

View File

@ -1,8 +1,8 @@
ncurses6 (6.0+20171007) unstable; urgency=low ncurses6 (6.0+20171014) unstable; urgency=low
* latest weekly patch * latest weekly patch
-- Thomas E. Dickey <dickey@invisible-island.net> Sun, 01 Oct 2017 21:01:40 -0400 -- Thomas E. Dickey <dickey@invisible-island.net> Sun, 08 Oct 2017 19:38:02 -0400
ncurses6 (5.9-20131005) unstable; urgency=low ncurses6 (5.9-20131005) unstable; urgency=low

View File

@ -1,8 +1,8 @@
ncurses6 (6.0+20171007) unstable; urgency=low ncurses6 (6.0+20171014) unstable; urgency=low
* latest weekly patch * latest weekly patch
-- Thomas E. Dickey <dickey@invisible-island.net> Sun, 01 Oct 2017 21:01:40 -0400 -- Thomas E. Dickey <dickey@invisible-island.net> Sun, 08 Oct 2017 19:38:02 -0400
ncurses6 (5.9-20131005) unstable; urgency=low ncurses6 (5.9-20131005) unstable; urgency=low

View File

@ -1,8 +1,8 @@
ncurses6 (6.0+20171007) unstable; urgency=low ncurses6 (6.0+20171014) unstable; urgency=low
* latest weekly patch * latest weekly patch
-- Thomas E. Dickey <dickey@invisible-island.net> Sun, 01 Oct 2017 21:01:40 -0400 -- Thomas E. Dickey <dickey@invisible-island.net> Sun, 08 Oct 2017 19:38:02 -0400
ncurses6 (5.9-20120608) unstable; urgency=low ncurses6 (5.9-20120608) unstable; urgency=low

View File

@ -1,4 +1,4 @@
; $Id: mingw-ncurses.nsi,v 1.234 2017/10/02 01:01:40 tom Exp $ ; $Id: mingw-ncurses.nsi,v 1.235 2017/10/08 23:38:02 tom Exp $
; TODO add examples ; TODO add examples
; TODO bump ABI to 6 ; TODO bump ABI to 6
@ -10,7 +10,7 @@
!define VERSION_MAJOR "6" !define VERSION_MAJOR "6"
!define VERSION_MINOR "0" !define VERSION_MINOR "0"
!define VERSION_YYYY "2017" !define VERSION_YYYY "2017"
!define VERSION_MMDD "1007" !define VERSION_MMDD "1014"
!define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD} !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD}
!define MY_ABI "5" !define MY_ABI "5"

View File

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

View File

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

View File

@ -30,7 +30,7 @@
* Author: Thomas E. Dickey 1997-on * * Author: Thomas E. Dickey 1997-on *
****************************************************************************/ ****************************************************************************/
/* /*
* $Id: progs.priv.h,v 1.45 2017/10/07 20:42:10 tom Exp $ * $Id: progs.priv.h,v 1.46 2017/10/09 00:30:38 tom Exp $
* *
* progs.priv.h * progs.priv.h
* *
@ -138,6 +138,8 @@ extern int optind;
#endif #endif
#endif #endif
#define VtoTrace(opt) (unsigned) ((opt > 0) ? opt : (opt == 0))
/* error-returns for tput */ /* error-returns for tput */
#define ErrUsage 2 #define ErrUsage 2
#define ErrTermType 3 #define ErrTermType 3

View File

@ -38,7 +38,7 @@
#include <progs.priv.h> #include <progs.priv.h>
#include <tty_settings.h> #include <tty_settings.h>
MODULE_ID("$Id: tabs.c,v 1.40 2017/10/07 19:34:58 tom Exp $") MODULE_ID("$Id: tabs.c,v 1.41 2017/10/12 22:42:08 tom Exp $")
static void usage(void) GCC_NORETURN; static void usage(void) GCC_NORETURN;
@ -458,7 +458,7 @@ main(int argc, char *argv[])
if (*++option != '\0') { if (*++option != '\0') {
term_name = option; term_name = option;
} else { } else {
term_name = argv[n++]; term_name = argv[n];
option--; option--;
} }
option += ((int) strlen(option)) - 1; option += ((int) strlen(option)) - 1;

View File

@ -48,7 +48,7 @@
#include <parametrized.h> #include <parametrized.h>
#include <transform.h> #include <transform.h>
MODULE_ID("$Id: tic.c,v 1.244 2017/09/20 00:39:37 tom Exp $") MODULE_ID("$Id: tic.c,v 1.247 2017/10/09 15:16:15 tom Exp $")
#define STDIN_NAME "<stdin>" #define STDIN_NAME "<stdin>"
@ -674,8 +674,6 @@ add_digit(int *target, int source)
*target = (*target * 10) + (source - '0'); *target = (*target * 10) + (source - '0');
} }
#define VtoTrace(opt) (unsigned) ((opt > 0) ? opt : (opt == 0))
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
@ -1925,7 +1923,7 @@ skip_DECSCNM(const char *value, int *flag)
} }
static void static void
check_delays(const char *name, const char *value) check_delays(TERMTYPE2 *tp, const char *name, const char *value)
{ {
const char *p, *q; const char *p, *q;
const char *first = 0; const char *first = 0;
@ -1975,6 +1973,14 @@ check_delays(const char *name, const char *value)
_nc_warning("function-key %s has delay", name); _nc_warning("function-key %s has delay", name);
} else if (proportional && !line_capability(name)) { } else if (proportional && !line_capability(name)) {
_nc_warning("non-line capability using proportional delay: %s", name); _nc_warning("non-line capability using proportional delay: %s", name);
} else if (!xon_xoff &&
!mandatory &&
strchr(_nc_first_name(tp->term_names), '+') == 0) {
_nc_warning("%s in %s is used since no xon/xoff",
(proportional
? "proportional delay"
: "delay"),
name);
} }
} else { } else {
p = q - 1; /* restart scan */ p = q - 1; /* restart scan */
@ -2703,7 +2709,7 @@ check_termtype(TERMTYPE2 *tp, bool literal)
parametrized[j] > 0) { parametrized[j] > 0) {
check_params(tp, name, a, (j >= STRCOUNT)); check_params(tp, name, a, (j >= STRCOUNT));
} }
check_delays(ExtStrname(tp, (int) j, strnames), a); check_delays(tp, ExtStrname(tp, (int) j, strnames), a);
if (capdump) { if (capdump) {
check_infotocap(tp, (int) j, a); check_infotocap(tp, (int) j, a);
} }

View File

@ -50,7 +50,7 @@
#include <transform.h> #include <transform.h>
#include <tty_settings.h> #include <tty_settings.h>
MODULE_ID("$Id: tput.c,v 1.77 2017/10/07 23:51:01 tom Exp $") MODULE_ID("$Id: tput.c,v 1.78 2017/10/14 20:46:43 tom Exp $")
#define PUTS(s) fputs(s, stdout) #define PUTS(s) fputs(s, stdout)
@ -316,7 +316,10 @@ main(int argc, char **argv)
} }
is_alias = (is_clear || is_reset || is_init); is_alias = (is_clear || is_reset || is_init);
need_tty = (is_reset || is_init); need_tty = ((is_reset || is_init) ||
(optind < argc &&
(!strcmp(argv[optind], "reset") ||
!strcmp(argv[optind], "init"))));
/* /*
* Modify the argument list to omit the options we processed. * Modify the argument list to omit the options we processed.

View File

@ -26,7 +26,7 @@
* authorization. * * authorization. *
****************************************************************************/ ****************************************************************************/
/* /*
* $Id: demo_new_pair.c,v 1.17 2017/09/28 23:17:56 tom Exp $ * $Id: demo_new_pair.c,v 1.18 2017/10/11 22:16:14 tom Exp $
* *
* Demonstrate the alloc_pair() function. * Demonstrate the alloc_pair() function.
*/ */
@ -323,7 +323,9 @@ main(int argc, char *argv[])
break; break;
wch[0] = use_wide ? 0xff03 : '#'; wch[0] = use_wide ? 0xff03 : '#';
wch[1] = 0; wch[1] = 0;
setcchar(&temp, wch, my_attrs, (short) my_pair, NULL); setcchar(&temp, wch, my_attrs,
(short) my_pair,
(use_init ? NULL : (void *) &my_pair));
/* /*
* At the end of a page, move the cursor to the home position. * At the end of a page, move the cursor to the home position.
*/ */

View File

@ -29,7 +29,7 @@
/* /*
* Author: Thomas E. Dickey <dickey@clark.net> 1999 * Author: Thomas E. Dickey <dickey@clark.net> 1999
* *
* $Id: dots.c,v 1.26 2017/09/30 17:55:22 tom Exp $ * $Id: dots.c,v 1.28 2017/10/11 08:15:27 tom Exp $
* *
* A simple demo of the terminfo interface. * A simple demo of the terminfo interface.
*/ */
@ -40,8 +40,6 @@
#include <time.h> #include <time.h>
#define valid(s) ((s != 0) && s != (char *)-1)
static bool interrupted = FALSE; static bool interrupted = FALSE;
static long total_chars = 0; static long total_chars = 0;
static time_t started; static time_t started;
@ -64,7 +62,7 @@ TPUTS_PROTO(outc, c)
static bool static bool
outs(const char *s) outs(const char *s)
{ {
if (valid(s)) { if (VALID_STRING(s)) {
tputs(s, 1, outc); tputs(s, 1, outc);
return TRUE; return TRUE;
} }
@ -80,7 +78,7 @@ cleanup(void)
outs(clear_screen); outs(clear_screen);
outs(cursor_normal); outs(cursor_normal);
printf("\n\n%ld total chars, rate %.2f/sec\n", printf("\n\n%ld total cells, rate %.2f/sec\n",
total_chars, total_chars,
((double) (total_chars) / (double) (time((time_t *) 0) - started))); ((double) (total_chars) / (double) (time((time_t *) 0) - started)));
} }
@ -113,9 +111,9 @@ main(int argc GCC_UNUSED,
outs(cursor_invisible); outs(cursor_invisible);
my_colors = max_colors; my_colors = max_colors;
if (my_colors > 1) { if (my_colors > 1) {
if (!valid(set_a_foreground) if (!VALID_STRING(set_a_foreground)
|| !valid(set_a_background) || !VALID_STRING(set_a_background)
|| (!valid(orig_colors) && !valid(orig_pair))) || (!VALID_STRING(orig_colors) && !VALID_STRING(orig_pair)))
my_colors = -1; my_colors = -1;
} }
@ -137,8 +135,8 @@ main(int argc GCC_UNUSED,
tputs(tparm2(set_a_background, z), 1, outc); tputs(tparm2(set_a_background, z), 1, outc);
napms(1); napms(1);
} }
} else if (valid(exit_attribute_mode) } else if (VALID_STRING(exit_attribute_mode)
&& valid(enter_reverse_mode)) { && VALID_STRING(enter_reverse_mode)) {
if (ranf() <= 0.01) { if (ranf() <= 0.01) {
outs((ranf() > 0.6) outs((ranf() > 0.6)
? enter_reverse_mode ? enter_reverse_mode

View File

@ -29,7 +29,7 @@
/* /*
* Author: Thomas E. Dickey * Author: Thomas E. Dickey
* *
* $Id: dots_curses.c,v 1.5 2017/09/30 15:41:17 tom Exp $ * $Id: dots_curses.c,v 1.7 2017/10/11 08:16:33 tom Exp $
* *
* A simple demo of the curses interface used for comparison with termcap. * A simple demo of the curses interface used for comparison with termcap.
*/ */
@ -41,8 +41,6 @@
#include <time.h> #include <time.h>
#define valid(s) ((s != 0) && s != (char *)-1)
static bool interrupted = FALSE; static bool interrupted = FALSE;
static long total_chars = 0; static long total_chars = 0;
static time_t started; static time_t started;
@ -52,7 +50,7 @@ cleanup(void)
{ {
endwin(); endwin();
printf("\n\n%ld total chars, rate %.2f/sec\n", printf("\n\n%ld total cells, rate %.2f/sec\n",
total_chars, total_chars,
((double) (total_chars) / (double) (time((time_t *) 0) - started))); ((double) (total_chars) / (double) (time((time_t *) 0) - started)));
} }

View File

@ -29,7 +29,7 @@
/* /*
* Author: Thomas E. Dickey - 2007 * Author: Thomas E. Dickey - 2007
* *
* $Id: dots_mvcur.c,v 1.13 2017/09/30 21:34:15 tom Exp $ * $Id: dots_mvcur.c,v 1.15 2017/10/11 08:15:46 tom Exp $
* *
* A simple demo of the terminfo interface, and mvcur. * A simple demo of the terminfo interface, and mvcur.
*/ */
@ -40,8 +40,6 @@
#include <time.h> #include <time.h>
#define valid(s) ((s != 0) && s != (char *)-1)
static bool interrupted = FALSE; static bool interrupted = FALSE;
static long total_chars = 0; static long total_chars = 0;
static time_t started; static time_t started;
@ -65,7 +63,7 @@ TPUTS_PROTO(outc, c)
static bool static bool
outs(const char *s) outs(const char *s)
{ {
if (valid(s)) { if (VALID_STRING(s)) {
tputs(s, 1, outc); tputs(s, 1, outc);
return TRUE; return TRUE;
} }
@ -81,7 +79,7 @@ cleanup(void)
outs(clear_screen); outs(clear_screen);
outs(cursor_normal); outs(cursor_normal);
printf("\n\n%ld total chars, rate %.2f/sec\n", printf("\n\n%ld total cells, rate %.2f/sec\n",
total_chars, total_chars,
((double) (total_chars) / (double) (time((time_t *) 0) - started))); ((double) (total_chars) / (double) (time((time_t *) 0) - started)));
} }
@ -125,9 +123,9 @@ main(int argc GCC_UNUSED,
outs(cursor_invisible); outs(cursor_invisible);
my_colors = max_colors; my_colors = max_colors;
if (my_colors > 1) { if (my_colors > 1) {
if (!valid(set_a_foreground) if (!VALID_STRING(set_a_foreground)
|| !valid(set_a_background) || !VALID_STRING(set_a_background)
|| (!valid(orig_colors) && !valid(orig_pair))) || (!VALID_STRING(orig_colors) && !VALID_STRING(orig_pair)))
my_colors = -1; my_colors = -1;
} }
@ -153,8 +151,8 @@ main(int argc GCC_UNUSED,
tputs(tparm2(set_a_background, z), 1, outc); tputs(tparm2(set_a_background, z), 1, outc);
napms(1); napms(1);
} }
} else if (valid(exit_attribute_mode) } else if (VALID_STRING(exit_attribute_mode)
&& valid(enter_reverse_mode)) { && VALID_STRING(enter_reverse_mode)) {
if (ranf() <= 0.01) { if (ranf() <= 0.01) {
outs((ranf() > 0.6) outs((ranf() > 0.6)
? enter_reverse_mode ? enter_reverse_mode

View File

@ -29,7 +29,7 @@
/* /*
* Author: Thomas E. Dickey * Author: Thomas E. Dickey
* *
* $Id: dots_termcap.c,v 1.10 2017/09/30 17:55:22 tom Exp $ * $Id: dots_termcap.c,v 1.12 2017/10/11 08:15:07 tom Exp $
* *
* A simple demo of the termcap interface. * A simple demo of the termcap interface.
*/ */
@ -44,8 +44,6 @@
#include <time.h> #include <time.h>
#define valid(s) ((s != 0) && s != (char *)-1)
static bool interrupted = FALSE; static bool interrupted = FALSE;
static long total_chars = 0; static long total_chars = 0;
static time_t started; static time_t started;
@ -116,7 +114,7 @@ TPUTS_PROTO(outc, c)
static bool static bool
outs(char *s) outs(char *s)
{ {
if (valid(s)) { if (VALID_STRING(s)) {
tputs(s, 1, outc); tputs(s, 1, outc);
return TRUE; return TRUE;
} }
@ -132,7 +130,7 @@ cleanup(void)
outs(t_cl); outs(t_cl);
outs(t_ve); outs(t_ve);
printf("\n\n%ld total chars, rate %.2f/sec\n", printf("\n\n%ld total cells, rate %.2f/sec\n",
total_chars, total_chars,
((double) (total_chars) / (double) (time((time_t *) 0) - started))); ((double) (total_chars) / (double) (time((time_t *) 0) - started)));
} }
@ -203,9 +201,9 @@ main(int argc GCC_UNUSED,
outs(t_cl); outs(t_cl);
outs(t_vi); outs(t_vi);
if (num_colors > 1) { if (num_colors > 1) {
if (!valid(t_AF) if (!VALID_STRING(t_AF)
|| !valid(t_AB) || !VALID_STRING(t_AB)
|| (!valid(t_oc) && !valid(t_op))) || (!VALID_STRING(t_oc) && !VALID_STRING(t_op)))
num_colors = -1; num_colors = -1;
} }
@ -227,8 +225,8 @@ main(int argc GCC_UNUSED,
tputs(tgoto(t_AB, 0, z), 1, outc); tputs(tgoto(t_AB, 0, z), 1, outc);
my_napms(1); my_napms(1);
} }
} else if (valid(t_me) } else if (VALID_STRING(t_me)
&& valid(t_mr)) { && VALID_STRING(t_mr)) {
if (ranf() <= 0.01) { if (ranf() <= 0.01) {
outs((ranf() > 0.6) outs((ranf() > 0.6)
? t_mr ? t_mr

237
test/dots_xcurses.c Normal file
View File

@ -0,0 +1,237 @@
/****************************************************************************
* Copyright (c) 2017 Free Software Foundation, Inc. *
* *
* 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. *
****************************************************************************/
/*
* Author: Thomas E. Dickey
*
* $Id: dots_xcurses.c,v 1.8 2017/10/12 00:20:41 tom Exp $
*
* A simple demo of the wide-curses interface used for comparison with termcap.
*/
#include <test.priv.h>
#if !defined(__MINGW32__)
#include <sys/time.h>
#endif
#include <time.h>
#if USE_WIDEC_SUPPORT
#if HAVE_ALLOC_PAIR
#define NewPair(n) x_option ? ((void *)&(n)) : NULL
#else
#define NewPair(n) NULL
#endif
#define InitPair(p,fg,bg) init_pair((short) (p), (short) (fg), (short) (bg))
static bool interrupted = FALSE;
static long total_chars = 0;
static time_t started;
#ifdef NCURSES_VERSION
static bool d_option = FALSE;
static bool x_option = FALSE;
#endif
static void
cleanup(void)
{
endwin();
printf("\n\n%ld total cells, rate %.2f/sec\n",
total_chars,
((double) (total_chars) / (double) (time((time_t *) 0) - started)));
}
static void
onsig(int n GCC_UNUSED)
{
interrupted = TRUE;
}
static double
ranf(void)
{
long r = (rand() & 077777);
return ((double) r / 32768.);
}
static int
mypair(int fg, int bg)
{
int result;
#if HAVE_ALLOC_PAIR
if (x_option) {
result = alloc_pair(fg, bg);
} else
#endif
{
int pair = (fg * COLORS) + bg;
result = (pair >= COLOR_PAIRS) ? -1 : pair;
}
return result;
}
static void
set_colors(int fg, int bg)
{
int pair = mypair(fg, bg);
if (pair > 0) {
color_set((short) pair, NewPair(pair));
}
}
#if defined(NCURSES_VERSION)
static void
usage(void)
{
static const char *msg[] =
{
"Usage: firework [options]"
,""
,"Options:"
#if HAVE_USE_DEFAULT_COLORS
," -d invoke use_default_colors()"
#endif
#if HAVE_ALLOC_PAIR
," -x use alloc_pair() rather than init_pair()"
#endif
};
size_t n;
for (n = 0; n < SIZEOF(msg); n++)
fprintf(stderr, "%s\n", msg[n]);
ExitProgram(EXIT_FAILURE);
}
#endif
int
main(int argc GCC_UNUSED,
char *argv[]GCC_UNUSED)
{
int margin = 2;
int x, y, z, p;
int fg, bg, ch;
wchar_t wch[2];
int pair;
double r;
double c;
#if defined(NCURSES_VERSION)
while ((ch = getopt(argc, argv, "dx")) != -1) {
switch (ch) {
case 'd':
d_option = TRUE;
break;
#if HAVE_ALLOC_PAIR
case 'x':
x_option = TRUE;
break;
#endif
default:
usage();
break;
}
}
#endif
srand((unsigned) time(0));
InitAndCatch(initscr(), onsig);
if (has_colors()) {
start_color();
#if HAVE_USE_DEFAULT_COLORS
if (d_option)
use_default_colors();
#endif
if (x_option) {
; /* nothing */
} else {
for (fg = 0; fg < COLORS; fg++) {
for (bg = 0; bg < COLORS; bg++) {
pair = mypair(fg, bg);
if (pair > 0) {
InitPair(pair, fg, bg);
}
}
}
}
}
r = (double) (LINES - (2 * margin));
c = (double) (COLS - (2 * margin));
started = time((time_t *) 0);
fg = COLOR_WHITE;
bg = COLOR_BLACK;
pair = 0;
wch[1] = 0;
while (!interrupted) {
x = (int) (c * ranf()) + margin;
y = (int) (r * ranf()) + margin;
p = (ranf() > 0.9) ? '*' : ' ';
move(y, x);
if (has_colors()) {
z = (int) (ranf() * COLORS);
if (ranf() > 0.01) {
set_colors(fg = z, bg);
} else {
set_colors(fg, bg = z);
napms(1);
}
} else {
if (ranf() <= 0.01) {
if (ranf() > 0.6) {
attr_on(WA_REVERSE, NULL);
} else {
attr_off(WA_REVERSE, NULL);
}
napms(1);
}
}
wch[0] = p;
addnwstr(wch, 1);
refresh();
++total_chars;
}
cleanup();
ExitProgram(EXIT_SUCCESS);
}
#else
int
main(void)
{
printf("This program requires the wide-ncurses library\n");
ExitProgram(EXIT_FAILURE);
}
#endif

View File

@ -26,7 +26,7 @@
* authorization. * * authorization. *
****************************************************************************/ ****************************************************************************/
/* /*
* $Id: echochar.c,v 1.15 2017/09/30 15:42:10 tom Exp $ * $Id: echochar.c,v 1.17 2017/10/11 08:16:12 tom Exp $
* *
* Demonstrate the echochar function (compare to dots.c). * Demonstrate the echochar function (compare to dots.c).
* Thomas Dickey - 2006/11/4 * Thomas Dickey - 2006/11/4
@ -36,8 +36,6 @@
#include <time.h> #include <time.h>
#define valid(s) ((s != 0) && s != (char *)-1)
static bool interrupted = FALSE; static bool interrupted = FALSE;
static long total_chars = 0; static long total_chars = 0;
static time_t started; static time_t started;
@ -47,7 +45,7 @@ cleanup(void)
{ {
exit_curses(); exit_curses();
printf("\n\n%ld total chars, rate %.2f/sec\n", printf("\n\n%ld total cells, rate %.2f/sec\n",
total_chars, total_chars,
((double) (total_chars) / (double) (time((time_t *) 0) - started))); ((double) (total_chars) / (double) (time((time_t *) 0) - started)));
} }

View File

@ -1,4 +1,4 @@
# $Id: modules,v 1.64 2017/06/24 18:26:44 tom Exp $ # $Id: modules,v 1.65 2017/10/11 08:08:41 tom Exp $
############################################################################## ##############################################################################
# Copyright (c) 1998-2016,2017 Free Software Foundation, Inc. # # Copyright (c) 1998-2016,2017 Free Software Foundation, Inc. #
# # # #
@ -53,6 +53,7 @@ dots progs $(srcdir) $(HEADER_DEPS)
dots_curses progs $(srcdir) $(HEADER_DEPS) dots_curses progs $(srcdir) $(HEADER_DEPS)
dots_mvcur progs $(srcdir) $(HEADER_DEPS) dots_mvcur progs $(srcdir) $(HEADER_DEPS)
dots_termcap progs $(srcdir) $(HEADER_DEPS) dots_termcap progs $(srcdir) $(HEADER_DEPS)
dots_xcurses progs $(srcdir) $(HEADER_DEPS)
echochar progs $(srcdir) $(HEADER_DEPS) echochar progs $(srcdir) $(HEADER_DEPS)
edit_field progs $(srcdir) $(HEADER_DEPS) $(srcdir)/edit_field.h $(srcdir)/popup_msg.h edit_field progs $(srcdir) $(HEADER_DEPS) $(srcdir)/edit_field.h $(srcdir)/popup_msg.h
extended_color progs $(srcdir) $(HEADER_DEPS) extended_color progs $(srcdir) $(HEADER_DEPS)

View File

@ -1,4 +1,4 @@
# $Id: programs,v 1.39 2017/07/01 20:14:35 tom Exp $ # $Id: programs,v 1.40 2017/10/11 08:08:41 tom Exp $
############################################################################## ##############################################################################
# Copyright (c) 2006-2016,2017 Free Software Foundation, Inc. # # Copyright (c) 2006-2016,2017 Free Software Foundation, Inc. #
# # # #
@ -51,6 +51,7 @@ dots $(LDFLAGS_TINFO) $(LOCAL_LIBS) dots
dots_curses $(LDFLAGS_CURSES) $(LOCAL_LIBS) dots_curses dots_curses $(LDFLAGS_CURSES) $(LOCAL_LIBS) dots_curses
dots_mvcur $(LDFLAGS_CURSES) $(LOCAL_LIBS) dots_mvcur dots_mvcur $(LDFLAGS_CURSES) $(LOCAL_LIBS) dots_mvcur
dots_termcap $(LDFLAGS_TINFO) $(LOCAL_LIBS) dots_termcap dots_termcap $(LDFLAGS_TINFO) $(LOCAL_LIBS) dots_termcap
dots_xcurses $(LDFLAGS_CURSES) $(LOCAL_LIBS) dots_xcurses
echochar $(LDFLAGS_CURSES) $(LOCAL_LIBS) echochar echochar $(LDFLAGS_CURSES) $(LOCAL_LIBS) echochar
extended_color $(LDFLAGS_CURSES) $(LOCAL_LIBS) extended_color extended_color $(LDFLAGS_CURSES) $(LOCAL_LIBS) extended_color
filter $(LDFLAGS_CURSES) $(LOCAL_LIBS) filter filter $(LDFLAGS_CURSES) $(LOCAL_LIBS) filter

View File

@ -29,7 +29,7 @@
/**************************************************************************** /****************************************************************************
* Author: Thomas E. Dickey 1996-on * * Author: Thomas E. Dickey 1996-on *
****************************************************************************/ ****************************************************************************/
/* $Id: test.priv.h,v 1.158 2017/09/30 17:58:37 tom Exp $ */ /* $Id: test.priv.h,v 1.160 2017/10/12 01:00:59 tom Exp $ */
#ifndef __TEST_PRIV_H #ifndef __TEST_PRIV_H
#define __TEST_PRIV_H 1 #define __TEST_PRIV_H 1
@ -571,38 +571,46 @@ extern int optind;
#undef WACS_NEQUAL #undef WACS_NEQUAL
#undef WACS_STERLING #undef WACS_STERLING
#define WACS_RARROW &(CURSES_WACS_ARRAY['+']) #define WACS_RARROW &(CURSES_WACS_ARRAY['+'])
#define WACS_LARROW &(CURSES_WACS_ARRAY[',']) #define WACS_LARROW &(CURSES_WACS_ARRAY[','])
#define WACS_UARROW &(CURSES_WACS_ARRAY['-']) #define WACS_UARROW &(CURSES_WACS_ARRAY['-'])
#define WACS_DARROW &(CURSES_WACS_ARRAY['.']) #define WACS_DARROW &(CURSES_WACS_ARRAY['.'])
#define WACS_BLOCK &(CURSES_WACS_ARRAY['0']) #define WACS_BLOCK &(CURSES_WACS_ARRAY['0'])
#define WACS_DIAMOND &(CURSES_WACS_ARRAY['`']) #define WACS_DIAMOND &(CURSES_WACS_ARRAY['`'])
#define WACS_CKBOARD &(CURSES_WACS_ARRAY['a']) #define WACS_CKBOARD &(CURSES_WACS_ARRAY['a'])
#define WACS_DEGREE &(CURSES_WACS_ARRAY['f']) #define WACS_DEGREE &(CURSES_WACS_ARRAY['f'])
#define WACS_PLMINUS &(CURSES_WACS_ARRAY['g']) #define WACS_PLMINUS &(CURSES_WACS_ARRAY['g'])
#define WACS_BOARD &(CURSES_WACS_ARRAY['h']) #define WACS_BOARD &(CURSES_WACS_ARRAY['h'])
#define WACS_LANTERN &(CURSES_WACS_ARRAY['i']) #define WACS_LANTERN &(CURSES_WACS_ARRAY['i'])
#define WACS_LRCORNER &(CURSES_WACS_ARRAY['j']) #define WACS_LRCORNER &(CURSES_WACS_ARRAY['j'])
#define WACS_URCORNER &(CURSES_WACS_ARRAY['k']) #define WACS_URCORNER &(CURSES_WACS_ARRAY['k'])
#define WACS_ULCORNER &(CURSES_WACS_ARRAY['l']) #define WACS_ULCORNER &(CURSES_WACS_ARRAY['l'])
#define WACS_LLCORNER &(CURSES_WACS_ARRAY['m']) #define WACS_LLCORNER &(CURSES_WACS_ARRAY['m'])
#define WACS_PLUS &(CURSES_WACS_ARRAY['n']) #define WACS_PLUS &(CURSES_WACS_ARRAY['n'])
#define WACS_HLINE &(CURSES_WACS_ARRAY['q']) #define WACS_HLINE &(CURSES_WACS_ARRAY['q'])
#define WACS_S1 &(CURSES_WACS_ARRAY['o']) #define WACS_S1 &(CURSES_WACS_ARRAY['o'])
#define WACS_S9 &(CURSES_WACS_ARRAY['s']) #define WACS_S9 &(CURSES_WACS_ARRAY['s'])
#define WACS_LTEE &(CURSES_WACS_ARRAY['t']) #define WACS_LTEE &(CURSES_WACS_ARRAY['t'])
#define WACS_RTEE &(CURSES_WACS_ARRAY['u']) #define WACS_RTEE &(CURSES_WACS_ARRAY['u'])
#define WACS_BTEE &(CURSES_WACS_ARRAY['v']) #define WACS_BTEE &(CURSES_WACS_ARRAY['v'])
#define WACS_TTEE &(CURSES_WACS_ARRAY['w']) #define WACS_TTEE &(CURSES_WACS_ARRAY['w'])
#define WACS_VLINE &(CURSES_WACS_ARRAY['x']) #define WACS_VLINE &(CURSES_WACS_ARRAY['x'])
#define WACS_BULLET &(CURSES_WACS_ARRAY['~']) #define WACS_BULLET &(CURSES_WACS_ARRAY['~'])
#define WACS_S3 &(CURSES_WACS_ARRAY['p']) #define WACS_S3 &(CURSES_WACS_ARRAY['p'])
#define WACS_S7 &(CURSES_WACS_ARRAY['r']) #define WACS_S7 &(CURSES_WACS_ARRAY['r'])
#define WACS_LEQUAL &(CURSES_WACS_ARRAY['y']) #define WACS_LEQUAL &(CURSES_WACS_ARRAY['y'])
#define WACS_GEQUAL &(CURSES_WACS_ARRAY['z']) #define WACS_GEQUAL &(CURSES_WACS_ARRAY['z'])
#define WACS_PI &(CURSES_WACS_ARRAY['{']) #define WACS_PI &(CURSES_WACS_ARRAY['{'])
#define WACS_NEQUAL &(CURSES_WACS_ARRAY['|']) #define WACS_NEQUAL &(CURSES_WACS_ARRAY['|'])
#define WACS_STERLING &(CURSES_WACS_ARRAY['}']) #define WACS_STERLING &(CURSES_WACS_ARRAY['}'])
#endif
#ifndef WA_NORMAL
#define WA_NORMAL A_NORMAL
#define WA_BOLD A_BOLD
#define WA_REVERSE A_REVERSE
#define WA_UNDERLINE A_UNDERLINE
#define WA_BLINK A_BLINK
#endif #endif
#ifndef OK #ifndef OK
@ -691,7 +699,7 @@ extern char *strnames[], *strcodes[], *strfnames[];
#define DECL_CURSES_DATA_TTYTYPE 0 #define DECL_CURSES_DATA_TTYTYPE 0
#endif #endif
#if !HAVE_CURSES_DATA_TTYTYPE || DECL_CURSES_DATA_TTYTYPE #if !defined(ttytype) && (!HAVE_CURSES_DATA_TTYTYPE || DECL_CURSES_DATA_TTYTYPE)
#define ttytype termname() #define ttytype termname()
#endif #endif

View File

@ -26,7 +26,7 @@
* authorization. * * authorization. *
****************************************************************************/ ****************************************************************************/
/* /*
* $Id: test_termattrs.c,v 1.1 2017/06/24 18:26:15 tom Exp $ * $Id: test_termattrs.c,v 1.2 2017/10/11 08:16:02 tom Exp $
* *
* Demonstrate the termattrs and term_attrs functions. * Demonstrate the termattrs and term_attrs functions.
*/ */
@ -36,8 +36,6 @@
#if HAVE_SETUPTERM #if HAVE_SETUPTERM
#define valid(s) ((s != 0) && s != (char *)-1)
static FILE *my_fp; static FILE *my_fp;
static void static void

View File

@ -26,7 +26,7 @@
* authorization. * * authorization. *
****************************************************************************/ ****************************************************************************/
/* /*
* $Id: test_vid_puts.c,v 1.9 2017/06/24 17:48:04 tom Exp $ * $Id: test_vid_puts.c,v 1.10 2017/10/11 08:16:24 tom Exp $
* *
* Demonstrate the vid_puts and vid_attr functions. * Demonstrate the vid_puts and vid_attr functions.
* Thomas Dickey - 2013/01/12 * Thomas Dickey - 2013/01/12
@ -37,8 +37,6 @@
#if USE_WIDEC_SUPPORT && HAVE_SETUPTERM && HAVE_VID_PUTS #if USE_WIDEC_SUPPORT && HAVE_SETUPTERM && HAVE_VID_PUTS
#define valid(s) ((s != 0) && s != (char *)-1)
static FILE *my_fp; static FILE *my_fp;
static bool p_opt = FALSE; static bool p_opt = FALSE;
@ -54,7 +52,7 @@ TPUTS_PROTO(outc, c)
static bool static bool
outs(const char *s) outs(const char *s)
{ {
if (valid(s)) { if (VALID_STRING(s)) {
tputs(s, 1, outc); tputs(s, 1, outc);
return TRUE; return TRUE;
} }

View File

@ -26,7 +26,7 @@
* authorization. * * authorization. *
****************************************************************************/ ****************************************************************************/
/* /*
* $Id: test_vidputs.c,v 1.8 2017/06/24 17:48:17 tom Exp $ * $Id: test_vidputs.c,v 1.9 2017/10/11 08:17:07 tom Exp $
* *
* Demonstrate the vidputs and vidattr functions. * Demonstrate the vidputs and vidattr functions.
* Thomas Dickey - 2013/01/12 * Thomas Dickey - 2013/01/12
@ -37,8 +37,6 @@
#if HAVE_SETUPTERM && HAVE_VIDPUTS #if HAVE_SETUPTERM && HAVE_VIDPUTS
#define valid(s) ((s != 0) && s != (char *)-1)
static FILE *my_fp; static FILE *my_fp;
static bool p_opt = FALSE; static bool p_opt = FALSE;
@ -54,7 +52,7 @@ TPUTS_PROTO(outc, c)
static bool static bool
outs(const char *s) outs(const char *s)
{ {
if (valid(s)) { if (VALID_STRING(s)) {
tputs(s, 1, outc); tputs(s, 1, outc);
return TRUE; return TRUE;
} }

View File

@ -50,17 +50,20 @@
* scroll operation worked, and the refresh() code only had to do a * scroll operation worked, and the refresh() code only had to do a
* partial repaint. * partial repaint.
* *
* $Id: view.c,v 1.104 2017/09/30 17:50:38 tom Exp $ * $Id: view.c,v 1.111 2017/10/15 00:56:58 tom Exp $
*/ */
#include <test.priv.h> #include <test.priv.h>
#include <widechars.h> #include <widechars.h>
#include <popup_msg.h> #include <popup_msg.h>
#include <sys/stat.h>
#include <time.h> #include <time.h>
#undef CTRL /* conflict on AIX 5.2 with <sys/ioctl.h> */ #undef CTRL /* conflict on AIX 5.2 with <sys/ioctl.h> */
static void finish(int sig) GCC_NORETURN;
#if HAVE_TERMIOS_H #if HAVE_TERMIOS_H
# include <termios.h> # include <termios.h>
#else #else
@ -86,9 +89,6 @@
#undef CTRL #undef CTRL
#define CTRL(x) ((x) & 0x1f) #define CTRL(x) ((x) & 0x1f)
static void finish(int sig) GCC_NORETURN;
static void show_all(const char *tag);
#if defined(SIGWINCH) && defined(TIOCGWINSZ) && HAVE_RESIZE_TERM #if defined(SIGWINCH) && defined(TIOCGWINSZ) && HAVE_RESIZE_TERM
#define CAN_RESIZE 1 #define CAN_RESIZE 1
#else #else
@ -96,7 +96,6 @@ static void show_all(const char *tag);
#endif #endif
#if CAN_RESIZE #if CAN_RESIZE
static void adjust(int sig);
static int interrupted; static int interrupted;
static bool waiting = FALSE; static bool waiting = FALSE;
#endif #endif
@ -111,6 +110,13 @@ static int num_lines;
static void usage(void) GCC_NORETURN; static void usage(void) GCC_NORETURN;
static void
failed(const char *msg)
{
fprintf(stderr, "%s\n", msg);
ExitProgram(EXIT_FAILURE);
}
static void static void
usage(void) usage(void)
{ {
@ -121,7 +127,6 @@ usage(void)
,"Options:" ,"Options:"
," -c use color if terminal supports it" ," -c use color if terminal supports it"
," -i ignore INT, QUIT, TERM signals" ," -i ignore INT, QUIT, TERM signals"
," -n NUM specify maximum number of lines (default 1000)"
#if defined(KEY_RESIZE) #if defined(KEY_RESIZE)
," -r use old-style sigwinch handler rather than KEY_RESIZE" ," -r use old-style sigwinch handler rather than KEY_RESIZE"
#endif #endif
@ -225,121 +230,182 @@ ch_dup(char *src)
return dst; return dst;
} }
int static void
main(int argc, char *argv[]) finish(int sig)
{ {
static const char *help[] = endwin();
{ #if NO_LEAKS
"Commands:", if (vec_lines != 0) {
" q,^Q,ESC - quit this program", int n;
"", for (n = 0; n < num_lines; ++n) {
" p,<Up> - scroll the viewport up by one row", free(vec_lines[n]);
" n,<Down> - scroll the viewport down by one row", }
" l,<Left> - scroll the viewport left by one column", free(vec_lines);
" r,<Right> - scroll the viewport right by one column", }
"", #endif
" h,<Home> - scroll the viewport to top of file", ExitProgram(sig != 0 ? EXIT_FAILURE : EXIT_SUCCESS);
" e,<End> - scroll the viewport to end of file", }
"",
" ^L - repaint using redrawwin()",
"",
" 0 through 9 - enter digits for count",
" s - use entered count for halfdelay() parameter",
" - if no entered count, stop nodelay()",
" <space> - begin nodelay()",
0
};
int MAXLINES = 1000; static void
FILE *fp; show_all(const char *tag)
char buf[BUFSIZ]; {
int i; int i;
int my_delay = 0; char temp[BUFSIZ];
NCURSES_CH_T **olptr; NCURSES_CH_T *s;
int value = 0; time_t this_time;
bool done = FALSE;
bool got_number = FALSE;
bool ignore_sigs = FALSE;
bool single_step = FALSE;
#if CAN_RESIZE #if CAN_RESIZE
bool nonposix_resize = FALSE; _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp))
"%.20s (%3dx%3d) col %d ", tag, LINES, COLS, shift);
i = (int) strlen(temp);
if ((i + 7) < (int) sizeof(temp)) {
_nc_SPRINTF(temp + i, _nc_SLIMIT(sizeof(temp) - (size_t) i)
"view %.*s",
(int) (sizeof(temp) - 7 - (size_t) i),
fname);
}
#else
(void) tag;
_nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp))
"view %.*s", (int) sizeof(temp) - 7, fname);
#endif #endif
const char *my_label = "Input"; move(0, 0);
printw("%.*s", COLS, temp);
clrtoeol();
this_time = time((time_t *) 0);
_nc_STRNCPY(temp, ctime(&this_time), (size_t) 30);
if ((i = (int) strlen(temp)) != 0) {
temp[--i] = 0;
if (move(0, COLS - i - 2) != ERR)
printw(" %s", temp);
}
setlocale(LC_ALL, ""); scrollok(stdscr, FALSE); /* prevent screen from moving */
for (i = 1; i < LINES; i++) {
#ifndef NCURSES_VERSION int len;
/* int actual = (int) (lptr + i - vec_lines);
* We know ncurses will catch SIGINT if we don't establish our own handler. if (actual >= num_lines) {
* Other versions of curses may/may not catch it. clrtobot();
*/ break;
(void) signal(SIGINT, finish); /* arrange interrupts to terminate */ }
move(i, 0);
printw("%3d:", actual);
clrtoeol();
if ((s = lptr[i - 1]) == 0) {
continue;
}
len = ch_len(s);
if (len > shift) {
#if USE_WIDEC_SUPPORT
add_wchstr(s + shift);
#else
addchstr(s + shift);
#endif #endif
}
#if defined(NCURSES_VERSION) || defined(HAVE_WCHGAT)
if (try_color)
wchgat(stdscr, -1, WA_NORMAL, my_pair, NULL);
#endif
}
setscrreg(1, LINES - 1);
scrollok(stdscr, TRUE);
refresh();
}
while ((i = getopt(argc, argv, "cin:rstT:")) != -1) {
switch (i) {
case 'c':
try_color = TRUE;
break;
case 'i':
ignore_sigs = TRUE;
break;
case 'n':
if ((MAXLINES = atoi(optarg)) < 1 ||
(MAXLINES + 2) <= 1)
usage();
break;
#if CAN_RESIZE #if CAN_RESIZE
case 'r': /*
nonposix_resize = TRUE; * This uses functions that are "unsafe", but it seems to work on SunOS.
break; * Usually: the "unsafe" refers to the functions that POSIX lists which may be
#endif * called from a signal handler. Those do not include buffered I/O, which is
case 's': * used for instance in wrefresh(). To be really portable, you should use the
single_step = TRUE; * KEY_RESIZE return (which relies on ncurses' sigwinch handler).
break; *
#ifdef TRACE * The 'wrefresh(curscr)' is needed to force the refresh to start from the top
case 'T': * of the screen -- some xterms mangle the bitmap while resizing.
{ */
char *next = 0; static void
int tvalue = (int) strtol(optarg, &next, 0); adjust(int sig)
if (tvalue < 0 || (next != 0 && *next != 0)) {
usage(); if (waiting || sig == 0) {
trace((unsigned) tvalue); struct winsize size;
if (ioctl(fileno(stdout), TIOCGWINSZ, &size) == 0) {
resize_term(size.ws_row, size.ws_col);
wrefresh(curscr);
show_all(sig ? "SIGWINCH" : "interrupt");
}
interrupted = FALSE;
} else {
interrupted = TRUE;
}
(void) signal(SIGWINCH, adjust); /* some systems need this */
}
#endif /* CAN_RESIZE */
static void
read_file(const char *filename)
{
FILE *fp;
int pass;
int k;
size_t j;
size_t len;
struct stat sb;
char *my_blob;
char **my_vec = 0;
if (stat(filename, &sb) != 0
|| (sb.st_mode & S_IFMT) != S_IFREG) {
failed("input is not a file");
}
if (sb.st_size == 0) {
failed("input is empty");
}
if ((fp = fopen(filename, "r")) == 0) {
failed("cannot open input-file");
}
if ((my_blob = malloc((size_t) sb.st_size + 1)) == 0) {
failed("cannot allocate memory for input-file");
}
len = fread(my_blob, sizeof(char), (size_t) sb.st_size, fp);
my_blob[sb.st_size] = '\0';
fclose(fp);
for (pass = 0; pass < 2; ++pass) {
char *base = my_blob;
k = 0;
for (j = 0; j < len; ++j) {
if (my_blob[j] == '\n') {
if (pass) {
my_vec[k] = base;
my_blob[j] = '\0';
}
base = my_blob + j + 1;
++k;
} }
break; }
case 't': num_lines = k;
trace(TRACE_CALLS); if (base != (my_blob + j))
break; ++num_lines;
#endif if (!pass &&
default: ((my_vec = typeCalloc(char *, (size_t) k + 2)) == 0)) {
usage(); failed("cannot allocate line-vector #1");
} }
} }
if (optind + 1 != argc) if ((vec_lines = typeCalloc(NCURSES_CH_T *, (size_t) num_lines + 2)) == 0)
usage(); failed("cannot allocate line-vector #2");
if ((vec_lines = typeCalloc(NCURSES_CH_T *, (size_t) MAXLINES + 2)) == 0)
usage();
assert(vec_lines != 0);
fname = argv[optind];
if ((fp = fopen(fname, "r")) == 0) {
perror(fname);
ExitProgram(EXIT_FAILURE);
}
#if CAN_RESIZE
if (nonposix_resize)
(void) signal(SIGWINCH, adjust); /* arrange interrupts to resize */
#endif
Trace(("slurp the file")); Trace(("slurp the file"));
for (lptr = &vec_lines[0]; (lptr - vec_lines) < MAXLINES; lptr++) { for (k = 0; k < num_lines; ++k) {
char *buf = my_vec[k];
char temp[BUFSIZ], *s, *d; char temp[BUFSIZ], *s, *d;
int col; int col;
if (fgets(buf, sizeof(buf), fp) == 0) lptr = &vec_lines[k];
break;
#if USE_WIDEC_SUPPORT #if USE_WIDEC_SUPPORT
if (lptr == vec_lines) { if (lptr == vec_lines) {
@ -386,14 +452,98 @@ main(int argc, char *argv[])
} }
*lptr = ch_dup(temp); *lptr = ch_dup(temp);
} }
(void) fclose(fp);
num_lines = (int) (lptr - vec_lines);
if (ignore_sigs) { free(my_vec);
InitAndCatch(initscr(), SIG_IGN); free(my_blob);
} else { }
initscr();
int
main(int argc, char *argv[])
{
static const char *help[] =
{
"Commands:",
" q,^Q,ESC - quit this program",
"",
" p,<Up> - scroll the viewport up by one row",
" n,<Down> - scroll the viewport down by one row",
" l,<Left> - scroll the viewport left by one column",
" r,<Right> - scroll the viewport right by one column",
"",
" h,<Home> - scroll the viewport to top of file",
" ^F,<PageDn> - scroll to the next page",
" ^B,<PageUp> - scroll to the previous page",
" e,<End> - scroll the viewport to end of file",
"",
" ^L - repaint using redrawwin()",
"",
" 0 through 9 - enter digits for count",
" s - use entered count for halfdelay() parameter",
" - if no entered count, stop nodelay()",
" <space> - begin nodelay()",
0
};
int i;
int my_delay = 0;
NCURSES_CH_T **olptr;
int value = 0;
bool done = FALSE;
bool got_number = FALSE;
bool ignore_sigs = FALSE;
bool single_step = FALSE;
#if CAN_RESIZE
bool nonposix_resize = FALSE;
#endif
const char *my_label = "Input";
setlocale(LC_ALL, "");
while ((i = getopt(argc, argv, "cirstT:")) != -1) {
switch (i) {
case 'c':
try_color = TRUE;
break;
case 'i':
ignore_sigs = TRUE;
break;
#if CAN_RESIZE
case 'r':
nonposix_resize = TRUE;
break;
#endif
case 's':
single_step = TRUE;
break;
#ifdef TRACE
case 'T':
{
char *next = 0;
int tvalue = (int) strtol(optarg, &next, 0);
if (tvalue < 0 || (next != 0 && *next != 0))
usage();
trace((unsigned) tvalue);
}
break;
case 't':
trace(TRACE_CALLS);
break;
#endif
default:
usage();
}
} }
if (optind + 1 != argc)
usage();
read_file(fname = argv[optind]);
#if CAN_RESIZE
if (nonposix_resize)
(void) signal(SIGWINCH, adjust); /* arrange interrupts to resize */
#endif
InitAndCatch(initscr(), ignore_sigs ? SIG_IGN : finish);
keypad(stdscr, TRUE); /* enable keyboard mapping */ keypad(stdscr, TRUE); /* enable keyboard mapping */
(void) nonl(); /* tell curses not to do NL->CR/NL on output */ (void) nonl(); /* tell curses not to do NL->CR/NL on output */
(void) cbreak(); /* take input chars one at a time, no wait for \n */ (void) cbreak(); /* take input chars one at a time, no wait for \n */
@ -473,15 +623,41 @@ main(int argc, char *argv[])
scrl((int) (lptr - olptr)); scrl((int) (lptr - olptr));
break; break;
case '<':
shift = 0;
/* FALLTHRU */
case 'h': case 'h':
/* FALLTHRU */
case KEY_HOME: case KEY_HOME:
lptr = vec_lines; lptr = vec_lines;
break; break;
case '>':
shift = 0;
/* FALLTHRU */
case 'e': case 'e':
/* FALLTHRU */
case KEY_END: case KEY_END:
if (num_lines > LINES) if (num_lines > LINES)
lptr = vec_lines + num_lines - LINES + 1; lptr = (vec_lines + num_lines - LINES + 1);
else
lptr = (vec_lines + (num_lines - 2));
break;
case CTRL('F'):
/* FALLTHRU */
case KEY_NPAGE:
if ((lptr - vec_lines) < (num_lines - 5))
lptr += (LINES - 1);
else
lptr = (vec_lines + num_lines - 2);
break;
case CTRL('B'):
/* FALLTHRU */
case KEY_PPAGE:
if ((lptr - vec_lines) >= LINES)
lptr -= (LINES - 1);
else else
lptr = vec_lines; lptr = vec_lines;
break; break;
@ -549,108 +725,3 @@ main(int argc, char *argv[])
finish(0); /* we're done */ finish(0); /* we're done */
} }
static void
finish(int sig)
{
endwin();
#if NO_LEAKS
if (vec_lines != 0) {
int n;
for (n = 0; n < num_lines; ++n) {
free(vec_lines[n]);
}
free(vec_lines);
}
#endif
ExitProgram(sig != 0 ? EXIT_FAILURE : EXIT_SUCCESS);
}
#if CAN_RESIZE
/*
* This uses functions that are "unsafe", but it seems to work on SunOS.
* Usually: the "unsafe" refers to the functions that POSIX lists which may be
* called from a signal handler. Those do not include buffered I/O, which is
* used for instance in wrefresh(). To be really portable, you should use the
* KEY_RESIZE return (which relies on ncurses' sigwinch handler).
*
* The 'wrefresh(curscr)' is needed to force the refresh to start from the top
* of the screen -- some xterms mangle the bitmap while resizing.
*/
static void
adjust(int sig)
{
if (waiting || sig == 0) {
struct winsize size;
if (ioctl(fileno(stdout), TIOCGWINSZ, &size) == 0) {
resize_term(size.ws_row, size.ws_col);
wrefresh(curscr);
show_all(sig ? "SIGWINCH" : "interrupt");
}
interrupted = FALSE;
} else {
interrupted = TRUE;
}
(void) signal(SIGWINCH, adjust); /* some systems need this */
}
#endif /* CAN_RESIZE */
static void
show_all(const char *tag)
{
int i;
char temp[BUFSIZ];
NCURSES_CH_T *s;
time_t this_time;
#if CAN_RESIZE
_nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp))
"%.20s (%3dx%3d) col %d ", tag, LINES, COLS, shift);
i = (int) strlen(temp);
if ((i + 7) < (int) sizeof(temp)) {
_nc_SPRINTF(temp + i, _nc_SLIMIT(sizeof(temp) - (size_t) i)
"view %.*s",
(int) (sizeof(temp) - 7 - (size_t) i),
fname);
}
#else
(void) tag;
_nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp))
"view %.*s", (int) sizeof(temp) - 7, fname);
#endif
move(0, 0);
printw("%.*s", COLS, temp);
clrtoeol();
this_time = time((time_t *) 0);
_nc_STRNCPY(temp, ctime(&this_time), (size_t) 30);
if ((i = (int) strlen(temp)) != 0) {
temp[--i] = 0;
if (move(0, COLS - i - 2) != ERR)
printw(" %s", temp);
}
scrollok(stdscr, FALSE); /* prevent screen from moving */
for (i = 1; i < LINES; i++) {
move(i, 0);
printw("%3ld:", (long) (lptr + i - vec_lines));
clrtoeol();
if ((s = lptr[i - 1]) != 0) {
int len = ch_len(s);
if (len > shift) {
#if USE_WIDEC_SUPPORT
add_wchstr(s + shift);
#else
addchstr(s + shift);
#endif
}
#if defined(NCURSES_VERSION) || defined(HAVE_WCHGAT)
if (try_color)
wchgat(stdscr, -1, WA_NORMAL, my_pair, NULL);
#endif
}
}
setscrreg(1, LINES - 1);
scrollok(stdscr, TRUE);
refresh();
}