libncurses: Import https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.5.tar.gz changes

Change-Id: I3433d30ca01359fd2e3623ede96b531f0b39cbfa
Signed-off-by: micky387 <mickaelsaibi@free.fr>
diff --git a/form/Makefile b/form/Makefile
deleted file mode 100644
index 9979745..0000000
--- a/form/Makefile
+++ /dev/null
@@ -1,853 +0,0 @@
-# $Id: Makefile.in,v 1.63 2015/08/05 23:15:41 tom Exp $
-##############################################################################
-# Copyright (c) 1998-2014,2015 Free Software Foundation, Inc.                #
-#                                                                            #
-# Permission is hereby granted, free of charge, to any person obtaining a    #
-# copy of this software and associated documentation files (the "Software"), #
-# to deal in the Software without restriction, including without limitation  #
-# the rights to use, copy, modify, merge, publish, distribute, distribute    #
-# with modifications, sublicense, and/or sell copies of the Software, and to #
-# permit persons to whom the Software is furnished to do so, subject to the  #
-# following conditions:                                                      #
-#                                                                            #
-# The above copyright notice and this permission notice shall be included in #
-# all copies or substantial portions of the Software.                        #
-#                                                                            #
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   #
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    #
-# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      #
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING    #
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER        #
-# DEALINGS IN THE SOFTWARE.                                                  #
-#                                                                            #
-# Except as contained in this notice, the name(s) of the above copyright     #
-# holders shall not be used in advertising or otherwise to promote the sale, #
-# use or other dealings in this Software without prior written               #
-# authorization.                                                             #
-##############################################################################
-#
-# Author: Thomas E. Dickey 1996-on
-#
-# Makefile for form source code.
-#
-# This makes the following:
-#	libraries (normal/debug/profile/shared)
-#
-# The variable 'srcdir' refers to the source-distribution, and can be set with
-# the configure script by "--srcdir=DIR".
-#
-# The rules are organized to produce the libraries for the configured models,
-
-# turn off _all_ suffix rules; we'll generate our own
-.SUFFIXES:
-
-SHELL		= /bin/sh
-
-THIS		= Makefile
-
-x		= 
-o		= .o
-
-MODEL		= normal
-DESTDIR		= 
-top_srcdir	= ..
-srcdir		= .
-prefix		= /system
-exec_prefix	= ${prefix}
-bindir		= ${exec_prefix}/bin
-libdir		= ${exec_prefix}/lib
-includedir	= ${prefix}/include
-includesubdir	= /ncurses
-
-INCLUDEDIR	= $(DESTDIR)$(includedir)$(includesubdir)
-
-PACKAGE		= ncurses
-
-LIBTOOL		= 
-LIBTOOL_OPTS	=  
-LIBTOOL_CLEAN	= 
-LIBTOOL_COMPILE	= 
-LIBTOOL_LINK	= ${CC}
-LIBTOOL_INSTALL	= 
-LIBTOOL_UNINSTALL = 
-LT_UNDEF	= 
-
-INSTALL		= /usr/bin/install -c
-INSTALL_LIB	= /usr/bin/install -c -m 644
-INSTALL_PROG	= ${INSTALL}
-INSTALL_DATA	= ${INSTALL} -m 644
-
-AR		= arm-linux-androideabi-ar
-ARFLAGS		= -curv
-AWK		= mawk
-LD		= arm-linux-androideabi-ld
-LN_S		= ln -s -f
-
-CTAGS		= 
-ETAGS		= 
-
-CC		= /home/shade/dev/cm/13/prebuilts/clang/linux-x86/host/3.6/bin/clang
-CPP		= /home/shade/dev/cm/13/prebuilts/clang/linux-x86/host/3.6/bin/clang -E
-CFLAGS		= -target arm-linux-androideabi -I/home/shade/dev/cm/13/bionic/libc/include -I/home/shade/dev/cm/13/bionic/libc/kernel/uapi -I/home/shade/dev/cm/13/bionic/libc/arch-arm/include -I/home/shade/dev/cm/13/bionic/libc/kernel/uapi/asm-arm --sysroot=/home/shade/dev/cm/13/prebuilts/ndk/current/platforms/android-21/arch-arm -L/home/shade/dev/cm/13/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/lib/gcc/arm-linux-androideabi/4.9.x-google/armv7-a -I/home/shade/dev/cm/13/bionic/libm/include -I/home/shade/dev/cm/13/bionic/libm/include/arm -I/home/shade/dev/cm/13/external/libselinux/include -I/home/shade/dev/cm/13/system/core/include -I/home/shade/dev/cm/13/bionic/libc/dns/include -I.  --param max-inline-insns-single=1200
-
-CPPFLAGS	= -I${top_srcdir}/ncurses -DHAVE_CONFIG_H -I. -I../include   -D_XOPEN_SOURCE=500 -D_FILE_OFFSET_BITS=64  -DNDEBUG
-
-CCFLAGS		= $(CPPFLAGS) $(CFLAGS)
-
-CFLAGS_LIBTOOL	= $(CCFLAGS)
-CFLAGS_NORMAL	= $(CCFLAGS)
-CFLAGS_DEBUG	= $(CCFLAGS) -g -DTRACE
-CFLAGS_PROFILE	= $(CCFLAGS) -pg
-CFLAGS_SHARED	= $(CCFLAGS) -fPIC
-
-CFLAGS_DEFAULT	= $(CFLAGS_NORMAL)
-
-LINK		= $(LIBTOOL_LINK)
-LDFLAGS		= -L/home/shade/dev/cm/13/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/lib/gcc/arm-linux-androideabi/4.9.x-google/armv7-a -L/home/shade/dev/cm/13/out/target/product/bacon/system/lib -lc -lselinux -lcutils  
-
-SHLIB_DIRS	= -L../lib
-SHLIB_LIST	= $(SHLIB_DIRS) -lncurses 
-
-RPATH_LIST	= ${libdir}
-RESULTING_SYMS	= 
-VERSIONED_SYMS	= 
-MK_SHARED_LIB	= ${CC} ${CFLAGS} -shared -Wl,-soname,`basename $@ .${REL_VERSION}`.${ABI_VERSION},-stats,-lc -o $@
-
-NCURSES_MAJOR	= 6
-NCURSES_MINOR	= 0
-REL_VERSION	= 6.0
-ABI_VERSION	= 6
-
-RANLIB		= arm-linux-androideabi-ranlib
-
-LIBRARIES	=  ../lib/libform.a ../lib/libform_g.a
-
-LINT		= lint
-LINT_OPTS	= 
-LINT_LIBS	= -lform -lncurses 
-
-AUTO_SRC	= \
-		../include/form.h
-
-################################################################################
-all \
-libs \
-install ::	$(AUTO_SRC) $(LIBRARIES)
-
-sources :	$(AUTO_SRC)
-
-$(DESTDIR)$(bindir) \
-$(DESTDIR)$(libdir) :
-	mkdir -p $@
-
-# make copies to simplify include-paths while still keeping form's include
-# file in this directory.
-../include/form.h : $(srcdir)/form.h
-	-rm -f $@
-	cp $(srcdir)/form.h $@
-
-HEADER_DEPS = \
-	$(srcdir)/form.priv.h \
-	$(srcdir)/form.h \
-	../include/mf_common.h \
-	../include/curses.h \
-	../include/eti.h
-
-tags:
-	$(CTAGS) *.[ch]
-
-#TAGS:
-#	$(ETAGS) *.[ch]
-
-mostlyclean ::
-	-rm -f core tags TAGS *~ *.bak *.i *.ln *.atac trace
-
-clean :: mostlyclean
-	-rm -f $(AUTO_SRC)
-
-distclean :: clean
-	-rm -f Makefile
-	-rm -rf .libs *.dSYM
-
-realclean :: distclean
-
-../include/mf_common.h \
-../include/eti.h :
-	cd ../menu && $(MAKE) $@
-
-###############################################################################
-# The remainder of this file is automatically generated during configuration
-###############################################################################
-
-# Generated by CF_LIB_RULES
-resulting.map: 
-	sed  -e "s/NCURSES\([WT]\+\)\?_/NCURSES\16_/g" -e "/deprecated in ABI6/d" <  >$@
-
-clean::
-	rm -f resulting.map
-
-# generated by mk-0th.awk
-#   libname:    form
-#   subsets:    ticlib+termlib+ext_tinfo+base+ext_funcs
-
-.SUFFIXES: .c .cc .h .i .ii
-.c.i :
-	$(CPP) $(CPPFLAGS) $< >$@
-.cc.ii :
-	$(CPP) $(CPPFLAGS) $< >$@
-.h.i :
-	$(CPP) $(CPPFLAGS) $< >$@
-
-C_SRC = \
-	$(srcdir)/f_trace.c \
-	$(srcdir)/fld_arg.c \
-	$(srcdir)/fld_attr.c \
-	$(srcdir)/fld_current.c \
-	$(srcdir)/fld_def.c \
-	$(srcdir)/fld_dup.c \
-	$(srcdir)/fld_ftchoice.c \
-	$(srcdir)/fld_ftlink.c \
-	$(srcdir)/fld_info.c \
-	$(srcdir)/fld_just.c \
-	$(srcdir)/fld_link.c \
-	$(srcdir)/fld_max.c \
-	$(srcdir)/fld_move.c \
-	$(srcdir)/fld_newftyp.c \
-	$(srcdir)/fld_opts.c \
-	$(srcdir)/fld_pad.c \
-	$(srcdir)/fld_page.c \
-	$(srcdir)/fld_stat.c \
-	$(srcdir)/fld_type.c \
-	$(srcdir)/fld_user.c \
-	$(srcdir)/frm_cursor.c \
-	$(srcdir)/frm_data.c \
-	$(srcdir)/frm_def.c \
-	$(srcdir)/frm_driver.c \
-	$(srcdir)/frm_hook.c \
-	$(srcdir)/frm_opts.c \
-	$(srcdir)/frm_page.c \
-	$(srcdir)/frm_post.c \
-	$(srcdir)/frm_req_name.c \
-	$(srcdir)/frm_scale.c \
-	$(srcdir)/frm_sub.c \
-	$(srcdir)/frm_user.c \
-	$(srcdir)/frm_win.c \
-	$(srcdir)/fty_alnum.c \
-	$(srcdir)/fty_alpha.c \
-	$(srcdir)/fty_enum.c \
-	$(srcdir)/fty_generic.c \
-	$(srcdir)/fty_int.c \
-	$(srcdir)/fty_ipv4.c \
-	$(srcdir)/fty_num.c \
-	$(srcdir)/fty_regex.c
-
-# Producing llib-lform is time-consuming, so there's no direct-dependency for
-# it in the lintlib rule.  We'll only remove in the cleanest setup.
-
-FORM_SRC = \
-	$(srcdir)/f_trace.c \
-	$(srcdir)/fld_arg.c \
-	$(srcdir)/fld_attr.c \
-	$(srcdir)/fld_current.c \
-	$(srcdir)/fld_def.c \
-	$(srcdir)/fld_dup.c \
-	$(srcdir)/fld_ftchoice.c \
-	$(srcdir)/fld_ftlink.c \
-	$(srcdir)/fld_info.c \
-	$(srcdir)/fld_just.c \
-	$(srcdir)/fld_link.c \
-	$(srcdir)/fld_max.c \
-	$(srcdir)/fld_move.c \
-	$(srcdir)/fld_newftyp.c \
-	$(srcdir)/fld_opts.c \
-	$(srcdir)/fld_pad.c \
-	$(srcdir)/fld_page.c \
-	$(srcdir)/fld_stat.c \
-	$(srcdir)/fld_type.c \
-	$(srcdir)/fld_user.c \
-	$(srcdir)/frm_cursor.c \
-	$(srcdir)/frm_data.c \
-	$(srcdir)/frm_def.c \
-	$(srcdir)/frm_driver.c \
-	$(srcdir)/frm_hook.c \
-	$(srcdir)/frm_opts.c \
-	$(srcdir)/frm_page.c \
-	$(srcdir)/frm_post.c \
-	$(srcdir)/frm_req_name.c \
-	$(srcdir)/frm_scale.c \
-	$(srcdir)/frm_sub.c \
-	$(srcdir)/frm_user.c \
-	$(srcdir)/frm_win.c \
-	$(srcdir)/fty_alnum.c \
-	$(srcdir)/fty_alpha.c \
-	$(srcdir)/fty_enum.c \
-	$(srcdir)/fty_generic.c \
-	$(srcdir)/fty_int.c \
-	$(srcdir)/fty_ipv4.c \
-	$(srcdir)/fty_num.c \
-	$(srcdir)/fty_regex.c
-
-clean ::
-	rm -f llib-lform.*
-
-realclean ::
-	rm -f llib-lform
-
-llib-lform : $(FORM_SRC)
-	cproto -a -l -DNCURSES_ENABLE_STDBOOL_H=0 -DLINT $(CPPFLAGS) $(FORM_SRC) >$@
-
-lintlib ::
-	sh $(srcdir)/../misc/makellib form $(CPPFLAGS)
-
-lint ::
-	$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(FORM_SRC) $(LINT_LIBS)
-
-# generated by mk-1st.awk (subset=ticlib+termlib+ext_tinfo+base+ext_funcs)
-#  name:          form
-#  traces:        DEBUG
-#  MODEL:         NORMAL
-#  CXX_MODEL:     NORMAL
-#  model:         objects
-#  prefix:        lib
-#  suffix:        .a
-#  subset:        ticlib+termlib+ext_tinfo+base+ext_funcs
-#  driver:        no
-#  ShlibVer:      rel
-#  ShlibVerInfix: no
-#  SymLink:       ln -s -f
-#  TermlibRoot:   ncurses
-#  TermlibSuffix: .a
-#  ReLink:        no
-#  DoLinks:       yes
-#  rmSoLocs:      no
-#  ldconfig:      :
-#  overwrite:     no
-#  depend:        ../include/ncurses_cfg.h ./form.priv.h
-#  host:          arm-unknown-linux-androideabi
-
-NORMAL_OBJS = \
-	../objects/fld_arg$o \
-	../objects/fld_attr$o \
-	../objects/fld_current$o \
-	../objects/fld_def$o \
-	../objects/fld_dup$o \
-	../objects/fld_ftchoice$o \
-	../objects/fld_ftlink$o \
-	../objects/fld_info$o \
-	../objects/fld_just$o \
-	../objects/fld_link$o \
-	../objects/fld_max$o \
-	../objects/fld_move$o \
-	../objects/fld_newftyp$o \
-	../objects/fld_opts$o \
-	../objects/fld_pad$o \
-	../objects/fld_page$o \
-	../objects/fld_stat$o \
-	../objects/fld_type$o \
-	../objects/fld_user$o \
-	../objects/frm_cursor$o \
-	../objects/frm_data$o \
-	../objects/frm_def$o \
-	../objects/frm_driver$o \
-	../objects/frm_hook$o \
-	../objects/frm_opts$o \
-	../objects/frm_page$o \
-	../objects/frm_post$o \
-	../objects/frm_req_name$o \
-	../objects/frm_scale$o \
-	../objects/frm_sub$o \
-	../objects/frm_user$o \
-	../objects/frm_win$o \
-	../objects/fty_alnum$o \
-	../objects/fty_alpha$o \
-	../objects/fty_enum$o \
-	../objects/fty_generic$o \
-	../objects/fty_int$o \
-	../objects/fty_ipv4$o \
-	../objects/fty_num$o \
-	../objects/fty_regex$o
-
-$(NORMAL_OBJS) : ../include/ncurses_cfg.h ./form.priv.h
-
-../lib/libform.a : $(NORMAL_OBJS)
-	$(AR) $(ARFLAGS) $@ $?
-	$(RANLIB) $@
-
-install \
-install.libs \
-install.form :: $(DESTDIR)$(libdir) ../lib/libform.a
-	@echo installing ../lib/libform.a as $(DESTDIR)$(libdir)/libform.a
-	$(INSTALL_DATA) ../lib/libform.a $(DESTDIR)$(libdir)/libform.a
-	$(RANLIB) $(DESTDIR)$(libdir)/libform.a
-
-uninstall \
-uninstall.libs \
-uninstall.form ::
-	@echo uninstalling $(DESTDIR)$(libdir)/libform.a
-	-@rm -f $(DESTDIR)$(libdir)/libform.a
-
-clean ::
-	-rm -f ../lib/libform.a
-
-mostlyclean::
-	-rm -f $(NORMAL_OBJS)
-
-# generated by mk-2nd.awk
-#   model:      objects
-#   MODEL:      NORMAL
-#   echo:       yes
-#   subset:     ticlib+termlib+ext_tinfo+base+ext_funcs
-#   crenames:   yes
-#   cxxrenames: 
-#   traces:     DEBUG
-#   srcdir:     .
-
-../objects/fld_arg$o :	$(srcdir)/fld_arg.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_arg.c -o ../objects/fld_arg$o
-
-../objects/fld_attr$o :	$(srcdir)/fld_attr.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_attr.c -o ../objects/fld_attr$o
-
-../objects/fld_current$o :	$(srcdir)/fld_current.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_current.c -o ../objects/fld_current$o
-
-../objects/fld_def$o :	$(srcdir)/fld_def.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_def.c -o ../objects/fld_def$o
-
-../objects/fld_dup$o :	$(srcdir)/fld_dup.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_dup.c -o ../objects/fld_dup$o
-
-../objects/fld_ftchoice$o :	$(srcdir)/fld_ftchoice.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_ftchoice.c -o ../objects/fld_ftchoice$o
-
-../objects/fld_ftlink$o :	$(srcdir)/fld_ftlink.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_ftlink.c -o ../objects/fld_ftlink$o
-
-../objects/fld_info$o :	$(srcdir)/fld_info.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_info.c -o ../objects/fld_info$o
-
-../objects/fld_just$o :	$(srcdir)/fld_just.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_just.c -o ../objects/fld_just$o
-
-../objects/fld_link$o :	$(srcdir)/fld_link.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_link.c -o ../objects/fld_link$o
-
-../objects/fld_max$o :	$(srcdir)/fld_max.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_max.c -o ../objects/fld_max$o
-
-../objects/fld_move$o :	$(srcdir)/fld_move.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_move.c -o ../objects/fld_move$o
-
-../objects/fld_newftyp$o :	$(srcdir)/fld_newftyp.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_newftyp.c -o ../objects/fld_newftyp$o
-
-../objects/fld_opts$o :	$(srcdir)/fld_opts.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_opts.c -o ../objects/fld_opts$o
-
-../objects/fld_pad$o :	$(srcdir)/fld_pad.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_pad.c -o ../objects/fld_pad$o
-
-../objects/fld_page$o :	$(srcdir)/fld_page.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_page.c -o ../objects/fld_page$o
-
-../objects/fld_stat$o :	$(srcdir)/fld_stat.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_stat.c -o ../objects/fld_stat$o
-
-../objects/fld_type$o :	$(srcdir)/fld_type.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_type.c -o ../objects/fld_type$o
-
-../objects/fld_user$o :	$(srcdir)/fld_user.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fld_user.c -o ../objects/fld_user$o
-
-../objects/frm_cursor$o :	$(srcdir)/frm_cursor.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/frm_cursor.c -o ../objects/frm_cursor$o
-
-../objects/frm_data$o :	$(srcdir)/frm_data.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/frm_data.c -o ../objects/frm_data$o
-
-../objects/frm_def$o :	$(srcdir)/frm_def.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/frm_def.c -o ../objects/frm_def$o
-
-../objects/frm_driver$o :	$(srcdir)/frm_driver.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/frm_driver.c -o ../objects/frm_driver$o
-
-../objects/frm_hook$o :	$(srcdir)/frm_hook.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/frm_hook.c -o ../objects/frm_hook$o
-
-../objects/frm_opts$o :	$(srcdir)/frm_opts.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/frm_opts.c -o ../objects/frm_opts$o
-
-../objects/frm_page$o :	$(srcdir)/frm_page.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/frm_page.c -o ../objects/frm_page$o
-
-../objects/frm_post$o :	$(srcdir)/frm_post.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/frm_post.c -o ../objects/frm_post$o
-
-../objects/frm_req_name$o :	$(srcdir)/frm_req_name.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/frm_req_name.c -o ../objects/frm_req_name$o
-
-../objects/frm_scale$o :	$(srcdir)/frm_scale.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/frm_scale.c -o ../objects/frm_scale$o
-
-../objects/frm_sub$o :	$(srcdir)/frm_sub.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/frm_sub.c -o ../objects/frm_sub$o
-
-../objects/frm_user$o :	$(srcdir)/frm_user.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/frm_user.c -o ../objects/frm_user$o
-
-../objects/frm_win$o :	$(srcdir)/frm_win.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/frm_win.c -o ../objects/frm_win$o
-
-../objects/fty_alnum$o :	$(srcdir)/fty_alnum.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fty_alnum.c -o ../objects/fty_alnum$o
-
-../objects/fty_alpha$o :	$(srcdir)/fty_alpha.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fty_alpha.c -o ../objects/fty_alpha$o
-
-../objects/fty_enum$o :	$(srcdir)/fty_enum.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fty_enum.c -o ../objects/fty_enum$o
-
-../objects/fty_generic$o :	$(srcdir)/fty_generic.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fty_generic.c -o ../objects/fty_generic$o
-
-../objects/fty_int$o :	$(srcdir)/fty_int.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fty_int.c -o ../objects/fty_int$o
-
-../objects/fty_ipv4$o :	$(srcdir)/fty_ipv4.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fty_ipv4.c -o ../objects/fty_ipv4$o
-
-../objects/fty_num$o :	$(srcdir)/fty_num.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fty_num.c -o ../objects/fty_num$o
-
-../objects/fty_regex$o :	$(srcdir)/fty_regex.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_NORMAL) -c ../form/fty_regex.c -o ../objects/fty_regex$o
-
-
-# generated by mk-1st.awk (subset=ticlib+termlib+ext_tinfo+base+ext_funcs)
-#  name:          form
-#  traces:        DEBUG
-#  MODEL:         DEBUG
-#  CXX_MODEL:     DEBUG
-#  model:         obj_g
-#  prefix:        lib
-#  suffix:        _g.a
-#  subset:        ticlib+termlib+ext_tinfo+base+ext_funcs
-#  driver:        no
-#  ShlibVer:      rel
-#  ShlibVerInfix: no
-#  SymLink:       ln -s -f
-#  TermlibRoot:   ncurses
-#  TermlibSuffix: .a
-#  ReLink:        no
-#  DoLinks:       yes
-#  rmSoLocs:      no
-#  ldconfig:      :
-#  overwrite:     no
-#  depend:        ../include/ncurses_cfg.h ./form.priv.h
-#  host:          arm-unknown-linux-androideabi
-
-DEBUG_OBJS = \
-	../obj_g/f_trace$o \
-	../obj_g/fld_arg$o \
-	../obj_g/fld_attr$o \
-	../obj_g/fld_current$o \
-	../obj_g/fld_def$o \
-	../obj_g/fld_dup$o \
-	../obj_g/fld_ftchoice$o \
-	../obj_g/fld_ftlink$o \
-	../obj_g/fld_info$o \
-	../obj_g/fld_just$o \
-	../obj_g/fld_link$o \
-	../obj_g/fld_max$o \
-	../obj_g/fld_move$o \
-	../obj_g/fld_newftyp$o \
-	../obj_g/fld_opts$o \
-	../obj_g/fld_pad$o \
-	../obj_g/fld_page$o \
-	../obj_g/fld_stat$o \
-	../obj_g/fld_type$o \
-	../obj_g/fld_user$o \
-	../obj_g/frm_cursor$o \
-	../obj_g/frm_data$o \
-	../obj_g/frm_def$o \
-	../obj_g/frm_driver$o \
-	../obj_g/frm_hook$o \
-	../obj_g/frm_opts$o \
-	../obj_g/frm_page$o \
-	../obj_g/frm_post$o \
-	../obj_g/frm_req_name$o \
-	../obj_g/frm_scale$o \
-	../obj_g/frm_sub$o \
-	../obj_g/frm_user$o \
-	../obj_g/frm_win$o \
-	../obj_g/fty_alnum$o \
-	../obj_g/fty_alpha$o \
-	../obj_g/fty_enum$o \
-	../obj_g/fty_generic$o \
-	../obj_g/fty_int$o \
-	../obj_g/fty_ipv4$o \
-	../obj_g/fty_num$o \
-	../obj_g/fty_regex$o
-
-$(DEBUG_OBJS) : ../include/ncurses_cfg.h ./form.priv.h
-
-../lib/libform_g.a : $(DEBUG_OBJS)
-	$(AR) $(ARFLAGS) $@ $?
-	$(RANLIB) $@
-
-install \
-install.libs \
-install.form :: $(DESTDIR)$(libdir) ../lib/libform_g.a
-	@echo installing ../lib/libform_g.a as $(DESTDIR)$(libdir)/libform_g.a
-	$(INSTALL_DATA) ../lib/libform_g.a $(DESTDIR)$(libdir)/libform_g.a
-	$(RANLIB) $(DESTDIR)$(libdir)/libform_g.a
-
-uninstall \
-uninstall.libs \
-uninstall.form ::
-	@echo uninstalling $(DESTDIR)$(libdir)/libform_g.a
-	-@rm -f $(DESTDIR)$(libdir)/libform_g.a
-
-clean ::
-	-rm -f ../lib/libform_g.a
-
-mostlyclean::
-	-rm -f $(DEBUG_OBJS)
-
-# generated by mk-2nd.awk
-#   model:      obj_g
-#   MODEL:      DEBUG
-#   echo:       yes
-#   subset:     ticlib+termlib+ext_tinfo+base+ext_funcs
-#   crenames:   yes
-#   cxxrenames: 
-#   traces:     DEBUG
-#   srcdir:     .
-
-../obj_g/f_trace$o :	$(srcdir)/f_trace.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/f_trace.c -o ../obj_g/f_trace$o
-
-../obj_g/fld_arg$o :	$(srcdir)/fld_arg.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_arg.c -o ../obj_g/fld_arg$o
-
-../obj_g/fld_attr$o :	$(srcdir)/fld_attr.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_attr.c -o ../obj_g/fld_attr$o
-
-../obj_g/fld_current$o :	$(srcdir)/fld_current.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_current.c -o ../obj_g/fld_current$o
-
-../obj_g/fld_def$o :	$(srcdir)/fld_def.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_def.c -o ../obj_g/fld_def$o
-
-../obj_g/fld_dup$o :	$(srcdir)/fld_dup.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_dup.c -o ../obj_g/fld_dup$o
-
-../obj_g/fld_ftchoice$o :	$(srcdir)/fld_ftchoice.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_ftchoice.c -o ../obj_g/fld_ftchoice$o
-
-../obj_g/fld_ftlink$o :	$(srcdir)/fld_ftlink.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_ftlink.c -o ../obj_g/fld_ftlink$o
-
-../obj_g/fld_info$o :	$(srcdir)/fld_info.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_info.c -o ../obj_g/fld_info$o
-
-../obj_g/fld_just$o :	$(srcdir)/fld_just.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_just.c -o ../obj_g/fld_just$o
-
-../obj_g/fld_link$o :	$(srcdir)/fld_link.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_link.c -o ../obj_g/fld_link$o
-
-../obj_g/fld_max$o :	$(srcdir)/fld_max.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_max.c -o ../obj_g/fld_max$o
-
-../obj_g/fld_move$o :	$(srcdir)/fld_move.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_move.c -o ../obj_g/fld_move$o
-
-../obj_g/fld_newftyp$o :	$(srcdir)/fld_newftyp.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_newftyp.c -o ../obj_g/fld_newftyp$o
-
-../obj_g/fld_opts$o :	$(srcdir)/fld_opts.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_opts.c -o ../obj_g/fld_opts$o
-
-../obj_g/fld_pad$o :	$(srcdir)/fld_pad.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_pad.c -o ../obj_g/fld_pad$o
-
-../obj_g/fld_page$o :	$(srcdir)/fld_page.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_page.c -o ../obj_g/fld_page$o
-
-../obj_g/fld_stat$o :	$(srcdir)/fld_stat.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_stat.c -o ../obj_g/fld_stat$o
-
-../obj_g/fld_type$o :	$(srcdir)/fld_type.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_type.c -o ../obj_g/fld_type$o
-
-../obj_g/fld_user$o :	$(srcdir)/fld_user.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fld_user.c -o ../obj_g/fld_user$o
-
-../obj_g/frm_cursor$o :	$(srcdir)/frm_cursor.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/frm_cursor.c -o ../obj_g/frm_cursor$o
-
-../obj_g/frm_data$o :	$(srcdir)/frm_data.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/frm_data.c -o ../obj_g/frm_data$o
-
-../obj_g/frm_def$o :	$(srcdir)/frm_def.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/frm_def.c -o ../obj_g/frm_def$o
-
-../obj_g/frm_driver$o :	$(srcdir)/frm_driver.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/frm_driver.c -o ../obj_g/frm_driver$o
-
-../obj_g/frm_hook$o :	$(srcdir)/frm_hook.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/frm_hook.c -o ../obj_g/frm_hook$o
-
-../obj_g/frm_opts$o :	$(srcdir)/frm_opts.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/frm_opts.c -o ../obj_g/frm_opts$o
-
-../obj_g/frm_page$o :	$(srcdir)/frm_page.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/frm_page.c -o ../obj_g/frm_page$o
-
-../obj_g/frm_post$o :	$(srcdir)/frm_post.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/frm_post.c -o ../obj_g/frm_post$o
-
-../obj_g/frm_req_name$o :	$(srcdir)/frm_req_name.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/frm_req_name.c -o ../obj_g/frm_req_name$o
-
-../obj_g/frm_scale$o :	$(srcdir)/frm_scale.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/frm_scale.c -o ../obj_g/frm_scale$o
-
-../obj_g/frm_sub$o :	$(srcdir)/frm_sub.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/frm_sub.c -o ../obj_g/frm_sub$o
-
-../obj_g/frm_user$o :	$(srcdir)/frm_user.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/frm_user.c -o ../obj_g/frm_user$o
-
-../obj_g/frm_win$o :	$(srcdir)/frm_win.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/frm_win.c -o ../obj_g/frm_win$o
-
-../obj_g/fty_alnum$o :	$(srcdir)/fty_alnum.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fty_alnum.c -o ../obj_g/fty_alnum$o
-
-../obj_g/fty_alpha$o :	$(srcdir)/fty_alpha.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fty_alpha.c -o ../obj_g/fty_alpha$o
-
-../obj_g/fty_enum$o :	$(srcdir)/fty_enum.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fty_enum.c -o ../obj_g/fty_enum$o
-
-../obj_g/fty_generic$o :	$(srcdir)/fty_generic.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fty_generic.c -o ../obj_g/fty_generic$o
-
-../obj_g/fty_int$o :	$(srcdir)/fty_int.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fty_int.c -o ../obj_g/fty_int$o
-
-../obj_g/fty_ipv4$o :	$(srcdir)/fty_ipv4.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fty_ipv4.c -o ../obj_g/fty_ipv4$o
-
-../obj_g/fty_num$o :	$(srcdir)/fty_num.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fty_num.c -o ../obj_g/fty_num$o
-
-../obj_g/fty_regex$o :	$(srcdir)/fty_regex.c \
-			$(HEADER_DEPS)
-	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS_DEBUG) -c ../form/fty_regex.c -o ../obj_g/fty_regex$o
-
-
-# generated by mk-hdr.awk
-#  subset:     ticlib+termlib+ext_tinfo+base+ext_funcs
-#  compat:     yes
-
-${INCLUDEDIR} :
-	mkdir -p $@
-
-install \
-install.libs \
-install.includes :: ${AUTO_SRC} ${INCLUDEDIR} \
-		$(srcdir)/form.h
-	@ (cd ${INCLUDEDIR} && rm -f form.h) ; ../headers.sh ${INSTALL_DATA} ${INCLUDEDIR} ${srcdir} $(srcdir)/form.h
-
-uninstall \
-uninstall.libs \
-uninstall.includes ::
-	-@ (cd ${INCLUDEDIR} && rm -f form.h)
-depend : ${AUTO_SRC}
-	makedepend -- ${CPPFLAGS} -- ${C_SRC}
-
-# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/form/Makefile.in b/form/Makefile.in
index 29b4929..a950a3e 100644
--- a/form/Makefile.in
+++ b/form/Makefile.in
@@ -1,6 +1,7 @@
-# $Id: Makefile.in,v 1.63 2015/08/05 23:15:41 tom Exp $
+# $Id: Makefile.in,v 1.72 2021/07/03 15:45:33 tom Exp $
 ##############################################################################
-# Copyright (c) 1998-2014,2015 Free Software Foundation, Inc.                #
+# Copyright 2020,2021 Thomas E. Dickey                                       #
+# Copyright 1998-2015,2018 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"), #
@@ -75,7 +76,7 @@
 
 INSTALL		= @INSTALL@
 INSTALL_LIB	= @INSTALL@ @INSTALL_LIB@
-INSTALL_PROG	= @INSTALL_PROGRAM@
+INSTALL_PROG	= @INSTALL_PROGRAM@ @INSTALL_OPT_S@
 INSTALL_DATA	= @INSTALL_DATA@
 
 AR		= @AR@
@@ -89,16 +90,18 @@
 
 CC		= @CC@
 CPP		= @CPP@
-CFLAGS		= @CFLAGS@
+CFLAGS		= @CFLAGS@ @EXTRA_CFLAGS@
 
-CPPFLAGS	= -I${top_srcdir}/ncurses -DHAVE_CONFIG_H @CPPFLAGS@
+INCDIR		= $(top_srcdir)/include
+BASE_DIR 	= $(top_srcdir)/ncurses
+CPPFLAGS	= -I$(BASE_DIR) -DHAVE_CONFIG_H -DBUILDING_FORM @CPPFLAGS@
 
 CCFLAGS		= $(CPPFLAGS) $(CFLAGS)
 
 CFLAGS_LIBTOOL	= $(CCFLAGS)
-CFLAGS_NORMAL	= $(CCFLAGS)
-CFLAGS_DEBUG	= $(CCFLAGS) @CC_G_OPT@ -DTRACE
-CFLAGS_PROFILE	= $(CCFLAGS) -pg
+CFLAGS_NORMAL	= $(CCFLAGS) -DNCURSES_STATIC
+CFLAGS_DEBUG	= $(CCFLAGS) -DNCURSES_STATIC @CC_G_OPT@ -DTRACE
+CFLAGS_PROFILE	= $(CCFLAGS) -DNCURSES_STATIC -pg
 CFLAGS_SHARED	= $(CCFLAGS) @CC_SHARED_OPTS@
 
 CFLAGS_DEFAULT	= $(CFLAGS_@DFT_UPR_MODEL@)
@@ -131,6 +134,19 @@
 		../include/form.h
 
 ################################################################################
+
+@MAKE_PHONY@.PHONY :	all
+@MAKE_PHONY@.PHONY :	clean
+@MAKE_PHONY@.PHONY :	distclean
+@MAKE_PHONY@.PHONY :	install
+@MAKE_PHONY@.PHONY :	install.libs
+@MAKE_PHONY@.PHONY :	libs
+@MAKE_PHONY@.PHONY :	mostlyclean
+@MAKE_PHONY@.PHONY :	realclean
+@MAKE_PHONY@.PHONY :	sources
+@MAKE_PHONY@.PHONY :	uninstall
+@MAKE_PHONY@.PHONY :	uninstall.libs
+
 all \
 libs \
 install ::	$(AUTO_SRC) $(LIBRARIES)
@@ -148,11 +164,24 @@
 	cp $(srcdir)/form.h $@
 
 HEADER_DEPS = \
-	$(srcdir)/form.priv.h \
-	$(srcdir)/form.h \
-	../include/mf_common.h \
 	../include/curses.h \
-	../include/eti.h
+	../include/eti.h \
+	../include/mf_common.h \
+	../include/ncurses_cfg.h \
+	../include/ncurses_def.h \
+	../include/ncurses_dll.h \
+	../include/term.h \
+	../include/unctrl.h \
+	$(BASE_DIR)/curses.priv.h \
+	$(BASE_DIR)/new_pair.h \
+	$(INCDIR)/nc_alloc.h \
+	$(INCDIR)/nc_panel.h \
+	$(INCDIR)/nc_string.h \
+	$(INCDIR)/nc_termios.h \
+	$(INCDIR)/nc_tparm.h \
+	$(INCDIR)/term_entry.h \
+	$(srcdir)/form.h \
+	$(srcdir)/form.priv.h
 
 tags:
 	$(CTAGS) *.[ch]
@@ -174,7 +203,7 @@
 
 ../include/mf_common.h \
 ../include/eti.h :
-	cd ../menu && $(MAKE) $@
+	( cd ../menu && $(MAKE) $@ )
 
 ###############################################################################
 # The remainder of this file is automatically generated during configuration
diff --git a/form/READ.ME b/form/READ.ME
index da86bf6..7c6ad97 100644
--- a/form/READ.ME
+++ b/form/READ.ME
@@ -1,5 +1,6 @@
 -------------------------------------------------------------------------------
--- Copyright (c) 1998-2003,2006 Free Software Foundation, Inc.               --
+-- Copyright 2020,2021 Thomas E. Dickey                                      --
+-- Copyright 1998-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             --
@@ -25,18 +26,18 @@
 -- sale, use or other dealings in this Software without prior written        --
 -- authorization.                                                            --
 -------------------------------------------------------------------------------
--- $Id: READ.ME,v 0.7 2006/04/22 23:13:05 tom Exp $
+-- $Id: READ.ME,v 0.9 2021/06/17 21:20:30 tom Exp $
 -------------------------------------------------------------------------------
 
 This is a clone of the form library that is available with typical
 System V curses implementations (ETI).
 
 It is modelled after the documentation that comes for this library with
-a 386 based SVR4 implementation (ESIX).  
+a 386 based SVR4 implementation (ESIX).
 
 The development environment was and is an ELF based Linux system.
 
-For things that still need doing, see the TO-DO file in the top-level 
+For things that still need doing, see the TO-DO file in the top-level
 directory.
 
 Juergen Pfeifer
diff --git a/form/f_trace.c b/form/f_trace.c
index 6044e03..c8df81a 100644
--- a/form/f_trace.c
+++ b/form/f_trace.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 2004,2010 Free Software Foundation, Inc.                   *
+ * Copyright 2018,2020 Thomas E. Dickey                                     *
+ * Copyright 2004-2010,2016 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,39 +33,40 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: f_trace.c,v 1.2 2010/01/23 21:14:36 tom Exp $")
+MODULE_ID("$Id: f_trace.c,v 1.6 2020/05/24 01:40:20 anonymous.maarten Exp $")
 
-NCURSES_EXPORT(FIELD **)
+FORM_EXPORT(FIELD **)
 _nc_retrace_field_ptr(FIELD **code)
 {
   T((T_RETURN("%p"), (void *)code));
   return code;
 }
 
-NCURSES_EXPORT(FIELD *)
+FORM_EXPORT(FIELD *)
 _nc_retrace_field(FIELD *code)
 {
   T((T_RETURN("%p"), (void *)code));
   return code;
 }
 
-NCURSES_EXPORT(FIELDTYPE *)
+FORM_EXPORT(FIELDTYPE *)
 _nc_retrace_field_type(FIELDTYPE *code)
 {
   T((T_RETURN("%p"), (void *)code));
   return code;
 }
 
-NCURSES_EXPORT(FORM *)
+FORM_EXPORT(FORM *)
 _nc_retrace_form(FORM *code)
 {
   T((T_RETURN("%p"), (void *)code));
   return code;
 }
 
-NCURSES_EXPORT(Form_Hook)
+FORM_EXPORT(Form_Hook)
 _nc_retrace_form_hook(Form_Hook code)
 {
-  T((T_RETURN("%p"), code));
+  TR_FUNC_BFR(1);
+  T((T_RETURN("%s"), TR_FUNC_ARG(0, code)));
   return code;
 }
diff --git a/form/fld_arg.c b/form/fld_arg.c
index 001c1d1..2f6c477 100644
--- a/form/fld_arg.c
+++ b/form/fld_arg.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
+ * Copyright 2018,2020 Thomas E. Dickey                                     *
+ * Copyright 1998-2012,2016 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +33,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_arg.c,v 1.13 2012/06/10 00:27:49 tom Exp $")
+MODULE_ID("$Id: fld_arg.c,v 1.18 2020/12/11 22:05:24 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform
@@ -60,14 +61,19 @@
 |   Return Values :  E_OK           - success
 |                    E_BAD_ARGUMENT - invalid argument
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_fieldtype_arg(FIELDTYPE *typ,
 		  void *(*const make_arg)(va_list *),
 		  void *(*const copy_arg)(const void *),
 		  void (*const free_arg) (void *))
 {
-  T((T_CALLED("set_fieldtype_arg(%p,%p,%p,%p)"),
-     (void *)typ, make_arg, copy_arg, free_arg));
+  TR_FUNC_BFR(3);
+
+  T((T_CALLED("set_fieldtype_arg(%p,%s,%s,%s)"),
+     (void *)typ,
+     TR_FUNC_ARG(0, make_arg),
+     TR_FUNC_ARG(1, copy_arg),
+     TR_FUNC_ARG(2, free_arg)));
 
   if (typ != 0 && make_arg != (void *)0)
     {
@@ -84,11 +90,11 @@
 |   Facility      :  libnform
 |   Function      :  void *field_arg(const FIELD *field)
 |
-|   Description   :  Retrieve pointer to the fields argument structure.
+|   Description   :  Retrieve pointer to the field's argument structure.
 |
 |   Return Values :  Pointer to structure or NULL if none is defined.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void *)
+FORM_EXPORT(void *)
 field_arg(const FIELD *field)
 {
   T((T_CALLED("field_arg(%p)"), (const void *)field));
diff --git a/form/fld_attr.c b/form/fld_attr.c
index 0112f00..4ce6b1c 100644
--- a/form/fld_attr.c
+++ b/form/fld_attr.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc.              *
+ * Copyright 2020 Thomas E. Dickey                                          *
+ * Copyright 1998-2010,2016 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,17 +33,17 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_attr.c,v 1.11 2010/01/23 21:12:08 tom Exp $")
+MODULE_ID("$Id: fld_attr.c,v 1.15 2020/12/11 22:05:24 tom Exp $")
 
 /*----------------------------------------------------------------------------
   Field-Attribute manipulation routines
   --------------------------------------------------------------------------*/
-/* "Template" macro to generate a function to set a fields attribute */
+/* "Template" macro to generate a function to set a field's attribute */
 #define GEN_FIELD_ATTR_SET_FCT( name ) \
-NCURSES_IMPEXP int NCURSES_API set_field_ ## name (FIELD * field, chtype attr)\
+FORM_IMPEXP int NCURSES_API set_field_ ## name (FIELD * field, chtype attr)\
 {\
    int res = E_BAD_ARGUMENT;\
-   T((T_CALLED("set_field_" #name "(%p,%s)"), field, _traceattr(attr)));\
+   T((T_CALLED("set_field_" #name "(%p,%s)"), (void *)field, _traceattr(attr)));\
    if ( attr==A_NORMAL || ((attr & A_ATTRIBUTES)==attr) )\
      {\
        Normalize_Field( field );\
@@ -62,9 +63,9 @@
    RETURN(res);\
 }
 
-/* "Template" macro to generate a function to get a fields attribute */
+/* "Template" macro to generate a function to get a field's attribute */
 #define GEN_FIELD_ATTR_GET_FCT( name ) \
-NCURSES_IMPEXP chtype NCURSES_API field_ ## name (const FIELD * field)\
+FORM_IMPEXP chtype NCURSES_API field_ ## name (const FIELD * field)\
 {\
    T((T_CALLED("field_" #name "(%p)"), (const void *) field));\
    returnAttr( A_ATTRIBUTES & (Normalize_Field( field ) -> name) );\
@@ -87,7 +88,7 @@
 |   Facility      :  libnform
 |   Function      :  chtype field_fore(const FIELD *)
 |
-|   Description   :  Retrieve fields foreground attribute
+|   Description   :  Retrieve field's foreground attribute
 |
 |   Return Values :  The foreground attribute
 +--------------------------------------------------------------------------*/
@@ -98,7 +99,7 @@
 |   Function      :  int set_field_back(FIELD *field, chtype attr)
 |
 |   Description   :  Sets the background of the field used to display the
-|                    fields extend.
+|                    field's extend.
 |
 |   Return Values :  E_OK             - success
 |                    E_BAD_ARGUMENT   - invalid attributes
@@ -110,7 +111,7 @@
 |   Facility      :  libnform
 |   Function      :  chtype field_back(const
 |
-|   Description   :  Retrieve fields background attribute
+|   Description   :  Retrieve field's background attribute
 |
 |   Return Values :  The background attribute
 +--------------------------------------------------------------------------*/
diff --git a/form/fld_current.c b/form/fld_current.c
index ef9ec00..264007e 100644
--- a/form/fld_current.c
+++ b/form/fld_current.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc.              *
+ * Copyright 2020 Thomas E. Dickey                                          *
+ * Copyright 1998-2010,2016 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +33,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_current.c,v 1.12 2010/01/23 21:14:35 tom Exp $")
+MODULE_ID("$Id: fld_current.c,v 1.16 2020/05/24 01:40:20 anonymous.maarten Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform
@@ -47,7 +48,7 @@
 |                    E_INVALID_FIELD   - current field can't be left
 |                    E_SYSTEM_ERROR    - system error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_current_field(FORM *form, FIELD *field)
 {
   int err = E_OK;
@@ -76,7 +77,7 @@
 	{
 	  if (form->current != field)
 	    {
-	      if (!_nc_Internal_Validation(form))
+	      if (form->current && !_nc_Internal_Validation(form))
 		{
 		  err = E_INVALID_FIELD;
 		}
@@ -104,13 +105,39 @@
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform
+|   Function      :  int unfocus_current_field(FORM * form)
+|
+|   Description   :  Removes focus from the current field.
+|
+|   Return Values :  E_OK              - success
+|                    E_BAD_ARGUMENT    - invalid form pointer
+|                    E_REQUEST_DENIED  - there is no current field to unfocus
++--------------------------------------------------------------------------*/
+FORM_EXPORT(int)
+unfocus_current_field(FORM *const form)
+{
+  T((T_CALLED("unfocus_current_field(%p)"), (const void *)form));
+  if (form == 0)
+    {
+      RETURN(E_BAD_ARGUMENT);
+    }
+  else if (form->current == 0)
+    {
+      RETURN(E_REQUEST_DENIED);
+    }
+  _nc_Unset_Current_Field(form);
+  RETURN(E_OK);
+}
+
+/*---------------------------------------------------------------------------
+|   Facility      :  libnform
 |   Function      :  FIELD *current_field(const FORM * form)
 |
 |   Description   :  Return the current field.
 |
 |   Return Values :  Pointer to the current field.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FIELD *)
+FORM_EXPORT(FIELD *)
 current_field(const FORM *form)
 {
   T((T_CALLED("current_field(%p)"), (const void *)form));
@@ -127,7 +154,7 @@
 |   Return Values :  >= 0   : field index
 |                    -1     : fieldpointer invalid or field not connected
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 field_index(const FIELD *field)
 {
   T((T_CALLED("field_index(%p)"), (const void *)field));
diff --git a/form/fld_def.c b/form/fld_def.c
index b18462f..51bdc64 100644
--- a/form/fld_def.c
+++ b/form/fld_def.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2012,2014 Free Software Foundation, Inc.              *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 1998-2012,2014 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +33,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_def.c,v 1.41 2014/07/26 21:08:55 tom Exp $")
+MODULE_ID("$Id: fld_def.c,v 1.44 2021/03/27 23:49:53 tom Exp $")
 
 /* this can't be readonly */
 static FIELD default_field =
@@ -65,7 +66,7 @@
   NCURSES_FIELD_EXTENSION
 };
 
-NCURSES_EXPORT_VAR(FIELD *) _nc_Default_Field = &default_field;
+FORM_EXPORT_VAR(FIELD *) _nc_Default_Field = &default_field;
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform
@@ -81,18 +82,17 @@
 |   Return Values :  Pointer to argument structure. Maybe NULL.
 |                    In case of an error in *err an error counter is increased.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(TypeArgument *)
+FORM_EXPORT(TypeArgument *)
 _nc_Make_Argument(const FIELDTYPE *typ, va_list *ap, int *err)
 {
   TypeArgument *res = (TypeArgument *)0;
-  TypeArgument *p;
 
   if (typ != 0 && (typ->status & _HAS_ARGS) != 0)
     {
       assert(err != 0 && ap != (va_list *)0);
       if ((typ->status & _LINKED_TYPE) != 0)
 	{
-	  p = typeMalloc(TypeArgument, 1);
+	  TypeArgument *p = typeMalloc(TypeArgument, 1);
 
 	  if (p != 0)
 	    {
@@ -129,18 +129,17 @@
 |   Return Values :  Pointer to argument structure. Maybe NULL.
 |                    In case of an error in *err an error counter is increased.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(TypeArgument *)
+FORM_EXPORT(TypeArgument *)
 _nc_Copy_Argument(const FIELDTYPE *typ, const TypeArgument *argp, int *err)
 {
   TypeArgument *res = (TypeArgument *)0;
-  TypeArgument *p;
 
   if (typ != 0 && (typ->status & _HAS_ARGS) != 0)
     {
       assert(err != 0 && argp != 0);
       if ((typ->status & _LINKED_TYPE) != 0)
 	{
-	  p = typeMalloc(TypeArgument, 1);
+	  TypeArgument *p = typeMalloc(TypeArgument, 1);
 
 	  if (p != 0)
 	    {
@@ -178,7 +177,7 @@
 |
 |   Return Values :  -
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void)
+FORM_EXPORT(void)
 _nc_Free_Argument(const FIELDTYPE *typ, TypeArgument *argp)
 {
   if (typ != 0 && (typ->status & _HAS_ARGS) != 0)
@@ -211,7 +210,7 @@
 |   Return Values :  TRUE       - copy worked
 |                    FALSE      - error occurred
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(bool)
+FORM_EXPORT(bool)
 _nc_Copy_Type(FIELD *dst, FIELD const *src)
 {
   int err = 0;
@@ -246,7 +245,7 @@
 |
 |   Return Values :  -
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void)
+FORM_EXPORT(void)
 _nc_Free_Type(FIELD *field)
 {
   assert(field != 0);
@@ -273,7 +272,7 @@
 |
 |   Return Values :  Pointer to the new field or NULL if failure.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FIELD *)
+FORM_EXPORT(FIELD *)
 new_field(int rows, int cols, int frow, int fcol, int nrow, int nbuf)
 {
   static const FIELD_CELL blank = BLANK;
@@ -353,7 +352,7 @@
 |                    E_BAD_ARGUMENT - invalid field pointer
 |                    E_CONNECTED    - field is connected
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 free_field(FIELD *field)
 {
   T((T_CALLED("free_field(%p)"), (void *)field));
diff --git a/form/fld_dup.c b/form/fld_dup.c
index 2df40ee..e195df9 100644
--- a/form/fld_dup.c
+++ b/form/fld_dup.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
+ * Copyright 2020 Thomas E. Dickey                                          *
+ * Copyright 1998-2010,2012 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +33,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_dup.c,v 1.14 2012/03/11 00:37:16 tom Exp $")
+MODULE_ID("$Id: fld_dup.c,v 1.18 2020/05/24 01:40:20 anonymous.maarten Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform
@@ -47,7 +48,7 @@
 |
 |   Return Values :  Pointer to the new field or NULL if failure
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FIELD *)
+FORM_EXPORT(FIELD *)
 dup_field(FIELD *field, int frow, int fcol)
 {
   FIELD *New_Field = (FIELD *)0;
@@ -60,8 +61,8 @@
     {
       T((T_CREATE("field %p"), (void *)New_Field));
       *New_Field = *_nc_Default_Field;
-      New_Field->frow = (short) frow;
-      New_Field->fcol = (short) fcol;
+      New_Field->frow = (short)frow;
+      New_Field->fcol = (short)fcol;
       New_Field->link = New_Field;
       New_Field->rows = field->rows;
       New_Field->cols = field->cols;
@@ -79,13 +80,12 @@
 
       if (_nc_Copy_Type(New_Field, field))
 	{
-	  size_t i, len;
+	  size_t len;
 
 	  len = Total_Buffer_Size(New_Field);
-	  if ((New_Field->buf = (FIELD_CELL *)malloc(len)))
+	  if ((New_Field->buf = (FIELD_CELL *)malloc(len * 20)))
 	    {
-	      for (i = 0; i < len; ++i)
-		New_Field->buf[i] = field->buf[i];
+	      memcpy(New_Field->buf, field->buf, len);
 	      returnField(New_Field);
 	    }
 	}
diff --git a/form/fld_ftchoice.c b/form/fld_ftchoice.c
index 0901306..dfaca14 100644
--- a/form/fld_ftchoice.c
+++ b/form/fld_ftchoice.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
+ * Copyright 2018-2020,2021 Thomas E. Dickey                                *
+ * Copyright 1998-2012,2016 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,10 +33,10 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_ftchoice.c,v 1.13 2012/06/10 00:27:49 tom Exp $")
+MODULE_ID("$Id: fld_ftchoice.c,v 1.18 2021/06/17 21:26:02 tom Exp $")
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  int set_fieldtype_choice(
 |                          FIELDTYPE *typ,
 |                          bool (* const next_choice)(FIELD *,const void *),
@@ -46,12 +47,17 @@
 |   Return Values :  E_OK           - success
 |                    E_BAD_ARGUMENT - invalid arguments
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_fieldtype_choice(FIELDTYPE *typ,
 		     bool (*const next_choice) (FIELD *, const void *),
 		     bool (*const prev_choice) (FIELD *, const void *))
 {
-  T((T_CALLED("set_fieldtype_choice(%p,%p,%p)"), (void *)typ, next_choice, prev_choice));
+  TR_FUNC_BFR(2);
+
+  T((T_CALLED("set_fieldtype_choice(%p,%s,%s)"),
+     (void *)typ,
+     TR_FUNC_ARG(0, next_choice),
+     TR_FUNC_ARG(1, prev_choice)));
 
   if (!typ || !next_choice || !prev_choice)
     RETURN(E_BAD_ARGUMENT);
diff --git a/form/fld_ftlink.c b/form/fld_ftlink.c
index e7b1440..ed16920 100644
--- a/form/fld_ftlink.c
+++ b/form/fld_ftlink.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 1998-2010,2012 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,23 +33,23 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_ftlink.c,v 1.15 2012/06/10 00:27:49 tom Exp $")
+MODULE_ID("$Id: fld_ftlink.c,v 1.18 2021/06/17 21:20:30 tom Exp $")
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  FIELDTYPE *link_fieldtype(
 |                                FIELDTYPE *type1,
 |                                FIELDTYPE *type2)
-|   
+|
 |   Description   :  Create a new fieldtype built from the two given types.
 |                    They are connected by an logical 'OR'.
-|                    If an error occurs, errno is set to                    
+|                    If an error occurs, errno is set to
 |                       E_BAD_ARGUMENT  - invalid arguments
 |                       E_SYSTEM_ERROR  - system error (no memory)
 |
 |   Return Values :  Fieldtype pointer or NULL if error occurred.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FIELDTYPE *)
+FORM_EXPORT(FIELDTYPE *)
 link_fieldtype(FIELDTYPE *type1, FIELDTYPE *type2)
 {
   FIELDTYPE *nftyp = (FIELDTYPE *)0;
diff --git a/form/fld_info.c b/form/fld_info.c
index 13fe8e7..bc8399d 100644
--- a/form/fld_info.c
+++ b/form/fld_info.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc.              *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 1998-2004,2010 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,21 +33,21 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_info.c,v 1.11 2010/01/23 21:14:35 tom Exp $")
+MODULE_ID("$Id: fld_info.c,v 1.16 2021/06/17 21:20:30 tom Exp $")
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  int field_info(const FIELD *field,
 |                                   int *rows, int *cols,
 |                                   int *frow, int *fcol,
 |                                   int *nrow, int *nbuf)
-|   
-|   Description   :  Retrieve infos about the fields creation parameters.
+|
+|   Description   :  Retrieve information about the field's creation parameters.
 |
 |   Return Values :  E_OK           - success
 |                    E_BAD_ARGUMENT - invalid field pointer
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 field_info(const FIELD *field,
 	   int *rows, int *cols,
 	   int *frow, int *fcol,
@@ -77,18 +78,18 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  int dynamic_field_info(const FIELD *field,
 |                                           int *drows, int *dcols,
 |                                           int *maxgrow)
-|   
-|   Description   :  Retrieve informations about a dynamic fields current
+|
+|   Description   :  Retrieve information about a dynamic field's current
 |                    dynamic parameters.
 |
 |   Return Values :  E_OK           - success
 |                    E_BAD_ARGUMENT - invalid argument
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 dynamic_field_info(const FIELD *field, int *drows, int *dcols, int *maxgrow)
 {
   T((T_CALLED("dynamic_field_info(%p,%p,%p,%p)"),
diff --git a/form/fld_just.c b/form/fld_just.c
index dea20b7..62253bc 100644
--- a/form/fld_just.c
+++ b/form/fld_just.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 1998-2010,2012 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,19 +33,19 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_just.c,v 1.13 2012/03/11 00:37:16 tom Exp $")
+MODULE_ID("$Id: fld_just.c,v 1.17 2021/06/17 21:20:30 tom Exp $")
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  int set_field_just(FIELD *field, int just)
-|   
-|   Description   :  Set the fields type of justification.
+|
+|   Description   :  Set the field's type of justification.
 |
 |   Return Values :  E_OK            - success
 |                    E_BAD_ARGUMENT  - one of the arguments was incorrect
 |                    E_SYSTEM_ERROR  - system error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_field_just(FIELD *field, int just)
 {
   int res = E_BAD_ARGUMENT;
@@ -59,7 +60,7 @@
       Normalize_Field(field);
       if (field->just != just)
 	{
-	  field->just = (short) just;
+	  field->just = (short)just;
 	  res = _nc_Synchronize_Attributes(field);
 	}
       else
@@ -69,14 +70,14 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  int field_just( const FIELD *field )
-|   
-|   Description   :  Retrieve the fields type of justification
+|
+|   Description   :  Retrieve the field's type of justification
 |
 |   Return Values :  The justification type.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 field_just(const FIELD *field)
 {
   T((T_CALLED("field_just(%p)"), (const void *)field));
diff --git a/form/fld_link.c b/form/fld_link.c
index b6c4768..c060458 100644
--- a/form/fld_link.c
+++ b/form/fld_link.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 1998-2010,2012 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,23 +33,23 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_link.c,v 1.13 2012/03/11 00:37:16 tom Exp $")
+MODULE_ID("$Id: fld_link.c,v 1.17 2021/06/17 21:20:30 tom Exp $")
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
-|   Function      :  FIELD *link_field(FIELD *field, int frow, int fcol)  
-|   
+|   Facility      :  libnform
+|   Function      :  FIELD *link_field(FIELD *field, int frow, int fcol)
+|
 |   Description   :  Duplicates the field at the specified position. The
 |                    new field shares its buffers with the original one,
 |                    the attributes are independent.
 |                    If an error occurs, errno is set to
-|                    
+|
 |                    E_BAD_ARGUMENT - invalid argument
 |                    E_SYSTEM_ERROR - system error
 |
 |   Return Values :  Pointer to the new field or NULL if failure
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FIELD *)
+FORM_EXPORT(FIELD *)
 link_field(FIELD *field, int frow, int fcol)
 {
   FIELD *New_Field = (FIELD *)0;
@@ -61,8 +62,8 @@
     {
       T((T_CREATE("field %p"), (void *)New_Field));
       *New_Field = *_nc_Default_Field;
-      New_Field->frow = (short) frow;
-      New_Field->fcol = (short) fcol;
+      New_Field->frow = (short)frow;
+      New_Field->fcol = (short)fcol;
 
       New_Field->link = field->link;
       field->link = New_Field;
diff --git a/form/fld_max.c b/form/fld_max.c
index 6c7fe72..325541a 100644
--- a/form/fld_max.c
+++ b/form/fld_max.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
+ * Copyright 2019-2020,2021 Thomas E. Dickey                                *
+ * Copyright 1998-2012,2013 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,19 +33,19 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_max.c,v 1.13 2013/08/24 22:59:28 tom Exp $")
+MODULE_ID("$Id: fld_max.c,v 1.18 2021/06/17 21:26:02 tom Exp $")
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  int set_max_field(FIELD *field, int maxgrow)
-|   
+|
 |   Description   :  Set the maximum growth for a dynamic field. If maxgrow=0
 |                    the field may grow to any possible size.
 |
 |   Return Values :  E_OK           - success
 |                    E_BAD_ARGUMENT - invalid argument
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_max_field(FIELD *field, int maxgrow)
 {
   T((T_CALLED("set_max_field(%p,%d)"), (void *)field, maxgrow));
@@ -57,11 +58,16 @@
 
       if (maxgrow > 0)
 	{
-	  if ((single_line_field && (maxgrow < field->dcols)) ||
-	      (!single_line_field && (maxgrow < field->drows)))
+	  if (((single_line_field && (maxgrow < field->dcols)) ||
+	       (!single_line_field && (maxgrow < field->drows))) &&
+	      !Field_Has_Option(field, O_INPUT_LIMIT))
 	    RETURN(E_BAD_ARGUMENT);
 	}
       field->maxgrow = maxgrow;
+      /* shrink */
+      if (maxgrow > 0 && Field_Has_Option(field, O_INPUT_LIMIT) &&
+	  field->dcols > maxgrow)
+	field->dcols = maxgrow;
       ClrStatus(field, _MAY_GROW);
       if (!((unsigned)field->opts & O_STATIC))
 	{
diff --git a/form/fld_move.c b/form/fld_move.c
index 99f5490..0d9ac4a 100644
--- a/form/fld_move.c
+++ b/form/fld_move.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 1998-2010,2012 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,20 +33,20 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_move.c,v 1.11 2012/03/11 00:37:16 tom Exp $")
+MODULE_ID("$Id: fld_move.c,v 1.16 2021/06/17 21:20:30 tom Exp $")
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  int move_field(FIELD *field,int frow, int fcol)
-|   
+|
 |   Description   :  Moves the disconnected field to the new location in
-|                    the forms subwindow.
+|                    the form's subwindow.
 |
 |   Return Values :  E_OK            - success
 |                    E_BAD_ARGUMENT  - invalid argument passed
 |                    E_CONNECTED     - field is connected
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 move_field(FIELD *field, int frow, int fcol)
 {
   T((T_CALLED("move_field(%p,%d,%d)"), (void *)field, frow, fcol));
@@ -56,8 +57,8 @@
   if (field->form)
     RETURN(E_CONNECTED);
 
-  field->frow = (short) frow;
-  field->fcol = (short) fcol;
+  field->frow = (short)frow;
+  field->fcol = (short)fcol;
   RETURN(E_OK);
 }
 
diff --git a/form/fld_newftyp.c b/form/fld_newftyp.c
index 4351aed..c5848d5 100644
--- a/form/fld_newftyp.c
+++ b/form/fld_newftyp.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright 2018,2020 Thomas E. Dickey                                     *
+ * Copyright 1998-2010,2016 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +33,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_newftyp.c,v 1.19 2010/01/23 21:14:36 tom Exp $")
+MODULE_ID("$Id: fld_newftyp.c,v 1.23 2020/05/24 01:40:20 anonymous.maarten Exp $")
 
 static FIELDTYPE default_fieldtype =
 {
@@ -52,8 +53,8 @@
 #endif
 };
 
-NCURSES_EXPORT_VAR(FIELDTYPE *)
-_nc_Default_FieldType = &default_fieldtype;
+FORM_EXPORT_VAR(FIELDTYPE *)
+  _nc_Default_FieldType = &default_fieldtype;
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform
@@ -70,13 +71,18 @@
 |
 |   Return Values :  Fieldtype pointer or NULL if error occurred
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FIELDTYPE *)
+FORM_EXPORT(FIELDTYPE *)
 new_fieldtype(bool (*const field_check) (FIELD *, const void *),
 	      bool (*const char_check) (int, const void *))
 {
   FIELDTYPE *nftyp = (FIELDTYPE *)0;
 
-  T((T_CALLED("new_fieldtype(%p,%p)"), field_check, char_check));
+  TR_FUNC_BFR(2);
+
+  T((T_CALLED("new_fieldtype(%s,%s)"),
+     TR_FUNC_ARG(0, field_check),
+     TR_FUNC_ARG(1, char_check)));
+
   if ((field_check) || (char_check))
     {
       nftyp = typeMalloc(FIELDTYPE, 1);
@@ -115,7 +121,7 @@
 |                    E_CONNECTED     - there are fields referencing the type
 |                    E_BAD_ARGUMENT  - invalid fieldtype pointer
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 free_fieldtype(FIELDTYPE *typ)
 {
   T((T_CALLED("free_fieldtype(%p)"), (void *)typ));
diff --git a/form/fld_opts.c b/form/fld_opts.c
index a52f1e2..ab4d559 100644
--- a/form/fld_opts.c
+++ b/form/fld_opts.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc.              *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 1998-2004,2010 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,16 +33,16 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_opts.c,v 1.12 2010/01/23 21:14:36 tom Exp $")
+MODULE_ID("$Id: fld_opts.c,v 1.16 2021/06/17 21:20:30 tom Exp $")
 
 /*----------------------------------------------------------------------------
   Field-Options manipulation routines
   --------------------------------------------------------------------------*/
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  int set_field_opts(FIELD *field, Field_Options opts)
-|   
+|
 |   Description   :  Turns on the named options for this field and turns
 |                    off all the remaining options.
 |
@@ -50,7 +51,7 @@
 |                    E_BAD_ARGUMENT  - invalid options
 |                    E_SYSTEM_ERROR  - system error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_field_opts(FIELD *field, Field_Options opts)
 {
   int res = E_BAD_ARGUMENT;
@@ -64,14 +65,14 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  Field_Options field_opts(const FIELD *field)
-|   
-|   Description   :  Retrieve the fields options.
+|
+|   Description   :  Retrieve the field's options.
 |
 |   Return Values :  The options.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(Field_Options)
+FORM_EXPORT(Field_Options)
 field_opts(const FIELD *field)
 {
   T((T_CALLED("field_opts(%p)"), (const void *)field));
@@ -80,10 +81,10 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  int field_opts_on(FIELD *field, Field_Options opts)
-|   
-|   Description   :  Turns on the named options for this field and all the 
+|
+|   Description   :  Turns on the named options for this field and all the
 |                    remaining options are unchanged.
 |
 |   Return Values :  E_OK            - success
@@ -91,7 +92,7 @@
 |                    E_BAD_ARGUMENT  - invalid options
 |                    E_SYSTEM_ERROR  - system error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 field_opts_on(FIELD *field, Field_Options opts)
 {
   int res = E_BAD_ARGUMENT;
@@ -108,10 +109,10 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  int field_opts_off(FIELD *field, Field_Options opts)
-|   
-|   Description   :  Turns off the named options for this field and all the 
+|
+|   Description   :  Turns off the named options for this field and all the
 |                    remaining options are unchanged.
 |
 |   Return Values :  E_OK            - success
@@ -119,7 +120,7 @@
 |                    E_BAD_ARGUMENT  - invalid options
 |                    E_SYSTEM_ERROR  - system error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 field_opts_off(FIELD *field, Field_Options opts)
 {
   int res = E_BAD_ARGUMENT;
diff --git a/form/fld_pad.c b/form/fld_pad.c
index 4f8ff1f..fdd803f 100644
--- a/form/fld_pad.c
+++ b/form/fld_pad.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc.              *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 1998-2004,2010 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,12 +33,12 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_pad.c,v 1.10 2010/01/23 21:14:36 tom Exp $")
+MODULE_ID("$Id: fld_pad.c,v 1.14 2021/06/17 21:20:30 tom Exp $")
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  int set_field_pad(FIELD *field, int ch)
-|   
+|
 |   Description   :  Set the pad character used to fill the field. This must
 |                    be a printable character.
 |
@@ -45,7 +46,7 @@
 |                    E_BAD_ARGUMENT - invalid field pointer or pad character
 |                    E_SYSTEM_ERROR - system error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_field_pad(FIELD *field, int ch)
 {
   int res = E_BAD_ARGUMENT;
@@ -67,14 +68,14 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  int field_pad(const FIELD *field)
-|   
-|   Description   :  Retrieve the fields pad character.
+|
+|   Description   :  Retrieve the field's pad character.
 |
 |   Return Values :  The pad character.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 field_pad(const FIELD *field)
 {
   T((T_CALLED("field_pad(%p)"), (const void *)field));
diff --git a/form/fld_page.c b/form/fld_page.c
index bcce4cf..6972d31 100644
--- a/form/fld_page.c
+++ b/form/fld_page.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 1998-2010,2012 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,19 +33,19 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_page.c,v 1.12 2012/06/10 00:12:47 tom Exp $")
+MODULE_ID("$Id: fld_page.c,v 1.16 2021/06/17 21:20:30 tom Exp $")
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  int set_new_page(FIELD *field, bool new_page_flag)
-|   
-|   Description   :  Marks the field as the beginning of a new page of 
+|
+|   Description   :  Marks the field as the beginning of a new page of
 |                    the form.
 |
 |   Return Values :  E_OK         - success
 |                    E_CONNECTED  - field is connected
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_new_page(FIELD *field, bool new_page_flag)
 {
   T((T_CALLED("set_new_page(%p,%d)"), (void *)field, new_page_flag));
@@ -62,16 +63,16 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  bool new_page(const FIELD *field)
-|   
-|   Description   :  Retrieve the info whether or not the field starts a
-|                    new page on the form.
+|
+|   Description   :  Retrieve the information whether or not the field starts
+|                    a new page on the form.
 |
 |   Return Values :  TRUE  - field starts a new page
 |                    FALSE - field doesn't start a new page
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(bool)
+FORM_EXPORT(bool)
 new_page(const FIELD *field)
 {
   T((T_CALLED("new_page(%p)"), (const void *)field));
diff --git a/form/fld_stat.c b/form/fld_stat.c
index 9bbe76e..62d782e 100644
--- a/form/fld_stat.c
+++ b/form/fld_stat.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 1998-2010,2012 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,18 +33,18 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_stat.c,v 1.14 2012/06/10 00:13:09 tom Exp $")
+MODULE_ID("$Id: fld_stat.c,v 1.18 2021/06/17 21:20:30 tom Exp $")
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  int set_field_status(FIELD *field, bool status)
-|   
+|
 |   Description   :  Set or clear the 'changed' indication flag for that
-|                    fields primary buffer.
+|                    field's primary buffer.
 |
 |   Return Values :  E_OK            - success
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_field_status(FIELD *field, bool status)
 {
   T((T_CALLED("set_field_status(%p,%d)"), (void *)field, status));
@@ -59,16 +60,16 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  bool field_status(const FIELD *field)
-|   
+|
 |   Description   :  Retrieve the value of the 'changed' indication flag
-|                    for that fields primary buffer. 
+|                    for that field's primary buffer.
 |
 |   Return Values :  TRUE  - buffer has been changed
 |                    FALSE - buffer has not been changed
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(bool)
+FORM_EXPORT(bool)
 field_status(const FIELD *field)
 {
   T((T_CALLED("field_status(%p)"), (const void *)field));
diff --git a/form/fld_type.c b/form/fld_type.c
index 0b35b7e..c557e05 100644
--- a/form/fld_type.c
+++ b/form/fld_type.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc.              *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 1998-2004,2010 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,12 +33,12 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_type.c,v 1.16 2010/01/23 21:14:36 tom Exp $")
+MODULE_ID("$Id: fld_type.c,v 1.20 2021/06/17 21:20:30 tom Exp $")
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  int set_field_type(FIELD *field, FIELDTYPE *type,...)
-|   
+|
 |   Description   :  Associate the specified fieldtype with the field.
 |                    Certain field types take additional arguments. Look
 |                    at the spec of the field types !
@@ -45,8 +46,8 @@
 |   Return Values :  E_OK           - success
 |                    E_SYSTEM_ERROR - system error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
-set_field_type(FIELD *field, FIELDTYPE *type,...)
+FORM_EXPORT(int)
+set_field_type(FIELD *field, FIELDTYPE *type, ...)
 {
   va_list ap;
   int res = E_SYSTEM_ERROR;
@@ -80,14 +81,14 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  FIELDTYPE *field_type(const FIELD *field)
-|   
+|
 |   Description   :  Retrieve the associated fieldtype for this field.
 |
 |   Return Values :  Pointer to fieldtype of NULL if none is defined.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FIELDTYPE *)
+FORM_EXPORT(FIELDTYPE *)
 field_type(const FIELD *field)
 {
   T((T_CALLED("field_type(%p)"), (const void *)field));
diff --git a/form/fld_user.c b/form/fld_user.c
index 30bcf7a..1b13e62 100644
--- a/form/fld_user.c
+++ b/form/fld_user.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc.              *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 1998-2004,2010 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,18 +33,18 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fld_user.c,v 1.16 2010/01/23 21:14:36 tom Exp $")
+MODULE_ID("$Id: fld_user.c,v 1.20 2021/06/17 21:20:30 tom Exp $")
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  int set_field_userptr(FIELD *field, void *usrptr)
-|   
+|
 |   Description   :  Set the pointer that is reserved in any field to store
-|                    application relevant informations
+|                    application relevant information.
 |
 |   Return Values :  E_OK         - on success
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_field_userptr(FIELD *field, void *usrptr)
 {
   T((T_CALLED("set_field_userptr(%p,%p)"), (void *)field, (void *)usrptr));
@@ -53,16 +54,16 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  void *field_userptr(const FIELD *field)
-|   
+|
 |   Description   :  Return the pointer that is reserved in any field to
-|                    store application relevant informations.
+|                    store application relevant information.
 |
 |   Return Values :  Value of pointer. If no such pointer has been set,
 |                    NULL is returned
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void *)
+FORM_EXPORT(void *)
 field_userptr(const FIELD *field)
 {
   T((T_CALLED("field_userptr(%p)"), (const void *)field));
diff --git a/form/form.h b/form/form.h
index 09856dc..3b62e39 100644
--- a/form/form.h
+++ b/form/form.h
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc.              *
+ * Copyright 2018-2019-2020,2021 Thomas E. Dickey                           *
+ * Copyright 1998-2016,2017 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            *
@@ -30,7 +31,7 @@
  *   Author:  Juergen Pfeifer, 1995,1997                                    *
  ****************************************************************************/
 
-/* $Id: form.h,v 0.24 2014/07/26 20:52:28 tom Exp $ */
+/* $Id: form.h,v 0.32 2021/06/17 21:26:02 tom Exp $ */
 
 #ifndef FORM_H
 #define FORM_H
@@ -43,6 +44,17 @@
   extern "C" {
 #endif
 
+#if defined(BUILDING_FORM)
+# define FORM_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT
+#else
+# define FORM_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT
+#endif
+
+#define FORM_WRAPPED_VAR(type,name) extern FORM_IMPEXP type NCURSES_PUBLIC_VAR(name)(void)
+
+#define FORM_EXPORT(type) FORM_IMPEXP type NCURSES_API
+#define FORM_EXPORT_VAR(type) FORM_IMPEXP type
+
 #ifndef FORM_PRIV_H
 typedef void *FIELD_CELL;
 #endif
@@ -58,18 +70,24 @@
 	*  _PAGE  *
 	**********/
 
-typedef struct {
+typedef struct pagenode
+#if !NCURSES_OPAQUE_FORM
+{
   short pmin;		/* index of first field on page			*/
   short pmax;		/* index of last field on page			*/
   short smin;		/* index of top leftmost field on page		*/
   short smax;		/* index of bottom rightmost field on page	*/
-} _PAGE;
+}
+#endif /* !NCURSES_OPAQUE_FORM */
+_PAGE;
 
 	/**********
 	*  FIELD  *
 	**********/
 
-typedef struct fieldnode {
+typedef struct fieldnode
+#if 1			/* not yet: !NCURSES_OPAQUE_FORM */
+{
   unsigned short	status;		/* flags			*/
   short			rows;		/* size in rows			*/
   short			cols;		/* size in cols			*/
@@ -98,20 +116,24 @@
   /*
    * The wide-character configuration requires extra information.  Because
    * there are existing applications that manipulate the members of FIELD
-   * directly, we cannot make the struct opaque.  Offsets of members up to
-   * this point are the same in the narrow- and wide-character configuration.
-   * But note that the type of buf depends on the configuration, and is made
-   * opaque for that reason.
+   * directly, we cannot make the struct opaque, except by changing the ABI.
+   * Offsets of members up to this point are the same in the narrow- and
+   * wide-character configuration.  But note that the type of buf depends on
+   * the configuration, and is made opaque for that reason.
    */
   NCURSES_FIELD_INTERNALS
-} FIELD;
+}
+#endif /* NCURSES_OPAQUE_FORM */
+FIELD;
 
 
 	/*********
 	*  FORM  *
 	*********/
 
-typedef struct formnode {
+typedef struct formnode
+#if 1			/* not yet: !NCURSES_OPAQUE_FORM */
+{
   unsigned short	status;	  	/* flags			*/
   short			rows;		/* size in rows			*/
   short			cols;		/* size in cols			*/
@@ -136,14 +158,18 @@
   void			(*fieldinit)(struct formnode *);
   void			(*fieldterm)(struct formnode *);
 
-} FORM;
+}
+#endif /* !NCURSES_OPAQUE_FORM */
+FORM;
 
 
 	/**************
 	*  FIELDTYPE  *
 	**************/
 
-typedef struct typenode {
+typedef struct typenode
+#if !NCURSES_OPAQUE_FORM
+{
   unsigned short	status;			/* flags		    */
   long			ref;			/* reference count	    */
   struct typenode *	left;			/* ptr to operand for |     */
@@ -179,7 +205,9 @@
   bool	(*next)(FIELD *,const void *);		/* enumerate next value */
   bool	(*prev)(FIELD *,const void *);		/* enumerate prev value */
 #endif
-} FIELDTYPE;
+}
+#endif /* !NCURSES_OPAQUE_FORM */
+FIELDTYPE;
 
 typedef void (*Form_Hook)(FORM *);
 
@@ -205,6 +233,9 @@
 #define O_PASSOK		(0x0100U)
 #define O_STATIC		(0x0200U)
 #define O_DYNAMIC_JUSTIFY	(0x0400U)	/* ncurses extension	*/
+#define O_NO_LEFT_STRIP		(0x0800U)	/* ncurses extension	*/
+#define O_EDGE_INSERT_STAY      (0x1000U)	/* ncurses extension	*/
+#define O_INPUT_LIMIT           (0x2000U)	/* ncurses extension	*/
 
 /* form options */
 #define O_NL_OVERLOAD		(0x0001U)
@@ -289,135 +320,136 @@
 	/*************************
 	*  standard field types  *
 	*************************/
-extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ALPHA;
-extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ALNUM;
-extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ENUM;
-extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_INTEGER;
-extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_NUMERIC;
-extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_REGEXP;
+extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_ALPHA;
+extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_ALNUM;
+extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_ENUM;
+extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_INTEGER;
+extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_NUMERIC;
+extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_REGEXP;
 
 	/************************************
 	*  built-in additional field types  *
 	*  They are not defined in SVr4     *
 	************************************/
-extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_IPV4;      /* Internet IP Version 4 address */
+extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_IPV4;      /* Internet IP Version 4 address */
 
 	/***********************
 	*  FIELDTYPE routines  *
 	***********************/
-extern NCURSES_EXPORT(FIELDTYPE *) new_fieldtype (
+extern FORM_EXPORT(FIELDTYPE *) new_fieldtype (
 		    bool (* const field_check)(FIELD *,const void *),
 		    bool (* const char_check)(int,const void *));
-extern NCURSES_EXPORT(FIELDTYPE *) link_fieldtype(
+extern FORM_EXPORT(FIELDTYPE *) link_fieldtype(
 		    FIELDTYPE *, FIELDTYPE *);
 
-extern NCURSES_EXPORT(int)	free_fieldtype (FIELDTYPE *);
-extern NCURSES_EXPORT(int)	set_fieldtype_arg (FIELDTYPE *,
+extern FORM_EXPORT(int)	free_fieldtype (FIELDTYPE *);
+extern FORM_EXPORT(int)	set_fieldtype_arg (FIELDTYPE *,
 		    void * (* const make_arg)(va_list *),
 		    void * (* const copy_arg)(const void *),
 		    void (* const free_arg)(void *));
-extern NCURSES_EXPORT(int)	 set_fieldtype_choice (FIELDTYPE *,
+extern FORM_EXPORT(int)	 set_fieldtype_choice (FIELDTYPE *,
 		    bool (* const next_choice)(FIELD *,const void *),
 	      	    bool (* const prev_choice)(FIELD *,const void *));
 
 	/*******************
 	*  FIELD routines  *
 	*******************/
-extern NCURSES_EXPORT(FIELD *)	new_field (int,int,int,int,int,int);
-extern NCURSES_EXPORT(FIELD *)	dup_field (FIELD *,int,int);
-extern NCURSES_EXPORT(FIELD *)	link_field (FIELD *,int,int);
+extern FORM_EXPORT(FIELD *)	new_field (int,int,int,int,int,int);
+extern FORM_EXPORT(FIELD *)	dup_field (FIELD *,int,int);
+extern FORM_EXPORT(FIELD *)	link_field (FIELD *,int,int);
 
-extern NCURSES_EXPORT(int)	free_field (FIELD *);
-extern NCURSES_EXPORT(int)	field_info (const FIELD *,int *,int *,int *,int *,int *,int *);
-extern NCURSES_EXPORT(int)	dynamic_field_info (const FIELD *,int *,int *,int *);
-extern NCURSES_EXPORT(int)	set_max_field ( FIELD *,int);
-extern NCURSES_EXPORT(int)	move_field (FIELD *,int,int);
-extern NCURSES_EXPORT(int)	set_field_type (FIELD *,FIELDTYPE *,...);
-extern NCURSES_EXPORT(int)	set_new_page (FIELD *,bool);
-extern NCURSES_EXPORT(int)	set_field_just (FIELD *,int);
-extern NCURSES_EXPORT(int)	field_just (const FIELD *);
-extern NCURSES_EXPORT(int)	set_field_fore (FIELD *,chtype);
-extern NCURSES_EXPORT(int)	set_field_back (FIELD *,chtype);
-extern NCURSES_EXPORT(int)	set_field_pad (FIELD *,int);
-extern NCURSES_EXPORT(int)	field_pad (const FIELD *);
-extern NCURSES_EXPORT(int)	set_field_buffer (FIELD *,int,const char *);
-extern NCURSES_EXPORT(int)	set_field_status (FIELD *,bool);
-extern NCURSES_EXPORT(int)	set_field_userptr (FIELD *, void *);
-extern NCURSES_EXPORT(int)	set_field_opts (FIELD *,Field_Options);
-extern NCURSES_EXPORT(int)	field_opts_on (FIELD *,Field_Options);
-extern NCURSES_EXPORT(int)	field_opts_off (FIELD *,Field_Options);
+extern FORM_EXPORT(int)	free_field (FIELD *);
+extern FORM_EXPORT(int)	field_info (const FIELD *,int *,int *,int *,int *,int *,int *);
+extern FORM_EXPORT(int)	dynamic_field_info (const FIELD *,int *,int *,int *);
+extern FORM_EXPORT(int)	set_max_field ( FIELD *,int);
+extern FORM_EXPORT(int)	move_field (FIELD *,int,int);
+extern FORM_EXPORT(int)	set_field_type (FIELD *,FIELDTYPE *,...);
+extern FORM_EXPORT(int)	set_new_page (FIELD *,bool);
+extern FORM_EXPORT(int)	set_field_just (FIELD *,int);
+extern FORM_EXPORT(int)	field_just (const FIELD *);
+extern FORM_EXPORT(int)	set_field_fore (FIELD *,chtype);
+extern FORM_EXPORT(int)	set_field_back (FIELD *,chtype);
+extern FORM_EXPORT(int)	set_field_pad (FIELD *,int);
+extern FORM_EXPORT(int)	field_pad (const FIELD *);
+extern FORM_EXPORT(int)	set_field_buffer (FIELD *,int,const char *);
+extern FORM_EXPORT(int)	set_field_status (FIELD *,bool);
+extern FORM_EXPORT(int)	set_field_userptr (FIELD *, void *);
+extern FORM_EXPORT(int)	set_field_opts (FIELD *,Field_Options);
+extern FORM_EXPORT(int)	field_opts_on (FIELD *,Field_Options);
+extern FORM_EXPORT(int)	field_opts_off (FIELD *,Field_Options);
 
-extern NCURSES_EXPORT(chtype)	field_fore (const FIELD *);
-extern NCURSES_EXPORT(chtype)	field_back (const FIELD *);
+extern FORM_EXPORT(chtype)	field_fore (const FIELD *);
+extern FORM_EXPORT(chtype)	field_back (const FIELD *);
 
-extern NCURSES_EXPORT(bool)	new_page (const FIELD *);
-extern NCURSES_EXPORT(bool)	field_status (const FIELD *);
+extern FORM_EXPORT(bool)	new_page (const FIELD *);
+extern FORM_EXPORT(bool)	field_status (const FIELD *);
 
-extern NCURSES_EXPORT(void *)	field_arg (const FIELD *);
+extern FORM_EXPORT(void *)	field_arg (const FIELD *);
 
-extern NCURSES_EXPORT(void *)	field_userptr (const FIELD *);
+extern FORM_EXPORT(void *)	field_userptr (const FIELD *);
 
-extern NCURSES_EXPORT(FIELDTYPE *)	field_type (const FIELD *);
+extern FORM_EXPORT(FIELDTYPE *)	field_type (const FIELD *);
 
-extern NCURSES_EXPORT(char *)	field_buffer (const FIELD *,int);
+extern FORM_EXPORT(char *)	field_buffer (const FIELD *,int);
 
-extern NCURSES_EXPORT(Field_Options)	field_opts (const FIELD *);
+extern FORM_EXPORT(Field_Options)	field_opts (const FIELD *);
 
 	/******************
 	*  FORM routines  *
 	******************/
 
-extern NCURSES_EXPORT(FORM *)	new_form (FIELD **);
+extern FORM_EXPORT(FORM *)	new_form (FIELD **);
 
-extern NCURSES_EXPORT(FIELD **)	form_fields (const FORM *);
-extern NCURSES_EXPORT(FIELD *)	current_field (const FORM *);
+extern FORM_EXPORT(FIELD **)	form_fields (const FORM *);
+extern FORM_EXPORT(FIELD *)	current_field (const FORM *);
 
-extern NCURSES_EXPORT(WINDOW *)	form_win (const FORM *);
-extern NCURSES_EXPORT(WINDOW *)	form_sub (const FORM *);
+extern FORM_EXPORT(WINDOW *)	form_win (const FORM *);
+extern FORM_EXPORT(WINDOW *)	form_sub (const FORM *);
 
-extern NCURSES_EXPORT(Form_Hook)	form_init (const FORM *);
-extern NCURSES_EXPORT(Form_Hook)	form_term (const FORM *);
-extern NCURSES_EXPORT(Form_Hook)	field_init (const FORM *);
-extern NCURSES_EXPORT(Form_Hook)	field_term (const FORM *);
+extern FORM_EXPORT(Form_Hook)	form_init (const FORM *);
+extern FORM_EXPORT(Form_Hook)	form_term (const FORM *);
+extern FORM_EXPORT(Form_Hook)	field_init (const FORM *);
+extern FORM_EXPORT(Form_Hook)	field_term (const FORM *);
 
-extern NCURSES_EXPORT(int)	free_form (FORM *);
-extern NCURSES_EXPORT(int)	set_form_fields (FORM *,FIELD **);
-extern NCURSES_EXPORT(int)	field_count (const FORM *);
-extern NCURSES_EXPORT(int)	set_form_win (FORM *,WINDOW *);
-extern NCURSES_EXPORT(int)	set_form_sub (FORM *,WINDOW *);
-extern NCURSES_EXPORT(int)	set_current_field (FORM *,FIELD *);
-extern NCURSES_EXPORT(int)	field_index (const FIELD *);
-extern NCURSES_EXPORT(int)	set_form_page (FORM *,int);
-extern NCURSES_EXPORT(int)	form_page (const FORM *);
-extern NCURSES_EXPORT(int)	scale_form (const FORM *,int *,int *);
-extern NCURSES_EXPORT(int)	set_form_init (FORM *,Form_Hook);
-extern NCURSES_EXPORT(int)	set_form_term (FORM *,Form_Hook);
-extern NCURSES_EXPORT(int)	set_field_init (FORM *,Form_Hook);
-extern NCURSES_EXPORT(int)	set_field_term (FORM *,Form_Hook);
-extern NCURSES_EXPORT(int)	post_form (FORM *);
-extern NCURSES_EXPORT(int)	unpost_form (FORM *);
-extern NCURSES_EXPORT(int)	pos_form_cursor (FORM *);
-extern NCURSES_EXPORT(int)	form_driver (FORM *,int);
+extern FORM_EXPORT(int)	free_form (FORM *);
+extern FORM_EXPORT(int)	set_form_fields (FORM *,FIELD **);
+extern FORM_EXPORT(int)	field_count (const FORM *);
+extern FORM_EXPORT(int)	set_form_win (FORM *,WINDOW *);
+extern FORM_EXPORT(int)	set_form_sub (FORM *,WINDOW *);
+extern FORM_EXPORT(int)	set_current_field (FORM *,FIELD *);
+extern FORM_EXPORT(int)	unfocus_current_field (FORM *);
+extern FORM_EXPORT(int)	field_index (const FIELD *);
+extern FORM_EXPORT(int)	set_form_page (FORM *,int);
+extern FORM_EXPORT(int)	form_page (const FORM *);
+extern FORM_EXPORT(int)	scale_form (const FORM *,int *,int *);
+extern FORM_EXPORT(int)	set_form_init (FORM *,Form_Hook);
+extern FORM_EXPORT(int)	set_form_term (FORM *,Form_Hook);
+extern FORM_EXPORT(int)	set_field_init (FORM *,Form_Hook);
+extern FORM_EXPORT(int)	set_field_term (FORM *,Form_Hook);
+extern FORM_EXPORT(int)	post_form (FORM *);
+extern FORM_EXPORT(int)	unpost_form (FORM *);
+extern FORM_EXPORT(int)	pos_form_cursor (FORM *);
+extern FORM_EXPORT(int)	form_driver (FORM *,int);
 # if NCURSES_WIDECHAR
-extern NCURSES_EXPORT(int)	form_driver_w (FORM *,int,wchar_t);
+extern FORM_EXPORT(int)	form_driver_w (FORM *,int,wchar_t);
 # endif
-extern NCURSES_EXPORT(int)	set_form_userptr (FORM *,void *);
-extern NCURSES_EXPORT(int)	set_form_opts (FORM *,Form_Options);
-extern NCURSES_EXPORT(int)	form_opts_on (FORM *,Form_Options);
-extern NCURSES_EXPORT(int)	form_opts_off (FORM *,Form_Options);
-extern NCURSES_EXPORT(int)	form_request_by_name (const char *);
+extern FORM_EXPORT(int)	set_form_userptr (FORM *,void *);
+extern FORM_EXPORT(int)	set_form_opts (FORM *,Form_Options);
+extern FORM_EXPORT(int)	form_opts_on (FORM *,Form_Options);
+extern FORM_EXPORT(int)	form_opts_off (FORM *,Form_Options);
+extern FORM_EXPORT(int)	form_request_by_name (const char *);
 
-extern NCURSES_EXPORT(const char *)	form_request_name (int);
+extern FORM_EXPORT(const char *)	form_request_name (int);
 
-extern NCURSES_EXPORT(void *)	form_userptr (const FORM *);
+extern FORM_EXPORT(void *)	form_userptr (const FORM *);
 
-extern NCURSES_EXPORT(Form_Options)	form_opts (const FORM *);
+extern FORM_EXPORT(Form_Options)	form_opts (const FORM *);
 
-extern NCURSES_EXPORT(bool)	data_ahead (const FORM *);
-extern NCURSES_EXPORT(bool)	data_behind (const FORM *);
+extern FORM_EXPORT(bool)	data_ahead (const FORM *);
+extern FORM_EXPORT(bool)	data_behind (const FORM *);
 
 #if NCURSES_SP_FUNCS
-extern NCURSES_EXPORT(FORM *)	NCURSES_SP_NAME(new_form) (SCREEN*, FIELD **);
+extern FORM_EXPORT(FORM *)	NCURSES_SP_NAME(new_form) (SCREEN*, FIELD **);
 #endif
 
 #ifdef __cplusplus
diff --git a/form/form.priv.h b/form/form.priv.h
index 4d1dfe7..ad5af63 100644
--- a/form/form.priv.h
+++ b/form/form.priv.h
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2012,2014 Free Software Foundation, Inc.              *
+ * Copyright 2018-2021,2024 Thomas E. Dickey                                *
+ * Copyright 1998-2016,2017 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            *
@@ -30,12 +31,15 @@
  *   Author:  Juergen Pfeifer, 1995,1997                                    *
  ****************************************************************************/
 
-/* $Id: form.priv.h,v 0.38 2014/11/01 13:56:14 tom Exp $ */
+/* $Id: form.priv.h,v 0.49 2024/02/24 12:17:31 tom Exp $ */
 
 #ifndef FORM_PRIV_H
 #define FORM_PRIV_H 1
 /* *INDENT-OFF*/
 #include "curses.priv.h"
+
+#define NCURSES_OPAQUE_FORM  0
+
 #include "mf_common.h"
 
 #if USE_WIDEC_SUPPORT
@@ -43,10 +47,6 @@
 #include <wctype.h>
 #endif
 
-#ifndef MB_LEN_MAX
-#define MB_LEN_MAX 8 /* should be >= MB_CUR_MAX, but that may be a function */
-#endif
-
 #define FIELD_CELL NCURSES_CH_T
 
 #define NCURSES_FIELD_INTERNALS char** expanded; WINDOW *working;
@@ -65,9 +65,9 @@
 	/***********************
 	*   Default objects    *
 	***********************/
-extern NCURSES_EXPORT_VAR(FORM *)      _nc_Default_Form;
-extern NCURSES_EXPORT_VAR(FIELD *)     _nc_Default_Field;
-extern NCURSES_EXPORT_VAR(FIELDTYPE *) _nc_Default_FieldType;
+extern FORM_EXPORT_VAR(FORM *)      _nc_Default_Form;
+extern FORM_EXPORT_VAR(FIELD *)     _nc_Default_Field;
+extern FORM_EXPORT_VAR(FIELDTYPE *) _nc_Default_FieldType;
 
 /* form  status values */
 #define _OVLMODE         (0x04U) /* Form is in overlay mode                */
@@ -106,7 +106,7 @@
 #define Get_Form_Screen(form) CURRENT_SCREEN
 #endif
 
-/* Retrieve forms window */
+/* Retrieve form's window */
 #define Get_Form_Window(form) \
   ((form)->sub \
    ? (form)->sub \
@@ -162,60 +162,64 @@
 
 #define ALL_FIELD_OPTS (Field_Options)( \
 			STD_FIELD_OPTS |\
-			O_DYNAMIC_JUSTIFY)
+			O_DYNAMIC_JUSTIFY |\
+			O_NO_LEFT_STRIP |\
+			O_EDGE_INSERT_STAY |\
+			O_INPUT_LIMIT)
 
 #define C_BLANK ' '
 #define is_blank(c) ((c)==C_BLANK)
 
 #define C_ZEROS '\0'
 
-extern NCURSES_EXPORT(TypeArgument *) _nc_Make_Argument (const FIELDTYPE*, va_list*, int*);
-extern NCURSES_EXPORT(TypeArgument *) _nc_Copy_Argument (const FIELDTYPE*, const TypeArgument*, int*);
-extern NCURSES_EXPORT(void) _nc_Free_Argument (const FIELDTYPE*, TypeArgument*);
-extern NCURSES_EXPORT(bool) _nc_Copy_Type (FIELD*, FIELD const *);
-extern NCURSES_EXPORT(void) _nc_Free_Type (FIELD *);
+extern FORM_EXPORT(TypeArgument *) _nc_Make_Argument (const FIELDTYPE*, va_list*, int*);
+extern FORM_EXPORT(TypeArgument *) _nc_Copy_Argument (const FIELDTYPE*, const TypeArgument*, int*);
+extern FORM_EXPORT(void) _nc_Free_Argument (const FIELDTYPE*, TypeArgument*);
+extern FORM_EXPORT(bool) _nc_Copy_Type (FIELD*, FIELD const *);
+extern FORM_EXPORT(void) _nc_Free_Type (FIELD *);
 
-extern NCURSES_EXPORT(int) _nc_Synchronize_Attributes (FIELD*);
-extern NCURSES_EXPORT(int) _nc_Synchronize_Options (FIELD*, Field_Options);
-extern NCURSES_EXPORT(int) _nc_Set_Form_Page (FORM*, int, FIELD*);
-extern NCURSES_EXPORT(int) _nc_Refresh_Current_Field (FORM*);
-extern NCURSES_EXPORT(FIELD *) _nc_First_Active_Field (FORM*);
-extern NCURSES_EXPORT(bool) _nc_Internal_Validation (FORM*);
-extern NCURSES_EXPORT(int) _nc_Set_Current_Field (FORM*, FIELD*);
-extern NCURSES_EXPORT(int) _nc_Position_Form_Cursor (FORM*);
+extern FORM_EXPORT(int) _nc_Synchronize_Attributes (FIELD*);
+extern FORM_EXPORT(int) _nc_Synchronize_Options (FIELD*, Field_Options);
+extern FORM_EXPORT(int) _nc_Set_Form_Page (FORM*, int, FIELD*);
+extern FORM_EXPORT(int) _nc_Refresh_Current_Field (FORM*);
+extern FORM_EXPORT(FIELD *) _nc_First_Active_Field (FORM*);
+extern FORM_EXPORT(bool) _nc_Internal_Validation (FORM*);
+extern FORM_EXPORT(int) _nc_Set_Current_Field (FORM*, FIELD*);
+extern FORM_EXPORT(int) _nc_Position_Form_Cursor (FORM*);
+extern FORM_EXPORT(void) _nc_Unset_Current_Field(FORM *form);
 
 #if NCURSES_INTEROP_FUNCS
-extern NCURSES_EXPORT(FIELDTYPE *) _nc_TYPE_INTEGER(void);
-extern NCURSES_EXPORT(FIELDTYPE *) _nc_TYPE_ALNUM(void);
-extern NCURSES_EXPORT(FIELDTYPE *) _nc_TYPE_ALPHA(void);
-extern NCURSES_EXPORT(FIELDTYPE *) _nc_TYPE_ENUM(void);
-extern NCURSES_EXPORT(FIELDTYPE *) _nc_TYPE_NUMERIC(void);
-extern NCURSES_EXPORT(FIELDTYPE *) _nc_TYPE_REGEXP(void);
-extern NCURSES_EXPORT(FIELDTYPE *) _nc_TYPE_IPV4(void);
+extern FORM_EXPORT(FIELDTYPE *) _nc_TYPE_INTEGER(void);
+extern FORM_EXPORT(FIELDTYPE *) _nc_TYPE_ALNUM(void);
+extern FORM_EXPORT(FIELDTYPE *) _nc_TYPE_ALPHA(void);
+extern FORM_EXPORT(FIELDTYPE *) _nc_TYPE_ENUM(void);
+extern FORM_EXPORT(FIELDTYPE *) _nc_TYPE_NUMERIC(void);
+extern FORM_EXPORT(FIELDTYPE *) _nc_TYPE_REGEXP(void);
+extern FORM_EXPORT(FIELDTYPE *) _nc_TYPE_IPV4(void);
 
-extern NCURSES_EXPORT(FIELDTYPE *)
-_nc_generic_fieldtype(bool (*const field_check) (FORM*, 
-						 FIELD *, 
+extern FORM_EXPORT(FIELDTYPE *)
+_nc_generic_fieldtype(bool (*const field_check) (FORM*,
+						 FIELD *,
 						 const void *),
-		      bool (*const char_check)  (int, 
-						 FORM*, 
-						 FIELD*, 
+		      bool (*const char_check)  (int,
+						 FORM*,
+						 FIELD*,
 						 const void *),
 		      bool (*const next)(FORM*,FIELD*,const void*),
 		      bool (*const prev)(FORM*,FIELD*,const void*),
 		      void (*freecallback)(void*));
-extern NCURSES_EXPORT(int) _nc_set_generic_fieldtype(FIELD*, FIELDTYPE*, int (*)(void**));
-extern NCURSES_EXPORT(WINDOW*) _nc_form_cursor(const FORM* , int* , int* );
+extern FORM_EXPORT(int) _nc_set_generic_fieldtype(FIELD*, FIELDTYPE*, int (*)(void**));
+extern FORM_EXPORT(WINDOW*) _nc_form_cursor(const FORM* , int* , int* );
 
 #define INIT_FT_FUNC(func) {func}
 #else
 #define INIT_FT_FUNC(func) func
 #endif
 
-extern NCURSES_EXPORT(void) _nc_get_fieldbuffer(FORM*, FIELD*, FIELD_CELL*);
+extern FORM_EXPORT(void) _nc_get_fieldbuffer(FORM*, FIELD*, FIELD_CELL*);
 
 #if USE_WIDEC_SUPPORT
-extern NCURSES_EXPORT(wchar_t *) _nc_Widen_String(char *, int *);
+extern FORM_EXPORT(wchar_t *) _nc_Widen_String(char *, int *);
 #endif
 
 #ifdef TRACE
@@ -226,11 +230,11 @@
 #define returnFieldType(code)	TRACE_RETURN1(code,field_type)
 #define returnFormHook(code)	TRACE_RETURN1(code,form_hook)
 
-extern NCURSES_EXPORT(FIELD **)	    _nc_retrace_field_ptr (FIELD **);
-extern NCURSES_EXPORT(FIELD *)	    _nc_retrace_field (FIELD *);
-extern NCURSES_EXPORT(FIELDTYPE *)  _nc_retrace_field_type (FIELDTYPE *);
-extern NCURSES_EXPORT(FORM *)       _nc_retrace_form (FORM *);
-extern NCURSES_EXPORT(Form_Hook)    _nc_retrace_form_hook (Form_Hook);
+extern FORM_EXPORT(FIELD **)	    _nc_retrace_field_ptr (FIELD **);
+extern FORM_EXPORT(FIELD *)	    _nc_retrace_field (FIELD *);
+extern FORM_EXPORT(FIELDTYPE *)  _nc_retrace_field_type (FIELDTYPE *);
+extern FORM_EXPORT(FORM *)       _nc_retrace_form (FORM *);
+extern FORM_EXPORT(Form_Hook)    _nc_retrace_form_hook (Form_Hook);
 
 #else /* !TRACE */
 
diff --git a/form/frm_cursor.c b/form/frm_cursor.c
index 7a4cd16..a54b483 100644
--- a/form/frm_cursor.c
+++ b/form/frm_cursor.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc.              *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 1998-2004,2010 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,12 +33,12 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_cursor.c,v 1.10 2010/01/23 21:14:36 tom Exp $")
+MODULE_ID("$Id: frm_cursor.c,v 1.13 2021/06/17 21:20:30 tom Exp $")
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  int pos_form_cursor(FORM * form)
-|   
+|
 |   Description   :  Moves the form window cursor to the location required
 |                    by the form driver to resume form processing. This may
 |                    be needed after the application calls a curses library
@@ -48,7 +49,7 @@
 |                    E_BAD_ARGUMENT            - Invalid form pointer
 |                    E_NOT_POSTED              - Form is not posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 pos_form_cursor(FORM *form)
 {
   int res;
diff --git a/form/frm_data.c b/form/frm_data.c
index a936060..940c32d 100644
--- a/form/frm_data.c
+++ b/form/frm_data.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2010,2013 Free Software Foundation, Inc.              *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 1998-2010,2013 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,19 +33,19 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_data.c,v 1.16 2013/08/24 22:44:05 tom Exp $")
+MODULE_ID("$Id: frm_data.c,v 1.21 2021/06/17 21:11:08 tom Exp $")
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  bool data_behind(const FORM *form)
-|   
+|
 |   Description   :  Check for off-screen data behind. This is nearly trivial
 |                    because the beginning of a field is fixed.
 |
 |   Return Values :  TRUE   - there are off-screen data behind
 |                    FALSE  - there are no off-screen data behind
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(bool)
+FORM_EXPORT(bool)
 data_behind(const FORM *form)
 {
   bool result = FALSE;
@@ -69,12 +70,12 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  static char * Only_Padding(
 |                                    WINDOW *w,
 |                                    int len,
 |                                    int pad)
-|   
+|
 |   Description   :  Test if 'length' cells starting at the current position
 |                    contain a padding character.
 |
@@ -103,7 +104,7 @@
 		}
 	    }
 #else
-	  cell = (FIELD_CELL) winch(w);
+	  cell = (FIELD_CELL)winch(w);
 	  if (ChCharOf(cell) != ChCharOf(pad))
 	    {
 	      result = FALSE;
@@ -122,16 +123,16 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  bool data_ahead(const FORM *form)
-|   
+|
 |   Description   :  Check for off-screen data ahead. This is more difficult
-|                    because a dynamic field has a variable end. 
+|                    because a dynamic field has a variable end.
 |
 |   Return Values :  TRUE   - there are off-screen data ahead
 |                    FALSE  - there are no off-screen data ahead
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(bool)
+FORM_EXPORT(bool)
 data_ahead(const FORM *form)
 {
   bool result = FALSE;
@@ -149,12 +150,11 @@
 
       if (Single_Line_Field(field))
 	{
-	  int check_len;
-
 	  pos = form->begincol + field->cols;
 	  while (pos < field->dcols)
 	    {
-	      check_len = field->dcols - pos;
+	      int check_len = field->dcols - pos;
+
 	      if (check_len >= field->cols)
 		check_len = field->cols;
 	      cursor_moved = TRUE;
diff --git a/form/frm_def.c b/form/frm_def.c
index fd7b56a..a9f21f2 100644
--- a/form/frm_def.c
+++ b/form/frm_def.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 1998-2010,2012 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,7 +33,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_def.c,v 1.26 2012/03/11 00:37:16 tom Exp $")
+MODULE_ID("$Id: frm_def.c,v 1.30 2021/03/27 23:49:58 tom Exp $")
 
 /* this can't be readonly */
 static FORM default_form =
@@ -61,14 +62,14 @@
   NULL				/* fieldterm  */
 };
 
-NCURSES_EXPORT_VAR(FORM *) _nc_Default_Form = &default_form;
-
+FORM_EXPORT_VAR(FORM *) _nc_Default_Form = &default_form;
+
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  static FIELD *Insert_Field_By_Position(
-|                                     FIELD *new_field, 
+|                                     FIELD *new_field,
 |                                     FIELD *head )
-|   
+|
 |   Description   :  Insert new_field into sorted fieldlist with head "head"
 |                    and return new head of sorted fieldlist. Sorting
 |                    criteria is (row,column). This is a circular list.
@@ -112,9 +113,9 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  static void Disconnect_Fields(FORM *form)
-|   
+|
 |   Description   :  Break association between form and array of fields.
 |
 |   Return Values :  -
@@ -142,9 +143,9 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  static int Connect_Fields(FORM *form, FIELD **fields)
-|   
+|
 |   Description   :  Set association between form and array of fields.
 |
 |   Return Values :  E_OK            - no error
@@ -157,7 +158,6 @@
 {
   int field_cnt, j;
   int page_nr;
-  int maximum_row_in_field, maximum_col_in_field;
   _PAGE *pg;
 
   T((T_CALLED("Connect_Fields(%p,%p)"), (void *)form, (void *)fields));
@@ -198,15 +198,18 @@
      size of the form */
   for (j = 0; j < field_cnt; j++)
     {
+      int maximum_row_in_field;
+      int maximum_col_in_field;
+
       if (j == 0)
-	pg->pmin = (short) j;
+	pg->pmin = (short)j;
       else
 	{
 	  if (fields[j]->status & _NEWPAGE)
 	    {
-	      pg->pmax = (short) (j - 1);
+	      pg->pmax = (short)(j - 1);
 	      pg++;
-	      pg->pmin = (short) j;
+	      pg->pmin = (short)j;
 	    }
 	}
 
@@ -214,14 +217,14 @@
       maximum_col_in_field = fields[j]->fcol + fields[j]->cols;
 
       if (form->rows < maximum_row_in_field)
-	form->rows = (short) maximum_row_in_field;
+	form->rows = (short)maximum_row_in_field;
       if (form->cols < maximum_col_in_field)
-	form->cols = (short) maximum_col_in_field;
+	form->cols = (short)maximum_col_in_field;
     }
 
-  pg->pmax = (short) (field_cnt - 1);
-  form->maxfield = (short) field_cnt;
-  form->maxpage = (short) page_nr;
+  pg->pmax = (short)(field_cnt - 1);
+  form->maxfield = (short)field_cnt;
+  form->maxpage = (short)page_nr;
 
   /* Sort fields on form pages */
   for (page_nr = 0; page_nr < form->maxpage; page_nr++)
@@ -230,8 +233,8 @@
 
       for (j = form->page[page_nr].pmin; j <= form->page[page_nr].pmax; j++)
 	{
-	  fields[j]->index = (short) j;
-	  fields[j]->page = (short) page_nr;
+	  fields[j]->index = (short)j;
+	  fields[j]->page = (short)page_nr;
 	  fld = Insert_Field_By_Position(fields[j], fld);
 	}
       if (fld)
@@ -249,10 +252,10 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  static int Associate_Fields(FORM *form, FIELD **fields)
-|   
-|   Description   :  Set association between form and array of fields. 
+|
+|   Description   :  Set association between form and array of fields.
 |                    If there are fields, position to first active field.
 |
 |   Return Values :  E_OK            - success
@@ -282,9 +285,9 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  FORM *new_form_sp(SCREEN* sp, FIELD** fields )
-|   
+|
 |   Description   :  Create new form with given array of fields.
 |
 |   Return Values :  Pointer to form. NULL if error occurred.
@@ -294,7 +297,7 @@
 |                    E_CONNECTED     - a field is already connected
 |                    E_SYSTEM_ERROR  - not enough memory
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FORM *)
+FORM_EXPORT(FORM *)
 NCURSES_SP_NAME(new_form) (NCURSES_SP_DCLx FIELD **fields)
 {
   int err = E_SYSTEM_ERROR;
@@ -330,9 +333,9 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  FORM* new_form(FIELD** fields )
-|   
+|
 |   Description   :  Create new form with given array of fields.
 |
 |   Return Values :  Pointer to form. NULL if error occurred.
@@ -343,7 +346,7 @@
 |                    E_SYSTEM_ERROR  - not enough memory
 +--------------------------------------------------------------------------*/
 #if NCURSES_SP_FUNCS
-NCURSES_EXPORT(FORM *)
+FORM_EXPORT(FORM *)
 new_form(FIELD **fields)
 {
   return NCURSES_SP_NAME(new_form) (CURRENT_SCREEN, fields);
@@ -351,16 +354,16 @@
 #endif
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  int free_form( FORM *form )
-|   
+|
 |   Description   :  Release internal memory associated with form.
 |
 |   Return Values :  E_OK           - no error
 |                    E_BAD_ARGUMENT - invalid form pointer
 |                    E_POSTED       - form is posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 free_form(FORM *form)
 {
   T((T_CALLED("free_form(%p)"), (void *)form));
@@ -380,9 +383,9 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  int set_form_fields( FORM *form, FIELD **fields )
-|   
+|
 |   Description   :  Set a new association of an array of fields to a form
 |
 |   Return Values :  E_OK            - no error
@@ -391,7 +394,7 @@
 |                    E_POSTED        - form is posted
 |                    E_SYSTEM_ERROR  - not enough memory
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_form_fields(FORM *form, FIELD **fields)
 {
   FIELD **old;
@@ -415,14 +418,14 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  FIELD **form_fields( const FORM *form )
-|   
+|
 |   Description   :  Retrieve array of fields
 |
 |   Return Values :  Pointer to field array
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FIELD **)
+FORM_EXPORT(FIELD **)
 form_fields(const FORM *form)
 {
   T((T_CALLED("form_field(%p)"), (const void *)form));
@@ -430,14 +433,14 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  int field_count( const FORM *form )
-|   
+|
 |   Description   :  Retrieve number of fields
 |
 |   Return Values :  Number of fields, -1 if none are defined
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 field_count(const FORM *form)
 {
   T((T_CALLED("field_count(%p)"), (const void *)form));
diff --git a/form/frm_driver.c b/form/frm_driver.c
index eebde42..75656d6 100644
--- a/form/frm_driver.c
+++ b/form/frm_driver.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2013,2014 Free Software Foundation, Inc.              *
+ * Copyright 2018-2020,2021 Thomas E. Dickey                                *
+ * Copyright 1998-2016,2017 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            *
@@ -32,7 +33,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_driver.c,v 1.115 2014/09/25 21:55:24 tom Exp $")
+MODULE_ID("$Id: frm_driver.c,v 1.135 2021/09/01 23:34:01 tom Exp $")
 
 /*----------------------------------------------------------------------------
   This is the core module of the form library. It contains the majority
@@ -99,9 +100,9 @@
 #define GROW_IF_NAVIGATE (1)
 
 #if USE_WIDEC_SUPPORT
-#define myADDNSTR(w, s, n) wadd_wchnstr(w, s, n)
-#define myINSNSTR(w, s, n) wins_wchnstr(w, s, n)
-#define myINNSTR(w, s, n)  fix_wchnstr(w, s, n)
+#define myADDNSTR(w, s, n) wide_waddnstr(w, s, n)
+#define myINSNSTR(w, s, n) wide_winsnstr(w, s, n)
+#define myINNSTR(w, s, n)  wide_winnstr(w, s, n)
 #define myWCWIDTH(w, y, x) cell_width(w, y, x)
 #else
 #define myADDNSTR(w, s, n) waddnstr(w, s, n)
@@ -130,34 +131,34 @@
 /* Calculate the position of a single row in a field buffer */
 #define Position_Of_Row_In_Buffer(field,row) ((row)*(field)->dcols)
 
-/* Calculate start address for the fields buffer# N */
+/* Calculate start address for the field's buffer# N */
 #define Address_Of_Nth_Buffer(field,N) \
   ((field)->buf + (N)*(1+Buffer_Length(field)))
 
-/* Calculate the start address of the row in the fields specified buffer# N */
+/* Calculate the start address of the row in the field's specified buffer# N */
 #define Address_Of_Row_In_Nth_Buffer(field,N,row) \
   (Address_Of_Nth_Buffer(field,N) + Position_Of_Row_In_Buffer(field,row))
 
-/* Calculate the start address of the row in the fields primary buffer */
+/* Calculate the start address of the row in the field's primary buffer */
 #define Address_Of_Row_In_Buffer(field,row) \
   Address_Of_Row_In_Nth_Buffer(field,0,row)
 
-/* Calculate the start address of the row in the forms current field
+/* Calculate the start address of the row in the form's current field
    buffer# N */
 #define Address_Of_Current_Row_In_Nth_Buffer(form,N) \
    Address_Of_Row_In_Nth_Buffer((form)->current,N,(form)->currow)
 
-/* Calculate the start address of the row in the forms current field
+/* Calculate the start address of the row in the form's current field
    primary buffer */
 #define Address_Of_Current_Row_In_Buffer(form) \
    Address_Of_Current_Row_In_Nth_Buffer(form,0)
 
-/* Calculate the address of the cursor in the forms current field
+/* Calculate the address of the cursor in the form's current field
    primary buffer */
 #define Address_Of_Current_Position_In_Nth_Buffer(form,N) \
    (Address_Of_Current_Row_In_Nth_Buffer(form,N) + (form)->curcol)
 
-/* Calculate the address of the cursor in the forms current field
+/* Calculate the address of the cursor in the form's current field
    buffer# N */
 #define Address_Of_Current_Position_In_Buffer(form) \
   Address_Of_Current_Position_In_Nth_Buffer(form,0)
@@ -186,7 +187,7 @@
 /* Logic to determine whether or not a dynamic field may still grow */
 #define Growable(field) ((field)->status & _MAY_GROW)
 
-/* Macro to set the attributes for a fields window */
+/* Macro to set the attributes for a field's window */
 #define Set_Field_Window_Attributes(field,win) \
 (  wbkgdset((win),(chtype)((chtype)((field)->pad) | (field)->back)), \
    (void) wattrset((win), (int)(field)->fore) )
@@ -216,10 +217,10 @@
 static void
 check_pos(FORM *form, int lineno)
 {
-  int y, x;
-
   if (form && form->w)
     {
+      int y, x;
+
       getyx(form->w, y, x);
       if (y != form->currow || x != form->curcol)
 	{
@@ -239,15 +240,36 @@
   Wide-character special functions
   --------------------------------------------------------------------------*/
 #if USE_WIDEC_SUPPORT
-/* like winsnstr */
+/* add like waddnstr, but using cchar_t* rather than char*
+ */
 static int
-wins_wchnstr(WINDOW *w, cchar_t *s, int n)
+wide_waddnstr(WINDOW *w, const cchar_t *s, int n)
 {
-  int code = ERR;
-  int y, x;
+  int rc = OK;
 
   while (n-- > 0)
     {
+      if ((rc = wadd_wch(w, s)) != OK)
+	break;
+      ++s;
+    }
+  return rc;
+}
+
+/* insert like winsnstr, but using cchar_t* rather than char*
+ *
+ * X/Open Curses has no close equivalent; inserts are done only with wchar_t
+ * strings.
+ */
+static int
+wide_winsnstr(WINDOW *w, const cchar_t *s, int n)
+{
+  int code = ERR;
+
+  while (n-- > 0)
+    {
+      int y, x;
+
       getyx(w, y, x);
       if ((code = wins_wch(w, s++)) != OK)
 	break;
@@ -257,11 +279,13 @@
   return code;
 }
 
-/* win_wchnstr is inconsistent with winnstr, since it returns OK rather than
- * the number of items transferred.
+/* retrieve like winnstr, but using cchar_t*, rather than char*.
+ *
+ * X/Open Curses' closest equivalent, win_wchnstr(), is inconsistent with
+ * winnstr(), since it returns OK rather than the number of items transferred.
  */
 static int
-fix_wchnstr(WINDOW *w, cchar_t *s, int n)
+wide_winnstr(WINDOW *w, cchar_t *s, int n)
 {
   int x;
 
@@ -488,7 +512,6 @@
 {
   int width, height;
   int y, x;
-  int len;
   int row;
   FIELD_CELL *pBuffer;
 
@@ -502,6 +525,8 @@
        row < height;
        row++, pBuffer += width)
     {
+      int len;
+
       if ((len = (int)(After_End_Of_Data(pBuffer, width) - pBuffer)) > 0)
 	{
 	  wmove(win, row, 0);
@@ -525,7 +550,7 @@
 |
 |   Return Values :  -
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void)
+FORM_EXPORT(void)
 _nc_get_fieldbuffer(FORM *form, FIELD *field, FIELD_CELL *buf)
 {
   int pad;
@@ -683,8 +708,6 @@
 	   * realloc().
 	   */
 	  int i, j;
-	  FIELD_CELL *old_bp;
-	  FIELD_CELL *new_bp;
 
 	  result = TRUE;	/* allow sharing of recovery on failure */
 
@@ -692,8 +715,9 @@
 	  field->buf = newbuf;
 	  for (i = 0; i <= field->nbuf; i++)
 	    {
-	      new_bp = Address_Of_Nth_Buffer(field, i);
-	      old_bp = oldbuf + i * (1 + old_buflen);
+	      FIELD_CELL *new_bp = Address_Of_Nth_Buffer(field, i);
+	      FIELD_CELL *old_bp = oldbuf + i * (1 + old_buflen);
+
 	      for (j = 0; j < old_buflen; ++j)
 		new_bp[j] = old_bp[j];
 	      while (j < new_buflen)
@@ -803,7 +827,7 @@
 |                    E_SYSTEM_ERROR    - form has no current field or
 |                                        field-window
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 _nc_Position_Form_Cursor(FORM *form)
 {
   FIELD *field;
@@ -837,18 +861,20 @@
 |   Facility      :  libnform
 |   Function      :  int _nc_Refresh_Current_Field(FORM * form)
 |
-|   Description   :  Propagate the changes in the fields window to the
+|   Description   :  Propagate the changes in the field's window to the
 |                    window of the form.
 |
 |   Return Values :  E_OK              - on success
 |                    E_BAD_ARGUMENT    - invalid form pointer
 |                    E_SYSTEM_ERROR    - general error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+static bool move_after_insert = TRUE;
+FORM_EXPORT(int)
 _nc_Refresh_Current_Field(FORM *form)
 {
   WINDOW *formwin;
   FIELD *field;
+  bool is_public;
 
   T((T_CALLED("_nc_Refresh_Current_Field(%p)"), (void *)form));
 
@@ -861,102 +887,106 @@
   field = form->current;
   formwin = Get_Form_Window(form);
 
-  if (Field_Has_Option(field, O_PUBLIC))
+  is_public = Field_Has_Option(field, O_PUBLIC);
+
+  if (Is_Scroll_Field(field))
     {
-      if (Is_Scroll_Field(field))
+      /* Again, in this case the fieldwin isn't derived from formwin,
+         so we have to perform a copy operation. */
+      if (Single_Line_Field(field))
 	{
-	  /* Again, in this case the fieldwin isn't derived from formwin,
-	     so we have to perform a copy operation. */
-	  if (Single_Line_Field(field))
-	    {
-	      /* horizontal scrolling */
-	      if (form->curcol < form->begincol)
-		form->begincol = form->curcol;
-	      else
-		{
-		  if (form->curcol >= (form->begincol + field->cols))
-		    form->begincol = form->curcol - field->cols + 1;
-		}
-	      copywin(form->w,
-		      formwin,
-		      0,
-		      form->begincol,
-		      field->frow,
-		      field->fcol,
-		      field->frow,
-		      field->cols + field->fcol - 1,
-		      0);
-	    }
+	  /* horizontal scrolling */
+	  if (form->curcol < form->begincol)
+	    form->begincol = form->curcol;
 	  else
 	    {
-	      /* A multi-line, i.e. vertical scrolling field */
-	      int row_after_bottom, first_modified_row, first_unmodified_row;
-
-	      if (field->drows > field->rows)
-		{
-		  row_after_bottom = form->toprow + field->rows;
-		  if (form->currow < form->toprow)
-		    {
-		      form->toprow = form->currow;
-		      SetStatus(field, _NEWTOP);
-		    }
-		  if (form->currow >= row_after_bottom)
-		    {
-		      form->toprow = form->currow - field->rows + 1;
-		      SetStatus(field, _NEWTOP);
-		    }
-		  if (field->status & _NEWTOP)
-		    {
-		      /* means we have to copy whole range */
-		      first_modified_row = form->toprow;
-		      first_unmodified_row = first_modified_row + field->rows;
-		      ClrStatus(field, _NEWTOP);
-		    }
-		  else
-		    {
-		      /* we try to optimize : finding the range of touched
-		         lines */
-		      first_modified_row = form->toprow;
-		      while (first_modified_row < row_after_bottom)
-			{
-			  if (is_linetouched(form->w, first_modified_row))
-			    break;
-			  first_modified_row++;
-			}
-		      first_unmodified_row = first_modified_row;
-		      while (first_unmodified_row < row_after_bottom)
-			{
-			  if (!is_linetouched(form->w, first_unmodified_row))
-			    break;
-			  first_unmodified_row++;
-			}
-		    }
-		}
-	      else
-		{
-		  first_modified_row = form->toprow;
-		  first_unmodified_row = first_modified_row + field->rows;
-		}
-	      if (first_unmodified_row != first_modified_row)
-		copywin(form->w,
-			formwin,
-			first_modified_row,
-			0,
-			field->frow + first_modified_row - form->toprow,
-			field->fcol,
-			field->frow + first_unmodified_row - form->toprow - 1,
-			field->cols + field->fcol - 1,
-			0);
+	      if (form->curcol >= (form->begincol + field->cols))
+		form->begincol = form->curcol - field->cols
+		  + (move_after_insert ? 1 : 0);
 	    }
-	  wsyncup(formwin);
+	  if (is_public)
+	    copywin(form->w,
+		    formwin,
+		    0,
+		    form->begincol,
+		    field->frow,
+		    field->fcol,
+		    field->frow,
+		    field->cols + field->fcol - 1,
+		    0);
 	}
       else
 	{
-	  /* if the field-window is simply a derived window, i.e. contains no
-	   * invisible parts, the whole thing is trivial
-	   */
-	  wsyncup(form->w);
+	  /* A multi-line, i.e. vertical scrolling field */
+	  int first_modified_row, first_unmodified_row;
+
+	  if (field->drows > field->rows)
+	    {
+	      int row_after_bottom = form->toprow + field->rows;
+
+	      if (form->currow < form->toprow)
+		{
+		  form->toprow = form->currow;
+		  SetStatus(field, _NEWTOP);
+		}
+	      if (form->currow >= row_after_bottom)
+		{
+		  form->toprow = form->currow - field->rows + 1;
+		  SetStatus(field, _NEWTOP);
+		}
+	      if (field->status & _NEWTOP)
+		{
+		  /* means we have to copy whole range */
+		  first_modified_row = form->toprow;
+		  first_unmodified_row = first_modified_row + field->rows;
+		  ClrStatus(field, _NEWTOP);
+		}
+	      else
+		{
+		  /* we try to optimize : finding the range of touched
+		     lines */
+		  first_modified_row = form->toprow;
+		  while (first_modified_row < row_after_bottom)
+		    {
+		      if (is_linetouched(form->w, first_modified_row))
+			break;
+		      first_modified_row++;
+		    }
+		  first_unmodified_row = first_modified_row;
+		  while (first_unmodified_row < row_after_bottom)
+		    {
+		      if (!is_linetouched(form->w, first_unmodified_row))
+			break;
+		      first_unmodified_row++;
+		    }
+		}
+	    }
+	  else
+	    {
+	      first_modified_row = form->toprow;
+	      first_unmodified_row = first_modified_row + field->rows;
+	    }
+	  if (first_unmodified_row != first_modified_row && is_public)
+	    copywin(form->w,
+		    formwin,
+		    first_modified_row,
+		    0,
+		    field->frow + first_modified_row - form->toprow,
+		    field->fcol,
+		    field->frow + first_unmodified_row - form->toprow - 1,
+		    field->cols + field->fcol - 1,
+		    0);
 	}
+      if (is_public)
+	wsyncup(formwin);
+    }
+  else
+    {
+      /* if the field-window is simply a derived window, i.e. contains no
+       * invisible parts, the whole thing is trivial
+       */
+      if (is_public)
+	wsyncup(form->w);
     }
   untouchwin(form->w);
   returnCode(_nc_Position_Form_Cursor(form));
@@ -977,13 +1007,16 @@
 {
   FIELD_CELL *bp;
   int len;
-  int col = 0;
 
-  bp = Get_Start_Of_Data(field->buf, Buffer_Length(field));
+  bp = (Field_Has_Option(field, O_NO_LEFT_STRIP)
+	? field->buf
+	: Get_Start_Of_Data(field->buf, Buffer_Length(field)));
   len = (int)(After_End_Of_Data(field->buf, Buffer_Length(field)) - bp);
 
   if (len > 0)
     {
+      int col = 0;
+
       assert(win && (field->drows == 1));
 
       if (field->cols - len >= 0)
@@ -1021,9 +1054,14 @@
 Undo_Justification(FIELD *field, WINDOW *win)
 {
   FIELD_CELL *bp;
+  int y, x;
   int len;
 
-  bp = Get_Start_Of_Data(field->buf, Buffer_Length(field));
+  getyx(win, y, x);
+
+  bp = (Field_Has_Option(field, O_NO_LEFT_STRIP)
+	? field->buf
+	: Get_Start_Of_Data(field->buf, Buffer_Length(field)));
   len = (int)(After_End_Of_Data(field->buf, Buffer_Length(field)) - bp);
 
   if (len > 0)
@@ -1032,6 +1070,7 @@
       wmove(win, 0, 0);
       myADDNSTR(win, bp, len);
     }
+  wmove(win, y, x);
 }
 
 /*---------------------------------------------------------------------------
@@ -1204,7 +1243,6 @@
 {
   FIELD *linked_field;
   int res = E_OK;
-  int syncres;
 
   if (!field)
     return (E_BAD_ARGUMENT);
@@ -1216,6 +1254,8 @@
        (linked_field != field) && (linked_field != 0);
        linked_field = linked_field->link)
     {
+      int syncres;
+
       if (((syncres = Synchronize_Field(linked_field)) != E_OK) &&
 	  (res == E_OK))
 	res = syncres;
@@ -1227,7 +1267,7 @@
 |   Facility      :  libnform
 |   Function      :  int _nc_Synchronize_Attributes(FIELD * field)
 |
-|   Description   :  If a fields visual attributes have changed, this
+|   Description   :  If a field's visual attributes have changed, this
 |                    routine is called to propagate those changes to the
 |                    screen.
 |
@@ -1235,12 +1275,11 @@
 |                    E_BAD_ARGUMENT   - invalid field pointer
 |                    E_SYSTEM_ERROR   - some severe basic error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 _nc_Synchronize_Attributes(FIELD *field)
 {
   FORM *form;
   int res = E_OK;
-  WINDOW *formwin;
 
   T((T_CALLED("_nc_Synchronize_Attributes(%p)"), (void *)field));
 
@@ -1267,11 +1306,13 @@
 	    }
 	  else
 	    {
-	      formwin = Get_Form_Window(form);
+	      WINDOW *formwin = Get_Form_Window(form);
+
 	      copywin(form->w, formwin,
 		      0, 0,
 		      field->frow, field->fcol,
-		      field->rows - 1, field->cols - 1, 0);
+		      field->frow + field->rows - 1,
+		      field->fcol + field->cols - 1, 0);
 	      wsyncup(formwin);
 	      Buffer_To_Window(field, form->w);
 	      SetStatus(field, _NEWTOP);	/* fake refresh to paint all */
@@ -1292,7 +1333,7 @@
 |   Function      :  int _nc_Synchronize_Options(FIELD * field,
 |                                                Field_Options newopts)
 |
-|   Description   :  If a fields options have changed, this routine is
+|   Description   :  If a field's options have changed, this routine is
 |                    called to propagate these changes to the screen and
 |                    to really change the behavior of the field.
 |
@@ -1301,7 +1342,7 @@
 |                    E_CURRENT           - field is the current one
 |                    E_SYSTEM_ERROR      - some severe basic error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 _nc_Synchronize_Options(FIELD *field, Field_Options newopts)
 {
   Field_Options oldopts;
@@ -1391,6 +1432,57 @@
   returnCode(res);
 }
 
+/*
+ * Removes the focus from the current field of the form.
+ */
+void
+_nc_Unset_Current_Field(FORM *form)
+{
+  FIELD *field = form->current;
+
+  _nc_Refresh_Current_Field(form);
+  if (Field_Has_Option(field, O_PUBLIC))
+    {
+      if (field->drows > field->rows)
+	{
+	  if (form->toprow == 0)
+	    ClrStatus(field, _NEWTOP);
+	  else
+	    SetStatus(field, _NEWTOP);
+	}
+      else
+	{
+	  if (Justification_Allowed(field))
+	    {
+	      Window_To_Buffer(form, field);
+	      werase(form->w);
+	      Perform_Justification(field, form->w);
+	      if (Field_Has_Option(field, O_DYNAMIC_JUSTIFY) &&
+		  (form->w->_parent == 0))
+		{
+		  copywin(form->w,
+			  Get_Form_Window(form),
+			  0,
+			  0,
+			  field->frow,
+			  field->fcol,
+			  field->frow,
+			  field->cols + field->fcol - 1,
+			  0);
+		  wsyncup(Get_Form_Window(form));
+		}
+	      else
+		{
+		  wsyncup(form->w);
+		}
+	    }
+	}
+    }
+  delwin(form->w);
+  form->w = (WINDOW *)0;
+  form->current = 0;
+}
+
 /*---------------------------------------------------------------------------
 |   Facility      :  libnform
 |   Function      :  int _nc_Set_Current_Field(FORM  * form,
@@ -1403,7 +1495,7 @@
 |                    E_SYSTEM_ERROR    - some severe basic error
 |                    E_NOT_CONNECTED   - no fields are connected to the form
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 _nc_Set_Current_Field(FORM *form, FIELD *newfield)
 {
   FIELD *field;
@@ -1411,7 +1503,7 @@
 
   T((T_CALLED("_nc_Set_Current_Field(%p,%p)"), (void *)form, (void *)newfield));
 
-  if (!form || !newfield || !form->current || (newfield->form != form))
+  if (!form || !newfield || (newfield->form != form))
     returnCode(E_BAD_ARGUMENT);
 
   if ((form->status & _IN_DRIVER))
@@ -1425,51 +1517,10 @@
   if ((field != newfield) ||
       !(form->status & _POSTED))
     {
-      if ((form->w) &&
+      if (field && (form->w) &&
 	  (Field_Has_Option(field, O_VISIBLE)) &&
 	  (field->form->curpage == field->page))
-	{
-	  _nc_Refresh_Current_Field(form);
-	  if (Field_Has_Option(field, O_PUBLIC))
-	    {
-	      if (field->drows > field->rows)
-		{
-		  if (form->toprow == 0)
-		    ClrStatus(field, _NEWTOP);
-		  else
-		    SetStatus(field, _NEWTOP);
-		}
-	      else
-		{
-		  if (Justification_Allowed(field))
-		    {
-		      Window_To_Buffer(form, field);
-		      werase(form->w);
-		      Perform_Justification(field, form->w);
-		      if (Field_Has_Option(field, O_DYNAMIC_JUSTIFY) &&
-			  (form->w->_parent == 0))
-			{
-			  copywin(form->w,
-				  Get_Form_Window(form),
-				  0,
-				  0,
-				  field->frow,
-				  field->fcol,
-				  field->frow,
-				  field->cols + field->fcol - 1,
-				  0);
-			  wsyncup(Get_Form_Window(form));
-			}
-		      else
-			{
-			  wsyncup(form->w);
-			}
-		    }
-		}
-	    }
-	  delwin(form->w);
-	  form->w = (WINDOW *)0;
-	}
+	_nc_Unset_Current_Field(form);
 
       field = newfield;
 
@@ -2375,7 +2426,6 @@
   int datalen = (int)(After_End_Of_Data(bp, field->dcols) - bp);
   int freelen = field->dcols - datalen;
   int requiredlen = len + 1;
-  FIELD_CELL *split;
   int result = E_REQUEST_DENIED;
 
   if (freelen >= requiredlen)
@@ -2384,7 +2434,7 @@
       myINSNSTR(form->w, txt, len);
       wmove(form->w, row, len);
       myINSNSTR(form->w, &myBLANK, 1);
-      return E_OK;
+      result = E_OK;
     }
   else
     {
@@ -2400,6 +2450,8 @@
 
       if (row < (field->drows - 1))
 	{
+	  FIELD_CELL *split;
+
 	  split =
 	    After_Last_Whitespace_Character(bp,
 					    (int)(Get_Start_Of_Data(bp
@@ -2423,8 +2475,8 @@
 	      return E_OK;
 	    }
 	}
-      return (result);
     }
+  return (result);
 }
 
 /*---------------------------------------------------------------------------
@@ -3178,7 +3230,7 @@
 |   Return Values :  TRUE  - field is valid
 |                    FALSE - field is invalid
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(bool)
+FORM_EXPORT(bool)
 _nc_Internal_Validation(FORM *form)
 {
   FIELD *field;
@@ -3237,7 +3289,7 @@
 |
 |   Description   :  Get the next field after the given field on the current
 |                    page. The order of fields is the one defined by the
-|                    fields array. Only visible and active fields are
+|                    field's array. Only visible and active fields are
 |                    counted.
 |
 |   Return Values :  Pointer to the next field.
@@ -3272,7 +3324,7 @@
 |
 |   Return Values :  Pointer to calculated field.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FIELD *)
+FORM_EXPORT(FIELD *)
 _nc_First_Active_Field(FORM *form)
 {
   FIELD **last_on_page = &form->field[form->page[form->curpage].pmax];
@@ -3320,7 +3372,7 @@
 |
 |   Description   :  Get the previous field before the given field on the
 |                    current page. The order of fields is the one defined by
-|                    the fields array. Only visible and active fields are
+|                    the field's array. Only visible and active fields are
 |                    counted.
 |
 |   Return Values :  Pointer to the previous field.
@@ -3454,10 +3506,10 @@
 |   Function      :  static FIELD *Upper_Neighbor_Field(FIELD * field)
 |
 |   Description   :  Because of the row-major nature of sorting the fields,
-|                    it is more difficult to define whats the upper neighbor
+|                    it is more difficult to define what the upper neighbor
 |                    field really means. We define that it must be on a
 |                    'previous' line (cyclic order!) and is the rightmost
-|                    field laying on the left side of the given field. If
+|                    field lying on the left side of the given field. If
 |                    this set is empty, we take the first field on the line.
 |
 |   Return Values :  Pointer to the upper neighbor field.
@@ -3504,7 +3556,7 @@
 |   Function      :  static FIELD *Down_Neighbor_Field(FIELD * field)
 |
 |   Description   :  Because of the row-major nature of sorting the fields,
-|                    its more difficult to define whats the down neighbor
+|                    it is more difficult to define what the down neighbor
 |                    field really means. We define that it must be on a
 |                    'next' line (cyclic order!) and is the leftmost
 |                    field laying on the right side of the given field. If
@@ -3826,7 +3878,7 @@
 |                    E_BAD_ARGUMENT      - invalid field pointer
 |                    E_SYSTEM_ERROR      - some severe basic error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 _nc_Set_Form_Page(FORM *form, int page, FIELD *field)
 {
   int res = E_OK;
@@ -3905,7 +3957,7 @@
 |                    that the field is left and a new field is entered.
 |                    So the field must be validated and the field init/term
 |                    hooks must be called. Because also the page is changed,
-|                    the forms init/term hooks must be called also.
+|                    the form's init/term hooks must be called also.
 |
 |   Return Values :  E_OK                - success
 |                    E_INVALID_FIELD     - field is invalid
@@ -4030,7 +4082,7 @@
       cchar_t temp_ch;
 
       given[0] = c;
-      given[1] = 1;
+      given[1] = 0;
       setcchar(&temp_ch, given, 0, 0, (void *)0);
       if ((Field_Has_Option(field, O_BLANK)) &&
 	  First_Position_In_Current_Field(form) &&
@@ -4143,6 +4195,12 @@
 	  bool End_Of_Field = (((field->drows - 1) == form->currow) &&
 			       ((field->dcols - 1) == form->curcol));
 
+	  if (Field_Has_Option(field, O_EDGE_INSERT_STAY))
+	    move_after_insert = !!(form->curcol
+				   - form->begincol
+				   - field->cols
+				   + 1);
+
 	  SetStatus(form, _WINDOW_MODIFIED);
 	  if (End_Of_Field && !Growable(field) && (Field_Has_Option(field, O_AUTOSKIP)))
 	    result = Inter_Field_Navigation(FN_Next_Field, form);
@@ -4301,18 +4359,20 @@
 |                    E_NOT_CONNECTED   - no fields are connected to the form
 |                    E_UNKNOWN_COMMAND - command not known
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 form_driver(FORM *form, int c)
 {
-  const Binding_Info *BI = (Binding_Info *) 0;
+  const Binding_Info *BI = (Binding_Info *)0;
   int res = E_UNKNOWN_COMMAND;
 
+  move_after_insert = TRUE;
+
   T((T_CALLED("form_driver(%p,%d)"), (void *)form, c));
 
   if (!form)
     RETURN(E_BAD_ARGUMENT);
 
-  if (!(form->field))
+  if (!(form->field) || !(form->current))
     RETURN(E_NOT_CONNECTED);
 
   assert(form->page);
@@ -4357,7 +4417,7 @@
 	NULL			/* Choice Request is generic           */
       };
       size_t nMethods = (sizeof(Generic_Methods) / sizeof(Generic_Methods[0]));
-      size_t method = (size_t) ((BI->keycode >> ID_Shft) & 0xffff);	/* see ID_Mask */
+      size_t method = (size_t)((BI->keycode >> ID_Shft) & 0xffff);	/* see ID_Mask */
 
       if ((method >= nMethods) || !(BI->cmd))
 	res = E_SYSTEM_ERROR;
@@ -4419,14 +4479,13 @@
 		}
 	      else if (wenclose(sub, event.y, event.x))
 		{		/* Inside the area we try to find the hit item */
-		  int i;
-
 		  ry = event.y;
 		  rx = event.x;
 		  if (wmouse_trafo(sub, &ry, &rx, FALSE))
 		    {
 		      int min_field = form->page[form->curpage].pmin;
 		      int max_field = form->page[form->curpage].pmax;
+		      int i;
 
 		      for (i = min_field; i <= max_field; ++i)
 			{
@@ -4506,10 +4565,10 @@
 |                    E_NOT_CONNECTED   - no fields are connected to the form
 |                    E_UNKNOWN_COMMAND - command not known
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 form_driver_w(FORM *form, int type, wchar_t c)
 {
-  const Binding_Info *BI = (Binding_Info *) 0;
+  const Binding_Info *BI = (Binding_Info *)0;
   int res = E_UNKNOWN_COMMAND;
 
   T((T_CALLED("form_driver(%p,%d)"), (void *)form, (int)c));
@@ -4563,7 +4622,7 @@
 	NULL			/* Choice Request is generic           */
       };
       size_t nMethods = (sizeof(Generic_Methods) / sizeof(Generic_Methods[0]));
-      size_t method = (size_t) (BI->keycode >> ID_Shft) & 0xffff;	/* see ID_Mask */
+      size_t method = (size_t)(BI->keycode >> ID_Shft) & 0xffff;	/* see ID_Mask */
 
       if ((method >= nMethods) || !(BI->cmd))
 	res = E_SYSTEM_ERROR;
@@ -4621,14 +4680,13 @@
 		}
 	      else if (wenclose(sub, event.y, event.x))
 		{		/* Inside the area we try to find the hit item */
-		  int i;
-
 		  ry = event.y;
 		  rx = event.x;
 		  if (wmouse_trafo(sub, &ry, &rx, FALSE))
 		    {
 		      int min_field = form->page[form->curpage].pmin;
 		      int max_field = form->page[form->curpage].pmax;
+		      int i;
 
 		      for (i = min_field; i <= max_field; ++i)
 			{
@@ -4681,14 +4739,14 @@
 |                    For dynamic fields this may grow the fieldbuffers if
 |                    the length of the value exceeds the current buffer
 |                    length. For buffer 0 only printable values are allowed.
-|                    For static fields, the value needs not to be zero ter-
-|                    minated. It is copied up to the length of the buffer.
+|                    For static fields, the value must not be zero terminated.
+|                    It is copied up to the length of the buffer.
 |
 |   Return Values :  E_OK            - success
 |                    E_BAD_ARGUMENT  - invalid argument
 |                    E_SYSTEM_ERROR  - system error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_field_buffer(FIELD *field, int buffer, const char *value)
 {
   FIELD_CELL *p;
@@ -4805,7 +4863,7 @@
 |
 |   Return Values :  Pointer to buffer or NULL if arguments were invalid.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(char *)
+FORM_EXPORT(char *)
 field_buffer(const FIELD *field, int buffer)
 {
   char *result = 0;
@@ -4873,7 +4931,7 @@
 | Convert a multibyte string to a wide-character string.  The result must be
 | freed by the caller.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(wchar_t *)
+FORM_EXPORT(wchar_t *)
 _nc_Widen_String(char *source, int *lengthp)
 {
   wchar_t *result = 0;
@@ -4917,7 +4975,7 @@
 		{
 		  result[need] = wch;
 		}
-	      passed += (size_t) status;
+	      passed += (size_t)status;
 	      ++need;
 	    }
 	  else
diff --git a/form/frm_hook.c b/form/frm_hook.c
index 23850bf..39d4d22 100644
--- a/form/frm_hook.c
+++ b/form/frm_hook.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
+ * Copyright 2018,2020 Thomas E. Dickey                                     *
+ * Copyright 1998-2012,2016 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,20 +33,21 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_hook.c,v 1.16 2012/03/11 00:37:16 tom Exp $")
+MODULE_ID("$Id: frm_hook.c,v 1.20 2020/05/24 01:40:20 anonymous.maarten Exp $")
 
 /* "Template" macro to generate function to set application specific hook */
 #define GEN_HOOK_SET_FUNCTION( typ, name ) \
-NCURSES_IMPEXP int NCURSES_API set_ ## typ ## _ ## name (FORM *form, Form_Hook func)\
+FORM_IMPEXP int NCURSES_API set_ ## typ ## _ ## name (FORM *form, Form_Hook func)\
 {\
-   T((T_CALLED("set_" #typ"_"#name"(%p,%p)"), (void *) form, func));\
+   TR_FUNC_BFR(1); \
+   T((T_CALLED("set_" #typ"_"#name"(%p,%s)"), (void *) form, TR_FUNC_ARG(0, func)));\
    (Normalize_Form( form ) -> typ ## name) = func ;\
    RETURN(E_OK);\
 }
 
 /* "Template" macro to generate function to get application specific hook */
 #define GEN_HOOK_GET_FUNCTION( typ, name ) \
-NCURSES_IMPEXP Form_Hook NCURSES_API typ ## _ ## name ( const FORM *form )\
+FORM_IMPEXP Form_Hook NCURSES_API typ ## _ ## name ( const FORM *form )\
 {\
    T((T_CALLED(#typ "_" #name "(%p)"), (const void *) form));\
    returnFormHook( Normalize_Form( form ) -> typ ## name );\
diff --git a/form/frm_opts.c b/form/frm_opts.c
index 42d6267..62e2beb 100644
--- a/form/frm_opts.c
+++ b/form/frm_opts.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2012,2013 Free Software Foundation, Inc.              *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 1998-2012,2013 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,24 +33,24 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_opts.c,v 1.17 2013/08/24 22:58:47 tom Exp $")
+MODULE_ID("$Id: frm_opts.c,v 1.21 2021/06/17 21:20:30 tom Exp $")
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  int set_form_opts(FORM *form, Form_Options opts)
-|   
+|
 |   Description   :  Turns on the named options and turns off all the
 |                    remaining options for that form.
 |
 |   Return Values :  E_OK              - success
 |                    E_BAD_ARGUMENT    - invalid options
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_form_opts(FORM *form, Form_Options opts)
 {
   T((T_CALLED("set_form_opts(%p,%d)"), (void *)form, opts));
 
-  opts &= (Form_Options) ALL_FORM_OPTS;
+  opts &= (Form_Options)ALL_FORM_OPTS;
   if ((unsigned)opts & ~ALL_FORM_OPTS)
     RETURN(E_BAD_ARGUMENT);
   else
@@ -60,36 +61,36 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  Form_Options form_opts(const FORM *)
-|   
+|
 |   Description   :  Retrieves the current form options.
 |
 |   Return Values :  The option flags.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(Form_Options)
+FORM_EXPORT(Form_Options)
 form_opts(const FORM *form)
 {
   T((T_CALLED("form_opts(%p)"), (const void *)form));
-  returnCode((Form_Options) ((unsigned)Normalize_Form(form)->opts & ALL_FORM_OPTS));
+  returnCode((Form_Options)((unsigned)Normalize_Form(form)->opts & ALL_FORM_OPTS));
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  int form_opts_on(FORM *form, Form_Options opts)
-|   
-|   Description   :  Turns on the named options; no other options are 
+|
+|   Description   :  Turns on the named options; no other options are
 |                    changed.
 |
-|   Return Values :  E_OK            - success 
+|   Return Values :  E_OK            - success
 |                    E_BAD_ARGUMENT  - invalid options
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 form_opts_on(FORM *form, Form_Options opts)
 {
   T((T_CALLED("form_opts_on(%p,%d)"), (void *)form, opts));
 
-  opts &= (Form_Options) ALL_FORM_OPTS;
+  opts &= (Form_Options)ALL_FORM_OPTS;
   if ((unsigned)opts & ~ALL_FORM_OPTS)
     RETURN(E_BAD_ARGUMENT);
   else
@@ -100,21 +101,21 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  int form_opts_off(FORM *form, Form_Options opts)
-|   
-|   Description   :  Turns off the named options; no other options are 
+|
+|   Description   :  Turns off the named options; no other options are
 |                    changed.
 |
-|   Return Values :  E_OK            - success 
+|   Return Values :  E_OK            - success
 |                    E_BAD_ARGUMENT  - invalid options
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 form_opts_off(FORM *form, Form_Options opts)
 {
   T((T_CALLED("form_opts_off(%p,%d)"), (void *)form, opts));
 
-  opts &= (Form_Options) ALL_FORM_OPTS;
+  opts &= (Form_Options)ALL_FORM_OPTS;
   if ((unsigned)opts & ~ALL_FORM_OPTS)
     RETURN(E_BAD_ARGUMENT);
   else
diff --git a/form/frm_page.c b/form/frm_page.c
index 13520da..ee8dd38 100644
--- a/form/frm_page.c
+++ b/form/frm_page.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 1998-2010,2012 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,12 +33,12 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_page.c,v 1.12 2012/06/10 00:28:04 tom Exp $")
+MODULE_ID("$Id: frm_page.c,v 1.15 2021/06/17 21:20:30 tom Exp $")
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  int set_form_page(FORM * form,int  page)
-|   
+|
 |   Description   :  Set the page number of the form.
 |
 |   Return Values :  E_OK              - success
@@ -46,7 +47,7 @@
 |                    E_INVALID_FIELD   - current field can't be left
 |                    E_SYSTEM_ERROR    - system error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_form_page(FORM *form, int page)
 {
   int err = E_OK;
@@ -87,15 +88,15 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  int form_page(const FORM * form)
-|   
+|
 |   Description   :  Return the current page of the form.
 |
 |   Return Values :  >= 0  : current page number
 |                    -1    : invalid form pointer
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 form_page(const FORM *form)
 {
   T((T_CALLED("form_page(%p)"), (const void *)form));
diff --git a/form/frm_post.c b/form/frm_post.c
index 31568b2..ab88089 100644
--- a/form/frm_post.c
+++ b/form/frm_post.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
+ * Copyright 2020 Thomas E. Dickey                                          *
+ * Copyright 1998-2010,2012 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,12 +33,12 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_post.c,v 1.11 2012/06/10 00:27:49 tom Exp $")
+MODULE_ID("$Id: frm_post.c,v 1.14 2020/05/24 01:40:20 anonymous.maarten Exp $")
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  int post_form(FORM * form)
-|   
+|
 |   Description   :  Writes the form into its associated subwindow.
 |
 |   Return Values :  E_OK              - success
@@ -47,7 +48,7 @@
 |                    E_NO_ROOM         - form doesn't fit into subwindow
 |                    E_SYSTEM_ERROR    - system error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 post_form(FORM *form)
 {
   WINDOW *formwin;
@@ -69,7 +70,7 @@
   if ((form->cols > getmaxx(formwin)) || (form->rows > getmaxy(formwin)))
     RETURN(E_NO_ROOM);
 
-  /* reset form->curpage to an invald value. This forces Set_Form_Page
+  /* reset form->curpage to an invalid value. This forces Set_Form_Page
      to do the page initialization which is required by post_form.
    */
   page = form->curpage;
@@ -87,9 +88,9 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  int unpost_form(FORM * form)
-|   
+|
 |   Description   :  Erase form from its associated subwindow.
 |
 |   Return Values :  E_OK            - success
@@ -97,7 +98,7 @@
 |                    E_NOT_POSTED    - form isn't posted
 |                    E_BAD_STATE     - called from a hook routine
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 unpost_form(FORM *form)
 {
   T((T_CALLED("unpost_form(%p)"), (void *)form));
diff --git a/form/frm_req_name.c b/form/frm_req_name.c
index 5686b22..8b76a8e 100644
--- a/form/frm_req_name.c
+++ b/form/frm_req_name.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2012,2015 Free Software Foundation, Inc.              *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 1998-2012,2015 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -37,7 +38,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_req_name.c,v 1.19 2015/04/04 17:11:46 tom Exp $")
+MODULE_ID("$Id: frm_req_name.c,v 1.23 2021/06/17 21:11:08 tom Exp $")
 
 #define DATA(s) { s }
 
@@ -111,15 +112,15 @@
 #define A_SIZE (sizeof(request_names)/sizeof(request_names[0]))
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  const char * form_request_name (int request);
-|   
+|
 |   Description   :  Get the external name of a form request.
 |
 |   Return Values :  Pointer to name      - on success
 |                    NULL                 - on invalid request code
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(const char *)
+FORM_EXPORT(const char *)
 form_request_name(int request)
 {
   T((T_CALLED("form_request_name(%d)"), request));
@@ -134,27 +135,28 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  int form_request_by_name (const char *str);
-|   
+|
 |   Description   :  Search for a request with this name.
 |
 |   Return Values :  Request Id       - on success
 |                    E_NO_MATCH       - request not found
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 form_request_by_name(const char *str)
 {
   /* because the table is so small, it doesn't really hurt
      to run sequentially through it.
    */
   size_t i = 0;
-  char buf[16];			/* longest name is 10 chars */
 
   T((T_CALLED("form_request_by_name(%s)"), _nc_visbuf(str)));
 
   if (str != 0 && (i = strlen(str)) != 0)
     {
+      char buf[16];		/* longest name is 10 chars */
+
       if (i > sizeof(buf) - 2)
 	i = sizeof(buf) - 2;
       memcpy(buf, str, i);
diff --git a/form/frm_scale.c b/form/frm_scale.c
index 27e154e..d53798e 100644
--- a/form/frm_scale.c
+++ b/form/frm_scale.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc.              *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 1998-2004,2010 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,19 +33,19 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_scale.c,v 1.10 2010/01/23 21:14:36 tom Exp $")
+MODULE_ID("$Id: frm_scale.c,v 1.13 2021/06/17 21:20:30 tom Exp $")
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  int scale_form( const FORM *form, int *rows, int *cols )
-|   
+|
 |   Description   :  Retrieve size of form
 |
 |   Return Values :  E_OK              - no error
 |                    E_BAD_ARGUMENT    - invalid form pointer
 |                    E_NOT_CONNECTED   - no fields connected to form
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 scale_form(const FORM *form, int *rows, int *cols)
 {
   T((T_CALLED("scale_form(%p,%p,%p)"),
diff --git a/form/frm_sub.c b/form/frm_sub.c
index 1ab131a..8f1de09 100644
--- a/form/frm_sub.c
+++ b/form/frm_sub.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 1998-2009,2010 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,18 +33,18 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_sub.c,v 1.12 2010/01/23 21:14:36 tom Exp $")
+MODULE_ID("$Id: frm_sub.c,v 1.15 2021/06/17 21:20:30 tom Exp $")
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  int set_form_sub(FORM *form, WINDOW *win)
-|   
-|   Description   :  Set the subwindow of the form to win. 
+|
+|   Description   :  Set the subwindow of the form to win.
 |
 |   Return Values :  E_OK       - success
 |                    E_POSTED   - form is posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_form_sub(FORM *form, WINDOW *win)
 {
   T((T_CALLED("set_form_sub(%p,%p)"), (void *)form, (void *)win));
@@ -65,14 +66,14 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  WINDOW *form_sub(const FORM *)
-|   
+|
 |   Description   :  Retrieve the window of the form.
 |
 |   Return Values :  The pointer to the Subwindow.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(WINDOW *)
+FORM_EXPORT(WINDOW *)
 form_sub(const FORM *form)
 {
   const FORM *f;
diff --git a/form/frm_user.c b/form/frm_user.c
index 1375b5e..a4a2249 100644
--- a/form/frm_user.c
+++ b/form/frm_user.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2004,2010 Free Software Foundation, Inc.              *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 1998-2004,2010 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,18 +33,18 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_user.c,v 1.15 2010/01/23 21:14:36 tom Exp $")
+MODULE_ID("$Id: frm_user.c,v 1.19 2021/06/17 21:20:30 tom Exp $")
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  int set_form_userptr(FORM *form, void *usrptr)
-|   
+|
 |   Description   :  Set the pointer that is reserved in any form to store
-|                    application relevant informations
+|                    application relevant information.
 |
 |   Return Values :  E_OK         - on success
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_form_userptr(FORM *form, void *usrptr)
 {
   T((T_CALLED("set_form_userptr(%p,%p)"), (void *)form, (void *)usrptr));
@@ -53,16 +54,16 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  void *form_userptr(const FORM *form)
-|   
+|
 |   Description   :  Return the pointer that is reserved in any form to
-|                    store application relevant informations.
+|                    store application relevant information.
 |
 |   Return Values :  Value of pointer. If no such pointer has been set,
 |                    NULL is returned
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(void *)
+FORM_EXPORT(void *)
 form_userptr(const FORM *form)
 {
   T((T_CALLED("form_userptr(%p)"), (const void *)form));
diff --git a/form/frm_win.c b/form/frm_win.c
index a65cc59..eeea27d 100644
--- a/form/frm_win.c
+++ b/form/frm_win.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 1998-2009,2010 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -32,18 +33,18 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: frm_win.c,v 1.16 2010/01/23 21:14:36 tom Exp $")
+MODULE_ID("$Id: frm_win.c,v 1.19 2021/06/17 21:20:30 tom Exp $")
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  int set_form_win(FORM *form,WINDOW *win)
-|   
-|   Description   :  Set the window of the form to win. 
+|
+|   Description   :  Set the window of the form to win.
 |
 |   Return Values :  E_OK       - success
 |                    E_POSTED   - form is posted
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 set_form_win(FORM *form, WINDOW *win)
 {
   T((T_CALLED("set_form_win(%p,%p)"), (void *)form, (void *)win));
@@ -65,14 +66,14 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  WINDOW *form_win(const FORM *)
-|   
+|
 |   Description   :  Retrieve the window of the form.
 |
 |   Return Values :  The pointer to the Window or stdscr if there is none.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(WINDOW *)
+FORM_EXPORT(WINDOW *)
 form_win(const FORM *form)
 {
   WINDOW *result;
diff --git a/form/fty_alnum.c b/form/fty_alnum.c
index cda23dc..854dc33 100644
--- a/form/fty_alnum.c
+++ b/form/fty_alnum.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright 2020 Thomas E. Dickey                                          *
+ * Copyright 1998-2009,2010 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -34,7 +35,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fty_alnum.c,v 1.24 2010/01/23 21:14:36 tom Exp $")
+MODULE_ID("$Id: fty_alnum.c,v 1.29 2020/12/12 01:15:37 tom Exp $")
 
 #define thisARG alnumARG
 
@@ -55,7 +56,7 @@
 static void *
 Generic_This_Type(void *arg)
 {
-  thisARG *argp = (thisARG *) 0;
+  thisARG *argp = (thisARG *)0;
 
   if (arg)
     {
@@ -139,7 +140,7 @@
 Check_This_Character(int c, const void *argp GCC_UNUSED)
 {
 #if USE_WIDEC_SUPPORT
-  if (iswalnum((wint_t) c))
+  if (iswalnum((wint_t)c))
     return TRUE;
 #endif
   return (isalnum(UChar(c)) ? TRUE : FALSE);
@@ -185,14 +186,14 @@
 #endif
 };
 
-NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_ALNUM = &typeTHIS;
+FORM_EXPORT_VAR(FIELDTYPE *) TYPE_ALNUM = &typeTHIS;
 
 #if NCURSES_INTEROP_FUNCS
 /* The next routines are to simplify the use of ncurses from
-   programming languages with restictions on interop with C level
+   programming languages with restrictions on interop with C level
    constructs (e.g. variable access or va_list + ellipsis constructs)
 */
-NCURSES_EXPORT(FIELDTYPE *)
+FORM_EXPORT(FIELDTYPE *)
 _nc_TYPE_ALNUM(void)
 {
   return TYPE_ALNUM;
diff --git a/form/fty_alpha.c b/form/fty_alpha.c
index 917a9e0..a37459a 100644
--- a/form/fty_alpha.c
+++ b/form/fty_alpha.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright 2020 Thomas E. Dickey                                          *
+ * Copyright 1998-2009,2010 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -34,7 +35,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fty_alpha.c,v 1.26 2010/01/23 21:14:36 tom Exp $")
+MODULE_ID("$Id: fty_alpha.c,v 1.31 2020/12/12 01:15:37 tom Exp $")
 
 #define thisARG alphaARG
 
@@ -55,7 +56,7 @@
 static void *
 Generic_This_Type(void *arg)
 {
-  thisARG *argp = (thisARG *) 0;
+  thisARG *argp = (thisARG *)0;
 
   if (arg)
     {
@@ -139,7 +140,7 @@
 Check_This_Character(int c, const void *argp GCC_UNUSED)
 {
 #if USE_WIDEC_SUPPORT
-  if (iswalpha((wint_t) c))
+  if (iswalpha((wint_t)c))
     return TRUE;
 #endif
   return (isalpha(UChar(c)) ? TRUE : FALSE);
@@ -185,14 +186,14 @@
 #endif
 };
 
-NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_ALPHA = &typeTHIS;
+FORM_EXPORT_VAR(FIELDTYPE *) TYPE_ALPHA = &typeTHIS;
 
 #if NCURSES_INTEROP_FUNCS
 /* The next routines are to simplify the use of ncurses from
-   programming languages with restictions on interop with C level
+   programming languages with restrictions on interop with C level
    constructs (e.g. variable access or va_list + ellipsis constructs)
 */
-NCURSES_EXPORT(FIELDTYPE *)
+FORM_EXPORT(FIELDTYPE *)
 _nc_TYPE_ALPHA(void)
 {
   return TYPE_ALPHA;
diff --git a/form/fty_enum.c b/form/fty_enum.c
index d335164..16ffae1 100644
--- a/form/fty_enum.c
+++ b/form/fty_enum.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.              *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 1998-2009,2010 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -34,7 +35,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fty_enum.c,v 1.26 2010/05/01 21:11:07 tom Exp $")
+MODULE_ID("$Id: fty_enum.c,v 1.33 2021/06/17 21:11:08 tom Exp $")
 
 typedef struct
   {
@@ -54,9 +55,9 @@
 enumParams;
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  static void *Generic_Enum_Type(void * arg)
-|   
+|
 |   Description   :  Allocate structure for enumeration type argument.
 |
 |   Return Values :  Pointer to argument structure or NULL on error
@@ -65,7 +66,7 @@
 Generic_Enum_Type(void *arg)
 {
   enumARG *argp = (enumARG *)0;
-  enumParams *params = (enumParams *) arg;
+  enumParams *params = (enumParams *)arg;
 
   if (params)
     {
@@ -76,7 +77,6 @@
 	  int cnt = 0;
 	  char **kp = (char **)0;
 	  char **kwds = (char **)0;
-	  char **kptarget;
 	  int ccase, cunique;
 
 	  T((T_CREATE("enumARG %p"), (void *)argp));
@@ -95,6 +95,8 @@
 
 	  if (cnt > 0)
 	    {
+	      char **kptarget;
+
 	      /* We copy the keywords, because we can't rely on the fact
 	         that the caller doesn't relocate or free the memory used
 	         for the keywords (maybe he has GC)
@@ -117,9 +119,9 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  static void *Make_Enum_Type( va_list * ap )
-|   
+|
 |   Description   :  Allocate structure for enumeration type argument.
 |
 |   Return Values :  Pointer to argument structure or NULL on error
@@ -137,10 +139,10 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  static void *Copy_Enum_Type( const void * argp )
-|   
-|   Description   :  Copy structure for enumeration type argument.  
+|
+|   Description   :  Copy structure for enumeration type argument.
 |
 |   Return Values :  Pointer to argument structure or NULL on error.
 +--------------------------------------------------------------------------*/
@@ -181,9 +183,9 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  static void Free_Enum_Type( void * argp )
-|   
+|
 |   Description   :  Free structure for enumeration type argument.
 |
 |   Return Values :  -
@@ -218,11 +220,11 @@
 #define EXACT   2
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
-|   Function      :  static int Compare(const unsigned char * s,  
+|   Facility      :  libnform
+|   Function      :  static int Compare(const unsigned char * s,
 |                                       const unsigned char * buf,
 |                                       bool  ccase )
-|   
+|
 |   Description   :  Check whether or not the text in 'buf' matches the
 |                    text in 's', at least partial.
 |
@@ -273,11 +275,11 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  static bool Check_Enum_Field(
 |                                      FIELD * field,
 |                                      const void  * argp)
-|   
+|
 |   Description   :  Validate buffer content to be a valid enumeration value
 |
 |   Return Values :  TRUE  - field is valid
@@ -291,10 +293,11 @@
   bool unique = ((const enumARG *)argp)->checkunique;
   unsigned char *bp = (unsigned char *)field_buffer(field, 0);
   char *s, *t, *p;
-  int res;
 
   while (kwds && (s = (*kwds++)))
     {
+      int res;
+
       if ((res = Compare((unsigned char *)s, bp, ccase)) != NOMATCH)
 	{
 	  p = t = s;		/* t is at least a partial match */
@@ -330,10 +333,10 @@
 {(char *)0};
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  static bool Next_Enum(FIELD * field,
 |                                          const void * argp)
-|   
+|
 |   Description   :  Check for the next enumeration value
 |
 |   Return Values :  TRUE  - next value found and loaded
@@ -367,11 +370,11 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  static bool Previous_Enum(
 |                                          FIELD * field,
 |                                          const void * argp)
-|   
+|
 |   Description   :  Check for the previous enumeration value
 |
 |   Return Values :  TRUE  - previous value found and loaded
@@ -424,15 +427,14 @@
 #endif
 };
 
-NCURSES_EXPORT_VAR(FIELDTYPE *)
-TYPE_ENUM = &typeENUM;
+FORM_EXPORT_VAR(FIELDTYPE *) TYPE_ENUM = &typeENUM;
 
 #if NCURSES_INTEROP_FUNCS
 /* The next routines are to simplify the use of ncurses from
-   programming languages with restictions on interop with C level
+   programming languages with restrictions on interop with C level
    constructs (e.g. variable access or va_list + ellipsis constructs)
 */
-NCURSES_EXPORT(FIELDTYPE *)
+FORM_EXPORT(FIELDTYPE *)
 _nc_TYPE_ENUM(void)
 {
   return TYPE_ENUM;
diff --git a/form/fty_generic.c b/form/fty_generic.c
index 429ceac..301c80a 100644
--- a/form/fty_generic.c
+++ b/form/fty_generic.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 2008-2010,2012 Free Software Foundation, Inc.              *
+ * Copyright 2018-2020,2021 Thomas E. Dickey                                *
+ * Copyright 2008-2012,2016 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -34,36 +35,37 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fty_generic.c,v 1.6 2012/06/10 00:27:49 tom Exp $")
+MODULE_ID("$Id: fty_generic.c,v 1.15 2021/03/27 23:49:53 tom Exp $")
 
 /*
  * This is not a full implementation of a field type, but adds some
  * support for higher level languages with some restrictions to interop
- * with C language. Especially the collection of arguments for the
+ * with C language. In particular, the collection of arguments for the
  * various fieldtypes is not based on the vararg C mechanism, but on a
- * iterator based callback mechanism that allowes the high level language
+ * iterator based callback mechanism that allows the high level language
  * to provide the arguments as a structure. Most languages have mechanisms
  * to layout structures so that they can be passed to C.
+ *
  * The languages can register a new generic fieldtype dynamically and store
  * a handle (key) to the calling object as an argument. Together with that
  * it can register a freearg callback, so that the high level language
  * remains in control of the memory management of the arguments they pass.
  * The design idea is, that the high-level language - typically a OO
- * language like C# or Java, uses it's own dispatching mechanisms
+ * language like C# or Java, uses its own dispatching mechanisms
  * (polymorphism) to call the proper check routines responsible for the
  * argument type. So these language implement typically only one generic
  * fieldtype they register with the forms library using this call.
  *
- * For that purpose we have extended the fieldtype struc by a new element
- * that gets the arguments from a single struct passed by the caller. 
- * 
+ * For that purpose we have extended the fieldtype structure by a new element
+ * that gets the arguments from a single struct passed by the caller.
+ *
  */
 #if NCURSES_INTEROP_FUNCS
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  static void *Generic_This_Type( void * arg )
-|   
+|
 |   Description   :  We interpret the passed arg just as a handle the
 |                    calling language uses to keep track of its allocated
 |                    argument structures. We can simply copy it back.
@@ -89,7 +91,7 @@
 |                    write a field_check and a char_check function and give
 |                    them as input to this call. A callback to allow the
 |                    release of the allocated memory must also be provided.
-|                    For generic field types, we provide some more 
+|                    For generic field types, we provide some more
 |                    information about the field as parameters.
 |
 |                    If an error occurs, errno is set to
@@ -98,7 +100,7 @@
 |
 |   Return Values :  Fieldtype pointer or NULL if error occurred
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(FIELDTYPE *)
+FORM_EXPORT(FIELDTYPE *)
 _nc_generic_fieldtype(bool (*const field_check) (FORM *, FIELD *, const void *),
 		      bool (*const char_check) (int, FORM *, FIELD *, const
 						void *),
@@ -109,8 +111,14 @@
   int code = E_SYSTEM_ERROR;
   FIELDTYPE *res = (FIELDTYPE *)0;
 
-  T((T_CALLED("_nc_generic_fieldtype(%p,%p,%p,%p,%p)"),
-     field_check, char_check, next, prev, freecallback));
+  TR_FUNC_BFR(5);
+
+  T((T_CALLED("_nc_generic_fieldtype(%s,%s,%s,%s,%s)"),
+     TR_FUNC_ARG(0, field_check),
+     TR_FUNC_ARG(1, char_check),
+     TR_FUNC_ARG(2, next),
+     TR_FUNC_ARG(3, prev),
+     TR_FUNC_ARG(4, freecallback)));
 
   if (field_check || char_check)
     {
@@ -139,16 +147,16 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  static TypeArgument *GenericArgument(
 |                      const FIELDTYPE* typ,
 |                      int (*argiterator)(void**),
 |                      int* err)
-|   
+|
 |   Description   :  The iterator callback must browse through all fieldtype
 |                    parameters that have an argument associated with the
 |                    type. The iterator returns 1 if the operation to get
-|                    the next element was successfull, 0 otherwise. If the
+|                    the next element was successful, 0 otherwise. If the
 |                    iterator could move to the next argument, it fills
 |                    the void* pointer representing the argument into the
 |                    location provided as argument to the iterator.
@@ -200,20 +208,20 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  int _nc_set_generic_fieldtype(
 |                      FIELD* field,
 |                      FIELDTYPE* ftyp,
 |                      int (*argiterator)(void**))
-|   
+|
 |   Description   :  Assign the fieldtype to the field and use the iterator
-|                    mechanism to get the arguments when a check is 
+|                    mechanism to get the arguments when a check is
 |                    performed.
 |
 |   Return Values :  E_OK if all went well
 |                    E_SYSTEM_ERROR if an error occurred
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+FORM_EXPORT(int)
 _nc_set_generic_fieldtype(FIELD *field,
 			  FIELDTYPE *ftyp,
 			  int (*argiterator) (void **))
@@ -258,23 +266,23 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  WINDOW* _nc_form_cursor(
 |                      FORM* form,
 |                      int *pRow, int *pCol)
-|   
+|
 |   Description   :  Get the current position of the form cursor position
 |                    We also return the field window
 |
-|   Return Values :  The fields Window or NULL on error
+|   Return Values :  The field's Window or NULL on error
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(WINDOW *)
+FORM_EXPORT(WINDOW *)
 _nc_form_cursor(const FORM *form, int *pRow, int *pCol)
 {
   int code = E_SYSTEM_ERROR;
   WINDOW *res = (WINDOW *)0;
 
-  if (!(form == 0 || pRow == 0 || pCol == 0))
+  if (form != 0 && pRow != 0 && pCol != 0)
     {
       *pRow = form->currow;
       *pCol = form->curcol;
diff --git a/form/fty_int.c b/form/fty_int.c
index 1e43874..c7e3135 100644
--- a/form/fty_int.c
+++ b/form/fty_int.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 1998-2010,2012 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -34,7 +35,7 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fty_int.c,v 1.26 2012/02/23 10:02:15 tom Exp $")
+MODULE_ID("$Id: fty_int.c,v 1.33 2021/06/17 21:11:08 tom Exp $")
 
 #if USE_WIDEC_SUPPORT
 #define isDigit(c) (iswdigit((wint_t)(c)) || isdigit(UChar(c)))
@@ -61,9 +62,9 @@
 integerPARM;
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  static void *Generic_This_Type( void * arg )
-|   
+|
 |   Description   :  Allocate structure for integer type argument.
 |
 |   Return Values :  Pointer to argument structure or NULL on error
@@ -71,8 +72,8 @@
 static void *
 Generic_This_Type(void *arg)
 {
-  thisARG *argp = (thisARG *) 0;
-  thisARG *param = (thisARG *) arg;
+  thisARG *argp = (thisARG *)0;
+  thisARG *param = (thisARG *)arg;
 
   if (param)
     {
@@ -88,9 +89,9 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  static void *Make_This_Type( va_list * ap )
-|   
+|
 |   Description   :  Allocate structure for integer type argument.
 |
 |   Return Values :  Pointer to argument structure or NULL on error
@@ -108,10 +109,10 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  static void *Copy_This_Type(const void * argp)
-|   
-|   Description   :  Copy structure for integer type argument.  
+|
+|   Description   :  Copy structure for integer type argument.
 |
 |   Return Values :  Pointer to argument structure or NULL on error.
 +--------------------------------------------------------------------------*/
@@ -119,11 +120,12 @@
 Copy_This_Type(const void *argp)
 {
   const thisARG *ap = (const thisARG *)argp;
-  thisARG *result = (thisARG *) 0;
+  thisARG *result = (thisARG *)0;
 
   if (argp)
     {
       result = typeMalloc(thisARG, 1);
+
       if (result)
 	{
 	  T((T_CREATE("thisARG %p"), (void *)result));
@@ -134,9 +136,9 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  static void Free_This_Type(void * argp)
-|   
+|
 |   Description   :  Free structure for integer type argument.
 |
 |   Return Values :  -
@@ -149,11 +151,11 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  static bool Check_This_Field(
 |                                                 FIELD * field,
 |                                                 const void * argp)
-|   
+|
 |   Description   :  Validate buffer content to be a valid integer value
 |
 |   Return Values :  TRUE  - field is valid
@@ -168,11 +170,9 @@
   int prec = argi->precision;
   unsigned char *bp = (unsigned char *)field_buffer(field, 0);
   char *s = (char *)bp;
-  long val;
-  char buf[100];
   bool result = FALSE;
 
-  while (*bp && *bp == ' ')
+  while (*bp == ' ')
     bp++;
   if (*bp)
     {
@@ -181,13 +181,14 @@
 #if USE_WIDEC_SUPPORT
       if (*bp)
 	{
-	  bool blank = FALSE;
 	  int len;
-	  int n;
 	  wchar_t *list = _nc_Widen_String((char *)bp, &len);
 
 	  if (list != 0)
 	    {
+	      bool blank = FALSE;
+	      int n;
+
 	      result = TRUE;
 	      for (n = 0; n < len; ++n)
 		{
@@ -225,7 +226,8 @@
 #endif
       if (result)
 	{
-	  val = atol(s);
+	  long val = atol(s);
+
 	  if (low < high)
 	    {
 	      if (val < low || val > high)
@@ -233,6 +235,8 @@
 	    }
 	  if (result)
 	    {
+	      char buf[100];
+
 	      _nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf))
 			  "%.*ld", (prec > 0 ? prec : 0), val);
 	      set_field_buffer(field, 0, buf);
@@ -243,11 +247,11 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  static bool Check_This_Character(
 |                                      int c,
 |                                      const void * argp)
-|   
+|
 |   Description   :  Check a character for the integer type.
 |
 |   Return Values :  TRUE  - character is valid
@@ -277,14 +281,14 @@
 #endif
 };
 
-NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_INTEGER = &typeTHIS;
+FORM_EXPORT_VAR(FIELDTYPE *) TYPE_INTEGER = &typeTHIS;
 
 #if NCURSES_INTEROP_FUNCS
 /* The next routines are to simplify the use of ncurses from
-   programming languages with restictions on interop with C level
+   programming languages with restrictions on interop with C level
    constructs (e.g. variable access or va_list + ellipsis constructs)
 */
-NCURSES_EXPORT(FIELDTYPE *)
+FORM_EXPORT(FIELDTYPE *)
 _nc_TYPE_INTEGER(void)
 {
   return TYPE_INTEGER;
diff --git a/form/fty_ipv4.c b/form/fty_ipv4.c
index 8dc04f8..108f7b4 100644
--- a/form/fty_ipv4.c
+++ b/form/fty_ipv4.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2006,2009 Free Software Foundation, Inc.              *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 1998-2006,2009 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -34,14 +35,14 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fty_ipv4.c,v 1.10 2009/11/07 20:17:58 tom Exp $")
+MODULE_ID("$Id: fty_ipv4.c,v 1.16 2021/06/17 21:11:08 tom Exp $")
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  static bool Check_IPV4_Field(
 |                                      FIELD * field,
 |                                      const void * argp)
-|   
+|
 |   Description   :  Validate buffer content to be a valid IP number (Ver. 4)
 |
 |   Return Values :  TRUE  - field is valid
@@ -52,7 +53,7 @@
 {
   char *bp = field_buffer(field, 0);
   int num = 0, len;
-  unsigned int d1, d2, d3, d4;
+  unsigned int d1 = 0, d2 = 0, d3 = 0, d4 = 0;
 
   if (isdigit(UChar(*bp)))	/* Must start with digit */
     {
@@ -69,11 +70,11 @@
 }
 
 /*---------------------------------------------------------------------------
-|   Facility      :  libnform  
+|   Facility      :  libnform
 |   Function      :  static bool Check_IPV4_Character(
-|                                      int c, 
+|                                      int c,
 |                                      const void *argp )
-|   
+|
 |   Description   :  Check a character for unsigned type or period.
 |
 |   Return Values :  TRUE  - character is valid
@@ -103,14 +104,14 @@
 #endif
 };
 
-NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_IPV4 = &typeIPV4;
+FORM_EXPORT_VAR(FIELDTYPE *) TYPE_IPV4 = &typeIPV4;
 
 #if NCURSES_INTEROP_FUNCS
 /* The next routines are to simplify the use of ncurses from
-   programming languages with restictions on interop with C level
+   programming languages with restrictions on interop with C level
    constructs (e.g. variable access or va_list + ellipsis constructs)
 */
-NCURSES_EXPORT(FIELDTYPE *)
+FORM_EXPORT(FIELDTYPE *)
 _nc_TYPE_IPV4(void)
 {
   return TYPE_IPV4;
diff --git a/form/fty_num.c b/form/fty_num.c
index 8cce43f..34cef63 100644
--- a/form/fty_num.c
+++ b/form/fty_num.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
+ * Copyright 2019-2020,2021 Thomas E. Dickey                                *
+ * Copyright 1998-2010,2012 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -34,13 +35,13 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fty_num.c,v 1.29 2012/02/23 10:02:15 tom Exp $")
+MODULE_ID("$Id: fty_num.c,v 1.37 2021/03/27 23:49:58 tom Exp $")
 
 #if HAVE_LOCALE_H
 #include <locale.h>
 #endif
 
-#if HAVE_LOCALE_H
+#if HAVE_LOCALE_H && HAVE_LOCALECONV
 #define isDecimalPoint(c) ((c) == ((L && L->decimal_point) ? *(L->decimal_point) : '.'))
 #else
 #define isDecimalPoint(c) ((c) == '.')
@@ -82,8 +83,8 @@
 static void *
 Generic_This_Type(void *arg)
 {
-  thisARG *argn = (thisARG *) 0;
-  thisPARM *args = (thisPARM *) arg;
+  thisARG *argn = (thisARG *)0;
+  thisPARM *args = (thisPARM *)arg;
 
   if (args)
     {
@@ -96,7 +97,7 @@
 	  argn->low = args->low;
 	  argn->high = args->high;
 
-#if HAVE_LOCALE_H
+#if HAVE_LOCALE_H && HAVE_LOCALECONV
 	  argn->L = localeconv();
 #else
 	  argn->L = NULL;
@@ -138,11 +139,12 @@
 Copy_This_Type(const void *argp)
 {
   const thisARG *ap = (const thisARG *)argp;
-  thisARG *result = (thisARG *) 0;
+  thisARG *result = (thisARG *)0;
 
   if (argp)
     {
       result = typeMalloc(thisARG, 1);
+
       if (result)
 	{
 	  T((T_CREATE("thisARG %p"), (void *)result));
@@ -186,12 +188,10 @@
   int prec = argn->precision;
   unsigned char *bp = (unsigned char *)field_buffer(field, 0);
   char *s = (char *)bp;
-  double val = 0.0;
   struct lconv *L = argn->L;
-  char buf[64];
   bool result = FALSE;
 
-  while (*bp && *bp == ' ')
+  while (*bp == ' ')
     bp++;
   if (*bp)
     {
@@ -200,14 +200,15 @@
 #if USE_WIDEC_SUPPORT
       if (*bp)
 	{
-	  bool blank = FALSE;
-	  int state = 0;
 	  int len;
-	  int n;
 	  wchar_t *list = _nc_Widen_String((char *)bp, &len);
 
 	  if (list != 0)
 	    {
+	      bool blank = FALSE;
+	      int state = 0;
+	      int n;
+
 	      result = TRUE;
 	      for (n = 0; n < len; ++n)
 		{
@@ -263,7 +264,8 @@
 #endif
       if (result)
 	{
-	  val = atof(s);
+	  double val = atof(s);
+
 	  if (low < high)
 	    {
 	      if (val < low || val > high)
@@ -271,6 +273,8 @@
 	    }
 	  if (result)
 	    {
+	      char buf[64];
+
 	      _nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf))
 			  "%.*f", (prec > 0 ? prec : 0), val);
 	      set_field_buffer(field, 0, buf);
@@ -323,14 +327,14 @@
 #endif
 };
 
-NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_NUMERIC = &typeTHIS;
+FORM_EXPORT_VAR(FIELDTYPE *) TYPE_NUMERIC = &typeTHIS;
 
 #if NCURSES_INTEROP_FUNCS
 /* The next routines are to simplify the use of ncurses from
-   programming languages with restictions on interop with C level
+   programming languages with restrictions on interop with C level
    constructs (e.g. variable access or va_list + ellipsis constructs)
 */
-NCURSES_EXPORT(FIELDTYPE *)
+FORM_EXPORT(FIELDTYPE *)
 _nc_TYPE_NUMERIC(void)
 {
   return TYPE_NUMERIC;
diff --git a/form/fty_regex.c b/form/fty_regex.c
index 194a52e..62dcab5 100644
--- a/form/fty_regex.c
+++ b/form/fty_regex.c
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2012,2015 Free Software Foundation, Inc.              *
+ * Copyright 2018-2020,2021 Thomas E. Dickey                                *
+ * Copyright 1998-2012,2015 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -34,10 +35,48 @@
 
 #include "form.priv.h"
 
-MODULE_ID("$Id: fty_regex.c,v 1.26 2015/01/10 17:10:25 tom Exp $")
+MODULE_ID("$Id: fty_regex.c,v 1.33 2021/08/14 15:01:52 tom Exp $")
 
-#if HAVE_REGEX_H_FUNCS		/* We prefer POSIX regex */
+#if HAVE_REGEX_H_FUNCS || HAVE_LIB_PCRE2	/* We prefer POSIX regex */
+
+#if HAVE_PCRE2POSIX_H
+#include <pcre2posix.h>
+
+/* pcre2 used to provide its "POSIX" entrypoints using the same names as the
+ * standard ones in the C runtime, but that never worked because the linker
+ * would use the C runtime.  Debian patched the library to fix this symbol
+ * conflict, but overlooked the header file, and Debian's patch was made
+ * obsolete when pcre2 was changed early in 2019 to provide different names.
+ *
+ * Here is a workaround to make the older version of Debian's package work.
+ */
+#if !defined(PCRE2regcomp) && defined(HAVE_PCRE2REGCOMP)
+
+#undef regcomp
+#undef regexec
+#undef regfree
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+  PCRE2POSIX_EXP_DECL int PCRE2regcomp(regex_t *, const char *, int);
+  PCRE2POSIX_EXP_DECL int PCRE2regexec(const regex_t *, const char *, size_t,
+				       regmatch_t *, int);
+  PCRE2POSIX_EXP_DECL void PCRE2regfree(regex_t *);
+#ifdef __cplusplus
+}				/* extern "C" */
+#endif
+#define regcomp(r,s,n)          PCRE2regcomp(r,s,n)
+#define regexec(r,s,n,m,x)      PCRE2regexec(r,s,n,m,x)
+#define regfree(r)              PCRE2regfree(r)
+#endif
+/* end workaround... */
+#elif HAVE_PCREPOSIX_H
+#include <pcreposix.h>
+#else
 #include <regex.h>
+#endif
 
 typedef struct
   {
@@ -332,14 +371,14 @@
 #endif
 };
 
-NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_REGEXP = &typeREGEXP;
+FORM_EXPORT_VAR(FIELDTYPE *) TYPE_REGEXP = &typeREGEXP;
 
 #if NCURSES_INTEROP_FUNCS
 /* The next routines are to simplify the use of ncurses from
-   programming languages with restictions on interop with C level
+   programming languages with restrictions on interop with C level
    constructs (e.g. variable access or va_list + ellipsis constructs)
 */
-NCURSES_EXPORT(FIELDTYPE *)
+FORM_EXPORT(FIELDTYPE *)
 _nc_TYPE_REGEXP(void)
 {
   return TYPE_REGEXP;
diff --git a/form/headers b/form/headers
index 56d72f0..0969e3f 100644
--- a/form/headers
+++ b/form/headers
@@ -1,5 +1,6 @@
 ##############################################################################
-# Copyright (c) 1998,2006 Free Software Foundation, Inc.                     #
+# Copyright 2020 Thomas E. Dickey                                            #
+# Copyright 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"), #
diff --git a/form/llib-lform b/form/llib-lform
index 4371d54..334f8cb 100644
--- a/form/llib-lform
+++ b/form/llib-lform
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2010,2015 Free Software Foundation, Inc.              *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 1998-2015,2017 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            *
@@ -64,11 +65,11 @@
 
 #undef set_fieldtype_arg
 int	set_fieldtype_arg(
-		FIELDTYPE *typ, 
+		FIELDTYPE *typ,
 		void	*(*const make_arg)(
-		va_list	*p1), 
+		va_list	*p1),
 		void	*(*const copy_arg)(
-		const void *p1), 
+		const void *p1),
 		void	(*const free_arg)(
 		void	*p1))
 		{ return(*(int *)0); }
@@ -82,7 +83,7 @@
 
 #undef set_field_fore
 int	set_field_fore(
-		FIELD	*field, 
+		FIELD	*field,
 		chtype	attr)
 		{ return(*(int *)0); }
 
@@ -93,7 +94,7 @@
 
 #undef set_field_back
 int	set_field_back(
-		FIELD	*field, 
+		FIELD	*field,
 		chtype	attr)
 		{ return(*(int *)0); }
 
@@ -106,10 +107,15 @@
 
 #undef set_current_field
 int	set_current_field(
-		FORM	*form, 
+		FORM	*form,
 		FIELD	*field)
 		{ return(*(int *)0); }
 
+#undef unfocus_current_field
+int	unfocus_current_field(
+		FORM	*const form)
+		{ return(*(int *)0); }
+
 #undef current_field
 FIELD	*current_field(
 		const FORM *form)
@@ -127,27 +133,27 @@
 
 #undef _nc_Make_Argument
 TypeArgument *_nc_Make_Argument(
-		const FIELDTYPE *typ, 
-		va_list	*ap, 
+		const FIELDTYPE *typ,
+		va_list	*ap,
 		int	*err)
 		{ return(*(TypeArgument **)0); }
 
 #undef _nc_Copy_Argument
 TypeArgument *_nc_Copy_Argument(
-		const FIELDTYPE *typ, 
-		const TypeArgument *argp, 
+		const FIELDTYPE *typ,
+		const TypeArgument *argp,
 		int	*err)
 		{ return(*(TypeArgument **)0); }
 
 #undef _nc_Free_Argument
 void	_nc_Free_Argument(
-		const FIELDTYPE *typ, 
+		const FIELDTYPE *typ,
 		TypeArgument *argp)
 		{ /* void */ }
 
 #undef _nc_Copy_Type
 NCURSES_BOOL _nc_Copy_Type(
-		FIELD	*dst, 
+		FIELD	*dst,
 		FIELD const *src)
 		{ return(*(NCURSES_BOOL *)0); }
 
@@ -158,11 +164,11 @@
 
 #undef new_field
 FIELD	*new_field(
-		int	rows, 
-		int	cols, 
-		int	frow, 
-		int	fcol, 
-		int	nrow, 
+		int	rows,
+		int	cols,
+		int	frow,
+		int	fcol,
+		int	nrow,
 		int	nbuf)
 		{ return(*(FIELD **)0); }
 
@@ -175,8 +181,8 @@
 
 #undef dup_field
 FIELD	*dup_field(
-		FIELD	*field, 
-		int	frow, 
+		FIELD	*field,
+		int	frow,
 		int	fcol)
 		{ return(*(FIELD **)0); }
 
@@ -184,12 +190,12 @@
 
 #undef set_fieldtype_choice
 int	set_fieldtype_choice(
-		FIELDTYPE *typ, 
+		FIELDTYPE *typ,
 		NCURSES_BOOL (*const next_choice)(
-		FIELD	*p1, 
-		const void *p2), 
+		FIELD	*p1,
+		const void *p2),
 		NCURSES_BOOL (*const prev_choice)(
-		FIELD	*p1, 
+		FIELD	*p1,
 		const void *p2))
 		{ return(*(int *)0); }
 
@@ -197,7 +203,7 @@
 
 #undef link_fieldtype
 FIELDTYPE *link_fieldtype(
-		FIELDTYPE *type1, 
+		FIELDTYPE *type1,
 		FIELDTYPE *type2)
 		{ return(*(FIELDTYPE **)0); }
 
@@ -205,20 +211,20 @@
 
 #undef field_info
 int	field_info(
-		const FIELD *field, 
-		int	*rows, 
-		int	*cols, 
-		int	*frow, 
-		int	*fcol, 
-		int	*nrow, 
+		const FIELD *field,
+		int	*rows,
+		int	*cols,
+		int	*frow,
+		int	*fcol,
+		int	*nrow,
 		int	*nbuf)
 		{ return(*(int *)0); }
 
 #undef dynamic_field_info
 int	dynamic_field_info(
-		const FIELD *field, 
-		int	*drows, 
-		int	*dcols, 
+		const FIELD *field,
+		int	*drows,
+		int	*dcols,
 		int	*maxgrow)
 		{ return(*(int *)0); }
 
@@ -226,7 +232,7 @@
 
 #undef set_field_just
 int	set_field_just(
-		FIELD	*field, 
+		FIELD	*field,
 		int	just)
 		{ return(*(int *)0); }
 
@@ -239,8 +245,8 @@
 
 #undef link_field
 FIELD	*link_field(
-		FIELD	*field, 
-		int	frow, 
+		FIELD	*field,
+		int	frow,
 		int	fcol)
 		{ return(*(FIELD **)0); }
 
@@ -248,7 +254,7 @@
 
 #undef set_max_field
 int	set_max_field(
-		FIELD	*field, 
+		FIELD	*field,
 		int	maxgrow)
 		{ return(*(int *)0); }
 
@@ -256,8 +262,8 @@
 
 #undef move_field
 int	move_field(
-		FIELD	*field, 
-		int	frow, 
+		FIELD	*field,
+		int	frow,
 		int	fcol)
 		{ return(*(int *)0); }
 
@@ -269,10 +275,10 @@
 #undef new_fieldtype
 FIELDTYPE *new_fieldtype(
 		NCURSES_BOOL (*const field_check)(
-		FIELD	*p1, 
-		const void *p2), 
+		FIELD	*p1,
+		const void *p2),
 		NCURSES_BOOL (*const char_check)(
-		int	p1, 
+		int	p1,
 		const void *p2))
 		{ return(*(FIELDTYPE **)0); }
 
@@ -285,7 +291,7 @@
 
 #undef set_field_opts
 int	set_field_opts(
-		FIELD	*field, 
+		FIELD	*field,
 		Field_Options opts)
 		{ return(*(int *)0); }
 
@@ -296,13 +302,13 @@
 
 #undef field_opts_on
 int	field_opts_on(
-		FIELD	*field, 
+		FIELD	*field,
 		Field_Options opts)
 		{ return(*(int *)0); }
 
 #undef field_opts_off
 int	field_opts_off(
-		FIELD	*field, 
+		FIELD	*field,
 		Field_Options opts)
 		{ return(*(int *)0); }
 
@@ -310,7 +316,7 @@
 
 #undef set_field_pad
 int	set_field_pad(
-		FIELD	*field, 
+		FIELD	*field,
 		int	ch)
 		{ return(*(int *)0); }
 
@@ -323,7 +329,7 @@
 
 #undef set_new_page
 int	set_new_page(
-		FIELD	*field, 
+		FIELD	*field,
 		NCURSES_BOOL new_page_flag)
 		{ return(*(int *)0); }
 
@@ -336,7 +342,7 @@
 
 #undef set_field_status
 int	set_field_status(
-		FIELD	*field, 
+		FIELD	*field,
 		NCURSES_BOOL status)
 		{ return(*(int *)0); }
 
@@ -349,8 +355,8 @@
 
 #undef set_field_type
 int	set_field_type(
-		FIELD	*field, 
-		FIELDTYPE *type, 
+		FIELD	*field,
+		FIELDTYPE *type,
 		...)
 		{ return(*(int *)0); }
 
@@ -363,7 +369,7 @@
 
 #undef set_field_userptr
 int	set_field_userptr(
-		FIELD	*field, 
+		FIELD	*field,
 		void	*usrptr)
 		{ return(*(int *)0); }
 
@@ -398,7 +404,7 @@
 
 #undef new_form_sp
 FORM	*new_form_sp(
-		SCREEN	*sp, 
+		SCREEN	*sp,
 		FIELD	**fields)
 		{ return(*(FORM **)0); }
 
@@ -414,7 +420,7 @@
 
 #undef set_form_fields
 int	set_form_fields(
-		FORM	*form, 
+		FORM	*form,
 		FIELD	**fields)
 		{ return(*(int *)0); }
 
@@ -432,8 +438,8 @@
 
 #undef _nc_get_fieldbuffer
 void	_nc_get_fieldbuffer(
-		FORM	*form, 
-		FIELD	*field, 
+		FORM	*form,
+		FIELD	*field,
 		char	*buf)
 		{ /* void */ }
 
@@ -454,13 +460,18 @@
 
 #undef _nc_Synchronize_Options
 int	_nc_Synchronize_Options(
-		FIELD	*field, 
+		FIELD	*field,
 		Field_Options newopts)
 		{ return(*(int *)0); }
 
+#undef _nc_Unset_Current_Field
+void	_nc_Unset_Current_Field(
+		FORM	*form)
+		{ /* void */ }
+
 #undef _nc_Set_Current_Field
 int	_nc_Set_Current_Field(
-		FORM	*form, 
+		FORM	*form,
 		FIELD	*newfield)
 		{ return(*(int *)0); }
 
@@ -476,34 +487,34 @@
 
 #undef _nc_Set_Form_Page
 int	_nc_Set_Form_Page(
-		FORM	*form, 
-		int	page, 
+		FORM	*form,
+		int	page,
 		FIELD	*field)
 		{ return(*(int *)0); }
 
 typedef struct
 {
-  int keycode; 
-  int (*cmd) (FORM *); 
+  int keycode;
+  int (*cmd) (FORM *);
 }
 Binding_Info;
 
 #undef form_driver
 int	form_driver(
-		FORM	*form, 
+		FORM	*form,
 		int	c)
 		{ return(*(int *)0); }
 
 #undef set_field_buffer
 int	set_field_buffer(
-		FIELD	*field, 
-		int	buffer, 
+		FIELD	*field,
+		int	buffer,
 		const char *value)
 		{ return(*(int *)0); }
 
 #undef field_buffer
 char	*field_buffer(
-		const FIELD *field, 
+		const FIELD *field,
 		int	buffer)
 		{ return(*(char **)0); }
 
@@ -511,7 +522,7 @@
 
 #undef set_field_init
 int	set_field_init(
-		FORM	*form, 
+		FORM	*form,
 		Form_Hook func)
 		{ return(*(int *)0); }
 
@@ -522,7 +533,7 @@
 
 #undef set_field_term
 int	set_field_term(
-		FORM	*form, 
+		FORM	*form,
 		Form_Hook func)
 		{ return(*(int *)0); }
 
@@ -533,7 +544,7 @@
 
 #undef set_form_init
 int	set_form_init(
-		FORM	*form, 
+		FORM	*form,
 		Form_Hook func)
 		{ return(*(int *)0); }
 
@@ -544,7 +555,7 @@
 
 #undef set_form_term
 int	set_form_term(
-		FORM	*form, 
+		FORM	*form,
 		Form_Hook func)
 		{ return(*(int *)0); }
 
@@ -557,7 +568,7 @@
 
 #undef set_form_opts
 int	set_form_opts(
-		FORM	*form, 
+		FORM	*form,
 		Form_Options opts)
 		{ return(*(int *)0); }
 
@@ -568,13 +579,13 @@
 
 #undef form_opts_on
 int	form_opts_on(
-		FORM	*form, 
+		FORM	*form,
 		Form_Options opts)
 		{ return(*(int *)0); }
 
 #undef form_opts_off
 int	form_opts_off(
-		FORM	*form, 
+		FORM	*form,
 		Form_Options opts)
 		{ return(*(int *)0); }
 
@@ -582,7 +593,7 @@
 
 #undef set_form_page
 int	set_form_page(
-		FORM	*form, 
+		FORM	*form,
 		int	page)
 		{ return(*(int *)0); }
 
@@ -619,8 +630,8 @@
 
 #undef scale_form
 int	scale_form(
-		const FORM *form, 
-		int	*rows, 
+		const FORM *form,
+		int	*rows,
 		int	*cols)
 		{ return(*(int *)0); }
 
@@ -628,7 +639,7 @@
 
 #undef set_form_sub
 int	set_form_sub(
-		FORM	*form, 
+		FORM	*form,
 		WINDOW	*win)
 		{ return(*(int *)0); }
 
@@ -641,7 +652,7 @@
 
 #undef set_form_userptr
 int	set_form_userptr(
-		FORM	*form, 
+		FORM	*form,
 		void	*usrptr)
 		{ return(*(int *)0); }
 
@@ -654,7 +665,7 @@
 
 #undef set_form_win
 int	set_form_win(
-		FORM	*form, 
+		FORM	*form,
 		WINDOW	*win)
 		{ return(*(int *)0); }
 
@@ -724,38 +735,38 @@
 #undef _nc_generic_fieldtype
 FIELDTYPE *_nc_generic_fieldtype(
 		NCURSES_BOOL (*const field_check)(
-		FORM	*p1, 
-		FIELD	*p2, 
-		const void *p3), 
+		FORM	*p1,
+		FIELD	*p2,
+		const void *p3),
 		NCURSES_BOOL (*const char_check)(
-		int	p1, 
-		FORM	*p2, 
-		FIELD	*p3, 
-		const void *p4), 
+		int	p1,
+		FORM	*p2,
+		FIELD	*p3,
+		const void *p4),
 		NCURSES_BOOL (*const next)(
-		FORM	*p1, 
-		FIELD	*p2, 
-		const void *p3), 
+		FORM	*p1,
+		FIELD	*p2,
+		const void *p3),
 		NCURSES_BOOL (*const prev)(
-		FORM	*p1, 
-		FIELD	*p2, 
-		const void *p3), 
+		FORM	*p1,
+		FIELD	*p2,
+		const void *p3),
 		void	(*freecallback)(
 		void	*p1))
 		{ return(*(FIELDTYPE **)0); }
 
 #undef _nc_set_generic_fieldtype
 int	_nc_set_generic_fieldtype(
-		FIELD	*field, 
-		FIELDTYPE *ftyp, 
+		FIELD	*field,
+		FIELDTYPE *ftyp,
 		int	(*argiterator)(
 		void	**p1))
 		{ return(*(int *)0); }
 
 #undef _nc_form_cursor
 WINDOW	*_nc_form_cursor(
-		const FORM *form, 
-		int	*pRow, 
+		const FORM *form,
+		int	*pRow,
 		int	*pCol)
 		{ return(*(WINDOW **)0); }
 
@@ -795,8 +806,6 @@
 
 /* ./fty_num.c */
 
-#include <locale.h>
-
 typedef struct
   {
     int precision;
@@ -823,8 +832,6 @@
 
 /* ./fty_regex.c */
 
-#include <regex.h>
-
 typedef struct
   {
     regex_t *pRegExp;
diff --git a/form/llib-lformt b/form/llib-lformt
index 967a4a7..d91b3f0 100644
--- a/form/llib-lformt
+++ b/form/llib-lformt
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 2010-2010,2015 Free Software Foundation, Inc.              *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 2010-2015,2017 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            *
@@ -64,11 +65,11 @@
 
 #undef set_fieldtype_arg
 int	set_fieldtype_arg(
-		FIELDTYPE *typ, 
+		FIELDTYPE *typ,
 		void	*(*const make_arg)(
-		va_list	*p1), 
+		va_list	*p1),
 		void	*(*const copy_arg)(
-		const void *p1), 
+		const void *p1),
 		void	(*const free_arg)(
 		void	*p1))
 		{ return(*(int *)0); }
@@ -82,7 +83,7 @@
 
 #undef set_field_fore
 int	set_field_fore(
-		FIELD	*field, 
+		FIELD	*field,
 		chtype	attr)
 		{ return(*(int *)0); }
 
@@ -93,7 +94,7 @@
 
 #undef set_field_back
 int	set_field_back(
-		FIELD	*field, 
+		FIELD	*field,
 		chtype	attr)
 		{ return(*(int *)0); }
 
@@ -106,10 +107,15 @@
 
 #undef set_current_field
 int	set_current_field(
-		FORM	*form, 
+		FORM	*form,
 		FIELD	*field)
 		{ return(*(int *)0); }
 
+#undef unfocus_current_field
+int	unfocus_current_field(
+		FORM	*const form)
+		{ return(*(int *)0); }
+
 #undef current_field
 FIELD	*current_field(
 		const FORM *form)
@@ -127,27 +133,27 @@
 
 #undef _nc_Make_Argument
 TypeArgument *_nc_Make_Argument(
-		const FIELDTYPE *typ, 
-		va_list	*ap, 
+		const FIELDTYPE *typ,
+		va_list	*ap,
 		int	*err)
 		{ return(*(TypeArgument **)0); }
 
 #undef _nc_Copy_Argument
 TypeArgument *_nc_Copy_Argument(
-		const FIELDTYPE *typ, 
-		const TypeArgument *argp, 
+		const FIELDTYPE *typ,
+		const TypeArgument *argp,
 		int	*err)
 		{ return(*(TypeArgument **)0); }
 
 #undef _nc_Free_Argument
 void	_nc_Free_Argument(
-		const FIELDTYPE *typ, 
+		const FIELDTYPE *typ,
 		TypeArgument *argp)
 		{ /* void */ }
 
 #undef _nc_Copy_Type
 NCURSES_BOOL _nc_Copy_Type(
-		FIELD	*dst, 
+		FIELD	*dst,
 		FIELD const *src)
 		{ return(*(NCURSES_BOOL *)0); }
 
@@ -158,11 +164,11 @@
 
 #undef new_field
 FIELD	*new_field(
-		int	rows, 
-		int	cols, 
-		int	frow, 
-		int	fcol, 
-		int	nrow, 
+		int	rows,
+		int	cols,
+		int	frow,
+		int	fcol,
+		int	nrow,
 		int	nbuf)
 		{ return(*(FIELD **)0); }
 
@@ -175,8 +181,8 @@
 
 #undef dup_field
 FIELD	*dup_field(
-		FIELD	*field, 
-		int	frow, 
+		FIELD	*field,
+		int	frow,
 		int	fcol)
 		{ return(*(FIELD **)0); }
 
@@ -184,12 +190,12 @@
 
 #undef set_fieldtype_choice
 int	set_fieldtype_choice(
-		FIELDTYPE *typ, 
+		FIELDTYPE *typ,
 		NCURSES_BOOL (*const next_choice)(
-		FIELD	*p1, 
-		const void *p2), 
+		FIELD	*p1,
+		const void *p2),
 		NCURSES_BOOL (*const prev_choice)(
-		FIELD	*p1, 
+		FIELD	*p1,
 		const void *p2))
 		{ return(*(int *)0); }
 
@@ -197,7 +203,7 @@
 
 #undef link_fieldtype
 FIELDTYPE *link_fieldtype(
-		FIELDTYPE *type1, 
+		FIELDTYPE *type1,
 		FIELDTYPE *type2)
 		{ return(*(FIELDTYPE **)0); }
 
@@ -205,20 +211,20 @@
 
 #undef field_info
 int	field_info(
-		const FIELD *field, 
-		int	*rows, 
-		int	*cols, 
-		int	*frow, 
-		int	*fcol, 
-		int	*nrow, 
+		const FIELD *field,
+		int	*rows,
+		int	*cols,
+		int	*frow,
+		int	*fcol,
+		int	*nrow,
 		int	*nbuf)
 		{ return(*(int *)0); }
 
 #undef dynamic_field_info
 int	dynamic_field_info(
-		const FIELD *field, 
-		int	*drows, 
-		int	*dcols, 
+		const FIELD *field,
+		int	*drows,
+		int	*dcols,
 		int	*maxgrow)
 		{ return(*(int *)0); }
 
@@ -226,7 +232,7 @@
 
 #undef set_field_just
 int	set_field_just(
-		FIELD	*field, 
+		FIELD	*field,
 		int	just)
 		{ return(*(int *)0); }
 
@@ -239,8 +245,8 @@
 
 #undef link_field
 FIELD	*link_field(
-		FIELD	*field, 
-		int	frow, 
+		FIELD	*field,
+		int	frow,
 		int	fcol)
 		{ return(*(FIELD **)0); }
 
@@ -248,7 +254,7 @@
 
 #undef set_max_field
 int	set_max_field(
-		FIELD	*field, 
+		FIELD	*field,
 		int	maxgrow)
 		{ return(*(int *)0); }
 
@@ -256,8 +262,8 @@
 
 #undef move_field
 int	move_field(
-		FIELD	*field, 
-		int	frow, 
+		FIELD	*field,
+		int	frow,
 		int	fcol)
 		{ return(*(int *)0); }
 
@@ -269,10 +275,10 @@
 #undef new_fieldtype
 FIELDTYPE *new_fieldtype(
 		NCURSES_BOOL (*const field_check)(
-		FIELD	*p1, 
-		const void *p2), 
+		FIELD	*p1,
+		const void *p2),
 		NCURSES_BOOL (*const char_check)(
-		int	p1, 
+		int	p1,
 		const void *p2))
 		{ return(*(FIELDTYPE **)0); }
 
@@ -285,7 +291,7 @@
 
 #undef set_field_opts
 int	set_field_opts(
-		FIELD	*field, 
+		FIELD	*field,
 		Field_Options opts)
 		{ return(*(int *)0); }
 
@@ -296,13 +302,13 @@
 
 #undef field_opts_on
 int	field_opts_on(
-		FIELD	*field, 
+		FIELD	*field,
 		Field_Options opts)
 		{ return(*(int *)0); }
 
 #undef field_opts_off
 int	field_opts_off(
-		FIELD	*field, 
+		FIELD	*field,
 		Field_Options opts)
 		{ return(*(int *)0); }
 
@@ -310,7 +316,7 @@
 
 #undef set_field_pad
 int	set_field_pad(
-		FIELD	*field, 
+		FIELD	*field,
 		int	ch)
 		{ return(*(int *)0); }
 
@@ -323,7 +329,7 @@
 
 #undef set_new_page
 int	set_new_page(
-		FIELD	*field, 
+		FIELD	*field,
 		NCURSES_BOOL new_page_flag)
 		{ return(*(int *)0); }
 
@@ -336,7 +342,7 @@
 
 #undef set_field_status
 int	set_field_status(
-		FIELD	*field, 
+		FIELD	*field,
 		NCURSES_BOOL status)
 		{ return(*(int *)0); }
 
@@ -349,8 +355,8 @@
 
 #undef set_field_type
 int	set_field_type(
-		FIELD	*field, 
-		FIELDTYPE *type, 
+		FIELD	*field,
+		FIELDTYPE *type,
 		...)
 		{ return(*(int *)0); }
 
@@ -363,7 +369,7 @@
 
 #undef set_field_userptr
 int	set_field_userptr(
-		FIELD	*field, 
+		FIELD	*field,
 		void	*usrptr)
 		{ return(*(int *)0); }
 
@@ -398,7 +404,7 @@
 
 #undef new_form_sp
 FORM	*new_form_sp(
-		SCREEN	*sp, 
+		SCREEN	*sp,
 		FIELD	**fields)
 		{ return(*(FORM **)0); }
 
@@ -414,7 +420,7 @@
 
 #undef set_form_fields
 int	set_form_fields(
-		FORM	*form, 
+		FORM	*form,
 		FIELD	**fields)
 		{ return(*(int *)0); }
 
@@ -432,8 +438,8 @@
 
 #undef _nc_get_fieldbuffer
 void	_nc_get_fieldbuffer(
-		FORM	*form, 
-		FIELD	*field, 
+		FORM	*form,
+		FIELD	*field,
 		char	*buf)
 		{ /* void */ }
 
@@ -454,13 +460,18 @@
 
 #undef _nc_Synchronize_Options
 int	_nc_Synchronize_Options(
-		FIELD	*field, 
+		FIELD	*field,
 		Field_Options newopts)
 		{ return(*(int *)0); }
 
+#undef _nc_Unset_Current_Field
+void	_nc_Unset_Current_Field(
+		FORM	*form)
+		{ /* void */ }
+
 #undef _nc_Set_Current_Field
 int	_nc_Set_Current_Field(
-		FORM	*form, 
+		FORM	*form,
 		FIELD	*newfield)
 		{ return(*(int *)0); }
 
@@ -476,34 +487,34 @@
 
 #undef _nc_Set_Form_Page
 int	_nc_Set_Form_Page(
-		FORM	*form, 
-		int	page, 
+		FORM	*form,
+		int	page,
 		FIELD	*field)
 		{ return(*(int *)0); }
 
 typedef struct
 {
-  int keycode; 
-  int (*cmd) (FORM *); 
+  int keycode;
+  int (*cmd) (FORM *);
 }
 Binding_Info;
 
 #undef form_driver
 int	form_driver(
-		FORM	*form, 
+		FORM	*form,
 		int	c)
 		{ return(*(int *)0); }
 
 #undef set_field_buffer
 int	set_field_buffer(
-		FIELD	*field, 
-		int	buffer, 
+		FIELD	*field,
+		int	buffer,
 		const char *value)
 		{ return(*(int *)0); }
 
 #undef field_buffer
 char	*field_buffer(
-		const FIELD *field, 
+		const FIELD *field,
 		int	buffer)
 		{ return(*(char **)0); }
 
@@ -511,7 +522,7 @@
 
 #undef set_field_init
 int	set_field_init(
-		FORM	*form, 
+		FORM	*form,
 		Form_Hook func)
 		{ return(*(int *)0); }
 
@@ -522,7 +533,7 @@
 
 #undef set_field_term
 int	set_field_term(
-		FORM	*form, 
+		FORM	*form,
 		Form_Hook func)
 		{ return(*(int *)0); }
 
@@ -533,7 +544,7 @@
 
 #undef set_form_init
 int	set_form_init(
-		FORM	*form, 
+		FORM	*form,
 		Form_Hook func)
 		{ return(*(int *)0); }
 
@@ -544,7 +555,7 @@
 
 #undef set_form_term
 int	set_form_term(
-		FORM	*form, 
+		FORM	*form,
 		Form_Hook func)
 		{ return(*(int *)0); }
 
@@ -557,7 +568,7 @@
 
 #undef set_form_opts
 int	set_form_opts(
-		FORM	*form, 
+		FORM	*form,
 		Form_Options opts)
 		{ return(*(int *)0); }
 
@@ -568,13 +579,13 @@
 
 #undef form_opts_on
 int	form_opts_on(
-		FORM	*form, 
+		FORM	*form,
 		Form_Options opts)
 		{ return(*(int *)0); }
 
 #undef form_opts_off
 int	form_opts_off(
-		FORM	*form, 
+		FORM	*form,
 		Form_Options opts)
 		{ return(*(int *)0); }
 
@@ -582,7 +593,7 @@
 
 #undef set_form_page
 int	set_form_page(
-		FORM	*form, 
+		FORM	*form,
 		int	page)
 		{ return(*(int *)0); }
 
@@ -619,8 +630,8 @@
 
 #undef scale_form
 int	scale_form(
-		const FORM *form, 
-		int	*rows, 
+		const FORM *form,
+		int	*rows,
 		int	*cols)
 		{ return(*(int *)0); }
 
@@ -628,7 +639,7 @@
 
 #undef set_form_sub
 int	set_form_sub(
-		FORM	*form, 
+		FORM	*form,
 		WINDOW	*win)
 		{ return(*(int *)0); }
 
@@ -641,7 +652,7 @@
 
 #undef set_form_userptr
 int	set_form_userptr(
-		FORM	*form, 
+		FORM	*form,
 		void	*usrptr)
 		{ return(*(int *)0); }
 
@@ -654,7 +665,7 @@
 
 #undef set_form_win
 int	set_form_win(
-		FORM	*form, 
+		FORM	*form,
 		WINDOW	*win)
 		{ return(*(int *)0); }
 
@@ -724,38 +735,38 @@
 #undef _nc_generic_fieldtype
 FIELDTYPE *_nc_generic_fieldtype(
 		NCURSES_BOOL (*const field_check)(
-		FORM	*p1, 
-		FIELD	*p2, 
-		const void *p3), 
+		FORM	*p1,
+		FIELD	*p2,
+		const void *p3),
 		NCURSES_BOOL (*const char_check)(
-		int	p1, 
-		FORM	*p2, 
-		FIELD	*p3, 
-		const void *p4), 
+		int	p1,
+		FORM	*p2,
+		FIELD	*p3,
+		const void *p4),
 		NCURSES_BOOL (*const next)(
-		FORM	*p1, 
-		FIELD	*p2, 
-		const void *p3), 
+		FORM	*p1,
+		FIELD	*p2,
+		const void *p3),
 		NCURSES_BOOL (*const prev)(
-		FORM	*p1, 
-		FIELD	*p2, 
-		const void *p3), 
+		FORM	*p1,
+		FIELD	*p2,
+		const void *p3),
 		void	(*freecallback)(
 		void	*p1))
 		{ return(*(FIELDTYPE **)0); }
 
 #undef _nc_set_generic_fieldtype
 int	_nc_set_generic_fieldtype(
-		FIELD	*field, 
-		FIELDTYPE *ftyp, 
+		FIELD	*field,
+		FIELDTYPE *ftyp,
 		int	(*argiterator)(
 		void	**p1))
 		{ return(*(int *)0); }
 
 #undef _nc_form_cursor
 WINDOW	*_nc_form_cursor(
-		const FORM *form, 
-		int	*pRow, 
+		const FORM *form,
+		int	*pRow,
 		int	*pCol)
 		{ return(*(WINDOW **)0); }
 
@@ -795,8 +806,6 @@
 
 /* ./fty_num.c */
 
-#include <locale.h>
-
 typedef struct
   {
     int precision;
@@ -823,8 +832,6 @@
 
 /* ./fty_regex.c */
 
-#include <regex.h>
-
 typedef struct
   {
     regex_t *pRegExp;
diff --git a/form/llib-lformtw b/form/llib-lformtw
index da8682c..340bf59 100644
--- a/form/llib-lformtw
+++ b/form/llib-lformtw
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 2010-2013,2015 Free Software Foundation, Inc.              *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 2010-2015,2017 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            *
@@ -64,11 +65,11 @@
 
 #undef set_fieldtype_arg
 int	set_fieldtype_arg(
-		FIELDTYPE *typ, 
+		FIELDTYPE *typ,
 		void	*(*const make_arg)(
-		va_list	*p1), 
+		va_list	*p1),
 		void	*(*const copy_arg)(
-		const void *p1), 
+		const void *p1),
 		void	(*const free_arg)(
 		void	*p1))
 		{ return(*(int *)0); }
@@ -82,7 +83,7 @@
 
 #undef set_field_fore
 int	set_field_fore(
-		FIELD	*field, 
+		FIELD	*field,
 		chtype	attr)
 		{ return(*(int *)0); }
 
@@ -93,7 +94,7 @@
 
 #undef set_field_back
 int	set_field_back(
-		FIELD	*field, 
+		FIELD	*field,
 		chtype	attr)
 		{ return(*(int *)0); }
 
@@ -106,10 +107,15 @@
 
 #undef set_current_field
 int	set_current_field(
-		FORM	*form, 
+		FORM	*form,
 		FIELD	*field)
 		{ return(*(int *)0); }
 
+#undef unfocus_current_field
+int	unfocus_current_field(
+		FORM	*const form)
+		{ return(*(int *)0); }
+
 #undef current_field
 FIELD	*current_field(
 		const FORM *form)
@@ -127,27 +133,27 @@
 
 #undef _nc_Make_Argument
 TypeArgument *_nc_Make_Argument(
-		const FIELDTYPE *typ, 
-		va_list	*ap, 
+		const FIELDTYPE *typ,
+		va_list	*ap,
 		int	*err)
 		{ return(*(TypeArgument **)0); }
 
 #undef _nc_Copy_Argument
 TypeArgument *_nc_Copy_Argument(
-		const FIELDTYPE *typ, 
-		const TypeArgument *argp, 
+		const FIELDTYPE *typ,
+		const TypeArgument *argp,
 		int	*err)
 		{ return(*(TypeArgument **)0); }
 
 #undef _nc_Free_Argument
 void	_nc_Free_Argument(
-		const FIELDTYPE *typ, 
+		const FIELDTYPE *typ,
 		TypeArgument *argp)
 		{ /* void */ }
 
 #undef _nc_Copy_Type
 NCURSES_BOOL _nc_Copy_Type(
-		FIELD	*dst, 
+		FIELD	*dst,
 		FIELD const *src)
 		{ return(*(NCURSES_BOOL *)0); }
 
@@ -158,11 +164,11 @@
 
 #undef new_field
 FIELD	*new_field(
-		int	rows, 
-		int	cols, 
-		int	frow, 
-		int	fcol, 
-		int	nrow, 
+		int	rows,
+		int	cols,
+		int	frow,
+		int	fcol,
+		int	nrow,
 		int	nbuf)
 		{ return(*(FIELD **)0); }
 
@@ -175,8 +181,8 @@
 
 #undef dup_field
 FIELD	*dup_field(
-		FIELD	*field, 
-		int	frow, 
+		FIELD	*field,
+		int	frow,
 		int	fcol)
 		{ return(*(FIELD **)0); }
 
@@ -184,12 +190,12 @@
 
 #undef set_fieldtype_choice
 int	set_fieldtype_choice(
-		FIELDTYPE *typ, 
+		FIELDTYPE *typ,
 		NCURSES_BOOL (*const next_choice)(
-		FIELD	*p1, 
-		const void *p2), 
+		FIELD	*p1,
+		const void *p2),
 		NCURSES_BOOL (*const prev_choice)(
-		FIELD	*p1, 
+		FIELD	*p1,
 		const void *p2))
 		{ return(*(int *)0); }
 
@@ -197,7 +203,7 @@
 
 #undef link_fieldtype
 FIELDTYPE *link_fieldtype(
-		FIELDTYPE *type1, 
+		FIELDTYPE *type1,
 		FIELDTYPE *type2)
 		{ return(*(FIELDTYPE **)0); }
 
@@ -205,20 +211,20 @@
 
 #undef field_info
 int	field_info(
-		const FIELD *field, 
-		int	*rows, 
-		int	*cols, 
-		int	*frow, 
-		int	*fcol, 
-		int	*nrow, 
+		const FIELD *field,
+		int	*rows,
+		int	*cols,
+		int	*frow,
+		int	*fcol,
+		int	*nrow,
 		int	*nbuf)
 		{ return(*(int *)0); }
 
 #undef dynamic_field_info
 int	dynamic_field_info(
-		const FIELD *field, 
-		int	*drows, 
-		int	*dcols, 
+		const FIELD *field,
+		int	*drows,
+		int	*dcols,
 		int	*maxgrow)
 		{ return(*(int *)0); }
 
@@ -226,7 +232,7 @@
 
 #undef set_field_just
 int	set_field_just(
-		FIELD	*field, 
+		FIELD	*field,
 		int	just)
 		{ return(*(int *)0); }
 
@@ -239,8 +245,8 @@
 
 #undef link_field
 FIELD	*link_field(
-		FIELD	*field, 
-		int	frow, 
+		FIELD	*field,
+		int	frow,
 		int	fcol)
 		{ return(*(FIELD **)0); }
 
@@ -248,7 +254,7 @@
 
 #undef set_max_field
 int	set_max_field(
-		FIELD	*field, 
+		FIELD	*field,
 		int	maxgrow)
 		{ return(*(int *)0); }
 
@@ -256,8 +262,8 @@
 
 #undef move_field
 int	move_field(
-		FIELD	*field, 
-		int	frow, 
+		FIELD	*field,
+		int	frow,
 		int	fcol)
 		{ return(*(int *)0); }
 
@@ -269,10 +275,10 @@
 #undef new_fieldtype
 FIELDTYPE *new_fieldtype(
 		NCURSES_BOOL (*const field_check)(
-		FIELD	*p1, 
-		const void *p2), 
+		FIELD	*p1,
+		const void *p2),
 		NCURSES_BOOL (*const char_check)(
-		int	p1, 
+		int	p1,
 		const void *p2))
 		{ return(*(FIELDTYPE **)0); }
 
@@ -285,7 +291,7 @@
 
 #undef set_field_opts
 int	set_field_opts(
-		FIELD	*field, 
+		FIELD	*field,
 		Field_Options opts)
 		{ return(*(int *)0); }
 
@@ -296,13 +302,13 @@
 
 #undef field_opts_on
 int	field_opts_on(
-		FIELD	*field, 
+		FIELD	*field,
 		Field_Options opts)
 		{ return(*(int *)0); }
 
 #undef field_opts_off
 int	field_opts_off(
-		FIELD	*field, 
+		FIELD	*field,
 		Field_Options opts)
 		{ return(*(int *)0); }
 
@@ -310,7 +316,7 @@
 
 #undef set_field_pad
 int	set_field_pad(
-		FIELD	*field, 
+		FIELD	*field,
 		int	ch)
 		{ return(*(int *)0); }
 
@@ -323,7 +329,7 @@
 
 #undef set_new_page
 int	set_new_page(
-		FIELD	*field, 
+		FIELD	*field,
 		NCURSES_BOOL new_page_flag)
 		{ return(*(int *)0); }
 
@@ -336,7 +342,7 @@
 
 #undef set_field_status
 int	set_field_status(
-		FIELD	*field, 
+		FIELD	*field,
 		NCURSES_BOOL status)
 		{ return(*(int *)0); }
 
@@ -349,8 +355,8 @@
 
 #undef set_field_type
 int	set_field_type(
-		FIELD	*field, 
-		FIELDTYPE *type, 
+		FIELD	*field,
+		FIELDTYPE *type,
 		...)
 		{ return(*(int *)0); }
 
@@ -363,7 +369,7 @@
 
 #undef set_field_userptr
 int	set_field_userptr(
-		FIELD	*field, 
+		FIELD	*field,
 		void	*usrptr)
 		{ return(*(int *)0); }
 
@@ -398,7 +404,7 @@
 
 #undef new_form_sp
 FORM	*new_form_sp(
-		SCREEN	*sp, 
+		SCREEN	*sp,
 		FIELD	**fields)
 		{ return(*(FORM **)0); }
 
@@ -414,7 +420,7 @@
 
 #undef set_form_fields
 int	set_form_fields(
-		FORM	*form, 
+		FORM	*form,
 		FIELD	**fields)
 		{ return(*(int *)0); }
 
@@ -432,8 +438,8 @@
 
 #undef _nc_get_fieldbuffer
 void	_nc_get_fieldbuffer(
-		FORM	*form, 
-		FIELD	*field, 
+		FORM	*form,
+		FIELD	*field,
 		cchar_t	*buf)
 		{ /* void */ }
 
@@ -454,13 +460,18 @@
 
 #undef _nc_Synchronize_Options
 int	_nc_Synchronize_Options(
-		FIELD	*field, 
+		FIELD	*field,
 		Field_Options newopts)
 		{ return(*(int *)0); }
 
+#undef _nc_Unset_Current_Field
+void	_nc_Unset_Current_Field(
+		FORM	*form)
+		{ /* void */ }
+
 #undef _nc_Set_Current_Field
 int	_nc_Set_Current_Field(
-		FORM	*form, 
+		FORM	*form,
 		FIELD	*newfield)
 		{ return(*(int *)0); }
 
@@ -476,47 +487,47 @@
 
 #undef _nc_Set_Form_Page
 int	_nc_Set_Form_Page(
-		FORM	*form, 
-		int	page, 
+		FORM	*form,
+		int	page,
 		FIELD	*field)
 		{ return(*(int *)0); }
 
 typedef struct
 {
-  int keycode; 
-  int (*cmd) (FORM *); 
+  int keycode;
+  int (*cmd) (FORM *);
 }
 Binding_Info;
 
 #undef form_driver
 int	form_driver(
-		FORM	*form, 
+		FORM	*form,
 		int	c)
 		{ return(*(int *)0); }
 
 #undef form_driver_w
 int	form_driver_w(
-		FORM	*form, 
-		int	type, 
+		FORM	*form,
+		int	type,
 		wchar_t	c)
 		{ return(*(int *)0); }
 
 #undef set_field_buffer
 int	set_field_buffer(
-		FIELD	*field, 
-		int	buffer, 
+		FIELD	*field,
+		int	buffer,
 		const char *value)
 		{ return(*(int *)0); }
 
 #undef field_buffer
 char	*field_buffer(
-		const FIELD *field, 
+		const FIELD *field,
 		int	buffer)
 		{ return(*(char **)0); }
 
 #undef _nc_Widen_String
 wchar_t	*_nc_Widen_String(
-		char	*source, 
+		char	*source,
 		int	*lengthp)
 		{ return(*(wchar_t **)0); }
 
@@ -524,7 +535,7 @@
 
 #undef set_field_init
 int	set_field_init(
-		FORM	*form, 
+		FORM	*form,
 		Form_Hook func)
 		{ return(*(int *)0); }
 
@@ -535,7 +546,7 @@
 
 #undef set_field_term
 int	set_field_term(
-		FORM	*form, 
+		FORM	*form,
 		Form_Hook func)
 		{ return(*(int *)0); }
 
@@ -546,7 +557,7 @@
 
 #undef set_form_init
 int	set_form_init(
-		FORM	*form, 
+		FORM	*form,
 		Form_Hook func)
 		{ return(*(int *)0); }
 
@@ -557,7 +568,7 @@
 
 #undef set_form_term
 int	set_form_term(
-		FORM	*form, 
+		FORM	*form,
 		Form_Hook func)
 		{ return(*(int *)0); }
 
@@ -570,7 +581,7 @@
 
 #undef set_form_opts
 int	set_form_opts(
-		FORM	*form, 
+		FORM	*form,
 		Form_Options opts)
 		{ return(*(int *)0); }
 
@@ -581,13 +592,13 @@
 
 #undef form_opts_on
 int	form_opts_on(
-		FORM	*form, 
+		FORM	*form,
 		Form_Options opts)
 		{ return(*(int *)0); }
 
 #undef form_opts_off
 int	form_opts_off(
-		FORM	*form, 
+		FORM	*form,
 		Form_Options opts)
 		{ return(*(int *)0); }
 
@@ -595,7 +606,7 @@
 
 #undef set_form_page
 int	set_form_page(
-		FORM	*form, 
+		FORM	*form,
 		int	page)
 		{ return(*(int *)0); }
 
@@ -632,8 +643,8 @@
 
 #undef scale_form
 int	scale_form(
-		const FORM *form, 
-		int	*rows, 
+		const FORM *form,
+		int	*rows,
 		int	*cols)
 		{ return(*(int *)0); }
 
@@ -641,7 +652,7 @@
 
 #undef set_form_sub
 int	set_form_sub(
-		FORM	*form, 
+		FORM	*form,
 		WINDOW	*win)
 		{ return(*(int *)0); }
 
@@ -654,7 +665,7 @@
 
 #undef set_form_userptr
 int	set_form_userptr(
-		FORM	*form, 
+		FORM	*form,
 		void	*usrptr)
 		{ return(*(int *)0); }
 
@@ -667,7 +678,7 @@
 
 #undef set_form_win
 int	set_form_win(
-		FORM	*form, 
+		FORM	*form,
 		WINDOW	*win)
 		{ return(*(int *)0); }
 
@@ -737,38 +748,38 @@
 #undef _nc_generic_fieldtype
 FIELDTYPE *_nc_generic_fieldtype(
 		NCURSES_BOOL (*const field_check)(
-		FORM	*p1, 
-		FIELD	*p2, 
-		const void *p3), 
+		FORM	*p1,
+		FIELD	*p2,
+		const void *p3),
 		NCURSES_BOOL (*const char_check)(
-		int	p1, 
-		FORM	*p2, 
-		FIELD	*p3, 
-		const void *p4), 
+		int	p1,
+		FORM	*p2,
+		FIELD	*p3,
+		const void *p4),
 		NCURSES_BOOL (*const next)(
-		FORM	*p1, 
-		FIELD	*p2, 
-		const void *p3), 
+		FORM	*p1,
+		FIELD	*p2,
+		const void *p3),
 		NCURSES_BOOL (*const prev)(
-		FORM	*p1, 
-		FIELD	*p2, 
-		const void *p3), 
+		FORM	*p1,
+		FIELD	*p2,
+		const void *p3),
 		void	(*freecallback)(
 		void	*p1))
 		{ return(*(FIELDTYPE **)0); }
 
 #undef _nc_set_generic_fieldtype
 int	_nc_set_generic_fieldtype(
-		FIELD	*field, 
-		FIELDTYPE *ftyp, 
+		FIELD	*field,
+		FIELDTYPE *ftyp,
 		int	(*argiterator)(
 		void	**p1))
 		{ return(*(int *)0); }
 
 #undef _nc_form_cursor
 WINDOW	*_nc_form_cursor(
-		const FORM *form, 
-		int	*pRow, 
+		const FORM *form,
+		int	*pRow,
 		int	*pCol)
 		{ return(*(WINDOW **)0); }
 
@@ -808,8 +819,6 @@
 
 /* ./fty_num.c */
 
-#include <locale.h>
-
 typedef struct
   {
     int precision;
@@ -836,8 +845,6 @@
 
 /* ./fty_regex.c */
 
-#include <regex.h>
-
 typedef struct
   {
     regex_t *pRegExp;
diff --git a/form/llib-lformw b/form/llib-lformw
index f6a685f..199e26c 100644
--- a/form/llib-lformw
+++ b/form/llib-lformw
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 2002-2013,2015 Free Software Foundation, Inc.              *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 2002-2015,2017 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            *
@@ -64,11 +65,11 @@
 
 #undef set_fieldtype_arg
 int	set_fieldtype_arg(
-		FIELDTYPE *typ, 
+		FIELDTYPE *typ,
 		void	*(*const make_arg)(
-		va_list	*p1), 
+		va_list	*p1),
 		void	*(*const copy_arg)(
-		const void *p1), 
+		const void *p1),
 		void	(*const free_arg)(
 		void	*p1))
 		{ return(*(int *)0); }
@@ -82,7 +83,7 @@
 
 #undef set_field_fore
 int	set_field_fore(
-		FIELD	*field, 
+		FIELD	*field,
 		chtype	attr)
 		{ return(*(int *)0); }
 
@@ -93,7 +94,7 @@
 
 #undef set_field_back
 int	set_field_back(
-		FIELD	*field, 
+		FIELD	*field,
 		chtype	attr)
 		{ return(*(int *)0); }
 
@@ -106,10 +107,15 @@
 
 #undef set_current_field
 int	set_current_field(
-		FORM	*form, 
+		FORM	*form,
 		FIELD	*field)
 		{ return(*(int *)0); }
 
+#undef unfocus_current_field
+int	unfocus_current_field(
+		FORM	*const form)
+		{ return(*(int *)0); }
+
 #undef current_field
 FIELD	*current_field(
 		const FORM *form)
@@ -127,27 +133,27 @@
 
 #undef _nc_Make_Argument
 TypeArgument *_nc_Make_Argument(
-		const FIELDTYPE *typ, 
-		va_list	*ap, 
+		const FIELDTYPE *typ,
+		va_list	*ap,
 		int	*err)
 		{ return(*(TypeArgument **)0); }
 
 #undef _nc_Copy_Argument
 TypeArgument *_nc_Copy_Argument(
-		const FIELDTYPE *typ, 
-		const TypeArgument *argp, 
+		const FIELDTYPE *typ,
+		const TypeArgument *argp,
 		int	*err)
 		{ return(*(TypeArgument **)0); }
 
 #undef _nc_Free_Argument
 void	_nc_Free_Argument(
-		const FIELDTYPE *typ, 
+		const FIELDTYPE *typ,
 		TypeArgument *argp)
 		{ /* void */ }
 
 #undef _nc_Copy_Type
 NCURSES_BOOL _nc_Copy_Type(
-		FIELD	*dst, 
+		FIELD	*dst,
 		FIELD const *src)
 		{ return(*(NCURSES_BOOL *)0); }
 
@@ -158,11 +164,11 @@
 
 #undef new_field
 FIELD	*new_field(
-		int	rows, 
-		int	cols, 
-		int	frow, 
-		int	fcol, 
-		int	nrow, 
+		int	rows,
+		int	cols,
+		int	frow,
+		int	fcol,
+		int	nrow,
 		int	nbuf)
 		{ return(*(FIELD **)0); }
 
@@ -175,8 +181,8 @@
 
 #undef dup_field
 FIELD	*dup_field(
-		FIELD	*field, 
-		int	frow, 
+		FIELD	*field,
+		int	frow,
 		int	fcol)
 		{ return(*(FIELD **)0); }
 
@@ -184,12 +190,12 @@
 
 #undef set_fieldtype_choice
 int	set_fieldtype_choice(
-		FIELDTYPE *typ, 
+		FIELDTYPE *typ,
 		NCURSES_BOOL (*const next_choice)(
-		FIELD	*p1, 
-		const void *p2), 
+		FIELD	*p1,
+		const void *p2),
 		NCURSES_BOOL (*const prev_choice)(
-		FIELD	*p1, 
+		FIELD	*p1,
 		const void *p2))
 		{ return(*(int *)0); }
 
@@ -197,7 +203,7 @@
 
 #undef link_fieldtype
 FIELDTYPE *link_fieldtype(
-		FIELDTYPE *type1, 
+		FIELDTYPE *type1,
 		FIELDTYPE *type2)
 		{ return(*(FIELDTYPE **)0); }
 
@@ -205,20 +211,20 @@
 
 #undef field_info
 int	field_info(
-		const FIELD *field, 
-		int	*rows, 
-		int	*cols, 
-		int	*frow, 
-		int	*fcol, 
-		int	*nrow, 
+		const FIELD *field,
+		int	*rows,
+		int	*cols,
+		int	*frow,
+		int	*fcol,
+		int	*nrow,
 		int	*nbuf)
 		{ return(*(int *)0); }
 
 #undef dynamic_field_info
 int	dynamic_field_info(
-		const FIELD *field, 
-		int	*drows, 
-		int	*dcols, 
+		const FIELD *field,
+		int	*drows,
+		int	*dcols,
 		int	*maxgrow)
 		{ return(*(int *)0); }
 
@@ -226,7 +232,7 @@
 
 #undef set_field_just
 int	set_field_just(
-		FIELD	*field, 
+		FIELD	*field,
 		int	just)
 		{ return(*(int *)0); }
 
@@ -239,8 +245,8 @@
 
 #undef link_field
 FIELD	*link_field(
-		FIELD	*field, 
-		int	frow, 
+		FIELD	*field,
+		int	frow,
 		int	fcol)
 		{ return(*(FIELD **)0); }
 
@@ -248,7 +254,7 @@
 
 #undef set_max_field
 int	set_max_field(
-		FIELD	*field, 
+		FIELD	*field,
 		int	maxgrow)
 		{ return(*(int *)0); }
 
@@ -256,8 +262,8 @@
 
 #undef move_field
 int	move_field(
-		FIELD	*field, 
-		int	frow, 
+		FIELD	*field,
+		int	frow,
 		int	fcol)
 		{ return(*(int *)0); }
 
@@ -269,10 +275,10 @@
 #undef new_fieldtype
 FIELDTYPE *new_fieldtype(
 		NCURSES_BOOL (*const field_check)(
-		FIELD	*p1, 
-		const void *p2), 
+		FIELD	*p1,
+		const void *p2),
 		NCURSES_BOOL (*const char_check)(
-		int	p1, 
+		int	p1,
 		const void *p2))
 		{ return(*(FIELDTYPE **)0); }
 
@@ -285,7 +291,7 @@
 
 #undef set_field_opts
 int	set_field_opts(
-		FIELD	*field, 
+		FIELD	*field,
 		Field_Options opts)
 		{ return(*(int *)0); }
 
@@ -296,13 +302,13 @@
 
 #undef field_opts_on
 int	field_opts_on(
-		FIELD	*field, 
+		FIELD	*field,
 		Field_Options opts)
 		{ return(*(int *)0); }
 
 #undef field_opts_off
 int	field_opts_off(
-		FIELD	*field, 
+		FIELD	*field,
 		Field_Options opts)
 		{ return(*(int *)0); }
 
@@ -310,7 +316,7 @@
 
 #undef set_field_pad
 int	set_field_pad(
-		FIELD	*field, 
+		FIELD	*field,
 		int	ch)
 		{ return(*(int *)0); }
 
@@ -323,7 +329,7 @@
 
 #undef set_new_page
 int	set_new_page(
-		FIELD	*field, 
+		FIELD	*field,
 		NCURSES_BOOL new_page_flag)
 		{ return(*(int *)0); }
 
@@ -336,7 +342,7 @@
 
 #undef set_field_status
 int	set_field_status(
-		FIELD	*field, 
+		FIELD	*field,
 		NCURSES_BOOL status)
 		{ return(*(int *)0); }
 
@@ -349,8 +355,8 @@
 
 #undef set_field_type
 int	set_field_type(
-		FIELD	*field, 
-		FIELDTYPE *type, 
+		FIELD	*field,
+		FIELDTYPE *type,
 		...)
 		{ return(*(int *)0); }
 
@@ -363,7 +369,7 @@
 
 #undef set_field_userptr
 int	set_field_userptr(
-		FIELD	*field, 
+		FIELD	*field,
 		void	*usrptr)
 		{ return(*(int *)0); }
 
@@ -398,7 +404,7 @@
 
 #undef new_form_sp
 FORM	*new_form_sp(
-		SCREEN	*sp, 
+		SCREEN	*sp,
 		FIELD	**fields)
 		{ return(*(FORM **)0); }
 
@@ -414,7 +420,7 @@
 
 #undef set_form_fields
 int	set_form_fields(
-		FORM	*form, 
+		FORM	*form,
 		FIELD	**fields)
 		{ return(*(int *)0); }
 
@@ -432,8 +438,8 @@
 
 #undef _nc_get_fieldbuffer
 void	_nc_get_fieldbuffer(
-		FORM	*form, 
-		FIELD	*field, 
+		FORM	*form,
+		FIELD	*field,
 		cchar_t	*buf)
 		{ /* void */ }
 
@@ -454,13 +460,18 @@
 
 #undef _nc_Synchronize_Options
 int	_nc_Synchronize_Options(
-		FIELD	*field, 
+		FIELD	*field,
 		Field_Options newopts)
 		{ return(*(int *)0); }
 
+#undef _nc_Unset_Current_Field
+void	_nc_Unset_Current_Field(
+		FORM	*form)
+		{ /* void */ }
+
 #undef _nc_Set_Current_Field
 int	_nc_Set_Current_Field(
-		FORM	*form, 
+		FORM	*form,
 		FIELD	*newfield)
 		{ return(*(int *)0); }
 
@@ -476,47 +487,47 @@
 
 #undef _nc_Set_Form_Page
 int	_nc_Set_Form_Page(
-		FORM	*form, 
-		int	page, 
+		FORM	*form,
+		int	page,
 		FIELD	*field)
 		{ return(*(int *)0); }
 
 typedef struct
 {
-  int keycode; 
-  int (*cmd) (FORM *); 
+  int keycode;
+  int (*cmd) (FORM *);
 }
 Binding_Info;
 
 #undef form_driver
 int	form_driver(
-		FORM	*form, 
+		FORM	*form,
 		int	c)
 		{ return(*(int *)0); }
 
 #undef form_driver_w
 int	form_driver_w(
-		FORM	*form, 
-		int	type, 
+		FORM	*form,
+		int	type,
 		wchar_t	c)
 		{ return(*(int *)0); }
 
 #undef set_field_buffer
 int	set_field_buffer(
-		FIELD	*field, 
-		int	buffer, 
+		FIELD	*field,
+		int	buffer,
 		const char *value)
 		{ return(*(int *)0); }
 
 #undef field_buffer
 char	*field_buffer(
-		const FIELD *field, 
+		const FIELD *field,
 		int	buffer)
 		{ return(*(char **)0); }
 
 #undef _nc_Widen_String
 wchar_t	*_nc_Widen_String(
-		char	*source, 
+		char	*source,
 		int	*lengthp)
 		{ return(*(wchar_t **)0); }
 
@@ -524,7 +535,7 @@
 
 #undef set_field_init
 int	set_field_init(
-		FORM	*form, 
+		FORM	*form,
 		Form_Hook func)
 		{ return(*(int *)0); }
 
@@ -535,7 +546,7 @@
 
 #undef set_field_term
 int	set_field_term(
-		FORM	*form, 
+		FORM	*form,
 		Form_Hook func)
 		{ return(*(int *)0); }
 
@@ -546,7 +557,7 @@
 
 #undef set_form_init
 int	set_form_init(
-		FORM	*form, 
+		FORM	*form,
 		Form_Hook func)
 		{ return(*(int *)0); }
 
@@ -557,7 +568,7 @@
 
 #undef set_form_term
 int	set_form_term(
-		FORM	*form, 
+		FORM	*form,
 		Form_Hook func)
 		{ return(*(int *)0); }
 
@@ -570,7 +581,7 @@
 
 #undef set_form_opts
 int	set_form_opts(
-		FORM	*form, 
+		FORM	*form,
 		Form_Options opts)
 		{ return(*(int *)0); }
 
@@ -581,13 +592,13 @@
 
 #undef form_opts_on
 int	form_opts_on(
-		FORM	*form, 
+		FORM	*form,
 		Form_Options opts)
 		{ return(*(int *)0); }
 
 #undef form_opts_off
 int	form_opts_off(
-		FORM	*form, 
+		FORM	*form,
 		Form_Options opts)
 		{ return(*(int *)0); }
 
@@ -595,7 +606,7 @@
 
 #undef set_form_page
 int	set_form_page(
-		FORM	*form, 
+		FORM	*form,
 		int	page)
 		{ return(*(int *)0); }
 
@@ -632,8 +643,8 @@
 
 #undef scale_form
 int	scale_form(
-		const FORM *form, 
-		int	*rows, 
+		const FORM *form,
+		int	*rows,
 		int	*cols)
 		{ return(*(int *)0); }
 
@@ -641,7 +652,7 @@
 
 #undef set_form_sub
 int	set_form_sub(
-		FORM	*form, 
+		FORM	*form,
 		WINDOW	*win)
 		{ return(*(int *)0); }
 
@@ -654,7 +665,7 @@
 
 #undef set_form_userptr
 int	set_form_userptr(
-		FORM	*form, 
+		FORM	*form,
 		void	*usrptr)
 		{ return(*(int *)0); }
 
@@ -667,7 +678,7 @@
 
 #undef set_form_win
 int	set_form_win(
-		FORM	*form, 
+		FORM	*form,
 		WINDOW	*win)
 		{ return(*(int *)0); }
 
@@ -737,38 +748,38 @@
 #undef _nc_generic_fieldtype
 FIELDTYPE *_nc_generic_fieldtype(
 		NCURSES_BOOL (*const field_check)(
-		FORM	*p1, 
-		FIELD	*p2, 
-		const void *p3), 
+		FORM	*p1,
+		FIELD	*p2,
+		const void *p3),
 		NCURSES_BOOL (*const char_check)(
-		int	p1, 
-		FORM	*p2, 
-		FIELD	*p3, 
-		const void *p4), 
+		int	p1,
+		FORM	*p2,
+		FIELD	*p3,
+		const void *p4),
 		NCURSES_BOOL (*const next)(
-		FORM	*p1, 
-		FIELD	*p2, 
-		const void *p3), 
+		FORM	*p1,
+		FIELD	*p2,
+		const void *p3),
 		NCURSES_BOOL (*const prev)(
-		FORM	*p1, 
-		FIELD	*p2, 
-		const void *p3), 
+		FORM	*p1,
+		FIELD	*p2,
+		const void *p3),
 		void	(*freecallback)(
 		void	*p1))
 		{ return(*(FIELDTYPE **)0); }
 
 #undef _nc_set_generic_fieldtype
 int	_nc_set_generic_fieldtype(
-		FIELD	*field, 
-		FIELDTYPE *ftyp, 
+		FIELD	*field,
+		FIELDTYPE *ftyp,
 		int	(*argiterator)(
 		void	**p1))
 		{ return(*(int *)0); }
 
 #undef _nc_form_cursor
 WINDOW	*_nc_form_cursor(
-		const FORM *form, 
-		int	*pRow, 
+		const FORM *form,
+		int	*pRow,
 		int	*pCol)
 		{ return(*(WINDOW **)0); }
 
@@ -808,8 +819,6 @@
 
 /* ./fty_num.c */
 
-#include <locale.h>
-
 typedef struct
   {
     int precision;
@@ -836,8 +845,6 @@
 
 /* ./fty_regex.c */
 
-#include <regex.h>
-
 typedef struct
   {
     regex_t *pRegExp;
diff --git a/form/modules b/form/modules
index 205356b..47a3ddf 100644
--- a/form/modules
+++ b/form/modules
@@ -1,6 +1,7 @@
-# $Id: modules,v 1.17 2010/01/23 16:26:37 tom Exp $
+# $Id: modules,v 1.18 2020/02/02 23:34:34 tom Exp $
 ##############################################################################
-# Copyright (c) 1998-2009,2010 Free Software Foundation, Inc.                #
+# Copyright 2020 Thomas E. Dickey                                            #
+# Copyright 1998-2008,2010 Free Software Foundation, Inc.                    #
 #                                                                            #
 # Permission is hereby granted, free of charge, to any person obtaining a    #
 # copy of this software and associated documentation files (the "Software"), #