From: Thomas E. Dickey Date: Sat, 9 Aug 2014 23:40:51 +0000 (+0000) Subject: ncurses 5.9 - patch 20140809 X-Git-Tag: v6.0~47 X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=commitdiff_plain;h=acc28c6418f43cbf15187f2f1fd9a562d5d96535 ncurses 5.9 - patch 20140809 + modify declarations for user-data pointers in C++ binding to use reinterpret_cast to facilitate converting typed pointers to void* in user's application (patch by Adam Jiang). + regenerated html manpages. + add note regarding cause and effect for TERM in ncurses manpage, having noted clueless verbiage in Terminal.app's "help" file which reverses cause/effect. + remove special fallback definition for NCURSES_ATTR_T, since macros have resolved type-mismatches using casts (cf: 970412). + fixes for win_driver.c: + handle repainting on endwin/refresh combination. + implement beep(). + minor cleanup. --- diff --git a/NEWS b/NEWS index f8cfaf2f..bdd262a0 100644 --- a/NEWS +++ b/NEWS @@ -25,7 +25,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: NEWS,v 1.2250 2014/08/02 20:51:48 tom Exp $ +-- $Id: NEWS,v 1.2257 2014/08/09 22:05:47 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -45,6 +45,21 @@ See the AUTHORS file for the corresponding full names. Changes through 1.9.9e did not credit all contributions; it is not possible to add this information. +20140809 + + modify declarations for user-data pointers in C++ binding to use + reinterpret_cast to facilitate converting typed pointers to void* + in user's application (patch by Adam Jiang). + + regenerated html manpages. + + add note regarding cause and effect for TERM in ncurses manpage, + having noted clueless verbiage in Terminal.app's "help" file + which reverses cause/effect. + + remove special fallback definition for NCURSES_ATTR_T, since macros + have resolved type-mismatches using casts (cf: 970412). + + fixes for win_driver.c: + + handle repainting on endwin/refresh combination. + + implement beep(). + + minor cleanup. + 20140802 + minor portability fixes for MinGW: + ensure WINVER is defined in makefiles rather than using headers diff --git a/c++/cursesf.h b/c++/cursesf.h index ef705413..fe1f1aa9 100644 --- a/c++/cursesf.h +++ b/c++/cursesf.h @@ -1,6 +1,6 @@ // * This makes emacs happy -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * + * Copyright (c) 1998-2012,2014 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 * @@ -31,7 +31,7 @@ * Author: Juergen Pfeifer, 1997 * ****************************************************************************/ -// $Id: cursesf.h,v 1.31 2012/12/29 21:49:58 tom Exp $ +// $Id: cursesf.h,v 1.32 2014/08/09 22:06:11 Adam.Jiang Exp $ #ifndef NCURSES_CURSESF_H_incl #define NCURSES_CURSESF_H_incl 1 @@ -673,7 +673,8 @@ protected: const T* p_UserData = STATIC_CAST(T*)(0)) : NCursesForm(nlines,ncols,begin_y,begin_x) { if (form) - set_user (const_cast(p_UserData)); + set_user (const_cast(reinterpret_cast + (p_UserData))); } public: @@ -683,7 +684,7 @@ public: bool autoDelete_Fields=FALSE) : NCursesForm (Fields, with_frame, autoDelete_Fields) { if (form) - set_user (const_cast(p_UserData)); + set_user (const_cast(reinterpret_cast(p_UserData))); }; NCursesUserForm (NCursesFormField* Fields[], @@ -697,19 +698,20 @@ public: : NCursesForm (Fields, nlines, ncols, begin_y, begin_x, with_frame, autoDelete_Fields) { if (form) - set_user (const_cast(p_UserData)); + set_user (const_cast(reinterpret_cast + (p_UserData))); }; virtual ~NCursesUserForm() { }; - inline T* UserData (void) const { + inline T* UserData (void) { return reinterpret_cast(get_user ()); }; inline virtual void setUserData (const T* p_UserData) { if (form) - set_user (const_cast(p_UserData)); + set_user (const_cast(reinterpret_cast(p_UserData))); } }; diff --git a/c++/cursesm.h b/c++/cursesm.h index 259d107f..f8f9665d 100644 --- a/c++/cursesm.h +++ b/c++/cursesm.h @@ -1,6 +1,6 @@ // * This makes emacs happy -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * + * Copyright (c) 1998-2012,2014 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 * @@ -31,7 +31,7 @@ * Author: Juergen Pfeifer, 1997 * ****************************************************************************/ -// $Id: cursesm.h,v 1.29 2012/12/29 21:48:33 tom Exp $ +// $Id: cursesm.h,v 1.30 2014/08/09 22:06:18 Adam.Jiang Exp $ #ifndef NCURSES_CURSESM_H_incl #define NCURSES_CURSESM_H_incl 1 @@ -632,7 +632,7 @@ protected: const T* p_UserData = STATIC_CAST(T*)(0)) : NCursesMenu(nlines,ncols,begin_y,begin_x) { if (menu) - set_user (const_cast(p_UserData)); + set_user (const_cast(reinterpret_cast(p_UserData))); } public: @@ -642,7 +642,7 @@ public: bool autoDelete_Items=FALSE) : NCursesMenu (Items, with_frame, autoDelete_Items) { if (menu) - set_user (const_cast(p_UserData)); + set_user (const_cast(reinterpret_cast(p_UserData))); }; NCursesUserMenu (NCursesMenuItem* Items[], @@ -654,19 +654,19 @@ public: bool with_frame=FALSE) : NCursesMenu (Items, nlines, ncols, begin_y, begin_x, with_frame) { if (menu) - set_user (const_cast(p_UserData)); + set_user (const_cast(reinterpret_cast(p_UserData))); }; virtual ~NCursesUserMenu() { }; - inline T* UserData (void) const { + inline T* UserData (void) { return reinterpret_cast(get_user ()); }; inline virtual void setUserData (const T* p_UserData) { if (menu) - set_user (const_cast(p_UserData)); + set_user (const_cast(reinterpret_cast(p_UserData))); } }; diff --git a/c++/cursesp.h b/c++/cursesp.h index 699ec284..54b0d588 100644 --- a/c++/cursesp.h +++ b/c++/cursesp.h @@ -1,6 +1,6 @@ // * This makes emacs happy -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998-2008,2012 Free Software Foundation, Inc. * + * Copyright (c) 1998-2012,2014 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 * @@ -34,7 +34,7 @@ #ifndef NCURSES_CURSESP_H_incl #define NCURSES_CURSESP_H_incl 1 -// $Id: cursesp.h,v 1.30 2012/12/29 21:50:55 tom Exp $ +// $Id: cursesp.h,v 1.31 2014/08/09 22:06:26 Adam.Jiang Exp $ #include @@ -236,7 +236,8 @@ public: : NCursesPanel (nlines, ncols, begin_y, begin_x) { if (p) - set_user (const_cast(p_UserData)); + set_user (const_cast(reinterpret_cast + (p_UserData))); }; // This creates an user panel of the requested size with associated // user data pointed to by p_UserData. @@ -244,14 +245,14 @@ public: NCursesUserPanel(const T* p_UserData = STATIC_CAST(T*)(0)) : NCursesPanel() { if (p) - set_user(const_cast(p_UserData)); + set_user(const_cast(reinterpret_cast(p_UserData))); }; // This creates an user panel associated with the ::stdscr and user data // pointed to by p_UserData. virtual ~NCursesUserPanel() {}; - T* UserData (void) const + T* UserData (void) { return reinterpret_cast(get_user ()); }; @@ -260,7 +261,7 @@ public: virtual void setUserData (const T* p_UserData) { if (p) - set_user (const_cast(p_UserData)); + set_user (const_cast(reinterpret_cast(p_UserData))); } // Associate the user panel with the user data pointed to by p_UserData. }; diff --git a/dist.mk b/dist.mk index f6067371..9ace8158 100644 --- 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.999 2014/08/01 23:41:10 tom Exp $ +# $Id: dist.mk,v 1.1000 2014/08/09 00:33:11 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 = 5 NCURSES_MINOR = 9 -NCURSES_PATCH = 20140802 +NCURSES_PATCH = 20140809 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/doc/html/man/adacurses-config.1.html b/doc/html/man/adacurses-config.1.html index 69aaf294..72399e26 100644 --- a/doc/html/man/adacurses-config.1.html +++ b/doc/html/man/adacurses-config.1.html @@ -1,7 +1,7 @@ @@ -78,12 +78,66 @@ --help prints a list of the adacurses-config script's options. + If no options are given, adacurses-config prints the com- + bination of --cflags and --libs that gnatmake expects (see + example). + + + +

EXAMPLE

+       For example, supposing that you want to compile the "Hello
+       World!"   program  for  AdaCurses.   Make  a  file   named
+       "hello.adb":
+              with Terminal_Interface.Curses; use Terminal_Interface.Curses;
+
+              procedure Hello is
+
+                 Visibility : Cursor_Visibility := Invisible;
+                 done : Boolean := False;
+                 c : Key_Code;
+
+              begin
+
+                 Init_Screen;
+                 Set_Echo_Mode (False);
+
+                 Set_Cursor_Visibility (Visibility);
+                 Set_Timeout_Mode (Standard_Window, Non_Blocking, 0);
+
+                 Move_Cursor (Line => Lines / 2, Column => (Columns - 12) / 2);
+                 Add (Str => "Hello World!");
+
+                 while not done loop
+
+                    c := Get_Keystroke (Standard_Window);
+                    case c is
+                    when Character'Pos ('q') => done := True;
+                    when others => null;
+                    end case;
+
+                    Nap_Milli_Seconds (50);
+
+                 end loop;
+
+                 End_Windows;
+
+              end Hello;
+
+       Then, using
+              gnatmake  `adacurses-config  --cflags` hello -largs
+              `adacurses-config --libs`
+
+       or (simpler):
+              gnatmake hello `adacurses-config`
+
+       you will compile and link the program.
+
 
 

SEE ALSO

        curses(3x)
 
-       This describes ncurses version 5.9 (patch 20140524).
+       This describes ncurses version 5.9 (patch 20140809).
 
 
 
diff --git a/doc/html/man/captoinfo.1m.html b/doc/html/man/captoinfo.1m.html
index b9ca9363..eec8372f 100644
--- a/doc/html/man/captoinfo.1m.html
+++ b/doc/html/man/captoinfo.1m.html
@@ -205,7 +205,7 @@
 

SEE ALSO

        infocmp(1m), curses(3x), terminfo(5)
 
-       This describes ncurses version 5.9 (patch 20140524).
+       This describes ncurses version 5.9 (patch 20140809).
 
 
 
diff --git a/doc/html/man/clear.1.html b/doc/html/man/clear.1.html index 9b2ae01c..4eb0ef63 100644 --- a/doc/html/man/clear.1.html +++ b/doc/html/man/clear.1.html @@ -71,7 +71,7 @@

SEE ALSO

        tput(1), terminfo(5)
 
-       This describes ncurses version 5.9 (patch 20140524).
+       This describes ncurses version 5.9 (patch 20140809).
 
 
 
diff --git a/doc/html/man/form.3x.html b/doc/html/man/form.3x.html
index 6c620aec..c95854dd 100644
--- a/doc/html/man/form.3x.html
+++ b/doc/html/man/form.3x.html
@@ -243,7 +243,7 @@
 
 

SEE ALSO

-       This describes ncurses version 5.9 (patch 20140524).
+       This describes ncurses version 5.9 (patch 20140809).
 
 
 
diff --git a/doc/html/man/form_field_opts.3x.html b/doc/html/man/form_field_opts.3x.html
index 1cdfe703..11318a6e 100644
--- a/doc/html/man/form_field_opts.3x.html
+++ b/doc/html/man/form_field_opts.3x.html
@@ -2,7 +2,7 @@
 
 
 
@@ -75,11 +75,8 @@
        The function field_opts returns the field's current option
        bits.
 
-       The following options are defined (all are on by default):
-
-       O_VISIBLE
-            The field is displayed.  If this option is off,  dis-
-            play of the field is suppressed.
+       The following standard options are defined (all are on  by
+       default):
 
        O_ACTIVE
             The  field  is  visited  during  processing.  If this
@@ -87,43 +84,54 @@
             navigation  keys.  Please  notice  that  an invisible
             field appears to be inactive also.
 
-       O_PUBLIC
-            The field contents are displayed as data is entered.
-
-       O_EDIT
-            The field can be edited.
-
-       O_WRAP
-            Words that do not fit on a line are  wrapped  to  the
-            next line.  Words are blank-separated.
+       O_AUTOSKIP
+            Skip to the next field when this one fills.
 
        O_BLANK
-            The  field is cleared whenever a character is entered
+            The field is cleared whenever a character is  entered
             at the first position.
 
-       O_AUTOSKIP
-            Skip to the next field when this one fills.
+       O_EDIT
+            The field can be edited.
 
        O_NULLOK
             Allow a blank field.
 
+       O_PASSOK
+            Validate field only if modified by user.
+
+       O_PUBLIC
+            The field contents are displayed as data is entered.
+
        O_STATIC
-            Field buffers are fixed  to  field's  original  size.
+            Field  buffers  are  fixed  to field's original size.
             Turn this option off to create a dynamic field.
 
-       O_PASSOK
-            Validate field only if modified by user.
+       O_VISIBLE
+            The field is displayed.  If this option is off,  dis-
+            play of the field is suppressed.
+
+       O_WRAP
+            Words  that  do  not fit on a line are wrapped to the
+            next line.  Words are blank-separated.
+
+       One extension option is defined  (extensions  are  off  by
+       default):
+
+       O_DYNAMIC_JUSTIFY
+            Permit  dynamic  fields  to be justified, like static
+            fields.
 
 
 

RETURN VALUE

-       Except  for  field_opts,  each  routine returns one of the
+       Except for field_opts, each routine  returns  one  of  the
        following:
 
        E_OK The routine succeeded.
 
        E_BAD_ARGUMENT
-            Routine detected an incorrect or  out-of-range  argu-
+            Routine  detected  an incorrect or out-of-range argu-
             ment.
 
        E_CURRENT
@@ -135,7 +143,7 @@
 
 

SEE ALSO

-       curses(3x), form(3x).
+       curses(3x), form(3x).  form_field_just(3x).
 
 
 
@@ -146,13 +154,13 @@

PORTABILITY

-       These routines emulate the System V forms  library.   They
+       These  routines  emulate the System V forms library.  They
        were not supported on Version 7 or BSD versions.
 
 
 

AUTHORS

-       Juergen  Pfeifer.   Manual  pages  and  adaptation for new
+       Juergen Pfeifer.  Manual  pages  and  adaptation  for  new
        curses by Eric S. Raymond.
 
 
diff --git a/doc/html/man/infocmp.1m.html b/doc/html/man/infocmp.1m.html
index 4d814961..9bb33e91 100644
--- a/doc/html/man/infocmp.1m.html
+++ b/doc/html/man/infocmp.1m.html
@@ -455,7 +455,7 @@
 
        http://invisible-island.net/ncurses/tctest.html
 
-       This describes ncurses version 5.9 (patch 20140524).
+       This describes ncurses version 5.9 (patch 20140809).
 
 
 
diff --git a/doc/html/man/infotocap.1m.html b/doc/html/man/infotocap.1m.html index 37c06938..a22c12f8 100644 --- a/doc/html/man/infotocap.1m.html +++ b/doc/html/man/infotocap.1m.html @@ -94,7 +94,7 @@

SEE ALSO

        curses(3x), tic(1m), infocmp(1m), terminfo(5)
 
-       This describes ncurses version 5.9 (patch 20140524).
+       This describes ncurses version 5.9 (patch 20140809).
 
 
 
diff --git a/doc/html/man/menu.3x.html b/doc/html/man/menu.3x.html index 822b44a6..5511ecd2 100644 --- a/doc/html/man/menu.3x.html +++ b/doc/html/man/menu.3x.html @@ -226,7 +226,7 @@

SEE ALSO

-       This describes ncurses version 5.9 (patch 20140524).
+       This describes ncurses version 5.9 (patch 20140809).
 
 
 
diff --git a/doc/html/man/ncurses.3x.html b/doc/html/man/ncurses.3x.html
index c4153e2e..ec387334 100644
--- a/doc/html/man/ncurses.3x.html
+++ b/doc/html/man/ncurses.3x.html
@@ -28,7 +28,7 @@
   * sale, use or other dealings in this Software without prior written       *
   * authorization.                                                           *
   ****************************************************************************
-  * @Id: ncurses.3x,v 1.117 2014/05/24 20:29:27 tom Exp @
+  * @Id: ncurses.3x,v 1.119 2014/08/09 20:54:30 tom Exp @
 -->
 
 
@@ -63,7 +63,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
-       ncurses version 5.9 (patch 20140524).
+       ncurses version 5.9 (patch 20140809).
 
        The ncurses library emulates the curses library of  System
        V  Release  4  UNIX,  and  XPG4 (X/Open Portability Guide)
@@ -1041,6 +1041,22 @@
        TERM Denotes  your  terminal  type.  Each terminal type is
             distinct, though many are similar.
 
+            TERM is commonly set by terminal  emulators  to  help
+            applications  find  a  workable terminal description.
+            Some of those choose a popular  approximation,  e.g.,
+            "ansi",  "vt100",  "xterm"  rather than an exact fit.
+            Not infrequently, your application will have problems
+            with that approach, e.g., incorrect function-key def-
+            initions.
+
+            If you set TERM in your environment, it has no effect
+            on  the  operation of the terminal emulator.  It only
+            affects the way applications work within  the  termi-
+            nal.  Likewise, as a general rule (xterm being a rare
+            exception), terminal emulators  which  allow  you  to
+            specify TERM as a parameter or configuration value do
+            not change their behavior to match that setting.
+
        TERMCAP
             If the ncurses library has been configured with term-
             cap  support,  ncurses  will  check  for a terminal's
diff --git a/doc/html/man/ncurses5-config.1.html b/doc/html/man/ncurses5-config.1.html
index 37b3d7db..22c23995 100644
--- a/doc/html/man/ncurses5-config.1.html
+++ b/doc/html/man/ncurses5-config.1.html
@@ -119,7 +119,7 @@
 

SEE ALSO

        curses(3x)
 
-       This describes ncurses version 5.9 (patch 20140524).
+       This describes ncurses version 5.9 (patch 20140809).
 
 
 
diff --git a/doc/html/man/panel.3x.html b/doc/html/man/panel.3x.html
index 00496bb7..7ffd60c3 100644
--- a/doc/html/man/panel.3x.html
+++ b/doc/html/man/panel.3x.html
@@ -218,7 +218,7 @@
 

SEE ALSO

        curses(3x), curs_variables(3x),
 
-       This describes ncurses version 5.9 (patch 20140524).
+       This describes ncurses version 5.9 (patch 20140809).
 
 
 
diff --git a/doc/html/man/tabs.1.html b/doc/html/man/tabs.1.html index 9f8e2b97..028a9533 100644 --- a/doc/html/man/tabs.1.html +++ b/doc/html/man/tabs.1.html @@ -160,7 +160,7 @@

SEE ALSO

        tset(1), infocmp(1m), curses(3x), terminfo(5).
 
-       This describes ncurses version 5.9 (patch 20140524).
+       This describes ncurses version 5.9 (patch 20140809).
 
 
 
diff --git a/doc/html/man/terminfo.5.html b/doc/html/man/terminfo.5.html
index 757120b9..be06a704 100644
--- a/doc/html/man/terminfo.5.html
+++ b/doc/html/man/terminfo.5.html
@@ -78,7 +78,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 ncurses version 5.9 (patch 20140524).
+       This describes ncurses version 5.9 (patch 20140809).
 
        Entries in terminfo consist of a sequence of `,' separated
        fields (embedded commas may be escaped with a backslash or
diff --git a/doc/html/man/tic.1m.html b/doc/html/man/tic.1m.html
index 5e543398..ea620b21 100644
--- a/doc/html/man/tic.1m.html
+++ b/doc/html/man/tic.1m.html
@@ -389,7 +389,7 @@
        infocmp(1m),   captoinfo(1m),   infotocap(1m),    toe(1m),
        curses(3x), term(5).  terminfo(5).
 
-       This describes ncurses version 5.9 (patch 20140524).
+       This describes ncurses version 5.9 (patch 20140809).
 
 
 
diff --git a/doc/html/man/toe.1m.html b/doc/html/man/toe.1m.html index bb724137..6d0700f5 100644 --- a/doc/html/man/toe.1m.html +++ b/doc/html/man/toe.1m.html @@ -119,7 +119,7 @@ tic(1m), infocmp(1m), captoinfo(1m), infotocap(1m), curses(3x), terminfo(5). - This describes ncurses version 5.9 (patch 20140524). + This describes ncurses version 5.9 (patch 20140809). diff --git a/doc/html/man/tput.1.html b/doc/html/man/tput.1.html index 95d873b9..e77d38a4 100644 --- a/doc/html/man/tput.1.html +++ b/doc/html/man/tput.1.html @@ -338,7 +338,7 @@

SEE ALSO

        clear(1), stty(1), tabs(1), terminfo(5), curs_termcap(3x).
 
-       This describes ncurses version 5.9 (patch 20140524).
+       This describes ncurses version 5.9 (patch 20140809).
 
 
 
diff --git a/doc/html/man/tset.1.html b/doc/html/man/tset.1.html
index f12cf7e3..821e13c0 100644
--- a/doc/html/man/tset.1.html
+++ b/doc/html/man/tset.1.html
@@ -319,7 +319,7 @@
        csh(1),   sh(1),   stty(1),   curs_terminfo(3x),   tty(4),
        terminfo(5), ttys(5), environ(7)
 
-       This describes ncurses version 5.9 (patch 20140524).
+       This describes ncurses version 5.9 (patch 20140809).
 
 
 
diff --git a/include/curses.h.in b/include/curses.h.in
index 26983aa1..65eedaa8 100644
--- a/include/curses.h.in
+++ b/include/curses.h.in
@@ -32,7 +32,7 @@
  *     and: Thomas E. Dickey                        1996-on                 *
  ****************************************************************************/
 
-/* $Id: curses.h.in,v 1.240 2014/08/02 16:01:30 tom Exp $ */
+/* $Id: curses.h.in,v 1.241 2014/08/09 20:39:44 tom Exp $ */
 
 #ifndef __NCURSES_H
 #define __NCURSES_H
@@ -74,12 +74,6 @@
  * NCURSES_ATTR_T is used to quiet compiler warnings when building ncurses
  * configured using --disable-macros.
  */
-#ifdef NCURSES_NOMACROS
-#ifndef NCURSES_ATTR_T
-#define NCURSES_ATTR_T attr_t
-#endif
-#endif /* NCURSES_NOMACROS */
-
 #ifndef NCURSES_ATTR_T
 #define NCURSES_ATTR_T int
 #endif
diff --git a/man/ncurses.3x b/man/ncurses.3x
index 73154b03..df709418 100644
--- a/man/ncurses.3x
+++ b/man/ncurses.3x
@@ -27,7 +27,7 @@
 .\" authorization.                                                           *
 .\"***************************************************************************
 .\"
-.\" $Id: ncurses.3x,v 1.117 2014/05/24 20:29:27 tom Exp $
+.\" $Id: ncurses.3x,v 1.119 2014/08/09 20:54:30 tom Exp $
 .hy 0
 .TH ncurses 3X ""
 .ie \n(.g .ds `` \(lq
@@ -1021,6 +1021,21 @@ file \fBtrace\fR to the current directory.
 TERM
 Denotes your terminal type.
 Each terminal type is distinct, though many are similar.
+.IP
+\fBTERM\fP is commonly set by terminal emulators to help
+applications find a workable terminal description.
+Some of those choose a popular approximation, e.g.,
+\*(``ansi\*('', \*(``vt100\*('', \*(``xterm\*('' rather than an exact fit.
+Not infrequently, your application will have problems with that approach,
+e.g., incorrect function-key definitions.
+.IP
+If you set \fBTERM\fP in your environment,
+it has no effect on the operation of the terminal emulator.
+It only affects the way applications work within the terminal.
+Likewise, as a general rule (\fBxterm\fP being a rare exception),
+terminal emulators which allow you to
+specify \fBTERM\fP as a parameter or configuration value do
+not change their behavior to match that setting.
 .TP 5
 TERMCAP
 If the \fBncurses\fR library has been configured with \fItermcap\fR
diff --git a/ncurses/win32con/win_driver.c b/ncurses/win32con/win_driver.c
index 0cb27e81..bc883004 100644
--- a/ncurses/win32con/win_driver.c
+++ b/ncurses/win32con/win_driver.c
@@ -34,6 +34,9 @@
 /*
  * TODO - GetMousePos(POINT * result) from ntconio.c
  * TODO - implement nodelay
+ * TODO - implement flash
+ * TODO - improve screen-repainting, using implied wraparound
+ * TODO - if non-buffered, change buffer size (temporarily) to window-size - SetConsoleScreenBufferSize
  */
 
 #include 
@@ -45,7 +48,7 @@
 
 #define CUR my_term.type.
 
-MODULE_ID("$Id: win_driver.c,v 1.39 2014/06/29 22:48:17 tom Exp $")
+MODULE_ID("$Id: win_driver.c,v 1.43 2014/08/09 20:31:40 tom Exp $")
 
 #ifndef __GNUC__
 #  error We need GCC to compile for MinGW
@@ -105,6 +108,8 @@ static struct {
     WORD pairs[NUMPAIRS];
     COORD origin;
     CHAR_INFO *save_screen;
+    COORD save_size;
+    SMALL_RECT save_region;
     CONSOLE_SCREEN_BUFFER_INFO SBI;
 } CON;
 
@@ -161,12 +166,64 @@ MapAttr(WORD res, attr_t ch)
     return res;
 }
 
+#if 0				/* def TRACE */
+static void
+dump_screen(const char *fn, int ln)
+{
+    int max_cells = (CON.SBI.dwSize.Y * (1 + CON.SBI.dwSize.X)) + 1;
+    char output[max_cells];
+    CHAR_INFO save_screen[max_cells];
+    COORD save_size;
+    SMALL_RECT save_region;
+    COORD bufferCoord;
+
+    T(("dump_screen %s@%d", fn, ln));
+
+    save_region.Top = CON.SBI.srWindow.Top;
+    save_region.Left = CON.SBI.srWindow.Left;
+    save_region.Bottom = CON.SBI.srWindow.Bottom;
+    save_region.Right = CON.SBI.srWindow.Right;
+
+    save_size.X = (SHORT) (save_region.Right - save_region.Left + 1);
+    save_size.Y = (SHORT) (save_region.Bottom - save_region.Top + 1);
+
+    bufferCoord.X = bufferCoord.Y = 0;
+
+    if (ReadConsoleOutput(CON.hdl,
+			  save_screen,
+			  save_size,
+			  bufferCoord,
+			  &save_region)) {
+	int i, j;
+	int ij = 0;
+	int k = 0;
+
+	for (i = save_region.Top; i <= save_region.Bottom; ++i) {
+	    for (j = save_region.Left; j <= save_region.Right; ++j) {
+		output[k++] = save_screen[ij++].Char.AsciiChar;
+	    }
+	    output[k++] = '\n';
+	}
+	output[k] = 0;
+
+	T(("DUMP: %d,%d - %d,%d",
+	   save_region.Top,
+	   save_region.Left,
+	   save_region.Bottom,
+	   save_region.Right));
+	T(("%s", output));
+    }
+}
+
+#else
+#define dump_screen(fn,ln)	/* nothing */
+#endif
+
 #if USE_WIDEC_SUPPORT
 /*
  * TODO: support surrogate pairs
  * TODO: support combining characters
  * TODO: support acsc
- * TODO: check wcwidth of base character, fill if needed for double-width
  * TODO: _nc_wacs should be part of sp.
  */
 static BOOL
@@ -205,14 +262,14 @@ con_write16(TERMINAL_CONTROL_BLOCK * TCB, int y, int x, cchar_t *str, int limit)
 	++actual;
     }
 
-    loc.X = (short) 0;
-    loc.Y = (short) 0;
-    siz.X = (short) actual;
+    loc.X = (SHORT) 0;
+    loc.Y = (SHORT) 0;
+    siz.X = (SHORT) actual;
     siz.Y = 1;
 
-    rec.Left = (short) x;
+    rec.Left = (SHORT) x;
     rec.Top = (SHORT) (y + AdjustY());
-    rec.Right = (short) (x + limit - 1);
+    rec.Right = (SHORT) (x + limit - 1);
     rec.Bottom = rec.Top;
 
     return WriteConsoleOutputW(CON.hdl, ci, siz, loc, &rec);
@@ -351,34 +408,30 @@ static bool
 restore_original_screen(void)
 {
     COORD bufferCoord;
-    SMALL_RECT writeRegion;
     bool result = FALSE;
+    SMALL_RECT save_region = CON.save_region;
 
-    if (CON.window_only) {
-	writeRegion.Top = CON.SBI.srWindow.Top;
-	writeRegion.Left = CON.SBI.srWindow.Left;
-	writeRegion.Bottom = CON.SBI.srWindow.Bottom;
-	writeRegion.Right = CON.SBI.srWindow.Right;
-	T(("... restoring window"));
-    } else {
-	writeRegion.Top = 0;
-	writeRegion.Left = 0;
-	writeRegion.Bottom = (SHORT) (CON.SBI.dwSize.Y - 1);
-	writeRegion.Right = (SHORT) (CON.SBI.dwSize.X - 1);
-	T(("... restoring entire buffer"));
-    }
+    T(("... restoring %s", CON.window_only ? "window" : "entire buffer"));
 
     bufferCoord.X = bufferCoord.Y = 0;
 
     if (WriteConsoleOutput(CON.hdl,
 			   CON.save_screen,
-			   CON.SBI.dwSize,
+			   CON.save_size,
 			   bufferCoord,
-			   &writeRegion)) {
+			   &save_region)) {
 	result = TRUE;
 	mvcur(-1, -1, LINES - 2, 0);
+	T(("... restore original screen contents ok %dx%d (%d,%d - %d,%d)",
+	   CON.save_size.Y,
+	   CON.save_size.X,
+	   save_region.Top,
+	   save_region.Left,
+	   save_region.Bottom,
+	   save_region.Right));
+    } else {
+	T(("... restore original screen contents err"));
     }
-    T(("... restore original screen contents %s", result ? "ok" : "err"));
     return result;
 }
 
@@ -406,6 +459,23 @@ wcon_doupdate(TERMINAL_CONTROL_BLOCK * TCB)
 	Height = screen_lines(sp);
 	nonempty = min(Height, NewScreen(sp)->_maxy + 1);
 
+	T(("... %dx%d clear cur:%d new:%d",
+	   Height, Width,
+	   CurScreen(sp)->_clear,
+	   NewScreen(sp)->_clear));
+
+	if (SP_PARM->_endwin) {
+
+	    T(("coming back from shell mode"));
+	    NCURSES_SP_NAME(reset_prog_mode) (NCURSES_SP_ARG);
+
+	    NCURSES_SP_NAME(_nc_mvcur_resume) (NCURSES_SP_ARG);
+	    NCURSES_SP_NAME(_nc_screen_resume) (NCURSES_SP_ARG);
+	    SP_PARM->_mouse_resume(SP_PARM);
+
+	    SP_PARM->_endwin = FALSE;
+	}
+
 	if ((CurScreen(sp)->_clear || NewScreen(sp)->_clear)) {
 	    int x;
 #if USE_WIDEC_SUPPORT
@@ -433,6 +503,8 @@ wcon_doupdate(TERMINAL_CONTROL_BLOCK * TCB)
 	    CurScreen(sp)->_clear = FALSE;
 	    NewScreen(sp)->_clear = FALSE;
 	    touchwin(NewScreen(sp));
+	    T(("... cleared %dx%d lines @%d of screen", nonempty, Width,
+	       AdjustY()));
 	}
 
 	for (y = 0; y < nonempty; y++) {
@@ -562,11 +634,12 @@ wcon_dobeepflash(TERMINAL_CONTROL_BLOCK * TCB,
 		 int beepFlag GCC_UNUSED)
 {
     SCREEN *sp;
-    int res = ERR;
+    int res = OK;
 
     AssertTCB();
     SetSP();
 
+    MessageBeep(MB_ICONWARNING);	/* MB_OK might be better */
     return res;
 }
 
@@ -807,6 +880,7 @@ wcon_mode(TERMINAL_CONTROL_BLOCK * TCB, int progFlag, int defFlag)
 		code = OK;
 	    }
 	}
+	T(("... buffered:%d, clear:%d", CON.buffered, CurScreen(sp)->_clear));
     } else {			/* shell mode */
 	if (defFlag) {
 	    /* def_shell_mode */
@@ -827,7 +901,7 @@ wcon_mode(TERMINAL_CONTROL_BLOCK * TCB, int progFlag, int defFlag)
 	}
     }
 
-    return (code);
+    returnCode(code);
 }
 
 static void
@@ -893,85 +967,78 @@ wcon_release(TERMINAL_CONTROL_BLOCK * TCB)
     returnVoid;
 }
 
-/*
- * Attempt to save the screen contents.  PDCurses does this if
- * PDC_RESTORE_SCREEN is set, giving the same visual appearance on restoration
- * as if the library had allocated a console buffer.
- */
 static bool
-save_original_screen(void)
+read_screen_data(void)
 {
     bool result = FALSE;
-    COORD bufferSize;
     COORD bufferCoord;
-    SMALL_RECT readRegion;
     size_t want;
 
-    bufferSize.X = CON.SBI.dwSize.X;
-    bufferSize.Y = CON.SBI.dwSize.Y;
-    want = (size_t) (bufferSize.X * bufferSize.Y);
+    CON.save_size.X = (SHORT) (CON.save_region.Right
+			       - CON.save_region.Left + 1);
+    CON.save_size.Y = (SHORT) (CON.save_region.Bottom
+			       - CON.save_region.Top + 1);
+
+    want = (size_t) (CON.save_size.X * CON.save_size.Y);
 
     if ((CON.save_screen = malloc(want * sizeof(CHAR_INFO))) != 0) {
 	bufferCoord.X = bufferCoord.Y = 0;
 
-	readRegion.Top = 0;
-	readRegion.Left = 0;
-	readRegion.Bottom = (SHORT) (bufferSize.Y - 1);
-	readRegion.Right = (SHORT) (bufferSize.X - 1);
-
-	T(("... reading console buffer %dx%d into %d,%d - %d,%d at %d,%d",
-	   bufferSize.Y, bufferSize.X,
-	   readRegion.Top,
-	   readRegion.Left,
-	   readRegion.Bottom,
-	   readRegion.Right,
+	T(("... reading console %s %dx%d into %d,%d - %d,%d at %d,%d",
+	   CON.window_only ? "window" : "buffer",
+	   CON.save_size.Y, CON.save_size.X,
+	   CON.save_region.Top,
+	   CON.save_region.Left,
+	   CON.save_region.Bottom,
+	   CON.save_region.Right,
 	   bufferCoord.Y,
 	   bufferCoord.X));
 
 	if (ReadConsoleOutput(CON.hdl,
 			      CON.save_screen,
-			      bufferSize,
+			      CON.save_size,
 			      bufferCoord,
-			      &readRegion)) {
+			      &CON.save_region)) {
 	    result = TRUE;
 	} else {
 	    T((" error %#lx", (unsigned long) GetLastError()));
 	    FreeAndNull(CON.save_screen);
+	}
+    }
 
-	    bufferSize.X = (SHORT) (CON.SBI.srWindow.Right
-				    - CON.SBI.srWindow.Left + 1);
-	    bufferSize.Y = (SHORT) (CON.SBI.srWindow.Bottom
-				    - CON.SBI.srWindow.Top + 1);
-	    want = (size_t) (bufferSize.X * bufferSize.Y);
-
-	    if ((CON.save_screen = malloc(want * sizeof(CHAR_INFO))) != 0) {
-		bufferCoord.X = bufferCoord.Y = 0;
-
-		readRegion.Top = CON.SBI.srWindow.Top;
-		readRegion.Left = CON.SBI.srWindow.Left;
-		readRegion.Bottom = CON.SBI.srWindow.Bottom;
-		readRegion.Right = CON.SBI.srWindow.Right;
-
-		T(("... reading console window %dx%d into %d,%d - %d,%d at %d,%d",
-		   bufferSize.Y, bufferSize.X,
-		   readRegion.Top,
-		   readRegion.Left,
-		   readRegion.Bottom,
-		   readRegion.Right,
-		   bufferCoord.Y,
-		   bufferCoord.X));
-
-		if (ReadConsoleOutput(CON.hdl,
-				      CON.save_screen,
-				      bufferSize,
-				      bufferCoord,
-				      &readRegion)) {
-		    result = TRUE;
-		    CON.window_only = TRUE;
-		} else {
-		    T((" error %#lx", (unsigned long) GetLastError()));
-		}
-	    }
+    return result;
+}
+
+/*
+ * Attempt to save the screen contents.  PDCurses does this if
+ * PDC_RESTORE_SCREEN is set, giving the same visual appearance on
+ * restoration as if the library had allocated a console buffer.  MSDN
+ * says that the data which can be read is limited to 64Kb (and may be
+ * less).
+ */
+static bool
+save_original_screen(void)
+{
+    bool result = FALSE;
+
+    CON.save_region.Top = 0;
+    CON.save_region.Left = 0;
+    CON.save_region.Bottom = (SHORT) (CON.SBI.dwSize.Y - 1);
+    CON.save_region.Right = (SHORT) (CON.SBI.dwSize.X - 1);
+
+    if (read_screen_data()) {
+	result = TRUE;
+    } else {
+
+	CON.save_region.Top = CON.SBI.srWindow.Top;
+	CON.save_region.Left = CON.SBI.srWindow.Left;
+	CON.save_region.Bottom = CON.SBI.srWindow.Bottom;
+	CON.save_region.Right = CON.SBI.srWindow.Right;
+
+	CON.window_only = TRUE;
+
+	if (read_screen_data()) {
+	    result = TRUE;
 	}
     }
 
@@ -1208,11 +1275,11 @@ tdiff(FILETIME fstart, FILETIME fend)
 static int
 Adjust(int milliseconds, int diff)
 {
-    if (milliseconds == INFINITY)
-	return milliseconds;
-    milliseconds -= diff;
-    if (milliseconds < 0)
-	milliseconds = 0;
+    if (milliseconds != INFINITY) {
+	milliseconds -= diff;
+	if (milliseconds < 0)
+	    milliseconds = 0;
+    }
     return milliseconds;
 }
 
@@ -1641,17 +1708,21 @@ _ismintty(int fd, LPHANDLE pMinTTY)
 #endif
 
 /*   Borrowed from ansicon project.
-     Check wether or not a I/O handle is associated with
+     Check whether or not an I/O handle is associated with
      a Windows console.
 */
 static BOOL
 IsConsoleHandle(HANDLE hdl)
 {
     DWORD dwFlag = 0;
+    BOOL result;
+
     if (!GetConsoleMode(hdl, &dwFlag)) {
-	return (int) WriteConsoleA(hdl, NULL, 0, &dwFlag, NULL);
+	result = (int) WriteConsoleA(hdl, NULL, 0, &dwFlag, NULL);
+    } else {
+	result = (int) (dwFlag & ENABLE_PROCESSED_OUTPUT);
     }
-    return (int) (dwFlag & ENABLE_PROCESSED_OUTPUT);
+    return result;
 }
 
 /*   Our replacement for the systems _isatty to include also
@@ -1661,13 +1732,16 @@ IsConsoleHandle(HANDLE hdl)
 int
 _nc_mingw_isatty(int fd)
 {
-    if (_isatty(fd))
-	return 1;
-#if WINVER < 0x0600
-    return 0;
-#else
-    return _ismintty(fd, NULL);
+    int result = 0;
+
+    if (_isatty(fd)) {
+	result = 1;
+    } else {
+#if WINVER >= 0x0600
+	result = _ismintty(fd, NULL);
 #endif
+    }
+    return result;
 }
 
 /*   This is used when running in terminfo mode to discover,
@@ -1693,15 +1767,15 @@ _nc_mingw_isconsole(int fd)
     SCREEN *sp;                                               \
     TERMINAL *term = 0;                                       \
     int code = ERR;                                           \
-    if (_nc_screen_chain==0)                                  \
-      return 0;                                               \
+    if (_nc_screen_chain == 0)                                \
+        return 0;                                             \
     for (each_screen(sp)) {                                   \
-        if (sp->_term && sp->_term->Filedes==fd) {            \
-	    term = sp->_term;                                 \
-	    break;                                            \
+        if (sp->_term && (sp->_term->Filedes == fd)) {        \
+            term = sp->_term;                                 \
+            break;                                            \
         }                                                     \
     }                                                         \
-    assert(term!=0)
+    assert(term != 0)
 
 int
 _nc_mingw_tcsetattr(
@@ -1855,6 +1929,7 @@ __attribute__((constructor))
 	BOOL buffered = TRUE;
 	BOOL b;
 
+	START_TRACE();
 	if (_nc_mingw_isatty(0)) {
 	    CON.isMinTTY = TRUE;
 	}
@@ -1896,9 +1971,11 @@ __attribute__((constructor))
 	    b = AttachConsole(ATTACH_PARENT_PROCESS);
 
 	if (getenv("NCGDB") || getenv("NCURSES_CONSOLE2")) {
-	    CON.hdl = CON.out;
+	    T(("... will not buffer console"));
 	    buffered = FALSE;
+	    CON.hdl = CON.out;
 	} else {
+	    T(("... creating console buffer"));
 	    CON.hdl = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE,
 						0,
 						NULL,
diff --git a/package/debian-mingw/changelog b/package/debian-mingw/changelog
index 5760a3ca..ba55c0a3 100644
--- a/package/debian-mingw/changelog
+++ b/package/debian-mingw/changelog
@@ -1,8 +1,8 @@
-ncurses6 (5.9-20140802) unstable; urgency=low
+ncurses6 (5.9-20140809) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey   Fri, 01 Aug 2014 19:41:10 -0400
+ -- Thomas E. Dickey   Fri, 08 Aug 2014 20:33:11 -0400
 
 ncurses6 (5.9-20131005) unstable; urgency=low
 
diff --git a/package/debian-mingw64/changelog b/package/debian-mingw64/changelog
index 5760a3ca..ba55c0a3 100644
--- a/package/debian-mingw64/changelog
+++ b/package/debian-mingw64/changelog
@@ -1,8 +1,8 @@
-ncurses6 (5.9-20140802) unstable; urgency=low
+ncurses6 (5.9-20140809) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey   Fri, 01 Aug 2014 19:41:10 -0400
+ -- Thomas E. Dickey   Fri, 08 Aug 2014 20:33:11 -0400
 
 ncurses6 (5.9-20131005) unstable; urgency=low
 
diff --git a/package/debian/changelog b/package/debian/changelog
index fe73e7a9..90472eb2 100644
--- a/package/debian/changelog
+++ b/package/debian/changelog
@@ -1,8 +1,8 @@
-ncurses6 (5.9-20140802) unstable; urgency=low
+ncurses6 (5.9-20140809) unstable; urgency=low
 
   * latest weekly patch
 
- -- Thomas E. Dickey   Fri, 01 Aug 2014 19:41:10 -0400
+ -- Thomas E. Dickey   Fri, 08 Aug 2014 20:33:11 -0400
 
 ncurses6 (5.9-20120608) unstable; urgency=low
 
diff --git a/package/mingw-ncurses.nsi b/package/mingw-ncurses.nsi
index c5eb435d..57ff6be0 100644
--- a/package/mingw-ncurses.nsi
+++ b/package/mingw-ncurses.nsi
@@ -1,4 +1,4 @@
-; $Id: mingw-ncurses.nsi,v 1.54 2014/08/01 23:41:10 tom Exp $
+; $Id: mingw-ncurses.nsi,v 1.55 2014/08/09 00:33:11 tom Exp $
 
 ; TODO add examples
 ; TODO bump ABI to 6
@@ -10,7 +10,7 @@
 !define VERSION_MAJOR "5"
 !define VERSION_MINOR "9"
 !define VERSION_YYYY  "2014"
-!define VERSION_MMDD  "0802"
+!define VERSION_MMDD  "0809"
 !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD}
 
 !define MY_ABI   "5"
diff --git a/package/mingw-ncurses.spec b/package/mingw-ncurses.spec
index e85e2140..fbfee71a 100644
--- a/package/mingw-ncurses.spec
+++ b/package/mingw-ncurses.spec
@@ -3,7 +3,7 @@
 Summary: shared libraries for terminal handling
 Name: mingw32-ncurses6
 Version: 5.9
-Release: 20140802
+Release: 20140809
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
diff --git a/package/ncurses.spec b/package/ncurses.spec
index 580b96c9..44df9a70 100644
--- a/package/ncurses.spec
+++ b/package/ncurses.spec
@@ -1,7 +1,7 @@
 Summary: shared libraries for terminal handling
 Name: ncurses6
 Version: 5.9
-Release: 20140802
+Release: 20140809
 License: X11
 Group: Development/Libraries
 Source: ncurses-%{version}-%{release}.tgz
diff --git a/test/background.c b/test/background.c
index 6c5ad996..291851b8 100644
--- a/test/background.c
+++ b/test/background.c
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: background.c,v 1.14 2014/02/01 22:10:42 tom Exp $
+ * $Id: background.c,v 1.15 2014/08/09 22:31:23 tom Exp $
  */
 
 #define NEED_COLOR_CODE 1
@@ -65,7 +65,7 @@ test_background(void)
     printw("Initializing pair 3 to %s/cyan (ACS_HLINE)\n", color_name(default_fg));
     init_pair(3, (NCURSES_COLOR_T) default_fg, COLOR_CYAN);
     printw("...and drawing a box which should be followed by lines\n");
-    bkgdset(ACS_HLINE | COLOR_PAIR(3));
+    bkgdset(ACS_HLINE | (attr_t) COLOR_PAIR(3));
     /*
      * Characters from vt100 line-drawing should be mapped to line-drawing,
      * since A_ALTCHARSET is set in the background, and the character part
diff --git a/test/bs.c b/test/bs.c
index c158cbb0..a74f6430 100644
--- a/test/bs.c
+++ b/test/bs.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2013,2014 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            *
@@ -34,7 +34,7 @@
  * v2.0 featuring strict ANSI/POSIX conformance, November 1993.
  * v2.1 with ncurses mouse support, September 1995
  *
- * $Id: bs.c,v 1.62 2013/11/16 19:57:56 tom Exp $
+ * $Id: bs.c,v 1.63 2014/08/09 22:27:12 tom Exp $
  */
 
 #include 
@@ -369,7 +369,7 @@ initgame(void)
 	MvAddCh(PYBASE + i, PXBASE - 3, (chtype) (i + 'A'));
 #ifdef A_COLOR
 	if (has_colors())
-	    attron((attr_t) COLOR_PAIR(COLOR_BLUE));
+	    attron(COLOR_PAIR(COLOR_BLUE));
 #endif /* A_COLOR */
 	(void) addch(' ');
 	for (j = 0; j < BWIDTH; j++)
@@ -387,7 +387,7 @@ initgame(void)
 	MvAddCh(CYBASE + i, CXBASE - 3, (chtype) (i + 'A'));
 #ifdef A_COLOR
 	if (has_colors())
-	    attron((attr_t) COLOR_PAIR(COLOR_BLUE));
+	    attron(COLOR_PAIR(COLOR_BLUE));
 #endif /* A_COLOR */
 	(void) addch(' ');
 	for (j = 0; j < BWIDTH; j++)
@@ -771,7 +771,7 @@ hitship(int x, int y)
 				    cgoto(y1, x1);
 #ifdef A_COLOR
 				    if (has_colors())
-					attron((attr_t) COLOR_PAIR(COLOR_GREEN));
+					attron(COLOR_PAIR(COLOR_GREEN));
 #endif /* A_COLOR */
 				    (void) addch(MARK_MISS);
 #ifdef A_COLOR
@@ -797,7 +797,7 @@ hitship(int x, int y)
 			pgoto(y1, x1);
 #ifdef A_COLOR
 			if (has_colors())
-			    attron((attr_t) COLOR_PAIR(COLOR_RED));
+			    attron(COLOR_PAIR(COLOR_RED));
 #endif /* A_COLOR */
 			(void) addch(SHOWHIT);
 #ifdef A_COLOR
@@ -836,9 +836,9 @@ plyturn(void)
 #ifdef A_COLOR
     if (has_colors()) {
 	if (hit)
-	    attron((attr_t) COLOR_PAIR(COLOR_RED));
+	    attron(COLOR_PAIR(COLOR_RED));
 	else
-	    attron((attr_t) COLOR_PAIR(COLOR_GREEN));
+	    attron(COLOR_PAIR(COLOR_GREEN));
     }
 #endif /* A_COLOR */
     (void) addch((chtype) hits[PLAYER][curx][cury]);
@@ -969,9 +969,9 @@ cpufire(int x, int y)
 #ifdef A_COLOR
     if (has_colors()) {
 	if (hit)
-	    attron((attr_t) COLOR_PAIR(COLOR_RED));
+	    attron(COLOR_PAIR(COLOR_RED));
 	else
-	    attron((attr_t) COLOR_PAIR(COLOR_GREEN));
+	    attron(COLOR_PAIR(COLOR_GREEN));
     }
 #endif /* A_COLOR */
     (void) addch((chtype) (hit ? SHOWHIT : SHOWSPLASH));
diff --git a/test/dots_curses.c b/test/dots_curses.c
index dc767116..c344280a 100644
--- a/test/dots_curses.c
+++ b/test/dots_curses.c
@@ -29,7 +29,7 @@
 /*
  * Author: Thomas E. Dickey
  *
- * $Id: dots_curses.c,v 1.2 2014/06/28 20:33:24 tom Exp $
+ * $Id: dots_curses.c,v 1.3 2014/08/09 22:28:42 tom Exp $
  *
  * A simple demo of the curses interface used for comparison with termcap.
  */
@@ -82,7 +82,7 @@ set_colors(int fg, int bg)
 {
     int pair = mypair(fg, bg);
     if (pair > 0) {
-	attron((attr_t) COLOR_PAIR(mypair(fg, bg)));
+	attron(COLOR_PAIR(mypair(fg, bg)));
     }
 }
 
@@ -127,7 +127,7 @@ main(int argc GCC_UNUSED,
 	    z = (int) (ranf() * COLORS);
 	    if (ranf() > 0.01) {
 		set_colors(fg = z, bg);
-		attron((attr_t) COLOR_PAIR(mypair(fg, bg)));
+		attron(COLOR_PAIR(mypair(fg, bg)));
 	    } else {
 		set_colors(fg, bg = z);
 		napms(1);
diff --git a/test/echochar.c b/test/echochar.c
index 8cb0833a..c9ac29ad 100644
--- a/test/echochar.c
+++ b/test/echochar.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2006-2010,2012 Free Software Foundation, Inc.              *
+ * Copyright (c) 2006-2012,2014 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            *
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: echochar.c,v 1.9 2012/06/09 20:30:32 tom Exp $
+ * $Id: echochar.c,v 1.10 2014/08/09 22:35:51 tom Exp $
  *
  * Demonstrate the echochar function (compare to dots.c).
  * Thomas Dickey - 2006/11/4
@@ -74,7 +74,7 @@ set_color(char *my_pairs, int fg, int bg)
 		  (short) fg,
 		  (short) bg);
     }
-    attron((attr_t) COLOR_PAIR(pair));
+    attron(COLOR_PAIR(pair));
 }
 
 int
diff --git a/test/filter.c b/test/filter.c
index b90012fe..ab2d8562 100644
--- a/test/filter.c
+++ b/test/filter.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2014 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            *
@@ -29,7 +29,7 @@
 /*
  * Author:  Thomas E. Dickey  1998
  *
- * $Id: filter.c,v 1.15 2012/06/09 20:30:32 tom Exp $
+ * $Id: filter.c,v 1.16 2014/08/09 22:35:51 tom Exp $
  */
 #include 
 
@@ -48,7 +48,7 @@
  */
 
 static int
-new_command(char *buffer, int length, attr_t underline)
+new_command(char *buffer, int length, int underline)
 {
     int code;
 
@@ -99,7 +99,7 @@ main(int argc, char *argv[])
 {
     int ch;
     char buffer[80];
-    attr_t underline;
+    int underline;
     bool i_option = FALSE;
 
     setlocale(LC_ALL, "");
@@ -133,7 +133,7 @@ main(int argc, char *argv[])
 	    background = -1;
 #endif
 	init_pair(1, COLOR_CYAN, (short) background);
-	underline = (attr_t) COLOR_PAIR(1);
+	underline = COLOR_PAIR(1);
     } else {
 	underline = A_UNDERLINE;
     }
diff --git a/test/gdc.c b/test/gdc.c
index 45eb39f4..04ea1b6b 100644
--- a/test/gdc.c
+++ b/test/gdc.c
@@ -33,7 +33,7 @@
  * modified 10-18-89 for curses (jrl)
  * 10-18-89 added signal handling
  *
- * $Id: gdc.c,v 1.41 2014/08/02 16:36:20 tom Exp $
+ * $Id: gdc.c,v 1.42 2014/08/09 22:28:42 tom Exp $
  */
 
 #include 
@@ -121,13 +121,13 @@ standt(int on)
 {
     if (on) {
 	if (hascolor) {
-	    attron((attr_t) COLOR_PAIR(PAIR_DIGITS));
+	    attron(COLOR_PAIR(PAIR_DIGITS));
 	} else {
 	    attron(A_STANDOUT);
 	}
     } else {
 	if (hascolor) {
-	    attron((attr_t) COLOR_PAIR(PAIR_OTHERS));
+	    attron(COLOR_PAIR(PAIR_OTHERS));
 	} else {
 	    attroff(A_STANDOUT);
 	}
diff --git a/test/ncurses.c b/test/ncurses.c
index a6a87d7f..345eadeb 100644
--- a/test/ncurses.c
+++ b/test/ncurses.c
@@ -40,7 +40,7 @@ AUTHOR
    Author: Eric S. Raymond  1993
            Thomas E. Dickey (beginning revision 1.27 in 1996).
 
-$Id: ncurses.c,v 1.414 2014/08/02 23:10:26 tom Exp $
+$Id: ncurses.c,v 1.415 2014/08/09 22:28:42 tom Exp $
 
 ***************************************************************************/
 
@@ -2235,13 +2235,13 @@ color_test(void)
 		NCURSES_COLOR_T bg = InxToBG(i);
 
 		init_pair(pair, fg, bg);
-		attron((attr_t) COLOR_PAIR(pair));
+		attron(COLOR_PAIR(pair));
 		if (opt_acsc)
-		    attron((attr_t) A_ALTCHARSET);
+		    attron(A_ALTCHARSET);
 		if (opt_bold)
-		    attron((attr_t) A_BOLD);
+		    attron(A_BOLD);
 		if (opt_revs)
-		    attron((attr_t) A_REVERSE);
+		    attron(A_REVERSE);
 
 		if (opt_nums) {
 		    sprintf(numbered, "{%02X}", (int) i);
@@ -2446,11 +2446,11 @@ wide_color_test(void)
 		init_pair(pair, InxToFG(i), InxToBG(i));
 		(void) color_set(pair, NULL);
 		if (opt_acsc)
-		    attr_on((attr_t) A_ALTCHARSET, NULL);
+		    attr_on(A_ALTCHARSET, NULL);
 		if (opt_bold)
-		    attr_on((attr_t) A_BOLD, NULL);
+		    attr_on(A_BOLD, NULL);
 		if (opt_revs)
-		    attr_on((attr_t) A_REVERSE, NULL);
+		    attr_on(A_REVERSE, NULL);
 
 		if (opt_nums) {
 		    sprintf(numbered, "{%02X}", i);