Update to ncurses-6.0

Change-Id: I98ab2ea8a5e13cca9f8b7cf6277b9b14a4da4299
diff --git a/c++/Makefile.in b/c++/Makefile.in
index 96d5879..4f5b960 100644
--- a/c++/Makefile.in
+++ b/c++/Makefile.in
@@ -1,6 +1,6 @@
-# $Id: Makefile.in,v 1.84 2007/04/28 15:29:12 tom Exp $
+# $Id: Makefile.in,v 1.111 2015/08/05 23:15:41 tom Exp $
 ##############################################################################
-# Copyright (c) 1998-2006,2007 Free Software Foundation, Inc.                #
+# Copyright (c) 1998-2014,2015 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"), #
@@ -34,7 +34,8 @@
 # turn off _all_ suffix rules; we'll generate our own
 .SUFFIXES:
 
-SHELL		= /bin/sh
+SHELL		= @SHELL@
+VPATH		= @srcdir@
 
 CF_MFLAGS 	= @cf_cv_makeflags@
 @SET_MAKE@
@@ -43,28 +44,41 @@
 
 MODEL		= ../@DFT_OBJ_SUBDIR@
 DESTDIR		= @DESTDIR@
+top_srcdir	= @top_srcdir@
 srcdir		= @srcdir@
 prefix		= @prefix@
 exec_prefix	= @exec_prefix@
+bindir		= @bindir@
 libdir		= @libdir@
 includedir	= @includedir@
+includesubdir	= @includesubdir@
+
+INCLUDEDIR	= $(DESTDIR)$(includedir)$(includesubdir)
+
+PACKAGE		= @PACKAGE@
 
 LIBTOOL		= @LIBTOOL_CXX@
+LIBTOOL_OPTS	= @LIBTOOL_OPTS@
 LIBTOOL_CLEAN	= @LIB_CLEAN@
 LIBTOOL_COMPILE	= @LIB_COMPILE@
 LIBTOOL_LINK	= @LIB_LINK@
 LIBTOOL_INSTALL	= @LIB_INSTALL@
 LIBTOOL_UNINSTALL = @LIB_UNINSTALL@
+LIBTOOL_VERSION = @LIBTOOL_VERSION@
+LT_UNDEF	= @LT_UNDEF@
 
 INSTALL		= @INSTALL@
 INSTALL_LIB	= @INSTALL@ @INSTALL_LIB@
 INSTALL_DATA	= @INSTALL_DATA@
 
 AR		= @AR@
-AR_OPTS		= @AR_OPTS@
+ARFLAGS		= @ARFLAGS@
+AWK		= @AWK@
+LD		= @LD@
+LN_S		= @LN_S@
 
 CXX_AR		= @CXX_AR@
-CXX_AR_OPTS	= @CXX_AR_OPTS@
+CXX_ARFLAGS	= @CXX_ARFLAGS@
 RANLIB		= @LIB_PREP@
 
 CXX		= @CXX@
@@ -73,7 +87,10 @@
 CXXLIBS		= @CXXLIBS@
 
 INCDIR		= ../include
-CPPFLAGS	= -I../c++ -I$(INCDIR) -I$(srcdir) -DHAVE_CONFIG_H @CPPFLAGS@
+CPPFLAGS	= -DHAVE_CONFIG_H @CPPFLAGS@
+
+CTAGS		= @CTAGS@
+ETAGS		= @ETAGS@
 
 CC		= ${CXX}
 CCFLAGS		= $(CPPFLAGS) $(CXXFLAGS)
@@ -95,106 +112,70 @@
 
 LINK		= @LINK_PROGS@ $(LIBTOOL_LINK) @CXXLDFLAGS@
 SHLIB_DIRS	= -L../lib
-SHLIB_LIST	= $(SHLIB_DIRS) -lncurses@LIB_SUFFIX@ @SHLIB_LIST@
+SHLIB_LIST	= $(SHLIB_DIRS) -lform@USE_LIB_SUFFIX@ -lmenu@USE_LIB_SUFFIX@ -lpanel@USE_LIB_SUFFIX@ -lncurses@USE_LIB_SUFFIX@ @SHLIB_LIST@
 
 LIBROOT		= ncurses++
 
-LIBNAME_LIBTOOL	= @LIB_PREFIX@$(LIBROOT)@LIB_SUFFIX@.la
-LIBNAME_NORMAL	= @LIB_PREFIX@$(LIBROOT)@LIB_SUFFIX@.a
+LIBNAME_LIBTOOL	= @LIB_PREFIX@$(LIBROOT)@USE_LIB_SUFFIX@.la
+LIBNAME_NORMAL	= @LIB_PREFIX@$(LIBROOT)@USE_LIB_SUFFIX@.a
 LIBNAME		= @LIB_PREFIX@$(LIBROOT)@CXX_LIB_SUFFIX@
 
-LINK_FLAGS	= @EXTRA_LDFLAGS@ -L../lib -l$(LIBROOT)@LIB_SUFFIX@
+LIBRARIES	= @Libs_To_Make@
 
-LINK_LIBTOOL	= @EXTRA_LDFLAGS@ -L../lib ../lib/$(LIBNAME)
+LINK_FLAGS	= @EXTRA_LDFLAGS@ -L../lib -l$(LIBROOT)@USE_LIB_SUFFIX@
+RPATH_LIST	= @RPATH_LIST@
+MK_SHARED_LIB	= @MK_SHARED_LIB@
+
+LINK_LIBTOOL	= @EXTRA_LDFLAGS@ -L../lib $(LIBRARIES)
 LINK_NORMAL	= $(LINK_FLAGS)
 LINK_DEBUG	= $(LINK_FLAGS)
 LINK_PROFILE	= $(LINK_FLAGS)
 LINK_SHARED	= $(LINK_FLAGS)
 
+# flags for test-programs
+TEST_LIBS	= @TEST_LIBS@
 TEST_ARGS	= @LDFLAGS_STATIC@ @TEST_ARGS@ @LDFLAGS_SHARED@ 
+TEST_LDFLAGS	= $(TEST_ARGS) @LDFLAGS@ \
+	@LD_MODEL@ $(TEST_LIBS) @LIBS@ @LOCAL_LDFLAGS@ $(CXXLIBS)
 
-LDFLAGS		= $(TEST_ARGS) @LDFLAGS@ \
-	@LD_MODEL@ @LIBS@ @LOCAL_LDFLAGS@ $(CXXLIBS)
-
-LDFLAGS_LIBTOOL	= $(LDFLAGS) $(CFLAGS_LIBTOOL)
-LDFLAGS_NORMAL	= $(LDFLAGS) $(CFLAGS_NORMAL)
-LDFLAGS_DEBUG	= $(LDFLAGS) $(CFLAGS_DEBUG)
-LDFLAGS_PROFILE	= $(LDFLAGS) $(CFLAGS_PROFILE)
-LDFLAGS_SHARED	= $(LDFLAGS) $(CFLAGS_SHARED) @LD_SHARED_OPTS@
+LDFLAGS_LIBTOOL	= $(TEST_LDFLAGS) $(CFLAGS_LIBTOOL)
+LDFLAGS_NORMAL	= $(TEST_LDFLAGS) $(CFLAGS_NORMAL)
+LDFLAGS_DEBUG	= $(TEST_LDFLAGS) $(CFLAGS_DEBUG)
+LDFLAGS_PROFILE	= $(TEST_LDFLAGS) $(CFLAGS_PROFILE)
+LDFLAGS_SHARED	= $(TEST_LDFLAGS) $(CFLAGS_SHARED) @LD_SHARED_OPTS@
 
 LDFLAGS_DEFAULT	= $(LINK_@DFT_UPR_MODEL@) $(LDFLAGS_@DFT_UPR_MODEL@)
 
+# flags for library built by this makefile
+LDFLAGS		= $(TEST_ARGS) @LDFLAGS@ \
+	@LD_MODEL@ $(TEST_LIBS) @LIBS@ $(CXXLIBS)
+
 AUTO_SRC	= \
 		etip.h
 
 all \
-libs ::		$(AUTO_SRC) ../lib/$(LIBNAME)
+libs ::		$(AUTO_SRC) $(LIBRARIES)
 
-all ::		demo$x
+@MAKE_TESTS@all ::		demo$x
 
 sources :	$(AUTO_SRC)
 
 depend :
 
 tags:
-	ctags *.[h] *.cc
-
-# Build a conventional library for installing, since a shared library would
-# pull in all of the ncurses libraries (panel, menu, form, ncurses) as direct
-# dependencies.
-LIB_OBJS = \
-	$(MODEL)/cursesf$o \
-	$(MODEL)/cursesm$o \
-	$(MODEL)/cursesw$o \
-	$(MODEL)/cursespad$o \
-	$(MODEL)/cursesp$o \
-	$(MODEL)/cursslk$o \
-	$(MODEL)/cursesapp$o \
-	$(MODEL)/cursesmain$o
-
-../lib/$(LIBNAME_NORMAL) : $(LIB_OBJS)
-	$(CXX_AR) $(CXX_AR_OPTS) $@ $?
-	$(RANLIB) $@
-
-../lib/$(LIBNAME_LIBTOOL) : $(LIB_OBJS)
-	cd ../lib && $(LIBTOOL_LINK) $(CXX) $(CXXFLAGS) \
-		-o $(LIBNAME) $(LIB_OBJS:$o=.lo) \
-		-rpath $(INSTALL_PREFIX)$(libdir) \
-		-version-info $(NCURSES_MAJOR):$(NCURSES_MINOR) $(SHLIB_LIST)
-
-OBJS_DEMO = $(MODEL)/demo$o
-
-$(MODEL)/demo$o : $(srcdir)/demo.cc \
-	$(cursesf_h) $(cursesm_h) $(cursesapp_h)
-
-demo$x:	$(OBJS_DEMO) \
-	../lib/$(LIBNAME)  \
-	@TEST_DEPS@
-	@ECHO_LINK@ $(LINK) -o $@ $(OBJS_DEMO) $(LDFLAGS_DEFAULT)
-
-etip.h:	$(srcdir)/etip.h.in $(srcdir)/edit_cfg.sh
-	cp $(srcdir)/etip.h.in $@
-	sh $(srcdir)/edit_cfg.sh ../include/ncurses_cfg.h $@
+	$(CTAGS) *.[h] *.cc
 
 $(DESTDIR)$(libdir) :
-	sh $(srcdir)/../mkdirs.sh $@
-
-install \
-install.libs:: ../lib/$(LIBNAME) $(DESTDIR)$(libdir)
-	$(LIBTOOL_INSTALL) $(INSTALL_LIB) ../lib/$(LIBNAME) $(DESTDIR)$(libdir)/$(LIBNAME)
-
-uninstall \
-uninstall.libs::
-	-$(LIBTOOL_UNINSTALL) rm -f $(DESTDIR)$(libdir)/$(LIBNAME)
+	mkdir -p $@
 
 mostlyclean ::
 	-rm -f core tags TAGS *~ *.bak *.i *.ii *.ln *.atac trace
 
 clean :: mostlyclean
-	-sh -c "if test -n '$x' ; then $(MAKE) clean x=''; fi"
+	-$(SHELL) -c "if test -n '$x' ; then $(MAKE) clean x=''; fi"
 	-rm -rf $(MODEL)/SunWS_cache
-	-$(LIBTOOL_CLEAN) rm -f demo$x $(AUTO_SRC) ../lib/$(LIBNAME) $(LIB_OBJS) $(OBJS_DEMO)
-	-rm -rf .libs
+	-$(LIBTOOL_CLEAN) rm -f demo$x $(AUTO_SRC) $(LIBRARIES) $(OBJS_DEMO)
+	-rm -rf .libs *.dSYM
 
 distclean :: clean
 	-rm -f Makefile
@@ -203,8 +184,16 @@
 
 ###############################################################################
 
+internal_h	= $(srcdir)/internal.h \
+		  $(INCDIR)/ncurses_cfg.h \
+		  $(INCDIR)/nc_mingw.h \
+		  $(INCDIR)/nc_string.h
+
+etip_h		= etip.h \
+		  $(INCDIR)/ncurses_dll.h
+
 cursesw_h	= $(srcdir)/cursesw.h \
-		  etip.h \
+		  $(etip_h) \
 		  $(INCDIR)/curses.h
 
 cursesp_h	= $(srcdir)/cursesp.h \
@@ -235,5 +224,26 @@
 	cd ../panel && $(MAKE) $@
 
 ###############################################################################
+
+OBJS_DEMO = $(MODEL)/demo$o
+
+$(MODEL)/demo$o : $(srcdir)/demo.cc \
+		$(internal_h) \
+		$(cursesf_h) \
+		$(cursesm_h) \
+		$(cursesapp_h)
+	@echo 'compiling demo (obj_s)'
+	@$(LIBTOOL_COMPILE) $(CXX) $(CFLAGS_DEFAULT) -c $(srcdir)/demo.cc -o $@
+
+demo$x:	$(OBJS_DEMO) \
+	$(LIBRARIES)  \
+	@TEST_DEPS@
+	@ECHO_LD@ $(LINK) -o $@ $(OBJS_DEMO) $(LDFLAGS_DEFAULT)
+
+etip.h:	$(srcdir)/etip.h.in $(srcdir)/edit_cfg.sh
+	cp $(srcdir)/etip.h.in $@
+	$(SHELL) $(srcdir)/edit_cfg.sh ../include/ncurses_cfg.h $@
+
+###############################################################################
 # The remainder of this file is automatically generated during configuration
 ###############################################################################
diff --git a/c++/cursesapp.h b/c++/cursesapp.h
index 7e995d2..e3cbc04 100644
--- a/c++/cursesapp.h
+++ b/c++/cursesapp.h
@@ -1,6 +1,6 @@
 // * This makes emacs happy -*-Mode: C++;-*-
 /****************************************************************************
- * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2005,2011 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: cursesapp.h,v 1.11 2005/05/28 21:57:44 tom Exp $
+// $Id: cursesapp.h,v 1.12 2011/09/17 22:12:10 tom Exp $
 
 #ifndef NCURSES_CURSESAPP_H_incl
 #define NCURSES_CURSESAPP_H_incl
@@ -80,6 +80,7 @@
   // This method is called to initialize the SLKs. Default is nothing.
   // You may rewrite this in your derived class
   virtual void init_labels(Soft_Label_Key_Set& S) const {
+    (void) S;
   }
 
   // Your derived class must implement this method. The return value must
@@ -118,6 +119,8 @@
   // Process the commandline arguments. The default implementation simply
   // ignores them. Your derived class may rewrite this.
   virtual void handleArgs(int argc, char* argv[]) {
+    (void) argc;
+    (void) argv;
   }
 
   // Does this application use colors?
@@ -138,37 +141,37 @@
 
   // Attributes to use for menu and forms foregrounds
   virtual chtype foregrounds() const {
-    return b_Colors ? COLOR_PAIR(1) : A_BOLD;
+    return b_Colors ? static_cast<chtype>(COLOR_PAIR(1)) : A_BOLD;
   }
 
   // Attributes to use for menu and forms backgrounds
   virtual chtype backgrounds() const {
-    return b_Colors ? COLOR_PAIR(2) : A_NORMAL;
+    return b_Colors ? static_cast<chtype>(COLOR_PAIR(2)) : A_NORMAL;
   }
 
   // Attributes to use for inactive (menu) elements
   virtual chtype inactives() const {
-    return b_Colors ? (COLOR_PAIR(3)|A_DIM) : A_DIM;
+    return b_Colors ? static_cast<chtype>(COLOR_PAIR(3)|A_DIM) : A_DIM;
   }
 
   // Attributes to use for (form) labels and SLKs
   virtual chtype labels() const {
-    return b_Colors ? COLOR_PAIR(4) : A_NORMAL;
+    return b_Colors ? static_cast<chtype>(COLOR_PAIR(4)) : A_NORMAL;
   }
 
   // Attributes to use for form backgrounds
   virtual chtype dialog_backgrounds() const {
-    return b_Colors ? COLOR_PAIR(4) : A_NORMAL;
+    return b_Colors ? static_cast<chtype>(COLOR_PAIR(4)) : A_NORMAL;
   }
 
   // Attributes to use as default for (form) window backgrounds
   virtual chtype window_backgrounds() const {
-    return b_Colors ? COLOR_PAIR(5) : A_NORMAL;
+    return b_Colors ? static_cast<chtype>(COLOR_PAIR(5)) : A_NORMAL;
   }
 
   // Attributes to use for the title window
   virtual chtype screen_titles() const {
-    return b_Colors ? COLOR_PAIR(6) : A_BOLD;
+    return b_Colors ? static_cast<chtype>(COLOR_PAIR(6)) : A_BOLD;
   }
 
 };
diff --git a/c++/cursesf.cc b/c++/cursesf.cc
index aaf1202..7956054 100644
--- a/c++/cursesf.cc
+++ b/c++/cursesf.cc
@@ -1,6 +1,6 @@
 // * this is for making emacs happy: -*-Mode: C++;-*-
 /****************************************************************************
- * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2005,2011 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            *
@@ -35,7 +35,7 @@
 #include "cursesf.h"
 #include "cursesapp.h"
 
-MODULE_ID("$Id: cursesf.cc,v 1.21 2005/08/13 18:09:06 tom Exp $")
+MODULE_ID("$Id: cursesf.cc,v 1.22 2011/09/17 22:12:10 tom Exp $")
 
 NCursesFormField::~NCursesFormField ()
 {
@@ -234,11 +234,13 @@
 void
 NCursesForm::On_Field_Init(NCursesFormField& field)
 {
+  (void) field;
 }
 
 void
 NCursesForm::On_Field_Termination(NCursesFormField& field)
 {
+  (void) field;
 }
 
 // call the form driver and do basic error checking.
@@ -260,16 +262,19 @@
 
 void NCursesForm::On_Request_Denied(int c) const
 {
+  (void) c;
   ::beep();
 }
 
 void NCursesForm::On_Invalid_Field(int c) const
 {
+  (void) c;
   ::beep();
 }
 
 void NCursesForm::On_Unknown_Command(int c) const
 {
+  (void) c;
   ::beep();
 }
 
@@ -373,6 +378,7 @@
 //
 bool _nc_xx_fld_fcheck(FIELD *f, const void *u)
 {
+  (void) f;
   NCursesFormField* F = reinterpret_cast<NCursesFormField*>(const_cast<void *>(u));
   assert(F != 0);
   UserDefinedFieldType* udf = reinterpret_cast<UserDefinedFieldType*>(F->fieldtype());
@@ -405,6 +411,7 @@
 
 bool _nc_xx_next_choice(FIELD *f, const void *u)
 {
+  (void) f;
   NCursesFormField* F = reinterpret_cast<NCursesFormField*>(const_cast<void *>(u));
   assert(F != 0);
   UserDefinedFieldType_With_Choice* udf =
@@ -415,6 +422,7 @@
 
 bool _nc_xx_prev_choice(FIELD *f, const void *u)
 {
+  (void) f;
   NCursesFormField* F = reinterpret_cast<NCursesFormField*>(const_cast<void *>(u));
   assert(F != 0);
   UserDefinedFieldType_With_Choice* udf =
diff --git a/c++/cursesf.h b/c++/cursesf.h
index 70a30c3..fe1f1aa 100644
--- a/c++/cursesf.h
+++ b/c++/cursesf.h
@@ -1,6 +1,6 @@
 // * This makes emacs happy -*-Mode: C++;-*-
 /****************************************************************************
- * Copyright (c) 1998-2004,2005 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.28 2005/08/13 18:08:24 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
@@ -61,7 +61,7 @@
 protected:
   FIELDTYPE* fieldtype;
 
-  inline void OnError(int err) const THROWS(NCursesFormException) {
+  inline void OnError(int err) const THROW2(NCursesException const, NCursesFormException) {
     if (err!=E_OK)
       THROW(new NCursesFormException (err));
   }
@@ -109,7 +109,7 @@
   NCursesFieldType* ftype;   // Associated field type
 
   // Error handler
-  inline void OnError (int err) const THROWS(NCursesFormException) {
+  inline void OnError (int err) const THROW2(NCursesException const, NCursesFormException) {
     if (err != E_OK)
       THROW(new NCursesFormException (err));
   }
@@ -391,7 +391,7 @@
 		 bool with_frame,
 		 bool autoDeleteFields);
 
-  inline void OnError (int err) const THROWS(NCursesFormException) {
+  inline void OnError (int err) const THROW2(NCursesException const, NCursesFormException) {
     if (err != E_OK)
       THROW(new NCursesFormException (err));
   }
@@ -673,20 +673,21 @@
 		   const T* p_UserData = STATIC_CAST(T*)(0))
     : NCursesForm(nlines,ncols,begin_y,begin_x) {
       if (form)
-	set_user (const_cast<void *>(p_UserData));
+	set_user (const_cast<void *>(reinterpret_cast<const void*>
+				     (p_UserData)));
   }
 
 public:
-  NCursesUserForm (NCursesFormField Fields[],
+  NCursesUserForm (NCursesFormField* Fields[],
 		   const T* p_UserData = STATIC_CAST(T*)(0),
 		   bool with_frame=FALSE,
 		   bool autoDelete_Fields=FALSE)
     : NCursesForm (Fields, with_frame, autoDelete_Fields) {
       if (form)
-	set_user (const_cast<void *>(p_UserData));
+	set_user (const_cast<void *>(reinterpret_cast<const void*>(p_UserData)));
   };
 
-  NCursesUserForm (NCursesFormField Fields[],
+  NCursesUserForm (NCursesFormField* Fields[],
 		   int nlines,
 		   int ncols,
 		   int begin_y = 0,
@@ -697,19 +698,20 @@
     : NCursesForm (Fields, nlines, ncols, begin_y, begin_x,
 		   with_frame, autoDelete_Fields) {
       if (form)
-	set_user (const_cast<void *>(p_UserData));
+	set_user (const_cast<void *>(reinterpret_cast<const void*>
+				     (p_UserData)));
   };
 
   virtual ~NCursesUserForm() {
   };
 
-  inline T* UserData (void) const {
+  inline T* UserData (void) {
     return reinterpret_cast<T*>(get_user ());
   };
 
   inline virtual void setUserData (const T* p_UserData) {
     if (form)
-      set_user (const_cast<void *>(p_UserData));
+      set_user (const_cast<void *>(reinterpret_cast<const void*>(p_UserData)));
   }
 
 };
diff --git a/c++/cursesm.cc b/c++/cursesm.cc
index c253a67..222de46 100644
--- a/c++/cursesm.cc
+++ b/c++/cursesm.cc
@@ -1,6 +1,6 @@
 // * this is for making emacs happy: -*-Mode: C++;-*-
 /****************************************************************************
- * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2005,2011 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            *
@@ -35,7 +35,7 @@
 #include "cursesm.h"
 #include "cursesapp.h"
 
-MODULE_ID("$Id: cursesm.cc,v 1.22 2005/04/02 20:39:05 tom Exp $")
+MODULE_ID("$Id: cursesm.cc,v 1.23 2011/09/17 22:11:32 tom Exp $")
 
 NCursesMenuItem::~NCursesMenuItem()
 {
@@ -375,33 +375,39 @@
 void
 NCursesMenu::On_Item_Init(NCursesMenuItem& item)
 {
+  (void) item;
 }
 
 void
 NCursesMenu::On_Item_Termination(NCursesMenuItem& item)
 {
+  (void) item;
 }
 
 void
 NCursesMenu::On_Request_Denied(int c) const
 {
+  (void) c;
   ::beep();
 }
 
 void
 NCursesMenu::On_Not_Selectable(int c) const
 {
+  (void) c;
   ::beep();
 }
 
 void
 NCursesMenu::On_No_Match(int c) const
 {
+  (void) c;
   ::beep();
 }
 
 void
 NCursesMenu::On_Unknown_Command(int c) const
 {
+  (void) c;
   ::beep();
 }
diff --git a/c++/cursesm.h b/c++/cursesm.h
index d9c2273..f8f9665 100644
--- a/c++/cursesm.h
+++ b/c++/cursesm.h
@@ -1,6 +1,6 @@
 // * This makes emacs happy -*-Mode: C++;-*-
 /****************************************************************************
- * Copyright (c) 1998-2003,2005 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.25 2005/08/13 18:10:36 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
@@ -53,7 +53,7 @@
 protected:
   ITEM *item;
 
-  inline void OnError (int err) const THROWS(NCursesMenuException) {
+  inline void OnError (int err) const THROW2(NCursesException const, NCursesMenuException) {
     if (err != E_OK)
       THROW(new NCursesMenuException (err));
   }
@@ -82,6 +82,7 @@
   NCursesMenuItem(const NCursesMenuItem& rhs)
     : item(0)
   {
+    (void) rhs;
   }
 
   virtual ~NCursesMenuItem ();
@@ -252,7 +253,7 @@
 		 bool with_frame,
 		 bool autoDeleteItems);
 
-  inline void OnError (int err) const THROWS(NCursesMenuException) {
+  inline void OnError (int err) const THROW2(NCursesException const, NCursesMenuException) {
     if (err != E_OK)
       THROW(new NCursesMenuException (this, err));
   }
@@ -631,20 +632,20 @@
 		   const T* p_UserData = STATIC_CAST(T*)(0))
     : NCursesMenu(nlines,ncols,begin_y,begin_x) {
       if (menu)
-	set_user (const_cast<void *>(p_UserData));
+	set_user (const_cast<void *>(reinterpret_cast<const void*>(p_UserData)));
   }
 
 public:
-  NCursesUserMenu (NCursesMenuItem Items[],
+  NCursesUserMenu (NCursesMenuItem* Items[],
 		   const T* p_UserData = STATIC_CAST(T*)(0),
 		   bool with_frame=FALSE,
 		   bool autoDelete_Items=FALSE)
     : NCursesMenu (Items, with_frame, autoDelete_Items) {
       if (menu)
-	set_user (const_cast<void *>(p_UserData));
+	set_user (const_cast<void *>(reinterpret_cast<const void*>(p_UserData)));
   };
 
-  NCursesUserMenu (NCursesMenuItem Items[],
+  NCursesUserMenu (NCursesMenuItem* Items[],
 		   int nlines,
 		   int ncols,
 		   int begin_y = 0,
@@ -653,19 +654,19 @@
 		   bool with_frame=FALSE)
     : NCursesMenu (Items, nlines, ncols, begin_y, begin_x, with_frame) {
       if (menu)
-	set_user (const_cast<void *>(p_UserData));
+	set_user (const_cast<void *>(reinterpret_cast<const void*>(p_UserData)));
   };
 
   virtual ~NCursesUserMenu() {
   };
 
-  inline T* UserData (void) const {
+  inline T* UserData (void) {
     return reinterpret_cast<T*>(get_user ());
   };
 
   inline virtual void setUserData (const T* p_UserData) {
     if (menu)
-      set_user (const_cast<void *>(p_UserData));
+      set_user (const_cast<void *>(reinterpret_cast<const void*>(p_UserData)));
   }
 };
 
diff --git a/c++/cursesmain.cc b/c++/cursesmain.cc
index 1f82d4a..e870995 100644
--- a/c++/cursesmain.cc
+++ b/c++/cursesmain.cc
@@ -1,6 +1,6 @@
 // * this is for making emacs happy: -*-Mode: C++;-*-
 /****************************************************************************
- * Copyright (c) 1998-2003,2007 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2007,2013 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            *
@@ -35,13 +35,15 @@
 #include "cursesapp.h"
 
 #if CPP_HAS_TRY_CATCH && HAVE_IOSTREAM
+#pragma GCC diagnostic ignored "-Weffc++"
 #include <iostream>
+#pragma GCC diagnostic warning "-Weffc++"
 #else
 #undef CPP_HAS_TRY_CATCH
 #define CPP_HAS_TRY_CATCH 0
 #endif
 
-MODULE_ID("$Id: cursesmain.cc,v 1.14 2007/04/07 17:10:11 tom Exp $")
+MODULE_ID("$Id: cursesmain.cc,v 1.15 2013/09/28 20:56:47 tom Exp $")
 
 #if HAVE_LOCALE_H
 #include <locale.h>
diff --git a/c++/cursesp.h b/c++/cursesp.h
index 9b63d6d..54b0d58 100644
--- a/c++/cursesp.h
+++ b/c++/cursesp.h
@@ -1,6 +1,6 @@
 // * This makes emacs happy -*-Mode: C++;-*-
 /****************************************************************************
- * Copyright (c) 1998-2007,2008 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.29 2008/08/16 17:20:23 tom Exp $
+// $Id: cursesp.h,v 1.31 2014/08/09 22:06:26 Adam.Jiang Exp $
 
 #include <cursesw.h>
 
@@ -86,7 +86,7 @@
     return result;
   }
 
-  void OnError (int err) const THROWS(NCursesPanelException)
+  void OnError (int err) const THROW2(NCursesException const, NCursesPanelException)
   {
     if (err==ERR)
       THROW(new NCursesPanelException (this, err));
@@ -236,7 +236,8 @@
     : NCursesPanel (nlines, ncols, begin_y, begin_x)
   {
       if (p)
-	set_user (const_cast<void *>(p_UserData));
+	set_user (const_cast<void *>(reinterpret_cast<const void*>
+				     (p_UserData)));
   };
   // This creates an user panel of the requested size with associated
   // user data pointed to by p_UserData.
@@ -244,14 +245,14 @@
   NCursesUserPanel(const T* p_UserData = STATIC_CAST(T*)(0)) : NCursesPanel()
   {
     if (p)
-      set_user(const_cast<void *>(p_UserData));
+      set_user(const_cast<void *>(reinterpret_cast<const void*>(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<T*>(get_user ());
   };
@@ -260,7 +261,7 @@
   virtual void setUserData (const T* p_UserData)
   {
     if (p)
-      set_user (const_cast<void *>(p_UserData));
+      set_user (const_cast<void *>(reinterpret_cast<const void*>(p_UserData)));
   }
   // Associate the user panel with the user data pointed to by p_UserData.
 };
diff --git a/c++/cursespad.cc b/c++/cursespad.cc
index 28c58fa..a534713 100644
--- a/c++/cursespad.cc
+++ b/c++/cursespad.cc
@@ -1,6 +1,6 @@
 // * this is for making emacs happy: -*-Mode: C++;-*-
 /****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2012,2013 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            *
@@ -33,10 +33,9 @@
 
 #include "internal.h"
 
-#include <etip.h>
 #include <cursesw.h>
 
-MODULE_ID("$Id: cursespad.cc,v 1.13 2008/08/04 18:59:22 tom Exp $")
+MODULE_ID("$Id: cursespad.cc,v 1.17 2013/03/30 19:45:36 tom Exp $")
 
 NCursesPad::NCursesPad(int nlines, int ncols)
   : NCursesWindow(),
@@ -220,6 +219,7 @@
 
 void NCursesFramedPad::OnOperation(int pad_req)
 {
+  (void) pad_req;
   NCursesWindow* W = Win();
   NCursesWindow* W2 = getWindow();
 
@@ -228,25 +228,45 @@
     int Height = W->height();
     int i, row, col, h_len, v_len;
 
-    h_len = (Width*Width + width() - 1)/width();
-    if (h_len==0)
+    int my_width = width();
+
+    if (my_width != 0) {
+      h_len = (Width*Width + my_width - 1) / my_width;
+      if (h_len==0)
+	h_len = 1;
+      if (h_len > Width)
+	h_len = Width;
+    } else {
       h_len = 1;
-    if (h_len > Width)
-      h_len = Width;
+    }
 
-    v_len = (Height*Height + height() - 1)/height();
-    if (v_len==0)
+    int my_height = height();
+
+    if (my_height != 0) {
+      v_len = (Height*Height + my_height - 1) / my_height;
+      if (v_len==0)
+	v_len = 1;
+      if (v_len > Height)
+	v_len = Height;
+    } else {
       v_len = 1;
-    if (v_len > Height)
-      v_len = Height;
+    }
 
-    col  = (min_col * Width + width() - 1)  / width();
-    if (col + h_len > Width)
-      col = Width - h_len;
+    if (my_width != 0) {
+      col  = (min_col * Width + my_width - 1) / my_width;
+      if (col + h_len > Width)
+        col = Width - h_len;
+    } else {
+      col = 0;
+    }
 
-    row  = (min_row * Height + height() - 1) / height();
-    if (row + v_len > Height)
-      row = Height - v_len;
+    if (my_height != 0) {
+      row  = (min_row * Height + my_height - 1) / my_height;
+      if (row + v_len > Height)
+        row = Height - v_len;
+    } else {
+      row = 0;
+    }
 
     W2->vline(1,Width+1,Height);
     W2->attron(A_REVERSE);
diff --git a/c++/cursesw.cc b/c++/cursesw.cc
index 825d08d..1643877 100644
--- a/c++/cursesw.cc
+++ b/c++/cursesw.cc
@@ -1,6 +1,6 @@
 // * this is for making emacs happy: -*-Mode: C++;-*-
 /****************************************************************************
- * Copyright (c) 2007 Free Software Foundation, Inc.                        *
+ * Copyright (c) 2007-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            *
@@ -42,7 +42,7 @@
 #include "internal.h"
 #include "cursesw.h"
 
-MODULE_ID("$Id: cursesw.cc,v 1.49 2007/12/15 23:01:57 tom Exp $")
+MODULE_ID("$Id: cursesw.cc,v 1.54 2014/02/01 22:10:42 tom Exp $")
 
 #define COLORS_NEED_INITIALIZATION  -1
 #define COLORS_NOT_INITIALIZED       0
@@ -192,7 +192,6 @@
     constructing();
 
     w = static_cast<WINDOW *>(0);
-    set_keyboard();
 }
 
 NCursesWindow::NCursesWindow(int nlines, int ncols, int begin_y, int begin_x)
@@ -285,19 +284,19 @@
 NCursesWindow::NCursesWindow(WINDOW *win, int ncols)
   : w(0), alloced(FALSE), par(0), subwins(0), sib(0)
 {
+    (void) ncols;
     initialize();
     w = win;
-    assert((w->_maxx +1 ) == ncols);
 }
 
 int _nc_xx_ripoff_init(WINDOW *w, int ncols)
 {
+    (void) ncols;
     int res = ERR;
 
     RIPOFFINIT init = *prip++;
     if (init) {
-	NCursesWindow* W = new NCursesWindow(w,ncols);
-	res = init(*W);
+	res = init(*(new NCursesWindow(w,ncols)));
     }
     return res;
 }
@@ -402,16 +401,16 @@
     }
 }
 
-short
+NCURSES_PAIRS_T
 NCursesWindow::getPair() const
 {
-    return static_cast<short>(PAIR_NUMBER(getattrs(w)));
+    return static_cast<NCURSES_PAIRS_T>(PAIR_NUMBER(getattrs(w)));
 }
 
-short
+NCURSES_COLOR_T
 NCursesWindow::getcolor(int getback) const
 {
-    short fore, back;
+    NCURSES_COLOR_T fore, back;
 
     if (HaveColors()) {
 	if (::pair_content(getPair(), &fore, &back) == ERR)
@@ -429,27 +428,27 @@
     return (HaveColors()) ? COLORS : 1;
 }
 
-short
+NCURSES_PAIRS_T
 NCursesWindow::getcolor() const
 {
     return (HaveColors()) ? getPair() : 0;
 }
 
 int
-NCursesWindow::setpalette(short fore, short back, short pair)
+NCursesWindow::setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back, NCURSES_PAIRS_T pair)
 {
     return (HaveColors()) ? ::init_pair(pair, fore, back) : OK;
 }
 
 int
-NCursesWindow::setpalette(short fore, short back)
+NCursesWindow::setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back)
 {
     return setpalette(fore, back, getPair());
 }
 
 
 int
-NCursesWindow::setcolor(short pair)
+NCursesWindow::setcolor(NCURSES_PAIRS_T pair)
 {
     if (HaveColors()) {
 	if ((pair < 1) || (pair > COLOR_PAIRS))
@@ -464,7 +463,7 @@
 #if HAVE_HAS_KEY
 bool NCursesWindow::has_mouse() const
 {
-    return ((::has_key(KEY_MOUSE) || ::_nc_has_mouse())
+    return ((::has_key(KEY_MOUSE) || ::has_mouse())
 	     ? TRUE : FALSE);
 }
 #endif
diff --git a/c++/cursesw.h b/c++/cursesw.h
index b8e921a..ca07b04 100644
--- a/c++/cursesw.h
+++ b/c++/cursesw.h
@@ -1,7 +1,7 @@
 // * This makes emacs happy -*-Mode: C++;-*-
 // vile:cppmode
 /****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,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 @@
 #ifndef NCURSES_CURSESW_H_incl
 #define NCURSES_CURSESW_H_incl 1
 
-// $Id: cursesw.h,v 1.48 2008/01/19 21:09:10 tom Exp $
+// $Id: cursesw.h,v 1.50 2014/02/01 22:17:37 tom Exp $
 
 #include <etip.h>
 
@@ -118,7 +118,7 @@
 #endif
 
 #ifdef chgat
-inline int UNDEF(chgat)(int n, attr_t attr, short color, const void *opts) {
+inline int UNDEF(chgat)(int n, attr_t attr, NCURSES_PAIRS_T color, const void *opts) {
   return chgat(n, attr, color, opts); }
 #undef chgat
 #define chgat UNDEF(chgat)
@@ -151,7 +151,7 @@
 #endif
 
 #ifdef color_set
-inline chtype UNDEF(color_set)(short p, void* opts) { return color_set(p, opts); }
+inline chtype UNDEF(color_set)(NCURSES_PAIRS_T p, void* opts) { return color_set(p, opts); }
 #undef color_set
 #define color_set UNDEF(color_set)
 #endif
@@ -361,7 +361,7 @@
 
 #ifdef mvchgat
 inline int UNDEF(mvchgat)(int y, int x, int n,
-			  attr_t attr, short color, const void *opts) {
+			  attr_t attr, NCURSES_PAIRS_T color, const void *opts) {
   return mvchgat(y, x, n, attr, color, opts); }
 #undef mvchgat
 #define mvchgat UNDEF(mvchgat)
@@ -463,7 +463,7 @@
 
 #ifdef mvwchgat
 inline int UNDEF(mvwchgat)(WINDOW *win, int y, int x, int n,
-			   attr_t attr, short color, const void *opts) {
+			   attr_t attr, NCURSES_PAIRS_T color, const void *opts) {
   return mvwchgat(win, y, x, n, attr, color, opts); }
 #undef mvwchgat
 #define mvwchgat UNDEF(mvwchgat)
@@ -763,10 +763,10 @@
 
   void           set_keyboard();
 
-  short          getcolor(int getback) const;
-  short          getPair() const;
+  NCURSES_COLOR_T getcolor(int getback) const;
+  NCURSES_PAIRS_T getPair() const;
 
-  static int     setpalette(short fore, short back, short pair);
+  static int     setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back, NCURSES_PAIRS_T pair);
   static int     colorInitialized;
 
   // This private constructor is only used during the initialization
@@ -896,19 +896,19 @@
   int            maxy() const { return getmaxy(w) == ERR ? ERR : getmaxy(w)-1; }
   // Largest y coord in window
 
-  short          getcolor() const;
+  NCURSES_PAIRS_T getcolor() const;
   // Actual color pair
 
-  short          foreground() const { return getcolor(0); }
+  NCURSES_COLOR_T foreground() const { return getcolor(0); }
   // Actual foreground color
 
-  short          background() const { return getcolor(1); }
+  NCURSES_COLOR_T background() const { return getcolor(1); }
   // Actual background color
 
-  int            setpalette(short fore, short back);
+  int            setpalette(NCURSES_COLOR_T fore, NCURSES_COLOR_T back);
   // Set color palette entry
 
-  int            setcolor(short pair);
+  int            setcolor(NCURSES_PAIRS_T pair);
   // Set actually used palette entry
 
   // -------------------------------------------------------------------------
@@ -1107,18 +1107,18 @@
   chtype         attrget() { return ::getattrs(w); }
   // Get the window attributes;
 
-  int            color_set(short color_pair_number, void* opts=NULL) {
+  int            color_set(NCURSES_PAIRS_T color_pair_number, void* opts=NULL) {
     return ::wcolor_set(w, color_pair_number, opts); }
   // Set the window color attribute;
 
-  int            chgat(int n, attr_t attr, short color, const void *opts=NULL) {
+  int            chgat(int n, attr_t attr, NCURSES_PAIRS_T color, const void *opts=NULL) {
     return ::wchgat(w, n, attr, color, opts); }
   // Change the attributes of the next n characters in the current line. If
   // n is negative or greater than the number of remaining characters in the
   // line, the attributes will be changed up to the end of the line.
 
   int            chgat(int y, int x,
-		       int n, attr_t attr, short color, const void *opts=NULL) {
+		       int n, attr_t attr, NCURSES_PAIRS_T color, const void *opts=NULL) {
     return ::mvwchgat(w, y, x, n, attr, color, opts); }
   // Move the cursor to the requested position and then perform chgat() as
   // described above.
@@ -1438,16 +1438,19 @@
   // The driver translates the keystroke c into an Pad_Request
 
   virtual void OnUnknownOperation(int pad_req) {
+    (void) pad_req;
     ::beep();
   }
   // This is called if the driver returns an unknown op-code
 
   virtual void OnNavigationError(int pad_req) {
+    (void) pad_req;
     ::beep();
   }
   // This is called if a navigation request couldn't be satisfied
 
   virtual void OnOperation(int pad_req) {
+    (void) pad_req;
   };
   // OnOperation is called if a Pad_Operation was executed and just before
   // the refresh() operation is done.
@@ -1542,11 +1545,15 @@
   }
 
   void setWindow(NCursesWindow& view, int v_grid = 1, int h_grid = 1) {
+    (void) view;
+    (void) v_grid;
+    (void) h_grid;
     err_handler("Operation not allowed");
   }
   // Disable this call; the viewport is already defined
 
   void setSubWindow(NCursesWindow& sub) {
+    (void) sub;
     err_handler("Operation not allowed");
   }
   // Disable this call; the viewport subwindow is already defined
diff --git a/c++/cursslk.cc b/c++/cursslk.cc
index cfbc9da..23785df 100644
--- a/c++/cursslk.cc
+++ b/c++/cursslk.cc
@@ -1,6 +1,6 @@
 // * this is for making emacs happy: -*-Mode: C++;-*-
 /****************************************************************************
- * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2005,2012 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            *
@@ -35,14 +35,15 @@
 #include "cursslk.h"
 #include "cursesapp.h"
 
-MODULE_ID("$Id: cursslk.cc,v 1.15 2005/08/06 22:12:36 tom Exp $")
+MODULE_ID("$Id: cursslk.cc,v 1.16 2012/02/23 10:41:56 tom Exp $")
 
 Soft_Label_Key_Set::Soft_Label_Key&
   Soft_Label_Key_Set::Soft_Label_Key::operator=(char *text)
 {
   delete[] label;
-  label = new char[1 + ::strlen(text)];
-  (::strcpy)(label,text);
+  size_t need = 1 + ::strlen(text);
+  label = new char[need];
+  ::_nc_STRCPY(label,text,need);
   return *this;
 }
 
diff --git a/c++/demo.cc b/c++/demo.cc
index ddd5f2b..8bcfb14 100644
--- a/c++/demo.cc
+++ b/c++/demo.cc
@@ -1,6 +1,6 @@
 // * This makes emacs happy -*-Mode: C++;-*-
 /****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 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            *
@@ -35,7 +35,7 @@
  *   Demo code for NCursesMenu and NCursesForm written by
  *   Juergen Pfeifer
  *
- * $Id: demo.cc,v 1.38 2008/08/04 17:16:57 tom Exp $
+ * $Id: demo.cc,v 1.41 2012/02/23 10:41:56 tom Exp $
  */
 
 #include "internal.h"
@@ -43,7 +43,13 @@
 #include "cursesm.h"
 #include "cursesf.h"
 
+#ifdef __MINGW32__
+#undef KEY_EVENT
+#endif
+
+#ifndef __MINGW32__
 extern "C" unsigned int sleep(unsigned int);
+#endif
 
 #undef index // needed for NeXT
 
@@ -214,6 +220,7 @@
   int chk;
 protected:
   bool field_check(NCursesFormField& f) {
+    (void) f;
     return TRUE;
   }
   bool char_check(int c) {
@@ -313,7 +320,7 @@
     for(int i=1; i <= S->labels(); i++) {
       char buf[8];
       assert(i < 100);
-      ::sprintf(buf, "Frm%02d", i);
+      ::_nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf)) "Frm%02d", i);
       (*S)[i] = buf;                                      // Text
       (*S)[i] = Soft_Label_Key_Set::Soft_Label_Key::Left; // Justification
     }
@@ -533,7 +540,7 @@
   for(int i=1; i <= S.labels(); i++) {
     char buf[8];
     assert(i < 100);
-    ::sprintf(buf, "Key%02d", i);
+    ::_nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf)) "Key%02d", i);
     S[i] = buf;                                      // Text
     S[i] = Soft_Label_Key_Set::Soft_Label_Key::Left; // Justification
   }
diff --git a/c++/etip.h.in b/c++/etip.h.in
index 20642a6..9f642ee 100644
--- a/c++/etip.h.in
+++ b/c++/etip.h.in
@@ -1,6 +1,6 @@
 // * This makes emacs happy -*-Mode: C++;-*-
 /****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2011,2012 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: etip.h.in,v 1.37 2008/08/30 19:27:32 tom Exp $
+// $Id: etip.h.in,v 1.39 2012/12/29 21:50:44 tom Exp $
 
 #ifndef NCURSES_ETIP_H_incl
 #define NCURSES_ETIP_H_incl 1
@@ -184,7 +184,7 @@
 
   NCursesPanelException (const char *msg, int err) :
     NCursesException (msg, err),
-    p (NULL)
+    p (0)
     {};
 
   NCursesPanelException (const NCursesPanel* panel,
@@ -196,7 +196,7 @@
 
   NCursesPanelException (int err) :
     NCursesException ("panel library error", err),
-    p (NULL)
+    p (0)
     {};
 
   NCursesPanelException (const NCursesPanel* panel,
@@ -235,7 +235,7 @@
 
   NCursesMenuException (const char *msg, int err) :
     NCursesException (msg, err),
-    m (NULL)
+    m (0)
     {};
 
   NCursesMenuException (const NCursesMenu* menu,
@@ -247,7 +247,7 @@
 
   NCursesMenuException (int err) :
     NCursesException ("menu library error", err),
-    m (NULL)
+    m (0)
     {};
 
   NCursesMenuException (const NCursesMenu* menu,
@@ -286,7 +286,7 @@
 
   NCursesFormException (const char *msg, int err) :
     NCursesException (msg, err),
-    f (NULL)
+    f (0)
     {};
 
   NCursesFormException (const NCursesForm* form,
@@ -298,7 +298,7 @@
 
   NCursesFormException (int err) :
     NCursesException ("form library error", err),
-    f (NULL)
+    f (0)
     {};
 
   NCursesFormException (const NCursesForm* form,
@@ -367,11 +367,13 @@
 #define NCURSES_CPP_TRY		/* nothing */
 #define NCURSES_CPP_CATCH(e)	if (false)
 #define THROWS(s)		/* nothing */
+#define THROW2(s,t)		/* nothing */
 #elif CPP_HAS_TRY_CATCH
   throw *e;
 #define NCURSES_CPP_TRY		try
 #define NCURSES_CPP_CATCH(e)	catch(e)
 #define THROWS(s)		throw(s)
+#define THROW2(s,t)		throw(s,t)
 #endif
 }
 
diff --git a/c++/internal.h b/c++/internal.h
index 3066e72..1f6b4a6 100644
--- a/c++/internal.h
+++ b/c++/internal.h
@@ -1,6 +1,6 @@
 // * This makes emacs happy -*-Mode: C++;-*-
 /****************************************************************************
- * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2008,2012 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: internal.h,v 1.16 2008/10/25 21:35:44 tom Exp $
+// $Id: internal.h,v 1.18 2012/02/23 10:41:56 tom Exp $
 
 #ifndef NCURSES_CPLUS_INTERNAL_H
 #define NCURSES_CPLUS_INTERNAL_H 1
@@ -44,6 +44,11 @@
 #define MODULE_ID(id) /*nothing*/
 #endif
 
+#ifdef __MINGW32__
+#include <nc_mingw.h>
+#undef KEY_EVENT
+#endif
+
 #ifndef _QNX_SOURCE
 #include <stdlib.h>
 #include <string.h>
@@ -57,4 +62,6 @@
 #define NULL 0
 #endif
 
+#include <nc_string.h>
+
 #endif /* NCURSES_CPLUS_INTERNAL_H */
diff --git a/c++/modules b/c++/modules
index bc4fae5..56ddad5 100644
--- a/c++/modules
+++ b/c++/modules
@@ -1,7 +1,7 @@
 # Program modules
-# $Id: modules,v 1.7 2006/12/24 00:53:08 tom Exp $
+# $Id: modules,v 1.11 2013/03/30 19:41:11 tom Exp $
 ##############################################################################
-# Copyright (c) 1998,2006 Free Software Foundation, Inc.                     #
+# Copyright (c) 1998-2006,2013 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"), #
@@ -32,14 +32,13 @@
 #
 
 @ base
-cursesf		c++		$(srcdir)	$(cursesf_h) $(cursesapp_h)
-cursesm		c++		$(srcdir)	$(cursesm_h) $(cursesapp_h)
-cursesp		c++		$(srcdir)	$(cursesp_h)
-cursesw		c++		$(srcdir)	$(cursesw_h)
-cursespad	c++		$(srcdir)	$(cursesw_h)
-cursslk		c++		$(srcdir)	$(cursslk_h) $(cursesapp_h)
-cursesapp	c++		$(srcdir)	$(cursesapp_h)
-cursesmain	c++		$(srcdir)	$(cursesapp_h)
-demo		c++		$(srcdir)	$(cursesf_h) $(cursesm_h) $(cursesapp_h)
+cursesf		c++		$(srcdir)	$(internal_h) $(cursesf_h) $(cursesapp_h)
+cursesm		c++		$(srcdir)	$(internal_h) $(cursesm_h) $(cursesapp_h)
+cursesw		c++		$(srcdir)	$(internal_h) $(cursesw_h)
+cursespad	c++		$(srcdir)	$(internal_h) $(cursesw_h)
+cursesp		c++		$(srcdir)	$(internal_h) $(cursesp_h)
+cursslk		c++		$(srcdir)	$(internal_h) $(cursesapp_h)
+cursesapp	c++		$(srcdir)	$(internal_h) $(cursesapp_h)
+cursesmain	c++		$(srcdir)	$(internal_h) $(cursesapp_h) $(INCDIR)/nc_alloc.h
 
 # vile:makemode