]> ncurses.scripts.mit.edu Git - ncurses.git/commitdiff
ncurses 6.0 - patch 20161224
authorThomas E. Dickey <dickey@invisible-island.net>
Sun, 25 Dec 2016 01:53:57 +0000 (01:53 +0000)
committerThomas E. Dickey <dickey@invisible-island.net>
Sun, 25 Dec 2016 01:53:57 +0000 (01:53 +0000)
+ correct parmeters for copywin call in _nc_Synchronize_Attributes()
  (patch by Leon Winter).
+ improve color-handling section in terminfo manual page (prompted by
  patch by Mihail Konev).
+ modify programs clear, tput and tset to pass the actual tty file
  descriptor to setupterm rather than the standard output, making
  padding work.

39 files changed:
MANIFEST
NEWS
VERSION
dist.mk
doc/html/man/adacurses6-config.1.html
doc/html/man/captoinfo.1m.html
doc/html/man/clear.1.html
doc/html/man/form.3x.html
doc/html/man/infocmp.1m.html
doc/html/man/infotocap.1m.html
doc/html/man/menu.3x.html
doc/html/man/ncurses.3x.html
doc/html/man/ncurses6-config.1.html
doc/html/man/panel.3x.html
doc/html/man/tabs.1.html
doc/html/man/terminfo.5.html
doc/html/man/tic.1m.html
doc/html/man/toe.1m.html
doc/html/man/tput.1.html
doc/html/man/tset.1.html
form/frm_driver.c
man/terminfo.tail
ncurses/tinfo/lib_ttyflags.c
ncurses/tinfo/tinfo_driver.c
package/debian-mingw/changelog
package/debian-mingw64/changelog
package/debian/changelog
package/mingw-ncurses.nsi
package/mingw-ncurses.spec
package/ncurses.spec
progs/Makefile.in
progs/clear.c
progs/modules
progs/reset_cmd.c
progs/reset_cmd.h
progs/tput.c
progs/tset.c
progs/tty_settings.c [new file with mode: 0644]
progs/tty_settings.h [new file with mode: 0644]

index 656325d60b24849e193f369851034bd2d46e305e..9e05ad1097a069227d875511949f9f8c774befe7 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
 ./progs/tput.c
 ./progs/transform.c
 ./progs/tset.c
+./progs/tty_settings.c
+./progs/tty_settings.h
 ./test/Makefile.in
 ./test/README
 ./test/aclocal.m4
diff --git a/NEWS b/NEWS
index 8cdb035af9c56f5e2f58b8bad757bf7778c85ba4..5bf4573adf30cabaece020cd941c971437fcfc13 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -25,7 +25,7 @@
 -- sale, use or other dealings in this Software without prior written        --
 -- authorization.                                                            --
 -------------------------------------------------------------------------------
--- $Id: NEWS,v 1.2711 2016/12/17 23:41:02 tom Exp $
+-- $Id: NEWS,v 1.2715 2016/12/24 23:45:38 tom Exp $
 -------------------------------------------------------------------------------
 
 This is a log of changes that ncurses has gone through since Zeyd started
@@ -45,6 +45,15 @@ 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.
 
+20161224
+       + correct parmeters for copywin call in _nc_Synchronize_Attributes()
+         (patch by Leon Winter).
+       + improve color-handling section in terminfo manual page (prompted by
+         patch by Mihail Konev).
+       + modify programs clear, tput and tset to pass the actual tty file
+         descriptor to setupterm rather than the standard output, making
+         padding work.
+
 20161217
        + add tput-colorcube demo script.
        + add -r and -s options to tput-initc demo, to match usage in xterm.
diff --git a/VERSION b/VERSION
index 1e6ab1682ada24d06e59cd19d6ada861361a438f..4a84d2f981f6e8b243d908f0a5284759ae8c0a02 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-5:0:9  6.0     20161217
+5:0:9  6.0     20161224
diff --git a/dist.mk b/dist.mk
index e39e58529253799b3cb7c4dc48b9f8f5c0b994ee..a2e7e4eebef12cf957ae8d421781bf485468d445 100644 (file)
--- a/dist.mk
+++ b/dist.mk
@@ -25,7 +25,7 @@
 # use or other dealings in this Software without prior written               #
 # authorization.                                                             #
 ##############################################################################
-# $Id: dist.mk,v 1.1137 2016/12/17 16:05:02 tom Exp $
+# $Id: dist.mk,v 1.1138 2016/12/24 13:45:15 tom Exp $
 # Makefile for creating ncurses distributions.
 #
 # 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.
 NCURSES_MAJOR = 6
 NCURSES_MINOR = 0
-NCURSES_PATCH = 20161217
+NCURSES_PATCH = 20161224
 
 # We don't append the patch to the version, since this only applies to releases
 VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
index da09cbbe0650946eea5af426474e348eec114bed..e6ac7168ac69202c703a136d29d55922d98dae2e 100644 (file)
 </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.0 (patch 20161203).
+       This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20161224).
 
 
 
index 8d9ef150d7ceee4b9c38e197bc7712858970c4c1..8d2b1266520022dd53fc222ca3b1006538124762 100644 (file)
 </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.0 (patch 20161203).
+       This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20161224).
 
 
 </PRE><H2><a name="h2-AUTHOR">AUTHOR</a></H2><PRE>
index a779802c7b467ddd0013b04da7009837d16a0505..f76da4661c269531ec6c29b34f3edbf6ecbbdcdb 100644 (file)
 </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.0 (patch 20161203).
+       This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20161224).
 
 
 
index a845821ade28f6ea0cf9eb5379a3bf6c53974390..2d800ca9386f9ab01480ed6c094ea6b6b88f5356 100644 (file)
        <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.0 (patch 20161203).
+       This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20161224).
 
 
 
index 9ea09e81be41ccc5c6042401ff3a6fef1cf0b0c4..5e24270058bd4a1756ca7a7049b39403645cdc5a 100644 (file)
 
        http://invisible-island.net/ncurses/tctest.html
 
-       This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20161203).
+       This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20161224).
 
 
 </PRE><H2><a name="h2-AUTHOR">AUTHOR</a></H2><PRE>
index 9f623760eadf1425e0ed9158e0fafa47a9659291..0f64f0d455120d1863610435fa34bc02f3fcf51b 100644 (file)
@@ -88,7 +88,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="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 20161203).
+       This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20161224).
 
 
 </PRE><H2><a name="h2-AUTHOR">AUTHOR</a></H2><PRE>
index 05c9ed62ed4b1e23ca007e8d05f16ccc6a58fcc3..670b4d3ff150ef415d7a3aafe2109503a68d339c 100644 (file)
        <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.0 (patch 20161203).
+       This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20161224).
 
 
 
index 19952bbec3a9f52d835821db12953fc16f9f44bf..173c335b0d59acfaa38b9e223f6ff8dbe0dfd2a4 100644 (file)
@@ -60,7 +60,7 @@
        sonable optimization.  This implementation is "new curses"
        (ncurses) and is the approved replacement for 4.4BSD clas-
        sic  curses,  which has been discontinued.  This describes
-       <STRONG>ncurses</STRONG> version 6.0 (patch 20161203).
+       <STRONG>ncurses</STRONG> version 6.0 (patch 20161224).
 
        The <STRONG>ncurses</STRONG> library emulates the curses library of  System
        V  Release  4  UNIX,  and  XPG4 (X/Open Portability Guide)
index c0539d40169a80511e81b95237baa695745f66ab..46a7c97fd30bf4e4ce62ae9f1a5fc4f9f956f230 100644 (file)
 </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.0 (patch 20161203).
+       This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20161224).
 
 
 
index b7cd6a28d6b37d029ac5f342e1e991cf5dacb2f5..5b913c5547df328b56264aec25995e580199c70e 100644 (file)
 </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.0 (patch 20161203).
+       This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20161224).
 
 
 </PRE><H2><a name="h2-AUTHOR">AUTHOR</a></H2><PRE>
index 8771059b7f1e133c5279bbe20729840f67ef0fe0..e30987076ddc3629256b9704c0c1d646204f0eda 100644 (file)
 </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>.
 
-       This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20161203).
+       This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20161224).
 
 
 
index 87f9e8e46dd9bc4cdbf279e62b8bc6d2afd5cc3b..becb62195bc697a2d8b2afc53b7fae7f11cbabd0 100644 (file)
@@ -33,7 +33,7 @@
   ****************************************************************************
   * @Id: terminfo.head,v 1.22 2016/10/15 17:02:31 tom Exp @
   * Head of terminfo man page ends here
-  * @Id: terminfo.tail,v 1.74 2016/11/05 21:15:43 Alain.Williams Exp @
+  * @Id: terminfo.tail,v 1.75 2016/12/24 22:54:11 tom Exp @
   * Beginning of terminfo.tail file
   * This file is part of ncurses.
   * See "terminfo.head" for copyright.
@@ -75,7 +75,7 @@
        nals by giving a set of capabilities which they  have,  by
        specifying how to perform screen operations, and by speci-
        fying padding requirements and  initialization  sequences.
-       This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20161203).
+       This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20161224).
 
        Entries in <EM>terminfo</EM> consist of a sequence of `,' separated
        fields (embedded commas may be escaped with a backslash or
 
 
 </PRE><H3><a name="h3-Color-Handling">Color Handling</a></H3><PRE>
-       Most  color  terminals are either "Tektronix-like" or "HP-
-       like".  Tektronix-like terminals have a predefined set  of
-       N  colors  (where N usually 8), and can set character-cell
-       foreground and background characters independently, mixing
-       them  into  N * N  color-pairs.  On HP-like terminals, the
-       use must set each color pair up separately (foreground and
-       background  are  not  independently  settable).   Up  to M
-       color-pairs may be  set  up  from  2*M  different  colors.
-       ANSI-compatible terminals are Tektronix-like.
+       The  curses  library  functions  <STRONG>init_pair</STRONG>  and <STRONG>init_color</STRONG>
+       manipulate the <EM>color</EM> <EM>pairs</EM> and <EM>color</EM> <EM>values</EM>  discussed  in
+       this  section (see <STRONG><A HREF="curs_color.3x.html">curs_color(3x)</A></STRONG> for details on these and
+       related functions).
+
+       Most color terminals are either "Tektronix-like"  or  "HP-
+       like":
+
+       <STRONG>o</STRONG>   Tektronix-like  terminals  have  a predefined set of <EM>N</EM>
+           colors (where <EM>N</EM> is usually 8), and can set  character-
+           cell  foreground  and  background  characters indepen-
+           dently, mixing them into <EM>N</EM> * <EM>N</EM> color-pairs.
+
+       <STRONG>o</STRONG>   On HP-like terminals, the user  must  set  each  color
+           pair  up separately (foreground and background are not
+           independently settable).  Up to <EM>M</EM> color-pairs  may  be
+           set  up  from  2*<EM>M</EM>  different colors.  ANSI-compatible
+           terminals are Tektronix-like.
 
        Some basic color capabilities are independent of the color
        method.  The numeric capabilities <STRONG>colors</STRONG> and <STRONG>pairs</STRONG> specify
-       the  maximum numbers of colors and color-pairs that can be
-       displayed simultaneously.  The <STRONG>op</STRONG> (original  pair)  string
-       resets  foreground  and background colors to their default
-       values for the terminal.  The <STRONG>oc</STRONG> string resets all  colors
-       or  color-pairs  to their default values for the terminal.
-       Some terminals  (including  many  PC  terminal  emulators)
-       erase  screen  areas  with  the  current  background color
-       rather than the power-up default background; these  should
+       the maximum numbers of colors and color-pairs that can  be
+       displayed  simultaneously.   The <STRONG>op</STRONG> (original pair) string
+       resets foreground and background colors to  their  default
+       values  for the terminal.  The <STRONG>oc</STRONG> string resets all colors
+       or color-pairs to their default values for  the  terminal.
+       Some  terminals  (including  many  PC  terminal emulators)
+       erase screen  areas  with  the  current  background  color
+       rather  than the power-up default background; these should
        have the boolean capability <STRONG>bce</STRONG>.
 
-       To  change the current foreground or background color on a
-       Tektronix-type terminal, use <STRONG>setaf</STRONG> (set  ANSI  foreground)
-       and  <STRONG>setab</STRONG>  (set ANSI background) or <STRONG>setf</STRONG> (set foreground)
-       and <STRONG>setb</STRONG> (set background).  These take one parameter,  the
-       color  number.   The  SVr4  documentation  describes  only
-       <STRONG>setaf</STRONG>/<STRONG>setab</STRONG>; the XPG4 draft says  that  "If  the  terminal
-       supports ANSI escape sequences to set background and fore-
-       ground, they should be coded as <STRONG>setaf</STRONG> and  <STRONG>setab</STRONG>,  respec-
-       tively.   If  the terminal supports other escape sequences
-       to set background and foreground, they should be coded  as
-       <STRONG>setf</STRONG> and <STRONG>setb</STRONG>, respectively.  The <STRONG>vidputs</STRONG> function and the
-       refresh  functions  use  <STRONG>setaf</STRONG>  and  <STRONG>setab</STRONG>  if  they   are
-       defined."
+       While the curses library works with <EM>color</EM> <EM>pairs</EM>  (reflect-
+       ing  the  inability  of some devices to set foreground and
+       background colors independently), there are separate capa-
+       bilities for setting these features:
+
+       <STRONG>o</STRONG>   To  change  the current foreground or background color
+           on a Tektronix-type  terminal,  use  <STRONG>setaf</STRONG>  (set  ANSI
+           foreground)  and  <STRONG>setab</STRONG>  (set ANSI background) or <STRONG>setf</STRONG>
+           (set foreground) and  <STRONG>setb</STRONG>  (set  background).   These
+           take  one parameter, the color number.  The SVr4 docu-
+           mentation describes only <STRONG>setaf</STRONG>/<STRONG>setab</STRONG>; the  XPG4  draft
+           says  that  "If  the  terminal  supports  ANSI  escape
+           sequences  to  set  background  and  foreground,  they
+           should be coded as <STRONG>setaf</STRONG> and <STRONG>setab</STRONG>, respectively.
+
+       <STRONG>o</STRONG>   If the terminal supports other escape sequences to set
+           background and foreground, they  should  be  coded  as
+           <STRONG>setf</STRONG>  and  <STRONG>setb</STRONG>,  respectively.   The  <STRONG>vidputs</STRONG> and the
+           <STRONG>refresh</STRONG> functions use the <STRONG>setaf</STRONG> and <STRONG>setab</STRONG> capabilities
+           if they are defined.
 
        The  <STRONG>setaf</STRONG>/<STRONG>setab</STRONG>  and <STRONG>setf</STRONG>/<STRONG>setb</STRONG> capabilities take a single
        numeric argument each.  Argument values 0-7 of <STRONG>setaf</STRONG>/<STRONG>setab</STRONG>
        On an HP-like terminal, use <STRONG>scp</STRONG> with a  color-pair  number
        parameter to set which color pair is current.
 
-       On  a  Tektronix-like  terminal, the capability <STRONG>ccc</STRONG> may be
-       present to indicate that colors can be modified.   If  so,
-       the <STRONG>initc</STRONG> capability will take a color number (0 to <STRONG>colors</STRONG>
-       - 1)and three more parameters which  describe  the  color.
-       These three parameters default to being interpreted as RGB
-       (Red, Green, Blue) values.  If the boolean capability  <STRONG>hls</STRONG>
-       is present, they are instead as HLS (Hue, Lightness, Satu-
-       ration) indices.  The ranges are terminal-dependent.
-
-       On an HP-like terminal, <STRONG>initp</STRONG> may give  a  capability  for
-       changing  a  color-pair value.  It will take seven parame-
-       ters; a color-pair number (0 to <STRONG>max_pairs</STRONG> -  1),  and  two
-       triples  describing  first  background and then foreground
-       colors.  These parameters must be (Red,  Green,  Blue)  or
-       (Hue, Lightness, Saturation) depending on <STRONG>hls</STRONG>.
+       Some terminals allow the <EM>color</EM> <EM>values</EM> to be modified:
+
+       <STRONG>o</STRONG>   On  a  Tektronix-like terminal, the capability <STRONG>ccc</STRONG> may
+           be present to indicate that colors  can  be  modified.
+           If  so,  the <STRONG>initc</STRONG> capability will take a color number
+           (0 to <STRONG>colors</STRONG>  -  1)and  three  more  parameters  which
+           describe the color.  These three parameters default to
+           being interpreted as RGB (Red,  Green,  Blue)  values.
+           If  the  boolean  capability  <STRONG>hls</STRONG> is present, they are
+           instead as HLS (Hue, Lightness,  Saturation)  indices.
+           The ranges are terminal-dependent.
+
+       <STRONG>o</STRONG>   On  an  HP-like  terminal, <STRONG>initp</STRONG> may give a capability
+           for changing a color-pair value.  It will  take  seven
+           parameters;  a color-pair number (0 to <STRONG>max_pairs</STRONG> - 1),
+           and two triples describing first background  and  then
+           foreground  colors.   These  parameters  must be (Red,
+           Green, Blue) or (Hue, Lightness, Saturation) depending
+           on <STRONG>hls</STRONG>.
 
        On  some  color terminals, colors collide with highlights.
        You can register these collisions with the <STRONG>ncv</STRONG> capability.
 
 
 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
-       <STRONG><A HREF="tic.1m.html">tic(1m)</A></STRONG>,   <STRONG><A HREF="infocmp.1m.html">infocmp(1m)</A></STRONG>,  <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>,  <STRONG>printf(3)</STRONG>,  <STRONG><A HREF="term.5.html">term(5)</A></STRONG>.
-       <STRONG><A HREF="term_variables.3x.html">term_variables(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="ncurses.3x.html">curses(3x)</A></STRONG>,    <STRONG><A HREF="curs_color.3x.html">curs_color(3x)</A></STRONG>,
+       <STRONG>printf(3)</STRONG>, <STRONG><A HREF="term.5.html">term(5)</A></STRONG>.  <STRONG><A HREF="term_variables.3x.html">term_variables(3x)</A></STRONG>.
 
 
 </PRE><H2><a name="h2-AUTHORS">AUTHORS</a></H2><PRE>
index ddb1c45042307abfb56153497cf32d14e385cecb..380d6ecfe6092bf8ae9c6ef1cae1622450c7a638 100644 (file)
        <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>.
 
-       This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20161203).
+       This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20161224).
 
 
 </PRE><H2><a name="h2-AUTHOR">AUTHOR</a></H2><PRE>
index 0559dcf96c6e68dafbb95150188be7752b66601d..5f6a9bb9f5f3e96016d3e3a65d5602c2d8c5c1ff 100644 (file)
        <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><A HREF="terminfo.5.html">terminfo(5)</A></STRONG>.
 
-       This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20161203).
+       This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20161224).
 
 
 
index 2e4e5595e408de745a50e606cfb0bcb05695dfec..ac789f043deb26c0d32873f47965c12a8f87bc99 100644 (file)
        <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 20161203).
+       This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20161224).
 
 
 
index 22004866d11a618feedc1dd7e6d68633edbec273..4c5ad2fd46604ee4e56a9888775edbbd98d528e6 100644 (file)
        <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.0 (patch 20161203).
+       This describes <STRONG>ncurses</STRONG> version 6.0 (patch 20161224).
 
 
 
index 87c1188e327686e582f4978a5caf4b3b5bf70e3b..66031d697abb09fbc7986b0c214bd1e9d8051c79 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_driver.c,v 1.119 2016/10/29 22:30:10 tom Exp $")
+MODULE_ID("$Id: frm_driver.c,v 1.120 2016/12/24 22:28:28 Leon.Winter Exp $")
 
 /*----------------------------------------------------------------------------
   This is the core module of the form library. It contains the majority
@@ -1275,7 +1275,8 @@ _nc_Synchronize_Attributes(FIELD *field)
              copywin(form->w, formwin,
                      0, 0,
                      field->frow, field->fcol,
-                     field->rows - 1, field->cols - 1, 0);
+                     field->frow + field->rows - 1,
+                     field->fcol + field->cols - 1, 0);
              wsyncup(formwin);
              Buffer_To_Window(field, form->w);
              SetStatus(field, _NEWTOP);        /* fake refresh to paint all */
index 4ee27a0df9fe33ce598ad5bb2a8d7576ef202bdc..80ce6432f3e83af9023e60f4490a6f48ed99709f 100644 (file)
@@ -1,4 +1,4 @@
-.\" $Id: terminfo.tail,v 1.74 2016/11/05 21:15:43 Alain.Williams Exp $
+.\" $Id: terminfo.tail,v 1.75 2016/12/24 22:54:11 tom Exp $
 .\" Beginning of terminfo.tail file
 .\" This file is part of ncurses.
 .\" See "terminfo.head" for copyright.
@@ -1324,16 +1324,24 @@ character pairs right to left in sequence; these become the ACSC string.
 .PP
 .SS Color Handling
 .PP
-Most color terminals are either \*(``Tektronix-like\*('' or \*(``HP-like\*(''.
+The curses library functions \fBinit_pair\fP and \fBinit_color\fP
+manipulate the \fIcolor pairs\fP and \fIcolor values\fP discussed in this
+section
+(see \fBcurs_color\fP(3X) for details on these and related functions).
+.PP
+Most color terminals are either \*(``Tektronix-like\*('' or \*(``HP-like\*('':
+.bP
 Tektronix-like
-terminals have a predefined set of N colors (where N usually 8), and can set
+terminals have a predefined set of \fIN\fP colors
+(where \fIN\fP is usually 8),
+and can set
 character-cell foreground and background characters independently, mixing them
-into N\ *\ N color-pairs.
-On HP-like terminals, the use must set each color
+into \fIN\fP\ *\ \fIN\fP color-pairs.
+.bP
+On HP-like terminals, the user must set each color
 pair up separately (foreground and background are not independently settable).
-Up to M color-pairs may be set up from 2*M different colors.
-ANSI-compatible
-terminals are Tektronix-like.
+Up to \fIM\fP color-pairs may be set up from 2*\fIM\fP different colors.
+ANSI-compatible terminals are Tektronix-like.
 .PP
 Some basic color capabilities are independent of the color method.
 The numeric
@@ -1349,6 +1357,11 @@ terminal emulators) erase screen areas with the current background color rather
 than the power-up default background; these should have the boolean capability
 \fBbce\fR.
 .PP
+While the curses library works with \fIcolor pairs\fP
+(reflecting the inability of some devices to set foreground
+and background colors independently),
+there are separate capabilities for setting these features:
+.bP
 To change the current foreground or background color on a Tektronix-type
 terminal, use \fBsetaf\fR (set ANSI foreground) and \fBsetab\fR (set ANSI
 background) or \fBsetf\fR (set foreground) and \fBsetb\fR (set background).
@@ -1357,12 +1370,12 @@ The SVr4 documentation describes
 only \fBsetaf\fR/\fBsetab\fR; the XPG4 draft says that "If the terminal
 supports ANSI escape sequences to set background and foreground, they should
 be coded as \fBsetaf\fR and \fBsetab\fR, respectively.
+.bP
 If the terminal
 supports other escape sequences to set background and foreground, they should
 be coded as \fBsetf\fR and \fBsetb\fR, respectively.
-The \fBvidputs\fR
-function and the refresh functions use \fBsetaf\fR and \fBsetab\fR if they are
-defined."
+The \fBvidputs\fR and the \fBrefresh\fP functions
+use the \fBsetaf\fR and \fBsetab\fR capabilities if they are defined.
 .PP
 The \fBsetaf\fR/\fBsetab\fR and \fBsetf\fR/\fBsetb\fR capabilities take a
 single numeric argument each.
@@ -1411,6 +1424,8 @@ otherwise red/blue will be interchanged on the display.
 On an HP-like terminal, use \fBscp\fR with a color-pair number parameter to set
 which color pair is current.
 .PP
+Some terminals allow the \fIcolor values\fP to be modified:
+.bP
 On a Tektronix-like terminal, the capability \fBccc\fR may be present to
 indicate that colors can be modified.
 If so, the \fBinitc\fR capability will
@@ -1422,7 +1437,7 @@ If the boolean capability \fBhls\fR is present,
 they are instead as HLS (Hue, Lightness, Saturation) indices.
 The ranges are
 terminal-dependent.
-.PP
+.bP
 On an HP-like terminal, \fBinitp\fR may give a capability for changing a
 color-pair value.
 It will take seven parameters; a color-pair number (0 to
@@ -1811,6 +1826,7 @@ files containing terminal descriptions
 \fB@TIC@\fR(1M),
 \fB@INFOCMP@\fR(1M),
 \fBcurses\fR(3X),
+\fBcurs_color\fR(3X),
 \fBprintf\fR(3),
 \fBterm\fR(\*n).
 \fBterm_variables\fR(3X).
index 43bed3536cfc1d63c32d29ecedec1031394e6419..3faa3ad8f0aeee861744daf29d23cc7f2517111a 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2012,2014 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2014,2016 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            *
 #define CUR SP_TERMTYPE
 #endif
 
-MODULE_ID("$Id: lib_ttyflags.c,v 1.30 2014/04/26 18:47:20 juergen Exp $")
+MODULE_ID("$Id: lib_ttyflags.c,v 1.31 2016/12/24 21:41:24 tom Exp $")
 
 NCURSES_EXPORT(int)
 NCURSES_SP_NAME(_nc_get_tty_mode) (NCURSES_SP_DCLx TTY * buf)
 {
+    TERMINAL *termp = TerminalOf(SP_PARM);
     int result = OK;
 
-    if (buf == 0 || SP_PARM == 0) {
+    if (buf == 0 || termp == 0) {
        result = ERR;
     } else {
-       TERMINAL *termp = TerminalOf(SP_PARM);
 
-       if (0 == termp) {
-           result = ERR;
-       } else {
 #ifdef USE_TERM_DRIVER
+       if (SP_PARM != 0) {
            result = CallDriver_2(SP_PARM, td_sgmode, FALSE, buf);
+       } else {
+           result = ERR;
+       }
 #else
-           for (;;) {
-               if (GET_TTY(termp->Filedes, buf) != 0) {
-                   if (errno == EINTR)
-                       continue;
-                   result = ERR;
-               }
-               break;
+       for (;;) {
+           if (GET_TTY(termp->Filedes, buf) != 0) {
+               if (errno == EINTR)
+                   continue;
+               result = ERR;
            }
-#endif
+           break;
        }
-
-       if (result == ERR)
-           memset(buf, 0, sizeof(*buf));
+#endif
 
        TR(TRACE_BITS, ("_nc_get_tty_mode(%d): %s",
                        termp ? termp->Filedes : -1,
                        _nc_trace_ttymode(buf)));
     }
+    if (result == ERR && buf != 0)
+       memset(buf, 0, sizeof(*buf));
+
     return (result);
 }
 
index f239b699ebb4b3ac9ec4c5af4b0195e2650b0daa..4a6426fcb08f80181e1d79f64c67cb162297fd30 100644 (file)
@@ -34,6 +34,7 @@
 #include <curses.priv.h>
 #define CUR ((TERMINAL*)TCB)->type.
 #include <tic.h>
+#include <termcap.h>           /* ospeed */
 
 #if HAVE_NANOSLEEP
 #include <time.h>
@@ -50,7 +51,7 @@
 # endif
 #endif
 
-MODULE_ID("$Id: tinfo_driver.c,v 1.41 2016/09/10 20:14:56 tom Exp $")
+MODULE_ID("$Id: tinfo_driver.c,v 1.43 2016/12/24 23:20:08 tom Exp $")
 
 /*
  * SCO defines TIOCGSIZE and the corresponding struct.  Other systems (SunOS,
@@ -113,6 +114,33 @@ drv_Name(TERMINAL_CONTROL_BLOCK * TCB)
     return "tinfo";
 }
 
+static void
+get_baudrate(TERMINAL * termp)
+{
+    int my_ospeed;
+    int result;
+    if (GET_TTY(termp->Filedes, &termp->Nttyb) == OK) {
+#ifdef TERMIOS
+       termp->Nttyb.c_oflag &= (unsigned) (~OFLAGS_TABS);
+#else
+       termp->Nttyb.sg_flags &= (unsigned) (~XTABS);
+#endif
+    }
+#ifdef USE_OLD_TTY
+    result = (int) cfgetospeed(&(termp->Nttyb));
+    my_ospeed = (NCURSES_OSPEED) _nc_ospeed(result);
+#else /* !USE_OLD_TTY */
+#ifdef TERMIOS
+    my_ospeed = (NCURSES_OSPEED) cfgetospeed(&(termp->Nttyb));
+#else
+    my_ospeed = (NCURSES_OSPEED) termp->Nttyb.sg_ospeed;
+#endif
+    result = _nc_baudrate(my_ospeed);
+#endif
+    termp->_baudrate = result;
+    ospeed = (NCURSES_OSPEED) my_ospeed;
+}
+
 #undef SETUP_FAIL
 #define SETUP_FAIL FALSE
 
@@ -166,6 +194,16 @@ drv_CanHandle(TERMINAL_CONTROL_BLOCK * TCB, const char *tname, int *errret)
     if (command_character)
        _nc_tinfo_cmdch(termp, *command_character);
 
+    /*
+     * If an application calls setupterm() rather than initscr() or
+     * newterm(), we will not have the def_prog_mode() call in
+     * _nc_setupscreen().  Do it now anyway, so we can initialize the
+     * baudrate.
+     */
+    if (sp == 0 && NC_ISATTY(termp->Filedes)) {
+       get_baudrate(termp);
+    }
+
     if (generic_type) {
        /*
         * BSD 4.3's termcap contains mis-typed "gn" for wy99.  Do a sanity
index 89c49fe0e1adc978ef38056268fae28875c1a9b2..851aa1487ad3811f6ab7e98513980c472199fbca 100644 (file)
@@ -1,8 +1,8 @@
-ncurses6 (6.0+20161217) unstable; urgency=low
+ncurses6 (6.0+20161224) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 17 Dec 2016 11:05:02 -0500
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 24 Dec 2016 08:45:15 -0500
 
 ncurses6 (5.9-20131005) unstable; urgency=low
 
index 89c49fe0e1adc978ef38056268fae28875c1a9b2..851aa1487ad3811f6ab7e98513980c472199fbca 100644 (file)
@@ -1,8 +1,8 @@
-ncurses6 (6.0+20161217) unstable; urgency=low
+ncurses6 (6.0+20161224) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 17 Dec 2016 11:05:02 -0500
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 24 Dec 2016 08:45:15 -0500
 
 ncurses6 (5.9-20131005) unstable; urgency=low
 
index 64e5920717ff1bd01e93a3fca30cfb28ef3fb572..7a4e180d8f40c9522e6c844bf53533f24a7b38f1 100644 (file)
@@ -1,8 +1,8 @@
-ncurses6 (6.0+20161217) unstable; urgency=low
+ncurses6 (6.0+20161224) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 17 Dec 2016 11:05:02 -0500
+ -- Thomas E. Dickey <dickey@invisible-island.net>  Sat, 24 Dec 2016 08:45:15 -0500
 
 ncurses6 (5.9-20120608) unstable; urgency=low
 
index 5b10c37faec4b631fff41d1a46443c6b7544d6b8..952e1a5212127cdc9cc22309e137ec386dff3be5 100644 (file)
@@ -1,4 +1,4 @@
-; $Id: mingw-ncurses.nsi,v 1.189 2016/12/17 16:05:02 tom Exp $\r
+; $Id: mingw-ncurses.nsi,v 1.190 2016/12/24 13:45:15 tom Exp $\r
 \r
 ; TODO add examples\r
 ; TODO bump ABI to 6\r
@@ -10,7 +10,7 @@
 !define VERSION_MAJOR "6"\r
 !define VERSION_MINOR "0"\r
 !define VERSION_YYYY  "2016"\r
-!define VERSION_MMDD  "1217"\r
+!define VERSION_MMDD  "1224"\r
 !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD}\r
 \r
 !define MY_ABI   "5"\r
index 89ae453fb61433cd7eeaa798f2cd6b0470c2b730..4bbf4dc91b493cef0d9996578f293d6e2f99efe3 100644 (file)
@@ -3,7 +3,7 @@
 Summary: shared libraries for terminal handling
 Name: mingw32-ncurses6
 Version: 6.0
-Release: 20161217
+Release: 20161224
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
index 3847651b709b289181119d54b1ce578a06f9ccd0..0c30f5afd074ce7f78e021098ffbef8d8b16ad9a 100644 (file)
@@ -1,7 +1,7 @@
 Summary: shared libraries for terminal handling
 Name: ncurses6
 Version: 6.0
-Release: 20161217
+Release: 20161224
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
index 7de8c9e5eaff3f7a6eb732210f9aaea05016261f..3368684c9d91cc633005032fdd0a3c73ae42365b 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.99 2016/10/22 00:13:20 tom Exp $
+# $Id: Makefile.in,v 1.100 2016/12/24 17:35:01 tom Exp $
 ##############################################################################
 # Copyright (c) 1998-2015,2016 Free Software Foundation, Inc.                #
 #                                                                            #
@@ -251,7 +251,8 @@ toe$x: $(DEPS_TOE) $(DEPS_CURSES)
 
 DEPS_CLEAR = \
        $(MODEL)/clear$o \
-       $(MODEL)/clear_cmd$o
+       $(MODEL)/clear_cmd$o \
+       $(MODEL)/tty_settings$o
 
 clear$x: $(DEPS_CLEAR) $(DEPS_CURSES)
        @ECHO_LD@ $(LINK) $(DEPS_CLEAR) $(LDFLAGS_TINFO) -o $@
@@ -267,7 +268,8 @@ DEPS_TPUT = \
        $(MODEL)/clear_cmd$o \
        $(MODEL)/reset_cmd$o \
        $(MODEL)/tparm_type$o \
-       $(MODEL)/transform$o
+       $(MODEL)/transform$o \
+       $(MODEL)/tty_settings$o
 
 tput$x: $(DEPS_TPUT) $(DEPS_CURSES) transform.h
        @ECHO_LD@ $(LINK) $(DEPS_TPUT) $(LDFLAGS_TINFO) -o $@
@@ -282,7 +284,8 @@ infocmp$x: $(DEPS_INFOCMP) $(DEPS_CURSES)
 DEPS_TSET = \
        $(MODEL)/tset$o \
        $(MODEL)/reset_cmd$o \
-       $(MODEL)/transform$o
+       $(MODEL)/transform$o \
+       $(MODEL)/tty_settings$o
 
 tset$x: $(DEPS_TSET) $(DEPS_CURSES) transform.h
        @ECHO_LD@ $(LINK) $(DEPS_TSET) $(LDFLAGS_TINFO) -o $@
index e9203a29e95fff901dcca02ecd64909313a1bfd9..559d296c3f4c01816c16535a026500416b35e850 100644 (file)
  * clear.c --  clears the terminal's screen
  */
 
-#define USE_LIBTINFO 1
+#define USE_LIBTINFO
 #include <clear_cmd.h>
+#include <tty_settings.h>
 
-MODULE_ID("$Id: clear.c,v 1.15 2016/10/23 00:36:36 tom Exp $")
+MODULE_ID("$Id: clear.c,v 1.17 2016/12/24 19:33:39 tom Exp $")
+
+const char *_nc_progname = "clear";
 
 int
 main(
        int argc GCC_UNUSED,
        char *argv[]GCC_UNUSED)
 {
-    setupterm((char *) 0, STDOUT_FILENO, (int *) 0);
+    TTY tty_settings;
+    int fd;
+
+    _nc_progname = _nc_rootname(argv[0]);
+
+    fd = save_tty_settings(&tty_settings);
+
+    setupterm((char *) 0, fd, (int *) 0);
 
     ExitProgram((clear_cmd() == ERR)
                ? EXIT_FAILURE
index f84d5df271915b1c0226961ee2928b16de806909..dc7d61cf4a74e06e76714f0a4dad047a6d763738 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: modules,v 1.20 2016/10/21 23:15:41 tom Exp $
+# $Id: modules,v 1.21 2016/12/24 17:33:59 tom Exp $
 # Program modules (some are in ncurses lib!)
 ##############################################################################
 # Copyright (c) 1998-2014,2016 Free Software Foundation, Inc.                #
 #
 
 @ base
-clear          progs           $(srcdir)       $(HEADER_DEPS)
+clear          progs           $(srcdir)       $(HEADER_DEPS) tty_settings.h
 tic            progs           $(srcdir)       $(HEADER_DEPS) transform.h $(srcdir)/dump_entry.h $(srcdir)/tparm_type.h
 toe            progs           $(srcdir)       $(HEADER_DEPS)             $(INCDIR)/hashed_db.h
 clear_cmd      progs           $(srcdir)       $(HEADER_DEPS) clear_cmd.h
 dump_entry     progs           $(srcdir)       $(HEADER_DEPS)             $(srcdir)/dump_entry.h ../include/parametrized.h $(INCDIR)/capdefaults.c termsort.c
 infocmp                progs           $(srcdir)       $(HEADER_DEPS)             $(srcdir)/dump_entry.h
-reset_cmd      progs           $(srcdir)       $(HEADER_DEPS) reset_cmd.h
+reset_cmd      progs           $(srcdir)       $(HEADER_DEPS) reset_cmd.h tty_settings.h
 tabs           progs           $(srcdir)       $(HEADER_DEPS)
 tparm_type     progs           $(srcdir)       $(HEADER_DEPS)             $(srcdir)/tparm_type.h
-tput           progs           $(srcdir)       $(HEADER_DEPS) transform.h $(srcdir)/dump_entry.h $(srcdir)/tparm_type.h termsort.c reset_cmd.h
-tset           progs           $(srcdir)       $(HEADER_DEPS) transform.h $(srcdir)/dump_entry.h ../include/termcap.h reset_cmd.h 
+tput           progs           $(srcdir)       $(HEADER_DEPS) transform.h $(srcdir)/dump_entry.h $(srcdir)/tparm_type.h termsort.c reset_cmd.h tty_settings.h
+tset           progs           $(srcdir)       $(HEADER_DEPS) transform.h $(srcdir)/dump_entry.h ../include/termcap.h reset_cmd.h  tty_settings.h
 transform      progs           $(srcdir)       $(HEADER_DEPS) transform.h
+tty_settings   progs           $(srcdir)       $(HEADER_DEPS) tty_settings.h
 
 # vile:makemode
index e0831e273c55f8c61a88a39707ccdc5e3c0326e9..8614bf7842fac3a1e907eb4f6090367952c2e40d 100644 (file)
@@ -31,6 +31,7 @@
  ****************************************************************************/
 
 #include <reset_cmd.h>
+#include <tty_settings.h>
 
 #include <errno.h>
 #include <stdio.h>
@@ -51,7 +52,7 @@
 #include <sys/ptem.h>
 #endif
 
-MODULE_ID("$Id: reset_cmd.c,v 1.9 2016/10/23 01:08:11 tom Exp $")
+MODULE_ID("$Id: reset_cmd.c,v 1.11 2016/12/24 23:20:57 tom Exp $")
 
 /*
  * SCO defines TIOCGSIZE and the corresponding struct.  Other systems (SunOS,
@@ -73,11 +74,8 @@ MODULE_ID("$Id: reset_cmd.c,v 1.9 2016/10/23 01:08:11 tom Exp $")
 # endif
 #endif
 
-static int my_fd;
 static FILE *my_file;
-static TTY original_settings;
 
-static bool can_restore = FALSE;
 static bool use_reset = FALSE; /* invoked as reset */
 static bool use_init = FALSE;  /* invoked as init */
 
@@ -104,17 +102,6 @@ failed(const char *msg)
     /* NOTREACHED */
 }
 
-static bool
-get_tty_settings(int fd, TTY * tty_settings)
-{
-    bool success = TRUE;
-    my_fd = fd;
-    if (fd < 0 || GET_TTY(my_fd, tty_settings) < 0) {
-       success = FALSE;
-    }
-    return success;
-}
-
 static bool
 cat_file(char *file)
 {
@@ -215,13 +202,9 @@ out_char(int c)
  * a child program dies in raw mode.
  */
 void
-reset_tty_settings(TTY * tty_settings)
+reset_tty_settings(int fd, TTY * tty_settings)
 {
-#ifdef TERMIOS
-    tcgetattr(my_fd, tty_settings);
-#else
-    stty(my_fd, tty_settings);
-#endif
+    GET_TTY(fd, tty_settings);
 
 #ifdef TERMIOS
 #if defined(VDISCARD) && defined(CDISCARD)
@@ -355,7 +338,7 @@ reset_tty_settings(TTY * tty_settings)
        );
 #endif
 
-    SET_TTY(my_fd, tty_settings);
+    SET_TTY(fd, tty_settings);
 }
 
 /*
@@ -487,7 +470,7 @@ sent_string(const char *s)
 
 /* Output startup string. */
 bool
-send_init_strings(TTY * old_settings)
+send_init_strings(int fd GCC_UNUSED, TTY * old_settings)
 {
     int i;
     bool need_flush = FALSE;
@@ -497,7 +480,7 @@ send_init_strings(TTY * old_settings)
     if (old_settings != 0 &&
        old_settings->c_oflag & (TAB3 | ONLCR | OCRNL | ONLRET)) {
        old_settings->c_oflag &= (TAB3 | ONLCR | OCRNL | ONLRET);
-       SET_TTY(my_fd, old_settings);
+       SET_TTY(fd, old_settings);
     }
 #endif
     if (use_reset || use_init) {
@@ -626,40 +609,6 @@ print_tty_chars(TTY * old_settings, TTY * new_settings)
     show_tty_change(old_settings, new_settings, "Interrupt", VINTR, CINTR);
 }
 
-/*
- * Open a file descriptor on the current terminal, to obtain its settings.
- * stderr is less likely to be redirected than stdout; try that first.
- */
-int
-save_tty_settings(TTY * tty_settings)
-{
-    if (!get_tty_settings(STDERR_FILENO, tty_settings) &&
-       !get_tty_settings(STDOUT_FILENO, tty_settings) &&
-       !get_tty_settings(STDIN_FILENO, tty_settings) &&
-       !get_tty_settings(open("/dev/tty", O_RDWR), tty_settings)) {
-       failed("terminal attributes");
-    }
-    can_restore = TRUE;
-    original_settings = *tty_settings;
-    return my_fd;
-}
-
-void
-restore_tty_settings(void)
-{
-    if (can_restore)
-       SET_TTY(my_fd, &original_settings);
-}
-
-/* Set the modes if they've changed. */
-void
-update_tty_settings(TTY * old_settings, TTY * new_settings)
-{
-    if (memcmp(new_settings, old_settings, sizeof(TTY))) {
-       SET_TTY(my_fd, new_settings);
-    }
-}
-
 #if HAVE_SIZECHANGE
 /*
  * Set window size if not set already, but update our copy of the values if the
index 19aee023c058754d4d02f4c8cdb458d05c5e3d4a..f5426eb8d04b1539f58923c7812cba65ca42f9fa 100644 (file)
@@ -31,7 +31,7 @@
  ****************************************************************************/
 
 /*
- * $Id: reset_cmd.h,v 1.6 2016/10/22 23:34:37 tom Exp $
+ * $Id: reset_cmd.h,v 1.7 2016/12/24 18:08:48 tom Exp $
  *
  * Utility functions for resetting terminal.
  */
 #undef CTRL
 #define CTRL(x)        ((x) & 0x1f)
 
-extern bool send_init_strings(TTY * /* old_settings */);
-extern int save_tty_settings(TTY * /* tty_settings */);
+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(TTY * /* tty_settings */);
-extern void restore_tty_settings(void);
+extern void reset_tty_settings(int /* fd */, TTY * /* tty_settings */);
 extern void set_control_chars(TTY * /* tty_settings */, int /* erase */, int /* intr */, int /* kill */);
 extern void set_conversions(TTY * /* tty_settings */);
-extern void update_tty_settings(TTY * /* old_settings */, TTY * /* new_settings */);
 
 #if HAVE_SIZECHANGE
 extern void set_window_size(int /* fd */, short * /* high */, short * /* wide */);
index b2d44f028d6baf04e402e734b6750405b386af40..481ae6356d16efe48c1caa8a28f945479a06e909 100644 (file)
@@ -48,8 +48,9 @@
 #include <termsort.c>
 #endif
 #include <transform.h>
+#include <tty_settings.h>
 
-MODULE_ID("$Id: tput.c,v 1.63 2016/10/23 01:08:28 tom Exp $")
+MODULE_ID("$Id: tput.c,v 1.65 2016/12/24 18:44:32 tom Exp $")
 
 #define PUTS(s)                fputs(s, stdout)
 
@@ -117,7 +118,7 @@ exit_code(int token, int value)
 }
 
 static int
-tput_cmd(int argc, char *argv[])
+tput_cmd(int fd, TTY * saved_settings, int argc, char *argv[])
 {
     NCURSES_CONST char *name;
     char *s;
@@ -128,29 +129,27 @@ tput_cmd(int argc, char *argv[])
 
     name = check_aliases(argv[0], FALSE);
     if (is_reset || is_init) {
-       TTY mode, oldmode;
+       TTY oldmode;
 
        int terasechar = -1;    /* new erase character */
        int intrchar = -1;      /* new interrupt character */
        int tkillchar = -1;     /* new kill character */
 
-       int my_fd = save_tty_settings(&mode);
-
        reset_start(stdout, is_reset, is_init);
-       reset_tty_settings(&mode);
+       reset_tty_settings(fd, saved_settings);
 
 #if HAVE_SIZECHANGE
-       set_window_size(my_fd, &lines, &columns);
+       set_window_size(fd, &lines, &columns);
 #else
-       (void) my_fd;
+       (void) fd;
 #endif
-       set_control_chars(&mode, terasechar, intrchar, tkillchar);
-       set_conversions(&mode);
-       if (send_init_strings(&oldmode)) {
+       set_control_chars(saved_settings, terasechar, intrchar, tkillchar);
+       set_conversions(saved_settings);
+       if (send_init_strings(fd, &oldmode)) {
            reset_flush();
        }
 
-       update_tty_settings(&oldmode, &mode);
+       update_tty_settings(&oldmode, saved_settings);
        return 0;
     }
 
@@ -262,6 +261,8 @@ main(int argc, char **argv)
     int c;
     char buf[BUFSIZ];
     int result = 0;
+    int fd;
+    TTY tty_settings;
 
     prg_name = check_aliases(_nc_rootname(argv[0]), TRUE);
 
@@ -302,13 +303,15 @@ main(int argc, char **argv)
     if (term == 0 || *term == '\0')
        quit(2, "No value for $TERM and no -T specified");
 
-    if (setupterm(term, STDOUT_FILENO, &errret) != OK && errret <= 0)
+    fd = save_tty_settings(&tty_settings);
+
+    if (setupterm(term, fd, &errret) != OK && errret <= 0)
        quit(3, "unknown terminal \"%s\"", term);
 
     if (cmdline) {
        if ((argc <= 0) && !(is_clear || is_reset || is_init))
            usage();
-       ExitProgram(tput_cmd(argc, argv));
+       ExitProgram(tput_cmd(fd, &tty_settings, argc, argv));
     }
 
     while (fgets(buf, sizeof(buf), stdin) != 0) {
@@ -329,7 +332,7 @@ main(int argc, char **argv)
        argvec[argnum] = 0;
 
        if (argnum != 0
-           && tput_cmd(argnum, argvec) != 0) {
+           && tput_cmd(fd, &tty_settings, argnum, argvec) != 0) {
            if (result == 0)
                result = 4;     /* will return value >4 */
            ++result;
index f21cb6d731f330948a9703b0c1c543ac33731ec7..d3007e95378cd6940516d1aab8c6d892eaaaf944 100644 (file)
@@ -88,6 +88,7 @@
 #include <reset_cmd.h>
 #include <termcap.h>
 #include <transform.h>
+#include <tty_settings.h>
 
 #if HAVE_GETTTYNAM && HAVE_TTYENT_H
 #include <ttyent.h>
@@ -96,7 +97,7 @@
 char *ttyname(int fd);
 #endif
 
-MODULE_ID("$Id: tset.c,v 1.113 2016/10/22 23:34:47 tom Exp $")
+MODULE_ID("$Id: tset.c,v 1.115 2016/12/24 18:46:42 tom Exp $")
 
 #ifndef environ
 extern char **environ;
@@ -627,7 +628,7 @@ get_termcap_entry(int fd, char *userarg)
            ttype = askuser(0);
     }
     /* Find the terminfo entry.  If it doesn't exist, ask the user. */
-    while (setupterm((NCURSES_CONST char *) ttype, STDOUT_FILENO, &errret)
+    while (setupterm((NCURSES_CONST char *) ttype, fd, &errret)
           != OK) {
        if (errret == 0) {
            (void) fprintf(stderr, "%s: unknown terminal type %s\n",
@@ -834,7 +835,7 @@ main(int argc, char **argv)
 
     if (same_program(_nc_progname, PROG_RESET)) {
        reset_start(stderr, TRUE, FALSE);
-       reset_tty_settings(&mode);
+       reset_tty_settings(my_fd, &mode);
     } else {
        reset_start(stderr, FALSE, FALSE);
     }
@@ -852,7 +853,7 @@ main(int argc, char **argv)
            set_conversions(&mode);
 
            if (!noinit) {
-               if (send_init_strings(&oldmode)) {
+               if (send_init_strings(my_fd, &oldmode)) {
                    (void) putc('\r', stderr);
                    (void) fflush(stderr);
                    (void) napms(1000);         /* Settle the terminal. */
diff --git a/progs/tty_settings.c b/progs/tty_settings.c
new file mode 100644 (file)
index 0000000..93d9e2a
--- /dev/null
@@ -0,0 +1,109 @@
+/****************************************************************************
+ * Copyright (c) 2016 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                                                *
+ ****************************************************************************/
+
+#define USE_LIBTINFO
+#include <tty_settings.h>
+
+#include <fcntl.h>
+
+MODULE_ID("$Id: tty_settings.c,v 1.2 2016/12/24 19:31:11 tom Exp $")
+
+static int my_fd;
+static TTY original_settings;
+static bool can_restore = FALSE;
+
+static void
+exit_error(void)
+{
+    restore_tty_settings();
+    (void) fprintf(stderr, "\n");
+    ExitProgram(EXIT_FAILURE);
+    /* NOTREACHED */
+}
+
+static void
+failed(const char *msg)
+{
+    char temp[BUFSIZ];
+
+    _nc_STRCPY(temp, _nc_progname, sizeof(temp));
+    _nc_STRCAT(temp, ": ", sizeof(temp));
+    _nc_STRNCAT(temp, msg, sizeof(temp), sizeof(temp) - strlen(temp) - 2);
+    perror(temp);
+    exit_error();
+    /* NOTREACHED */
+}
+
+static bool
+get_tty_settings(int fd, TTY * tty_settings)
+{
+    bool success = TRUE;
+    my_fd = fd;
+    if (fd < 0 || GET_TTY(my_fd, tty_settings) < 0) {
+       success = FALSE;
+    }
+    return success;
+}
+
+/*
+ * Open a file descriptor on the current terminal, to obtain its settings.
+ * stderr is less likely to be redirected than stdout; try that first.
+ */
+int
+save_tty_settings(TTY * tty_settings)
+{
+    if (!get_tty_settings(STDERR_FILENO, tty_settings) &&
+       !get_tty_settings(STDOUT_FILENO, tty_settings) &&
+       !get_tty_settings(STDIN_FILENO, tty_settings) &&
+       !get_tty_settings(open("/dev/tty", O_RDWR), tty_settings)) {
+       failed("terminal attributes");
+    }
+    can_restore = TRUE;
+    original_settings = *tty_settings;
+    return my_fd;
+}
+
+void
+restore_tty_settings(void)
+{
+    if (can_restore)
+       SET_TTY(my_fd, &original_settings);
+}
+
+/* Set the modes if they've changed. */
+void
+update_tty_settings(TTY * old_settings, TTY * new_settings)
+{
+    if (memcmp(new_settings, old_settings, sizeof(TTY))) {
+       SET_TTY(my_fd, new_settings);
+    }
+}
diff --git a/progs/tty_settings.h b/progs/tty_settings.h
new file mode 100644 (file)
index 0000000..1104291
--- /dev/null
@@ -0,0 +1,50 @@
+/****************************************************************************
+ * Copyright (c) 2016 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: tty_settings.h,v 1.1 2016/12/24 18:17:44 tom Exp $
+ *
+ * Utility functions for saving/restoring terminal settings.
+ */
+#ifndef TTY_SETTINGS_H
+#define TTY_SETTINGS_H 1
+/* *INDENT-OFF* */
+
+#include <progs.priv.h>
+
+extern int save_tty_settings(TTY * /* tty_settings */ );
+extern void restore_tty_settings(void);
+extern void update_tty_settings(TTY * /* old_settings */, TTY * /* new_settings */ );
+
+/* *INDENT-ON* */
+
+#endif /* TTY_SETTINGS_H */