diff --git a/contrib/ncurses/COPYING b/contrib/ncurses/COPYING
new file mode 100644
index 000000000000..6e3b39483181
--- /dev/null
+++ b/contrib/ncurses/COPYING
@@ -0,0 +1,28 @@
+Copyright (c) 1998-2013,2014 Free Software Foundation, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"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.
+
+-- vile:txtmode fc=72
+-- $Id: COPYING,v 1.2 2014/01/18 23:59:29 tom Exp $
diff --git a/contrib/ncurses/INSTALL b/contrib/ncurses/INSTALL
index eb26ab103ef8..9b0ac23d88b1 100644
--- a/contrib/ncurses/INSTALL
+++ b/contrib/ncurses/INSTALL
@@ -1,5 +1,5 @@
-------------------------------------------------------------------------------
--- Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. --
+-- Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
@@ -25,7 +25,7 @@
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
--- $Id: INSTALL,v 1.155 2011/03/31 08:27:24 tom Exp $
+-- $Id: INSTALL,v 1.168 2013/08/03 23:15:23 tom Exp $
---------------------------------------------------------------------
How to install Ncurses/Terminfo on your system
---------------------------------------------------------------------
@@ -315,6 +315,10 @@ SUMMARY OF CONFIGURE OPTIONS:
programs are useful in this configuration, e.g., reset and tput versus
infocmp and tic.
+ --disable-db-install
+ Do not install the terminal database. This is used to omit features
+ for packages, as done with --without-progs.
+
--disable-ext-funcs
Disable function-extensions. Configure ncurses without the functions
that are not specified by XSI. See ncurses/modules for the exact
@@ -407,13 +411,14 @@ SUMMARY OF CONFIGURE OPTIONS:
--disable-tic-depends
When building shared libraries, normally the tic library is linked to
- depend upon the ncurses library (and in turn, on the term-library if
- the --with-termlib option was given). The tic- and term-libraries
- ABI does not depend on the --enable-widec option. Some packagers have
- used this to reduce the number of library files which are packaged
- by using only one copy of those libraries. To make this work properly,
+ depend upon the ncurses library (or equivalently, on the tinfo-library
+ if the --with-termlib option was given). The tic- and tinfo-library
+ ABIs do not depend on the --enable-widec option. Some packagers have
+ used this to reduce the number of library files which are packaged by
+ using only one copy of those libraries. To make this work properly,
the tic library must be built without an explicit dependency on the
- ncurses (or ncursesw) library. Use this configure option to do that.
+ underlying library (ncurses vs ncursesw, tinfo vs tinfow). Use this
+ configure option to do that.
For example
configure --with-ticlib --with-shared --disable-tic-depends
@@ -555,6 +560,9 @@ SUMMARY OF CONFIGURE OPTIONS:
library by reducing global and static variables. This option is also
set if --with-pthread is used.
+ Enabling this option adds a "t" to the library names, except for the
+ special case when --enable-weak-symbols is also used.
+
--enable-rpath
Use rpath option when generating shared libraries, and (with some
restrictions) when linking the corresponding programs. This originally
@@ -595,6 +603,14 @@ SUMMARY OF CONFIGURE OPTIONS:
reducing the need for juggling the global SP value with set_term() and
delscreen().
+ --enable-string-hacks
+ Controls whether strlcat and strlcpy may be used. The same issue
+ applies to OpenBSD's warnings about snprintf, noting that this function
+ is weakly standardized.
+
+ Aside from stifling these warnings, there is no functional improvement
+ in ncurses.
+
--enable-symlinks
If your system supports symbolic links, make tic use symbolic links
rather than hard links to save diskspace when writing aliases in the
@@ -616,6 +632,12 @@ SUMMARY OF CONFIGURE OPTIONS:
match is found in the terminfo database. See also the --enable-getcap
and --enable-getcap-cache options.
+ Termcap support requires run-time parsing rather than loading
+ predigested data. If you have specified --with-ticlib, then you
+ cannot have termcap support since run-time parsing is done in the
+ tic library, which is intentionally not part of normal linkage
+ dependencies.
+
--enable-warnings
Turn on GCC compiler warnings. There should be only a few.
@@ -740,6 +762,12 @@ SUMMARY OF CONFIGURE OPTIONS:
executables, e.g., by setting "--with-chtype=long" (the configure
script supplies "unsigned").
+ --with-cxx-shared
+ When --with-shared is set, build libncurses++ as a shared library.
+ This implicitly relies upon building with gcc/g++, since other
+ compiler suites may have differences in the way shared libraries are
+ built. libtool by the way has similar limitations.
+
--with-database=XXX
Specify the terminfo source file to install. Usually you will wish
to install ncurses' default (misc/terminfo.src). Certain systems
@@ -824,7 +852,17 @@ SUMMARY OF CONFIGURE OPTIONS:
NOTE: a few systems build shared libraries with fixed pathnames; this
option probably will not work for those configurations.
- --with-libtool[=XXX]
+ --with-lib-prefix=XXX
+ OS/2 EMX used a different naming convention from most Unix-like
+ platforms. It required that the "lib" part of a library name was
+ omitted. Newer EMX as part of eComStation does not follow that
+ convention. Use this option to override the configure script's
+ assumptions about the library-prefix. If this option is omitted, it
+ uses the original OS/2 EMX convention for that platform. Use
+ "--with-lib-prefix=lib" for the newer EMX in eComStation. Use
+ "--without-lib-prefix" to suppress it for other odd platforms.
+
+ --with-libtool[=XXX]
Generate libraries with libtool. If this option is selected, then it
overrides all other library model specifications. Note that libtool
must already be installed, uses makefile rules dependent on GNU make,
@@ -904,6 +942,10 @@ SUMMARY OF CONFIGURE OPTIONS:
--with-pkg-config=[DIR]
Check for pkg-config, optionally specifying its path.
+ --with-pkg-config-libdir=[DIR]
+ If pkg-config was found, override the automatic check for its library
+ path.
+
--with-profile
Generate profile-libraries These are named by adding "_p" to the root,
e.g., libncurses_p.a
@@ -996,10 +1038,27 @@ SUMMARY OF CONFIGURE OPTIONS:
library dependencies for tic and other programs built with the tic
library.
+ --with-tparm-arg[=XXX]
+ Override the type used for tparm() arguments, which normally is a
+ "long". However the function must assume that its arguments can hold a
+ pointer to char's which is not always workable for 64-bit platforms. A
+ better choice would be intptr_t, which was not available at the time
+ tparm's interface was defined.
+
+ If the option is not given, this defaults to "long".
+
--with-trace
Configure the trace() function as part of the all models of the ncurses
library. Normally it is part of the debug (libncurses_g) library only.
+ --with-xterm-kbs=XXX
+ Configure xterm's terminfo entries to use either BS (^H, i.e., ASCII
+ backspace) or DEL (^?, or 127). XXX can be BS (or bs, 8) or DEL
+ (or del, 127).
+
+ During installation, the makefile and scripts modifies the "xterm+kbs"
+ terminfo entry to use this setting.
+
--with-valgrind
For testing, compile with debug option.
This also sets the --disable-leaks option.
@@ -1024,6 +1083,8 @@ SUMMARY OF CONFIGURE OPTIONS:
install as "ncurses.h" and modify the installed headers and manpages
accordingly.
+ Likewise, do not install an alias "curses" for the ncurses manpage.
+
--without-cxx
XSI curses declares "bool" as part of the interface. C++ also declares
"bool". Neither specifies the size and type of booleans, but both
@@ -1726,20 +1787,37 @@ CONFIGURING FALLBACK ENTRIES:
By default, there are no entries on the fallback list. After you have
built the ncurses suite for the first time, you can change the list
(the process needs infocmp(1)). To do so, use the script
- ncurses/tinfo/MKfallback.sh. A configure script option
+ ncurses/tinfo/MKfallback.sh. The configure script option
--with-fallbacks does this (it accepts a comma-separated list of the
names you wish, and does not require a rebuild).
If you wanted (say) to have linux, vt100, and xterm fallbacks, you
- would use the commands
+ might use the commands
cd ncurses;
- tinfo/MKfallback.sh linux vt100 xterm >fallback.c
+ tinfo/MKfallback.sh \
+ $TERMINFO \
+ ../misc/terminfo.src \
+ `which tic` \
+ linux vt100 xterm >fallback.c
+
+ The first three parameters of the script are normally supplied by
+ the configured makefiles via the "--with-fallbacks" option. They
+ are
+
+ 1) the location of the terminfo database
+ 2) the source for the terminfo entries
+ 3) the location of the tic program, used to create a terminfo
+ database.
Then just rebuild and reinstall the library as you would normally.
You can restore the default empty fallback list with
- tinfo/MKfallback.sh >fallback.c
+ tinfo/MKfallback.sh \
+ $TERMINFO \
+ ../misc/terminfo.src \
+ `which tic` \
+ >fallback.c
The overhead for an empty fallback list is one trivial stub function.
Any non-empty fallback list is const-ed and therefore lives in sharable
diff --git a/contrib/ncurses/MANIFEST b/contrib/ncurses/MANIFEST
index 421cc678cd6b..e35f9854ccc9 100644
--- a/contrib/ncurses/MANIFEST
+++ b/contrib/ncurses/MANIFEST
@@ -190,6 +190,7 @@
./Ada95/src/terminal_interface-curses-text_io.ads
./Ada95/src/terminal_interface-curses-trace.adb_p
./Ada95/src/terminal_interface.ads
+./COPYING
./INSTALL
./MANIFEST
./Makefile.in
@@ -545,6 +546,8 @@
./include/nc_alloc.h
./include/nc_mingw.h
./include/nc_panel.h
+./include/nc_string.h
+./include/nc_termios.h
./include/nc_tparm.h
./include/ncurses_cfg.hin
./include/ncurses_defs
@@ -656,6 +659,8 @@
./man/legacy_coding.3x
./man/make_sed.sh
./man/man_db.renames
+./man/manhtml.aliases
+./man/manhtml.externs
./man/manlinks.sed
./man/menu.3x
./man/menu_attributes.3x
@@ -764,7 +769,6 @@
./mk-0th.awk
./mk-1st.awk
./mk-2nd.awk
-./mk-dlls.sh.in
./mk-hdr.awk
./ncurses/Makefile.in
./ncurses/README
@@ -850,7 +854,6 @@
./ncurses/base/lib_wattron.c
./ncurses/base/lib_winch.c
./ncurses/base/lib_window.c
-./ncurses/base/memmove.c
./ncurses/base/nc_panel.c
./ncurses/base/resizeterm.c
./ncurses/base/safe_sprintf.c
@@ -867,6 +870,14 @@
./ncurses/llib-lncursest
./ncurses/llib-lncursestw
./ncurses/llib-lncursesw
+./ncurses/llib-ltic
+./ncurses/llib-ltict
+./ncurses/llib-ltictw
+./ncurses/llib-lticw
+./ncurses/llib-ltinfo
+./ncurses/llib-ltinfot
+./ncurses/llib-ltinfotw
+./ncurses/llib-ltinfow
./ncurses/modules
./ncurses/tinfo/MKcaptab.awk
./ncurses/tinfo/MKcaptab.sh
@@ -915,10 +926,10 @@
./ncurses/tinfo/make_hash.c
./ncurses/tinfo/make_keys.c
./ncurses/tinfo/name_match.c
+./ncurses/tinfo/obsolete.c
./ncurses/tinfo/parse_entry.c
./ncurses/tinfo/read_entry.c
./ncurses/tinfo/read_termcap.c
-./ncurses/tinfo/setbuf.c
./ncurses/tinfo/strings.c
./ncurses/tinfo/tinfo_driver.c
./ncurses/tinfo/trim_sgr0.c
@@ -943,8 +954,6 @@
./ncurses/tty/lib_tstp.c
./ncurses/tty/lib_twait.c
./ncurses/tty/lib_vidattr.c
-./ncurses/tty/tty_display.h
-./ncurses/tty/tty_input.h
./ncurses/tty/tty_update.c
./ncurses/wcwidth.h
./ncurses/widechar/charable.c
@@ -967,9 +976,34 @@
./ncurses/widechar/lib_vline_set.c
./ncurses/widechar/lib_wacs.c
./ncurses/widechar/lib_wunctrl.c
+./ncurses/widechar/widechars.c
./ncurses/win32con/gettimeofday.c
./ncurses/win32con/wcwidth.c
./ncurses/win32con/win_driver.c
+./package/debian-mingw/changelog
+./package/debian-mingw/compat
+./package/debian-mingw/control
+./package/debian-mingw/copyright
+./package/debian-mingw/rules
+./package/debian-mingw/source/format
+./package/debian-mingw/watch
+./package/debian-mingw64/changelog
+./package/debian-mingw64/compat
+./package/debian-mingw64/control
+./package/debian-mingw64/copyright
+./package/debian-mingw64/rules
+./package/debian-mingw64/source/format
+./package/debian-mingw64/watch
+./package/debian/changelog
+./package/debian/compat
+./package/debian/control
+./package/debian/copyright
+./package/debian/rules
+./package/debian/source/format
+./package/debian/watch
+./package/mingw-ncurses.nsi
+./package/mingw-ncurses.spec
+./package/ncurses.spec
./panel/Makefile.in
./panel/headers
./panel/llib-lpanel
@@ -1022,12 +1056,14 @@
./test/cardfile.dat
./test/chgat.c
./test/clip_printw.c
+./test/color_name.h
./test/color_set.c
./test/configure
./test/configure.in
./test/demo_altkeys.c
./test/demo_defkey.c
./test/demo_forms.c
+./test/demo_forms.txt
./test/demo_keyok.c
./test/demo_menus.c
./test/demo_panels.c
@@ -1036,6 +1072,7 @@
./test/ditto.c
./test/dots.c
./test/dots_mvcur.c
+./test/dots_termcap.c
./test/echochar.c
./test/edit_field.c
./test/edit_field.h
@@ -1043,6 +1080,7 @@
./test/firework.c
./test/firstlast.c
./test/foldkeys.c
+./test/form_driver_w.c
./test/gdc.6
./test/gdc.c
./test/hanoi.c
@@ -1073,6 +1111,7 @@
./test/package/debian/rules
./test/package/debian/source/format
./test/package/debian/watch
+./test/package/mingw-ncurses-examples.spec
./test/package/ncurses-examples.spec
./test/programs
./test/railroad.c
@@ -1092,12 +1131,15 @@
./test/test_instr.c
./test/test_inwstr.c
./test/test_opaque.c
+./test/test_vid_puts.c
+./test/test_vidputs.c
./test/testaddch.c
./test/testcurs.c
./test/testscanw.c
./test/tracemunch
./test/view.c
./test/widechars-utf8.txt
+./test/widechars.h
./test/worm.c
./test/xmas.c
./test/xterm-16color.dat
diff --git a/contrib/ncurses/Makefile.in b/contrib/ncurses/Makefile.in
index d891e002fd83..803746c2b6a7 100644
--- a/contrib/ncurses/Makefile.in
+++ b/contrib/ncurses/Makefile.in
@@ -1,6 +1,6 @@
-# $Id: Makefile.in,v 1.30 2010/11/27 21:45:27 tom Exp $
+# $Id: Makefile.in,v 1.38 2014/01/18 20:19:45 tom Exp $
##############################################################################
-# Copyright (c) 1998-2008,2010 Free Software Foundation, Inc. #
+# Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. #
# #
# Permission is hereby granted, free of charge, to any person obtaining a #
# copy of this software and associated documentation files (the "Software"), #
@@ -27,7 +27,7 @@
# authorization. #
##############################################################################
#
-# Author: Thomas E. Dickey 1996,1997
+# Author: Thomas E. Dickey 1996-on
#
# Master Makefile for ncurses library.
@@ -35,7 +35,8 @@ SHELL = /bin/sh
VPATH = @srcdir@
DESTDIR=@DESTDIR@
-CF_MFLAGS = @cf_cv_makeflags@ DESTDIR="$(DESTDIR)"
+RPATH_LIST=@RPATH_LIST@
+TOP_MFLAGS = @cf_cv_makeflags@ DESTDIR="$(DESTDIR)" RPATH_LIST="$(RPATH_LIST)"
@SET_MAKE@
@@ -48,13 +49,17 @@ srcdir = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
+datarootdir = @datarootdir@
bindir = @bindir@
ticdir = @TERMINFO@
includedir = @includedir@
+includesubdir = @includesubdir@
libdir = @libdir@
mandir = @mandir@
+include_dir = ${includedir}${includesubdir}
+
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@@ -74,25 +79,22 @@ preinstall :
@ echo ''
@ echo ' bin directory: '$(bindir)
@ echo ' lib directory: '$(libdir)
- @ echo ' include directory: '$(includedir)
+ @ echo ' include directory: '$(include_dir)
@ echo ' man directory: '$(mandir)
@MAKE_TERMINFO@ @ echo ' terminfo directory: '$(ticdir)
@ echo ''
- @ test "$(includedir)" = "$(prefix)/include" || \
+ @ test "$(include_dir)" = "$(prefix)/include" || \
echo '** Include-directory is not in a standard location'
- @ test ! -f $(includedir)/termcap.h || \
- fgrep NCURSES_VERSION $(includedir)/termcap.h >/dev/null || \
+ @ test ! -f $(include_dir)/termcap.h || \
+ fgrep NCURSES_VERSION $(include_dir)/termcap.h >/dev/null || \
echo '** Will overwrite non-ncurses termcap.h'
- @ test ! -f $(includedir)/curses.h || \
- fgrep NCURSES_VERSION $(includedir)/curses.h >/dev/null || \
+ @ test ! -f $(include_dir)/curses.h || \
+ fgrep NCURSES_VERSION $(include_dir)/curses.h >/dev/null || \
echo '** Will overwrite non-ncurses curses.h'
-dlls: libs
- $(SHELL) $(srcdir)/mk-dlls.sh
-
distclean \
realclean ::
- -rm -f mk-dlls.sh mingw_arch
+
# Put the common rules here so that we can easily construct the list of
# directories to visit.
diff --git a/contrib/ncurses/NEWS b/contrib/ncurses/NEWS
index e8f9cefbabdd..e7cbd9bf1c56 100644
--- a/contrib/ncurses/NEWS
+++ b/contrib/ncurses/NEWS
@@ -1,5 +1,5 @@
-------------------------------------------------------------------------------
--- Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. --
+-- Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
@@ -25,7 +25,7 @@
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
--- $Id: NEWS,v 1.1682 2011/04/04 00:02:42 tom Exp $
+-- $Id: NEWS,v 1.2172 2014/02/23 01:19:35 tom Exp $
-------------------------------------------------------------------------------
This is a log of changes that ncurses has gone through since Zeyd started
@@ -45,6 +45,1360 @@ See the AUTHORS file for the corresponding full names.
Changes through 1.9.9e did not credit all contributions;
it is not possible to add this information.
+20140222
+ + fix some compiler warnings in win_driver.c
+ + updated notes for wsvt25 based on tack and vttest -TD
+ + add teken entry to show actual properties of FreeBSD's "xterm"
+ console -TD
+
+20140215
+ + in-progress changes to win_driver.c to implement output without
+ allocating a console-buffer. This uses a pre-existing environment
+ variable NCGDB used by Juergen Pfeifer for debugging (prompted by
+ discussion with Erwin Waterlander regarding Console2, which hangs
+ when reading in an allocated console-buffer).
+ + add -t option to gdc.c, and modify to accept "S" to step through the
+ scrolling-stages.
+ + regenerate NCURSES-Programming-HOWTO.html to fix some of the broken
+ html emitted by docbook.
+
+20140209
+ + modify CF_XOPEN_SOURCE macro to omit followup check to determine if
+ _XOPEN_SOURCE can/should be defined. g++ 4.7.2 built on Solaris 10
+ has some header breakage due to its own predefinition of this symbol
+ (report by Jean-Pierre Flori, Sage #15796).
+
+20140201
+ + add/use symbol NCURSES_PAIRS_T like NCURSES_COLOR_T, to illustrate
+ which "short" types are for color pairs and which are color values.
+ + fix build for s390x, by correcting field bit offsets in generated
+ representation clauses when int=32 long=64 and endian=big, or at
+ least on s390x (patch by Nicolas Boulenguez).
+ + minor cleanup change to test/form_driver_w.c (patch by Gaute Hope).
+
+20140125
+ + remove unnecessary ifdef's in Ada95/gen/gen.c, which reportedly do
+ not work as is with gcc 4.8 due to fixes using chtype cast made for
+ new compiler warnings by gcc 4.8 in 20130824 (Debian #735753, patch
+ by Nicolas Boulenguez).
+
+20140118
+ + apply includesubdir variable which was introduced in 20130805 to
+ gen-pkgconfig.in (Debian #735782).
+
+20131221
+ + further improved man2html, used this to fix broken links in html
+ manpages. See
+ ftp://invisible-island.net/ncurses/patches/man2html
+
+20131214
+ + modify configure-script/ifdef's to allow OLD_TTY feature to be
+ suppressed if the type of ospeed is configured using the option
+ --with-ospeed to not be a short. By default, it is a short for
+ termcap-compatibility (adapted from suggestion by Christian
+ Weisgerber).
+ + correct a typo in _nc_baudrate() (patch by Christian Weisgerber,
+ cf: 20061230).
+ + fix a few -Wlogical-op warnings.
+ + updated llib-l* files.
+
+20131207
+ + add form_driver_w() entrypoint to wide-character forms library, as
+ well as test program form_driver_w (adapted from patch by Gaute
+ Hope).
+
+20131123
+ + minor fix for CF_GCC_WARNINGS to special-case options which are not
+ recognized by clang.
+
+20131116
+ + add special case to configure script to move _XOPEN_SOURCE_EXTENDED
+ definition from CPPFLAGS to CFLAGS if it happens to be needed for
+ Solaris, because g++ errors with that definition (report by
+ Jean-Pierre Flori, Sage #15268).
+ + correct logic in infocmp's -i option which was intended to ignore
+ strings which correspond to function-keys as candidates for piecing
+ together initialization- or reset-strings. The problem dates to
+ 1.9.7a, but was overlooked until changes in -Wlogical-op warnings for
+ gcc 4.8 (report by David Binderman).
+ + updated CF_GCC_WARNINGS to documented options for gcc 4.9.0, adding
+ checks for -Wextra, -Wignored-qualifiers and -Wlogical-op
+ + updated CF_GCC_WARNINGS to documented options for gcc 4.9.0, moving
+ checks for -Wextra and -Wdeclaration-after-statement into the macro,
+ and adding checks for -Wignored-qualifiers, -Wlogical-op and
+ -Wvarargs
+ + updated CF_CURSES_UNCTRL_H and CF_SHARED_OPTS macros from ongoing
+ work on cdk.
+ + update config.sub from
+ http://git.savannah.gnu.org/cgit/config.git
+
+20131110
+ + minor cleanup of terminfo.tail
+
+20131102
+ + use TS extension to describe xterm's title-escapes -TD
+ + modify terminator and nsterm-s to use xterm+sl-twm building block -TD
+ + update hurd.ti, add xenl to reflect 2011-03-06 change in
+ http://git.savannah.gnu.org/cgit/hurd/hurd.git/log/console/display.c
+ (Debian #727119).
+ + simplify pfkey expression in ansi.sys -TD
+
+20131027
+ + correct/simplify ifdef's for cur_term versus broken-linker and
+ reentrant options (report by Jean-Pierre Flori, cf: 20090530).
+ + modify release/version combinations in test build-scripts to make
+ them more consistent with other packages.
+
+20131019
+ + add nc_mingw.h to installed headers for MinGW port; needed for
+ compiling ncurses-examples.
+ + add rpm-script for testing cross-compile of ncurses-examples.
+
+20131014
+ + fix new typo in CF_ADA_INCLUDE_DIRS macro (report by Roumen Petrov).
+
+20131012
+ + fix a few compiler warnings in progs and test.
+ + minor fix to package/debian-mingw/rules, do not strip dll's.
+ + minor fixes to configure script for empty $prefix, e.g., when doing
+ cross-compiles to MinGW.
+ + add script for building test-packages of binaries cross-compiled to
+ MinGW using NSIS.
+
+20131005
+ + minor fixes for ncurses-example package and makefile.
+ + add scripts for test-builds of cross-compiler packages for ncurses6
+ to MinGW.
+
+20130928
+ + some build-fixes for ncurses-examples with NetBSD-6.0 curses, though
+ it lacks some common functions such as use_env() which is not yet
+ addressed.
+ + build-fix and some compiler warning fixes for ncurses-examples with
+ OpenBSD 5.3
+ + fix a possible null-pointer reference in a trace message from newterm.
+ + quiet a few warnings from NetBSD 6.0 namespace pollution by
+ nonstandard popcount() function in standard strings.h header.
+ + ignore g++ 4.2.1 warnings for "-Weffc++" in c++/cursesmain.cc
+ + fix a few overlooked places for --enable-string-hacks option.
+
+20130921
+ + fix typo in curs_attr.3x (patch by Sven Joachim, cf: 20130831).
+ + build-fix for --with-shared option for DragonFly and FreeBSD (report
+ by Rong-En Fan, cf: 20130727).
+
+20130907
+ + build-fixes for MSYS for two test-programs (patches by Ray Donnelly,
+ Alexey Pavlov).
+ + revert change to two of the dpkg format files, to work with dpkg
+ before/after Debian #700177.
+ + fix gcc -Wconversion warning in wattr_get() macro.
+ + add msys and msysdll to known host/configuration types (patch by
+ Alexey Pavlov).
+ + modify CF_RPATH_HACK configure macro to not rely upon "-u" option
+ of sort, improving portability.
+ + minor improvements for test-programs from reviewing Solaris port.
+ + update config.guess, config.sub from
+ http://git.savannah.gnu.org/cgit/config.git
+
+20130831
+ + modify test/ncurses.c b/B tests to display lines only for the
+ attributes which a given terminal supports, to make room for an
+ italics test.
+ + completed ncv table in terminfo.tail; it did not list the wide
+ character codes listed in X/Open Curses issue 7.
+ + add A_ITALIC extension (prompted by discussion with Egmont Koblinger).
+
+20130824
+ + fix some gcc 4.8 -Wconversion warnings.
+ + change format of dpkg test-scripts to quilted to work around bug
+ introduced by Debian #700177.
+ + discard cached keyname() values if meta() is changed after a value
+ was cached using (report by Kurban Mallachiev).
+
+20130816
+ + add checks in tic to warn about terminals which lack cursor
+ addressing, capabilities or having those, are marked as hard_copy or
+ generic_type.
+ + use --without-progs in mingw-ncurses rpm.
+ + split out _nc_init_termtype() from alloc_entry.c to use in MinGW
+ port when tic and other programs are not needed.
+
+20130805
+ + minor fixes to the --disable-overwrite logic, to ensure that the
+ configured $(includedir) is not cancelled by the mingwxx-filesystem
+ rpm macros.
+ + add --disable-db-install configure option, to simplify building
+ cross-compile support packages.
+ + add mingw-ncurses.spec file, for testing cross-compiles.
+
+20130727
+ + improve configure macros from ongoing work on cdk, dialog, xterm:
+ + CF_ADD_LIB_AFTER - fix a problem with -Wl options
+ + CF_RPATH_HACK - add missing result-message
+ + CF_SHARED_OPTS - modify to use $rel_builddir in cygwin and mingw
+ dll symbols (which can be overridden) rather than explicit "../".
+ + CF_SHARED_OPTS - modify NetBSD and DragonFly symbols to use ${CC}
+ rather than ${LD} to improve rpath support.
+ + CF_SHARED_OPTS - add a symbol to denote the temporary files that
+ are created by the macro, to simplify clean-rules.
+ + CF_X_ATHENA - trim extra libraries to work with -Wl,--as-needed
+ + fix a regression in hashed-database support for NetBSD, which uses
+ the key-size differently from other implementations (cf: 20121229).
+
+20130720
+ + further improvements for setupterm manpage, clarifying the
+ initialization of cur_term.
+
+20130713
+ + improve manpages for initscr and setupterm.
+ + minor compiler-warning fixes
+
+20130706
+ + add fallback defs for and (cf: 20120225).
+ + add check for size of wchar_t, use that to suppress a chunk of
+ wcwidth.h in MinGW port.
+ + quiet linker warnings for MinGW cross-compile with dll's using the
+ --enable-auto-import flag.
+ + add ncurses.map rule to ncurses/Makefile to help diagnose symbol
+ table issues.
+
+20130622
+ + modify the clear program to take into account the E3 extended
+ capability to clear the terminal's scrollback buffer (patch by
+ Miroslav Lichvar, Redhat #815790).
+ + clarify in resizeterm manpage that LINES and COLS are updated.
+ + updated ansi example in terminfo.tail, correct misordered example
+ of sgr.
+ + fix other doclifter warnings for manpages
+ + remove unnecessary ".ta" in terminfo.tail, add missing ".fi"
+ (patch by Eric Raymond).
+
+20130615
+ + minor changes to some configure macros to make them more reusable.
+ + fixes for tabs program (prompted by report by Nick Andrik):
+ + corrected logic in command-line parsing of -a and -c predefined
+ tab-lists options.
+ + allow "-0" and "-8" options to be combined with others, e.g.,"-0d".
+ + make warning messages more consistent with the other utilities by
+ not printing the full pathname of the program.
+ + add -V option for consistency with other utilities.
+ + fix off-by-one in columns for tabs program when processing an option
+ such as "-5" (patch by Nick Andrik).
+
+20130608
+ + add to test/demo_forms.c examples of using the menu-hooks as well
+ as showing how the menu item user-data can be used to pass a callback
+ function pointer.
+ + add test/dots_termcap.c
+ + remove setupterm call from test/demo_termcap.c
+ + build-fix if --disable-ext-funcs configure option is used.
+ + modified test/edit_field.c and test/demo_forms.c to move the lengths
+ into a user-data structure, keeping the original string for later
+ expansion to free-format input/out demo.
+ + modified test/demo_forms.c to load data from file.
+ + added note to clarify Terminal.app's non-emulation of the various
+ terminal types listed in the preferences dialog -TD
+ + fix regression in error-reporting in lib_setup.c (Debian #711134,
+ cf: 20121117).
+ + build-fix for a case where --enable-broken_linker and
+ --enable-reentrant options are combined (report by George R Goffe).
+
+20130525
+ + modify mvcur() to distinguish between internal use by the ncurses
+ library, and external callers, preventing it from reading the content
+ of the screen which is only nonblank when curses calls have updated
+ it. This makes test/dots_mvcur.c avoid painting colored cells in
+ the left margin of the display.
+ + minor fix to test/dots_mvcur.c
+ + move configured symbols USE_DATABASE and USE_TERMCAP to term.h as
+ NCURSES_USE_DATABASE and NCURSES_USE_TERMCAP to allow consistent
+ use of these symbols in term_entry.h
+
+20130518
+ + corrected ifdefs in test/testcurs.c to allow comparison of mouse
+ interface versus pdcurses (cf: 20130316).
+ + add pow() to configure-check for math library, needed since
+ 20121208 for test/hanoi (Debian #708056).
+ + regenerated html manpages.
+ + update doctype used for html documentation.
+
+20130511
+ + move nsterm-related entries out of "obsolete" section to more
+ plausible "ansi consoles" -TD
+ + additional cleanup of table-of-contents by reordering -TD
+ + revise fix for check for 8-bit value in _nc_insert_ch(); prior fix
+ prevented inserts when video attributes were attached to the data
+ (cf: 20121215) (Redhat #959534).
+
+20130504
+ + fixes for issues found by Coverity:
+ + correct FNKEY() macro in progs/dump_entry.c, allowing kf11-kf63 to
+ display when infocmp's -R option is used for HP or AIX subsets.
+ + fix dead-code issue with test/movewindow.c
+ + improve limited-checking in _nc_read_termtype().
+
+20130427
+ + fix clang 3.2 warning in progs/dump_entry.c
+ + drop AC_TYPE_SIGNAL check; ncurses relies on c89 and later.
+
+20130413
+ + add MinGW to cases where ncurses installs by default into /usr
+ (prompted by discussion with Daniel Silva Ferreira).
+ + add -D option to infocmp's usage-message (patch by Miroslav Lichvar).
+ + add a missing 'int' type for main function in configure check for
+ type of bool variable, to work with clang 3.2 (report by Dmitri
+ Gribenko).
+ + improve configure check for static_cast, to work with clang 3.2
+ (report by Dmitri Gribenko).
+ + re-order rule for demo.o and macros defining header dependencies in
+ c++/Makefile.in to accommodate gmake (report by Dmitri Gribenko).
+
+20130406
+ + improve parameter checking in copywin().
+ + modify configure script to work around OS X's "libtool" program, to
+ choose glibtool instead. At the same time, chance the autoconf macro
+ to look for a "tool" rather than a "prog", to help with potential use
+ in cross-compiling.
+ + separate the rpath usage for c++ library from demo program
+ (Redhat #911540)
+ + update/correct header-dependencies in c++ makefile (report by Werner
+ Fink).
+ + add --with-cxx-shared to dpkg-script, as done for rpm-script.
+
+20130324
+ + build-fix for libtool configuration (reports by Daniel Silva Ferreira
+ and Roumen Petrov).
+
+20130323
+ + build-fix for OS X, to handle changes for --with-cxx-shared feature
+ (report by Christian Ebert).
+ + change initialization for vt220, similar entries for consistency
+ with cursor-key strings (NetBSD #47674) -TD
+ + further improvements to linux-16color (Benjamin Sittler)
+
+20130316
+ + additional fix for tic.c, to allocate missing buffer space.
+ + eliminate configure-script warnings for gen-pkgconfig.in
+ + correct typo in sgr string for sun-color,
+ add bold for consistency with sgr,
+ change smso for consistency with sgr -TD
+ + correct typo in sgr string for terminator -TD
+ + add blink to the attributes masked by ncv in linux-16color (report
+ by Benjamin Sittler)
+ + improve warning message from post-load checking for missing "%?"
+ operator by tic/infocmp by showing the entry name and capability.
+ + minor formatting improvement to tic/infocmp -f option to ensure
+ line split after "%;".
+ + amend scripting for --with-cxx-shared option to handle the debug
+ library "libncurses++_g.a" (report by Sven Joachim).
+
+20130309
+ + amend change to toe.c for reading from /dev/zero, to ensure that
+ there is a buffer for the temporary filename (cf: 20120324).
+ + regenerated html manpages.
+ + fix typo in terminfo.head (report by Sven Joachim, cf: 20130302).
+ + updated some autoconf macros:
+ + CF_ACVERSION_CHECK, from byacc 1.9 20130304
+ + CF_INTEL_COMPILER, CF_XOPEN_SOURCE from luit 2.0-20130217
+ + add configure option --with-cxx-shared to permit building
+ libncurses++ as a shared library when using g++, e.g., the same
+ limitations as libtool but better integrated with the usual build
+ configuration (Redhat #911540).
+ + modify MKkey_defs.sh to filter out build-path which was unnecessarily
+ shown in curses.h (Debian #689131).
+
+20130302
+ + add section to terminfo manpage discussing user-defined capabilities.
+ + update manpage description of NCURSES_NO_SETBUF, explaining why it
+ is obsolete.
+ + add a check in waddch_nosync() to ensure that tab characters are
+ treated as control characters; some broken locales claim they are
+ printable.
+ + add some traces to the Windows console driver.
+ + initialize a temporary array in _nc_mbtowc, needed for some cases
+ of raw input in MinGW port.
+
+20130218
+ + correct ifdef on change to lib_twait.c (report by Werner Fink).
+ + update config.guess, config.sub
+
+20130216
+ + modify test/testcurs.c to work with mouse for ncurses as it does for
+ pdcurses.
+ + modify test/knight.c to work with mouse for pdcurses as it does for
+ ncurses.
+ + modify internal recursion in wgetch() which handles cooked mode to
+ check if the call to wgetnstr() returned an error. This can happen
+ when both nocbreak() and nodelay() are set, for instance (report by
+ Nils Christopher Brause) (cf: 960418).
+ + fixes for issues found by Coverity:
+ + add a check for valid position in ClearToEOS()
+ + fix in lib_twait.c when --enable-wgetch-events is used, pointer
+ use after free.
+ + improve a limit-check in make_hash.c
+ + fix a memory leak in hashed_db.c
+
+20130209
+ + modify test/configure script to make it simpler to override names
+ of curses-related libraries, to help with linking with pdcurses in
+ MinGW environment.
+ + if the --with-terminfo-dirs configure option is not used, there is
+ no corresponding compiled-in value for that. Fill in "no default
+ value" for that part of the manpage substitution.
+
+20130202
+ + correct initialization in knight.c which let it occasionally make
+ an incorrect move (cf: 20001028).
+ + improve documentation of the terminfo/termcap search path.
+
+20130126
+ + further fixes to mvcur to pass callback function (cf: 20130112),
+ needed to make test/dots_mvcur work.
+ + reduce calls to SetConsoleActiveScreenBuffer in win_driver.c, to
+ help reduce flicker.
+ + modify configure script to omit "+b" from linker options for very
+ old HP-UX systems (report by Dennis Grevenstein)
+ + add HP-UX workaround for missing EILSEQ on old HP-UX systems (patch
+ by Dennis Grevenstein).
+ + restore memmove/strdup support for antique systems (request by
+ Dennis Grevenstein).
+ + change %l behavior in tparm to push the string length onto the stack
+ rather than saving the formatted length into the output buffer
+ (report by Roy Marples, cf: 980620).
+
+20130119
+ + fixes for issues found by Coverity:
+ + fix memory leak in safe_sprintf.c
+ + add check for return-value in tty_update.c
+ + correct initialization for -s option in test/view.c
+ + add check for numeric overflow in lib_instr.c
+ + improve error-checking in copywin
+ + add advice in infocmp manpage for termcap users (Debian #698469).
+ + add "-y" option to test/demo_termcap and test/demo_terminfo to
+ demonstrate behavior with/without extended capabilities.
+ + updated termcap manpage to document legacy termcap behavior for
+ matching capability names.
+ + modify name-comparison for tgetstr, etc., to accommodate legacy
+ applications as well as to improve compatbility with BSD 4.2
+ termcap implementations (Debian #698299) (cf: 980725).
+
+20130112
+ + correct prototype in manpage for vid_puts.
+ + drop ncurses/tty/tty_display.h, ncurses/tty/tty_input.h, since they
+ are unused in the current driver model.
+ + modify mvcur to use stdout except when called within the ncurses
+ library.
+ + modify vidattr and vid_attr to use stdout as documented in manpage.
+ + amend changes made to buffering in 20120825 so that the low-level
+ putp() call uses stdout rather than ncurses' internal buffering.
+ The putp_sp() call does the same, for consistency (Redhat #892674).
+
+20130105
+ + add "-s" option to test/view.c to allow it to start in single-step
+ mode, reducing size of trace files when it is used for debugging
+ MinGW changes.
+ + revert part of 20121222 change to tinfo_driver.c
+ + add experimental logic in win_driver.c to improve optimization of
+ screen updates. This does not yet work with double-width characters,
+ so it is ifdef'd out for the moment (prompted by report by Erwin
+ Waterlander regarding screen flicker).
+
+20121229
+ + fix coverity warnings regarding copying into fixed-size buffers.
+ + add throw-declarations in the c++ binding per Coverity warning.
+ + minor changes to new-items for consistent reference to bug-report
+ numbers.
+
+20121222
+ + add *.dSYM directories to clean-rule in ncurses directory makefile,
+ for Mac OS builds.
+ + add a configure check for gcc option -no-cpp-precomp, which is not
+ available in all Mac OS X configurations (report by Andras Salamon,
+ cf: 20011208).
+ + improve 20021221 workaround for broken acs, handling a case where
+ that ACS_xxx character is not in the acsc string but there is a known
+ wide-character which can be used.
+
+20121215
+ + fix several warnings from clang 3.1 --analyze, includes correcting
+ a null-pointer check in _nc_mvcur_resume.
+ + correct display of double-width characters with MinGW port (report
+ by Erwin Waterlander).
+ + replace MinGW's wcrtomb(), fixing a problem with _nc_viscbuf
+ > fixes based on Coverity report:
+ + correct coloring in test/bs.c
+ + correct check for 8-bit value in _nc_insert_ch().
+ + remove dead code in progs/tset.c, test/linedata.h
+ + add null-pointer checks in lib_tracemse.c, panel.priv.h, and some
+ test-programs.
+
+20121208
+ + modify test/knight.c to show the number of choices possible for
+ each position in automove option, e.g., to allow user to follow
+ Warnsdorff's rule to solve the puzzle.
+ + modify test/hanoi.c to show the minimum number of moves possible for
+ the given number of tiles (prompted by patch by Lucas Gioia).
+ > fixes based on Coverity report:
+ + remove a few redundant checks.
+ + correct logic in test/bs.c, when randomly placing a specific type of
+ ship.
+ + check return value from remove/unlink in tic.
+ + check return value from sscanf in test/ncurses.c
+ + fix a null dereference in c++/cursesw.cc
+ + fix two instances of uninitialized variables when configuring for the
+ terminal driver.
+ + correct scope of variable used in SetSafeOutcWrapper macro.
+ + set umask when calling mkstemp in tic.
+ + initialize wbkgrndset() temporary variable when extended-colors are
+ used.
+
+20121201
+ + also replace MinGW's wctomb(), fixing a problem with setcchar().
+ + modify test/view.c to load UTF-8 when built with MinGW by using
+ regular win32 API because the MinGW functions mblen() and mbtowc()
+ do not work.
+
+20121124
+ + correct order of color initialization versus display in some of the
+ test-programs, e.g., test_addstr.c
+ > fixes based on Coverity report:
+ + delete windows on exit from some of the test-programs.
+
+20121117
+ > fixes based on Coverity report:
+ + add missing braces around FreeAndNull in two places.
+ + various fixes in test/ncurses.c
+ + improve limit-checks in tinfo/make_hash.c, tinfo/read_entry.c
+ + correct malloc size in progs/infocmp.c
+ + guard against negative array indices in test/knight.c
+ + fix off-by-one limit check in test/color_name.h
+ + add null-pointer check in progs/tabs.c, test/bs.c, test/demo_forms.c,
+ test/inchs.c
+ + fix memory-leak in tinfo/lib_setup.c, progs/toe.c,
+ test/clip_printw.c, test/demo_menus.c
+ + delete unused windows in test/chgat.c, test/clip_printw.c,
+ test/insdelln.c, test/newdemo.c on error-return.
+
+20121110
+ + modify configure macro CF_INCLUDE_DIRS to put $CPPFLAGS after the
+ local -I include options in case someone has set conflicting -I
+ options in $CPPFLAGS (prompted by patch for ncurses/Makefile.in by
+ Vassili Courzakis).
+ + modify the ncurses*-config scripts to eliminate relative paths from
+ the RPATH_LIST variable, e.g., "../lib" as used in installing shared
+ libraries or executables.
+
+20121102
+ + realign these related pages:
+ curs_add_wchstr.3x
+ curs_addchstr.3x
+ curs_addstr.3x
+ curs_addwstr.3x
+ and fix a long-ago error in curs_addstr.3x which said that a -1
+ length parameter would only write as much as fit onto one line
+ (report by Reuben Thomas).
+ + remove obsolete fallback _nc_memmove() for memmove()/bcopy().
+ + remove obsolete fallback _nc_strdup() for strdup().
+ + cancel any debug-rpm in package/ncurses.spec
+ + reviewed vte-2012, reverted most of the change since it was incorrect
+ based on testing with tack -TD
+ + un-cancel the initc in vte-256color, since this was implemented
+ starting with version 0.20 in 2009 -TD
+
+20121026
+ + improve malloc/realloc checking (prompted by discussion in Redhat
+ #866989).
+ + add ncurses test-program as "ncurses6" to the rpm- and dpkg-scripts.
+ + updated configure macros CF_GCC_VERSION and CF_WITH_PATHLIST. The
+ first corrects pattern used for Mac OS X's customization of gcc.
+
+20121017
+ + fix change to _nc_scroll_optimize(), which incorrectly freed memory
+ (Redhat #866989).
+
+20121013
+ + add vte-2012, gnome-2012, making these the defaults for vte/gnome
+ (patch by Christian Persch).
+
+20121006
+ + improve CF_GCC_VERSION to work around Debian's customization of gcc
+ --version message.
+ + improve configure macros as done in byacc:
+ + drop 2.13 compatibility; use 2.52.xxxx version only since EMX port
+ has used that for a while.
+ + add 3rd parameter to AC_DEFINE's to allow autoheader to run, i.e.,
+ for experimental use.
+ + remove unused configure macros.
+ + modify configure script and makefiles to quiet new autoconf warning
+ for LIBS_TO_MAKE variable.
+ + modify configure script to show $PATH_SEPARATOR variable.
+ + update config.guess, config.sub
+
+20120922
+ + modify setupterm to set its copy of TERM to "unknown" if configured
+ for the terminal driver and TERM was null or empty.
+ + modify treatment of TERM variable for MinGW port to allow explicit
+ use of the windows console driver by checking if $TERM is set to
+ "#win32con" or an abbreviation of that.
+ + undo recent change to fallback definition of vsscanf() to build with
+ older Solaris compilers (cf: 20120728).
+
+20120908
+ + add test-screens to test/ncurses to show 256-characters at a time,
+ to help with MinGW port.
+
+20120903
+ + simplify varargs logic in lib_printw.c; va_copy is no longer needed
+ there.
+ + modifications for MinGW port to make wide-character display usable.
+
+20120902
+ + regenerate configure script (report by Sven Joachim, cf: 20120901).
+
+20120901
+ + add a null-pointer check in _nc_flush (cf: 20120825).
+ + fix a case in _nc_scroll_optimize() where the _oldnums_list array
+ might not be allocated.
+ + improve comparisons in configure.in for unset shell variables.
+
+20120826
+ + increase size of ncurses' output-buffer, in case of very small
+ initial screen-sizes.
+ + fix evaluation of TERMINFO and TERMINFO_DIRS default values as needed
+ after changes to use --datarootdir (reports by Gabriele Balducci,
+ Roumen Petrov).
+
+20120825
+ + change output buffering scheme, using buffer maintained by ncurses
+ rather than stdio, to avoid problems with SIGTSTP handling (report
+ by Brian Bloniarz).
+
+20120811
+ + update autoconf patch to 2.52.20120811, adding --datarootdir
+ (prompted by discussion with Erwin Waterlander).
+ + improve description of --enable-reentrant option in README and the
+ INSTALL file.
+ + add nsterm-256color, make this the default nsterm -TD
+ + remove bw from nsterm-bce, per testing with tack -TD
+
+20120804
+ + update test/configure, adding check for tinfo library.
+ + improve limit-checks for the getch fifo (report by Werner Fink).
+ + fix a remaining mismatch between $with_echo and the symbols updated
+ for CF_DISABLE_ECHO affecting parameters for mk-2nd.awk (report by
+ Sven Joachim, cf: 20120317).
+ + modify followup check for pkg-config's library directory in the
+ --enable-pc-files option to validate syntax (report by Sven Joachim,
+ cf: 20110716).
+
+20120728
+ + correct path for ncurses_mingw.h in include/headers, in case build
+ is done outside source-tree (patch by Roumen Petrov).
+ + modify some older xterm entries to align with xterm source -TD
+ + separate "xterm-old" alias from "xterm-r6" -TD
+ + add E3 extended capability to xterm-basic and putty -TD
+ + parenthesize parameters of other macros in curses.h -TD
+ + parenthesize parameter of COLOR_PAIR and PAIR_NUMBER in curses.h
+ in case it happens to be a comma-expression, etc. (patch by Nick
+ Black).
+
+20120721
+ + improved form_request_by_name() and menu_request_by_name().
+ + eliminate two fixed-size buffers in toe.c
+ + extend use_tioctl() to have expected behavior when use_env(FALSE) and
+ use_tioctl(TRUE) are called.
+ + modify ncurses test-program, adding -E and -T options to demonstrate
+ use_env() versus use_tioctl().
+
+20120714
+ + add use_tioctl() function (adapted from patch by Werner Fink,
+ Novell #769788):
+
+20120707
+ + add ncurses_mingw.h to installed headers (prompted by patch by
+ Juergen Pfeifer).
+ + clarify return-codes from wgetch() in response to SIGWINCH (prompted
+ by Novell #769788).
+ + modify resizeterm() to always push a KEY_RESIZE onto the fifo, even
+ if screensize is unchanged. Modify _nc_update_screensize() to push a
+ KEY_RESIZE if there was a SIGWINCH, even if it does not call
+ resizeterm(). These changes eliminate the case where a SIGWINCH is
+ received, but ERR returned from wgetch or wgetnstr because the screen
+ dimensions did not change (Novell #769788).
+
+20120630
+ + add --enable-interop to sample package scripts (suggested by Juergen
+ Pfeifer).
+ + update CF_PATH_SYNTAX macro, from mawk changes.
+ + modify mk-0th.awk to allow for generating llib-ltic, etc., though
+ some work is needed on cproto to work with lib_gen.c to update
+ llib-lncurses.
+ + remove redundant getenv() cal in database-iterator leftover from
+ cleanup in 20120622 changes (report by Sven Joachim).
+
+20120622
+ + add -d, -e and -q options to test/demo_terminfo and test/demo_termcap
+ + fix caching of environment variables in database-iterator (patch by
+ Philippe Troin, Redhat #831366).
+
+20120616
+ + add configure check to distinguish clang from gcc to eliminate
+ warnings about unused command-line parameters when compiler warnings
+ are enabled.
+ + improve behavior when updating terminfo entries which are hardlinked
+ by allowing for the possibility that an alias has been repurposed to
+ a new primary name.
+ + fix some strict compiler warnings based on package scripts.
+ + further fixes for configure check for working poll (Debian #676461).
+
+20120608
+ + fix an uninitialized variable in -c/-n logic for infocmp changes
+ (cf: 20120526).
+ + corrected fix for building c++ binding with clang 3.0 (report/patch
+ by Richard Yao, Gentoo #417613, cf: 20110409)
+ + correct configure check for working poll, fixing the case where stdin
+ is redirected, e.g., in rpm/dpkg builds (Debian #676461).
+ + add rpm- and dpkg-scripts, to test those build-environments.
+ The resulting packages are used only for testing.
+
+20120602
+ + add kdch1 aka "Remove" to vt220 and vt220-8 entries -TD
+ + add kdch1, etc., to qvt108 -TD
+ + add dl1/il1 to some entries based on dl/il values -TD
+ + add dl to simpleterm -TD
+ + add consistency-checks in tic for insert-line vs delete-line
+ controls, and insert/delete-char keys
+ + correct no-leaks logic in infocmp when doing comparisons, fixing
+ duplicate free of entries given via the command-line, and freeing
+ entries loaded from the last-but-one of files specified on the
+ command-line.
+ + add kdch1 to wsvt25 entry from NetBSD CVS (reported by David Lord,
+ analysis by Martin Husemann).
+ + add cnorm/civis to wsvt25 entry from NetBSD CVS (report/analysis by
+ Onno van der Linden).
+
+20120526
+ + extend -c and -n options of infocmp to allow comparing more than two
+ entries.
+ + correct check in infocmp for number of terminal names when more than
+ two are given.
+ + correct typo in curs_threads.3x (report by Yanhui Shen on
+ freebsd-hackers mailing list).
+
+20120512
+ + corrected 'op' for bterm (report by Samuel Thibault) -TD
+ + modify test/background.c to demonstrate a background character
+ holding a colored ACS_HLINE. The behavior differs from SVr4 due to
+ the thick- and double-line extension (cf: 20091003).
+ + modify handling of acs characters in PutAttrChar to avoid mapping an
+ unmapped character to a space with A_ALTCHARSET set.
+ + rewrite vt520 entry based on vt420 -TD
+
+20120505
+ + remove p6 (bold) from opus3n1+ for consistency -TD
+ + remove acs stuff from env230 per clues in Ingres termcap -TD
+ + modify env230 sgr/sgr0 to match other capabilities -TD
+ + modify smacs/rmacs in bq300-8 to match sgr/sgr0 -TD
+ + make sgr for dku7202 agree with other caps -TD
+ + make sgr for ibmpc agree with other caps -TD
+ + make sgr for tek4107 agree with other caps -TD
+ + make sgr for ndr9500 agree with other caps -TD
+ + make sgr for sco-ansi agree with other caps -TD
+ + make sgr for d410 agree with other caps -TD
+ + make sgr for d210 agree with other caps -TD
+ + make sgr for d470c, d470c-7b agree with other caps -TD
+ + remove redundant AC_DEFINE for NDEBUG versus Makefile definition.
+ + fix a back-link in _nc_delink_entry(), which is needed if ncurses is
+ configured with --enable-termcap and --disable-getcap.
+
+20120428
+ + fix some inconsistencies between vt320/vt420, e.g., cnorm/civis -TD
+ + add eslok flag to dec+sl -TD
+ + dec+sl applies to vt320 and up -TD
+ + drop wsl width from xterm+sl -TD
+ + reuse xterm+sl in putty and nsca-m -TD
+ + add ansi+tabs to vt520 -TD
+ + add ansi+enq to vt220-vt520 -TD
+ + fix a compiler warning in example in ncurses-intro.doc (Paul Waring).
+ + added paragraph in keyname manpage telling how extended capabilities
+ are interpreted as key definitions.
+ + modify tic's check of conflicting key definitions to include extended
+ capability strings in addition to the existing check on predefined
+ keys.
+
+20120421
+ + improve cleanup of temporary files in tic using atexit().
+ + add msgr to vt420, similar DEC vtXXX entries -TD
+ + add several missing vt420 capabilities from vt220 -TD
+ + factor out ansi+pp from several entries -TD
+ + change xterm+sl and xterm+sl-twm to include only the status-line
+ capabilities and not "use=xterm", making them more generally useful
+ as building-blocks -TD
+ + add dec+sl building block, as example -TD
+
+20120414
+ + add XT to some terminfo entries to improve usefulness for other
+ applications than screen, which would like to pretend that xterm's
+ title is a status-line. -TD
+ + change use-clauses in ansi-mtabs, hp2626, and hp2622 based on review
+ of ordering and overrides -TD
+ + add consistency check in tic for screen's "XT" capability.
+ + add section in terminfo.src summarizing the user-defined capabilities
+ used in that file -TD
+
+20120407
+ + fix an inconsistency between tic/infocmp "-x" option; tic omits all
+ non-standard capabilities, while infocmp was ignoring only the user
+ definable capabilities.
+ + improve special case in tic parsing of description to allow it to be
+ followed by terminfo capabilities. Previously the description had to
+ be the last field on an input line to allow tic to distinguish
+ between termcap and terminfo format while still allowing commas to be
+ embedded in the description.
+ + correct variable name in gen_edit.sh which broke configurability of
+ the --with-xterm-kbs option.
+ + revert 2011-07-16 change to "linux" alias, return to "linux2.2" -TD
+ + further amend 20110910 change, providing for configure-script
+ override of the "linux" terminfo entry to install and changing the
+ default for that to "linux2.2" (Debian #665959).
+
+20120331
+ + update Ada95/configure to use CF_DISABLE_ECHO (cf: 20120317).
+ + correct order of use-clauses in st-256color -TD
+ + modify configure script to look for gnatgcc if the Ada95 binding
+ is built, in preference to the default gcc/cc (suggested by
+ Nicolas Boulenguez).
+ + modify configure script to ensure that the same -On option used for
+ the C compiler in CFLAGS is used for ADAFLAGS rather than simply
+ using "-O3" (suggested by Nicolas Boulenguez)
+
+20120324
+ + amend an old fix so that next_char() exits properly for empty files,
+ e.g., from reading /dev/null (cf: 20080804).
+ + modify tic so that it can read from the standard input, or from
+ a character device. Because tic uses seek's, this requires writing
+ the data to a temporary file first (prompted by remark by Sven
+ Joachim) (cf: 20000923).
+
+20120317
+ + correct a check made in lib_napms.c, so that terminfo applications
+ can again use napms() (cf: 20110604).
+ + add a note in tic.h regarding required casts for ABSENT_BOOLEAN
+ (cf: 20040327).
+ + correct scripting for --disable-echo option in test/configure.
+ + amend check for missing c++ compiler to work when no error is
+ reported, and no variables set (cf: 20021206).
+ + add/use configure macro CF_DISABLE_ECHO.
+
+20120310
+ + fix some strict compiler warnings for abi6 and 64-bits.
+ + use begin_va_copy/end_va_copy macros in lib_printw.c (cf: 20120303).
+ + improve a limit-check in infocmp.c (Werner Fink):
+
+20120303
+ + minor tidying of terminfo.tail, clarify reason for limitation
+ regarding mapping of \0 to \200
+ + minor improvement to _nc_copy_termtype(), using memcpy to replace
+ loops.
+ + fix no-leaks checking in test/demo_termcap.c to account for multiple
+ calls to setupterm().
+ + modified the libgpm change to show previous load as a problem in the
+ debug-trace.
+ > merge some patches from OpenSUSE rpm (Werner Fink):
+ + ncurses-5.7-printw.dif, fixes for varargs handling in lib_printw.c
+ + ncurses-5.7-gpm.dif, do not dlopen libgpm if already loaded by
+ runtime linker
+ + ncurses-5.6-fallback.dif, do not free arrays and strings from static
+ fallback entries
+
+20120228
+ + fix breakage in tic/infocmp from 20120225 (report by Werner Fink).
+
+20120225
+ + modify configure script to allow creating dll's for MinGW when
+ cross-compiling.
+ + add --enable-string-hacks option to control whether strlcat and
+ strlcpy may be used. The same issue applies to OpenBSD's warnings
+ about snprintf, noting that this function is weakly standardized.
+ + add configure checks for strlcat, strlcpy and snprintf, to help
+ reduce bogus warnings with OpenBSD builds.
+ + build-fix for OpenBSD 4.9 to supply consistent intptr_t declaration
+ (cf:20111231)
+ + update config.guess, config.sub
+
+20120218
+ + correct CF_ETIP_DEFINES configure macro, making it exit properly on
+ the first success (patch by Pierre Labastie).
+ + improve configure macro CF_MKSTEMP by moving existence-check for
+ mkstemp out of the AC_TRY_RUN, to help with cross-compiles.
+ + improve configure macro CF_FUNC_POLL from luit changes to detect
+ broken implementations, e.g., with Mac OS X.
+ + add configure option --with-tparm-arg
+ + build-fix for MinGW cross-compiling, so that make_hash does not
+ depend on TTY definition (cf: 20111008).
+
+20120211
+ + make sgr for xterm-pcolor agree with other caps -TD
+ + make sgr for att5425 agree with other caps -TD
+ + make sgr for att630 agree with other caps -TD
+ + make sgr for linux entries agree with other caps -TD
+ + make sgr for tvi9065 agree with other caps -TD
+ + make sgr for ncr260vt200an agree with other caps -TD
+ + make sgr for ncr160vt100pp agree with other caps -TD
+ + make sgr for ncr260vt300an agree with other caps -TD
+ + make sgr for aaa-60-dec-rv, aaa+dec agree with other caps -TD
+ + make sgr for cygwin, cygwinDBG agree with other caps -TD
+ + add configure option --with-xterm-kbs to simplify configuration for
+ Linux versus most other systems.
+
+20120204
+ + improved tic -D option, avoid making target directory and provide
+ better diagnostics.
+
+20120128
+ + add mach-gnu (Debian #614316, patch by Samuel Thibault)
+ + add mach-gnu-color, tweaks to mach-gnu terminfo -TD
+ + make sgr for sun-color agree with smso -TD
+ + make sgr for prism9 agree with other caps -TD
+ + make sgr for icl6404 agree with other caps -TD
+ + make sgr for ofcons agree with other caps -TD
+ + make sgr for att5410v1, att4415, att620 agree with other caps -TD
+ + make sgr for aaa-unk, aaa-rv agree with other caps -TD
+ + make sgr for avt-ns agree with other caps -TD
+ + amend fix intended to separate fixups for acsc to allow "tic -cv" to
+ give verbose warnings (cf: 20110730).
+ + modify misc/gen-edit.sh to make the location of the tabset directory
+ consistent with misc/Makefile.in, i.e., using ${datadir}/tabset
+ (Debian #653435, patch by Sven Joachim).
+
+20120121
+ + add --with-lib-prefix option to allow configuring for old/new flavors
+ of OS/2 EMX.
+ + modify check for gnat version to allow for year, as used in FreeBSD
+ port.
+ + modify check_existence() in db_iterator.c to simply check if the
+ path is a directory or file, according to the need. Checking for
+ directory size also gives no usable result with OS/2 (cf: 20120107).
+ + support OS/2 kLIBC (patch by KO Myung-Han).
+
+20120114
+ + several improvements to test/movewindow.c (prompted by discussion on
+ Linux Mint forum):
+ + modify movement commands to make them continuous
+ + rewrote the test for mvderwin
+ + rewrote the test for recursive mvwin
+ + split-out reusable CF_WITH_NCURSES_ETC macro in test/configure.in
+ + updated configure macro CF_XOPEN_SOURCE, build-fixes for Mac OS X
+ and OpenBSD.
+ + regenerated html manpages.
+
+20120107
+ + various improvments for MinGW (Juergen Pfeifer):
+ + modify stat() calls to ignore the st_size member
+ + drop mk-dlls.sh script.
+ + change recommended regular expression library.
+ + modify rain.c to allow for threaded configuraton.
+ + modify tset.c to allow for case when size-change logic is not used.
+
+20111231
+ + modify toe's report when -a and -s options are combined, to add
+ a column showing which entries belong to a given database.
+ + add -s option to toe, to sort its output.
+ + modify progs/toe.c, simplifying use of db-iterator results to use
+ caching improvements from 20111001 and 20111126.
+ + correct generation of pc-files when ticlib or termlib options are
+ given to rename the corresponding tic- or tinfo-libraries (report
+ by Sven Joachim).
+
+20111224
+ + document a portability issue with tput, i.e., that scripts which work
+ with ncurses may fail in other implementations that do no parameter
+ analysis.
+ + add putty-sco entry -TD
+
+20111217
+ + review/fix places in manpages where --program-prefix configure option
+ was not being used.
+ + add -D option to infocmp, to show the database locations that it
+ could use.
+ + fix build for the special case where term-driver, ticlib and termlib
+ are all enabled. The terminal driver depends on a few features in
+ the base ncurses library, so tic's dependencies include both ncurses
+ and termlib.
+ + fix build work for term-driver when --enable-wgetch-events option is
+ enabled.
+ + use types to fix some questionable casts to void*.
+
+20111210
+ + modify configure script to check if thread library provides
+ pthread_mutexattr_settype(), e.g., not provided by Solaris 2.6
+ + modify configure script to suppress check to define _XOPEN_SOURCE
+ for IRIX64, since its header files have a conflict versus
+ _SGI_SOURCE.
+ + modify configure script to add ".pc" files for tic- and
+ tinfo-libraries, which were omitted in recent change (cf: 20111126).
+ + fix inconsistent checks on $PKG_CONFIG variable in configure script.
+
+20111203
+ + modify configure-check for etip.h dependencies, supplying a temporary
+ copy of ncurses_dll.h since it is a generated file (prompted by
+ Debian #646977).
+ + modify CF_CPP_PARAM_INIT "main" function to work with current C++.
+
+20111126
+ + correct database iterator's check for duplicate entries
+ (cf: 20111001).
+ + modify database iterator to ignore $TERMCAP when it is not an
+ absolute pathname.
+ + add -D option to tic, to show the database locations that it could
+ use.
+ + improve description of database locations in tic manpage.
+ + modify the configure script to generate a list of the ".pc" files to
+ generate, rather than deriving the list from the libraries which have
+ been built (patch by Mike Frysinger).
+ + use AC_CHECK_TOOLS in preference to AC_PATH_PROGS when searching for
+ ncurses*-config, e.g., in Ada95/configure and test/configure (adapted
+ from patch by Mike Frysinger).
+
+20111119
+ + remove obsolete/conflicting fallback definition for _POSIX_SOURCE
+ from curses.priv.h, fixing a regression with IRIX64 and Tru64
+ (cf: 20110416)
+ + modify _nc_tic_dir() to ensure that its return-value is nonnull,
+ i.e., the database iterator was not initialized. This case is needed
+ to when tic is translating to termcap, rather than loading the
+ database (cf: 20111001).
+
+20111112
+ + add pccon entries for OpenBSD console (Alexei Malinin).
+ + build-fix for OpenBSD 4.9 with gcc 4.2.1, setting _XOPEN_SOURCE to
+ 600 to work around inconsistent ifdef'ing of wcstof between C and
+ C++ header files.
+ + modify capconvert script to accept more than exact match on "xterm",
+ e.g., the "xterm-*" variants, to exclude from the conversion (patch
+ by Robert Millan).
+ + add -lc_r as alternative for -lpthread, allows build of threaded code
+ in older FreeBSD machines.
+ + build-fix for MirBSD, which fails when either _XOPEN_SOURCE or
+ _POSIX_SOURCE are defined.
+ + fix a typo misc/Makefile.in, used in uninstalling pc-files.
+
+20111030
+ + modify make_db_path() to allow creating "terminfo.db" in the same
+ directory as an existing "terminfo" directory. This fixes a case
+ where switching between hashed/filesystem databases would cause the
+ new hashed database to be installed in the next best location -
+ root's home directory.
+ + add variable cf_cv_prog_gnat_correct to those passed to
+ config.status, fixing a problem with Ada95 builds (cf: 20111022).
+ + change feature test from _XPG5 to _XOPEN_SOURCE in two places, to
+ accommodate broken implementations for _XPG6.
+ + eliminate usage of NULL symbol from etip.h, to reduce header
+ interdependencies.
+ + add configure check to decide when to add _XOPEN_SOURCE define to
+ compiler options, i.e., for Solaris 10 and later (cf: 20100403).
+ This is a workaround for gcc 4.6, which fails to build the c++
+ binding if that symbol is defined by the application, due to
+ incorrectly combining the corresponding feature test macros
+ (report by Peter Kruse).
+
+20111022
+ + correct logic for discarding mouse events, retaining the partial
+ events used to build up click, double-click, etc, until needed
+ (cf: 20110917).
+ + fix configure script to avoid creating unused Ada95 makefile when
+ gnat does not work.
+ + cleanup width-related gcc 3.4.3 warnings for 64-bit platform, for the
+ internal functions of libncurses. The external interface of courses
+ uses bool, which still produces these warnings.
+
+20111015
+ + improve description of --disable-tic-depends option to make it
+ clear that it may be useful whether or not the --with-termlib
+ option is also given (report by Sven Joachim).
+ + amend termcap equivalent for set_pglen_inch to use the X/Open
+ "YI" rather than the obsolete Solaris 2.5 "sL" (cf: 990109).
+ + improve manpage for tgetent differences from termcap library.
+
+20111008
+ + moved static data from db_iterator.c to lib_data.c
+ + modify db_iterator.c for memory-leak checking, fix one leak.
+ + modify misc/gen-pkgconfig.in to use Requires.private for the parts
+ of ncurses rather than Requires, as well as Libs.private for the
+ other library dependencies (prompted by Debian #644728).
+
+20111001
+ + modify tic "-K" option to only set the strict-flag rather than force
+ source-output. That allows the same flag to control the parser for
+ input and output of termcap source.
+ + modify _nc_getent() to ignore backslash at the end of a comment line,
+ making it consistent with ncurses' parser.
+ + restore a special-case check for directory needed to make termcap
+ text files load as if they were databases (cf: 20110924).
+ + modify tic's resolution/collision checking to attempt to remove the
+ conflicting alias from the second entry in the pair, which is
+ normally following in the source file. Also improved the warning
+ message to make it simpler to see which alias is the problem.
+ + improve performance of the database iterator by caching search-list.
+
+20110925
+ + add a missing "else" in changes to _nc_read_tic_entry().
+
+20110924
+ + modify _nc_read_tic_entry() so that hashed-database is checked before
+ filesystem.
+ + updated CF_CURSES_LIBS check in test/configure script.
+ + modify configure script and makefiles to split TIC_ARGS and
+ TINFO_ARGS into pieces corresponding to LDFLAGS and LIBS variables,
+ to help separate searches for tic- and tinfo-libraries (patch by Nick
+ Alcock aka "Nix").
+ + build-fix for lib_mouse.c changes (cf: 20110917).
+
+20110917
+ + fix compiler warning for clang 2.9
+ + improve merging of mouse events (integrated patch by Damien
+ Guibouret).
+ + correct mask-check used in lib_mouse for wheel mouse buttons 4/5
+ (patch by Damien Guibouret).
+
+20110910
+ + modify misc/gen_edit.sh to select a "linux" entry which works with
+ the current kernel rather than assuming it is always "linux3.0"
+ (cf: 20110716).
+ + revert a change to getmouse() which had the undesirable side-effect
+ of suppressing button-release events (report by Damien Guibouret,
+ cf: 20100102).
+ + add xterm+kbs fragment from xterm #272 -TD
+ + add configure option --with-pkg-config-libdir to provide control over
+ the actual directory into which pc-files are installed, do not use
+ the pkg-config environment variables (discussion with Frederic L W
+ Meunier).
+ + add link to mailing-list archive in announce.html.in, as done in
+ FAQ (prompted by question by Andrius Bentkus).
+ + improve manpage install by adjusting the "#include" examples to
+ show the ncurses-subdirectory used when --disable-overwrite option
+ is used.
+ + install an alias for "curses" to the ncurses manpage, tied to the
+ --with-curses-h configure option (suggested by Reuben Thomas).
+
+20110903
+ + propagate error-returns from wresize, i.e., the internal
+ increase_size and decrease_size functions through resize_term (report
+ by Tim van der Molen, cf: 20020713).
+ + fix typo in tset manpage (patch by Sven Joachim).
+
+20110820
+ + add a check to ensure that termcap files which might have "^?" do
+ not use the terminfo interpretation as "\177".
+ + minor cleanup of X-terminal emulator section of terminfo.src -TD
+ + add terminator entry -TD
+ + add simpleterm entry -TD
+ + improve wattr_get macros by ensuring that if the window pointer is
+ null, then the attribute and color values returned will be zero
+ (cf: 20110528).
+
+20110813
+ + add substitution for $RPATH_LIST to misc/ncurses-config.in
+ + improve performance of tic with hashed-database by caching the
+ database connection, using atexit() to cleanup.
+ + modify treatment of 2-character aliases at the beginning of termcap
+ entries so they are not counted in use-resolution, since these are
+ guaranteed to be unique. Also ignore these aliases when reporting
+ the primary name of the entry (cf: 20040501)
+ + double-check gn (generic) flag in terminal descriptions to
+ accommodate old/buggy termcap databases which misused that feature.
+ + minor fixes to _nc_tgetent(), ensure buffer is initialized even on
+ error-return.
+
+20110807
+ + improve rpath fix from 20110730 by ensuring that the new $RPATH_LIST
+ variable is defined in the makefiles which use it.
+ + build-fix for DragonFlyBSD's pkgsrc in test/configure script.
+ + build-fixes for NetBSD 5.1 with termcap support enabled.
+ + corrected k9 in dg460-ansi, add other features based on manuals -TD
+ + improve trimming of whitespace at the end of terminfo/termcap output
+ from tic/infocmp.
+ + when writing termcap source, ensure that colons in the description
+ field are translated to a non-delimiter, i.e., "=".
+ + add "-0" option to tic/infocmp, to make the termcap/terminfo source
+ use a single line.
+ + add a null-pointer check when handling the $CC variable.
+
+20110730
+ + modify configure script and makefiles in c++ and progs to allow the
+ directory used for rpath option to be overridden, e.g., to work
+ around updates to the variables used by tic during an install.
+ + add -K option to tic/infocmp, to provide stricter BSD-compatibility
+ for termcap output.
+ + add _nc_strict_bsd variable in tic library which controls the
+ "strict" BSD termcap compatibility from 20110723, plus these
+ features:
+ + allow escapes such as "\8" and "\9" when reading termcap
+ + disallow "\a", "\e", "\l", "\s" and "\:" escapes when reading
+ termcap files, passing through "a", "e", etc.
+ + expand "\:" as "\072" on output.
+ + modify _nc_get_token() to reset the token's string value in case
+ there is a string-typed token lacking the "=" marker.
+ + fix a few memory leaks in _nc_tgetent.
+ + fix a few places where reading from a termcap file could refer to
+ freed memory.
+ + add an overflow check when converting terminfo/termcap numeric
+ values, since terminfo stores those in a short, and they must be
+ positive.
+ + correct internal variables used for translating to termcap "%>"
+ feature, and translating from termcap %B to terminfo, needed by
+ tctest (cf: 19991211).
+ + amend a minor fix to acsc when loading a termcap file to separate it
+ from warnings needed for tic (cf: 20040710)
+ + modify logic in _nc_read_entry() and _nc_read_tic_entry() to allow
+ a termcap file to be handled via TERMINFO_DIRS.
+ + modify _nc_infotocap() to include non-mandatory padding when
+ translating to termcap.
+ + modify _nc_read_termcap_entry(), passing a flag in the case where
+ getcap is used, to reduce interactive warning messages.
+
+20110723
+ + add a check in start_color() to limit color-pairs to 256 when
+ extended colors are not supported (patch by David Benjamin).
+ + modify setcchar to omit no-longer-needed OR'ing of color pair in
+ the SetAttr() macro (patch by David Benjamin).
+ + add kich1 to sun terminfo entry (Yuri Pankov)
+ + use bold rather than reverse for smso in sun-color terminfo entry
+ (Yuri Pankov).
+ + improve generation of termcap using tic/infocmp -C option, e.g.,
+ to correspond with 4.2BSD (prompted by discussion with Yuri Pankov
+ regarding Schilling's test program):
+ + translate %02 and %03 to %2 and %3 respectively.
+ + suppress string capabilities which use %s, not supported by tgoto
+ + use \040 rather than \s
+ + expand null characters as \200 rather than \0
+ + modify configure script to support shared libraries for DragonFlyBSD.
+
+20110716
+ + replace an assert() in _nc_Free_Argument() with a regular null
+ pointer check (report/analysis by Franjo Ivancic).
+ + modify configure --enable-pc-files option to take into account the
+ PKG_CONFIG_PATH variable (report by Frederic L W Meunier).
+ + add/use xterm+tmux chunk from xterm #271 -TD
+ + resync xterm-new entry from xterm #271 -TD
+ + add E3 extended capability to linux-basic (Miroslav Lichvar)
+ + add linux2.2, linux2.6, linux3.0 entries to give context for E3 -TD
+ + add SI/SO change to linux2.6 entry (Debian #515609) -TD
+ + fix inconsistent tabset path in pcmw (Todd C. Miller).
+ + remove a backslash which continued comment, obscuring altos3
+ definition with OpenBSD toolset (Nicholas Marriott).
+
+20110702
+ + add workaround from xterm #271 changes to ensure that compiler flags
+ are not used in the $CC variable.
+ + improve support for shared libraries, tested with AIX 5.3, 6.1 and
+ 7.1 with both gcc 4.2.4 and cc.
+ + modify configure checks for AIX to include release 7.x
+ + add loader flags/libraries to libtool options so that dynamic loading
+ works properly, adapted from ncurses-5.7-ldflags-with-libtool.patch
+ at gentoo prefix repository (patch by Michael Haubenwallner).
+
+20110626
+ + move include of nc_termios.h out of term_entry.h, since the latter
+ is installed, e.g., for tack while the former is not (report by
+ Sven Joachim).
+
+20110625
+ + improve cleanup() function in lib_tstp.c, using _exit() rather than
+ exit() and checking for SIGTERM rather than SIGQUIT (prompted by
+ comments forwarded by Nicholas Marriott).
+ + reduce name pollution from term.h, moving fallback #define's for
+ tcgetattr(), etc., to new private header nc_termios.h (report by
+ Sergio NNX).
+ + two minor fixes for tracing (patch by Vassili Courzakis).
+ + improve trace initialization by starting it in use_env() and
+ ripoffline().
+ + review old email, add details for some changelog entries.
+
+20110611
+ + update minix entry to minix 3.2 (Thomas Cort).
+ + fix a strict compiler warning in change to wattr_get (cf: 20110528).
+
+20110604
+ + fixes for MirBSD port:
+ + set default prefix to /usr.
+ + add support for shared libraries in configure script.
+ + use S_ISREG and S_ISDIR consistently, with fallback definitions.
+ + add a few more checks based on ncurses/link_test.
+ + modify MKlib_gen.sh to handle sp-funcs renaming of NCURSES_OUTC type.
+
+20110528
+ + add case to CF_SHARED_OPTS for Interix (patch by Markus Duft).
+ + used ncurses/link_test to check for behavior when the terminal has
+ not been initialized and when an application passes null pointers
+ to the library. Added checks to cover this (prompted by Redhat
+ #707344).
+ + modify MKlib_gen.sh to make its main() function call each function
+ with zero parameters, to help find inconsistent checking for null
+ pointers, etc.
+
+20110521
+ + fix warnings from clang 2.7 "--analyze"
+
+20110514
+ + compiler-warning fixes in panel and progs.
+ + modify CF_PKG_CONFIG macro, from changes to tin -TD
+ + modify CF_CURSES_FUNCS configure macro, used in test directory
+ configure script:
+ + work around (non-optimizer) bug in gcc 4.2.1 which caused
+ test-expression to be omitted from executable.
+ + force the linker to see a link-time expression of a symbol, to
+ help work around weak-symbol issues.
+
+20110507
+ + update discussion of MKfallback.sh script in INSTALL; normally the
+ script is used automatically via the configured makefiles. However
+ there are still occasions when it might be used directly by packagers
+ (report by Gunter Schaffler).
+ + modify misc/ncurses-config.in to omit the "-L" option from the
+ "--libs" output if the library directory is /usr/lib.
+ + change order of tests for curses.h versus ncurses.h headers in the
+ configure scripts for Ada95 and test-directories, to look for
+ ncurses.h, from fixes to tin -TD
+ + modify ncurses/tinfo/access.c to account for Tandem's root uid
+ (report by Joachim Schmitz).
+
+20110430
+ + modify rules in Ada95/src/Makefile.in to ensure that the PIC option
+ is not used when building a static library (report by Nicolas
+ Boulenguez):
+ + Ada95 build-fix for big-endian architectures such as sparc. This
+ undoes one of the fixes from 20110319, which added an "Unused" member
+ to representation clauses, replacing that with pragmas to suppress
+ warnings about unused bits (patch by Nicolas Boulenguez):
+
+20110423
+ + add check in test/configure for use_window, use_screen.
+ + add configure-checks for getopt's variables, which may be declared
+ as different types on some Unix systems.
+ + add check in test/configure for some legacy curses types of the
+ function pointer passed to tputs().
+ + modify init_pair() to accept -1's for color value after
+ assume_default_colors() has been called (Debian #337095).
+ + modify test/background.c, adding commmand-line options to demonstrate
+ assume_default_colors() and use_default_colors().
+
+20110416
+ + modify configure script/source-code to only define _POSIX_SOURCE if
+ the checks for sigaction and/or termios fail, and if _POSIX_C_SOURCE
+ and _XOPEN_SOURCE are undefined (report by Valentin Ochs).
+ + update config.guess, config.sub
+
+20110409
+ + fixes to build c++ binding with clang 3.0 (patch by Alexander
+ Kolesen).
+ + add check for unctrl.h in test/configure, to work around breakage in
+ some ncurses packages.
+ + add "--disable-widec" option to test/configure script.
+ + add "--with-curses-colr" and "--with-curses-5lib" options to the
+ test/configure script to address testing with very old machines.
+
20110404 5.9 release for upload to ftp.gnu.org
20110402
@@ -100,7 +1454,7 @@ it is not possible to add this information.
+ modify configure script to provide value for HTML_DIR in
Ada95/gen/Makefile.in, which depends on whether the Ada95 binding is
distributed separately (report by Nicolas Boulenguez).
- + modify configure script to add -g and/or -O3 to ADAFLAGS if the
+ + modify configure script to add "-g" and/or "-O3" to ADAFLAGS if the
CFLAGS for the build has these options.
+ amend change from 20070324, to not add 1 to the result of getmaxx
and getmaxy in the Ada binding (report by Nicolas Boulenguez for
@@ -155,7 +1509,7 @@ it is not possible to add this information.
20110212
+ regenerated html manpages.
+ use _tracef() in show_where() function of tic, to work correctly with
- special case of trace configuration.
+ special case of trace configuration.
20110205
+ add xterm-utf8 entry as a demo of the U8 feature -TD
@@ -219,7 +1573,7 @@ it is not possible to add this information.
version which works with termcap.
+ remove obsolete emacs "Local Variables" section from documentation
(request by Sven Joachim).
- + update doc/html/index.html to include NCURSES-Programming-HOWTO.html
+ + update doc/html/index.html to include NCURSES-Programming-HOWTO.html
(report by Sven Joachim).
20101128
@@ -294,8 +1648,8 @@ it is not possible to add this information.
Sven Joachim).
+ add parameterized cursor-controls to linux-basic (report by Dae) -TD
> patch by Juergen Pfeifer:
- + document how to build 32-bit libraries in README.MinGW
- + fixes to filename computation in mk-dlls.sh.in
+ + document how to build 32-bit libraries in README.MinGW
+ + fixes to filename computation in mk-dlls.sh.in
+ use POSIX locale in mk-dlls.sh.in rather than en_US (report by Sven
Joachim).
+ add a check in mk-dlls.sh.in to obtain the size of a pointer to
@@ -478,7 +1832,7 @@ it is not possible to add this information.
20100417
+ modify _nc_capcmp() to work with cancelled strings.
+ correct translation of "^" in _nc_infotocap(), used to transform
- terminfo to termcap strings
+ terminfo to termcap strings
+ add configure --disable-rpath-hack, to allow disabling the feature
which adds rpath options for libraries in unusual places.
+ improve CF_RPATH_HACK_2 by checking if the rpath option for a given
@@ -1533,8 +2887,8 @@ it is not possible to add this information.
that library.
+ add/modify null-pointer checks in several functions for SP and/or
the WINDOW* parameter (report by Thorben Krueger).
- + fixes for field_buffer() in formw library (see Redhat Bugzilla
- #310071, patches by Miroslav Lichvar).
+ + fixes for field_buffer() in formw library (see Redhat #310071,
+ patches by Miroslav Lichvar).
+ improve performance of NCURSES_CHAR_EQ code (patch by Miroslav
Lichvar).
+ update/improve mlterm and rxvt terminfo entries, e.g., for
@@ -1645,7 +2999,7 @@ it is not possible to add this information.
+ modify configure script to quiet c++ build with libtool when the
--disable-echo option is used.
+ modify configure script to disable ada95 if libtool is selected,
- writing a warning message (addresses FreeBSD ports/114493).
+ writing a warning message (addresses FreeBSD #114493).
+ update config.guess, config.sub
20070707
@@ -2130,8 +3484,7 @@ it is not possible to add this information.
+ workaround for 20050806 ifdef's change to allow visbuf.c to compile
when using --with-termlib --with-trace options.
+ improve tgetstr() by making the return value point into the user's
- buffer, if provided (patch by Miroslav Lichvar (see Redhat Bugzilla
- #202480)).
+ buffer, if provided (patch by Miroslav Lichvar (see Redhat #202480)).
+ correct libraries needed for foldkeys (report by Stanislav Ievlev)
20060826
@@ -2144,10 +3497,10 @@ it is not possible to add this information.
source output (Debian #378783).
+ modify configure script to ensure that if the C compiler is used
rather than the loader in making shared libraries, the $(CFLAGS)
- variable is also used (Redhat Bugzilla #199369).
+ variable is also used (Redhat #199369).
+ port hashed-db code to db2 and db3.
+ fix a bug in tgetent() from 20060625 and 20060715 changes
- (patch/analysis by Miroslav Lichvar (see Redhat Bugzilla #202480)).
+ (patch/analysis by Miroslav Lichvar (see Redhat #202480)).
20060805
+ updated xterm function-keys terminfo to match xterm #216 -TD
@@ -2939,7 +4292,7 @@ it is not possible to add this information.
of cur_term if the same output was selected. This now reuses it only
when setupterm() is called from tgetent(), which has no notion of
separate SCREENs. Note that tgetent() must be called after initscr()
- or newterm() to use this feature (Redhat Bugzilla #140326).
+ or newterm() to use this feature (Redhat #140326).
+ add a check in CF_BUILD_CC macro to ensure that developer has given
the --with-build-cc option when cross-compiling (report by Alexandre
Campo).
@@ -3032,7 +4385,7 @@ it is not possible to add this information.
entries, e.g., so it can analyze the xterm-8bit entry.
+ add morphos terminfo entry, improve amiga-8bit entry (Pavel Fedin).
+ correct translation of "%%" in terminfo format to termcap, e.g.,
- using "tic -C" (Redhat Bugzilla #130921).
+ using "tic -C" (Redhat #130921).
+ modified configure script CF_XOPEN_SOURCE macro to ensure that if
it defines _POSIX_C_SOURCE, that it defines it to a specific value
(comp.os.stratus newsgroup comment).
@@ -3043,9 +4396,9 @@ it is not possible to add this information.
However that did find a coding error in Assume_Default_Colors().
+ modify several terminfo entries to ensure xterm mouse and cursor
visibility are reset in rs2 string: hurd, putty, gnome,
- konsole-base, mlterm, Eterm, screen (Debian #265784, #55637). The
- xterm entries are left alone - old ones for compatibility, and the
- new ones do not require this change. -TD
+ konsole-base, mlterm, Eterm, screen (Debian #265784, Debian #55637).
+ The xterm entries are left alone - old ones for compatibility, and
+ the new ones do not require this change. -TD
20040814
+ fake a SIGWINCH in newterm() to accommodate buggy terminal emulators
@@ -3076,8 +4429,8 @@ it is not possible to add this information.
+ modify "tic -cv" to ignore delays when comparing strings. Also
modify it to ignore a canceled sgr string, e.g., for terminals which
cannot properly combine attributes in one control sequence.
- + corrections for gnome and konsole entries (Redhat Bugzilla #122815,
- patch by Hans de Goede)
+ + corrections for gnome and konsole entries (Redhat #122815, patch by
+ Hans de Goede)
> terminfo updates -TD
+ make ncsa-m rmacs/smacs consistent with sgr
+ add sgr, rc/sc and ech to syscons entries
@@ -3090,7 +4443,7 @@ it is not possible to add this information.
> terminfo updates -TD
+ add xterm-pc-fkeys
+ review/update gnome and gnome-rh90 entries (prompted by Redhat
- Bugzilla #122815).
+ #122815).
+ review/update konsole entries
+ add sgr, correct sgr0 for kterm and mlterm
+ correct tsl string in kterm
@@ -3503,7 +4856,7 @@ it is not possible to add this information.
generated when cross-compiling for DJGPP.
+ modify infocmp to omit check for $TERM for operations that do not
require it, e.g., "infocmp -e" used to build fallback list (report by
- Koblinger Egmont).
+ Egmont Koblinger).
20031004
+ add terminfo entries for DJGPP.
@@ -4204,7 +5557,7 @@ it is not possible to add this information.
+ add a check in kgetch() for cooked characters in the fifo to avoid
calling fifo_push() when a KEY_RESIZE is available (report/analysis
by Sam Varshavchik ).
- + fix an overlooked case for bugzilla #68199 (Philippe Blain).
+ + fix an overlooked case for Redhat #68199 (Philippe Blain).
+ ensure clearerr() is called before using ferror() e.g., in
lib_screen.c (report by Philippe Blain).
@@ -4212,7 +5565,7 @@ it is not possible to add this information.
+ modify lib_screen.c and lib_newwin.c to maintain the SCREEN-specific
pointers for curscr/stdscr/newscr when scr_save() and scr_restore()
modify the global curscr/stdscr/newscr variables. Fixes Redhat
- bugzilla #68199 dated 2002-07-07.
+ #68199.
+ add checks for null pointer in calls to tparm() and tgoto() based on
FreeBSD bug report. If ncurses were built with termcap support, and
the first call to tgoto() were a zero-length string, the result would
@@ -4245,7 +5598,7 @@ it is not possible to add this information.
Olaf Buddenhagen ).
+ modified wresize() to ensure that a failed realloc will not corrupt
the window structure, and to make subwindows fit within the resized
- window (completes Debian #87678, #101699)
+ window (completes Debian #87678, Debian #101699)
20020803
+ fix an off-by-one in lib_pad.c check for limits of pad (patch by
@@ -4940,9 +6293,9 @@ it is not possible to add this information.
which may be in libutf8.
+ remove some unnecessary text from curs_extend.3x and
default_colors.3x which caused man-db to make incorrect symbolic
- links (Debian bug report #99550).
+ links (Debian #99550).
+ add configure check if cast for _IO_va_list is needed to compile
- C++ vscan code (Debian bug report #97945).
+ C++ vscan code (Debian #97945).
> several patches from Sven Verdoolaege:
+ correct code that used non-standard auto-initialization of a struct,
which gcc allows (report by Larry Virden).
@@ -5077,7 +6430,7 @@ it is not possible to add this information.
+ add some examples of customizing screen's terminfo:
screen.xterm-xfree86, screen.xterm-r6, screen.teraterm -TD
+ modify screen's terminfo entry to match the khome/kend in screen
- 3.09.08 (Debian bug report #92215).
+ 3.09.08 (Debian #92215).
+ correct a memory leak in forms library (report by Stefan Vogtner
) (patch by Juergen Pfeifer).
@@ -5091,12 +6444,12 @@ it is not possible to add this information.
+ add .cc.ii rule to c++ makefile, to get preprocessor output for
debugging.
+ correct configure script handling of @keyword@ substitutions when the
- --with-manpage-renames option is given (cf: 20000715, fixes Debian
- bug #89939).
+ --with-manpage-renames option is given (cf: 20000715, fixes Debian
+ #89939).
+ report stack underflow/overflow in tparm() when tic -cv option is
given.
+ remove spurious "%|" operator from xterm-xfree86 terminfo entry,
- (reported by Adam Costello , Debian bug #89222).
+ (reported by Adam Costello , Debian #89222).
20010310
+ cleanup of newdemo.c, fixing some ambiguous expressions noted by gcc
@@ -5800,7 +7153,7 @@ it is not possible to add this information.
+ correct spelling error in terminfo entry name: bq300-rv was given as
bg300-rv in esr's version.
+ modify redrawwin() macro so its parameter is fully parenthesized
- (fixes Debian bug report #61088).
+ (fixes Debian #61088).
+ correct formatting error in dump_entry() which set incorrect column
value when no newline trimming was needed at the end of an entry,
before appending "use=" clauses (cf: 960406).
@@ -6530,7 +7883,7 @@ it is not possible to add this information.
handling in lynx (reported by Kim DeVaughn).
990306 pre-release
- + add -G option to tic and infocmp, to reverse the -g option.
+ + add -G option to tic and infocmp, to reverse the "-g" option.
+ recode functions in name_match.c to avoid use of strncpy, which
caused a 4-fold slowdown in tic (cf: 980530).
+ correct a few warnings about sign-extension in recent changes.
@@ -6901,7 +8254,7 @@ it is not possible to add this information.
since that is a little more efficient.
+ minor correction to infocmp to avoid displaying "difference" between
two capabilities that are rendered in equivalent forms.
- + add -g option to tic/infocmp to force character constants to be
+ + add "-g" option to tic/infocmp to force character constants to be
displayed in quoted form. Otherwise their decimal values are shown.
+ modify setupterm so that cancelled strings are treated the same as
absent strings, cancelled and absent booleans false (does not affect
@@ -8979,15 +10332,18 @@ it is not possible to add this information.
+ correction to #317.
> patch 317 (ESR):
+ re-add _nc_hash_map
- + modify EmitRange to maintain position as per original design.
- + add hashtest.c, program to time the hashmap optimization.
+ + modify EmitRange to maintain position as per original design
+ (patch by A. Lukyanov).
+ + modify test/ncurses.c and tputs, etc., to allow trace counting
+ output characters.
+ + add hashtest.c program to time the hashmap optimization.
> patch 316 (ESR):
+ add logic to deal with magic-cookie (how was this tested?)
(lib_doupdate.c).
+ add ncurses.c driver for magic-cookie, some fixes to ncurses.c
> patch 315 (ESR):
- + merged Alexander V Lukyanov's patch to use ech and rep - untested
- (lib_doupdate.c).
+ + merge changes to lib_doupdate.c to use ech and rep - untested
+ (patch by Alexander V Lukyanov).
+ modified handling of interrupted system calls - untested
(lib_getch.c, lib_twait.c).
+ new function _nc_mvcur_resume()
@@ -9059,12 +10415,12 @@ it is not possible to add this information.
+ corrected typo in dtterm description.
> patch 313 (ESR):
+ add dtterm description
- + clarify ncurses 'i' test (drop vscanf subtest)
+ + clarify ncurses 'i' test (drop mvwscanw subtest)
960810 - snapshot
+ correct nl()/nonl() to work as per SVr4 & XSI.
+ minor fixes to ncurses.c (use 'noraw()', mvscanw return-code)
- + refine configure-test for -g option (Tim Mooney).
+ + refine configure-test for "-g" option (Tim Mooney).
+ correct interaction between O_BLANK and NEW_LINE request in form
library (Juergen Pfeifer)
@@ -9073,7 +10429,8 @@ it is not possible to add this information.
> patch 312 (ESR):
correct terminfo.src corrupted by #310
> patch 311 (ESR):
- + fix idlok() and idcok() and the default of the idlok switch.
+ + fix idlok() and idcok() and the default of the idlok switch (report
+ by Ville Sulko).
960803 - snapshot
+ corrected tparm to handle capability strings without explicit pop
@@ -9083,7 +10440,7 @@ it is not possible to add this information.
> patch 310 (ESR):
+ documentation and prototyping errors for has_color, immedok and idcok
(reported by William P Setzer )
- + updated qnx terminfo entry (by Michael Hunter)
+ + updated qnx terminfo entry (patch by Michael Hunter)
960730
+ eliminate quoted includes in ncurses subdirectory, ensure config.h
@@ -9095,7 +10452,7 @@ it is not possible to add this information.
+ call cbreak() in initscr(), as per XSI & SVr4.
+ turn off hardware echo in initscr() as per XSI & SVr4
> patch 309 (ESR):
- + terminfo changes (9.3.10), from BRL
+ + terminfo changes (9.3.9), from BRL
+ add more checks to terminfo parser.
+ add more symbols to infocmp.
@@ -9114,6 +10471,7 @@ it is not possible to add this information.
> patch 308 (ESR):
+ terminfo changes (9.3.8)
+ modified logic of error-reporting in terminfo parser
+ + fix option-processing bug in toe.
960713 - snapshot
+ always check for since ISC needs it to declare
@@ -9122,9 +10480,19 @@ it is not possible to add this information.
by Juergen Pfeifer, Mike Long)
+ add LOCAL_LDFLAGS2 symbol (Juergen Pfeifer)
+ corrected prototype for delay_output() -- bump ABI to 3.2
- + terminfo patches #306/307 (ESR).
+ + patch 307 (ESR):
+ + enable more translations of nonstandard caps, and document them.
+ + misc/terminfo.src update to 9.13.8
+ + patch 306 (ESR):
+ moved logic that filters out rmul and rmso from setupterm to newterm
where it is less likely to interfere with termcap applications.
+ + cosmetic fixes to test/ncurses.c
+ + modify open() call in ncurses/read_entry.c to use O_RDONLY symbol
+ rather than constant (report by mib).
+ + misc/terminfo.src sgr0 and acsc changes (report by Philippe De
+ Muyter).
+ + modify ncurses/comp_parse.c so that entries containing a "+" can
+ have missing rmcup vs smcup.
960707
+ rollback ESR's #305 change to terminfo.src (it breaks existing
@@ -9139,7 +10507,6 @@ it is not possible to add this information.
+ make lib_vidattr.c more readable using macros.
+ filter out rmul, rmso that conflict with sgr0 when reading terminal
descriptions.
- + added sanity-checking of various paired string attributes (ESR).
+ work around autoconf bug, force $INSTALL to absolute path
(reported by Zeyd).
+ modify man-page install for BSDI to install preformatted .0 files
@@ -9152,6 +10519,12 @@ it is not possible to add this information.
+ disable scrollok during the ncurses 'p' test; if it is enabled the
stdscr will scroll when putting the box-corners in the lower-right
of the screen.
+ > patch 305 (ESR):
+ + added sanity-checking of various paired string attributes.
+ + misc/terminfo.src update to 9.13.7 (report by A. Lukyanov).
+ + modify man/Makefile.in to make terminfo.5 during normal build.
+ > patch 304 (ESR):
+ + corrected allocation-length for $HOME/.terminfo path.
960629 - snapshot
+ check return code of _nc_mvcur_scrolln() in _nc_scroll_optimize() for
@@ -9234,6 +10607,7 @@ it is not possible to add this information.
+ better fix for nvi refresh-bug (Rick Marshall)
+ fix for bug in handling of interrupted keystroke waits,
(Werner Fleck).
+ + misc/ncurses-intro.html syntax fix (Kajiyama Tamito).
960601 - snapshot
+ auto-configure man-page compression-format and renames for Debian.
@@ -9248,7 +10622,7 @@ it is not possible to add this information.
+ enhancement to the control over the new PC-style soft key format.
allow caller now to select whether or not one wants to have
the index-line; see curs_slk.3x for documentation (Juergen Pfeifer).
- + typos, don't use inline with -g (Philippe De Muyter)
+ + typos, don't use inline with "-g" (Philippe De Muyter)
+ fixes for menus & wattr-, slk-functions (Juergen Pfeifer)
960526 - snapshot
@@ -9263,6 +10637,9 @@ it is not possible to add this information.
+ include sys/types.h in case stdlib.h does not declare size_t.
+ fixes for makefile (Tim Mooney)
+ fixes for menus & forms (Juergen Pfeifer)
+ > patch 302 (ESR):
+ + improve hash function (suggested by Alexander V Lukyanov).
+ + 9.13.4 update for terminfo.src
960518 - snapshot
+ revised ncurses.c panner test, let pad abut all 4 sides of screen.
@@ -9275,6 +10652,8 @@ it is not possible to add this information.
confusion, and made this check for the /usr/lib/terminfo pre-existing
directory.
> patches 299-301 (ESR):
+ + html fixes (Phillippe de Muyter).
+ + fix typo in ncurses-intro.html (report by Fabrizio Polacco).
+ added hashmap.c
+ mods to tracing, especially for ACS chars.
+ corrected off-by-one in IDCtransform.
@@ -9294,13 +10673,21 @@ it is not possible to add this information.
> patches 297, 298 (ESR):
+ implement TERMINFO_DIRS, and -o option of tic
+ added TRACE_IEVENT
- + removed boolean version of 'getm'
- + added lib_print.c (for Rick Marshall)
- + added has_key()
+ + fix REQ_TOGGLE_ITEM in menu/menu_driver.c; it could select but not
+ deselect.
+ + added lib_print.c (request by Rick Marshall).
+ + added has_key() (request by Juergen Pfeifer).
+ + do not issue clrtoeol or clrtobot if the relevant portion of the line
+ is already blank (analysis by Keith Bostic).
+ + add parentheses for parameters of COLOR_PAIR and PAIR_NUMBER macros
+ (analysis by Jurgen Eidt).
+ + update screen's notion of cursor position in endwin() (analysis by
+ Alexander Lukyanov).
+ added 't' to ncurses.c test.
+ moved delay_output() to lib_tputs.c
+ removed tparam() (was added in 1.9.9, but conflicts with emacs and
is not part of X/Open Curses).
+ + removed boolean version of 'getm'.
+ misc cursor & optimization fixes.
960504 - snapshot
@@ -9326,11 +10713,20 @@ it is not possible to add this information.
+ make TIOCGWINSZ configure test less stringent, in case user
configures via terminal that cannot get screen size.
> patches 295, 296 (ESR):
- + new "-e" option of tic.
- + fix for "infocmp -e".
- + restore working-directory in read_termcap.c
+ split lib_kernel.c, lib_setup.c and names.c in order to reduce
overhead for programs that use only termcap features.
+ + new "-e" and "-h" options of tic (request by Tony Nugent).
+ + fix bug in mandatory-delay logic in lib_tputs.c (report by Sven
+ Verdoolaege).
+ + fix for "infocmp -e" to emit correct initializers (reported by Manual
+ J Novoa III).
+ + restore working-directory in read_termcap.c (report by Kayvan
+ Sylvan).
+ + use "-h" option on Solaris when generating shared libraries on
+ Solaris 2.5 to record the library name in the file, for assisting
+ the loader (patch by Scott Kramer).
+ + undo patch #294 changes to form and menu libraries (request by
+ Juergen Pfeifer).
960418 - snapshot
+ use autoconf 2.9
@@ -9338,10 +10734,22 @@ it is not possible to add this information.
definitions via , modified macros in lib_raw.c to avoid
K&R-style substitution)
> patches 293, 294 (ESR):
- + mods to wgetch() in cooked mode
- + corrected askuser() logic in tset
- + correct interaction of endwin() with mouse processing
+ + rewrite wsyncup(), wsyncdown(), as well as small fixes to form and
+ menu libraries to fix echo-breakage introduced by 1.8.9, 1.9.9e
+ changes (patches by Juergen Pfeifer).
+ + fix compile under QNX 4.2 by defining ONLCR in lib_raw.c when
+ __QNX__ is defined (patch by Michael Hunter).
+ + modify setupterm() to match documentation for its return value, fix
+ newterm to work with this change (report by Emmet Lazich).
+ + add checks in getch() for error, return ERR as appropriate (report by
+ Emmet Lazich).
+ + mods to wgetch() in cooked mode (report by Pete Seebach).
+ + corrected askuser() logic in tset (patch by Remco Treffkorn).
+ + correct interaction of endwin() with mouse processing (report by
+ Michael Elkins).
+ added trace support for TTY flags
+ + update terminfo.src to 9.13.1
+ + FreeBSD console entries (patch by Andrew Chernov).
960406
+ fixes for NeXT, ISC and HPUX auto-configure
diff --git a/contrib/ncurses/README b/contrib/ncurses/README
index 56bc38586f48..c509352b785e 100644
--- a/contrib/ncurses/README
+++ b/contrib/ncurses/README
@@ -1,5 +1,5 @@
-------------------------------------------------------------------------------
--- Copyright (c) 1998-2004,2006 Free Software Foundation, Inc. --
+-- Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
@@ -25,7 +25,7 @@
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
--- $Id: README,v 1.23 2006/04/22 22:19:37 tom Exp $
+-- $Id: README,v 1.25 2012/08/11 20:11:26 tom Exp $
-------------------------------------------------------------------------------
README file for the ncurses package
@@ -78,6 +78,10 @@ features are provided by ifdef's in the header files. The wide-character
library interfaces are not binary-compatible with the non-wide-character
version.
+If you configure using the --enable-reentrant option, a "t" is appended to the
+library names (e.g., libncursest.a) and the resulting libraries have a
+different binary interface which makes the ncurses interface more "opaque".
+
The ncurses libraries implement the curses API. The panel, menu and forms
libraries implement clones of the SVr4 panel, menu and forms APIs. The source
code for these lives in the `ncurses', `panel', `menu', and `form' directories
@@ -122,8 +126,9 @@ The utilities are as follows:
tic -- terminfo source to binary compiler
infocmp -- terminfo binary to source decompiler/comparator
clear -- emits clear-screen for current terminal
+ tabs -- set tabs on a terminal
tput -- shell-script access to terminal capabilities.
- toe -- table of entries utility
+ toe -- table of entries utility
tset -- terminal-initialization utility
The first two (tic and infocmp) are used for manipulating terminfo
@@ -153,8 +158,10 @@ Thomas Dickey (maintainer for 1.9.9g through 4.1, resuming with FSF's 5.0):
configuration scripts, porting, mods to adhere to XSI Curses in the
areas of background color, terminal modes. Also memory leak testing,
the wresize, default colors and key definition extensions and numerous
- bug fixes (more than half of those enumerated in NEWS beginning with
- the internal release 1.8.9).
+ bug fixes -- more than half of those enumerated in NEWS beginning with
+ the internal release 1.8.9, see
+
+ http://invisible-island.net/personal/changelogs.html
Florian La Roche (official maintainer for FSF's ncurses 4.2)
Beginning with release 4.2, ncurses is distributed under an MIT-style
diff --git a/contrib/ncurses/README.MinGW b/contrib/ncurses/README.MinGW
index d111b3877840..f7d789777a1d 100644
--- a/contrib/ncurses/README.MinGW
+++ b/contrib/ncurses/README.MinGW
@@ -1,5 +1,5 @@
-------------------------------------------------------------------------------
--- Copyright (c) 2008-2010,2011 Free Software Foundation, Inc. --
+-- Copyright (c) 2008-2011,2012 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
-- copy of this software and associated documentation files (the --
@@ -25,7 +25,7 @@
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
--- $Id: README.MinGW,v 1.5 2011/02/26 16:57:17 tom Exp $
+-- $Id: README.MinGW,v 1.9 2012/09/22 17:46:04 tom Exp $
-- Author: Juergen Pfeifer
-------------------------------------------------------------------------------
@@ -39,7 +39,7 @@ from http://www.mingw.org
To build ncurses for native Windows, you need the MinGW toolchain. The
original MinGW toolchain from the above site is only for 32-Bit Windows. As
Windows Server - and also regular workstations - are moving to 64-Bit, it
-seems to be reasonable to have a toolchain that supports both architectures.
+seems to be reasonable to have a toolchain that supports both architectures.
I recommend to use the TDM gcc toolchain which you can find at
http://tdm-gcc.tdragon.net/download. Go to the download section and select
the bundle installer for tdm64 (MinGW-w64). This installs a multilib version
@@ -47,7 +47,7 @@ of the gcc toolchain that can compile for native 32- and 64-Bit Windows
versions. It also comes with a working pthread implementation.
The latest config and build scripts we use for MinGW have only been tested
-for the gcc-4.4 compiler toolchain (or better).
+for the gcc-4.6.1 compiler toolchain (or better).
Using MinGW is a pragmatic decision, it's the easiest way to port this
heavily UNIX based sourcebase to native Windows. The goal is of course
@@ -55,22 +55,13 @@ to provide the includes, libraries and DLLs to be used with the more
common traditional development environments on Windows, mainly with
Microsoft Visual Studio.
-If you start a bash from the MSYS environment, please make sure that the
-Microsoft Development tools are in your PATH right after the MinGW
-tools. The LIB.EXE tool is the only one needed. You need this only if
-you want to build DLLs that work with native Windows programs. If you
-don't have any Microsoft Development tools on your machine, consider
-at least to get the free "Visual C++ 2010 Express Edition".
-It contains the LIB.EXE tool. You may also use this compiler to test
-writing native Windows programs using the ncurses DLLs without using
-MinGW then for writing apps.
-
-It is necessary to unset the TERM environment variable, to activate the
-Windows console-driver.
+The TERM environment variable must be set specially to active the Windows
+console-driver. The driver checks if TERM is set to "#win32con" (explicit
+use) or if TERM is unset or empty (implicit).
Please also make sure that MSYS links to the correct directory containing
your MinGW toolchain. For TDM this is usually C:\MinGW64. In your Windows
-CMD.EXE command shell go to the MSYS root directory (most probably
+CMD.EXE command shell go to the MSYS root directory (most probably
C:\MSYS or C:\MSYS\1.0) and verify, that there is a junction point mingw
that points to the MinGW toolchain directory. If not, delete the mingw
directory and use the mklink command (or the linkd.exe utility on older
@@ -79,62 +70,60 @@ Windows) to create the junction point.
This code requires WindowsNT 5.1 or better, which means on the client
Windows XP or better, on the server Windows Server 2003 or better.
-In order to build ncurses for the planned interop layer with .NET, we
-recommend to use these options with configure
+I recommend using libtool to build ncurses on MinGW, because libtool
+knows exactly how to build dll's on Windows for use with MinGW.
+To build a modern but still small footprint ncurses that provides
+hooks for interop, I recommend using these options:
+
+ --with-libtool
--disable-home-terminfo
- --enable-reentrant
+ --enable-database
+ --disable-termcap
--enable-sp-funcs
--enable-term-driver
--enable-interop
- --with-pthread (if using TDM toolchain as recommended)
-This is the configuration commandline as I'm using it at the moment:
+This is the configuration commandline as I'm using it at the moment (assuming
+environment variable MINGW_ROOT to hold the root directory name of your MinGW
+build):
./configure \
- --prefix=/mingw \
- --without-cxx-binding \
+ --prefix=$MINGW_ROOT \
+ --with-cxx \
--without-ada \
--enable-warnings \
--enable-assertions \
- --enable-reentrant \
- --with-debug \
- --with-normal \
--disable-home-terminfo \
+ --enable-database \
--enable-sp-funcs \
--enable-term-driver \
--enable-interop \
- --with-pthread
+ --disable-termcap \
+ --with-progs \
+ --with-libtool \
+ --enable-pc-files \
+ --mandir=$MINGW_ROOT/share/man
-If you are on a 64-Bit Windows system and want to build a 32-Bit version
-of ncurses, you may use this commandline for configuration (when using
-the TDM toolchain):
+Please note that it is also necessary to set this environment variable:
-CC="gcc -m32" LD="ld -m32" ./configure \
- --prefix=/mingw \
- --without-cxx-binding \
- --without-ada \
- --enable-warnings \
- --enable-assertions \
- --enable-reentrant \
- --with-debug \
- --with-normal \
- --disable-home-terminfo \
- --enable-sp-funcs \
- --enable-term-driver \
- --enable-interop \
- --with-pthread
+export PATH_SEPARATOR=";"
+
+in order to parse the terminfo paths correctly. Terminfo paths should
+always be separated by a seeeemicolon,even when running under MSYS.
+
+To support regular expressions properly, ncurses under MinGW should be
+linked against the gnurx regex library, which must be built separately
+under MinGW. See
+
+ ftp.gnome.org/pub/GNOME/binaries/win32/dependencies/libgnurx-src-2.5.zip
All the options above are - like the whole Windows support -
experimental.
-In order to build the DLLs, after your regular make you must call
-
- make dlls
-
A lot is still TODO, e.g.:
- - Wide Character support
+ - Wide Character support (display is workable, but input untested)
The Win32Con driver should actually only use Unicode in the
future.
- Thread support (locking). If using TDM toolchain this is done by
@@ -145,5 +134,5 @@ A lot is still TODO, e.g.:
- Workarounds for MinGW's filesystem access are necessary to make infocmp
work (though tic works).
-To support terminfo, we need to have an ioctl() simulation for the
-serial and networked Terminals.
+To support terminfo, we would need to have an ioctl() simulation for the
+serial and networked terminals.
diff --git a/contrib/ncurses/aclocal.m4 b/contrib/ncurses/aclocal.m4
index 9a828559d4ab..e73959ecc239 100644
--- a/contrib/ncurses/aclocal.m4
+++ b/contrib/ncurses/aclocal.m4
@@ -1,5 +1,5 @@
dnl***************************************************************************
-dnl Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. *
+dnl Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. *
dnl *
dnl Permission is hereby granted, free of charge, to any person obtaining a *
dnl copy of this software and associated documentation files (the *
@@ -28,7 +28,7 @@ dnl***************************************************************************
dnl
dnl Author: Thomas E. Dickey 1995-on
dnl
-dnl $Id: aclocal.m4,v 1.553 2011/03/31 23:35:38 tom Exp $
+dnl $Id: aclocal.m4,v 1.686 2014/02/10 00:37:02 tom Exp $
dnl Macros used in NCURSES auto-configuration script.
dnl
dnl These macros are maintained separately from NCURSES. The copyright on
@@ -62,7 +62,33 @@ AC_DEFUN([AM_LANGINFO_CODESET],
fi
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_ADA_INCLUDE_DIRS version: 6 updated: 2010/02/26 19:52:07
+dnl CF_ACVERSION_CHECK version: 4 updated: 2013/03/04 19:52:56
+dnl ------------------
+dnl Conditionally generate script according to whether we're using a given autoconf.
+dnl
+dnl $1 = version to compare against
+dnl $2 = code to use if AC_ACVERSION is at least as high as $1.
+dnl $3 = code to use if AC_ACVERSION is older than $1.
+define([CF_ACVERSION_CHECK],
+[
+ifdef([AC_ACVERSION], ,[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])dnl
+ifdef([m4_version_compare],
+[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])],
+[CF_ACVERSION_COMPARE(
+AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])),
+AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53
+dnl --------------------
+dnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1,
+dnl MAJOR2, MINOR2, TERNARY2,
+dnl PRINTABLE2, not FOUND, FOUND)
+define([CF_ACVERSION_COMPARE],
+[ifelse(builtin([eval], [$2 < $5]), 1,
+[ifelse([$8], , ,[$8])],
+[ifelse([$9], , ,[$9])])])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_ADA_INCLUDE_DIRS version: 8 updated: 2013/10/14 04:24:07
dnl -------------------
dnl Construct the list of include-options for the C programs in the Ada95
dnl binding.
@@ -76,7 +102,7 @@ if test "$GCC" != yes; then
ACPPFLAGS="$ACPPFLAGS -I\${includedir}"
elif test "$includedir" != "/usr/include"; then
if test "$includedir" = '${prefix}/include' ; then
- if test $prefix != /usr ; then
+ if test x$prefix != x/usr ; then
ACPPFLAGS="$ACPPFLAGS -I\${includedir}"
fi
else
@@ -291,7 +317,7 @@ dnl $1 = libraries to add, with the "-l", etc.
dnl $2 = variable to update (default $LIBS)
AC_DEFUN([CF_ADD_LIBS],[ifelse($2,,LIBS,[$2])="$1 [$]ifelse($2,,LIBS,[$2])"])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_ADD_SUBDIR_PATH version: 3 updated: 2010/07/03 20:58:12
+dnl CF_ADD_SUBDIR_PATH version: 4 updated: 2013/10/08 17:47:05
dnl ------------------
dnl Append to a search-list for a nonstandard header/lib-file
dnl $1 = the variable to return as result
@@ -301,9 +327,9 @@ dnl $4 = the directory under which we will test for subdirectories
dnl $5 = a directory that we do not want $4 to match
AC_DEFUN([CF_ADD_SUBDIR_PATH],
[
-test "$4" != "$5" && \
+test "x$4" != "x$5" && \
test -d "$4" && \
-ifelse([$5],NONE,,[(test $5 = NONE || test "$4" != "$5") &&]) {
+ifelse([$5],NONE,,[(test -z "$5" || test x$5 = xNONE || test "x$4" != "x$5") &&]) {
test -n "$verbose" && echo " ... testing for $3-directories under $4"
test -d $4/$3 && $1="[$]$1 $4/$3"
test -d $4/$3/$2 && $1="[$]$1 $4/$3/$2"
@@ -313,76 +339,6 @@ ifelse([$5],NONE,,[(test $5 = NONE || test "$4" != "$5") &&]) {
}
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_ANSI_CC_CHECK version: 10 updated: 2010/10/23 15:52:32
-dnl ----------------
-dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES'
-dnl in the sharutils 4.2 distribution.
-AC_DEFUN([CF_ANSI_CC_CHECK],
-[
-AC_CACHE_CHECK(for ${CC:-cc} option to accept ANSI C, cf_cv_ansi_cc,[
-cf_cv_ansi_cc=no
-cf_save_CFLAGS="$CFLAGS"
-cf_save_CPPFLAGS="$CPPFLAGS"
-# Don't try gcc -ansi; that turns off useful extensions and
-# breaks some systems' header files.
-# AIX -qlanglvl=ansi
-# Ultrix and OSF/1 -std1
-# HP-UX -Aa -D_HPUX_SOURCE
-# SVR4 -Xc
-# UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes)
-for cf_arg in "-DCC_HAS_PROTOS" \
- "" \
- -qlanglvl=ansi \
- -std1 \
- -Ae \
- "-Aa -D_HPUX_SOURCE" \
- -Xc
-do
- CF_ADD_CFLAGS($cf_arg)
- AC_TRY_COMPILE(
-[
-#ifndef CC_HAS_PROTOS
-#if !defined(__STDC__) || (__STDC__ != 1)
-choke me
-#endif
-#endif
-],[
- int test (int i, double x);
- struct s1 {int (*f) (int a);};
- struct s2 {int (*f) (double a);};],
- [cf_cv_ansi_cc="$cf_arg"; break])
-done
-CFLAGS="$cf_save_CFLAGS"
-CPPFLAGS="$cf_save_CPPFLAGS"
-])
-
-if test "$cf_cv_ansi_cc" != "no"; then
-if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
- CF_ADD_CFLAGS($cf_cv_ansi_cc)
-else
- AC_DEFINE(CC_HAS_PROTOS)
-fi
-fi
-])dnl
-dnl ---------------------------------------------------------------------------
-dnl CF_ANSI_CC_REQD version: 4 updated: 2008/03/23 14:48:54
-dnl ---------------
-dnl For programs that must use an ANSI compiler, obtain compiler options that
-dnl will make it recognize prototypes. We'll do preprocessor checks in other
-dnl macros, since tools such as unproto can fake prototypes, but only part of
-dnl the preprocessor.
-AC_DEFUN([CF_ANSI_CC_REQD],
-[AC_REQUIRE([CF_ANSI_CC_CHECK])
-if test "$cf_cv_ansi_cc" = "no"; then
- AC_MSG_ERROR(
-[Your compiler does not appear to recognize prototypes.
-You have the following choices:
- a. adjust your compiler options
- b. get an up-to-date compiler
- c. use a wrapper such as unproto])
-fi
-])dnl
-dnl ---------------------------------------------------------------------------
dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31
dnl --------------
dnl Allow user to disable a normally-on option.
@@ -465,7 +421,7 @@ fi
AC_SUBST(ARFLAGS)
])
dnl ---------------------------------------------------------------------------
-dnl CF_AWK_BIG_PRINTF version: 3 updated: 2008/12/27 12:30:03
+dnl CF_AWK_BIG_PRINTF version: 4 updated: 2011/10/30 17:09:50
dnl -----------------
dnl Check if awk can handle big strings using printf. Some older versions of
dnl awk choke on large strings passed via "%s".
@@ -479,8 +435,8 @@ AC_DEFUN([CF_AWK_BIG_PRINTF],
eval $2=no
;;
*) #(vi
- if ( ${AWK} 'BEGIN { xx = "x"; while (length(xx) < $1) { xx = xx "x"; }; printf("%s\n", xx); }' \
- | $AWK '{ printf "%d\n", length([$]0); }' | $AWK 'BEGIN { eqls=0; recs=0; } { recs++; if ([$]0 == 12000) eqls++; } END { if (recs != 1 || eqls != 1) exit 1; }' 2>/dev/null >/dev/null ) ; then
+ if ( ${AWK} 'BEGIN { xx = "x"; while (length(xx) < $1) { xx = xx "x"; }; printf("%s\n", xx); }' 2>/dev/null \
+ | $AWK '{ printf "%d\n", length([$]0); }' 2>/dev/null | $AWK 'BEGIN { eqls=0; recs=0; } { recs++; if ([$]0 == 12000) eqls++; } END { if (recs != 1 || eqls != 1) exit 1; }' 2>/dev/null >/dev/null ) ; then
eval $2=yes
else
eval $2=no
@@ -536,7 +492,7 @@ else AC_MSG_RESULT(no)
fi
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_BOOL_SIZE version: 12 updated: 2006/12/16 12:33:30
+dnl CF_BOOL_SIZE version: 13 updated: 2013/04/13 18:03:21
dnl ------------
dnl Test for the size of 'bool' in the configured C++ compiler (e.g., a type).
dnl Don't bother looking for bool.h, since it's been deprecated.
@@ -570,7 +526,7 @@ AC_CACHE_VAL(cf_cv_type_of_bool,[
#endif
-main()
+int main()
{
FILE *fp = fopen("cf_test.out", "w");
if (fp != 0) {
@@ -604,7 +560,7 @@ if test "$cf_cv_type_of_bool" = unknown ; then
fi
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_BUILD_CC version: 6 updated: 2006/10/14 15:23:15
+dnl CF_BUILD_CC version: 7 updated: 2012/10/06 15:31:55
dnl -----------
dnl If we're cross-compiling, allow the user to override the tools and their
dnl options. The configure script is oriented toward identifying the host
@@ -614,7 +570,8 @@ dnl
dnl $1 = default for $CPPFLAGS
dnl $2 = default for $LIBS
AC_DEFUN([CF_BUILD_CC],[
-AC_REQUIRE([CF_PROG_EXT])
+CF_ACVERSION_CHECK(2.52,,
+ [AC_REQUIRE([CF_PROG_EXT])])
if test "$cross_compiling" = yes ; then
# defaults that we might want to override
@@ -695,7 +652,33 @@ AC_SUBST(BUILD_EXEEXT)
AC_SUBST(BUILD_OBJEXT)
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_CFG_DEFAULTS version: 7 updated: 2005/09/24 16:15:00
+dnl CF_CC_ENV_FLAGS version: 1 updated: 2012/10/03 05:25:49
+dnl ---------------
+dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content
+dnl into CC. This will not help with broken scripts that wrap the compiler with
+dnl options, but eliminates a more common category of user confusion.
+AC_DEFUN([CF_CC_ENV_FLAGS],
+[
+# This should have been defined by AC_PROG_CC
+: ${CC:=cc}
+
+AC_MSG_CHECKING(\$CC variable)
+case "$CC" in #(vi
+*[[\ \ ]]-[[IUD]]*)
+ AC_MSG_RESULT(broken)
+ AC_MSG_WARN(your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options)
+ # humor him...
+ cf_flags=`echo "$CC" | sed -e 's/^[[^ ]]*[[ ]]//'`
+ CC=`echo "$CC" | sed -e 's/[[ ]].*//'`
+ CF_ADD_CFLAGS($cf_flags)
+ ;;
+*)
+ AC_MSG_RESULT(ok)
+ ;;
+esac
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_CFG_DEFAULTS version: 10 updated: 2013/09/07 13:54:05
dnl ---------------
dnl Determine the default configuration into which we'll install ncurses. This
dnl can be overridden by the user's command-line options. There's two items to
@@ -713,7 +696,7 @@ AC_MSG_CHECKING(for prefix)
if test "x$prefix" = "xNONE" ; then
case "$cf_cv_system_name" in
# non-vendor systems don't have a conflict
- openbsd*|freebsd*|linux*|cygwin*|k*bsd*-gnu)
+ openbsd*|freebsd*|mirbsd*|linux*|cygwin*|msys*|k*bsd*-gnu|mingw*)
prefix=/usr
;;
*) prefix=$ac_default_prefix
@@ -749,30 +732,51 @@ AC_MSG_RESULT($includedir)
fi
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_CGETENT version: 3 updated: 2000/08/12 23:18:52
+dnl CF_CGETENT version: 5 updated: 2012/10/06 17:56:13
dnl ----------
dnl Check if the terminal-capability database functions are available. If not,
dnl ncurses has a much-reduced version.
AC_DEFUN([CF_CGETENT],[
-AC_MSG_CHECKING(for terminal-capability database functions)
-AC_CACHE_VAL(cf_cv_cgetent,[
+AC_CACHE_CHECK(for terminal-capability database functions,cf_cv_cgetent,[
AC_TRY_LINK([
#include ],[
char temp[128];
char *buf = temp;
char *db_array = temp;
- cgetent(&buf, /* int *, */ &db_array, "vt100");
+ cgetent(&buf, &db_array, "vt100");
cgetcap(buf, "tc", '=');
cgetmatch(buf, "tc");
],
[cf_cv_cgetent=yes],
[cf_cv_cgetent=no])
])
-AC_MSG_RESULT($cf_cv_cgetent)
-test "$cf_cv_cgetent" = yes && AC_DEFINE(HAVE_BSD_CGETENT)
+
+if test "$cf_cv_cgetent" = yes
+then
+ AC_DEFINE(HAVE_BSD_CGETENT,1,[Define to 1 if we have BSD cgetent])
+AC_CACHE_CHECK(if cgetent uses const parameter,cf_cv_cgetent_const,[
+AC_TRY_LINK([
+#include ],[
+ char temp[128];
+ char *buf = temp;
+#ifndef _NETBSD_SOURCE /* given, since April 2004 in stdlib.h */
+ const char *db_array = temp;
+ cgetent(&buf, &db_array, "vt100");
+#endif
+ cgetcap(buf, "tc", '=');
+ cgetmatch(buf, "tc");
+ ],
+ [cf_cv_cgetent_const=yes],
+ [cf_cv_cgetent_const=no])
+])
+ if test "$cf_cv_cgetent_const" = yes
+ then
+ AC_DEFINE_UNQUOTED(CGETENT_CONST,const,[Define to const if needed for some BSD cgetent variations])
+ fi
+fi
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_CHECK_CACHE version: 11 updated: 2008/03/23 14:45:59
+dnl CF_CHECK_CACHE version: 12 updated: 2012/10/02 20:55:03
dnl --------------
dnl Check if we're accidentally using a cache from a different machine.
dnl Derive the system name, as a check for reusing the autoconf cache.
@@ -795,7 +799,7 @@ else
system_name="`(hostname) 2>/dev/null`"
fi
fi
-test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name")
+test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[Define to the system name.])
AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
test -z "$system_name" && system_name="$cf_cv_system_name"
@@ -908,7 +912,82 @@ if test "$cf_cv_check_gpm_wgetch" != yes ; then
fi
])])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_CPP_PARAM_INIT version: 4 updated: 2001/04/07 22:31:18
+dnl CF_CHECK_LIBTOOL_VERSION version: 1 updated: 2013/04/06 18:03:09
+dnl ------------------------
+dnl Show the version of libtool
+dnl
+dnl Save the version in a cache variable - this is not entirely a good thing,
+dnl but the version string from libtool is very ugly, and for bug reports it
+dnl might be useful to have the original string.
+AC_DEFUN([CF_CHECK_LIBTOOL_VERSION],[
+if test -n "$LIBTOOL" && test "$LIBTOOL" != none
+then
+ AC_MSG_CHECKING(version of $LIBTOOL)
+ CF_LIBTOOL_VERSION
+ AC_MSG_RESULT($cf_cv_libtool_version)
+ if test -z "$cf_cv_libtool_version" ; then
+ AC_MSG_ERROR(This is not GNU libtool)
+ fi
+else
+ AC_MSG_ERROR(GNU libtool has not been found)
+fi
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_CHECK_WCHAR_H version: 1 updated: 2011/10/29 15:01:05
+dnl ----------------
+dnl Check if wchar.h can be used, i.e., without defining _XOPEN_SOURCE_EXTENDED
+AC_DEFUN([CF_CHECK_WCHAR_H],[
+AC_CACHE_CHECK(if wchar.h can be used as is,cf_cv_wchar_h_okay,[
+AC_TRY_COMPILE(
+[
+#include
+#include
+],[
+ wint_t foo = 0;
+ int bar = iswpunct(foo)],
+ [cf_cv_wchar_h_okay=yes],
+ [cf_cv_wchar_h_okay=no])])
+
+if test $cf_cv_wchar_h_okay = no
+then
+ CF_PREDEFINE(_XOPEN_SOURCE_EXTENDED)
+fi
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_CLANG_COMPILER version: 2 updated: 2013/11/19 19:23:35
+dnl -----------------
+dnl Check if the given compiler is really clang. clang's C driver defines
+dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does
+dnl not ignore some gcc options.
+dnl
+dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
+dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
+dnl the wrappers for gcc and g++ warnings.
+dnl
+dnl $1 = GCC (default) or GXX
+dnl $2 = CLANG_COMPILER (default)
+dnl $3 = CFLAGS (default) or CXXFLAGS
+AC_DEFUN([CF_CLANG_COMPILER],[
+ifelse([$2],,CLANG_COMPILER,[$2])=no
+
+if test "$ifelse([$1],,[$1],GCC)" = yes ; then
+ AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler)
+ cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
+ ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -Qunused-arguments"
+ AC_TRY_COMPILE([],[
+#ifdef __clang__
+#else
+make an error
+#endif
+],[ifelse([$2],,CLANG_COMPILER,[$2])=yes
+cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments"
+],[])
+ ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
+ AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2]))
+fi
+])
+dnl ---------------------------------------------------------------------------
+dnl CF_CPP_PARAM_INIT version: 6 updated: 2012/10/06 17:56:13
dnl -----------------
dnl Check if the C++ compiler accepts duplicate parameter initialization. This
dnl is a late feature for the standard and is not in some recent compilers
@@ -932,7 +1011,7 @@ TEST::TEST(int x = 1) // some compilers do not like second initializer
{
value = x;
}
-void main() { }
+int main() { }
],
[cf_cv_cpp_param_init=yes],
[cf_cv_cpp_param_init=no],
@@ -940,10 +1019,10 @@ void main() { }
AC_LANG_RESTORE
])
fi
-test "$cf_cv_cpp_param_init" = yes && AC_DEFINE(CPP_HAS_PARAM_INIT)
+test "$cf_cv_cpp_param_init" = yes && AC_DEFINE(CPP_HAS_PARAM_INIT,1,[Define to 1 if C++ has parameter initialization])
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_CPP_STATIC_CAST version: 1 updated: 2005/07/23 16:52:43
+dnl CF_CPP_STATIC_CAST version: 3 updated: 2013/04/13 18:03:21
dnl ------------------
dnl Check if the C++ compiler accepts static_cast in generics. This appears to
dnl not be supported in g++ before 3.0
@@ -965,7 +1044,7 @@ public:
int begin_x = 0)
{
}
-
+ NCursesPanel();
~NCursesPanel();
};
@@ -996,10 +1075,58 @@ public:
fi
-test "$cf_cv_cpp_static_cast" = yes && AC_DEFINE(CPP_HAS_STATIC_CAST)
+test "$cf_cv_cpp_static_cast" = yes && AC_DEFINE(CPP_HAS_STATIC_CAST,1,[Define to 1 if C++ has static_cast])
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_C_INLINE version: 3 updated: 2010/05/01 15:14:41
+dnl CF_CXX_AR_FLAGS version: 1 updated: 2011/10/29 08:35:34
+dnl ---------------
+dnl Setup special archiver flags for given compilers.
+AC_DEFUN([CF_CXX_AR_FLAGS],[
+ CXX_AR='$(AR)'
+ CXX_ARFLAGS='$(ARFLAGS)'
+ case $cf_cv_system_name in #(vi
+ irix*) #(vi
+ if test "$GXX" != yes ; then
+ CXX_AR='$(CXX)'
+ CXX_ARFLAGS='-ar -o'
+ fi
+ ;;
+ sco3.2v5*) #(vi
+ CXXLDFLAGS="-u main"
+ ;;
+ solaris2*)
+ if test "$GXX" != yes ; then
+ CXX_AR='$(CXX)'
+ CXX_ARFLAGS='-xar -o'
+ fi
+ ;;
+ esac
+ AC_SUBST(CXXLDFLAGS)
+ AC_SUBST(CXX_AR)
+ AC_SUBST(CXX_ARFLAGS)
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_CXX_IOSTREAM_NAMESPACE version: 2 updated: 2012/10/06 17:56:13
+dnl -------------------------
+dnl For c++, check if iostream uses "std::" namespace.
+AC_DEFUN([CF_CXX_IOSTREAM_NAMESPACE],[
+AC_CHECK_HEADERS(iostream)
+if test x"$ac_cv_header_iostream" = xyes ; then
+ AC_MSG_CHECKING(if iostream uses std-namespace)
+ AC_TRY_COMPILE([
+#include
+using std::endl;
+using std::cerr;],[
+cerr << "testing" << endl;
+],[cf_iostream_namespace=yes],[cf_iostream_namespace=no])
+ AC_MSG_RESULT($cf_iostream_namespace)
+ if test "$cf_iostream_namespace" = yes ; then
+ AC_DEFINE(IOSTREAM_NAMESPACE,1,[Define to 1 if C++ has namespace iostream])
+ fi
+fi
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_C_INLINE version: 4 updated: 2012/06/16 14:55:39
dnl -----------
dnl Check if the C compiler supports "inline".
dnl $1 is the name of a shell variable to set if inline is supported
@@ -1010,6 +1137,9 @@ $1=
if test "$ac_cv_c_inline" != no ; then
$1=inline
if test "$INTEL_COMPILER" = yes
+ then
+ :
+ elif test "$CLANG_COMPILER" = yes
then
:
elif test "$GCC" = yes
@@ -1057,7 +1187,44 @@ done
AC_SUBST(DIRS_TO_MAKE)
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_DISABLE_LEAKS version: 6 updated: 2010/07/23 04:14:32
+dnl CF_DISABLE_ECHO version: 12 updated: 2012/10/06 16:30:28
+dnl ---------------
+dnl You can always use "make -n" to see the actual options, but it's hard to
+dnl pick out/analyze warning messages when the compile-line is long.
+dnl
+dnl Sets:
+dnl ECHO_LT - symbol to control if libtool is verbose
+dnl ECHO_LD - symbol to prefix "cc -o" lines
+dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o)
+dnl SHOW_CC - symbol to put before explicit "cc -c" lines
+dnl ECHO_CC - symbol to put before any "cc" line
+dnl
+AC_DEFUN([CF_DISABLE_ECHO],[
+AC_MSG_CHECKING(if you want to see long compiling messages)
+CF_ARG_DISABLE(echo,
+ [ --disable-echo do not display "compiling" commands],
+ [
+ ECHO_LT='--silent'
+ ECHO_LD='@echo linking [$]@;'
+ RULE_CC='@echo compiling [$]<'
+ SHOW_CC='@echo compiling [$]@'
+ ECHO_CC='@'
+],[
+ ECHO_LT=''
+ ECHO_LD=''
+ RULE_CC=''
+ SHOW_CC=''
+ ECHO_CC=''
+])
+AC_MSG_RESULT($enableval)
+AC_SUBST(ECHO_LT)
+AC_SUBST(ECHO_LD)
+AC_SUBST(RULE_CC)
+AC_SUBST(SHOW_CC)
+AC_SUBST(ECHO_CC)
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_DISABLE_LEAKS version: 7 updated: 2012/10/02 20:55:03
dnl ----------------
dnl Combine no-leak checks with the libraries or tools that are used for the
dnl checks.
@@ -1075,8 +1242,8 @@ AC_ARG_ENABLE(leaks,
AC_MSG_RESULT($with_no_leaks)
if test "$with_no_leaks" = yes ; then
- AC_DEFINE(NO_LEAKS)
- AC_DEFINE(YY_NO_LEAKS)
+ AC_DEFINE(NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.])
+ AC_DEFINE(YY_NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.])
fi
])dnl
dnl ---------------------------------------------------------------------------
@@ -1123,6 +1290,30 @@ if test "$cf_disable_rpath_hack" = no ; then
fi
])
dnl ---------------------------------------------------------------------------
+dnl CF_ENABLE_PC_FILES version: 9 updated: 2012/08/04 13:59:54
+dnl ------------------
+dnl This is the "--enable-pc-files" option, which is available if there is a
+dnl pkg-config configuration on the local machine.
+AC_DEFUN([CF_ENABLE_PC_FILES],[
+AC_REQUIRE([CF_PKG_CONFIG])
+AC_REQUIRE([CF_WITH_PKG_CONFIG_LIBDIR])
+
+if test "$PKG_CONFIG" != none ; then
+ AC_MSG_CHECKING(if we should install .pc files for $PKG_CONFIG)
+ AC_ARG_ENABLE(pc-files,
+ [ --enable-pc-files generate and install .pc files for pkg-config],
+ [enable_pc_files=$enableval],
+ [enable_pc_files=no])
+ AC_MSG_RESULT($enable_pc_files)
+ if test "$enable_pc_files" != no
+ then
+ CF_PATH_SYNTAX(PKG_CONFIG_LIBDIR)
+ fi
+else
+ enable_pc_files=no
+fi
+])dnl
+dnl ---------------------------------------------------------------------------
dnl CF_ENABLE_RPATH version: 2 updated: 2010/03/27 18:39:42
dnl ---------------
dnl Check if the rpath option should be used, setting cache variable
@@ -1137,6 +1328,37 @@ AC_ARG_ENABLE(rpath,
AC_MSG_RESULT($cf_cv_enable_rpath)
])dnl
dnl ---------------------------------------------------------------------------
+dnl CF_ENABLE_STRING_HACKS version: 3 updated: 2013/01/26 16:26:12
+dnl ----------------------
+dnl On a few platforms, the compiler and/or loader nags with untruthful
+dnl comments stating that "most" uses of strcat/strcpy/sprintf are incorrect,
+dnl and implying that most uses of the recommended alternatives are correct.
+dnl
+dnl Factually speaking, no one has actually counted the number of uses of these
+dnl functions versus the total of incorrect uses. Samples of a few thousand
+dnl instances are meaningless compared to the hundreds of millions of lines of
+dnl existing C code.
+dnl
+dnl strlcat/strlcpy are (as of 2012) non-standard, and are available on some
+dnl platforms, in implementations of varying quality. Likewise, snprintf is
+dnl standard - but evolved through phases, and older implementations are likely
+dnl to yield surprising results, as documented in manpages on various systems.
+AC_DEFUN([CF_ENABLE_STRING_HACKS],
+[
+AC_MSG_CHECKING(if you want to work around bogus compiler/loader warnings)
+AC_ARG_ENABLE(string-hacks,
+ [ --enable-string-hacks work around bogus compiler/loader warnings],
+ [with_string_hacks=$enableval],
+ [with_string_hacks=no])
+AC_MSG_RESULT($with_string_hacks)
+
+if test "x$with_string_hacks" = "xyes"; then
+ AC_DEFINE(USE_STRING_HACKS,1,[Define to 1 to work around bogus compiler/loader warnings])
+ AC_MSG_WARN(enabling string-hacks to work around bogus compiler/loader warnings)
+ AC_CHECK_FUNCS( strlcat strlcpy snprintf )
+fi
+])dnl
+dnl ---------------------------------------------------------------------------
dnl CF_ERRNO version: 5 updated: 1997/11/30 12:44:39
dnl --------
dnl Check if 'errno' is declared in
@@ -1145,7 +1367,7 @@ AC_DEFUN([CF_ERRNO],
CF_CHECK_ERRNO(errno)
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_ETIP_DEFINES version: 3 updated: 2003/03/22 19:13:43
+dnl CF_ETIP_DEFINES version: 5 updated: 2012/02/18 17:51:07
dnl ---------------
dnl Test for conflicting definitions of exception in gcc 2.8.0, etc., between
dnl math.h and builtin.h, only for ncurses
@@ -1154,11 +1376,17 @@ AC_DEFUN([CF_ETIP_DEFINES],
AC_MSG_CHECKING(for special defines needed for etip.h)
cf_save_CXXFLAGS="$CXXFLAGS"
cf_result="none"
+
+# etip.h includes ncurses.h which includes ncurses_dll.h
+# But ncurses_dll.h is generated - fix here.
+test -d include || mkdir include
+test -f include/ncurses_dll.h || sed -e 's/@NCURSES_WRAP_PREFIX@/'$NCURSES_WRAP_PREFIX'/g' ${srcdir}/include/ncurses_dll.h.in >include/ncurses_dll.h
+
for cf_math in "" MATH_H
do
for cf_excp in "" MATH_EXCEPTION
do
- CXXFLAGS="$cf_save_CXXFLAGS -I${srcdir}/c++ -I${srcdir}/menu -I${srcdir}/include"
+ CXXFLAGS="$cf_save_CXXFLAGS -I${srcdir}/c++ -I${srcdir}/menu -Iinclude -I${srcdir}/include"
test -n "$cf_math" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_math}"
test -n "$cf_excp" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_excp}"
AC_TRY_COMPILE([
@@ -1167,7 +1395,7 @@ AC_TRY_COMPILE([
test -n "$cf_math" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_math})
test -n "$cf_excp" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_excp})
cf_result="$cf_math $cf_excp"
- break
+ break 2
],[])
done
done
@@ -1305,7 +1533,35 @@ ifelse([$5],,AC_MSG_WARN(Cannot find $3 library),[$5])
fi
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_FUNC_DLSYM version: 2 updated: 2010/05/29 16:31:02
+dnl CF_FIXUP_ADAFLAGS version: 1 updated: 2012/03/31 18:48:10
+dnl -----------------
+dnl make ADAFLAGS consistent with CFLAGS
+AC_DEFUN([CF_FIXUP_ADAFLAGS],[
+ AC_MSG_CHECKING(optimization options for ADAFLAGS)
+ case "$CFLAGS" in
+ *-g*)
+ CF_ADD_ADAFLAGS(-g)
+ ;;
+ esac
+ case "$CFLAGS" in
+ *-O*)
+ cf_O_flag=`echo "$CFLAGS" |sed -e 's/^.*-O/-O/' -e 's/[[ ]].*//'`
+ CF_ADD_ADAFLAGS($cf_O_flag)
+ ;;
+ esac
+ AC_MSG_RESULT($ADAFLAGS)
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_FORGET_TOOL version: 1 updated: 2013/04/06 18:03:09
+dnl --------------
+dnl Forget that we saw the given tool.
+AC_DEFUN([CF_FORGET_TOOL],[
+unset ac_cv_prog_ac_ct_$1
+unset ac_ct_$1
+unset $1
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_FUNC_DLSYM version: 3 updated: 2012/10/06 11:17:15
dnl -------------
dnl Test for dlsym() and related functions, as well as libdl.
dnl
@@ -1332,7 +1588,7 @@ if test "$cf_have_dlsym" = yes ; then
dlclose(obj);
}
}],[
- AC_DEFINE(HAVE_LIBDL)],[
+ AC_DEFINE(HAVE_LIBDL,1,[Define to 1 if we have dl library])],[
AC_MSG_ERROR(Cannot link test program for libdl)])
AC_MSG_RESULT(ok)
else
@@ -1340,7 +1596,7 @@ else
fi
])
dnl ---------------------------------------------------------------------------
-dnl CF_FUNC_MEMMOVE version: 7 updated: 2006/12/16 12:33:30
+dnl CF_FUNC_MEMMOVE version: 8 updated: 2012/10/04 20:12:20
dnl ---------------
dnl Check for memmove, or a bcopy that can handle overlapping copy. If neither
dnl is found, add our own version of memmove to the list of objects.
@@ -1365,13 +1621,13 @@ int main() {
])
],[cf_cv_good_bcopy=no])
if test "$cf_cv_good_bcopy" = yes ; then
- AC_DEFINE(USE_OK_BCOPY)
+ AC_DEFINE(USE_OK_BCOPY,1,[Define to 1 to use bcopy when memmove is unavailable])
else
- AC_DEFINE(USE_MY_MEMMOVE)
+ AC_DEFINE(USE_MY_MEMMOVE,1,[Define to 1 to use replacement function when memmove is unavailable])
fi
])])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_FUNC_NANOSLEEP version: 3 updated: 2006/12/16 12:33:30
+dnl CF_FUNC_NANOSLEEP version: 4 updated: 2012/10/06 17:56:13
dnl -----------------
dnl Check for existence of workable nanosleep() function. Some systems, e.g.,
dnl AIX 4.x, provide a non-working version.
@@ -1402,7 +1658,7 @@ int main() {
[cf_cv_func_nanosleep=no],
[cf_cv_func_nanosleep=unknown])])
-test "$cf_cv_func_nanosleep" = "yes" && AC_DEFINE(HAVE_NANOSLEEP)
+test "$cf_cv_func_nanosleep" = "yes" && AC_DEFINE(HAVE_NANOSLEEP,1,[Define to 1 if we have nanosleep()])
])
dnl ---------------------------------------------------------------------------
dnl CF_FUNC_OPENPTY version: 3 updated: 2010/05/29 16:31:02
@@ -1433,14 +1689,17 @@ AC_CACHE_CHECK(for openpty header,cf_cv_func_openpty,[
])
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_FUNC_POLL version: 4 updated: 2006/12/16 12:33:30
+dnl CF_FUNC_POLL version: 8 updated: 2012/10/04 05:24:07
dnl ------------
dnl See if the poll function really works. Some platforms have poll(), but
dnl it does not work for terminals or files.
AC_DEFUN([CF_FUNC_POLL],[
AC_CACHE_CHECK(if poll really works,cf_cv_working_poll,[
AC_TRY_RUN([
+#include
#include
+#include
+#include
#ifdef HAVE_POLL_H
#include
#else
@@ -1450,19 +1709,42 @@ int main() {
struct pollfd myfds;
int ret;
- myfds.fd = 0;
+ /* check for Darwin bug with respect to "devices" */
+ myfds.fd = open("/dev/null", 1); /* O_WRONLY */
+ if (myfds.fd < 0)
+ myfds.fd = 0;
myfds.events = POLLIN;
+ myfds.revents = 0;
ret = poll(&myfds, 1, 100);
- ${cf_cv_main_return:-return}(ret != 0);
+
+ if (ret < 0 || (myfds.revents & POLLNVAL)) {
+ ret = -1;
+ } else {
+ int fd = 0;
+ if (!isatty(fd)) {
+ fd = open("/dev/tty", 2); /* O_RDWR */
+ }
+
+ if (fd >= 0) {
+ /* also check with standard input */
+ myfds.fd = fd;
+ myfds.events = POLLIN;
+ myfds.revents = 0;
+ ret = poll(&myfds, 1, 100);
+ } else {
+ ret = -1;
+ }
+ }
+ ${cf_cv_main_return:-return}(ret < 0);
}],
[cf_cv_working_poll=yes],
[cf_cv_working_poll=no],
[cf_cv_working_poll=unknown])])
-test "$cf_cv_working_poll" = "yes" && AC_DEFINE(HAVE_WORKING_POLL)
+test "$cf_cv_working_poll" = "yes" && AC_DEFINE(HAVE_WORKING_POLL,1,[Define to 1 if the poll function seems to work])
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_FUNC_TERMIOS version: 2 updated: 2000/07/22 23:37:24
+dnl CF_FUNC_TERMIOS version: 3 updated: 2012/10/06 17:56:13
dnl ---------------
dnl Some old/broken variations define tcgetattr() only as a macro in
dnl termio(s).h
@@ -1488,10 +1770,10 @@ TTY foo;
tcgetattr(1, &foo);],
[cf_cv_have_tcgetattr=yes],
[cf_cv_have_tcgetattr=no])])
-test "$cf_cv_have_tcgetattr" = yes && AC_DEFINE(HAVE_TCGETATTR)
+test "$cf_cv_have_tcgetattr" = yes && AC_DEFINE(HAVE_TCGETATTR,1,[Define to 1 if we have tcgetattr])
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_FUNC_VSSCANF version: 3 updated: 2001/12/19 00:50:10
+dnl CF_FUNC_VSSCANF version: 4 updated: 2012/10/06 17:56:13
dnl ---------------
dnl Check for vsscanf() function, which is in c9x but generally not in earlier
dnl versions of C. It is in the GNU C library, and can often be simulated by
@@ -1529,14 +1811,14 @@ AC_TRY_LINK([
cf_cv_func_vsscanf=no])])])])
case $cf_cv_func_vsscanf in #(vi
-vsscanf) AC_DEFINE(HAVE_VSSCANF);; #(vi
-vfscanf) AC_DEFINE(HAVE_VFSCANF);; #(vi
-_doscan) AC_DEFINE(HAVE__DOSCAN);;
+vsscanf) AC_DEFINE(HAVE_VSSCANF,1,[Define to 1 if we have vsscanf]);; #(vi
+vfscanf) AC_DEFINE(HAVE_VFSCANF,1,[Define to 1 if we have vfscanf]);; #(vi
+_doscan) AC_DEFINE(HAVE__DOSCAN,1,[Define to 1 if we have _doscan]);;
esac
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_GCC_ATTRIBUTES version: 14 updated: 2010/10/23 15:52:32
+dnl CF_GCC_ATTRIBUTES version: 16 updated: 2012/10/02 20:55:03
dnl -----------------
dnl Test for availability of useful gcc __attribute__ directives to quiet
dnl compiler warnings. Though useful, not all are supported -- and contrary
@@ -1614,27 +1896,27 @@ EOF
test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
cat conftest.h >>confdefs.h
case $cf_attribute in #(vi
+ noreturn) #(vi
+ AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc])
+ ;;
printf) #(vi
- if test "$cf_printf_attribute" = no ; then
- cat >>confdefs.h <>confdefs.h <>confdefs.h <>confdefs.h < conftest.$ac_ext <],
+[int x = optind; char *y = optarg],
+[cf_cv_getopt_header=$cf_header
+ break])
+done
+])
+if test $cf_cv_getopt_header != none ; then
+ AC_DEFINE(HAVE_GETOPT_HEADER,1,[Define to 1 if we need to include getopt.h])
+fi
+])dnl
+dnl ---------------------------------------------------------------------------
dnl CF_GNAT_GENERICS version: 2 updated: 2011/03/23 20:24:41
dnl ----------------
AC_DEFUN([CF_GNAT_GENERICS],
@@ -1828,7 +2145,7 @@ fi
AC_SUBST(PRAGMA_UNREF)
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_GNAT_PROJECTS version: 2 updated: 2011/03/23 20:24:41
+dnl CF_GNAT_PROJECTS version: 4 updated: 2013/09/07 14:05:46
dnl ----------------
dnl GNAT projects are configured with ".gpr" project files.
dnl GNAT libraries are a further development, using the project feature.
@@ -1845,7 +2162,7 @@ case $cf_gnat_version in #(vi
;;
*)
case $cf_cv_system_name in #(vi
- cygwin*) #(vi
+ cygwin*|msys*) #(vi
;;
*)
mkdir conftest.src conftest.bin conftest.lib
@@ -2040,7 +2357,7 @@ fi
rm -rf conftest* *~conftest*
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_GNAT_VERSION version: 17 updated: 2011/03/23 20:24:41
+dnl CF_GNAT_VERSION version: 18 updated: 2012/01/21 19:28:10
dnl ---------------
dnl Verify version of GNAT.
AC_DEFUN([CF_GNAT_VERSION],
@@ -2052,7 +2369,7 @@ cf_gnat_version=`${cf_ada_make:-gnatmake} -v 2>&1 | \
AC_MSG_RESULT($cf_gnat_version)
case $cf_gnat_version in #(vi
-3.1[[1-9]]*|3.[[2-9]]*|[[4-9]].*) #(vi
+3.1[[1-9]]*|3.[[2-9]]*|[[4-9]].*|20[[0-9]][[0-9]]) #(vi
cf_cv_prog_gnat_correct=yes
;;
*)
@@ -2092,7 +2409,7 @@ make an error
test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_GPP_LIBRARY version: 10 updated: 2010/05/29 16:31:02
+dnl CF_GPP_LIBRARY version: 11 updated: 2012/10/06 17:56:13
dnl --------------
dnl If we're trying to use g++, test if libg++ is installed (a rather common
dnl problem :-). If we have the compiler but no library, we'll be able to
@@ -2119,9 +2436,9 @@ if test "$GXX" = yes; then
[cf_cxx_library=yes
CF_ADD_LIB($cf_gpp_libname,CXXLIBS)
if test "$cf_gpp_libname" = cpp ; then
- AC_DEFINE(HAVE_GPP_BUILTIN_H)
+ AC_DEFINE(HAVE_GPP_BUILTIN_H,1,[Define to 1 if we have gpp builtin.h])
else
- AC_DEFINE(HAVE_GXX_BUILTIN_H)
+ AC_DEFINE(HAVE_GXX_BUILTIN_H,1,[Define to 1 if we have g++ builtin.h])
fi],
[AC_TRY_LINK([
#include
@@ -2129,28 +2446,28 @@ if test "$GXX" = yes; then
[two_arg_error_handler_t foo2 = lib_error_handler],
[cf_cxx_library=yes
CF_ADD_LIB($cf_gpp_libname,CXXLIBS)
- AC_DEFINE(HAVE_BUILTIN_H)],
+ AC_DEFINE(HAVE_BUILTIN_H,1,[Define to 1 if we have builtin.h])],
[cf_cxx_library=no])])
LIBS="$cf_save"
AC_MSG_RESULT($cf_cxx_library)
fi
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_GXX_VERSION version: 6 updated: 2010/10/23 15:44:18
+dnl CF_GXX_VERSION version: 7 updated: 2012/06/16 14:55:39
dnl --------------
dnl Check for version of g++
AC_DEFUN([CF_GXX_VERSION],[
AC_REQUIRE([AC_PROG_CPP])
GXX_VERSION=none
if test "$GXX" = yes; then
- AC_MSG_CHECKING(version of g++)
+ AC_MSG_CHECKING(version of ${CXX:-g++})
GXX_VERSION="`${CXX:-g++} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
test -z "$GXX_VERSION" && GXX_VERSION=unknown
AC_MSG_RESULT($GXX_VERSION)
fi
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_GXX_WARNINGS version: 6 updated: 2010/08/14 18:25:37
+dnl CF_GXX_WARNINGS version: 8 updated: 2013/11/16 14:27:53
dnl ---------------
dnl Check if the compiler supports useful warning options.
dnl
@@ -2173,6 +2490,7 @@ AC_DEFUN([CF_GXX_WARNINGS],
[
CF_INTEL_COMPILER(GXX,INTEL_CPLUSPLUS,CXXFLAGS)
+CF_CLANG_COMPILER(GXX,CLANG_CPLUSPLUS,CXXFLAGS)
AC_REQUIRE([CF_GXX_VERSION])
@@ -2238,16 +2556,17 @@ then
for cf_opt in \
Wabi \
fabi-version=0 \
+ Wextra \
+ Wignored-qualifiers \
+ Wlogical-op \
Woverloaded-virtual \
Wsign-promo \
Wsynth \
Wold-style-cast \
Wcast-align \
Wcast-qual \
- Wmissing-prototypes \
Wpointer-arith \
Wshadow \
- Wstrict-prototypes \
Wundef $cf_gxx_extra_warnings $1
do
CXXFLAGS="$cf_save_CXXFLAGS $EXTRA_CXXFLAGS -Werror -$cf_opt"
@@ -2464,7 +2783,7 @@ AC_DEFUN([CF_HELP_MESSAGE],
[AC_DIVERT_HELP([$1])dnl
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_INCLUDE_DIRS version: 6 updated: 2009/01/06 19:37:40
+dnl CF_INCLUDE_DIRS version: 8 updated: 2013/10/12 16:45:09
dnl ---------------
dnl Construct the list of include-options according to whether we're building
dnl in the source directory or using '--srcdir=DIR' option. If we're building
@@ -2472,25 +2791,25 @@ dnl with gcc, don't append the includedir if it happens to be /usr/include,
dnl since that usually breaks gcc's shadow-includes.
AC_DEFUN([CF_INCLUDE_DIRS],
[
-CPPFLAGS="$CPPFLAGS -I. -I../include"
-if test "$srcdir" != "."; then
- CPPFLAGS="$CPPFLAGS -I\${srcdir}/../include"
-fi
if test "$GCC" != yes; then
- CPPFLAGS="$CPPFLAGS -I\${includedir}"
+ CPPFLAGS="-I\${includedir} $CPPFLAGS"
elif test "$includedir" != "/usr/include"; then
if test "$includedir" = '${prefix}/include' ; then
- if test $prefix != /usr ; then
- CPPFLAGS="$CPPFLAGS -I\${includedir}"
+ if test x$prefix != x/usr ; then
+ CPPFLAGS="-I\${includedir} $CPPFLAGS"
fi
else
- CPPFLAGS="$CPPFLAGS -I\${includedir}"
+ CPPFLAGS="-I\${includedir} $CPPFLAGS"
fi
fi
+if test "$srcdir" != "."; then
+ CPPFLAGS="-I\${srcdir}/../include $CPPFLAGS"
+fi
+CPPFLAGS="-I. -I../include $CPPFLAGS"
AC_SUBST(CPPFLAGS)
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_INTEL_COMPILER version: 4 updated: 2010/05/26 05:38:42
+dnl CF_INTEL_COMPILER version: 5 updated: 2013/02/10 10:41:05
dnl -----------------
dnl Check if the given compiler is really the Intel compiler for Linux. It
dnl tries to imitate gcc, but does not return an error when it finds a mismatch
@@ -2504,6 +2823,7 @@ dnl $1 = GCC (default) or GXX
dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
dnl $3 = CFLAGS (default) or CXXFLAGS
AC_DEFUN([CF_INTEL_COMPILER],[
+AC_REQUIRE([AC_CANONICAL_HOST])
ifelse([$2],,INTEL_COMPILER,[$2])=no
if test "$ifelse([$1],,[$1],GCC)" = yes ; then
@@ -2527,7 +2847,7 @@ cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
fi
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_ISASCII version: 3 updated: 2000/08/12 23:18:52
+dnl CF_ISASCII version: 4 updated: 2012/10/06 17:56:13
dnl ----------
dnl Check if we have either a function or macro for 'isascii()'.
AC_DEFUN([CF_ISASCII],
@@ -2539,10 +2859,10 @@ AC_CACHE_VAL(cf_cv_have_isascii,[
[cf_cv_have_isascii=no])
])dnl
AC_MSG_RESULT($cf_cv_have_isascii)
-test "$cf_cv_have_isascii" = yes && AC_DEFINE(HAVE_ISASCII)
+test "$cf_cv_have_isascii" = yes && AC_DEFINE(HAVE_ISASCII,1,[Define to 1 if we have isascii()])
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_LARGEFILE version: 7 updated: 2007/06/02 11:58:50
+dnl CF_LARGEFILE version: 8 updated: 2012/10/06 08:57:51
dnl ------------
dnl Add checks for large file support.
AC_DEFUN([CF_LARGEFILE],[
@@ -2576,12 +2896,12 @@ ifdef([AC_FUNC_FSEEKO],[
[cf_cv_struct_dirent64=yes],
[cf_cv_struct_dirent64=no])
])
- test "$cf_cv_struct_dirent64" = yes && AC_DEFINE(HAVE_STRUCT_DIRENT64)
+ test "$cf_cv_struct_dirent64" = yes && AC_DEFINE(HAVE_STRUCT_DIRENT64,1,[Define to 1 if we have struct dirent64])
fi
])
])
dnl ---------------------------------------------------------------------------
-dnl CF_LDFLAGS_STATIC version: 8 updated: 2010/10/23 14:39:56
+dnl CF_LDFLAGS_STATIC version: 10 updated: 2011/09/24 12:51:48
dnl -----------------
dnl Check for compiler/linker flags used to temporarily force usage of static
dnl libraries. This depends on the compiler and platform. Use this to help
@@ -2602,7 +2922,7 @@ if test "$GCC" = yes ; then
esac
else
case $cf_cv_system_name in #(
- aix[[456]]*) #( from ld manpage
+ aix[[4-7]]*) #( from ld manpage
LDFLAGS_STATIC=-bstatic
LDFLAGS_SHARED=-bdynamic
;;
@@ -2652,7 +2972,17 @@ EOF
int cf_ldflags_static(FILE *fp);
],[
return cf_ldflags_static(stdin);
-],[cf_ldflags_static=yes],[cf_ldflags_static=no])
+],[
+ # some linkers simply ignore the -dynamic
+ case x`file conftest$ac_exeext 2>/dev/null` in #(vi
+ *static*) # (vi
+ cf_ldflags_static=no
+ ;;
+ *)
+ cf_ldflags_static=yes
+ ;;
+ esac
+],[cf_ldflags_static=no])
rm -f libconftest.*
LIBS="$cf_save_LIBS"
@@ -2673,7 +3003,7 @@ AC_SUBST(LDFLAGS_STATIC)
AC_SUBST(LDFLAGS_SHARED)
])
dnl ---------------------------------------------------------------------------
-dnl CF_LD_RPATH_OPT version: 3 updated: 2010/06/02 05:03:05
+dnl CF_LD_RPATH_OPT version: 5 updated: 2011/07/17 14:48:41
dnl ---------------
dnl For the given system and compiler, find the compiler flags to pass to the
dnl loader to use the "rpath" feature.
@@ -2694,10 +3024,10 @@ irix*) #(vi
linux*|gnu*|k*bsd*-gnu) #(vi
LD_RPATH_OPT="-Wl,-rpath,"
;;
-openbsd[[2-9]].*) #(vi
+openbsd[[2-9]].*|mirbsd*) #(vi
LD_RPATH_OPT="-Wl,-rpath,"
;;
-freebsd*) #(vi
+dragonfly*|freebsd*) #(vi
LD_RPATH_OPT="-rpath "
;;
netbsd*) #(vi
@@ -2756,11 +3086,23 @@ CF_SUBDIR_PATH($1,$2,lib)
$1="$cf_library_path_list [$]$1"
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_LIB_PREFIX version: 8 updated: 2008/09/13 11:34:16
+dnl CF_LIBTOOL_VERSION version: 1 updated: 2013/04/06 18:03:09
+dnl ------------------
+AC_DEFUN([CF_LIBTOOL_VERSION],[
+if test -n "$LIBTOOL" && test "$LIBTOOL" != none
+then
+ cf_cv_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '/^$/d' |sed -e '2,$d' -e 's/([[^)]]*)//g' -e 's/^[[^1-9]]*//' -e 's/[[^0-9.]].*//'`
+else
+ cf_cv_libtool_version=
+fi
+test -z "$cf_cv_libtool_version" && unset cf_cv_libtool_version
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_LIB_PREFIX version: 9 updated: 2012/01/21 19:28:10
dnl -------------
dnl Compute the library-prefix for the given host system
dnl $1 = variable to set
-AC_DEFUN([CF_LIB_PREFIX],
+define([CF_LIB_PREFIX],
[
case $cf_cv_system_name in #(vi
OS/2*|os2*) #(vi
@@ -2773,11 +3115,11 @@ ifelse($1,,,[$1=$LIB_PREFIX])
AC_SUBST(LIB_PREFIX)
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_LIB_RULES version: 61 updated: 2010/10/23 16:10:30
+dnl CF_LIB_RULES version: 74 updated: 2013/09/07 13:54:05
dnl ------------
dnl Append definitions and rules for the given models to the subdirectory
dnl Makefiles, and the recursion rule for the top-level Makefile. If the
-dnl subdirectory is a library-source directory, modify the LIBS_TO_MAKE list in
+dnl subdirectory is a library-source directory, modify the Libs_To_Make list in
dnl the corresponding makefile to list the models that we'll generate.
dnl
dnl For shared libraries, make a list of symbolic links to construct when
@@ -2786,15 +3128,19 @@ dnl one:
dnl lib.so ->
dnl lib.so. ->
dnl lib.so..
+dnl
+dnl Note: Libs_To_Make is mixed case, since it is not a pure autoconf variable.
AC_DEFUN([CF_LIB_RULES],
[
-CF_LIB_PREFIX(cf_prefix)
+cf_prefix=$LIB_PREFIX
AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
-if test $cf_cv_shlib_version = cygdll ; then
+case $cf_cv_shlib_version in #(vi
+cygdll|msysdll|mingw)
TINFO_NAME=$TINFO_ARG_SUFFIX
TINFO_SUFFIX=.dll
-fi
+ ;;
+esac
if test -n "$TINFO_SUFFIX" ; then
case $TINFO_SUFFIX in
@@ -2820,79 +3166,78 @@ do
elif test -f $srcdir/$cf_dir/modules; then
SHARED_LIB=
- LIBS_TO_MAKE=
+ Libs_To_Make=
for cf_item in $cf_LIST_MODELS
do
CF_LIB_SUFFIX($cf_item,cf_suffix,cf_depsuf)
+ cf_libname=$cf_dir
+ test "$cf_dir" = c++ && cf_libname=ncurses++
if test $cf_item = shared ; then
- if test "$cf_cv_do_symlinks" = yes ; then
- case "$cf_cv_shlib_version" in #(vi
- rel) #(vi
- case "$cf_cv_system_name" in #(vi
- darwin*)
- case .${LIB_SUFFIX} in
- .tw*)
- cf_suffix=`echo $cf_suffix | sed 's/^tw//'`
- cf_suffix=tw'.${REL_VERSION}'"$cf_suffix"
+ if test -n "${LIB_SUFFIX}"
+ then
+ cf_shared_suffix=`echo "$cf_suffix" | sed 's/^'"${LIB_SUFFIX}"'//'`
+ else
+ cf_shared_suffix="$cf_suffix"
+ fi
+ if test "$cf_cv_do_symlinks" = yes ; then
+ cf_version_name=
+
+ case "$cf_cv_shlib_version" in #(vi
+ rel) #(vi
+ cf_version_name=REL_VERSION
;;
- .t*)
- cf_suffix=`echo $cf_suffix | sed 's/^t//'`
- cf_suffix=t'.${REL_VERSION}'"$cf_suffix"
- ;;
- .w*)
- cf_suffix=`echo $cf_suffix | sed 's/^w//'`
- cf_suffix=w'.${REL_VERSION}'"$cf_suffix"
- ;;
- *)
- cf_suffix='.${REL_VERSION}'"$cf_suffix"
+ abi)
+ cf_version_name=ABI_VERSION
;;
esac
- ;; #(vi
- *) cf_suffix="$cf_suffix"'.${REL_VERSION}' ;;
- esac
+
+ if test -n "$cf_version_name"
+ then
+ case "$cf_cv_system_name" in #(vi
+ darwin*)
+ # "w", etc?
+ cf_suffix="${LIB_SUFFIX}"'.${'$cf_version_name'}'"$cf_shared_suffix"
+ ;; #(vi
+ *)
+ cf_suffix="$cf_suffix"'.${'$cf_version_name'}'
+ ;;
+ esac
+ fi
+ if test -n "${LIB_SUFFIX}"
+ then
+ cf_shared_suffix=`echo "$cf_suffix" | sed 's/^'"${LIB_SUFFIX}"'//'`
+ else
+ cf_shared_suffix="$cf_suffix"
+ fi
+ fi
+ # cygwin needs import library, and has unique naming convention
+ # use autodetected ${cf_prefix} for import lib and static lib, but
+ # use 'cyg' prefix for shared lib.
+ case $cf_cv_shlib_version in #(vi
+ cygdll) #(vi
+ cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'`
+ Libs_To_Make="$Libs_To_Make ../lib/cyg${cf_libname}${cf_cygsuf}"
+ continue
;;
- abi)
- case "$cf_cv_system_name" in #(vi
- darwin*)
- case .${LIB_SUFFIX} in
- .tw*)
- cf_suffix=`echo $cf_suffix | sed 's/^tw//'`
- cf_suffix=tw'.${ABI_VERSION}'"$cf_suffix"
- ;;
- .t*)
- cf_suffix=`echo $cf_suffix | sed 's/^t//'`
- cf_suffix=t'.${ABI_VERSION}'"$cf_suffix"
- ;;
- .w*)
- cf_suffix=`echo $cf_suffix | sed 's/^w//'`
- cf_suffix=w'.${ABI_VERSION}'"$cf_suffix"
- ;;
- *)
- cf_suffix='.${ABI_VERSION}'"$cf_suffix"
- ;;
- esac
- ;; #(vi
- *) cf_suffix="$cf_suffix"'.${ABI_VERSION}' ;;
- esac
+ msysdll) #(vi
+ cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'`
+ Libs_To_Make="$Libs_To_Make ../lib/msys-${cf_libname}${cf_cygsuf}"
+ continue
+ ;;
+ mingw)
+ cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'`
+ Libs_To_Make="$Libs_To_Make ../lib/lib${cf_libname}${cf_cygsuf}"
+ continue
;;
esac
fi
- # cygwin needs import library, and has unique naming convention
- # use autodetected ${cf_prefix} for import lib and static lib, but
- # use 'cyg' prefix for shared lib.
- if test $cf_cv_shlib_version = cygdll ; then
- cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'`
- LIBS_TO_MAKE="$LIBS_TO_MAKE ../lib/cyg${cf_dir}${cf_cygsuf}"
- continue
- fi
- fi
- LIBS_TO_MAKE="$LIBS_TO_MAKE ../lib/${cf_prefix}${cf_dir}${cf_suffix}"
+ Libs_To_Make="$Libs_To_Make ../lib/${cf_prefix}${cf_libname}${cf_suffix}"
done
if test $cf_dir = ncurses ; then
cf_subsets="$LIB_SUBSETS"
cf_r_parts="$cf_subsets"
- cf_liblist="$LIBS_TO_MAKE"
+ cf_liblist="$Libs_To_Make"
while test -n "$cf_r_parts"
do
@@ -2912,7 +3257,7 @@ do
;;
esac
if test -n "$cf_item"; then
- LIBS_TO_MAKE="$cf_item $LIBS_TO_MAKE"
+ Libs_To_Make="$cf_item $Libs_To_Make"
fi
else
break
@@ -2922,13 +3267,40 @@ do
cf_subsets=`echo "$LIB_SUBSETS" | sed -e 's/^termlib.* //'`
fi
- sed -e "s%@LIBS_TO_MAKE@%$LIBS_TO_MAKE%" \
+ if test $cf_dir = c++; then
+ if test "x$with_shared_cxx" != xyes && test -n "$cf_shared_suffix"; then
+ cf_list=
+ for cf_item in $Libs_To_Make
+ do
+ case $cf_item in
+ *.a)
+ ;;
+ *)
+ cf_item=`echo "$cf_item" | sed -e "s,"$cf_shared_suffix",.a,"`
+ ;;
+ esac
+ for cf_test in $cf_list
+ do
+ if test "$cf_test" = "$cf_item"
+ then
+ cf_LIST_MODELS=`echo "$cf_LIST_MODELS" | sed -e 's/normal//'`
+ cf_item=
+ break
+ fi
+ done
+ test -n "$cf_item" && cf_list="$cf_list $cf_item"
+ done
+ Libs_To_Make="$cf_list"
+ fi
+ fi
+
+ sed -e "s%@Libs_To_Make@%$Libs_To_Make%" \
-e "s%@SHARED_LIB@%$SHARED_LIB%" \
$cf_dir/Makefile >$cf_dir/Makefile.out
mv $cf_dir/Makefile.out $cf_dir/Makefile
$AWK -f $srcdir/mk-0th.awk \
- libname="${cf_dir}${LIB_SUFFIX}" subsets="$LIB_SUBSETS" \
+ libname="${cf_dir}${LIB_SUFFIX}" subsets="$LIB_SUBSETS" ticlib="$TICS_LIB_SUFFIX" termlib="$TINFO_LIB_SUFFIX" \
$srcdir/$cf_dir/modules >>$cf_dir/Makefile
for cf_subset in $cf_subsets
@@ -2936,8 +3308,23 @@ do
cf_subdirs=
for cf_item in $cf_LIST_MODELS
do
+
echo "Appending rules for ${cf_item} model (${cf_dir}: ${cf_subset})"
CF_UPPER(cf_ITEM,$cf_item)
+
+ CXX_MODEL=$cf_ITEM
+ if test "$CXX_MODEL" = SHARED; then
+ case $cf_cv_shlib_version in #(vi
+ cygdll|msysdll|mingw) #(vi
+ test "x$with_shared_cxx" = xno && CF_VERBOSE(overriding CXX_MODEL to SHARED)
+ with_shared_cxx=yes
+ ;;
+ *)
+ test "x$with_shared_cxx" = xno && CXX_MODEL=NORMAL
+ ;;
+ esac
+ fi
+
CF_LIB_SUFFIX($cf_item,cf_suffix,cf_depsuf)
CF_OBJ_SUBDIR($cf_item,cf_subdir)
@@ -2955,6 +3342,8 @@ do
cf_libname=$TICS_LIB_SUFFIX
;;
esac
+ elif test $cf_dir = c++ ; then
+ cf_libname=ncurses++$LIB_SUFFIX
else
cf_libname=${cf_libname}$LIB_SUFFIX
fi
@@ -3006,10 +3395,12 @@ do
name=${cf_libname}${cf_dir_suffix} \
traces=$LIB_TRACING \
MODEL=$cf_ITEM \
+ CXX_MODEL=$CXX_MODEL \
model=$cf_subdir \
prefix=$cf_prefix \
suffix=$cf_suffix \
subset=$cf_subset \
+ driver=$cf_cv_term_driver \
SymLink="$LN_S" \
TermlibRoot=$TINFO_NAME \
TermlibSuffix=$TINFO_SUFFIX \
@@ -3048,7 +3439,7 @@ do
done
fi
- echo ' cd '$cf_dir' && ${MAKE} ${CF_MFLAGS} [$]@' >>Makefile
+ echo ' cd '$cf_dir' && ${MAKE} ${TOP_MFLAGS} [$]@' >>Makefile
done
for cf_dir in $SRC_SUBDIRS
@@ -3063,7 +3454,7 @@ do
echo 'libs \' >> Makefile
echo 'install.libs \' >> Makefile
echo 'uninstall.libs ::' >> Makefile
- echo ' cd '$cf_dir' && ${MAKE} ${CF_MFLAGS} [$]@' >> Makefile
+ echo ' cd '$cf_dir' && ${MAKE} ${TOP_MFLAGS} [$]@' >> Makefile
;;
esac
fi
@@ -3086,7 +3477,7 @@ install.libs \\
uninstall.libs \\
install.$cf_dir \\
uninstall.$cf_dir ::
- cd $cf_dir && \${MAKE} \${CF_MFLAGS} \[$]@
+ cd $cf_dir && \${MAKE} \${TOP_MFLAGS} \[$]@
CF_EOF
elif test -f $srcdir/$cf_dir/headers; then
cat >> Makefile <> Makefile <> Makefile <> Makefile <$cf_edit_man <>$cf_man_alias <<-CF_EOF2
s,@DATADIR@,\$datadir,g
- s,@TERMINFO@,\$TERMINFO,g
- s,@NCURSES_MAJOR@,\$NCURSES_MAJOR,g
- s,@NCURSES_MINOR@,\$NCURSES_MINOR,g
- s,@NCURSES_PATCH@,\$NCURSES_PATCH,g
- s,@NCURSES_OSPEED@,\$NCURSES_OSPEED,g
+ s,@TERMINFO@,\${TERMINFO:="no default value"},g
+ s,@TERMINFO_DIRS@,\${TERMINFO_DIRS:="no default value"},g
+ s,@NCURSES_MAJOR@,\${NCURSES_MAJOR:="no default value"},g
+ s,@NCURSES_MINOR@,\${NCURSES_MINOR:="no default value"},g
+ s,@NCURSES_PATCH@,\${NCURSES_PATCH:="no default value"},g
+ s,@NCURSES_OSPEED@,\${NCURSES_OSPEED:="no default value"},g
CF_EOF
ifelse($1,,,[
for cf_name in $1
@@ -3949,7 +4333,9 @@ CF_EOF
if test "$MANPAGE_ALIASES" != no ; then
cat >>$cf_edit_man <>$cf_edit_man <\$TMP.out
+ mv \$TMP.out \$TMP
+CF_EOF
+fi
+
if test $with_curses_h != yes ; then
cat >>$cf_edit_man <\$TMP.out
@@ -4154,7 +4547,7 @@ ifelse($1,,[
fi
])
dnl ---------------------------------------------------------------------------
-dnl CF_MIXEDCASE_FILENAMES version: 3 updated: 2003/09/20 17:07:55
+dnl CF_MIXEDCASE_FILENAMES version: 6 updated: 2013/10/08 17:47:05
dnl ----------------------
dnl Check if the file-system supports mixed-case filenames. If we're able to
dnl create a lowercase name and see it as uppercase, it doesn't support that.
@@ -4163,7 +4556,7 @@ AC_DEFUN([CF_MIXEDCASE_FILENAMES],
AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[
if test "$cross_compiling" = yes ; then
case $target_alias in #(vi
- *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-mingw32*|*-uwin*) #(vi
+ *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*) #(vi
cf_cv_mixedcase=no
;;
*)
@@ -4181,10 +4574,10 @@ else
rm -f conftest CONFTEST
fi
])
-test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES)
+test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.])
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_MKSTEMP version: 7 updated: 2010/08/14 18:25:37
+dnl CF_MKSTEMP version: 9 updated: 2012/10/03 04:34:49
dnl ----------
dnl Check for a working mkstemp. This creates two files, checks that they are
dnl successfully created and distinct (AmigaOS apparently fails on the last).
@@ -4226,11 +4619,13 @@ int main()
}
],[cf_cv_func_mkstemp=yes
],[cf_cv_func_mkstemp=no
-],[AC_CHECK_FUNC(mkstemp)
-])
+],[cf_cv_func_mkstemp=maybe])
])
+if test "x$cf_cv_func_mkstemp" = xmaybe ; then
+ AC_CHECK_FUNC(mkstemp)
+fi
if test "x$cf_cv_func_mkstemp" = xyes || test "x$ac_cv_func_mkstemp" = xyes ; then
- AC_DEFINE(HAVE_MKSTEMP)
+ AC_DEFINE(HAVE_MKSTEMP,1,[Define to 1 if mkstemp() is available and working.])
fi
])dnl
dnl ---------------------------------------------------------------------------
@@ -4258,14 +4653,14 @@ if test "${with_abi_version+set}" != set; then
fi
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_NO_LEAKS_OPTION version: 4 updated: 2006/12/16 14:24:05
+dnl CF_NO_LEAKS_OPTION version: 5 updated: 2012/10/02 20:55:03
dnl ------------------
dnl see CF_WITH_NO_LEAKS
AC_DEFUN([CF_NO_LEAKS_OPTION],[
AC_MSG_CHECKING(if you want to use $1 for testing)
AC_ARG_WITH($1,
[$2],
- [AC_DEFINE($3)ifelse([$4],,[
+ [AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[
$4
])
: ${with_cflags:=-g}
@@ -4306,7 +4701,7 @@ else
fi
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_OBJ_SUBDIR version: 4 updated: 2002/02/23 20:38:31
+dnl CF_OBJ_SUBDIR version: 6 updated: 2013/09/07 14:06:10
dnl -------------
dnl Compute the object-directory name from the given model name
AC_DEFUN([CF_OBJ_SUBDIR],
@@ -4318,7 +4713,7 @@ AC_DEFUN([CF_OBJ_SUBDIR],
profile) $2='obj_p' ;;
shared)
case $cf_cv_system_name in #(vi
- cygwin) #(vi
+ cygwin|msys) #(vi
$2='objects' ;;
*)
$2='obj_s' ;;
@@ -4326,20 +4721,23 @@ AC_DEFUN([CF_OBJ_SUBDIR],
esac
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_PATHSEP version: 5 updated: 2010/05/26 05:38:42
+dnl CF_PATHSEP version: 6 updated: 2012/09/29 18:38:12
dnl ----------
-dnl Provide a value for the $PATH and similar separator
+dnl Provide a value for the $PATH and similar separator (or amend the value
+dnl as provided in autoconf 2.5x).
AC_DEFUN([CF_PATHSEP],
[
+ AC_MSG_CHECKING(for PATH separator)
case $cf_cv_system_name in
os2*) PATH_SEPARATOR=';' ;;
- *) PATH_SEPARATOR=':' ;;
+ *) ${PATH_SEPARATOR:=':'} ;;
esac
ifelse([$1],,,[$1=$PATH_SEPARATOR])
AC_SUBST(PATH_SEPARATOR)
+ AC_MSG_RESULT($PATH_SEPARATOR)
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_PATH_SYNTAX version: 13 updated: 2010/05/26 05:38:42
+dnl CF_PATH_SYNTAX version: 14 updated: 2012/06/19 20:58:54
dnl --------------
dnl Check the argument to see that it looks like a pathname. Rewrite it if it
dnl begins with one of the prefix/exec_prefix variables, and then again if the
@@ -4359,7 +4757,7 @@ case ".[$]$1" in #(vi
;;
.[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX
;;
-.\[$]{*prefix}*) #(vi
+.\[$]{*prefix}*|.\[$]{*dir}*) #(vi
eval $1="[$]$1"
case ".[$]$1" in #(vi
.NONE/*)
@@ -4376,7 +4774,7 @@ case ".[$]$1" in #(vi
esac
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_PKG_CONFIG version: 4 updated: 2011/02/18 20:26:24
+dnl CF_PKG_CONFIG version: 7 updated: 2011/04/29 04:53:22
dnl -------------
dnl Check for the package-config program, unless disabled by command-line.
AC_DEFUN([CF_PKG_CONFIG],
@@ -4393,7 +4791,9 @@ no) #(vi
PKG_CONFIG=none
;;
yes) #(vi
- AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)
+ CF_ACVERSION_CHECK(2.52,
+ [AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)],
+ [AC_PATH_PROG(PKG_CONFIG, pkg-config, none)])
;;
*)
PKG_CONFIG=$withval
@@ -4554,6 +4954,19 @@ AC_PROG_AWK
test -z "$AWK" && AC_MSG_ERROR(No awk program found)
])dnl
dnl ---------------------------------------------------------------------------
+dnl CF_PROG_CC version: 3 updated: 2012/10/06 15:31:55
+dnl ----------
+dnl standard check for CC, plus followup sanity checks
+dnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name
+AC_DEFUN([CF_PROG_CC],[
+ifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)])
+CF_GCC_VERSION
+CF_ACVERSION_CHECK(2.52,
+ [AC_PROG_CC_STDC],
+ [CF_ANSI_CC_REQD])
+CF_CC_ENV_FLAGS
+])dnl
+dnl ---------------------------------------------------------------------------
dnl CF_PROG_CC_C_O version: 3 updated: 2010/08/14 18:25:37
dnl --------------
dnl Analogous to AC_PROG_CC_C_O, but more useful: tests only $CC, ensures that
@@ -4593,31 +5006,6 @@ else
fi
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_PROG_CC_U_D version: 1 updated: 2005/07/14 16:59:30
-dnl --------------
-dnl Check if C (preprocessor) -U and -D options are processed in the order
-dnl given rather than by type of option. Some compilers insist on apply all
-dnl of the -U options after all of the -D options. Others allow mixing them,
-dnl and may predefine symbols that conflict with those we define.
-AC_DEFUN([CF_PROG_CC_U_D],
-[
-AC_CACHE_CHECK(if $CC -U and -D options work together,cf_cv_cc_u_d_options,[
- cf_save_CPPFLAGS="$CPPFLAGS"
- CPPFLAGS="-UU_D_OPTIONS -DU_D_OPTIONS -DD_U_OPTIONS -UD_U_OPTIONS"
- AC_TRY_COMPILE([],[
-#ifndef U_D_OPTIONS
-make an undefined-error
-#endif
-#ifdef D_U_OPTIONS
-make a defined-error
-#endif
- ],[
- cf_cv_cc_u_d_options=yes],[
- cf_cv_cc_u_d_options=no])
- CPPFLAGS="$cf_save_CPPFLAGS"
-])
-])dnl
-dnl ---------------------------------------------------------------------------
dnl CF_PROG_EGREP version: 1 updated: 2006/09/16 11:40:59
dnl -------------
dnl AC_PROG_EGREP was introduced in autoconf 2.53.
@@ -4633,32 +5021,7 @@ AC_DEFUN([CF_PROG_EGREP],
test -z "$EGREP" && AC_MSG_ERROR(No egrep program found)
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_PROG_EXT version: 10 updated: 2004/01/03 19:28:18
-dnl -----------
-dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX.
-AC_DEFUN([CF_PROG_EXT],
-[
-AC_REQUIRE([CF_CHECK_CACHE])
-case $cf_cv_system_name in
-os2*)
- CFLAGS="$CFLAGS -Zmt"
- CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__"
- CXXFLAGS="$CXXFLAGS -Zmt"
- # autoconf's macro sets -Zexe and suffix both, which conflict:w
- LDFLAGS="$LDFLAGS -Zmt -Zcrtdll"
- ac_cv_exeext=.exe
- ;;
-esac
-
-AC_EXEEXT
-AC_OBJEXT
-
-PROG_EXT="$EXEEXT"
-AC_SUBST(PROG_EXT)
-test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT")
-])dnl
-dnl ---------------------------------------------------------------------------
-dnl CF_PROG_GNAT version: 1 updated: 2010/06/19 15:22:18
+dnl CF_PROG_GNAT version: 2 updated: 2011/10/22 14:01:47
dnl ------------
dnl Check for gnatmake, ensure that it is complete.
AC_DEFUN([CF_PROG_GNAT],[
@@ -4666,6 +5029,7 @@ cf_ada_make=gnatmake
AC_CHECK_PROG(gnat_exists, $cf_ada_make, yes, no)
if test "$ac_cv_prog_gnat_exists" = no; then
cf_ada_make=
+ cf_cv_prog_gnat_correct=no
else
CF_GNAT_VERSION
AC_CHECK_PROG(M4_exists, m4, yes, no)
@@ -4709,7 +5073,7 @@ case $INSTALL in
esac
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_PROG_LDCONFIG version: 2 updated: 2008/12/13 14:08:40
+dnl CF_PROG_LDCONFIG version: 3 updated: 2011/06/04 20:09:13
dnl ----------------
dnl Check for ldconfig, needed to fixup shared libraries that would be built
dnl and then used in the install.
@@ -4718,7 +5082,7 @@ if test "$cross_compiling" = yes ; then
LDCONFIG=:
else
case "$cf_cv_system_name" in #(vi
-dragonfly*|freebsd*) #(vi
+dragonfly*|mirbsd*|freebsd*) #(vi
test -z "$LDCONFIG" && LDCONFIG="/sbin/ldconfig -R"
;;
*) LDPATH=$PATH:/sbin:/usr/sbin
@@ -4759,7 +5123,7 @@ AC_MSG_RESULT($cf_prog_ln_sf)
test "$cf_prog_ln_sf" = yes && LN_S="$LN_S -f"
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_REGEX version: 8 updated: 2010/08/07 14:09:44
+dnl CF_REGEX version: 10 updated: 2012/10/04 20:12:20
dnl --------
dnl Attempt to determine if we've got one of the flavors of regular-expression
dnl code that we can support.
@@ -4771,7 +5135,7 @@ cf_regex_func=no
cf_regex_libs="regex re"
case $host_os in #(vi
mingw*)
- cf_regex_libs="regex.dll $cf_regex_libs"
+ cf_regex_libs="gnurx $cf_regex_libs"
;;
esac
@@ -4833,9 +5197,9 @@ esac
case $cf_cv_regex_hdrs in #(vi
no) AC_MSG_WARN(no regular expression header found) ;; #(vi
- regex.h) AC_DEFINE(HAVE_REGEX_H_FUNCS) ;; #(vi
- regexp.h) AC_DEFINE(HAVE_REGEXP_H_FUNCS) ;; #(vi
- regexpr.h) AC_DEFINE(HAVE_REGEXPR_H_FUNCS) ;;
+ regex.h) AC_DEFINE(HAVE_REGEX_H_FUNCS,1,[Define to 1 to include regex.h for regular expressions]) ;; #(vi
+ regexp.h) AC_DEFINE(HAVE_REGEXP_H_FUNCS,1,[Define to 1 to include regexp.h for regular expressions]) ;; #(vi
+ regexpr.h) AC_DEFINE(HAVE_REGEXPR_H_FUNCS,1,[Define to 1 to include regexpr.h for regular expressions]) ;;
esac
])dnl
dnl ---------------------------------------------------------------------------
@@ -4869,7 +5233,7 @@ define([CF_REMOVE_LIB],
$1=`echo "$2" | sed -e 's/-l$3[[ ]]//g' -e 's/-l$3[$]//'`
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_RPATH_HACK version: 9 updated: 2011/02/13 13:31:33
+dnl CF_RPATH_HACK version: 11 updated: 2013/09/01 13:02:00
dnl -------------
AC_DEFUN([CF_RPATH_HACK],
[
@@ -4886,8 +5250,8 @@ if test -n "$LD_RPATH_OPT" ; then
AC_TRY_LINK([#include ],
[printf("Hello");],
- [cf_rpath_oops=`$cf_ldd_prog conftest$ac_exeext | fgrep ' not found' | sed -e 's% =>.*$%%' |sort -u`
- cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[[ ]]/%/%' -e 's%/[[^/]][[^/]]*$%%' |sort -u`])
+ [cf_rpath_oops=`$cf_ldd_prog conftest$ac_exeext | fgrep ' not found' | sed -e 's% =>.*$%%' |sort | uniq`
+ cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[[ ]]/%/%' -e 's%/[[^/]][[^/]]*$%%' |sort | uniq`])
# If we passed the link-test, but get a "not found" on a given library,
# this could be due to inept reconfiguration of gcc to make it only
@@ -4920,6 +5284,8 @@ AC_TRY_LINK([#include ],
CF_RPATH_HACK_2(LIBS)
CF_VERBOSE(...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS)
+else
+ AC_MSG_RESULT(no)
fi
AC_SUBST(EXTRA_LDFLAGS)
])dnl
@@ -4984,18 +5350,19 @@ CF_VERBOSE(...checked $1 [$]$1)
AC_SUBST(EXTRA_LDFLAGS)
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_SHARED_OPTS version: 64 updated: 2010/06/05 16:51:16
+dnl CF_SHARED_OPTS version: 84 updated: 2013/11/03 06:26:10
dnl --------------
dnl --------------
dnl Attempt to determine the appropriate CC/LD options for creating a shared
dnl library.
dnl
-dnl Note: ${LOCAL_LDFLAGS} is used to link executables that will run within the
-dnl build-tree, i.e., by making use of the libraries that are compiled in ../lib
-dnl We avoid compiling-in a ../lib path for the shared library since that can
-dnl lead to unexpected results at runtime.
-dnl ${LOCAL_LDFLAGS2} has the same intention but assumes that the shared libraries
-dnl are compiled in ../../lib
+dnl Notes:
+dnl a) ${LOCAL_LDFLAGS} is used to link executables that will run within
+dnl the build-tree, i.e., by making use of the libraries that are compiled in
+dnl $rel_builddir/lib We avoid compiling-in a $rel_builddir/lib path for the
+dnl shared library since that can lead to unexpected results at runtime.
+dnl b) ${LOCAL_LDFLAGS2} has the same intention but assumes that the shared
+dnl libraries are compiled in ../../lib
dnl
dnl The variable 'cf_cv_do_symlinks' is used to control whether we configure
dnl to install symbolic links to the rel/abi versions of shared libraries.
@@ -5010,12 +5377,19 @@ dnl
dnl Some loaders leave 'so_locations' lying around. It's nice to clean up.
AC_DEFUN([CF_SHARED_OPTS],
[
- AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
AC_REQUIRE([CF_LD_RPATH_OPT])
+ RM_SHARED_OPTS=
LOCAL_LDFLAGS=
LOCAL_LDFLAGS2=
LD_SHARED_OPTS=
INSTALL_LIB="-m 644"
+ : ${rel_builddir:=.}
+
+ shlibdir=$libdir
+ AC_SUBST(shlibdir)
+
+ MAKE_DLLS="#"
+ AC_SUBST(MAKE_DLLS)
cf_cv_do_symlinks=no
cf_ld_rpath_opt=
@@ -5040,6 +5414,7 @@ AC_DEFUN([CF_SHARED_OPTS],
AC_MSG_RESULT($cf_cv_shlib_version)
cf_cv_rm_so_locs=no
+ cf_try_cflags=
# Some less-capable ports of gcc support only -fpic
CC_SHARED_OPTS=
@@ -5059,10 +5434,14 @@ AC_DEFUN([CF_SHARED_OPTS],
cf_cv_shlib_version_infix=no
case $cf_cv_system_name in #(vi
- aix[[56]]*) #(vi
+ aix4.[3-9]*|aix[[5-7]]*) #(vi
if test "$GCC" = yes; then
CC_SHARED_OPTS=
- MK_SHARED_LIB='$(CC) -shared'
+ MK_SHARED_LIB='${CC} -shared -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o [$]@'
+ else
+ # CC_SHARED_OPTS='-qpic=large -G'
+ # perhaps "-bM:SRE -bnoentry -bexpall"
+ MK_SHARED_LIB='${CC} -G -Wl,-brtl -Wl,-blibpath:${RPATH_LIST}:/usr/lib -o [$]@'
fi
;;
beos*) #(vi
@@ -5070,9 +5449,12 @@ AC_DEFUN([CF_SHARED_OPTS],
;;
cygwin*) #(vi
CC_SHARED_OPTS=
- MK_SHARED_LIB='sh ../mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}'
+ MK_SHARED_LIB='sh '$rel_builddir'/mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}'
+ RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a"
cf_cv_shlib_version=cygdll
cf_cv_shlib_version_infix=cygdll
+ shlibdir=$bindir
+ MAKE_DLLS=
cat >mk_shared_lib.sh <<-CF_EOF
#!/bin/sh
SHARED_LIB=\[$]1
@@ -5083,12 +5465,34 @@ AC_DEFUN([CF_SHARED_OPTS],
** SHARED_LIB \[$]SHARED_LIB
** IMPORT_LIB \[$]IMPORT_LIB
EOF
- exec \[$]* -shared -Wl,--out-implib=../lib/\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o ../lib/\[$]{SHARED_LIB}
+ exec \[$]* -shared -Wl,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB}
+CF_EOF
+ chmod +x mk_shared_lib.sh
+ ;;
+ msys*) #(vi
+ CC_SHARED_OPTS=
+ MK_SHARED_LIB='sh '$rel_builddir'/mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}'
+ RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a"
+ cf_cv_shlib_version=msysdll
+ cf_cv_shlib_version_infix=msysdll
+ shlibdir=$bindir
+ MAKE_DLLS=
+ cat >mk_shared_lib.sh <<-CF_EOF
+ #!/bin/sh
+ SHARED_LIB=\[$]1
+ IMPORT_LIB=\`echo "\[$]1" | sed -e 's/msys-/lib/' -e 's/[[0-9]]*\.dll[$]/.dll.a/'\`
+ shift
+ cat <<-EOF
+ Linking shared library
+ ** SHARED_LIB \[$]SHARED_LIB
+ ** IMPORT_LIB \[$]IMPORT_LIB
+EOF
+ exec \[$]* -shared -Wl,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB}
CF_EOF
chmod +x mk_shared_lib.sh
;;
darwin*) #(vi
- EXTRA_CFLAGS="-no-cpp-precomp"
+ cf_try_cflags="no-cpp-precomp"
CC_SHARED_OPTS="-dynamic"
MK_SHARED_LIB='${CC} ${CFLAGS} -dynamiclib -install_name ${libdir}/`basename $[@]` -compatibility_version ${ABI_VERSION} -current_version ${ABI_VERSION} -o $[@]'
test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=abi
@@ -5102,6 +5506,14 @@ CF_EOF
LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
fi
;;
+ hpux[[7-8]]*) #(vi
+ # HP-UX 8.07 ld lacks "+b" option used for libdir search-list
+ if test "$GCC" != yes; then
+ CC_SHARED_OPTS='+Z'
+ fi
+ MK_SHARED_LIB='${LD} -b -o $[@]'
+ INSTALL_LIB="-m 555"
+ ;;
hpux*) #(vi
# (tested with gcc 2.7.2 -- I don't have c89)
if test "$GCC" = yes; then
@@ -5115,9 +5527,19 @@ CF_EOF
# readonly to exploit a quirk in the memory manager.
INSTALL_LIB="-m 555"
;;
+ interix*)
+ test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
+ if test "$cf_cv_shlib_version" = rel; then
+ cf_shared_soname='`basename $@ .${REL_VERSION}`.${ABI_VERSION}'
+ else
+ cf_shared_soname='`basename $@`'
+ fi
+ CC_SHARED_OPTS=
+ MK_SHARED_LIB='${CC} -shared -Wl,-rpath,${RPATH_LIST} -Wl,-h,'$cf_shared_soname' -o $@'
+ ;;
irix*) #(vi
if test "$cf_cv_enable_rpath" = yes ; then
- EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
+ EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
fi
# tested with IRIX 5.2 and 'cc'.
if test "$GCC" != yes; then
@@ -5134,18 +5556,45 @@ CF_EOF
LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
fi
if test "$cf_cv_enable_rpath" = yes ; then
- EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
+ EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
fi
CF_SHARED_SONAME
MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]'
;;
- openbsd[[2-9]].*) #(vi
+ mingw*) #(vi
+ cf_cv_shlib_version=mingw
+ cf_cv_shlib_version_infix=mingw
+ shlibdir=$bindir
+ MAKE_DLLS=
+ if test "$DFT_LWR_MODEL" = "shared" ; then
+ LOCAL_LDFLAGS="-Wl,--enable-auto-import"
+ LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
+ EXTRA_LDFLAGS="-Wl,--enable-auto-import $EXTRA_LDFLAGS"
+ fi
+ CC_SHARED_OPTS=
+ MK_SHARED_LIB='sh '$rel_builddir'/mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}'
+ RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.a"
+ cat >mk_shared_lib.sh <<-CF_EOF
+ #!/bin/sh
+ SHARED_LIB=\[$]1
+ IMPORT_LIB=\`echo "\[$]1" | sed -e 's/[[0-9]]*\.dll[$]/.dll.a/'\`
+ shift
+ cat <<-EOF
+ Linking shared library
+ ** SHARED_LIB \[$]SHARED_LIB
+ ** IMPORT_LIB \[$]IMPORT_LIB
+EOF
+ exec \[$]* -shared -Wl,--enable-auto-import,--out-implib=\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o \[$]{SHARED_LIB}
+CF_EOF
+ chmod +x mk_shared_lib.sh
+ ;;
+ openbsd[[2-9]].*|mirbsd*) #(vi
if test "$DFT_LWR_MODEL" = "shared" ; then
LOCAL_LDFLAGS="${LD_RPATH_OPT}\$(LOCAL_LIBDIR)"
LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
fi
if test "$cf_cv_enable_rpath" = yes ; then
- EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
+ EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
fi
CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
CF_SHARED_SONAME
@@ -5156,12 +5605,12 @@ CF_EOF
MK_SHARED_LIB='${LD} -Bshareable -o $[@]'
test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
;;
- freebsd*) #(vi
+ dragonfly*|freebsd*) #(vi
CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then
LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)"
- LOCAL_LDFLAGS2="${cf_ld_rpath_opt}\${libdir} $LOCAL_LDFLAGS"
- EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
+ LOCAL_LDFLAGS2="${cf_ld_rpath_opt}\${RPATH_LIST} $LOCAL_LDFLAGS"
+ EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
fi
CF_SHARED_SONAME
MK_SHARED_LIB='${LD} -shared -Bshareable -soname=`basename $[@]` -o $[@]'
@@ -5171,7 +5620,7 @@ CF_EOF
if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_enable_rpath" = yes ; then
LOCAL_LDFLAGS="${cf_ld_rpath_opt}\$(LOCAL_LIBDIR)"
LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
- EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${libdir} $EXTRA_LDFLAGS"
+ EXTRA_LDFLAGS="${cf_ld_rpath_opt}\${RPATH_LIST} $EXTRA_LDFLAGS"
if test "$cf_cv_shlib_version" = auto; then
if test -f /usr/libexec/ld.elf_so; then
cf_cv_shlib_version=abi
@@ -5182,7 +5631,7 @@ CF_EOF
CF_SHARED_SONAME
MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname' -o $[@]'
else
- MK_SHARED_LIB='${LD} -shared -Bshareable -o $[@]'
+ MK_SHARED_LIB='${CC} -Wl,-shared -Wl,-Bshareable -o $[@]'
fi
;;
osf*|mls+*) #(vi
@@ -5276,20 +5725,57 @@ CF_EOF
;;
esac
- if test -n "$cf_ld_rpath_opt" ; then
- MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${libdir}"
+ if test -n "$cf_try_cflags"
+ then
+cat > conftest.$ac_ext <
+int main(int argc, char *argv[[]])
+{
+ printf("hello\n");
+ return (argv[[argc-1]] == 0) ;
+}
+EOF
+ cf_save_CFLAGS="$CFLAGS"
+ for cf_opt in $cf_try_cflags
+ do
+ CFLAGS="$cf_save_CFLAGS -$cf_opt"
+ AC_MSG_CHECKING(if CFLAGS option -$cf_opt works)
+ if AC_TRY_EVAL(ac_compile); then
+ AC_MSG_RESULT(yes)
+ cf_save_CFLAGS="$CFLAGS"
+ else
+ AC_MSG_RESULT(no)
+ fi
+ done
+ CFLAGS="$cf_save_CFLAGS"
fi
+
+ # RPATH_LIST is a colon-separated list of directories
+ test -n "$cf_ld_rpath_opt" && MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${RPATH_LIST}"
+ test -z "$RPATH_LIST" && RPATH_LIST="\${libdir}"
+
+ test $cf_cv_rm_so_locs = yes && RM_SHARED_OPTS="$RM_SHARED_OPTS so_locations"
+
+ CF_VERBOSE(CC_SHARED_OPTS: $CC_SHARED_OPTS)
+ CF_VERBOSE(MK_SHARED_LIB: $MK_SHARED_LIB)
+
AC_SUBST(CC_SHARED_OPTS)
AC_SUBST(LD_RPATH_OPT)
AC_SUBST(LD_SHARED_OPTS)
AC_SUBST(MK_SHARED_LIB)
+ AC_SUBST(RM_SHARED_OPTS)
+
AC_SUBST(LINK_PROGS)
AC_SUBST(LINK_TESTS)
+
AC_SUBST(EXTRA_LDFLAGS)
AC_SUBST(LOCAL_LDFLAGS)
AC_SUBST(LOCAL_LDFLAGS2)
+
AC_SUBST(INSTALL_LIB)
+ AC_SUBST(RPATH_LIST)
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_SHARED_SONAME version: 3 updated: 2008/09/08 18:34:43
@@ -5369,7 +5855,7 @@ done
fi
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_SIG_ATOMIC_T version: 2 updated: 2005/09/18 17:27:12
+dnl CF_SIG_ATOMIC_T version: 3 updated: 2012/10/04 20:12:20
dnl ---------------
dnl signal handler, but there are some gcc depedencies in that recommendation.
dnl Try anyway.
@@ -5401,10 +5887,10 @@ static void handler(int sig)
done
])
AC_MSG_RESULT($cf_cv_sig_atomic_t)
-test "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t)
+test "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t,[Define to signal global datatype])
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_SIZECHANGE version: 8 updated: 2000/11/04 12:22:16
+dnl CF_SIZECHANGE version: 9 updated: 2012/10/06 11:17:15
dnl -------------
dnl Check for definitions & structures needed for window size-changing
dnl FIXME: check that this works with "snake" (HP-UX 10.x)
@@ -5465,7 +5951,7 @@ do
done
])
if test "$cf_cv_sizechange" != no ; then
- AC_DEFINE(HAVE_SIZECHANGE)
+ AC_DEFINE(HAVE_SIZECHANGE,1,[Define to 1 if sizechar declarations are provided])
case $cf_cv_sizechange in #(vi
NEED*)
AC_DEFINE_UNQUOTED($cf_cv_sizechange )
@@ -5474,7 +5960,7 @@ if test "$cf_cv_sizechange" != no ; then
fi
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_SRC_MODULES version: 21 updated: 2010/09/04 17:37:40
+dnl CF_SRC_MODULES version: 27 updated: 2013/08/03 18:18:08
dnl --------------
dnl For each parameter, test if the source-directory exists, and if it contains
dnl a 'modules' file. If so, add to the list $cf_cv_src_modules which we'll
@@ -5497,6 +5983,7 @@ else
TEST_ARG2="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARG2"
fi
+PC_MODULES_TO_MAKE="ncurses${DFT_ARG_SUFFIX}"
cf_cv_src_modules=
for cf_dir in $1
do
@@ -5535,6 +6022,7 @@ do
TEST_ARGS="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARGS"
TEST_ARG2="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARG2"
fi
+ PC_MODULES_TO_MAKE="${PC_MODULES_TO_MAKE} ${cf_dir}${DFT_ARG_SUFFIX}"
fi
fi
done
@@ -5561,11 +6049,21 @@ done
if test "x$cf_with_tests" != "xno" ; then
SRC_SUBDIRS="$SRC_SUBDIRS test"
fi
-test -z "$MAKE_TERMINFO" && SRC_SUBDIRS="$SRC_SUBDIRS misc"
-test "$cf_with_cxx_binding" != no && SRC_SUBDIRS="$SRC_SUBDIRS c++"
+if test "x$cf_with_db_install" = xyes; then
+ test -z "$MAKE_TERMINFO" && SRC_SUBDIRS="$SRC_SUBDIRS misc"
+fi
+if test "$cf_with_cxx_binding" != no; then
+ PC_MODULES_TO_MAKE="${PC_MODULES_TO_MAKE} ncurses++${DFT_ARG_SUFFIX}"
+ SRC_SUBDIRS="$SRC_SUBDIRS c++"
+fi
+
+test "x$with_termlib" != xno && PC_MODULES_TO_MAKE="$PC_MODULES_TO_MAKE $TINFO_ARG_SUFFIX"
+test "x$with_ticlib" != xno && PC_MODULES_TO_MAKE="$PC_MODULES_TO_MAKE $TICS_ARG_SUFFIX"
+
+AC_SUBST(PC_MODULES_TO_MAKE)
ADA_SUBDIRS=
-if test "$cf_cv_prog_gnat_correct" = yes && test -f $srcdir/Ada95/Makefile.in; then
+if test "x$cf_with_ada" = "xyes" && test "x$cf_cv_prog_gnat_correct" = xyes && test -f $srcdir/Ada95/Makefile.in; then
SRC_SUBDIRS="$SRC_SUBDIRS Ada95"
ADA_SUBDIRS="gen src"
if test "x$cf_with_tests" != "xno" ; then
@@ -5624,13 +6122,13 @@ dnl Remove "-g" option from the compiler options
AC_DEFUN([CF_STRIP_G_OPT],
[$1=`echo ${$1} | sed -e 's%-g %%' -e 's%-g$%%'`])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_STRUCT_SIGACTION version: 3 updated: 2000/08/12 23:18:52
+dnl CF_STRUCT_SIGACTION version: 5 updated: 2012/10/06 17:56:13
dnl -------------------
dnl Check if we need _POSIX_SOURCE defined to use struct sigaction. We'll only
dnl do this if we've found the sigaction function.
-dnl
-dnl If needed, define SVR4_ACTION.
AC_DEFUN([CF_STRUCT_SIGACTION],[
+AC_REQUIRE([CF_XOPEN_SOURCE])
+
if test "$ac_cv_func_sigaction" = yes; then
AC_MSG_CHECKING(whether sigaction needs _POSIX_SOURCE)
AC_TRY_COMPILE([
@@ -5645,22 +6143,24 @@ AC_TRY_COMPILE([
#include ],
[struct sigaction act],
[sigact_bad=yes
- AC_DEFINE(SVR4_ACTION)],
+ AC_DEFINE(_POSIX_SOURCE,1,[Define to 1 if we must define _POSIX_SOURCE])],
[sigact_bad=unknown])])
AC_MSG_RESULT($sigact_bad)
fi
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_STRUCT_TERMIOS version: 5 updated: 2000/11/04 12:22:46
+dnl CF_STRUCT_TERMIOS version: 7 updated: 2012/10/06 17:56:13
dnl -----------------
dnl Some machines require _POSIX_SOURCE to completely define struct termios.
-dnl If so, define SVR4_TERMIO
AC_DEFUN([CF_STRUCT_TERMIOS],[
+AC_REQUIRE([CF_XOPEN_SOURCE])
+
AC_CHECK_HEADERS( \
termio.h \
termios.h \
unistd.h \
)
+
if test "$ISC" = yes ; then
AC_CHECK_HEADERS( sys/termio.h )
fi
@@ -5680,7 +6180,7 @@ if test "$ac_cv_header_termios_h" = yes ; then
#include ],
[struct termios foo; int x = foo.c_iflag],
termios_bad=unknown,
- termios_bad=yes AC_DEFINE(SVR4_TERMIO))
+ termios_bad=yes AC_DEFINE(_POSIX_SOURCE,1,[Define to 1 if we must define _POSIX_SOURCE]))
])
AC_MSG_RESULT($termios_bad)
fi
@@ -5704,23 +6204,6 @@ CF_ADD_SUBDIR_PATH($1,$2,$3,/opt,$prefix)
CF_ADD_SUBDIR_PATH($1,$2,$3,[$]HOME,$prefix)
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_SUBST version: 4 updated: 2006/06/17 12:33:03
-dnl --------
-dnl Shorthand macro for substituting things that the user may override
-dnl with an environment variable.
-dnl
-dnl $1 = long/descriptive name
-dnl $2 = environment variable
-dnl $3 = default value
-AC_DEFUN([CF_SUBST],
-[AC_CACHE_VAL(cf_cv_subst_$2,[
-AC_MSG_CHECKING(for $1 (symbol $2))
-CF_SUBST_IF([-z "[$]$2"], [$2], [$3])
-cf_cv_subst_$2=[$]$2
-AC_MSG_RESULT([$]$2)
-])
-])dnl
-dnl ---------------------------------------------------------------------------
dnl CF_SUBST_IF version: 2 updated: 2006/06/17 12:33:03
dnl -----------
dnl Shorthand macro for substituting things that the user may override
@@ -5766,7 +6249,7 @@ AC_SUBST(cf_cv_header_stdbool_h)
AC_SUBST(cf_cv_type_of_bool)dnl
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_SYS_TIME_SELECT version: 4 updated: 2000/10/04 09:18:40
+dnl CF_SYS_TIME_SELECT version: 5 updated: 2012/10/04 05:24:07
dnl ------------------
dnl Check if we can include with ; this breaks on
dnl older SCO configurations.
@@ -5786,19 +6269,58 @@ AC_TRY_COMPILE([
[cf_cv_sys_time_select=no])
])
AC_MSG_RESULT($cf_cv_sys_time_select)
-test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT)
+test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT,1,[Define to 1 if we can include with ])
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_TOP_BUILDDIR version: 1 updated: 2006/10/15 16:33:23
+dnl CF_TOP_BUILDDIR version: 2 updated: 2013/07/27 17:38:32
dnl ---------------
dnl Define a top_builddir symbol, for applications that need an absolute path.
AC_DEFUN([CF_TOP_BUILDDIR],
[
-top_builddir=`pwd`
+top_builddir=ifelse($1,,`pwd`,$1)
AC_SUBST(top_builddir)
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_TYPEOF_CHTYPE version: 8 updated: 2006/12/16 12:33:30
+dnl CF_TRY_XOPEN_SOURCE version: 1 updated: 2011/10/30 17:09:50
+dnl -------------------
+dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we
+dnl can define it successfully.
+AC_DEFUN([CF_TRY_XOPEN_SOURCE],[
+AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
+ AC_TRY_COMPILE([
+#include
+#include
+#include
+],[
+#ifndef _XOPEN_SOURCE
+make an error
+#endif],
+ [cf_cv_xopen_source=no],
+ [cf_save="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
+ AC_TRY_COMPILE([
+#include
+#include
+#include
+],[
+#ifdef _XOPEN_SOURCE
+make an error
+#endif],
+ [cf_cv_xopen_source=no],
+ [cf_cv_xopen_source=$cf_XOPEN_SOURCE])
+ CPPFLAGS="$cf_save"
+ ])
+])
+
+if test "$cf_cv_xopen_source" != no ; then
+ CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
+ CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
+ cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
+ CF_ADD_CFLAGS($cf_temp_xopen_source)
+fi
+])
+dnl ---------------------------------------------------------------------------
+dnl CF_TYPEOF_CHTYPE version: 9 updated: 2012/10/06 17:56:13
dnl ----------------
dnl Determine the type we should use for chtype (and attr_t, which is treated
dnl as the same thing). We want around 32 bits, so on most machines want a
@@ -5847,10 +6369,10 @@ int main()
AC_MSG_RESULT($cf_cv_typeof_chtype)
AC_SUBST(cf_cv_typeof_chtype)
-AC_DEFINE_UNQUOTED(TYPEOF_CHTYPE,$cf_cv_typeof_chtype)
+AC_DEFINE_UNQUOTED(TYPEOF_CHTYPE,$cf_cv_typeof_chtype,[Define to actual type if needed for chtype])
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_TYPE_SIGACTION version: 3 updated: 2000/08/12 23:18:52
+dnl CF_TYPE_SIGACTION version: 4 updated: 2012/10/06 17:56:13
dnl -----------------
dnl
AC_DEFUN([CF_TYPE_SIGACTION],
@@ -5863,7 +6385,7 @@ AC_CACHE_VAL(cf_cv_type_sigaction,[
[cf_cv_type_sigaction=yes],
[cf_cv_type_sigaction=no])])
AC_MSG_RESULT($cf_cv_type_sigaction)
-test "$cf_cv_type_sigaction" = yes && AC_DEFINE(HAVE_TYPE_SIGACTION)
+test "$cf_cv_type_sigaction" = yes && AC_DEFINE(HAVE_TYPE_SIGACTION,1,[Define to 1 if we have the sigaction_t type])
])dnl
dnl ---------------------------------------------------------------------------
dnl CF_UNSIGNED_LITERALS version: 2 updated: 1998/02/07 22:10:16
@@ -5890,7 +6412,7 @@ AC_DEFUN([CF_UPPER],
$1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_UTF8_LIB version: 7 updated: 2010/06/20 09:24:28
+dnl CF_UTF8_LIB version: 8 updated: 2012/10/06 08:57:51
dnl -----------
dnl Check for multibyte support, and if not found, utf8 compatibility library
AC_DEFUN([CF_UTF8_LIB],
@@ -5909,14 +6431,14 @@ AC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[
# HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between
# ncurses/ncursesw:
if test "$cf_cv_utf8_lib" = "add-on" ; then
- AC_DEFINE(HAVE_LIBUTF8_H)
+ AC_DEFINE(HAVE_LIBUTF8_H,1,[Define to 1 if we should include libutf8.h])
CF_ADD_INCDIR($cf_cv_header_path_utf8)
CF_ADD_LIBDIR($cf_cv_library_path_utf8)
CF_ADD_LIBS($cf_cv_library_file_utf8)
fi
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_VA_COPY version: 2 updated: 2010/03/04 05:37:29
+dnl CF_VA_COPY version: 3 updated: 2012/10/06 11:17:15
dnl ----------
dnl check for va_copy, part of stdarg.h
dnl Also, workaround for glibc's __va_copy, by checking for both.
@@ -5931,7 +6453,7 @@ AC_TRY_LINK([
cf_cv_have_va_copy=yes,
cf_cv_have_va_copy=no)])
-test "$cf_cv_have_va_copy" = yes && AC_DEFINE(HAVE_VA_COPY)
+test "$cf_cv_have_va_copy" = yes && AC_DEFINE(HAVE_VA_COPY,1,[Define to 1 if we have va_copy])
AC_CACHE_CHECK(for __va_copy, cf_cv_have___va_copy,[
AC_TRY_LINK([
@@ -5943,7 +6465,7 @@ AC_TRY_LINK([
cf_cv_have___va_copy=yes,
cf_cv_have___va_copy=no)])
-test "$cf_cv_have___va_copy" = yes && AC_DEFINE(HAVE___VA_COPY)
+test "$cf_cv_have___va_copy" = yes && AC_DEFINE(HAVE___VA_COPY,1,[Define to 1 if we have __va_copy])
])
dnl ---------------------------------------------------------------------------
dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12
@@ -5954,7 +6476,7 @@ AC_DEFUN([CF_VERBOSE],
CF_MSG_LOG([$1])
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_WCHAR_TYPE version: 3 updated: 2010/05/26 16:44:57
+dnl CF_WCHAR_TYPE version: 4 updated: 2012/10/06 16:39:58
dnl -------------
dnl Check if type wide-character type $1 is declared, and if so, which header
dnl file is needed. The second parameter is used to set a shell variable when
@@ -5986,7 +6508,7 @@ AC_TRY_COMPILE([
[cf_cv_$1=unknown])])])
if test "$cf_cv_$1" = yes ; then
- AC_DEFINE(NEED_WCHAR_H)
+ AC_DEFINE(NEED_WCHAR_H,1,[Define to 1 if we must include wchar.h])
NEED_WCHAR_H=1
fi
@@ -6149,7 +6671,7 @@ if test "$with_dmalloc" = yes ; then
fi
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_WITH_GPM version: 7 updated: 2008/03/23 14:48:54
+dnl CF_WITH_GPM version: 8 updated: 2012/10/06 17:56:13
dnl -----------
dnl
dnl The option parameter (if neither yes/no) is assumed to be the name of
@@ -6165,10 +6687,10 @@ AC_MSG_RESULT($with_gpm)
if test "$with_gpm" != no ; then
AC_CHECK_HEADER(gpm.h,[
- AC_DEFINE(HAVE_GPM_H)
+ AC_DEFINE(HAVE_GPM_H,1,[Define to 1 if we have gpm.h header])
if test "$with_gpm" != yes && test "$with_gpm" != maybe ; then
CF_VERBOSE(assuming we really have GPM library)
- AC_DEFINE(HAVE_LIBGPM)
+ AC_DEFINE(HAVE_LIBGPM,1,[Define to 1 if we have the gpm library])
else
AC_CHECK_LIB(gpm,Gpm_Open,[:],[
AC_MSG_ERROR(Cannot link with GPM library)
@@ -6182,7 +6704,7 @@ if test "$with_gpm" != no ; then
fi
])
dnl ---------------------------------------------------------------------------
-dnl CF_WITH_LIBTOOL version: 26 updated: 2010/10/23 15:55:24
+dnl CF_WITH_LIBTOOL version: 30 updated: 2013/09/07 13:54:05
dnl ---------------
dnl Provide a configure option to incorporate libtool. Define several useful
dnl symbols for the makefile rules.
@@ -6252,13 +6774,20 @@ ifdef([AC_PROG_LIBTOOL],[
CF_PATH_SYNTAX(with_libtool)
LIBTOOL=$with_libtool
else
- AC_PATH_PROG(LIBTOOL,libtool)
+ AC_CHECK_TOOLS(LIBTOOL,[libtool glibtool],none)
+ CF_LIBTOOL_VERSION
+ if test -z "$cf_cv_libtool_version" && test "$LIBTOOL" = libtool
+ then
+ CF_FORGET_TOOL(LIBTOOL)
+ AC_CHECK_TOOLS(LIBTOOL,[glibtool],none)
+ CF_LIBTOOL_VERSION
+ fi
fi
if test -z "$LIBTOOL" ; then
AC_MSG_ERROR(Cannot find libtool)
fi
])dnl
- LIB_CREATE='${LIBTOOL} --mode=link ${CC} -rpath ${DESTDIR}${libdir} ${LIBTOOL_VERSION} `cut -f1 ${srcdir}/VERSION` ${LIBTOOL_OPTS} ${LT_UNDEF} -o'
+ LIB_CREATE='${LIBTOOL} --mode=link ${CC} -rpath ${DESTDIR}${libdir} ${LIBTOOL_VERSION} `cut -f1 ${srcdir}/VERSION` ${LIBTOOL_OPTS} ${LT_UNDEF} $(LIBS) -o'
LIB_OBJECT='${OBJECTS:.o=.lo}'
LIB_SUFFIX=.la
LIB_CLEAN='${LIBTOOL} --mode=clean'
@@ -6268,22 +6797,12 @@ ifdef([AC_PROG_LIBTOOL],[
LIB_UNINSTALL='${LIBTOOL} --mode=uninstall'
LIB_PREP=:
- # Show the version of libtool
- AC_MSG_CHECKING(version of libtool)
-
- # Save the version in a cache variable - this is not entirely a good
- # thing, but the version string from libtool is very ugly, and for
- # bug reports it might be useful to have the original string. "("
- cf_cv_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '/^$/d' |sed -e '2,$d' -e 's/([[^)]]*)//g' -e 's/^[[^1-9]]*//' -e 's/[[^0-9.]].*//'`
- AC_MSG_RESULT($cf_cv_libtool_version)
- if test -z "$cf_cv_libtool_version" ; then
- AC_MSG_ERROR(This is not GNU libtool)
- fi
+ CF_CHECK_LIBTOOL_VERSION
# special hack to add -no-undefined (which libtool should do for itself)
LT_UNDEF=
case "$cf_cv_system_name" in #(vi
- cygwin*|mingw32*|uwin*|aix[[456]]) #(vi
+ cygwin*|msys*|mingw32*|uwin*|aix[[4-7]]) #(vi
LT_UNDEF=-no-undefined
;;
esac
@@ -6323,7 +6842,33 @@ AC_SUBST(LIB_UNINSTALL)
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_WITH_PATH version: 10 updated: 2010/10/23 15:44:18
+dnl CF_WITH_LIB_PREFIX version: 1 updated: 2012/01/21 19:28:10
+dnl ------------------
+dnl Allow the library-prefix to be overridden. OS/2 EMX originally had no
+dnl "lib" prefix, e.g., because it used the dll naming convention.
+dnl
+dnl $1 = variable to set
+AC_DEFUN([CF_WITH_LIB_PREFIX],
+[
+AC_MSG_CHECKING(if you want to have a library-prefix)
+AC_ARG_WITH(lib-prefix,
+ [ --with-lib-prefix override library-prefix],
+ [with_lib_prefix=$withval],
+ [with_lib_prefix=auto])
+AC_MSG_RESULT($with_lib_prefix)
+
+if test $with_lib_prefix = auto
+then
+ CF_LIB_PREFIX($1)
+elif test $with_lib_prefix = no
+then
+ LIB_PREFIX=
+else
+ LIB_PREFIX=$with_lib_prefix
+fi
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_WITH_PATH version: 11 updated: 2012/09/29 15:04:19
dnl ------------
dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just
dnl defaulting to yes/no.
@@ -6340,11 +6885,11 @@ ifelse([$4],,[withval="${$3}"],[withval="${$3:-ifelse([$5],,[$4],[$5])}"]))dnl
if ifelse([$5],,true,[test -n "$5"]) ; then
CF_PATH_SYNTAX(withval)
fi
-$3="$withval"
+eval $3="$withval"
AC_SUBST($3)dnl
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_WITH_PATHLIST version: 7 updated: 2010/10/23 16:10:30
+dnl CF_WITH_PATHLIST version: 9 updated: 2012/10/18 05:05:24
dnl ----------------
dnl Process an option specifying a list of colon-separated paths.
dnl
@@ -6365,7 +6910,7 @@ cf_dst_path=
for cf_src_path in $withval
do
CF_PATH_SYNTAX(cf_src_path)
- test -n "$cf_dst_path" && cf_dst_path="${cf_dst_path}:"
+ test -n "$cf_dst_path" && cf_dst_path="${cf_dst_path}$PATH_SEPARATOR"
cf_dst_path="${cf_dst_path}${cf_src_path}"
done
IFS="$ac_save_ifs"
@@ -6381,12 +6926,65 @@ esac
cf_dst_path=`echo "$cf_dst_path" | sed -e 's/\\\\/\\\\\\\\/g'`
])
-eval '$3="$cf_dst_path"'
+# This may use the prefix/exec_prefix symbols which will only yield "NONE"
+# so we have to check/work around. We do prefer the result of "eval"...
+eval cf_dst_eval="$cf_dst_path"
+case "x$cf_dst_eval" in #(vi
+xNONE*) #(vi
+ $3=$cf_dst_path
+ ;;
+*)
+ $3="$cf_dst_eval"
+ ;;
+esac
AC_SUBST($3)dnl
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_WITH_PTHREAD version: 3 updated: 2010/05/29 16:31:02
+dnl CF_WITH_PKG_CONFIG_LIBDIR version: 2 updated: 2011/12/10 18:58:47
+dnl -------------------------
+dnl Allow the choice of the pkg-config library directory to be overridden.
+AC_DEFUN([CF_WITH_PKG_CONFIG_LIBDIR],[
+if test "$PKG_CONFIG" != none ; then
+ AC_MSG_CHECKING(for $PKG_CONFIG library directory)
+ AC_ARG_WITH(pkg-config-libdir,
+ [ --with-pkg-config-libdir=XXX use given directory for installing pc-files],
+ [PKG_CONFIG_LIBDIR=$withval],
+ [PKG_CONFIG_LIBDIR=yes])
+
+ case x$PKG_CONFIG_LIBDIR in #(vi
+ x/*) #(vi
+ ;;
+ xyes) #(vi
+ # look for the library directory using the same prefix as the executable
+ cf_path=`echo "$PKG_CONFIG" | sed -e 's,/[[^/]]*/[[^/]]*$,,'`
+ case x`(arch) 2>/dev/null` in #(vi
+ *64) #(vi
+ for cf_config in $cf_path/share $cf_path/lib64 $cf_path/lib32 $cf_path/lib
+ do
+ if test -d $cf_config/pkgconfig
+ then
+ PKG_CONFIG_LIBDIR=$cf_config/pkgconfig
+ break
+ fi
+ done
+ ;;
+ *)
+ PKG_CONFIG_LIBDIR=$cf_path/lib/pkgconfig
+ ;;
+ esac
+ ;;
+ *)
+ ;;
+ esac
+
+ AC_MSG_RESULT($PKG_CONFIG_LIBDIR)
+fi
+
+AC_SUBST(PKG_CONFIG_LIBDIR)
+])dnl
+dnl ---------------------------------------------------------------------------
+dnl CF_WITH_PTHREAD version: 6 updated: 2012/10/06 17:41:51
dnl ---------------
dnl Check for POSIX thread library.
AC_DEFUN([CF_WITH_PTHREAD],
@@ -6400,25 +6998,30 @@ AC_MSG_RESULT($with_pthread)
if test "$with_pthread" != no ; then
AC_CHECK_HEADER(pthread.h,[
- AC_DEFINE(HAVE_PTHREADS_H)
+ AC_DEFINE(HAVE_PTHREADS_H,1,[Define to 1 if we have pthreads.h header])
- AC_MSG_CHECKING(if we can link with the pthread library)
- cf_save_LIBS="$LIBS"
- CF_ADD_LIB(pthread)
- AC_TRY_LINK([
+ for cf_lib_pthread in pthread c_r
+ do
+ AC_MSG_CHECKING(if we can link with the $cf_lib_pthread library)
+ cf_save_LIBS="$LIBS"
+ CF_ADD_LIB($cf_lib_pthread)
+ AC_TRY_LINK([
#include
],[
- int rc = pthread_create(0,0,0,0);
+ int rc = pthread_create(0,0,0,0);
+ int r2 = pthread_mutexattr_settype(0, 0);
],[with_pthread=yes],[with_pthread=no])
- LIBS="$cf_save_LIBS"
- AC_MSG_RESULT($with_pthread)
+ LIBS="$cf_save_LIBS"
+ AC_MSG_RESULT($with_pthread)
+ test "$with_pthread" = yes && break
+ done
- if test "$with_pthread" = yes ; then
- CF_ADD_LIB(pthread)
- AC_DEFINE(HAVE_LIBPTHREADS)
- else
- AC_MSG_ERROR(Cannot link with pthread library)
- fi
+ if test "$with_pthread" = yes ; then
+ CF_ADD_LIB($cf_lib_pthread)
+ AC_DEFINE(HAVE_LIBPTHREADS,1,[Define to 1 if we have pthreads library])
+ else
+ AC_MSG_ERROR(Cannot link with pthread library)
+ fi
])
fi
])
@@ -6448,7 +7051,7 @@ ifelse($1,,[
])
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_WITH_SYSMOUSE version: 2 updated: 2003/03/22 19:13:43
+dnl CF_WITH_SYSMOUSE version: 3 updated: 2012/10/06 17:56:13
dnl ----------------
dnl If we can compile with sysmouse, make it available unless it is not wanted.
AC_DEFUN([CF_WITH_SYSMOUSE],[
@@ -6474,10 +7077,30 @@ AC_ARG_WITH(sysmouse,
],[cf_with_sysmouse=yes],[cf_with_sysmouse=no])
fi
AC_MSG_RESULT($cf_with_sysmouse)
-test "$cf_with_sysmouse" = yes && AC_DEFINE(USE_SYSMOUSE)
+test "$cf_with_sysmouse" = yes && AC_DEFINE(USE_SYSMOUSE,1,[Define to 1 if we can/should use the sysmouse interface])
fi
])dnl
dnl ---------------------------------------------------------------------------
+dnl CF_WITH_SYSTYPE version: 1 updated: 2013/01/26 16:26:12
+dnl ---------------
+dnl For testing, override the derived host system-type which is used to decide
+dnl things such as the linker commands used to build shared libraries. This is
+dnl normally chosen automatically based on the type of system which you are
+dnl building on. We use it for testing the configure script.
+dnl
+dnl This is different from the --host option: it is used only for testing parts
+dnl of the configure script which would not be reachable with --host since that
+dnl relies on the build environment being real, rather than mocked up.
+AC_DEFUN([CF_WITH_SYSTYPE],[
+CF_CHECK_CACHE([AC_CANONICAL_SYSTEM])
+AC_ARG_WITH(system-type,
+ [ --with-system-type=XXX test: override derived host system-type],
+[AC_MSG_WARN(overriding system type to $withval)
+ cf_cv_system_name=$withval
+ host_os=$withval
+])
+])dnl
+dnl ---------------------------------------------------------------------------
dnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21
dnl ----------------
AC_DEFUN([CF_WITH_VALGRIND],[
@@ -6486,7 +7109,7 @@ CF_NO_LEAKS_OPTION(valgrind,
[USE_VALGRIND])
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_XOPEN_SOURCE version: 35 updated: 2011/02/20 20:37:37
+dnl CF_XOPEN_SOURCE version: 46 updated: 2014/02/09 19:30:15
dnl ---------------
dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
dnl or adapt to the vendor's definitions to get equivalent functionality,
@@ -6496,16 +7119,17 @@ dnl Parameters:
dnl $1 is the nominal value for _XOPEN_SOURCE
dnl $2 is the nominal value for _POSIX_C_SOURCE
AC_DEFUN([CF_XOPEN_SOURCE],[
+AC_REQUIRE([AC_CANONICAL_HOST])
cf_XOPEN_SOURCE=ifelse([$1],,500,[$1])
cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2])
cf_xopen_source=
case $host_os in #(vi
-aix[[456]]*) #(vi
+aix[[4-7]]*) #(vi
cf_xopen_source="-D_ALL_SOURCE"
;;
-cygwin) #(vi
+cygwin|msys) #(vi
cf_XOPEN_SOURCE=600
;;
darwin[[0-8]].*) #(vi
@@ -6513,6 +7137,7 @@ darwin[[0-8]].*) #(vi
;;
darwin*) #(vi
cf_xopen_source="-D_DARWIN_C_SOURCE"
+ cf_XOPEN_SOURCE=
;;
freebsd*|dragonfly*) #(vi
# 5.x headers associate
@@ -6530,15 +7155,23 @@ hpux*) #(vi
;;
irix[[56]].*) #(vi
cf_xopen_source="-D_SGI_SOURCE"
+ cf_XOPEN_SOURCE=
;;
linux*|gnu*|mint*|k*bsd*-gnu) #(vi
CF_GNU_SOURCE
;;
mirbsd*) #(vi
- # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks
+ # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks and other headers which use u_int / u_short types
+ cf_XOPEN_SOURCE=
+ CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
;;
netbsd*) #(vi
- # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
+ cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
+ ;;
+openbsd[[4-9]]*) #(vi
+ # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw
+ cf_xopen_source="-D_BSD_SOURCE"
+ cf_XOPEN_SOURCE=600
;;
openbsd*) #(vi
# setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
@@ -6552,36 +7185,12 @@ nto-qnx*) #(vi
sco*) #(vi
# setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
;;
-solaris2.1[[0-9]]) #(vi
- cf_xopen_source="-D__EXTENSIONS__ -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
- ;;
-solaris2.[[1-9]]) #(vi
+solaris2.*) #(vi
cf_xopen_source="-D__EXTENSIONS__"
+ cf_cv_xopen_source=broken
;;
*)
- AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
- AC_TRY_COMPILE([#include ],[
-#ifndef _XOPEN_SOURCE
-make an error
-#endif],
- [cf_cv_xopen_source=no],
- [cf_save="$CPPFLAGS"
- CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
- AC_TRY_COMPILE([#include ],[
-#ifdef _XOPEN_SOURCE
-make an error
-#endif],
- [cf_cv_xopen_source=no],
- [cf_cv_xopen_source=$cf_XOPEN_SOURCE])
- CPPFLAGS="$cf_save"
- ])
-])
- if test "$cf_cv_xopen_source" != no ; then
- CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
- CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
- cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
- CF_ADD_CFLAGS($cf_temp_xopen_source)
- fi
+ CF_TRY_XOPEN_SOURCE
CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
;;
esac
@@ -6589,4 +7198,33 @@ esac
if test -n "$cf_xopen_source" ; then
CF_ADD_CFLAGS($cf_xopen_source)
fi
+
+dnl In anything but the default case, we may have system-specific setting
+dnl which is still not guaranteed to provide all of the entrypoints that
+dnl _XOPEN_SOURCE would yield.
+if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then
+ AC_MSG_CHECKING(if _XOPEN_SOURCE really is set)
+ AC_TRY_COMPILE([#include ],[
+#ifndef _XOPEN_SOURCE
+make an error
+#endif],
+ [cf_XOPEN_SOURCE_set=yes],
+ [cf_XOPEN_SOURCE_set=no])
+ AC_MSG_RESULT($cf_XOPEN_SOURCE_set)
+ if test $cf_XOPEN_SOURCE_set = yes
+ then
+ AC_TRY_COMPILE([#include ],[
+#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE
+make an error
+#endif],
+ [cf_XOPEN_SOURCE_set_ok=yes],
+ [cf_XOPEN_SOURCE_set_ok=no])
+ if test $cf_XOPEN_SOURCE_set_ok = no
+ then
+ AC_MSG_WARN(_XOPEN_SOURCE is lower than requested)
+ fi
+ else
+ CF_TRY_XOPEN_SOURCE
+ fi
+fi
])
diff --git a/contrib/ncurses/announce.html.in b/contrib/ncurses/announce.html.in
index e385204de503..a07dc0573325 100644
--- a/contrib/ncurses/announce.html.in
+++ b/contrib/ncurses/announce.html.in
@@ -1,8 +1,7 @@
-
+
+ "HTML Tidy for Linux (vers 25 March 2009), see www.w3.org">
Announcing ncurses @VERSION@
@@ -42,12 +42,13 @@
-
Announcing ncurses @VERSION@
The ncurses (new curses)
- library is a free software emulation of curses in System V
- Release 4.0, and more. It uses terminfo format, supports pads and
- color and multiple highlights and forms characters and
- function-key mapping, and has all the other SYSV-curses
- enhancements over BSD curses.
+
Announcing ncurses @VERSION@
+
+
The ncurses (new curses) library is a free software emulation
+ of curses in System V Release 4.0, and more. It uses terminfo
+ format, supports pads and color and multiple highlights and forms
+ characters and function-key mapping, and has all the other
+ SYSV-curses enhancements over BSD curses.
In mid-June 1995, the maintainer of 4.4BSD curses declared
that he considered 4.4BSD curses obsolete, and encouraged the
@@ -73,38 +74,50 @@
It is also available at ftp://invisible-island.net/ncurses/ .
-
Release Notes
This release is designed to be upward
- compatible from ncurses 5.0 through 5.8; very few applications
- will require recompilation, depending on the platform. These are
- the highlights from the change-log since ncurses 5.8 release.
-
- This is a bug-fix release, correcting a small number of urgent problems
- in the ncurses library from the 5.8 release.
-
- It also improves the Ada95 binding:
+
Release Notes
+
+
This release is designed to be upward compatible from ncurses
+ 5.0 through 5.8; very few applications will require
+ recompilation, depending on the platform. These are the
+ highlights from the change-log since ncurses 5.8 release.
+
+
This is a bug-fix release, correcting a small number of urgent
+ problems in the ncurses library from the 5.8 release.
+
+
It also improves the Ada95 binding:
+
-
fixes a longstanding portability problem with its use of the
- set_field_type
- function. Because that function uses variable-length argument lists,
- its interface with gnat does not work with certain platforms.
-
improves configurability and portability, particularly when built
- separately from the main ncurses tree. The 5.8 release introduced
- scripts which can be used to construct separate tarballs for the
- Ada95 and ncurses examples.
-
Those were a proof of concept. For the 5.9 release, those
- scripts are augmented with rpm- and dpkg-scripts used in test builds
- against a variety of gnat- and system ncurses versions as old as
- gnat 3.15 and ncurses 5.4 (see snapshots and systems tested
- here.
-
additional improvements were made for portability of the
- ncurses examples, adding rpm- and dpkg-scripts for test-builds.
- See
- this page
- for snapshots and other information.
+
fixes a longstanding portability problem with its use of
+ the set_field_type
+ function. Because that function uses variable-length argument
+ lists, its interface with gnat does not work with certain
+ platforms.
+
+
improves configurability and portability, particularly when
+ built separately from the main ncurses tree. The 5.8 release
+ introduced scripts which can be used to construct separate
+ tarballs for the Ada95 and ncurses examples.
+
+
Those were a proof of concept. For the 5.9 release, those
+ scripts are augmented with rpm- and dpkg-scripts used in test
+ builds against a variety of gnat- and system ncurses versions
+ as old as gnat 3.15 and ncurses 5.4 (see snapshots and
+ systems tested here.
+
+
+
additional improvements were made for portability of the
+ ncurses examples, adding rpm- and dpkg-scripts for test-builds.
+ See this
+ page for snapshots and other information.
-
Features of Ncurses
The ncurses package is fully
- compatible with SVr4 (System V Release 4) curses:
+
Features of Ncurses
+
+
The ncurses package is fully compatible with SVr4 (System V
+ Release 4) curses:
All 257 of the SVr4 calls have been implemented (and are
@@ -132,8 +145,10 @@
entries for use with less capable
curses/terminfo versions such
as the HP/UX and AIX ports.
-
The ncurses package also has many useful extensions over
- SVr4:
+
+
+
The ncurses package also has many useful extensions over
+ SVr4:
The API is 8-bit clean and base-level conformant with the
@@ -249,12 +264,14 @@
interface.
-
State of the Package
Numerous bugs present in earlier
- versions have been fixed; the library is far more reliable than
- it used to be. Bounds checking in many `dangerous' entry points
- has been improved. The code is now type-safe according to gcc
- -Wall. The library has been checked for malloc leaks and arena
- corruption by the Purify memory-allocation tester.
+
State of the Package
+
+
Numerous bugs present in earlier versions have been fixed; the
+ library is far more reliable than it used to be. Bounds checking
+ in many `dangerous' entry points has been improved. The code is
+ now type-safe according to gcc -Wall. The library has been
+ checked for malloc leaks and arena corruption by the Purify
+ memory-allocation tester.
The ncurses code has been tested with a wide variety of
applications including (versions starting with those noted):
- as well as some that use ncurses for the terminfo support
- alone:
+
+
+
as well as some that use ncurses for the terminfo support
+ alone:
minicom
@@ -341,15 +360,17 @@
The ncurses distribution includes a selection of test programs
(including a few games).
-
Who's Who and What's What
Zeyd Ben-Halim started it from
- a previous package pcurses, written by Pavel Curtis. Eric S.
- Raymond continued development. Jürgen Pfeifer wrote most of
- the form and menu libraries. Ongoing work is being done by
- Thomas Dickey.
- Thomas Dickey acts as the maintainer for the Free Software
- Foundation, which holds the copyright on ncurses. Contact the
- current maintainers at bug-ncurses@gnu.org.
+
Who's Who and What's What
+
+
Zeyd Ben-Halim started it from a previous package pcurses,
+ written by Pavel Curtis. Eric S. Raymond continued development.
+ Jürgen Pfeifer wrote most of the form and menu libraries.
+ Ongoing work is being done by Thomas Dickey. Thomas
+ Dickey acts as the maintainer for the Free Software Foundation,
+ which holds the copyright on ncurses. Contact the current
+ maintainers at bug-ncurses@gnu.org.
To join the ncurses mailing list, please write email to
bug-ncurses-request@gnu.org containing the line:
The license has been changed to the
-MIT-style license used by NCURSES. Note that the programs are also
-re-licensed under this.
-
-
-
Revision 1.8
-
2005-06-17
-
Revised by: ppadala
-
-
-
Lots of updates. Added references and
-perl examples. Changes to examples. Many grammatical and stylistic
-changes to the content. Changes to NCURSES history.
-
-
-
Revision 1.7.1
-
2002-06-25
-
Revised by: ppadala
-
-
-
Added a README file for building and
-instructions for building from source.
-
-
-
Revision 1.7
-
2002-06-25
-
Revised by: ppadala
-
-
-
Added "Other formats" section and made
-a lot of fancy changes to the programs. Inlining of programs is
-gone.
-
-
-
Revision 1.6.1
-
2002-02-24
-
Revised by: ppadala
-
-
-
Removed the old Changelog section,
-cleaned the makefiles
-
-
-
Revision 1.6
-
2002-02-16
-
Revised by: ppadala
-
-
-
Corrected a lot of spelling mistakes,
-added ACS variables section
-
-
-
Revision 1.5
-
2002-01-05
-
Revised by: ppadala
-
-
-
Changed structure to present proper
-TOC
-
-
-
Revision 1.3.1
-
2001-07-26
-
Revised by: ppadala
-
-
-
Corrected maintainers paragraph,
-Corrected stable release number
-
-
-
Revision 1.3
-
2001-07-24
-
Revised by: ppadala
-
-
-
Added copyright notices to main
-document (LDP license) and programs (GPL), Corrected
-printw_example.
-
-
-
Revision 1.2
-
2001-06-05
-
Revised by: ppadala
-
-
-
Incorporated ravi's changes. Mainly to
-introduction, menu, form, justforfun sections
-
-
-
Revision 1.1
-
2001-05-22
-
Revised by: ppadala
-
-
-
Added "a word about window" section,
-Added scanw_example.
-
-
-
-
-
-
This document is intended to be an "All in One" guide for
-programming with ncurses and its sister libraries. We graduate from
-a simple "Hello World" program to more complex form manipulation.
-No prior experience in ncurses is assumed. Send comments to
-this
-address
In the olden days of teletype terminals, terminals were away
-from computers and were connected to them through serial cables.
-The terminals could be configured by sending a series of bytes. All
-the capabilities (such as moving the cursor to a new location,
-erasing part of the screen, scrolling the screen, changing modes
-etc.) of terminals could be accessed through these series of bytes.
-These control seeuqnces are usually called escape sequences,
-because they start with an escape(0x1B) character. Even today, with
-proper emulation, we can send escape sequences to the emulator and
-achieve the same effect on a terminal window.
-
Suppose you wanted to print a line in color. Try typing this on
-your console.
-
-
-
-
-echo "^[[0;31;40mIn Color"
-
-
-
-
The first character is an escape character, which looks like two
-characters ^ and [. To be able to print it, you have to press
-CTRL+V and then the ESC key. All the others are normal printable
-characters. You should be able to see the string "In Color" in red.
-It stays that way and to revert back to the original mode type
-this.
-
-
-
-
-echo "^[[0;37;40m"
-
-
-
-
Now, what do these magic characters mean? Difficult to
-comprehend? They might even be different for different terminals.
-So the designers of UNIX invented a mechanism named termcap. It is a file that lists all the
-capabilities of a particular terminal, along with the escape
-sequences needed to achieve a particular effect. In the later
-years, this was replaced by terminfo.
-Without delving too much into details, this mechanism allows
-application programs to query the terminfo database and obtain the
-control characters to be sent to a terminal or terminal
-emulator.
You might be wondering, what the import of all this technical
-gibberish is. In the above scenario, every application program is
-supposed to query the terminfo and perform the necessary stuff
-(sending control characters etc.). It soon became difficult to
-manage this complexity and this gave birth to 'CURSES'. Curses is a
-pun on the name "cursor optimization". The Curses library forms a
-wrapper over working with raw terminal codes, and provides highly
-flexible and efficient API (Application Programming Interface). It
-provides functions to move the cursor, create windows, produce
-colors, play with mouse etc. The application programs need not
-worry about the underlying terminal capabilities.
-
So what is NCURSES? NCURSES is a clone of the original System V
-Release 4.0 (SVr4) curses. It is a freely distributable library,
-fully compatible with older version of curses. In short, it is a
-library of functions that manages an application's display on
-character-cell terminals. In the remainder of the document, the
-terms curses and ncurses are used interchangeably.
-
A detailed history of NCURSES can be found in the NEWS file from
-the source distribution. The current package is maintained by
-Thomas Dickey.
-You can contact the maintainers at bug-ncurses@gnu.org.
NCURSES not only creates a wrapper over terminal capabilities,
-but also gives a robust framework to create nice looking UI (User
-Interface)s in text mode. It provides functions to create windows
-etc. Its sister libraries panel, menu and form provide an extension
-to the basic curses library. These libraries usually come along
-with curses. One can create applications that contain multiple
-windows, menus, panels and forms. Windows can be managed
-independently, can provide 'scrollability' and even can be
-hidden.
-
Menus provide the user with an easy command selection option.
-Forms allow the creation of easy-to-use data entry and display
-windows. Panels extend the capabilities of ncurses to deal with
-overlapping and stacked windows.
-
These are just some of the basic things we can do with ncurses.
-As we move along, We will see all the capabilities of these
-libraries.
All right, now that you know what you can do with ncurses, you
-must be rearing to get started. NCURSES is usually shipped with
-your installation. In case you don't have the library or want to
-compile it on your own, read on.
The license has been changed to the MIT-style license used
+ by NCURSES. Note that the programs are also re-licensed under this.
Revision 1.8
2005-06-17
Revised by: ppadala
Lots of updates. Added references and perl examples.
+ Changes to examples. Many grammatical and stylistic changes to the
+ content. Changes to NCURSES history.
Revision 1.7.1
2002-06-25
Revised by: ppadala
Added a README file for building and instructions
+ for building from source.
Revision 1.7
2002-06-25
Revised by: ppadala
Added "Other formats" section and made a lot of fancy
+ changes to the programs. Inlining of programs is gone.
Revision 1.6.1
2002-02-24
Revised by: ppadala
Removed the old Changelog section, cleaned the makefiles
Revision 1.6
2002-02-16
Revised by: ppadala
Corrected a lot of spelling mistakes, added ACS variables
+ section
Revision 1.5
2002-01-05
Revised by: ppadala
Changed structure to present proper TOC
Revision 1.3.1
2001-07-26
Revised by: ppadala
Corrected maintainers paragraph, Corrected stable release number
Revision 1.3
2001-07-24
Revised by: ppadala
Added copyright notices to main document (LDP license)
+ and programs (GPL), Corrected
+ printw_example.
Added "a word about window" section, Added scanw_example.
This document is intended to be an "All in One" guide for programming with
+ncurses and its sister libraries. We graduate from a simple "Hello World"
+program to more complex form manipulation. No prior experience in ncurses is
+assumed. Send comments to this address
+
+
In the olden days of teletype terminals, terminals were away from computers and
+were connected to them through serial cables. The terminals could be configured
+by sending a series of bytes. All the capabilities (such as
+moving the cursor to a new location, erasing part of the screen, scrolling the
+screen, changing modes etc.) of terminals could be accessed through these
+series of bytes. These control seeuqnces are usually called escape sequences,
+because they start
+with an escape(0x1B) character. Even today, with proper emulation, we can send
+escape sequences to the emulator and achieve the same effect on a terminal
+window.
Suppose you wanted to print a line in color. Try typing this on your console.
echo "^[[0;31;40mIn Color"
The first character is an escape character, which looks like two characters ^
+and [. To be able to print it, you have to press CTRL+V and then the ESC key.
+All the others are normal printable characters. You should be able to see the
+string "In Color" in red. It stays that way and to revert back to the original
+mode type this.
echo "^[[0;37;40m"
Now, what do these magic characters mean? Difficult to comprehend? They might
+even be different for different terminals. So the designers of UNIX invented a
+mechanism named termcap. It is a file that
+lists all the capabilities of a particular terminal, along with the escape
+sequences needed to achieve a particular effect. In the later years, this was
+replaced by terminfo. Without delving too
+much into details, this mechanism allows application
+programs to query the terminfo database and obtain the control characters to be
+sent to a terminal or terminal emulator.
+You might be wondering, what the import of all this technical gibberish is. In
+the above scenario, every application program is supposed to query the terminfo
+and perform the necessary stuff (sending control characters etc.). It soon became
+difficult to manage this complexity and this gave birth to 'CURSES'. Curses is
+a pun on the name "cursor optimization". The Curses library forms a wrapper
+over working with raw terminal codes, and provides highly flexible and
+efficient API (Application Programming Interface). It provides functions to
+move the cursor, create windows, produce colors, play with mouse etc. The
+application programs need not worry about the underlying terminal capabilities.
So what is NCURSES? NCURSES is a clone of the original System V Release 4.0
+(SVr4) curses. It is a freely distributable library, fully compatible with
+older version of curses. In short, it is a library of functions that manages
+an application's display on character-cell terminals. In the remainder of the
+document, the terms curses and ncurses are used interchangeably.
A detailed history of NCURSES can be found in the NEWS file from the source
+distribution. The current package is maintained by
+Thomas Dickey.
+You can contact the maintainers at bug-ncurses@gnu.org.
NCURSES not only creates a wrapper over terminal capabilities, but also gives a
+robust framework to create nice looking UI (User Interface)s in text mode. It
+provides functions to create windows etc. Its sister libraries panel, menu and
+form provide an extension to the basic curses library. These libraries usually
+come along with curses. One can create applications that contain multiple
+windows, menus, panels and forms. Windows can be managed independently, can
+provide 'scrollability' and even can be hidden.
+Menus provide the user with an easy command selection option. Forms allow the
+creation of easy-to-use data entry and display windows. Panels extend the
+capabilities of ncurses to deal with overlapping and stacked windows.
These are just some of the basic things we can do with ncurses. As we move
+along, We will see all the capabilities of these libraries.
All right, now that you know what you can do with ncurses, you must be rearing
+to get started. NCURSES is usually shipped with your installation. In case
+you don't have the library or want to compile it on your own, read on.
Read the README and INSTALL files for details on to how to install it. It
+usually involves the following operations.
tar zxvf ncurses<version>.tar.gz # unzip and untar the archive
cd ncurses<version> # cd to the directory
./configure # configure the build according to your
# environment
make # make it
su root # become root
- make install # install it
-
-
-
-
Using the RPM
-
NCURSES RPM can be found and downloaded from http://rpmfind.net . The RPM
-can be installed with the following command after becoming
-root.
This document is intended to be a "All in One" guide for
-programming with ncurses and its sister libraries. We graduate from
-a simple "Hello World" program to more complex form manipulation.
-No prior experience in ncurses is assumed. The writing is informal,
-but a lot of detail is provided for each of the examples.
This document is intended to be a "All in One" guide for programming with
+ncurses and its sister libraries. We graduate from a simple "Hello World"
+program to more complex form manipulation. No prior experience in ncurses is
+assumed. The writing is informal, but a lot of detail is provided for
+each of the examples.
All the programs in the document are available in zipped form
+here. Unzip and untar it. The directory structure looks like this.
ncurses
|
|----> JustForFun -- just for fun programs
|----> basics -- basic programs
@@ -524,16 +1290,12 @@ looks like this.
| by Anuradha Ratnaweera)
|----> Makefile -- the top level Makefile
|----> README -- the top level README file. contains instructions
- |----> COPYING -- copyright notice
-
-
-
-
The individual directories contain the following files.
-
-
-
-
-Description of files in each directory
+ |----> COPYING -- copyright notice
The individual directories contain the following files.
Description of files in each directory
--------------------------------------
JustForFun
|
@@ -592,73 +1354,96 @@ JustForFun
|----> panel_simple.c -- A simple panel example
perl
- |----> 01-10.pl -- Perl equivalents of first ten example programs
-
-
-
-
There is a top level Makefile included in the main directory. It
-builds all the files and puts the ready-to-use exes in demo/exe
-directory. You can also do selective make by going into the
-corresponding directory. Each directory contains a README file
-explaining the purpose of each c file in the directory.
-
For every example, I have included path name for the file
-relative to the examples directory.
All the programs are released under the same license that is
-used by ncurses (MIT-style). This gives you the ability to do
-pretty much anything other than claiming them as yours. Feel free
-to use them in your programs as appropriate.
If above links are broken or if you want to experiment with sgml
-read on.
-
-
-
-
-
Get both the source and the tar,gzipped programs, available at
+ |----> 01-10.pl -- Perl equivalents of first ten example programs
There is a top level Makefile included in the main directory. It builds all the
+files and puts the ready-to-use exes in demo/exe directory. You can also
+do selective make by going into the corresponding directory. Each directory
+contains a README file explaining the purpose of each c file in the directory.
For every example, I have included path name for the file relative to the
+examples directory.
All the programs are released under the same license that is used by ncurses
+(MIT-style). This gives you the ability to do pretty much anything other than
+claiming them as yours. Feel free to use them in your programs as appropriate.
If above links are broken or if you want to experiment with sgml read on.
+
Get both the source and the tar,gzipped programs, available at
http://cvsview.tldp.org/index.cgi/LDP/howto/docbook/
NCURSES-HOWTO/NCURSES-Programming-HOWTO.sgml
http://cvsview.tldp.org/index.cgi/LDP/howto/docbook/
@@ -679,588 +1464,862 @@ read on.
NCURSES-ONE-BIG-FILE.html
for ps, you would use
htmldoc --size universal -t ps --firstpage p1 -f <output file name.ps>
- NCURSES-ONE-BIG-FILE.html
-
I thank Sharath and Emre Akbas for helping me with few sections.
-The introduction was initially written by sharath. I rewrote it
-with few excerpts taken from his initial work. Emre helped in
-writing printw and scanw sections.
-
Perl equivalents of the example programs are contributed by
-Anuradha
-Ratnaweera.
-
Then comes Ravi Parimi, my dearest friend, who has been on this
-project before even one line was written. He constantly bombarded
-me with suggestions and patiently reviewed the whole text. He also
-checked each program on Linux and Solaris.
This is the wish list, in the order of priority. If you have a
-wish or you want to work on completing the wish, mail me.
-
-
-
Add examples to last parts of forms section.
-
-
-
Prepare a Demo showing all the programs and allow the user to
-browse through description of each program. Let the user compile
-and see the program in action. A dialog based interface is
-preferred.
-
-
-
Add debug info. _tracef, _tracemouse stuff.
-
-
-
Accessing termcap, terminfo using functions provided by ncurses
-package.
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.
Welcome to the world of curses. Before we plunge into the
-library and look into its various features, let's write a simple
-program and say hello to the world.
To use ncurses library functions, you have to include ncurses.h
-in your programs. To link the program with ncurses the flag
--lncurses should be added.
I thank Sharath and Emre Akbas for
+helping me with few sections. The introduction was initially written by sharath.
+I rewrote it with few excerpts taken from his initial work. Emre helped in
+writing printw and scanw sections.
Perl equivalents of the example programs are contributed by Anuradha Ratnaweera.
Then comes Ravi Parimi, my
+dearest friend, who has been on this project before even one line was written.
+He constantly bombarded me with suggestions and patiently reviewed the whole
+text. He also checked each program on Linux and Solaris.
This is the wish list, in the order of priority. If you have a wish or you want
+to work on completing the wish, mail me.
Add examples to last parts of forms section.
Prepare a Demo showing all the programs and allow the user to browse through
+description of each program. Let the user compile and see the program in action.
+A dialog based interface is preferred.
Add debug info. _tracef, _tracemouse stuff.
Accessing termcap, terminfo using functions provided by ncurses
+package.
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.
Welcome to the world of curses. Before we plunge into the library and look into
+its various features, let's write a simple program and say
+hello to the world.
To use ncurses library functions, you have to include ncurses.h in your
+programs. To link the
+program with ncurses the flag -lncurses should be added.
-#include <ncurses.h>
+ compile and link: gcc <program file> -lncurses
Example 1. The Hello World !!! Program
#include <ncurses.h>
int main()
-{
- initscr(); /* Start curses mode */
- printw("Hello World !!!"); /* Print Hello World */
- refresh(); /* Print it on to the real screen */
- getch(); /* Wait for user input */
- endwin(); /* End curses mode */
+{
+ initscr(); /* Start curses mode */
+ printw("Hello World !!!"); /* Print Hello World */
+ refresh(); /* Print it on to the real screen */
+ getch(); /* Wait for user input */
+ endwin(); /* End curses mode */
- return 0;
-}
-
The above program prints "Hello World !!!" to the screen and
-exits. This program shows how to initialize curses and do screen
-manipulation and end curses mode. Let's dissect it line by
-line.
The function initscr() initializes the terminal in curses mode.
-In some implementations, it clears the screen and presents a blank
-screen. To do any screen manipulation using curses package this has
-to be called first. This function initializes the curses system and
-allocates memory for our present window (called stdscr) and some other data-structures. Under
-extreme cases this function might fail due to insufficient memory
-to allocate memory for curses library's data structures.
-
After this is done, we can do a variety of initializations to
-customize our curses settings. These details will be explained
-later .
The next line printw prints the string "Hello World !!!" on to
-the screen. This function is analogous to normal printf in all
-respects except that it prints the data on a window called stdscr
-at the current (y,x) co-ordinates. Since our present co-ordinates
-are at 0,0 the string is printed at the left hand corner of the
-window.
-
This brings us to that mysterious refresh(). Well, when we
-called printw the data is actually written to an imaginary window,
-which is not updated on the screen yet. The job of printw is to
-update a few flags and data structures and write the data to a
-buffer corresponding to stdscr. In order to show it on the screen,
-we need to call refresh() and tell the curses system to dump the
-contents on the screen.
-
The philosophy behind all this is to allow the programmer to do
-multiple updates on the imaginary screen or windows and do a
-refresh once all his screen update is done. refresh() checks the
-window and updates only the portion which has been changed. This
-improves performance and offers greater flexibility too. But, it is
-sometimes frustrating to beginners. A common mistake committed by
-beginners is to forget to call refresh() after they did some update
-through printw() class of functions. I still forget to add it
-sometimes :-)
And finally don't forget to end the curses mode. Otherwise your
-terminal might behave strangely after the program quits. endwin()
-frees the memory taken by curses sub-system and its data structures
-and puts the terminal in normal mode. This function must be called
-after you are done with the curses mode.
Now that we have seen how to write a simple curses program let's
-get into the details. There are many functions that help customize
-what you see on screen and many features which can be put to full
-use.
We now know that to initialize curses system the function
-initscr() has to be called. There are functions which can be called
-after this initialization to customize our curses session. We may
-ask the curses system to set the terminal in raw mode or initialize
-color or initialize the mouse etc.. Let's discuss some of the
-functions that are normally called immediately after initscr();
Normally the terminal driver buffers the characters a user types
-until a new line or carriage return is encountered. But most
-programs require that the characters be available as soon as the
-user types them. The above two functions are used to disable line
-buffering. The difference between these two functions is in the way
-control characters like suspend (CTRL-Z), interrupt and quit
-(CTRL-C) are passed to the program. In the raw() mode these
-characters are directly passed to the program without generating a
-signal. In the cbreak() mode these
-control characters are interpreted as any other character by the
-terminal driver. I personally prefer to use raw() as I can exercise
-greater control over what the user does.
These functions control the echoing of characters typed by the
-user to the terminal. noecho() switches
-off echoing. The reason you might want to do this is to gain more
-control over echoing or to suppress unnecessary echoing while
-taking input from the user through the getch() etc. functions. Most
-of the interactive programs call noecho() at initialization and do the echoing of
-characters in a controlled manner. It gives the programmer the
-flexibility of echoing characters at any place in the window
-without updating current (y,x) co-ordinates.
This is my favorite initialization function. It enables the
-reading of function keys like F1, F2, arrow keys etc. Almost every
-interactive program enables this, as arrow keys are a major part of
-any User Interface. Do keypad(stdscr,
-TRUE) to enable this feature for the regular screen (stdscr).
-You will learn more about key management in later sections of this
-document.
This function, though not used very often, is a useful one at
-times. halfdelay()is called to enable the half-delay mode, which is
-similar to the cbreak() mode in that characters typed are
-immediately available to program. However, it waits for 'X' tenths
-of a second for input and then returns ERR, if no input is
-available. 'X' is the timeout value passed to the function
-halfdelay(). This function is useful when you want to ask the user
-for input, and if he doesn't respond with in certain time, we can
-do some thing else. One possible example is a timeout at the
-password prompt.
There are few more functions which are called at initialization
-to customize curses behavior. They are not used as extensively as
-those mentioned above. Some of them are explained where
-appropriate.
+The above program prints "Hello World !!!" to the screen and exits. This
+program shows how to initialize curses and do screen manipulation and
+end curses mode. Let's dissect it line by line.
The function initscr() initializes the terminal in curses mode. In some
+implementations, it clears the screen and presents a blank screen. To do any
+screen manipulation using curses package this has to be called first. This
+function initializes the curses system and allocates memory for our present
+window (called stdscr) and some other data-structures. Under extreme
+cases this function might fail due to insufficient memory to allocate memory
+for curses library's data structures.
+After this is done, we can do a variety of initializations to customize
+our curses settings. These details will be explained later .
The next line printw prints the string "Hello World !!!" on to the screen. This
+function is analogous to normal printf in all respects except that it prints
+the data on a window called stdscr at the current (y,x) co-ordinates. Since our
+present co-ordinates are at 0,0 the string is printed at the left hand corner
+of the window.
This brings us to that mysterious refresh(). Well, when we called printw
+the data is actually written to an imaginary window, which is not updated
+on the screen yet. The job of printw is to update a few flags
+and data structures and write the data to a buffer corresponding to stdscr.
+In order to show it on the screen, we need to call refresh() and tell the
+curses system to dump the contents on the screen.
The philosophy behind all this is to allow the programmer to do multiple updates
+on the imaginary screen or windows and do a refresh once all his screen update
+is done. refresh() checks the window and updates only the portion which has been
+changed. This improves performance and offers greater flexibility too. But, it is
+sometimes frustrating to beginners. A common mistake committed by beginners is
+to forget to call refresh() after they did some update through printw() class of
+functions. I still forget to add it sometimes :-)
And finally don't forget to end the curses mode. Otherwise your terminal might
+behave strangely after the program quits. endwin() frees the memory taken by
+curses sub-system and its data structures and puts the terminal in normal
+mode. This function must be called after you are done with the curses mode.
Now that we have seen how to write a simple curses program let's get into the
+details. There are many functions that help customize what you see on screen and
+many features which can be put to full use.
We now know that to initialize curses system the function initscr() has to be
+called. There are functions which can be called after this initialization to
+customize our curses session. We may ask the curses system to set the terminal
+in raw mode or initialize color or initialize the mouse etc.. Let's discuss some
+of the functions that are normally called immediately after initscr();
Normally the terminal driver buffers the characters a user types until a new
+line or carriage return is encountered. But most programs require that the
+characters be available as soon as the user types them. The above two functions
+are used to disable line buffering. The difference between these two functions
+is in the way control characters like suspend (CTRL-Z), interrupt and quit
+(CTRL-C) are passed to the program. In the raw() mode these characters are
+directly passed to the program without generating a signal. In the
+cbreak() mode these control characters are
+interpreted as any other character by the terminal driver. I personally prefer
+to use raw() as I can exercise greater control over what the user does.
+These functions control the echoing of characters typed by the user to the
+terminal. noecho() switches off echoing. The
+reason you might want to do this is to gain more control over echoing or to
+suppress unnecessary echoing while taking input from the user through the
+getch() etc. functions. Most of the interactive programs call
+noecho() at initialization and do the echoing
+of characters in a controlled manner. It gives the programmer the flexibility
+of echoing characters at any place in the window without updating current (y,x)
+co-ordinates.
This is my favorite initialization function. It enables the reading of function
+keys like F1, F2, arrow keys etc. Almost every interactive program enables this,
+as arrow keys are a major part of any User Interface. Do
+keypad(stdscr, TRUE) to enable this feature
+for the regular screen (stdscr). You will learn more about key management in
+later sections of this document.
This function, though not used very often, is a useful one at times.
+halfdelay()is called to enable the half-delay mode, which is similar to the
+cbreak() mode in that characters typed are immediately available to program.
+However, it waits for 'X' tenths of a second for input and then returns ERR, if
+no input is available. 'X' is the timeout value passed to the function
+halfdelay(). This function is useful when you want to ask the user for input,
+and if he doesn't respond with in certain time, we can do some thing else. One
+possible example is a timeout at the password prompt.
There are few more functions which are called at initialization to
+customize curses behavior. They are not used as extensively as those mentioned
+above. Some of them are explained where appropriate.
Let's write a program which will clarify the usage of these functions.
Example 2. Initialization Function Usage example
#include <ncurses.h>
int main()
-{ int ch;
+{ int ch;
- initscr(); /* Start curses mode */
- raw(); /* Line buffering disabled */
- keypad(stdscr, TRUE); /* We get F1, F2 etc.. */
- noecho(); /* Don't echo() while we do getch */
+ initscr(); /* Start curses mode */
+ raw(); /* Line buffering disabled */
+ keypad(stdscr, TRUE); /* We get F1, F2 etc.. */
+ noecho(); /* Don't echo() while we do getch */
- printw("Type any character to see it in bold\n");
- ch = getch(); /* If raw() hadn't been called
- * we have to press enter before it
- * gets to the program */
- if(ch == KEY_F(1)) /* Without keypad enabled this will */
- printw("F1 Key pressed");/* not get to us either */
- /* Without noecho() some ugly escape
- * charachters might have been printed
- * on screen */
- else
- { printw("The pressed key is ");
- attron(A_BOLD);
- printw("%c", ch);
- attroff(A_BOLD);
- }
- refresh(); /* Print it on to the real screen */
- getch(); /* Wait for user input */
- endwin(); /* End curses mode */
+ printw("Type any character to see it in bold\n");
+ ch = getch(); /* If raw() hadn't been called
+ * we have to press enter before it
+ * gets to the program */
+ if(ch == KEY_F(1)) /* Without keypad enabled this will */
+ printw("F1 Key pressed");/* not get to us either */
+ /* Without noecho() some ugly escape
+ * charachters might have been printed
+ * on screen */
+ else
+ { printw("The pressed key is ");
+ attron(A_BOLD);
+ printw("%c", ch);
+ attroff(A_BOLD);
+ }
+ refresh(); /* Print it on to the real screen */
+ getch(); /* Wait for user input */
+ endwin(); /* End curses mode */
- return 0;
-}
-
-
-
-
-
This program is self-explanatory. But I used functions which
-aren't explained yet. The function getch() is used to get a character from user. It is
-equivalent to normal getchar() except
-that we can disable the line buffering to avoid <enter> after
-input. Look for more about getch()and
-reading keys in the key management section .
-The functions attron and attroff are used to switch some attributes
-on and off respectively. In the example I used them to print the
-character in bold. These functions are explained in detail
-later.
Before we plunge into the myriad ncurses functions, let me clear
-few things about windows. Windows are explained in detail in
-following sections
-
A Window is an imaginary screen defined by curses system. A
-window does not mean a bordered window which you usually see on
-Win9X platforms. When curses is initialized, it creates a default
-window named stdscr which represents
-your 80x25 (or the size of window in which you are running) screen.
-If you are doing simple tasks like printing few strings, reading
-input etc., you can safely use this single window for all of your
-purposes. You can also create windows and call functions which
-explicitly work on the specified window.
-
For example, if you call
-
-
-
-
- printw("Hi There !!!");
- refresh();
-
-
-
-
It prints the string on stdscr at the present cursor position.
-Similarly the call to refresh(), works on stdscr only.
-
Say you have created windows then you
-have to call a function with a 'w' added to the usual function.
-
-
-
-
- wprintw(win, "Hi There !!!");
- wrefresh(win);
-
-
-
-
As you will see in the rest of the document, naming of functions
-follow the same convention. For each function there usually are
-three more functions.
-
-
-
-
- printw(string); /* Print on stdscr at present cursor position */
+ return 0;
+}
This program is self-explanatory. But I used functions which aren't explained
+yet. The function getch() is used to get a
+character from user. It is equivalent to normal
+getchar() except that we can disable the line
+buffering to avoid <enter> after input. Look for more about
+getch()and reading keys in the key management section . The functions attron and attroff
+are used to switch some attributes on and off respectively. In the example I
+used them to print the character in bold. These functions are explained in detail
+later.
+Before we plunge into the myriad ncurses functions, let me clear few things
+about windows. Windows are explained in detail in following sections
A Window is an imaginary screen defined by curses system. A window does not mean
+a bordered window which you usually see on Win9X platforms. When curses is
+initialized, it creates a default window named
+stdscr which represents your 80x25 (or the size
+of window in which you are running) screen. If you are doing simple tasks like
+printing few strings, reading input etc., you can safely use this single window
+for all of your purposes. You can also create windows and call functions which
+explicitly work on the specified window.
For example, if you call
printw("Hi There !!!");
+ refresh();
It prints the string on stdscr at the present cursor position. Similarly the
+call to refresh(), works on stdscr only.
Say you have created windows then you have to
+call a function with a 'w' added to the usual function.
wprintw(win, "Hi There !!!");
+ wrefresh(win);
As you will see in the rest of the document, naming of functions follow the
+same convention. For each function there usually are three more functions.
printw(string); /* Print on stdscr at present cursor position */
mvprintw(y, x, string);/* Move to (y, x) then print string */
wprintw(win, string); /* Print on window win at present cursor position */
/* in the window */
mvwprintw(win, y, x, string); /* Move to (y, x) relative to window */
- /* co-ordinates and then print */
-
-
-
-
Usually the w-less functions are macros which expand to
-corresponding w-function with stdscr as the window parameter.
I guess you can't wait any more to see some action. Back to our
-odyssey of curses functions. Now that curses is initialized, let's
-interact with world.
-
There are three classes of functions which you can use to do
-output on screen.
-
-
-
addch() class: Print single character with attributes
-
-
-
printw() class: Print formatted output similar to printf()
-
-
-
addstr() class: Print strings
-
-
-
These functions can be used interchangeably and it's a matter of
-style as to which class is used. Let's see each one in detail.
These functions put a single character into the current cursor
-location and advance the position of the cursor. You can give the
-character to be printed but they usually are used to print a
-character with some attributes. Attributes are explained in detail
-in later sections of the document. If a
-character is associated with an attribute(bold, reverse video
-etc.), when curses prints the character, it is printed in that
-attribute.
-
In order to combine a character with some attributes, you have
-two options:
-
-
-
By OR'ing a single character with the desired attribute macros.
-These attribute macros could be found in the header file
-ncurses.h. For example, you want to
-print a character ch(of type char) bold and underlined, you would
-call addch() as below.
-
-
-
-
- addch(ch | A_BOLD | A_UNDERLINE);
-
-
-
-
-
-
By using functions like attrset(),attron(),attroff(). These functions are
-explained in the Attributes section. Briefly,
-they manipulate the current attributes of the given window. Once
-set, the character printed in the window are associated with the
-attributes until it is turned off.
-
-
-
Additionally, curses provides some
-special characters for character-based graphics. You can draw
-tables, horizontal or vertical lines, etc. You can find all
-avaliable characters in the header file ncurses.h. Try looking for macros beginning with
-ACS_ in this file.
I guess you can't wait any more to see some action. Back to our odyssey of
+curses functions. Now that curses is initialized, let's interact with
+world.
There are three classes of functions which you can use to do output on screen.
+
addch() class: Print single character with attributes
printw() class: Print formatted output similar to printf()
addstr() class: Print strings
These functions can be used interchangeably and it's a matter of style as to
+which class is used. Let's see each one in detail.
These functions put a single character into the current cursor location and
+advance the position of the cursor. You can give the character to be printed but
+they usually are used to print a character with some attributes. Attributes are
+explained in detail in later sections of the
+document. If a character is associated with an attribute(bold, reverse video
+etc.), when curses prints the character, it is printed in that attribute.
In order to combine a character with some attributes, you have two options:
By OR'ing a single character with the desired attribute macros. These attribute
+macros could be found in the header file
+ncurses.h. For example, you want to print a
+character ch(of type char) bold and underlined, you would call addch() as below.
+
addch(ch | A_BOLD | A_UNDERLINE);
By using functions like attrset(),attron(),attroff(). These functions are explained in the Attributes section. Briefly, they manipulate the current attributes of
+the given window. Once set, the character printed in the window are associated
+with the attributes until it is turned off.
Additionally, curses provides some special
+characters for character-based graphics. You can draw tables, horizontal or
+vertical lines, etc. You can find all avaliable characters in the header file
+ncurses.h. Try looking for macros beginning
+with ACS_ in this file.
mvaddch() is used to move the cursor to a
+given point, and then print. Thus, the calls:
+
move(row,col); /* moves the cursor to rowth row and colth column */
+ addch(ch);
can be replaced by
-
-
-
-
- mvaddch(row,col,ch);
-
-
-
-
waddch() is similar to addch(), except that it adds a character into the
-given window. (Note that addch() adds a
-character into the window stdscr.)
-
In a similar fashion mvwaddch()
-function is used to add a character into the given window at the
-given coordinates.
-
Now, we are familiar with the basic output function addch(). But, if we want to print a string, it
-would be very annoying to print it character by character.
-Fortunately, ncurses provides
-printf-like or puts-like functions.
These two functions work much like printf(). mvprintw() can
-be used to move the cursor to a position and then print. If you
-want to move the cursor first and then print using printw() function, use move() first and then use printw() though I see no point why one should avoid
-using mvprintw(), you have the
-flexibility to manipulate.
-#include <ncurses.h> /* ncurses.h includes stdio.h */
-#include <string.h>
+
mvaddch(row,col,ch);
waddch() is similar to
+addch(), except that it adds a character into
+the given window. (Note that addch() adds a
+character into the window stdscr.)
In a similar fashion mvwaddch() function is
+used to add a character into the given window at the given coordinates.
Now, we are familiar with the basic output function
+addch(). But, if we want to print a string, it
+would be very annoying to print it character by character. Fortunately,
+ncurses provides printf-like or
+puts-like functions.
These two functions work much like printf().
+mvprintw() can be used to move the cursor to a
+position and then print. If you want to move the cursor first and then print
+using printw() function, use
+move() first and then use
+printw() though I see no point why one should
+avoid using mvprintw(), you have the
+flexibility to manipulate.
#include <ncurses.h> /* ncurses.h includes stdio.h */
+#include <string.h>
int main()
{
- char mesg[]="Just a string"; /* message to be appeared on the screen */
- int row,col; /* to store the number of rows and *
- * the number of colums of the screen */
- initscr(); /* start the curses mode */
- getmaxyx(stdscr,row,col); /* get the number of rows and columns */
+ char mesg[]="Just a string"; /* message to be appeared on the screen */
+ int row,col; /* to store the number of rows and *
+ * the number of colums of the screen */
+ initscr(); /* start the curses mode */
+ getmaxyx(stdscr,row,col); /* get the number of rows and columns */
mvprintw(row/2,(col-strlen(mesg))/2,"%s",mesg);
- /* print the message at the center of the screen */
+ /* print the message at the center of the screen */
mvprintw(row-2,0,"This screen has %d rows and %d columns\n",row,col);
printw("Try resizing your window(if possible) and then run this program again");
refresh();
@@ -1268,192 +2327,302 @@ int main()
endwin();
return 0;
-}
-
-
-
-
-
Above program demonstrates how easy it is to use printw. You just feed the coordinates and the
-message to be appeared on the screen, then it does what you
-want.
-
The above program introduces us to a new function getmaxyx(), a macro defined in ncurses.h. It gives the number of columns and the
-number of rows in a given window. getmaxyx() does this by updating the variables
-given to it. Since getmaxyx() is not a
-function we don't pass pointers to it, we just give two integer
-variables.
addstr() is used to put a character
-string into a given window. This function is similar to calling
-addch() once for each character in a
-given string. This is true for all output functions. There are
-other functions from this family such as mvaddstr(),mvwaddstr() and waddstr(), which obey the naming convention of
-curses.(e.g. mvaddstr() is similar to the respective calls move()
-and then addstr().) Another function of this family is addnstr(),
-which takes an integer parameter(say n) additionally. This function
-puts at most n characters into the screen. If n is negative, then
-the entire string will be added.
All these functions take y co-ordinate first and then x in their
-arguments. A common mistake by beginners is to pass x,y in that
-order. If you are doing too many manipulations of (y,x)
-co-ordinates, think of dividing the screen into windows and
-manipulate each one separately. Windows are explained in the
-windows section.
Well, printing without taking input, is boring. Let's see
-functions which allow us to get input from user. These functions
-also can be divided into three categories.
These functions read a single character from the terminal. But
-there are several subtle facts to consider. For example if you
-don't use the function cbreak(), curses will not read your input
-characters contiguously but will begin read them only after a new
-line or an EOF is encountered. In order to avoid this, the cbreak()
-function must used so that characters are immediately available to
-your program. Another widely used function is noecho(). As the name
-suggests, when this function is set (used), the characters that are
-keyed in by the user will not show up on the screen. The two
-functions cbreak() and noecho() are typical examples of key
-management. Functions of this genre are explained in the key management section .
The usage of these functions is similar to that of sscanf(), where the line to be scanned is provided
-by wgetstr() function. That is, these
-functions call to wgetstr()
-function(explained below) and uses the resulting line for a
-scan.
These functions are used to get strings from the terminal. In
-essence, this function performs the same task as would be achieved
-by a series of calls to getch() until a
-newline, carriage return, or end-of-file is received. The resulting
-string of characters are pointed to by str, which is a character pointer provided by the
-user.
-#include <ncurses.h> /* ncurses.h includes stdio.h */
-#include <string.h>
+}
Above program demonstrates how easy it is to use printw. You just feed the coordinates and the message to be appeared
+on the screen, then it does what you want.
The above program introduces us to a new function
+getmaxyx(), a macro defined in
+ncurses.h. It gives the number of columns and
+the number of rows in a given window.
+getmaxyx() does this by updating the variables
+given to it. Since getmaxyx() is not a function
+we don't pass pointers to it, we just give two integer variables.
addstr() is used to put a character string into
+a given window. This function is similar to calling
+addch() once for each character in a given
+string. This is true for all output functions. There are other functions from
+this family such as mvaddstr(),mvwaddstr() and
+waddstr(), which obey the naming convention of
+curses.(e.g. mvaddstr() is similar to the respective calls move() and then
+addstr().) Another function of this family is addnstr(), which takes an integer
+parameter(say n) additionally. This function puts at most n characters into the
+screen. If n is negative, then the entire string will be added.
All these functions take y co-ordinate first and then x in their arguments.
+A common mistake by beginners is to pass x,y in that order. If you are
+doing too many manipulations of (y,x) co-ordinates, think of dividing the
+screen into windows and manipulate each one separately. Windows are explained
+in the windows section.
Well, printing without taking input, is boring. Let's see functions which
+allow us to get input from user. These functions also can be divided into
+three categories.
These functions read a single character from the terminal. But there are several
+subtle facts to consider. For example if you don't use the function cbreak(),
+curses will not read your input characters contiguously but will begin read them
+only after a new line or an EOF is encountered. In order to avoid this, the
+cbreak() function must used so that characters are immediately available to your
+program. Another widely used function is noecho(). As the name suggests, when
+this function is set (used), the characters that are keyed in by the user will
+not show up on the screen. The two functions cbreak() and noecho() are typical
+examples of key management. Functions of this genre are explained in the
+key management section .
The usage of these functions is similar to that of
+sscanf(), where the line to be scanned is
+provided by wgetstr() function. That is, these
+functions call to wgetstr() function(explained
+below) and uses the resulting line for a scan.
These functions are used to get strings from the terminal. In essence, this
+function performs the same task as would be achieved by a series of calls to
+getch() until a newline, carriage return, or
+end-of-file is received. The resulting string of characters are pointed to by
+str, which is a character pointer provided by
+the user.
#include <ncurses.h> /* ncurses.h includes stdio.h */
+#include <string.h>
int main()
{
- char mesg[]="Enter a string: "; /* message to be appeared on the screen */
+ char mesg[]="Enter a string: "; /* message to be appeared on the screen */
char str[80];
- int row,col; /* to store the number of rows and *
- * the number of colums of the screen */
- initscr(); /* start the curses mode */
- getmaxyx(stdscr,row,col); /* get the number of rows and columns */
+ int row,col; /* to store the number of rows and *
+ * the number of colums of the screen */
+ initscr(); /* start the curses mode */
+ getmaxyx(stdscr,row,col); /* get the number of rows and columns */
mvprintw(row/2,(col-strlen(mesg))/2,"%s",mesg);
- /* print the message at the center of the screen */
+ /* print the message at the center of the screen */
getstr(str);
mvprintw(LINES - 2, 0, "You Entered: %s", str);
getch();
endwin();
return 0;
-}
-
We have seen an example of how attributes can be used to print
-characters with some special effects. Attributes, when set
-prudently, can present information in an easy, understandable
-manner. The following program takes a C file as input and prints
-the file with comments in bold. Scan through the code.
-
-
Example 5. A Simple Attributes example
-
-
-
-
-/* pager functionality by Joseph Spainhour" <spainhou@bellsouth.net> */
-#include <ncurses.h>
-#include <stdlib.h>
+}
We have seen an example of how attributes can be used to print characters with
+some special effects. Attributes, when set prudently, can present information in
+an easy, understandable manner. The following program takes a C file as input
+and prints the file with comments in bold. Scan through the code.
Example 5. A Simple Attributes example
/* pager functionality by Joseph Spainhour" <spainhou@bellsouth.net> */
+#include <ncurses.h>
+#include <stdlib.h>
int main(int argc, char *argv[])
{
@@ -1464,7 +2633,7 @@ int main(int argc, char *argv[])
if(argc != 2)
{
- printf("Usage: %s <a c file name>\n", argv[0]);
+ printf("Usage: %s <a c file name>\n", argv[0]);
exit(1);
}
fp = fopen(argv[1], "r");
@@ -1473,77 +2642,101 @@ int main(int argc, char *argv[])
perror("Cannot open input file");
exit(1);
}
- initscr(); /* Start curses mode */
- getmaxyx(stdscr, row, col); /* find the boundaries of the screeen */
- while((ch = fgetc(fp)) != EOF) /* read the file till we reach the end */
+ initscr(); /* Start curses mode */
+ getmaxyx(stdscr, row, col); /* find the boundaries of the screeen */
+ while((ch = fgetc(fp)) != EOF) /* read the file till we reach the end */
{
- getyx(stdscr, y, x); /* get the current curser position */
- if(y == (row - 1)) /* are we are at the end of the screen */
+ getyx(stdscr, y, x); /* get the current curser position */
+ if(y == (row - 1)) /* are we are at the end of the screen */
{
- printw("<-Press Any Key->"); /* tell the user to press a key */
+ printw("<-Press Any Key->"); /* tell the user to press a key */
getch();
- clear(); /* clear the screen */
- move(0, 0); /* start at the beginning of the screen */
+ clear(); /* clear the screen */
+ move(0, 0); /* start at the beginning of the screen */
}
- if(prev == '/' && ch == '*') /* If it is / and * then only
- * switch bold on */
+ if(prev == '/' && ch == '*') /* If it is / and * then only
+ * switch bold on */
{
- attron(A_BOLD); /* cut bold on */
- getyx(stdscr, y, x); /* get the current curser position */
- move(y, x - 1); /* back up one space */
- printw("%c%c", '/', ch); /* The actual printing is done here */
+ attron(A_BOLD); /* cut bold on */
+ getyx(stdscr, y, x); /* get the current curser position */
+ move(y, x - 1); /* back up one space */
+ printw("%c%c", '/', ch); /* The actual printing is done here */
}
else
printw("%c", ch);
refresh();
- if(prev == '*' && ch == '/')
- attroff(A_BOLD); /* Switch it off once we got *
- * and then / */
+ if(prev == '*' && ch == '/')
+ attroff(A_BOLD); /* Switch it off once we got *
+ * and then / */
prev = ch;
}
- endwin(); /* End curses mode */
+ endwin(); /* End curses mode */
fclose(fp);
return 0;
-}
-
-
-
-
-
Don't worry about all those initialization and other crap.
-Concentrate on the while loop. It reads each character in the file
-and searches for the pattern /*. Once it spots the pattern, it
-switches the BOLD attribute on with attron() . When we get the pattern */ it is
-switched off by attroff() .
-
The above program also introduces us to two useful functions
-getyx() and move(). The first function gets the co-ordinates of
-the present cursor into the variables y, x. Since getyx() is a
+}
+Don't worry about all those initialization and other crap. Concentrate on
+the while loop. It reads each character in the file and searches for the
+pattern /*. Once it spots the pattern, it switches the BOLD attribute on with
+ attron() . When we get the pattern */ it is
+switched off by attroff() .
+The above program also introduces us to two useful functions
+getyx() and
+move(). The first function gets the
+co-ordinates of the present cursor into the variables y, x. Since getyx() is a
macro we don't have to pass pointers to variables. The function
-move() moves the cursor to the
-co-ordinates given to it.
-
The above program is really a simple one which doesn't do much.
-On these lines one could write a more useful program which reads a
-C file, parses it and prints it in different colors. One could even
-extend it to other languages as well.
Let's get into more details of attributes. The functions
-attron(), attroff(), attrset() , and
-their sister functions attr_get() etc..
-can be used to switch attributes on/off , get attributes and
-produce a colorful display.
-
The functions attron and attroff take a bit-mask of attributes
-and switch them on or off, respectively. The following video
-attributes, which are defined in <curses.h> can be passed to
-these functions.
-
-
-
-
-
+move() moves the cursor to the co-ordinates
+given to it.
+The above program is really a simple one which doesn't do much. On these lines
+one could write a more useful program which reads a C file, parses it and prints
+it in different colors. One could even extend it to other languages as well.
Let's get into more details of attributes. The functions attron(), attroff(), attrset() , and their sister functions
+ attr_get() etc.. can be used to switch
+attributes on/off , get attributes and produce a colorful display.
The functions attron and attroff take a bit-mask of attributes and switch them
+on or off, respectively. The following video attributes, which are defined in
+<curses.h> can be passed to these functions.
A_NORMAL Normal display (no highlight)
A_STANDOUT Best highlighting mode of the terminal.
A_UNDERLINE Underlining
@@ -1556,368 +2749,445 @@ these functions.
A_ALTCHARSET Alternate character set
A_CHARTEXT Bit-mask to extract a character
COLOR_PAIR(n) Color-pair number n
-
-
-
-
-
The last one is the most colorful one :-) Colors are explained
-in the next sections.
-
We can OR(|) any number of above attributes to get a combined
-effect. If you wanted reverse video with blinking characters you
-can use
Then what is the difference between attron() and attrset()?
-attrset sets the attributes of window whereas attron just switches
-on the attribute given to it. So attrset() fully overrides whatever
-attributes the window previously had and sets it to the new
-attribute(s). Similarly attroff() just switches off the
-attribute(s) given to it as an argument. This gives us the
-flexibility of managing attributes easily.But if you use them
-carelessly you may loose track of what attributes the window has
-and garble the display. This is especially true while managing
-menus with colors and highlighting. So decide on a consistent
-policy and stick to it. You can always use standend() which is equivalent to attrset(A_NORMAL) which turns off all attributes
-and brings you to normal mode.
The function attr_get() gets the current attributes and color
-pair of the window. Though we might not use this as often as the
-above functions, this is useful in scanning areas of screen. Say we
-wanted to do some complex update on screen and we are not sure what
-attribute each character is associated with. Then this function can
-be used with either attrset or attron to produce the desired
-effect.
For each of the above functions we have a corresponding function
-with 'w' which operates on a particular window. The above functions
-operate on stdscr.
The function chgat() is listed in the end of the man page
-curs_attr. It actually is a useful one. This function can be used
-to set attributes for a group of characters without moving. I mean
-it !!! without moving the cursor :-) It changes the attributes of a
-given number of characters starting at the current cursor
-location.
-
We can give -1 as the character count to update till end of
-line. If you want to change attributes of characters from current
-position to end of line, just use this.
-
-
-
-
- chgat(-1, A_REVERSE, 0, NULL);
-
-
-
-
This function is useful when changing attributes for characters
-that are already on the screen. Move to the character from which
-you want to change and change the attribute.
-
Other functions wchgat(), mvchgat(), wchgat() behave similarly
-except that the w functions operate on the particular window. The
-mv functions first move the cursor then perform the work given to
-them. Actually chgat is a macro which is replaced by a wchgat()
-with stdscr as the window. Most of the "w-less" functions are
-macros.
-
-
Example 6. Chgat() Usage example
-
-
-
-
-#include <ncurses.h>
+
+The last one is the most colorful one :-) Colors are explained in the
+next sections.
We can OR(|) any number of above attributes to get a combined effect. If you
+wanted reverse video with blinking characters you can use
Then what is the difference between attron() and attrset()? attrset sets the
+attributes of window whereas attron just switches on the attribute given to it.
+So attrset() fully overrides whatever attributes the window previously had and
+sets it to the new attribute(s). Similarly attroff() just switches off the
+attribute(s) given to it as an argument. This gives us the flexibility of
+managing attributes easily.But if you use them carelessly you may loose track of
+what attributes the window has and garble the display. This is especially true
+while managing menus with colors and highlighting. So decide on a consistent
+policy and stick to it. You can always use standend() which is equivalent to attrset(A_NORMAL) which turns off all attributes and brings you to normal mode.
The function attr_get() gets the current attributes and color pair of the
+window. Though we might not use this as often as the above functions, this is
+useful in scanning areas of screen. Say we wanted to do some complex update on
+screen and we are not sure what attribute each character is associated with.
+Then this function can be used with either attrset or attron to produce the
+desired effect.
For each of the above functions we have a corresponding function with 'w' which
+operates on a particular window. The above functions operate on stdscr.
The function chgat() is listed in the end of the man page curs_attr. It actually
+is a useful one. This function can be used to set attributes for a group of
+characters without moving. I mean it !!! without moving the cursor :-) It
+changes the attributes of a given number of characters starting at the current
+cursor location.
We can give -1 as the character count to update till end of line. If you want to
+change attributes of characters from current position to end of line, just use
+this.
chgat(-1, A_REVERSE, 0, NULL);
+This function is useful when changing attributes for characters that are
+already on the screen. Move to the character from which you want to change and
+change the attribute.
Other functions wchgat(), mvchgat(), wchgat() behave similarly except that the w
+functions operate on the particular window. The mv functions first move the
+cursor then perform the work given to them. Actually chgat is a macro which is
+replaced by a wchgat() with stdscr as the window. Most of the "w-less" functions
+are macros.
Example 6. Chgat() Usage example
#include <ncurses.h>
int main(int argc, char *argv[])
-{ initscr(); /* Start curses mode */
- start_color(); /* Start color functionality */
-
- init_pair(1, COLOR_CYAN, COLOR_BLACK);
- printw("A Big string which i didn't care to type fully ");
- mvchgat(0, 0, -1, A_BLINK, 1, NULL);
- /*
- * First two parameters specify the position at which to start
- * Third parameter number of characters to update. -1 means till
- * end of line
- * Forth parameter is the normal attribute you wanted to give
- * to the charcter
- * Fifth is the color index. It is the index given during init_pair()
- * use 0 if you didn't want color
- * Sixth one is always NULL
- */
- refresh();
- getch();
- endwin(); /* End curses mode */
- return 0;
-}
-
-
-
-
-
This example also introduces us to the color world of curses.
-Colors will be explained in detail later. Use 0 for no color.
Windows form the most important concept in curses. You have seen
-the standard window stdscr above where all the functions implicitly
-operated on this window. Now to make design even a simplest GUI,
-you need to resort to windows. The main reason you may want to use
-windows is to manipulate parts of the screen separately, for better
-efficiency, by updating only the windows that need to be changed
-and for a better design. I would say the last reason is the most
-important in going for windows. You should always strive for a
-better and easy-to-manage design in your programs. If you are
-writing big, complex GUIs this is of pivotal importance before you
-start doing anything.
A Window can be created by calling the function newwin(). It doesn't create any thing on the screen
-actually. It allocates memory for a structure to manipulate the
-window and updates the structure with data regarding the window
-like it's size, beginy, beginx etc.. Hence in curses, a window is
-just an abstraction of an imaginary window, which can be
-manipulated independent of other parts of screen. The function
-newwin() returns a pointer to structure WINDOW, which can be passed
-to window related functions like wprintw() etc.. Finally the window
-can be destroyed with delwin(). It will deallocate the memory
-associated with the window structure.
What fun is it, if a window is created and we can't see it. So
-the fun part begins by displaying the window. The function
-box() can be used to draw a border
-around the window. Let's explore these functions in more detail in
-this example.
-
-
Example 7. Window Border example
-
-
-
-
-#include <ncurses.h>
+{ initscr(); /* Start curses mode */
+ start_color(); /* Start color functionality */
+
+ init_pair(1, COLOR_CYAN, COLOR_BLACK);
+ printw("A Big string which i didn't care to type fully ");
+ mvchgat(0, 0, -1, A_BLINK, 1, NULL);
+ /*
+ * First two parameters specify the position at which to start
+ * Third parameter number of characters to update. -1 means till
+ * end of line
+ * Forth parameter is the normal attribute you wanted to give
+ * to the charcter
+ * Fifth is the color index. It is the index given during init_pair()
+ * use 0 if you didn't want color
+ * Sixth one is always NULL
+ */
+ refresh();
+ getch();
+ endwin(); /* End curses mode */
+ return 0;
+}
This example also introduces us to the color world of curses. Colors will be
+explained in detail later. Use 0 for no color.
Windows form the most important concept in curses. You have seen the standard
+window stdscr above where all the functions implicitly operated on this window.
+Now to make design even a simplest GUI, you need to resort to windows. The main
+reason you may want to use windows is to manipulate parts of the screen
+separately, for better efficiency, by updating only the windows that need to be
+changed and for a better design. I would say the last reason is the most
+important in going for windows. You should always strive for a better and
+easy-to-manage design in your programs. If you are writing big, complex GUIs
+this is of pivotal importance before you start doing anything.
A Window can be created by calling the function
+newwin(). It doesn't create any thing on the
+screen actually. It allocates memory for a structure to manipulate the window
+and updates the structure with data regarding the window like it's size, beginy,
+beginx etc.. Hence in curses, a window is just an abstraction of an imaginary
+window, which can be manipulated independent of other parts of screen. The
+function newwin() returns a pointer to structure WINDOW, which can be passed to
+window related functions like wprintw() etc.. Finally the window can be
+destroyed with delwin(). It will deallocate the memory associated with the
+window structure.
What fun is it, if a window is created and we can't see it. So the fun part
+begins by displaying the window. The function
+box() can be used to draw a border around the
+window. Let's explore these functions in more detail in this example.
Example 7. Window Border example
#include <ncurses.h>
WINDOW *create_newwin(int height, int width, int starty, int startx);
void destroy_win(WINDOW *local_win);
int main(int argc, char *argv[])
-{ WINDOW *my_win;
- int startx, starty, width, height;
- int ch;
+{ WINDOW *my_win;
+ int startx, starty, width, height;
+ int ch;
- initscr(); /* Start curses mode */
- cbreak(); /* Line buffering disabled, Pass on
- * everty thing to me */
- keypad(stdscr, TRUE); /* I need that nifty F1 */
+ initscr(); /* Start curses mode */
+ cbreak(); /* Line buffering disabled, Pass on
+ * everty thing to me */
+ keypad(stdscr, TRUE); /* I need that nifty F1 */
- height = 3;
- width = 10;
- starty = (LINES - height) / 2; /* Calculating for a center placement */
- startx = (COLS - width) / 2; /* of the window */
- printw("Press F1 to exit");
- refresh();
- my_win = create_newwin(height, width, starty, startx);
+ height = 3;
+ width = 10;
+ starty = (LINES - height) / 2; /* Calculating for a center placement */
+ startx = (COLS - width) / 2; /* of the window */
+ printw("Press F1 to exit");
+ refresh();
+ my_win = create_newwin(height, width, starty, startx);
- while((ch = getch()) != KEY_F(1))
- { switch(ch)
- { case KEY_LEFT:
- destroy_win(my_win);
- my_win = create_newwin(height, width, starty,--startx);
- break;
- case KEY_RIGHT:
- destroy_win(my_win);
- my_win = create_newwin(height, width, starty,++startx);
- break;
- case KEY_UP:
- destroy_win(my_win);
- my_win = create_newwin(height, width, --starty,startx);
- break;
- case KEY_DOWN:
- destroy_win(my_win);
- my_win = create_newwin(height, width, ++starty,startx);
- break;
- }
- }
-
- endwin(); /* End curses mode */
- return 0;
+ while((ch = getch()) != KEY_F(1))
+ { switch(ch)
+ { case KEY_LEFT:
+ destroy_win(my_win);
+ my_win = create_newwin(height, width, starty,--startx);
+ break;
+ case KEY_RIGHT:
+ destroy_win(my_win);
+ my_win = create_newwin(height, width, starty,++startx);
+ break;
+ case KEY_UP:
+ destroy_win(my_win);
+ my_win = create_newwin(height, width, --starty,startx);
+ break;
+ case KEY_DOWN:
+ destroy_win(my_win);
+ my_win = create_newwin(height, width, ++starty,startx);
+ break;
+ }
+ }
+
+ endwin(); /* End curses mode */
+ return 0;
}
WINDOW *create_newwin(int height, int width, int starty, int startx)
-{ WINDOW *local_win;
+{ WINDOW *local_win;
- local_win = newwin(height, width, starty, startx);
- box(local_win, 0 , 0); /* 0, 0 gives default characters
- * for the vertical and horizontal
- * lines */
- wrefresh(local_win); /* Show that box */
+ local_win = newwin(height, width, starty, startx);
+ box(local_win, 0 , 0); /* 0, 0 gives default characters
+ * for the vertical and horizontal
+ * lines */
+ wrefresh(local_win); /* Show that box */
- return local_win;
+ return local_win;
}
void destroy_win(WINDOW *local_win)
-{
- /* box(local_win, ' ', ' '); : This won't produce the desired
- * result of erasing the window. It will leave it's four corners
- * and so an ugly remnant of window.
- */
- wborder(local_win, ' ', ' ', ' ',' ',' ',' ',' ',' ');
- /* The parameters taken are
- * 1. win: the window on which to operate
- * 2. ls: character to be used for the left side of the window
- * 3. rs: character to be used for the right side of the window
- * 4. ts: character to be used for the top side of the window
- * 5. bs: character to be used for the bottom side of the window
- * 6. tl: character to be used for the top left corner of the window
- * 7. tr: character to be used for the top right corner of the window
- * 8. bl: character to be used for the bottom left corner of the window
- * 9. br: character to be used for the bottom right corner of the window
- */
- wrefresh(local_win);
- delwin(local_win);
-}
-
Don't scream. I know it's a big example. But I have to explain
-some important things here :-). This program creates a rectangular
-window that can be moved with left, right, up, down arrow keys. It
-repeatedly creates and destroys windows as user press a key. Don't
-go beyond the screen limits. Checking for those limits is left as
-an exercise for the reader. Let's dissect it by line by line.
-
The create_newwin() function creates
-a window with newwin() and displays a
-border around it with box. The function destroy_win() first erases the window from screen
-by painting a border with ' ' character and then calling
-delwin() to deallocate memory related to
-it. Depending on the key the user presses, starty or startx is
-changed and a new window is created.
-
In the destroy_win, as you can see, I used wborder instead of
-box. The reason is written in the comments (You missed it. I know.
-Read the code :-)). wborder draws a border around the window with
-the characters given to it as the 4 corner points and the 4 lines.
-To put it clearly, if you have called wborder as below:
- +------------+
+{
+ /* box(local_win, ' ', ' '); : This won't produce the desired
+ * result of erasing the window. It will leave it's four corners
+ * and so an ugly remnant of window.
+ */
+ wborder(local_win, ' ', ' ', ' ',' ',' ',' ',' ',' ');
+ /* The parameters taken are
+ * 1. win: the window on which to operate
+ * 2. ls: character to be used for the left side of the window
+ * 3. rs: character to be used for the right side of the window
+ * 4. ts: character to be used for the top side of the window
+ * 5. bs: character to be used for the bottom side of the window
+ * 6. tl: character to be used for the top left corner of the window
+ * 7. tr: character to be used for the top right corner of the window
+ * 8. bl: character to be used for the bottom left corner of the window
+ * 9. br: character to be used for the bottom right corner of the window
+ */
+ wrefresh(local_win);
+ delwin(local_win);
+}
Don't scream. I know it's a big example. But I have to explain some important
+things here :-). This program creates a rectangular window that can be moved
+with left, right, up, down arrow keys. It repeatedly creates and destroys
+windows as user press a key. Don't go beyond the screen limits. Checking for
+those limits is left as an exercise for the reader. Let's dissect it by line by line.
The create_newwin() function creates a window
+with newwin() and displays a border around it
+with box. The function destroy_win() first
+erases the window from screen by painting a border with ' ' character and then
+calling delwin() to deallocate memory related
+to it. Depending on the key the user presses, starty or startx is changed and a
+new window is created.
In the destroy_win, as you can see, I used wborder instead of box. The reason is
+written in the comments (You missed it. I know. Read the code :-)). wborder
+draws a border around the window with the characters given to it as the 4 corner
+points and the 4 lines. To put it clearly, if you have called wborder as below:
+
You can also see in the above examples, that I have used the
-variables COLS, LINES which are initialized to the screen sizes
-after initscr(). They can be useful in finding screen dimensions
-and finding the center co-ordinate of the screen as above. The
-function getch() as usual gets the key
-from keyboard and according to the key it does the corresponding
-work. This type of switch- case is very common in any GUI based
-programs.
Above program is grossly inefficient in that with each press of
-a key, a window is destroyed and another is created. So let's write
-a more efficient program which uses other border related
-functions.
-
The following program uses mvhline()
-and mvvline() to achieve similar effect.
-These two functions are simple. They create a horizontal or
-vertical line of the specified length at the specified
-position.
You can also see in the above examples, that I have used the variables COLS,
+LINES which are initialized to the screen sizes after initscr(). They can be
+useful in finding screen dimensions and finding the center co-ordinate of the
+screen as above. The function getch() as usual
+gets the key from keyboard and according to the key it does the corresponding
+work. This type of switch- case is very common in any GUI based programs.
Above program is grossly inefficient in that with each press of a key, a window
+is destroyed and another is created. So let's write a more efficient program
+which uses other border related functions.
The following program uses mvhline() and
+mvvline() to achieve similar effect. These two
+functions are simple. They create a horizontal or vertical line of the specified
+length at the specified position.
Example 8. More border functions
#include <ncurses.h>
typedef struct _win_border_struct {
- chtype ls, rs, ts, bs,
- tl, tr, bl, br;
+ chtype ls, rs, ts, bs,
+ tl, tr, bl, br;
}WIN_BORDER;
typedef struct _WIN_struct {
- int startx, starty;
- int height, width;
- WIN_BORDER border;
+ int startx, starty;
+ int height, width;
+ WIN_BORDER border;
}WIN;
void init_win_params(WIN *p_win);
@@ -1925,319 +3195,380 @@ void print_win_params(WIN *p_win);
void create_box(WIN *win, bool flag);
int main(int argc, char *argv[])
-{ WIN win;
- int ch;
+{ WIN win;
+ int ch;
- initscr(); /* Start curses mode */
- start_color(); /* Start the color functionality */
- cbreak(); /* Line buffering disabled, Pass on
- * everty thing to me */
- keypad(stdscr, TRUE); /* I need that nifty F1 */
- noecho();
- init_pair(1, COLOR_CYAN, COLOR_BLACK);
+ initscr(); /* Start curses mode */
+ start_color(); /* Start the color functionality */
+ cbreak(); /* Line buffering disabled, Pass on
+ * everty thing to me */
+ keypad(stdscr, TRUE); /* I need that nifty F1 */
+ noecho();
+ init_pair(1, COLOR_CYAN, COLOR_BLACK);
- /* Initialize the window parameters */
- init_win_params(&win);
- print_win_params(&win);
+ /* Initialize the window parameters */
+ init_win_params(&win);
+ print_win_params(&win);
- attron(COLOR_PAIR(1));
- printw("Press F1 to exit");
- refresh();
- attroff(COLOR_PAIR(1));
-
- create_box(&win, TRUE);
- while((ch = getch()) != KEY_F(1))
- { switch(ch)
- { case KEY_LEFT:
- create_box(&win, FALSE);
- --win.startx;
- create_box(&win, TRUE);
- break;
- case KEY_RIGHT:
- create_box(&win, FALSE);
- ++win.startx;
- create_box(&win, TRUE);
- break;
- case KEY_UP:
- create_box(&win, FALSE);
- --win.starty;
- create_box(&win, TRUE);
- break;
- case KEY_DOWN:
- create_box(&win, FALSE);
- ++win.starty;
- create_box(&win, TRUE);
- break;
- }
- }
- endwin(); /* End curses mode */
- return 0;
+ attron(COLOR_PAIR(1));
+ printw("Press F1 to exit");
+ refresh();
+ attroff(COLOR_PAIR(1));
+
+ create_box(&win, TRUE);
+ while((ch = getch()) != KEY_F(1))
+ { switch(ch)
+ { case KEY_LEFT:
+ create_box(&win, FALSE);
+ --win.startx;
+ create_box(&win, TRUE);
+ break;
+ case KEY_RIGHT:
+ create_box(&win, FALSE);
+ ++win.startx;
+ create_box(&win, TRUE);
+ break;
+ case KEY_UP:
+ create_box(&win, FALSE);
+ --win.starty;
+ create_box(&win, TRUE);
+ break;
+ case KEY_DOWN:
+ create_box(&win, FALSE);
+ ++win.starty;
+ create_box(&win, TRUE);
+ break;
+ }
+ }
+ endwin(); /* End curses mode */
+ return 0;
}
void init_win_params(WIN *p_win)
{
- p_win->height = 3;
- p_win->width = 10;
- p_win->starty = (LINES - p_win->height)/2;
- p_win->startx = (COLS - p_win->width)/2;
+ p_win->height = 3;
+ p_win->width = 10;
+ p_win->starty = (LINES - p_win->height)/2;
+ p_win->startx = (COLS - p_win->width)/2;
- p_win->border.ls = '|';
- p_win->border.rs = '|';
- p_win->border.ts = '-';
- p_win->border.bs = '-';
- p_win->border.tl = '+';
- p_win->border.tr = '+';
- p_win->border.bl = '+';
- p_win->border.br = '+';
+ p_win->border.ls = '|';
+ p_win->border.rs = '|';
+ p_win->border.ts = '-';
+ p_win->border.bs = '-';
+ p_win->border.tl = '+';
+ p_win->border.tr = '+';
+ p_win->border.bl = '+';
+ p_win->border.br = '+';
}
void print_win_params(WIN *p_win)
{
#ifdef _DEBUG
- mvprintw(25, 0, "%d %d %d %d", p_win->startx, p_win->starty,
- p_win->width, p_win->height);
- refresh();
+ mvprintw(25, 0, "%d %d %d %d", p_win->startx, p_win->starty,
+ p_win->width, p_win->height);
+ refresh();
#endif
}
void create_box(WIN *p_win, bool flag)
-{ int i, j;
- int x, y, w, h;
+{ int i, j;
+ int x, y, w, h;
- x = p_win->startx;
- y = p_win->starty;
- w = p_win->width;
- h = p_win->height;
+ x = p_win->startx;
+ y = p_win->starty;
+ w = p_win->width;
+ h = p_win->height;
- if(flag == TRUE)
- { mvaddch(y, x, p_win->border.tl);
- mvaddch(y, x + w, p_win->border.tr);
- mvaddch(y + h, x, p_win->border.bl);
- mvaddch(y + h, x + w, p_win->border.br);
- mvhline(y, x + 1, p_win->border.ts, w - 1);
- mvhline(y + h, x + 1, p_win->border.bs, w - 1);
- mvvline(y + 1, x, p_win->border.ls, h - 1);
- mvvline(y + 1, x + w, p_win->border.rs, h - 1);
+ if(flag == TRUE)
+ { mvaddch(y, x, p_win->border.tl);
+ mvaddch(y, x + w, p_win->border.tr);
+ mvaddch(y + h, x, p_win->border.bl);
+ mvaddch(y + h, x + w, p_win->border.br);
+ mvhline(y, x + 1, p_win->border.ts, w - 1);
+ mvhline(y + h, x + 1, p_win->border.bs, w - 1);
+ mvvline(y + 1, x, p_win->border.ls, h - 1);
+ mvvline(y + 1, x + w, p_win->border.rs, h - 1);
- }
- else
- for(j = y; j <= y + h; ++j)
- for(i = x; i <= x + w; ++i)
- mvaddch(j, i, ' ');
-
- refresh();
+ }
+ else
+ for(j = y; j <= y + h; ++j)
+ for(i = x; i <= x + w; ++i)
+ mvaddch(j, i, ' ');
+
+ refresh();
-}
-
Life seems dull with no colors. Curses has a nice mechanism to handle colors.
+Let's get into the thick of the things with a small program.
Example 9. A Simple Color example
#include <ncurses.h>
void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string);
int main(int argc, char *argv[])
-{ initscr(); /* Start curses mode */
- if(has_colors() == FALSE)
- { endwin();
- printf("Your terminal does not support color\n");
- exit(1);
- }
- start_color(); /* Start color */
- init_pair(1, COLOR_RED, COLOR_BLACK);
+{ initscr(); /* Start curses mode */
+ if(has_colors() == FALSE)
+ { endwin();
+ printf("Your terminal does not support color\n");
+ exit(1);
+ }
+ start_color(); /* Start color */
+ init_pair(1, COLOR_RED, COLOR_BLACK);
- attron(COLOR_PAIR(1));
- print_in_middle(stdscr, LINES / 2, 0, 0, "Viola !!! In color ...");
- attroff(COLOR_PAIR(1));
- getch();
- endwin();
+ attron(COLOR_PAIR(1));
+ print_in_middle(stdscr, LINES / 2, 0, 0, "Viola !!! In color ...");
+ attroff(COLOR_PAIR(1));
+ getch();
+ endwin();
}
void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string)
-{ int length, x, y;
- float temp;
+{ int length, x, y;
+ float temp;
- if(win == NULL)
- win = stdscr;
- getyx(win, y, x);
- if(startx != 0)
- x = startx;
- if(starty != 0)
- y = starty;
- if(width == 0)
- width = 80;
+ if(win == NULL)
+ win = stdscr;
+ getyx(win, y, x);
+ if(startx != 0)
+ x = startx;
+ if(starty != 0)
+ y = starty;
+ if(width == 0)
+ width = 80;
- length = strlen(string);
- temp = (width - length)/ 2;
- x = startx + (int)temp;
- mvwprintw(win, y, x, "%s", string);
- refresh();
+ length = strlen(string);
+ temp = (width - length)/ 2;
+ x = startx + (int)temp;
+ mvwprintw(win, y, x, "%s", string);
+ refresh();
}
-
-
-
-
-
-
As you can see, to start using color, you should first call the
-function start_color(). After that, you
-can use color capabilities of your terminals using various
-functions. To find out whether a terminal has color capabilities or
-not, you can use has_colors() function,
-which returns FALSE if the terminal does not support color.
-
Curses initializes all the colors supported by terminal when
-start_color() is called. These can be accessed by the define
-constants like COLOR_BLACK etc. Now to
-actually start using colors, you have to define pairs. Colors are
-always used in pairs. That means you have to use the function
-init_pair() to define the foreground and
-background for the pair number you give. After that that pair
-number can be used as a normal attribute with COLOR_PAIR()function. This may seem to be
-cumbersome at first. But this elegant solution allows us to manage
-color pairs very easily. To appreciate it, you have to look into
-the the source code of "dialog", a utility for displaying dialog
-boxes from shell scripts. The developers have defined foreground
-and background combinations for all the colors they might need and
-initialized at the beginning. This makes it very easy to set
-attributes just by accessing a pair which we already have defined
-as a constant.
-
The following colors are defined in curses.h. You can use these as parameters for
-various color functions.
-
-
-
-
- COLOR_BLACK 0
+
As you can see, to start using color, you should first call the function
+ start_color(). After that, you can use color
+capabilities of your terminals using various functions. To find out whether a
+terminal has color capabilities or not, you can use
+has_colors() function, which returns FALSE if
+the terminal does not support color.
Curses initializes all the colors supported by terminal when start_color() is
+called. These can be accessed by the define constants like
+COLOR_BLACK etc. Now to actually start using
+colors, you have to define pairs. Colors are always used in pairs. That means
+you have to use the function init_pair() to
+define the foreground and background for the pair number you give. After that
+that pair number can be used as a normal attribute with COLOR_PAIR()function. This may seem to be cumbersome at first.
+But this elegant solution allows us to manage color pairs very easily. To
+appreciate it, you have to look into the the source code of "dialog", a utility
+for displaying dialog boxes from shell scripts. The developers have defined
+foreground and background combinations for all the colors they might need and
+initialized at the beginning. This makes it very easy to set attributes just by
+accessing a pair which we already have defined as a constant.
The following colors are defined in curses.h.
+You can use these as parameters for various color functions.
+
The function init_color()can be used
-to change the rgb values for the colors defined by curses
-initially. Say you wanted to lighten the intensity of red color by
-a minuscule. Then you can use this function as
The function init_color()can be used to change
+the rgb values for the colors defined by curses initially. Say you wanted to
+lighten the intensity of red color by a minuscule. Then you can use this
+function as
init_color(COLOR_RED, 700, 0, 0);
/* param 1 : color name
- * param 2, 3, 4 : rgb content min = 0, max = 1000 */
-
-
-
-
If your terminal cannot change the color definitions, the
-function returns ERR. The function can_change_color() can be used to find out whether
-the terminal has the capability of changing color content or not.
-The rgb content is scaled from 0 to 1000. Initially RED color is
-defined with content 1000(r), 0(g), 0(b).
No GUI is complete without a strong user interface and to
-interact with the user, a curses program should be sensitive to key
-presses or the mouse actions done by the user. Let's deal with the
-keys first.
-
As you have seen in almost all of the above examples, it's very
-easy to get key input from the user. A simple way of getting key
-presses is to use getch() function. The
-cbreak mode should be enabled to read keys when you are interested
-in reading individual key hits rather than complete lines of text
-(which usually end with a carriage return). keypad should be
-enabled to get the Functions keys, arrow keys etc. See the
-initialization section for details.
-
getch() returns an integer
-corresponding to the key pressed. If it is a normal character, the
-integer value will be equivalent to the character. Otherwise it
-returns a number which can be matched with the constants defined in
-curses.h. For example if the user
-presses F1, the integer returned is 265. This can be checked using
-the macro KEY_F() defined in curses.h. This makes reading keys
-portable and easy to manage.
-
For example, if you call getch() like this
-
-
-
-
- int ch;
+ * param 2, 3, 4 : rgb content min = 0, max = 1000 */
If your terminal cannot change the color definitions, the function returns ERR.
+The function can_change_color() can be used to
+find out whether the terminal has the capability of changing color content or
+not. The rgb content is scaled from 0 to 1000. Initially RED color is defined
+with content 1000(r), 0(g), 0(b).
No GUI is complete without a strong user interface and to interact with the
+user, a curses program should be sensitive to key presses or the mouse actions
+done by the user. Let's deal with the keys first.
As you have seen in almost all of the above examples, it's very easy to get key
+input from the user. A simple way of getting key presses is to use
+getch() function. The cbreak mode should be
+enabled to read keys when you are interested in reading individual key hits
+rather than complete lines of text (which usually end with a carriage return).
+keypad should be enabled to get the Functions keys, arrow keys etc. See the
+initialization section for details.
getch() returns an integer corresponding to the
+key pressed. If it is a normal character, the integer value will be equivalent
+to the character. Otherwise it returns a number which can be matched with the
+constants defined in curses.h. For example if
+the user presses F1, the integer returned is 265. This can be checked using the
+macro KEY_F() defined in curses.h. This makes reading keys portable and easy to
+manage.
For example, if you call getch() like this
int ch;
- ch = getch();
-
-
-
-
getch() will wait for the user to press a key, (unless you
-specified a timeout) and when user presses a key, the corresponding
-integer is returned. Then you can check the value returned with the
-constants defined in curses.h to match against the keys you
-want.
-
The following code piece will do that job.
-
-
-
-
- if(ch == KEY_LEFT)
- printw("Left arrow is pressed\n");
-
-
-
-
Let's write a small program which creates a menu which can be
-navigated by up and down arrows.
getch() will wait for the user to press a key, (unless you specified a timeout)
+and when user presses a key, the corresponding integer is returned. Then you can
+check the value returned with the constants defined in curses.h to match against
+the keys you want.
The following code piece will do that job.
if(ch == KEY_LEFT)
+ printw("Left arrow is pressed\n");
Let's write a small program which creates a menu which can be navigated by up
+and down arrows.
Before you do any thing else, the events you want to receive
-have to be enabled with mousemask().
-
-
-
-
- mousemask( mmask_t newmask, /* The events you want to listen to */
- mmask_t *oldmask) /* The old events mask */
-
-
-
-
The first parameter to above function is a bit mask of events
-you would like to listen. By default, all the events are turned
-off. The bit mask ALL_MOUSE_EVENTS can
-be used to get all the events.
Before you do any thing else, the events you want to receive have to be enabled
+with mousemask().
mousemask( mmask_t newmask, /* The events you want to listen to */
+ mmask_t *oldmask) /* The old events mask */
The first parameter to above function is a bit mask of events you would like to
+listen. By default, all the events are turned off. The bit mask ALL_MOUSE_EVENTS can be used to get all the events.
The following are all the event masks:
Name Description
---------------------------------------------------------------------
BUTTON1_PRESSED mouse button 1 down
BUTTON1_RELEASED mouse button 1 up
@@ -2392,79 +3728,85 @@ be used to get all the events.
BUTTON_CTRL control was down during button state change
BUTTON_ALT alt was down during button state change
ALL_MOUSE_EVENTS report all button state changes
- REPORT_MOUSE_POSITION report mouse movement
-
Once a class of mouse events have been enabled, getch() class of
-functions return KEY_MOUSE every time some mouse event happens.
-Then the mouse event can be retrieved with getmouse().
-
The code approximately looks like this:
-
-
-
-
- MEVENT event;
+ REPORT_MOUSE_POSITION report mouse movement
Once a class of mouse events have been enabled, getch() class of functions
+return KEY_MOUSE every time some mouse event happens. Then the mouse event can
+be retrieved with getmouse().
The code approximately looks like this:
MEVENT event;
ch = getch();
if(ch == KEY_MOUSE)
if(getmouse(&event) == OK)
. /* Do some thing with the event */
.
- .
-
-
-
-
getmouse() returns the event into the pointer given to it. It's
-a structure which contains
-
-
-
-
- typedef struct
+ .
+getmouse() returns the event into the pointer given to it. It's a structure
+which contains
typedef struct
{
short id; /* ID to distinguish multiple devices */
int x, y, z; /* event coordinates */
mmask_t bstate; /* button state bits */
- }
-
-
-
-
The bstate is the main variable we
-are interested in. It tells the button state of the mouse.
-
Then with a code snippet like the following, we can find out
-what happened.
The functions mouse_trafo() and wmouse_trafo() can be used to
-convert to mouse co-ordinates to screen relative co-ordinates. See
-curs_mouse(3X) man page for details.
-
The mouseinterval function sets the maximum time (in thousands
-of a second) that can elapse between press and release events in
-order for them to be recognized as a click. This function returns
-the previous interval value. The default is one fifth of a
-second.
In this section, we will look into some functions, which allow
-us to manage the screen efficiently and to write some fancy
-programs. This is especially important in writing games.
The function getyx() can be used to
-find out the present cursor co-ordinates. It will fill the values
-of x and y co-ordinates in the arguments given to it. Since getyx()
-is a macro you don't have to pass the address of the variables. It
-can be called as
The functions mouse_trafo() and wmouse_trafo() can be used to convert to mouse
+co-ordinates to screen relative co-ordinates. See curs_mouse(3X) man page for details.
The mouseinterval function sets the maximum time (in thousands of a
+second) that can elapse between press and release events in order for
+them to be recognized as a click. This function returns the previous
+interval value. The default is one fifth of a second.
In this section, we will look into some functions, which allow us to manage the
+screen efficiently and to write some fancy programs. This is especially
+important in writing games.
The function getyx() can be used to find out
+the present cursor co-ordinates. It will fill the values of x and y co-ordinates
+in the arguments given to it. Since getyx() is a macro you don't have to pass
+the address of the variables. It can be called as
getyx(win, y, x);
/* win: window pointer
* y, x: y, x co-ordinates will be put into this variables
- */
-
-
-
-
The function getparyx() gets the beginning co-ordinates of the
-sub window relative to the main window. This is some times useful
-to update a sub window. When designing fancy stuff like writing
-multiple menus, it becomes difficult to store the menu positions,
-their first option co-ordinates etc. A simple solution to this
-problem, is to create menus in sub windows and later find the
-starting co-ordinates of the menus by using getparyx().
-
The functions getbegyx() and getmaxyx() store current window's
-beginning and maximum co-ordinates. These functions are useful in
-the same way as above in managing the windows and sub windows
-effectively.
While writing games, some times it becomes necessary to store
-the state of the screen and restore it back to the same state. The
-function scr_dump() can be used to dump the screen contents to a
-file given as an argument. Later it can be restored by scr_restore
-function. These two simple functions can be used effectively to
-maintain a fast moving game with changing scenarios.
To store and restore windows, the functions putwin() and getwin()
-can be used. putwin() puts the present
-window state into a file, which can be later restored by
-getwin().
-
The function copywin() can be used to
-copy a window completely onto another window. It takes the source
-and destination windows as parameters and according to the
-rectangle specified, it copies the rectangular region from source
-to destination window. It's last parameter specifies whether to
-overwrite or just overlay the contents on to the destination
-window. If this argument is true, then the copying is
-non-destructive.
Now you know enough features to write a good curses program,
-with all bells and whistles. There are some miscellaneous functions
-which are useful in various cases. Let's go headlong into some of
-those.
This function can be used to make the cursor invisible. The
-parameter to this function should be
-
-
-
-
- 0 : invisible or
+ */
The function getparyx() gets the beginning co-ordinates of the sub window
+relative to the main window. This is some times useful to update a sub window.
+When designing fancy stuff like writing multiple menus, it becomes difficult to
+store the menu positions, their first option co-ordinates etc. A simple solution
+to this problem, is to create menus in sub windows and later find the starting
+co-ordinates of the menus by using getparyx().
The functions getbegyx() and getmaxyx() store current window's beginning and
+maximum co-ordinates. These functions are useful in the same way as above in
+managing the windows and sub windows effectively.
While writing games, some times it becomes necessary to store the state of the
+screen and restore it back to the same state. The function scr_dump() can be
+used to dump the screen contents to a file given as an argument. Later it can be
+restored by scr_restore function. These two simple functions can be used
+effectively to maintain a fast moving game with changing scenarios.
To store and restore windows, the functions
+putwin() and getwin() can be used. putwin() puts
+the present window state into a file, which can be later restored by
+getwin().
+The function copywin() can be used to copy a
+window completely onto another window. It takes the source and destination
+windows as parameters and according to the rectangle specified, it copies the
+rectangular region from source to destination window. It's last parameter
+specifies whether to overwrite or just overlay the contents on to the
+destination window. If this argument is true, then the copying is
+non-destructive.
Now you know enough features to write a good curses program, with all bells and
+whistles. There are some miscellaneous functions which are useful in various
+cases. Let's go headlong into some of those.
Some times you may want to get back to cooked mode (normal line
-buffering mode) temporarily. In such a case you will first need to
-save the tty modes with a call to def_prog_mode() and then call endwin() to end the curses mode. This will leave
-you in the original tty mode. To get back to curses once you are
-done, call reset_prog_mode() . This
-function returns the tty to the state stored by def_prog_mode(). Then do refresh(), and you are
-back to the curses mode. Here is an example showing the sequence of
-things to be done.
Some times you may want to get back to cooked mode (normal line buffering mode)
+temporarily. In such a case you will first need to save the tty modes with a
+call to def_prog_mode() and then call
+endwin() to end the curses mode. This will
+leave you in the original tty mode. To get back to curses once you are done,
+call reset_prog_mode() . This function returns
+the tty to the state stored by def_prog_mode(). Then do refresh(), and you are back to the curses mode. Here
+is an example showing the sequence of things to be done.
Example 12. Temporarily Leaving Curses Mode
#include <ncurses.h>
int main()
-{
- initscr(); /* Start curses mode */
- printw("Hello World !!!\n"); /* Print Hello World */
- refresh(); /* Print it on to the real screen */
- def_prog_mode(); /* Save the tty modes */
- endwin(); /* End curses mode temporarily */
- system("/bin/sh"); /* Do whatever you like in cooked mode */
- reset_prog_mode(); /* Return to the previous tty mode*/
- /* stored by def_prog_mode() */
- refresh(); /* Do refresh() to restore the */
- /* Screen contents */
- printw("Another String\n"); /* Back to curses use the full */
- refresh(); /* capabilities of curses */
- endwin(); /* End curses mode */
+{
+ initscr(); /* Start curses mode */
+ printw("Hello World !!!\n"); /* Print Hello World */
+ refresh(); /* Print it on to the real screen */
+ def_prog_mode(); /* Save the tty modes */
+ endwin(); /* End curses mode temporarily */
+ system("/bin/sh"); /* Do whatever you like in cooked mode */
+ reset_prog_mode(); /* Return to the previous tty mode*/
+ /* stored by def_prog_mode() */
+ refresh(); /* Do refresh() to restore the */
+ /* Screen contents */
+ printw("Another String\n"); /* Back to curses use the full */
+ refresh(); /* capabilities of curses */
+ endwin(); /* End curses mode */
- return 0;
-}
-
If you have ever programmed in DOS, you know about those nifty
-characters in extended character set. They are printable only on
-some terminals. NCURSES functions like box() use these characters. All these variables
-start with ACS meaning alternative character set. You might have
-noticed me using these characters in some of the programs above.
-Here's an example showing all the characters.
If you have ever programmed in DOS, you know about those nifty characters in
+extended character set. They are printable only on some terminals. NCURSES
+functions like box() use these characters. All
+these variables start with ACS meaning alternative character set. You might have
+noticed me using these characters in some of the programs above. Here's an example
+showing all the characters.
Example 13. ACS Variables Example
#include <ncurses.h>
int main()
{
@@ -2790,181 +4200,218 @@ int main()
getch();
endwin();
- return 0;
-}
-
Apart from the curses library, there are few text mode
-libraries, which provide more functionality and a lot of features.
-The following sections explain three standard libraries which are
-usually distributed along with curses.
Now that you are proficient in curses, you wanted to do some
-thing big. You created a lot of overlapping windows to give a
-professional windows-type look. Unfortunately, it soon becomes
-difficult to manage these. The multiple refreshes, updates plunge
-you into a nightmare. The overlapping windows create blotches,
-whenever you forget to refresh the windows in the proper order.
-
Don't despair. There's an elegant solution provided in panels
-library. In the words of developers of ncurses
-
When your interface design is such that windows may dive
-deeper into the visibility stack or pop to the top at runtime, the
-resulting book-keeping can be tedious and difficult to get right.
-Hence the panels library.
-
If you have lot of overlapping windows, then panels library is
-the way to go. It obviates the need of doing series of
-wnoutrefresh(), doupdate() and relieves the burden of doing it
-correctly(bottom up). The library maintains information about the
-order of windows, their overlapping and update the screen properly.
-So why wait? Let's take a close peek into panels.
Panel object is a window that is implicitly treated as part of a
-deck including all other panel objects. The deck is treated as a
-stack with the top panel being completely visible and the other
-panels may or may not be obscured according to their positions. So
-the basic idea is to create a stack of overlapping panels and use
-panels library to display them correctly. There is a function
-similar to refresh() which, when called , displays panels in the
-correct order. Functions are provided to hide or show panels, move
-panels, change its size etc.. The overlapping problem is managed by
-the panels library during all the calls to these functions.
-
The general flow of a panel program goes like this:
-
-
-
Create the windows (with newwin()) to be attached to the
-panels.
-
-
-
Create panels with the chosen visibility order. Stack them up
-according to the desired visibility. The function new_panel() is
-used to created panels.
-
-
-
Call update_panels() to write the panels to the virtual screen
-in correct visibility order. Do a doupdate() to show it on the
-screen.
-
-
-
Mainpulate the panels with show_panel(), hide_panel(),
-move_panel() etc. Make use of helper functions like panel_hidden()
-and panel_window(). Make use of user pointer to store custom data
-for a panel. Use the functions set_panel_userptr() and
-panel_userptr() to set and get the user pointer for a panel.
-
-
-
When you are done with the panel use del_panel() to delete the
-panel.
-
-
-
Let's make the concepts clear, with some programs. The following
-is a simple program which creates 3 overlapping panels and shows
-them on the screen.
To use panels library functions, you have to include panel.h and
-to link the program with panels library the flag -lpanel should be
-added along with -lncurses in that order.
Apart from the curses library, there are few text mode libraries, which provide
+more functionality and a lot of features. The following sections explain three
+standard libraries which are usually distributed along with curses.
Now that you are proficient in curses, you wanted to do some thing big. You
+created a lot of overlapping windows to give a professional windows-type look.
+Unfortunately, it soon becomes difficult to manage these. The multiple
+refreshes, updates plunge you into a nightmare. The overlapping windows create
+blotches, whenever you forget to refresh the windows in the proper order.
Don't despair. There's an elegant solution provided in panels library. In the
+words of developers of ncurses
When your interface design is such that windows may dive deeper into the
+visibility stack or pop to the top at runtime, the resulting book-keeping can be
+tedious and difficult to get right. Hence the panels library.
If you have lot of overlapping windows, then panels library is the way to go. It
+obviates the need of doing series of wnoutrefresh(), doupdate() and relieves the
+burden of doing it correctly(bottom up). The library maintains information about
+the order of windows, their overlapping and update the screen properly. So why
+wait? Let's take a close peek into panels.
Panel object is a window that is implicitly treated as part of a deck including
+all other panel objects. The deck is treated as a stack with the top panel being
+completely visible and the other panels may or may not be obscured according to
+their positions. So the basic idea is to create a stack of overlapping panels
+and use panels library to display them correctly. There is a function similar to
+refresh() which, when called , displays panels in the correct order. Functions
+are provided to hide or show panels, move panels, change its size etc.. The
+overlapping problem is managed by the panels library during all the calls to
+these functions.
The general flow of a panel program goes like this:
+
+
Create the windows (with newwin()) to be attached to the panels.
Create panels with the chosen visibility order. Stack them up according to the
+desired visibility. The function new_panel() is used to created panels.
Call update_panels() to write the panels to the virtual screen in correct
+visibility order. Do a doupdate() to show it on the screen.
Mainpulate the panels with show_panel(), hide_panel(), move_panel() etc. Make
+use of helper functions like panel_hidden() and panel_window(). Make use of user
+pointer to store custom data for a panel. Use the functions set_panel_userptr()
+and panel_userptr() to set and get the user pointer for a panel.
When you are done with the panel use del_panel() to delete the panel.
Let's make the concepts clear, with some programs. The following is a simple
+program which creates 3 overlapping panels and shows them on the screen.
To use panels library functions, you have to include panel.h and to link the
+program with panels library the flag -lpanel should be added along with
+-lncurses in that order.
#include <panel.h>
int main()
-{ WINDOW *my_wins[3];
- PANEL *my_panels[3];
- int lines = 10, cols = 40, y = 2, x = 4, i;
+{ WINDOW *my_wins[3];
+ PANEL *my_panels[3];
+ int lines = 10, cols = 40, y = 2, x = 4, i;
- initscr();
- cbreak();
- noecho();
+ initscr();
+ cbreak();
+ noecho();
- /* Create windows for the panels */
- my_wins[0] = newwin(lines, cols, y, x);
- my_wins[1] = newwin(lines, cols, y + 1, x + 5);
- my_wins[2] = newwin(lines, cols, y + 2, x + 10);
+ /* Create windows for the panels */
+ my_wins[0] = newwin(lines, cols, y, x);
+ my_wins[1] = newwin(lines, cols, y + 1, x + 5);
+ my_wins[2] = newwin(lines, cols, y + 2, x + 10);
- /*
- * Create borders around the windows so that you can see the effect
- * of panels
- */
- for(i = 0; i < 3; ++i)
- box(my_wins[i], 0, 0);
+ /*
+ * Create borders around the windows so that you can see the effect
+ * of panels
+ */
+ for(i = 0; i < 3; ++i)
+ box(my_wins[i], 0, 0);
- /* Attach a panel to each window */ /* Order is bottom up */
- my_panels[0] = new_panel(my_wins[0]); /* Push 0, order: stdscr-0 */
- my_panels[1] = new_panel(my_wins[1]); /* Push 1, order: stdscr-0-1 */
- my_panels[2] = new_panel(my_wins[2]); /* Push 2, order: stdscr-0-1-2 */
+ /* Attach a panel to each window */ /* Order is bottom up */
+ my_panels[0] = new_panel(my_wins[0]); /* Push 0, order: stdscr-0 */
+ my_panels[1] = new_panel(my_wins[1]); /* Push 1, order: stdscr-0-1 */
+ my_panels[2] = new_panel(my_wins[2]); /* Push 2, order: stdscr-0-1-2 */
- /* Update the stacking order. 2nd panel will be on top */
- update_panels();
+ /* Update the stacking order. 2nd panel will be on top */
+ update_panels();
- /* Show it on the screen */
- doupdate();
-
- getch();
- endwin();
+ /* Show it on the screen */
+ doupdate();
+
+ getch();
+ endwin();
}
-
-
-
-
-
-
As you can see, above program follows a simple flow as
-explained. The windows are created with newwin() and then they are
-attached to panels with new_panel(). As we attach one panel after
-another, the stack of panels gets updated. To put them on screen
-update_panels() and doupdate() are called.
A slightly complicated example is given below. This program
-creates 3 windows which can be cycled through using tab. Have a
-look at the code.
-
-
Example 15. Panel Window Browsing Example
-
-
-
-
-#include <panel.h>
+
As you can see, above program follows a simple flow as explained. The windows
+are created with newwin() and then they are attached to panels with new_panel().
+As we attach one panel after another, the stack of panels gets updated. To put
+them on screen update_panels() and doupdate() are called.
In the above example I used user pointers to find out the next
-window in the cycle. We can attach custom information to the panel
-by specifying a user pointer, which can point to any information
-you want to store. In this case I stored the pointer to the next
-panel in the cycle. User pointer for a panel can be set with the
-function set_panel_userptr(). It can be
-accessed using the function panel_userptr() which will return the user pointer
-for the panel given as argument. After finding the next panel in
-the cycle It's brought to the top by the function top_panel(). This
-function brings the panel given as argument to the top of the panel
-stack.
The function move_panel() can be used
-to move a panel to the desired location. It does not change the
-position of the panel in the stack. Make sure that you use
-move_panel() instead mvwin() on the window associated with the
-panel.
-
Resizing a panel is slightly complex. There is no straight
-forward function just to resize the window associated with a panel.
-A solution to resize a panel is to create a new window with the
-desired sizes, change the window associated with the panel using
-replace_panel(). Don't forget to delete the old window. The window
-associated with a panel can be found by using the function
-panel_window().
-
The following program shows these concepts, in supposedly simple
-program. You can cycle through the window with <TAB> as
-usual. To resize or move the active panel press 'r' for resize 'm'
-for moving. Then use arrow keys to resize or move it to the desired
-way and press enter to end your resizing or moving. This example
-makes use of user data to get the required data to do the
-operations.
In the above example I used user pointers to find out the next window in the
+cycle. We can attach custom information to the panel by specifying a user
+pointer, which can point to any information you want to store. In this case I
+stored the pointer to the next panel in the cycle. User pointer for a panel can
+be set with the function set_panel_userptr().
+It can be accessed using the function panel_userptr() which will return the user pointer for the panel given as
+argument. After finding the next panel in the cycle It's brought to the top by
+the function top_panel(). This function brings the panel given as argument to
+the top of the panel stack.
The function move_panel() can be used to move a
+panel to the desired location. It does not change the position of the panel in
+the stack. Make sure that you use move_panel() instead mvwin() on the window
+associated with the panel.
Resizing a panel is slightly complex. There is no straight forward function
+just to resize the window associated with a panel. A solution to resize a panel
+is to create a new window with the desired sizes, change the window associated
+with the panel using replace_panel(). Don't forget to delete the old window. The
+window associated with a panel can be found by using the function
+panel_window().
The following program shows these concepts, in supposedly simple program. You
+can cycle through the window with <TAB> as usual. To resize or move the
+active panel press 'r' for resize 'm' for moving. Then use arrow keys to resize
+or move it to the desired way and press enter to end your resizing or moving.
+This example makes use of user data to get the required data to do the
+operations.
Example 16. Panel Moving and Resizing example
#include <panel.h>
typedef struct _PANEL_DATA {
- int x, y, w, h;
- char label[80];
- int label_color;
- PANEL *next;
+ int x, y, w, h;
+ char label[80];
+ int label_color;
+ PANEL *next;
}PANEL_DATA;
#define NLINES 10
@@ -3151,275 +4617,289 @@ void print_in_middle(WINDOW *win, int starty, int startx, int width, char *strin
void set_user_ptrs(PANEL **panels, int n);
int main()
-{ WINDOW *my_wins[3];
- PANEL *my_panels[3];
- PANEL_DATA *top;
- PANEL *stack_top;
- WINDOW *temp_win, *old_win;
- int ch;
- int newx, newy, neww, newh;
- int size = FALSE, move = FALSE;
+{ WINDOW *my_wins[3];
+ PANEL *my_panels[3];
+ PANEL_DATA *top;
+ PANEL *stack_top;
+ WINDOW *temp_win, *old_win;
+ int ch;
+ int newx, newy, neww, newh;
+ int size = FALSE, move = FALSE;
- /* Initialize curses */
- initscr();
- start_color();
- cbreak();
- noecho();
- keypad(stdscr, TRUE);
+ /* Initialize curses */
+ initscr();
+ start_color();
+ cbreak();
+ noecho();
+ keypad(stdscr, TRUE);
- /* Initialize all the colors */
- init_pair(1, COLOR_RED, COLOR_BLACK);
- init_pair(2, COLOR_GREEN, COLOR_BLACK);
- init_pair(3, COLOR_BLUE, COLOR_BLACK);
- init_pair(4, COLOR_CYAN, COLOR_BLACK);
+ /* Initialize all the colors */
+ init_pair(1, COLOR_RED, COLOR_BLACK);
+ init_pair(2, COLOR_GREEN, COLOR_BLACK);
+ init_pair(3, COLOR_BLUE, COLOR_BLACK);
+ init_pair(4, COLOR_CYAN, COLOR_BLACK);
- init_wins(my_wins, 3);
-
- /* Attach a panel to each window */ /* Order is bottom up */
- my_panels[0] = new_panel(my_wins[0]); /* Push 0, order: stdscr-0 */
- my_panels[1] = new_panel(my_wins[1]); /* Push 1, order: stdscr-0-1 */
- my_panels[2] = new_panel(my_wins[2]); /* Push 2, order: stdscr-0-1-2 */
+ init_wins(my_wins, 3);
+
+ /* Attach a panel to each window */ /* Order is bottom up */
+ my_panels[0] = new_panel(my_wins[0]); /* Push 0, order: stdscr-0 */
+ my_panels[1] = new_panel(my_wins[1]); /* Push 1, order: stdscr-0-1 */
+ my_panels[2] = new_panel(my_wins[2]); /* Push 2, order: stdscr-0-1-2 */
- set_user_ptrs(my_panels, 3);
- /* Update the stacking order. 2nd panel will be on top */
- update_panels();
+ set_user_ptrs(my_panels, 3);
+ /* Update the stacking order. 2nd panel will be on top */
+ update_panels();
- /* Show it on the screen */
- attron(COLOR_PAIR(4));
- mvprintw(LINES - 3, 0, "Use 'm' for moving, 'r' for resizing");
- mvprintw(LINES - 2, 0, "Use tab to browse through the windows (F1 to Exit)");
- attroff(COLOR_PAIR(4));
- doupdate();
+ /* Show it on the screen */
+ attron(COLOR_PAIR(4));
+ mvprintw(LINES - 3, 0, "Use 'm' for moving, 'r' for resizing");
+ mvprintw(LINES - 2, 0, "Use tab to browse through the windows (F1 to Exit)");
+ attroff(COLOR_PAIR(4));
+ doupdate();
- stack_top = my_panels[2];
- top = (PANEL_DATA *)panel_userptr(stack_top);
- newx = top->x;
- newy = top->y;
- neww = top->w;
- newh = top->h;
- while((ch = getch()) != KEY_F(1))
- { switch(ch)
- { case 9: /* Tab */
- top = (PANEL_DATA *)panel_userptr(stack_top);
- top_panel(top->next);
- stack_top = top->next;
- top = (PANEL_DATA *)panel_userptr(stack_top);
- newx = top->x;
- newy = top->y;
- neww = top->w;
- newh = top->h;
- break;
- case 'r': /* Re-Size*/
- size = TRUE;
- attron(COLOR_PAIR(4));
- mvprintw(LINES - 4, 0, "Entered Resizing :Use Arrow Keys to resize and press <ENTER> to end resizing");
- refresh();
- attroff(COLOR_PAIR(4));
- break;
- case 'm': /* Move */
- attron(COLOR_PAIR(4));
- mvprintw(LINES - 4, 0, "Entered Moving: Use Arrow Keys to Move and press <ENTER> to end moving");
- refresh();
- attroff(COLOR_PAIR(4));
- move = TRUE;
- break;
- case KEY_LEFT:
- if(size == TRUE)
- { --newx;
- ++neww;
- }
- if(move == TRUE)
- --newx;
- break;
- case KEY_RIGHT:
- if(size == TRUE)
- { ++newx;
- --neww;
- }
- if(move == TRUE)
- ++newx;
- break;
- case KEY_UP:
- if(size == TRUE)
- { --newy;
- ++newh;
- }
- if(move == TRUE)
- --newy;
- break;
- case KEY_DOWN:
- if(size == TRUE)
- { ++newy;
- --newh;
- }
- if(move == TRUE)
- ++newy;
- break;
- case 10: /* Enter */
- move(LINES - 4, 0);
- clrtoeol();
- refresh();
- if(size == TRUE)
- { old_win = panel_window(stack_top);
- temp_win = newwin(newh, neww, newy, newx);
- replace_panel(stack_top, temp_win);
- win_show(temp_win, top->label, top->label_color);
- delwin(old_win);
- size = FALSE;
- }
- if(move == TRUE)
- { move_panel(stack_top, newy, newx);
- move = FALSE;
- }
- break;
-
- }
- attron(COLOR_PAIR(4));
- mvprintw(LINES - 3, 0, "Use 'm' for moving, 'r' for resizing");
- mvprintw(LINES - 2, 0, "Use tab to browse through the windows (F1 to Exit)");
- attroff(COLOR_PAIR(4));
- refresh();
- update_panels();
- doupdate();
- }
- endwin();
- return 0;
+ stack_top = my_panels[2];
+ top = (PANEL_DATA *)panel_userptr(stack_top);
+ newx = top->x;
+ newy = top->y;
+ neww = top->w;
+ newh = top->h;
+ while((ch = getch()) != KEY_F(1))
+ { switch(ch)
+ { case 9: /* Tab */
+ top = (PANEL_DATA *)panel_userptr(stack_top);
+ top_panel(top->next);
+ stack_top = top->next;
+ top = (PANEL_DATA *)panel_userptr(stack_top);
+ newx = top->x;
+ newy = top->y;
+ neww = top->w;
+ newh = top->h;
+ break;
+ case 'r': /* Re-Size*/
+ size = TRUE;
+ attron(COLOR_PAIR(4));
+ mvprintw(LINES - 4, 0, "Entered Resizing :Use Arrow Keys to resize and press <ENTER> to end resizing");
+ refresh();
+ attroff(COLOR_PAIR(4));
+ break;
+ case 'm': /* Move */
+ attron(COLOR_PAIR(4));
+ mvprintw(LINES - 4, 0, "Entered Moving: Use Arrow Keys to Move and press <ENTER> to end moving");
+ refresh();
+ attroff(COLOR_PAIR(4));
+ move = TRUE;
+ break;
+ case KEY_LEFT:
+ if(size == TRUE)
+ { --newx;
+ ++neww;
+ }
+ if(move == TRUE)
+ --newx;
+ break;
+ case KEY_RIGHT:
+ if(size == TRUE)
+ { ++newx;
+ --neww;
+ }
+ if(move == TRUE)
+ ++newx;
+ break;
+ case KEY_UP:
+ if(size == TRUE)
+ { --newy;
+ ++newh;
+ }
+ if(move == TRUE)
+ --newy;
+ break;
+ case KEY_DOWN:
+ if(size == TRUE)
+ { ++newy;
+ --newh;
+ }
+ if(move == TRUE)
+ ++newy;
+ break;
+ case 10: /* Enter */
+ move(LINES - 4, 0);
+ clrtoeol();
+ refresh();
+ if(size == TRUE)
+ { old_win = panel_window(stack_top);
+ temp_win = newwin(newh, neww, newy, newx);
+ replace_panel(stack_top, temp_win);
+ win_show(temp_win, top->label, top->label_color);
+ delwin(old_win);
+ size = FALSE;
+ }
+ if(move == TRUE)
+ { move_panel(stack_top, newy, newx);
+ move = FALSE;
+ }
+ break;
+
+ }
+ attron(COLOR_PAIR(4));
+ mvprintw(LINES - 3, 0, "Use 'm' for moving, 'r' for resizing");
+ mvprintw(LINES - 2, 0, "Use tab to browse through the windows (F1 to Exit)");
+ attroff(COLOR_PAIR(4));
+ refresh();
+ update_panels();
+ doupdate();
+ }
+ endwin();
+ return 0;
}
/* Put all the windows */
void init_wins(WINDOW **wins, int n)
-{ int x, y, i;
- char label[80];
+{ int x, y, i;
+ char label[80];
- y = 2;
- x = 10;
- for(i = 0; i < n; ++i)
- { wins[i] = newwin(NLINES, NCOLS, y, x);
- sprintf(label, "Window Number %d", i + 1);
- win_show(wins[i], label, i + 1);
- y += 3;
- x += 7;
- }
+ y = 2;
+ x = 10;
+ for(i = 0; i < n; ++i)
+ { wins[i] = newwin(NLINES, NCOLS, y, x);
+ sprintf(label, "Window Number %d", i + 1);
+ win_show(wins[i], label, i + 1);
+ y += 3;
+ x += 7;
+ }
}
/* Set the PANEL_DATA structures for individual panels */
void set_user_ptrs(PANEL **panels, int n)
-{ PANEL_DATA *ptrs;
- WINDOW *win;
- int x, y, w, h, i;
- char temp[80];
-
- ptrs = (PANEL_DATA *)calloc(n, sizeof(PANEL_DATA));
+{ PANEL_DATA *ptrs;
+ WINDOW *win;
+ int x, y, w, h, i;
+ char temp[80];
+
+ ptrs = (PANEL_DATA *)calloc(n, sizeof(PANEL_DATA));
- for(i = 0;i < n; ++i)
- { win = panel_window(panels[i]);
- getbegyx(win, y, x);
- getmaxyx(win, h, w);
- ptrs[i].x = x;
- ptrs[i].y = y;
- ptrs[i].w = w;
- ptrs[i].h = h;
- sprintf(temp, "Window Number %d", i + 1);
- strcpy(ptrs[i].label, temp);
- ptrs[i].label_color = i + 1;
- if(i + 1 == n)
- ptrs[i].next = panels[0];
- else
- ptrs[i].next = panels[i + 1];
- set_panel_userptr(panels[i], &ptrs[i]);
- }
+ for(i = 0;i < n; ++i)
+ { win = panel_window(panels[i]);
+ getbegyx(win, y, x);
+ getmaxyx(win, h, w);
+ ptrs[i].x = x;
+ ptrs[i].y = y;
+ ptrs[i].w = w;
+ ptrs[i].h = h;
+ sprintf(temp, "Window Number %d", i + 1);
+ strcpy(ptrs[i].label, temp);
+ ptrs[i].label_color = i + 1;
+ if(i + 1 == n)
+ ptrs[i].next = panels[0];
+ else
+ ptrs[i].next = panels[i + 1];
+ set_panel_userptr(panels[i], &ptrs[i]);
+ }
}
/* Show the window with a border and a label */
void win_show(WINDOW *win, char *label, int label_color)
-{ int startx, starty, height, width;
+{ int startx, starty, height, width;
- getbegyx(win, starty, startx);
- getmaxyx(win, height, width);
+ getbegyx(win, starty, startx);
+ getmaxyx(win, height, width);
- box(win, 0, 0);
- mvwaddch(win, 2, 0, ACS_LTEE);
- mvwhline(win, 2, 1, ACS_HLINE, width - 2);
- mvwaddch(win, 2, width - 1, ACS_RTEE);
-
- print_in_middle(win, 1, 0, width, label, COLOR_PAIR(label_color));
+ box(win, 0, 0);
+ mvwaddch(win, 2, 0, ACS_LTEE);
+ mvwhline(win, 2, 1, ACS_HLINE, width - 2);
+ mvwaddch(win, 2, width - 1, ACS_RTEE);
+
+ print_in_middle(win, 1, 0, width, label, COLOR_PAIR(label_color));
}
void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color)
-{ int length, x, y;
- float temp;
+{ int length, x, y;
+ float temp;
- if(win == NULL)
- win = stdscr;
- getyx(win, y, x);
- if(startx != 0)
- x = startx;
- if(starty != 0)
- y = starty;
- if(width == 0)
- width = 80;
+ if(win == NULL)
+ win = stdscr;
+ getyx(win, y, x);
+ if(startx != 0)
+ x = startx;
+ if(starty != 0)
+ y = starty;
+ if(width == 0)
+ width = 80;
- length = strlen(string);
- temp = (width - length)/ 2;
- x = startx + (int)temp;
- wattron(win, color);
- mvwprintw(win, y, x, "%s", string);
- wattroff(win, color);
- refresh();
-}
-
-
-
-
-
Concentrate on the main while loop. Once it finds out the type
-of key pressed, it takes appropriate action. If 'r' is pressed
-resizing mode is started. After this the new sizes are updated as
-the user presses the arrow keys. When the user presses
-<ENTER> present selection ends and panel is resized by using
-the concept explained. While in resizing mode the program doesn't
-show how the window is getting resized. It's left as an exercise to
-the reader to print a dotted border while it gets resized to a new
-position.
-
When the user presses 'm' the move mode starts. This is a bit
-simpler than resizing. As the arrow keys are pressed the new
-position is updated and pressing of <ENTER> causes the panel
-to be moved by calling the function move_panel().
-
In this program the user data which is represented as
-PANEL_DATA, plays very important role in finding the associated
-information with a panel. As written in the comments, the
-PANEL_DATA stores the panel sizes, label, label color and a pointer
-to the next panel in the cycle.
A Panel can be hidden by using the function hide_panel(). This
-function merely removes it form the stack of panels, thus hiding it
-on the screen once you do update_panels() and doupdate(). It
-doesn't destroy the PANEL structure associated with the hidden
-panel. It can be shown again by using the show_panel()
-function.
-
The following program shows the hiding of panels. Press 'a' or
-'b' or 'c' to show or hide first, second and third windows
-respectively. It uses a user data with a small variable hide, which
-keeps track of whether the window is hidden or not. For some reason
-the function panel_hidden() which tells
-whether a panel is hidden or not is not working. A bug report was
-also presented by Michael Andres here
Concentrate on the main while loop. Once it finds out the type of key pressed,
+it takes appropriate action. If 'r' is pressed resizing mode is started. After
+this the new sizes are updated as the user presses the arrow keys. When the user
+presses <ENTER> present selection ends and panel is resized by using the
+concept explained. While in resizing mode the program doesn't show how the
+window is getting resized. It's left as an exercise to the reader to print a
+dotted border while it gets resized to a new position.
When the user presses 'm' the move mode starts. This is a bit simpler than
+resizing. As the arrow keys are pressed the new position is updated and
+pressing of <ENTER> causes the panel to be moved by calling the function
+move_panel().
In this program the user data which is represented as PANEL_DATA, plays very
+important role in finding the associated information with a panel. As written in
+the comments, the PANEL_DATA stores the panel sizes, label, label color and a
+pointer to the next panel in the cycle.
A Panel can be hidden by using the function hide_panel(). This function merely
+removes it form the stack of panels, thus hiding it on the screen once you do
+update_panels() and doupdate(). It doesn't destroy the PANEL structure
+associated with the hidden panel. It can be shown again by using the
+show_panel() function.
The following program shows the hiding of panels. Press 'a' or 'b' or 'c' to
+show or hide first, second and third windows respectively. It uses a user data
+with a small variable hide, which keeps track of whether the window is hidden or
+not. For some reason the function
+panel_hidden() which tells whether a panel is
+hidden or not is not working. A bug report was also presented by Michael Andres
+ here
Example 17. Panel Hiding and Showing example
#include <panel.h>
typedef struct _PANEL_DATA {
- int hide; /* TRUE if panel is hidden */
+ int hide; /* TRUE if panel is hidden */
}PANEL_DATA;
#define NLINES 10
@@ -3430,257 +4910,292 @@ void win_show(WINDOW *win, char *label, int label_color);
void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color);
int main()
-{ WINDOW *my_wins[3];
- PANEL *my_panels[3];
- PANEL_DATA panel_datas[3];
- PANEL_DATA *temp;
- int ch;
+{ WINDOW *my_wins[3];
+ PANEL *my_panels[3];
+ PANEL_DATA panel_datas[3];
+ PANEL_DATA *temp;
+ int ch;
- /* Initialize curses */
- initscr();
- start_color();
- cbreak();
- noecho();
- keypad(stdscr, TRUE);
+ /* Initialize curses */
+ initscr();
+ start_color();
+ cbreak();
+ noecho();
+ keypad(stdscr, TRUE);
- /* Initialize all the colors */
- init_pair(1, COLOR_RED, COLOR_BLACK);
- init_pair(2, COLOR_GREEN, COLOR_BLACK);
- init_pair(3, COLOR_BLUE, COLOR_BLACK);
- init_pair(4, COLOR_CYAN, COLOR_BLACK);
+ /* Initialize all the colors */
+ init_pair(1, COLOR_RED, COLOR_BLACK);
+ init_pair(2, COLOR_GREEN, COLOR_BLACK);
+ init_pair(3, COLOR_BLUE, COLOR_BLACK);
+ init_pair(4, COLOR_CYAN, COLOR_BLACK);
- init_wins(my_wins, 3);
-
- /* Attach a panel to each window */ /* Order is bottom up */
- my_panels[0] = new_panel(my_wins[0]); /* Push 0, order: stdscr-0 */
- my_panels[1] = new_panel(my_wins[1]); /* Push 1, order: stdscr-0-1 */
- my_panels[2] = new_panel(my_wins[2]); /* Push 2, order: stdscr-0-1-2 */
+ init_wins(my_wins, 3);
+
+ /* Attach a panel to each window */ /* Order is bottom up */
+ my_panels[0] = new_panel(my_wins[0]); /* Push 0, order: stdscr-0 */
+ my_panels[1] = new_panel(my_wins[1]); /* Push 1, order: stdscr-0-1 */
+ my_panels[2] = new_panel(my_wins[2]); /* Push 2, order: stdscr-0-1-2 */
- /* Initialize panel datas saying that nothing is hidden */
- panel_datas[0].hide = FALSE;
- panel_datas[1].hide = FALSE;
- panel_datas[2].hide = FALSE;
+ /* Initialize panel datas saying that nothing is hidden */
+ panel_datas[0].hide = FALSE;
+ panel_datas[1].hide = FALSE;
+ panel_datas[2].hide = FALSE;
- set_panel_userptr(my_panels[0], &panel_datas[0]);
- set_panel_userptr(my_panels[1], &panel_datas[1]);
- set_panel_userptr(my_panels[2], &panel_datas[2]);
+ set_panel_userptr(my_panels[0], &panel_datas[0]);
+ set_panel_userptr(my_panels[1], &panel_datas[1]);
+ set_panel_userptr(my_panels[2], &panel_datas[2]);
- /* Update the stacking order. 2nd panel will be on top */
- update_panels();
+ /* Update the stacking order. 2nd panel will be on top */
+ update_panels();
- /* Show it on the screen */
- attron(COLOR_PAIR(4));
- mvprintw(LINES - 3, 0, "Show or Hide a window with 'a'(first window) 'b'(Second Window) 'c'(Third Window)");
- mvprintw(LINES - 2, 0, "F1 to Exit");
+ /* Show it on the screen */
+ attron(COLOR_PAIR(4));
+ mvprintw(LINES - 3, 0, "Show or Hide a window with 'a'(first window) 'b'(Second Window) 'c'(Third Window)");
+ mvprintw(LINES - 2, 0, "F1 to Exit");
- attroff(COLOR_PAIR(4));
- doupdate();
-
- while((ch = getch()) != KEY_F(1))
- { switch(ch)
- { case 'a':
- temp = (PANEL_DATA *)panel_userptr(my_panels[0]);
- if(temp->hide == FALSE)
- { hide_panel(my_panels[0]);
- temp->hide = TRUE;
- }
- else
- { show_panel(my_panels[0]);
- temp->hide = FALSE;
- }
- break;
- case 'b':
- temp = (PANEL_DATA *)panel_userptr(my_panels[1]);
- if(temp->hide == FALSE)
- { hide_panel(my_panels[1]);
- temp->hide = TRUE;
- }
- else
- { show_panel(my_panels[1]);
- temp->hide = FALSE;
- }
- break;
- case 'c':
- temp = (PANEL_DATA *)panel_userptr(my_panels[2]);
- if(temp->hide == FALSE)
- { hide_panel(my_panels[2]);
- temp->hide = TRUE;
- }
- else
- { show_panel(my_panels[2]);
- temp->hide = FALSE;
- }
- break;
- }
- update_panels();
- doupdate();
- }
- endwin();
- return 0;
+ attroff(COLOR_PAIR(4));
+ doupdate();
+
+ while((ch = getch()) != KEY_F(1))
+ { switch(ch)
+ { case 'a':
+ temp = (PANEL_DATA *)panel_userptr(my_panels[0]);
+ if(temp->hide == FALSE)
+ { hide_panel(my_panels[0]);
+ temp->hide = TRUE;
+ }
+ else
+ { show_panel(my_panels[0]);
+ temp->hide = FALSE;
+ }
+ break;
+ case 'b':
+ temp = (PANEL_DATA *)panel_userptr(my_panels[1]);
+ if(temp->hide == FALSE)
+ { hide_panel(my_panels[1]);
+ temp->hide = TRUE;
+ }
+ else
+ { show_panel(my_panels[1]);
+ temp->hide = FALSE;
+ }
+ break;
+ case 'c':
+ temp = (PANEL_DATA *)panel_userptr(my_panels[2]);
+ if(temp->hide == FALSE)
+ { hide_panel(my_panels[2]);
+ temp->hide = TRUE;
+ }
+ else
+ { show_panel(my_panels[2]);
+ temp->hide = FALSE;
+ }
+ break;
+ }
+ update_panels();
+ doupdate();
+ }
+ endwin();
+ return 0;
}
/* Put all the windows */
void init_wins(WINDOW **wins, int n)
-{ int x, y, i;
- char label[80];
+{ int x, y, i;
+ char label[80];
- y = 2;
- x = 10;
- for(i = 0; i < n; ++i)
- { wins[i] = newwin(NLINES, NCOLS, y, x);
- sprintf(label, "Window Number %d", i + 1);
- win_show(wins[i], label, i + 1);
- y += 3;
- x += 7;
- }
+ y = 2;
+ x = 10;
+ for(i = 0; i < n; ++i)
+ { wins[i] = newwin(NLINES, NCOLS, y, x);
+ sprintf(label, "Window Number %d", i + 1);
+ win_show(wins[i], label, i + 1);
+ y += 3;
+ x += 7;
+ }
}
/* Show the window with a border and a label */
void win_show(WINDOW *win, char *label, int label_color)
-{ int startx, starty, height, width;
+{ int startx, starty, height, width;
- getbegyx(win, starty, startx);
- getmaxyx(win, height, width);
+ getbegyx(win, starty, startx);
+ getmaxyx(win, height, width);
- box(win, 0, 0);
- mvwaddch(win, 2, 0, ACS_LTEE);
- mvwhline(win, 2, 1, ACS_HLINE, width - 2);
- mvwaddch(win, 2, width - 1, ACS_RTEE);
-
- print_in_middle(win, 1, 0, width, label, COLOR_PAIR(label_color));
+ box(win, 0, 0);
+ mvwaddch(win, 2, 0, ACS_LTEE);
+ mvwhline(win, 2, 1, ACS_HLINE, width - 2);
+ mvwaddch(win, 2, width - 1, ACS_RTEE);
+
+ print_in_middle(win, 1, 0, width, label, COLOR_PAIR(label_color));
}
void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color)
-{ int length, x, y;
- float temp;
+{ int length, x, y;
+ float temp;
- if(win == NULL)
- win = stdscr;
- getyx(win, y, x);
- if(startx != 0)
- x = startx;
- if(starty != 0)
- y = starty;
- if(width == 0)
- width = 80;
+ if(win == NULL)
+ win = stdscr;
+ getyx(win, y, x);
+ if(startx != 0)
+ x = startx;
+ if(starty != 0)
+ y = starty;
+ if(width == 0)
+ width = 80;
- length = strlen(string);
- temp = (width - length)/ 2;
- x = startx + (int)temp;
- wattron(win, color);
- mvwprintw(win, y, x, "%s", string);
- wattroff(win, color);
- refresh();
-}
-
The functions panel_above() and
-panel_below() can be used to find out
-the panel above and below a panel. If the argument to these
-functions is NULL, then they return a pointer to bottom panel and
-top panel respectively.
The menus library provides a nice extension to basic curses,
-through which you can create menus. It provides a set of functions
-to create menus. But they have to be customized to give a nicer
-look, with colors etc. Let's get into the details.
-
A menu is a screen display that assists the user to choose some
-subset of a given set of items. To put it simple, a menu is a
-collection of items from which one or more items can be chosen.
-Some readers might not be aware of multiple item selection
-capability. Menu library provides functionality to write menus from
-which the user can chose more than one item as the preferred
-choice. This is dealt with in a later section. Now it is time for
-some rudiments.
To create menus, you first create items, and then post the menu
-to the display. After that, all the processing of user responses is
-done in an elegant function menu_driver() which is the work horse
-of any menu program.
-
The general flow of control of a menu program looks like
-this.
-
-
-
Initialize curses
-
-
-
Create items using new_item(). You can specify a name and
-description for the items.
-
-
-
Create the menu with new_menu() by specifying the items to be
-attached with.
-
-
-
Post the menu with menu_post() and refresh the screen.
-
-
-
Process the user requests with a loop and do necessary updates
-to menu with menu_driver.
-
-
-
Unpost the menu with menu_unpost()
-
-
-
Free the memory allocated to menu by free_menu()
-
-
-
Free the memory allocated to the items with free_item()
-
-
-
End curses
-
-
-
Let's see a program which prints a simple menu and updates the
-current selection with up, down arrows.
To use menu library functions, you have to include menu.h and to
-link the program with menu library the flag -lmenu should be added
-along with -lncurses in that order.
The functions panel_above() and
+panel_below() can be used to find out the panel
+above and below a panel. If the argument to these functions is NULL, then they
+return a pointer to bottom panel and top panel respectively.
The menus library provides a nice extension to basic curses, through which you
+can create menus. It provides a set of functions to create menus. But they have
+to be customized to give a nicer look, with colors etc. Let's get into the
+details.
A menu is a screen display that assists the user to choose some subset of a
+given set of items. To put it simple, a menu is a collection of items from which
+one or more items can be chosen. Some readers might not be aware of multiple
+item selection capability. Menu library provides functionality to write menus
+from which the user can chose more than one item as the preferred choice. This
+is dealt with in a later section. Now it is time for some rudiments.
To create menus, you first create items, and then post the menu to the display.
+After that, all the processing of user responses is done in an elegant function
+menu_driver() which is the work horse of any menu program.
The general flow of control of a menu program looks like this.
+
Initialize curses
Create items using new_item(). You can specify a name and description for the
+items.
Create the menu with new_menu() by specifying the items to be attached with.
Post the menu with menu_post() and refresh the screen.
Process the user requests with a loop and do necessary updates to menu with
+menu_driver.
Unpost the menu with menu_unpost()
Free the memory allocated to menu by free_menu()
Free the memory allocated to the items with free_item()
End curses
Let's see a program which prints a simple menu and updates the current selection
+with up, down arrows.
To use menu library functions, you have to include menu.h and to link the
+program with menu library the flag -lmenu should be added along with -lncurses
+in that order.
This program demonstrates the basic concepts involved in
-creating a menu using menus library. First we create the items
-using new_item() and then attach them to the menu with new_menu()
-function. After posting the menu and refreshing the screen, the
-main processing loop starts. It reads user input and takes
-corresponding action. The function menu_driver() is the main work
-horse of the menu system. The second parameter to this function
-tells what's to be done with the menu. According to the parameter,
-menu_driver() does the corresponding task. The value can be either
-a menu navigational request, an ascii character, or a KEY_MOUSE
-special key associated with a mouse event.
-
The menu_driver accepts following navigational requests.
-
-
-
-
-
REQ_LEFT_ITEM Move left to an item.
+
This program demonstrates the basic concepts involved in creating a menu using
+menus library. First we create the items using new_item() and then attach them
+to the menu with new_menu() function. After posting the menu and refreshing the
+screen, the main processing loop starts. It reads user input and takes
+corresponding action. The function menu_driver() is the main work horse of the
+menu system. The second parameter to this function tells what's to be done with
+the menu. According to the parameter, menu_driver() does the corresponding task.
+The value can be either a menu navigational request, an ascii character, or a
+KEY_MOUSE special key associated with a mouse event.
The menu_driver accepts following navigational requests.
+
REQ_LEFT_ITEM Move left to an item.
REQ_RIGHT_ITEM Move right to an item.
REQ_UP_ITEM Move up to an item.
REQ_DOWN_ITEM Move down to an item.
@@ -3769,87 +5279,144 @@ special key associated with a mouse event.
REQ_CLEAR_PATTERN Clear the menu pattern buffer.
REQ_BACK_PATTERN Delete the previous character from the pattern buffer.
REQ_NEXT_MATCH Move to the next item matching the pattern match.
- REQ_PREV_MATCH Move to the previous item matching the pattern match.
-
-
-
-
Don't get overwhelmed by the number of options. We will see them
-slowly one after another. The options of interest in this example
-are REQ_UP_ITEM and REQ_DOWN_ITEM. These two options when passed to
-menu_driver, menu driver updates the current item to one item up or
-down respectively.
As you have seen in the above example, menu_driver plays an
-important role in updating the menu. It is very important to
-understand various options it takes and what they do. As explained
-above, the second parameter to menu_driver() can be either a
-navigational request, a printable character or a KEY_MOUSE key.
-Let's dissect the different navigational requests.
-
-
-
REQ_LEFT_ITEM and REQ_RIGHT_ITEM
-
A Menu can be displayed with multiple columns for more than one
-item. This can be done by using the menu_format()function. When a multi columnar menu
-is displayed these requests cause the menu driver to move the
-current selection to left or right.
-
-
-
REQ_UP_ITEM and REQ_DOWN_ITEM
-
These two options you have seen in the above example. These
-options when given, makes the menu_driver to move the current
-selection to an item up or down.
-
-
-
REQ_SCR_* options
-
The four options REQ_SCR_ULINE, REQ_SCR_DLINE, REQ_SCR_DPAGE,
-REQ_SCR_UPAGE are related to scrolling. If all the items in the
-menu cannot be displayed in the menu sub window, then the menu is
-scrollable. These requests can be given to the menu_driver to do
-the scrolling either one line up, down or one page down or up
-respectively.
-
-
-
REQ_FIRST_ITEM, REQ_LAST_ITEM, REQ_NEXT_ITEM and
-REQ_PREV_ITEM
-
These requests are self explanatory.
-
-
-
REQ_TOGGLE_ITEM
-
This request when given, toggles the present selection. This
-option is to be used only in a multi valued menu. So to use this
-request the option O_ONEVALUE must be off. This option can be made
-off or on with set_menu_opts().
-
-
-
Pattern Requests
-
Every menu has an associated pattern buffer, which is used to
-find the nearest match to the ascii characters entered by the user.
-Whenever ascii characters are given to menu_driver, it puts in to
-the pattern buffer. It also tries to find the nearest match to the
-pattern in the items list and moves current selection to that item.
-The request REQ_CLEAR_PATTERN clears the pattern buffer. The
-request REQ_BACK_PATTERN deletes the previous character in the
-pattern buffer. In case the pattern matches more than one item then
-the matched items can be cycled through REQ_NEXT_MATCH and
-REQ_PREV_MATCH which move the current selection to the next and
-previous matches respectively.
-
-
-
Mouse Requests
-
In case of KEY_MOUSE requests, according to the mouse position
-an action is taken accordingly. The action to be taken is explained
-in the man page as,
-
-
-
-
- If the second argument is the KEY_MOUSE special key, the
+ REQ_PREV_MATCH Move to the previous item matching the pattern match.
Don't get overwhelmed by the number of options. We will see them slowly one
+after another. The options of interest in this example are REQ_UP_ITEM and
+REQ_DOWN_ITEM. These two options when passed to menu_driver, menu driver
+updates the current item to one item up or down respectively.
As you have seen in the above example, menu_driver plays an important role in
+updating the menu. It is very important to understand various options it takes
+and what they do. As explained above, the second parameter to menu_driver() can
+be either a navigational request, a printable character or a KEY_MOUSE key.
+Let's dissect the different navigational requests.
REQ_LEFT_ITEM and REQ_RIGHT_ITEM
A Menu can be displayed with multiple columns for more than one item. This can
+be done by using the menu_format()function.
+When a multi columnar menu is displayed these requests cause the menu driver to
+move the current selection to left or right.
REQ_UP_ITEM and REQ_DOWN_ITEM
These two options you have seen in the above example. These options when given,
+makes the menu_driver to move the current selection to an item up or down.
REQ_SCR_* options
The four options REQ_SCR_ULINE, REQ_SCR_DLINE, REQ_SCR_DPAGE, REQ_SCR_UPAGE are
+related to scrolling. If all the items in the menu cannot be displayed in the
+menu sub window, then the menu is scrollable. These requests can be given to the
+menu_driver to do the scrolling either one line up, down or one page down or up
+respectively.
REQ_FIRST_ITEM, REQ_LAST_ITEM, REQ_NEXT_ITEM and
+REQ_PREV_ITEM
These requests are self explanatory.
REQ_TOGGLE_ITEM
This request when given, toggles the present selection. This option is to be
+used only in a multi valued menu. So to use this request the option O_ONEVALUE
+must be off. This option can be made off or on with set_menu_opts().
Pattern Requests
Every menu has an associated pattern buffer, which is used to find the nearest
+match to the ascii characters entered by the user. Whenever ascii characters are
+given to menu_driver, it puts in to the pattern buffer. It also tries to find
+the nearest match to the pattern in the items list and moves current selection
+to that item. The request REQ_CLEAR_PATTERN clears the pattern buffer. The
+request REQ_BACK_PATTERN deletes the previous character in the pattern buffer.
+In case the pattern matches more than one item then the matched items can be
+cycled through REQ_NEXT_MATCH and REQ_PREV_MATCH which move the current
+selection to the next and previous matches respectively.
Mouse Requests
In case of KEY_MOUSE requests, according to the mouse position an action is
+taken accordingly. The action to be taken is explained in the man page as,
If the second argument is the KEY_MOUSE special key, the
associated mouse event is translated into one of the above
pre-defined requests. Currently only clicks in the user
window (e.g. inside the menu display area or the decora
@@ -3861,39 +5428,49 @@ in the man page as,
generated, if you doubleclick a REQ_SCR_DPAGE is generated
and if you tripleclick a REQ_LAST_ITEM is generated. If
you click at an item inside the display area of the menu,
- the menu cursor is positioned to that item.
-
-
-
-
-
-
Each of the above requests will be explained in the following
-lines with several examples whenever appropriate.
Every menu created is associated with a window and a sub window.
-The menu window displays any title or border associated with the
-menu. The menu sub window displays the menu items currently
-available for selection. But we didn't specify any window or sub
-window in the simple example. When a window is not specified,
-stdscr is taken as the main window, and then menu system calculates
-the sub window size required for the display of items. Then items
-are displayed in the calculated sub window. So let's play with
-these windows and display a menu with a border and a title.
-
-
Example 19. Menu Windows Usage example
-
-
-
-
-#include <menu.h>
+ the menu cursor is positioned to that item.
Each of the above requests will be explained in the following lines with several
+examples whenever appropriate.
Every menu created is associated with a window and a sub window. The menu window
+displays any title or border associated with the menu. The menu sub window
+displays the menu items currently available for selection. But we didn't specify
+any window or sub window in the simple example. When a window is not specified,
+stdscr is taken as the main window, and then menu system calculates the sub
+window size required for the display of items. Then items are displayed in the
+calculated sub window. So let's play with these windows and display a menu with
+a border and a title.
Example 19. Menu Windows Usage example
#include <menu.h>
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
-#define CTRLD 4
+#define CTRLD 4
char *choices[] = {
"Choice 1",
@@ -3906,392 +5483,403 @@ char *choices[] = {
void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color);
int main()
-{ ITEM **my_items;
- int c;
- MENU *my_menu;
+{ ITEM **my_items;
+ int c;
+ MENU *my_menu;
WINDOW *my_menu_win;
int n_choices, i;
-
- /* Initialize curses */
- initscr();
- start_color();
+
+ /* Initialize curses */
+ initscr();
+ start_color();
cbreak();
noecho();
- keypad(stdscr, TRUE);
- init_pair(1, COLOR_RED, COLOR_BLACK);
+ keypad(stdscr, TRUE);
+ init_pair(1, COLOR_RED, COLOR_BLACK);
- /* Create items */
+ /* Create items */
n_choices = ARRAY_SIZE(choices);
my_items = (ITEM **)calloc(n_choices, sizeof(ITEM *));
- for(i = 0; i < n_choices; ++i)
+ for(i = 0; i < n_choices; ++i)
my_items[i] = new_item(choices[i], choices[i]);
- /* Crate menu */
- my_menu = new_menu((ITEM **)my_items);
+ /* Crate menu */
+ my_menu = new_menu((ITEM **)my_items);
- /* Create the window to be associated with the menu */
+ /* Create the window to be associated with the menu */
my_menu_win = newwin(10, 40, 4, 4);
keypad(my_menu_win, TRUE);
- /* Set main window and sub window */
+ /* Set main window and sub window */
set_menu_win(my_menu, my_menu_win);
set_menu_sub(my_menu, derwin(my_menu_win, 6, 38, 3, 1));
- /* Set menu mark to the string " * " */
+ /* Set menu mark to the string " * " */
set_menu_mark(my_menu, " * ");
- /* Print a border around the main window and print a title */
+ /* Print a border around the main window and print a title */
box(my_menu_win, 0, 0);
- print_in_middle(my_menu_win, 1, 0, 40, "My Menu", COLOR_PAIR(1));
- mvwaddch(my_menu_win, 2, 0, ACS_LTEE);
- mvwhline(my_menu_win, 2, 1, ACS_HLINE, 38);
- mvwaddch(my_menu_win, 2, 39, ACS_RTEE);
- mvprintw(LINES - 2, 0, "F1 to exit");
- refresh();
+ print_in_middle(my_menu_win, 1, 0, 40, "My Menu", COLOR_PAIR(1));
+ mvwaddch(my_menu_win, 2, 0, ACS_LTEE);
+ mvwhline(my_menu_win, 2, 1, ACS_HLINE, 38);
+ mvwaddch(my_menu_win, 2, 39, ACS_RTEE);
+ mvprintw(LINES - 2, 0, "F1 to exit");
+ refresh();
- /* Post the menu */
- post_menu(my_menu);
- wrefresh(my_menu_win);
+ /* Post the menu */
+ post_menu(my_menu);
+ wrefresh(my_menu_win);
- while((c = wgetch(my_menu_win)) != KEY_F(1))
- { switch(c)
- { case KEY_DOWN:
- menu_driver(my_menu, REQ_DOWN_ITEM);
- break;
- case KEY_UP:
- menu_driver(my_menu, REQ_UP_ITEM);
- break;
- }
+ while((c = wgetch(my_menu_win)) != KEY_F(1))
+ { switch(c)
+ { case KEY_DOWN:
+ menu_driver(my_menu, REQ_DOWN_ITEM);
+ break;
+ case KEY_UP:
+ menu_driver(my_menu, REQ_UP_ITEM);
+ break;
+ }
wrefresh(my_menu_win);
- }
+ }
- /* Unpost and free all the memory taken up */
+ /* Unpost and free all the memory taken up */
unpost_menu(my_menu);
free_menu(my_menu);
- for(i = 0; i < n_choices; ++i)
+ for(i = 0; i < n_choices; ++i)
free_item(my_items[i]);
- endwin();
+ endwin();
}
void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color)
-{ int length, x, y;
- float temp;
+{ int length, x, y;
+ float temp;
- if(win == NULL)
- win = stdscr;
- getyx(win, y, x);
- if(startx != 0)
- x = startx;
- if(starty != 0)
- y = starty;
- if(width == 0)
- width = 80;
+ if(win == NULL)
+ win = stdscr;
+ getyx(win, y, x);
+ if(startx != 0)
+ x = startx;
+ if(starty != 0)
+ y = starty;
+ if(width == 0)
+ width = 80;
- length = strlen(string);
- temp = (width - length)/ 2;
- x = startx + (int)temp;
- wattron(win, color);
- mvwprintw(win, y, x, "%s", string);
- wattroff(win, color);
- refresh();
-}
-
-
-
-
-
This example creates a menu with a title, border, a fancy line
-separating title and the items. As you can see, in order to attach
-a window to a menu the function set_menu_win() has to be used. Then
-we attach the sub window also. This displays the items in the sub
-window. You can also set the mark string which gets displayed to
-the left of the selected item with set_menu_mark().
If the sub window given for a window is not big enough to show
-all the items, then the menu will be scrollable. When you are on
-the last item in the present list, if you send REQ_DOWN_ITEM, it
-gets translated into REQ_SCR_DLINE and the menu scrolls by one
-item. You can manually give REQ_SCR_ operations to do scrolling.
-Let's see how it can be done.
This example creates a menu with a title, border, a fancy line separating title
+and the items. As you can see, in order to attach a window to a menu the
+function set_menu_win() has to be used. Then we attach the sub window also. This
+displays the items in the sub window. You can also set the mark string which
+gets displayed to the left of the selected item with set_menu_mark().
If the sub window given for a window is not big enough to show all the items,
+then the menu will be scrollable. When you are on the last item in the present
+list, if you send REQ_DOWN_ITEM, it gets translated into REQ_SCR_DLINE and the
+menu scrolls by one item. You can manually give REQ_SCR_ operations to do
+scrolling. Let's see how it can be done.
Example 20. Scrolling Menus example
#include <curses.h>
+#include <menu.h>
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
-#define CTRLD 4
+#define CTRLD 4
char *choices[] = {
"Choice 1",
"Choice 2",
"Choice 3",
"Choice 4",
- "Choice 5",
- "Choice 6",
- "Choice 7",
- "Choice 8",
- "Choice 9",
- "Choice 10",
+ "Choice 5",
+ "Choice 6",
+ "Choice 7",
+ "Choice 8",
+ "Choice 9",
+ "Choice 10",
"Exit",
(char *)NULL,
};
void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color);
int main()
-{ ITEM **my_items;
- int c;
- MENU *my_menu;
+{ ITEM **my_items;
+ int c;
+ MENU *my_menu;
WINDOW *my_menu_win;
int n_choices, i;
-
- /* Initialize curses */
- initscr();
- start_color();
+
+ /* Initialize curses */
+ initscr();
+ start_color();
cbreak();
noecho();
- keypad(stdscr, TRUE);
- init_pair(1, COLOR_RED, COLOR_BLACK);
- init_pair(2, COLOR_CYAN, COLOR_BLACK);
+ keypad(stdscr, TRUE);
+ init_pair(1, COLOR_RED, COLOR_BLACK);
+ init_pair(2, COLOR_CYAN, COLOR_BLACK);
- /* Create items */
+ /* Create items */
n_choices = ARRAY_SIZE(choices);
my_items = (ITEM **)calloc(n_choices, sizeof(ITEM *));
- for(i = 0; i < n_choices; ++i)
+ for(i = 0; i < n_choices; ++i)
my_items[i] = new_item(choices[i], choices[i]);
- /* Crate menu */
- my_menu = new_menu((ITEM **)my_items);
+ /* Crate menu */
+ my_menu = new_menu((ITEM **)my_items);
- /* Create the window to be associated with the menu */
+ /* Create the window to be associated with the menu */
my_menu_win = newwin(10, 40, 4, 4);
keypad(my_menu_win, TRUE);
- /* Set main window and sub window */
+ /* Set main window and sub window */
set_menu_win(my_menu, my_menu_win);
set_menu_sub(my_menu, derwin(my_menu_win, 6, 38, 3, 1));
- set_menu_format(my_menu, 5, 1);
-
- /* Set menu mark to the string " * " */
+ set_menu_format(my_menu, 5, 1);
+
+ /* Set menu mark to the string " * " */
set_menu_mark(my_menu, " * ");
- /* Print a border around the main window and print a title */
+ /* Print a border around the main window and print a title */
box(my_menu_win, 0, 0);
- print_in_middle(my_menu_win, 1, 0, 40, "My Menu", COLOR_PAIR(1));
- mvwaddch(my_menu_win, 2, 0, ACS_LTEE);
- mvwhline(my_menu_win, 2, 1, ACS_HLINE, 38);
- mvwaddch(my_menu_win, 2, 39, ACS_RTEE);
+ print_in_middle(my_menu_win, 1, 0, 40, "My Menu", COLOR_PAIR(1));
+ mvwaddch(my_menu_win, 2, 0, ACS_LTEE);
+ mvwhline(my_menu_win, 2, 1, ACS_HLINE, 38);
+ mvwaddch(my_menu_win, 2, 39, ACS_RTEE);
- /* Post the menu */
- post_menu(my_menu);
- wrefresh(my_menu_win);
-
- attron(COLOR_PAIR(2));
- mvprintw(LINES - 2, 0, "Use PageUp and PageDown to scoll down or up a page of items");
- mvprintw(LINES - 1, 0, "Arrow Keys to navigate (F1 to Exit)");
- attroff(COLOR_PAIR(2));
- refresh();
+ /* Post the menu */
+ post_menu(my_menu);
+ wrefresh(my_menu_win);
+
+ attron(COLOR_PAIR(2));
+ mvprintw(LINES - 2, 0, "Use PageUp and PageDown to scoll down or up a page of items");
+ mvprintw(LINES - 1, 0, "Arrow Keys to navigate (F1 to Exit)");
+ attroff(COLOR_PAIR(2));
+ refresh();
- while((c = wgetch(my_menu_win)) != KEY_F(1))
- { switch(c)
- { case KEY_DOWN:
- menu_driver(my_menu, REQ_DOWN_ITEM);
- break;
- case KEY_UP:
- menu_driver(my_menu, REQ_UP_ITEM);
- break;
- case KEY_NPAGE:
- menu_driver(my_menu, REQ_SCR_DPAGE);
- break;
- case KEY_PPAGE:
- menu_driver(my_menu, REQ_SCR_UPAGE);
- break;
- }
+ while((c = wgetch(my_menu_win)) != KEY_F(1))
+ { switch(c)
+ { case KEY_DOWN:
+ menu_driver(my_menu, REQ_DOWN_ITEM);
+ break;
+ case KEY_UP:
+ menu_driver(my_menu, REQ_UP_ITEM);
+ break;
+ case KEY_NPAGE:
+ menu_driver(my_menu, REQ_SCR_DPAGE);
+ break;
+ case KEY_PPAGE:
+ menu_driver(my_menu, REQ_SCR_UPAGE);
+ break;
+ }
wrefresh(my_menu_win);
- }
+ }
- /* Unpost and free all the memory taken up */
+ /* Unpost and free all the memory taken up */
unpost_menu(my_menu);
free_menu(my_menu);
- for(i = 0; i < n_choices; ++i)
+ for(i = 0; i < n_choices; ++i)
free_item(my_items[i]);
- endwin();
+ endwin();
}
void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color)
-{ int length, x, y;
- float temp;
+{ int length, x, y;
+ float temp;
- if(win == NULL)
- win = stdscr;
- getyx(win, y, x);
- if(startx != 0)
- x = startx;
- if(starty != 0)
- y = starty;
- if(width == 0)
- width = 80;
+ if(win == NULL)
+ win = stdscr;
+ getyx(win, y, x);
+ if(startx != 0)
+ x = startx;
+ if(starty != 0)
+ y = starty;
+ if(width == 0)
+ width = 80;
- length = strlen(string);
- temp = (width - length)/ 2;
- x = startx + (int)temp;
- wattron(win, color);
- mvwprintw(win, y, x, "%s", string);
- wattroff(win, color);
- refresh();
-}
-
-
-
-
-
This program is self-explanatory. In this example the number of
-choices has been increased to ten, which is larger than our sub
-window size which can hold 6 items. This message has to be
-explicitly conveyed to the menu system with the function
-set_menu_format(). In here we specify the number of rows and
-columns we want to be displayed for a single page. We can specify
-any number of items to be shown, in the rows variables, if it is
-less than the height of the sub window. If the key pressed by the
-user is a PAGE UP or PAGE DOWN, the menu is scrolled a page due to
-the requests (REQ_SCR_DPAGE and REQ_SCR_UPAGE) given to
-menu_driver().
In the above example you have seen how to use the function
-set_menu_format(). I didn't mention what the cols variable (third
-parameter) does. Well, If your sub window is wide enough, you can
-opt to display more than one item per row. This can be specified in
-the cols variable. To make things simpler, the following example
-doesn't show descriptions for the items.
This program is self-explanatory. In this example the number of choices has been
+increased to ten, which is larger than our sub window size which can hold 6
+items. This message has to be explicitly conveyed to the menu system with the
+function set_menu_format(). In here we specify the number of rows and columns we
+want to be displayed for a single page. We can specify any number of items to be
+shown, in the rows variables, if it is less than the height of the sub window.
+If the key pressed by the user is a PAGE UP or PAGE DOWN, the menu is scrolled a
+page due to the requests (REQ_SCR_DPAGE and REQ_SCR_UPAGE) given to
+menu_driver().
In the above example you have seen how to use the function set_menu_format(). I
+didn't mention what the cols variable (third parameter) does. Well, If your sub
+window is wide enough, you can opt to display more than one item per row. This
+can be specified in the cols variable. To make things simpler, the following
+example doesn't show descriptions for the items.
Example 21. Milt Columnar Menus Example
#include <curses.h>
+#include <menu.h>
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
-#define CTRLD 4
+#define CTRLD 4
char *choices[] = {
"Choice 1", "Choice 2", "Choice 3", "Choice 4", "Choice 5",
- "Choice 6", "Choice 7", "Choice 8", "Choice 9", "Choice 10",
- "Choice 11", "Choice 12", "Choice 13", "Choice 14", "Choice 15",
- "Choice 16", "Choice 17", "Choice 18", "Choice 19", "Choice 20",
+ "Choice 6", "Choice 7", "Choice 8", "Choice 9", "Choice 10",
+ "Choice 11", "Choice 12", "Choice 13", "Choice 14", "Choice 15",
+ "Choice 16", "Choice 17", "Choice 18", "Choice 19", "Choice 20",
"Exit",
(char *)NULL,
};
int main()
-{ ITEM **my_items;
- int c;
- MENU *my_menu;
+{ ITEM **my_items;
+ int c;
+ MENU *my_menu;
WINDOW *my_menu_win;
int n_choices, i;
-
- /* Initialize curses */
- initscr();
- start_color();
+
+ /* Initialize curses */
+ initscr();
+ start_color();
cbreak();
noecho();
- keypad(stdscr, TRUE);
- init_pair(1, COLOR_RED, COLOR_BLACK);
- init_pair(2, COLOR_CYAN, COLOR_BLACK);
+ keypad(stdscr, TRUE);
+ init_pair(1, COLOR_RED, COLOR_BLACK);
+ init_pair(2, COLOR_CYAN, COLOR_BLACK);
- /* Create items */
+ /* Create items */
n_choices = ARRAY_SIZE(choices);
my_items = (ITEM **)calloc(n_choices, sizeof(ITEM *));
- for(i = 0; i < n_choices; ++i)
+ for(i = 0; i < n_choices; ++i)
my_items[i] = new_item(choices[i], choices[i]);
- /* Crate menu */
- my_menu = new_menu((ITEM **)my_items);
+ /* Crate menu */
+ my_menu = new_menu((ITEM **)my_items);
- /* Set menu option not to show the description */
- menu_opts_off(my_menu, O_SHOWDESC);
+ /* Set menu option not to show the description */
+ menu_opts_off(my_menu, O_SHOWDESC);
- /* Create the window to be associated with the menu */
+ /* Create the window to be associated with the menu */
my_menu_win = newwin(10, 70, 4, 4);
keypad(my_menu_win, TRUE);
- /* Set main window and sub window */
+ /* Set main window and sub window */
set_menu_win(my_menu, my_menu_win);
set_menu_sub(my_menu, derwin(my_menu_win, 6, 68, 3, 1));
- set_menu_format(my_menu, 5, 3);
- set_menu_mark(my_menu, " * ");
+ set_menu_format(my_menu, 5, 3);
+ set_menu_mark(my_menu, " * ");
- /* Print a border around the main window and print a title */
+ /* Print a border around the main window and print a title */
box(my_menu_win, 0, 0);
-
- attron(COLOR_PAIR(2));
- mvprintw(LINES - 3, 0, "Use PageUp and PageDown to scroll");
- mvprintw(LINES - 2, 0, "Use Arrow Keys to navigate (F1 to Exit)");
- attroff(COLOR_PAIR(2));
- refresh();
+
+ attron(COLOR_PAIR(2));
+ mvprintw(LINES - 3, 0, "Use PageUp and PageDown to scroll");
+ mvprintw(LINES - 2, 0, "Use Arrow Keys to navigate (F1 to Exit)");
+ attroff(COLOR_PAIR(2));
+ refresh();
- /* Post the menu */
- post_menu(my_menu);
- wrefresh(my_menu_win);
-
- while((c = wgetch(my_menu_win)) != KEY_F(1))
- { switch(c)
- { case KEY_DOWN:
- menu_driver(my_menu, REQ_DOWN_ITEM);
- break;
- case KEY_UP:
- menu_driver(my_menu, REQ_UP_ITEM);
- break;
- case KEY_LEFT:
- menu_driver(my_menu, REQ_LEFT_ITEM);
- break;
- case KEY_RIGHT:
- menu_driver(my_menu, REQ_RIGHT_ITEM);
- break;
- case KEY_NPAGE:
- menu_driver(my_menu, REQ_SCR_DPAGE);
- break;
- case KEY_PPAGE:
- menu_driver(my_menu, REQ_SCR_UPAGE);
- break;
- }
+ /* Post the menu */
+ post_menu(my_menu);
+ wrefresh(my_menu_win);
+
+ while((c = wgetch(my_menu_win)) != KEY_F(1))
+ { switch(c)
+ { case KEY_DOWN:
+ menu_driver(my_menu, REQ_DOWN_ITEM);
+ break;
+ case KEY_UP:
+ menu_driver(my_menu, REQ_UP_ITEM);
+ break;
+ case KEY_LEFT:
+ menu_driver(my_menu, REQ_LEFT_ITEM);
+ break;
+ case KEY_RIGHT:
+ menu_driver(my_menu, REQ_RIGHT_ITEM);
+ break;
+ case KEY_NPAGE:
+ menu_driver(my_menu, REQ_SCR_DPAGE);
+ break;
+ case KEY_PPAGE:
+ menu_driver(my_menu, REQ_SCR_UPAGE);
+ break;
+ }
wrefresh(my_menu_win);
- }
+ }
- /* Unpost and free all the memory taken up */
+ /* Unpost and free all the memory taken up */
unpost_menu(my_menu);
free_menu(my_menu);
- for(i = 0; i < n_choices; ++i)
+ for(i = 0; i < n_choices; ++i)
free_item(my_items[i]);
- endwin();
-}
-
-
-
-
-
Watch the function call to set_menu_format(). It specifies the
-number of columns to be 3, thus displaying 3 items per row. We have
-also switched off the showing descriptions with the function
-menu_opts_off(). There are couple of functions set_menu_opts(),
-menu_opts_on() and menu_opts() which can be used to manipulate menu
-options. The following menu options can be specified.
-
-
-
-
- O_ONEVALUE
+ endwin();
+}
Watch the function call to set_menu_format(). It specifies the number of columns
+to be 3, thus displaying 3 items per row. We have also switched off the showing
+descriptions with the function menu_opts_off(). There are couple of functions
+set_menu_opts(), menu_opts_on() and menu_opts() which can be used to manipulate
+menu options. The following menu options can be specified.
O_ONEVALUE
Only one item can be selected for this menu.
O_SHOWDESC
@@ -4310,633 +5898,684 @@ options. The following menu options can be specified.
O_NONCYCLIC
Don't wrap around next-item and previous-item,
- requests to the other end of the menu.
-
-
-
-
All options are on by default. You can switch specific
-attributes on or off with menu_opts_on() and menu_opts_off()
-functions. You can also use set_menu_opts() to directly specify the
-options. The argument to this function should be a OR ed value of
-some of those above constants. The function menu_opts() can be used
-to find out a menu's present options.
You might be wondering what if you switch off the option
-O_ONEVALUE. Then the menu becomes multi-valued. That means you can
-select more than one item. This brings us to the request
-REQ_TOGGLE_ITEM. Let's see it in action.
-
-
Example 22. Multi Valued Menus example
-
-
-
-
-#include <curses.h>
-#include <menu.h>
+ requests to the other end of the menu.
All options are on by default. You can switch specific attributes on or off with
+menu_opts_on() and menu_opts_off() functions. You can also use set_menu_opts()
+to directly specify the options. The argument to this function should be a OR ed
+value of some of those above constants. The function menu_opts() can be used to
+find out a menu's present options.
You might be wondering what if you switch off the option O_ONEVALUE. Then the
+menu becomes multi-valued. That means you can select more than one item. This
+brings us to the request REQ_TOGGLE_ITEM. Let's see it in action.
Whew, A lot of new functions. Let's take them one after another.
-Firstly, the REQ_TOGGLE_ITEM. In a multi-valued menu, the user
-should be allowed to select or un select more than one item. The
-request REQ_TOGGLE_ITEM toggles the present selection. In this case
-when space is pressed REQ_TOGGLE_ITEM request is sent to
-menu_driver to achieve the result.
-
Now when the user presses <ENTER> we show the items he
-presently selected. First we find out the items associated with the
-menu using the function menu_items(). Then we loop through the
-items to find out if the item is selected or not. The function
-item_value() returns TRUE if an item is selected. The function
-item_count() returns the number of items in the menu. The item name
-can be found with item_name(). You can also find the description
-associated with an item using item_description().
Well, by this time you must be itching for some difference in
-your menu, with lots of functionality. I know. You want Colors !!!.
-You want to create nice menus similar to those text mode dos
-games. The functions set_menu_fore() and set_menu_back() can be
-used to change the attribute of the selected item and unselected
-item. The names are misleading. They don't change menu's foreground
-or background which would have been useless.
-
The function set_menu_grey() can be used to set the display
-attribute for the non-selectable items in the menu. This brings us
-to the interesting option for an item the one and only
-O_SELECTABLE. We can turn it off by the function item_opts_off()
-and after that that item is not selectable. It's like a grayed item
-in those fancy windows menus. Let's put these concepts in practice
-with this example
-
-
Example 23. Menu Options example
-
-
-
-
-#include <menu.h>
+
Whew, A lot of new functions. Let's take them one after another. Firstly, the
+REQ_TOGGLE_ITEM. In a multi-valued menu, the user should be allowed to select
+or un select more than one item. The request REQ_TOGGLE_ITEM toggles the present
+selection. In this case when space is pressed REQ_TOGGLE_ITEM request is sent to
+menu_driver to achieve the result.
Now when the user presses <ENTER> we show the items he presently selected.
+First we find out the items associated with the menu using the function
+menu_items(). Then we loop through the items to find out if the item is selected
+or not. The function item_value() returns TRUE if an item is selected. The
+function item_count() returns the number of items in the menu. The item name can
+be found with item_name(). You can also find the description associated with an
+item using item_description().
Well, by this time you must be itching for some difference in your menu, with
+lots of functionality. I know. You want Colors !!!. You want to create nice
+menus similar to those text mode dos games. The functions
+set_menu_fore() and set_menu_back() can be used to change the attribute of the
+selected item and unselected item. The names are misleading. They don't change
+menu's foreground or background which would have been useless.
The function set_menu_grey() can be used to set the display attribute for the
+non-selectable items in the menu. This brings us to the interesting option for
+an item the one and only O_SELECTABLE. We can turn it off by the function
+item_opts_off() and after that that item is not selectable. It's like a grayed
+item in those fancy windows menus. Let's put these concepts in practice with
+this example
Example 23. Menu Options example
#include <menu.h>
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
-#define CTRLD 4
+#define CTRLD 4
char *choices[] = {
"Choice 1",
"Choice 2",
"Choice 3",
"Choice 4",
- "Choice 5",
- "Choice 6",
- "Choice 7",
+ "Choice 5",
+ "Choice 6",
+ "Choice 7",
"Exit",
};
int main()
-{ ITEM **my_items;
- int c;
- MENU *my_menu;
+{ ITEM **my_items;
+ int c;
+ MENU *my_menu;
int n_choices, i;
- ITEM *cur_item;
-
- /* Initialize curses */
- initscr();
- start_color();
+ ITEM *cur_item;
+
+ /* Initialize curses */
+ initscr();
+ start_color();
cbreak();
noecho();
- keypad(stdscr, TRUE);
- init_pair(1, COLOR_RED, COLOR_BLACK);
- init_pair(2, COLOR_GREEN, COLOR_BLACK);
- init_pair(3, COLOR_MAGENTA, COLOR_BLACK);
+ keypad(stdscr, TRUE);
+ init_pair(1, COLOR_RED, COLOR_BLACK);
+ init_pair(2, COLOR_GREEN, COLOR_BLACK);
+ init_pair(3, COLOR_MAGENTA, COLOR_BLACK);
- /* Initialize items */
+ /* Initialize items */
n_choices = ARRAY_SIZE(choices);
my_items = (ITEM **)calloc(n_choices + 1, sizeof(ITEM *));
- for(i = 0; i < n_choices; ++i)
+ for(i = 0; i < n_choices; ++i)
my_items[i] = new_item(choices[i], choices[i]);
- my_items[n_choices] = (ITEM *)NULL;
- item_opts_off(my_items[3], O_SELECTABLE);
- item_opts_off(my_items[6], O_SELECTABLE);
+ my_items[n_choices] = (ITEM *)NULL;
+ item_opts_off(my_items[3], O_SELECTABLE);
+ item_opts_off(my_items[6], O_SELECTABLE);
- /* Create menu */
- my_menu = new_menu((ITEM **)my_items);
+ /* Create menu */
+ my_menu = new_menu((ITEM **)my_items);
- /* Set fore ground and back ground of the menu */
- set_menu_fore(my_menu, COLOR_PAIR(1) | A_REVERSE);
- set_menu_back(my_menu, COLOR_PAIR(2));
- set_menu_grey(my_menu, COLOR_PAIR(3));
+ /* Set fore ground and back ground of the menu */
+ set_menu_fore(my_menu, COLOR_PAIR(1) | A_REVERSE);
+ set_menu_back(my_menu, COLOR_PAIR(2));
+ set_menu_grey(my_menu, COLOR_PAIR(3));
- /* Post the menu */
- mvprintw(LINES - 3, 0, "Press <ENTER> to see the option selected");
- mvprintw(LINES - 2, 0, "Up and Down arrow keys to naviage (F1 to Exit)");
- post_menu(my_menu);
- refresh();
+ /* Post the menu */
+ mvprintw(LINES - 3, 0, "Press <ENTER> to see the option selected");
+ mvprintw(LINES - 2, 0, "Up and Down arrow keys to naviage (F1 to Exit)");
+ post_menu(my_menu);
+ refresh();
- while((c = getch()) != KEY_F(1))
- { switch(c)
- { case KEY_DOWN:
- menu_driver(my_menu, REQ_DOWN_ITEM);
- break;
- case KEY_UP:
- menu_driver(my_menu, REQ_UP_ITEM);
- break;
- case 10: /* Enter */
- move(20, 0);
- clrtoeol();
- mvprintw(20, 0, "Item selected is : %s",
- item_name(current_item(my_menu)));
- pos_menu_cursor(my_menu);
- break;
- }
- }
- unpost_menu(my_menu);
- for(i = 0; i < n_choices; ++i)
- free_item(my_items[i]);
- free_menu(my_menu);
- endwin();
+ while((c = getch()) != KEY_F(1))
+ { switch(c)
+ { case KEY_DOWN:
+ menu_driver(my_menu, REQ_DOWN_ITEM);
+ break;
+ case KEY_UP:
+ menu_driver(my_menu, REQ_UP_ITEM);
+ break;
+ case 10: /* Enter */
+ move(20, 0);
+ clrtoeol();
+ mvprintw(20, 0, "Item selected is : %s",
+ item_name(current_item(my_menu)));
+ pos_menu_cursor(my_menu);
+ break;
+ }
+ }
+ unpost_menu(my_menu);
+ for(i = 0; i < n_choices; ++i)
+ free_item(my_items[i]);
+ free_menu(my_menu);
+ endwin();
}
-
-
We can associate a user pointer with each item in the menu. It
-works the same way as user pointer in panels. It's not touched by
-menu system. You can store any thing you like in that. I usually
-use it to store the function to be executed when the menu option is
-chosen (It's selected and may be the user pressed
-<ENTER>);
We can associate a user pointer with each item in the menu. It works the same
+way as user pointer in panels. It's not touched by menu system. You can store
+any thing you like in that. I usually use it to store the function to be
+executed when the menu option is chosen (It's selected and may be the user
+pressed <ENTER>);
Example 24. Menu User Pointer Usage
#include <curses.h>
+#include <menu.h>
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
-#define CTRLD 4
+#define CTRLD 4
char *choices[] = {
"Choice 1",
"Choice 2",
"Choice 3",
"Choice 4",
- "Choice 5",
- "Choice 6",
- "Choice 7",
+ "Choice 5",
+ "Choice 6",
+ "Choice 7",
"Exit",
};
void func(char *name);
int main()
-{ ITEM **my_items;
- int c;
- MENU *my_menu;
+{ ITEM **my_items;
+ int c;
+ MENU *my_menu;
int n_choices, i;
- ITEM *cur_item;
-
- /* Initialize curses */
- initscr();
- start_color();
+ ITEM *cur_item;
+
+ /* Initialize curses */
+ initscr();
+ start_color();
cbreak();
noecho();
- keypad(stdscr, TRUE);
- init_pair(1, COLOR_RED, COLOR_BLACK);
- init_pair(2, COLOR_GREEN, COLOR_BLACK);
- init_pair(3, COLOR_MAGENTA, COLOR_BLACK);
+ keypad(stdscr, TRUE);
+ init_pair(1, COLOR_RED, COLOR_BLACK);
+ init_pair(2, COLOR_GREEN, COLOR_BLACK);
+ init_pair(3, COLOR_MAGENTA, COLOR_BLACK);
- /* Initialize items */
+ /* Initialize items */
n_choices = ARRAY_SIZE(choices);
my_items = (ITEM **)calloc(n_choices + 1, sizeof(ITEM *));
- for(i = 0; i < n_choices; ++i)
- { my_items[i] = new_item(choices[i], choices[i]);
- /* Set the user pointer */
- set_item_userptr(my_items[i], func);
- }
- my_items[n_choices] = (ITEM *)NULL;
+ for(i = 0; i < n_choices; ++i)
+ { my_items[i] = new_item(choices[i], choices[i]);
+ /* Set the user pointer */
+ set_item_userptr(my_items[i], func);
+ }
+ my_items[n_choices] = (ITEM *)NULL;
- /* Create menu */
- my_menu = new_menu((ITEM **)my_items);
+ /* Create menu */
+ my_menu = new_menu((ITEM **)my_items);
- /* Post the menu */
- mvprintw(LINES - 3, 0, "Press <ENTER> to see the option selected");
- mvprintw(LINES - 2, 0, "Up and Down arrow keys to naviage (F1 to Exit)");
- post_menu(my_menu);
- refresh();
+ /* Post the menu */
+ mvprintw(LINES - 3, 0, "Press <ENTER> to see the option selected");
+ mvprintw(LINES - 2, 0, "Up and Down arrow keys to naviage (F1 to Exit)");
+ post_menu(my_menu);
+ refresh();
- while((c = getch()) != KEY_F(1))
- { switch(c)
- { case KEY_DOWN:
- menu_driver(my_menu, REQ_DOWN_ITEM);
- break;
- case KEY_UP:
- menu_driver(my_menu, REQ_UP_ITEM);
- break;
- case 10: /* Enter */
- { ITEM *cur;
- void (*p)(char *);
+ while((c = getch()) != KEY_F(1))
+ { switch(c)
+ { case KEY_DOWN:
+ menu_driver(my_menu, REQ_DOWN_ITEM);
+ break;
+ case KEY_UP:
+ menu_driver(my_menu, REQ_UP_ITEM);
+ break;
+ case 10: /* Enter */
+ { ITEM *cur;
+ void (*p)(char *);
- cur = current_item(my_menu);
- p = item_userptr(cur);
- p((char *)item_name(cur));
- pos_menu_cursor(my_menu);
- break;
- }
- break;
- }
- }
- unpost_menu(my_menu);
- for(i = 0; i < n_choices; ++i)
- free_item(my_items[i]);
- free_menu(my_menu);
- endwin();
+ cur = current_item(my_menu);
+ p = item_userptr(cur);
+ p((char *)item_name(cur));
+ pos_menu_cursor(my_menu);
+ break;
+ }
+ break;
+ }
+ }
+ unpost_menu(my_menu);
+ for(i = 0; i < n_choices; ++i)
+ free_item(my_items[i]);
+ free_menu(my_menu);
+ endwin();
}
void func(char *name)
-{ move(20, 0);
- clrtoeol();
- mvprintw(20, 0, "Item selected is : %s", name);
-}
-
Well. If you have seen those forms on web pages which take input
-from users and do various kinds of things, you might be wondering
-how would any one create such forms in text mode display. It's
-quite difficult to write those nifty forms in plain ncurses. Forms
-library tries to provide a basic frame work to build and maintain
-forms with ease. It has lot of features(functions) which manage
-validation, dynamic expansion of fields etc.. Let's see it in full
-flow.
-
A form is a collection of fields; each field can be either a
-label(static text) or a data-entry location. The forms also library
-provides functions to divide forms into multiple pages.
Forms are created in much the same way as menus. First the
-fields related to the form are created with new_field(). You can
-set options for the fields, so that they can be displayed with some
-fancy attributes, validated before the field looses focus etc..
-Then the fields are attached to form. After this, the form can be
-posted to display and is ready to receive inputs. On the similar
-lines to menu_driver(), the form is manipulated with form_driver().
-We can send requests to form_driver to move focus to a certain
-field, move cursor to end of the field etc.. After the user enters
-values in the fields and validation done, form can be unposted and
-memory allocated can be freed.
-
The general flow of control of a forms program looks like
-this.
-
-
-
Initialize curses
-
-
-
Create fields using new_field(). You can specify the height and
-width of the field, and its position on the form.
-
-
-
Create the forms with new_form() by specifying the fields to be
-attached with.
-
-
-
Post the form with form_post() and refresh the screen.
-
-
-
Process the user requests with a loop and do necessary updates
-to form with form_driver.
-
-
-
Unpost the menu with form_unpost()
-
-
-
Free the memory allocated to menu by free_form()
-
-
-
Free the memory allocated to the items with free_field()
-
-
-
End curses
-
-
-
As you can see, working with forms library is much similar to
-handling menu library. The following examples will explore various
-aspects of form processing. Let's start the journey with a simple
-example. first.
To use forms library functions, you have to include form.h and
-to link the program with forms library the flag -lform should be
-added along with -lncurses in that order.
Well. If you have seen those forms on web pages which take input from users and
+do various kinds of things, you might be wondering how would any one create such
+forms in text mode display. It's quite difficult to write those nifty forms in
+plain ncurses. Forms library tries to provide a basic frame work to build and
+maintain forms with ease. It has lot of features(functions) which manage
+validation, dynamic expansion of fields etc.. Let's see it in full flow.
A form is a collection of fields; each field can be either a label(static text)
+or a data-entry location. The forms also library provides functions to divide
+forms into multiple pages.
Forms are created in much the same way as menus. First the fields related to the
+form are created with new_field(). You can set options for the fields, so that
+they can be displayed with some fancy attributes, validated before the field
+looses focus etc.. Then the fields are attached to form. After this, the form
+can be posted to display and is ready to receive inputs. On the similar lines to
+menu_driver(), the form is manipulated with form_driver(). We can send requests
+to form_driver to move focus to a certain field, move cursor to end of the field
+etc.. After the user enters values in the fields and validation done, form can
+be unposted and memory allocated can be freed.
The general flow of control of a forms program looks like this.
+
+
Initialize curses
Create fields using new_field(). You can specify the height and
+width of the field, and its position on the form.
Create the forms with new_form() by specifying the fields to be
+attached with.
Post the form with form_post() and refresh the screen.
Process the user requests with a loop and do necessary updates
+to form with form_driver.
Unpost the menu with form_unpost()
Free the memory allocated to menu by free_form()
Free the memory allocated to the items with free_field()
End curses
As you can see, working with forms library is much similar to handling menu
+library. The following examples will explore various aspects of form
+processing. Let's start the journey with a simple example. first.
To use forms library functions, you have to include form.h and to link the
+program with forms library the flag -lform should be added along with -lncurses
+in that order.
#include <form.h>
int main()
-{ FIELD *field[3];
- FORM *my_form;
- int ch;
-
- /* Initialize curses */
- initscr();
- cbreak();
- noecho();
- keypad(stdscr, TRUE);
+{ FIELD *field[3];
+ FORM *my_form;
+ int ch;
+
+ /* Initialize curses */
+ initscr();
+ cbreak();
+ noecho();
+ keypad(stdscr, TRUE);
- /* Initialize the fields */
- field[0] = new_field(1, 10, 4, 18, 0, 0);
- field[1] = new_field(1, 10, 6, 18, 0, 0);
- field[2] = NULL;
+ /* Initialize the fields */
+ field[0] = new_field(1, 10, 4, 18, 0, 0);
+ field[1] = new_field(1, 10, 6, 18, 0, 0);
+ field[2] = NULL;
- /* Set field options */
- set_field_back(field[0], A_UNDERLINE); /* Print a line for the option */
- field_opts_off(field[0], O_AUTOSKIP); /* Don't go to next field when this */
- /* Field is filled up */
- set_field_back(field[1], A_UNDERLINE);
- field_opts_off(field[1], O_AUTOSKIP);
+ /* Set field options */
+ set_field_back(field[0], A_UNDERLINE); /* Print a line for the option */
+ field_opts_off(field[0], O_AUTOSKIP); /* Don't go to next field when this */
+ /* Field is filled up */
+ set_field_back(field[1], A_UNDERLINE);
+ field_opts_off(field[1], O_AUTOSKIP);
- /* Create the form and post it */
- my_form = new_form(field);
- post_form(my_form);
- refresh();
-
- mvprintw(4, 10, "Value 1:");
- mvprintw(6, 10, "Value 2:");
- refresh();
+ /* Create the form and post it */
+ my_form = new_form(field);
+ post_form(my_form);
+ refresh();
+
+ mvprintw(4, 10, "Value 1:");
+ mvprintw(6, 10, "Value 2:");
+ refresh();
- /* Loop through to get user requests */
- while((ch = getch()) != KEY_F(1))
- { switch(ch)
- { case KEY_DOWN:
- /* Go to next field */
- form_driver(my_form, REQ_NEXT_FIELD);
- /* Go to the end of the present buffer */
- /* Leaves nicely at the last character */
- form_driver(my_form, REQ_END_LINE);
- break;
- case KEY_UP:
- /* Go to previous field */
- form_driver(my_form, REQ_PREV_FIELD);
- form_driver(my_form, REQ_END_LINE);
- break;
- default:
- /* If this is a normal character, it gets */
- /* Printed */
- form_driver(my_form, ch);
- break;
- }
- }
+ /* Loop through to get user requests */
+ while((ch = getch()) != KEY_F(1))
+ { switch(ch)
+ { case KEY_DOWN:
+ /* Go to next field */
+ form_driver(my_form, REQ_NEXT_FIELD);
+ /* Go to the end of the present buffer */
+ /* Leaves nicely at the last character */
+ form_driver(my_form, REQ_END_LINE);
+ break;
+ case KEY_UP:
+ /* Go to previous field */
+ form_driver(my_form, REQ_PREV_FIELD);
+ form_driver(my_form, REQ_END_LINE);
+ break;
+ default:
+ /* If this is a normal character, it gets */
+ /* Printed */
+ form_driver(my_form, ch);
+ break;
+ }
+ }
- /* Un post form and free the memory */
- unpost_form(my_form);
- free_form(my_form);
- free_field(field[0]);
- free_field(field[1]);
+ /* Un post form and free the memory */
+ unpost_form(my_form);
+ free_form(my_form);
+ free_field(field[0]);
+ free_field(field[1]);
- endwin();
- return 0;
-}
-
-
-
-
-
Above example is pretty straight forward. It creates two fields
-with new_field(). new_field() takes
-height, width, starty, startx, number of offscreen rows and number
-of additional working buffers. The fifth argument number of
-offscreen rows specifies how much of the field to be shown. If it
-is zero, the entire field is always displayed otherwise the form
-will be scrollable when the user accesses not displayed parts of
-the field. The forms library allocates one buffer per field to
-store the data user enters. Using the last parameter to new_field()
-we can specify it to allocate some additional buffers. These can be
-used for any purpose you like.
-
After creating the fields, back ground attribute of both of them
-is set to an underscore with set_field_back(). The AUTOSKIP option
-is turned off using field_opts_off(). If this option is turned on,
-focus will move to the next field in the form once the active field
-is filled up completely.
-
After attaching the fields to the form, it is posted. Here on,
-user inputs are processed in the while loop, by making
-corresponding requests to form_driver. The details of all the
-requests to the form_driver() are explained later.
The parameters we have given at the time of creation of a field
-can be retrieved with field_info(). It returns height, width,
-starty, startx, number of offscreen rows, and number of additional
-buffers into the parameters given to it. It is a sort of inverse of
-new_field().
-
-
-
-
-int field_info( FIELD *field, /* field from which to fetch */
+ endwin();
+ return 0;
+}
Above example is pretty straight forward. It creates two fields with
+new_field(). new_field() takes height, width,
+starty, startx, number of offscreen rows and number of additional working
+buffers. The fifth argument number of offscreen rows specifies how much of the
+field to be shown. If it is zero, the entire field is always displayed otherwise
+the form will be scrollable when the user accesses not displayed parts of the
+field. The forms library allocates one buffer per field to store the data user
+enters. Using the last parameter to new_field() we can specify it to allocate
+some additional buffers. These can be used for any purpose you like.
After creating the fields, back ground attribute of both of them is set to an
+underscore with set_field_back(). The AUTOSKIP option is turned off using
+field_opts_off(). If this option is turned on, focus will move to the next
+field in the form once the active field is filled up completely.
After attaching the fields to the form, it is posted. Here on, user inputs are
+processed in the while loop, by making corresponding requests to form_driver.
+The details of all the requests to the form_driver() are explained later.
The parameters we have given at the time of creation of a field can be retrieved
+with field_info(). It returns height, width, starty, startx, number of offscreen
+rows, and number of additional buffers into the parameters given to it. It is a
+sort of inverse of new_field().
int field_info( FIELD *field, /* field from which to fetch */
int *height, *int width, /* field size */
int *top, int *left, /* upper left corner */
int *offscreen, /* number of offscreen rows */
- int *nbuf); /* number of working buffers */
-
The justification to be done for the field can be fixed using the function
+set_field_just().
int set_field_just(FIELD *field, /* field to alter */
int justmode); /* mode to set */
- int field_just(FIELD *field); /* fetch justify mode of field */
-
-
-
-
The justification mode valued accepted and returned by these
-functions are NO_JUSTIFICATION, JUSTIFY_RIGHT, JUSTIFY_LEFT, or
-JUSTIFY_CENTER.
As you have seen, in the above example, display attribute for
-the fields can be set with set_field_fore() and setfield_back().
-These functions set foreground and background attribute of the
-fields. You can also specify a pad character which will be filled
-in the unfilled portion of the field. The pad character is set with
-a call to set_field_pad(). Default pad value is a space. The
-functions field_fore(), field_back, field_pad() can be used to
-query the present foreground, background attributes and pad
-character for the field. The following list gives the usage of
-functions.
-
-
-
-
-
int set_field_fore(FIELD *field, /* field to alter */
+ int field_just(FIELD *field); /* fetch justify mode of field */
The justification mode valued accepted and returned by these functions are
+NO_JUSTIFICATION, JUSTIFY_RIGHT, JUSTIFY_LEFT, or JUSTIFY_CENTER.
As you have seen, in the above example, display attribute for the fields can be
+set with set_field_fore() and setfield_back(). These functions set foreground
+and background attribute of the fields. You can also specify a pad character
+which will be filled in the unfilled portion of the field. The pad character is
+set with a call to set_field_pad(). Default pad value is a space. The functions
+field_fore(), field_back, field_pad() can be used to query the present
+foreground, background attributes and pad character for the field. The following
+list gives the usage of functions.
int set_field_fore(FIELD *field, /* field to alter */
chtype attr); /* attribute to set */
chtype field_fore(FIELD *field); /* field to query */
@@ -4952,124 +6591,127 @@ int set_field_pad(FIELD *field, /* field to alter */
int pad); /* pad character to set */
chtype field_pad(FIELD *field); /* field to query */
- /* returns present pad character */
-
-
-
-
Though above functions seem quite simple, using colors with
-set_field_fore() may be frustrating in the beginning. Let me first
-explain about foreground and background attributes of a field. The
-foreground attribute is associated with the character. That means a
-character in the field is printed with the attribute you have set
-with set_field_fore(). Background attribute is the attribute used
-to fill background of field, whether any character is there or not.
-So what about colors? Since colors are always defined in pairs,
-what is the right way to display colored fields? Here's an example
-clarifying color attributes.
-
-
Example 26. Form Attributes example
-
-
-
-
-#include <form.h>
+ /* returns present pad character */
Though above functions seem quite simple, using colors with set_field_fore() may
+be frustrating in the beginning. Let me first explain about foreground and
+background attributes of a field. The foreground attribute is associated with
+the character. That means a character in the field is printed with the attribute
+you have set with set_field_fore(). Background attribute is the attribute used
+to fill background of field, whether any character is there or not. So what
+about colors? Since colors are always defined in pairs, what is the right way to
+display colored fields? Here's an example clarifying color attributes.
Example 26. Form Attributes example
#include <form.h>
int main()
-{ FIELD *field[3];
- FORM *my_form;
- int ch;
-
- /* Initialize curses */
- initscr();
- start_color();
- cbreak();
- noecho();
- keypad(stdscr, TRUE);
+{ FIELD *field[3];
+ FORM *my_form;
+ int ch;
+
+ /* Initialize curses */
+ initscr();
+ start_color();
+ cbreak();
+ noecho();
+ keypad(stdscr, TRUE);
- /* Initialize few color pairs */
- init_pair(1, COLOR_WHITE, COLOR_BLUE);
- init_pair(2, COLOR_WHITE, COLOR_BLUE);
+ /* Initialize few color pairs */
+ init_pair(1, COLOR_WHITE, COLOR_BLUE);
+ init_pair(2, COLOR_WHITE, COLOR_BLUE);
- /* Initialize the fields */
- field[0] = new_field(1, 10, 4, 18, 0, 0);
- field[1] = new_field(1, 10, 6, 18, 0, 0);
- field[2] = NULL;
+ /* Initialize the fields */
+ field[0] = new_field(1, 10, 4, 18, 0, 0);
+ field[1] = new_field(1, 10, 6, 18, 0, 0);
+ field[2] = NULL;
- /* Set field options */
- set_field_fore(field[0], COLOR_PAIR(1));/* Put the field with blue background */
- set_field_back(field[0], COLOR_PAIR(2));/* and white foreground (characters */
- /* are printed in white */
- field_opts_off(field[0], O_AUTOSKIP); /* Don't go to next field when this */
- /* Field is filled up */
- set_field_back(field[1], A_UNDERLINE);
- field_opts_off(field[1], O_AUTOSKIP);
+ /* Set field options */
+ set_field_fore(field[0], COLOR_PAIR(1));/* Put the field with blue background */
+ set_field_back(field[0], COLOR_PAIR(2));/* and white foreground (characters */
+ /* are printed in white */
+ field_opts_off(field[0], O_AUTOSKIP); /* Don't go to next field when this */
+ /* Field is filled up */
+ set_field_back(field[1], A_UNDERLINE);
+ field_opts_off(field[1], O_AUTOSKIP);
- /* Create the form and post it */
- my_form = new_form(field);
- post_form(my_form);
- refresh();
-
- set_current_field(my_form, field[0]); /* Set focus to the colored field */
- mvprintw(4, 10, "Value 1:");
- mvprintw(6, 10, "Value 2:");
- mvprintw(LINES - 2, 0, "Use UP, DOWN arrow keys to switch between fields");
- refresh();
+ /* Create the form and post it */
+ my_form = new_form(field);
+ post_form(my_form);
+ refresh();
+
+ set_current_field(my_form, field[0]); /* Set focus to the colored field */
+ mvprintw(4, 10, "Value 1:");
+ mvprintw(6, 10, "Value 2:");
+ mvprintw(LINES - 2, 0, "Use UP, DOWN arrow keys to switch between fields");
+ refresh();
- /* Loop through to get user requests */
- while((ch = getch()) != KEY_F(1))
- { switch(ch)
- { case KEY_DOWN:
- /* Go to next field */
- form_driver(my_form, REQ_NEXT_FIELD);
- /* Go to the end of the present buffer */
- /* Leaves nicely at the last character */
- form_driver(my_form, REQ_END_LINE);
- break;
- case KEY_UP:
- /* Go to previous field */
- form_driver(my_form, REQ_PREV_FIELD);
- form_driver(my_form, REQ_END_LINE);
- break;
- default:
- /* If this is a normal character, it gets */
- /* Printed */
- form_driver(my_form, ch);
- break;
- }
- }
+ /* Loop through to get user requests */
+ while((ch = getch()) != KEY_F(1))
+ { switch(ch)
+ { case KEY_DOWN:
+ /* Go to next field */
+ form_driver(my_form, REQ_NEXT_FIELD);
+ /* Go to the end of the present buffer */
+ /* Leaves nicely at the last character */
+ form_driver(my_form, REQ_END_LINE);
+ break;
+ case KEY_UP:
+ /* Go to previous field */
+ form_driver(my_form, REQ_PREV_FIELD);
+ form_driver(my_form, REQ_END_LINE);
+ break;
+ default:
+ /* If this is a normal character, it gets */
+ /* Printed */
+ form_driver(my_form, ch);
+ break;
+ }
+ }
- /* Un post form and free the memory */
- unpost_form(my_form);
- free_form(my_form);
- free_field(field[0]);
- free_field(field[1]);
+ /* Un post form and free the memory */
+ unpost_form(my_form);
+ free_form(my_form);
+ free_field(field[0]);
+ free_field(field[1]);
- endwin();
- return 0;
-}
-
-
-
-
-
Play with the color pairs and try to understand the foreground
-and background attributes. In my programs using color attributes, I
-usually set only the background with set_field_back(). Curses
-simply doesn't allow defining individual color attributes.
There is also a large collection of field option bits you can
-set to control various aspects of forms processing. You can
-manipulate them with these functions:
-
-
-
-
-int set_field_opts(FIELD *field, /* field to alter */
+ endwin();
+ return 0;
+}
Play with the color pairs and try to understand the foreground and background
+attributes. In my programs using color attributes, I usually set only the
+background with set_field_back(). Curses simply doesn't allow defining
+individual color attributes.
There is also a large collection of field option bits you can set to control
+various aspects of forms processing. You can manipulate them with these
+functions:
int set_field_opts(FIELD *field, /* field to alter */
int attr); /* attribute to set */
int field_opts_on(FIELD *field, /* field to alter */
@@ -5078,108 +6720,134 @@ int field_opts_on(FIELD *field, /* field to alter */
int field_opts_off(FIELD *field, /* field to alter */
int attr); /* attributes to turn off */
-int field_opts(FIELD *field); /* field to query */
-
-
-
-
The function set_field_opts() can be used to directly set
-attributes of a field or you can choose to switch a few attributes
-on and off with field_opts_on() and field_opts_off() selectively.
-Anytime you can query the attributes of a field with field_opts().
-The following is the list of available options. By default, all
-options are on.
-
-
-
O_VISIBLE
-
-
Controls whether the field is visible on the screen. Can be used
-during form processing to hide or pop up fields depending on the
-value of parent fields.
-
-
O_ACTIVE
-
-
Controls whether the field is active during forms processing
-(i.e. visited by form navigation keys). Can be used to make labels
-or derived fields with buffer values alterable by the forms
-application, not the user.
-
-
O_PUBLIC
-
-
Controls whether data is displayed during field entry. If this
-option is turned off on a field, the library will accept and edit
-data in that field, but it will not be displayed and the visible
-field cursor will not move. You can turn off the O_PUBLIC bit to
-define password fields.
-
-
O_EDIT
-
-
Controls whether the field's data can be modified. When this
-option is off, all editing requests except REQ_PREV_CHOICE and REQ_NEXT_CHOICEwill fail. Such read-only fields may
-be useful for help messages.
-
-
O_WRAP
-
-
Controls word-wrapping in multi-line fields. Normally, when any
-character of a (blank-separated) word reaches the end of the
-current line, the entire word is wrapped to the next line (assuming
-there is one). When this option is off, the word will be split
-across the line break.
-
-
O_BLANK
-
-
Controls field blanking. When this option is on, entering a
-character at the first field position erases the entire field
-(except for the just-entered character).
-
-
O_AUTOSKIP
-
-
Controls automatic skip to next field when this one fills.
-Normally, when the forms user tries to type more data into a field
-than will fit, the editing location jumps to next field. When this
-option is off, the user's cursor will hang at the end of the field.
-This option is ignored in dynamic fields that have not reached
-their size limit.
-
-
O_NULLOK
-
-
Controls whether validation is applied to blank fields.
-Normally, it is not; the user can leave a field blank without
-invoking the usual validation check on exit. If this option is off
-on a field, exit from it will invoke a validation check.
-
-
O_PASSOK
-
-
Controls whether validation occurs on every exit, or only after
-the field is modified. Normally the latter is true. Setting
-O_PASSOK may be useful if your field's validation function may
-change during forms processing.
-
-
O_STATIC
-
-
Controls whether the field is fixed to its initial dimensions.
-If you turn this off, the field becomes dynamic and will stretch to
-fit entered data.
-
-
-
-
A field's options cannot be changed while the field is currently
-selected. However, options may be changed on posted fields that are
-not current.
-
The option values are bit-masks and can be composed with
-logical-or in the obvious way. You have seen the usage of switching
-off O_AUTOSKIP option. The following example clarifies usage of
-some more options. Other options are explained where
-appropriate.
-
-
Example 27. Field Options Usage example
-
-
-
-
-#include <form.h>
+int field_opts(FIELD *field); /* field to query */
The function set_field_opts() can be used to directly set attributes of a field
+or you can choose to switch a few attributes on and off with field_opts_on() and
+field_opts_off() selectively. Anytime you can query the attributes of a field
+with field_opts(). The following is the list of available options. By default,
+all options are on.
O_VISIBLE
Controls whether the field is visible on the screen. Can be used
+during form processing to hide or pop up fields depending on the value
+of parent fields.
O_ACTIVE
Controls whether the field is active during forms processing (i.e.
+visited by form navigation keys). Can be used to make labels or derived
+fields with buffer values alterable by the forms application, not the user.
O_PUBLIC
Controls whether data is displayed during field entry. If this option is
+turned off on a field, the library will accept and edit data in that field,
+but it will not be displayed and the visible field cursor will not move.
+You can turn off the O_PUBLIC bit to define password fields.
O_EDIT
Controls whether the field's data can be modified. When this option is
+off, all editing requests except REQ_PREV_CHOICE and REQ_NEXT_CHOICEwill
+fail. Such read-only fields may be useful for help messages.
O_WRAP
Controls word-wrapping in multi-line fields. Normally, when any
+character of a (blank-separated) word reaches the end of the current line, the
+entire word is wrapped to the next line (assuming there is one). When this
+option is off, the word will be split across the line break.
O_BLANK
Controls field blanking. When this option is on, entering a character at
+the first field position erases the entire field (except for the just-entered
+character).
O_AUTOSKIP
Controls automatic skip to next field when this one fills. Normally,
+when the forms user tries to type more data into a field than will fit,
+the editing location jumps to next field. When this option is off, the
+user's cursor will hang at the end of the field. This option is ignored
+in dynamic fields that have not reached their size limit.
O_NULLOK
Controls whether validation is applied to
+blank fields. Normally, it is not; the user can leave a field blank
+without invoking the usual validation check on exit. If this option is
+off on a field, exit from it will invoke a validation check.
O_PASSOK
Controls whether validation occurs on every exit, or only after
+the field is modified. Normally the latter is true. Setting O_PASSOK
+may be useful if your field's validation function may change during
+forms processing.
O_STATIC
Controls whether the field is fixed to its initial dimensions. If you
+turn this off, the field becomes dynamic and will
+stretch to fit entered data.
A field's options cannot be changed while the field is currently selected.
+However, options may be changed on posted fields that are not current.
The option values are bit-masks and can be composed with logical-or in
+the obvious way. You have seen the usage of switching off O_AUTOSKIP option.
+The following example clarifies usage of some more options. Other options
+are explained where appropriate.
Example 27. Field Options Usage example
#include <form.h>
#define STARTX 15
#define STARTY 4
@@ -5188,975 +6856,1476 @@ appropriate.
#define N_FIELDS 3
int main()
-{ FIELD *field[N_FIELDS];
- FORM *my_form;
- int ch, i;
-
- /* Initialize curses */
- initscr();
- cbreak();
- noecho();
- keypad(stdscr, TRUE);
+{ FIELD *field[N_FIELDS];
+ FORM *my_form;
+ int ch, i;
+
+ /* Initialize curses */
+ initscr();
+ cbreak();
+ noecho();
+ keypad(stdscr, TRUE);
- /* Initialize the fields */
- for(i = 0; i < N_FIELDS - 1; ++i)
- field[i] = new_field(1, WIDTH, STARTY + i * 2, STARTX, 0, 0);
- field[N_FIELDS - 1] = NULL;
+ /* Initialize the fields */
+ for(i = 0; i < N_FIELDS - 1; ++i)
+ field[i] = new_field(1, WIDTH, STARTY + i * 2, STARTX, 0, 0);
+ field[N_FIELDS - 1] = NULL;
- /* Set field options */
- set_field_back(field[1], A_UNDERLINE); /* Print a line for the option */
-
- field_opts_off(field[0], O_ACTIVE); /* This field is a static label */
- field_opts_off(field[1], O_PUBLIC); /* This filed is like a password field*/
- field_opts_off(field[1], O_AUTOSKIP); /* To avoid entering the same field */
- /* after last character is entered */
-
- /* Create the form and post it */
- my_form = new_form(field);
- post_form(my_form);
- refresh();
-
- set_field_just(field[0], JUSTIFY_CENTER); /* Center Justification */
- set_field_buffer(field[0], 0, "This is a static Field");
- /* Initialize the field */
- mvprintw(STARTY, STARTX - 10, "Field 1:");
- mvprintw(STARTY + 2, STARTX - 10, "Field 2:");
- refresh();
+ /* Set field options */
+ set_field_back(field[1], A_UNDERLINE); /* Print a line for the option */
+
+ field_opts_off(field[0], O_ACTIVE); /* This field is a static label */
+ field_opts_off(field[1], O_PUBLIC); /* This filed is like a password field*/
+ field_opts_off(field[1], O_AUTOSKIP); /* To avoid entering the same field */
+ /* after last character is entered */
+
+ /* Create the form and post it */
+ my_form = new_form(field);
+ post_form(my_form);
+ refresh();
+
+ set_field_just(field[0], JUSTIFY_CENTER); /* Center Justification */
+ set_field_buffer(field[0], 0, "This is a static Field");
+ /* Initialize the field */
+ mvprintw(STARTY, STARTX - 10, "Field 1:");
+ mvprintw(STARTY + 2, STARTX - 10, "Field 2:");
+ refresh();
- /* Loop through to get user requests */
- while((ch = getch()) != KEY_F(1))
- { switch(ch)
- { case KEY_DOWN:
- /* Go to next field */
- form_driver(my_form, REQ_NEXT_FIELD);
- /* Go to the end of the present buffer */
- /* Leaves nicely at the last character */
- form_driver(my_form, REQ_END_LINE);
- break;
- case KEY_UP:
- /* Go to previous field */
- form_driver(my_form, REQ_PREV_FIELD);
- form_driver(my_form, REQ_END_LINE);
- break;
- default:
- /* If this is a normal character, it gets */
- /* Printed */
- form_driver(my_form, ch);
- break;
- }
- }
+ /* Loop through to get user requests */
+ while((ch = getch()) != KEY_F(1))
+ { switch(ch)
+ { case KEY_DOWN:
+ /* Go to next field */
+ form_driver(my_form, REQ_NEXT_FIELD);
+ /* Go to the end of the present buffer */
+ /* Leaves nicely at the last character */
+ form_driver(my_form, REQ_END_LINE);
+ break;
+ case KEY_UP:
+ /* Go to previous field */
+ form_driver(my_form, REQ_PREV_FIELD);
+ form_driver(my_form, REQ_END_LINE);
+ break;
+ default:
+ /* If this is a normal character, it gets */
+ /* Printed */
+ form_driver(my_form, ch);
+ break;
+ }
+ }
- /* Un post form and free the memory */
- unpost_form(my_form);
- free_form(my_form);
- free_field(field[0]);
- free_field(field[1]);
+ /* Un post form and free the memory */
+ unpost_form(my_form);
+ free_form(my_form);
+ free_field(field[0]);
+ free_field(field[1]);
- endwin();
- return 0;
-}
-
-
-
-
-
This example, though useless, shows the usage of options. If
-used properly, they can present information very effectively in a
-form. The second field being not O_PUBLIC, does not show the
-characters you are typing.
The field status specifies whether the field has got edited or
-not. It is initially set to FALSE and when user enters something
-and the data buffer gets modified it becomes TRUE. So a field's
-status can be queried to find out whether it has been modified or
-not. The following functions can assist in those operations.
-
-
-
-
-int set_field_status(FIELD *field, /* field to alter */
+ endwin();
+ return 0;
+}
This example, though useless, shows the usage of options. If used properly, they
+can present information very effectively in a form. The second field being not
+O_PUBLIC, does not show the characters you are typing.
The field status specifies whether the field has got edited or not. It is
+initially set to FALSE and when user enters something and the data buffer gets
+modified it becomes TRUE. So a field's status can be queried to find out whether
+it has been modified or not. The following functions can assist in those
+operations.
int set_field_status(FIELD *field, /* field to alter */
int status); /* status to set */
-int field_status(FIELD *field); /* fetch status of field */
-
-
-
-
It's better to check the field's status only after after leaving
-the field, as data buffer might not have been updated yet as the
-validation is still due. To guarantee that right status is
-returned, call field_status() either (1) in the field's exit
-validation check routine, (2) from the field's or form's
-initialization or termination hooks, or (3) just after a
-REQ_VALIDATION request has been processed by the forms driver
Every field structure contains one pointer that can be used by
-the user for various purposes. It is not touched by forms library
-and can be used for any purpose by the user. The following
-functions set and fetch user pointer.
-
-
-
-
-int set_field_userptr(FIELD *field,
+int field_status(FIELD *field); /* fetch status of field */
It's better to check the field's status only after after leaving the field, as
+data buffer might not have been updated yet as the validation is still due. To
+guarantee that right status is returned, call field_status() either (1) in the
+field's exit validation check routine, (2) from the field's or form's
+initialization or termination hooks, or (3) just after a REQ_VALIDATION request
+has been processed by the forms driver
Every field structure contains one pointer that can be used by the user for
+various purposes. It is not touched by forms library and can be used for any
+purpose by the user. The following functions set and fetch user pointer.
int set_field_userptr(FIELD *field,
char *userptr); /* the user pointer you wish to associate */
/* with the field */
-char *field_userptr(FIELD *field); /* fetch user pointer of the field */
-
If you want a dynamically changing field with variable width,
-this is the feature you want to put to full use. This will allow
-the user to enter more data than the original size of the field and
-let the field grow. According to the field orientation it will
-scroll horizontally or vertically to incorporate the new data.
-
To make a field dynamically growable, the option O_STATIC should
-be turned off. This can be done with a
-
-
-
-
- field_opts_off(field_pointer, O_STATIC);
-
-
-
-
But it's usually not advisable to allow a field to grow
-infinitely. You can set a maximum limit to the growth of the field
-with
-
-
-
-
-int set_max_field(FIELD *field, /* Field on which to operate */
- int max_growth); /* maximum growth allowed for the field */
-
-
-
-
The field info for a dynamically growable field can be retrieved
-by
-
-
-
-
-int dynamic_field_info( FIELD *field, /* Field on which to operate */
+char *field_userptr(FIELD *field); /* fetch user pointer of the field */
If you want a dynamically changing field with variable width, this is the
+feature you want to put to full use. This will allow the user to enter more data
+than the original size of the field and let the field grow. According to the
+field orientation it will scroll horizontally or vertically to incorporate the
+new data.
To make a field dynamically growable, the option O_STATIC should be turned off.
+This can be done with a
+
field_opts_off(field_pointer, O_STATIC);
But it's usually not advisable to allow a field to grow infinitely. You can set
+a maximum limit to the growth of the field with
+
int set_max_field(FIELD *field, /* Field on which to operate */
+ int max_growth); /* maximum growth allowed for the field */
The field info for a dynamically growable field can be retrieved by
+
int dynamic_field_info( FIELD *field, /* Field on which to operate */
int *prows, /* number of rows will be filled in this */
int *pcols, /* number of columns will be filled in this*/
int *pmax) /* maximum allowable growth will be filled */
- /* in this */
-
-
-
-Though field_info work as usual, it is advisable to use this
-function to get the proper attributes of a dynamically growable
-field.
-
Recall the library routine new_field; a new field created with
-height set to one will be defined to be a one line field. A new
-field created with height greater than one will be defined to be a
-multi line field.
-
A one line field with O_STATIC turned off (dynamically growable
-field) will contain a single fixed row, but the number of columns
-can increase if the user enters more data than the initial field
-will hold. The number of columns displayed will remain fixed and
-the additional data will scroll horizontally.
-
A multi line field with O_STATIC turned off (dynamically
-growable field) will contain a fixed number of columns, but the
-number of rows can increase if the user enters more data than the
-initial field will hold. The number of rows displayed will remain
-fixed and the additional data will scroll vertically.
-
The above two paragraphs pretty much describe a dynamically
-growable field's behavior. The way other parts of forms library
-behaves is described below:
-
-
-
The field option O_AUTOSKIP will be ignored if the option
-O_STATIC is off and there is no maximum growth specified for the
-field. Currently, O_AUTOSKIP generates an automatic REQ_NEXT_FIELD
-form driver request when the user types in the last character
-position of a field. On a growable field with no maximum growth
-specified, there is no last character position. If a maximum growth
-is specified, the O_AUTOSKIP option will work as normal if the
-field has grown to its maximum size.
-
-
-
The field justification will be ignored if the option O_STATIC
-is off. Currently, set_field_just can be used to JUSTIFY_LEFT,
-JUSTIFY_RIGHT, JUSTIFY_CENTER the contents of a one line field. A
-growable one line field will, by definition, grow and scroll
-horizontally and may contain more data than can be justified. The
-return from field_just will be unchanged.
-
-
-
The overloaded form driver request REQ_NEW_LINE will operate the
-same way regardless of the O_NL_OVERLOAD form option if the field
-option O_STATIC is off and there is no maximum growth specified for
-the field. Currently, if the form option O_NL_OVERLOAD is on,
-REQ_NEW_LINE implicitly generates a REQ_NEXT_FIELD if called from
-the last line of a field. If a field can grow without bound, there
-is no last line, so REQ_NEW_LINE will never implicitly generate a
-REQ_NEXT_FIELD. If a maximum growth limit is specified and the
-O_NL_OVERLOAD form option is on, REQ_NEW_LINE will only implicitly
-generate REQ_NEXT_FIELD if the field has grown to its maximum size
-and the user is on the last line.
-
-
-
The library call dup_field will work as usual; it will duplicate
-the field, including the current buffer size and contents of the
-field being duplicated. Any specified maximum growth will also be
-duplicated.
-
-
-
The library call link_field will work as usual; it will
-duplicate all field attributes and share buffers with the field
-being linked. If the O_STATIC field option is subsequently changed
-by a field sharing buffers, how the system reacts to an attempt to
-enter more data into the field than the buffer will currently hold
-will depend on the setting of the option in the current field.
-
-
-
The library call field_info will work as usual; the variable
-nrow will contain the value of the original call to new_field. The
-user should use dynamic_field_info, described above, to query the
-current size of the buffer.
-
-
-
Some of the above points make sense only after explaining form
-driver. We will be looking into that in next few sections.
The form windows concept is pretty much similar to menu windows.
-Every form is associated with a main window and a sub window. The
-form main window displays any title or border associated or
-whatever the user wishes. Then the sub window contains all the
-fields and displays them according to their position. This gives
-the flexibility of manipulating fancy form displaying very
-easily.
-
Since this is pretty much similar to menu windows, I am
-providing an example with out much explanation. The functions are
-similar and they work the same way.
-
-
Example 28. Form Windows Example
-
-
-
-
-#include <form.h>
+ /* in this */
+Though field_info work as usual, it is advisable to use this function to get the
+proper attributes of a dynamically growable field.
Recall the library routine new_field; a new field created with height set to one
+will be defined to be a one line field. A new field created with height greater
+than one will be defined to be a multi line field.
A one line field with O_STATIC turned off (dynamically growable field) will
+contain a single fixed row, but the number of columns can increase if the user
+enters more data than the initial field will hold. The number of columns
+displayed will remain fixed and the additional data will scroll horizontally.
A multi line field with O_STATIC turned off (dynamically growable field) will
+contain a fixed number of columns, but the number of rows can increase if the
+user enters more data than the initial field will hold. The number of rows
+displayed will remain fixed and the additional data will scroll vertically.
The above two paragraphs pretty much describe a dynamically growable field's
+behavior. The way other parts of forms library behaves is described below:
The field option O_AUTOSKIP will be ignored if the option O_STATIC is off and
+there is no maximum growth specified for the field. Currently, O_AUTOSKIP
+generates an automatic REQ_NEXT_FIELD form driver request when the user types in
+the last character position of a field. On a growable field with no maximum
+growth specified, there is no last character position. If a maximum growth is
+specified, the O_AUTOSKIP option will work as normal if the field has grown to
+its maximum size.
The field justification will be ignored if the option O_STATIC is off.
+Currently, set_field_just can be used to JUSTIFY_LEFT, JUSTIFY_RIGHT,
+JUSTIFY_CENTER the contents of a one line field. A growable one line field will,
+by definition, grow and scroll horizontally and may contain more data than can
+be justified. The return from field_just will be unchanged.
The overloaded form driver request REQ_NEW_LINE will operate the same way
+regardless of the O_NL_OVERLOAD form option if the field option O_STATIC is off
+and there is no maximum growth specified for the field. Currently, if the form
+option O_NL_OVERLOAD is on, REQ_NEW_LINE implicitly generates a REQ_NEXT_FIELD
+if called from the last line of a field. If a field can grow without bound,
+there is no last line, so REQ_NEW_LINE will never implicitly generate a
+REQ_NEXT_FIELD. If a maximum growth limit is specified and the O_NL_OVERLOAD
+form option is on, REQ_NEW_LINE will only implicitly generate REQ_NEXT_FIELD if
+the field has grown to its maximum size and the user is on the last line.
The library call dup_field will work as usual; it will duplicate the field,
+including the current buffer size and contents of the field being duplicated.
+Any specified maximum growth will also be duplicated.
The library call link_field will work as usual; it will duplicate all field
+attributes and share buffers with the field being linked. If the O_STATIC field
+option is subsequently changed by a field sharing buffers, how the system reacts
+to an attempt to enter more data into the field than the buffer will currently
+hold will depend on the setting of the option in the current field.
The library call field_info will work as usual; the variable nrow will contain
+the value of the original call to new_field. The user should use
+dynamic_field_info, described above, to query the current size of the buffer.
Some of the above points make sense only after explaining form driver. We will
+be looking into that in next few sections.
The form windows concept is pretty much similar to menu windows. Every form is
+associated with a main window and a sub window. The form main window displays
+any title or border associated or whatever the user wishes. Then the sub window
+contains all the fields and displays them according to their position. This
+gives the flexibility of manipulating fancy form displaying very easily.
Since this is pretty much similar to menu windows, I am providing an example
+with out much explanation. The functions are similar and they work the same way.
Example 28. Form Windows Example
#include <form.h>
void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color);
int main()
{
- FIELD *field[3];
- FORM *my_form;
- WINDOW *my_form_win;
- int ch, rows, cols;
-
- /* Initialize curses */
- initscr();
- start_color();
- cbreak();
- noecho();
- keypad(stdscr, TRUE);
+ FIELD *field[3];
+ FORM *my_form;
+ WINDOW *my_form_win;
+ int ch, rows, cols;
+
+ /* Initialize curses */
+ initscr();
+ start_color();
+ cbreak();
+ noecho();
+ keypad(stdscr, TRUE);
- /* Initialize few color pairs */
- init_pair(1, COLOR_RED, COLOR_BLACK);
+ /* Initialize few color pairs */
+ init_pair(1, COLOR_RED, COLOR_BLACK);
- /* Initialize the fields */
- field[0] = new_field(1, 10, 6, 1, 0, 0);
- field[1] = new_field(1, 10, 8, 1, 0, 0);
- field[2] = NULL;
+ /* Initialize the fields */
+ field[0] = new_field(1, 10, 6, 1, 0, 0);
+ field[1] = new_field(1, 10, 8, 1, 0, 0);
+ field[2] = NULL;
- /* Set field options */
- set_field_back(field[0], A_UNDERLINE);
- field_opts_off(field[0], O_AUTOSKIP); /* Don't go to next field when this */
- /* Field is filled up */
- set_field_back(field[1], A_UNDERLINE);
- field_opts_off(field[1], O_AUTOSKIP);
-
- /* Create the form and post it */
- my_form = new_form(field);
-
- /* Calculate the area required for the form */
- scale_form(my_form, &rows, &cols);
+ /* Set field options */
+ set_field_back(field[0], A_UNDERLINE);
+ field_opts_off(field[0], O_AUTOSKIP); /* Don't go to next field when this */
+ /* Field is filled up */
+ set_field_back(field[1], A_UNDERLINE);
+ field_opts_off(field[1], O_AUTOSKIP);
+
+ /* Create the form and post it */
+ my_form = new_form(field);
+
+ /* Calculate the area required for the form */
+ scale_form(my_form, &rows, &cols);
- /* Create the window to be associated with the form */
+ /* Create the window to be associated with the form */
my_form_win = newwin(rows + 4, cols + 4, 4, 4);
keypad(my_form_win, TRUE);
- /* Set main window and sub window */
+ /* Set main window and sub window */
set_form_win(my_form, my_form_win);
set_form_sub(my_form, derwin(my_form_win, rows, cols, 2, 2));
- /* Print a border around the main window and print a title */
+ /* Print a border around the main window and print a title */
box(my_form_win, 0, 0);
- print_in_middle(my_form_win, 1, 0, cols + 4, "My Form", COLOR_PAIR(1));
-
- post_form(my_form);
- wrefresh(my_form_win);
+ print_in_middle(my_form_win, 1, 0, cols + 4, "My Form", COLOR_PAIR(1));
+
+ post_form(my_form);
+ wrefresh(my_form_win);
- mvprintw(LINES - 2, 0, "Use UP, DOWN arrow keys to switch between fields");
- refresh();
+ mvprintw(LINES - 2, 0, "Use UP, DOWN arrow keys to switch between fields");
+ refresh();
- /* Loop through to get user requests */
- while((ch = wgetch(my_form_win)) != KEY_F(1))
- { switch(ch)
- { case KEY_DOWN:
- /* Go to next field */
- form_driver(my_form, REQ_NEXT_FIELD);
- /* Go to the end of the present buffer */
- /* Leaves nicely at the last character */
- form_driver(my_form, REQ_END_LINE);
- break;
- case KEY_UP:
- /* Go to previous field */
- form_driver(my_form, REQ_PREV_FIELD);
- form_driver(my_form, REQ_END_LINE);
- break;
- default:
- /* If this is a normal character, it gets */
- /* Printed */
- form_driver(my_form, ch);
- break;
- }
- }
+ /* Loop through to get user requests */
+ while((ch = wgetch(my_form_win)) != KEY_F(1))
+ { switch(ch)
+ { case KEY_DOWN:
+ /* Go to next field */
+ form_driver(my_form, REQ_NEXT_FIELD);
+ /* Go to the end of the present buffer */
+ /* Leaves nicely at the last character */
+ form_driver(my_form, REQ_END_LINE);
+ break;
+ case KEY_UP:
+ /* Go to previous field */
+ form_driver(my_form, REQ_PREV_FIELD);
+ form_driver(my_form, REQ_END_LINE);
+ break;
+ default:
+ /* If this is a normal character, it gets */
+ /* Printed */
+ form_driver(my_form, ch);
+ break;
+ }
+ }
- /* Un post form and free the memory */
- unpost_form(my_form);
- free_form(my_form);
- free_field(field[0]);
- free_field(field[1]);
+ /* Un post form and free the memory */
+ unpost_form(my_form);
+ free_form(my_form);
+ free_field(field[0]);
+ free_field(field[1]);
- endwin();
- return 0;
+ endwin();
+ return 0;
}
void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color)
-{ int length, x, y;
- float temp;
+{ int length, x, y;
+ float temp;
- if(win == NULL)
- win = stdscr;
- getyx(win, y, x);
- if(startx != 0)
- x = startx;
- if(starty != 0)
- y = starty;
- if(width == 0)
- width = 80;
+ if(win == NULL)
+ win = stdscr;
+ getyx(win, y, x);
+ if(startx != 0)
+ x = startx;
+ if(starty != 0)
+ y = starty;
+ if(width == 0)
+ width = 80;
- length = strlen(string);
- temp = (width - length)/ 2;
- x = startx + (int)temp;
- wattron(win, color);
- mvwprintw(win, y, x, "%s", string);
- wattroff(win, color);
- refresh();
-}
-
By default, a field will accept any data input by the user. It
-is possible to attach validation to the field. Then any attempt by
-the user to leave the field, while it contains data that doesn't
-match the validation type will fail. Some validation types also
-have a character-validity check for each time a character is
-entered in the field.
-
Validation can be attached to a field with the following
-function.
-
-
-
-
-int set_field_type(FIELD *field, /* field to alter */
+ length = strlen(string);
+ temp = (width - length)/ 2;
+ x = startx + (int)temp;
+ wattron(win, color);
+ mvwprintw(win, y, x, "%s", string);
+ wattroff(win, color);
+ refresh();
+}
By default, a field will accept any data input by the user. It is possible to
+attach validation to the field. Then any attempt by the user to leave the field,
+while it contains data that doesn't match the validation type will fail. Some
+validation types also have a character-validity check for each time a character
+is entered in the field.
Validation can be attached to a field with the following function.
+
int set_field_type(FIELD *field, /* field to alter */
FIELDTYPE *ftype, /* type to associate */
- ...); /* additional arguments*/
-
-
-
+ ...); /* additional arguments*/
Once set, the validation type for a field can be queried with
-
-
-
-
-FIELDTYPE *field_type(FIELD *field); /* field to query */
-
-
-
-
The form driver validates the data in a field only when data is
-entered by the end-user. Validation does not occur when
-
-
-
the application program changes the field value by calling
-set_field_buffer.
-
-
-
linked field values are changed indirectly -- by changing the
-field to which they are linked
-
-
-
The following are the pre-defined validation types. You can also
-specify custom validation, though it's a bit tricky and
-cumbersome.
-
TYPE_ALPHA
-
This field type accepts alphabetic data; no blanks, no digits,
-no special characters (this is checked at character-entry time). It
-is set up with:
-
-
-
-
-int set_field_type(FIELD *field, /* field to alter */
+
FIELDTYPE *field_type(FIELD *field); /* field to query */
The form driver validates the data in a field only when data is entered by the
+end-user. Validation does not occur when
the application program changes the field value by calling set_field_buffer.
linked field values are changed indirectly -- by changing the field to which
+they are linked
The following are the pre-defined validation types. You can also specify custom
+validation, though it's a bit tricky and cumbersome.
TYPE_ALPHA
This field type accepts alphabetic data; no blanks, no digits, no special
+characters (this is checked at character-entry time). It is set up with:
int set_field_type(FIELD *field, /* field to alter */
TYPE_ALPHA, /* type to associate */
- int width); /* maximum width of field */
-
-
-
-
The width argument sets a minimum width of data. The user has to
-enter at-least width number of characters before he can leave the
-field. Typically you'll want to set this to the field width; if
-it's greater than the field width, the validation check will always
-fail. A minimum width of zero makes field completion optional.
-
TYPE_ALNUM
-
This field type accepts alphabetic data and digits; no blanks,
-no special characters (this is checked at character-entry time). It
-is set up with:
-
-
-
-
-int set_field_type(FIELD *field, /* field to alter */
+ int width); /* maximum width of field */
The width argument sets a minimum width of data. The user has to enter at-least
+width number of characters before he can leave the field. Typically
+you'll want to set this to the field width; if it's greater than the
+field width, the validation check will always fail. A minimum width
+of zero makes field completion optional.
TYPE_ALNUM
This field type accepts alphabetic data and digits; no blanks, no special
+characters (this is checked at character-entry time). It is set up with:
int set_field_type(FIELD *field, /* field to alter */
TYPE_ALNUM, /* type to associate */
- int width); /* maximum width of field */
-
-
-
-
The width argument sets a minimum width of data. As with
-TYPE_ALPHA, typically you'll want to set this to the field width;
-if it's greater than the field width, the validation check will
-always fail. A minimum width of zero makes field completion
-optional.
-
TYPE_ENUM
-
This type allows you to restrict a field's values to be among a
-specified set of string values (for example, the two-letter postal
-codes for U.S. states). It is set up with:
-
-
-
-
-int set_field_type(FIELD *field, /* field to alter */
+ int width); /* maximum width of field */
The width argument sets a minimum width of data. As with
+TYPE_ALPHA, typically you'll want to set this to the field width; if it's
+greater than the field width, the validation check will always fail. A
+minimum width of zero makes field completion optional.
TYPE_ENUM
This type allows you to restrict a field's values to be among a specified
+set of string values (for example, the two-letter postal codes for U.S.
+states). It is set up with:
int set_field_type(FIELD *field, /* field to alter */
TYPE_ENUM, /* type to associate */
char **valuelist; /* list of possible values */
int checkcase; /* case-sensitive? */
- int checkunique); /* must specify uniquely? */
-
-
-
-
The valuelist parameter must point at a NULL-terminated list of
-valid strings. The checkcase argument, if true, makes comparison
-with the string case-sensitive.
-
When the user exits a TYPE_ENUM field, the validation procedure
-tries to complete the data in the buffer to a valid entry. If a
-complete choice string has been entered, it is of course valid. But
-it is also possible to enter a prefix of a valid string and have it
-completed for you.
-
By default, if you enter such a prefix and it matches more than
-one value in the string list, the prefix will be completed to the
-first matching value. But the checkunique argument, if true,
-requires prefix matches to be unique in order to be valid.
-
The REQ_NEXT_CHOICE and REQ_PREV_CHOICE input requests can be
-particularly useful with these fields.
-
TYPE_INTEGER
-
This field type accepts an integer. It is set up as follows:
-
-
-
-
-int set_field_type(FIELD *field, /* field to alter */
+ int checkunique); /* must specify uniquely? */
The valuelist parameter must point at a NULL-terminated list of
+valid strings. The checkcase argument, if true, makes comparison
+with the string case-sensitive.
When the user exits a TYPE_ENUM field, the validation procedure tries to
+complete the data in the buffer to a valid entry. If a complete choice string
+has been entered, it is of course valid. But it is also possible to enter a
+prefix of a valid string and have it completed for you.
By default, if you enter such a prefix and it matches more than one value
+in the string list, the prefix will be completed to the first matching
+value. But the checkunique argument, if true, requires prefix
+matches to be unique in order to be valid.
The REQ_NEXT_CHOICE and REQ_PREV_CHOICE input requests can be particularly
+useful with these fields.
TYPE_INTEGER
This field type accepts an integer. It is set up as follows:
int set_field_type(FIELD *field, /* field to alter */
TYPE_INTEGER, /* type to associate */
int padding, /* # places to zero-pad to */
- int vmin, int vmax); /* valid range */
-
-
-
-
Valid characters consist of an optional leading minus and
-digits. The range check is performed on exit. If the range maximum
-is less than or equal to the minimum, the range is ignored.
-
If the value passes its range check, it is padded with as many
-leading zero digits as necessary to meet the padding argument.
-
A TYPE_INTEGER value buffer can conveniently be interpreted with
-the C library function atoi(3).
-
TYPE_NUMERIC
-
This field type accepts a decimal number. It is set up as
-follows:
-
-
-
-
-int set_field_type(FIELD *field, /* field to alter */
+ int vmin, int vmax); /* valid range */
Valid characters consist of an optional leading minus and digits.
+The range check is performed on exit. If the range maximum is less
+than or equal to the minimum, the range is ignored.
If the value passes its range check, it is padded with as many leading
+zero digits as necessary to meet the padding argument.
A TYPE_INTEGER value buffer can conveniently be interpreted with the C library
+function atoi(3).
TYPE_NUMERIC
This field type accepts a decimal number. It is set up as follows:
int set_field_type(FIELD *field, /* field to alter */
TYPE_NUMERIC, /* type to associate */
int padding, /* # places of precision */
- int vmin, int vmax); /* valid range */
-
-
-
-
Valid characters consist of an optional leading minus and
-digits. possibly including a decimal point. The range check is
-performed on exit. If the range maximum is less than or equal to
-the minimum, the range is ignored.
-
If the value passes its range check, it is padded with as many
-trailing zero digits as necessary to meet the padding argument.
-
A TYPE_NUMERIC value buffer can conveniently be interpreted with
-the C library function atof(3).
-
TYPE_REGEXP
-
This field type accepts data matching a regular expression. It
-is set up as follows:
-
-
-
-
-int set_field_type(FIELD *field, /* field to alter */
+ int vmin, int vmax); /* valid range */
Valid characters consist of an optional leading minus and digits. possibly
+including a decimal point. The range check is performed on exit. If the
+range maximum is less than or equal to the minimum, the range is
+ignored.
If the value passes its range check, it is padded with as many trailing
+zero digits as necessary to meet the padding argument.
A TYPE_NUMERIC value buffer can conveniently be interpreted with the C library
+function atof(3).
TYPE_REGEXP
This field type accepts data matching a regular expression. It is set up
+as follows:
int set_field_type(FIELD *field, /* field to alter */
TYPE_REGEXP, /* type to associate */
- char *regexp); /* expression to match */
-
-
-
-
The syntax for regular expressions is that of regcomp(3). The
-check for regular-expression match is performed on exit.
As in the menu system, form_driver() plays a very important role
-in forms system. All types of requests to forms system should be
-funneled through form_driver().
-
-
-
-
-int form_driver(FORM *form, /* form on which to operate */
- int request) /* form request code */
-
-
-
-
As you have seen some of the examples above, you have to be in a
-loop looking for user input and then decide whether it's a field
-data or a form request. The form requests are then passed to
-form_driver() to do the work.
-
The requests roughly can be divided into following categories.
-Different requests and their usage is explained below:
These requests cause page-level moves through the form,
-triggering display of a new form screen. A form can be made of
-multiple pages. If you have a big form with lot of fields and
-logical sections, then you can divide the form into pages. The
-function set_new_page() to set a new page at the field
-specified.
-
-
-
-
-int set_new_page(FIELD *field,/* Field at which page break to be set or unset */
- bool new_page_flag); /* should be TRUE to put a break */
-
-
-
-
The following requests allow you to move to different pages
-
-
-
REQ_NEXT_PAGE Move to the next form page.
-
-
-
REQ_PREV_PAGE Move to the previous form page.
-
-
-
REQ_FIRST_PAGE Move to the first form page.
-
-
-
REQ_LAST_PAGE Move to the last form page.
-
-
-
These requests treat the list as cyclic; that is, REQ_NEXT_PAGE
-from the last page goes to the first, and REQ_PREV_PAGE from the
-first page goes to the last.
These requests handle navigation between fields on the same
-page.
-
-
-
REQ_NEXT_FIELD Move to next field.
-
-
-
REQ_PREV_FIELD Move to previous field.
-
-
-
REQ_FIRST_FIELD Move to the first field.
-
-
-
REQ_LAST_FIELD Move to the last field.
-
-
-
REQ_SNEXT_FIELD Move to sorted next field.
-
-
-
REQ_SPREV_FIELD Move to sorted previous field.
-
-
-
REQ_SFIRST_FIELD Move to the sorted first field.
-
-
-
REQ_SLAST_FIELD Move to the sorted last field.
-
-
-
REQ_LEFT_FIELD Move left to field.
-
-
-
REQ_RIGHT_FIELD Move right to field.
-
-
-
REQ_UP_FIELD Move up to field.
-
-
-
REQ_DOWN_FIELD Move down to field.
-
-
-
These requests treat the list of fields on a page as cyclic;
-that is, REQ_NEXT_FIELD from the last field goes to the first, and
-REQ_PREV_FIELD from the first field goes to the last. The order of
-the fields for these (and the REQ_FIRST_FIELD and REQ_LAST_FIELD
-requests) is simply the order of the field pointers in the form
-array (as set up by new_form() or set_form_fields()
-
It is also possible to traverse the fields as if they had been
-sorted in screen-position order, so the sequence goes left-to-right
-and top-to-bottom. To do this, use the second group of four
-sorted-movement requests.
-
Finally, it is possible to move between fields using visual
-directions up, down, right, and left. To accomplish this, use the
-third group of four requests. Note, however, that the position of a
-form for purposes of these requests is its upper-left corner.
-
For example, suppose you have a multi-line field B, and two
-single-line fields A and C on the same line with B, with A to the
-left of B and C to the right of B. A REQ_MOVE_RIGHT from A will go
-to B only if A, B, and C all share the same first line; otherwise
-it will skip over B to C.
These requests drive movement of the edit cursor within the
-currently selected field.
-
-
-
REQ_NEXT_CHAR Move to next character.
-
-
-
REQ_PREV_CHAR Move to previous character.
-
-
-
REQ_NEXT_LINE Move to next line.
-
-
-
REQ_PREV_LINE Move to previous line.
-
-
-
REQ_NEXT_WORD Move to next word.
-
-
-
REQ_PREV_WORD Move to previous word.
-
-
-
REQ_BEG_FIELD Move to beginning of field.
-
-
-
REQ_END_FIELD Move to end of field.
-
-
-
REQ_BEG_LINE Move to beginning of line.
-
-
-
REQ_END_LINE Move to end of line.
-
-
-
REQ_LEFT_CHAR Move left in field.
-
-
-
REQ_RIGHT_CHAR Move right in field.
-
-
-
REQ_UP_CHAR Move up in field.
-
-
-
REQ_DOWN_CHAR Move down in field.
-
-
-
Each word is separated from the previous and next characters by
-whitespace. The commands to move to beginning and end of line or
-field look for the first or last non-pad character in their
-ranges.
Fields that are dynamic and have grown and fields explicitly
-created with offscreen rows are scrollable. One-line fields scroll
-horizontally; multi-line fields scroll vertically. Most scrolling
-is triggered by editing and intra-field movement (the library
-scrolls the field to keep the cursor visible). It is possible to
-explicitly request scrolling with the following requests:
-
-
-
REQ_SCR_FLINE Scroll vertically forward a line.
-
-
-
REQ_SCR_BLINE Scroll vertically backward a line.
-
-
-
REQ_SCR_FPAGE Scroll vertically forward a page.
-
-
-
REQ_SCR_BPAGE Scroll vertically backward a page.
-
-
-
REQ_SCR_FHPAGE Scroll vertically forward half a
-page.
-
-
-
REQ_SCR_BHPAGE Scroll vertically backward half a
-page.
-
-
-
REQ_SCR_FCHAR Scroll horizontally forward a
-character.
-
-
-
REQ_SCR_BCHAR Scroll horizontally backward a
-character.
-
-
-
REQ_SCR_HFLINE Scroll horizontally one field width
-forward.
-
-
-
REQ_SCR_HBLINE Scroll horizontally one field width
-backward.
-
-
-
REQ_SCR_HFHALF Scroll horizontally one half field width
-forward.
-
-
-
REQ_SCR_HBHALF Scroll horizontally one half field width
-backward.
-
-
-
For scrolling purposes, a page of a field is the height of its
-visible part.
When you pass the forms driver an ASCII character, it is treated
-as a request to add the character to the field's data buffer.
-Whether this is an insertion or a replacement depends on the
-field's edit mode (insertion is the default.
-
The following requests support editing the field and changing
-the edit mode:
-
-
-
REQ_INS_MODE Set insertion mode.
-
-
-
REQ_OVL_MODE Set overlay mode.
-
-
-
REQ_NEW_LINE New line request (see below for
-explanation).
-
-
-
REQ_INS_CHAR Insert space at character location.
-
-
-
REQ_INS_LINE Insert blank line at character
-location.
-
-
-
REQ_DEL_CHAR Delete character at cursor.
-
-
-
REQ_DEL_PREV Delete previous word at cursor.
-
-
-
REQ_DEL_LINE Delete line at cursor.
-
-
-
REQ_DEL_WORD Delete word at cursor.
-
-
-
REQ_CLR_EOL Clear to end of line.
-
-
-
REQ_CLR_EOF Clear to end of field.
-
-
-
REQ_CLR_FIELD Clear entire field.
-
-
-
The behavior of the REQ_NEW_LINE and REQ_DEL_PREV requests is
-complicated and partly controlled by a pair of forms options. The
-special cases are triggered when the cursor is at the beginning of
-a field, or on the last line of the field.
-
First, we consider REQ_NEW_LINE:
-
The normal behavior of REQ_NEW_LINE in insert mode is to break
-the current line at the position of the edit cursor, inserting the
-portion of the current line after the cursor as a new line
-following the current and moving the cursor to the beginning of
-that new line (you may think of this as inserting a newline in the
-field buffer).
-
The normal behavior of REQ_NEW_LINE in overlay mode is to clear
-the current line from the position of the edit cursor to end of
-line. The cursor is then moved to the beginning of the next
-line.
-
However, REQ_NEW_LINE at the beginning of a field, or on the
-last line of a field, instead does a REQ_NEXT_FIELD. O_NL_OVERLOAD
-option is off, this special action is disabled.
-
Now, let us consider REQ_DEL_PREV:
-
The normal behavior of REQ_DEL_PREV is to delete the previous
-character. If insert mode is on, and the cursor is at the start of
-a line, and the text on that line will fit on the previous one, it
-instead appends the contents of the current line to the previous
-one and deletes the current line (you may think of this as deleting
-a newline from the field buffer).
-
However, REQ_DEL_PREV at the beginning of a field is instead
-treated as a REQ_PREV_FIELD.
-
If the O_BS_OVERLOAD option is off, this special action is
-disabled and the forms driver just returns E_REQUEST_DENIED.
If the type of your field is ordered, and has associated
-functions for getting the next and previous values of the type from
-a given value, there are requests that can fetch that value into
-the field buffer:
-
-
-
REQ_NEXT_CHOICE Place the successor value of the
-current value in the buffer.
-
-
-
REQ_PREV_CHOICE Place the predecessor value of the
-current value in the buffer.
-
-
-
Of the built-in field types, only TYPE_ENUM has built-in
-successor and predecessor functions. When you define a field type
-of your own (see Custom Validation Types), you can associate our
-own ordering functions.
Form requests are represented as integers above the curses value
-greater than KEY_MAX and less than or equal to the constant
-MAX_COMMAND. A value within this range gets ignored by
-form_driver(). So this can be used for any purpose by the
-application. It can be treated as an application specific action
-and take corresponding action.
Now that you have seen the capabilities of ncurses and its
-sister libraries, you are rolling your sleeves up and gearing for a
-project that heavily manipulates screen. But wait.. It can be
-pretty difficult to write and maintain complex GUI widgets in plain
-ncurses or even with the additional libraries. There are some
-ready-to-use tools and widget libraries that can be used instead of
-writing your own widgets. You can use some of them, get ideas from
-the code, or even extend them.
CDK stands for 'Curses Development Kit' and it currently
-contains 21 ready to use widgets which facilitate the speedy
-development of full screen curses programs.
-
The kit provides some useful widgets, which can be used in your
-programs directly. It's pretty well written and the documentation
-is very good. The examples in the examples directory can be a good
-place to start for beginners. The CDK can be downloaded from
-http://invisible-island.net/cdk/ . Follow the
-instructions in README file to install it.
As in the menu system, form_driver() plays a very important role in forms
+system. All types of requests to forms system should be funneled through
+form_driver().
int form_driver(FORM *form, /* form on which to operate */
+ int request) /* form request code */
As you have seen some of the examples above, you have to be in a loop looking
+for user input and then decide whether it's a field data or a form request. The
+form requests are then passed to form_driver() to do the work.
The requests roughly can be divided into following categories. Different
+requests and their usage is explained below:
These requests cause page-level moves through the form, triggering display of a
+new form screen. A form can be made of multiple pages. If you have a big form
+with lot of fields and logical sections, then you can divide the form into
+pages. The function set_new_page() to set a new page at the field specified.
int set_new_page(FIELD *field,/* Field at which page break to be set or unset */
+ bool new_page_flag); /* should be TRUE to put a break */
The following requests allow you to move to different pages
REQ_NEXT_PAGE Move to the next form page.
REQ_PREV_PAGE Move to the previous
+form page.
REQ_FIRST_PAGE Move to the first form page.
REQ_LAST_PAGE Move to the last form page.
These requests treat the list as cyclic; that is, REQ_NEXT_PAGE from the
+last page goes to the first, and REQ_PREV_PAGE from the first page goes to
+the last.
These requests handle navigation between fields on the same page.
REQ_NEXT_FIELD
+ Move to next field.
REQ_PREV_FIELD
+ Move to previous field.
REQ_FIRST_FIELD
+ Move to the first field.
REQ_LAST_FIELD
+ Move to the last field.
REQ_SNEXT_FIELD
+ Move to sorted next field.
REQ_SPREV_FIELD
+ Move to sorted previous field.
REQ_SFIRST_FIELD
+ Move to the sorted first field.
REQ_SLAST_FIELD
+ Move to the sorted last field.
REQ_LEFT_FIELD
+ Move left to field.
REQ_RIGHT_FIELD
+ Move right to field.
REQ_UP_FIELD
+ Move up to field.
REQ_DOWN_FIELD
+ Move down to field.
These requests treat the list of fields on a page as cyclic; that is,
+REQ_NEXT_FIELD from the last field goes to the first, and REQ_PREV_FIELD
+from the first field goes to the last. The order of the fields for these
+(and the REQ_FIRST_FIELD and REQ_LAST_FIELD requests) is simply the order of
+the field pointers in the form array (as set up by new_form() or
+set_form_fields()
It is also possible to traverse the fields as if they had been sorted in
+screen-position order, so the sequence goes left-to-right and top-to-bottom.
+To do this, use the second group of four sorted-movement requests.
Finally, it is possible to move between fields using visual directions up,
+down, right, and left. To accomplish this, use the third group of four
+requests. Note, however, that the position of a form for purposes of these
+requests is its upper-left corner.
For example, suppose you have a multi-line field B, and two single-line
+fields A and C on the same line with B, with A to the left of B and C to the
+right of B. A REQ_MOVE_RIGHT from A will go to B only if A, B, and C all
+share the same first line; otherwise it will skip over B to C.
These requests drive movement of the edit cursor within the currently
+selected field.
REQ_NEXT_CHAR
+ Move to next character.
REQ_PREV_CHAR
+ Move to previous character.
REQ_NEXT_LINE
+ Move to next line.
REQ_PREV_LINE
+ Move to previous line.
REQ_NEXT_WORD
+ Move to next word.
REQ_PREV_WORD
+ Move to previous word.
REQ_BEG_FIELD
+ Move to beginning of field.
REQ_END_FIELD
+ Move to end of field.
REQ_BEG_LINE
+ Move to beginning of line.
REQ_END_LINE
+ Move to end of line.
REQ_LEFT_CHAR
+ Move left in field.
REQ_RIGHT_CHAR
+ Move right in field.
REQ_UP_CHAR
+ Move up in field.
REQ_DOWN_CHAR
+ Move down in field.
Each word is separated from the previous and next characters by whitespace.
+The commands to move to beginning and end of line or field look for the
+first or last non-pad character in their ranges.
Fields that are dynamic and have grown and fields explicitly created with
+offscreen rows are scrollable. One-line fields scroll horizontally;
+multi-line fields scroll vertically. Most scrolling is triggered by editing
+and intra-field movement (the library scrolls the field to keep the cursor
+visible). It is possible to explicitly request scrolling with the following
+requests:
REQ_SCR_FLINE
+ Scroll vertically forward a line.
REQ_SCR_BLINE
+ Scroll vertically backward a line.
REQ_SCR_FPAGE
+ Scroll vertically forward a page.
REQ_SCR_BPAGE
+ Scroll vertically backward a page.
REQ_SCR_FHPAGE
+ Scroll vertically forward half a page.
REQ_SCR_BHPAGE
+ Scroll vertically backward half a page.
REQ_SCR_FCHAR
+ Scroll horizontally forward a character.
REQ_SCR_BCHAR
+ Scroll horizontally backward a character.
REQ_SCR_HFLINE
+ Scroll horizontally one field width forward.
REQ_SCR_HBLINE
+ Scroll horizontally one field width backward.
REQ_SCR_HFHALF
+ Scroll horizontally one half field width forward.
REQ_SCR_HBHALF
+ Scroll horizontally one half field width backward.
For scrolling purposes, a page of a field is the height of its visible part.
When you pass the forms driver an ASCII character, it is treated as a
+request to add the character to the field's data buffer. Whether this is an
+insertion or a replacement depends on the field's edit mode (insertion is
+the default.
The following requests support editing the field and changing the edit mode:
REQ_INS_MODE
+ Set insertion mode.
REQ_OVL_MODE
+ Set overlay mode.
REQ_NEW_LINE
+ New line request (see below for explanation).
REQ_INS_CHAR
+ Insert space at character location.
REQ_INS_LINE
+ Insert blank line at character location.
REQ_DEL_CHAR
+ Delete character at cursor.
REQ_DEL_PREV
+ Delete previous word at cursor.
REQ_DEL_LINE
+ Delete line at cursor.
REQ_DEL_WORD
+ Delete word at cursor.
REQ_CLR_EOL
+ Clear to end of line.
REQ_CLR_EOF
+ Clear to end of field.
REQ_CLR_FIELD
+ Clear entire field.
The behavior of the REQ_NEW_LINE and REQ_DEL_PREV requests is complicated
+and partly controlled by a pair of forms options. The special cases are
+triggered when the cursor is at the beginning of a field, or on the last
+line of the field.
First, we consider REQ_NEW_LINE:
The normal behavior of REQ_NEW_LINE in insert mode is to break the current
+line at the position of the edit cursor, inserting the portion of the
+current line after the cursor as a new line following the current and moving
+the cursor to the beginning of that new line (you may think of this as
+inserting a newline in the field buffer).
The normal behavior of REQ_NEW_LINE in overlay mode is to clear the current
+line from the position of the edit cursor to end of line. The cursor is then
+moved to the beginning of the next line.
However, REQ_NEW_LINE at the beginning of a field, or on the last line of a
+field, instead does a REQ_NEXT_FIELD. O_NL_OVERLOAD option is off, this
+special action is disabled.
Now, let us consider REQ_DEL_PREV:
The normal behavior of REQ_DEL_PREV is to delete the previous character. If
+insert mode is on, and the cursor is at the start of a line, and the text on
+that line will fit on the previous one, it instead appends the contents of
+the current line to the previous one and deletes the current line (you may
+think of this as deleting a newline from the field buffer).
However, REQ_DEL_PREV at the beginning of a field is instead treated as a
+REQ_PREV_FIELD.
If the O_BS_OVERLOAD option is off, this special action is disabled and the
+forms driver just returns E_REQUEST_DENIED.
If the type of your field is ordered, and has associated functions for
+getting the next and previous values of the type from a given value, there
+are requests that can fetch that value into the field buffer:
REQ_NEXT_CHOICE
+ Place the successor value of the current value in the buffer.
+
REQ_PREV_CHOICE
+ Place the predecessor value of the current value in the buffer.
+
Of the built-in field types, only TYPE_ENUM has built-in successor and
+predecessor functions. When you define a field type of your own (see Custom
+Validation Types), you can associate our own ordering functions.
Form requests are represented as integers above the curses value greater than
+KEY_MAX and less than or equal to the constant MAX_COMMAND. A value within this
+range gets ignored by form_driver(). So this can be used for any purpose by the
+application. It can be treated as an application specific action and take
+corresponding action.
+Now that you have seen the capabilities of ncurses and its sister libraries, you
+are rolling your sleeves up and gearing for a project that heavily manipulates
+screen. But wait.. It can be pretty difficult to write and maintain complex GUI
+widgets in plain ncurses or even with the additional libraries. There are some
+ready-to-use tools and widget libraries that can be used instead of writing your
+own widgets. You can use some of them, get ideas from the code, or even extend
+them.
+CDK stands for 'Curses Development Kit' and it currently contains 21 ready
+to use widgets which facilitate the speedy development of full screen
+curses programs.
The kit provides some useful widgets, which can be used in your programs
+directly. It's pretty well written and the documentation is very good. The
+examples in the examples directory can be a good place to start for beginners.
+The CDK can be downloaded from http://invisible-island.net/cdk/
+. Follow the instructions in
+README file to install it.
The following is the list of widgets provided with cdk and their description.
Widget Type Quick Description
===========================================================================
Alphalist Allows a user to select from a list of words, with
the ability to narrow the search list by typing in a
@@ -6199,215 +8368,346 @@ Template Creates a entry field with character sensitive
dates and phone numbers.
Viewer This is a file/information viewer. Very useful
when you need to display loads of information.
-===========================================================================
-
-
-
-
A few of the widgets are modified by Thomas Dickey in recent
-versions.
Apart from making our life easier with readily usable widgets,
-cdk solves one frustrating problem with printing multi colored
-strings, justified strings elegantly. Special formatting tags can
-be embedded in the strings which are passed to CDK functions. For
-Example
-
If the string
-
-
-
-
-"</B/1>This line should have a yellow foreground and a blue
-background.<!1>"
-
-
-
-
given as a parameter to newCDKLabel(), it prints the line with
-yellow foreground and blue background. There are other tags
-available for justifying string, embedding special drawing
-characters etc.. Please refer to the man page cdk_display(3X) for
-details. The man page explains the usage with nice examples.
Long long ago, in September 1994, when few people knew linux,
-Jeff Tranter wrote an article on dialog in Linux Journal. He starts the
-article with these words..
-
Linux is based on the Unix operating system, but also
-features a number of unique and useful kernel features and
-application programs that often go beyond what is available under
-Unix. One little-known gem is "dialog", a utility for creating
-professional-looking dialog boxes from within shell scripts. This
-article presents a tutorial introduction to the dialog utility, and
-shows examples of how and where it can be used
-
As he explains, dialog is a real gem in making
-professional-looking dialog boxes with ease. It creates a variety
-of dialog boxes, menus, check lists etc.. It is usually installed
-by default. If not, you can download it from Thomas
-Dickey's site.
-
The above-mentioned article gives a very good overview of its
-uses and capabilites. The man page has more details. It can be used
-in variety of situations. One good example is building of linux
-kernel in text mode. Linux kernel uses a modified version of dialog
-tailored for its needs.
-
dialog was initially designed to be used with shell scripts. If
-you want to use its functionality in a c program, then you can use
-libdialog. The documentation regarding this is sparse. Definitive
-reference is the dialog.h header file which comes with the library.
-You may need to hack here and there to get the required output. The
-source is easily customizable. I have used it on a number of
-occasions by modifying the code.
The perl module Curses, Curses::Form and Curses::Widgets give
-access to curses from perl. If you have curses and basic perl is
-installed, you can get these modules from CPAN All Modules page. Get the three zipped modules in
-the Curses category. Once installed you can use these modules from
-perl scripts like any other module. For more information on perl
-modules see perlmod man page. The above modules come with good
-documentation and they have some demo scripts to test the
-functionality. Though the widgets provided are very rudimentary,
-these modules provide good access to curses library from perl.
-
Some of my code examples are converted to perl by Anuradha
-Ratnaweera and they are available in the perl directory.
-
For more information see man pages Curses(3) , Curses::Form(3)
-and Curses::Widgets(3). These pages are installed only when the
-above modules are acquired and installed.
This section contains few programs written by me just for fun.
-They don't signify a better programming practice or the best way of
-using ncurses. They are provided here so as to allow beginners to
-get ideas and add more programs to this section. If you have
-written a couple of nice, simple programs in curses and want them
-to included here, contact me.
Game of life is a wonder of math. In Paul Callahan's words
-
-
-
-
-The Game of Life (or simply Life) is not a game in the conventional sense. There
+===========================================================================
A few of the widgets are modified by Thomas Dickey in recent versions.
Apart from making our life easier with readily usable widgets, cdk solves one
+frustrating problem with printing multi colored strings, justified strings
+elegantly. Special formatting tags can be embedded in the strings which are
+passed to CDK functions. For Example
If the string
"</B/1>This line should have a yellow foreground and a blue
+background.<!1>"
given as a parameter to newCDKLabel(), it prints the line with yellow foreground
+and blue background. There are other tags available for justifying string,
+embedding special drawing characters etc.. Please refer to the man page
+cdk_display(3X) for details. The man page explains the usage with nice examples.
Long long ago, in September 1994, when few people knew linux, Jeff Tranter wrote
+an article on dialog in Linux Journal. He starts the article with these words..
Linux is based on the Unix operating system, but also features a number of
+unique and useful kernel features and application programs that often go beyond
+what is available under Unix. One little-known gem is "dialog", a utility for
+creating professional-looking dialog boxes from within shell scripts. This
+article presents a tutorial introduction to the dialog utility, and shows
+examples of how and where it can be used
+As he explains, dialog is a real gem in making professional-looking dialog boxes
+with ease. It creates a variety of dialog boxes, menus, check lists etc.. It is
+usually installed by default. If not, you can download it from Thomas Dickey's site.
The above-mentioned article gives a very good overview of its uses and
+capabilites. The man page has more details. It can be used in variety of
+situations. One good example is building of linux kernel in text mode. Linux
+kernel uses a modified version of dialog tailored for its needs.
dialog was initially designed to be used with shell scripts. If you want to use
+its functionality in a c program, then you can use libdialog. The documentation
+regarding this is sparse. Definitive reference is the dialog.h header file which
+comes with the library. You may need to hack here and there to get the required
+output. The source is easily customizable. I have used it on a number of
+occasions by modifying the code.
The perl module Curses, Curses::Form and Curses::Widgets give access to curses
+from perl. If you have curses and basic perl is installed, you can get these
+modules from CPAN
+All Modules page. Get the three zipped modules in the Curses category.
+Once installed you can use these modules from perl scripts like any other
+module. For more information on perl modules see perlmod man page. The above
+modules come with good documentation and they have some demo scripts to test the
+functionality. Though the widgets provided are very rudimentary, these modules
+provide good access to curses library from perl.
Some of my code examples are converted to perl by Anuradha Ratnaweera and they
+are available in the perl directory.
+For more information see man pages Curses(3) , Curses::Form(3) and
+Curses::Widgets(3). These pages are installed only when the above modules are
+acquired and installed.
This section contains few programs written by me just for fun. They don't
+signify a better programming practice or the best way of using ncurses. They are
+provided here so as to allow beginners to get ideas and add more programs to
+this section. If you have written a couple of nice, simple programs in curses
+and want them to included here, contact me.
Game of life is a wonder of math. In
+Paul Callahan's words
The Game of Life (or simply Life) is not a game in the conventional sense. There
are no players, and no winning or losing. Once the "pieces" are placed in the
starting position, the rules determine everything that happens later.
Nevertheless, Life is full of surprises! In most cases, it is impossible to look
at a starting position (or pattern) and see what will happen in the future. The
-only way to find out is to follow the rules of the game.
-
-
-
-
This program starts with a simple inverted U pattern and shows
-how wonderful life works. There is a lot of room for improvement in
-the program. You can let the user enter pattern of his choice or
-even take input from a file. You can also change rules and play
-with a lot of variations. Search on google for interesting information on game of
-life.
Magic Square, another wonder of math, is very simple to
-understand but very difficult to make. In a magic square sum of the
-numbers in each row, each column is equal. Even diagnol sum can be
-equal. There are many variations which have special properties.
-
This program creates a simple magic square of odd order.
The famous towers of hanoi solver. The aim of the game is to
-move the disks on the first peg to last peg, using middle peg as a
-temporary stay. The catch is not to place a larger disk over a
-small disk at any time.
A simple typing tutor, I created more out of need than for ease
-of use. If you know how to put your fingers correctly on the
-keyboard, but lack practice, this can be helpful.
Writing programs with NCURSES by Eric Raymond and Zeyd M.
-Ben-Halim at http://invisible-island.net/ncurses/ncurses-intro.html -
-somewhat obsolete. I was inspired by this document and the
-structure of this HOWTO follows from the original document
-
-
-
-
-
-
+only way to find out is to follow the rules of the game.
This program starts with a simple inverted U pattern and shows how wonderful
+life works. There is a lot of room for improvement in the program. You can let
+the user enter pattern of his choice or even take input from a file. You can
+also change rules and play with a lot of variations. Search on google for interesting information on game
+of life.
Magic Square, another wonder of math, is very simple to understand but very
+difficult to make. In a magic square sum of the numbers in each row, each column
+is equal. Even diagnol sum can be equal. There are many variations which have
+special properties.
This program creates a simple magic square of odd order.
The famous towers of hanoi solver. The aim of the game is to move the disks on
+the first peg to last peg, using middle peg as a temporary stay. The catch is
+not to place a larger disk over a small disk at any time.
A simple typing tutor, I created more out of need than for ease of use. If you
+know how to put your fingers correctly on the keyboard, but lack practice, this
+can be helpful.
Writing programs with NCURSES by Eric Raymond and Zeyd M.
+Ben-Halim at
+http://invisible-island.net/ncurses/ncurses-intro.html - somewhat
+obsolete. I was inspired by this document and the structure of this HOWTO
+follows from the original document
\ No newline at end of file
diff --git a/contrib/ncurses/doc/html/announce.html b/contrib/ncurses/doc/html/announce.html
index 961e7571cf61..ffc115de1e66 100644
--- a/contrib/ncurses/doc/html/announce.html
+++ b/contrib/ncurses/doc/html/announce.html
@@ -1,6 +1,6 @@
-
+