diff --git a/ncurses/base/MKkeyname.awk b/ncurses/base/MKkeyname.awk
new file mode 100644
index 0000000..b35ba2a
--- /dev/null
+++ b/ncurses/base/MKkeyname.awk
@@ -0,0 +1,161 @@
+# $Id: MKkeyname.awk,v 1.40 2008/07/12 18:40:00 tom Exp $
+##############################################################################
+# Copyright (c) 1999-2007,2008 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.                                                             #
+##############################################################################
+BEGIN {
+	print "/* generated by MKkeyname.awk */"
+	print ""
+	print "#include <curses.priv.h>"
+	print "#include <tic.h>"
+	print "#include <term_entry.h>"
+	print ""
+	first = 1;
+}
+
+/^[^#]/ {
+		if (bigstrings) {
+			if (first)  {
+				print "struct kn { short offset; int code; };"
+				print "static const struct kn _nc_key_names[] = {"
+			}
+			printf "\t{ %d, %s },\n", offset, $1
+			offset += length($1) + 1
+			names = names"\n\t\""$1"\\0\""
+		} else {
+			if (first) {
+				print "struct kn { const char *name; int code; };"
+				print "static const struct kn _nc_key_names[] = {"
+			}
+			printf "\t{ \"%s\", %s },\n", $1, $1;
+		}
+		first = 0;
+	}
+
+END {
+	if (bigstrings) {
+		printf "\t{ -1, 0 }};\n"
+		print ""
+		print "static const char key_names[] = "names";"
+	} else {
+		printf "\t{ 0, 0 }};\n"
+	}
+	print ""
+	print "#define SIZEOF_TABLE 256"
+	print "#define MyTable _nc_globals.keyname_table"
+	print ""
+	print "NCURSES_EXPORT(NCURSES_CONST char *) _nc_keyname (SCREEN *sp, int c)"
+	print "{"
+	print "	int i;"
+	print "	char name[20];"
+	print "	char *p;"
+	print "	NCURSES_CONST char *result = 0;"
+	print ""
+	print "	if (c == -1) {"
+	print "		result = \"-1\";"
+	print "	} else {"
+	if (bigstrings) {
+		print "		for (i = 0; _nc_key_names[i].offset != -1; i++) {"
+		print "			if (_nc_key_names[i].code == c) {"
+		print "				result = (NCURSES_CONST char *)key_names + _nc_key_names[i].offset;"
+		print "				break;"
+		print "			}"
+		print "		}"
+	} else {
+		print "		for (i = 0; _nc_key_names[i].name != 0; i++) {"
+		print "			if (_nc_key_names[i].code == c) {"
+		print "				result = (NCURSES_CONST char *)_nc_key_names[i].name;"
+		print "				break;"
+		print "			}"
+		print "		}"
+	}
+	print ""
+	print "		if (result == 0 && (c >= 0 && c < SIZEOF_TABLE)) {"
+	print "			if (MyTable == 0)"
+	print "				MyTable = typeCalloc(char *, SIZEOF_TABLE);"
+	print "			if (MyTable != 0) {"
+	print "				if (MyTable[c] == 0) {"
+	print "					int cc = c;"
+	print "					p = name;"
+	print "					if (cc >= 128 && (sp == 0 || sp->_use_meta)) {"
+	print "						strcpy(p, \"M-\");"
+	print "						p += 2;"
+	print "						cc -= 128;"
+	print "					}"
+	print "					if (cc < 32)"
+	print "						sprintf(p, \"^%c\", cc + '@');"
+	print "					else if (cc == 127)"
+	print "						strcpy(p, \"^?\");"
+	print "					else"
+	print "						sprintf(p, \"%c\", cc);"
+	print "					MyTable[c] = strdup(name);"
+	print "				}"
+	print "				result = MyTable[c];"
+	print "			}"
+	print "#if NCURSES_EXT_FUNCS && NCURSES_XNAMES"
+	print "		} else if (result == 0 && cur_term != 0) {"
+	print "			int j, k;"
+	print "			char * bound;"
+	print "			TERMTYPE *tp = &(cur_term->type);"
+	print "			int save_trace = _nc_tracing;"
+	print ""
+	print "			_nc_tracing = 0;	/* prevent recursion via keybound() */"
+	print "			for (j = 0; (bound = keybound(c, j)) != 0; ++j) {"
+	print "				for(k = STRCOUNT; k < (int) NUM_STRINGS(tp);  k++) {"
+	print "					if (tp->Strings[k] != 0 && !strcmp(bound, tp->Strings[k])) {"
+	print "						result = ExtStrname(tp, k, strnames);"
+	print "						break;"
+	print "					}"
+	print "				}"
+	print "				free(bound);"
+	print "				if (result != 0)"
+	print "					break;"
+	print "			}"
+	print "			_nc_tracing = save_trace;"
+	print "#endif"
+	print "		}"
+	print "	}"
+	print "	return result;"
+	print "}"
+	print ""
+	print "NCURSES_EXPORT(NCURSES_CONST char *) keyname (int c)"
+	print "{"
+	print "\treturn _nc_keyname(SP, c);"
+	print "}"
+	print ""
+	print "#if NO_LEAKS"
+	print "void _nc_keyname_leaks(void)"
+	print "{"
+	print "	int j;"
+	print "	if (MyTable != 0) {"
+	print "		for (j = 0; j < SIZEOF_TABLE; ++j) {"
+	print "			FreeIfNeeded(MyTable[j]);"
+	print "		}"
+	print "		FreeAndNull(MyTable);"
+	print "	}"
+	print "}"
+	print "#endif /* NO_LEAKS */"
+}
diff --git a/ncurses/base/MKlib_gen.sh b/ncurses/base/MKlib_gen.sh
new file mode 100755
index 0000000..a984e85
--- /dev/null
+++ b/ncurses/base/MKlib_gen.sh
@@ -0,0 +1,429 @@
+#!/bin/sh
+#
+# MKlib_gen.sh -- generate sources from curses.h macro definitions
+#
+# ($Id: MKlib_gen.sh,v 1.34 2008/08/30 19:20:50 tom Exp $)
+#
+##############################################################################
+# Copyright (c) 1998-2007,2008 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.                                                             #
+##############################################################################
+#
+# The XSI Curses standard requires all curses entry points to exist as
+# functions, even though many definitions would normally be shadowed
+# by macros.  Rather than hand-hack all that code, we actually
+# generate functions from the macros.
+#
+# This script accepts a file of prototypes on standard input.  It discards
+# any that don't have a `generated' comment attached. It then parses each
+# prototype (relying on the fact that none of the macros take function
+# pointer or array arguments) and generates C source from it.
+#
+# Here is what the pipeline stages are doing:
+#
+# 1. sed: extract prototypes of generated functions
+# 2. sed: decorate prototypes with generated arguments a1. a2,...z
+# 3. awk: generate the calls with args matching the formals
+# 4. sed: prefix function names in prototypes so the preprocessor won't expand
+#         them.
+# 5. cpp: macro-expand the file so the macro calls turn into C calls
+# 6. awk: strip the expansion junk off the front and add the new header
+# 7. sed: squeeze spaces, strip off gen_ prefix, create needed #undef
+#
+
+# keep the editing independent of locale:
+if test "${LANGUAGE+set}"    = set; then LANGUAGE=C;    export LANGUAGE;    fi
+if test "${LANG+set}"        = set; then LANG=C;        export LANG;        fi
+if test "${LC_ALL+set}"      = set; then LC_ALL=C;      export LC_ALL;      fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
+if test "${LC_COLLATE+set}"  = set; then LC_COLLATE=C;  export LC_COLLATE;  fi
+
+preprocessor="$1 -DNCURSES_INTERNALS -I../include"
+AWK="$2"
+USE="$3"
+
+PID=$$
+ED1=sed1_${PID}.sed
+ED2=sed2_${PID}.sed
+ED3=sed3_${PID}.sed
+ED4=sed4_${PID}.sed
+AW1=awk1_${PID}.awk
+AW2=awk2_${PID}.awk
+TMP=gen__${PID}.c
+trap "rm -f $ED1 $ED2 $ED3 $ED4 $AW1 $AW2 $TMP" 0 1 2 5 15
+
+ALL=$USE
+if test "$USE" = implemented ; then
+	CALL="call_"
+	cat >$ED1 <<EOF1
+/^extern.*implemented/{
+	h
+	s/^.*implemented:\([^ 	*]*\).*/P_POUNDCif_USE_\1_SUPPORT/p
+	g
+	s/^extern \([^;]*\);.*/\1/p
+	g
+	s/^.*implemented:\([^ 	*]*\).*/P_POUNDCendif/p
+}
+/^extern.*generated/{
+	h
+	s/^.*generated:\([^ 	*]*\).*/P_POUNDCif_USE_\1_SUPPORT/p
+	g
+	s/^extern \([^;]*\);.*/\1/p
+	g
+	s/^.*generated:\([^ 	*]*\).*/P_POUNDCendif/p
+}
+EOF1
+else
+	CALL=""
+	cat >$ED1 <<EOF1
+/^extern.*${ALL}/{
+	h
+	s/^.*${ALL}:\([^ 	*]*\).*/P_POUNDCif_USE_\1_SUPPORT/p
+	g
+	s/^extern \([^;]*\);.*/\1/p
+	g
+	s/^.*${ALL}:\([^ 	*]*\).*/P_POUNDCendif/p
+}
+EOF1
+fi
+
+cat >$ED2 <<EOF2
+/^P_/b nc
+/(void)/b nc
+	s/,/ a1% /
+	s/,/ a2% /
+	s/,/ a3% /
+	s/,/ a4% /
+	s/,/ a5% /
+	s/,/ a6% /
+	s/,/ a7% /
+	s/,/ a8% /
+	s/,/ a9% /
+	s/,/ a10% /
+	s/,/ a11% /
+	s/,/ a12% /
+	s/,/ a13% /
+	s/,/ a14% /
+	s/,/ a15% /
+	s/*/ * /g
+	s/%/ , /g
+	s/)/ z)/
+	s/\.\.\. z)/...)/
+:nc
+	s/(/ ( /
+	s/)/ )/
+EOF2
+
+cat >$ED3 <<EOF3
+/^P_/{
+	s/^P_POUNDCif_/#if /
+	s/^P_POUNDCendif/#endif/
+	s/^P_//
+	b done
+}
+	s/		*/ /g
+	s/  */ /g
+	s/ ,/,/g
+	s/( /(/g
+	s/ )/)/g
+	s/ gen_/ /
+	s/^M_/#undef /
+	s/^[ 	]*@[ 	]*@[ 	]*/	/
+:done
+EOF3
+
+if test "$USE" = generated ; then
+cat >$ED4 <<EOF
+	s/^\(.*\) \(.*\) (\(.*\))\$/NCURSES_EXPORT(\1) \2 (\3)/
+EOF
+else
+cat >$ED4 <<EOF
+/^\(.*\) \(.*\) (\(.*\))\$/ {
+	h
+	s/^\(.*\) \(.*\) (\(.*\))\$/extern \1 call_\2 (\3);/
+	p
+	g
+	s/^\(.*\) \(.*\) (\(.*\))\$/\1 call_\2 (\3)/
+	}
+EOF
+fi
+
+cat >$AW1 <<\EOF1
+BEGIN	{
+		skip=0;
+	}
+/^P_POUNDCif/ {
+		print "\n"
+		print $0
+		skip=0;
+}
+/^P_POUNDCendif/ {
+		print $0
+		skip=1;
+}
+$0 !~ /^P_/ {
+	if (skip)
+		print "\n"
+	skip=1;
+
+	first=$1
+	for (i = 1; i <= NF; i++) {
+		if ( $i != "NCURSES_CONST" ) {
+			first = i;
+			break;
+		}
+	}
+	second = first + 1;
+	if ( $first == "chtype" ) {
+		returnType = "Char";
+	} else if ( $first == "SCREEN" ) {
+		returnType = "SP";
+	} else if ( $first == "WINDOW" ) {
+		returnType = "Win";
+	} else if ( $first == "attr_t" || $second == "attrset" || $second == "standout" || $second == "standend" || $second == "wattrset" || $second == "wstandout" || $second == "wstandend" ) {
+		returnType = "Attr";
+	} else if ( $first == "bool" || $first == "NCURSES_BOOL" ) {
+		returnType = "Bool";
+	} else if ( $second == "*" ) {
+		returnType = "Ptr";
+	} else {
+		returnType = "Code";
+	}
+	myfunc = second;
+	for (i = second; i <= NF; i++) {
+		if ($i != "*") {
+			myfunc = i;
+			break;
+		}
+	}
+	if (using == "generated") {
+		print "M_" $myfunc
+	}
+	print $0;
+	print "{";
+	argcount = 1;
+	check = NF - 1;
+	if ($check == "void")
+		argcount = 0;
+	if (argcount != 0) {
+		for (i = 1; i <= NF; i++)
+			if ($i == ",")
+				argcount++;
+	}
+
+	# suppress trace-code for functions that we cannot do properly here,
+	# since they return data.
+	dotrace = 1;
+	if ($myfunc ~ /innstr/)
+		dotrace = 0;
+	if ($myfunc ~ /innwstr/)
+		dotrace = 0;
+
+	# workaround functions that we do not parse properly
+	if ($myfunc ~ /ripoffline/) {
+		dotrace = 0;
+		argcount = 2;
+	}
+	if ($myfunc ~ /wunctrl/) {
+		dotrace = 0;
+	}
+
+	call = "@@T((T_CALLED(\""
+	args = ""
+	comma = ""
+	num = 0;
+	pointer = 0;
+	va_list = 0;
+	varargs = 0;
+	argtype = ""
+	for (i = myfunc; i <= NF; i++) {
+		ch = $i;
+		if ( ch == "*" )
+			pointer = 1;
+		else if ( ch == "va_list" )
+			va_list = 1;
+		else if ( ch == "..." )
+			varargs = 1;
+		else if ( ch == "char" )
+			argtype = "char";
+		else if ( ch == "int" )
+			argtype = "int";
+		else if ( ch == "short" )
+			argtype = "short";
+		else if ( ch == "chtype" )
+			argtype = "chtype";
+		else if ( ch == "attr_t" || ch == "NCURSES_ATTR_T" )
+			argtype = "attr";
+
+		if ( ch == "," || ch == ")" ) {
+			if (va_list) {
+				call = call "%s"
+			} else if (varargs) {
+				call = call "%s"
+			} else if (pointer) {
+				if ( argtype == "char" ) {
+					call = call "%s"
+					comma = comma "_nc_visbuf2(" num ","
+					pointer = 0;
+				} else
+					call = call "%p"
+			} else if (argcount != 0) {
+				if ( argtype == "int" || argtype == "short" ) {
+					call = call "%d"
+					argtype = ""
+				} else if ( argtype != "" ) {
+					call = call "%s"
+					comma = comma "_trace" argtype "2(" num ","
+				} else {
+					call = call "%#lx"
+					comma = comma "(long)"
+				}
+			}
+			if (ch == ",") {
+				args = args comma "a" ++num;
+			} else if ( argcount != 0 ) {
+				if ( va_list ) {
+					args = args comma "\"va_list\""
+				} else if ( varargs ) {
+					args = args comma "\"...\""
+				} else {
+					args = args comma "z"
+				}
+			}
+			call = call ch
+			if (pointer == 0 && argcount != 0 && argtype != "" )
+				args = args ")"
+			if (args != "")
+				comma = ", "
+			pointer = 0;
+			argtype = ""
+		}
+		if ( i == 2 || ch == "(" )
+			call = call ch
+	}
+	call = call "\")"
+	if (args != "")
+		call = call ", " args
+	call = call ")); "
+
+	if (dotrace)
+		printf "%s", call
+
+	if (match($0, "^void"))
+		call = ""
+	else if (dotrace)
+		call = sprintf("return%s( ", returnType);
+	else
+		call = "@@return ";
+
+	call = call $myfunc "(";
+	for (i = 1; i < argcount; i++) {
+		if (i != 1)
+			call = call ", ";
+		call = call "a" i;
+	}
+	if ( argcount != 0 && $check != "..." ) {
+		if (argcount != 1)
+			call = call ", ";
+		call = call "z";
+	}
+	if (!match($0, "^void"))
+		call = call ") ";
+	if (dotrace)
+		call = call ")";
+	print call ";"
+
+	if (match($0, "^void"))
+		print "@@returnVoid;"
+	print "}";
+}
+EOF1
+
+cat >$AW2 <<EOF1
+BEGIN		{
+		print "/*"
+		print " * DO NOT EDIT THIS FILE BY HAND!"
+		printf " * It is generated by $0 %s.\n", "$USE"
+		if ( "$USE" == "generated" ) {
+			print " *"
+			print " * This is a file of trivial functions generated from macro"
+			print " * definitions in curses.h to satisfy the XSI Curses requirement"
+			print " * that every macro also exist as a callable function."
+			print " *"
+			print " * It will never be linked unless you call one of the entry"
+			print " * points with its normal macro definition disabled.  In that"
+			print " * case, if you have no shared libraries, it will indirectly"
+			print " * pull most of the rest of the library into your link image."
+		}
+		print " */"
+		print "#define NCURSES_ATTR_T int"
+		print "#include <curses.priv.h>"
+		print ""
+		}
+/^DECLARATIONS/	{start = 1; next;}
+		{if (start) print \$0;}
+END		{
+		if ( "$USE" != "generated" ) {
+			print "int main(void) { return 0; }"
+		}
+		}
+EOF1
+
+cat >$TMP <<EOF
+#include <ncurses_cfg.h>
+#undef NCURSES_NOMACROS
+#include <curses.h>
+
+DECLARATIONS
+
+EOF
+
+sed -n -f $ED1 \
+| sed -e 's/NCURSES_EXPORT(\(.*\)) \(.*\) (\(.*\))/\1 \2(\3)/' \
+| sed -f $ED2 \
+| $AWK -f $AW1 using=$USE \
+| sed \
+	-e 's/ [ ]*$//g' \
+	-e 's/^\([a-zA-Z_][a-zA-Z_]*[ *]*\)/\1 gen_/' \
+	-e 's/gen_$//' \
+	-e 's/  / /g' >>$TMP
+
+$preprocessor $TMP 2>/dev/null \
+| sed \
+	-e 's/  / /g' \
+	-e 's/^ //' \
+	-e 's/_Bool/NCURSES_BOOL/g' \
+| $AWK -f $AW2 \
+| sed -f $ED3 \
+| sed \
+	-e 's/^.*T_CALLED.*returnCode( \([a-z].*) \));/	return \1;/' \
+	-e 's/^.*T_CALLED.*returnCode( \((wmove.*) \));/	return \1;/' \
+	-e 's/gen_//' \
+	-e 's/^[ 	]*#/#/' \
+	-e '/#ident/d' \
+	-e '/#line/d' \
+| sed -f $ED4
diff --git a/ncurses/base/MKunctrl.awk b/ncurses/base/MKunctrl.awk
new file mode 100644
index 0000000..36fbeec
--- /dev/null
+++ b/ncurses/base/MKunctrl.awk
@@ -0,0 +1,192 @@
+# $Id: MKunctrl.awk,v 1.23 2008/10/04 21:40:24 tom Exp $
+##############################################################################
+# Copyright (c) 1998-2007,2008 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 (1997-on)
+#
+
+BEGIN	{
+		print "/* generated by MKunctrl.awk */"
+		print ""
+		print "#include <curses.priv.h>"
+		print "#include <ctype.h>"
+		print ""
+		print "#if USE_WIDEC_SUPPORT"
+		print "#if HAVE_WCTYPE_H"
+		print "#include <wctype.h>"
+		print "#endif"
+		print "#endif"
+		print ""
+		print "#undef unctrl"
+		print ""
+	}
+END	{
+		print "NCURSES_EXPORT(NCURSES_CONST char *) _nc_unctrl (SCREEN *sp, chtype ch)"
+		print "{"
+
+		blob=""
+		offset=0
+		if (bigstrings) {
+			printf "static const short unctrl_table[] = {"
+		} else {
+			printf "static const char* const unctrl_table[] = {"
+		}
+		for ( ch = 0; ch < 256; ch++ ) {
+			gap = ","
+			part=""
+			if ((ch % 8) == 0) {
+				printf "\n    "
+				if (ch != 0)
+					blob = blob "\""
+				blob = blob "\n    \""
+			}
+			if (bigstrings)
+				printf "%4d%s", offset, gap;
+			if (ch < 32) {
+				part = sprintf ("^\\%03o", ch + 64);
+				offset = offset + 3;
+			} else if (ch == 127) {
+				part = "^?";
+				offset = offset + 3;
+			} else if (ch >= 128 && ch < 160) {
+				part = sprintf("~\\%03o", ch - 64);
+				offset = offset + 3;
+			} else if (ch == 255) {
+				part = "~?";
+				offset = offset + 3;
+			} else if (ch >= 160) {
+				part = sprintf("M-\\%03o", ch - 128);
+				offset = offset + 4;
+			} else {
+				gap = gap " "
+				part = sprintf("\\%03o", ch);
+				offset = offset + 2;
+			}
+			if (ch == 255)
+				gap = "\n"
+			else if (((ch + 1) % 8) != 0)
+				gap = gap " "
+			if (bigstrings) {
+				blob = blob part "\\0";
+			} else {
+				printf "\"%s\"%s", part, gap
+			}
+		}
+		print "};"
+		blob = blob "\"";
+
+		print ""
+		printf "#if NCURSES_EXT_FUNCS\n";
+		if (bigstrings) {
+			blob = blob "\n/* printable values in 128-255 range */"
+			printf "static const short unctrl_c1[] = {"
+		} else {
+			printf "static const char* const unctrl_c1[] = {"
+		}
+		for ( ch = 128; ch < 256; ch++ ) {
+			gap = ","
+			if ((ch % 8) == 0) {
+				if (ch != 128)
+					blob = blob "\""
+				printf "\n    "
+				blob = blob "\n    \""
+			}
+			if (bigstrings) {
+				printf "%4d%s", offset, gap;
+				part = sprintf("\\%03o\\0", ch);
+				blob = blob part
+				offset = offset + 2;
+				if (((ch + 1) % 8) != 0)
+					gap = gap " "
+			} else {
+				if (ch >= 128) {
+					printf "\"\\%03o\"", ch
+					gap = gap " "
+				}
+				if (ch == 255)
+					gap = "\n"
+				else if (((ch + 1) % 8) != 0)
+					gap = gap " "
+				printf "%s", gap
+			}
+		}
+		print "};"
+		print "#endif /* NCURSES_EXT_FUNCS */"
+		blob = blob "\"\n"
+
+		print ""
+		if (bigstrings) {
+			print "static const char unctrl_blob[] = "blob";"
+			print ""
+			stringname = "unctrl_blob + unctrl"
+		} else {
+			stringname = "unctrl"
+		}
+		print  "\tint check = ChCharOf(ch);"
+		print  "\tconst char *result;"
+		print  ""
+		print  "\tif (check >= 0 && check < (int)SIZEOF(unctrl_table)) {"
+		print  "#if NCURSES_EXT_FUNCS"
+		print  "\t\tif ((sp != 0)"
+		print  "\t\t && (sp->_legacy_coding > 1)"
+		print  "\t\t && (check >= 128)"
+		print  "\t\t && (check < 160))"
+		printf "\t\t\tresult = %s_c1[check - 128];\n", stringname;
+		print  "\t\telse"
+		print  "#if USE_WIDEC_SUPPORT"
+		print  "\t\tif ((check >= 160)"
+		print  "\t\t && (check < 256)"
+		print  "\t\t && ((sp != 0)"
+		print  "\t\t  && ((sp->_legacy_coding > 0)"
+		print  "\t\t   || (sp->_legacy_coding == 0"
+		print  "\t\t       && (isprint(check) || iswprint(check))))))"
+		printf "\t\t\tresult = %s_c1[check - 128];\n", stringname;
+		print  "\t\telse"
+		print  "#else"
+		print  "\t\tif ((check >= 160)"
+		print  "\t\t && (check < 256)"
+		print  "\t\t && ((sp != 0)"
+		print  "\t\t  && ((sp->_legacy_coding > 0)"
+		print  "\t\t   || (sp->_legacy_coding == 0"
+		print  "\t\t       && isprint(check)))))"
+		printf "\t\t\tresult = %s_c1[check - 128];\n", stringname;
+		print  "\t\telse"
+		print  "#endif /* USE_WIDEC_SUPPORT */"
+		print  "#endif /* NCURSES_EXT_FUNCS */"
+		printf "\t\t\tresult = %s_table[check];\n", stringname;
+		print  "\t} else {"
+		print  "\t\tresult = 0;"
+		print  "\t}"
+		print  "\treturn (NCURSES_CONST char *)result;"
+		print  "}"
+		print  ""
+		print  "NCURSES_EXPORT(NCURSES_CONST char *) unctrl (chtype ch)"
+		print  "{"
+		print  "\treturn _nc_unctrl(SP, ch);"
+		print  "}"
+	}
diff --git a/ncurses/base/README b/ncurses/base/README
new file mode 100644
index 0000000..4677e42
--- /dev/null
+++ b/ncurses/base/README
@@ -0,0 +1,35 @@
+-------------------------------------------------------------------------------
+-- Copyright (c) 1998,2006 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.                                                            --
+-------------------------------------------------------------------------------
+-- $Id: README,v 1.2 2006/04/22 22:19:37 tom Exp $
+-------------------------------------------------------------------------------
+
+The functions in this directory are the generic (not device-specific) modules
+of ncurses.
+
+As a rule, these modules should not depend directly on term.h references and
+associated terminfo function and variables.
diff --git a/ncurses/base/define_key.c b/ncurses/base/define_key.c
new file mode 100644
index 0000000..3d5815f
--- /dev/null
+++ b/ncurses/base/define_key.c
@@ -0,0 +1,70 @@
+/****************************************************************************
+ * Copyright (c) 1998-2005,2006 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                    1997-on                     *
+ ****************************************************************************/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: define_key.c,v 1.13 2006/12/30 23:23:31 tom Exp $")
+
+NCURSES_EXPORT(int)
+define_key(const char *str, int keycode)
+{
+    int code = ERR;
+
+    T((T_CALLED("define_key(%s,%d)"), _nc_visbuf(str), keycode));
+    if (SP == 0) {
+	code = ERR;
+    } else if (keycode > 0) {
+	unsigned ukey = (unsigned) keycode;
+
+	if (str != 0) {
+	    define_key(str, 0);
+	} else if (has_key(keycode)) {
+	    while (_nc_remove_key(&(SP->_keytry), ukey))
+		code = OK;
+	}
+	if (str != 0) {
+	    if (key_defined(str) == 0) {
+		if (_nc_add_to_try(&(SP->_keytry), str, ukey) == OK) {
+		    code = OK;
+		} else {
+		    code = ERR;
+		}
+	    } else {
+		code = ERR;
+	    }
+	}
+    } else {
+	while (_nc_remove_string(&(SP->_keytry), str))
+	    code = OK;
+    }
+    returnCode(code);
+}
diff --git a/ncurses/base/key_defined.c b/ncurses/base/key_defined.c
new file mode 100644
index 0000000..759ad82
--- /dev/null
+++ b/ncurses/base/key_defined.c
@@ -0,0 +1,78 @@
+/****************************************************************************
+ * Copyright (c) 2003,2006 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, 2003                                          *
+ ****************************************************************************/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: key_defined.c,v 1.6 2006/12/30 23:22:55 tom Exp $")
+
+static int
+find_definition(TRIES * tree, const char *str)
+{
+    TRIES *ptr;
+    int result = OK;
+
+    if (str != 0 && *str != '\0') {
+	for (ptr = tree; ptr != 0; ptr = ptr->sibling) {
+	    if (UChar(*str) == UChar(ptr->ch)) {
+		if (str[1] == '\0' && ptr->child != 0) {
+		    result = ERR;
+		} else if ((result = find_definition(ptr->child, str + 1))
+			   == OK) {
+		    result = ptr->value;
+		} else if (str[1] == '\0') {
+		    result = ERR;
+		}
+	    }
+	    if (result != OK)
+		break;
+	}
+    }
+    return (result);
+}
+
+/*
+ * Returns the keycode associated with the given string.  If none is found,
+ * return OK.  If the string is only a prefix to other strings, return ERR.
+ * Otherwise, return the keycode's value (neither OK/ERR).
+ */
+NCURSES_EXPORT(int)
+key_defined(const char *str)
+{
+    int code = ERR;
+
+    T((T_CALLED("key_defined(%s)"), _nc_visbuf(str)));
+    if (SP != 0 && str != 0) {
+	code = find_definition(SP->_keytry, str);
+    }
+
+    returnCode(code);
+}
diff --git a/ncurses/base/keybound.c b/ncurses/base/keybound.c
new file mode 100644
index 0000000..2995714
--- /dev/null
+++ b/ncurses/base/keybound.c
@@ -0,0 +1,51 @@
+/****************************************************************************
+ * Copyright (c) 1999-2005,2006 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                 1999-on                        *
+ ****************************************************************************/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: keybound.c,v 1.7 2006/06/17 18:19:24 tom Exp $")
+
+/*
+ * Returns the count'th string definition which is associated with the
+ * given keycode.  The result is malloc'd, must be freed by the caller.
+ */
+NCURSES_EXPORT(char *)
+keybound(int code, int count)
+{
+    char *result = 0;
+
+    T((T_CALLED("keybound(%d,%d)"), code, count));
+    if (SP != 0 && code >= 0) {
+	result = _nc_expand_try(SP->_keytry, (unsigned) code, &count, 0);
+    }
+    returnPtr(result);
+}
diff --git a/ncurses/base/keyok.c b/ncurses/base/keyok.c
new file mode 100644
index 0000000..ad8988c
--- /dev/null
+++ b/ncurses/base/keyok.c
@@ -0,0 +1,78 @@
+/****************************************************************************
+ * Copyright (c) 1998-2000,2006 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            1997-on                             *
+ ****************************************************************************/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: keyok.c,v 1.7 2006/12/30 16:22:33 tom Exp $")
+
+/*
+ * Enable (or disable) ncurses' interpretation of a keycode by adding (or
+ * removing) the corresponding 'tries' entry.
+ *
+ * Do this by storing a second tree of tries, which records the disabled keys. 
+ * The simplest way to copy is to make a function that returns the string (with
+ * nulls set to 0200), then use that to reinsert the string into the
+ * corresponding tree.
+ */
+
+NCURSES_EXPORT(int)
+keyok(int c, bool flag)
+{
+    int code = ERR;
+    int count = 0;
+    char *s;
+
+    T((T_CALLED("keyok(%d,%d)"), c, flag));
+    if (c >= 0) {
+	unsigned ch = (unsigned) c;
+	if (flag) {
+	    while ((s = _nc_expand_try(SP->_key_ok, ch, &count, 0)) != 0
+		   && _nc_remove_key(&(SP->_key_ok), ch)) {
+		code = _nc_add_to_try(&(SP->_keytry), s, ch);
+		free(s);
+		count = 0;
+		if (code != OK)
+		    break;
+	    }
+	} else {
+	    while ((s = _nc_expand_try(SP->_keytry, ch, &count, 0)) != 0
+		   && _nc_remove_key(&(SP->_keytry), ch)) {
+		code = _nc_add_to_try(&(SP->_key_ok), s, ch);
+		free(s);
+		count = 0;
+		if (code != OK)
+		    break;
+	    }
+	}
+    }
+    returnCode(code);
+}
diff --git a/ncurses/base/legacy_coding.c b/ncurses/base/legacy_coding.c
new file mode 100644
index 0000000..1c2f160
--- /dev/null
+++ b/ncurses/base/legacy_coding.c
@@ -0,0 +1,48 @@
+/****************************************************************************
+ * Copyright (c) 2005 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                                                *
+ ****************************************************************************/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: legacy_coding.c,v 1.2 2005/12/17 23:38:17 tom Exp $")
+
+NCURSES_EXPORT(int)
+use_legacy_coding(int level)
+{
+    int result = ERR;
+
+    T((T_CALLED("use_legacy_coding(%d)"), level));
+    if (level >= 0 && level <= 2 && SP != 0) {
+	result = SP->_legacy_coding;
+	SP->_legacy_coding = level;
+    }
+    returnCode(result);
+}
diff --git a/ncurses/base/lib_addch.c b/ncurses/base/lib_addch.c
new file mode 100644
index 0000000..20a97a0
--- /dev/null
+++ b/ncurses/base/lib_addch.c
@@ -0,0 +1,548 @@
+/****************************************************************************
+ * Copyright (c) 1998-2006,2008 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.                                                           *
+ ****************************************************************************/
+
+/*
+**	lib_addch.c
+**
+**	The routine waddch().
+**
+*/
+
+#include <curses.priv.h>
+#include <ctype.h>
+
+MODULE_ID("$Id: lib_addch.c,v 1.113 2008/08/16 19:20:04 tom Exp $")
+
+static const NCURSES_CH_T blankchar = NewChar(BLANK_TEXT);
+
+/*
+ * Ugly microtweaking alert.  Everything from here to end of module is
+ * likely to be speed-critical -- profiling data sure says it is!
+ * Most of the important screen-painting functions are shells around
+ * waddch().  So we make every effort to reduce function-call overhead
+ * by inlining stuff, even at the cost of making wrapped copies for
+ * export.  Also we supply some internal versions that don't call the
+ * window sync hook, for use by string-put functions.
+ */
+
+/* Return bit mask for clearing color pair number if given ch has color */
+#define COLOR_MASK(ch) (~(attr_t)((ch) & A_COLOR ? A_COLOR : 0))
+
+static NCURSES_INLINE NCURSES_CH_T
+render_char(WINDOW *win, NCURSES_CH_T ch)
+/* compute a rendition of the given char correct for the current context */
+{
+    attr_t a = WINDOW_ATTRS(win);
+    int pair = GetPair(ch);
+
+    if (ISBLANK(ch)
+	&& AttrOf(ch) == A_NORMAL
+	&& pair == 0) {
+	/* color/pair in attrs has precedence over bkgrnd */
+	ch = win->_nc_bkgd;
+	SetAttr(ch, a | AttrOf(win->_nc_bkgd));
+	if ((pair = GET_WINDOW_PAIR(win)) == 0)
+	    pair = GetPair(win->_nc_bkgd);
+	SetPair(ch, pair);
+    } else {
+	/* color in attrs has precedence over bkgrnd */
+	a |= AttrOf(win->_nc_bkgd) & COLOR_MASK(a);
+	/* color in ch has precedence */
+	if (pair == 0) {
+	    if ((pair = GET_WINDOW_PAIR(win)) == 0)
+		pair = GetPair(win->_nc_bkgd);
+	}
+#if 0
+	if (pair > 255) {
+	    NCURSES_CH_T fixme = ch;
+	    SetPair(fixme, pair);
+	}
+#endif
+	AddAttr(ch, (a & COLOR_MASK(AttrOf(ch))));
+	SetPair(ch, pair);
+    }
+
+    TR(TRACE_VIRTPUT,
+       ("render_char bkg %s (%d), attrs %s (%d) -> ch %s (%d)",
+	_tracech_t2(1, CHREF(win->_nc_bkgd)),
+	GetPair(win->_nc_bkgd),
+	_traceattr(WINDOW_ATTRS(win)),
+	GET_WINDOW_PAIR(win),
+	_tracech_t2(3, CHREF(ch)),
+	GetPair(ch)));
+
+    return (ch);
+}
+
+NCURSES_EXPORT(NCURSES_CH_T)
+_nc_render(WINDOW *win, NCURSES_CH_T ch)
+/* make render_char() visible while still allowing us to inline it below */
+{
+    return render_char(win, ch);
+}
+
+/* check if position is legal; if not, return error */
+#ifndef NDEBUG			/* treat this like an assertion */
+#define CHECK_POSITION(win, x, y) \
+	if (y > win->_maxy \
+	 || x > win->_maxx \
+	 || y < 0 \
+	 || x < 0) { \
+		TR(TRACE_VIRTPUT, ("Alert! Win=%p _curx = %d, _cury = %d " \
+				   "(_maxx = %d, _maxy = %d)", win, x, y, \
+				   win->_maxx, win->_maxy)); \
+		return(ERR); \
+	}
+#else
+#define CHECK_POSITION(win, x, y)	/* nothing */
+#endif
+
+static bool
+newline_forces_scroll(WINDOW *win, NCURSES_SIZE_T * ypos)
+{
+    bool result = FALSE;
+
+    if (*ypos >= win->_regtop && *ypos == win->_regbottom) {
+	*ypos = win->_regbottom;
+	result = TRUE;
+    } else {
+	*ypos += 1;
+    }
+    return result;
+}
+
+/*
+ * The _WRAPPED flag is useful only for telling an application that we've just
+ * wrapped the cursor.  We don't do anything with this flag except set it when
+ * wrapping, and clear it whenever we move the cursor.  If we try to wrap at
+ * the lower-right corner of a window, we cannot move the cursor (since that
+ * wouldn't be legal).  So we return an error (which is what SVr4 does). 
+ * Unlike SVr4, we can successfully add a character to the lower-right corner
+ * (Solaris 2.6 does this also, however).
+ */
+static int
+wrap_to_next_line(WINDOW *win)
+{
+    win->_flags |= _WRAPPED;
+    if (newline_forces_scroll(win, &(win->_cury))) {
+	win->_curx = win->_maxx;
+	if (!win->_scroll)
+	    return (ERR);
+	scroll(win);
+    }
+    win->_curx = 0;
+    return (OK);
+}
+
+#if USE_WIDEC_SUPPORT
+static int waddch_literal(WINDOW *, NCURSES_CH_T);
+/*
+ * Fill the given number of cells with blanks using the current background
+ * rendition.  This saves/restores the current x-position.
+ */
+static void
+fill_cells(WINDOW *win, int count)
+{
+    NCURSES_CH_T blank = blankchar;
+    int save_x = win->_curx;
+    int save_y = win->_cury;
+
+    while (count-- > 0) {
+	if (waddch_literal(win, blank) == ERR)
+	    break;
+    }
+    win->_curx = save_x;
+    win->_cury = save_y;
+}
+#endif
+
+/*
+ * Build up the bytes for a multibyte character, returning the length when
+ * complete (a positive number), -1 for error and -2 for incomplete.
+ */
+#if USE_WIDEC_SUPPORT
+NCURSES_EXPORT(int)
+_nc_build_wch(WINDOW *win, ARG_CH_T ch)
+{
+    char *buffer = WINDOW_EXT(win, addch_work);
+    int len;
+    int x = win->_curx;
+    int y = win->_cury;
+    mbstate_t state;
+    wchar_t result;
+
+    if ((WINDOW_EXT(win, addch_used) != 0) &&
+	(WINDOW_EXT(win, addch_x) != x ||
+	 WINDOW_EXT(win, addch_y) != y)) {
+	/* discard the incomplete multibyte character */
+	WINDOW_EXT(win, addch_used) = 0;
+	TR(TRACE_VIRTPUT,
+	   ("Alert discarded multibyte on move (%d,%d) -> (%d,%d)",
+	    WINDOW_EXT(win, addch_y), WINDOW_EXT(win, addch_x),
+	    y, x));
+    }
+    WINDOW_EXT(win, addch_x) = x;
+    WINDOW_EXT(win, addch_y) = y;
+
+    init_mb(state);
+    buffer[WINDOW_EXT(win, addch_used)] = (char) CharOf(CHDEREF(ch));
+    WINDOW_EXT(win, addch_used) += 1;
+    buffer[WINDOW_EXT(win, addch_used)] = '\0';
+    if ((len = mbrtowc(&result,
+		       buffer,
+		       WINDOW_EXT(win, addch_used), &state)) > 0) {
+	attr_t attrs = AttrOf(CHDEREF(ch));
+	if_EXT_COLORS(int pair = GetPair(CHDEREF(ch)));
+	SetChar(CHDEREF(ch), result, attrs);
+	if_EXT_COLORS(SetPair(CHDEREF(ch), pair));
+	WINDOW_EXT(win, addch_used) = 0;
+    } else if (len == -1) {
+	/*
+	 * An error occurred.  We could either discard everything,
+	 * or assume that the error was in the previous input.
+	 * Try the latter.
+	 */
+	TR(TRACE_VIRTPUT, ("Alert! mbrtowc returns error"));
+	/* handle this with unctrl() */
+	WINDOW_EXT(win, addch_used) = 0;
+    }
+    return len;
+}
+#endif /* USE_WIDEC_SUPPORT */
+
+static
+#if !USE_WIDEC_SUPPORT		/* cannot be inline if it is recursive */
+NCURSES_INLINE
+#endif
+int
+waddch_literal(WINDOW *win, NCURSES_CH_T ch)
+{
+    int x;
+    int y;
+    struct ldat *line;
+
+    x = win->_curx;
+    y = win->_cury;
+
+    CHECK_POSITION(win, x, y);
+
+    ch = render_char(win, ch);
+
+    line = win->_line + y;
+
+    CHANGED_CELL(line, x);
+
+    /*
+     * Build up multibyte characters until we have a wide-character.
+     */
+    if_WIDEC({
+	if (WINDOW_EXT(win, addch_used) != 0 || !Charable(ch)) {
+	    int len = _nc_build_wch(win, CHREF(ch));
+
+	    if (len >= -1) {
+		/* handle EILSEQ */
+		if (is8bits(CharOf(ch))) {
+		    const char *s = unctrl((chtype) CharOf(ch));
+		    if (s[1] != 0) {
+			return waddstr(win, s);
+		    }
+		}
+		if (len == -1)
+		    return waddch(win, ' ');
+	    } else {
+		return OK;
+	    }
+	}
+    });
+
+    /*
+     * Non-spacing characters are added to the current cell.
+     *
+     * Spacing characters that are wider than one column require some display
+     * adjustments.
+     */
+    if_WIDEC({
+	int len = wcwidth(CharOf(ch));
+	int i;
+	int j;
+	wchar_t *chars;
+
+	if (len == 0) {		/* non-spacing */
+	    if ((x > 0 && y >= 0)
+		|| (win->_maxx >= 0 && win->_cury >= 1)) {
+		if (x > 0 && y >= 0)
+		    chars = (win->_line[y].text[x - 1].chars);
+		else
+		    chars = (win->_line[y - 1].text[win->_maxx].chars);
+		for (i = 0; i < CCHARW_MAX; ++i) {
+		    if (chars[i] == 0) {
+			TR(TRACE_VIRTPUT,
+			   ("added non-spacing %d: %x",
+			    x, (int) CharOf(ch)));
+			chars[i] = CharOf(ch);
+			break;
+		    }
+		}
+	    }
+	    goto testwrapping;
+	} else if (len > 1) {	/* multi-column characters */
+	    /*
+	     * Check if the character will fit on the current line.  If it does
+	     * not fit, fill in the remainder of the line with blanks.  and
+	     * move to the next line.
+	     */
+	    if (len > win->_maxx + 1) {
+		TR(TRACE_VIRTPUT, ("character will not fit"));
+		return ERR;
+	    } else if (x + len > win->_maxx + 1) {
+		int count = win->_maxx + 1 - x;
+		TR(TRACE_VIRTPUT, ("fill %d remaining cells", count));
+		fill_cells(win, count);
+		if (wrap_to_next_line(win) == ERR)
+		    return ERR;
+		x = win->_curx;
+		y = win->_cury;
+	    }
+	    /*
+	     * Check for cells which are orphaned by adding this character, set
+	     * those to blanks.
+	     *
+	     * FIXME: this actually could fill j-i cells, more complicated to
+	     * setup though.
+	     */
+	    for (i = 0; i < len; ++i) {
+		if (isWidecBase(win->_line[y].text[x + i])) {
+		    break;
+		} else if (isWidecExt(win->_line[y].text[x + i])) {
+		    for (j = i; x + j <= win->_maxx; ++j) {
+			if (!isWidecExt(win->_line[y].text[x + j])) {
+			    TR(TRACE_VIRTPUT, ("fill %d orphan cells", j));
+			    fill_cells(win, j);
+			    break;
+			}
+		    }
+		    break;
+		}
+	    }
+	    /*
+	     * Finally, add the cells for this character.
+	     */
+	    for (i = 0; i < len; ++i) {
+		NCURSES_CH_T value = ch;
+		SetWidecExt(value, i);
+		TR(TRACE_VIRTPUT, ("multicolumn %d:%d (%d,%d)",
+				   i + 1, len,
+				   win->_begy + y, win->_begx + x));
+		line->text[x] = value;
+		CHANGED_CELL(line, x);
+		++x;
+	    }
+	    goto testwrapping;
+	}
+    });
+
+    /*
+     * Single-column characters.
+     */
+    line->text[x++] = ch;
+    /*
+     * This label is used only for wide-characters.
+     */
+    if_WIDEC(
+  testwrapping:
+    );
+
+    TR(TRACE_VIRTPUT, ("cell (%ld, %ld..%d) = %s",
+		       (long) win->_cury, (long) win->_curx, x - 1,
+		       _tracech_t(CHREF(ch))));
+
+    if (x > win->_maxx) {
+	return wrap_to_next_line(win);
+    }
+    win->_curx = x;
+    return OK;
+}
+
+static NCURSES_INLINE int
+waddch_nosync(WINDOW *win, const NCURSES_CH_T ch)
+/* the workhorse function -- add a character to the given window */
+{
+    NCURSES_SIZE_T x, y;
+    chtype t = CharOf(ch);
+    const char *s = unctrl(t);
+
+    /*
+     * If we are using the alternate character set, forget about locale.
+     * Otherwise, if unctrl() returns a single-character or the locale
+     * claims the code is printable, treat it that way.
+     */
+    if ((AttrOf(ch) & A_ALTCHARSET)
+	|| (
+#if USE_WIDEC_SUPPORT
+	       (SP != 0 && SP->_legacy_coding) &&
+#endif
+	       s[1] == 0
+	)
+	|| (
+	       isprint(t)
+#if USE_WIDEC_SUPPORT
+	       || ((SP == 0 || !SP->_legacy_coding) &&
+		   (WINDOW_EXT(win, addch_used)
+		    || !_nc_is_charable(CharOf(ch))))
+#endif
+	))
+	return waddch_literal(win, ch);
+
+    /*
+     * Handle carriage control and other codes that are not printable, or are
+     * known to expand to more than one character according to unctrl().
+     */
+    x = win->_curx;
+    y = win->_cury;
+
+    switch (t) {
+    case '\t':
+	x += (TABSIZE - (x % TABSIZE));
+
+	/*
+	 * Space-fill the tab on the bottom line so that we'll get the
+	 * "correct" cursor position.
+	 */
+	if ((!win->_scroll && (y == win->_regbottom))
+	    || (x <= win->_maxx)) {
+	    NCURSES_CH_T blank = blankchar;
+	    AddAttr(blank, AttrOf(ch));
+	    while (win->_curx < x) {
+		if (waddch_literal(win, blank) == ERR)
+		    return (ERR);
+	    }
+	    break;
+	} else {
+	    wclrtoeol(win);
+	    win->_flags |= _WRAPPED;
+	    if (newline_forces_scroll(win, &y)) {
+		x = win->_maxx;
+		if (win->_scroll) {
+		    scroll(win);
+		    x = 0;
+		}
+	    } else {
+		x = 0;
+	    }
+	}
+	break;
+    case '\n':
+	wclrtoeol(win);
+	if (newline_forces_scroll(win, &y)) {
+	    if (win->_scroll)
+		scroll(win);
+	    else
+		return (ERR);
+	}
+	/* FALLTHRU */
+    case '\r':
+	x = 0;
+	win->_flags &= ~_WRAPPED;
+	break;
+    case '\b':
+	if (x == 0)
+	    return (OK);
+	x--;
+	win->_flags &= ~_WRAPPED;
+	break;
+    default:
+	while (*s) {
+	    NCURSES_CH_T sch;
+	    SetChar(sch, *s++, AttrOf(ch));
+	    if_EXT_COLORS(SetPair(sch, GetPair(ch)));
+	    if (waddch_literal(win, sch) == ERR)
+		return ERR;
+	}
+	return (OK);
+    }
+
+    win->_curx = x;
+    win->_cury = y;
+
+    return (OK);
+}
+
+NCURSES_EXPORT(int)
+_nc_waddch_nosync(WINDOW *win, const NCURSES_CH_T c)
+/* export copy of waddch_nosync() so the string-put functions can use it */
+{
+    return (waddch_nosync(win, c));
+}
+
+/*
+ * The versions below call _nc_synchook().  We wanted to avoid this in the
+ * version exported for string puts; they'll call _nc_synchook once at end
+ * of run.
+ */
+
+/* These are actual entry points */
+
+NCURSES_EXPORT(int)
+waddch(WINDOW *win, const chtype ch)
+{
+    int code = ERR;
+    NCURSES_CH_T wch;
+    SetChar2(wch, ch);
+
+    TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_CALLED("waddch(%p, %s)"), win,
+				      _tracechtype(ch)));
+
+    if (win && (waddch_nosync(win, wch) != ERR)) {
+	_nc_synchook(win);
+	code = OK;
+    }
+
+    TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_RETURN("%d"), code));
+    return (code);
+}
+
+NCURSES_EXPORT(int)
+wechochar(WINDOW *win, const chtype ch)
+{
+    int code = ERR;
+    NCURSES_CH_T wch;
+    SetChar2(wch, ch);
+
+    TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_CALLED("wechochar(%p, %s)"), win,
+				      _tracechtype(ch)));
+
+    if (win && (waddch_nosync(win, wch) != ERR)) {
+	bool save_immed = win->_immed;
+	win->_immed = TRUE;
+	_nc_synchook(win);
+	win->_immed = save_immed;
+	code = OK;
+    }
+    TR(TRACE_VIRTPUT | TRACE_CCALLS, (T_RETURN("%d"), code));
+    return (code);
+}
diff --git a/ncurses/base/lib_addstr.c b/ncurses/base/lib_addstr.c
new file mode 100644
index 0000000..4e3a040
--- /dev/null
+++ b/ncurses/base/lib_addstr.c
@@ -0,0 +1,245 @@
+/****************************************************************************
+ * 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *                                                                          *
+ *  Rewritten 2001-2004 to support wide-characters by                       *
+ *	Sven Verdoolaege                                                    *
+ *	Thomas Dickey                                                       *
+ ****************************************************************************/
+
+/*
+**	lib_addstr.c
+*
+**	The routines waddnstr(), waddchnstr().
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_addstr.c,v 1.48 2007/10/13 19:56:57 tom Exp $")
+
+NCURSES_EXPORT(int)
+waddnstr(WINDOW *win, const char *astr, int n)
+{
+    const char *str = astr;
+    int code = ERR;
+
+    T((T_CALLED("waddnstr(%p,%s,%d)"), win, _nc_visbufn(astr, n), n));
+
+    if (win && (str != 0)) {
+	TR(TRACE_VIRTPUT | TRACE_ATTRS,
+	   ("... current %s", _traceattr(WINDOW_ATTRS(win))));
+	code = OK;
+	if (n < 0)
+	    n = (int) strlen(astr);
+
+	TR(TRACE_VIRTPUT, ("str is not null, length = %d", n));
+	while ((n-- > 0) && (*str != '\0')) {
+	    NCURSES_CH_T ch;
+	    TR(TRACE_VIRTPUT, ("*str = %#o", UChar(*str)));
+	    SetChar(ch, UChar(*str++), A_NORMAL);
+	    if (_nc_waddch_nosync(win, ch) == ERR) {
+		code = ERR;
+		break;
+	    }
+	}
+	_nc_synchook(win);
+    }
+    TR(TRACE_VIRTPUT, ("waddnstr returns %d", code));
+    returnCode(code);
+}
+
+NCURSES_EXPORT(int)
+waddchnstr(WINDOW *win, const chtype *astr, int n)
+{
+    NCURSES_SIZE_T y, x;
+    int code = OK;
+    int i;
+    struct ldat *line;
+
+    T((T_CALLED("waddchnstr(%p,%p,%d)"), win, astr, n));
+
+    if (!win)
+	returnCode(ERR);
+
+    y = win->_cury;
+    x = win->_curx;
+    if (n < 0) {
+	const chtype *str;
+	n = 0;
+	for (str = (const chtype *) astr; *str != 0; str++)
+	    n++;
+    }
+    if (n > win->_maxx - x + 1)
+	n = win->_maxx - x + 1;
+    if (n == 0)
+	returnCode(code);
+
+    line = &(win->_line[y]);
+    for (i = 0; i < n && ChCharOf(astr[i]) != '\0'; ++i) {
+	SetChar2(line->text[i + x], astr[i]);
+    }
+    CHANGED_RANGE(line, x, x + n - 1);
+
+    _nc_synchook(win);
+    returnCode(code);
+}
+
+#if USE_WIDEC_SUPPORT
+
+NCURSES_EXPORT(int)
+_nc_wchstrlen(const cchar_t *s)
+{
+    int result = 0;
+    while (CharOf(s[result]) != L'\0') {
+	result++;
+    }
+    return result;
+}
+
+NCURSES_EXPORT(int)
+wadd_wchnstr(WINDOW *win, const cchar_t *astr, int n)
+{
+    static const NCURSES_CH_T blank = NewChar(BLANK_TEXT);
+    NCURSES_SIZE_T y;
+    NCURSES_SIZE_T x;
+    int code = OK;
+    struct ldat *line;
+    int i, j, start, len, end;
+
+    T((T_CALLED("wadd_wchnstr(%p,%s,%d)"), win, _nc_viscbuf(astr, n), n));
+
+    if (!win)
+	returnCode(ERR);
+
+    y = win->_cury;
+    x = win->_curx;
+    if (n < 0) {
+	n = _nc_wchstrlen(astr);
+    }
+    if (n > win->_maxx - x + 1)
+	n = win->_maxx - x + 1;
+    if (n == 0)
+	returnCode(code);
+
+    line = &(win->_line[y]);
+    start = x;
+    end = x + n - 1;
+
+    /*
+     * Reset orphaned cells of multi-column characters that extend up to the
+     * new string's location to blanks.
+     */
+    if (x > 0 && isWidecExt(line->text[x])) {
+	for (i = 0; i <= x; ++i) {
+	    if (!isWidecExt(line->text[x - i])) {
+		/* must be isWidecBase() */
+		start -= i;
+		while (i > 0) {
+		    line->text[x - i--] = _nc_render(win, blank);
+		}
+		break;
+	    }
+	}
+    }
+
+    /*
+     * Copy the new string to the window.
+     */
+    for (i = 0; i < n && CharOf(astr[i]) != L'\0' && x <= win->_maxx; ++i) {
+	if (isWidecExt(astr[i]))
+	    continue;
+
+	len = wcwidth(CharOf(astr[i]));
+
+	if (x + len - 1 <= win->_maxx) {
+	    line->text[x] = _nc_render(win, astr[i]);
+	    if (len > 1) {
+		for (j = 0; j < len; ++j) {
+		    if (j != 0) {
+			line->text[x + j] = line->text[x];
+		    }
+		    SetWidecExt(line->text[x + j], j);
+		}
+	    }
+	    x += len;
+	    end += len - 1;
+	} else {
+	    break;
+	}
+    }
+
+    /*
+     * Set orphaned cells of multi-column characters which lie after the new
+     * string to blanks.
+     */
+    while (x <= win->_maxx && isWidecExt(line->text[x])) {
+	line->text[x] = _nc_render(win, blank);
+	++end;
+	++x;
+    }
+    CHANGED_RANGE(line, start, end);
+
+    _nc_synchook(win);
+    returnCode(code);
+}
+
+NCURSES_EXPORT(int)
+waddnwstr(WINDOW *win, const wchar_t *str, int n)
+{
+    int code = ERR;
+
+    T((T_CALLED("waddnwstr(%p,%s,%d)"), win, _nc_viswbufn(str, n), n));
+
+    if (win && (str != 0)) {
+	TR(TRACE_VIRTPUT | TRACE_ATTRS,
+	   ("... current %s", _traceattr(WINDOW_ATTRS(win))));
+	code = OK;
+	if (n < 0)
+	    n = (int) wcslen(str);
+
+	TR(TRACE_VIRTPUT, ("str is not null, length = %d", n));
+	while ((n-- > 0) && (*str != L('\0'))) {
+	    NCURSES_CH_T ch;
+	    TR(TRACE_VIRTPUT, ("*str[0] = %#lx", (unsigned long) *str));
+	    SetChar(ch, *str++, A_NORMAL);
+	    if (wadd_wch(win, &ch) == ERR) {
+		code = ERR;
+		break;
+	    }
+	}
+	_nc_synchook(win);
+    }
+    TR(TRACE_VIRTPUT, ("waddnwstr returns %d", code));
+    returnCode(code);
+}
+
+#endif
diff --git a/ncurses/base/lib_beep.c b/ncurses/base/lib_beep.c
new file mode 100644
index 0000000..b478f25
--- /dev/null
+++ b/ncurses/base/lib_beep.c
@@ -0,0 +1,76 @@
+/****************************************************************************
+ * Copyright (c) 1998-2000,2005 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Thomas E. Dickey                        1996-on                 *
+ ****************************************************************************/
+
+/*
+ *	beep.c
+ *
+ *	The routine beep().
+ *
+ */
+
+#include <curses.priv.h>
+#include <term.h>		/* beep, flash */
+
+MODULE_ID("$Id: lib_beep.c,v 1.10 2005/04/09 15:20:04 tom Exp $")
+
+/*
+ *	beep()
+ *
+ *	Sound the current terminal's audible bell if it has one.   If not,
+ *	flash the screen if possible.
+ *
+ */
+
+NCURSES_EXPORT(int)
+beep(void)
+{
+    int res = ERR;
+
+    T((T_CALLED("beep()")));
+
+    /* FIXME: should make sure that we are not in altchar mode */
+    if (cur_term == 0) {
+	res = ERR;
+    } else if (bell) {
+	TPUTS_TRACE("bell");
+	res = putp(bell);
+	_nc_flush();
+    } else if (flash_screen) {
+	TPUTS_TRACE("flash_screen");
+	res = putp(flash_screen);
+	_nc_flush();
+    }
+
+    returnCode(res);
+}
diff --git a/ncurses/base/lib_bkgd.c b/ncurses/base/lib_bkgd.c
new file mode 100644
index 0000000..c99e0c5
--- /dev/null
+++ b/ncurses/base/lib_bkgd.c
@@ -0,0 +1,156 @@
+/****************************************************************************
+ * Copyright (c) 1998-2006,2008 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Juergen Pfeifer                         1997                    *
+ *     and: Sven Verdoolaege                        2000                    *
+ *     and: Thomas E. Dickey                        1996-on                 *
+ ****************************************************************************/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_bkgd.c,v 1.36 2008/03/23 00:09:14 tom Exp $")
+
+/*
+ * Set the window's background information.
+ */
+#if USE_WIDEC_SUPPORT
+NCURSES_EXPORT(void)
+#else
+static NCURSES_INLINE void
+#endif
+wbkgrndset(WINDOW *win, const ARG_CH_T ch)
+{
+    T((T_CALLED("wbkgdset(%p,%s)"), win, _tracech_t(ch)));
+
+    if (win) {
+	attr_t off = AttrOf(win->_nc_bkgd);
+	attr_t on = AttrOf(CHDEREF(ch));
+
+	toggle_attr_off(WINDOW_ATTRS(win), off);
+	toggle_attr_on(WINDOW_ATTRS(win), on);
+
+#if NCURSES_EXT_COLORS
+	{
+	    int pair;
+
+	    if ((pair = GetPair(win->_nc_bkgd)) != 0)
+		SET_WINDOW_PAIR(win, 0);
+	    if ((pair = GetPair(CHDEREF(ch))) != 0)
+		SET_WINDOW_PAIR(win, pair);
+	}
+#endif
+
+	if (CharOf(CHDEREF(ch)) == L('\0')) {
+	    SetChar(win->_nc_bkgd, BLANK_TEXT, AttrOf(CHDEREF(ch)));
+	    if_EXT_COLORS(SetPair(win->_nc_bkgd, GetPair(CHDEREF(ch))));
+	} else {
+	    win->_nc_bkgd = CHDEREF(ch);
+	}
+#if USE_WIDEC_SUPPORT
+	/*
+	 * If we're compiled for wide-character support, _bkgrnd is the
+	 * preferred location for the background information since it stores
+	 * more than _bkgd.  Update _bkgd each time we modify _bkgrnd, so the
+	 * macro getbkgd() will work.
+	 */
+	{
+	    cchar_t wch;
+	    int tmp;
+
+	    wgetbkgrnd(win, &wch);
+	    tmp = _nc_to_char((wint_t) CharOf(wch));
+
+	    win->_bkgd = (((tmp == EOF) ? ' ' : (chtype) tmp)
+			  | (AttrOf(wch) & ALL_BUT_COLOR)
+			  | COLOR_PAIR(GET_WINDOW_PAIR(win)));
+	}
+#endif
+    }
+    returnVoid;
+}
+
+NCURSES_EXPORT(void)
+wbkgdset(WINDOW *win, chtype ch)
+{
+    NCURSES_CH_T wch;
+    SetChar2(wch, ch);
+    wbkgrndset(win, CHREF(wch));
+}
+
+/*
+ * Set the window's background information and apply it to each cell.
+ */
+#if USE_WIDEC_SUPPORT
+NCURSES_EXPORT(int)
+#else
+static NCURSES_INLINE int
+#undef wbkgrnd
+#endif
+wbkgrnd(WINDOW *win, const ARG_CH_T ch)
+{
+    int code = ERR;
+    int x, y;
+    NCURSES_CH_T new_bkgd = CHDEREF(ch);
+
+    T((T_CALLED("wbkgd(%p,%s)"), win, _tracech_t(ch)));
+
+    if (win) {
+	NCURSES_CH_T old_bkgrnd;
+	wgetbkgrnd(win, &old_bkgrnd);
+
+	wbkgrndset(win, CHREF(new_bkgd));
+	wattrset(win, AttrOf(win->_nc_bkgd));
+
+	for (y = 0; y <= win->_maxy; y++) {
+	    for (x = 0; x <= win->_maxx; x++) {
+		if (CharEq(win->_line[y].text[x], old_bkgrnd)) {
+		    win->_line[y].text[x] = win->_nc_bkgd;
+		} else {
+		    NCURSES_CH_T wch = win->_line[y].text[x];
+		    RemAttr(wch, (~(A_ALTCHARSET | A_CHARTEXT)));
+		    win->_line[y].text[x] = _nc_render(win, wch);
+		}
+	    }
+	}
+	touchwin(win);
+	_nc_synchook(win);
+	code = OK;
+    }
+    returnCode(code);
+}
+
+NCURSES_EXPORT(int)
+wbkgd(WINDOW *win, chtype ch)
+{
+    NCURSES_CH_T wch;
+    SetChar2(wch, ch);
+    return wbkgrnd(win, CHREF(wch));
+}
diff --git a/ncurses/base/lib_box.c b/ncurses/base/lib_box.c
new file mode 100644
index 0000000..d6cfc6c
--- /dev/null
+++ b/ncurses/base/lib_box.c
@@ -0,0 +1,128 @@
+/****************************************************************************
+ * Copyright (c) 1998-2002,2005 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Thomas E. Dickey                        1996-on                 *
+ *     and: Sven Verdoolaege                        2001                    *
+ ****************************************************************************/
+
+/*
+**	lib_box.c
+**
+**	The routine wborder().
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_box.c,v 1.22 2005/11/26 15:39:42 tom Exp $")
+
+#if USE_WIDEC_SUPPORT
+static NCURSES_INLINE chtype
+_my_render(WINDOW *win, chtype ch)
+{
+    NCURSES_CH_T wch;
+    SetChar2(wch, ch);
+    wch = _nc_render(win, wch);
+    return CharOf(wch) | AttrOf(wch);
+}
+#define RENDER_WITH_DEFAULT(ch,def) w ## ch = _my_render(win, (ch == 0) ? def : ch)
+#else
+#define RENDER_WITH_DEFAULT(ch,def) w ## ch = _nc_render(win, (ch == 0) ? def : ch)
+#endif
+
+NCURSES_EXPORT(int)
+wborder(WINDOW *win,
+	chtype ls, chtype rs,
+	chtype ts, chtype bs,
+	chtype tl, chtype tr,
+	chtype bl, chtype br)
+{
+    NCURSES_SIZE_T i;
+    NCURSES_SIZE_T endx, endy;
+    chtype wls, wrs, wts, wbs, wtl, wtr, wbl, wbr;
+
+    T((T_CALLED("wborder(%p,%s,%s,%s,%s,%s,%s,%s,%s)"),
+       win,
+       _tracechtype2(1, ls),
+       _tracechtype2(2, rs),
+       _tracechtype2(3, ts),
+       _tracechtype2(4, bs),
+       _tracechtype2(5, tl),
+       _tracechtype2(6, tr),
+       _tracechtype2(7, bl),
+       _tracechtype2(8, br)));
+
+    if (!win)
+	returnCode(ERR);
+
+    RENDER_WITH_DEFAULT(ls, ACS_VLINE);
+    RENDER_WITH_DEFAULT(rs, ACS_VLINE);
+    RENDER_WITH_DEFAULT(ts, ACS_HLINE);
+    RENDER_WITH_DEFAULT(bs, ACS_HLINE);
+    RENDER_WITH_DEFAULT(tl, ACS_ULCORNER);
+    RENDER_WITH_DEFAULT(tr, ACS_URCORNER);
+    RENDER_WITH_DEFAULT(bl, ACS_LLCORNER);
+    RENDER_WITH_DEFAULT(br, ACS_LRCORNER);
+
+    T(("using %s, %s, %s, %s, %s, %s, %s, %s",
+       _tracechtype2(1, wls),
+       _tracechtype2(2, wrs),
+       _tracechtype2(3, wts),
+       _tracechtype2(4, wbs),
+       _tracechtype2(5, wtl),
+       _tracechtype2(6, wtr),
+       _tracechtype2(7, wbl),
+       _tracechtype2(8, wbr)));
+
+    endx = win->_maxx;
+    endy = win->_maxy;
+
+    for (i = 0; i <= endx; i++) {
+	SetChar2(win->_line[0].text[i], wts);
+	SetChar2(win->_line[endy].text[i], wbs);
+    }
+    win->_line[endy].firstchar = win->_line[0].firstchar = 0;
+    win->_line[endy].lastchar = win->_line[0].lastchar = endx;
+
+    for (i = 0; i <= endy; i++) {
+	SetChar2(win->_line[i].text[0], wls);
+	SetChar2(win->_line[i].text[endx], wrs);
+	win->_line[i].firstchar = 0;
+	win->_line[i].lastchar = endx;
+    }
+    SetChar2(win->_line[0].text[0], wtl);
+    SetChar2(win->_line[0].text[endx], wtr);
+    SetChar2(win->_line[endy].text[0], wbl);
+    SetChar2(win->_line[endy].text[endx], wbr);
+
+    _nc_synchook(win);
+    returnCode(OK);
+}
diff --git a/ncurses/base/lib_chgat.c b/ncurses/base/lib_chgat.c
new file mode 100644
index 0000000..89eefa7
--- /dev/null
+++ b/ncurses/base/lib_chgat.c
@@ -0,0 +1,68 @@
+/****************************************************************************
+ * Copyright (c) 1998-2005,2006 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Sven Verdoolaege                        2001                    *
+ *     and: Thomas E. Dickey                        2005                    *
+ ****************************************************************************/
+
+/*
+**	lib_chgat.c
+**
+**	The routine wchgat().
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_chgat.c,v 1.7 2006/07/15 22:07:11 tom Exp $")
+
+NCURSES_EXPORT(int)
+wchgat(WINDOW *win, int n, attr_t attr, short color, const void *opts GCC_UNUSED)
+{
+    int i;
+
+    T((T_CALLED("wchgat(%p,%d,%s,%d)"), win, n, _traceattr(attr), color));
+
+    if (win) {
+	struct ldat *line = &(win->_line[win->_cury]);
+
+	toggle_attr_on(attr, COLOR_PAIR(color));
+
+	for (i = win->_curx; i <= win->_maxx && (n == -1 || (n-- > 0)); i++) {
+	    SetAttr(line->text[i], attr);
+	    SetPair(line->text[i], color);
+	    CHANGED_CELL(line, i);
+	}
+
+	returnCode(OK);
+    } else
+	returnCode(ERR);
+}
diff --git a/ncurses/base/lib_clear.c b/ncurses/base/lib_clear.c
new file mode 100644
index 0000000..e0b4edf
--- /dev/null
+++ b/ncurses/base/lib_clear.c
@@ -0,0 +1,56 @@
+/****************************************************************************
+ * Copyright (c) 1998,2000 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ ****************************************************************************/
+
+/*
+**	lib_clear.c
+**
+**	The routine wclear().
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_clear.c,v 1.7 2000/12/10 02:43:26 tom Exp $")
+
+NCURSES_EXPORT(int)
+wclear(WINDOW *win)
+{
+    int code = ERR;
+
+    T((T_CALLED("wclear(%p)"), win));
+
+    if ((code = werase(win)) != ERR)
+	win->_clear = TRUE;
+
+    returnCode(code);
+}
diff --git a/ncurses/base/lib_clearok.c b/ncurses/base/lib_clearok.c
new file mode 100644
index 0000000..9b56bd1
--- /dev/null
+++ b/ncurses/base/lib_clearok.c
@@ -0,0 +1,55 @@
+/****************************************************************************
+ * Copyright (c) 1998,2000 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ ****************************************************************************/
+
+/*
+**	lib_clearok.c
+**
+**	The routine clearok.
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_clearok.c,v 1.4 2000/12/10 02:43:26 tom Exp $")
+
+NCURSES_EXPORT(int)
+clearok(WINDOW *win, bool flag)
+{
+    T((T_CALLED("clearok(%p,%d)"), win, flag));
+
+    if (win) {
+	win->_clear = flag;
+	returnCode(OK);
+    } else
+	returnCode(ERR);
+}
diff --git a/ncurses/base/lib_clrbot.c b/ncurses/base/lib_clrbot.c
new file mode 100644
index 0000000..df196e8
--- /dev/null
+++ b/ncurses/base/lib_clrbot.c
@@ -0,0 +1,76 @@
+/****************************************************************************
+ * Copyright (c) 1998-2001,2006 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ ****************************************************************************/
+
+/*
+**	lib_clrbot.c
+**
+**	The routine wclrtobot().
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_clrbot.c,v 1.20 2006/10/14 20:43:31 tom Exp $")
+
+NCURSES_EXPORT(int)
+wclrtobot(WINDOW *win)
+{
+    int code = ERR;
+
+    T((T_CALLED("wclrtobot(%p)"), win));
+
+    if (win) {
+	NCURSES_SIZE_T y;
+	NCURSES_SIZE_T startx = win->_curx;
+	NCURSES_CH_T blank = win->_nc_bkgd;
+
+	T(("clearing from y = %ld to y = %ld with maxx =  %ld",
+	   (long) win->_cury, (long) win->_maxy, (long) win->_maxx));
+
+	for (y = win->_cury; y <= win->_maxy; y++) {
+	    struct ldat *line = &(win->_line[y]);
+	    NCURSES_CH_T *ptr = &(line->text[startx]);
+	    NCURSES_CH_T *end = &(line->text[win->_maxx]);
+
+	    CHANGED_TO_EOL(line, startx, win->_maxx);
+
+	    while (ptr <= end)
+		*ptr++ = blank;
+
+	    startx = 0;
+	}
+	_nc_synchook(win);
+	code = OK;
+    }
+    returnCode(code);
+}
diff --git a/ncurses/base/lib_clreol.c b/ncurses/base/lib_clreol.c
new file mode 100644
index 0000000..c46ebd9
--- /dev/null
+++ b/ncurses/base/lib_clreol.c
@@ -0,0 +1,91 @@
+/****************************************************************************
+ * Copyright (c) 1998,1999,2000,2001 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ ****************************************************************************/
+
+/*
+**	lib_clreol.c
+**
+**	The routine wclrtoeol().
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_clreol.c,v 1.21 2001/12/19 01:06:04 tom Exp $")
+
+NCURSES_EXPORT(int)
+wclrtoeol(WINDOW *win)
+{
+    int code = ERR;
+
+    T((T_CALLED("wclrtoeol(%p)"), win));
+
+    if (win) {
+	NCURSES_CH_T blank;
+	NCURSES_CH_T *ptr, *end;
+	struct ldat *line;
+	NCURSES_SIZE_T y = win->_cury;
+	NCURSES_SIZE_T x = win->_curx;
+
+	/*
+	 * If we have just wrapped the cursor, the clear applies to the
+	 * new line, unless we are at the lower right corner.
+	 */
+	if ((win->_flags & _WRAPPED) != 0
+	    && y < win->_maxy) {
+	    win->_flags &= ~_WRAPPED;
+	}
+
+	/*
+	 * There's no point in clearing if we're not on a legal
+	 * position, either.
+	 */
+	if ((win->_flags & _WRAPPED) != 0
+	    || y > win->_maxy
+	    || x > win->_maxx)
+	    returnCode(ERR);
+
+	blank = win->_nc_bkgd;
+	line = &win->_line[y];
+	CHANGED_TO_EOL(line, x, win->_maxx);
+
+	ptr = &(line->text[x]);
+	end = &(line->text[win->_maxx]);
+
+	while (ptr <= end)
+	    *ptr++ = blank;
+
+	_nc_synchook(win);
+	code = OK;
+    }
+    returnCode(code);
+}
diff --git a/ncurses/base/lib_color.c b/ncurses/base/lib_color.c
new file mode 100644
index 0000000..9cae495
--- /dev/null
+++ b/ncurses/base/lib_color.c
@@ -0,0 +1,593 @@
+/****************************************************************************
+ * 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Thomas E. Dickey                        1996-on                 *
+ ****************************************************************************/
+
+/* lib_color.c
+ *
+ * Handles color emulation of SYS V curses
+ */
+
+#include <curses.priv.h>
+
+#include <term.h>
+#include <tic.h>
+
+MODULE_ID("$Id: lib_color.c,v 1.85 2007/04/07 17:07:28 tom Exp $")
+
+/*
+ * These should be screen structure members.  They need to be globals for
+ * historical reasons.  So we assign them in start_color() and also in
+ * set_term()'s screen-switching logic.
+ */
+#if USE_REENTRANT
+NCURSES_EXPORT(int)
+NCURSES_PUBLIC_VAR(COLOR_PAIRS) (void)
+{
+    return SP ? SP->_pair_count : -1;
+}
+NCURSES_EXPORT(int)
+NCURSES_PUBLIC_VAR(COLORS) (void)
+{
+    return SP ? SP->_color_count : -1;
+}
+#else
+NCURSES_EXPORT_VAR(int) COLOR_PAIRS = 0;
+NCURSES_EXPORT_VAR(int) COLORS = 0;
+#endif
+
+#define DATA(r,g,b) {r,g,b, 0,0,0, 0}
+
+#define TYPE_CALLOC(type,elts) typeCalloc(type, (unsigned)(elts))
+
+#define MAX_PALETTE	8
+
+#define OkColorHi(n)	(((n) < COLORS) && ((n) < max_colors))
+#define InPalette(n)	((n) >= 0 && (n) < MAX_PALETTE)
+
+/*
+ * Given a RGB range of 0..1000, we'll normally set the individual values
+ * to about 2/3 of the maximum, leaving full-range for bold/bright colors.
+ */
+#define RGB_ON  680
+#define RGB_OFF 0
+/* *INDENT-OFF* */
+static const color_t cga_palette[] =
+{
+    /*  R               G               B */
+    DATA(RGB_OFF,	RGB_OFF,	RGB_OFF),	/* COLOR_BLACK */
+    DATA(RGB_ON,	RGB_OFF,	RGB_OFF),	/* COLOR_RED */
+    DATA(RGB_OFF,	RGB_ON,		RGB_OFF),	/* COLOR_GREEN */
+    DATA(RGB_ON,	RGB_ON,		RGB_OFF),	/* COLOR_YELLOW */
+    DATA(RGB_OFF,	RGB_OFF,	RGB_ON),	/* COLOR_BLUE */
+    DATA(RGB_ON,	RGB_OFF,	RGB_ON),	/* COLOR_MAGENTA */
+    DATA(RGB_OFF,	RGB_ON,		RGB_ON),	/* COLOR_CYAN */
+    DATA(RGB_ON,	RGB_ON,		RGB_ON),	/* COLOR_WHITE */
+};
+
+static const color_t hls_palette[] =
+{
+    /*  	H       L       S */
+    DATA(	0,	0,	0),		/* COLOR_BLACK */
+    DATA(	120,	50,	100),		/* COLOR_RED */
+    DATA(	240,	50,	100),		/* COLOR_GREEN */
+    DATA(	180,	50,	100),		/* COLOR_YELLOW */
+    DATA(	330,	50,	100),		/* COLOR_BLUE */
+    DATA(	60,	50,	100),		/* COLOR_MAGENTA */
+    DATA(	300,	50,	100),		/* COLOR_CYAN */
+    DATA(	0,	50,	100),		/* COLOR_WHITE */
+};
+/* *INDENT-ON* */
+
+#if NCURSES_EXT_FUNCS
+/*
+ * These are called from _nc_do_color(), which in turn is called from
+ * vidattr - so we have to assume that SP may be null.
+ */
+static int
+default_fg(void)
+{
+    return (SP != 0) ? SP->_default_fg : COLOR_WHITE;
+}
+
+static int
+default_bg(void)
+{
+    return SP != 0 ? SP->_default_bg : COLOR_BLACK;
+}
+#else
+#define default_fg() COLOR_WHITE
+#define default_bg() COLOR_BLACK
+#endif
+
+/*
+ * SVr4 curses is known to interchange color codes (1,4) and (3,6), possibly
+ * to maintain compatibility with a pre-ANSI scheme.  The same scheme is
+ * also used in the FreeBSD syscons.
+ */
+static int
+toggled_colors(int c)
+{
+    if (c < 16) {
+	static const int table[] =
+	{0, 4, 2, 6, 1, 5, 3, 7,
+	 8, 12, 10, 14, 9, 13, 11, 15};
+	c = table[c];
+    }
+    return c;
+}
+
+static void
+set_background_color(int bg, int (*outc) (int))
+{
+    if (set_a_background) {
+	TPUTS_TRACE("set_a_background");
+	tputs(TPARM_1(set_a_background, bg), 1, outc);
+    } else {
+	TPUTS_TRACE("set_background");
+	tputs(TPARM_1(set_background, toggled_colors(bg)), 1, outc);
+    }
+}
+
+static void
+set_foreground_color(int fg, int (*outc) (int))
+{
+    if (set_a_foreground) {
+	TPUTS_TRACE("set_a_foreground");
+	tputs(TPARM_1(set_a_foreground, fg), 1, outc);
+    } else {
+	TPUTS_TRACE("set_foreground");
+	tputs(TPARM_1(set_foreground, toggled_colors(fg)), 1, outc);
+    }
+}
+
+static void
+init_color_table(void)
+{
+    const color_t *tp;
+    int n;
+
+    tp = (hue_lightness_saturation) ? hls_palette : cga_palette;
+    for (n = 0; n < COLORS; n++) {
+	if (InPalette(n)) {
+	    SP->_color_table[n] = tp[n];
+	} else {
+	    SP->_color_table[n] = tp[n % MAX_PALETTE];
+	    if (hue_lightness_saturation) {
+		SP->_color_table[n].green = 100;
+	    } else {
+		if (SP->_color_table[n].red)
+		    SP->_color_table[n].red = 1000;
+		if (SP->_color_table[n].green)
+		    SP->_color_table[n].green = 1000;
+		if (SP->_color_table[n].blue)
+		    SP->_color_table[n].blue = 1000;
+	    }
+	}
+    }
+}
+
+/*
+ * Reset the color pair, e.g., to whatever color pair 0 is.
+ */
+static bool
+reset_color_pair(void)
+{
+    bool result = FALSE;
+
+    if (orig_pair != 0) {
+	TPUTS_TRACE("orig_pair");
+	putp(orig_pair);
+	result = TRUE;
+    }
+    return result;
+}
+
+/*
+ * Reset color pairs and definitions.  Actually we do both more to accommodate
+ * badly-written terminal descriptions than for the relatively rare case where
+ * someone has changed the color definitions.
+ */
+bool
+_nc_reset_colors(void)
+{
+    int result = FALSE;
+
+    T((T_CALLED("_nc_reset_colors()")));
+    if (SP->_color_defs > 0)
+	SP->_color_defs = -(SP->_color_defs);
+
+    if (reset_color_pair())
+	result = TRUE;
+    if (orig_colors != 0) {
+	TPUTS_TRACE("orig_colors");
+	putp(orig_colors);
+	result = TRUE;
+    }
+    returnBool(result);
+}
+
+NCURSES_EXPORT(int)
+start_color(void)
+{
+    int result = ERR;
+
+    T((T_CALLED("start_color()")));
+
+    if (SP == 0) {
+	result = ERR;
+    } else if (SP->_coloron) {
+	result = OK;
+    } else {
+
+	if (reset_color_pair() != TRUE) {
+	    set_foreground_color(default_fg(), _nc_outch);
+	    set_background_color(default_bg(), _nc_outch);
+	}
+
+	if (max_pairs > 0 && max_colors > 0) {
+	    SP->_pair_count = max_pairs;
+	    SP->_color_count = max_colors;
+#if !USE_REENTRANT
+	    COLOR_PAIRS = max_pairs;
+	    COLORS = max_colors;
+#endif
+
+	    if ((SP->_color_pairs = TYPE_CALLOC(colorpair_t,
+						max_pairs)) != 0) {
+		if ((SP->_color_table = TYPE_CALLOC(color_t,
+						    max_colors)) != 0) {
+		    SP->_color_pairs[0] = PAIR_OF(default_fg(), default_bg());
+		    init_color_table();
+
+		    T(("started color: COLORS = %d, COLOR_PAIRS = %d",
+		       COLORS, COLOR_PAIRS));
+
+		    SP->_coloron = 1;
+		    result = OK;
+		} else if (SP->_color_pairs != 0) {
+		    FreeAndNull(SP->_color_pairs);
+		}
+	    }
+	} else {
+	    result = OK;
+	}
+    }
+    returnCode(result);
+}
+
+/* This function was originally written by Daniel Weaver <danw@znyx.com> */
+static void
+rgb2hls(short r, short g, short b, short *h, short *l, short *s)
+/* convert RGB to HLS system */
+{
+    short min, max, t;
+
+    if ((min = g < r ? g : r) > b)
+	min = b;
+    if ((max = g > r ? g : r) < b)
+	max = b;
+
+    /* calculate lightness */
+    *l = (min + max) / 20;
+
+    if (min == max) {		/* black, white and all shades of gray */
+	*h = 0;
+	*s = 0;
+	return;
+    }
+
+    /* calculate saturation */
+    if (*l < 50)
+	*s = ((max - min) * 100) / (max + min);
+    else
+	*s = ((max - min) * 100) / (2000 - max - min);
+
+    /* calculate hue */
+    if (r == max)
+	t = 120 + ((g - b) * 60) / (max - min);
+    else if (g == max)
+	t = 240 + ((b - r) * 60) / (max - min);
+    else
+	t = 360 + ((r - g) * 60) / (max - min);
+
+    *h = t % 360;
+}
+
+/*
+ * Extension (1997/1/18) - Allow negative f/b values to set default color
+ * values.
+ */
+NCURSES_EXPORT(int)
+init_pair(short pair, short f, short b)
+{
+    colorpair_t result;
+
+    T((T_CALLED("init_pair(%d,%d,%d)"), pair, f, b));
+
+    if ((pair < 0) || (pair >= COLOR_PAIRS) || SP == 0 || !SP->_coloron)
+	returnCode(ERR);
+#if NCURSES_EXT_FUNCS
+    if (SP->_default_color) {
+	if (f < 0)
+	    f = COLOR_DEFAULT;
+	if (b < 0)
+	    b = COLOR_DEFAULT;
+	if (!OkColorHi(f) && !isDefaultColor(f))
+	    returnCode(ERR);
+	if (!OkColorHi(b) && !isDefaultColor(b))
+	    returnCode(ERR);
+    } else
+#endif
+    {
+	if ((f < 0) || !OkColorHi(f)
+	    || (b < 0) || !OkColorHi(b)
+	    || (pair < 1))
+	    returnCode(ERR);
+    }
+
+    /*
+     * When a pair's content is changed, replace its colors (if pair was
+     * initialized before a screen update is performed replacing original
+     * pair colors with the new ones).
+     */
+    result = PAIR_OF(f, b);
+    if (SP->_color_pairs[pair] != 0
+	&& SP->_color_pairs[pair] != result) {
+	int y, x;
+
+	for (y = 0; y <= curscr->_maxy; y++) {
+	    struct ldat *ptr = &(curscr->_line[y]);
+	    bool changed = FALSE;
+	    for (x = 0; x <= curscr->_maxx; x++) {
+		if (GetPair(ptr->text[x]) == pair) {
+		    /* Set the old cell to zero to ensure it will be
+		       updated on the next doupdate() */
+		    SetChar(ptr->text[x], 0, 0);
+		    CHANGED_CELL(ptr, x);
+		    changed = TRUE;
+		}
+	    }
+	    if (changed)
+		_nc_make_oldhash(y);
+	}
+    }
+    SP->_color_pairs[pair] = result;
+    if (GET_SCREEN_PAIR(SP) == pair)
+	SET_SCREEN_PAIR(SP, (chtype) (~0));	/* force attribute update */
+
+    if (initialize_pair && InPalette(f) && InPalette(b)) {
+	const color_t *tp = hue_lightness_saturation ? hls_palette : cga_palette;
+
+	TR(TRACE_ATTRS,
+	   ("initializing pair: pair = %d, fg=(%d,%d,%d), bg=(%d,%d,%d)",
+	    pair,
+	    tp[f].red, tp[f].green, tp[f].blue,
+	    tp[b].red, tp[b].green, tp[b].blue));
+
+	TPUTS_TRACE("initialize_pair");
+	putp(TPARM_7(initialize_pair,
+		     pair,
+		     tp[f].red, tp[f].green, tp[f].blue,
+		     tp[b].red, tp[b].green, tp[b].blue));
+    }
+
+    returnCode(OK);
+}
+
+#define okRGB(n) ((n) >= 0 && (n) <= 1000)
+
+NCURSES_EXPORT(int)
+init_color(short color, short r, short g, short b)
+{
+    int result = ERR;
+
+    T((T_CALLED("init_color(%d,%d,%d,%d)"), color, r, g, b));
+
+    if (initialize_color != NULL
+	&& SP != 0
+	&& SP->_coloron
+	&& (color >= 0 && OkColorHi(color))
+	&& (okRGB(r) && okRGB(g) && okRGB(b))) {
+
+	SP->_color_table[color].init = 1;
+	SP->_color_table[color].r = r;
+	SP->_color_table[color].g = g;
+	SP->_color_table[color].b = b;
+
+	if (hue_lightness_saturation) {
+	    rgb2hls(r, g, b,
+		    &SP->_color_table[color].red,
+		    &SP->_color_table[color].green,
+		    &SP->_color_table[color].blue);
+	} else {
+	    SP->_color_table[color].red = r;
+	    SP->_color_table[color].green = g;
+	    SP->_color_table[color].blue = b;
+	}
+
+	TPUTS_TRACE("initialize_color");
+	putp(TPARM_4(initialize_color, color, r, g, b));
+	SP->_color_defs = max(color + 1, SP->_color_defs);
+	result = OK;
+    }
+    returnCode(result);
+}
+
+NCURSES_EXPORT(bool)
+can_change_color(void)
+{
+    T((T_CALLED("can_change_color()")));
+    returnCode((can_change != 0) ? TRUE : FALSE);
+}
+
+NCURSES_EXPORT(bool)
+has_colors(void)
+{
+    T((T_CALLED("has_colors()")));
+    returnCode((VALID_NUMERIC(max_colors) && VALID_NUMERIC(max_pairs)
+		&& (((set_foreground != NULL)
+		     && (set_background != NULL))
+		    || ((set_a_foreground != NULL)
+			&& (set_a_background != NULL))
+		    || set_color_pair)) ? TRUE : FALSE);
+}
+
+NCURSES_EXPORT(int)
+color_content(short color, short *r, short *g, short *b)
+{
+    int result;
+
+    T((T_CALLED("color_content(%d,%p,%p,%p)"), color, r, g, b));
+    if (color < 0 || !OkColorHi(color) || SP == 0 || !SP->_coloron) {
+	result = ERR;
+    } else {
+	NCURSES_COLOR_T c_r = SP->_color_table[color].red;
+	NCURSES_COLOR_T c_g = SP->_color_table[color].green;
+	NCURSES_COLOR_T c_b = SP->_color_table[color].blue;
+
+	if (r)
+	    *r = c_r;
+	if (g)
+	    *g = c_g;
+	if (b)
+	    *b = c_b;
+
+	TR(TRACE_ATTRS, ("...color_content(%d,%d,%d,%d)",
+			 color, c_r, c_g, c_b));
+	result = OK;
+    }
+    returnCode(result);
+}
+
+NCURSES_EXPORT(int)
+pair_content(short pair, short *f, short *b)
+{
+    int result;
+
+    T((T_CALLED("pair_content(%d,%p,%p)"), pair, f, b));
+
+    if ((pair < 0) || (pair >= COLOR_PAIRS) || SP == 0 || !SP->_coloron) {
+	result = ERR;
+    } else {
+	NCURSES_COLOR_T fg = ((SP->_color_pairs[pair] >> C_SHIFT) & C_MASK);
+	NCURSES_COLOR_T bg = (SP->_color_pairs[pair] & C_MASK);
+
+#if NCURSES_EXT_FUNCS
+	if (fg == COLOR_DEFAULT)
+	    fg = -1;
+	if (bg == COLOR_DEFAULT)
+	    bg = -1;
+#endif
+
+	if (f)
+	    *f = fg;
+	if (b)
+	    *b = bg;
+
+	TR(TRACE_ATTRS, ("...pair_content(%d,%d,%d)", pair, fg, bg));
+	result = OK;
+    }
+    returnCode(result);
+}
+
+NCURSES_EXPORT(void)
+_nc_do_color(short old_pair, short pair, bool reverse, int (*outc) (int))
+{
+    NCURSES_COLOR_T fg = COLOR_DEFAULT;
+    NCURSES_COLOR_T bg = COLOR_DEFAULT;
+    NCURSES_COLOR_T old_fg, old_bg;
+
+    if (pair < 0 || pair >= COLOR_PAIRS) {
+	return;
+    } else if (pair != 0) {
+	if (set_color_pair) {
+	    TPUTS_TRACE("set_color_pair");
+	    tputs(TPARM_1(set_color_pair, pair), 1, outc);
+	    return;
+	} else if (SP != 0) {
+	    pair_content((short) pair, &fg, &bg);
+	}
+    }
+
+    if (old_pair >= 0
+	&& SP != 0
+	&& pair_content(old_pair, &old_fg, &old_bg) != ERR) {
+	if ((isDefaultColor(fg) && !isDefaultColor(old_fg))
+	    || (isDefaultColor(bg) && !isDefaultColor(old_bg))) {
+#if NCURSES_EXT_FUNCS
+	    /*
+	     * A minor optimization - but extension.  If "AX" is specified in
+	     * the terminal description, treat it as screen's indicator of ECMA
+	     * SGR 39 and SGR 49, and assume the two sequences are independent.
+	     */
+	    if (SP->_has_sgr_39_49
+		&& isDefaultColor(old_bg)
+		&& !isDefaultColor(old_fg)) {
+		tputs("\033[39m", 1, outc);
+	    } else if (SP->_has_sgr_39_49
+		       && isDefaultColor(old_fg)
+		       && !isDefaultColor(old_bg)) {
+		tputs("\033[49m", 1, outc);
+	    } else
+#endif
+		reset_color_pair();
+	}
+    } else {
+	reset_color_pair();
+	if (old_pair < 0)
+	    return;
+    }
+
+#if NCURSES_EXT_FUNCS
+    if (isDefaultColor(fg))
+	fg = default_fg();
+    if (isDefaultColor(bg))
+	bg = default_bg();
+#endif
+
+    if (reverse) {
+	NCURSES_COLOR_T xx = fg;
+	fg = bg;
+	bg = xx;
+    }
+
+    TR(TRACE_ATTRS, ("setting colors: pair = %d, fg = %d, bg = %d", pair,
+		     fg, bg));
+
+    if (!isDefaultColor(fg)) {
+	set_foreground_color(fg, outc);
+    }
+    if (!isDefaultColor(bg)) {
+	set_background_color(bg, outc);
+    }
+}
diff --git a/ncurses/base/lib_colorset.c b/ncurses/base/lib_colorset.c
new file mode 100644
index 0000000..a973c53
--- /dev/null
+++ b/ncurses/base/lib_colorset.c
@@ -0,0 +1,60 @@
+/****************************************************************************
+ * Copyright (c) 1998-2003,2005 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: Juergen Pfeifer,  1998                                          *
+ *     and: Thomas E. Dickey, 2005                                          *
+ ****************************************************************************/
+
+/*
+**	lib_colorset.c
+**
+**	The routine wcolor_set().
+**
+*/
+
+#include <curses.priv.h>
+#include <ctype.h>
+
+MODULE_ID("$Id: lib_colorset.c,v 1.11 2005/01/29 21:40:51 tom Exp $")
+
+NCURSES_EXPORT(int)
+wcolor_set(WINDOW *win, short color_pair_number, void *opts)
+{
+    T((T_CALLED("wcolor_set(%p,%d)"), win, color_pair_number));
+    if (win
+	&& !opts
+	&& (color_pair_number >= 0)
+	&& (color_pair_number < COLOR_PAIRS)) {
+	TR(TRACE_ATTRS, ("... current %ld", (long) GET_WINDOW_PAIR(win)));
+	SET_WINDOW_PAIR(win, color_pair_number);
+	if_EXT_COLORS(win->_color = color_pair_number);
+	returnCode(OK);
+    } else
+	returnCode(ERR);
+}
diff --git a/ncurses/base/lib_delch.c b/ncurses/base/lib_delch.c
new file mode 100644
index 0000000..0c30f2d
--- /dev/null
+++ b/ncurses/base/lib_delch.c
@@ -0,0 +1,69 @@
+/****************************************************************************
+ * Copyright (c) 1998,2000,2001 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ ****************************************************************************/
+
+/*
+**	lib_delch.c
+**
+**	The routine wdelch().
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_delch.c,v 1.12 2001/12/19 01:06:09 tom Exp $")
+
+NCURSES_EXPORT(int)
+wdelch(WINDOW *win)
+{
+    int code = ERR;
+
+    T((T_CALLED("wdelch(%p)"), win));
+
+    if (win) {
+	NCURSES_CH_T blank = win->_nc_bkgd;
+	struct ldat *line = &(win->_line[win->_cury]);
+	NCURSES_CH_T *end = &(line->text[win->_maxx]);
+	NCURSES_CH_T *temp2 = &(line->text[win->_curx + 1]);
+	NCURSES_CH_T *temp1 = temp2 - 1;
+
+	CHANGED_TO_EOL(line, win->_curx, win->_maxx);
+	while (temp1 < end)
+	    *temp1++ = *temp2++;
+
+	*temp1 = blank;
+
+	_nc_synchook(win);
+	code = OK;
+    }
+    returnCode(code);
+}
diff --git a/ncurses/base/lib_delwin.c b/ncurses/base/lib_delwin.c
new file mode 100644
index 0000000..b92c403
--- /dev/null
+++ b/ncurses/base/lib_delwin.c
@@ -0,0 +1,86 @@
+/****************************************************************************
+ * Copyright (c) 1998-2007,2008 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ ****************************************************************************/
+
+/*
+**	lib_delwin.c
+**
+**	The routine delwin().
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_delwin.c,v 1.17 2008/06/07 14:10:56 tom Exp $")
+
+static bool
+cannot_delete(WINDOW *win)
+{
+    WINDOWLIST *p;
+    bool result = TRUE;
+
+    for (each_window(p)) {
+	if (&(p->win) == win) {
+	    result = FALSE;
+	} else if ((p->win._flags & _SUBWIN) != 0
+		   && p->win._parent == win) {
+	    result = TRUE;
+	    break;
+	}
+    }
+    return result;
+}
+
+NCURSES_EXPORT(int)
+delwin(WINDOW *win)
+{
+    int result = ERR;
+
+    T((T_CALLED("delwin(%p)"), win));
+
+    if (_nc_try_global(curses) == 0) {
+	if (win == 0
+	    || cannot_delete(win)) {
+	    result = ERR;
+	} else {
+
+	    if (win->_flags & _SUBWIN)
+		touchwin(win->_parent);
+	    else if (curscr != 0)
+		touchwin(curscr);
+
+	    result = _nc_freewin(win);
+	}
+	_nc_unlock_global(curses);
+    }
+    returnCode(result);
+}
diff --git a/ncurses/base/lib_dft_fgbg.c b/ncurses/base/lib_dft_fgbg.c
new file mode 100644
index 0000000..8953c14
--- /dev/null
+++ b/ncurses/base/lib_dft_fgbg.c
@@ -0,0 +1,75 @@
+/****************************************************************************
+ * Copyright (c) 1998-2004,2005 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                                                *
+ ****************************************************************************/
+
+#include <curses.priv.h>
+#include <term.h>
+
+MODULE_ID("$Id: lib_dft_fgbg.c,v 1.18 2005/11/26 20:03:38 tom Exp $")
+
+/*
+ * Modify the behavior of color-pair 0 so that the library doesn't assume that
+ * it is white on black.  This is an extension to XSI curses.
+ */
+NCURSES_EXPORT(int)
+use_default_colors(void)
+{
+    T((T_CALLED("use_default_colors()")));
+    returnCode(assume_default_colors(-1, -1));
+}
+
+/*
+ * Modify the behavior of color-pair 0 so that the library assumes that it
+ * is something specific, possibly not white on black.
+ */
+NCURSES_EXPORT(int)
+assume_default_colors(int fg, int bg)
+{
+    T((T_CALLED("assume_default_colors(%d,%d)"), fg, bg));
+
+    if (!orig_pair && !orig_colors)
+	returnCode(ERR);
+
+    if (initialize_pair)	/* don't know how to handle this */
+	returnCode(ERR);
+
+    SP->_default_color = isDefaultColor(fg) || isDefaultColor(bg);
+    SP->_has_sgr_39_49 = (tigetflag("AX") == TRUE);
+    SP->_default_fg = isDefaultColor(fg) ? COLOR_DEFAULT : (fg & C_MASK);
+    SP->_default_bg = isDefaultColor(bg) ? COLOR_DEFAULT : (bg & C_MASK);
+    if (SP->_color_pairs != 0) {
+	bool save = SP->_default_color;
+	SP->_default_color = TRUE;
+	init_pair(0, (short) fg, (short) bg);
+	SP->_default_color = save;
+    }
+    returnCode(OK);
+}
diff --git a/ncurses/base/lib_echo.c b/ncurses/base/lib_echo.c
new file mode 100644
index 0000000..df44713
--- /dev/null
+++ b/ncurses/base/lib_echo.c
@@ -0,0 +1,61 @@
+/****************************************************************************
+ * Copyright (c) 1998,2000 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ ****************************************************************************/
+
+/*
+ *	echo.c
+ *
+ *	Routines:
+ *		echo()
+ *		noecho()
+ *
+ */
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_echo.c,v 1.5 2000/12/10 02:43:27 tom Exp $")
+
+NCURSES_EXPORT(int)
+echo(void)
+{
+    T((T_CALLED("echo()")));
+    SP->_echo = TRUE;
+    returnCode(OK);
+}
+
+NCURSES_EXPORT(int)
+noecho(void)
+{
+    T((T_CALLED("noecho()")));
+    SP->_echo = FALSE;
+    returnCode(OK);
+}
diff --git a/ncurses/base/lib_endwin.c b/ncurses/base/lib_endwin.c
new file mode 100644
index 0000000..6666287
--- /dev/null
+++ b/ncurses/base/lib_endwin.c
@@ -0,0 +1,60 @@
+/****************************************************************************
+ * Copyright (c) 1998,2000 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ ****************************************************************************/
+
+/*
+**	lib_endwin.c
+**
+**	The routine endwin().
+**
+*/
+
+#include <curses.priv.h>
+#include <term.h>
+
+MODULE_ID("$Id: lib_endwin.c,v 1.19 2000/12/10 02:43:27 tom Exp $")
+
+NCURSES_EXPORT(int)
+endwin(void)
+{
+    T((T_CALLED("endwin()")));
+
+    if (SP) {
+	SP->_endwin = TRUE;
+	SP->_mouse_wrap(SP);
+	_nc_screen_wrap();
+	_nc_mvcur_wrap();	/* wrap up cursor addressing */
+	returnCode(reset_shell_mode());
+    }
+
+    returnCode(ERR);
+}
diff --git a/ncurses/base/lib_erase.c b/ncurses/base/lib_erase.c
new file mode 100644
index 0000000..2566e8b
--- /dev/null
+++ b/ncurses/base/lib_erase.c
@@ -0,0 +1,92 @@
+/****************************************************************************
+ * Copyright (c) 1998,2000,2001 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Thomas E. Dickey                        1996-on                 *
+ ****************************************************************************/
+
+/*
+**	lib_erase.c
+**
+**	The routine werase().
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_erase.c,v 1.16 2005/10/30 00:36:36 tom Exp $")
+
+NCURSES_EXPORT(int)
+werase(WINDOW *win)
+{
+    int code = ERR;
+    int y;
+    NCURSES_CH_T blank;
+    NCURSES_CH_T *sp, *end, *start;
+
+    T((T_CALLED("werase(%p)"), win));
+
+    if (win) {
+	blank = win->_nc_bkgd;
+	for (y = 0; y <= win->_maxy; y++) {
+	    start = win->_line[y].text;
+	    end = &start[win->_maxx];
+
+	    /*
+	     * If this is a derived window, we have to handle the case where
+	     * a multicolumn character extends into the window that we are
+	     * erasing.
+	     */
+	    if_WIDEC({
+		if (isWidecExt(start[0])) {
+		    int x = (win->_parent != 0) ? (win->_begx) : 0;
+		    while (x-- > 0) {
+			if (isWidecBase(start[-1])) {
+			    --start;
+			    break;
+			}
+			--start;
+		    }
+		}
+	    });
+
+	    for (sp = start; sp <= end; sp++)
+		*sp = blank;
+
+	    win->_line[y].firstchar = 0;
+	    win->_line[y].lastchar = win->_maxx;
+	}
+	win->_curx = win->_cury = 0;
+	win->_flags &= ~_WRAPPED;
+	_nc_synchook(win);
+	code = OK;
+    }
+    returnCode(code);
+}
diff --git a/ncurses/base/lib_flash.c b/ncurses/base/lib_flash.c
new file mode 100644
index 0000000..a6b022a
--- /dev/null
+++ b/ncurses/base/lib_flash.c
@@ -0,0 +1,73 @@
+/****************************************************************************
+ * Copyright (c) 1998,2000 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ ****************************************************************************/
+
+/*
+ *	flash.c
+ *
+ *	The routine flash().
+ *
+ */
+
+#include <curses.priv.h>
+#include <term.h>		/* beep, flash */
+
+MODULE_ID("$Id: lib_flash.c,v 1.6 2000/12/10 02:43:27 tom Exp $")
+
+/*
+ *	flash()
+ *
+ *	Flash the current terminal's screen if possible.   If not,
+ *	sound the audible bell if one exists.
+ *
+ */
+
+NCURSES_EXPORT(int)
+flash(void)
+{
+    int res = ERR;
+
+    T((T_CALLED("flash()")));
+
+    /* FIXME: should make sure that we are not in altchar mode */
+    if (flash_screen) {
+	TPUTS_TRACE("flash_screen");
+	res = putp(flash_screen);
+	_nc_flush();
+    } else if (bell) {
+	TPUTS_TRACE("bell");
+	res = putp(bell);
+	_nc_flush();
+    }
+
+    returnCode(res);
+}
diff --git a/ncurses/base/lib_freeall.c b/ncurses/base/lib_freeall.c
new file mode 100644
index 0000000..5640265
--- /dev/null
+++ b/ncurses/base/lib_freeall.c
@@ -0,0 +1,157 @@
+/****************************************************************************
+ * Copyright (c) 1998-2007,2008 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                     *
+ ****************************************************************************/
+
+#include <curses.priv.h>
+#include <term_entry.h>
+#include <tic.h>
+
+#if HAVE_NC_FREEALL
+
+#if HAVE_LIBDBMALLOC
+extern int malloc_errfd;	/* FIXME */
+#endif
+
+MODULE_ID("$Id: lib_freeall.c,v 1.54 2008/09/27 13:09:57 tom Exp $")
+
+/*
+ * Free all ncurses data.  This is used for testing only (there's no practical
+ * use for it as an extension).
+ */
+NCURSES_EXPORT(void)
+_nc_freeall(void)
+{
+    WINDOWLIST *p, *q;
+    static va_list empty_va;
+
+    T((T_CALLED("_nc_freeall()")));
+#if NO_LEAKS
+    if (SP != 0) {
+	if (SP->_oldnum_list != 0) {
+	    FreeAndNull(SP->_oldnum_list);
+	}
+	if (SP->_panelHook.destroy != 0) {
+	    SP->_panelHook.destroy(SP->_panelHook.stdscr_pseudo_panel);
+	}
+    }
+#endif
+    if (SP != 0) {
+	_nc_lock_global(curses);
+
+	while (_nc_windows != 0) {
+	    bool deleted = FALSE;
+
+	    /* Delete only windows that're not a parent */
+	    for (each_window(p)) {
+		bool found = FALSE;
+
+		for (each_window(q)) {
+		    if ((p != q)
+			&& (q->win._flags & _SUBWIN)
+			&& (&(p->win) == q->win._parent)) {
+			found = TRUE;
+			break;
+		    }
+		}
+
+		if (!found) {
+		    if (delwin(&(p->win)) != ERR)
+			deleted = TRUE;
+		    break;
+		}
+	    }
+
+	    /*
+	     * Don't continue to loop if the list is trashed.
+	     */
+	    if (!deleted)
+		break;
+	}
+	delscreen(SP);
+	_nc_unlock_global(curses);
+    }
+    if (cur_term != 0)
+	del_curterm(cur_term);
+
+    (void) _nc_printf_string(0, empty_va);
+#ifdef TRACE
+    (void) _nc_trace_buf(-1, 0);
+#endif
+#if USE_WIDEC_SUPPORT
+    FreeIfNeeded(_nc_wacs);
+#endif
+    _nc_leaks_tinfo();
+
+#if HAVE_LIBDBMALLOC
+    malloc_dump(malloc_errfd);
+#elif HAVE_LIBDMALLOC
+#elif HAVE_LIBMPATROL
+    __mp_summary();
+#elif HAVE_PURIFY
+    purify_all_inuse();
+#endif
+    returnVoid;
+}
+
+NCURSES_EXPORT(void)
+_nc_free_and_exit(int code)
+{
+    char *last_setbuf = (SP != 0) ? SP->_setbuf : 0;
+
+    _nc_freeall();
+#ifdef TRACE
+    trace(0);			/* close trace file, freeing its setbuf */
+    {
+	static va_list fake;
+	free(_nc_varargs("?", fake));
+    }
+#endif
+    fclose(stdout);
+    FreeIfNeeded(last_setbuf);
+    exit(code);
+}
+
+#else
+NCURSES_EXPORT(void)
+_nc_freeall(void)
+{
+}
+
+NCURSES_EXPORT(void)
+_nc_free_and_exit(int code)
+{
+    if (SP)
+	delscreen(SP);
+    if (cur_term != 0)
+	del_curterm(cur_term);
+    exit(code);
+}
+#endif
diff --git a/ncurses/base/lib_getch.c b/ncurses/base/lib_getch.c
new file mode 100644
index 0000000..a3812be
--- /dev/null
+++ b/ncurses/base/lib_getch.c
@@ -0,0 +1,664 @@
+/****************************************************************************
+ * Copyright (c) 1998-2007,2008 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Thomas E. Dickey                        1996-on                 *
+ ****************************************************************************/
+
+/*
+**	lib_getch.c
+**
+**	The routine getch().
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_getch.c,v 1.99 2008/09/20 19:46:13 tom Exp $")
+
+#include <fifo_defs.h>
+
+#if USE_REENTRANT
+#define GetEscdelay(sp) (sp)->_ESCDELAY
+NCURSES_EXPORT(int)
+NCURSES_PUBLIC_VAR(ESCDELAY) (void)
+{
+    return SP ? GetEscdelay(SP) : 1000;
+}
+#else
+#define GetEscdelay(sp) ESCDELAY
+NCURSES_EXPORT_VAR(int)
+ESCDELAY = 1000;		/* max interval betw. chars in funkeys, in millisecs */
+#endif
+
+#if NCURSES_EXT_FUNCS
+NCURSES_EXPORT(int)
+set_escdelay(int value)
+{
+    int code = OK;
+#if USE_REENTRANT
+    if (SP) {
+	SP->_ESCDELAY = value;
+    } else {
+	code = ERR;
+    }
+#else
+    ESCDELAY = value;
+#endif
+    return code;
+}
+#endif
+
+static int
+_nc_use_meta(WINDOW *win)
+{
+    SCREEN *sp = _nc_screen_of(win);
+    return (sp ? sp->_use_meta : 0);
+}
+
+#ifdef NCURSES_WGETCH_EVENTS
+#define TWAIT_MASK 7
+#else
+#define TWAIT_MASK 3
+#endif
+
+/*
+ * Check for mouse activity, returning nonzero if we find any.
+ */
+static int
+check_mouse_activity(SCREEN *sp, int delay EVENTLIST_2nd(_nc_eventlist * evl))
+{
+    int rc;
+
+#if USE_SYSMOUSE
+    if ((sp->_mouse_type == M_SYSMOUSE)
+	&& (sp->_sysmouse_head < sp->_sysmouse_tail)) {
+	return 2;
+    }
+#endif
+    rc = _nc_timed_wait(sp, TWAIT_MASK, delay, (int *) 0 EVENTLIST_2nd(evl));
+#if USE_SYSMOUSE
+    if ((sp->_mouse_type == M_SYSMOUSE)
+	&& (sp->_sysmouse_head < sp->_sysmouse_tail)
+	&& (rc == 0)
+	&& (errno == EINTR)) {
+	rc |= 2;
+    }
+#endif
+    return rc;
+}
+
+static NCURSES_INLINE int
+fifo_peek(SCREEN *sp)
+{
+    int ch = sp->_fifo[peek];
+    TR(TRACE_IEVENT, ("peeking at %d", peek));
+
+    p_inc();
+    return ch;
+}
+
+static NCURSES_INLINE int
+fifo_pull(SCREEN *sp)
+{
+    int ch;
+    ch = sp->_fifo[head];
+    TR(TRACE_IEVENT, ("pulling %s from %d", _nc_tracechar(sp, ch), head));
+
+    if (peek == head) {
+	h_inc();
+	peek = head;
+    } else
+	h_inc();
+
+#ifdef TRACE
+    if (USE_TRACEF(TRACE_IEVENT)) {
+	_nc_fifo_dump(sp);
+	_nc_unlock_global(tracef);
+    }
+#endif
+    return ch;
+}
+
+static NCURSES_INLINE int
+fifo_push(SCREEN *sp EVENTLIST_2nd(_nc_eventlist * evl))
+{
+    int n;
+    int ch = 0;
+    int mask = 0;
+
+    (void) mask;
+    if (tail == -1)
+	return ERR;
+
+#ifdef HIDE_EINTR
+  again:
+    errno = 0;
+#endif
+
+#ifdef NCURSES_WGETCH_EVENTS
+    if (evl
+#if USE_GPM_SUPPORT || USE_EMX_MOUSE || USE_SYSMOUSE
+	|| (sp->_mouse_fd >= 0)
+#endif
+	) {
+	mask = check_mouse_activity(sp, -1 EVENTLIST_2nd(evl));
+    } else
+	mask = 0;
+
+    if (mask & 4) {
+	T(("fifo_push: ungetch KEY_EVENT"));
+	_nc_ungetch(sp, KEY_EVENT);
+	return KEY_EVENT;
+    }
+#elif USE_GPM_SUPPORT || USE_EMX_MOUSE || USE_SYSMOUSE
+    if (sp->_mouse_fd >= 0) {
+	mask = check_mouse_activity(sp, -1 EVENTLIST_2nd(evl));
+    }
+#endif
+
+#if USE_GPM_SUPPORT || USE_EMX_MOUSE
+    if ((sp->_mouse_fd >= 0) && (mask & 2)) {
+	sp->_mouse_event(sp);
+	ch = KEY_MOUSE;
+	n = 1;
+    } else
+#endif
+#if USE_SYSMOUSE
+	if ((sp->_mouse_type == M_SYSMOUSE)
+	    && (sp->_sysmouse_head < sp->_sysmouse_tail)) {
+	sp->_mouse_event(sp);
+	ch = KEY_MOUSE;
+	n = 1;
+    } else if ((sp->_mouse_type == M_SYSMOUSE)
+	       && (mask <= 0) && errno == EINTR) {
+	sp->_mouse_event(sp);
+	ch = KEY_MOUSE;
+	n = 1;
+    } else
+#endif
+    {				/* Can block... */
+	unsigned char c2 = 0;
+	n = read(sp->_ifd, &c2, 1);
+	ch = c2;
+    }
+
+#ifdef HIDE_EINTR
+    /*
+     * Under System V curses with non-restarting signals, getch() returns
+     * with value ERR when a handled signal keeps it from completing.
+     * If signals restart system calls, OTOH, the signal is invisible
+     * except to its handler.
+     *
+     * We don't want this difference to show.  This piece of code
+     * tries to make it look like we always have restarting signals.
+     */
+    if (n <= 0 && errno == EINTR)
+	goto again;
+#endif
+
+    if ((n == -1) || (n == 0)) {
+	TR(TRACE_IEVENT, ("read(%d,&ch,1)=%d, errno=%d", sp->_ifd, n, errno));
+	ch = ERR;
+    }
+    TR(TRACE_IEVENT, ("read %d characters", n));
+
+    sp->_fifo[tail] = ch;
+    sp->_fifohold = 0;
+    if (head == -1)
+	head = peek = tail;
+    t_inc();
+    TR(TRACE_IEVENT, ("pushed %s at %d", _nc_tracechar(sp, ch), tail));
+#ifdef TRACE
+    if (USE_TRACEF(TRACE_IEVENT)) {
+	_nc_fifo_dump(sp);
+	_nc_unlock_global(tracef);
+    }
+#endif
+    return ch;
+}
+
+static NCURSES_INLINE void
+fifo_clear(SCREEN *sp)
+{
+    memset(sp->_fifo, 0, sizeof(sp->_fifo));
+    head = -1;
+    tail = peek = 0;
+}
+
+static int kgetch(SCREEN *EVENTLIST_2nd(_nc_eventlist * evl));
+
+static void
+recur_wrefresh(WINDOW *win)
+{
+#ifdef USE_PTHREADS
+    SCREEN *sp = _nc_screen_of(win);
+    if (_nc_use_pthreads && sp != SP) {
+	SCREEN *save_SP;
+
+	/* temporarily switch to the window's screen to check/refresh */
+	_nc_lock_global(curses);
+	save_SP = SP;
+	_nc_set_screen(sp);
+	recur_wrefresh(win);
+	_nc_set_screen(save_SP);
+	_nc_unlock_global(curses);
+    } else
+#endif
+	if ((is_wintouched(win) || (win->_flags & _HASMOVED))
+	    && !(win->_flags & _ISPAD)) {
+	wrefresh(win);
+    }
+}
+
+static int
+recur_wgetnstr(WINDOW *win, char *buf)
+{
+    SCREEN *sp = _nc_screen_of(win);
+    int rc;
+
+    if (sp != 0) {
+#ifdef USE_PTHREADS
+	if (_nc_use_pthreads && sp != SP) {
+	    SCREEN *save_SP;
+
+	    /* temporarily switch to the window's screen to get cooked input */
+	    _nc_lock_global(curses);
+	    save_SP = SP;
+	    _nc_set_screen(sp);
+	    rc = recur_wgetnstr(win, buf);
+	    _nc_set_screen(save_SP);
+	    _nc_unlock_global(curses);
+	} else
+#endif
+	{
+	    sp->_called_wgetch = TRUE;
+	    rc = wgetnstr(win, buf, MAXCOLUMNS);
+	    sp->_called_wgetch = FALSE;
+	}
+    } else {
+	rc = ERR;
+    }
+    return rc;
+}
+
+NCURSES_EXPORT(int)
+_nc_wgetch(WINDOW *win,
+	   unsigned long *result,
+	   int use_meta
+	   EVENTLIST_2nd(_nc_eventlist * evl))
+{
+    SCREEN *sp;
+    int ch;
+#ifdef NCURSES_WGETCH_EVENTS
+    long event_delay = -1;
+#endif
+
+    T((T_CALLED("_nc_wgetch(%p)"), win));
+
+    *result = 0;
+
+    sp = _nc_screen_of(win);
+    if (win == 0 || sp == 0) {
+	returnCode(ERR);
+    }
+
+    if (cooked_key_in_fifo()) {
+	recur_wrefresh(win);
+	*result = fifo_pull(sp);
+	returnCode(*result >= KEY_MIN ? KEY_CODE_YES : OK);
+    }
+#ifdef NCURSES_WGETCH_EVENTS
+    if (evl && (evl->count == 0))
+	evl = NULL;
+    event_delay = _nc_eventlist_timeout(evl);
+#endif
+
+    /*
+     * Handle cooked mode.  Grab a string from the screen,
+     * stuff its contents in the FIFO queue, and pop off
+     * the first character to return it.
+     */
+    if (head == -1 &&
+	!sp->_notty &&
+	!sp->_raw &&
+	!sp->_cbreak &&
+	!sp->_called_wgetch) {
+	char buf[MAXCOLUMNS], *bufp;
+	int rc;
+
+	TR(TRACE_IEVENT, ("filling queue in cooked mode"));
+
+	rc = recur_wgetnstr(win, buf);
+
+	/* ungetch in reverse order */
+#ifdef NCURSES_WGETCH_EVENTS
+	if (rc != KEY_EVENT)
+#endif
+	    _nc_ungetch(sp, '\n');
+	for (bufp = buf + strlen(buf); bufp > buf; bufp--)
+	    _nc_ungetch(sp, bufp[-1]);
+
+#ifdef NCURSES_WGETCH_EVENTS
+	/* Return it first */
+	if (rc == KEY_EVENT) {
+	    *result = rc;
+	} else
+#endif
+	    *result = fifo_pull(sp);
+	returnCode(*result >= KEY_MIN ? KEY_CODE_YES : OK);
+    }
+
+    if (win->_use_keypad != sp->_keypad_on)
+	_nc_keypad(sp, win->_use_keypad);
+
+    recur_wrefresh(win);
+
+    if (win->_notimeout || (win->_delay >= 0) || (sp->_cbreak > 1)) {
+	if (head == -1) {	/* fifo is empty */
+	    int delay;
+	    int rc;
+
+	    TR(TRACE_IEVENT, ("timed delay in wgetch()"));
+	    if (sp->_cbreak > 1)
+		delay = (sp->_cbreak - 1) * 100;
+	    else
+		delay = win->_delay;
+
+#ifdef NCURSES_WGETCH_EVENTS
+	    if (event_delay >= 0 && delay > event_delay)
+		delay = event_delay;
+#endif
+
+	    TR(TRACE_IEVENT, ("delay is %d milliseconds", delay));
+
+	    rc = check_mouse_activity(sp, delay EVENTLIST_2nd(evl));
+
+#ifdef NCURSES_WGETCH_EVENTS
+	    if (rc & 4) {
+		*result = KEY_EVENT;
+		returnCode(KEY_CODE_YES);
+	    }
+#endif
+	    if (!rc) {
+		returnCode(ERR);
+	    }
+	}
+	/* else go on to read data available */
+    }
+
+    if (win->_use_keypad) {
+	/*
+	 * This is tricky.  We only want to get special-key
+	 * events one at a time.  But we want to accumulate
+	 * mouse events until either (a) the mouse logic tells
+	 * us it's picked up a complete gesture, or (b)
+	 * there's a detectable time lapse after one.
+	 *
+	 * Note: if the mouse code starts failing to compose
+	 * press/release events into clicks, you should probably
+	 * increase the wait with mouseinterval().
+	 */
+	int runcount = 0;
+	int rc;
+
+	do {
+	    ch = kgetch(sp EVENTLIST_2nd(evl));
+	    if (ch == KEY_MOUSE) {
+		++runcount;
+		if (sp->_mouse_inline(sp))
+		    break;
+	    }
+	    if (sp->_maxclick < 0)
+		break;
+	} while
+	    (ch == KEY_MOUSE
+	     && (((rc = check_mouse_activity(sp, sp->_maxclick
+					     EVENTLIST_2nd(evl))) != 0
+		  && !(rc & 4))
+		 || !sp->_mouse_parse(sp, runcount)));
+#ifdef NCURSES_WGETCH_EVENTS
+	if ((rc & 4) && !ch == KEY_EVENT) {
+	    _nc_ungetch(sp, ch);
+	    ch = KEY_EVENT;
+	}
+#endif
+	if (runcount > 0 && ch != KEY_MOUSE) {
+#ifdef NCURSES_WGETCH_EVENTS
+	    /* mouse event sequence ended by an event, report event */
+	    if (ch == KEY_EVENT) {
+		_nc_ungetch(sp, KEY_MOUSE);	/* FIXME This interrupts a gesture... */
+	    } else
+#endif
+	    {
+		/* mouse event sequence ended by keystroke, store keystroke */
+		_nc_ungetch(sp, ch);
+		ch = KEY_MOUSE;
+	    }
+	}
+    } else {
+	if (head == -1)
+	    fifo_push(sp EVENTLIST_2nd(evl));
+	ch = fifo_pull(sp);
+    }
+
+    if (ch == ERR) {
+#if USE_SIZECHANGE
+	if (_nc_handle_sigwinch(sp)) {
+	    _nc_update_screensize(sp);
+	    /* resizeterm can push KEY_RESIZE */
+	    if (cooked_key_in_fifo()) {
+		*result = fifo_pull(sp);
+		returnCode(*result >= KEY_MIN ? KEY_CODE_YES : OK);
+	    }
+	}
+#endif
+	returnCode(ERR);
+    }
+
+    /*
+     * If echo() is in effect, display the printable version of the
+     * key on the screen.  Carriage return and backspace are treated
+     * specially by Solaris curses:
+     *
+     * If carriage return is defined as a function key in the
+     * terminfo, e.g., kent, then Solaris may return either ^J (or ^M
+     * if nonl() is set) or KEY_ENTER depending on the echo() mode. 
+     * We echo before translating carriage return based on nonl(),
+     * since the visual result simply moves the cursor to column 0.
+     *
+     * Backspace is a different matter.  Solaris curses does not
+     * translate it to KEY_BACKSPACE if kbs=^H.  This does not depend
+     * on the stty modes, but appears to be a hardcoded special case.
+     * This is a difference from ncurses, which uses the terminfo entry.
+     * However, we provide the same visual result as Solaris, moving the
+     * cursor to the left.
+     */
+    if (sp->_echo && !(win->_flags & _ISPAD)) {
+	chtype backup = (ch == KEY_BACKSPACE) ? '\b' : ch;
+	if (backup < KEY_MIN)
+	    wechochar(win, backup);
+    }
+
+    /*
+     * Simulate ICRNL mode
+     */
+    if ((ch == '\r') && sp->_nl)
+	ch = '\n';
+
+    /* Strip 8th-bit if so desired.  We do this only for characters that
+     * are in the range 128-255, to provide compatibility with terminals
+     * that display only 7-bit characters.  Note that 'ch' may be a
+     * function key at this point, so we mustn't strip _those_.
+     */
+    if (!use_meta)
+	if ((ch < KEY_MIN) && (ch & 0x80))
+	    ch &= 0x7f;
+
+    T(("wgetch returning : %s", _nc_tracechar(sp, ch)));
+
+    *result = ch;
+    returnCode(ch >= KEY_MIN ? KEY_CODE_YES : OK);
+}
+
+#ifdef NCURSES_WGETCH_EVENTS
+NCURSES_EXPORT(int)
+wgetch_events(WINDOW *win, _nc_eventlist * evl)
+{
+    int code;
+    unsigned long value;
+
+    T((T_CALLED("wgetch_events(%p,%p)"), win, evl));
+    code = _nc_wgetch(win,
+		      &value,
+		      _nc_use_meta(win)
+		      EVENTLIST_2nd(evl));
+    if (code != ERR)
+	code = value;
+    returnCode(code);
+}
+#endif
+
+NCURSES_EXPORT(int)
+wgetch(WINDOW *win)
+{
+    int code;
+    unsigned long value;
+
+    T((T_CALLED("wgetch(%p)"), win));
+    code = _nc_wgetch(win,
+		      &value,
+		      _nc_use_meta(win)
+		      EVENTLIST_2nd((_nc_eventlist *) 0));
+    if (code != ERR)
+	code = value;
+    returnCode(code);
+}
+
+/*
+**      int
+**      kgetch()
+**
+**      Get an input character, but take care of keypad sequences, returning
+**      an appropriate code when one matches the input.  After each character
+**      is received, set an alarm call based on ESCDELAY.  If no more of the
+**      sequence is received by the time the alarm goes off, pass through
+**      the sequence gotten so far.
+**
+**	This function must be called when there are no cooked keys in queue.
+**	(that is head==-1 || peek==head)
+**
+*/
+
+static int
+kgetch(SCREEN *sp EVENTLIST_2nd(_nc_eventlist * evl))
+{
+    TRIES *ptr;
+    int ch = 0;
+    int timeleft = GetEscdelay(sp);
+
+    TR(TRACE_IEVENT, ("kgetch() called"));
+
+    ptr = sp->_keytry;
+
+    for (;;) {
+	if (cooked_key_in_fifo() && sp->_fifo[head] >= KEY_MIN) {
+	    break;
+	} else if (!raw_key_in_fifo()) {
+	    ch = fifo_push(sp EVENTLIST_2nd(evl));
+	    if (ch == ERR) {
+		peek = head;	/* the keys stay uninterpreted */
+		return ERR;
+	    }
+#ifdef NCURSES_WGETCH_EVENTS
+	    else if (ch == KEY_EVENT) {
+		peek = head;	/* the keys stay uninterpreted */
+		return fifo_pull(sp);	/* Remove KEY_EVENT from the queue */
+	    }
+#endif
+	}
+
+	ch = fifo_peek(sp);
+	if (ch >= KEY_MIN) {
+	    /* If not first in queue, somebody put this key there on purpose in
+	     * emergency.  Consider it higher priority than the unfinished
+	     * keysequence we are parsing.
+	     */
+	    peek = head;
+	    /* assume the key is the last in fifo */
+	    t_dec();		/* remove the key */
+	    return ch;
+	}
+
+	TR(TRACE_IEVENT, ("ch: %s", _nc_tracechar(sp, (unsigned char) ch)));
+	while ((ptr != NULL) && (ptr->ch != (unsigned char) ch))
+	    ptr = ptr->sibling;
+
+	if (ptr == NULL) {
+	    TR(TRACE_IEVENT, ("ptr is null"));
+	    break;
+	}
+	TR(TRACE_IEVENT, ("ptr=%p, ch=%d, value=%d",
+			  ptr, ptr->ch, ptr->value));
+
+	if (ptr->value != 0) {	/* sequence terminated */
+	    TR(TRACE_IEVENT, ("end of sequence"));
+	    if (peek == tail)
+		fifo_clear(sp);
+	    else
+		head = peek;
+	    return (ptr->value);
+	}
+
+	ptr = ptr->child;
+
+	if (!raw_key_in_fifo()) {
+	    int rc;
+
+	    TR(TRACE_IEVENT, ("waiting for rest of sequence"));
+	    rc = check_mouse_activity(sp, timeleft EVENTLIST_2nd(evl));
+#ifdef NCURSES_WGETCH_EVENTS
+	    if (rc & 4) {
+		TR(TRACE_IEVENT, ("interrupted by a user event"));
+		/* FIXME Should have preserved remainder timeleft for reuse... */
+		peek = head;	/* Restart interpreting later */
+		return KEY_EVENT;
+	    }
+#endif
+	    if (!rc) {
+		TR(TRACE_IEVENT, ("ran out of time"));
+		break;
+	    }
+	}
+    }
+    ch = fifo_pull(sp);
+    peek = head;
+    return ch;
+}
diff --git a/ncurses/base/lib_getstr.c b/ncurses/base/lib_getstr.c
new file mode 100644
index 0000000..b17df03
--- /dev/null
+++ b/ncurses/base/lib_getstr.c
@@ -0,0 +1,225 @@
+/****************************************************************************
+ * Copyright (c) 1998-2006,2008 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ ****************************************************************************/
+
+/*
+**	lib_getstr.c
+**
+**	The routine wgetstr().
+**
+*/
+
+#include <curses.priv.h>
+#include <term.h>
+
+MODULE_ID("$Id: lib_getstr.c,v 1.27 2008/08/16 19:20:04 tom Exp $")
+
+/*
+ * This wipes out the last character, no matter whether it was a tab, control
+ * or other character, and handles reverse wraparound.
+ */
+static char *
+WipeOut(WINDOW *win, int y, int x, char *first, char *last, bool echoed)
+{
+    if (last > first) {
+	*--last = '\0';
+	if (echoed) {
+	    int y1 = win->_cury;
+	    int x1 = win->_curx;
+
+	    wmove(win, y, x);
+	    waddstr(win, first);
+	    getyx(win, y, x);
+	    while (win->_cury < y1
+		   || (win->_cury == y1 && win->_curx < x1))
+		waddch(win, (chtype) ' ');
+
+	    wmove(win, y, x);
+	}
+    }
+    return last;
+}
+
+NCURSES_EXPORT(int)
+wgetnstr_events(WINDOW *win,
+		char *str,
+		int maxlen,
+		EVENTLIST_1st(_nc_eventlist * evl))
+{
+    SCREEN *sp = _nc_screen_of(win);
+    TTY buf;
+    bool oldnl, oldecho, oldraw, oldcbreak;
+    char erasec;
+    char killc;
+    char *oldstr;
+    int ch;
+    int y, x;
+
+    T((T_CALLED("wgetnstr(%p,%p, %d)"), win, str, maxlen));
+
+    if (!win)
+	returnCode(ERR);
+
+    _nc_get_tty_mode(&buf);
+
+    oldnl = sp->_nl;
+    oldecho = sp->_echo;
+    oldraw = sp->_raw;
+    oldcbreak = sp->_cbreak;
+    nl();
+    noecho();
+    noraw();
+    cbreak();
+
+    erasec = erasechar();
+    killc = killchar();
+
+    oldstr = str;
+    getyx(win, y, x);
+
+    if (is_wintouched(win) || (win->_flags & _HASMOVED))
+	wrefresh(win);
+
+    while ((ch = wgetch_events(win, evl)) != ERR) {
+	/*
+	 * Some terminals (the Wyse-50 is the most common) generate
+	 * a \n from the down-arrow key.  With this logic, it's the
+	 * user's choice whether to set kcud=\n for wgetch();
+	 * terminating *getstr() with \n should work either way.
+	 */
+	if (ch == '\n'
+	    || ch == '\r'
+	    || ch == KEY_DOWN
+	    || ch == KEY_ENTER) {
+	    if (oldecho == TRUE
+		&& win->_cury == win->_maxy
+		&& win->_scroll)
+		wechochar(win, (chtype) '\n');
+	    break;
+	}
+#ifdef KEY_EVENT
+	if (ch == KEY_EVENT)
+	    break;
+#endif
+#ifdef KEY_RESIZE
+	if (ch == KEY_RESIZE)
+	    break;
+#endif
+	if (ch == erasec || ch == KEY_LEFT || ch == KEY_BACKSPACE) {
+	    if (str > oldstr) {
+		str = WipeOut(win, y, x, oldstr, str, oldecho);
+	    }
+	} else if (ch == killc) {
+	    while (str > oldstr) {
+		str = WipeOut(win, y, x, oldstr, str, oldecho);
+	    }
+	} else if (ch >= KEY_MIN
+		   || (maxlen >= 0 && str - oldstr >= maxlen)) {
+	    beep();
+	} else {
+	    *str++ = (char) ch;
+	    if (oldecho == TRUE) {
+		int oldy = win->_cury;
+		if (waddch(win, (chtype) ch) == ERR) {
+		    /*
+		     * We can't really use the lower-right
+		     * corner for input, since it'll mess
+		     * up bookkeeping for erases.
+		     */
+		    win->_flags &= ~_WRAPPED;
+		    waddch(win, (chtype) ' ');
+		    str = WipeOut(win, y, x, oldstr, str, oldecho);
+		    continue;
+		} else if (win->_flags & _WRAPPED) {
+		    /*
+		     * If the last waddch forced a wrap &
+		     * scroll, adjust our reference point
+		     * for erasures.
+		     */
+		    if (win->_scroll
+			&& oldy == win->_maxy
+			&& win->_cury == win->_maxy) {
+			if (--y <= 0) {
+			    y = 0;
+			}
+		    }
+		    win->_flags &= ~_WRAPPED;
+		}
+		wrefresh(win);
+	    }
+	}
+    }
+
+    win->_curx = 0;
+    win->_flags &= ~_WRAPPED;
+    if (win->_cury < win->_maxy)
+	win->_cury++;
+    wrefresh(win);
+
+    /* Restore with a single I/O call, to fix minor asymmetry between
+     * raw/noraw, etc.
+     */
+    sp->_nl = oldnl;
+    sp->_echo = oldecho;
+    sp->_raw = oldraw;
+    sp->_cbreak = oldcbreak;
+
+    _nc_set_tty_mode(&buf);
+
+    *str = '\0';
+    if (ch == ERR)
+	returnCode(ch);
+
+    T(("wgetnstr returns %s", _nc_visbuf(oldstr)));
+
+#ifdef KEY_EVENT
+    if (ch == KEY_EVENT)
+	returnCode(ch);
+#endif
+#ifdef KEY_RESIZE
+    if (ch == KEY_RESIZE)
+	returnCode(ch);
+#endif
+
+    returnCode(OK);
+}
+
+#ifdef NCURSES_WGETCH_EVENTS
+NCURSES_EXPORT(int)
+wgetnstr(WINDOW *win, char *str, int maxlen)
+{
+    returnCode(wgetnstr_events(win,
+			       str,
+			       maxlen,
+			       EVENTLIST_1st((_nc_eventlist *) 0)));
+}
+#endif
diff --git a/ncurses/base/lib_hline.c b/ncurses/base/lib_hline.c
new file mode 100644
index 0000000..2ef2cc5
--- /dev/null
+++ b/ncurses/base/lib_hline.c
@@ -0,0 +1,80 @@
+/****************************************************************************
+ * Copyright (c) 1998-2001,2006 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ ****************************************************************************/
+
+/*
+**	lib_hline.c
+**
+**	The routine whline().
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_hline.c,v 1.11 2006/03/11 21:52:27 tom Exp $")
+
+NCURSES_EXPORT(int)
+whline(WINDOW *win, chtype ch, int n)
+{
+    int code = ERR;
+    NCURSES_SIZE_T start;
+    NCURSES_SIZE_T end;
+
+    T((T_CALLED("whline(%p,%s,%d)"), win, _tracechtype(ch), n));
+
+    if (win) {
+	struct ldat *line = &(win->_line[win->_cury]);
+	NCURSES_CH_T wch;
+
+	start = win->_curx;
+	end = start + n - 1;
+	if (end > win->_maxx)
+	    end = win->_maxx;
+
+	CHANGED_RANGE(line, start, end);
+
+	if (ch == 0)
+	    SetChar2(wch, ACS_HLINE);
+	else
+	    SetChar2(wch, ch);
+	wch = _nc_render(win, wch);
+
+	while (end >= start) {
+	    line->text[end] = wch;
+	    end--;
+	}
+
+	_nc_synchook(win);
+	code = OK;
+    }
+    returnCode(code);
+}
diff --git a/ncurses/base/lib_immedok.c b/ncurses/base/lib_immedok.c
new file mode 100644
index 0000000..87988b6
--- /dev/null
+++ b/ncurses/base/lib_immedok.c
@@ -0,0 +1,54 @@
+/****************************************************************************
+ * Copyright (c) 1998,2000 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ ****************************************************************************/
+
+/*
+**	lib_immedok.c
+**
+**	The routine immedok.
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_immedok.c,v 1.4 2000/12/10 02:43:27 tom Exp $")
+
+NCURSES_EXPORT(void)
+immedok(WINDOW *win, bool flag)
+{
+    T((T_CALLED("immedok(%p,%d)"), win, flag));
+
+    if (win)
+	win->_immed = flag;
+
+    returnVoid;
+}
diff --git a/ncurses/base/lib_inchstr.c b/ncurses/base/lib_inchstr.c
new file mode 100644
index 0000000..6ff0168
--- /dev/null
+++ b/ncurses/base/lib_inchstr.c
@@ -0,0 +1,64 @@
+/****************************************************************************
+ * Copyright (c) 1998,2000,2001 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ ****************************************************************************/
+
+/*
+**	lib_inchstr.c
+**
+**	The routine winchnstr().
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_inchstr.c,v 1.10 2001/06/02 23:37:58 skimo Exp $")
+
+NCURSES_EXPORT(int)
+winchnstr(WINDOW *win, chtype * str, int n)
+{
+    int i = 0;
+
+    T((T_CALLED("winchnstr(%p,%p,%d)"), win, str, n));
+
+    if (!str)
+	returnCode(0);
+
+    if (win) {
+	for (; (n < 0 || (i < n)) && (win->_curx + i <= win->_maxx); i++)
+	    str[i] =
+		CharOf(win->_line[win->_cury].text[win->_curx + i]) |
+		AttrOf(win->_line[win->_cury].text[win->_curx + i]);
+    }
+    str[i] = (chtype) 0;
+
+    returnCode(i);
+}
diff --git a/ncurses/base/lib_initscr.c b/ncurses/base/lib_initscr.c
new file mode 100644
index 0000000..b2fef0c
--- /dev/null
+++ b/ncurses/base/lib_initscr.c
@@ -0,0 +1,99 @@
+/****************************************************************************
+ * Copyright (c) 1998-2007,2008 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Thomas E. Dickey                        1996-2003               *
+ ****************************************************************************/
+
+/*
+**	lib_initscr.c
+**
+**	The routines initscr(), and termname().
+**
+*/
+
+#include <curses.priv.h>
+
+#if HAVE_SYS_TERMIO_H
+#include <sys/termio.h>		/* needed for ISC */
+#endif
+
+MODULE_ID("$Id: lib_initscr.c,v 1.38 2008/08/16 21:20:48 Werner.Fink Exp $")
+
+NCURSES_EXPORT(WINDOW *)
+initscr(void)
+{
+    WINDOW *result;
+
+    NCURSES_CONST char *name;
+
+    START_TRACE();
+    T((T_CALLED("initscr()")));
+
+    _nc_init_pthreads();
+    _nc_lock_global(curses);
+
+    /* Portable applications must not call initscr() more than once */
+    if (!_nc_globals.init_screen) {
+	_nc_globals.init_screen = TRUE;
+
+	if ((name = getenv("TERM")) == 0
+	    || *name == '\0')
+	    name = "unknown";
+#ifdef __CYGWIN__
+	/*
+	 * 2002/9/21
+	 * Work around a bug in Cygwin.  Full-screen subprocesses run from
+	 * bash, in turn spawned from another full-screen process, will dump
+	 * core when attempting to write to stdout.  Opening /dev/tty
+	 * explicitly seems to fix the problem.
+	 */
+	if (isatty(fileno(stdout))) {
+	    FILE *fp = fopen("/dev/tty", "w");
+	    if (fp != 0 && isatty(fileno(fp))) {
+		fclose(stdout);
+		dup2(fileno(fp), STDOUT_FILENO);
+		stdout = fdopen(STDOUT_FILENO, "w");
+	    }
+	}
+#endif
+	if (newterm(name, stdout, stdin) == 0) {
+	    fprintf(stderr, "Error opening terminal: %s.\n", name);
+	    exit(EXIT_FAILURE);
+	}
+
+	/* def_shell_mode - done in newterm/_nc_setupscreen */
+	def_prog_mode();
+    }
+    result = stdscr;
+    _nc_unlock_global(curses);
+
+    returnWin(result);
+}
diff --git a/ncurses/base/lib_insch.c b/ncurses/base/lib_insch.c
new file mode 100644
index 0000000..9166ea5
--- /dev/null
+++ b/ncurses/base/lib_insch.c
@@ -0,0 +1,155 @@
+/****************************************************************************
+ * Copyright (c) 1998-2005,2008 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Sven Verdoolaege                                                *
+ *     and: Thomas E. Dickey                                                *
+ ****************************************************************************/
+
+/*
+**	lib_insch.c
+**
+**	The routine winsch().
+**
+*/
+
+#include <curses.priv.h>
+#include <ctype.h>
+
+MODULE_ID("$Id: lib_insch.c,v 1.25 2008/02/03 00:14:37 tom Exp $")
+
+/*
+ * Insert the given character, updating the current location to simplify
+ * inserting a string.
+ */
+NCURSES_EXPORT(int)
+_nc_insert_ch(WINDOW *win, chtype ch)
+{
+    int code = OK;
+    NCURSES_CH_T wch;
+    int count;
+    NCURSES_CONST char *s;
+
+    switch (ch) {
+    case '\t':
+	for (count = (TABSIZE - (win->_curx % TABSIZE)); count > 0; count--) {
+	    if ((code = _nc_insert_ch(win, ' ')) != OK)
+		break;
+	}
+	break;
+    case '\n':
+    case '\r':
+    case '\b':
+	SetChar2(wch, ch);
+	_nc_waddch_nosync(win, wch);
+	break;
+    default:
+	if (
+#if USE_WIDEC_SUPPORT
+	       WINDOW_EXT(win, addch_used) == 0 &&
+#endif
+	       is8bits(ChCharOf(ch)) &&
+	       isprint(ChCharOf(ch))) {
+	    if (win->_curx <= win->_maxx) {
+		struct ldat *line = &(win->_line[win->_cury]);
+		NCURSES_CH_T *end = &(line->text[win->_curx]);
+		NCURSES_CH_T *temp1 = &(line->text[win->_maxx]);
+		NCURSES_CH_T *temp2 = temp1 - 1;
+
+		SetChar2(wch, ch);
+
+		CHANGED_TO_EOL(line, win->_curx, win->_maxx);
+		while (temp1 > end)
+		    *temp1-- = *temp2--;
+
+		*temp1 = _nc_render(win, wch);
+		win->_curx++;
+	    }
+	} else if (is8bits(ChCharOf(ch)) && iscntrl(ChCharOf(ch))) {
+	    s = unctrl(ChCharOf(ch));
+	    while (*s != '\0') {
+		code = _nc_insert_ch(win, ChAttrOf(ch) | UChar(*s));
+		if (code != OK)
+		    break;
+		++s;
+	    }
+	}
+#if USE_WIDEC_SUPPORT
+	else {
+	    /*
+	     * Handle multibyte characters here
+	     */
+	    SetChar2(wch, ch);
+	    wch = _nc_render(win, wch);
+	    count = _nc_build_wch(win, &wch);
+	    if (count > 0) {
+		code = wins_wch(win, &wch);
+	    } else if (count == -1) {
+		/* handle EILSEQ */
+		if (is8bits(ch)) {
+		    s = unctrl(ChCharOf(ch));
+		    while (*s != '\0') {
+			code = _nc_insert_ch(win, ChAttrOf(ch) | UChar(*s));
+			if (code != OK)
+			    break;
+			++s;
+		    }
+		} else {
+		    code = ERR;
+		}
+	    }
+	}
+#endif
+	break;
+    }
+    return code;
+}
+
+NCURSES_EXPORT(int)
+winsch(WINDOW *win, chtype c)
+{
+    NCURSES_SIZE_T oy;
+    NCURSES_SIZE_T ox;
+    int code = ERR;
+
+    T((T_CALLED("winsch(%p, %s)"), win, _tracechtype(c)));
+
+    if (win != 0) {
+	oy = win->_cury;
+	ox = win->_curx;
+
+	code = _nc_insert_ch(win, c);
+
+	win->_curx = ox;
+	win->_cury = oy;
+	_nc_synchook(win);
+    }
+    returnCode(code);
+}
diff --git a/ncurses/base/lib_insdel.c b/ncurses/base/lib_insdel.c
new file mode 100644
index 0000000..342c654
--- /dev/null
+++ b/ncurses/base/lib_insdel.c
@@ -0,0 +1,63 @@
+/****************************************************************************
+ * Copyright (c) 1998-2001,2003 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ ****************************************************************************/
+
+/*
+**	lib_insdel.c
+**
+**	The routine winsdelln(win, n).
+**  positive n insert n lines above current line
+**  negative n delete n lines starting from current line
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_insdel.c,v 1.12 2003/07/26 22:40:06 tom Exp $")
+
+NCURSES_EXPORT(int)
+winsdelln(WINDOW *win, int n)
+{
+    int code = ERR;
+
+    T((T_CALLED("winsdelln(%p,%d)"), win, n));
+
+    if (win) {
+	if (n != 0) {
+	    _nc_scroll_window(win, -n, win->_cury, win->_maxy,
+			      win->_nc_bkgd);
+	    _nc_synchook(win);
+	}
+	code = OK;
+    }
+    returnCode(code);
+}
diff --git a/ncurses/base/lib_insnstr.c b/ncurses/base/lib_insnstr.c
new file mode 100644
index 0000000..b6ddfde
--- /dev/null
+++ b/ncurses/base/lib_insnstr.c
@@ -0,0 +1,68 @@
+/****************************************************************************
+ * Copyright (c) 2004 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                                                *
+ ****************************************************************************/
+
+/*
+**	lib_insnstr.c
+**
+**	The routine winsnstr().
+**
+*/
+
+#include <curses.priv.h>
+#include <ctype.h>
+
+MODULE_ID("$Id: lib_insnstr.c,v 1.1 2004/02/28 23:44:56 tom Exp $")
+
+NCURSES_EXPORT(int)
+winsnstr(WINDOW *win, const char *s, int n)
+{
+    int code = ERR;
+    NCURSES_SIZE_T oy;
+    NCURSES_SIZE_T ox;
+    const unsigned char *str = (const unsigned char *) s;
+    const unsigned char *cp;
+
+    T((T_CALLED("winsnstr(%p,%s,%d)"), win, _nc_visbufn(s, n), n));
+
+    if (win != 0 && str != 0) {
+	oy = win->_cury;
+	ox = win->_curx;
+	for (cp = str; *cp && (n <= 0 || (cp - str) < n); cp++) {
+	    _nc_insert_ch(win, (chtype) UChar(*cp));
+	}
+	win->_curx = ox;
+	win->_cury = oy;
+	_nc_synchook(win);
+	code = OK;
+    }
+    returnCode(code);
+}
diff --git a/ncurses/base/lib_instr.c b/ncurses/base/lib_instr.c
new file mode 100644
index 0000000..3fb2949
--- /dev/null
+++ b/ncurses/base/lib_instr.c
@@ -0,0 +1,112 @@
+/****************************************************************************
+ * Copyright (c) 1998-2005,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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Thomas E. Dickey                        1996-on                 *
+ ****************************************************************************/
+
+/*
+**	lib_instr.c
+**
+**	The routine winnstr().
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_instr.c,v 1.16 2007/07/21 20:18:10 tom Exp $")
+
+NCURSES_EXPORT(int)
+winnstr(WINDOW *win, char *str, int n)
+{
+    int i = 0, row, col;
+
+    T((T_CALLED("winnstr(%p,%p,%d)"), win, str, n));
+
+    if (!str)
+	returnCode(0);
+
+    if (win) {
+	getyx(win, row, col);
+
+	if (n < 0)
+	    n = win->_maxx - win->_curx + 1;
+
+	for (; i < n;) {
+#if USE_WIDEC_SUPPORT
+	    cchar_t *cell = &(win->_line[row].text[col]);
+	    wchar_t *wch;
+	    attr_t attrs;
+	    short pair;
+	    int n2;
+	    bool done = FALSE;
+	    mbstate_t state;
+	    size_t i3, n3;
+	    char *tmp;
+
+	    if (!isWidecExt(*cell)) {
+		n2 = getcchar(cell, 0, 0, 0, 0);
+		if (n2 > 0
+		    && (wch = typeCalloc(wchar_t, (unsigned) n2 + 1)) != 0) {
+		    if (getcchar(cell, wch, &attrs, &pair, 0) == OK) {
+
+			init_mb(state);
+			n3 = wcstombs(0, wch, 0);
+			if (isEILSEQ(n3) || (n3 == 0)) {
+			    ;
+			} else if ((int) (n3 + i) > n) {
+			    done = TRUE;
+			} else if ((tmp = typeCalloc(char, n3 + 10)) == 0) {
+			    done = TRUE;
+			} else {
+			    init_mb(state);
+			    wcstombs(tmp, wch, n3);
+			    for (i3 = 0; i3 < n3; ++i3)
+				str[i++] = tmp[i3];
+			    free(tmp);
+			}
+		    }
+		    free(wch);
+		    if (done)
+			break;
+		}
+	    }
+#else
+	    str[i++] = (char) CharOf(win->_line[row].text[col]);
+#endif
+	    if (++col > win->_maxx) {
+		break;
+	    }
+	}
+    }
+    str[i] = '\0';		/* SVr4 does not seem to count the null */
+    T(("winnstr returns %s", _nc_visbuf(str)));
+    returnCode(i);
+}
diff --git a/ncurses/base/lib_isendwin.c b/ncurses/base/lib_isendwin.c
new file mode 100644
index 0000000..b337d97
--- /dev/null
+++ b/ncurses/base/lib_isendwin.c
@@ -0,0 +1,51 @@
+/****************************************************************************
+ * Copyright (c) 1998,2000 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ ****************************************************************************/
+
+/*
+**	lib_endwin.c
+**
+**	The routine endwin().
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_isendwin.c,v 1.6 2000/12/10 02:43:27 tom Exp $")
+
+NCURSES_EXPORT(bool)
+isendwin(void)
+{
+    if (SP == NULL)
+	return FALSE;
+    return SP->_endwin;
+}
diff --git a/ncurses/base/lib_leaveok.c b/ncurses/base/lib_leaveok.c
new file mode 100644
index 0000000..17d095d
--- /dev/null
+++ b/ncurses/base/lib_leaveok.c
@@ -0,0 +1,55 @@
+/****************************************************************************
+ * Copyright (c) 1998,2000 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ ****************************************************************************/
+
+/*
+**	lib_leaveok.c
+**
+**	The routine leaveok.
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_leaveok.c,v 1.5 2000/12/10 02:43:27 tom Exp $")
+
+NCURSES_EXPORT(int)
+leaveok(WINDOW *win, bool flag)
+{
+    T((T_CALLED("leaveok(%p,%d)"), win, flag));
+
+    if (win) {
+	win->_leaveok = flag;
+	returnCode(OK);
+    } else
+	returnCode(ERR);
+}
diff --git a/ncurses/base/lib_mouse.c b/ncurses/base/lib_mouse.c
new file mode 100644
index 0000000..95f29aa
--- /dev/null
+++ b/ncurses/base/lib_mouse.c
@@ -0,0 +1,1435 @@
+/****************************************************************************
+ * Copyright (c) 1998-2007,2008 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Thomas E. Dickey                        1996-on                 *
+ ****************************************************************************/
+
+/*
+ * This module is intended to encapsulate ncurses's interface to pointing
+ * devices.
+ *
+ * The primary method used is xterm's internal mouse-tracking facility.
+ * Additional methods depend on the platform:
+ *	Alessandro Rubini's GPM server (Linux)
+ *	sysmouse (FreeBSD)
+ *	special-purpose mouse interface for OS/2 EMX.
+ *
+ * Notes for implementors of new mouse-interface methods:
+ *
+ * The code is logically split into a lower level that accepts event reports
+ * in a device-dependent format and an upper level that parses mouse gestures
+ * and filters events.  The mediating data structure is a circular queue of
+ * MEVENT structures.
+ *
+ * Functionally, the lower level's job is to pick up primitive events and
+ * put them on the circular queue.  This can happen in one of two ways:
+ * either (a) _nc_mouse_event() detects a series of incoming mouse reports
+ * and queues them, or (b) code in lib_getch.c detects the kmous prefix in
+ * the keyboard input stream and calls _nc_mouse_inline to queue up a series
+ * of adjacent mouse reports.
+ *
+ * In either case, _nc_mouse_parse() should be called after the series is
+ * accepted to parse the digested mouse reports (low-level MEVENTs) into
+ * a gesture (a high-level or composite MEVENT).
+ *
+ * Don't be too shy about adding new event types or modifiers, if you can find
+ * room for them in the 32-bit mask.  The API is written so that users get
+ * feedback on which theoretical event types they won't see when they call
+ * mousemask. There's one bit per button (the RESERVED_EVENT bit) not being
+ * used yet, and a couple of bits open at the high end.
+ */
+
+#ifdef __EMX__
+#  include <io.h>
+#  define  INCL_DOS
+#  define  INCL_VIO
+#  define  INCL_KBD
+#  define  INCL_MOU
+#  define  INCL_DOSPROCESS
+#  include <os2.h>		/* Need to include before the others */
+#endif
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_mouse.c,v 1.102 2008/10/18 21:48:55 tom Exp $")
+
+#include <term.h>
+#include <tic.h>
+
+#if USE_GPM_SUPPORT
+#include <linux/keyboard.h>	/* defines KG_* macros */
+
+#ifdef HAVE_LIBDL
+/* use dynamic loader to avoid linkage dependency */
+#include <dlfcn.h>
+
+#ifdef RTLD_NOW
+#define my_RTLD RTLD_NOW
+#else
+#ifdef RTLD_LAZY
+#define my_RTLD RTLD_LAZY
+#else
+make an error
+#endif
+#endif				/* RTLD_NOW */
+#endif				/* HAVE_LIBDL */
+
+#endif				/* USE_GPM_SUPPORT */
+
+#if USE_SYSMOUSE
+#undef buttons			/* symbol conflict in consio.h */
+#undef mouse_info		/* symbol conflict in consio.h */
+#include <osreldate.h>
+#if (__FreeBSD_version >= 400017)
+#include <sys/consio.h>
+#include <sys/fbio.h>
+#else
+#include <machine/console.h>
+#endif
+#endif				/* use_SYSMOUSE */
+
+#define MY_TRACE TRACE_ICALLS|TRACE_IEVENT
+
+#define	MASK_RELEASE(x)		NCURSES_MOUSE_MASK(x, 001)
+#define	MASK_PRESS(x)		NCURSES_MOUSE_MASK(x, 002)
+#define	MASK_CLICK(x)		NCURSES_MOUSE_MASK(x, 004)
+#define	MASK_DOUBLE_CLICK(x)	NCURSES_MOUSE_MASK(x, 010)
+#define	MASK_TRIPLE_CLICK(x)	NCURSES_MOUSE_MASK(x, 020)
+#define	MASK_RESERVED_EVENT(x)	NCURSES_MOUSE_MASK(x, 040)
+
+#if NCURSES_MOUSE_VERSION == 1
+#define BUTTON_CLICKED        (BUTTON1_CLICKED        | BUTTON2_CLICKED        | BUTTON3_CLICKED        | BUTTON4_CLICKED)
+#define BUTTON_PRESSED        (BUTTON1_PRESSED        | BUTTON2_PRESSED        | BUTTON3_PRESSED        | BUTTON4_PRESSED)
+#define BUTTON_RELEASED       (BUTTON1_RELEASED       | BUTTON2_RELEASED       | BUTTON3_RELEASED       | BUTTON4_RELEASED)
+#define BUTTON_DOUBLE_CLICKED (BUTTON1_DOUBLE_CLICKED | BUTTON2_DOUBLE_CLICKED | BUTTON3_DOUBLE_CLICKED | BUTTON4_DOUBLE_CLICKED)
+#define BUTTON_TRIPLE_CLICKED (BUTTON1_TRIPLE_CLICKED | BUTTON2_TRIPLE_CLICKED | BUTTON3_TRIPLE_CLICKED | BUTTON4_TRIPLE_CLICKED)
+#define MAX_BUTTONS  4
+#else
+#define BUTTON_CLICKED        (BUTTON1_CLICKED        | BUTTON2_CLICKED        | BUTTON3_CLICKED        | BUTTON4_CLICKED        | BUTTON5_CLICKED)
+#define BUTTON_PRESSED        (BUTTON1_PRESSED        | BUTTON2_PRESSED        | BUTTON3_PRESSED        | BUTTON4_PRESSED        | BUTTON5_PRESSED)
+#define BUTTON_RELEASED       (BUTTON1_RELEASED       | BUTTON2_RELEASED       | BUTTON3_RELEASED       | BUTTON4_RELEASED       | BUTTON5_RELEASED)
+#define BUTTON_DOUBLE_CLICKED (BUTTON1_DOUBLE_CLICKED | BUTTON2_DOUBLE_CLICKED | BUTTON3_DOUBLE_CLICKED | BUTTON4_DOUBLE_CLICKED | BUTTON5_DOUBLE_CLICKED)
+#define BUTTON_TRIPLE_CLICKED (BUTTON1_TRIPLE_CLICKED | BUTTON2_TRIPLE_CLICKED | BUTTON3_TRIPLE_CLICKED | BUTTON4_TRIPLE_CLICKED | BUTTON5_TRIPLE_CLICKED)
+#define MAX_BUTTONS  5
+#endif
+
+#define INVALID_EVENT	-1
+#define NORMAL_EVENT	0
+
+#if USE_GPM_SUPPORT
+
+#ifndef LIBGPM_SONAME
+#define LIBGPM_SONAME "libgpm.so"
+#endif
+
+#define GET_DLSYM(name) (my_##name = (TYPE_##name) dlsym(SP->_dlopen_gpm, #name))
+
+#endif				/* USE_GPM_SUPPORT */
+
+static bool _nc_mouse_parse(SCREEN *, int);
+static void _nc_mouse_resume(SCREEN *);
+static void _nc_mouse_wrap(SCREEN *);
+
+/* maintain a circular list of mouse events */
+
+#define FirstEV(sp)	((sp)->_mouse_events)
+#define LastEV(sp)	((sp)->_mouse_events + EV_MAX - 1)
+
+#undef  NEXT
+#define NEXT(ep)	((ep >= LastEV(sp)) \
+			 ? FirstEV(sp) \
+			 : ep + 1)
+
+#undef  PREV
+#define PREV(ep)	((ep <= FirstEV(sp)) \
+			 ? LastEV(sp) \
+			 : ep - 1)
+
+#define IndexEV(sp, ep)	(ep - FirstEV(sp))
+
+#define RunParams(sp, eventp, runp) \
+		(long) IndexEV(sp, runp), \
+		(long) (IndexEV(sp, eventp) + (EV_MAX - 1)) % EV_MAX
+
+#ifdef TRACE
+static void
+_trace_slot(SCREEN *sp, const char *tag)
+{
+    MEVENT *ep;
+
+    _tracef(tag);
+
+    for (ep = FirstEV(sp); ep <= LastEV(sp); ep++)
+	_tracef("mouse event queue slot %ld = %s",
+		(long) IndexEV(sp, ep),
+		_nc_tracemouse(sp, ep));
+}
+#endif
+
+#if USE_EMX_MOUSE
+
+#  define TOP_ROW          0
+#  define LEFT_COL         0
+
+#  define M_FD(sp) sp->_mouse_fd
+
+static void
+write_event(SCREEN *sp, int down, int button, int x, int y)
+{
+    char buf[6];
+    unsigned long ignore;
+
+    strncpy(buf, key_mouse, 3);	/* should be "\033[M" */
+    buf[3] = ' ' + (button - 1) + (down ? 0 : 0x40);
+    buf[4] = ' ' + x - LEFT_COL + 1;
+    buf[5] = ' ' + y - TOP_ROW + 1;
+    DosWrite(sp->_emxmouse_wfd, buf, 6, &ignore);
+}
+
+static void
+mouse_server(unsigned long param)
+{
+    SCREEN *sp = (SCREEN *) param;
+    unsigned short fWait = MOU_WAIT;
+    /* NOPTRRECT mourt = { 0,0,24,79 }; */
+    MOUEVENTINFO mouev;
+    HMOU hmou;
+    unsigned short mask = MOUSE_BN1_DOWN | MOUSE_BN2_DOWN | MOUSE_BN3_DOWN;
+    int nbuttons = 3;
+    int oldstate = 0;
+    char err[80];
+    unsigned long rc;
+
+    /* open the handle for the mouse */
+    if (MouOpen(NULL, &hmou) == 0) {
+	rc = MouSetEventMask(&mask, hmou);
+	if (rc) {		/* retry with 2 buttons */
+	    mask = MOUSE_BN1_DOWN | MOUSE_BN2_DOWN;
+	    rc = MouSetEventMask(&mask, hmou);
+	    nbuttons = 2;
+	}
+	if (rc == 0 && MouDrawPtr(hmou) == 0) {
+	    for (;;) {
+		/* sit and wait on the event queue */
+		rc = MouReadEventQue(&mouev, &fWait, hmou);
+		if (rc) {
+		    sprintf(err, "Error reading mouse queue, rc=%lu.\r\n", rc);
+		    break;
+		}
+		if (!sp->_emxmouse_activated)
+		    goto finish;
+
+		/*
+		 * OS/2 numbers a 3-button mouse inconsistently from other
+		 * platforms:
+		 *      1 = left
+		 *      2 = right
+		 *      3 = middle.
+		 */
+		if ((mouev.fs ^ oldstate) & MOUSE_BN1_DOWN)
+		    write_event(sp, mouev.fs & MOUSE_BN1_DOWN,
+				sp->_emxmouse_buttons[1], mouev.col, mouev.row);
+		if ((mouev.fs ^ oldstate) & MOUSE_BN2_DOWN)
+		    write_event(sp, mouev.fs & MOUSE_BN2_DOWN,
+				sp->_emxmouse_buttons[3], mouev.col, mouev.row);
+		if ((mouev.fs ^ oldstate) & MOUSE_BN3_DOWN)
+		    write_event(sp, mouev.fs & MOUSE_BN3_DOWN,
+				sp->_emxmouse_buttons[2], mouev.col, mouev.row);
+
+	      finish:
+		oldstate = mouev.fs;
+	    }
+	} else
+	    sprintf(err, "Error setting event mask, buttons=%d, rc=%lu.\r\n",
+		    nbuttons, rc);
+
+	DosWrite(2, err, strlen(err), &rc);
+	MouClose(hmou);
+    }
+    DosExit(EXIT_THREAD, 0L);
+}
+
+#endif /* USE_EMX_MOUSE */
+
+#if USE_SYSMOUSE
+static void
+sysmouse_server(SCREEN *sp)
+{
+    struct mouse_info the_mouse;
+    MEVENT *work;
+
+    the_mouse.operation = MOUSE_GETINFO;
+    if (sp != 0
+	&& sp->_mouse_fd >= 0
+	&& sp->_sysmouse_tail < FIFO_SIZE
+	&& ioctl(sp->_mouse_fd, CONS_MOUSECTL, &the_mouse) != -1) {
+
+	if (sp->_sysmouse_head > sp->_sysmouse_tail) {
+	    sp->_sysmouse_tail = 0;
+	    sp->_sysmouse_head = 0;
+	}
+	work = &(sp->_sysmouse_fifo[sp->_sysmouse_tail]);
+	memset(work, 0, sizeof(*work));
+	work->id = NORMAL_EVENT;	/* there's only one mouse... */
+
+	sp->_sysmouse_old_buttons = sp->_sysmouse_new_buttons;
+	sp->_sysmouse_new_buttons = the_mouse.u.data.buttons & 0x7;
+
+	if (sp->_sysmouse_new_buttons) {
+	    if (sp->_sysmouse_new_buttons & 1)
+		work->bstate |= BUTTON1_PRESSED;
+	    if (sp->_sysmouse_new_buttons & 2)
+		work->bstate |= BUTTON2_PRESSED;
+	    if (sp->_sysmouse_new_buttons & 4)
+		work->bstate |= BUTTON3_PRESSED;
+	} else {
+	    if (sp->_sysmouse_old_buttons & 1)
+		work->bstate |= BUTTON1_RELEASED;
+	    if (sp->_sysmouse_old_buttons & 2)
+		work->bstate |= BUTTON2_RELEASED;
+	    if (sp->_sysmouse_old_buttons & 4)
+		work->bstate |= BUTTON3_RELEASED;
+	}
+
+	/* for cosmetic bug in syscons.c on FreeBSD 3.[34] */
+	the_mouse.operation = MOUSE_HIDE;
+	ioctl(sp->_mouse_fd, CONS_MOUSECTL, &the_mouse);
+	the_mouse.operation = MOUSE_SHOW;
+	ioctl(sp->_mouse_fd, CONS_MOUSECTL, &the_mouse);
+
+	/*
+	 * We're only interested if the button is pressed or released.
+	 * FIXME: implement continuous event-tracking.
+	 */
+	if (sp->_sysmouse_new_buttons != sp->_sysmouse_old_buttons) {
+	    sp->_sysmouse_tail += 1;
+	}
+	work->x = the_mouse.u.data.x / sp->_sysmouse_char_width;
+	work->y = the_mouse.u.data.y / sp->_sysmouse_char_height;
+    }
+}
+
+static void
+handle_sysmouse(int sig GCC_UNUSED)
+{
+    sysmouse_server(SP);
+}
+#endif /* USE_SYSMOUSE */
+
+static void
+init_xterm_mouse(SCREEN *sp)
+{
+    sp->_mouse_type = M_XTERM;
+    sp->_mouse_xtermcap = tigetstr("XM");
+    if (!VALID_STRING(sp->_mouse_xtermcap))
+	sp->_mouse_xtermcap = "\033[?1000%?%p1%{1}%=%th%el%;";
+}
+
+static void
+enable_xterm_mouse(SCREEN *sp, int enable)
+{
+#if USE_EMX_MOUSE
+    sp->_emxmouse_activated = enable;
+#else
+    putp(TPARM_1(sp->_mouse_xtermcap, enable));
+#endif
+    sp->_mouse_active = enable;
+}
+
+#if USE_GPM_SUPPORT
+static bool
+allow_gpm_mouse(void)
+{
+    bool result = FALSE;
+
+    /* GPM does printf's without checking if stdout is a terminal */
+    if (isatty(fileno(stdout))) {
+	char *list = getenv("NCURSES_GPM_TERMS");
+	char *env = getenv("TERM");
+	if (list != 0) {
+	    if (env != 0) {
+		result = _nc_name_match(list, env, "|:");
+	    }
+	} else {
+	    /* GPM checks the beginning of the $TERM variable to decide if it
+	     * should pass xterm events through.  There is no real advantage in
+	     * allowing GPM to do this.  Recent versions relax that check, and
+	     * pretend that GPM can work with any terminal having the kmous
+	     * capability.  Perhaps that works for someone.  If so, they can
+	     * set the environment variable (above).
+	     */
+	    if (env != 0 && strstr(env, "linux") != 0) {
+		result = TRUE;
+	    }
+	}
+    }
+    return result;
+}
+
+#ifdef HAVE_LIBDL
+static void
+unload_gpm_library(SCREEN *sp)
+{
+    if (SP->_dlopen_gpm != 0) {
+	T(("unload GPM library"));
+	sp->_mouse_gpm_loaded = FALSE;
+	sp->_mouse_fd = -1;
+	dlclose(sp->_dlopen_gpm);
+	sp->_dlopen_gpm = 0;
+    }
+}
+
+static void
+load_gpm_library(SCREEN *sp)
+{
+    sp->_mouse_gpm_found = FALSE;
+    if ((sp->_dlopen_gpm = dlopen(LIBGPM_SONAME, my_RTLD)) != 0) {
+	if (GET_DLSYM(gpm_fd) == 0 ||
+	    GET_DLSYM(Gpm_Open) == 0 ||
+	    GET_DLSYM(Gpm_Close) == 0 ||
+	    GET_DLSYM(Gpm_GetEvent) == 0) {
+	    T(("GPM initialization failed: %s", dlerror()));
+	    unload_gpm_library(sp);
+	} else {
+	    sp->_mouse_gpm_found = TRUE;
+	    sp->_mouse_gpm_loaded = TRUE;
+	}
+    }
+}
+#endif
+
+static bool
+enable_gpm_mouse(SCREEN *sp, bool enable)
+{
+    bool result;
+
+    T((T_CALLED("enable_gpm_mouse(%d)"), enable));
+
+    if (enable && !sp->_mouse_active) {
+#ifdef HAVE_LIBDL
+	if (sp->_mouse_gpm_found && !sp->_mouse_gpm_loaded) {
+	    load_gpm_library(sp);
+	}
+#endif
+	if (sp->_mouse_gpm_loaded) {
+	    /* GPM: initialize connection to gpm server */
+	    sp->_mouse_gpm_connect.eventMask = GPM_DOWN | GPM_UP;
+	    sp->_mouse_gpm_connect.defaultMask =
+		(unsigned short) (~(sp->_mouse_gpm_connect.eventMask | GPM_HARD));
+	    sp->_mouse_gpm_connect.minMod = 0;
+	    sp->_mouse_gpm_connect.maxMod =
+		(unsigned short) (~((1 << KG_SHIFT) |
+				    (1 << KG_SHIFTL) |
+				    (1 << KG_SHIFTR)));
+	    /*
+	     * Note: GPM hardcodes \E[?1001s and \E[?1000h during its open.
+	     * The former is recognized by wscons (SunOS), and the latter by
+	     * xterm.  Those will not show up in ncurses' traces.
+	     */
+	    result = (my_Gpm_Open(&sp->_mouse_gpm_connect, 0) >= 0);
+	} else {
+	    result = FALSE;
+	}
+	sp->_mouse_active = result;
+	T(("GPM open %s", result ? "succeeded" : "failed"));
+    } else {
+	if (!enable && sp->_mouse_active) {
+	    /* GPM: close connection to gpm server */
+	    my_Gpm_Close();
+	    sp->_mouse_active = FALSE;
+	    T(("GPM closed"));
+	}
+	result = enable;
+    }
+#ifdef HAVE_LIBDL
+    if (!result) {
+	unload_gpm_library(sp);
+    }
+#endif
+    returnBool(result);
+}
+#endif /* USE_GPM_SUPPORT */
+
+#define xterm_kmous "\033[M"
+
+static void
+initialize_mousetype(SCREEN *sp)
+{
+    T((T_CALLED("initialize_mousetype()")));
+
+    /* Try gpm first, because gpm may be configured to run in xterm */
+#if USE_GPM_SUPPORT
+    if (allow_gpm_mouse()) {
+	if (!sp->_mouse_gpm_loaded) {
+#ifdef HAVE_LIBDL
+	    load_gpm_library(sp);
+#else /* !HAVE_LIBDL */
+	    sp->_mouse_gpm_found = TRUE;
+	    sp->_mouse_gpm_loaded = TRUE;
+#endif
+	}
+
+	/*
+	 * The gpm_fd file-descriptor may be negative (xterm).  So we have to
+	 * maintain our notion of whether the mouse connection is active
+	 * without testing the file-descriptor.
+	 */
+	if (sp->_mouse_gpm_found && enable_gpm_mouse(sp, TRUE)) {
+	    sp->_mouse_type = M_GPM;
+	    sp->_mouse_fd = *(my_gpm_fd);
+	    T(("GPM mouse_fd %d", sp->_mouse_fd));
+	    returnVoid;
+	}
+    }
+#endif /* USE_GPM_SUPPORT */
+
+    /* OS/2 VIO */
+#if USE_EMX_MOUSE
+    if (!sp->_emxmouse_thread
+	&& strstr(cur_term->type.term_names, "xterm") == 0
+	&& key_mouse) {
+	int handles[2];
+
+	if (pipe(handles) < 0) {
+	    perror("mouse pipe error");
+	    returnVoid;
+	} else {
+	    int rc;
+
+	    if (!sp->_emxmouse_buttons[0]) {
+		char *s = getenv("MOUSE_BUTTONS_123");
+
+		sp->_emxmouse_buttons[0] = 1;
+		if (s && strlen(s) >= 3) {
+		    sp->_emxmouse_buttons[1] = s[0] - '0';
+		    sp->_emxmouse_buttons[2] = s[1] - '0';
+		    sp->_emxmouse_buttons[3] = s[2] - '0';
+		} else {
+		    sp->_emxmouse_buttons[1] = 1;
+		    sp->_emxmouse_buttons[2] = 3;
+		    sp->_emxmouse_buttons[3] = 2;
+		}
+	    }
+	    sp->_emxmouse_wfd = handles[1];
+	    M_FD(sp) = handles[0];
+	    /* Needed? */
+	    setmode(handles[0], O_BINARY);
+	    setmode(handles[1], O_BINARY);
+	    /* Do not use CRT functions, we may single-threaded. */
+	    rc = DosCreateThread((unsigned long *) &sp->_emxmouse_thread,
+				 mouse_server, (long) sp, 0, 8192);
+	    if (rc) {
+		printf("mouse thread error %d=%#x", rc, rc);
+	    } else {
+		sp->_mouse_type = M_XTERM;
+	    }
+	    returnVoid;
+	}
+    }
+#endif /* USE_EMX_MOUSE */
+
+#if USE_SYSMOUSE
+    {
+	struct mouse_info the_mouse;
+	char *the_device = 0;
+
+	if (isatty(sp->_ifd))
+	    the_device = ttyname(sp->_ifd);
+	if (the_device == 0)
+	    the_device = "/dev/tty";
+
+	sp->_mouse_fd = open(the_device, O_RDWR);
+
+	if (sp->_mouse_fd >= 0) {
+	    /*
+	     * sysmouse does not have a usable user interface for obtaining
+	     * mouse events.  The logical way to proceed (reading data on a
+	     * stream) only works if one opens the device as root.  Even in
+	     * that mode, careful examination shows we lose events
+	     * occasionally.  The interface provided for user programs is to
+	     * establish a signal handler.  really.
+	     *
+	     * Take over SIGUSR2 for this purpose since SIGUSR1 is more
+	     * likely to be used by an application.  getch() will have to
+	     * handle the misleading EINTR's.
+	     */
+	    signal(SIGUSR2, SIG_IGN);
+	    the_mouse.operation = MOUSE_MODE;
+	    the_mouse.u.mode.mode = 0;
+	    the_mouse.u.mode.signal = SIGUSR2;
+	    if (ioctl(sp->_mouse_fd, CONS_MOUSECTL, &the_mouse) != -1) {
+		signal(SIGUSR2, handle_sysmouse);
+		the_mouse.operation = MOUSE_SHOW;
+		ioctl(sp->_mouse_fd, CONS_MOUSECTL, &the_mouse);
+
+#if defined(FBIO_MODEINFO) || defined(CONS_MODEINFO)	/* FreeBSD > 2.x */
+		{
+#ifndef FBIO_GETMODE		/* FreeBSD 3.x */
+#define FBIO_GETMODE    CONS_GET
+#define FBIO_MODEINFO   CONS_MODEINFO
+#endif /* FBIO_GETMODE */
+		    video_info_t the_video;
+
+		    if (ioctl(sp->_mouse_fd,
+			      FBIO_GETMODE,
+			      &the_video.vi_mode) != -1
+			&& ioctl(sp->_mouse_fd,
+				 FBIO_MODEINFO,
+				 &the_video) != -1) {
+			sp->_sysmouse_char_width = the_video.vi_cwidth;
+			sp->_sysmouse_char_height = the_video.vi_cheight;
+		    }
+		}
+#endif /* defined(FBIO_MODEINFO) || defined(CONS_MODEINFO) */
+
+		if (sp->_sysmouse_char_width <= 0)
+		    sp->_sysmouse_char_width = 8;
+		if (sp->_sysmouse_char_height <= 0)
+		    sp->_sysmouse_char_height = 16;
+		sp->_mouse_type = M_SYSMOUSE;
+		returnVoid;
+	    }
+	}
+    }
+#endif /* USE_SYSMOUSE */
+
+    /* we know how to recognize mouse events under "xterm" */
+    if (key_mouse != 0) {
+	if (!strcmp(key_mouse, xterm_kmous)
+	    || strstr(cur_term->type.term_names, "xterm") != 0) {
+	    init_xterm_mouse(sp);
+	}
+    } else if (strstr(cur_term->type.term_names, "xterm") != 0) {
+	if (_nc_add_to_try(&(sp->_keytry), xterm_kmous, KEY_MOUSE) == OK)
+	    init_xterm_mouse(sp);
+    }
+    returnVoid;
+}
+
+static bool
+_nc_mouse_init(SCREEN *sp)
+/* initialize the mouse */
+{
+    bool result = FALSE;
+    int i;
+
+    if (sp != 0) {
+	if (!sp->_mouse_initialized) {
+	    sp->_mouse_initialized = TRUE;
+
+	    TR(MY_TRACE, ("_nc_mouse_init() called"));
+
+	    sp->_mouse_eventp = FirstEV(sp);
+	    for (i = 0; i < EV_MAX; i++)
+		sp->_mouse_events[i].id = INVALID_EVENT;
+
+	    initialize_mousetype(sp);
+
+	    T(("_nc_mouse_init() set mousetype to %d", sp->_mouse_type));
+	}
+	result = sp->_mouse_initialized;
+    }
+    return result;
+}
+
+/*
+ * Query to see if there is a pending mouse event.  This is called from
+ * fifo_push() in lib_getch.c
+ */
+static bool
+_nc_mouse_event(SCREEN *sp GCC_UNUSED)
+{
+    MEVENT *eventp = sp->_mouse_eventp;
+    bool result = FALSE;
+
+    (void) eventp;
+
+    switch (sp->_mouse_type) {
+    case M_XTERM:
+	/* xterm: never have to query, mouse events are in the keyboard stream */
+#if USE_EMX_MOUSE
+	{
+	    char kbuf[3];
+
+	    int i, res = read(M_FD(sp), &kbuf, 3);	/* Eat the prefix */
+	    if (res != 3)
+		printf("Got %d chars instead of 3 for prefix.\n", res);
+	    for (i = 0; i < res; i++) {
+		if (kbuf[i] != key_mouse[i])
+		    printf("Got char %d instead of %d for prefix.\n",
+			   (int) kbuf[i], (int) key_mouse[i]);
+	    }
+	    result = TRUE;
+	}
+#endif /* USE_EMX_MOUSE */
+	break;
+
+#if USE_GPM_SUPPORT
+    case M_GPM:
+	{
+	    /* query server for event, return TRUE if we find one */
+	    Gpm_Event ev;
+
+	    if (my_Gpm_GetEvent(&ev) == 1) {
+		/* there's only one mouse... */
+		eventp->id = NORMAL_EVENT;
+
+		eventp->bstate = 0;
+		switch (ev.type & 0x0f) {
+		case (GPM_DOWN):
+		    if (ev.buttons & GPM_B_LEFT)
+			eventp->bstate |= BUTTON1_PRESSED;
+		    if (ev.buttons & GPM_B_MIDDLE)
+			eventp->bstate |= BUTTON2_PRESSED;
+		    if (ev.buttons & GPM_B_RIGHT)
+			eventp->bstate |= BUTTON3_PRESSED;
+		    break;
+		case (GPM_UP):
+		    if (ev.buttons & GPM_B_LEFT)
+			eventp->bstate |= BUTTON1_RELEASED;
+		    if (ev.buttons & GPM_B_MIDDLE)
+			eventp->bstate |= BUTTON2_RELEASED;
+		    if (ev.buttons & GPM_B_RIGHT)
+			eventp->bstate |= BUTTON3_RELEASED;
+		    break;
+		default:
+		    break;
+		}
+
+		eventp->x = ev.x - 1;
+		eventp->y = ev.y - 1;
+		eventp->z = 0;
+
+		/* bump the next-free pointer into the circular list */
+		sp->_mouse_eventp = eventp = NEXT(eventp);
+		result = TRUE;
+	    }
+	}
+	break;
+#endif
+
+#if USE_SYSMOUSE
+    case M_SYSMOUSE:
+	if (sp->_sysmouse_head < sp->_sysmouse_tail) {
+	    *eventp = sp->_sysmouse_fifo[sp->_sysmouse_head];
+
+	    /*
+	     * Point the fifo-head to the next possible location.  If there
+	     * are none, reset the indices.  This may be interrupted by the
+	     * signal handler, doing essentially the same reset.
+	     */
+	    sp->_sysmouse_head += 1;
+	    if (sp->_sysmouse_head == sp->_sysmouse_tail) {
+		sp->_sysmouse_tail = 0;
+		sp->_sysmouse_head = 0;
+	    }
+
+	    /* bump the next-free pointer into the circular list */
+	    sp->_mouse_eventp = eventp = NEXT(eventp);
+	    result = TRUE;
+	}
+	break;
+#endif /* USE_SYSMOUSE */
+
+    case M_NONE:
+	break;
+    }
+
+    return result;		/* true if we found an event */
+}
+
+static bool
+_nc_mouse_inline(SCREEN *sp)
+/* mouse report received in the keyboard stream -- parse its info */
+{
+    int b;
+    bool result = FALSE;
+    MEVENT *eventp = sp->_mouse_eventp;
+
+    TR(MY_TRACE, ("_nc_mouse_inline() called"));
+
+    if (sp->_mouse_type == M_XTERM) {
+	unsigned char kbuf[4];
+	mmask_t prev;
+	size_t grabbed;
+	int res;
+
+	/* This code requires that your xterm entry contain the kmous
+	 * capability and that it be set to the \E[M documented in the
+	 * Xterm Control Sequences reference.  This is how we
+	 * arrange for mouse events to be reported via a KEY_MOUSE
+	 * return value from wgetch().  After this value is received,
+	 * _nc_mouse_inline() gets called and is immediately
+	 * responsible for parsing the mouse status information
+	 * following the prefix.
+	 *
+	 * The following quotes from the ctrlseqs.ms document in the
+	 * X distribution, describing the X mouse tracking feature:
+	 *
+	 * Parameters for all mouse tracking escape sequences
+	 * generated by xterm encode numeric parameters in a single
+	 * character as value+040.  For example, !  is 1.
+	 *
+	 * On button press or release, xterm sends ESC [ M CbCxCy.
+	 * The low two bits of Cb encode button information: 0=MB1
+	 * pressed, 1=MB2 pressed, 2=MB3 pressed, 3=release.  The
+	 * upper bits encode what modifiers were down when the
+	 * button was pressed and are added together.  4=Shift,
+	 * 8=Meta, 16=Control.  Cx and Cy are the x and y coordinates
+	 * of the mouse event.  The upper left corner is (1,1).
+	 *
+	 * (End quote)  By the time we get here, we've eaten the
+	 * key prefix.  FYI, the loop below is necessary because
+	 * mouse click info isn't guaranteed to present as a
+	 * single clist item.
+	 *
+	 * Wheel mice may return buttons 4 and 5 when the wheel is turned.
+	 * We encode those as button presses.
+	 */
+	for (grabbed = 0; grabbed < 3; grabbed += (size_t) res) {
+
+	    /* For VIO mouse we add extra bit 64 to disambiguate button-up. */
+#if USE_EMX_MOUSE
+	    res = read(M_FD(sp) >= 0 ? M_FD(sp) : sp->_ifd, &kbuf, 3);
+#else
+	    res = read(sp->_ifd, kbuf + grabbed, 3 - grabbed);
+#endif
+	    if (res == -1)
+		break;
+	}
+	kbuf[3] = '\0';
+
+	TR(TRACE_IEVENT,
+	   ("_nc_mouse_inline sees the following xterm data: '%s'", kbuf));
+
+	/* there's only one mouse... */
+	eventp->id = NORMAL_EVENT;
+
+	/* processing code goes here */
+	eventp->bstate = 0;
+	prev = PREV(eventp)->bstate;
+
+#if USE_EMX_MOUSE
+#define PRESS_POSITION(n) \
+	eventp->bstate = MASK_PRESS(n); \
+	if (kbuf[0] & 0x40) \
+	    eventp->bstate = MASK_RELEASE(n)
+#else
+#define PRESS_POSITION(n) \
+	eventp->bstate = (mmask_t) (prev & MASK_PRESS(n) \
+				    ? REPORT_MOUSE_POSITION \
+				    : MASK_PRESS(n))
+#endif
+
+	switch (kbuf[0] & 0x3) {
+	case 0x0:
+	    if (kbuf[0] & 64)
+		eventp->bstate = MASK_PRESS(4);
+	    else
+		PRESS_POSITION(1);
+	    break;
+
+	case 0x1:
+#if NCURSES_MOUSE_VERSION == 2
+	    if (kbuf[0] & 64)
+		eventp->bstate = MASK_PRESS(5);
+	    else
+#endif
+		PRESS_POSITION(2);
+	    break;
+
+	case 0x2:
+	    PRESS_POSITION(3);
+	    break;
+
+	case 0x3:
+	    /*
+	     * Release events aren't reported for individual buttons, just for
+	     * the button set as a whole.  However, because there are normally
+	     * no mouse events under xterm that intervene between press and
+	     * release, we can infer the button actually released by looking at
+	     * the previous event.
+	     */
+	    if (prev & (BUTTON_PRESSED | BUTTON_RELEASED)) {
+		eventp->bstate = BUTTON_RELEASED;
+		for (b = 1; b <= MAX_BUTTONS; ++b) {
+		    if (!(prev & MASK_PRESS(b)))
+			eventp->bstate &= ~MASK_RELEASE(b);
+		}
+	    } else {
+		/*
+		 * XFree86 xterm will return a stream of release-events to
+		 * let the application know where the mouse is going, if the
+		 * private mode 1002 or 1003 is enabled.
+		 */
+		eventp->bstate = REPORT_MOUSE_POSITION;
+	    }
+	    break;
+	}
+	result = (eventp->bstate & REPORT_MOUSE_POSITION) ? TRUE : FALSE;
+
+	if (kbuf[0] & 4) {
+	    eventp->bstate |= BUTTON_SHIFT;
+	}
+	if (kbuf[0] & 8) {
+	    eventp->bstate |= BUTTON_ALT;
+	}
+	if (kbuf[0] & 16) {
+	    eventp->bstate |= BUTTON_CTRL;
+	}
+
+	eventp->x = (kbuf[1] - ' ') - 1;
+	eventp->y = (kbuf[2] - ' ') - 1;
+	TR(MY_TRACE,
+	   ("_nc_mouse_inline: primitive mouse-event %s has slot %ld",
+	    _nc_tracemouse(sp, eventp),
+	    (long) IndexEV(sp, eventp)));
+
+	/* bump the next-free pointer into the circular list */
+	sp->_mouse_eventp = NEXT(eventp);
+#if 0				/* this return would be needed for QNX's mods to lib_getch.c */
+	return (TRUE);
+#endif
+    }
+
+    return (result);
+}
+
+static void
+mouse_activate(SCREEN *sp, bool on)
+{
+    if (!on && !sp->_mouse_initialized)
+	return;
+
+    if (!_nc_mouse_init(sp))
+	return;
+
+    if (on) {
+
+	switch (sp->_mouse_type) {
+	case M_XTERM:
+#if NCURSES_EXT_FUNCS
+	    keyok(KEY_MOUSE, on);
+#endif
+	    TPUTS_TRACE("xterm mouse initialization");
+	    enable_xterm_mouse(sp, 1);
+	    break;
+#if USE_GPM_SUPPORT
+	case M_GPM:
+	    if (enable_gpm_mouse(sp, TRUE)) {
+		sp->_mouse_fd = *(my_gpm_fd);
+		T(("GPM mouse_fd %d", sp->_mouse_fd));
+	    }
+	    break;
+#endif
+#if USE_SYSMOUSE
+	case M_SYSMOUSE:
+	    signal(SIGUSR2, handle_sysmouse);
+	    sp->_mouse_active = TRUE;
+	    break;
+#endif
+	case M_NONE:
+	    return;
+	}
+	/* Make runtime binding to cut down on object size of applications that
+	 * do not use the mouse (e.g., 'clear').
+	 */
+	sp->_mouse_event = _nc_mouse_event;
+	sp->_mouse_inline = _nc_mouse_inline;
+	sp->_mouse_parse = _nc_mouse_parse;
+	sp->_mouse_resume = _nc_mouse_resume;
+	sp->_mouse_wrap = _nc_mouse_wrap;
+    } else {
+
+	switch (sp->_mouse_type) {
+	case M_XTERM:
+	    TPUTS_TRACE("xterm mouse deinitialization");
+	    enable_xterm_mouse(sp, 0);
+	    break;
+#if USE_GPM_SUPPORT
+	case M_GPM:
+	    enable_gpm_mouse(sp, FALSE);
+	    break;
+#endif
+#if USE_SYSMOUSE
+	case M_SYSMOUSE:
+	    signal(SIGUSR2, SIG_IGN);
+	    sp->_mouse_active = FALSE;
+	    break;
+#endif
+	case M_NONE:
+	    return;
+	}
+    }
+    _nc_flush();
+}
+
+/**************************************************************************
+ *
+ * Device-independent code
+ *
+ **************************************************************************/
+
+static bool
+_nc_mouse_parse(SCREEN *sp, int runcount)
+/* parse a run of atomic mouse events into a gesture */
+{
+    MEVENT *eventp = sp->_mouse_eventp;
+    MEVENT *ep, *runp, *next, *prev = PREV(eventp);
+    int n;
+    int b;
+    bool merge;
+
+    TR(MY_TRACE, ("_nc_mouse_parse(%d) called", runcount));
+
+    /*
+     * When we enter this routine, the event list next-free pointer
+     * points just past a run of mouse events that we know were separated
+     * in time by less than the critical click interval. The job of this
+     * routine is to collapse this run into a single higher-level event
+     * or gesture.
+     *
+     * We accomplish this in two passes.  The first pass merges press/release
+     * pairs into click events.  The second merges runs of click events into
+     * double or triple-click events.
+     *
+     * It's possible that the run may not resolve to a single event (for
+     * example, if the user quadruple-clicks).  If so, leading events
+     * in the run are ignored.
+     *
+     * Note that this routine is independent of the format of the specific
+     * format of the pointing-device's reports.  We can use it to parse
+     * gestures on anything that reports press/release events on a per-
+     * button basis, as long as the device-dependent mouse code puts stuff
+     * on the queue in MEVENT format.
+     */
+    if (runcount == 1) {
+	TR(MY_TRACE,
+	   ("_nc_mouse_parse: returning simple mouse event %s at slot %ld",
+	    _nc_tracemouse(sp, prev),
+	    (long) IndexEV(sp, prev)));
+	return (prev->id >= NORMAL_EVENT)
+	    ? ((prev->bstate & sp->_mouse_mask) ? TRUE : FALSE)
+	    : FALSE;
+    }
+
+    /* find the start of the run */
+    runp = eventp;
+    for (n = runcount; n > 0; n--) {
+	runp = PREV(runp);
+    }
+
+#ifdef TRACE
+    if (USE_TRACEF(TRACE_IEVENT)) {
+	_trace_slot(sp, "before mouse press/release merge:");
+	_tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d",
+		RunParams(sp, eventp, runp),
+		runcount);
+	_nc_unlock_global(tracef);
+    }
+#endif /* TRACE */
+
+    /* first pass; merge press/release pairs */
+    do {
+	merge = FALSE;
+	for (ep = runp; (next = NEXT(ep)) != eventp; ep = next) {
+
+#define MASK_CHANGED(x) (!(ep->bstate & MASK_PRESS(x)) \
+		      == !(next->bstate & MASK_RELEASE(x)))
+
+	    if (ep->x == next->x && ep->y == next->y
+		&& (ep->bstate & BUTTON_PRESSED)
+		&& MASK_CHANGED(1)
+		&& MASK_CHANGED(2)
+		&& MASK_CHANGED(3)
+		&& MASK_CHANGED(4)
+#if NCURSES_MOUSE_VERSION == 2
+		&& MASK_CHANGED(5)
+#endif
+		) {
+		for (b = 1; b <= MAX_BUTTONS; ++b) {
+		    if ((sp->_mouse_mask & MASK_CLICK(b))
+			&& (ep->bstate & MASK_PRESS(b))) {
+			ep->bstate &= ~MASK_PRESS(b);
+			ep->bstate |= MASK_CLICK(b);
+			merge = TRUE;
+		    }
+		}
+		if (merge)
+		    next->id = INVALID_EVENT;
+	    }
+	}
+    } while
+	(merge);
+
+#ifdef TRACE
+    if (USE_TRACEF(TRACE_IEVENT)) {
+	_trace_slot(sp, "before mouse click merge:");
+	_tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d",
+		RunParams(sp, eventp, runp),
+		runcount);
+	_nc_unlock_global(tracef);
+    }
+#endif /* TRACE */
+
+    /*
+     * Second pass; merge click runs.  At this point, click events are
+     * each followed by one invalid event. We merge click events
+     * forward in the queue.
+     *
+     * NOTE: There is a problem with this design!  If the application
+     * allows enough click events to pile up in the circular queue so
+     * they wrap around, it will cheerfully merge the newest forward
+     * into the oldest, creating a bogus doubleclick and confusing
+     * the queue-traversal logic rather badly.  Generally this won't
+     * happen, because calling getmouse() marks old events invalid and
+     * ineligible for merges.  The true solution to this problem would
+     * be to timestamp each MEVENT and perform the obvious sanity check,
+     * but the timer element would have to have sub-second resolution,
+     * which would get us into portability trouble.
+     */
+    do {
+	MEVENT *follower;
+
+	merge = FALSE;
+	for (ep = runp; (next = NEXT(ep)) != eventp; ep = next)
+	    if (ep->id != INVALID_EVENT) {
+		if (next->id != INVALID_EVENT)
+		    continue;
+		follower = NEXT(next);
+		if (follower->id == INVALID_EVENT)
+		    continue;
+
+		/* merge click events forward */
+		if ((ep->bstate & BUTTON_CLICKED)
+		    && (follower->bstate & BUTTON_CLICKED)) {
+		    for (b = 1; b <= MAX_BUTTONS; ++b) {
+			if ((sp->_mouse_mask & MASK_DOUBLE_CLICK(b))
+			    && (follower->bstate & MASK_CLICK(b))) {
+			    follower->bstate &= ~MASK_CLICK(b);
+			    follower->bstate |= MASK_DOUBLE_CLICK(b);
+			    merge = TRUE;
+			}
+		    }
+		    if (merge)
+			ep->id = INVALID_EVENT;
+		}
+
+		/* merge double-click events forward */
+		if ((ep->bstate & BUTTON_DOUBLE_CLICKED)
+		    && (follower->bstate & BUTTON_CLICKED)) {
+		    for (b = 1; b <= MAX_BUTTONS; ++b) {
+			if ((sp->_mouse_mask & MASK_TRIPLE_CLICK(b))
+			    && (follower->bstate & MASK_CLICK(b))) {
+			    follower->bstate &= ~MASK_CLICK(b);
+			    follower->bstate |= MASK_TRIPLE_CLICK(b);
+			    merge = TRUE;
+			}
+		    }
+		    if (merge)
+			ep->id = INVALID_EVENT;
+		}
+	    }
+    } while
+	(merge);
+
+#ifdef TRACE
+    if (USE_TRACEF(TRACE_IEVENT)) {
+	_trace_slot(sp, "before mouse event queue compaction:");
+	_tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d",
+		RunParams(sp, eventp, runp),
+		runcount);
+	_nc_unlock_global(tracef);
+    }
+#endif /* TRACE */
+
+    /*
+     * Now try to throw away trailing events flagged invalid, or that
+     * don't match the current event mask.
+     */
+    for (; runcount; prev = PREV(eventp), runcount--)
+	if (prev->id == INVALID_EVENT || !(prev->bstate & sp->_mouse_mask)) {
+	    sp->_mouse_eventp = eventp = prev;
+	}
+#ifdef TRACE
+    if (USE_TRACEF(TRACE_IEVENT)) {
+	_trace_slot(sp, "after mouse event queue compaction:");
+	_tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d",
+		RunParams(sp, eventp, runp),
+		runcount);
+	_nc_unlock_global(tracef);
+    }
+    for (ep = runp; ep != eventp; ep = NEXT(ep))
+	if (ep->id != INVALID_EVENT)
+	    TR(MY_TRACE,
+	       ("_nc_mouse_parse: returning composite mouse event %s at slot %ld",
+		_nc_tracemouse(sp, ep),
+		(long) IndexEV(sp, ep)));
+#endif /* TRACE */
+
+    /* after all this, do we have a valid event? */
+    return (PREV(eventp)->id != INVALID_EVENT);
+}
+
+static void
+_nc_mouse_wrap(SCREEN *sp)
+/* release mouse -- called by endwin() before shellout/exit */
+{
+    TR(MY_TRACE, ("_nc_mouse_wrap() called"));
+
+    switch (sp->_mouse_type) {
+    case M_XTERM:
+	if (sp->_mouse_mask)
+	    mouse_activate(sp, FALSE);
+	break;
+#if USE_GPM_SUPPORT
+	/* GPM: pass all mouse events to next client */
+    case M_GPM:
+	if (sp->_mouse_mask)
+	    mouse_activate(sp, FALSE);
+	break;
+#endif
+#if USE_SYSMOUSE
+    case M_SYSMOUSE:
+	mouse_activate(sp, FALSE);
+	break;
+#endif
+    case M_NONE:
+	break;
+    }
+}
+
+static void
+_nc_mouse_resume(SCREEN *sp)
+/* re-connect to mouse -- called by doupdate() after shellout */
+{
+    TR(MY_TRACE, ("_nc_mouse_resume() called"));
+
+    switch (sp->_mouse_type) {
+    case M_XTERM:
+	/* xterm: re-enable reporting */
+	if (sp->_mouse_mask)
+	    mouse_activate(sp, TRUE);
+	break;
+
+#if USE_GPM_SUPPORT
+    case M_GPM:
+	/* GPM: reclaim our event set */
+	if (sp->_mouse_mask)
+	    mouse_activate(sp, TRUE);
+	break;
+#endif
+
+#if USE_SYSMOUSE
+    case M_SYSMOUSE:
+	mouse_activate(sp, TRUE);
+	break;
+#endif
+    case M_NONE:
+	break;
+    }
+}
+
+/**************************************************************************
+ *
+ * Mouse interface entry points for the API
+ *
+ **************************************************************************/
+
+static int
+_nc_getmouse(SCREEN *sp, MEVENT * aevent)
+{
+    T((T_CALLED("getmouse(%p)"), aevent));
+
+    if ((aevent != 0) && (sp != 0) && (sp->_mouse_type != M_NONE)) {
+	MEVENT *eventp = sp->_mouse_eventp;
+	/* compute the current-event pointer */
+	MEVENT *prev = PREV(eventp);
+
+	/* copy the event we find there */
+	*aevent = *prev;
+
+	TR(TRACE_IEVENT, ("getmouse: returning event %s from slot %ld",
+			  _nc_tracemouse(sp, prev),
+			  (long) IndexEV(sp, prev)));
+
+	prev->id = INVALID_EVENT;	/* so the queue slot becomes free */
+	returnCode(OK);
+    }
+    returnCode(ERR);
+}
+
+/* grab a copy of the current mouse event */
+NCURSES_EXPORT(int)
+getmouse(MEVENT * aevent)
+{
+    return _nc_getmouse(SP, aevent);
+}
+
+static int
+_nc_ungetmouse(SCREEN *sp, MEVENT * aevent)
+{
+    int result = ERR;
+
+    T((T_CALLED("ungetmouse(%p)"), aevent));
+
+    if (aevent != 0 && sp != 0) {
+	MEVENT *eventp = sp->_mouse_eventp;
+
+	/* stick the given event in the next-free slot */
+	*eventp = *aevent;
+
+	/* bump the next-free pointer into the circular list */
+	sp->_mouse_eventp = NEXT(eventp);
+
+	/* push back the notification event on the keyboard queue */
+	result = _nc_ungetch(sp, KEY_MOUSE);
+    }
+    returnCode(result);
+}
+
+/* enqueue a synthesized mouse event to be seen by the next wgetch() */
+NCURSES_EXPORT(int)
+ungetmouse(MEVENT * aevent)
+{
+    return _nc_ungetmouse(SP, aevent);
+}
+
+NCURSES_EXPORT(mmask_t)
+mousemask(mmask_t newmask, mmask_t * oldmask)
+/* set the mouse event mask */
+{
+    mmask_t result = 0;
+
+    T((T_CALLED("mousemask(%#lx,%p)"), (unsigned long) newmask, oldmask));
+
+    if (SP != 0) {
+	if (oldmask)
+	    *oldmask = SP->_mouse_mask;
+
+	if (newmask || SP->_mouse_initialized) {
+	    _nc_mouse_init(SP);
+	    if (SP->_mouse_type != M_NONE) {
+		result = newmask &
+		    (REPORT_MOUSE_POSITION
+		     | BUTTON_ALT
+		     | BUTTON_CTRL
+		     | BUTTON_SHIFT
+		     | BUTTON_PRESSED
+		     | BUTTON_RELEASED
+		     | BUTTON_CLICKED
+		     | BUTTON_DOUBLE_CLICKED
+		     | BUTTON_TRIPLE_CLICKED);
+
+		mouse_activate(SP, (bool) (result != 0));
+
+		SP->_mouse_mask = result;
+	    }
+	}
+    }
+    returnBits(result);
+}
+
+NCURSES_EXPORT(bool)
+wenclose(const WINDOW *win, int y, int x)
+/* check to see if given window encloses given screen location */
+{
+    bool result = FALSE;
+
+    T((T_CALLED("wenclose(%p,%d,%d)"), win, y, x));
+
+    if (win != 0) {
+	y -= win->_yoffset;
+	result = ((win->_begy <= y &&
+		   win->_begx <= x &&
+		   (win->_begx + win->_maxx) >= x &&
+		   (win->_begy + win->_maxy) >= y) ? TRUE : FALSE);
+    }
+    returnBool(result);
+}
+
+NCURSES_EXPORT(int)
+mouseinterval(int maxclick)
+/* set the maximum mouse interval within which to recognize a click */
+{
+    int oldval;
+
+    T((T_CALLED("mouseinterval(%d)"), maxclick));
+
+    if (SP != 0) {
+	oldval = SP->_maxclick;
+	if (maxclick >= 0)
+	    SP->_maxclick = maxclick;
+    } else {
+	oldval = DEFAULT_MAXCLICK;
+    }
+
+    returnCode(oldval);
+}
+
+/* This may be used by other routines to ask for the existence of mouse
+   support */
+NCURSES_EXPORT(int)
+_nc_has_mouse(void)
+{
+    return (SP->_mouse_type == M_NONE ? 0 : 1);
+}
+
+NCURSES_EXPORT(bool)
+wmouse_trafo(const WINDOW *win, int *pY, int *pX, bool to_screen)
+{
+    bool result = FALSE;
+
+    T((T_CALLED("wmouse_trafo(%p,%p,%p,%d)"), win, pY, pX, to_screen));
+
+    if (win && pY && pX) {
+	int y = *pY;
+	int x = *pX;
+
+	if (to_screen) {
+	    y += win->_begy + win->_yoffset;
+	    x += win->_begx;
+	    if (wenclose(win, y, x))
+		result = TRUE;
+	} else {
+	    if (wenclose(win, y, x)) {
+		y -= (win->_begy + win->_yoffset);
+		x -= win->_begx;
+		result = TRUE;
+	    }
+	}
+	if (result) {
+	    *pX = x;
+	    *pY = y;
+	}
+    }
+    returnBool(result);
+}
diff --git a/ncurses/base/lib_move.c b/ncurses/base/lib_move.c
new file mode 100644
index 0000000..652c44d
--- /dev/null
+++ b/ncurses/base/lib_move.c
@@ -0,0 +1,60 @@
+/****************************************************************************
+ * Copyright (c) 1998-2000,2004 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Thomas E. Dickey                        1996-on                 *
+ ****************************************************************************/
+
+/*
+**	lib_move.c
+**
+**	The routine wmove().
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_move.c,v 1.12 2004/12/04 21:50:07 tom Exp $")
+
+NCURSES_EXPORT(int)
+wmove(WINDOW *win, int y, int x)
+{
+    T((T_CALLED("wmove(%p,%d,%d)"), win, y, x));
+
+    if (LEGALYX(win, y, x)) {
+	win->_curx = (NCURSES_SIZE_T) x;
+	win->_cury = (NCURSES_SIZE_T) y;
+
+	win->_flags &= ~_WRAPPED;
+	win->_flags |= _HASMOVED;
+	returnCode(OK);
+    } else
+	returnCode(ERR);
+}
diff --git a/ncurses/base/lib_mvwin.c b/ncurses/base/lib_mvwin.c
new file mode 100644
index 0000000..e4dad4a
--- /dev/null
+++ b/ncurses/base/lib_mvwin.c
@@ -0,0 +1,114 @@
+/****************************************************************************
+ * Copyright (c) 1998-2001,2006 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ ****************************************************************************/
+
+/*
+**	lib_mvwin.c
+**
+**	The routine mvwin().
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_mvwin.c,v 1.14 2006/02/25 22:53:46 tom Exp $")
+
+NCURSES_EXPORT(int)
+mvwin(WINDOW *win, int by, int bx)
+{
+    T((T_CALLED("mvwin(%p,%d,%d)"), win, by, bx));
+
+    if (!win || (win->_flags & _ISPAD))
+	returnCode(ERR);
+
+    /*
+     * mvwin() should only modify the indices.  See test/demo_menus.c and
+     * test/movewindow.c for examples.
+     */
+#if 0
+    /* Copying subwindows is allowed, but it is expensive... */
+    if (win->_flags & _SUBWIN) {
+	int err = ERR;
+	WINDOW *parent = win->_parent;
+	if (parent) {		/* Now comes the complicated and costly part, you should really
+				 * try to avoid to move subwindows. Because a subwindow shares
+				 * the text buffers with its parent, one can't do a simple
+				 * memmove of the text buffers. One has to create a copy, then
+				 * to relocate the subwindow and then to do a copy.
+				 */
+	    if ((by - parent->_begy == win->_pary) &&
+		(bx - parent->_begx == win->_parx))
+		err = OK;	/* we don't actually move */
+	    else {
+		WINDOW *clone = dupwin(win);
+		if (clone) {
+		    /* now we have the clone, so relocate win */
+
+		    werase(win);	/* Erase the original place     */
+		    /* fill with parents background */
+		    wbkgrnd(win, CHREF(parent->_nc_bkgd));
+		    wsyncup(win);	/* Tell the parent(s)           */
+
+		    err = mvderwin(win,
+				   by - parent->_begy,
+				   bx - parent->_begx);
+		    if (err != ERR) {
+			err = copywin(clone, win,
+				      0, 0, 0, 0, win->_maxy, win->_maxx, 0);
+			if (ERR != err)
+			    wsyncup(win);
+		    }
+		    if (ERR == delwin(clone))
+			err = ERR;
+		}
+	    }
+	}
+	returnCode(err);
+    }
+#endif
+
+    if (by + win->_maxy > screen_lines - 1
+	|| bx + win->_maxx > screen_columns - 1
+	|| by < 0
+	|| bx < 0)
+	returnCode(ERR);
+
+    /*
+     * Whether or not the window is moved, touch the window's contents so
+     * that a following call to 'wrefresh()' will paint the window at the
+     * new location.  This ensures that if the caller has refreshed another
+     * window at the same location, that this one will be displayed.
+     */
+    win->_begy = by;
+    win->_begx = bx;
+    returnCode(touchwin(win));
+}
diff --git a/ncurses/base/lib_newterm.c b/ncurses/base/lib_newterm.c
new file mode 100644
index 0000000..05982b8
--- /dev/null
+++ b/ncurses/base/lib_newterm.c
@@ -0,0 +1,235 @@
+/****************************************************************************
+ * Copyright (c) 1998-2007,2008 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Thomas E. Dickey                        1996-on                 *
+ ****************************************************************************/
+
+/*
+**	lib_newterm.c
+**
+**	The newterm() function.
+**
+*/
+
+#include <curses.priv.h>
+
+#if SVR4_TERMIO && !defined(_POSIX_SOURCE)
+#define _POSIX_SOURCE
+#endif
+
+#include <term.h>		/* clear_screen, cup & friends, cur_term */
+#include <tic.h>
+
+MODULE_ID("$Id: lib_newterm.c,v 1.73 2008/08/16 21:20:48 Werner.Fink Exp $")
+
+#ifndef ONLCR			/* Allows compilation under the QNX 4.2 OS */
+#define ONLCR 0
+#endif
+
+/*
+ * SVr4/XSI Curses specify that hardware echo is turned off in initscr, and not
+ * restored during the curses session.  The library simulates echo in software.
+ * (The behavior is unspecified if the application enables hardware echo).
+ *
+ * The newterm function also initializes terminal settings, and since initscr
+ * is supposed to behave as if it calls newterm, we do it here.
+ */
+static NCURSES_INLINE int
+_nc_initscr(void)
+{
+    int result = ERR;
+
+    /* for extended XPG4 conformance requires cbreak() at this point */
+    /* (SVr4 curses does this anyway) */
+    if (cbreak() == OK) {
+	TTY buf;
+
+	buf = cur_term->Nttyb;
+#ifdef TERMIOS
+	buf.c_lflag &= ~(ECHO | ECHONL);
+	buf.c_iflag &= ~(ICRNL | INLCR | IGNCR);
+	buf.c_oflag &= ~(ONLCR);
+#elif HAVE_SGTTY_H
+	buf.sg_flags &= ~(ECHO | CRMOD);
+#else
+	memset(&buf, 0, sizeof(buf));
+#endif
+	if ((result = _nc_set_tty_mode(&buf)) == OK)
+	    cur_term->Nttyb = buf;
+    }
+    return result;
+}
+
+/*
+ * filter() has to be called before either initscr() or newterm(), so there is
+ * apparently no way to make this flag apply to some terminals and not others,
+ * aside from possibly delaying a filter() call until some terminals have been
+ * initialized.
+ */
+NCURSES_EXPORT(void)
+filter(void)
+{
+    START_TRACE();
+    T((T_CALLED("filter")));
+    _nc_prescreen.filter_mode = TRUE;
+    returnVoid;
+}
+
+#if NCURSES_EXT_FUNCS
+/*
+ * An extension, allowing the application to open a new screen without
+ * requiring it to also be filtered.
+ */
+NCURSES_EXPORT(void)
+nofilter(void)
+{
+    START_TRACE();
+    T((T_CALLED("nofilter")));
+    _nc_prescreen.filter_mode = FALSE;
+    returnVoid;
+}
+#endif
+
+NCURSES_EXPORT(SCREEN *)
+newterm(NCURSES_CONST char *name, FILE *ofp, FILE *ifp)
+{
+    int value;
+    int errret;
+    SCREEN *current;
+    SCREEN *result = 0;
+    TERMINAL *its_term;
+
+    START_TRACE();
+    T((T_CALLED("newterm(\"%s\",%p,%p)"), name, ofp, ifp));
+
+    _nc_init_pthreads();
+    _nc_lock_global(curses);
+
+    current = SP;
+    its_term = (SP ? SP->_term : 0);
+
+    /* this loads the capability entry, then sets LINES and COLS */
+    if (setupterm(name, fileno(ofp), &errret) != ERR) {
+	int slk_format = _nc_globals.slk_format;
+
+	/*
+	 * This actually allocates the screen structure, and saves the original
+	 * terminal settings.
+	 */
+	_nc_set_screen(0);
+
+	/* allow user to set maximum escape delay from the environment */
+	if ((value = _nc_getenv_num("ESCDELAY")) >= 0) {
+	    set_escdelay(value);
+	}
+
+	if (_nc_setupscreen(LINES,
+			    COLS,
+			    ofp,
+			    _nc_prescreen.filter_mode,
+			    slk_format) == ERR) {
+	    _nc_set_screen(current);
+	    result = 0;
+	} else {
+	    assert(SP != 0);
+	    /*
+	     * In setupterm() we did a set_curterm(), but it was before we set
+	     * SP.  So the "current" screen's terminal pointer was overwritten
+	     * with a different terminal.  Later, in _nc_setupscreen(), we set
+	     * SP and the terminal pointer in the new screen.
+	     *
+	     * Restore the terminal-pointer for the pre-existing screen, if
+	     * any.
+	     */
+	    if (current)
+		current->_term = its_term;
+
+	    /* if the terminal type has real soft labels, set those up */
+	    if (slk_format && num_labels > 0 && SLK_STDFMT(slk_format))
+		_nc_slk_initialize(stdscr, COLS);
+
+	    SP->_ifd = fileno(ifp);
+	    typeahead(fileno(ifp));
+#ifdef TERMIOS
+	    SP->_use_meta = ((cur_term->Ottyb.c_cflag & CSIZE) == CS8 &&
+			     !(cur_term->Ottyb.c_iflag & ISTRIP));
+#else
+	    SP->_use_meta = FALSE;
+#endif
+	    SP->_endwin = FALSE;
+
+	    /*
+	     * Check whether we can optimize scrolling under dumb terminals in
+	     * case we do not have any of these capabilities, scrolling
+	     * optimization will be useless.
+	     */
+	    SP->_scrolling = ((scroll_forward && scroll_reverse) ||
+			      ((parm_rindex ||
+				parm_insert_line ||
+				insert_line) &&
+			       (parm_index ||
+				parm_delete_line ||
+				delete_line)));
+
+	    baudrate();		/* sets a field in the SP structure */
+
+	    SP->_keytry = 0;
+
+	    /*
+	     * Check for mismatched graphic-rendition capabilities.  Most SVr4
+	     * terminfo trees contain entries that have rmul or rmso equated to
+	     * sgr0 (Solaris curses copes with those entries).  We do this only
+	     * for curses, since many termcap applications assume that
+	     * smso/rmso and smul/rmul are paired, and will not function
+	     * properly if we remove rmso or rmul.  Curses applications
+	     * shouldn't be looking at this detail.
+	     */
+#define SGR0_TEST(mode) (mode != 0) && (exit_attribute_mode == 0 || strcmp(mode, exit_attribute_mode))
+	    SP->_use_rmso = SGR0_TEST(exit_standout_mode);
+	    SP->_use_rmul = SGR0_TEST(exit_underline_mode);
+
+	    /* compute movement costs so we can do better move optimization */
+	    _nc_mvcur_init();
+
+	    /* initialize terminal to a sane state */
+	    _nc_screen_init();
+
+	    /* Initialize the terminal line settings. */
+	    _nc_initscr();
+
+	    _nc_signal_handler(TRUE);
+
+	    result = SP;
+	}
+    }
+    _nc_unlock_global(curses);
+    returnSP(result);
+}
diff --git a/ncurses/base/lib_newwin.c b/ncurses/base/lib_newwin.c
new file mode 100644
index 0000000..587e83a
--- /dev/null
+++ b/ncurses/base/lib_newwin.c
@@ -0,0 +1,338 @@
+/****************************************************************************
+ * Copyright (c) 1998-2007,2008 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Thomas E. Dickey                        1996-on                 *
+ ****************************************************************************/
+
+/*
+**	lib_newwin.c
+**
+**	The routines newwin(), subwin() and their dependent
+**
+*/
+
+#include <curses.priv.h>
+#include <stddef.h>
+
+MODULE_ID("$Id: lib_newwin.c,v 1.52 2008/06/07 13:58:09 tom Exp $")
+
+#define window_is(name) ((sp)->_##name == win)
+
+#if USE_REENTRANT
+#define remove_window(name) \
+		sp->_##name = 0
+#else
+#define remove_window(name) \
+		sp->_##name = 0; \
+		if (win == name) \
+		    name = 0
+#endif
+
+static void
+remove_window_from_screen(WINDOW *win)
+{
+    SCREEN *sp;
+
+    for (each_screen(sp)) {
+	if (window_is(curscr)) {
+	    remove_window(curscr);
+	    break;
+	} else if (window_is(stdscr)) {
+	    remove_window(stdscr);
+	    break;
+	} else if (window_is(newscr)) {
+	    remove_window(newscr);
+	    break;
+	}
+    }
+}
+
+NCURSES_EXPORT(int)
+_nc_freewin(WINDOW *win)
+{
+    WINDOWLIST *p, *q;
+    int i;
+    int result = ERR;
+
+    T((T_CALLED("_nc_freewin(%p)"), win));
+
+    if (win != 0) {
+	if (_nc_try_global(curses) == 0) {
+	    q = 0;
+	    for (each_window(p)) {
+		if (&(p->win) == win) {
+		    remove_window_from_screen(win);
+		    if (q == 0)
+			_nc_windows = p->next;
+		    else
+			q->next = p->next;
+
+		    if (!(win->_flags & _SUBWIN)) {
+			for (i = 0; i <= win->_maxy; i++)
+			    FreeIfNeeded(win->_line[i].text);
+		    }
+		    free(win->_line);
+		    free(p);
+
+		    result = OK;
+		    T(("...deleted win=%p", win));
+		    break;
+		}
+		q = p;
+	    }
+	    _nc_unlock_global(curses);
+	}
+    }
+    returnCode(result);
+}
+
+NCURSES_EXPORT(WINDOW *)
+newwin(int num_lines, int num_columns, int begy, int begx)
+{
+    WINDOW *win;
+    NCURSES_CH_T *ptr;
+    int i;
+
+    T((T_CALLED("newwin(%d,%d,%d,%d)"), num_lines, num_columns, begy, begx));
+
+    if (begy < 0 || begx < 0 || num_lines < 0 || num_columns < 0)
+	returnWin(0);
+
+    if (num_lines == 0)
+	num_lines = SP->_lines_avail - begy;
+    if (num_columns == 0)
+	num_columns = screen_columns - begx;
+
+    if ((win = _nc_makenew(num_lines, num_columns, begy, begx, 0)) == 0)
+	returnWin(0);
+
+    for (i = 0; i < num_lines; i++) {
+	win->_line[i].text = typeCalloc(NCURSES_CH_T, (unsigned) num_columns);
+	if (win->_line[i].text == 0) {
+	    (void) _nc_freewin(win);
+	    returnWin(0);
+	}
+	for (ptr = win->_line[i].text;
+	     ptr < win->_line[i].text + num_columns;
+	     ptr++)
+	    SetChar(*ptr, BLANK_TEXT, BLANK_ATTR);
+    }
+
+    returnWin(win);
+}
+
+NCURSES_EXPORT(WINDOW *)
+derwin(WINDOW *orig, int num_lines, int num_columns, int begy, int begx)
+{
+    WINDOW *win;
+    int i;
+    int flags = _SUBWIN;
+
+    T((T_CALLED("derwin(%p,%d,%d,%d,%d)"), orig, num_lines, num_columns,
+       begy, begx));
+
+    /*
+     * make sure window fits inside the original one
+     */
+    if (begy < 0 || begx < 0 || orig == 0 || num_lines < 0 || num_columns < 0)
+	returnWin(0);
+    if (begy + num_lines > orig->_maxy + 1
+	|| begx + num_columns > orig->_maxx + 1)
+	returnWin(0);
+
+    if (num_lines == 0)
+	num_lines = orig->_maxy + 1 - begy;
+
+    if (num_columns == 0)
+	num_columns = orig->_maxx + 1 - begx;
+
+    if (orig->_flags & _ISPAD)
+	flags |= _ISPAD;
+
+    if ((win = _nc_makenew(num_lines, num_columns, orig->_begy + begy,
+			   orig->_begx + begx, flags)) == 0)
+	returnWin(0);
+
+    win->_pary = begy;
+    win->_parx = begx;
+    WINDOW_ATTRS(win) = WINDOW_ATTRS(orig);
+    win->_nc_bkgd = orig->_nc_bkgd;
+
+    for (i = 0; i < num_lines; i++)
+	win->_line[i].text = &orig->_line[begy++].text[begx];
+
+    win->_parent = orig;
+
+    returnWin(win);
+}
+
+NCURSES_EXPORT(WINDOW *)
+subwin(WINDOW *w, int l, int c, int y, int x)
+{
+    T((T_CALLED("subwin(%p, %d, %d, %d, %d)"), w, l, c, y, x));
+    T(("parent has begy = %ld, begx = %ld", (long) w->_begy, (long) w->_begx));
+
+    returnWin(derwin(w, l, c, y - w->_begy, x - w->_begx));
+}
+
+static bool
+dimension_limit(int value)
+{
+    NCURSES_SIZE_T test = value;
+    return (test == value && value > 0);
+}
+
+NCURSES_EXPORT(WINDOW *)
+_nc_makenew(int num_lines, int num_columns, int begy, int begx, int flags)
+{
+    int i;
+    WINDOWLIST *wp;
+    WINDOW *win;
+    bool is_pad = (flags & _ISPAD);
+
+    T((T_CALLED("_nc_makenew(%d,%d,%d,%d)"), num_lines, num_columns, begy, begx));
+
+    if (SP == 0)
+	returnWin(0);
+
+    if (!dimension_limit(num_lines) || !dimension_limit(num_columns))
+	returnWin(0);
+
+    if ((wp = typeCalloc(WINDOWLIST, 1)) == 0)
+	returnWin(0);
+
+    win = &(wp->win);
+
+    if ((win->_line = typeCalloc(struct ldat, ((unsigned) num_lines))) == 0) {
+	free(win);
+	returnWin(0);
+    }
+
+    _nc_lock_global(curses);
+
+    win->_curx = 0;
+    win->_cury = 0;
+    win->_maxy = num_lines - 1;
+    win->_maxx = num_columns - 1;
+    win->_begy = begy;
+    win->_begx = begx;
+    win->_yoffset = SP->_topstolen;
+
+    win->_flags = flags;
+    WINDOW_ATTRS(win) = A_NORMAL;
+    SetChar(win->_nc_bkgd, BLANK_TEXT, BLANK_ATTR);
+
+    win->_clear = is_pad ? FALSE : (num_lines == screen_lines
+				    && num_columns == screen_columns);
+    win->_idlok = FALSE;
+    win->_idcok = TRUE;
+    win->_scroll = FALSE;
+    win->_leaveok = FALSE;
+    win->_use_keypad = FALSE;
+    win->_delay = -1;
+    win->_immed = FALSE;
+    win->_sync = 0;
+    win->_parx = -1;
+    win->_pary = -1;
+    win->_parent = 0;
+
+    win->_regtop = 0;
+    win->_regbottom = num_lines - 1;
+
+    win->_pad._pad_y = -1;
+    win->_pad._pad_x = -1;
+    win->_pad._pad_top = -1;
+    win->_pad._pad_bottom = -1;
+    win->_pad._pad_left = -1;
+    win->_pad._pad_right = -1;
+
+    for (i = 0; i < num_lines; i++) {
+	/*
+	 * This used to do
+	 *
+	 * win->_line[i].firstchar = win->_line[i].lastchar = _NOCHANGE;
+	 *
+	 * which marks the whole window unchanged.  That's how
+	 * SVr1 curses did it, but SVr4 curses marks the whole new
+	 * window changed.
+	 *
+	 * With the old SVr1-like code, say you have stdscr full of
+	 * characters, then create a new window with newwin(),
+	 * then do a printw(win, "foo        ");, the trailing spaces are
+	 * completely ignored by the following refreshes.  So, you
+	 * get "foojunkjunk" on the screen instead of "foo        " as
+	 * you actually intended.
+	 *
+	 * SVr4 doesn't do this.  Instead the spaces are actually written.
+	 * So that's how we want ncurses to behave.
+	 */
+	win->_line[i].firstchar = 0;
+	win->_line[i].lastchar = num_columns - 1;
+
+	if_USE_SCROLL_HINTS(win->_line[i].oldindex = i);
+    }
+
+    if (!is_pad && (begx + num_columns == screen_columns)) {
+	win->_flags |= _ENDLINE;
+
+	if (begx == 0 && num_lines == screen_lines && begy == 0)
+	    win->_flags |= _FULLWIN;
+
+	if (begy + num_lines == screen_lines)
+	    win->_flags |= _SCROLLWIN;
+    }
+
+    wp->next = _nc_windows;
+    wp->screen = SP;
+    _nc_windows = wp;
+
+    T((T_CREATE("window %p"), win));
+
+    _nc_unlock_global(curses);
+    returnWin(win);
+}
+
+/*
+ * wgetch() and other functions with a WINDOW* parameter may use a SCREEN*
+ * internally, and it is useful to allow those to be invoked without switching
+ * SCREEN's, e.g., for multi-threaded applications.
+ */
+NCURSES_EXPORT(SCREEN *)
+_nc_screen_of(WINDOW *win)
+{
+    SCREEN *sp = 0;
+
+    if (win != 0) {
+	WINDOWLIST *wp = (WINDOWLIST *) win;
+	sp = wp->screen;
+    }
+    return (sp);
+}
diff --git a/ncurses/base/lib_nl.c b/ncurses/base/lib_nl.c
new file mode 100644
index 0000000..32515da
--- /dev/null
+++ b/ncurses/base/lib_nl.c
@@ -0,0 +1,79 @@
+/****************************************************************************
+ * Copyright (c) 1998,1999,2000 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ ****************************************************************************/
+
+/*
+ *	nl.c
+ *
+ *	Routines:
+ *		nl()
+ *		nonl()
+ *
+ */
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_nl.c,v 1.8 2000/12/10 02:43:27 tom Exp $")
+
+#ifdef __EMX__
+#include <io.h>
+#endif
+
+NCURSES_EXPORT(int)
+nl(void)
+{
+    T((T_CALLED("nl()")));
+
+    SP->_nl = TRUE;
+
+#ifdef __EMX__
+    _nc_flush();
+    _fsetmode(NC_OUTPUT, "t");
+#endif
+
+    returnCode(OK);
+}
+
+NCURSES_EXPORT(int)
+nonl(void)
+{
+    T((T_CALLED("nonl()")));
+
+    SP->_nl = FALSE;
+
+#ifdef __EMX__
+    _nc_flush();
+    _fsetmode(NC_OUTPUT, "b");
+#endif
+
+    returnCode(OK);
+}
diff --git a/ncurses/base/lib_overlay.c b/ncurses/base/lib_overlay.c
new file mode 100644
index 0000000..669e8e7
--- /dev/null
+++ b/ncurses/base/lib_overlay.c
@@ -0,0 +1,206 @@
+/****************************************************************************
+ * Copyright (c) 1998-2007,2008 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ ****************************************************************************/
+
+/*
+**	lib_overlay.c
+**
+**	The routines overlay(), copywin(), and overwrite().
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_overlay.c,v 1.27 2008/06/07 23:30:34 tom Exp $")
+
+static int
+overlap(const WINDOW *const src, WINDOW *const dst, int const flag)
+{
+    int rc = ERR;
+    int sx1, sy1, sx2, sy2;
+    int dx1, dy1, dx2, dy2;
+    int sminrow, smincol;
+    int dminrow, dmincol;
+    int dmaxrow, dmaxcol;
+
+    T((T_CALLED("overlap(%p,%p,%d)"), src, dst, flag));
+
+    if (src != 0 && dst != 0) {
+	_nc_lock_global(curses);
+
+	T(("src : begy %ld, begx %ld, maxy %ld, maxx %ld",
+	   (long) src->_begy,
+	   (long) src->_begx,
+	   (long) src->_maxy,
+	   (long) src->_maxx));
+	T(("dst : begy %ld, begx %ld, maxy %ld, maxx %ld",
+	   (long) dst->_begy,
+	   (long) dst->_begx,
+	   (long) dst->_maxy,
+	   (long) dst->_maxx));
+
+	sx1 = src->_begx;
+	sy1 = src->_begy;
+	sx2 = sx1 + src->_maxx;
+	sy2 = sy1 + src->_maxy;
+
+	dx1 = dst->_begx;
+	dy1 = dst->_begy;
+	dx2 = dx1 + dst->_maxx;
+	dy2 = dy1 + dst->_maxy;
+
+	if (dx2 >= sx1 && dx1 <= sx2 && dy2 >= sy1 && dy1 <= sy2) {
+	    sminrow = max(sy1, dy1) - sy1;
+	    smincol = max(sx1, dx1) - sx1;
+	    dminrow = max(sy1, dy1) - dy1;
+	    dmincol = max(sx1, dx1) - dx1;
+	    dmaxrow = min(sy2, dy2) - dy1;
+	    dmaxcol = min(sx2, dx2) - dx1;
+
+	    rc = copywin(src, dst,
+			 sminrow, smincol,
+			 dminrow, dmincol,
+			 dmaxrow, dmaxcol,
+			 flag);
+	}
+	_nc_unlock_global(curses);
+    }
+    returnCode(rc);
+}
+
+/*
+**
+**	overlay(win1, win2)
+**
+**
+**	overlay() writes the overlapping area of win1 behind win2
+**	on win2 non-destructively.
+**
+**/
+
+NCURSES_EXPORT(int)
+overlay(const WINDOW *win1, WINDOW *win2)
+{
+    T((T_CALLED("overlay(%p,%p)"), win1, win2));
+    returnCode(overlap(win1, win2, TRUE));
+}
+
+/*
+**
+**	overwrite(win1, win2)
+**
+**
+**	overwrite() writes the overlapping area of win1 behind win2
+**	on win2 destructively.
+**
+**/
+
+NCURSES_EXPORT(int)
+overwrite(const WINDOW *win1, WINDOW *win2)
+{
+    T((T_CALLED("overwrite(%p,%p)"), win1, win2));
+    returnCode(overlap(win1, win2, FALSE));
+}
+
+NCURSES_EXPORT(int)
+copywin(const WINDOW *src, WINDOW *dst,
+	int sminrow, int smincol,
+	int dminrow, int dmincol,
+	int dmaxrow, int dmaxcol,
+	int over)
+{
+    int rc = ERR;
+    int sx, sy, dx, dy;
+    bool touched;
+    attr_t bk;
+    attr_t mask;
+
+    T((T_CALLED("copywin(%p, %p, %d, %d, %d, %d, %d, %d, %d)"),
+       src, dst, sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol, over));
+
+    if (src && dst) {
+	_nc_lock_global(curses);
+
+	bk = AttrOf(dst->_nc_bkgd);
+	mask = ~(attr_t) ((bk & A_COLOR) ? A_COLOR : 0);
+
+	/* make sure rectangle exists in source */
+	if ((sminrow + dmaxrow - dminrow) <= (src->_maxy + 1) &&
+	    (smincol + dmaxcol - dmincol) <= (src->_maxx + 1)) {
+
+	    T(("rectangle exists in source"));
+
+	    /* make sure rectangle fits in destination */
+	    if (dmaxrow <= dst->_maxy && dmaxcol <= dst->_maxx) {
+
+		T(("rectangle fits in destination"));
+
+		for (dy = dminrow, sy = sminrow;
+		     dy <= dmaxrow;
+		     sy++, dy++) {
+
+		    touched = FALSE;
+		    for (dx = dmincol, sx = smincol;
+			 dx <= dmaxcol;
+			 sx++, dx++) {
+			if (over) {
+			    if ((CharOf(src->_line[sy].text[sx]) != L(' ')) &&
+				(!CharEq(dst->_line[dy].text[dx],
+					 src->_line[sy].text[sx]))) {
+				dst->_line[dy].text[dx] =
+				    src->_line[sy].text[sx];
+				SetAttr(dst->_line[dy].text[dx],
+					((AttrOf(src->_line[sy].text[sx]) &
+					  mask) | bk));
+				touched = TRUE;
+			    }
+			} else {
+			    if (!CharEq(dst->_line[dy].text[dx],
+					src->_line[sy].text[sx])) {
+				dst->_line[dy].text[dx] =
+				    src->_line[sy].text[sx];
+				touched = TRUE;
+			    }
+			}
+		    }
+		    if (touched) {
+			touchline(dst, dminrow, (dmaxrow - dminrow + 1));
+		    }
+		}
+		T(("finished copywin"));
+		rc = OK;
+	    }
+	}
+	_nc_unlock_global(curses);
+    }
+    returnCode(rc);
+}
diff --git a/ncurses/base/lib_pad.c b/ncurses/base/lib_pad.c
new file mode 100644
index 0000000..6cad9c5
--- /dev/null
+++ b/ncurses/base/lib_pad.c
@@ -0,0 +1,322 @@
+/****************************************************************************
+ * Copyright (c) 1998-2004,2006 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ ****************************************************************************/
+
+/*
+ * lib_pad.c
+ * newpad	-- create a new pad
+ * pnoutrefresh -- refresh a pad, no update
+ * pechochar	-- add a char to a pad and refresh
+ */
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_pad.c,v 1.41 2006/10/14 20:47:13 tom Exp $")
+
+NCURSES_EXPORT(WINDOW *)
+newpad(int l, int c)
+{
+    WINDOW *win;
+    NCURSES_CH_T *ptr;
+    int i;
+
+    T((T_CALLED("newpad(%d, %d)"), l, c));
+
+    if (l <= 0 || c <= 0)
+	returnWin(0);
+
+    if ((win = _nc_makenew(l, c, 0, 0, _ISPAD)) == NULL)
+	returnWin(0);
+
+    for (i = 0; i < l; i++) {
+	if_USE_SCROLL_HINTS(win->_line[i].oldindex = _NEWINDEX);
+	if ((win->_line[i].text = typeCalloc(NCURSES_CH_T, ((size_t) c))) == 0) {
+	    (void) _nc_freewin(win);
+	    returnWin(0);
+	}
+	for (ptr = win->_line[i].text; ptr < win->_line[i].text + c; ptr++)
+	    SetChar(*ptr, BLANK_TEXT, BLANK_ATTR);
+    }
+
+    returnWin(win);
+}
+
+NCURSES_EXPORT(WINDOW *)
+subpad(WINDOW *orig, int l, int c, int begy, int begx)
+{
+    WINDOW *win = (WINDOW *) 0;
+
+    T((T_CALLED("subpad(%d, %d)"), l, c));
+
+    if (orig) {
+	if (!(orig->_flags & _ISPAD)
+	    || ((win = derwin(orig, l, c, begy, begx)) == NULL))
+	    returnWin(0);
+    }
+    returnWin(win);
+}
+
+NCURSES_EXPORT(int)
+prefresh(WINDOW *win,
+	 int pminrow,
+	 int pmincol,
+	 int sminrow,
+	 int smincol,
+	 int smaxrow,
+	 int smaxcol)
+{
+    T((T_CALLED("prefresh()")));
+    if (pnoutrefresh(win, pminrow, pmincol, sminrow, smincol, smaxrow,
+		     smaxcol) != ERR
+	&& doupdate() != ERR) {
+	returnCode(OK);
+    }
+    returnCode(ERR);
+}
+
+NCURSES_EXPORT(int)
+pnoutrefresh(WINDOW *win,
+	     int pminrow,
+	     int pmincol,
+	     int sminrow,
+	     int smincol,
+	     int smaxrow,
+	     int smaxcol)
+{
+    NCURSES_SIZE_T i, j;
+    NCURSES_SIZE_T m, n;
+    NCURSES_SIZE_T pmaxrow;
+    NCURSES_SIZE_T pmaxcol;
+
+#if USE_SCROLL_HINTS
+    const int my_len = 2;	/* parameterize the threshold for hardscroll */
+    NCURSES_SIZE_T displaced;
+    bool wide;
+#endif
+
+    T((T_CALLED("pnoutrefresh(%p, %d, %d, %d, %d, %d, %d)"),
+       win, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol));
+
+    if (win == 0)
+	returnCode(ERR);
+
+    if (!(win->_flags & _ISPAD))
+	returnCode(ERR);
+
+    /* negative values are interpreted as zero */
+    if (pminrow < 0)
+	pminrow = 0;
+    if (pmincol < 0)
+	pmincol = 0;
+    if (sminrow < 0)
+	sminrow = 0;
+    if (smincol < 0)
+	smincol = 0;
+
+    pmaxrow = pminrow + smaxrow - sminrow;
+    pmaxcol = pmincol + smaxcol - smincol;
+
+    T((" pminrow + smaxrow - sminrow %ld, win->_maxy %ld",
+       (long) pmaxrow, (long) win->_maxy));
+    T((" pmincol + smaxcol - smincol %ld, win->_maxx %ld",
+       (long) pmaxcol, (long) win->_maxx));
+
+    /*
+     * Trim the caller's screen size back to the actual limits.
+     */
+    if (pmaxrow > win->_maxy) {
+	smaxrow -= (pmaxrow - win->_maxy);
+	pmaxrow = pminrow + smaxrow - sminrow;
+    }
+    if (pmaxcol > win->_maxx) {
+	smaxcol -= (pmaxcol - win->_maxx);
+	pmaxcol = pmincol + smaxcol - smincol;
+    }
+
+    if (smaxrow >= screen_lines
+	|| smaxcol >= screen_columns
+	|| sminrow > smaxrow
+	|| smincol > smaxcol)
+	returnCode(ERR);
+
+    T(("pad being refreshed"));
+
+#if USE_SCROLL_HINTS
+    if (win->_pad._pad_y >= 0) {
+	displaced = pminrow - win->_pad._pad_y
+	    - (sminrow - win->_pad._pad_top);
+	T(("pad being shifted by %d line(s)", displaced));
+    } else
+	displaced = 0;
+#endif
+
+    /*
+     * For pure efficiency, we'd want to transfer scrolling information
+     * from the pad to newscr whenever the window is wide enough that
+     * its update will dominate the cost of the update for the horizontal
+     * band of newscr that it occupies.  Unfortunately, this threshold
+     * tends to be complex to estimate, and in any case scrolling the
+     * whole band and rewriting the parts outside win's image would look
+     * really ugly.  So.  What we do is consider the pad "wide" if it
+     * either (a) occupies the whole width of newscr, or (b) occupies
+     * all but at most one column on either vertical edge of the screen
+     * (this caters to fussy people who put boxes around full-screen
+     * windows).  Note that changing this formula will not break any code,
+     * merely change the costs of various update cases.
+     */
+#if USE_SCROLL_HINTS
+    wide = (smincol < my_len && smaxcol > (newscr->_maxx - my_len));
+#endif
+
+    for (i = pminrow, m = sminrow + win->_yoffset;
+	 i <= pmaxrow && m <= newscr->_maxy;
+	 i++, m++) {
+	register struct ldat *nline = &newscr->_line[m];
+	register struct ldat *oline = &win->_line[i];
+	for (j = pmincol, n = smincol; j <= pmaxcol; j++, n++) {
+	    NCURSES_CH_T ch = oline->text[j];
+#if USE_WIDEC_SUPPORT
+	    /*
+	     * Special case for leftmost character of the displayed area.
+	     * Only half of a double-width character may be visible.
+	     */
+	    if (j == pmincol
+		&& j > 0
+		&& isWidecExt(ch)) {
+		SetChar(ch, L(' '), AttrOf(oline->text[j - 1]));
+	    }
+#endif
+	    if (!CharEq(ch, nline->text[n])) {
+		nline->text[n] = ch;
+		CHANGED_CELL(nline, n);
+	    }
+	}
+
+#if USE_SCROLL_HINTS
+	if (wide) {
+	    int nind = m + displaced;
+	    if (oline->oldindex < 0
+		|| nind < sminrow
+		|| nind > smaxrow) {
+		nind = _NEWINDEX;
+	    } else if (displaced) {
+		register struct ldat *pline = &curscr->_line[nind];
+		for (j = 0; j <= my_len; j++) {
+		    int k = newscr->_maxx - j;
+		    if (pline->text[j] != nline->text[j]
+			|| pline->text[k] != nline->text[k]) {
+			nind = _NEWINDEX;
+			break;
+		    }
+		}
+	    }
+
+	    nline->oldindex = nind;
+	}
+#endif /* USE_SCROLL_HINTS */
+	oline->firstchar = oline->lastchar = _NOCHANGE;
+	if_USE_SCROLL_HINTS(oline->oldindex = i);
+    }
+
+    /*
+     * Clean up debris from scrolling or resizing the pad, so we do not
+     * accidentally pick up the index value during the next call to this
+     * procedure.  The only rows that should have an index value are those
+     * that are displayed during this cycle.
+     */
+#if USE_SCROLL_HINTS
+    for (i = pminrow - 1; (i >= 0) && (win->_line[i].oldindex >= 0); i--)
+	win->_line[i].oldindex = _NEWINDEX;
+    for (i = pmaxrow + 1; (i <= win->_maxy)
+	 && (win->_line[i].oldindex >= 0); i++)
+	win->_line[i].oldindex = _NEWINDEX;
+#endif
+
+    win->_begx = smincol;
+    win->_begy = sminrow;
+
+    if (win->_clear) {
+	win->_clear = FALSE;
+	newscr->_clear = TRUE;
+    }
+
+    /*
+     * Use the pad's current position, if it will be visible.
+     * If not, don't do anything; it's not an error.
+     */
+    if (win->_leaveok == FALSE
+	&& win->_cury >= pminrow
+	&& win->_curx >= pmincol
+	&& win->_cury <= pmaxrow
+	&& win->_curx <= pmaxcol) {
+	newscr->_cury = win->_cury - pminrow + win->_begy + win->_yoffset;
+	newscr->_curx = win->_curx - pmincol + win->_begx;
+    }
+    newscr->_leaveok = win->_leaveok;
+    win->_flags &= ~_HASMOVED;
+
+    /*
+     * Update our cache of the line-numbers that we displayed from the pad.
+     * We will use this on subsequent calls to this function to derive
+     * values to stuff into 'oldindex[]' -- for scrolling optimization.
+     */
+    win->_pad._pad_y = pminrow;
+    win->_pad._pad_x = pmincol;
+    win->_pad._pad_top = sminrow;
+    win->_pad._pad_left = smincol;
+    win->_pad._pad_bottom = smaxrow;
+    win->_pad._pad_right = smaxcol;
+
+    returnCode(OK);
+}
+
+NCURSES_EXPORT(int)
+pechochar(WINDOW *pad, const chtype ch)
+{
+    T((T_CALLED("pechochar(%p, %s)"), pad, _tracechtype(ch)));
+
+    if (pad == 0)
+	returnCode(ERR);
+
+    if (!(pad->_flags & _ISPAD))
+	returnCode(wechochar(pad, ch));
+
+    waddch(pad, ch);
+    prefresh(pad, pad->_pad._pad_y,
+	     pad->_pad._pad_x,
+	     pad->_pad._pad_top,
+	     pad->_pad._pad_left,
+	     pad->_pad._pad_bottom,
+	     pad->_pad._pad_right);
+
+    returnCode(OK);
+}
diff --git a/ncurses/base/lib_printw.c b/ncurses/base/lib_printw.c
new file mode 100644
index 0000000..62ae921
--- /dev/null
+++ b/ncurses/base/lib_printw.c
@@ -0,0 +1,138 @@
+/****************************************************************************
+ * Copyright (c) 1998-2003,2005 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 <dickey@clark.net> 1997                        *
+ ****************************************************************************/
+
+/*
+**	lib_printw.c
+**
+**	The routines printw(), wprintw() and friends.
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_printw.c,v 1.18 2006/12/17 19:21:39 tom Exp $")
+
+NCURSES_EXPORT(int)
+printw(const char *fmt,...)
+{
+    va_list argp;
+    int code;
+
+#ifdef TRACE
+    va_start(argp, fmt);
+    T((T_CALLED("printw(%s%s)"),
+       _nc_visbuf(fmt), _nc_varargs(fmt, argp)));
+    va_end(argp);
+#endif
+
+    va_start(argp, fmt);
+    code = vwprintw(stdscr, fmt, argp);
+    va_end(argp);
+
+    returnCode(code);
+}
+
+NCURSES_EXPORT(int)
+wprintw(WINDOW *win, const char *fmt,...)
+{
+    va_list argp;
+    int code;
+
+#ifdef TRACE
+    va_start(argp, fmt);
+    T((T_CALLED("wprintw(%p,%s%s)"),
+       win, _nc_visbuf(fmt), _nc_varargs(fmt, argp)));
+    va_end(argp);
+#endif
+
+    va_start(argp, fmt);
+    code = vwprintw(win, fmt, argp);
+    va_end(argp);
+
+    returnCode(code);
+}
+
+NCURSES_EXPORT(int)
+mvprintw(int y, int x, const char *fmt,...)
+{
+    va_list argp;
+    int code;
+
+#ifdef TRACE
+    va_start(argp, fmt);
+    T((T_CALLED("mvprintw(%d,%d,%s%s)"),
+       y, x, _nc_visbuf(fmt), _nc_varargs(fmt, argp)));
+    va_end(argp);
+#endif
+
+    if ((code = move(y, x)) != ERR) {
+	va_start(argp, fmt);
+	code = vwprintw(stdscr, fmt, argp);
+	va_end(argp);
+    }
+    returnCode(code);
+}
+
+NCURSES_EXPORT(int)
+mvwprintw(WINDOW *win, int y, int x, const char *fmt,...)
+{
+    va_list argp;
+    int code;
+
+#ifdef TRACE
+    va_start(argp, fmt);
+    T((T_CALLED("mvwprintw(%d,%d,%p,%s%s)"),
+       y, x, win, _nc_visbuf(fmt), _nc_varargs(fmt, argp)));
+    va_end(argp);
+#endif
+
+    if ((code = wmove(win, y, x)) != ERR) {
+	va_start(argp, fmt);
+	code = vwprintw(win, fmt, argp);
+	va_end(argp);
+    }
+    returnCode(code);
+}
+
+NCURSES_EXPORT(int)
+vwprintw(WINDOW *win, const char *fmt, va_list argp)
+{
+    char *buf;
+    int code = ERR;
+
+    T((T_CALLED("vwprintw(%p,%s,va_list)"), win, _nc_visbuf(fmt)));
+
+    if ((buf = _nc_printf_string(fmt, argp)) != 0) {
+	code = waddstr(win, buf);
+    }
+    returnCode(code);
+}
diff --git a/ncurses/base/lib_redrawln.c b/ncurses/base/lib_redrawln.c
new file mode 100644
index 0000000..6b0905f
--- /dev/null
+++ b/ncurses/base/lib_redrawln.c
@@ -0,0 +1,84 @@
+/****************************************************************************
+ * 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 <dickey@clark.net> 1997                        *
+ ****************************************************************************/
+
+/*
+ *	lib_redrawln.c
+ *
+ *	The routine wredrawln().
+ *
+ */
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_redrawln.c,v 1.12 2007/10/13 20:08:56 tom Exp $")
+
+NCURSES_EXPORT(int)
+wredrawln(WINDOW *win, int beg, int num)
+{
+    int i;
+    int end;
+    size_t len;
+
+    T((T_CALLED("wredrawln(%p,%d,%d)"), win, beg, num));
+
+    if (win == 0)
+	returnCode(ERR);
+
+    if (beg < 0)
+	beg = 0;
+
+    if (touchline(win, beg, num) == ERR)
+	returnCode(ERR);
+
+    if (touchline(curscr, beg + win->_begy, num) == ERR)
+	returnCode(ERR);
+
+    end = beg + num;
+    if (end > curscr->_maxy + 1)
+	end = curscr->_maxy + 1;
+    if (end > win->_maxy + 1)
+	end = win->_maxy + 1;
+
+    len = (win->_maxx + 1);
+    if (len > (size_t) (curscr->_maxx + 1))
+	len = (size_t) (curscr->_maxx + 1);
+    len *= sizeof(curscr->_line[0].text[0]);
+
+    for (i = beg; i < end; i++) {
+	int crow = i + win->_begy;
+
+	memset(curscr->_line[crow].text + win->_begx, 0, len);
+	_nc_make_oldhash(crow);
+    }
+
+    returnCode(OK);
+}
diff --git a/ncurses/base/lib_refresh.c b/ncurses/base/lib_refresh.c
new file mode 100644
index 0000000..2a9cafb
--- /dev/null
+++ b/ncurses/base/lib_refresh.c
@@ -0,0 +1,288 @@
+/****************************************************************************
+ * 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Thomas E. Dickey                        1996-on                 *
+ ****************************************************************************/
+
+/*
+ *	lib_refresh.c
+ *
+ *	The routines wrefresh() and wnoutrefresh().
+ *
+ */
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_refresh.c,v 1.41 2007/09/29 20:39:34 tom Exp $")
+
+NCURSES_EXPORT(int)
+wrefresh(WINDOW *win)
+{
+    int code;
+
+    T((T_CALLED("wrefresh(%p)"), win));
+
+    if (win == 0) {
+	code = ERR;
+    } else if (win == curscr) {
+	curscr->_clear = TRUE;
+	code = doupdate();
+    } else if ((code = wnoutrefresh(win)) == OK) {
+	if (win->_clear)
+	    newscr->_clear = TRUE;
+	code = doupdate();
+	/*
+	 * Reset the clearok() flag in case it was set for the special
+	 * case in hardscroll.c (if we don't reset it here, we'll get 2
+	 * refreshes because the flag is copied from stdscr to newscr).
+	 * Resetting the flag shouldn't do any harm, anyway.
+	 */
+	win->_clear = FALSE;
+    }
+    returnCode(code);
+}
+
+NCURSES_EXPORT(int)
+wnoutrefresh(WINDOW *win)
+{
+    NCURSES_SIZE_T limit_x;
+    NCURSES_SIZE_T src_row, src_col;
+    NCURSES_SIZE_T begx;
+    NCURSES_SIZE_T begy;
+    NCURSES_SIZE_T dst_row, dst_col;
+#if USE_SCROLL_HINTS
+    bool wide;
+#endif
+
+    T((T_CALLED("wnoutrefresh(%p)"), win));
+#ifdef TRACE
+    if (USE_TRACEF(TRACE_UPDATE)) {
+	_tracedump("...win", win);
+	_nc_unlock_global(tracef);
+    }
+#endif /* TRACE */
+
+    /*
+     * This function will break badly if we try to refresh a pad.
+     */
+    if ((win == 0)
+	|| (win->_flags & _ISPAD))
+	returnCode(ERR);
+
+    /* put them here so "win == 0" won't break our code */
+    begx = win->_begx;
+    begy = win->_begy;
+
+    newscr->_nc_bkgd = win->_nc_bkgd;
+    WINDOW_ATTRS(newscr) = WINDOW_ATTRS(win);
+
+    /* merge in change information from all subwindows of this window */
+    wsyncdown(win);
+
+#if USE_SCROLL_HINTS
+    /*
+     * For pure efficiency, we'd want to transfer scrolling information
+     * from the window to newscr whenever the window is wide enough that
+     * its update will dominate the cost of the update for the horizontal
+     * band of newscr that it occupies.  Unfortunately, this threshold
+     * tends to be complex to estimate, and in any case scrolling the
+     * whole band and rewriting the parts outside win's image would look
+     * really ugly.  So.  What we do is consider the window "wide" if it
+     * either (a) occupies the whole width of newscr, or (b) occupies
+     * all but at most one column on either vertical edge of the screen
+     * (this caters to fussy people who put boxes around full-screen
+     * windows).  Note that changing this formula will not break any code,
+     * merely change the costs of various update cases.
+     */
+    wide = (begx <= 1 && win->_maxx >= (newscr->_maxx - 1));
+#endif
+
+    win->_flags &= ~_HASMOVED;
+
+    /*
+     * Microtweaking alert!  This double loop is one of the genuine
+     * hot spots in the code.  Even gcc doesn't seem to do enough
+     * common-subexpression chunking to make it really tense,
+     * so we'll force the issue.
+     */
+
+    /* limit(dst_col) */
+    limit_x = win->_maxx;
+    /* limit(src_col) */
+    if (limit_x > newscr->_maxx - begx)
+	limit_x = newscr->_maxx - begx;
+
+    for (src_row = 0, dst_row = begy + win->_yoffset;
+	 src_row <= win->_maxy && dst_row <= newscr->_maxy;
+	 src_row++, dst_row++) {
+	register struct ldat *nline = &newscr->_line[dst_row];
+	register struct ldat *oline = &win->_line[src_row];
+
+	if (oline->firstchar != _NOCHANGE) {
+	    int last_src = oline->lastchar;
+
+	    if (last_src > limit_x)
+		last_src = limit_x;
+
+	    src_col = oline->firstchar;
+	    dst_col = src_col + begx;
+
+	    if_WIDEC({
+		register int j;
+
+		/*
+		 * Ensure that we will copy complete multi-column characters
+		 * on the left-boundary.
+		 */
+		if (isWidecExt(oline->text[src_col])) {
+		    j = 1 + dst_col - WidecExt(oline->text[src_col]);
+		    if (j < 0)
+			j = 0;
+		    if (dst_col > j) {
+			src_col -= (dst_col - j);
+			dst_col = j;
+		    }
+		}
+
+		/*
+		 * Ensure that we will copy complete multi-column characters
+		 * on the right-boundary.
+		 */
+		j = last_src;
+		if (WidecExt(oline->text[j])) {
+		    ++j;
+		    while (j <= limit_x) {
+			if (isWidecBase(oline->text[j])) {
+			    break;
+			} else {
+			    last_src = j;
+			}
+			++j;
+		    }
+		}
+	    });
+
+	    if_WIDEC({
+		static cchar_t blank = BLANK;
+		int last_dst = begx + ((last_src < win->_maxx)
+				       ? last_src
+				       : win->_maxx);
+		int fix_left = dst_col;
+		int fix_right = last_dst;
+		register int j;
+
+		/*
+		 * Check for boundary cases where we may overwrite part of a
+		 * multi-column character.  For those, wipe the remainder of
+		 * the character to blanks.
+		 */
+		j = dst_col;
+		if (isWidecExt(nline->text[j])) {
+		    /*
+		     * On the left, we only care about multi-column characters
+		     * that extend into the changed region.
+		     */
+		    fix_left = 1 + j - WidecExt(nline->text[j]);
+		    if (fix_left < 0)
+			fix_left = 0;	/* only if cell is corrupt */
+		}
+
+		j = last_dst;
+		if (WidecExt(nline->text[j]) != 0) {
+		    /*
+		     * On the right, any multi-column character is a problem,
+		     * unless it happens to be contained in the change, and
+		     * ending at the right boundary of the change.  The
+		     * computation for 'fix_left' accounts for the left-side of
+		     * this character.  Find the end of the character.
+		     */
+		    ++j;
+		    while (j <= newscr->_maxx && isWidecExt(nline->text[j])) {
+			fix_right = j++;
+		    }
+		}
+
+		/*
+		 * The analysis is simpler if we do the clearing afterwards.
+		 * Do that now.
+		 */
+		if (fix_left < dst_col || fix_right > last_dst) {
+		    for (j = fix_left; j <= fix_right; ++j) {
+			nline->text[j] = blank;
+			CHANGED_CELL(nline, j);
+		    }
+		}
+	    });
+
+	    /*
+	     * Copy the changed text.
+	     */
+	    for (; src_col <= last_src; src_col++, dst_col++) {
+		if (!CharEq(oline->text[src_col], nline->text[dst_col])) {
+		    nline->text[dst_col] = oline->text[src_col];
+		    CHANGED_CELL(nline, dst_col);
+		}
+	    }
+
+	}
+#if USE_SCROLL_HINTS
+	if (wide) {
+	    int oind = oline->oldindex;
+
+	    nline->oldindex = ((oind == _NEWINDEX)
+			       ? _NEWINDEX
+			       : (begy + oind + win->_yoffset));
+	}
+#endif /* USE_SCROLL_HINTS */
+
+	oline->firstchar = oline->lastchar = _NOCHANGE;
+	if_USE_SCROLL_HINTS(oline->oldindex = src_row);
+    }
+
+    if (win->_clear) {
+	win->_clear = FALSE;
+	newscr->_clear = TRUE;
+    }
+
+    if (!win->_leaveok) {
+	newscr->_cury = win->_cury + win->_begy + win->_yoffset;
+	newscr->_curx = win->_curx + win->_begx;
+    }
+    newscr->_leaveok = win->_leaveok;
+
+#ifdef TRACE
+    if (USE_TRACEF(TRACE_UPDATE)) {
+	_tracedump("newscr", newscr);
+	_nc_unlock_global(tracef);
+    }
+#endif /* TRACE */
+    returnCode(OK);
+}
diff --git a/ncurses/base/lib_restart.c b/ncurses/base/lib_restart.c
new file mode 100644
index 0000000..da770d4
--- /dev/null
+++ b/ncurses/base/lib_restart.c
@@ -0,0 +1,97 @@
+/****************************************************************************
+ * Copyright (c) 1998-2007,2008 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Thomas E. Dickey                        1996-on                 *
+ ****************************************************************************/
+
+/*
+ * Terminfo-only terminal setup routines:
+ *
+ *		int restartterm(const char *, int, int *)
+ */
+
+#include <curses.priv.h>
+
+#if SVR4_TERMIO && !defined(_POSIX_SOURCE)
+#define _POSIX_SOURCE
+#endif
+
+#include <term.h>		/* lines, columns, cur_term */
+
+MODULE_ID("$Id: lib_restart.c,v 1.10 2008/06/21 17:31:22 tom Exp $")
+
+NCURSES_EXPORT(int)
+restartterm(NCURSES_CONST char *termp, int filenum, int *errret)
+{
+    int result;
+
+    T((T_CALLED("restartterm(%s,%d,%p)"), termp, filenum, errret));
+
+    if (setupterm(termp, filenum, errret) != OK) {
+	result = ERR;
+    } else if (SP != 0) {
+	int saveecho = SP->_echo;
+	int savecbreak = SP->_cbreak;
+	int saveraw = SP->_raw;
+	int savenl = SP->_nl;
+
+	if (saveecho)
+	    echo();
+	else
+	    noecho();
+
+	if (savecbreak) {
+	    cbreak();
+	    noraw();
+	} else if (saveraw) {
+	    nocbreak();
+	    raw();
+	} else {
+	    nocbreak();
+	    noraw();
+	}
+	if (savenl)
+	    nl();
+	else
+	    nonl();
+
+	reset_prog_mode();
+
+#if USE_SIZECHANGE
+	_nc_update_screensize(SP);
+#endif
+
+	result = OK;
+    } else {
+	result = ERR;
+    }
+    returnCode(result);
+}
diff --git a/ncurses/base/lib_scanw.c b/ncurses/base/lib_scanw.c
new file mode 100644
index 0000000..b8a5a22
--- /dev/null
+++ b/ncurses/base/lib_scanw.c
@@ -0,0 +1,106 @@
+/****************************************************************************
+ * Copyright (c) 1998,2000,2001 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ ****************************************************************************/
+
+/*
+**	lib_scanw.c
+**
+**	The routines scanw(), wscanw() and friends.
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_scanw.c,v 1.11 2001/06/30 23:39:41 tom Exp $")
+
+NCURSES_EXPORT(int)
+vwscanw(WINDOW *win, NCURSES_CONST char *fmt, va_list argp)
+{
+    char buf[BUFSIZ];
+
+    if (wgetnstr(win, buf, sizeof(buf) - 1) == ERR)
+	return (ERR);
+
+    return (vsscanf(buf, fmt, argp));
+}
+
+NCURSES_EXPORT(int)
+scanw(NCURSES_CONST char *fmt,...)
+{
+    int code;
+    va_list ap;
+
+    T(("scanw(\"%s\",...) called", fmt));
+
+    va_start(ap, fmt);
+    code = vwscanw(stdscr, fmt, ap);
+    va_end(ap);
+    return (code);
+}
+
+NCURSES_EXPORT(int)
+wscanw(WINDOW *win, NCURSES_CONST char *fmt,...)
+{
+    int code;
+    va_list ap;
+
+    T(("wscanw(%p,\"%s\",...) called", win, fmt));
+
+    va_start(ap, fmt);
+    code = vwscanw(win, fmt, ap);
+    va_end(ap);
+    return (code);
+}
+
+NCURSES_EXPORT(int)
+mvscanw(int y, int x, NCURSES_CONST char *fmt,...)
+{
+    int code;
+    va_list ap;
+
+    va_start(ap, fmt);
+    code = (move(y, x) == OK) ? vwscanw(stdscr, fmt, ap) : ERR;
+    va_end(ap);
+    return (code);
+}
+
+NCURSES_EXPORT(int)
+mvwscanw(WINDOW *win, int y, int x, NCURSES_CONST char *fmt,...)
+{
+    int code;
+    va_list ap;
+
+    va_start(ap, fmt);
+    code = (wmove(win, y, x) == OK) ? vwscanw(win, fmt, ap) : ERR;
+    va_end(ap);
+    return (code);
+}
diff --git a/ncurses/base/lib_screen.c b/ncurses/base/lib_screen.c
new file mode 100644
index 0000000..4aa58ea
--- /dev/null
+++ b/ncurses/base/lib_screen.c
@@ -0,0 +1,220 @@
+/****************************************************************************
+ * Copyright (c) 1998-2007,2008 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Thomas E. Dickey                        1996 on                 *
+ ****************************************************************************/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_screen.c,v 1.31 2008/08/16 19:05:37 tom Exp $")
+
+#define MAX_SIZE 0x3fff		/* 16k is big enough for a window or pad */
+
+NCURSES_EXPORT(WINDOW *)
+getwin(FILE *filep)
+{
+    WINDOW tmp, *nwin;
+    int n;
+
+    T((T_CALLED("getwin(%p)"), filep));
+
+    clearerr(filep);
+    (void) fread(&tmp, sizeof(WINDOW), 1, filep);
+    if (ferror(filep)
+	|| tmp._maxy == 0
+	|| tmp._maxy > MAX_SIZE
+	|| tmp._maxx == 0
+	|| tmp._maxx > MAX_SIZE)
+	returnWin(0);
+
+    if (tmp._flags & _ISPAD) {
+	nwin = newpad(tmp._maxy + 1, tmp._maxx + 1);
+    } else {
+	nwin = newwin(tmp._maxy + 1, tmp._maxx + 1, 0, 0);
+    }
+
+    /*
+     * We deliberately do not restore the _parx, _pary, or _parent
+     * fields, because the window hierarchy within which they
+     * made sense is probably gone.
+     */
+    if (nwin != 0) {
+	nwin->_curx = tmp._curx;
+	nwin->_cury = tmp._cury;
+	nwin->_maxy = tmp._maxy;
+	nwin->_maxx = tmp._maxx;
+	nwin->_begy = tmp._begy;
+	nwin->_begx = tmp._begx;
+	nwin->_yoffset = tmp._yoffset;
+	nwin->_flags = tmp._flags & ~(_SUBWIN);
+
+	WINDOW_ATTRS(nwin) = WINDOW_ATTRS(&tmp);
+	nwin->_nc_bkgd = tmp._nc_bkgd;
+
+	nwin->_notimeout = tmp._notimeout;
+	nwin->_clear = tmp._clear;
+	nwin->_leaveok = tmp._leaveok;
+	nwin->_idlok = tmp._idlok;
+	nwin->_idcok = tmp._idcok;
+	nwin->_immed = tmp._immed;
+	nwin->_scroll = tmp._scroll;
+	nwin->_sync = tmp._sync;
+	nwin->_use_keypad = tmp._use_keypad;
+	nwin->_delay = tmp._delay;
+
+	nwin->_regtop = tmp._regtop;
+	nwin->_regbottom = tmp._regbottom;
+
+	if (tmp._flags & _ISPAD)
+	    nwin->_pad = tmp._pad;
+
+	for (n = 0; n <= nwin->_maxy; n++) {
+	    clearerr(filep);
+	    (void) fread(nwin->_line[n].text,
+			 sizeof(NCURSES_CH_T),
+			 (size_t) (nwin->_maxx + 1),
+			 filep);
+	    if (ferror(filep)) {
+		delwin(nwin);
+		returnWin(0);
+	    }
+	}
+	touchwin(nwin);
+    }
+    returnWin(nwin);
+}
+
+NCURSES_EXPORT(int)
+putwin(WINDOW *win, FILE *filep)
+{
+    int code = ERR;
+    int n;
+
+    T((T_CALLED("putwin(%p,%p)"), win, filep));
+
+    if (win != 0) {
+	size_t len = (size_t) (win->_maxx + 1);
+
+	clearerr(filep);
+	if (fwrite(win, sizeof(WINDOW), 1, filep) != 1
+	    || ferror(filep))
+	      returnCode(code);
+
+	for (n = 0; n <= win->_maxy; n++) {
+	    if (fwrite(win->_line[n].text,
+		       sizeof(NCURSES_CH_T), len, filep) != len
+		|| ferror(filep)) {
+		returnCode(code);
+	    }
+	}
+	code = OK;
+    }
+    returnCode(code);
+}
+
+NCURSES_EXPORT(int)
+scr_restore(const char *file)
+{
+    FILE *fp = 0;
+
+    T((T_CALLED("scr_restore(%s)"), _nc_visbuf(file)));
+
+    if (_nc_access(file, R_OK) < 0
+	|| (fp = fopen(file, "rb")) == 0) {
+	returnCode(ERR);
+    } else {
+	delwin(newscr);
+	SP->_newscr = getwin(fp);
+#if !USE_REENTRANT
+	newscr = SP->_newscr;
+#endif
+	(void) fclose(fp);
+	returnCode(OK);
+    }
+}
+
+NCURSES_EXPORT(int)
+scr_dump(const char *file)
+{
+    FILE *fp = 0;
+
+    T((T_CALLED("scr_dump(%s)"), _nc_visbuf(file)));
+
+    if (_nc_access(file, W_OK) < 0
+	|| (fp = fopen(file, "wb")) == 0) {
+	returnCode(ERR);
+    } else {
+	(void) putwin(newscr, fp);
+	(void) fclose(fp);
+	returnCode(OK);
+    }
+}
+
+NCURSES_EXPORT(int)
+scr_init(const char *file)
+{
+    FILE *fp = 0;
+
+    T((T_CALLED("scr_init(%s)"), _nc_visbuf(file)));
+
+    if (exit_ca_mode && non_rev_rmcup)
+	returnCode(ERR);
+
+    if (_nc_access(file, R_OK) < 0
+	|| (fp = fopen(file, "rb")) == 0) {
+	returnCode(ERR);
+    } else {
+	delwin(curscr);
+	SP->_curscr = getwin(fp);
+#if !USE_REENTRANT
+	curscr = SP->_curscr;
+#endif
+	(void) fclose(fp);
+	returnCode(OK);
+    }
+}
+
+NCURSES_EXPORT(int)
+scr_set(const char *file)
+{
+    T((T_CALLED("scr_set(%s)"), _nc_visbuf(file)));
+
+    if (scr_init(file) == ERR) {
+	returnCode(ERR);
+    } else {
+	delwin(newscr);
+	SP->_newscr = dupwin(curscr);
+#if !USE_REENTRANT
+	newscr = SP->_newscr;
+#endif
+	returnCode(OK);
+    }
+}
diff --git a/ncurses/base/lib_scroll.c b/ncurses/base/lib_scroll.c
new file mode 100644
index 0000000..ac85bd5
--- /dev/null
+++ b/ncurses/base/lib_scroll.c
@@ -0,0 +1,150 @@
+/****************************************************************************
+ * Copyright (c) 1998-2004,2006 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-2003                                      *
+ *     and: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ ****************************************************************************/
+
+/*
+**	lib_scroll.c
+**
+**	The routine wscrl(win, n).
+**  positive n scroll the window up (ie. move lines down)
+**  negative n scroll the window down (ie. move lines up)
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_scroll.c,v 1.26 2006/10/14 20:46:08 tom Exp $")
+
+NCURSES_EXPORT(void)
+_nc_scroll_window(WINDOW *win,
+		  int const n,
+		  NCURSES_SIZE_T const top,
+		  NCURSES_SIZE_T const bottom,
+		  NCURSES_CH_T blank)
+{
+    int limit;
+    int line;
+    int j;
+    size_t to_copy = (size_t) (sizeof(NCURSES_CH_T) * (win->_maxx + 1));
+
+    TR(TRACE_MOVE, ("_nc_scroll_window(%p, %d, %ld, %ld)",
+		    win, n, (long) top, (long) bottom));
+
+    if (top < 0
+	|| bottom < top
+	|| bottom > win->_maxy) {
+	TR(TRACE_MOVE, ("nothing to scroll"));
+	return;
+    }
+
+    /*
+     * This used to do a line-text pointer-shuffle instead of text copies.
+     * That (a) doesn't work when the window is derived and doesn't have
+     * its own storage, (b) doesn't save you a lot on modern machines
+     * anyway.  Your typical memcpy implementations are coded in
+     * assembler using a tight BLT loop; for the size of copies we're
+     * talking here, the total execution time is dominated by the one-time
+     * setup cost.  So there is no point in trying to be excessively
+     * clever -- esr.
+     */
+
+    /* shift n lines downwards */
+    if (n < 0) {
+	limit = top - n;
+	for (line = bottom; line >= limit && line >= 0; line--) {
+	    TR(TRACE_MOVE, ("...copying %d to %d", line + n, line));
+	    memcpy(win->_line[line].text,
+		   win->_line[line + n].text,
+		   to_copy);
+	    if_USE_SCROLL_HINTS(win->_line[line].oldindex =
+				win->_line[line + n].oldindex);
+	}
+	for (line = top; line < limit && line <= win->_maxy; line++) {
+	    TR(TRACE_MOVE, ("...filling %d", line));
+	    for (j = 0; j <= win->_maxx; j++)
+		win->_line[line].text[j] = blank;
+	    if_USE_SCROLL_HINTS(win->_line[line].oldindex = _NEWINDEX);
+	}
+    }
+
+    /* shift n lines upwards */
+    if (n > 0) {
+	limit = bottom - n;
+	for (line = top; line <= limit && line <= win->_maxy; line++) {
+	    memcpy(win->_line[line].text,
+		   win->_line[line + n].text,
+		   to_copy);
+	    if_USE_SCROLL_HINTS(win->_line[line].oldindex =
+				win->_line[line + n].oldindex);
+	}
+	for (line = bottom; line > limit && line >= 0; line--) {
+	    for (j = 0; j <= win->_maxx; j++)
+		win->_line[line].text[j] = blank;
+	    if_USE_SCROLL_HINTS(win->_line[line].oldindex = _NEWINDEX);
+	}
+    }
+    touchline(win, top, bottom - top + 1);
+
+    if_WIDEC({
+	if (WINDOW_EXT(win, addch_used) != 0) {
+	    int next = WINDOW_EXT(win, addch_y) + n;
+	    if (next < 0 || next > win->_maxy) {
+		TR(TRACE_VIRTPUT,
+		   ("Alert discarded multibyte on scroll"));
+		WINDOW_EXT(win, addch_y) = 0;
+	    } else {
+		TR(TRACE_VIRTPUT, ("scrolled working position to %d,%d",
+				   WINDOW_EXT(win, addch_y),
+				   WINDOW_EXT(win, addch_x)));
+		WINDOW_EXT(win, addch_y) = next;
+	    }
+	}
+    })
+}
+
+NCURSES_EXPORT(int)
+wscrl(WINDOW *win, int n)
+{
+    T((T_CALLED("wscrl(%p,%d)"), win, n));
+
+    if (!win || !win->_scroll) {
+	TR(TRACE_MOVE, ("...scrollok is false"));
+	returnCode(ERR);
+    }
+
+    if (n != 0) {
+	_nc_scroll_window(win, n, win->_regtop, win->_regbottom, win->_nc_bkgd);
+	_nc_synchook(win);
+    }
+    returnCode(OK);
+}
diff --git a/ncurses/base/lib_scrollok.c b/ncurses/base/lib_scrollok.c
new file mode 100644
index 0000000..f6b3025
--- /dev/null
+++ b/ncurses/base/lib_scrollok.c
@@ -0,0 +1,55 @@
+/****************************************************************************
+ * Copyright (c) 1998,2000 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ ****************************************************************************/
+
+/*
+**	lib_scrollok.c
+**
+**	The routine scrollok.
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_scrollok.c,v 1.4 2000/12/10 02:43:27 tom Exp $")
+
+NCURSES_EXPORT(int)
+scrollok(WINDOW *win, bool flag)
+{
+    T((T_CALLED("scrollok(%p,%d)"), win, flag));
+
+    if (win) {
+	win->_scroll = flag;
+	returnCode(OK);
+    } else
+	returnCode(ERR);
+}
diff --git a/ncurses/base/lib_scrreg.c b/ncurses/base/lib_scrreg.c
new file mode 100644
index 0000000..c85d60f
--- /dev/null
+++ b/ncurses/base/lib_scrreg.c
@@ -0,0 +1,60 @@
+/****************************************************************************
+ * Copyright (c) 1998,2000 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ ****************************************************************************/
+
+/*
+**	lib_scrreg.c
+**
+**	The routine wsetscrreg().
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_scrreg.c,v 1.10 2000/12/10 02:43:27 tom Exp $")
+
+NCURSES_EXPORT(int)
+wsetscrreg(WINDOW *win, int top, int bottom)
+{
+    T((T_CALLED("wsetscrreg(%p,%d,%d)"), win, top, bottom));
+
+    if (win &&
+	top >= 0 && top <= win->_maxy &&
+	bottom >= 0 && bottom <= win->_maxy &&
+	bottom > top) {
+	win->_regtop = (NCURSES_SIZE_T) top;
+	win->_regbottom = (NCURSES_SIZE_T) bottom;
+
+	returnCode(OK);
+    } else
+	returnCode(ERR);
+}
diff --git a/ncurses/base/lib_set_term.c b/ncurses/base/lib_set_term.c
new file mode 100644
index 0000000..aff432b
--- /dev/null
+++ b/ncurses/base/lib_set_term.c
@@ -0,0 +1,647 @@
+/****************************************************************************
+ * Copyright (c) 1998-2007,2008 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Thomas E. Dickey                        1996-on                 *
+ ****************************************************************************/
+
+/*
+**	lib_set_term.c
+**
+**	The routine set_term().
+**
+*/
+
+#include <curses.priv.h>
+
+#include <term.h>		/* cur_term */
+#include <tic.h>
+
+MODULE_ID("$Id: lib_set_term.c,v 1.117 2008/08/04 18:11:12 tom Exp $")
+
+NCURSES_EXPORT(SCREEN *)
+set_term(SCREEN *screenp)
+{
+    SCREEN *oldSP;
+    SCREEN *newSP;
+
+    T((T_CALLED("set_term(%p)"), screenp));
+
+    _nc_lock_global(curses);
+
+    oldSP = SP;
+    _nc_set_screen(screenp);
+    newSP = SP;
+
+    if (newSP != 0) {
+	set_curterm(newSP->_term);
+#if !USE_REENTRANT
+	curscr = newSP->_curscr;
+	newscr = newSP->_newscr;
+	stdscr = newSP->_stdscr;
+	COLORS = newSP->_color_count;
+	COLOR_PAIRS = newSP->_pair_count;
+#endif
+    } else {
+	set_curterm(0);
+#if !USE_REENTRANT
+	curscr = 0;
+	newscr = 0;
+	stdscr = 0;
+	COLORS = 0;
+	COLOR_PAIRS = 0;
+#endif
+    }
+
+    _nc_unlock_global(curses);
+
+    T((T_RETURN("%p"), oldSP));
+    return (oldSP);
+}
+
+static void
+_nc_free_keytry(TRIES * kt)
+{
+    if (kt != 0) {
+	_nc_free_keytry(kt->child);
+	_nc_free_keytry(kt->sibling);
+	free(kt);
+    }
+}
+
+static bool
+delink_screen(SCREEN *sp)
+{
+    SCREEN *last = 0;
+    SCREEN *temp;
+    bool result = FALSE;
+
+    for (each_screen(temp)) {
+	if (temp == sp) {
+	    if (last)
+		last = sp->_next_screen;
+	    else
+		_nc_screen_chain = sp->_next_screen;
+	    result = TRUE;
+	    break;
+	}
+	last = temp;
+    }
+    return result;
+}
+
+/*
+ * Free the storage associated with the given SCREEN sp.
+ */
+NCURSES_EXPORT(void)
+delscreen(SCREEN *sp)
+{
+    int i;
+
+    T((T_CALLED("delscreen(%p)"), sp));
+
+    _nc_lock_global(curses);
+    if (delink_screen(sp)) {
+
+	(void) _nc_freewin(sp->_curscr);
+	(void) _nc_freewin(sp->_newscr);
+	(void) _nc_freewin(sp->_stdscr);
+
+	if (sp->_slk != 0) {
+	    if (sp->_slk->ent != 0) {
+		for (i = 0; i < sp->_slk->labcnt; ++i) {
+		    FreeIfNeeded(sp->_slk->ent[i].ent_text);
+		    FreeIfNeeded(sp->_slk->ent[i].form_text);
+		}
+		free(sp->_slk->ent);
+	    }
+	    free(sp->_slk);
+	    sp->_slk = 0;
+	}
+
+	_nc_free_keytry(sp->_keytry);
+	sp->_keytry = 0;
+
+	_nc_free_keytry(sp->_key_ok);
+	sp->_key_ok = 0;
+
+	FreeIfNeeded(sp->_current_attr);
+
+	FreeIfNeeded(sp->_color_table);
+	FreeIfNeeded(sp->_color_pairs);
+
+	FreeIfNeeded(sp->oldhash);
+	FreeIfNeeded(sp->newhash);
+	FreeIfNeeded(sp->hashtab);
+
+	FreeIfNeeded(sp->_acs_map);
+	FreeIfNeeded(sp->_screen_acs_map);
+
+	/*
+	 * If the associated output stream has been closed, we can discard the
+	 * set-buffer.  Limit the error check to EBADF, since fflush may fail
+	 * for other reasons than trying to operate upon a closed stream.
+	 */
+	if (sp->_ofp != 0
+	    && sp->_setbuf != 0
+	    && fflush(sp->_ofp) != 0
+	    && errno == EBADF) {
+	    free(sp->_setbuf);
+	}
+
+	del_curterm(sp->_term);
+	free(sp);
+
+	/*
+	 * If this was the current screen, reset everything that the
+	 * application might try to use (except cur_term, which may have
+	 * multiple references in different screens).
+	 */
+	if (sp == SP) {
+#if !USE_REENTRANT
+	    curscr = 0;
+	    newscr = 0;
+	    stdscr = 0;
+	    COLORS = 0;
+	    COLOR_PAIRS = 0;
+#endif
+	    _nc_set_screen(0);
+	}
+    }
+    _nc_unlock_global(curses);
+
+    returnVoid;
+}
+
+static bool
+no_mouse_event(SCREEN *sp GCC_UNUSED)
+{
+    return FALSE;
+}
+
+static bool
+no_mouse_inline(SCREEN *sp GCC_UNUSED)
+{
+    return FALSE;
+}
+
+static bool
+no_mouse_parse(SCREEN *sp GCC_UNUSED, int code GCC_UNUSED)
+{
+    return TRUE;
+}
+
+static void
+no_mouse_resume(SCREEN *sp GCC_UNUSED)
+{
+}
+
+static void
+no_mouse_wrap(SCREEN *sp GCC_UNUSED)
+{
+}
+
+#if NCURSES_EXT_FUNCS && USE_COLORFGBG
+static char *
+extract_fgbg(char *src, int *result)
+{
+    char *dst = 0;
+    long value = strtol(src, &dst, 0);
+
+    if (dst == 0) {
+	dst = src;
+    } else if (value >= 0) {
+	*result = value;
+    }
+    while (*dst != 0 && *dst != ';')
+	dst++;
+    if (*dst == ';')
+	dst++;
+    return dst;
+}
+#endif
+
+/* OS-independent screen initializations */
+NCURSES_EXPORT(int)
+_nc_setupscreen(int slines GCC_UNUSED,
+		int scolumns GCC_UNUSED,
+		FILE *output,
+		bool filtered,
+		int slk_format)
+{
+    char *env;
+    int bottom_stolen = 0;
+    bool support_cookies = USE_XMC_SUPPORT;
+    ripoff_t *rop;
+
+    T((T_CALLED("_nc_setupscreen(%d, %d, %p, %d, %d)"),
+       slines, scolumns, output, filtered, slk_format));
+
+    assert(SP == 0);		/* has been reset in newterm() ! */
+    if (!_nc_alloc_screen()
+	|| ((SP->_acs_map = typeCalloc(chtype, ACS_LEN)) == 0)
+	|| ((SP->_screen_acs_map = typeCalloc(bool, ACS_LEN)) == 0)) {
+	returnCode(ERR);
+    }
+
+    T(("created SP %p", SP));
+    SP->_next_screen = _nc_screen_chain;
+    _nc_screen_chain = SP;
+
+    if ((SP->_current_attr = typeCalloc(NCURSES_CH_T, 1)) == 0)
+	returnCode(ERR);
+
+    /*
+     * We should always check the screensize, just in case.
+     */
+    _nc_get_screensize(SP, &slines, &scolumns);
+    SET_LINES(slines);
+    SET_COLS(scolumns);
+    T((T_CREATE("screen %s %dx%d"), termname(), LINES, COLS));
+
+    SP->_filtered = filtered;
+
+    /* implement filter mode */
+    if (filtered) {
+	slines = 1;
+	SET_LINES(slines);
+	clear_screen = 0;
+	cursor_down = parm_down_cursor = 0;
+	cursor_address = 0;
+	cursor_up = parm_up_cursor = 0;
+	row_address = 0;
+
+	cursor_home = carriage_return;
+	T(("filter screensize %dx%d", LINES, COLS));
+    }
+#ifdef __DJGPP__
+    T(("setting output mode to binary"));
+    fflush(output);
+    setmode(output, O_BINARY);
+#endif
+    _nc_set_buffer(output, TRUE);
+    SP->_term = cur_term;
+    SP->_lines = slines;
+    SP->_lines_avail = slines;
+    SP->_columns = scolumns;
+    SP->_cursrow = -1;
+    SP->_curscol = -1;
+    SP->_nl = TRUE;
+    SP->_raw = FALSE;
+    SP->_cbreak = 0;
+    SP->_echo = TRUE;
+    SP->_fifohead = -1;
+    SP->_endwin = TRUE;
+    SP->_ofp = output;
+    SP->_cursor = -1;		/* cannot know real cursor shape */
+
+    SetNoPadding(SP);
+
+#if NCURSES_EXT_FUNCS
+    SP->_default_color = FALSE;
+    SP->_has_sgr_39_49 = FALSE;
+
+    /*
+     * Set our assumption of the terminal's default foreground and background
+     * colors.  The curs_color man-page states that we can assume that the
+     * background is black.  The origin of this assumption appears to be
+     * terminals that displayed colored text, but no colored backgrounds, e.g.,
+     * the first colored terminals around 1980.  More recent ones with better
+     * technology can display not only colored backgrounds, but all
+     * combinations.  So a terminal might be something other than "white" on
+     * black (green/black looks monochrome too), but black on white or even
+     * on ivory.
+     *
+     * White-on-black is the simplest thing to use for monochrome.  Almost
+     * all applications that use color paint both text and background, so
+     * the distinction is moot.  But a few do not - which is why we leave this
+     * configurable (a better solution is to use assume_default_colors() for
+     * the rare applications that do require that sort of appearance, since
+     * is appears that more users expect to be able to make a white-on-black
+     * or black-on-white display under control of the application than not).
+     */
+#ifdef USE_ASSUMED_COLOR
+    SP->_default_fg = COLOR_WHITE;
+    SP->_default_bg = COLOR_BLACK;
+#else
+    SP->_default_fg = C_MASK;
+    SP->_default_bg = C_MASK;
+#endif
+
+    /*
+     * Allow those assumed/default color assumptions to be overridden at
+     * runtime:
+     */
+    if ((env = getenv("NCURSES_ASSUMED_COLORS")) != 0) {
+	int fg, bg;
+	char sep1, sep2;
+	int count = sscanf(env, "%d%c%d%c", &fg, &sep1, &bg, &sep2);
+	if (count >= 1) {
+	    SP->_default_fg = (fg >= 0 && fg < max_colors) ? fg : C_MASK;
+	    if (count >= 3) {
+		SP->_default_bg = (bg >= 0 && bg < max_colors) ? bg : C_MASK;
+	    }
+	    TR(TRACE_CHARPUT | TRACE_MOVE,
+	       ("from environment assumed fg=%d, bg=%d",
+		SP->_default_fg,
+		SP->_default_bg));
+	}
+    }
+#if USE_COLORFGBG
+    /*
+     * If rxvt's $COLORFGBG variable is set, use it to specify the assumed
+     * default colors.  Note that rxvt (mis)uses bold colors, equating a bold
+     * color to that value plus 8.  We'll only use the non-bold color for now -
+     * decide later if it is worth having default attributes as well.
+     */
+    if (getenv("COLORFGBG") != 0) {
+	char *p = getenv("COLORFGBG");
+	TR(TRACE_CHARPUT | TRACE_MOVE, ("decoding COLORFGBG %s", p));
+	p = extract_fgbg(p, &(SP->_default_fg));
+	p = extract_fgbg(p, &(SP->_default_bg));
+	if (*p)			/* assume rxvt was compiled with xpm support */
+	    p = extract_fgbg(p, &(SP->_default_bg));
+	TR(TRACE_CHARPUT | TRACE_MOVE, ("decoded fg=%d, bg=%d",
+					SP->_default_fg, SP->_default_bg));
+	if (SP->_default_fg >= max_colors) {
+	    if (set_a_foreground != ABSENT_STRING
+		&& !strcmp(set_a_foreground, "\033[3%p1%dm")) {
+		set_a_foreground = "\033[3%?%p1%{8}%>%t9%e%p1%d%;m";
+	    } else {
+		SP->_default_fg %= max_colors;
+	    }
+	}
+	if (SP->_default_bg >= max_colors) {
+	    if (set_a_background != ABSENT_STRING
+		&& !strcmp(set_a_background, "\033[4%p1%dm")) {
+		set_a_background = "\033[4%?%p1%{8}%>%t9%e%p1%d%;m";
+	    } else {
+		SP->_default_bg %= max_colors;
+	    }
+	}
+    }
+#endif
+#endif /* NCURSES_EXT_FUNCS */
+
+    SP->_maxclick = DEFAULT_MAXCLICK;
+    SP->_mouse_event = no_mouse_event;
+    SP->_mouse_inline = no_mouse_inline;
+    SP->_mouse_parse = no_mouse_parse;
+    SP->_mouse_resume = no_mouse_resume;
+    SP->_mouse_wrap = no_mouse_wrap;
+    SP->_mouse_fd = -1;
+
+    /*
+     * If we've no magic cookie support, we suppress attributes that xmc would
+     * affect, i.e., the attributes that affect the rendition of a space.
+     */
+    SP->_ok_attributes = termattrs();
+    if (has_colors()) {
+	SP->_ok_attributes |= A_COLOR;
+    }
+#if USE_XMC_SUPPORT
+    /*
+     * If we have no magic-cookie support compiled-in, or if it is suppressed
+     * in the environment, reset the support-flag.
+     */
+    if (magic_cookie_glitch >= 0) {
+	if (getenv("NCURSES_NO_MAGIC_COOKIE") != 0) {
+	    support_cookies = FALSE;
+	}
+    }
+#endif
+
+    if (!support_cookies && magic_cookie_glitch >= 0) {
+	T(("will disable attributes to work w/o magic cookies"));
+    }
+
+    if (magic_cookie_glitch > 0) {	/* tvi, wyse */
+
+	SP->_xmc_triggers = SP->_ok_attributes & (
+						     A_STANDOUT |
+						     A_UNDERLINE |
+						     A_REVERSE |
+						     A_BLINK |
+						     A_DIM |
+						     A_BOLD |
+						     A_INVIS |
+						     A_PROTECT
+	    );
+#if 0
+	/*
+	 * We "should" treat colors as an attribute.  The wyse350 (and its
+	 * clones) appear to be the only ones that have both colors and magic
+	 * cookies.
+	 */
+	if (has_colors()) {
+	    SP->_xmc_triggers |= A_COLOR;
+	}
+#endif
+	SP->_xmc_suppress = SP->_xmc_triggers & (chtype) ~(A_BOLD);
+
+	T(("magic cookie attributes %s", _traceattr(SP->_xmc_suppress)));
+	/*
+	 * Supporting line-drawing may be possible.  But make the regular
+	 * video attributes work first.
+	 */
+	acs_chars = ABSENT_STRING;
+	ena_acs = ABSENT_STRING;
+	enter_alt_charset_mode = ABSENT_STRING;
+	exit_alt_charset_mode = ABSENT_STRING;
+#if USE_XMC_SUPPORT
+	/*
+	 * To keep the cookie support simple, suppress all of the optimization
+	 * hooks except for clear_screen and the cursor addressing.
+	 */
+	if (support_cookies) {
+	    clr_eol = ABSENT_STRING;
+	    clr_eos = ABSENT_STRING;
+	    set_attributes = ABSENT_STRING;
+	}
+#endif
+    } else if (magic_cookie_glitch == 0) {	/* hpterm */
+    }
+
+    /*
+     * If magic cookies are not supported, cancel the strings that set
+     * video attributes.
+     */
+    if (!support_cookies && magic_cookie_glitch >= 0) {
+	magic_cookie_glitch = ABSENT_NUMERIC;
+	set_attributes = ABSENT_STRING;
+	enter_blink_mode = ABSENT_STRING;
+	enter_bold_mode = ABSENT_STRING;
+	enter_dim_mode = ABSENT_STRING;
+	enter_reverse_mode = ABSENT_STRING;
+	enter_standout_mode = ABSENT_STRING;
+	enter_underline_mode = ABSENT_STRING;
+    }
+
+    /* initialize normal acs before wide, since we use mapping in the latter */
+#if !USE_WIDEC_SUPPORT
+    if (_nc_unicode_locale() && _nc_locale_breaks_acs(cur_term)) {
+	acs_chars = NULL;
+	ena_acs = NULL;
+	enter_alt_charset_mode = NULL;
+	exit_alt_charset_mode = NULL;
+	set_attributes = NULL;
+    }
+#endif
+    _nc_init_acs();
+#if USE_WIDEC_SUPPORT
+    _nc_init_wacs();
+
+    SP->_screen_acs_fix = (_nc_unicode_locale()
+			   && _nc_locale_breaks_acs(cur_term));
+#endif
+    env = _nc_get_locale();
+    SP->_legacy_coding = ((env == 0)
+			  || !strcmp(env, "C")
+			  || !strcmp(env, "POSIX"));
+    T(("legacy-coding %d", SP->_legacy_coding));
+
+    _nc_idcok = TRUE;
+    _nc_idlok = FALSE;
+
+    SP->oldhash = 0;
+    SP->newhash = 0;
+
+    T(("creating newscr"));
+    if ((SP->_newscr = newwin(slines, scolumns, 0, 0)) == 0)
+	returnCode(ERR);
+
+    T(("creating curscr"));
+    if ((SP->_curscr = newwin(slines, scolumns, 0, 0)) == 0)
+	returnCode(ERR);
+
+#if !USE_REENTRANT
+    newscr = SP->_newscr;
+    curscr = SP->_curscr;
+#endif
+#if USE_SIZECHANGE
+    SP->_resize = resizeterm;
+#endif
+
+    newscr->_clear = TRUE;
+    curscr->_clear = FALSE;
+
+    def_shell_mode();
+    def_prog_mode();
+
+    for (rop = ripoff_stack;
+	 rop != ripoff_sp && (rop - ripoff_stack) < N_RIPS;
+	 rop++) {
+
+	/* If we must simulate soft labels, grab off the line to be used.
+	   We assume that we must simulate, if it is none of the standard
+	   formats (4-4 or 3-2-3) for which there may be some hardware
+	   support. */
+	if (rop->hook == _nc_slk_initialize)
+	    if (!(num_labels <= 0 || !SLK_STDFMT(slk_format)))
+		continue;
+	if (rop->hook) {
+	    int count;
+	    WINDOW *w;
+
+	    count = (rop->line < 0) ? -rop->line : rop->line;
+	    T(("ripping off %i lines at %s", count,
+	       ((rop->line < 0)
+		? "bottom"
+		: "top")));
+
+	    w = newwin(count, scolumns,
+		       ((rop->line < 0)
+			? SP->_lines_avail - count
+			: 0),
+		       0);
+	    if (w) {
+		rop->win = w;
+		rop->hook(w, scolumns);
+	    } else {
+		returnCode(ERR);
+	    }
+	    if (rop->line < 0)
+		bottom_stolen += count;
+	    else
+		SP->_topstolen += count;
+	    SP->_lines_avail -= count;
+	}
+    }
+    /* reset the stack */
+    ripoff_sp = ripoff_stack;
+
+    T(("creating stdscr"));
+    assert((SP->_lines_avail + SP->_topstolen + bottom_stolen) == slines);
+    if ((SP->_stdscr = newwin(SP->_lines_avail, scolumns, 0, 0)) == 0)
+	returnCode(ERR);
+
+    SET_LINES(SP->_lines_avail);
+#if !USE_REENTRANT
+    stdscr = SP->_stdscr;
+#endif
+
+    returnCode(OK);
+}
+
+/*
+ * The internal implementation interprets line as the number of lines to rip
+ * off from the top or bottom.
+ */
+NCURSES_EXPORT(int)
+_nc_ripoffline(int line, int (*init) (WINDOW *, int))
+{
+    T((T_CALLED("_nc_ripoffline(%d, %p)"), line, init));
+
+    if (line != 0) {
+
+	if (ripoff_sp == 0)
+	    ripoff_sp = ripoff_stack;
+	if (ripoff_sp >= ripoff_stack + N_RIPS)
+	    returnCode(ERR);
+
+	ripoff_sp->line = line;
+	ripoff_sp->hook = init;
+	ripoff_sp++;
+    }
+
+    returnCode(OK);
+}
+
+NCURSES_EXPORT(int)
+ripoffline(int line, int (*init) (WINDOW *, int))
+{
+    START_TRACE();
+    T((T_CALLED("ripoffline(%d,%p)"), line, init));
+
+    if (line == 0)
+	returnCode(OK);
+
+    returnCode(_nc_ripoffline((line < 0) ? -1 : 1, init));
+}
diff --git a/ncurses/base/lib_slk.c b/ncurses/base/lib_slk.c
new file mode 100644
index 0000000..662f7e4
--- /dev/null
+++ b/ncurses/base/lib_slk.c
@@ -0,0 +1,191 @@
+/****************************************************************************
+ * Copyright (c) 1998-2005,2008 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.                                                           *
+ ****************************************************************************/
+
+/****************************************************************************
+ *  Authors:                                                                *
+ *          Gerhard Fuernkranz                      1993 (original)         *
+ *          Zeyd M. Ben-Halim                       1992,1995 (sic)         *
+ *          Eric S. Raymond                                                 *
+ *          Juergen Pfeifer                         1996-on                 *
+ *          Thomas E. Dickey                                                *
+ ****************************************************************************/
+
+/*
+ *	lib_slk.c
+ *	Soft key routines.
+ */
+
+#include <curses.priv.h>
+
+#include <ctype.h>
+#include <term.h>		/* num_labels, label_*, plab_norm */
+
+MODULE_ID("$Id: lib_slk.c,v 1.35 2008/09/27 14:07:33 juergen Exp $")
+
+/*
+ * Free any memory related to soft labels, return an error.
+ */
+static int
+slk_failed(void)
+{
+    if (SP->_slk) {
+	FreeIfNeeded(SP->_slk->ent);
+	free(SP->_slk);
+	SP->_slk = (SLK *) 0;
+    }
+    return ERR;
+}
+
+/*
+ * Initialize soft labels.
+ * Called from newterm()
+ */
+NCURSES_EXPORT(int)
+_nc_slk_initialize(WINDOW *stwin, int cols)
+{
+    int i, x;
+    int res = OK;
+    unsigned max_length;
+
+    T((T_CALLED("_nc_slk_initialize()")));
+
+    if (SP->_slk) {		/* we did this already, so simply return */
+	returnCode(OK);
+    } else if ((SP->_slk = typeCalloc(SLK, 1)) == 0)
+	returnCode(ERR);
+
+    SP->_slk->ent = NULL;
+
+    /*
+     * If we use colors, vidputs() will suppress video attributes that conflict
+     * with colors.  In that case, we're still guaranteed that "reverse" would
+     * work.
+     */
+    if ((no_color_video & 1) == 0)
+	SetAttr(SP->_slk->attr, A_STANDOUT);
+    else
+	SetAttr(SP->_slk->attr, A_REVERSE);
+
+    SP->_slk->maxlab = ((num_labels > 0)
+			? num_labels
+			: MAX_SKEY(_nc_globals.slk_format));
+    SP->_slk->maxlen = ((num_labels > 0)
+			? label_width * label_height
+			: MAX_SKEY_LEN(_nc_globals.slk_format));
+    SP->_slk->labcnt = ((SP->_slk->maxlab < MAX_SKEY(_nc_globals.slk_format))
+			? MAX_SKEY(_nc_globals.slk_format)
+			: SP->_slk->maxlab);
+
+    if (SP->_slk->maxlen <= 0
+	|| SP->_slk->labcnt <= 0
+	|| (SP->_slk->ent = typeCalloc(slk_ent,
+				       (unsigned) SP->_slk->labcnt)) == NULL)
+	returnCode(slk_failed());
+
+    max_length = SP->_slk->maxlen;
+    for (i = 0; i < SP->_slk->labcnt; i++) {
+	size_t used = max_length + 1;
+
+	if ((SP->_slk->ent[i].ent_text = (char *) _nc_doalloc(0, used)) == 0)
+	    returnCode(slk_failed());
+	memset(SP->_slk->ent[i].ent_text, 0, used);
+
+	if ((SP->_slk->ent[i].form_text = (char *) _nc_doalloc(0, used)) == 0)
+	    returnCode(slk_failed());
+	memset(SP->_slk->ent[i].form_text, 0, used);
+
+	memset(SP->_slk->ent[i].form_text, ' ', max_length);
+	SP->_slk->ent[i].visible = (char) (i < SP->_slk->maxlab);
+    }
+    if (_nc_globals.slk_format >= 3) {	/* PC style */
+	int gap = (cols - 3 * (3 + 4 * max_length)) / 2;
+
+	if (gap < 1)
+	    gap = 1;
+
+	for (i = x = 0; i < SP->_slk->maxlab; i++) {
+	    SP->_slk->ent[i].ent_x = x;
+	    x += max_length;
+	    x += (i == 3 || i == 7) ? gap : 1;
+	}
+    } else {
+	if (_nc_globals.slk_format == 2) {	/* 4-4 */
+	    int gap = cols - (SP->_slk->maxlab * max_length) - 6;
+
+	    if (gap < 1)
+		gap = 1;
+	    for (i = x = 0; i < SP->_slk->maxlab; i++) {
+		SP->_slk->ent[i].ent_x = x;
+		x += max_length;
+		x += (i == 3) ? gap : 1;
+	    }
+	} else {
+	    if (_nc_globals.slk_format == 1) {	/* 1 -> 3-2-3 */
+		int gap = (cols - (SP->_slk->maxlab * max_length) - 5)
+		/ 2;
+
+		if (gap < 1)
+		    gap = 1;
+		for (i = x = 0; i < SP->_slk->maxlab; i++) {
+		    SP->_slk->ent[i].ent_x = x;
+		    x += max_length;
+		    x += (i == 2 || i == 4) ? gap : 1;
+		}
+	    } else
+		returnCode(slk_failed());
+	}
+    }
+    SP->_slk->dirty = TRUE;
+    if ((SP->_slk->win = stwin) == NULL) {
+	returnCode(slk_failed());
+    }
+
+    /* We now reset the format so that the next newterm has again
+     * per default no SLK keys and may call slk_init again to
+     * define a new layout. (juergen 03-Mar-1999)
+     */
+    SP->slk_format = _nc_globals.slk_format;
+    _nc_globals.slk_format = 0;
+    returnCode(res);
+}
+
+/*
+ * Restore the soft labels on the screen.
+ */
+NCURSES_EXPORT(int)
+slk_restore(void)
+{
+    T((T_CALLED("slk_restore()")));
+
+    if (SP->_slk == NULL)
+	return (ERR);
+    SP->_slk->hidden = FALSE;
+    SP->_slk->dirty = TRUE;
+
+    returnCode(slk_refresh());
+}
diff --git a/ncurses/base/lib_slkatr_set.c b/ncurses/base/lib_slkatr_set.c
new file mode 100644
index 0000000..f83616b
--- /dev/null
+++ b/ncurses/base/lib_slkatr_set.c
@@ -0,0 +1,59 @@
+/****************************************************************************
+ * Copyright (c) 1998-2003,2005 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:  Juergen Pfeifer, 1998                                          *
+ *     and:  Thomas E. Dickey 2005                                          *
+ ****************************************************************************/
+
+/*
+ *	lib_slkatr_set.c
+ *	Soft key routines.
+ *	Set the label's attributes
+ */
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_slkatr_set.c,v 1.10 2005/01/28 21:11:53 tom Exp $")
+
+NCURSES_EXPORT(int)
+slk_attr_set(const attr_t attr, short color_pair_number, void *opts)
+{
+    T((T_CALLED("slk_attr_set(%s,%d)"), _traceattr(attr), color_pair_number));
+
+    if (SP != 0 && SP->_slk != 0 && !opts &&
+	color_pair_number >= 0 && color_pair_number < COLOR_PAIRS) {
+	TR(TRACE_ATTRS, ("... current %s", _tracech_t(CHREF(SP->_slk->attr))));
+	SetAttr(SP->_slk->attr, attr);
+	if (color_pair_number > 0) {
+	    SetPair(SP->_slk->attr, color_pair_number);
+	}
+	TR(TRACE_ATTRS, ("new attribute is %s", _tracech_t(CHREF(SP->_slk->attr))));
+	returnCode(OK);
+    } else
+	returnCode(ERR);
+}
diff --git a/ncurses/base/lib_slkatrof.c b/ncurses/base/lib_slkatrof.c
new file mode 100644
index 0000000..14b4c3b
--- /dev/null
+++ b/ncurses/base/lib_slkatrof.c
@@ -0,0 +1,58 @@
+/****************************************************************************
+ * Copyright (c) 1998-2000,2005 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:  Juergen Pfeifer, 1997                                          *
+ *     and:  Thomas E. Dickey 2005                                          *
+ ****************************************************************************/
+
+/*
+ *	lib_slkatrof.c
+ *	Soft key routines.
+ *      Switch off labels attributes
+ */
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_slkatrof.c,v 1.8 2005/01/08 23:01:32 tom Exp $")
+
+NCURSES_EXPORT(int)
+slk_attroff(const chtype attr)
+{
+    T((T_CALLED("slk_attroff(%s)"), _traceattr(attr)));
+
+    if (SP != 0 && SP->_slk != 0) {
+	TR(TRACE_ATTRS, ("... current %s", _tracech_t(CHREF(SP->_slk->attr))));
+	RemAttr(SP->_slk->attr, attr);
+	if ((attr & A_COLOR) != 0) {
+	    SetPair(SP->_slk->attr, 0);
+	}
+	TR(TRACE_ATTRS, ("new attribute is %s", _tracech_t(CHREF(SP->_slk->attr))));
+	returnCode(OK);
+    } else
+	returnCode(ERR);
+}
diff --git a/ncurses/base/lib_slkatron.c b/ncurses/base/lib_slkatron.c
new file mode 100644
index 0000000..90add86
--- /dev/null
+++ b/ncurses/base/lib_slkatron.c
@@ -0,0 +1,58 @@
+/****************************************************************************
+ * Copyright (c) 1998-2000,2005 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:  Juergen Pfeifer, 1997                                          *
+ *     and:  Thomas E. Dickey 2005                                          *
+ ****************************************************************************/
+
+/*
+ *	lib_slkatron.c
+ *	Soft key routines.
+ *      Switch on labels attributes
+ */
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_slkatron.c,v 1.8 2005/01/08 23:02:01 tom Exp $")
+
+NCURSES_EXPORT(int)
+slk_attron(const chtype attr)
+{
+    T((T_CALLED("slk_attron(%s)"), _traceattr(attr)));
+
+    if (SP != 0 && SP->_slk != 0) {
+	TR(TRACE_ATTRS, ("... current %s", _tracech_t(CHREF(SP->_slk->attr))));
+	AddAttr(SP->_slk->attr, attr);
+	if ((attr & A_COLOR) != 0) {
+	    SetPair(SP->_slk->attr, PAIR_NUMBER(attr));
+	}
+	TR(TRACE_ATTRS, ("new attribute is %s", _tracech_t(CHREF(SP->_slk->attr))));
+	returnCode(OK);
+    } else
+	returnCode(ERR);
+}
diff --git a/ncurses/base/lib_slkatrset.c b/ncurses/base/lib_slkatrset.c
new file mode 100644
index 0000000..8da9981
--- /dev/null
+++ b/ncurses/base/lib_slkatrset.c
@@ -0,0 +1,53 @@
+/****************************************************************************
+ * Copyright (c) 1998-2000,2005 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:  Juergen Pfeifer, 1997                                          *
+ *     and:  Thomas E. Dickey 2005                                          *
+ ****************************************************************************/
+
+/*
+ *	lib_slkatrset.c
+ *	Soft key routines.
+ *      Set the labels attributes
+ */
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_slkatrset.c,v 1.7 2005/01/08 21:46:47 tom Exp $")
+
+NCURSES_EXPORT(int)
+slk_attrset(const chtype attr)
+{
+    T((T_CALLED("slk_attrset(%s)"), _traceattr(attr)));
+
+    if (SP != 0 && SP->_slk != 0) {
+	SetAttr(SP->_slk->attr, attr);
+	returnCode(OK);
+    } else
+	returnCode(ERR);
+}
diff --git a/ncurses/base/lib_slkattr.c b/ncurses/base/lib_slkattr.c
new file mode 100644
index 0000000..da82ee5
--- /dev/null
+++ b/ncurses/base/lib_slkattr.c
@@ -0,0 +1,56 @@
+/****************************************************************************
+ * Copyright (c) 1998,2000 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:  Juergen Pfeifer, 1997                                          *
+ *     and:  Thomas E. Dickey 2005                                          *
+ ****************************************************************************/
+
+/*
+ *	lib_slkattr.c
+ *	Soft key routines.
+ *      Fetch the labels attributes
+ */
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_slkattr.c,v 1.6 2005/01/08 21:44:28 tom Exp $")
+
+NCURSES_EXPORT(attr_t)
+slk_attr(void)
+{
+    T((T_CALLED("slk_attr()")));
+
+    if (SP != 0 && SP->_slk != 0) {
+	attr_t result = AttrOf(SP->_slk->attr) & ALL_BUT_COLOR;
+	int pair = GetPair(SP->_slk->attr);
+
+	result |= COLOR_PAIR(pair);
+	returnAttr(result);
+    } else
+	returnAttr(0);
+}
diff --git a/ncurses/base/lib_slkclear.c b/ncurses/base/lib_slkclear.c
new file mode 100644
index 0000000..946ceea
--- /dev/null
+++ b/ncurses/base/lib_slkclear.c
@@ -0,0 +1,66 @@
+/****************************************************************************
+ * 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Juergen Pfeifer                         1996-1999               *
+ *     and: Thomas E. Dickey                        1996-on                 *
+ ****************************************************************************/
+
+/*
+ *	lib_slkclear.c
+ *	Soft key routines.
+ *      Remove soft labels from the screen.
+ */
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_slkclear.c,v 1.10 2007/12/29 17:51:47 tom Exp $")
+
+NCURSES_EXPORT(int)
+slk_clear(void)
+{
+    int rc = ERR;
+
+    T((T_CALLED("slk_clear()")));
+
+    if (SP != NULL && SP->_slk != NULL) {
+	SP->_slk->hidden = TRUE;
+	/* For simulated SLK's it looks much more natural to
+	   inherit those attributes from the standard screen */
+	SP->_slk->win->_nc_bkgd = stdscr->_nc_bkgd;
+	WINDOW_ATTRS(SP->_slk->win) = WINDOW_ATTRS(stdscr);
+	if (SP->_slk->win == stdscr) {
+	    rc = OK;
+	} else {
+	    werase(SP->_slk->win);
+	    rc = wrefresh(SP->_slk->win);
+	}
+    }
+    returnCode(rc);
+}
diff --git a/ncurses/base/lib_slkcolor.c b/ncurses/base/lib_slkcolor.c
new file mode 100644
index 0000000..b677b65
--- /dev/null
+++ b/ncurses/base/lib_slkcolor.c
@@ -0,0 +1,56 @@
+/****************************************************************************
+ * Copyright (c) 1998-2003,2005 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:  Juergen Pfeifer, 1998                                          *
+ *     and:  Thomas E. Dickey 2005                                          *
+ ****************************************************************************/
+
+/*
+ *	lib_slkcolor.c
+ *	Soft key routines.
+ *	Set the label's color
+ */
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_slkcolor.c,v 1.12 2005/01/28 21:11:53 tom Exp $")
+
+NCURSES_EXPORT(int)
+slk_color(short color_pair_number)
+{
+    T((T_CALLED("slk_color(%d)"), color_pair_number));
+
+    if (SP != 0 && SP->_slk != 0 &&
+	color_pair_number >= 0 && color_pair_number < COLOR_PAIRS) {
+	TR(TRACE_ATTRS, ("... current is %s", _tracech_t(CHREF(SP->_slk->attr))));
+	SetPair(SP->_slk->attr, color_pair_number);
+	TR(TRACE_ATTRS, ("new attribute is %s", _tracech_t(CHREF(SP->_slk->attr))));
+	returnCode(OK);
+    } else
+	returnCode(ERR);
+}
diff --git a/ncurses/base/lib_slkinit.c b/ncurses/base/lib_slkinit.c
new file mode 100644
index 0000000..c440109
--- /dev/null
+++ b/ncurses/base/lib_slkinit.c
@@ -0,0 +1,55 @@
+/****************************************************************************
+ * Copyright (c) 1998-2007,2008 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Thomas E. Dickey                        1996-on                 *
+ ****************************************************************************/
+
+/*
+ *	lib_slkinit.c
+ *	Soft key routines.
+ *      Initialize soft labels.  Called by the user before initscr().
+ */
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_slkinit.c,v 1.7 2008/01/12 20:23:39 tom Exp $")
+
+NCURSES_EXPORT(int)
+slk_init(int format)
+{
+    int code = ERR;
+
+    T((T_CALLED("slk_init(%d)"), format));
+    if (format >= 0 && format <= 3 && !_nc_globals.slk_format) {
+	_nc_globals.slk_format = 1 + format;
+	code = _nc_ripoffline(-SLK_LINES(_nc_globals.slk_format), _nc_slk_initialize);
+    }
+    returnCode(code);
+}
diff --git a/ncurses/base/lib_slklab.c b/ncurses/base/lib_slklab.c
new file mode 100644
index 0000000..42bb4ac
--- /dev/null
+++ b/ncurses/base/lib_slklab.c
@@ -0,0 +1,51 @@
+/****************************************************************************
+ * Copyright (c) 1998-2000,2003 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ ****************************************************************************/
+
+/*
+ *	lib_slklab.c
+ *	Soft key routines.
+ *      Fetch the label text.
+ */
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_slklab.c,v 1.7 2003/03/29 22:53:48 tom Exp $")
+
+NCURSES_EXPORT(char *)
+slk_label(int n)
+{
+    T((T_CALLED("slk_label(%d)"), n));
+
+    if (SP == NULL || SP->_slk == NULL || n < 1 || n > SP->_slk->labcnt)
+	returnPtr(0);
+    returnPtr(SP->_slk->ent[n - 1].ent_text);
+}
diff --git a/ncurses/base/lib_slkrefr.c b/ncurses/base/lib_slkrefr.c
new file mode 100644
index 0000000..cb1beba
--- /dev/null
+++ b/ncurses/base/lib_slkrefr.c
@@ -0,0 +1,144 @@
+/****************************************************************************
+ * Copyright (c) 1998-2006,2008 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Juergen Pfeifer                         1996-on                 *
+ *     and: Thomas E. Dickey                                                *
+ ****************************************************************************/
+
+/*
+ *	lib_slkrefr.c
+ *	Write SLK window to the (virtual) screen.
+ */
+#include <curses.priv.h>
+#include <term.h>		/* num_labels, label_*, plab_norm */
+
+MODULE_ID("$Id: lib_slkrefr.c,v 1.17 2008/09/27 14:07:53 juergen Exp $")
+
+/*
+ * Paint the info line for the PC style SLK emulation.
+ */
+static void
+slk_paint_info(WINDOW *win)
+{
+    SCREEN *sp = _nc_screen_of(win);
+
+    if (win && sp && (sp->slk_format == 4)) {
+	int i;
+
+	mvwhline(win, 0, 0, 0, getmaxx(win));
+	wmove(win, 0, 0);
+
+	for (i = 0; i < sp->_slk->maxlab; i++) {
+	    mvwprintw(win, 0, sp->_slk->ent[i].ent_x, "F%d", i + 1);
+	}
+    }
+}
+
+/*
+ * Write the soft labels to the soft-key window.
+ */
+static void
+slk_intern_refresh(SLK * slk)
+{
+    int i;
+    int fmt = SP->slk_format;
+
+    for (i = 0; i < slk->labcnt; i++) {
+	if (slk->dirty || slk->ent[i].dirty) {
+	    if (slk->ent[i].visible) {
+		if (num_labels > 0 && SLK_STDFMT(fmt)) {
+		    if (i < num_labels) {
+			TPUTS_TRACE("plab_norm");
+			putp(TPARM_2(plab_norm, i + 1, slk->ent[i].form_text));
+		    }
+		} else {
+		    if (fmt == 4)
+			slk_paint_info(slk->win);
+		    wmove(slk->win, SLK_LINES(fmt) - 1, slk->ent[i].ent_x);
+		    if (SP->_slk) {
+			wattrset(slk->win, AttrOf(SP->_slk->attr));
+		    }
+		    waddstr(slk->win, slk->ent[i].form_text);
+		    /* if we simulate SLK's, it's looking much more
+		       natural to use the current ATTRIBUTE also
+		       for the label window */
+		    wattrset(slk->win, WINDOW_ATTRS(stdscr));
+		}
+	    }
+	    slk->ent[i].dirty = FALSE;
+	}
+    }
+    slk->dirty = FALSE;
+
+    if (num_labels > 0) {
+	if (slk->hidden) {
+	    TPUTS_TRACE("label_off");
+	    putp(label_off);
+	} else {
+	    TPUTS_TRACE("label_on");
+	    putp(label_on);
+	}
+    }
+}
+
+/*
+ * Refresh the soft labels.
+ */
+NCURSES_EXPORT(int)
+slk_noutrefresh(void)
+{
+    T((T_CALLED("slk_noutrefresh()")));
+
+    if (SP == NULL || SP->_slk == NULL)
+	returnCode(ERR);
+    if (SP->_slk->hidden)
+	returnCode(OK);
+    slk_intern_refresh(SP->_slk);
+
+    returnCode(wnoutrefresh(SP->_slk->win));
+}
+
+/*
+ * Refresh the soft labels.
+ */
+NCURSES_EXPORT(int)
+slk_refresh(void)
+{
+    T((T_CALLED("slk_refresh()")));
+
+    if (SP == NULL || SP->_slk == NULL)
+	returnCode(ERR);
+    if (SP->_slk->hidden)
+	returnCode(OK);
+    slk_intern_refresh(SP->_slk);
+
+    returnCode(wrefresh(SP->_slk->win));
+}
diff --git a/ncurses/base/lib_slkset.c b/ncurses/base/lib_slkset.c
new file mode 100644
index 0000000..e19f88e
--- /dev/null
+++ b/ncurses/base/lib_slkset.c
@@ -0,0 +1,149 @@
+/****************************************************************************
+ * Copyright (c) 1998-2005,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: Juergen Pfeifer                                                 *
+ *     and: Thomas E. Dickey                                                *
+ ****************************************************************************/
+
+/*
+ *	lib_slkset.c
+ *      Set soft label text.
+ */
+#include <curses.priv.h>
+#include <ctype.h>
+
+#if USE_WIDEC_SUPPORT
+#if HAVE_WCTYPE_H
+#include <wctype.h>
+#endif
+#endif
+
+MODULE_ID("$Id: lib_slkset.c,v 1.17 2007/10/13 20:08:46 tom Exp $")
+
+NCURSES_EXPORT(int)
+slk_set(int i, const char *astr, int format)
+{
+    SLK *slk;
+    int offset;
+    int numchrs;
+    int numcols;
+    int limit;
+    const char *str = astr;
+    const char *p;
+
+    T((T_CALLED("slk_set(%d, \"%s\", %d)"), i, str, format));
+
+    if (SP == 0
+	|| (slk = SP->_slk) == 0
+	|| i < 1
+	|| i > slk->labcnt
+	|| format < 0
+	|| format > 2)
+	returnCode(ERR);
+    if (str == NULL)
+	str = "";
+    --i;			/* Adjust numbering of labels */
+
+    limit = MAX_SKEY_LEN(SP->slk_format);
+    while (isspace(UChar(*str)))
+	str++;			/* skip over leading spaces  */
+    p = str;
+
+#if USE_WIDEC_SUPPORT
+    numcols = 0;
+    while (*p != 0) {
+	mbstate_t state;
+	wchar_t wc;
+	size_t need;
+
+	init_mb(state);
+	need = mbrtowc(0, p, strlen(p), &state);
+	if (need == (size_t) -1)
+	    break;
+	mbrtowc(&wc, p, need, &state);
+	if (!iswprint((wint_t) wc))
+	    break;
+	if (wcwidth(wc) + numcols > limit)
+	    break;
+	numcols += wcwidth(wc);
+	p += need;
+    }
+    numchrs = (p - str);
+#else
+    while (isprint(UChar(*p)))
+	p++;			/* The first non-print stops */
+
+    numcols = (p - str);
+    if (numcols > limit)
+	numcols = limit;
+    numchrs = numcols;
+#endif
+
+    FreeIfNeeded(slk->ent[i].ent_text);
+    if ((slk->ent[i].ent_text = strdup(str)) == 0)
+	returnCode(ERR);
+    slk->ent[i].ent_text[numchrs] = '\0';
+
+    if ((slk->ent[i].form_text = (char *) _nc_doalloc(slk->ent[i].form_text,
+						      (unsigned) (limit +
+								  numchrs + 1))
+	) == 0)
+	returnCode(ERR);
+
+    switch (format) {
+    default:
+    case 0:			/* left-justified */
+	offset = 0;
+	break;
+    case 1:			/* centered */
+	offset = (limit - numcols) / 2;
+	break;
+    case 2:			/* right-justified */
+	offset = limit - numcols;
+	break;
+    }
+    if (offset <= 0)
+	offset = 0;
+    else
+	memset(slk->ent[i].form_text, ' ', (unsigned) offset);
+
+    memcpy(slk->ent[i].form_text + offset,
+	   slk->ent[i].ent_text,
+	   (unsigned) numchrs);
+
+    if (offset < limit) {
+	memset(slk->ent[i].form_text + offset + numchrs,
+	       ' ',
+	       (unsigned) (limit - (offset + numcols)));
+    }
+
+    slk->ent[i].form_text[numchrs - numcols + limit] = 0;
+    slk->ent[i].dirty = TRUE;
+    returnCode(OK);
+}
diff --git a/ncurses/base/lib_slktouch.c b/ncurses/base/lib_slktouch.c
new file mode 100644
index 0000000..5eb5df3
--- /dev/null
+++ b/ncurses/base/lib_slktouch.c
@@ -0,0 +1,53 @@
+/****************************************************************************
+ * Copyright (c) 1998,2000 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ ****************************************************************************/
+
+/*
+ *	lib_slktouch.c
+ *	Soft key routines.
+ *      Force the code to believe that the soft keys have been changed.
+ */
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_slktouch.c,v 1.5 2000/12/10 02:43:27 tom Exp $")
+
+NCURSES_EXPORT(int)
+slk_touch(void)
+{
+    T((T_CALLED("slk_touch()")));
+
+    if (SP == NULL || SP->_slk == NULL)
+	returnCode(ERR);
+    SP->_slk->dirty = TRUE;
+
+    returnCode(OK);
+}
diff --git a/ncurses/base/lib_touch.c b/ncurses/base/lib_touch.c
new file mode 100644
index 0000000..2ac21f2
--- /dev/null
+++ b/ncurses/base/lib_touch.c
@@ -0,0 +1,91 @@
+/****************************************************************************
+ * Copyright (c) 1998,2000 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ ****************************************************************************/
+
+/*
+**	lib_touch.c
+**
+**	   The routines	untouchwin(),
+**			wtouchln(),
+**			is_linetouched()
+**			is_wintouched().
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_touch.c,v 1.9 2000/12/10 02:43:27 tom Exp $")
+
+NCURSES_EXPORT(bool)
+is_linetouched(WINDOW *win, int line)
+{
+    T((T_CALLED("is_linetouched(%p,%d)"), win, line));
+
+    /* XSI doesn't define any error */
+    if (!win || (line > win->_maxy) || (line < 0))
+	returnCode((bool) ERR);
+
+    returnCode(win->_line[line].firstchar != _NOCHANGE ? TRUE : FALSE);
+}
+
+NCURSES_EXPORT(bool)
+is_wintouched(WINDOW *win)
+{
+    int i;
+
+    T((T_CALLED("is_wintouched(%p)"), win));
+
+    if (win)
+	for (i = 0; i <= win->_maxy; i++)
+	    if (win->_line[i].firstchar != _NOCHANGE)
+		returnCode(TRUE);
+    returnCode(FALSE);
+}
+
+NCURSES_EXPORT(int)
+wtouchln(WINDOW *win, int y, int n, int changed)
+{
+    int i;
+
+    T((T_CALLED("wtouchln(%p,%d,%d,%d)"), win, y, n, changed));
+
+    if (!win || (n < 0) || (y < 0) || (y > win->_maxy))
+	returnCode(ERR);
+
+    for (i = y; i < y + n; i++) {
+	if (i > win->_maxy)
+	    break;
+	win->_line[i].firstchar = changed ? 0 : _NOCHANGE;
+	win->_line[i].lastchar = changed ? win->_maxx : _NOCHANGE;
+    }
+    returnCode(OK);
+}
diff --git a/ncurses/base/lib_ungetch.c b/ncurses/base/lib_ungetch.c
new file mode 100644
index 0000000..8742f86
--- /dev/null
+++ b/ncurses/base/lib_ungetch.c
@@ -0,0 +1,90 @@
+/****************************************************************************
+ * Copyright (c) 1998-2007,2008 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Thomas E. Dickey                        1996-on                 *
+ ****************************************************************************/
+
+/*
+**	lib_ungetch.c
+**
+**	The routine ungetch().
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_ungetch.c,v 1.11 2008/05/31 16:44:54 tom Exp $")
+
+#include <fifo_defs.h>
+
+#ifdef TRACE
+NCURSES_EXPORT(void)
+_nc_fifo_dump(SCREEN *sp)
+{
+    int i;
+    T(("head = %d, tail = %d, peek = %d", head, tail, peek));
+    for (i = 0; i < 10; i++)
+	T(("char %d = %s", i, _nc_tracechar(sp, sp->_fifo[i])));
+}
+#endif /* TRACE */
+
+NCURSES_EXPORT(int)
+_nc_ungetch(SCREEN *sp, int ch)
+{
+    int rc = ERR;
+
+    if (tail != -1) {
+	if (head == -1) {
+	    head = 0;
+	    t_inc();
+	    peek = tail;	/* no raw keys */
+	} else
+	    h_dec();
+
+	sp->_fifo[head] = ch;
+	T(("ungetch %s ok", _nc_tracechar(sp, ch)));
+#ifdef TRACE
+	if (USE_TRACEF(TRACE_IEVENT)) {
+	    _nc_fifo_dump(sp);
+	    _nc_unlock_global(tracef);
+	}
+#endif
+	rc = OK;
+    }
+    return rc;
+}
+
+NCURSES_EXPORT(int)
+ungetch(int ch)
+{
+    T((T_CALLED("ungetch(%s)"), _nc_tracechar(SP, ch)));
+    returnCode(_nc_ungetch(SP, ch));
+}
diff --git a/ncurses/base/lib_vline.c b/ncurses/base/lib_vline.c
new file mode 100644
index 0000000..1a2537e
--- /dev/null
+++ b/ncurses/base/lib_vline.c
@@ -0,0 +1,79 @@
+/****************************************************************************
+ * Copyright (c) 1998-2001,2006 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ ****************************************************************************/
+
+/*
+**	lib_vline.c
+**
+**	The routine wvline().
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_vline.c,v 1.10 2006/03/11 21:52:19 tom Exp $")
+
+NCURSES_EXPORT(int)
+wvline(WINDOW *win, chtype ch, int n)
+{
+    int code = ERR;
+    NCURSES_SIZE_T row, col;
+    NCURSES_SIZE_T end;
+
+    T((T_CALLED("wvline(%p,%s,%d)"), win, _tracechtype(ch), n));
+
+    if (win) {
+	NCURSES_CH_T wch;
+	row = win->_cury;
+	col = win->_curx;
+	end = row + n - 1;
+	if (end > win->_maxy)
+	    end = win->_maxy;
+
+	if (ch == 0)
+	    SetChar2(wch, ACS_VLINE);
+	else
+	    SetChar2(wch, ch);
+	wch = _nc_render(win, wch);
+
+	while (end >= row) {
+	    struct ldat *line = &(win->_line[end]);
+	    line->text[col] = wch;
+	    CHANGED_CELL(line, col);
+	    end--;
+	}
+
+	_nc_synchook(win);
+	code = OK;
+    }
+    returnCode(code);
+}
diff --git a/ncurses/base/lib_wattroff.c b/ncurses/base/lib_wattroff.c
new file mode 100644
index 0000000..bf2020e
--- /dev/null
+++ b/ncurses/base/lib_wattroff.c
@@ -0,0 +1,64 @@
+/****************************************************************************
+ * Copyright (c) 1998-2005,2006 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Thomas E. Dickey                        1996-on                 *
+ ****************************************************************************/
+
+/*
+**	lib_wattroff.c
+**
+**	The routine wattr_off().
+**
+*/
+
+#include <curses.priv.h>
+#include <ctype.h>
+
+MODULE_ID("$Id: lib_wattroff.c,v 1.9 2006/05/27 19:30:33 tom Exp $")
+
+NCURSES_EXPORT(int)
+wattr_off(WINDOW *win, attr_t at, void *opts GCC_UNUSED)
+{
+    T((T_CALLED("wattr_off(%p,%s)"), win, _traceattr(at)));
+    if (win) {
+	T(("... current %s (%d)",
+	   _traceattr(WINDOW_ATTRS(win)),
+	   GET_WINDOW_PAIR(win)));
+
+	if_EXT_COLORS({
+	    if (at & A_COLOR)
+		win->_color = 0;
+	});
+	toggle_attr_off(WINDOW_ATTRS(win), at);
+	returnCode(OK);
+    } else
+	returnCode(ERR);
+}
diff --git a/ncurses/base/lib_wattron.c b/ncurses/base/lib_wattron.c
new file mode 100644
index 0000000..2e17d96
--- /dev/null
+++ b/ncurses/base/lib_wattron.c
@@ -0,0 +1,64 @@
+/****************************************************************************
+ * Copyright (c) 1998-2005,2006 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Thomas E. Dickey                        1996-on                 *
+ ****************************************************************************/
+
+/*
+**	lib_wattron.c
+**
+**	The routines wattr_on().
+**
+*/
+
+#include <curses.priv.h>
+#include <ctype.h>
+
+MODULE_ID("$Id: lib_wattron.c,v 1.9 2006/05/27 19:30:46 tom Exp $")
+
+NCURSES_EXPORT(int)
+wattr_on(WINDOW *win, attr_t at, void *opts GCC_UNUSED)
+{
+    T((T_CALLED("wattr_on(%p,%s)"), win, _traceattr(at)));
+    if (win != 0) {
+	T(("... current %s (%d)",
+	   _traceattr(WINDOW_ATTRS(win)),
+	   GET_WINDOW_PAIR(win)));
+
+	if_EXT_COLORS({
+	    if (at & A_COLOR)
+		win->_color = PAIR_NUMBER(at);
+	});
+	toggle_attr_on(WINDOW_ATTRS(win), at);
+	returnCode(OK);
+    } else
+	returnCode(ERR);
+}
diff --git a/ncurses/base/lib_winch.c b/ncurses/base/lib_winch.c
new file mode 100644
index 0000000..18da9c5
--- /dev/null
+++ b/ncurses/base/lib_winch.c
@@ -0,0 +1,54 @@
+/****************************************************************************
+ * Copyright (c) 1998,2000,2001 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 <dickey@clark.net> 1998                        *
+ ****************************************************************************/
+
+/*
+**	lib_winch.c
+**
+**	The routine winch().
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_winch.c,v 1.5 2001/06/02 23:42:08 skimo Exp $")
+
+NCURSES_EXPORT(chtype)
+winch(WINDOW *win)
+{
+    T((T_CALLED("winch(%p)"), win));
+    if (win != 0) {
+	returnChar(CharOf(win->_line[win->_cury].text[win->_curx]) |
+		   AttrOf(win->_line[win->_cury].text[win->_curx]));
+    } else {
+	returnChar(0);
+    }
+}
diff --git a/ncurses/base/lib_window.c b/ncurses/base/lib_window.c
new file mode 100644
index 0000000..a3236e2
--- /dev/null
+++ b/ncurses/base/lib_window.c
@@ -0,0 +1,250 @@
+/****************************************************************************
+ * Copyright (c) 1998-2007,2008 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ ****************************************************************************/
+
+/*
+**	lib_window.c
+**
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_window.c,v 1.25 2008/06/07 14:12:56 tom Exp $")
+
+NCURSES_EXPORT(void)
+_nc_synchook(WINDOW *win)
+/* hook to be called after each window change */
+{
+    if (win->_immed)
+	wrefresh(win);
+    if (win->_sync)
+	wsyncup(win);
+}
+
+NCURSES_EXPORT(int)
+mvderwin(WINDOW *win, int y, int x)
+/* move a derived window */
+{
+    WINDOW *orig;
+    int i;
+
+    T((T_CALLED("mvderwin(%p,%d,%d)"), win, y, x));
+
+    if (win && (orig = win->_parent)) {
+	if (win->_parx == x && win->_pary == y)
+	    returnCode(OK);
+	if (x < 0 || y < 0)
+	    returnCode(ERR);
+	if ((x + getmaxx(win) > getmaxx(orig)) ||
+	    (y + getmaxy(win) > getmaxy(orig)))
+	    returnCode(ERR);
+    } else
+	returnCode(ERR);
+    wsyncup(win);
+    win->_parx = x;
+    win->_pary = y;
+    for (i = 0; i < getmaxy(win); i++)
+	win->_line[i].text = &(orig->_line[y++].text[x]);
+    returnCode(OK);
+}
+
+NCURSES_EXPORT(int)
+syncok(WINDOW *win, bool bf)
+/* enable/disable automatic wsyncup() on each change to window */
+{
+    T((T_CALLED("syncok(%p,%d)"), win, bf));
+
+    if (win) {
+	win->_sync = bf;
+	returnCode(OK);
+    } else
+	returnCode(ERR);
+}
+
+NCURSES_EXPORT(void)
+wsyncup(WINDOW *win)
+/* mark changed every cell in win's ancestors that is changed in win */
+/* Rewritten by J. Pfeifer, 1-Apr-96 (don't even think that...)      */
+{
+    WINDOW *wp;
+
+    T((T_CALLED("wsyncup(%p)"), win));
+    if (win && win->_parent) {
+	for (wp = win; wp->_parent; wp = wp->_parent) {
+	    int y;
+	    WINDOW *pp = wp->_parent;
+
+	    assert((wp->_pary <= pp->_maxy) &&
+		   ((wp->_pary + wp->_maxy) <= pp->_maxy));
+
+	    for (y = 0; y <= wp->_maxy; y++) {
+		int left = wp->_line[y].firstchar;
+		if (left >= 0) {	/* line is touched */
+		    struct ldat *line = &(pp->_line[wp->_pary + y]);
+		    /* left & right character in parent window coordinates */
+		    int right = wp->_line[y].lastchar + wp->_parx;
+		    left += wp->_parx;
+
+		    CHANGED_RANGE(line, left, right);
+		}
+	    }
+	}
+    }
+    returnVoid;
+}
+
+NCURSES_EXPORT(void)
+wsyncdown(WINDOW *win)
+/* mark changed every cell in win that is changed in any of its ancestors */
+/* Rewritten by J. Pfeifer, 1-Apr-96 (don't even think that...)           */
+{
+    T((T_CALLED("wsyncdown(%p)"), win));
+
+    if (win && win->_parent) {
+	WINDOW *pp = win->_parent;
+	int y;
+
+	/* This recursion guarantees, that the changes are propagated down-
+	   wards from the root to our direct parent. */
+	wsyncdown(pp);
+
+	/* and now we only have to propagate the changes from our direct
+	   parent, if there are any. */
+	assert((win->_pary <= pp->_maxy) &&
+	       ((win->_pary + win->_maxy) <= pp->_maxy));
+
+	for (y = 0; y <= win->_maxy; y++) {
+	    if (pp->_line[win->_pary + y].firstchar >= 0) {	/* parent changed */
+		struct ldat *line = &(win->_line[y]);
+		/* left and right character in child coordinates */
+		int left = pp->_line[win->_pary + y].firstchar - win->_parx;
+		int right = pp->_line[win->_pary + y].lastchar - win->_parx;
+		/* The change may be outside the child's range */
+		if (left < 0)
+		    left = 0;
+		if (right > win->_maxx)
+		    right = win->_maxx;
+		CHANGED_RANGE(line, left, right);
+	    }
+	}
+    }
+    returnVoid;
+}
+
+NCURSES_EXPORT(void)
+wcursyncup(WINDOW *win)
+/* sync the cursor in all derived windows to its value in the base window */
+{
+    WINDOW *wp;
+
+    T((T_CALLED("wcursyncup(%p)"), win));
+    for (wp = win; wp && wp->_parent; wp = wp->_parent) {
+	wmove(wp->_parent, wp->_pary + wp->_cury, wp->_parx + wp->_curx);
+    }
+    returnVoid;
+}
+
+NCURSES_EXPORT(WINDOW *)
+dupwin(WINDOW *win)
+/* make an exact duplicate of the given window */
+{
+    WINDOW *nwin = 0;
+    size_t linesize;
+    int i;
+
+    T((T_CALLED("dupwin(%p)"), win));
+
+    if (win != 0) {
+
+	_nc_lock_global(curses);
+	if (win->_flags & _ISPAD) {
+	    nwin = newpad(win->_maxy + 1,
+			  win->_maxx + 1);
+	} else {
+	    nwin = newwin(win->_maxy + 1,
+			  win->_maxx + 1,
+			  win->_begy,
+			  win->_begx);
+	}
+
+	if (nwin != 0) {
+
+	    nwin->_curx = win->_curx;
+	    nwin->_cury = win->_cury;
+	    nwin->_maxy = win->_maxy;
+	    nwin->_maxx = win->_maxx;
+	    nwin->_begy = win->_begy;
+	    nwin->_begx = win->_begx;
+	    nwin->_yoffset = win->_yoffset;
+
+	    nwin->_flags = win->_flags & ~_SUBWIN;
+	    /* Due to the use of newwin(), the clone is not a subwindow.
+	     * The text is really copied into the clone.
+	     */
+
+	    WINDOW_ATTRS(nwin) = WINDOW_ATTRS(win);
+	    nwin->_nc_bkgd = win->_nc_bkgd;
+
+	    nwin->_notimeout = win->_notimeout;
+	    nwin->_clear = win->_clear;
+	    nwin->_leaveok = win->_leaveok;
+	    nwin->_scroll = win->_scroll;
+	    nwin->_idlok = win->_idlok;
+	    nwin->_idcok = win->_idcok;
+	    nwin->_immed = win->_immed;
+	    nwin->_sync = win->_sync;
+	    nwin->_use_keypad = win->_use_keypad;
+	    nwin->_delay = win->_delay;
+
+	    nwin->_parx = 0;
+	    nwin->_pary = 0;
+	    nwin->_parent = (WINDOW *) 0;
+	    /* See above: the clone isn't a subwindow! */
+
+	    nwin->_regtop = win->_regtop;
+	    nwin->_regbottom = win->_regbottom;
+
+	    if (win->_flags & _ISPAD)
+		nwin->_pad = win->_pad;
+
+	    linesize = (win->_maxx + 1) * sizeof(NCURSES_CH_T);
+	    for (i = 0; i <= nwin->_maxy; i++) {
+		memcpy(nwin->_line[i].text, win->_line[i].text, linesize);
+		nwin->_line[i].firstchar = win->_line[i].firstchar;
+		nwin->_line[i].lastchar = win->_line[i].lastchar;
+	    }
+	}
+	_nc_unlock_global(curses);
+    }
+    returnWin(nwin);
+}
diff --git a/ncurses/base/memmove.c b/ncurses/base/memmove.c
new file mode 100644
index 0000000..093ad72
--- /dev/null
+++ b/ncurses/base/memmove.c
@@ -0,0 +1,69 @@
+/****************************************************************************
+ * Copyright (c) 1998-2000,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.                                                           *
+ ****************************************************************************/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: memmove.c,v 1.5 2007/08/11 17:12:43 tom Exp $")
+
+/****************************************************************************
+ *  Author: Thomas E. Dickey <dickey@clark.net> 1998                        *
+ ****************************************************************************/
+
+#if USE_MY_MEMMOVE
+#define DST ((char *)s1)
+#define SRC ((const char *)s2)
+NCURSES_EXPORT(void *)
+_nc_memmove(void *s1, const void *s2, size_t n)
+{
+    if (n != 0) {
+	if ((DST + n > SRC) && (SRC + n > DST)) {
+	    static char *bfr;
+	    static size_t length;
+	    register size_t j;
+	    if (length < n) {
+		length = (n * 3) / 2;
+		bfr = typeRealloc(char, length, bfr);
+	    }
+	    for (j = 0; j < n; j++)
+		bfr[j] = SRC[j];
+	    s2 = bfr;
+	}
+	while (n-- != 0)
+	    DST[n] = SRC[n];
+    }
+    return s1;
+}
+#else
+extern
+NCURSES_EXPORT(void)
+_nc_memmove(void);		/* quiet's gcc warning */
+NCURSES_EXPORT(void)
+_nc_memmove(void)
+{
+}				/* nonempty for strict ANSI compilers */
+#endif /* USE_MY_MEMMOVE */
diff --git a/ncurses/base/nc_panel.c b/ncurses/base/nc_panel.c
new file mode 100644
index 0000000..59bfbbe
--- /dev/null
+++ b/ncurses/base/nc_panel.c
@@ -0,0 +1,41 @@
+/****************************************************************************
+ * Copyright (c) 1998,2000 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 <dickey@clark.net> 1997                        *
+ ****************************************************************************/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: nc_panel.c,v 1.4 2000/12/10 02:43:28 tom Exp $")
+
+NCURSES_EXPORT(struct panelhook *)
+_nc_panelhook(void)
+{
+    return (SP ? &(SP->_panelHook) : NULL);
+}
diff --git a/ncurses/base/resizeterm.c b/ncurses/base/resizeterm.c
new file mode 100644
index 0000000..a94cfc3
--- /dev/null
+++ b/ncurses/base/resizeterm.c
@@ -0,0 +1,455 @@
+/****************************************************************************
+ * Copyright (c) 1998-2007,2008 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                                                *
+ ****************************************************************************/
+
+/*
+ * This is an extension to the curses library.  It provides callers with a hook
+ * into the NCURSES data to resize windows, primarily for use by programs
+ * running in an X Window terminal (e.g., xterm).  I abstracted this module
+ * from my application library for NCURSES because it must be compiled with
+ * the private data structures -- T.Dickey 1995/7/4.
+ */
+
+#include <curses.priv.h>
+#include <term.h>
+
+MODULE_ID("$Id: resizeterm.c,v 1.34 2008/06/07 13:58:40 tom Exp $")
+
+#define stolen_lines (screen_lines - SP->_lines_avail)
+
+/*
+ * If we're trying to be reentrant, do not want any local statics.
+ */
+#if USE_REENTRANT
+#define EXTRA_ARGS ,     CurLines,     CurCols
+#define EXTRA_DCLS , int CurLines, int CurCols
+#else
+static int current_lines;
+static int current_cols;
+#define CurLines current_lines
+#define CurCols  current_cols
+#define EXTRA_ARGS		/* nothing */
+#define EXTRA_DCLS		/* nothing */
+#endif
+
+#ifdef TRACE
+static void
+show_window_sizes(const char *name)
+{
+    WINDOWLIST *wp;
+
+    _nc_lock_global(curses);
+    _tracef("%s resizing: %2d x %2d (%2d x %2d)", name, LINES, COLS,
+	    screen_lines, screen_columns);
+    for (each_window(wp)) {
+	_tracef("  window %p is %2ld x %2ld at %2ld,%2ld",
+		&(wp->win),
+		(long) wp->win._maxy + 1,
+		(long) wp->win._maxx + 1,
+		(long) wp->win._begy,
+		(long) wp->win._begx);
+    }
+    _nc_unlock_global(curses);
+}
+#endif
+
+/*
+ * Return true if the given dimensions do not match the internal terminal
+ * structure's size.
+ */
+NCURSES_EXPORT(bool)
+is_term_resized(int ToLines, int ToCols)
+{
+    T((T_CALLED("is_term_resized(%d, %d)"), ToLines, ToCols));
+    returnCode(ToLines > 0
+	       && ToCols > 0
+	       && (ToLines != screen_lines
+		   || ToCols != screen_columns));
+}
+
+/*
+ */
+static ripoff_t *
+ripped_window(WINDOW *win)
+{
+    ripoff_t *result = 0;
+    ripoff_t *rop;
+
+    if (win != 0) {
+	for (each_ripoff(rop)) {
+	    if (rop->win == win && rop->line != 0) {
+		result = rop;
+		break;
+	    }
+	}
+    }
+    return result;
+}
+
+/*
+ * Returns the number of lines from the bottom for the beginning of a ripped
+ * off window.
+ */
+static int
+ripped_bottom(WINDOW *win)
+{
+    int result = 0;
+    ripoff_t *rop;
+
+    if (win != 0) {
+	for (each_ripoff(rop)) {
+	    if (rop->line < 0) {
+		result -= rop->line;
+		if (rop->win == win) {
+		    break;
+		}
+	    }
+	}
+    }
+    return result;
+}
+
+/*
+ * Return the number of levels of child-windows under the current window.
+ */
+static int
+child_depth(WINDOW *cmp)
+{
+    int depth = 0;
+
+    if (cmp != 0) {
+	WINDOWLIST *wp;
+
+	for (each_window(wp)) {
+	    WINDOW *tst = &(wp->win);
+	    if (tst->_parent == cmp) {
+		depth = 1 + child_depth(tst);
+		break;
+	    }
+	}
+    }
+    return depth;
+}
+
+/*
+ * Return the number of levels of parent-windows above the current window.
+ */
+static int
+parent_depth(WINDOW *cmp)
+{
+    int depth = 0;
+
+    if (cmp != 0) {
+	WINDOW *tst;
+	while ((tst = cmp->_parent) != 0) {
+	    ++depth;
+	    cmp = tst;
+	}
+    }
+    return depth;
+}
+
+/*
+ * FIXME: must adjust position so it's within the parent!
+ */
+static int
+adjust_window(WINDOW *win, int ToLines, int ToCols, int stolen EXTRA_DCLS)
+{
+    int result;
+    int bottom = CurLines + SP->_topstolen - stolen;
+    int myLines = win->_maxy + 1;
+    int myCols = win->_maxx + 1;
+    ripoff_t *rop = ripped_window(win);
+
+    T((T_CALLED("adjust_window(%p,%d,%d)%s depth %d/%d currently %ldx%ld at %ld,%ld"),
+       win, ToLines, ToCols,
+       (rop != 0) ? " (rip)" : "",
+       parent_depth(win),
+       child_depth(win),
+       (long) getmaxy(win), (long) getmaxx(win),
+       (long) getbegy(win) + win->_yoffset, (long) getbegx(win)));
+
+    if (rop != 0 && rop->line < 0) {
+	/*
+	 * If it is a ripped-off window at the bottom of the screen, simply
+	 * move it to the same relative position.
+	 */
+	win->_begy = ToLines - ripped_bottom(win) - 0 - win->_yoffset;
+    } else if (win->_begy >= bottom) {
+	/*
+	 * If it is below the bottom of the new screen, move up by the same
+	 * amount that the screen shrank.
+	 */
+	win->_begy += (ToLines - CurLines);
+    } else {
+	if (myLines == (CurLines - stolen)
+	    && ToLines != CurLines) {
+	    myLines = ToLines - stolen;
+	} else if (myLines == CurLines
+		   && ToLines != CurLines) {
+	    myLines = ToLines;
+	}
+    }
+
+    if (myLines > ToLines) {
+	myLines = ToLines;
+    }
+
+    if (myCols > ToCols)
+	myCols = ToCols;
+
+    if (myCols == CurCols
+	&& ToCols != CurCols)
+	myCols = ToCols;
+
+    result = wresize(win, myLines, myCols);
+    returnCode(result);
+}
+
+/*
+ * If we're decreasing size, recursively search for windows that have no
+ * children, decrease those to fit, then decrease the containing window, etc.
+ */
+static int
+decrease_size(int ToLines, int ToCols, int stolen EXTRA_DCLS)
+{
+    bool found;
+    int depth = 0;
+    WINDOWLIST *wp;
+
+    T((T_CALLED("decrease_size(%d, %d)"), ToLines, ToCols));
+
+    do {
+	found = FALSE;
+	TR(TRACE_UPDATE, ("decreasing size of windows to %dx%d, depth=%d",
+			  ToLines, ToCols, depth));
+	for (each_window(wp)) {
+	    WINDOW *win = &(wp->win);
+
+	    if (!(win->_flags & _ISPAD)) {
+		if (child_depth(win) == depth) {
+		    found = TRUE;
+		    if (adjust_window(win, ToLines, ToCols,
+				      stolen EXTRA_ARGS) != OK)
+			returnCode(ERR);
+		}
+	    }
+	}
+	++depth;
+    } while (found);
+    returnCode(OK);
+}
+
+/*
+ * If we're increasing size, recursively search for windows that have no
+ * parent, increase those to fit, then increase the contained window, etc.
+ */
+static int
+increase_size(int ToLines, int ToCols, int stolen EXTRA_DCLS)
+{
+    bool found;
+    int depth = 0;
+    WINDOWLIST *wp;
+
+    T((T_CALLED("increase_size(%d, %d)"), ToLines, ToCols));
+
+    do {
+	found = FALSE;
+	TR(TRACE_UPDATE, ("increasing size of windows to %dx%d, depth=%d",
+			  ToLines, ToCols, depth));
+	for (each_window(wp)) {
+	    WINDOW *win = &(wp->win);
+
+	    if (!(win->_flags & _ISPAD)) {
+		if (parent_depth(win) == depth) {
+		    found = TRUE;
+		    if (adjust_window(win, ToLines, ToCols,
+				      stolen EXTRA_ARGS) != OK)
+			returnCode(ERR);
+		}
+	    }
+	}
+	++depth;
+    } while (found);
+    returnCode(OK);
+}
+
+/*
+ * This function reallocates NCURSES window structures, with no side-effects
+ * such as ungetch().
+ */
+NCURSES_EXPORT(int)
+resize_term(int ToLines, int ToCols)
+{
+    int result = OK EXTRA_ARGS;
+    int was_stolen;
+
+    T((T_CALLED("resize_term(%d,%d) old(%d,%d)"),
+       ToLines, ToCols,
+       screen_lines, screen_columns));
+
+    if (SP == 0) {
+	returnCode(ERR);
+    }
+
+    _nc_lock_global(curses);
+
+    was_stolen = (screen_lines - SP->_lines_avail);
+    if (is_term_resized(ToLines, ToCols)) {
+	int myLines = CurLines = screen_lines;
+	int myCols = CurCols = screen_columns;
+
+#ifdef TRACE
+	if (USE_TRACEF(TRACE_UPDATE)) {
+	    show_window_sizes("before");
+	    _nc_unlock_global(tracef);
+	}
+#endif
+	if (ToLines > screen_lines) {
+	    increase_size(myLines = ToLines, myCols, was_stolen EXTRA_ARGS);
+	    CurLines = myLines;
+	    CurCols = myCols;
+	}
+
+	if (ToCols > screen_columns) {
+	    increase_size(myLines, myCols = ToCols, was_stolen EXTRA_ARGS);
+	    CurLines = myLines;
+	    CurCols = myCols;
+	}
+
+	if (ToLines < myLines ||
+	    ToCols < myCols) {
+	    decrease_size(ToLines, ToCols, was_stolen EXTRA_ARGS);
+	}
+
+	screen_lines = lines = ToLines;
+	screen_columns = columns = ToCols;
+
+	SP->_lines_avail = lines - was_stolen;
+
+	if (SP->oldhash) {
+	    FreeAndNull(SP->oldhash);
+	}
+	if (SP->newhash) {
+	    FreeAndNull(SP->newhash);
+	}
+#ifdef TRACE
+	if (USE_TRACEF(TRACE_UPDATE)) {
+	    SET_LINES(ToLines - was_stolen);
+	    SET_COLS(ToCols);
+	    show_window_sizes("after");
+	    _nc_unlock_global(tracef);
+	}
+#endif
+    }
+
+    /*
+     * Always update LINES, to allow for call from lib_doupdate.c which
+     * needs to have the count adjusted by the stolen (ripped off) lines.
+     */
+    SET_LINES(ToLines - was_stolen);
+    SET_COLS(ToCols);
+
+    _nc_unlock_global(curses);
+
+    returnCode(result);
+}
+
+/*
+ * This function reallocates NCURSES window structures.  It is invoked in
+ * response to a SIGWINCH interrupt.  Other user-defined windows may also need
+ * to be reallocated.
+ *
+ * Because this performs memory allocation, it should not (in general) be
+ * invoked directly from the signal handler.
+ */
+NCURSES_EXPORT(int)
+resizeterm(int ToLines, int ToCols)
+{
+    int result = ERR;
+
+    T((T_CALLED("resizeterm(%d,%d) old(%d,%d)"),
+       ToLines, ToCols,
+       screen_lines, screen_columns));
+
+    if (SP != 0) {
+	result = OK;
+	SP->_sig_winch = FALSE;
+
+	if (is_term_resized(ToLines, ToCols)) {
+#if USE_SIGWINCH
+	    ripoff_t *rop;
+	    bool slk_visible = (SP != 0
+				&& SP->_slk != 0
+				&& !(SP->_slk->hidden));
+
+	    if (slk_visible) {
+		slk_clear();
+	    }
+#endif
+	    result = resize_term(ToLines, ToCols);
+
+#if USE_SIGWINCH
+	    _nc_ungetch(SP, KEY_RESIZE);	/* so application can know this */
+	    clearok(curscr, TRUE);	/* screen contents are unknown */
+
+	    /* ripped-off lines are a special case: if we did not lengthen
+	     * them, we haven't moved them either.  repaint them, too.
+	     *
+	     * for the rest - stdscr and other windows - the client has to
+	     * decide which to repaint, since without panels, ncurses does
+	     * not know which are really on top.
+	     */
+	    for (each_ripoff(rop)) {
+		if (rop->win != stdscr
+		    && rop->win != 0
+		    && rop->line < 0) {
+
+		    if (rop->hook != _nc_slk_initialize) {
+			touchwin(rop->win);
+			wnoutrefresh(rop->win);
+		    }
+		}
+	    }
+
+	    /* soft-keys are a special case: we _know_ how to repaint them */
+	    if (slk_visible) {
+		slk_restore();
+		slk_touch();
+
+		slk_refresh();
+	    }
+#endif
+	}
+    }
+
+    returnCode(result);
+}
diff --git a/ncurses/base/safe_sprintf.c b/ncurses/base/safe_sprintf.c
new file mode 100644
index 0000000..8fc5d89
--- /dev/null
+++ b/ncurses/base/safe_sprintf.c
@@ -0,0 +1,264 @@
+/****************************************************************************
+ * Copyright (c) 1998-2003,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 <dickey@clark.net> 1997                        *
+ ****************************************************************************/
+
+#include <curses.priv.h>
+#include <ctype.h>
+
+MODULE_ID("$Id: safe_sprintf.c,v 1.20 2007/04/21 22:28:06 tom Exp $")
+
+#if USE_SAFE_SPRINTF
+
+typedef enum {
+    Flags, Width, Prec, Type, Format
+} PRINTF;
+
+#define VA_INTGR(type) ival = va_arg(ap, type)
+#define VA_FLOAT(type) fval = va_arg(ap, type)
+#define VA_POINT(type) pval = (void *)va_arg(ap, type)
+
+/*
+ * Scan a variable-argument list for printf to determine the number of
+ * characters that would be emitted.
+ */
+static int
+_nc_printf_length(const char *fmt, va_list ap)
+{
+    size_t length = BUFSIZ;
+    char *buffer;
+    char *format;
+    int len = 0;
+    size_t fmt_len;
+    char fmt_arg[BUFSIZ];
+
+    if (fmt == 0 || *fmt == '\0')
+	return 0;
+    fmt_len = strlen(fmt) + 1;
+    if ((format = typeMalloc(char, fmt_len)) == 0)
+	  return -1;
+    if ((buffer = typeMalloc(char, length)) == 0) {
+	free(format);
+	return -1;
+    }
+
+    while (*fmt != '\0') {
+	if (*fmt == '%') {
+	    static char dummy[] = "";
+	    PRINTF state = Flags;
+	    char *pval = dummy;	/* avoid const-cast */
+	    double fval = 0.0;
+	    int done = FALSE;
+	    int ival = 0;
+	    int prec = -1;
+	    int type = 0;
+	    int used = 0;
+	    int width = -1;
+	    size_t f = 0;
+
+	    format[f++] = *fmt;
+	    while (*++fmt != '\0' && len >= 0 && !done) {
+		format[f++] = *fmt;
+
+		if (isdigit(UChar(*fmt))) {
+		    int num = *fmt - '0';
+		    if (state == Flags && num != 0)
+			state = Width;
+		    if (state == Width) {
+			if (width < 0)
+			    width = 0;
+			width = (width * 10) + num;
+		    } else if (state == Prec) {
+			if (prec < 0)
+			    prec = 0;
+			prec = (prec * 10) + num;
+		    }
+		} else if (*fmt == '*') {
+		    VA_INTGR(int);
+		    if (state == Flags)
+			state = Width;
+		    if (state == Width) {
+			width = ival;
+		    } else if (state == Prec) {
+			prec = ival;
+		    }
+		    sprintf(fmt_arg, "%d", ival);
+		    fmt_len += strlen(fmt_arg);
+		    if ((format = realloc(format, fmt_len)) == 0) {
+			return -1;
+		    }
+		    strcpy(&format[--f], fmt_arg);
+		    f = strlen(format);
+		} else if (isalpha(UChar(*fmt))) {
+		    done = TRUE;
+		    switch (*fmt) {
+		    case 'Z':	/* FALLTHRU */
+		    case 'h':	/* FALLTHRU */
+		    case 'l':	/* FALLTHRU */
+			done = FALSE;
+			type = *fmt;
+			break;
+		    case 'i':	/* FALLTHRU */
+		    case 'd':	/* FALLTHRU */
+		    case 'u':	/* FALLTHRU */
+		    case 'x':	/* FALLTHRU */
+		    case 'X':	/* FALLTHRU */
+			if (type == 'l')
+			    VA_INTGR(long);
+			else if (type == 'Z')
+			    VA_INTGR(size_t);
+			else
+			    VA_INTGR(int);
+			used = 'i';
+			break;
+		    case 'f':	/* FALLTHRU */
+		    case 'e':	/* FALLTHRU */
+		    case 'E':	/* FALLTHRU */
+		    case 'g':	/* FALLTHRU */
+		    case 'G':	/* FALLTHRU */
+			VA_FLOAT(double);
+			used = 'f';
+			break;
+		    case 'c':
+			VA_INTGR(int);
+			used = 'i';
+			break;
+		    case 's':
+			VA_POINT(char *);
+			if (prec < 0)
+			    prec = strlen(pval);
+			if (prec > (int) length) {
+			    length = length + prec;
+			    buffer = typeRealloc(char, length, buffer);
+			    if (buffer == 0) {
+				free(format);
+				return -1;
+			    }
+			}
+			used = 'p';
+			break;
+		    case 'p':
+			VA_POINT(void *);
+			used = 'p';
+			break;
+		    case 'n':
+			VA_POINT(int *);
+			used = 0;
+			break;
+		    default:
+			break;
+		    }
+		} else if (*fmt == '.') {
+		    state = Prec;
+		} else if (*fmt == '%') {
+		    done = TRUE;
+		    used = 'p';
+		}
+	    }
+	    format[f] = '\0';
+	    switch (used) {
+	    case 'i':
+		sprintf(buffer, format, ival);
+		break;
+	    case 'f':
+		sprintf(buffer, format, fval);
+		break;
+	    default:
+		sprintf(buffer, format, pval);
+		break;
+	    }
+	    len += (int) strlen(buffer);
+	} else {
+	    fmt++;
+	    len++;
+	}
+    }
+
+    free(buffer);
+    free(format);
+    return len;
+}
+#endif
+
+#define my_buffer _nc_globals.safeprint_buf
+#define my_length _nc_globals.safeprint_used
+
+/*
+ * Wrapper for vsprintf that allocates a buffer big enough to hold the result.
+ */
+NCURSES_EXPORT(char *)
+_nc_printf_string(const char *fmt, va_list ap)
+{
+    char *result = 0;
+
+    if (fmt != 0) {
+#if USE_SAFE_SPRINTF
+	int len = _nc_printf_length(fmt, ap);
+
+	if ((int) my_length < len + 1) {
+	    my_length = 2 * (len + 1);
+	    my_buffer = typeRealloc(char, my_length, my_buffer);
+	}
+	if (my_buffer != 0) {
+	    *my_buffer = '\0';
+	    if (len >= 0) {
+		vsprintf(my_buffer, fmt, ap);
+	    }
+	    result = my_buffer;
+	}
+#else
+#define MyCols _nc_globals.safeprint_cols
+#define MyRows _nc_globals.safeprint_rows
+
+	if (screen_lines > MyRows || screen_columns > MyCols) {
+	    if (screen_lines > MyRows)
+		MyRows = screen_lines;
+	    if (screen_columns > MyCols)
+		MyCols = screen_columns;
+	    my_length = (MyRows * (MyCols + 1)) + 1;
+	    my_buffer = typeRealloc(char, my_length, my_buffer);
+	}
+
+	if (my_buffer != 0) {
+# if HAVE_VSNPRINTF
+	    vsnprintf(my_buffer, my_length, fmt, ap);	/* GNU extension */
+# else
+	    vsprintf(my_buffer, fmt, ap);	/* ANSI */
+# endif
+	    result = my_buffer;
+	}
+#endif
+    } else if (my_buffer != 0) {	/* see _nc_freeall() */
+	free(my_buffer);
+	my_buffer = 0;
+	my_length = 0;
+    }
+    return result;
+}
diff --git a/ncurses/base/sigaction.c b/ncurses/base/sigaction.c
new file mode 100644
index 0000000..36442e0
--- /dev/null
+++ b/ncurses/base/sigaction.c
@@ -0,0 +1,99 @@
+/****************************************************************************
+ * Copyright (c) 1998-2002,2003 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: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
+ *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Thomas E. Dickey                        1996-2003               *
+ ****************************************************************************/
+
+/* This file provides sigaction() emulation using sigvec() */
+/* Use only if this is non POSIX system */
+
+MODULE_ID("$Id: sigaction.c,v 1.14 2003/12/07 01:06:52 tom Exp $")
+
+static int
+_nc_sigaction(int sig, sigaction_t * sigact, sigaction_t * osigact)
+{
+    return sigvec(sig, sigact, osigact);
+}
+
+static int
+_nc_sigemptyset(sigset_t * mask)
+{
+    *mask = 0;
+    return 0;
+}
+
+static int
+_nc_sigprocmask(int mode, sigset_t * mask, sigset_t * omask)
+{
+    sigset_t current = sigsetmask(0);
+
+    if (omask)
+	*omask = current;
+
+    if (mode == SIG_BLOCK)
+	current |= *mask;
+    else if (mode == SIG_UNBLOCK)
+	current &= ~*mask;
+    else if (mode == SIG_SETMASK)
+	current = *mask;
+
+    sigsetmask(current);
+    return 0;
+}
+
+static int
+_nc_sigaddset(sigset_t * mask, int sig)
+{
+    *mask |= sigmask(sig);
+    return 0;
+}
+
+/* not used in lib_tstp.c */
+#if 0
+static int
+_nc_sigsuspend(sigset_t * mask)
+{
+    return sigpause(*mask);
+}
+
+static int
+_nc_sigdelset(sigset_t * mask, int sig)
+{
+    *mask &= ~sigmask(sig);
+    return 0;
+}
+
+static int
+_nc_sigismember(sigset_t * mask, int sig)
+{
+    return (*mask & sigmask(sig)) != 0;
+}
+#endif
diff --git a/ncurses/base/tries.c b/ncurses/base/tries.c
new file mode 100644
index 0000000..c4263c7
--- /dev/null
+++ b/ncurses/base/tries.c
@@ -0,0 +1,143 @@
+/****************************************************************************
+ * Copyright (c) 1998-2007,2008 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 <dickey@clark.net> 1997                        *
+ ****************************************************************************/
+
+/*
+**	tries.c
+**
+**	Functions to manage the tree of partial-completions for keycodes.
+**
+*/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: tries.c,v 1.27 2008/08/16 19:22:55 tom Exp $")
+
+/*
+ * Expand a keycode into the string that it corresponds to, returning null if
+ * no match was found, otherwise allocating a string of the result.
+ */
+NCURSES_EXPORT(char *)
+_nc_expand_try(TRIES * tree, unsigned code, int *count, size_t len)
+{
+    TRIES *ptr = tree;
+    char *result = 0;
+
+    if (code != 0) {
+	while (ptr != 0) {
+	    if ((result = _nc_expand_try(ptr->child, code, count, len + 1))
+		!= 0) {
+		break;
+	    }
+	    if (ptr->value == code) {
+		*count -= 1;
+		if (*count == -1) {
+		    result = typeCalloc(char, len + 2);
+		    break;
+		}
+	    }
+	    ptr = ptr->sibling;
+	}
+    }
+    if (result != 0) {
+	if (ptr != 0 && (result[len] = (char) ptr->ch) == 0)
+	    *((unsigned char *) (result + len)) = 128;
+#ifdef TRACE
+	if (len == 0 && USE_TRACEF(TRACE_MAXIMUM)) {
+	    _tracef("expand_key %s %s", _nc_tracechar(SP, code), _nc_visbuf(result));
+	    _nc_unlock_global(tracef);
+	}
+#endif
+    }
+    return result;
+}
+
+/*
+ * Remove a code from the specified tree, freeing the unused nodes.  Returns
+ * true if the code was found/removed.
+ */
+NCURSES_EXPORT(int)
+_nc_remove_key(TRIES ** tree, unsigned code)
+{
+    T((T_CALLED("_nc_remove_key(%p,%d)"), tree, code));
+
+    if (code == 0)
+	returnCode(FALSE);
+
+    while (*tree != 0) {
+	if (_nc_remove_key(&(*tree)->child, code)) {
+	    returnCode(TRUE);
+	}
+	if ((*tree)->value == code) {
+	    if ((*tree)->child) {
+		/* don't cut the whole sub-tree */
+		(*tree)->value = 0;
+	    } else {
+		TRIES *to_free = *tree;
+		*tree = (*tree)->sibling;
+		free(to_free);
+	    }
+	    returnCode(TRUE);
+	}
+	tree = &(*tree)->sibling;
+    }
+    returnCode(FALSE);
+}
+
+/*
+ * Remove a string from the specified tree, freeing the unused nodes.  Returns
+ * true if the string was found/removed.
+ */
+NCURSES_EXPORT(int)
+_nc_remove_string(TRIES ** tree, const char *string)
+{
+    T((T_CALLED("_nc_remove_string(%p,%s)"), tree, _nc_visbuf(string)));
+
+    if (string == 0 || *string == 0)
+	returnCode(FALSE);
+
+    while (*tree != 0) {
+	if (UChar((*tree)->ch) == UChar(*string)) {
+	    if (string[1] != 0)
+		returnCode(_nc_remove_string(&(*tree)->child, string + 1));
+	    if ((*tree)->child == 0) {
+		TRIES *to_free = *tree;
+		*tree = (*tree)->sibling;
+		free(to_free);
+		returnCode(TRUE);
+	    } else {
+		returnCode(FALSE);
+	    }
+	}
+	tree = &(*tree)->sibling;
+    }
+    returnCode(FALSE);
+}
diff --git a/ncurses/base/use_window.c b/ncurses/base/use_window.c
new file mode 100644
index 0000000..f6408c3
--- /dev/null
+++ b/ncurses/base/use_window.c
@@ -0,0 +1,48 @@
+/****************************************************************************
+ * Copyright (c) 2007,2008 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                        2007                 *
+ ****************************************************************************/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: use_window.c,v 1.8 2008/06/07 14:13:46 tom Exp $")
+
+NCURSES_EXPORT(int)
+use_window(WINDOW *win, NCURSES_WINDOW_CB func, void *data)
+{
+    int code = OK;
+
+    T((T_CALLED("use_window(%p,%p,%p)"), win, func, data));
+    _nc_lock_global(curses);
+    code = func(win, data);
+    _nc_unlock_global(curses);
+
+    returnCode(code);
+}
diff --git a/ncurses/base/version.c b/ncurses/base/version.c
new file mode 100644
index 0000000..ef83967
--- /dev/null
+++ b/ncurses/base/version.c
@@ -0,0 +1,42 @@
+/****************************************************************************
+ * Copyright (c) 1999-2004,2005 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 <dickey@clark.net> 1999                        *
+ ****************************************************************************/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: version.c,v 1.6 2005/01/02 01:23:54 tom Exp $")
+
+NCURSES_EXPORT(const char *)
+curses_version(void)
+{
+    T((T_CALLED("curses_version()")));
+    returnCPtr("ncurses " NCURSES_VERSION_STRING);
+}
diff --git a/ncurses/base/vsscanf.c b/ncurses/base/vsscanf.c
new file mode 100644
index 0000000..e6253c3
--- /dev/null
+++ b/ncurses/base/vsscanf.c
@@ -0,0 +1,356 @@
+/****************************************************************************
+ * Copyright (c) 1998-2003,2004 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.                                                           *
+ ****************************************************************************/
+
+/****************************************************************************
+ *  State-machine fallback written by Thomas E. Dickey 2002                 *
+ ****************************************************************************/
+
+/*
+ * This function is needed to support vwscanw
+ */
+
+#include <curses.priv.h>
+
+#if !HAVE_VSSCANF
+
+MODULE_ID("$Id: vsscanf.c,v 1.18 2004/04/03 20:27:02 tom Exp $")
+
+#if !(HAVE_VFSCANF || HAVE__DOSCAN)
+
+#include <ctype.h>
+
+#define L_SQUARE '['
+#define R_SQUARE ']'
+
+typedef enum {
+    cUnknown
+    ,cError			/* anything that isn't ANSI */
+    ,cAssigned
+    ,cChar
+    ,cInt
+    ,cFloat
+    ,cDouble
+    ,cPointer
+    ,cLong
+    ,cShort
+    ,cRange
+    ,cString
+} ChunkType;
+
+typedef enum {
+    oUnknown
+    ,oShort
+    ,oLong
+} OtherType;
+
+typedef enum {
+    sUnknown
+    ,sPercent			/* last was '%' beginning a format */
+    ,sNormal			/* ...somewhere in the middle */
+    ,sLeft			/* last was left square bracket beginning a range */
+    ,sRange			/* ...somewhere in the middle */
+    ,sFinal			/* last finished a format */
+} ScanState;
+
+static ChunkType
+final_ch(int ch, OtherType other)
+{
+    ChunkType result = cUnknown;
+
+    switch (ch) {
+    case 'c':
+	if (other == oUnknown)
+	    result = cChar;
+	else
+	    result = cError;
+	break;
+    case 'd':
+    case 'i':
+    case 'X':
+    case 'x':
+	switch (other) {
+	case oUnknown:
+	    result = cInt;
+	    break;
+	case oShort:
+	    result = cShort;
+	    break;
+	case oLong:
+	    result = cLong;
+	    break;
+	}
+	break;
+    case 'E':
+    case 'e':
+    case 'f':
+    case 'g':
+	switch (other) {
+	case oUnknown:
+	    result = cFloat;
+	    break;
+	case oShort:
+	    result = cError;
+	    break;
+	case oLong:
+	    result = cDouble;
+	    break;
+	}
+	break;
+    case 'n':
+	if (other == oUnknown)
+	    result = cAssigned;
+	else
+	    result = cError;
+	break;
+    case 'p':
+	if (other == oUnknown)
+	    result = cPointer;
+	else
+	    result = cError;
+	break;
+    case 's':
+	if (other == oUnknown)
+	    result = cString;
+	else
+	    result = cError;
+	break;
+    }
+    return result;
+}
+
+static OtherType
+other_ch(int ch)
+{
+    OtherType result = oUnknown;
+    switch (ch) {
+    case 'h':
+	result = oShort;
+	break;
+    case 'l':
+	result = oLong;
+	break;
+    }
+    return result;
+}
+#endif
+
+/*VARARGS2*/
+NCURSES_EXPORT(int)
+vsscanf(const char *str, const char *format, va_list ap)
+{
+#if HAVE_VFSCANF || HAVE__DOSCAN
+    /*
+     * This code should work on anything descended from AT&T SVr1.
+     */
+    FILE strbuf;
+
+    strbuf._flag = _IOREAD;
+    strbuf._ptr = strbuf._base = (unsigned char *) str;
+    strbuf._cnt = strlen(str);
+    strbuf._file = _NFILE;
+
+#if HAVE_VFSCANF
+    return (vfscanf(&strbuf, format, ap));
+#else
+    return (_doscan(&strbuf, format, ap));
+#endif
+#else
+    static int can_convert = -1;
+
+    int assigned = 0;
+    int consumed = 0;
+
+    T((T_CALLED("vsscanf(%s,%s,...)"),
+       _nc_visbuf2(1, str),
+       _nc_visbuf2(2, format)));
+
+    /*
+     * This relies on having a working "%n" format conversion.  Check if it
+     * works.  Only very old C libraries do not support it.
+     *
+     * FIXME: move this check into the configure script.
+     */
+    if (can_convert < 0) {
+	int check1;
+	int check2;
+	if (sscanf("123", "%d%n", &check1, &check2) > 0
+	    && check1 == 123
+	    && check2 == 3) {
+	    can_convert = 1;
+	} else {
+	    can_convert = 0;
+	}
+    }
+
+    if (can_convert) {
+	size_t len_fmt = strlen(format) + 32;
+	char *my_fmt = malloc(len_fmt);
+	ChunkType chunk, ctest;
+	OtherType other, otest;
+	ScanState state;
+	unsigned n;
+	int eaten;
+	void *pointer;
+
+	if (my_fmt != 0) {
+	    /*
+	     * Split the original format into chunks, adding a "%n" to the end
+	     * of each (except of course if it used %n), and use that
+	     * information to decide where to start scanning the next chunk.
+	     *
+	     * FIXME:  does %n count bytes or characters?  If the latter, this
+	     * will require further work for multibyte strings.
+	     */
+	    while (*format != '\0') {
+		/* find a chunk */
+		state = sUnknown;
+		chunk = cUnknown;
+		other = oUnknown;
+		pointer = 0;
+		for (n = 0; format[n] != 0 && state != sFinal; ++n) {
+		    my_fmt[n] = format[n];
+		    switch (state) {
+		    case sUnknown:
+			if (format[n] == '%')
+			    state = sPercent;
+			break;
+		    case sPercent:
+			if (format[n] == '%') {
+			    state = sUnknown;
+			} else if (format[n] == L_SQUARE) {
+			    state = sLeft;
+			} else {
+			    state = sNormal;
+			    --n;
+			}
+			break;
+		    case sLeft:
+			state = sRange;
+			if (format[n] == '^') {
+			    ++n;
+			    my_fmt[n] = format[n];
+			}
+			break;
+		    case sRange:
+			if (format[n] == R_SQUARE) {
+			    state = sFinal;
+			    chunk = cRange;
+			}
+			break;
+		    case sNormal:
+			if (format[n] == '*') {
+			    state = sUnknown;
+			} else {
+			    if ((ctest = final_ch(format[n], other)) != cUnknown) {
+				state = sFinal;
+				chunk = ctest;
+			    } else if ((otest = other_ch(format[n])) != oUnknown) {
+				other = otest;
+			    } else if (isalpha(UChar(format[n]))) {
+				state = sFinal;
+				chunk = cError;
+			    }
+			}
+			break;
+		    case sFinal:
+			break;
+		    }
+		}
+		my_fmt[n] = '\0';
+		format += n;
+
+		if (chunk == cUnknown
+		    || chunk == cError) {
+		    if (assigned == 0)
+			assigned = EOF;
+		    break;
+		}
+
+		/* add %n, if the format was not that */
+		if (chunk != cAssigned) {
+		    strcat(my_fmt, "%n");
+		}
+
+		switch (chunk) {
+		case cAssigned:
+		    strcat(my_fmt, "%n");
+		    pointer = &eaten;
+		    break;
+		case cInt:
+		    pointer = va_arg(ap, int *);
+		    break;
+		case cShort:
+		    pointer = va_arg(ap, short *);
+		    break;
+		case cFloat:
+		    pointer = va_arg(ap, float *);
+		    break;
+		case cDouble:
+		    pointer = va_arg(ap, double *);
+		    break;
+		case cLong:
+		    pointer = va_arg(ap, long *);
+		    break;
+		case cPointer:
+		    pointer = va_arg(ap, void *);
+		    break;
+		case cChar:
+		case cRange:
+		case cString:
+		    pointer = va_arg(ap, char *);
+		    break;
+		case cError:
+		case cUnknown:
+		    break;
+		}
+		/* do the conversion */
+		T(("...converting chunk #%d type %d(%s,%s)",
+		   assigned + 1, chunk,
+		   _nc_visbuf2(1, str + consumed),
+		   _nc_visbuf2(2, my_fmt)));
+		if (sscanf(str + consumed, my_fmt, pointer, &eaten) > 0)
+		    consumed += eaten;
+		else
+		    break;
+		++assigned;
+	    }
+	    free(my_fmt);
+	}
+    }
+    returnCode(assigned);
+#endif
+}
+#else
+extern
+NCURSES_EXPORT(void)
+_nc_vsscanf(void);		/* quiet's gcc warning */
+NCURSES_EXPORT(void)
+_nc_vsscanf(void)
+{
+}				/* nonempty for strict ANSI compilers */
+#endif /* !HAVE_VSSCANF */
diff --git a/ncurses/base/wresize.c b/ncurses/base/wresize.c
new file mode 100644
index 0000000..f46085a
--- /dev/null
+++ b/ncurses/base/wresize.c
@@ -0,0 +1,246 @@
+/****************************************************************************
+ * Copyright (c) 1998-2007,2008 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-2002                                      *
+ ****************************************************************************/
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: wresize.c,v 1.29 2008/06/07 13:59:01 tom Exp $")
+
+static int
+cleanup_lines(struct ldat *data, int length)
+{
+    while (--length >= 0)
+	free(data[length].text);
+    free(data);
+    return ERR;
+}
+
+/*
+ * If we have reallocated the ldat structs, we will have to repair pointers
+ * used in subwindows.
+ */
+static void
+repair_subwindows(WINDOW *cmp)
+{
+    WINDOWLIST *wp;
+    struct ldat *pline = cmp->_line;
+    int row;
+
+    _nc_lock_global(curses);
+
+    for (each_window(wp)) {
+	WINDOW *tst = &(wp->win);
+
+	if (tst->_parent == cmp) {
+
+	    if (tst->_pary > cmp->_maxy)
+		tst->_pary = cmp->_maxy;
+	    if (tst->_parx > cmp->_maxx)
+		tst->_parx = cmp->_maxx;
+
+	    if (tst->_maxy + tst->_pary > cmp->_maxy)
+		tst->_maxy = cmp->_maxy - tst->_pary;
+	    if (tst->_maxx + tst->_parx > cmp->_maxx)
+		tst->_maxx = cmp->_maxx - tst->_parx;
+
+	    for (row = 0; row <= tst->_maxy; ++row) {
+		tst->_line[row].text = &pline[tst->_pary + row].text[tst->_parx];
+	    }
+	    repair_subwindows(tst);
+	}
+    }
+    _nc_unlock_global(curses);
+}
+
+/*
+ * Reallocate a curses WINDOW struct to either shrink or grow to the specified
+ * new lines/columns.  If it grows, the new character cells are filled with
+ * blanks.  The application is responsible for repainting the blank area.
+ */
+NCURSES_EXPORT(int)
+wresize(WINDOW *win, int ToLines, int ToCols)
+{
+    int col, row, size_x, size_y;
+    struct ldat *pline;
+    struct ldat *new_lines = 0;
+
+#ifdef TRACE
+    T((T_CALLED("wresize(%p,%d,%d)"), win, ToLines, ToCols));
+    if (win) {
+	TR(TRACE_UPDATE, ("...beg (%ld, %ld), max(%ld,%ld), reg(%ld,%ld)",
+			  (long) win->_begy, (long) win->_begx,
+			  (long) win->_maxy, (long) win->_maxx,
+			  (long) win->_regtop, (long) win->_regbottom));
+	if (USE_TRACEF(TRACE_UPDATE)) {
+	    _tracedump("...before", win);
+	    _nc_unlock_global(tracef);
+	}
+    }
+#endif
+
+    if (!win || --ToLines < 0 || --ToCols < 0)
+	returnCode(ERR);
+
+    size_x = win->_maxx;
+    size_y = win->_maxy;
+
+    if (ToLines == size_y
+	&& ToCols == size_x)
+	returnCode(OK);
+
+    if ((win->_flags & _SUBWIN)) {
+	/*
+	 * Check if the new limits will fit into the parent window's size.  If
+	 * not, do not resize.  We could adjust the location of the subwindow,
+	 * but the application may not like that.
+	 */
+	if (win->_pary + ToLines > win->_parent->_maxy
+	    || win->_parx + ToCols > win->_parent->_maxx) {
+	    returnCode(ERR);
+	}
+	pline = win->_parent->_line;
+    } else {
+	pline = 0;
+    }
+
+    /*
+     * Allocate new memory as needed.  Do the allocations without modifying
+     * the original window, in case an allocation fails.  Always allocate
+     * (at least temporarily) the array pointing to the individual lines.
+     */
+    new_lines = typeCalloc(struct ldat, (unsigned) (ToLines + 1));
+    if (new_lines == 0)
+	returnCode(ERR);
+
+    /*
+     * For each line in the target, allocate or adjust pointers for the
+     * corresponding text, depending on whether this is a window or a
+     * subwindow.
+     */
+    for (row = 0; row <= ToLines; ++row) {
+	int begin = (row > size_y) ? 0 : (size_x + 1);
+	int end = ToCols;
+	NCURSES_CH_T *s;
+
+	if (!(win->_flags & _SUBWIN)) {
+	    if (row <= size_y) {
+		if (ToCols != size_x) {
+		    if ((s = typeMalloc(NCURSES_CH_T, ToCols + 1)) == 0)
+			returnCode(cleanup_lines(new_lines, row));
+		    for (col = 0; col <= ToCols; ++col) {
+			s[col] = (col <= size_x
+				  ? win->_line[row].text[col]
+				  : win->_nc_bkgd);
+		    }
+		} else {
+		    s = win->_line[row].text;
+		}
+	    } else {
+		if ((s = typeMalloc(NCURSES_CH_T, ToCols + 1)) == 0)
+		    returnCode(cleanup_lines(new_lines, row));
+		for (col = 0; col <= ToCols; ++col)
+		    s[col] = win->_nc_bkgd;
+	    }
+	} else {
+	    s = &pline[win->_pary + row].text[win->_parx];
+	}
+
+	if_USE_SCROLL_HINTS(new_lines[row].oldindex = row);
+	if (row <= size_y) {
+	    new_lines[row].firstchar = win->_line[row].firstchar;
+	    new_lines[row].lastchar = win->_line[row].lastchar;
+	}
+	if ((ToCols != size_x) || (row > size_y)) {
+	    if (end >= begin) {	/* growing */
+		if (new_lines[row].firstchar < begin)
+		    new_lines[row].firstchar = begin;
+	    } else {		/* shrinking */
+		new_lines[row].firstchar = 0;
+	    }
+	    new_lines[row].lastchar = ToCols;
+	}
+	new_lines[row].text = s;
+    }
+
+    /*
+     * Dispose of unwanted memory.
+     */
+    if (!(win->_flags & _SUBWIN)) {
+	if (ToCols == size_x) {
+	    for (row = ToLines + 1; row <= size_y; row++) {
+		free(win->_line[row].text);
+	    }
+	} else {
+	    for (row = 0; row <= size_y; row++) {
+		free(win->_line[row].text);
+	    }
+	}
+    }
+
+    free(win->_line);
+    win->_line = new_lines;
+
+    /*
+     * Finally, adjust the parameters showing screen size and cursor
+     * position:
+     */
+    win->_maxx = ToCols;
+    win->_maxy = ToLines;
+
+    if (win->_regtop > win->_maxy)
+	win->_regtop = win->_maxy;
+    if (win->_regbottom > win->_maxy
+	|| win->_regbottom == size_y)
+	win->_regbottom = win->_maxy;
+
+    if (win->_curx > win->_maxx)
+	win->_curx = win->_maxx;
+    if (win->_cury > win->_maxy)
+	win->_cury = win->_maxy;
+
+    /*
+     * Check for subwindows of this one, and readjust pointers to our text,
+     * if needed.
+     */
+    repair_subwindows(win);
+
+#ifdef TRACE
+    TR(TRACE_UPDATE, ("...beg (%ld, %ld), max(%ld,%ld), reg(%ld,%ld)",
+		      (long) win->_begy, (long) win->_begx,
+		      (long) win->_maxy, (long) win->_maxx,
+		      (long) win->_regtop, (long) win->_regbottom));
+    if (USE_TRACEF(TRACE_UPDATE)) {
+	_tracedump("...after:", win);
+	_nc_unlock_global(tracef);
+    }
+#endif
+    returnCode(OK);
+}
