Update to ncurses-6.0

Change-Id: I98ab2ea8a5e13cca9f8b7cf6277b9b14a4da4299
diff --git a/panel/Makefile b/panel/Makefile
deleted file mode 100644
index a4a8e3d..0000000
--- a/panel/Makefile
+++ /dev/null
@@ -1,492 +0,0 @@
-# $Id: Makefile.in,v 1.52 2007/04/28 14:56:11 tom Exp $
-##############################################################################
-# Copyright (c) 1998-2006,2007 Free Software Foundation, Inc.                #
-#                                                                            #
-# Permission is hereby granted, free of charge, to any person obtaining a    #
-# copy of this software and associated documentation files (the "Software"), #
-# to deal in the Software without restriction, including without limitation  #
-# the rights to use, copy, modify, merge, publish, distribute, distribute    #
-# with modifications, sublicense, and/or sell copies of the Software, and to #
-# permit persons to whom the Software is furnished to do so, subject to the  #
-# following conditions:                                                      #
-#                                                                            #
-# The above copyright notice and this permission notice shall be included in #
-# all copies or substantial portions of the Software.                        #
-#                                                                            #
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   #
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    #
-# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      #
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING    #
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER        #
-# DEALINGS IN THE SOFTWARE.                                                  #
-#                                                                            #
-# Except as contained in this notice, the name(s) of the above copyright     #
-# holders shall not be used in advertising or otherwise to promote the sale, #
-# use or other dealings in this Software without prior written               #
-# authorization.                                                             #
-##############################################################################
-#
-# Author: Thomas E. Dickey 1996-on
-#
-# Makefile for panels source code.
-#
-# This makes the following:
-#	libraries (normal/debug/profile/shared)
-#
-# The variable 'srcdir' refers to the source-distribution, and can be set with
-# the configure script by "--srcdir=DIR".
-#
-# The rules are organized to produce the libraries for the configured models,
-
-# turn off _all_ suffix rules; we'll generate our own
-.SUFFIXES:
-
-SHELL		= /bin/sh
-THIS		= Makefile
-
-x		= 
-o		= .o
-
-MODEL		= normal
-DESTDIR		= 
-srcdir		= .
-prefix		= /usr/local
-exec_prefix	= ${prefix}
-bindir		= ${exec_prefix}/bin
-libdir		= ${exec_prefix}/lib
-includedir	= ${prefix}/include/ncurses
-datadir		= ${prefix}/share
-
-LIBTOOL		= 
-LIBTOOL_CLEAN	= 
-LIBTOOL_COMPILE	= 
-LIBTOOL_LINK	= ${CC}
-LIBTOOL_INSTALL	= 
-LIBTOOL_UNINSTALL = 
-
-INSTALL		= /usr/bin/install -c
-INSTALL_LIB	= /usr/bin/install -c -m 644
-INSTALL_PROG	= ${INSTALL}
-INSTALL_DATA	= ${INSTALL} -m 644
-
-AR		= arm-eabi-ar
-AR_OPTS		= rv
-AWK		= mawk
-LD		= arm-eabi-ld
-LN_S		= ln -s
-
-CC		= agcc.pl
-CPP		= agcc.pl -E
-CFLAGS		= -O2 --param max-inline-insns-single=1200
-
-CPPFLAGS	= -I../ncurses -DHAVE_CONFIG_H -I. -I../include  -U_XOPEN_SOURCE -D_XOPEN_SOURCE=500 -U_POSIX_C_SOURCE -D_POSIX_C_SOURCE=199506L -DNDEBUG -I${includedir}
-
-CCFLAGS		= $(CPPFLAGS) $(CFLAGS)
-
-CFLAGS_LIBTOOL	= $(CCFLAGS)
-CFLAGS_NORMAL	= $(CCFLAGS)
-CFLAGS_DEBUG	= $(CCFLAGS) -g -DTRACE
-CFLAGS_PROFILE	= $(CCFLAGS) -pg
-CFLAGS_SHARED	= $(CCFLAGS) unknown
-
-CFLAGS_DEFAULT	= $(CFLAGS_NORMAL)
-
-LINK		= $(LIBTOOL_LINK)
-LDFLAGS		=   
-
-SHLIB_DIRS	= -L../lib
-SHLIB_LIST	= $(SHLIB_DIRS) -lncurses 
-
-MK_SHARED_LIB	= echo unknown
-
-NCURSES_MAJOR	= 5
-NCURSES_MINOR	= 7
-REL_VERSION	= 5.7
-ABI_VERSION	= 5
-
-RANLIB		= arm-eabi-ranlib
-
-LIBRARIES	=  ../lib/libpanel.a ../lib/libpanel_g.a
-
-LINT		= 
-LINT_OPTS	= 
-LINT_LIBS	= -lpanel -lncurses 
-
-AUTO_SRC	= \
-		../include/panel.h
-
-################################################################################
-all \
-libs \
-install ::	$(AUTO_SRC) $(LIBRARIES)
-
-sources:	$(AUTO_SRC)
-
-$(DESTDIR)$(bindir) \
-$(DESTDIR)$(libdir) :
-	sh $(srcdir)/../mkdirs.sh $@
-
-# make a copy to simplify include-paths while still keeping panel's include
-# file in this directory.
-../include/panel.h : $(srcdir)/panel.h
-	-rm -f $@
-	cp $(srcdir)/panel.h $@
-
-PANEL_PRIV_H = \
-	$(srcdir)/panel.priv.h \
-	$(srcdir)/panel.h
-
-tags:
-	ctags *.[ch]
-
-TAGS:
-	etags *.[ch]
-
-mostlyclean ::
-	-rm -f core tags TAGS *~ *.bak *.i *.ln *.atac trace
-
-clean :: mostlyclean
-	-rm -f $(AUTO_SRC)
-
-distclean :: clean
-	-rm -f Makefile
-
-realclean :: distclean
-
-###############################################################################
-# The remainder of this file is automatically generated during configuration
-###############################################################################
-
-# generated by mk-0th.awk
-#   libname:    panel
-#   subsets:    ticlib+termlib+ext_tinfo+base+ext_funcs
-
-.SUFFIXES: .c .cc .h .i .ii
-.c.i :
-	$(CPP) $(CPPFLAGS) $< >$@
-.cc.ii :
-	$(CPP) $(CPPFLAGS) $< >$@
-.h.i :
-	$(CPP) $(CPPFLAGS) $< >$@
-
-C_SRC = \
-	$(srcdir)/panel.c \
-	$(srcdir)/p_above.c \
-	$(srcdir)/p_below.c \
-	$(srcdir)/p_bottom.c \
-	$(srcdir)/p_delete.c \
-	$(srcdir)/p_hide.c \
-	$(srcdir)/p_hidden.c \
-	$(srcdir)/p_move.c \
-	$(srcdir)/p_new.c \
-	$(srcdir)/p_replace.c \
-	$(srcdir)/p_show.c \
-	$(srcdir)/p_top.c \
-	$(srcdir)/p_update.c \
-	$(srcdir)/p_user.c \
-	$(srcdir)/p_win.c
-
-# Producing llib-lpanel is time-consuming, so there's no direct-dependency for
-# it in the lintlib rule.  We'll only remove in the cleanest setup.
-clean ::
-	rm -f llib-lpanel.*
-
-realclean ::
-	rm -f llib-lpanel
-
-llib-lpanel : $(C_SRC)
-	cproto -a -l -DNCURSES_ENABLE_STDBOOL_H=0 -DLINT $(CPPFLAGS) $(C_SRC) >$@
-
-lintlib :
-	sh $(srcdir)/../misc/makellib panel $(CPPFLAGS)
-lint :
-	$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(C_SRC) $(LINT_LIBS)
-
-# generated by mk-1st.awk (subset=ticlib+termlib+ext_tinfo+base+ext_funcs)
-#  name:          panel
-#  traces:        DEBUG
-#  MODEL:         NORMAL
-#  model:         objects
-#  prefix:        lib
-#  suffix:        .a
-#  subset:        ticlib+termlib+ext_tinfo+base+ext_funcs
-#  ShlibVer:      auto
-#  ShlibVerInfix: no
-#  TermlibRoot:   ncurses
-#  TermlibSuffix: .a
-#  ReLink:        
-#  DoLinks:       no
-#  rmSoLocs:      no
-#  ldconfig:      :
-#  overwrite:     no
-#  depend:        ../include/ncurses_cfg.h ./panel.priv.h
-#  host:          arm-unknown-eabi
-
-NORMAL_OBJS = \
-	../objects/panel$o \
-	../objects/p_above$o \
-	../objects/p_below$o \
-	../objects/p_bottom$o \
-	../objects/p_delete$o \
-	../objects/p_hide$o \
-	../objects/p_hidden$o \
-	../objects/p_move$o \
-	../objects/p_new$o \
-	../objects/p_replace$o \
-	../objects/p_show$o \
-	../objects/p_top$o \
-	../objects/p_update$o \
-	../objects/p_user$o \
-	../objects/p_win$o
-
-$(NORMAL_OBJS) : ../include/ncurses_cfg.h ./panel.priv.h
-
-../lib/libpanel.a : $(NORMAL_OBJS)
-	$(AR) $(AR_OPTS) $@ $?
-	$(RANLIB) $@
-
-install \
-install.libs \
-install.panel :: $(DESTDIR)$(libdir) ../lib/libpanel.a
-	@echo installing ../lib/libpanel.a as $(DESTDIR)$(libdir)/libpanel.a
-	$(INSTALL_DATA) ../lib/libpanel.a $(DESTDIR)$(libdir)/libpanel.a
-	$(RANLIB) $(DESTDIR)$(libdir)/libpanel.a
-
-uninstall \
-uninstall.libs \
-uninstall.panel ::
-	@echo uninstalling $(DESTDIR)$(libdir)/libpanel.a
-	-@rm -f $(DESTDIR)$(libdir)/libpanel.a
-
-clean ::
-	-rm -f ../lib/libpanel.a
-
-mostlyclean::
-	-rm -f $(NORMAL_OBJS)
-
-# generated by mk-2nd.awk
-#   model:      objects
-#   MODEL:      NORMAL
-#   echo:       yes
-#   subset:     ticlib+termlib+ext_tinfo+base+ext_funcs
-#   crenames:   yes
-#   cxxrenames: no
-#   traces:     DEBUG
-#   srcdir:     .
-
-../objects/panel$o :	$(srcdir)/panel.c \
-			$(PANEL_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../panel/panel.c -o ../objects/panel$o
-
-../objects/p_above$o :	$(srcdir)/p_above.c \
-			$(PANEL_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../panel/p_above.c -o ../objects/p_above$o
-
-../objects/p_below$o :	$(srcdir)/p_below.c \
-			$(PANEL_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../panel/p_below.c -o ../objects/p_below$o
-
-../objects/p_bottom$o :	$(srcdir)/p_bottom.c \
-			$(PANEL_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../panel/p_bottom.c -o ../objects/p_bottom$o
-
-../objects/p_delete$o :	$(srcdir)/p_delete.c \
-			$(PANEL_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../panel/p_delete.c -o ../objects/p_delete$o
-
-../objects/p_hide$o :	$(srcdir)/p_hide.c \
-			$(PANEL_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../panel/p_hide.c -o ../objects/p_hide$o
-
-../objects/p_hidden$o :	$(srcdir)/p_hidden.c \
-			$(PANEL_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../panel/p_hidden.c -o ../objects/p_hidden$o
-
-../objects/p_move$o :	$(srcdir)/p_move.c \
-			$(PANEL_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../panel/p_move.c -o ../objects/p_move$o
-
-../objects/p_new$o :	$(srcdir)/p_new.c \
-			$(PANEL_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../panel/p_new.c -o ../objects/p_new$o
-
-../objects/p_replace$o :	$(srcdir)/p_replace.c \
-			$(PANEL_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../panel/p_replace.c -o ../objects/p_replace$o
-
-../objects/p_show$o :	$(srcdir)/p_show.c \
-			$(PANEL_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../panel/p_show.c -o ../objects/p_show$o
-
-../objects/p_top$o :	$(srcdir)/p_top.c \
-			$(PANEL_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../panel/p_top.c -o ../objects/p_top$o
-
-../objects/p_update$o :	$(srcdir)/p_update.c \
-			$(PANEL_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../panel/p_update.c -o ../objects/p_update$o
-
-../objects/p_user$o :	$(srcdir)/p_user.c \
-			$(PANEL_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../panel/p_user.c -o ../objects/p_user$o
-
-../objects/p_win$o :	$(srcdir)/p_win.c \
-			$(PANEL_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../panel/p_win.c -o ../objects/p_win$o
-
-
-# generated by mk-1st.awk (subset=ticlib+termlib+ext_tinfo+base+ext_funcs)
-#  name:          panel
-#  traces:        DEBUG
-#  MODEL:         DEBUG
-#  model:         obj_g
-#  prefix:        lib
-#  suffix:        _g.a
-#  subset:        ticlib+termlib+ext_tinfo+base+ext_funcs
-#  ShlibVer:      auto
-#  ShlibVerInfix: no
-#  TermlibRoot:   ncurses
-#  TermlibSuffix: .a
-#  ReLink:        
-#  DoLinks:       no
-#  rmSoLocs:      no
-#  ldconfig:      :
-#  overwrite:     no
-#  depend:        ../include/ncurses_cfg.h ./panel.priv.h
-#  host:          arm-unknown-eabi
-
-DEBUG_OBJS = \
-	../obj_g/panel$o \
-	../obj_g/p_above$o \
-	../obj_g/p_below$o \
-	../obj_g/p_bottom$o \
-	../obj_g/p_delete$o \
-	../obj_g/p_hide$o \
-	../obj_g/p_hidden$o \
-	../obj_g/p_move$o \
-	../obj_g/p_new$o \
-	../obj_g/p_replace$o \
-	../obj_g/p_show$o \
-	../obj_g/p_top$o \
-	../obj_g/p_update$o \
-	../obj_g/p_user$o \
-	../obj_g/p_win$o
-
-$(DEBUG_OBJS) : ../include/ncurses_cfg.h ./panel.priv.h
-
-../lib/libpanel_g.a : $(DEBUG_OBJS)
-	$(AR) $(AR_OPTS) $@ $?
-	$(RANLIB) $@
-
-install \
-install.libs \
-install.panel :: $(DESTDIR)$(libdir) ../lib/libpanel_g.a
-	@echo installing ../lib/libpanel_g.a as $(DESTDIR)$(libdir)/libpanel_g.a
-	$(INSTALL_DATA) ../lib/libpanel_g.a $(DESTDIR)$(libdir)/libpanel_g.a
-	$(RANLIB) $(DESTDIR)$(libdir)/libpanel_g.a
-
-uninstall \
-uninstall.libs \
-uninstall.panel ::
-	@echo uninstalling $(DESTDIR)$(libdir)/libpanel_g.a
-	-@rm -f $(DESTDIR)$(libdir)/libpanel_g.a
-
-clean ::
-	-rm -f ../lib/libpanel_g.a
-
-mostlyclean::
-	-rm -f $(DEBUG_OBJS)
-
-# generated by mk-2nd.awk
-#   model:      obj_g
-#   MODEL:      DEBUG
-#   echo:       yes
-#   subset:     ticlib+termlib+ext_tinfo+base+ext_funcs
-#   crenames:   yes
-#   cxxrenames: no
-#   traces:     DEBUG
-#   srcdir:     .
-
-../obj_g/panel$o :	$(srcdir)/panel.c \
-			$(PANEL_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../panel/panel.c -o ../obj_g/panel$o
-
-../obj_g/p_above$o :	$(srcdir)/p_above.c \
-			$(PANEL_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../panel/p_above.c -o ../obj_g/p_above$o
-
-../obj_g/p_below$o :	$(srcdir)/p_below.c \
-			$(PANEL_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../panel/p_below.c -o ../obj_g/p_below$o
-
-../obj_g/p_bottom$o :	$(srcdir)/p_bottom.c \
-			$(PANEL_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../panel/p_bottom.c -o ../obj_g/p_bottom$o
-
-../obj_g/p_delete$o :	$(srcdir)/p_delete.c \
-			$(PANEL_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../panel/p_delete.c -o ../obj_g/p_delete$o
-
-../obj_g/p_hide$o :	$(srcdir)/p_hide.c \
-			$(PANEL_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../panel/p_hide.c -o ../obj_g/p_hide$o
-
-../obj_g/p_hidden$o :	$(srcdir)/p_hidden.c \
-			$(PANEL_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../panel/p_hidden.c -o ../obj_g/p_hidden$o
-
-../obj_g/p_move$o :	$(srcdir)/p_move.c \
-			$(PANEL_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../panel/p_move.c -o ../obj_g/p_move$o
-
-../obj_g/p_new$o :	$(srcdir)/p_new.c \
-			$(PANEL_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../panel/p_new.c -o ../obj_g/p_new$o
-
-../obj_g/p_replace$o :	$(srcdir)/p_replace.c \
-			$(PANEL_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../panel/p_replace.c -o ../obj_g/p_replace$o
-
-../obj_g/p_show$o :	$(srcdir)/p_show.c \
-			$(PANEL_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../panel/p_show.c -o ../obj_g/p_show$o
-
-../obj_g/p_top$o :	$(srcdir)/p_top.c \
-			$(PANEL_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../panel/p_top.c -o ../obj_g/p_top$o
-
-../obj_g/p_update$o :	$(srcdir)/p_update.c \
-			$(PANEL_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../panel/p_update.c -o ../obj_g/p_update$o
-
-../obj_g/p_user$o :	$(srcdir)/p_user.c \
-			$(PANEL_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../panel/p_user.c -o ../obj_g/p_user$o
-
-../obj_g/p_win$o :	$(srcdir)/p_win.c \
-			$(PANEL_PRIV_H)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../panel/p_win.c -o ../obj_g/p_win$o
-
-
-# generated by mk-hdr.awk
-#  subset:     ticlib+termlib+ext_tinfo+base+ext_funcs
-#  compat:     yes
-
-${DESTDIR}${includedir} :
-	sh ${srcdir}/../mkdirs.sh $@
-
-install \
-install.libs \
-install.includes :: ${AUTO_SRC} ${DESTDIR}${includedir} \
-		$(srcdir)/panel.h
-	@ (cd ${DESTDIR}${includedir} && rm -f panel.h) ; ../headers.sh ${INSTALL_DATA} ${DESTDIR}${includedir} ${srcdir} $(srcdir)/panel.h
-
-uninstall \
-uninstall.libs \
-uninstall.includes ::
-	-@ (cd ${DESTDIR}${includedir} && rm -f panel.h)
-depend : ${AUTO_SRC}
-	makedepend -- ${CPPFLAGS} -- ${C_SRC}
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/panel/Makefile.in b/panel/Makefile.in
index 89dbeea..5ed4b02 100644
--- a/panel/Makefile.in
+++ b/panel/Makefile.in
@@ -1,6 +1,6 @@
-# $Id: Makefile.in,v 1.52 2007/04/28 14:56:11 tom Exp $
+# $Id: Makefile.in,v 1.69 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"), #
@@ -42,7 +42,8 @@
 # turn off _all_ suffix rules; we'll generate our own
 .SUFFIXES:
 
-SHELL		= /bin/sh
+SHELL		= @SHELL@
+VPATH		= @srcdir@
 THIS		= Makefile
 
 x		= @EXEEXT@
@@ -50,20 +51,29 @@
 
 MODEL		= @DFT_LWR_MODEL@
 DESTDIR		= @DESTDIR@
+top_srcdir	= @top_srcdir@
 srcdir		= @srcdir@
 prefix		= @prefix@
 exec_prefix	= @exec_prefix@
 bindir		= @bindir@
 libdir		= @libdir@
 includedir	= @includedir@
+datarootdir	= @datarootdir@
 datadir		= @datadir@
+includesubdir	= @includesubdir@
+
+INCLUDEDIR	= $(DESTDIR)$(includedir)$(includesubdir)
+
+PACKAGE		= @PACKAGE@
 
 LIBTOOL		= @LIBTOOL@
+LIBTOOL_OPTS	= @LIBTOOL_OPTS@ @EXPORT_SYMS@
 LIBTOOL_CLEAN	= @LIB_CLEAN@
 LIBTOOL_COMPILE	= @LIB_COMPILE@
 LIBTOOL_LINK	= @LIB_LINK@
 LIBTOOL_INSTALL	= @LIB_INSTALL@
 LIBTOOL_UNINSTALL = @LIB_UNINSTALL@
+LT_UNDEF	= @LT_UNDEF@
 
 INSTALL		= @INSTALL@
 INSTALL_LIB	= @INSTALL@ @INSTALL_LIB@
@@ -71,16 +81,19 @@
 INSTALL_DATA	= @INSTALL_DATA@
 
 AR		= @AR@
-AR_OPTS		= @AR_OPTS@
+ARFLAGS		= @ARFLAGS@
 AWK		= @AWK@
 LD		= @LD@
 LN_S		= @LN_S@
 
+CTAGS		= @CTAGS@
+ETAGS		= @ETAGS@
+
 CC		= @CC@
 CPP		= @CPP@
 CFLAGS		= @CFLAGS@
 
-CPPFLAGS	= -I@top_srcdir@/ncurses -DHAVE_CONFIG_H @CPPFLAGS@
+CPPFLAGS	= -I${top_srcdir}/ncurses -DHAVE_CONFIG_H @CPPFLAGS@
 
 CCFLAGS		= $(CPPFLAGS) $(CFLAGS)
 
@@ -96,8 +109,11 @@
 LDFLAGS		= @LDFLAGS@ @LD_MODEL@ @LIBS@
 
 SHLIB_DIRS	= -L../lib
-SHLIB_LIST	= $(SHLIB_DIRS) -lncurses@LIB_SUFFIX@ @SHLIB_LIST@
+SHLIB_LIST	= $(SHLIB_DIRS) -lncurses@USE_LIB_SUFFIX@ @SHLIB_LIST@
 
+RPATH_LIST	= @RPATH_LIST@
+RESULTING_SYMS	= @RESULTING_SYMS@
+VERSIONED_SYMS	= @VERSIONED_SYMS@
 MK_SHARED_LIB	= @MK_SHARED_LIB@
 
 NCURSES_MAJOR	= @NCURSES_MAJOR@
@@ -107,7 +123,7 @@
 
 RANLIB		= @LIB_PREP@
 
-LIBRARIES	= @LIBS_TO_MAKE@
+LIBRARIES	= @Libs_To_Make@
 
 LINT		= @LINT@
 LINT_OPTS	= @LINT_OPTS@
@@ -125,7 +141,7 @@
 
 $(DESTDIR)$(bindir) \
 $(DESTDIR)$(libdir) :
-	sh $(srcdir)/../mkdirs.sh $@
+	mkdir -p $@
 
 # make a copy to simplify include-paths while still keeping panel's include
 # file in this directory.
@@ -133,21 +149,22 @@
 	-rm -f $@
 	cp $(srcdir)/panel.h $@
 
-PANEL_PRIV_H = \
+HEADER_DEPS = \
 	$(srcdir)/panel.priv.h \
 	$(srcdir)/panel.h
 
 tags:
-	ctags *.[ch]
+	$(CTAGS) *.[ch]
 
 @MAKE_UPPER_TAGS@TAGS:
-@MAKE_UPPER_TAGS@	etags *.[ch]
+@MAKE_UPPER_TAGS@	$(ETAGS) *.[ch]
 
 mostlyclean ::
 	-rm -f core tags TAGS *~ *.bak *.i *.ln *.atac trace
 
 clean :: mostlyclean
 	-rm -f $(AUTO_SRC)
+	-rm -rf .libs *.dSYM
 
 distclean :: clean
 	-rm -f Makefile
diff --git a/panel/llib-lpanel b/panel/llib-lpanel
index de49c23..02e1054 100644
--- a/panel/llib-lpanel
+++ b/panel/llib-lpanel
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2002,2005 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,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            *
@@ -27,13 +27,13 @@
  ****************************************************************************/
 
 /****************************************************************************
- *  Author: Thomas E. Dickey        1997,2002,2005                          *
+ *  Author: Thomas E. Dickey       1996-on                                  *
  ****************************************************************************/
 /* LINTLIBRARY */
 
 /* ./panel.c */
 
-#include "panel.priv.h"
+#include <panel.priv.h>
 
 #undef _nc_retrace_panel
 PANEL	*_nc_retrace_panel(
@@ -77,6 +77,11 @@
 
 /* ./p_above.c */
 
+#undef ground_panel
+PANEL	*ground_panel(
+		SCREEN	*sp)
+		{ return(*(PANEL **)0); }
+
 #undef panel_above
 PANEL	*panel_above(
 		const PANEL *pan)
@@ -84,6 +89,11 @@
 
 /* ./p_below.c */
 
+#undef ceiling_panel
+PANEL	*ceiling_panel(
+		SCREEN	*sp)
+		{ return(*(PANEL **)0); }
+
 #undef panel_below
 PANEL	*panel_below(
 		const PANEL *pan)
@@ -157,6 +167,11 @@
 
 /* ./p_update.c */
 
+#undef update_panels_sp
+void	update_panels_sp(
+		SCREEN	*sp)
+		{ /* void */ }
+
 #undef update_panels
 void	update_panels(void)
 		{ /* void */ }
@@ -166,13 +181,13 @@
 #undef set_panel_userptr
 int	set_panel_userptr(
 		PANEL	*pan, 
-		void	*uptr)
+		const void *uptr)
 		{ return(*(int *)0); }
 
 #undef panel_userptr
-void	*panel_userptr(
+const void *panel_userptr(
 		const PANEL *pan)
-		{ return(*(void **)0); }
+		{ return(*(const void **)0); }
 
 /* ./p_win.c */
 
diff --git a/panel/llib-lpanelt b/panel/llib-lpanelt
new file mode 100644
index 0000000..efa4175
--- /dev/null
+++ b/panel/llib-lpanelt
@@ -0,0 +1,197 @@
+/****************************************************************************
+ * Copyright (c) 2010-2010,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"), to deal in the Software without restriction, including      *
+ * without limitation the rights to use, copy, modify, merge, publish,      *
+ * distribute, distribute with modifications, sublicense, and/or sell       *
+ * copies of the Software, and to permit persons to whom the Software is    *
+ * furnished to do so, subject to the following conditions:                 *
+ *                                                                          *
+ * The above copyright notice and this permission notice shall be included  *
+ * in all copies or substantial portions of the Software.                   *
+ *                                                                          *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
+ *                                                                          *
+ * Except as contained in this notice, the name(s) of the above copyright   *
+ * holders shall not be used in advertising or otherwise to promote the     *
+ * sale, use or other dealings in this Software without prior written       *
+ * authorization.                                                           *
+ ****************************************************************************/
+
+/****************************************************************************
+ *  Author: Thomas E. Dickey       2010-on                                  *
+ ****************************************************************************/
+/* LINTLIBRARY */
+
+/* ./panel.c */
+
+#include <panel.priv.h>
+
+#undef _nc_retrace_panel
+PANEL	*_nc_retrace_panel(
+		PANEL	*pan)
+		{ return(*(PANEL **)0); }
+
+#undef _nc_my_visbuf
+const char *_nc_my_visbuf(
+		const void *ptr)
+		{ return(*(const char **)0); }
+
+#undef _nc_dPanel
+void	_nc_dPanel(
+		const char *text, 
+		const PANEL *pan)
+		{ /* void */ }
+
+#undef _nc_dStack
+void	_nc_dStack(
+		const char *fmt, 
+		int	num, 
+		const PANEL *pan)
+		{ /* void */ }
+
+#undef _nc_Wnoutrefresh
+void	_nc_Wnoutrefresh(
+		const PANEL *pan)
+		{ /* void */ }
+
+#undef _nc_Touchpan
+void	_nc_Touchpan(
+		const PANEL *pan)
+		{ /* void */ }
+
+#undef _nc_Touchline
+void	_nc_Touchline(
+		const PANEL *pan, 
+		int	start, 
+		int	count)
+		{ /* void */ }
+
+/* ./p_above.c */
+
+#undef ground_panel
+PANEL	*ground_panel(
+		SCREEN	*sp)
+		{ return(*(PANEL **)0); }
+
+#undef panel_above
+PANEL	*panel_above(
+		const PANEL *pan)
+		{ return(*(PANEL **)0); }
+
+/* ./p_below.c */
+
+#undef ceiling_panel
+PANEL	*ceiling_panel(
+		SCREEN	*sp)
+		{ return(*(PANEL **)0); }
+
+#undef panel_below
+PANEL	*panel_below(
+		const PANEL *pan)
+		{ return(*(PANEL **)0); }
+
+/* ./p_bottom.c */
+
+#undef bottom_panel
+int	bottom_panel(
+		PANEL	*pan)
+		{ return(*(int *)0); }
+
+/* ./p_delete.c */
+
+#undef del_panel
+int	del_panel(
+		PANEL	*pan)
+		{ return(*(int *)0); }
+
+/* ./p_hide.c */
+
+#undef hide_panel
+int	hide_panel(
+		 PANEL	*pan)
+		{ return(*(int *)0); }
+
+/* ./p_hidden.c */
+
+#undef panel_hidden
+int	panel_hidden(
+		const PANEL *pan)
+		{ return(*(int *)0); }
+
+/* ./p_move.c */
+
+#undef move_panel
+int	move_panel(
+		PANEL	*pan, 
+		int	starty, 
+		int	startx)
+		{ return(*(int *)0); }
+
+/* ./p_new.c */
+
+#undef new_panel
+PANEL	*new_panel(
+		WINDOW	*win)
+		{ return(*(PANEL **)0); }
+
+/* ./p_replace.c */
+
+#undef replace_panel
+int	replace_panel(
+		PANEL	*pan, 
+		WINDOW	*win)
+		{ return(*(int *)0); }
+
+/* ./p_show.c */
+
+#undef show_panel
+int	show_panel(
+		PANEL	*pan)
+		{ return(*(int *)0); }
+
+/* ./p_top.c */
+
+#undef top_panel
+int	top_panel(
+		PANEL	*pan)
+		{ return(*(int *)0); }
+
+/* ./p_update.c */
+
+#undef update_panels_sp
+void	update_panels_sp(
+		SCREEN	*sp)
+		{ /* void */ }
+
+#undef update_panels
+void	update_panels(void)
+		{ /* void */ }
+
+/* ./p_user.c */
+
+#undef set_panel_userptr
+int	set_panel_userptr(
+		PANEL	*pan, 
+		const void *uptr)
+		{ return(*(int *)0); }
+
+#undef panel_userptr
+const void *panel_userptr(
+		const PANEL *pan)
+		{ return(*(const void **)0); }
+
+/* ./p_win.c */
+
+#undef panel_window
+WINDOW	*panel_window(
+		const PANEL *pan)
+		{ return(*(WINDOW **)0); }
diff --git a/panel/llib-lpaneltw b/panel/llib-lpaneltw
new file mode 100644
index 0000000..efa4175
--- /dev/null
+++ b/panel/llib-lpaneltw
@@ -0,0 +1,197 @@
+/****************************************************************************
+ * Copyright (c) 2010-2010,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"), to deal in the Software without restriction, including      *
+ * without limitation the rights to use, copy, modify, merge, publish,      *
+ * distribute, distribute with modifications, sublicense, and/or sell       *
+ * copies of the Software, and to permit persons to whom the Software is    *
+ * furnished to do so, subject to the following conditions:                 *
+ *                                                                          *
+ * The above copyright notice and this permission notice shall be included  *
+ * in all copies or substantial portions of the Software.                   *
+ *                                                                          *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
+ *                                                                          *
+ * Except as contained in this notice, the name(s) of the above copyright   *
+ * holders shall not be used in advertising or otherwise to promote the     *
+ * sale, use or other dealings in this Software without prior written       *
+ * authorization.                                                           *
+ ****************************************************************************/
+
+/****************************************************************************
+ *  Author: Thomas E. Dickey       2010-on                                  *
+ ****************************************************************************/
+/* LINTLIBRARY */
+
+/* ./panel.c */
+
+#include <panel.priv.h>
+
+#undef _nc_retrace_panel
+PANEL	*_nc_retrace_panel(
+		PANEL	*pan)
+		{ return(*(PANEL **)0); }
+
+#undef _nc_my_visbuf
+const char *_nc_my_visbuf(
+		const void *ptr)
+		{ return(*(const char **)0); }
+
+#undef _nc_dPanel
+void	_nc_dPanel(
+		const char *text, 
+		const PANEL *pan)
+		{ /* void */ }
+
+#undef _nc_dStack
+void	_nc_dStack(
+		const char *fmt, 
+		int	num, 
+		const PANEL *pan)
+		{ /* void */ }
+
+#undef _nc_Wnoutrefresh
+void	_nc_Wnoutrefresh(
+		const PANEL *pan)
+		{ /* void */ }
+
+#undef _nc_Touchpan
+void	_nc_Touchpan(
+		const PANEL *pan)
+		{ /* void */ }
+
+#undef _nc_Touchline
+void	_nc_Touchline(
+		const PANEL *pan, 
+		int	start, 
+		int	count)
+		{ /* void */ }
+
+/* ./p_above.c */
+
+#undef ground_panel
+PANEL	*ground_panel(
+		SCREEN	*sp)
+		{ return(*(PANEL **)0); }
+
+#undef panel_above
+PANEL	*panel_above(
+		const PANEL *pan)
+		{ return(*(PANEL **)0); }
+
+/* ./p_below.c */
+
+#undef ceiling_panel
+PANEL	*ceiling_panel(
+		SCREEN	*sp)
+		{ return(*(PANEL **)0); }
+
+#undef panel_below
+PANEL	*panel_below(
+		const PANEL *pan)
+		{ return(*(PANEL **)0); }
+
+/* ./p_bottom.c */
+
+#undef bottom_panel
+int	bottom_panel(
+		PANEL	*pan)
+		{ return(*(int *)0); }
+
+/* ./p_delete.c */
+
+#undef del_panel
+int	del_panel(
+		PANEL	*pan)
+		{ return(*(int *)0); }
+
+/* ./p_hide.c */
+
+#undef hide_panel
+int	hide_panel(
+		 PANEL	*pan)
+		{ return(*(int *)0); }
+
+/* ./p_hidden.c */
+
+#undef panel_hidden
+int	panel_hidden(
+		const PANEL *pan)
+		{ return(*(int *)0); }
+
+/* ./p_move.c */
+
+#undef move_panel
+int	move_panel(
+		PANEL	*pan, 
+		int	starty, 
+		int	startx)
+		{ return(*(int *)0); }
+
+/* ./p_new.c */
+
+#undef new_panel
+PANEL	*new_panel(
+		WINDOW	*win)
+		{ return(*(PANEL **)0); }
+
+/* ./p_replace.c */
+
+#undef replace_panel
+int	replace_panel(
+		PANEL	*pan, 
+		WINDOW	*win)
+		{ return(*(int *)0); }
+
+/* ./p_show.c */
+
+#undef show_panel
+int	show_panel(
+		PANEL	*pan)
+		{ return(*(int *)0); }
+
+/* ./p_top.c */
+
+#undef top_panel
+int	top_panel(
+		PANEL	*pan)
+		{ return(*(int *)0); }
+
+/* ./p_update.c */
+
+#undef update_panels_sp
+void	update_panels_sp(
+		SCREEN	*sp)
+		{ /* void */ }
+
+#undef update_panels
+void	update_panels(void)
+		{ /* void */ }
+
+/* ./p_user.c */
+
+#undef set_panel_userptr
+int	set_panel_userptr(
+		PANEL	*pan, 
+		const void *uptr)
+		{ return(*(int *)0); }
+
+#undef panel_userptr
+const void *panel_userptr(
+		const PANEL *pan)
+		{ return(*(const void **)0); }
+
+/* ./p_win.c */
+
+#undef panel_window
+WINDOW	*panel_window(
+		const PANEL *pan)
+		{ return(*(WINDOW **)0); }
diff --git a/panel/llib-lpanelw b/panel/llib-lpanelw
index 48bd1e0..4d6688e 100644
--- a/panel/llib-lpanelw
+++ b/panel/llib-lpanelw
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2002,2005 Free Software Foundation, Inc.                   *
+ * Copyright (c) 2002-2010,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            *
@@ -27,13 +27,13 @@
  ****************************************************************************/
 
 /****************************************************************************
- *  Author: Thomas E. Dickey                    2002,2005                   *
+ *  Author: Thomas E. Dickey       2002-on                                  *
  ****************************************************************************/
 /* LINTLIBRARY */
 
 /* ./panel.c */
 
-#include "panel.priv.h"
+#include <panel.priv.h>
 
 #undef _nc_retrace_panel
 PANEL	*_nc_retrace_panel(
@@ -77,6 +77,11 @@
 
 /* ./p_above.c */
 
+#undef ground_panel
+PANEL	*ground_panel(
+		SCREEN	*sp)
+		{ return(*(PANEL **)0); }
+
 #undef panel_above
 PANEL	*panel_above(
 		const PANEL *pan)
@@ -84,6 +89,11 @@
 
 /* ./p_below.c */
 
+#undef ceiling_panel
+PANEL	*ceiling_panel(
+		SCREEN	*sp)
+		{ return(*(PANEL **)0); }
+
 #undef panel_below
 PANEL	*panel_below(
 		const PANEL *pan)
@@ -157,6 +167,11 @@
 
 /* ./p_update.c */
 
+#undef update_panels_sp
+void	update_panels_sp(
+		SCREEN	*sp)
+		{ /* void */ }
+
 #undef update_panels
 void	update_panels(void)
 		{ /* void */ }
@@ -166,13 +181,13 @@
 #undef set_panel_userptr
 int	set_panel_userptr(
 		PANEL	*pan, 
-		void	*uptr)
+		const void *uptr)
 		{ return(*(int *)0); }
 
 #undef panel_userptr
-void	*panel_userptr(
+const void *panel_userptr(
 		const PANEL *pan)
-		{ return(*(void **)0); }
+		{ return(*(const void **)0); }
 
 /* ./p_win.c */
 
diff --git a/panel/modules b/panel/modules
index d0f7a79..cd3f545 100644
--- a/panel/modules
+++ b/panel/modules
@@ -1,6 +1,6 @@
-# $Id: modules,v 1.9 2006/12/24 00:53:17 tom Exp $
+# $Id: modules,v 1.10 2010/01/23 16:31:16 tom Exp $
 ##############################################################################
-# Copyright (c) 1998,2006 Free Software Foundation, Inc.                     #
+# Copyright (c) 1998-2006,2010 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,20 +32,20 @@
 
 @ base
 # Library objects
-panel		lib		$(srcdir)	$(PANEL_PRIV_H)
-p_above		lib		$(srcdir)	$(PANEL_PRIV_H)
-p_below		lib		$(srcdir)	$(PANEL_PRIV_H)
-p_bottom	lib		$(srcdir)	$(PANEL_PRIV_H)
-p_delete	lib		$(srcdir)	$(PANEL_PRIV_H)
-p_hide		lib		$(srcdir)	$(PANEL_PRIV_H)
-p_hidden	lib		$(srcdir)	$(PANEL_PRIV_H)
-p_move		lib		$(srcdir)	$(PANEL_PRIV_H)
-p_new		lib		$(srcdir)	$(PANEL_PRIV_H)
-p_replace	lib		$(srcdir)	$(PANEL_PRIV_H)
-p_show		lib		$(srcdir)	$(PANEL_PRIV_H)
-p_top		lib		$(srcdir)	$(PANEL_PRIV_H)
-p_update	lib		$(srcdir)	$(PANEL_PRIV_H)
-p_user		lib		$(srcdir)	$(PANEL_PRIV_H)
-p_win		lib		$(srcdir)	$(PANEL_PRIV_H)
+panel		lib		$(srcdir)	$(HEADER_DEPS)
+p_above		lib		$(srcdir)	$(HEADER_DEPS)
+p_below		lib		$(srcdir)	$(HEADER_DEPS)
+p_bottom	lib		$(srcdir)	$(HEADER_DEPS)
+p_delete	lib		$(srcdir)	$(HEADER_DEPS)
+p_hide		lib		$(srcdir)	$(HEADER_DEPS)
+p_hidden	lib		$(srcdir)	$(HEADER_DEPS)
+p_move		lib		$(srcdir)	$(HEADER_DEPS)
+p_new		lib		$(srcdir)	$(HEADER_DEPS)
+p_replace	lib		$(srcdir)	$(HEADER_DEPS)
+p_show		lib		$(srcdir)	$(HEADER_DEPS)
+p_top		lib		$(srcdir)	$(HEADER_DEPS)
+p_update	lib		$(srcdir)	$(HEADER_DEPS)
+p_user		lib		$(srcdir)	$(HEADER_DEPS)
+p_win		lib		$(srcdir)	$(HEADER_DEPS)
 
 # vile:makemode
diff --git a/panel/p_above.c b/panel/p_above.c
index 32495f6..76209fe 100644
--- a/panel/p_above.c
+++ b/panel/p_above.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,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            *
@@ -29,24 +29,56 @@
 /****************************************************************************
  *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995                    *
  *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Juergen Pfeifer                         1997-1999,2008          *
  ****************************************************************************/
 
 /* p_above.c
  */
 #include "panel.priv.h"
 
-MODULE_ID("$Id: p_above.c,v 1.6 2005/02/19 16:44:57 tom Exp $")
+MODULE_ID("$Id: p_above.c,v 1.9 2012/03/10 23:43:41 tom Exp $")
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(PANEL *)
+ground_panel(SCREEN * sp)
+{
+  T((T_CALLED("ground_panel(%p)"), (void *)sp));
+  if (sp)
+    {
+      struct panelhook *ph = NCURSES_SP_NAME(_nc_panelhook) (sp);
+
+      if (_nc_bottom_panel)	/* this is the pseudo panel */
+	returnPanel(_nc_bottom_panel->above);
+      else
+	returnPanel(0);
+    }
+  else
+    {
+      if (0 == CURRENT_SCREEN)
+	returnPanel(0);
+      else
+	returnPanel(ground_panel(CURRENT_SCREEN));
+    }
+}
+#endif
 
 NCURSES_EXPORT(PANEL *)
 panel_above(const PANEL * pan)
 {
-  T((T_CALLED("panel_above(%p)"), pan));
-  if (!pan)
+  PANEL *result;
+
+  T((T_CALLED("panel_above(%p)"), (const void *)pan));
+  if (pan)
+    result = pan->above;
+  else
     {
+#if NCURSES_SP_FUNCS
+      result = ground_panel(CURRENT_SCREEN);
+#else
       /* if top and bottom are equal, we have no or only the pseudo panel;
          if not, we return the panel above the pseudo panel */
-      returnPanel(EMPTY_STACK()? (PANEL *) 0 : _nc_bottom_panel->above);
+      result = EMPTY_STACK()? (PANEL *) 0 : _nc_bottom_panel->above;
+#endif
     }
-  else
-    returnPanel(pan->above);
+  returnPanel(result);
 }
diff --git a/panel/p_below.c b/panel/p_below.c
index c4b2410..913efa9 100644
--- a/panel/p_below.c
+++ b/panel/p_below.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,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            *
@@ -29,26 +29,57 @@
 /****************************************************************************
  *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995                    *
  *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Juergen Pfeifer                         1997-1999,2008          *
  ****************************************************************************/
 
 /* p_below.c
  */
 #include "panel.priv.h"
 
-MODULE_ID("$Id: p_below.c,v 1.6 2005/02/19 16:45:10 tom Exp $")
+MODULE_ID("$Id: p_below.c,v 1.9 2012/03/10 23:43:41 tom Exp $")
 
+#if NCURSES_SP_FUNCS
 NCURSES_EXPORT(PANEL *)
-panel_below(const PANEL * pan)
+ceiling_panel(SCREEN * sp)
 {
-  T((T_CALLED("panel_below(%p)"), pan));
-  if (!pan)
+  T((T_CALLED("ceiling_panel(%p)"), (void *)sp));
+  if (sp)
     {
+      struct panelhook *ph = NCURSES_SP_NAME(_nc_panelhook) (sp);
+
       /* if top and bottom are equal, we have no or only the pseudo panel */
       returnPanel(EMPTY_STACK()? (PANEL *) 0 : _nc_top_panel);
     }
   else
     {
-      /* we must not return the pseudo panel */
-      returnPanel(Is_Pseudo(pan->below) ? (PANEL *) 0 : pan->below);
+      if (0 == CURRENT_SCREEN)
+	returnPanel(0);
+      else
+	returnPanel(ceiling_panel(CURRENT_SCREEN));
     }
 }
+#endif
+
+NCURSES_EXPORT(PANEL *)
+panel_below(const PANEL * pan)
+{
+  PANEL *result;
+
+  T((T_CALLED("panel_below(%p)"), (const void *)pan));
+  if (pan)
+    {
+      GetHook(pan);
+      /* we must not return the pseudo panel */
+      result = Is_Pseudo(pan->below) ? (PANEL *) 0 : pan->below;
+    }
+  else
+    {
+#if NCURSES_SP_FUNCS
+      result = ceiling_panel(CURRENT_SCREEN);
+#else
+      /* if top and bottom are equal, we have no or only the pseudo panel */
+      result = EMPTY_STACK()? (PANEL *) 0 : _nc_top_panel;
+#endif
+    }
+  returnPanel(result);
+}
diff --git a/panel/p_bottom.c b/panel/p_bottom.c
index b861fd9..db81441 100644
--- a/panel/p_bottom.c
+++ b/panel/p_bottom.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2009,2010 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,6 +29,7 @@
 /****************************************************************************
  *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995                    *
  *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Juergen Pfeifer                         1997-1999,2008          *
  ****************************************************************************/
 
 /* p_bottom.c
@@ -36,16 +37,17 @@
  */
 #include "panel.priv.h"
 
-MODULE_ID("$Id: p_bottom.c,v 1.11 2005/02/19 16:38:16 tom Exp $")
+MODULE_ID("$Id: p_bottom.c,v 1.13 2010/01/23 21:22:16 tom Exp $")
 
 NCURSES_EXPORT(int)
 bottom_panel(PANEL * pan)
 {
   int err = OK;
 
-  T((T_CALLED("bottom_panel(%p)"), pan));
+  T((T_CALLED("bottom_panel(%p)"), (void *)pan));
   if (pan)
     {
+      GetHook(pan);
       if (!Is_Bottom(pan))
 	{
 
diff --git a/panel/p_delete.c b/panel/p_delete.c
index 24ee26b..39b0553 100644
--- a/panel/p_delete.c
+++ b/panel/p_delete.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2009,2010 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,6 +29,7 @@
 /****************************************************************************
  *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995                    *
  *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Juergen Pfeifer                         1999,2008               *
  ****************************************************************************/
 
 /* p_delete.c
@@ -36,19 +37,22 @@
  */
 #include "panel.priv.h"
 
-MODULE_ID("$Id: p_delete.c,v 1.8 2005/02/19 16:38:45 tom Exp $")
+MODULE_ID("$Id: p_delete.c,v 1.10 2010/01/23 21:22:16 tom Exp $")
 
 NCURSES_EXPORT(int)
 del_panel(PANEL * pan)
 {
   int err = OK;
 
-  T((T_CALLED("del_panel(%p)"), pan));
+  T((T_CALLED("del_panel(%p)"), (void *)pan));
   if (pan)
     {
       dBug(("--> del_panel %s", USER_PTR(pan->user)));
-      HIDE_PANEL(pan, err, OK);
-      free((void *)pan);
+      {
+	GetHook(pan);
+	HIDE_PANEL(pan, err, OK);
+	free((void *)pan);
+      }
     }
   else
     err = ERR;
diff --git a/panel/p_hidden.c b/panel/p_hidden.c
index 624c07d..01b69b9 100644
--- a/panel/p_hidden.c
+++ b/panel/p_hidden.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2009,2010 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,6 +29,7 @@
 /****************************************************************************
  *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995                    *
  *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Juergen Pfeifer                         1997-1999,2008          *
  ****************************************************************************/
 
 /* p_hidden.c
@@ -36,13 +37,18 @@
  */
 #include "panel.priv.h"
 
-MODULE_ID("$Id: p_hidden.c,v 1.7 2005/02/19 16:39:17 tom Exp $")
+MODULE_ID("$Id: p_hidden.c,v 1.9 2010/01/23 21:22:15 tom Exp $")
 
 NCURSES_EXPORT(int)
 panel_hidden(const PANEL * pan)
 {
-  T((T_CALLED("panel_hidden(%p)"), pan));
-  if (!pan)
-    returnCode(ERR);
-  returnCode(IS_LINKED(pan) ? FALSE : TRUE);
+  int rc = ERR;
+
+  T((T_CALLED("panel_hidden(%p)"), (const void *)pan));
+  if (pan)
+    {
+      GetHook(pan);
+      rc = (IS_LINKED(pan) ? FALSE : TRUE);
+    }
+  returnCode(rc);
 }
diff --git a/panel/p_hide.c b/panel/p_hide.c
index 08d8853..7b780d4 100644
--- a/panel/p_hide.c
+++ b/panel/p_hide.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2005,2010 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            *
@@ -36,23 +36,27 @@
  */
 #include "panel.priv.h"
 
-MODULE_ID("$Id: p_hide.c,v 1.9 2005/02/19 16:39:41 tom Exp $")
+MODULE_ID("$Id: p_hide.c,v 1.11 2010/01/23 21:22:16 tom Exp $")
 
 NCURSES_EXPORT(int)
 hide_panel(register PANEL * pan)
 {
-  int err = OK;
+  int err = ERR;
 
-  T((T_CALLED("hide_panel(%p)"), pan));
-  if (!pan)
-    returnCode(ERR);
+  T((T_CALLED("hide_panel(%p)"), (void *)pan));
 
-  dBug(("--> hide_panel %s", USER_PTR(pan->user)));
-  dStack("<u%d>", 1, pan);
+  if (pan)
+    {
+      GetHook(pan);
 
-  HIDE_PANEL(pan, err, ERR);
+      dBug(("--> hide_panel %s", USER_PTR(pan->user)));
+      dStack("<u%d>", 1, pan);
 
-  dStack("<u%d>", 9, pan);
+      HIDE_PANEL(pan, err, ERR);
 
+      err = OK;
+
+      dStack("<u%d>", 9, pan);
+    }
   returnCode(err);
 }
diff --git a/panel/p_move.c b/panel/p_move.c
index 3818e8c..adae645 100644
--- a/panel/p_move.c
+++ b/panel/p_move.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2008,2010 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,6 +29,7 @@
 /****************************************************************************
  *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995                    *
  *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Juergen Pfeifer                         1997-1999,2009          *
  ****************************************************************************/
 
 /* p_move.c
@@ -36,21 +37,24 @@
  */
 #include "panel.priv.h"
 
-MODULE_ID("$Id: p_move.c,v 1.9 2005/02/19 16:46:49 tom Exp $")
+MODULE_ID("$Id: p_move.c,v 1.11 2010/01/23 21:22:15 tom Exp $")
 
 NCURSES_EXPORT(int)
 move_panel(PANEL * pan, int starty, int startx)
 {
-  T((T_CALLED("move_panel(%p,%d,%d)"), pan, starty, startx));
+  int rc = ERR;
 
-  if (!pan)
-    returnCode(ERR);
+  T((T_CALLED("move_panel(%p,%d,%d)"), (void *)pan, starty, startx));
 
-  if (IS_LINKED(pan))
+  if (pan)
     {
-      Touchpan(pan);
-      PANEL_UPDATE(pan, (PANEL *) 0);
+      GetHook(pan);
+      if (IS_LINKED(pan))
+	{
+	  Touchpan(pan);
+	  PANEL_UPDATE(pan, (PANEL *) 0);
+	}
+      rc = mvwin(pan->win, starty, startx);
     }
-
-  returnCode(mvwin(pan->win, starty, startx));
+  returnCode(rc);
 }
diff --git a/panel/p_new.c b/panel/p_new.c
index 2719316..235336c 100644
--- a/panel/p_new.c
+++ b/panel/p_new.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2005,2008 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2009,2010 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            *
@@ -38,7 +38,7 @@
  */
 #include "panel.priv.h"
 
-MODULE_ID("$Id: p_new.c,v 1.10 2008/08/04 18:25:48 tom Exp $")
+MODULE_ID("$Id: p_new.c,v 1.16 2010/01/23 21:22:16 tom Exp $")
 
 #ifdef TRACE
 static char *stdscr_id;
@@ -50,20 +50,27 @@
   Establish the pseudo panel for stdscr if necessary.
 --------------------------------------------------------------------------*/
 static PANEL *
-root_panel(void)
+root_panel(NCURSES_SP_DCL0)
 {
+#if NCURSES_SP_FUNCS
+  struct panelhook *ph = NCURSES_SP_NAME(_nc_panelhook) (sp);
+
+#elif NO_LEAKS
+  struct panelhook *ph = _nc_panelhook();
+#endif
+
   if (_nc_stdscr_pseudo_panel == (PANEL *) 0)
     {
 
-      assert(stdscr && !_nc_bottom_panel && !_nc_top_panel);
+      assert(SP_PARM && SP_PARM->_stdscr && !_nc_bottom_panel && !_nc_top_panel);
 #if NO_LEAKS
-      _nc_panelhook()->destroy = del_panel;
+      ph->destroy = del_panel;
 #endif
-      _nc_stdscr_pseudo_panel = (PANEL *) malloc(sizeof(PANEL));
+      _nc_stdscr_pseudo_panel = typeMalloc(PANEL, 1);
       if (_nc_stdscr_pseudo_panel != 0)
 	{
 	  PANEL *pan = _nc_stdscr_pseudo_panel;
-	  WINDOW *win = stdscr;
+	  WINDOW *win = SP_PARM->_stdscr;
 
 	  pan->win = win;
 	  pan->below = (PANEL *) 0;
@@ -86,16 +93,18 @@
 {
   PANEL *pan = (PANEL *) 0;
 
-  T((T_CALLED("new_panel(%p)"), win));
+  GetWindowHook(win);
+
+  T((T_CALLED("new_panel(%p)"), (void *)win));
 
   if (!win)
     returnPanel(pan);
 
   if (!_nc_stdscr_pseudo_panel)
-    (void)root_panel();
+    (void)root_panel(NCURSES_SP_ARG);
   assert(_nc_stdscr_pseudo_panel);
 
-  if (!(win->_flags & _ISPAD) && (pan = (PANEL *) malloc(sizeof(PANEL))))
+  if (!(win->_flags & _ISPAD) && (pan = typeMalloc(PANEL, 1)))
     {
       pan->win = win;
       pan->above = (PANEL *) 0;
diff --git a/panel/p_replace.c b/panel/p_replace.c
index 5d0d295..d3733ed 100644
--- a/panel/p_replace.c
+++ b/panel/p_replace.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2005,2010 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            *
@@ -36,23 +36,25 @@
  */
 #include "panel.priv.h"
 
-MODULE_ID("$Id: p_replace.c,v 1.9 2005/02/19 16:41:31 tom Exp $")
+MODULE_ID("$Id: p_replace.c,v 1.11 2010/01/23 21:22:16 tom Exp $")
 
 NCURSES_EXPORT(int)
 replace_panel(PANEL * pan, WINDOW *win)
 {
-  T((T_CALLED("replace_panel(%p,%p)"), pan, win));
+  int rc = ERR;
 
-  if (!pan)
-    returnCode(ERR);
+  T((T_CALLED("replace_panel(%p,%p)"), (void *)pan, (void *)win));
 
-  if (IS_LINKED(pan))
+  if (pan)
     {
-      Touchpan(pan);
-      PANEL_UPDATE(pan, (PANEL *) 0);
+      GetHook(pan);
+      if (IS_LINKED(pan))
+	{
+	  Touchpan(pan);
+	  PANEL_UPDATE(pan, (PANEL *) 0);
+	}
+      pan->win = win;
+      rc = OK;
     }
-
-  pan->win = win;
-
-  returnCode(OK);
+  returnCode(rc);
 }
diff --git a/panel/p_show.c b/panel/p_show.c
index 35eee23..d5b09bd 100644
--- a/panel/p_show.c
+++ b/panel/p_show.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2005,2010 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            *
@@ -36,34 +36,37 @@
  */
 #include "panel.priv.h"
 
-MODULE_ID("$Id: p_show.c,v 1.11 2005/02/19 16:42:02 tom Exp $")
+MODULE_ID("$Id: p_show.c,v 1.13 2010/01/23 21:22:16 tom Exp $")
 
 NCURSES_EXPORT(int)
 show_panel(PANEL * pan)
 {
-  int err = OK;
+  int err = ERR;
 
-  T((T_CALLED("show_panel(%p)"), pan));
+  T((T_CALLED("show_panel(%p)"), (void *)pan));
 
-  if (!pan)
-    returnCode(ERR);
+  if (pan)
+    {
+      GetHook(pan);
 
-  if (Is_Top(pan))
-    returnCode(OK);
+      if (Is_Top(pan))
+	returnCode(OK);
 
-  dBug(("--> show_panel %s", USER_PTR(pan->user)));
+      dBug(("--> show_panel %s", USER_PTR(pan->user)));
 
-  HIDE_PANEL(pan, err, OK);
+      HIDE_PANEL(pan, err, OK);
 
-  dStack("<lt%d>", 1, pan);
-  assert(_nc_bottom_panel == _nc_stdscr_pseudo_panel);
+      dStack("<lt%d>", 1, pan);
+      assert(_nc_bottom_panel == _nc_stdscr_pseudo_panel);
 
-  _nc_top_panel->above = pan;
-  pan->below = _nc_top_panel;
-  pan->above = (PANEL *) 0;
-  _nc_top_panel = pan;
+      _nc_top_panel->above = pan;
+      pan->below = _nc_top_panel;
+      pan->above = (PANEL *) 0;
+      _nc_top_panel = pan;
 
-  dStack("<lt%d>", 9, pan);
+      err = OK;
 
-  returnCode(OK);
+      dStack("<lt%d>", 9, pan);
+    }
+  returnCode(err);
 }
diff --git a/panel/p_top.c b/panel/p_top.c
index 8bd1d9f..fdcdee9 100644
--- a/panel/p_top.c
+++ b/panel/p_top.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2005,2010 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            *
@@ -36,11 +36,11 @@
  */
 #include "panel.priv.h"
 
-MODULE_ID("$Id: p_top.c,v 1.5 2005/02/19 16:42:23 tom Exp $")
+MODULE_ID("$Id: p_top.c,v 1.6 2010/01/23 21:22:16 tom Exp $")
 
 NCURSES_EXPORT(int)
 top_panel(PANEL * pan)
 {
-  T((T_CALLED("top_panel(%p)"), pan));
+  T((T_CALLED("top_panel(%p)"), (void *)pan));
   returnCode(show_panel(pan));
 }
diff --git a/panel/p_update.c b/panel/p_update.c
index 5967718..a2f4506 100644
--- a/panel/p_update.c
+++ b/panel/p_update.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2009,2010 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,6 +29,7 @@
 /****************************************************************************
  *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995                    *
  *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Juergen Pfeifer                         1997-1999,2008          *
  ****************************************************************************/
 
 /* p_update.c
@@ -36,28 +37,42 @@
  */
 #include "panel.priv.h"
 
-MODULE_ID("$Id: p_update.c,v 1.9 2005/02/19 16:49:47 tom Exp $")
+MODULE_ID("$Id: p_update.c,v 1.11 2010/01/23 21:22:16 tom Exp $")
 
 NCURSES_EXPORT(void)
-update_panels(void)
+NCURSES_SP_NAME(update_panels) (NCURSES_SP_DCL0)
 {
   PANEL *pan;
 
-  T((T_CALLED("update_panels()")));
+  T((T_CALLED("update_panels(%p)"), (void *)SP_PARM));
   dBug(("--> update_panels"));
-  pan = _nc_bottom_panel;
-  while (pan && pan->above)
-    {
-      PANEL_UPDATE(pan, pan->above);
-      pan = pan->above;
-    }
 
-  pan = _nc_bottom_panel;
-  while (pan)
+  if (SP_PARM)
     {
-      Wnoutrefresh(pan);
-      pan = pan->above;
+      GetScreenHook(SP_PARM);
+
+      pan = _nc_bottom_panel;
+      while (pan && pan->above)
+	{
+	  PANEL_UPDATE(pan, pan->above);
+	  pan = pan->above;
+	}
+
+      pan = _nc_bottom_panel;
+      while (pan)
+	{
+	  Wnoutrefresh(pan);
+	  pan = pan->above;
+	}
     }
 
   returnVoid;
 }
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(void)
+update_panels(void)
+{
+  NCURSES_SP_NAME(update_panels) (CURRENT_SCREEN);
+}
+#endif
diff --git a/panel/p_user.c b/panel/p_user.c
index ffa25f8..deb5bdf 100644
--- a/panel/p_user.c
+++ b/panel/p_user.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2005,2010 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            *
@@ -36,12 +36,12 @@
  */
 #include "panel.priv.h"
 
-MODULE_ID("$Id: p_user.c,v 1.6 2005/02/19 16:52:44 tom Exp $")
+MODULE_ID("$Id: p_user.c,v 1.8 2010/01/23 23:18:35 tom Exp $")
 
 NCURSES_EXPORT(int)
 set_panel_userptr(PANEL * pan, NCURSES_CONST void *uptr)
 {
-  T((T_CALLED("set_panel_userptr(%p,%p)"), pan, uptr));
+  T((T_CALLED("set_panel_userptr(%p,%p)"), (void *)pan, (NCURSES_CONST void *)uptr));
   if (!pan)
     returnCode(ERR);
   pan->user = uptr;
@@ -51,6 +51,6 @@
 NCURSES_EXPORT(NCURSES_CONST void *)
 panel_userptr(const PANEL * pan)
 {
-  T((T_CALLED("panel_userptr(%p)"), pan));
+  T((T_CALLED("panel_userptr(%p)"), (const void *)pan));
   returnCVoidPtr(pan ? pan->user : (NCURSES_CONST void *)0);
 }
diff --git a/panel/p_win.c b/panel/p_win.c
index e7d2cea..6643d5c 100644
--- a/panel/p_win.c
+++ b/panel/p_win.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2005,2010 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            *
@@ -36,11 +36,11 @@
  */
 #include "panel.priv.h"
 
-MODULE_ID("$Id: p_win.c,v 1.5 2005/02/19 16:44:16 tom Exp $")
+MODULE_ID("$Id: p_win.c,v 1.6 2010/01/23 21:22:15 tom Exp $")
 
 NCURSES_EXPORT(WINDOW *)
 panel_window(const PANEL * pan)
 {
-  T((T_CALLED("panel_window(%p)"), pan));
+  T((T_CALLED("panel_window(%p)"), (const void *)pan));
   returnWin(pan ? pan->win : (WINDOW *)0);
 }
diff --git a/panel/panel.c b/panel/panel.c
index 16a8083..97bebca 100644
--- a/panel/panel.c
+++ b/panel/panel.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2010,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            *
@@ -29,12 +29,14 @@
 /****************************************************************************
  *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995                    *
  *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Juergen Pfeifer                         1996-1999,2008          *
+ *     and: Thomas E. Dickey                                                *
  ****************************************************************************/
 
 /* panel.c -- implementation of panels library, some core routines */
 #include "panel.priv.h"
 
-MODULE_ID("$Id: panel.c,v 1.23 2005/02/19 18:04:31 tom Exp $")
+MODULE_ID("$Id: panel.c,v 1.26 2012/02/23 10:02:15 tom Exp $")
 
 /*+-------------------------------------------------------------------------
 	_nc_retrace_panel (pan)
@@ -43,7 +45,7 @@
 NCURSES_EXPORT(PANEL *)
 _nc_retrace_panel(PANEL * pan)
 {
-  T((T_RETURN("%p"), pan));
+  T((T_RETURN("%p"), (void *)pan));
   return pan;
 }
 #endif
@@ -59,9 +61,9 @@
   char temp[32];
 
   if (ptr != 0)
-    sprintf(temp, "ptr:%p", ptr);
+    _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) "ptr:%p", ptr);
   else
-    strcpy(temp, "<null>");
+    _nc_STRCPY(temp, "<null>", sizeof(temp));
   return _nc_visbuf(temp);
 }
 #endif
@@ -91,7 +93,9 @@
 {
   char s80[80];
 
-  sprintf(s80, fmt, num, pan);
+  GetPanelHook(pan);
+
+  _nc_SPRINTF(s80, _nc_SLIMIT(sizeof(s80)) fmt, num, pan);
   _tracef("%s b=%s t=%s", s80,
 	  (_nc_bottom_panel) ? USER_PTR(_nc_bottom_panel->user) : "--",
 	  (_nc_top_panel) ? USER_PTR(_nc_top_panel->user) : "--");
@@ -139,7 +143,7 @@
 {
   char s80[80];
 
-  sprintf(s80, "Touchline s=%d c=%d", start, count);
+  _nc_SPRINTF(s80, _nc_SLIMIT(sizeof(s80)) "Touchline s=%d c=%d", start, count);
   dPanel(s80, pan);
   touchline(pan->win, start, count);
 }
diff --git a/panel/panel.h b/panel/panel.h
index 1e02091..6ed2061 100644
--- a/panel/panel.h
+++ b/panel/panel.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2001,2006 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2006,2009 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,9 +29,10 @@
 /****************************************************************************
  *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995                    *
  *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Juergen Pfeifer                         1996-1999,2008          *
  ****************************************************************************/
 
-/* $Id: panel.h,v 1.10 2006/05/27 19:49:40 tom Exp $ */
+/* $Id: panel.h,v 1.11 2009/04/11 19:50:40 tom Exp $ */
 
 /* panel.h -- interface file for panels library */
 
@@ -68,6 +69,13 @@
 extern NCURSES_EXPORT(int)     replace_panel (PANEL *,WINDOW *);
 extern NCURSES_EXPORT(int)     panel_hidden (const PANEL *);
 
+#if NCURSES_SP_FUNCS
+extern NCURSES_EXPORT(PANEL *) ground_panel(SCREEN *);
+extern NCURSES_EXPORT(PANEL *) ceiling_panel(SCREEN *);
+
+extern NCURSES_EXPORT(void)    NCURSES_SP_NAME(update_panels) (SCREEN*);
+#endif
+
 #if	defined(__cplusplus)
 }
 #endif
diff --git a/panel/panel.priv.h b/panel/panel.priv.h
index 4fb8144..1156c72 100644
--- a/panel/panel.priv.h
+++ b/panel/panel.priv.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2005,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            *
@@ -26,10 +26,11 @@
  * authorization.                                                           *
  ****************************************************************************/
 
-/* $Id: panel.priv.h,v 1.22 2008/09/27 22:36:11 tom Exp $ */
+/* $Id: panel.priv.h,v 1.26 2014/11/01 14:48:03 tom Exp $ */
 
 #ifndef NCURSES_PANEL_PRIV_H
 #define NCURSES_PANEL_PRIV_H 1
+/* *INDENT-OFF* */
 
 #if HAVE_CONFIG_H
 #  include <ncurses_cfg.h>
@@ -39,9 +40,11 @@
 #include <string.h>
 #include <assert.h>
 
-#include "curses.priv.h"
+struct screen;              /* forward declaration */
+
+#include "curses.priv.h"    /* includes nc_panel.h */
 #include "panel.h"
-#include <nc_panel.h>
+
 
 #if USE_RCS_IDS
 #  define MODULE_ID(id) static const char Ident[] = id;
@@ -58,7 +61,7 @@
 #    define USER_PTR(ptr) _nc_my_visbuf((const char *)ptr)
 #  endif
 
-#  define returnPanel(code)	TRACE_RETURN(code,panel)
+#  define returnPanel(code)	TRACE_RETURN1(code,panel)
 
    extern NCURSES_EXPORT(PANEL *) _nc_retrace_panel (PANEL *);
    extern NCURSES_EXPORT(void) _nc_dPanel (const char*, const PANEL*);
@@ -83,14 +86,38 @@
 #  define Touchline(pan,start,count) touchline((pan)->win,start,count)
 #endif
 
-#define _nc_stdscr_pseudo_panel _nc_panelhook()->stdscr_pseudo_panel
-#define _nc_top_panel _nc_panelhook()->top_panel
-#define _nc_bottom_panel _nc_panelhook()->bottom_panel
+#if NCURSES_SP_FUNCS
+#define GetScreenHook(sp) \
+			struct panelhook* ph = NCURSES_SP_NAME(_nc_panelhook)(sp)
+#define GetPanelHook(pan) \
+			GetScreenHook(pan ? _nc_screen_of((pan)->win) : 0)
+#define GetWindowHook(win) \
+			SCREEN* sp = _nc_screen_of(win); \
+			GetScreenHook(sp)
+#define GetHook(pan)	SCREEN* sp = _nc_screen_of(pan->win); \
+			GetScreenHook(sp)
 
-#define EMPTY_STACK() (_nc_top_panel==_nc_bottom_panel)
-#define Is_Bottom(p)  (((p)!=(PANEL*)0) && !EMPTY_STACK() && (_nc_bottom_panel->above==(p)))
-#define Is_Top(p) (((p)!=(PANEL*)0) && !EMPTY_STACK() && (_nc_top_panel==(p)))
-#define Is_Pseudo(p) ((p) && ((p)==_nc_bottom_panel))
+#define _nc_stdscr_pseudo_panel ((ph)->stdscr_pseudo_panel)
+#define _nc_top_panel           ((ph)->top_panel)
+#define _nc_bottom_panel        ((ph)->bottom_panel)
+
+#else	/* !NCURSES_SP_FUNCS */
+
+#define GetScreenHook(sp) /* nothing */
+#define GetPanelHook(pan) /* nothing */
+#define GetWindowHook(win) /* nothing */
+#define GetHook(pan) /* nothing */
+
+#define _nc_stdscr_pseudo_panel _nc_panelhook()->stdscr_pseudo_panel
+#define _nc_top_panel           _nc_panelhook()->top_panel
+#define _nc_bottom_panel        _nc_panelhook()->bottom_panel
+
+#endif	/* NCURSES_SP_FUNCS */
+
+#define EMPTY_STACK() (_nc_top_panel == _nc_bottom_panel)
+#define Is_Bottom(p)  (((p) != (PANEL*)0) && !EMPTY_STACK() && (_nc_bottom_panel->above == (p)))
+#define Is_Top(p)     (((p) != (PANEL*)0) && !EMPTY_STACK() && (_nc_top_panel == (p)))
+#define Is_Pseudo(p)  (((p) != (PANEL*)0) && ((p) == _nc_bottom_panel))
 
 /*+-------------------------------------------------------------------------
 	IS_LINKED(pan) - check to see if panel is in the stack
@@ -122,7 +149,7 @@
    ix2 = (PENDX(pan1)   < PENDX(pan2))   ? PENDX(pan1)   : PENDX(pan2);\
    iy1 = (PSTARTY(pan1) < PSTARTY(pan2)) ? PSTARTY(pan2) : PSTARTY(pan1);\
    iy2 = (PENDY(pan1)   < PENDY(pan2))   ? PENDY(pan1)   : PENDY(pan2);\
-   assert((ix1<=ix2) && (iy1<=iy2));\
+   assert((ix1<=ix2) && (iy1<=iy2))
 
 
 /*+-------------------------------------------------------------------------
@@ -134,14 +161,14 @@
 ---------------------------------------------------------------------------*/
 #define PANEL_UPDATE(pan,panstart)\
 {  PANEL* pan2 = ((panstart) ? (panstart) : _nc_bottom_panel);\
-   while(pan2) {\
+   while(pan2 && pan2->win) {\
       if ((pan2 != pan) && PANELS_OVERLAPPED(pan,pan2)) {\
-        int y,ix1,ix2,iy1,iy2;\
-        COMPUTE_INTERSECTION(pan,pan2,ix1,ix2,iy1,iy2);\
+        int y, ix1, ix2, iy1, iy2;\
+        COMPUTE_INTERSECTION(pan, pan2, ix1, ix2, iy1, iy2);\
 	for(y = iy1; y <= iy2; y++) {\
 	  if (is_linetouched(pan->win,y - PSTARTY(pan))) {\
             struct ldat* line = &(pan2->win->_line[y - PSTARTY(pan2)]);\
-            CHANGED_RANGE(line,ix1-PSTARTX(pan2),ix2-PSTARTX(pan2));\
+            CHANGED_RANGE(line, ix1 - PSTARTX(pan2), ix2 - PSTARTX(pan2));\
           }\
 	}\
       }\
@@ -180,4 +207,10 @@
       err = err_if_unlinked;\
   }
 
+#if NCURSES_SP_FUNCS
+/* These may become later renamed and part of panel.h and the public API */
+extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_update_panels)(SCREEN*);
+#endif
+/* *INDENT-ON* */
+
 #endif /* NCURSES_PANEL_PRIV_H */