ncurses: merge update to ncurses 6.6

6.6 is ABI compatible with 6.5 (tested with abidiff)
Remove html documentation to ease updates

MFC After:	1 month
This commit is contained in:
Baptiste Daroussin
2026-01-14 14:48:32 +01:00
415 changed files with 40789 additions and 36194 deletions
+5
View File
@@ -51,6 +51,11 @@
# xargs -n1 | sort | uniq -d;
# done
# 20260114: remove ncurses html documentation
OLD_FILES+=usr/share/doc/ncurses/hackguide.html
OLD_FILES+=usr/share/doc/ncurses/ncurses-intro.html
OLD_DIRS+=usr/share/doc/ncurses
# 20251215: Remove intrinsic utilities
OLD_FILES+=usr/bin/alias
OLD_FILES+=usr/bin/bg
+4 -3
View File
@@ -1,5 +1,5 @@
-------------------------------------------------------------------------------
-- Copyright 2020,2021 Thomas E. Dickey --
-- Copyright 2020-2024,2025 Thomas E. Dickey --
-- Copyright 2006,2017 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
@@ -26,7 +26,7 @@
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
-- $Id: AUTHORS,v 1.5 2021/06/17 21:20:30 tom Exp $
-- $Id: AUTHORS,v 1.8 2025/11/12 01:25:55 tom Exp $
-------------------------------------------------------------------------------
These are the principal authors/contributors of ncurses since 1.9.9e,
in decreasing order of their contribution:
@@ -36,5 +36,6 @@ JPF Juergen Pfeifer
ESR Eric S Raymond
AVL Alexander V Lukyanov
PB Philippe Blain
GBR Branden Robinson
SV Sven Verdoolaege
NB Nicolas Boulenguez
NB Nicolas Boulenguez
+2 -2
View File
@@ -1,4 +1,4 @@
Copyright 2018-2023,2024 Thomas E. Dickey
Copyright 2018-2024,2025 Thomas E. Dickey
Copyright 1998-2017,2018 Free Software Foundation, Inc.
Permission is hereby granted, free of charge, to any person obtaining a
@@ -26,4 +26,4 @@ sale, use or other dealings in this Software without prior written
authorization.
-- vile:txtmode fc=72
-- $Id: COPYING,v 1.13 2024/01/05 21:13:17 tom Exp $
-- $Id: COPYING,v 1.14 2025/01/04 10:53:46 tom Exp $
+73 -38
View File
@@ -1,5 +1,5 @@
-------------------------------------------------------------------------------
-- Copyright 2018-2023,2024 Thomas E. Dickey --
-- Copyright 2018-2024,2025 Thomas E. Dickey --
-- Copyright 1998-2017,2018 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
@@ -26,7 +26,7 @@
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
-- $Id: INSTALL,v 1.254 2024/04/27 14:21:05 tom Exp $
-- $Id: INSTALL,v 1.263 2025/12/30 20:42:25 tom Exp $
---------------------------------------------------------------------
How to install Ncurses/Terminfo on your system
---------------------------------------------------------------------
@@ -550,8 +550,8 @@ CONFIGURE OPTIONS:
problem.
--enable-bsdpad
Recognize BSD-style prefix padding. Some ancient BSD programs (such as
nethack) call tputs("50") to implement delays.
Recognize BSD-style prefix padding. Some programs written using
the BSD curses API use tputs("50") to implement delays.
--enable-check-size
Compile-in feature to detect screensize for terminals which do not
@@ -587,7 +587,8 @@ CONFIGURE OPTIONS:
as such to the debugger. See also the --disable-macros option.
--enable-exp-win32
When configuring for MinGW, use the experimental Windows 10 driver.
This is an obsolete option used for configuring the Windows 10 driver
for MinGW.
--enable-ext-colors
Extend the cchar_t structure to allow more than 16 colors to be
@@ -650,6 +651,12 @@ CONFIGURE OPTIONS:
may not be accurate, or that your stty settings have disabled the use
of tabs.
--enable-install-prefix
Extend the --with-install-prefix feature to replace the prefix value
with $DESTDIR rather than simply prepending $DESTDIR to install
pathnames. This works with any "make" which supports AT&T style
variable substitution.
--enable-interop
Compile-in experimental interop bindings. These provide generic types
for the form-library.
@@ -660,6 +667,10 @@ CONFIGURE OPTIONS:
systems). If you do not specify this option, the configure script
checks the current filesystem.
--enable-named-pipes
Compile-in support for named pipes, used to connect to Windows 10
pseudo-console.
--enable-no-padding
Compile-in support for the $NCURSES_NO_PADDING environment variable,
which allows you to suppress the effect of non-mandatory padding in
@@ -703,7 +714,7 @@ CONFIGURE OPTIONS:
Use rpath option when generating shared libraries, and (with some
restrictions) when linking the corresponding programs. This originally
(in 1997) applied mainly to systems using the GNU linker (read the
manpage).
man page).
More recently it is useful for systems that require special treatment
shared libraries in "unusual" locations. The "system" libraries reside
@@ -768,9 +779,9 @@ CONFIGURE OPTIONS:
unless you have disabled the extended functions.
--enable-term-driver
Enable experimental terminal-driver. This is currently used for the
MinGW port, by providing a way to substitute the low-level terminfo
library with different terminal drivers.
Enable terminal-driver. This is required for the MinGW port, by
providing a way to substitute the low-level terminfo library with
different terminal drivers.
--enable-termcap
Compile in support for reading terminal descriptions from termcap if no
@@ -1097,34 +1108,35 @@ CONFIGURE OPTIONS:
./configure --enable-static
--with-manpage-aliases
Tell the configure script you wish to create entries in the
man-directory for aliases to manpages which list them, e.g., the
functions in the panel manpage. This is the default. You can disable
it if your man program does this. You can also disable
--with-manpage-symlinks to install files containing a ".so" command
rather than symbolic links.
Create files in subdirectories of the installation "man" directory that
alias the man pages documenting them. For example, the "beep" man page
also documents the function "flash". This is the default. You can
disable this procedure if your system's makewhatis(8) or mandb(8)
program indexes the directory to which the pages are installed. If you
disable man page symlinks by specifying "--without-manpage-symlinks",
the alias pages are created as stubs containing ".so" *roff requests.
--with-manpage-format=XXX
Tell the configure script how you would like to install man-pages. The
option value must be one of these: gzip, compress, BSDI, normal,
formatted. If you do not give this option, the configure script
Tell the configure script how you would like to install man pages. The
option value must be one of these: "gzip", "compress", "BSDI", "normal",
"formatted". If you do not specify this option, the configure script
attempts to determine which is the case.
--with-manpage-renames=XXX
Tell the configure script that you wish to rename the manpages while
installing. Currently the only distribution which does this is Debian.
Tell the configure script that you wish to rename the man pages when
installing them. Debian and distributions descended from it do this.
The option value specifies the name of a file that lists the renamed
files, e.g., $srcdir/man/man_db.renames
files, e.g., "$srcdir/man/man_db.renames".
--with-manpage-symlinks
Tell the configure script that you wish to make symbolic links in the
man-directory for aliases to the man-pages. This is the default, but
can be disabled for systems that provide this automatically. Doing
this on systems that do not support symbolic links will result in
copying the man-page for each alias.
man-directory for aliases to the man pages. This is the default, but
can be disabled for systems that provide this service automatically.
Doing this on systems that do not support symbolic links creates a copy
of the target man page for each alias.
--with-manpage-tbl
Tell the configure script that you wish to preprocess the manpages
Tell the configure script that you wish to preprocess the man pages
by running them through tbl to generate tables understandable by
nroff.
@@ -1182,11 +1194,11 @@ CONFIGURE OPTIONS:
--with-pkg-config-libdir[=DIR]
If pkg-config was found, override the automatic check for its library
path. The optional DIR value can be
"auto", automatically use pkg-config's library directory, or
"libdir", use a ${libdir}/pkgconfig (based on the configuration), or
a directory path, i.e., beginning with "/".
The configure script allows only a single directory, because
@@ -1351,11 +1363,9 @@ CONFIGURE OPTIONS:
several builds, some symbols will be listed in the the ".map" files
that do not happen to be present in one configuration or another.
The sample ".map" (and ".sym") files are generated using a set of
scripts which build several configurations for each release version,
checking to see which of the "_nc_" symbols can be made local. In
addition to the ncurses libraries and programs, the symbols used
by the "tack" program before version 1.08 are made global.
The sample ".map" (and ".sym") files were generated using a set of
scripts which built several configurations for each release version,
checking to see which of the "_nc_" symbols can be made local.
These sample ".map" files will not cover all possible combinations.
In some cases, e.g., when using the --with-weak-symbols option, you
@@ -1393,10 +1403,10 @@ CONFIGURE OPTIONS:
--without-curses-h
Don't install the ncurses header with the name "curses.h". Rather,
install as "ncurses.h" and modify the installed headers and manpages
install as "ncurses.h" and modify the installed headers and man pages
accordingly.
Likewise, do not install an alias "curses" for the ncurses manpage.
Likewise, do not install an alias "curses" for the ncurses man page.
--without-cxx
XSI curses declares "bool" as part of the interface. C++ also declares
@@ -1419,7 +1429,7 @@ CONFIGURE OPTIONS:
Do not use dlsym() to load GPM dynamically.
--without-manpages
Tell the configure script to suppress the install of ncurses' manpages.
Tell the configure script to suppress the install of ncurses' man pages.
--without-progs
Tell the configure script to suppress the build of ncurses' application
@@ -1451,7 +1461,32 @@ COMPATIBILITY WITH OLDER RELEASES:
you may encounter when building a system with different versions of
ncurses:
6.5 (Apt 27, 2024)
6.6 (Dec 30, 2025)
Interface changes:
+ none
Added extensions:
+ none
Added internal functions (other than "_sp" variants):
+ _nc_is_path_found
Removed internal functions:
+ none
Modified internal functions:
+ These now pass a const parameter: _nc_has_mouse,
_nc_reset_color_pair, _nc_free_entry, and _nc_timed_wait.
+ These now use a NCURSES_BOOL where an int was used:
_nc_setupscreen, _nc_keypad, _nc_unicode_locale, and
_nc_retrace_bool.
6.5 (Apr 27, 2024)
Interface changes:
+ the WINDOW structure and some related internal data types declared
+12 -11
View File
@@ -36,6 +36,8 @@
./Ada95/mk-pkg.awk
./Ada95/package/AdaCurses-doc.spec
./Ada95/package/AdaCurses.spec
./Ada95/package/debian/adacurses.lintian-overrides
./Ada95/package/debian/adacurses.triggers
./Ada95/package/debian/compat
./Ada95/package/debian/control
./Ada95/package/debian/copyright
@@ -556,21 +558,18 @@
./include/headers
./include/nc_access.h
./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/nc_win32.h
./include/nc_win32.h.in
./include/ncurses_cfg.hin
./include/ncurses_defs
./include/ncurses_dll.h.in
./include/ncurses_mingw.h
./include/term_entry.h
./include/termcap.h.in
./include/tic.h
./include/unctrl.h.in
./include/win32_curses.h
./install-sh
./man/MKada_config.in
./man/MKncu_config.in
@@ -900,6 +899,7 @@
./ncurses/llib-ltinfow
./ncurses/modules
./ncurses/new_pair.h
./ncurses/report_ctype.c
./ncurses/report_hashing.c
./ncurses/report_offsets.c
./ncurses/term.priv.h
@@ -1007,12 +1007,11 @@
./ncurses/win32con/gettimeofday.c
./ncurses/win32con/wcwidth.c
./ncurses/win32con/win32_driver.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/mingw32-ncurses6.lintian-overrides
./package/debian-mingw/mingw32-ncurses6td.lintian-overrides
./package/debian-mingw/rules
./package/debian-mingw/source/format
./package/debian-mingw/watch
@@ -1020,7 +1019,7 @@
./package/debian-mingw64/compat
./package/debian-mingw64/control
./package/debian-mingw64/copyright
./package/debian-mingw64/mingw64-ncurses6.lintian-overrides
./package/debian-mingw64/mingw64-ncurses6td.lintian-overrides
./package/debian-mingw64/rules
./package/debian-mingw64/source/format
./package/debian-mingw64/watch
@@ -1028,10 +1027,10 @@
./package/debian/compat
./package/debian/control
./package/debian/copyright
./package/debian/ncurses6.lintian-overrides
./package/debian/ncurses6.triggers
./package/debian/ncursest6.lintian-overrides
./package/debian/ncursest6.triggers
./package/debian/ncurses6td.lintian-overrides
./package/debian/ncurses6td.triggers
./package/debian/ncursest6td.lintian-overrides
./package/debian/ncursest6td.triggers
./package/debian/rules
./package/debian/source/format
./package/debian/watch
@@ -1190,6 +1189,8 @@
./test/package/debian/control
./test/package/debian/copyright
./test/package/debian/docs
./test/package/debian/ncurses-examples.lintian-overrides
./test/package/debian/ncursest-examples.lintian-overrides
./test/package/debian/rules
./test/package/debian/source/format
./test/package/debian/watch
+7 -10
View File
@@ -1,6 +1,6 @@
# $Id: Makefile.in,v 1.46 2022/10/01 22:53:36 tom Exp $
# $Id: Makefile.in,v 1.51 2025/10/25 18:01:01 tom Exp $
##############################################################################
# Copyright 2018-2021,2022 Thomas E. Dickey #
# Copyright 2018-2022,2025 Thomas E. Dickey #
# Copyright 1998-2014,2015 Free Software Foundation, Inc. #
# #
# Permission is hereby granted, free of charge, to any person obtaining a #
@@ -35,11 +35,10 @@
SHELL = @SHELL@
VPATH = @srcdir@
DESTDIR=@DESTDIR@
RPATH_LIST=@RPATH_LIST@
TOP_MFLAGS = @cf_cv_makeflags@ DESTDIR="$(DESTDIR)" RPATH_LIST="$(RPATH_LIST)"
@SET_MAKE@
@SET_DESTDIR@
RPATH_LIST = @RPATH_LIST@
TOP_MFLAGS = DESTDIR="$(DESTDIR)" RPATH_LIST="$(RPATH_LIST)"
NCURSES_MAJOR = @NCURSES_MAJOR@
NCURSES_MINOR = @NCURSES_MINOR@
@@ -93,6 +92,7 @@ preinstall :
@ echo ''
@ echo ' extended funcs: '`test @NCURSES_EXT_FUNCS@ != 0 && echo yes || echo no`
@ echo ' xterm terminfo: '@WHICH_XTERM@
@ echo ' ABI suffix: '`if test -n "@ABI_SUFFIX@"; then echo @ABI_SUFFIX@; else echo "(none)"; fi`
@ echo ''
@ echo ' bin directory: '$(bindir)
@ echo ' lib directory: '$(libdir)
@@ -114,13 +114,10 @@ preinstall :
distclean \
realclean ::
check :
@ echo The test-programs are interactive
# Put the common rules here so that we can easily construct the list of
# directories to visit.
all \
check \
clean \
distclean \
mostlyclean \
+3 -3
View File
@@ -1,5 +1,5 @@
##############################################################################
# Copyright 2020,2021 Thomas E. Dickey #
# Copyright 2020-2021,2025 Thomas E. Dickey #
# Copyright 1998-2000,2006 Free Software Foundation, Inc. #
# #
# Permission is hereby granted, free of charge, to any person obtaining a #
@@ -26,7 +26,7 @@
# use or other dealings in this Software without prior written #
# authorization. #
################################################################################
# $Id: Makefile.os2,v 1.13 2021/06/17 21:20:30 tom Exp $
# $Id: Makefile.os2,v 1.15 2025/07/12 10:48:01 tom Exp $
#
# Wrapper Makefile for ncurses library under OS/2.
# Author: Juan Jose Garcia Ripoll <worm@arrakis.es>.
@@ -247,7 +247,7 @@ OS2NAME=ncurses-$(NCURSES_MAJOR).$(NCURSES_MINOR)-emx
os2dist :
$(MAKE) -f Makefile.os2 os2clean
./configure --without-debug --with-install-prefix=`pwd|sed -e 's@^.:@@'`/$(OS2NAME)
$(MAKE) -f Makefile.os2 $(CF_MFLAGS) install.os2
$(MAKE) -f Makefile.os2 install.os2
-rm -f $(OS2NAME).zip
echo NCurses-$(NCURSES_MAJOR).$(NCURSES_MINOR)-$(NCURSES_PATCH) for emx > $(OS2NAME)/FILE_ID.DIZ
echo Binary release. >> $(OS2NAME)/FILE_ID.DIZ
+592 -23
View File
@@ -1,5 +1,5 @@
-------------------------------------------------------------------------------
-- Copyright 2018-2023,2024 Thomas E. Dickey --
-- Copyright 2018-2024,2025 Thomas E. Dickey --
-- Copyright 1998-2017,2018 Free Software Foundation, Inc. --
-- --
-- Permission is hereby granted, free of charge, to any person obtaining a --
@@ -26,7 +26,7 @@
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
-- $Id: NEWS,v 1.4114 2024/04/27 18:00:35 tom Exp $
-- $Id: NEWS,v 1.4390 2025/12/30 20:31:07 tom Exp $
-------------------------------------------------------------------------------
This is a log of changes that ncurses has gone through since Zeyd started
@@ -46,6 +46,575 @@ 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.
20251230 6.6 release for upload to ftp.gnu.org
+ update announcement
+ corrected an ifdef needed for mouse support in MinGW/Windows
+ eliminate remaining duplicate code between MinGW/Windows drivers
20251227
+ make win32_curses.h obsolete in favor of nc_win32.h
+ modify MinGW32 configuration to account for its use of Windows-style
pathnames in filesystem checks.
+ replace --enable-exp-win32 option with --enable-named-pipes
20251220
> in-progress work to merge MinGW/Windows port.
+ eliminate EXP_WIN32_DRIVER with USE_NAMED_PIPES
+ change MS_TERMINAL to DEFAULT_TERM_VAR
20251213
+ in-progress work to merge MinGW/Windows port.
+ add a null-pointer check in tic -c option.
+ add a limit-check in infocmp -i option (report/example by Yixuan Cao).
20251206
+ in-progress work to merge MinGW/Windows port.
20251129
+ in-progress work to merge MinGW/Windows port.
20251123
+ revert change using NCURSES_SBOOL in tic.h which interfered with
sign-extension in tigetflag (Debian #1121191, cf: 20251101).
20251122
+ in-progress work to merge MinGW/Windows port.
+ correct expression for TINFO_LIB variable in misc/ncurses-config.in
(Debian #1121208, cf: 20251004).
20251115
+ check for special case of wcrtomb() converting a single byte code to
a different single byte code, which glibc does for code 160 in the
KOI8-R encoding (report by Yury V Zaytsev).
+ improve formatting/style of manpages (patches by Branden Robinson).
+ amend recent changes to mouse handling to avoid a case which caused
a loop in wgetch until additional input is provided (htop #1769,
cf: 20250913).
20251101
+ adjust generated terminfo.5 to omit tbl "x" column modifier if that
is unsupported, i.e., with old nroff/tbl (adapted from patch by
Branden Robinson).
+ in-progress work to merge MinGW/Windows port.
20251025
+ amend locale-portability fix in tty_update.c (MidnightCommander #4799,
cf: 20240203).
+ add testing utility report_ctype
+ update configure macros, improving check for $host_os
+ correct a recent change to curs_termino.3x, along with formatting
fixes for manpages.
+ corrected note about box() in curs_border.3x (patch by Jakub Horky,
cf: 20250201).
20251018
+ add check for build-time utilities, in case cross-compiling is setup
with an invalid $BUILD_CC (prompted by discussion with Stas Sergeev).
+ modify configure-script and makefiles to make it easier to override
the "--with-install-prefix" default with environment variable
(report by Stas Sergeev).
20251010
+ fix stray "\" in curs_extend.3x, regen html manpages.
+ regen html manpages with man2html 1.42, fixing a few cases where
headers were not linked (report by Branden Robinson).
20251004
+ improve formatting/style of manpages (patches by Branden Robinson).
+ in-progress work to merge MinGW/Windows port.
+ improve configure check for "install".
20250927
+ in-progress work to merge MinGW/Windows port.
20250920
+ in-progress work to merge MinGW/Windows port.
+ add configure check for <sys/fsuid.h>, build-fix for flatpacks
(report by Stas Sergeev).
+ update config.guess, config.sub
20250913
+ update ncurses-howto.
+ modify MKfallback.sh to eliminate TERMINFO environment variable.
+ improve checks in run_tic.sh script, change some variable names to
reduce packager confusion (report by Stas Sergeev).
+ disallow configure options which apply only to multiuser systems, to
improve ports to single-user systems such as Haiku (report by Stas
Sergeev).
+ update ncurses/wcwidth.c, for MinGW ports, from xterm.
+ correct _nc_to_char() for the case when wctob() is not found by
configure script (report/patch by Benno Schulenberg).
> patches by Robin Haberkorn
+ modify handle_wheel case 2 to ignore the event as in case 1 for
mouse version 1, since that corresponds to a button 6 or 7 event
which is not supported with ABI 6.
+ use separate read/write pointers in the mouse event queue to work
with too-close events for the click-detection to work reliably,
and further improve that in case mouseinterval(0) is used to
suppress click-detection.
20250830
+ in-progress work to merge MinGW/Windows port.
+ build-fix for experimental Windows configuration (report by Kirill
Makurin).
+ improve pattern used for configure --with-xterm-kbs option.
20250823
+ improve style of MKterminfo.sh script (patches by Branden Robinson).
+ improve formatting/style of manpages (patches by Branden Robinson).
+ remove redundant definition of ConsoleInfo.
+ change scope of TTY, GET_TTY and SET_TTY to ncurses-internals
20250816
+ remove redundant reference to compiler in libtool configuration of
mk-1st.awk (report by Lorinczy Zsigmond).
+ build-fixes for --enable-exp-win32 configuration
+ improve formatting/style of manpages (patches by Branden Robinson).
20250809
+ add configure check for Win32 named pipes feature, using that to make
nc_mingw.h obsolete in favor of nc_win32.h
+ amend limit used in alloc_pair, by applying an adjustment for default
colors only when the maximum number of color pairs is greater than
the maximum number of colors (report by "Ingvix").
20250802
+ fixes for reading Unicode characters in MinGW/Windows port (report by
Axel Reinhold).
20250726
+ modify configure script cases for $host_os, to accommodate 64-bit
big-endian POWER linux with glibc (patch by Cosima Neidahl).
+ add warning to configure script to address conflict between the
--enable-lp64 option and the options for overriding the types used
for chtype and mmask_t.
20250720
+ further improve readability of header-files
+ add a consistency-check for termio(s)/tty headers, to help with
cross-compiles (report by Stas Sergeev).
+ remove some unused configure-macros
+ add xterm+keypad to pccon+base -TD
+ trim trailing blanks from a few files (report by Stas Sergeev).
20250712
+ improve readability of term.h
+ modify recursive make rules to avoid interference with GNU make's
"-j" option (report by Stas Sergeev).
20250705
+ when installing the terminfo database, check if symbolic links are
supported before attemping to link lib/terminfo from share/terminfo
(report by Kirill Makurin).
+ modify configure check for MAKEFLAGS/MFLAGS to ignore existing value
of these environment variables (report by Stas Sergeev).
+ reserve -c/-l options in test/*.c for command/logging like vttest.
+ add options to test/worm.c for benchmarking (Nibby Nebbulous)
+ improve formatting/style of manpages (patches by Branden Robinson).
+ improve readability of header-files (patches by Branden Robinson).
20250628
+ fix a few compiler-warnings.
+ simplify include for wchar.h in Windows port by removing the platform
ifdef's (report by Kirill Makurin).
+ regen Ada95/configure (report by Sven Joachim).
20250621
+ revise loop in wins_nwstr, to ensure that non-spacing characters are
combined with the base spacing character (report by Karl Knechtel).
+ fixes for port using clang-cl or cl MSVC (report by Kirill Makurin).
+ improve test-packages:
+ convert debian*/copyright to DEP-5 format.
+ modify ".spec" test-files to work around timestamp-clamping in
recent Fedora releases.
20250614
+ reduce lintian warnings for test-packages.
+ clean up some shellcheck warnings
+ improve test/configure checks for X libraries, reducing duplicates
+ fix some typos/errata in license text, to help with scripted checks
20250531
+ improve logic in misc/run_tic.in for constructing symbolic link
when $DESTDIR is set.
20250524
+ correct option-name used in configure script, which resulted in size
change for cchar_t (cf: 20250517).
20250517
+ initial changes for some ABI 7 features:
+ disable wgetch-events
+ add feature for extending mouse-buttons
+ add feature for extending direct-color support
+ use bracketed+paste in nsterm, rlogin-color, screen, terminology -TD
20250510
+ add rv/xr codes for domterm, mintty, mlterm -TD
+ add xr code for putty -TD
+ update teraterm to 5.0 -TD
+ add rlogin-color -TD
20250503
+ update/correct some of the rv/xr strings, checked with tack -TD
+ use ansi+rca in sclp -TD
+ use vt220+pcedit in sclp (Werner Fink)
+ move some building blocks from illumos to sun-color, based on
illumos source-history -TD
+ improve use-clauses: ansi+cup, ansi+idl1, ansi+rca, ansi+rca2,
ansi+sgrso, ansi+sgrul -TD
+ add ecma+standout, ecma+underline -TD
+ add rv code for alacritty -TD
+ add rv/xr codes for contour, ghostty, iterm2, kitty, konsole,
vscode, vte, wezterm -TD
20250426
+ expand note on extensions in curs_addch.3x
+ add illumos, sun-16color, sun-256color, sun-direct -TD
+ add wyse+cvis -TD
20250419
+ add note on scrolling and lower-right corner to waddch and wadd_wch
manual pages.
20250412
+ add pangoterm -TD
+ add kf1 to kf5 to sclp (report by Werner Fink)
+ add vt100+pf1-pf4 -TD
20250405
+ improve formatting/style of manpages (patches by Branden Robinson).
+ improve infocmp -E/-e fallback feature (report by Ville Rissanen):
+ prefix names with "ti_" if they begin with a digit, e.g., 9term
+ escape backslashes and double-quotes in description fields
+ modify infocmp -E/-e fallback feature to reduce stricter compiler
warnings for the extended capability data.
+ add sclp -TD
+ add op to vt525 -TD
+ update contour -TD
20250329
+ add XM/xm to ms-terminal, to enable mouse with experimental Windows
driver -TD
+ add -x option to infocmp in MKfallback.sh
+ improve experimental Windows driver by restoring the scroll buffer
and console mode, e.g., when reset_prog_mode or endwin is called
(patch by Daniel Starke).
+ add a buffer-limit check in postprocess_termcap (report/testcase by
Yifan Zhang).
20250322
+ add a null pointer check in mouse-initialization, for the
experimental Windows driver (patch by Daniel Starke).
+ improve makefile dependency in Ada95/src
+ add note in user_caps.5 addressing a quibble about dates.
20250315
+ improve formatting/style of manpages (patches by Branden Robinson).
20250308
+ remove test in wgetch which applied notimeout to the initial read
of a character (patch by Branden Robinson).
+ improve formatting/style of manpages (patches by Branden Robinson).
+ fix a few compiler-warnings in MinGW port.
20250301
+ add color to vt525 (Branden Robinson)
+ add vt520-w and vt525-w (Branden Robinson)
+ improve formatting/style of manpages (patches by Branden Robinson).
+ improve configurability of alloca() as used in Windows ports.
+ fix some typos in manpages.
+ modify configure script checks for stdbool.h to fix build with older
gcc version.
20250222
+ modify treatment of "n" parameter for waddnstr, waddnwstr, and
wins_nwstr to return OK when "n" is zero, for consistency with other
implementations (report by Benjamin Barenblat, cf: 20231118).
+ formatting improvements for terminfo.5 (Debian #1096164).
20250216
+ add limit-checks in alloc_entry.c and alloc_ttype.c to avoid indexing
errors when using infocmp to compare all capabilities when processing
a malformed terminfo binary which has a valid header (testcase by
"Ekkosun").
20250215
+ add gzip option for suppressing filename/timestamp information to an
overlooked case (cf: 20240330).
+ correct spelling errors found with codespell.
+ fix some typos in manpages (report by Sven Joachim)
+ amend change to lib_set_term.c to work with thread configuration
(report by Rajeev Pillai, cf: 20250208).
20250208
+ change etip.h.in to include either/both of <new> and <exception>,
needed for another old BSD.
+ update st (report by Alexander Kashpir) -TD
+ add note for ghostty 1.1.0 -TD
+ fix a few issues found with coverity.
20250201
+ add <new> to the possible headers declaring the C++ std::bad_alloc
(report by Carl Hansen).
+ modify check for stdbool.h to be more conservative in case the
headers are used with a compiler other than that which was used to
configure (Redhat #2342514).
+ improve MKlib_gen.sh handling of "bool" type, for building link_test
+ improve formatting/style of manpages (patches by Branden Robinson).
20250125
+ improve error-handling in c++ binding (report by Mingjie Shen).
+ strict compiler-warning fixes for upcoming gcc15
20250118
+ improve pattern used for configure --with-xterm-kbs option (report by
Mingyu Wang)
+ update configure macros, from work on cdk and dialog.
+ change a parameter name in curs_sp_funcs.3x, for consistency (patch
by "WHR").
> patches by Branden Robinson:
+ improve formatting/style of manpages
+ change winwstr() to a generated function, using the macro definition,
moving its handling of negative length parameter into winnwstr().
+ correct actual-function name in a few trace calls.
20250111
+ add check for infinite loop in tic's use-resolution.
+ increase limit on use-clauses from 32 to 40, warn but allow entries
which exceed the old limit.
+ add some null-pointer checks after mallocs in test-programs.
20250104
+ modify tput to warn about capabilities which expect parameters where
none are given; also repair the feature where multiple capabilities
can be handled on a single line.
+ cleanup use-clauses -TD
+ add linux+lockeys, xterm+r5+lockeys, xterm+r5+fkeys -TD
+ add vt220+ufkeys, vt220+sfkeys
+ revert man/manlinks.sed change, which loses aliases (cf: 20241228).
+ modify MKlib_gen.c to allow for Solaris's definition of NULL as 0L
20241228
+ correct conditional-compile for a case when the C compiler does not
have a bool type.
+ add ghostty -TD
> patches by Branden Robinson:
+ add comments to generated term.h to hint the configure options used
+ use same subdir-convention for term.h, in configure script
+ improve formatting/style of manpages
20241221
+ modify ncurses/tinfo/MKfallback.sh to work with MacOS sed, which
lacks BSD-style \< and \>
+ trim padding from sgr expression used in trim_sgr0, to avoid copying
the padding into the resulting sgr0 (report by Rajeev Pillai).
+ strict compiler-warning fixes for upcoming gcc15
20241214
+ avoid redefining bool in curses.h if the platform already supports
that type (cf: 20241123).
+ move include <curses.h> from etip.h.in to cursesw.h, to work around
breakage in Apple's port of ncurses.
+ strict compiler-warning fixes for upcoming gcc15
20241207
+ strict compiler-warning fixes for upcoming gcc15
20241130
+ improve configure check for lint program.
+ adjust options in test-programs to allow for consistent use of -c/-l
for command/logging.
+ modify win_driver.c for MinGW to handle shift-tab and control-tab as
back-tab (report by Axel Reinhold)
20241123
+ remove dependency on stdbool.h from configure script check for type
of bool when C++ binding is omitted (report by Sam James).
+ compiler-warning fixes
20241109
+ work around musl header ifdef's (report by Urs Jansen, cf: Gentoo
#920266).
+ improve error-reporting in write_entry.c (report by Changqing Li).
+ remove unused #include from DJGPP configuration (report by Stas
Sergeev).
+ workaround/fix issues from clang-analyze
20241102
+ remove djgpp-specific initialization to binary mode (report/patch by
Stas Sergeev).
+ add extended-keys for djgpp 2.05 -TD
20241026
+ update ms-terminal -TD
+ add ms-terminal-direct -TD
+ correct dimensions in test/popup_msg.c, fixing an overrun (patch by
Stas Sergeev, cf: 20211219).
20241019
+ fixes for compiler warnings/cppcheck.
+ build-fixes for DJGPP configuration (patches by Stas Sergeev)
20241006
+ fixes for compiler warnings/cppcheck.
+ use xterm+alt+title in wezterm -TD
20240928
+ improve error-message from infocmp when a terminal entry cannot be
opened (patch by Branden Robinson).
+ improve filtering of -L options in misc/gen-pkgconfig.in and in
misc/ncurses-config.in
+ add check in wresize() for out-of-range dimensions (report by Peter
Bierma).
20240922
+ add a few null-pointer checks in ncurses
+ improve test-driver in ncurses/link_test.c
+ restore background character in manpages as described in X/Open
Curses section 3.3.6, and add option "-c" to test programs to
illustrate a non-blank character in the window background property.
+ improve formatting/style of manpages (patches by Branden Robinson).
+ modify ncurses*-config to add -I option in --cflag where needed for
--disable-overwrite to match ".pc" files.
+ disallow directories and block/character devices in safe-open.
+ amend scr_restore() and scr_init() to remove the target window only
after validating the source window which will replace the target
(report by Zixi Liu).
20240914
+ modify _nc_flush() to also flush stderr to help the flash capability
to work in bash (patch by Harm te Hennepe, cf: 20201128)
+ omit -g and -fXXX flags from CFLAGS in misc/ncurses-config.in
+ improve formatting/style of manpages (patches by Branden Robinson).
+ improve examples in NCURSES-Programming-HOWTO.html
+ update comments in terminfo.src -TD
20240831
+ build-fix for a case in msys2 where gettimeofday() was available but
the fallback was partly configured.
> patch by Rafael Kitover:
+ separate the _NC_WINDOWS platform macro into _NC_WINDOWS_NATIVE,
for MinGW and other native Win32 support, and _NC_WINDOWS, to make
some Win32 features available under the Cygwin runtime, in this case
the term-driver.
+ make some minor adjustments to allow
./configure --enable-term-driver
to also work on Cygwin platforms such as Cygwin and MSYS2.
20240824
+ modify infocmp and tabs to use actual name in usage and header.
+ modify test/demo_keyok.c to accept ^Q for quit, for consistency.
20240817
+ review/update foot for 1.18.1 -TD
+ add a note about DomTerm 3.2.0 -TD
+ add new glob-expressions variables to list in config.status script
(patch by Werner Fink).
+ add --enable-install-prefix to modify behavior of $DESTDIR to merge
or replace the value set by --prefix (adapted from suggestion by
Eli Zaretskii).
20240810
+ modify misc/Makefile.in and misc/run_tic.in so that $DESTDIR is set
and used only in the makefile.
+ modify CF_WITH_PKG_CONFIG_LIBDIR to allow for pkg-config using
DOS/Windows pathname syntax (report by Eli Zaretskii).
+ improve glob-expressions in configure script
+ remove unused Get_Menu_Screen() macro from menu.priv.h
+ update config.guess, config.sub
20240727
+ improve formatting/style of manpages (patches by Branden Robinson).
+ fixes for compiler warnings/cppcheck.
+ modify wattron/wattroff calls in form/m_post.c to call wattr_on and
wattr_off to omit cast used in the former for X/Open compatibility
(patch by Bill Gray).
+ modify wezterm, omitting its broken left/right margin feature (report
by Thayne McCombs) -TD
20240720
+ improve formatting/style of manpages (patches by Branden Robinson).
+ modify configure script and misc/Makefile to accept glob expressions
that include Windows/DOS drive-letters (report by Eli Zaretskii).
+ fix misspelled ifdef and correct return-value of _nc_mingw_tcflush in
win_driver.c (report/patch by Eli Zaretskii).
20240713
+ modify misc/ncurses-config.in, improved match with pkg-config output.
20240706
+ update configure script to use macro changes from dialog.
+ modify CF_NCURSES_PTHREADS to avoid equating package and library
names.
20240629
+ build-fix for ncurses-examples with newer PDCurses, which no longer
has stubs for unimplemented features.
+ add help-popup for test_instr.c, test_inwstr.c
+ modify checks in delwin to avoid checking if the window is a pad
until first checking if it is still on the active window-list
(cf: 20211115).
+ improve -t option of test/gdc.c, allowing hours only, or hours and
minutes only.
20240622
+ improve test/gdc.c (patch by Branden Robinson).
+ improve formatting/style of manpages (patches by Branden Robinson).
+ adjust naming of mingw *-config scripts to match the pkg-config names
+ widen pattern in pc/*-config scripts to disallow more linker options
+ add --cflags-only-I and --cflags-only-other options to
misc/ncurses-config.in
+ revert change to CF_BUILD_CC macro (report by Vassili Courzakis,
cf: 20240518).
20240615
+ improve formatting/style of manpages (patches by Branden Robinson).
+ review/update modules files.
+ improve install-rules in Ada95 makefiles (report by Branden Robinson).
+ improve formatting/style of manpages in test-directory.
20240608
+ change winwstr to return wide character count instead of OK (patch
by Branden Robinson).
+ improve formatting/style of manpages (patches by Branden Robinson).
+ rename testing dpkg's for ncurses6 to resolve a naming conflict with
Debian's ncurses packages.
20240601
+ improve formatting/style of manpages (patches by Branden Robinson).
+ change Ada95/configure to use --with-screen option rather than
--enable-widec, to provide more choices of underlying curses library
20240525
+ build-fix for configure option --disable-ext-funcs
+ improve formatting/style of manpages (patches by Branden Robinson).
+ review/update iTerm2 for 3.5.0 -TD
20240519
+ update Ada95/configure to match change for -DTRACE
+ revert change to include/ncurses_defs, which caused build failure if
tracing was not enabled (report by Branden Robinson).
20240518
+ improve formatting/style of manpages (patches by Branden Robinson).
+ move makefile's -DTRACE into include/ncurses_cfg.h, to simplify use
of CFLAGS/CPPFLAGS.
+ improve check for clock_gettime(), from xterm.
+ modify configure script to work around broken gnatgcc script found in
gcc-13 builds.
20240511
+ improve formatting/style of manpages (patches by Branden Robinson).
+ limit value from ESCDELAY environment variable to 30 seconds, like
other delay limits.
+ limit values from LINES and COLUMNS environment variables to 512
(report by Miroslav Lichvar).
20240504
+ update ncurses/wcwidth.c, for MinGW ports, from xterm.
+ trim obsolete comment about tack from INSTALL.
20240427 6.5 release for upload to ftp.gnu.org
+ update announcement
+ fixes/corrections for manpages (patches by Branden Robinson).
@@ -223,7 +792,7 @@ it is not possible to add this information.
modem (prompted by discussion with Werner Fink, Michal Suchanek,
OpenSUSE #1201384, Debian #60377).
+ build-fixes for --with-caps variations.
+ correct a couple of section-references in INSTALL.
+ correct a couple of section references in INSTALL.
20231028
+ move xterm focus mode 1004 from xterm+sm+1006 into xterm+focus as
@@ -319,7 +888,7 @@ it is not possible to add this information.
+ minor grammatical fix for manpages (Branden Robinson).
20230729
+ improve manpages for wgetnstr() and wget_wnstr().
+ improve manpages for wgetnstr() and wget_nwstr().
+ modify MinGW configuration to provide for running in MSYS/MSYS2
shells, assuming ConPTY support (patch by Pavel Fedin).
+ add assignment in CF_MAN_PAGES to fill in value for TERMINFO_DIRS in
@@ -4262,7 +4831,7 @@ it is not possible to add this information.
20140621
+ change shared-library suffix for AIX 5 and 6 to ".so", avoiding
conflict with the static library (report by Ben Lentz).
+ document RPATH_LIST in INSTALLATION file, as part of workarounds for
+ document RPATH_LIST in INSTALL file, as part of workarounds for
upgrading an ncurses library using the "--with-shared" option.
+ modify test/ncurses.c c/C tests to cycle through subsets of the
total number of colors, to better illustrate 8/16/88/256-colors by
@@ -10577,7 +11146,7 @@ it is not possible to add this information.
(adapted from a patch by Ilya Zakharevich).
+ correct parameter types of vidputs() and vidattr() to agree with
header files (report by William P Setzer).
+ fix typos in several man-pages (patch by William P Setzer).
+ fix typos in several man pages (patch by William P Setzer).
+ remove unneeded ifdef for __GNUG__ in CF_CPP_VSCAN_FUNC configure
macro, which made ncurses C++ binding fail to build with other
C++ compilers such as HPUX 11.x (report by Albert Chin-A-Young).
@@ -10630,7 +11199,7 @@ it is not possible to add this information.
wide-character structures (report by <George.R.Goffe@seagate.com>).
+ ensure that _XOPEN_SOURCE_EXTENDED is defined in curses.priv.h if
compiling for wide-character configuration.
+ make addwnstr() handle non-spacing characters (patch by Sven
+ make addnwstr() handle non-spacing characters (patch by Sven
Verdoolaege).
20010630
@@ -11109,7 +11678,7 @@ it is not possible to add this information.
absolute pathname for the build tree's lib directory (prompted by
discussion with Albert Chin-A-Young).
+ modify "make install.man" and "make uninstall.man" to include tack's
man-page.
man page.
+ various fixes for install scripts used to support configure --srcdir
and --with-install-prefix (reported by Matthew Clarke
<Matthew_Clarke@mindlink.bc.ca>).
@@ -11336,7 +11905,7 @@ it is not possible to add this information.
20000708 5.1 release for upload to ftp.gnu.org
+ document configure options in INSTALL.
+ add man-page for ncurses trace functions.
+ add man page for ncurses trace functions.
+ correct return value shown in curs_touch.3x for is_linetouched() and
is_wintouched(), in curs_initscr.3x for isendwin(), and in
curs_termattr.3x for has_ic() and has_il().
@@ -12465,7 +13034,7 @@ it is not possible to add this information.
running screen built with ncurses.
+ check if tmp_fp is opened in tic.c before closing it (patch by Pavel
Roskin <pavel_roskin@geocities.com>).
+ correct several font specification typos in man-pages.
+ correct several font specification typos in man pages.
981220
+ correct default value for BUILD_CC (reported by Larry Virden).
@@ -12814,7 +13383,7 @@ it is not possible to add this information.
+ modify init_pair so that if a color-pair is reinitialized, we will
repaint the areas of the screen whose color changes, like SVr4 curses
(reported by Christian Maurer <maurer@inf.fu-berlin.de>).
+ modify getsyx/setsyx macros to comply with SVr4 man-page which
+ modify getsyx/setsyx macros to comply with SVr4 man page which
says that leaveok() affects their behavior (report by Darryl Miles,
patch by Alexander V Lukyanov).
@@ -12827,7 +13396,7 @@ it is not possible to add this information.
+ implement tparm dynamic variables (reported by Xiaodan Tang).
980613
+ update man-page for for wattr_set, wattr_get (cf: 980509)
+ update man page for wattr_set, wattr_get (cf: 980509)
+ correct limits in hashtest, which would cause nonprinting characters
to be written to large screens.
+ correct configure script, when --without-cxx was specified: the
@@ -13009,12 +13578,12 @@ it is not possible to add this information.
option (patch by Jesse Thilo).
+ correct some places in configure script where $enableval was used
rather than $withval (patch by Darryl Miles <dlm@g7led.demon.co.uk>).
+ modify some man-pages so no '.' or '..' falls between TH and SH
+ modify some man pages so no '.' or '..' falls between TH and SH
macros, to accommodate man_db program (reported by Ian T. Zimmerman
<itz@rahul.net>).
+ terminfo.src 10.2.1 downloaded from ESR's webpage (ESR).
> several changes by Juergen Pfeifer:
+ add copyright notices (and rcs id's) on remaining man-pages.
+ add copyright notices (and rcs id's) on remaining man pages.
+ corrected prototypes for slk_* functions, using chtype rather than
attr_t.
+ implemented the wcolor_set() and slk_color() functions
@@ -13164,7 +13733,7 @@ it is not possible to add this information.
implemented.
+ correct _tracef calls in _tracedump(), which did not separate format
from parameters.
+ correct getopt string for tic "-o" option, and add it to man-page
+ correct getopt string for tic "-o" option, and add it to man page
synopsis (reported by Darren Hiebert <darren@hmi.com>).
+ correct typo in panel/Makefile.in, reversed if-statement in scrolling
optimization (Alexander V. Lukyanov).
@@ -13251,7 +13820,7 @@ it is not possible to add this information.
+ resynchronizes the generated html manpages
971213
+ additional fixes for man-pages section-references
+ additional fixes for man pages' section references
+ add (for debugging) a check for ich/ich1 conflict with smir/rmir
to tic, etc.
+ remove hpa/vpa from rxvt terminal description because they are not
@@ -13263,7 +13832,7 @@ it is not possible to add this information.
+ modify protection when installing libraries to (normally) not
executable. HP-UX shared libraries are an exception.
+ add configure check for 'tack'.
+ implement script for renaming section-references in man-page install,
+ implement script for renaming section references in man page install,
for Debian configuration.
+ add validity-check for SP in trace code in baudrate() (reported by
Daniel Weaver).
@@ -14398,9 +14967,9 @@ it is not possible to add this information.
970104
+ workaround defect in autoconf 2.12 (which terminates configuration
if no C++ compiler is found) by adding an option --without-cxx.
+ modify several man-pages to use tbl, where .nf/.fi was used (reported
+ modify several man pages to use tbl, where .nf/.fi was used (reported
by Jesse Thilo).
+ correct font-codes in some man-pages (patch by Jesse Thilo
+ correct font codes in some man pages (patch by Jesse Thilo
<Jesse.Thilo@pobox.com>)
+ use configure script's knowledge of existence of g++ library for the
c++ Makefile (reported by Paul Jackson).
@@ -14666,7 +15235,7 @@ it is not possible to add this information.
simpler to construct tests (for double-check of _nc_hash_map tests).
+ correct ifdef's for c++ in curses.h
+ change default xterm type to xterm-x11r6.
+ correct quoting in configure that made man-pages installed with
+ correct quoting in configure that made man pages installed with
$datadir instead of actual terminfo path.
+ correct whitespace in include/Caps, which caused kf11, clr_eol and
clr_end to be omitted from terminfo.5
@@ -14878,7 +15447,7 @@ it is not possible to add this information.
960707
+ rollback ESR's #305 change to terminfo.src (it breaks existing
applications, e.g., 'less 290').
+ correct path of edit_man.sh, and fix typo that made all man-pages
+ correct path of edit_man.sh, and fix typo that made all man pages
preformatted.
+ restore man/menu_requestname.3x omitted in Zeyd's resync (oops).
+ auto-configure the GCC_PRINTFLIKE/GCC_SCANFLIKE macros (reported by
@@ -14890,7 +15459,7 @@ it is not possible to add this information.
descriptions.
+ work around autoconf bug, force $INSTALL to absolute path
(reported by Zeyd).
+ modify man-page install for BSDI to install preformatted .0 files
+ modify man page install for BSDI to install preformatted .0 files
(reported by David MacKenzie).
+ add/use gcc __attribute__ for printf and scanf in curses.h
+ added SGR attributes test-case to ncurses
@@ -14991,7 +15560,7 @@ it is not possible to add this information.
+ misc/ncurses-intro.html syntax fix (Kajiyama Tamito).
960601 - snapshot
+ auto-configure man-page compression-format and renames for Debian.
+ auto-configure man page compression format and renames for Debian.
+ corrected several typos in curses.h.in (i.e., the mvXXXX macros).
+ re-order curses.priv.h for lint.
+ added rules for lintlib, lint
+1 -1
View File
@@ -1 +1 @@
5:0:10 6.5 20240427
5:0:10 6.6 20251230
+853 -527
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+16 -10
View File
@@ -1,10 +1,10 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright 1992-2023 Free Software Foundation, Inc.
# Copyright 1992-2025 Free Software Foundation, Inc.
# shellcheck disable=SC2006,SC2268 # see below for rationale
timestamp='2023-10-19'
timestamp='2025-07-10'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -60,7 +60,7 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
Copyright 1992-2023 Free Software Foundation, Inc.
Copyright 1992-2025 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -123,7 +123,7 @@ set_cc_for_build() {
dummy=$tmp/dummy
case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
,,) echo "int x;" > "$dummy.c"
for driver in cc gcc c89 c99 ; do
for driver in cc gcc c17 c99 c89 ; do
if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
CC_FOR_BUILD=$driver
break
@@ -634,7 +634,8 @@ EOF
sed 's/^ //' << EOF > "$dummy.c"
#include <sys/systemcfg.h>
main()
int
main ()
{
if (!__power_pc())
exit(1);
@@ -718,7 +719,8 @@ EOF
#include <stdlib.h>
#include <unistd.h>
int main ()
int
main ()
{
#if defined(_SC_KERNEL_BITS)
long bits = sysconf(_SC_KERNEL_BITS);
@@ -1595,8 +1597,11 @@ EOF
*:Unleashed:*:*)
GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
;;
*:Ironclad:*:*)
GUESS=$UNAME_MACHINE-unknown-ironclad
x86_64:[Ii]ronclad:*:*|i?86:[Ii]ronclad:*:*)
GUESS=$UNAME_MACHINE-pc-ironclad-mlibc
;;
*:[Ii]ronclad:*:*)
GUESS=$UNAME_MACHINE-unknown-ironclad-mlibc
;;
esac
@@ -1621,6 +1626,7 @@ cat > "$dummy.c" <<EOF
#endif
#endif
#endif
int
main ()
{
#if defined (sony)
@@ -1805,8 +1811,8 @@ fi
exit 1
# Local variables:
# eval: (add-hook 'before-save-hook 'time-stamp)
# eval: (add-hook 'before-save-hook 'time-stamp nil t)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-format: "%Y-%02m-%02d"
# time-stamp-end: "'"
# End:
+571 -178
View File
File diff suppressed because it is too large Load Diff
+15906 -15332
View File
File diff suppressed because it is too large Load Diff
+178 -140
View File
@@ -1,5 +1,5 @@
dnl***************************************************************************
dnl Copyright 2018-2023,2024 Thomas E. Dickey *
dnl Copyright 2018-2024,2025 Thomas E. Dickey *
dnl Copyright 1998-2017,2018 Free Software Foundation, Inc. *
dnl *
dnl Permission is hereby granted, free of charge, to any person obtaining a *
@@ -29,7 +29,7 @@ dnl***************************************************************************
dnl
dnl Author: Thomas E. Dickey 1995-on
dnl
dnl $Id: configure.in,v 1.779 2024/04/10 08:04:00 tom Exp $
dnl $Id: configure.in,v 1.824 2025/12/27 00:12:13 tom Exp $
dnl Process this file with autoconf to produce a configure script.
dnl
dnl For additional information, see
@@ -38,9 +38,10 @@ dnl https://invisible-island.net/autoconf/my-autoconf.html
dnl
dnl ---------------------------------------------------------------------------
AC_PREREQ(2.52.20210101)
AC_REVISION($Revision: 1.779 $)
AC_INIT(ncurses/base/lib_initscr.c)
AC_CONFIG_HEADER(include/ncurses_cfg.h:include/ncurses_cfg.hin)
AC_REVISION($Revision: 1.824 $)
AC_INIT
AC_CONFIG_SRCDIR([ncurses/base/lib_initscr.c])
AC_CONFIG_HEADERS([include/ncurses_cfg.h:include/ncurses_cfg.hin])
AC_DEFUN([AC_PATH_XTRA],[])dnl ignore dependencies on this
@@ -65,19 +66,7 @@ CF_ABI_DEFAULTS
CF_WITH_ABI_ALTERED
### Checks for programs.
AC_ARG_WITH(ada,
[ --without-ada suppress check for Ada compiler, don't build demo],
[cf_with_ada=$withval],
[cf_with_ada=yes])
if test "x$cf_with_ada" = xyes
then
cf_prog_cc="gnatgcc gcc cc"
else
cf_prog_cc="gcc cc"
fi
CF_PROG_CC($cf_prog_cc)
CF_WITH_ADA
AC_PROG_CPP
AC_PROG_GCC_TRADITIONAL
CF_PROG_CC_C_O(CC,[$CFLAGS $CPPFLAGS])
@@ -114,13 +103,13 @@ else
save_CPPFLAGS="$CPPFLAGS"
eval cf_includedir=${includedir}
CPPFLAGS="$CPPFLAGS -I${cf_includedir}"
AC_TRY_COMPILE([
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
#include <stdlib.h>
#include <stdio.h>
],
[
printf("Hello world!\n")
],
])],
[cf_cxx_works=yes],
[cf_cxx_works=no])
CPPFLAGS="$save_CPPFLAGS"
@@ -268,7 +257,6 @@ fi
AC_PROG_MAKE_SET
CF_MAKE_PHONY
CF_MAKE_TAGS
CF_MAKEFLAGS
dnl These are standard among *NIX systems, but not when cross-compiling
AC_CHECK_TOOL(RANLIB, ranlib, ':')
@@ -277,20 +265,7 @@ AC_CHECK_TOOL(AR, ar, ar)
AC_CHECK_TOOL(NM, nm, nm)
CF_AR_FLAGS
dnl Special option for use by system-builders: the install-prefix is used to
dnl adjust the location into which the actual install is done, so that an
dnl archive can be built without modifying the host system's configuration.
AC_MSG_CHECKING(for an installation directory prefix)
AC_ARG_WITH(install-prefix,
[ --with-install-prefix=DESTDIR use DESTDIR as installation directory prefix],
[case "x$withval" in
(xyes|xno)
;;
(*) DESTDIR="$withval"
;;
esac])
AC_MSG_RESULT([${DESTDIR:-(none)}])
AC_SUBST(DESTDIR)
CF_INSTALL_PREFIX
###############################################################################
CF_HELP_MESSAGE(Build-Tools Needed to Compile Temporary Applications for Cross-compiling:)
@@ -474,13 +449,13 @@ for model in $cf_list_models ; do
;;
(shared)
if test "$CC_SHARED_OPTS" = "unknown"; then
AC_ERROR(Shared libraries are not supported in this version)
AC_MSG_ERROR(Shared libraries are not supported in this version)
fi
# workaround for inept transition to PIE vs PIC...
AC_MSG_CHECKING(if current CFLAGS link properly)
AC_TRY_LINK(
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[#include <stdio.h>],
[printf("Hello work\\n");],
[printf("Hello work\\n");])],
[cf_cflags_work=yes],
[cf_cflags_work=no])
AC_MSG_RESULT($cf_cflags_work)
@@ -683,42 +658,7 @@ AC_MSG_RESULT($with_xterm_new)
WHICH_XTERM=$with_xterm_new
AC_SUBST(WHICH_XTERM)
case $host_os in
(*linux-gnu|*cygwin|*mingw32|*msys)
want_xterm_kbs=DEL
;;
(*)
want_xterm_kbs=BS
;;
esac
AC_MSG_CHECKING(if xterm backspace sends BS or DEL)
AC_ARG_WITH(xterm-kbs,
[[ --with-xterm-kbs[=XXX] specify if xterm backspace sends BS or DEL]],
[with_xterm_kbs=$withval],
[with_xterm_kbs=auto])
case x$with_xterm_kbs in
(xyes|xno|xBS|xbs|x8)
with_xterm_kbs=BS
;;
(xDEL|xdel|x127)
with_xterm_kbs=DEL
;;
(xauto)
with_xterm_kbs=$want_xterm_kbs
;;
(*)
with_xterm_kbs=$withval
;;
esac
AC_MSG_RESULT($with_xterm_kbs)
XTERM_KBS=$with_xterm_kbs
AC_SUBST(XTERM_KBS)
if test "x$with_xterm_kbs" != "x$want_xterm_kbs"
then
AC_MSG_WARN([expected --with-xterm-kbs=$want_xterm_kbs for $host_os, have $with_xterm_kbs])
fi
CF_WITH_XTERM_KBS
MAKE_TERMINFO=
if test "$use_database" = no ; then
@@ -804,14 +744,14 @@ NCURSES_USE_TERMCAP=0
if test "x$with_termcap" != "xyes" ; then
if test "$use_database" = no ; then
if test -z "$with_fallback" ; then
AC_ERROR(You have disabled the database w/o specifying fallbacks)
AC_MSG_ERROR(You have disabled the database w/o specifying fallbacks)
fi
fi
AC_DEFINE(PURE_TERMINFO,1,[Define to 1 if we should support only terminfo])
else
if test "$with_ticlib" != no ; then
AC_ERROR(Options --with-ticlib and --enable-termcap cannot be combined)
AC_MSG_ERROR(Options --with-ticlib and --enable-termcap cannot be combined)
fi
NCURSES_USE_TERMCAP=1
@@ -852,6 +792,10 @@ AC_ARG_ENABLE(home-terminfo,
AC_MSG_RESULT($with_home_terminfo)
test "x$with_home_terminfo" = "xyes" && AC_DEFINE(USE_HOME_TERMINFO,1,[Define to 1 if $HOME/.terminfo feature is wanted])
CF_CHECK_MULTIUSER
if test "$cf_cv_multiuser" = yes; then
AC_MSG_CHECKING(if you want to permit root to use ncurses environment variables)
AC_ARG_ENABLE(root-environ,
[ --disable-root-environ restrict root use of ncurses environment variables],
@@ -876,6 +820,14 @@ AC_ARG_ENABLE(setuid-environ,
AC_MSG_RESULT($with_setuid_environ)
test "x$with_setuid_environ" = xyes && AC_DEFINE(USE_SETUID_ENVIRON,1,[Define to 1 if setuid/setgid application is allowed to use ncurses environment])
else
if test -n "$enable_root_environ$enable_root_access$enable_setuid_environ"
then
AC_MSG_WARN(ignoring options used only for multiuser systems)
fi
fi # cf_cv_multiuser
### Use option --enable-symlinks to make tic use symlinks, not hard links
### to reduce storage requirements for the terminfo database.
CF_LINK_FUNCS
@@ -977,7 +929,7 @@ if test "x$with_widec" = xyes ; then
# with_overwrite=no
NCURSES_CH_T=cchar_t
AC_CHECK_FUNCS(putwc btowc wctob wmemchr mbtowc wctomb mblen mbrlen mbrtowc wcsrtombs mbsrtowcs wcstombs mbstowcs)
AC_CHECK_FUNCS(putwc btowc wctob wmemchr mbtowc wctomb mblen mbrlen mbrtowc wcsrtombs mbsrtowcs wcstombs mbstowcs wcwidth)
if test "x$ac_cv_func_putwc" != xyes ; then
CF_UTF8_LIB
if test "$cf_cv_utf8_lib" != no ; then
@@ -1097,6 +1049,12 @@ CF_WITH_TYPE(mmask-t,
NCURSES_MMASK_T,
$cf_dft_mmask_t)
### option --enable-lp64 can give unexpected results
if test "$cf_cv_enable_lp64" = 1 ; then
test -n "$with_chtype" && test "$NCURSES_CHTYPE" != unsigned && AC_MSG_WARN(option --enable-lp64 overrides --with-chtype)
test -n "$with_mmask_t" && test "$NCURSES_MMASK_T" != unsigned && AC_MSG_WARN(option --enable-lp64 overrides --with-mmask-t)
fi
### use option --with-ccharw-max to override CCHARW_MAX size
AC_MSG_CHECKING(for size CCHARW_MAX)
AC_ARG_WITH(ccharw-max,
@@ -1136,9 +1094,6 @@ AC_ARG_WITH(rcs-ids,
AC_MSG_RESULT($with_rcs_ids)
test "x$with_rcs_ids" = xyes && AC_DEFINE(USE_RCS_IDS,1,[Define to 1 to compile-in RCS identifiers])
###############################################################################
CF_MAN_PAGES([ captoinfo clear infocmp infotocap reset tabs tic toe tput tset ])
###############################################################################
CF_HELP_MESSAGE(Extensions:)
@@ -1163,8 +1118,9 @@ if test "x$with_ext_funcs" = xyes ; then
AC_DEFINE(HAVE_USE_WINDOW,1,[Define to 1 to enable use_window() function in test-programs])
AC_DEFINE(HAVE_WRESIZE,1,[Define to 1 to enable wresize() function in test-programs])
GENERATED_EXT_FUNCS=generated
test "x$with_ext_funcs" = xyes || cf_dft_ext_spfuncs=no
else
cf_dft_ext_spfuncs=no
cf_dft_ext_colors=no
NCURSES_EXT_FUNCS=0
GENERATED_EXT_FUNCS=
fi
@@ -1189,11 +1145,20 @@ fi
AC_SUBST(NCURSES_SP_FUNCS)
AC_SUBST(GENERATED_SP_FUNCS)
case "$cf_cv_system_name" in
(*mingw32*|*mingw64*|*-msvc*)
cf_dft_term_driver=yes
;;
(*)
cf_dft_term_driver=no
;;
esac
AC_MSG_CHECKING(if you want to build with terminal-driver)
AC_ARG_ENABLE(term-driver,
[ --enable-term-driver enable terminal-driver],
[with_term_driver=$enableval],
[with_term_driver=no])
[with_term_driver=$cf_dft_term_driver])
AC_MSG_RESULT($with_term_driver)
if test "x$with_term_driver" = xyes ; then
AC_DEFINE(USE_TERM_DRIVER,1,[Define to 1 to enable terminal-driver])
@@ -1219,13 +1184,14 @@ fi
AC_SUBST(NCURSES_CONST)
### use option --enable-ext-colors to turn on use of colors beyond 16.
NCURSES_EXT_COLORS=0
NCURSES_RGB_COLORS=0
AC_MSG_CHECKING(if you want to use extended colors)
AC_ARG_ENABLE(ext-colors,
[ --enable-ext-colors compile for 256-color support],
[with_ext_colors=$enableval],
[with_ext_colors=$cf_dft_ext_colors])
AC_MSG_RESULT($with_ext_colors)
NCURSES_EXT_COLORS=0
if test "x$with_ext_colors" = xyes ; then
if test "x$with_widec" != xyes ; then
AC_MSG_WARN(This option applies only to wide-character library)
@@ -1238,8 +1204,20 @@ if test "x$with_ext_colors" = xyes ; then
AC_DEFINE(HAVE_INIT_EXTENDED_COLOR,1,[Define to 1 to enable init_extended_color() function in test-programs])
AC_DEFINE(HAVE_RESET_COLOR_PAIRS,1,[Define to 1 to enable reset_color_pairs() function in test-programs])
fi
### use option --enable-rgb-color to extend support for direct-color
AC_MSG_CHECKING(if you want to extend support for direct color)
AC_ARG_ENABLE(rgb-color,
[ --enable-rgb-color compile for extended direct-color],
[with_rgb_color=$enableval],
[with_rgb_color=$cf_dft_rgb_color])
AC_MSG_RESULT($with_rgb_color)
if test "x$with_rgb_color" = xyes ; then
NCURSES_RGB_COLORS=1
AC_DEFINE(NCURSES_RGB_COLORS,1,[Define to 1 to compile for extended direct-color support])
fi
fi
AC_SUBST(NCURSES_EXT_COLORS)
AC_SUBST(NCURSES_RGB_COLORS)
### use option --enable-ext-mouse to modify coding to support 5-button mice
AC_MSG_CHECKING(if you want to use extended mouse encoding)
@@ -1311,6 +1289,44 @@ if test "x$with_tcap_names" = xyes; then
fi
AC_SUBST(NCURSES_XNAMES)
##############################################################################
USE_NAMED_PIPES=0
INTERNALS_HDR=
case "$cf_cv_system_name" in
(*mingw32*|*mingw64*|*-msvc*)
CF_CHECK_NAMED_PIPES
if test "$cf_cv_named_pipes" = yes; then
AC_MSG_CHECKING(if you want to use named pipes with -Windows driver)
AC_ARG_ENABLE(named-pipes,
[ --enable-named-pipes use named pipes with Windows driver],
[with_named_pipes=$enableval],
[with_named_pipes=no])
AC_MSG_RESULT($with_named_pipes)
else
with_named_pipes=no
fi
if test "x$with_named_pipes" = xyes
then
AC_DEFINE(USE_NAMED_PIPES,1,[Define to 1 to use named pipes with win32 driver])
USE_NAMED_PIPES=1
fi
INTERNALS_HDR='../include/nc_win32.h'
# MinGW32 sets $WD to its directory.
if test -n "$WD"
then
if test -d "$WD"
then
AC_DEFINE(USE_DOS_PATHS,1,[Define to 1 to use DOS pathnames internally])
fi
fi
;;
esac
AC_SUBST(USE_NAMED_PIPES)
AC_SUBST(INTERNALS_HDR)
##############################################################################
CF_HELP_MESSAGE(Reentrant Code:)
CF_WITH_PTHREAD
@@ -1588,6 +1604,11 @@ AC_MSG_RESULT($with_scroll_hints)
test "x$with_scroll_hints" = xyes && AC_DEFINE(USE_SCROLL_HINTS,1,[Define to 1 to compile without scroll-hints code])
fi
case x$cf_cv_abi_default in
(x[[789]])
NCURSES_WGETCH_EVENTS=0
;;
(*)
AC_MSG_CHECKING(if you want wgetch-events code)
AC_ARG_ENABLE(wgetch-events,
[ --enable-wgetch-events compile with wgetch-events code],
@@ -1600,33 +1621,16 @@ if test "x$with_wgetch_events" = xyes ; then
else
NCURSES_WGETCH_EVENTS=0
fi
esac
AC_SUBST(NCURSES_WGETCH_EVENTS)
case "$cf_cv_system_name" in
(*mingw32*|*mingw64*|*-msvc*)
AC_MSG_CHECKING(if you want experimental-Windows driver)
AC_ARG_ENABLE(exp-win32,
[ --enable-exp-win32 compile with experimental-Windows driver],
[with_exp_win32=$enableval],
[with_exp_win32=no])
AC_MSG_RESULT($with_exp_win32)
if test "x$with_exp_win32" = xyes
then
AC_DEFINE(EXP_WIN32_DRIVER,1,[Define to 1 to compile with experimental win32 driver])
EXP_WIN32_DRIVER=1
INTERNALS_HDR='[$](INCDIR)/nc_win32.h'
else
INTERNALS_HDR='[$](INCDIR)/nc_mingw.h'
EXP_WIN32_DRIVER=0
fi
;;
(*)
EXP_WIN32_DRIVER=0
INTERNALS_HDR=
[ --enable-exp-win32 obsolete option for Windows driver],
[AC_MSG_WARN(The --enable-exp-win32 option is obsolete)])
;;
esac
AC_SUBST(EXP_WIN32_DRIVER)
AC_SUBST(INTERNALS_HDR)
###############################################################################
CF_HELP_MESSAGE(Testing/development Options:)
@@ -1721,7 +1725,7 @@ AC_MSG_RESULT($cf_with_trace)
if test "x$cf_with_trace" = xyes ; then
LIB_TRACING=all
ADA_TRACE=TRUE
CF_ADD_CFLAGS(-DTRACE)
AC_DEFINE(TRACE,1,[Define to 1 if we have support trace functions])
AC_DEFINE(HAVE__TRACEF,1,[Define to 1 if we have _tracef function])
else
LIB_TRACING=DEBUG
@@ -1736,7 +1740,7 @@ CF_DISABLE_GNAT_PROJECTS
case "$cf_cv_system_name" in
(*mingw32*|*mingw64*)
# Note: WINVER may be a problem with Windows 10
if test "x$with_exp_win32" = xyes ; then
if test "x$with_named_pipes" = xyes ; then
CPPFLAGS="$CPPFLAGS -DWINVER=0x0600 -DWIN32_LEAN_AND_MEAN"
else
CPPFLAGS="$CPPFLAGS -DWINVER=0x0501 -DWIN32_LEAN_AND_MEAN"
@@ -1756,13 +1760,16 @@ CF_REGEX
dnl These are some other potentially nonportable headers.
AC_CHECK_HEADERS( \
alloca.h \
fcntl.h \
getopt.h \
limits.h \
locale.h \
malloc.h \
math.h \
poll.h \
sys/auxv.h \
sys/fsuid.h \
sys/ioctl.h \
sys/param.h \
sys/poll.h \
@@ -1786,7 +1793,7 @@ fi
CF_SYS_TIME_SELECT
### checks for compiler characteristics
AC_LANG_C
AC_LANG([C])
AC_C_CONST
CF_C_INLINE(NCURSES_INLINE,1200)
CF_SIG_ATOMIC_T
@@ -1893,8 +1900,12 @@ CF_FUNC_MEMMOVE
CF_FUNC_POLL
CF_MB_LEN_MAX
CF_VA_COPY
AC_FUNC_VFORK
AC_FUNC_FORK([])
CF_FOPEN_BIN_R
CF_CHECK_TYPE2(cc_t,termios.h)
CF_CHECK_TYPE2(speed_t,termios.h)
CF_CHECK_TYPE2(tcflag_t,termios.h)
CF_CHECK_TYPE2(sigset_t,signal.h)
# special check for test/ditto.c
CF_FUNC_OPENPTY
@@ -1921,10 +1932,18 @@ fi
# Just in case, check if the C compiler has a bool type.
CF_BOOL_DECL(cf_cv_cc_bool_type)
if test "$cf_cv_cc_bool_type" = yes; then
USE_BUILTIN_BOOL=1
else
USE_BUILTIN_BOOL=0
fi
AC_SUBST(USE_BUILTIN_BOOL)
test "$cf_cv_header_stdbool_h" = yes && AC_DEFINE(USE_STDBOOL_H,1,[Define to 1 if we can include stdbool.h])
# Check for C++ compiler characteristics (and ensure that it's there!)
if test -n "$CXX" ; then
AC_LANG_CPLUSPLUS
AC_LANG([C++])
CF_STDCPP_LIBRARY
CF_PROG_CC_C_O(CXX,[$CXXFLAGS $CPPFLAGS])
@@ -1940,7 +1959,7 @@ if test -n "$CXX" ; then
;;
esac
AC_CHECK_HEADERS(typeinfo)
AC_CHECK_HEADERS(new exception typeinfo)
CF_CXX_IOSTREAM_NAMESPACE
CF_BOOL_DECL
CF_BOOL_SIZE
@@ -1951,7 +1970,7 @@ if test -n "$CXX" ; then
CF_CXX_AR_FLAGS
else
cf_cxx_library=no
cf_cv_builtin_bool=1
cf_cv_builtin_bool=yes
# Just because we are not configuring against C++ right now does not
# mean that a user will not want to use C++. Some distributors disable
@@ -1964,18 +1983,9 @@ else
if test "$NCURSES_BOOL" != auto ; then
cf_cv_type_of_bool=$NCURSES_BOOL
cf_cv_header_stdbool_h=0
USE_STDBOOL_H=0
else
if test "$cf_cv_header_stdbool_h" = 1 ; then
CF_BOOL_SIZE
else
AC_MSG_CHECKING(for fallback type of bool)
case "$host_cpu" in
(i?86) cf_cv_type_of_bool=char ;;
(*) cf_cv_type_of_bool=int ;;
esac
AC_MSG_RESULT($cf_cv_type_of_bool)
fi
CF_BOOL_SIZE
fi
fi
AC_SUBST(CXXLIBS)
@@ -1986,11 +1996,11 @@ AC_SUBST(CXXLIBS)
# specify the type of bool in a configure-script option and postpone
# integration with the C++ compiler provided that the types are compatible.
USE_CXX_BOOL=1
if test "$cf_cv_cc_bool_type" = 1
if test "$USE_BUILTIN_BOOL" = 1
then
# oops: C has a bool. Unlikely, but C++ could differ.
USE_CXX_BOOL=0
elif test "$cf_cv_builtin_bool" = 0
elif test "$cf_cv_builtin_bool" = no
then
# C++ has no bool
USE_CXX_BOOL=0
@@ -2019,7 +2029,6 @@ dnl libtool -TD 20070714
dnl Check for availability of GNU Ada Translator (GNAT).
dnl At the moment we support no other Ada compiler.
if test "$cf_with_ada" != "no" ; then
CF_PROG_GNAT
if test "x$cf_cv_prog_gnat_correct" = xyes; then
CF_ADD_ADAFLAGS(-gnatpn)
CF_FIXUP_ADAFLAGS
@@ -2101,18 +2110,21 @@ if test "$with_term_driver" != no ; then
LIB_SUBSETS="${LIB_SUBSETS}+port_drivers"
case "$cf_cv_system_name" in
(*mingw32*|*mingw64*)
if test "x$with_exp_win32" = xyes ; then
if test "x$with_named_pipes" = xyes ; then
LIB_SUBSETS="${LIB_SUBSETS}+port_tinfo+port_win32"
else
LIB_SUBSETS="${LIB_SUBSETS}+port_tinfo+port_win32con"
fi
CPPFLAGS="$CPPFLAGS -DUSE_WIN32CON_DRIVER"
;;
(*msys*|*cygwin*)
LIB_SUBSETS="${LIB_SUBSETS}+port_tinfo+port_msys2"
;;
(*)
LIB_SUBSETS="${LIB_SUBSETS}+port_tinfo"
;;
esac
elif test "x$with_exp_win32" = xyes ; then
elif test "x$with_named_pipes" = xyes ; then
case "$cf_cv_system_name" in
(*mingw32*|*mingw64*)
LIB_SUBSETS="${LIB_SUBSETS}+port_win32"
@@ -2180,7 +2192,7 @@ if test "x$with_dlsym" = xyes ; then
fi
USE_ARG_SUFFIX="${DFT_ARG_SUFFIX}${EXTRA_SUFFIX}"
USE_LIB_SUFFIX="${LIB_SUFFIX}${EXTRA_SUFFIX}"
ABI_SUFFIX="${LIB_SUFFIX}${EXTRA_SUFFIX}"
USE_CFG_SUFFIX=${DFT_ARG_SUFFIX}${cf_cv_abi_version}
if test -n "$EXTRA_SUFFIX" && test "x$EXTRA_SUFFIX" != "x${cf_cv_abi_version}"
then
@@ -2188,13 +2200,13 @@ then
fi
AC_SUBST(USE_ARG_SUFFIX)
AC_SUBST(USE_CFG_SUFFIX)
AC_SUBST(USE_LIB_SUFFIX)
AC_SUBST(ABI_SUFFIX)
if test "$with_ticlib" != no ; then
if test "x$with_ticlib" != xyes ; then
TICS_NAME=$with_ticlib
TICS_SUFFIX="`echo "${DFT_LIB_SUFFIX}" |sed -e "s/^${USE_LIB_SUFFIX}//"`"
TICS_SUFFIX="`echo "${DFT_LIB_SUFFIX}" |sed -e "s/^${ABI_SUFFIX}//"`"
TICS_ARG_SUFFIX="${with_ticlib}`echo "${USE_ARG_SUFFIX}" |sed -e "s/^${LIB_SUFFIX}//"`"
TICS_DEP_SUFFIX="${with_ticlib}`echo "${DFT_DEP_SUFFIX}" |sed -e "s/^${LIB_SUFFIX}//"`"
TICS_LIB_SUFFIX="${with_ticlib}"
@@ -2202,7 +2214,7 @@ if test "$with_ticlib" != no ; then
TICS_SUFFIX=${DFT_LIB_SUFFIX}
TICS_ARG_SUFFIX="${TICS_NAME}${USE_ARG_SUFFIX}"
TICS_DEP_SUFFIX="${TICS_NAME}${DFT_DEP_SUFFIX}"
TICS_LIB_SUFFIX="${TICS_NAME}${USE_LIB_SUFFIX}"
TICS_LIB_SUFFIX="${TICS_NAME}${ABI_SUFFIX}"
fi
TICS_LDFLAGS="-L${LIB_DIR}"
TICS_LIBS="-l${TICS_ARG_SUFFIX}"
@@ -2221,7 +2233,7 @@ if test "$with_termlib" != no ; then
if test "x$with_termlib" != xyes ; then
TINFO_NAME=$with_termlib
TINFO_SUFFIX="`echo "${DFT_LIB_SUFFIX}" |sed -e "s/^${USE_LIB_SUFFIX}//"`"
TINFO_SUFFIX="`echo "${DFT_LIB_SUFFIX}" |sed -e "s/^${ABI_SUFFIX}//"`"
TINFO_ARG_SUFFIX="${with_termlib}`echo "${USE_ARG_SUFFIX}" |sed -e "s/^${LIB_SUFFIX}//"`"
TINFO_DEP_SUFFIX="${with_termlib}`echo "${DFT_DEP_SUFFIX}" |sed -e "s/^${LIB_SUFFIX}//"`"
TINFO_LIB_SUFFIX="${with_termlib}"
@@ -2229,7 +2241,7 @@ if test "$with_termlib" != no ; then
TINFO_SUFFIX=${DFT_LIB_SUFFIX}
TINFO_ARG_SUFFIX="${TINFO_NAME}${USE_ARG_SUFFIX}"
TINFO_DEP_SUFFIX="${TINFO_NAME}${DFT_DEP_SUFFIX}"
TINFO_LIB_SUFFIX="${TINFO_NAME}${USE_LIB_SUFFIX}"
TINFO_LIB_SUFFIX="${TINFO_NAME}${ABI_SUFFIX}"
fi
TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${TINFO_DEP_SUFFIX}"
@@ -2310,7 +2322,7 @@ if test "$with_overwrite" = no && \
{ test "x$includedir" = 'x${prefix}/include' || \
test "x$includedir" = "x${prefix}/include"; }
then
includesubdir="/ncurses${USE_LIB_SUFFIX}"
includesubdir="/ncurses${ABI_SUFFIX}"
fi
AC_MSG_RESULT(${includedir}${includesubdir})
@@ -2373,11 +2385,29 @@ AC_DEFINE_UNQUOTED(NCURSES_PATHSEP,'$PATH_SEPARATOR',[Define to override ':' as
AC_DEFINE_UNQUOTED(NCURSES_VERSION_STRING, "${NCURSES_MAJOR}.${NCURSES_MINOR}.${NCURSES_PATCH}",[Define to 1 if machine has ample memory for tic])
### Define substitutions for header files to avoid name-pollution
CF_SUBST_IF(["x$cf_cv_have_tcgetattr" = xyes], HAVE_TCGETATTR, 1, 0)
CF_SUBST_IF(["x$ac_cv_header_stdint_h" = xyes], HAVE_STDINT_H, 1, 0)
CF_SUBST_IF(["x$ac_cv_header_termio_h" = xyes], HAVE_TERMIO_H, 1, 0)
CF_SUBST_IF(["x$cf_cv_have_tcgetattr" = xyes], HAVE_TCGETATTR, 1, 0)
CF_SUBST_IF(["x$ac_cv_header_stdint_h" = xyes], HAVE_STDINT_H, 1, 0)
CF_SUBST_IF(["x$ac_cv_header_sgtty_h" = xyes], HAVE_SGTTY_H, 1, 0)
CF_SUBST_IF(["x$ac_cv_header_termio_h" = xyes], HAVE_TERMIO_H, 1, 0)
CF_SUBST_IF(["x$ac_cv_header_termios_h" = xyes], HAVE_TERMIOS_H, 1, 0)
case "x${ac_cv_header_termios_h}${ac_cv_header_termio_h}${ac_cv_header_sgtty_h}${cf_cv_have_tcgetattr}" in
(*yes*)
;;
(*)
case "$cf_cv_system_name" in
(*mingw32*|*mingw64*|*-msvc*)
;;
(*)
AC_MSG_ERROR(No termio/termios/sgtty found)
;;
esac
;;
esac
###############################################################################
CF_MAN_PAGES([ captoinfo clear infocmp infotocap reset tabs tic toe tput tset ])
################################################################################
test "x$use_database" = xyes && \
SUB_MAKEFILES="$SUB_MAKEFILES misc/run_tic.sh:misc/run_tic.in"
@@ -2443,6 +2473,7 @@ do
done
AC_MSG_RESULT($PKG_CFLAGS)
AC_SUBST(PKG_CFLAGS)
CF_GLOB_FULLPATH
# AC_CHECK_SIZEOF demands a literal parameter, no variables. So we do this.
case "x$NCURSES_OSPEED" in
@@ -2532,15 +2563,18 @@ AC_SUBST(PRIVATE_LIBS)
# This is used for the *-config script and *.pc data files.
CF_LD_SEARCHPATH
AC_OUTPUT( \
AC_CONFIG_FILES([\
include/MKterm.h.awk \
include/curses.head:include/curses.h.in \
include/ncurses_dll.h \
include/nc_win32.h \
include/termcap.h \
include/unctrl.h \
man/MKterminfo.tmp:man/MKterminfo.sh \
man/man_db.renames \
$SUB_MAKEFILES \
Makefile,[
Makefile])
AC_CONFIG_COMMANDS([default],[
if test "x$cf_with_tests" != xno ; then
CF_PRG_RULES(["$srcdir/test/mk-test.awk" INSTALL=no ECHO_LINK="$ECHO_LD"], test)
fi
@@ -2564,6 +2598,8 @@ DFT_LWR_MODEL="$DFT_LWR_MODEL"
ECHO_LD="$ECHO_LD"
EXTRA_SUFFIX="$EXTRA_SUFFIX"
FORM_NAME="$FORM_NAME"
GLOB_FULLPATH_OTHER="$GLOB_FULLPATH_OTHER"
GLOB_FULLPATH_POSIX="$GLOB_FULLPATH_POSIX"
LDCONFIG="$LDCONFIG"
LIBTOOL_VERSION="$LIBTOOL_VERSION"
LIB_NAME="$LIB_NAME"
@@ -2594,7 +2630,7 @@ TINFO_SUFFIX="$TINFO_SUFFIX"
UNALTERED_SYMS="$UNALTERED_SYMS"
USE_ARG_SUFFIX="$USE_ARG_SUFFIX"
USE_CFG_SUFFIX="$USE_CFG_SUFFIX"
USE_LIB_SUFFIX="$USE_LIB_SUFFIX"
ABI_SUFFIX="$ABI_SUFFIX"
USE_OLD_MAKERULES="$USE_OLD_MAKERULES"
WILDCARD_SYMS="$WILDCARD_SYMS"
WITH_CURSES_H="$with_curses_h"
@@ -2631,5 +2667,7 @@ target="$target"
verbose="$verbose"
with_shared_cxx="$with_shared_cxx"
],cat)dnl
])
AC_SETUP_DEFS([cat])
AC_OUTPUT
${MAKE:-make} preinstall
+6 -6
View File
@@ -1,5 +1,5 @@
##############################################################################
# Copyright 2018-2023,2024 Thomas E. Dickey #
# Copyright 2018-2024,2025 Thomas E. Dickey #
# Copyright 1998-2017,2018 Free Software Foundation, Inc. #
# #
# Permission is hereby granted, free of charge, to any person obtaining a #
@@ -26,7 +26,7 @@
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
# $Id: dist.mk,v 1.1610 2024/04/27 13:55:54 tom Exp $
# $Id: dist.mk,v 1.1709 2025/12/30 20:31:32 tom Exp $
# Makefile for creating ncurses distributions.
#
# This only needs to be used directly as a makefile by developers, but
@@ -37,8 +37,8 @@ SHELL = /bin/sh
# These define the major/minor/patch versions of ncurses.
NCURSES_MAJOR = 6
NCURSES_MINOR = 5
NCURSES_PATCH = 20240427
NCURSES_MINOR = 6
NCURSES_PATCH = 20251230
# We don't append the patch to the version, since this only applies to releases
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
@@ -93,11 +93,11 @@ doc/hackguide.doc: doc/html/hackguide.html
# The distributed html files are formatted using
# configure --without-manpage-renames
#
# The edit_man.sed script is built as a side-effect of installing the manpages.
# The edit_man.sed script is built as a side effect of installing the man pages.
# If that conflicts with the --without-manpage-renames, you can install those
# in a different location using the --with-install-prefix option of the
# configure script.
MANPROG = tbl | nroff -mandoc -rHY=0 -rLL=78n -rLT=78n -Tascii
MANPROG = tbl | nroff -c -mandoc -rHY=0 -rLL=78n -rLT=78n -Tascii
manhtml:
@for f in doc/html/man/*.html; do \
-962
View File
@@ -1,962 +0,0 @@
<!--
$Id: hackguide.html,v 1.36 2022/11/26 19:31:56 tom Exp $
****************************************************************************
* Copyright 2019-2020,2022 Thomas E. Dickey *
* Copyright 2000-2013,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "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. *
****************************************************************************
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<meta name="generator" content=
"HTML Tidy for HTML5 for Linux version 5.6.0">
<title>A Hacker's Guide to Ncurses Internals</title>
<link rel="author" href="mailto:bugs-ncurses@gnu.org">
<meta http-equiv="Content-Type" content=
"text/html; charset=us-ascii"><!--
This document is self-contained, *except* that there is one relative link to
the ncurses-intro.html document, expected to be in the same directory with
this one.
-->
</head>
<body>
<h1 class="no-header">A Hacker's Guide to NCURSES</h1>
<h2>A Hacker's Guide to NCURSES</h2>
<div class="nav">
<h2>Contents</h2>
<ul>
<li><a href="#abstract">Abstract</a></li>
<li>
<a href="#objective">Objective of the Package</a>
<ul>
<li><a href="#whysvr4">Why System V Curses?</a></li>
<li><a href="#extensions">How to Design Extensions</a></li>
</ul>
</li>
<li><a href="#portability">Portability and Configuration</a></li>
<li><a href="#documentation">Documentation Conventions</a></li>
<li><a href="#bugtrack">How to Report Bugs</a></li>
<li>
<a href="#ncurslib">A Tour of the Ncurses Library</a>
<ul>
<li><a href="#loverview">Library Overview</a></li>
<li><a href="#engine">The Engine Room</a></li>
<li><a href="#input">Keyboard Input</a></li>
<li><a href="#mouse">Mouse Events</a></li>
<li><a href="#output">Output and Screen Updating</a></li>
</ul>
</li>
<li><a href="#fmnote">The Forms and Menu Libraries</a></li>
<li>
<a href="#tic">A Tour of the Terminfo Compiler</a>
<ul>
<li><a href="#nonuse">Translation of
Non-<strong>use</strong> Capabilities</a></li>
<li><a href="#uses">Use Capability Resolution</a></li>
<li><a href="#translation">Source-Form Translation</a></li>
</ul>
</li>
<li><a href="#utils">Other Utilities</a></li>
<li><a href="#style">Style Tips for Developers</a></li>
<li><a href="#port">Porting Hints</a></li>
</ul>
</div>
<h2><a name="abstract" id="abstract">Abstract</a></h2>
<p>This document is a hacker's tour of the
<strong>ncurses</strong> library and utilities. It discusses
design philosophy, implementation methods, and the conventions
used for coding and documentation. It is recommended reading for
anyone who is interested in porting, extending or improving the
package.</p>
<h2><a name="objective" id="objective">Objective of the
Package</a></h2>
<p>The objective of the <strong>ncurses</strong> package is to
provide a free software API for character-cell terminals and
terminal emulators with the following characteristics:</p>
<ul>
<li>Source-compatible with historical curses implementations
(including the original BSD curses and System V curses.</li>
<li>Conformant with the XSI Curses standard issued as part of
XPG4 by X/Open.</li>
<li>High-quality &mdash; stable and reliable code, wide
portability, good packaging, superior documentation.</li>
<li>Featureful &mdash; should eliminate as much of the drudgery
of C interface programming as possible, freeing programmers to
think at a higher level of design.</li>
</ul>
<p>These objectives are in priority order. So, for example,
source compatibility with older version must trump featurefulness
&mdash; we cannot add features if it means breaking the portion
of the API corresponding to historical curses versions.</p>
<h3><a name="whysvr4" id="whysvr4">Why System V Curses?</a></h3>
<p>We used System V curses as a model, reverse-engineering their
API, in order to fulfill the first two objectives.</p>
<p>System V curses implementations can support BSD curses
programs with just a recompilation, so by capturing the System V
API we also capture BSD's.</p>
<p>More importantly for the future, the XSI Curses standard
issued by X/Open is explicitly and closely modeled on System V.
So conformance with System V took us most of the way to
base-level XSI conformance.</p>
<h3><a name="extensions" id="extensions">How to Design
Extensions</a></h3>
<p>The third objective (standards conformance) requires that it
be easy to condition source code using <strong>ncurses</strong>
so that the absence of nonstandard extensions does not break the
code.</p>
<p>Accordingly, we have a policy of associating with each
nonstandard extension a feature macro, so that ncurses client
code can use this macro to condition in or out the code that
requires the <strong>ncurses</strong> extension.</p>
<p>For example, there is a macro
<code>NCURSES_MOUSE_VERSION</code> which XSI Curses does not
define, but which is defined in the <strong>ncurses</strong>
library header. You can use this to condition the calls to the
mouse API calls.</p>
<h2><a name="portability" id="portability">Portability and
Configuration</a></h2>
<p>Code written for <strong>ncurses</strong> may assume an
ANSI-standard C compiler and POSIX-compatible OS interface. It
may also assume the presence of a System-V-compatible
<em>select(2)</em> call.</p>
<p>We encourage (but do not require) developers to make the code
friendly to less-capable UNIX environments wherever possible.</p>
<p>We encourage developers to support OS-specific optimizations
and methods not available under POSIX/ANSI, provided only
that:</p>
<ul>
<li>All such code is properly conditioned so the build process
does not attempt to compile it under a plain ANSI/POSIX
environment.</li>
<li>Adding such implementation methods does not introduce
incompatibilities in the <strong>ncurses</strong> API between
platforms.</li>
</ul>
<p>We use GNU <code>autoconf(1)</code> as a tool to deal with
portability issues. The right way to leverage an OS-specific
feature is to modify the autoconf specification files
(configure.in and aclocal.m4) to set up a new feature macro,
which you then use to condition your code.</p>
<h2><a name="documentation" id="documentation">Documentation
Conventions</a></h2>
<p>There are three kinds of documentation associated with this
package. Each has a different preferred format:</p>
<ul>
<li>Package-internal files (README, INSTALL, TO-DO etc.)</li>
<li>Manual pages.</li>
<li>Everything else (i.e., narrative documentation).</li>
</ul>
<p>Our conventions are simple:</p>
<ol>
<li><strong>Maintain package-internal files in plain
text.</strong> The expected viewer for them is <em>more(1)</em> or
an editor window; there is no point in elaborate mark-up.</li>
<li><strong>Mark up manual pages in the man macros.</strong>
These have to be viewable through traditional <em>man(1)</em>
programs.</li>
<li><strong>Write everything else in HTML.</strong>
</li>
</ol>
<p>When in doubt, HTMLize a master and use <em>lynx(1)</em> to
generate plain ASCII (as we do for the announcement
document).</p>
<p>The reason for choosing HTML is that it is (a) well-adapted
for on-line browsing through viewers that are everywhere; (b)
more easily readable as plain text than most other mark-ups, if
you do not have a viewer; and (c) carries enough information that
you can generate a nice-looking printed version from it. Also, of
course, it make exporting things like the announcement document
to WWW pretty trivial.</p>
<h2><a name="bugtrack" id="bugtrack">How to Report Bugs</a></h2>
<p>The <a name="bugreport" id="bugreport">reporting address for
bugs</a> is <a href=
"mailto:bug-ncurses@gnu.org">bug-ncurses@gnu.org</a>. This is a
majordomo list; to join, write to
<code>bug-ncurses-request@gnu.org</code> with a message
containing the line:</p>
<pre class="code-block">
subscribe &lt;name&gt;@&lt;host.domain&gt;
</pre>
<p>The <code>ncurses</code> code is maintained by a small group
of volunteers. While we try our best to fix bugs promptly, we
simply do not have a lot of hours to spend on elementary
hand-holding. We rely on intelligent cooperation from our users.
If you think you have found a bug in <code>ncurses</code>, there
are some steps you can take before contacting us that will help
get the bug fixed quickly.</p>
<p>In order to use our bug-fixing time efficiently, we put people
who show us they have taken these steps at the head of our queue.
This means that if you do not, you will probably end up at the
tail end and have to wait a while.</p>
<ol>
<li><p>Develop a recipe to reproduce the bug.
<p>Bugs we can reproduce are likely to be fixed very quickly,
often within days. The most effective single thing you can do
to get a quick fix is develop a way we can duplicate the bad
behavior &mdash; ideally, by giving us source for a small,
portable test program that breaks the library. (Even better
is a keystroke recipe using one of the test programs provided
with the distribution.)</p>
</li>
<li><p>Try to reproduce the bug on a different terminal type.
<p>In our experience, most of the behaviors people report as
library bugs are actually due to subtle problems in terminal
descriptions. This is especially likely to be true if you are
using a traditional asynchronous terminal or PC-based
terminal emulator, rather than xterm or a UNIX console
entry.</p>
<p>It is therefore extremely helpful if you can tell us
whether or not your problem reproduces on other terminal
types. Usually you will have both a console type and xterm
available; please tell us whether or not your bug reproduces
on both.</p>
<p>If you have xterm available, it is also good to collect
xterm reports for different window sizes. This is especially
true if you normally use an unusual xterm window size &mdash;
a surprising number of the bugs we have seen are either
triggered or masked by these.</p>
</li>
<li><p>Generate and examine a trace file for the broken behavior.
<p>Recompile your program with the debugging versions of the
libraries. Insert a <code>trace()</code> call with the
argument set to <code>TRACE_UPDATE</code>. (See <a href=
"ncurses-intro.html#debugging">"Writing Programs with
NCURSES"</a> for details on trace levels.) Reproduce your
bug, then look at the trace file to see what the library was
actually doing.</p>
<p>Another frequent cause of apparent bugs is application
coding errors that cause the wrong things to be put on the
virtual screen. Looking at the virtual-screen dumps in the
trace file will tell you immediately if this is happening,
and save you from the possible embarrassment of being told
that the bug is in your code and is your problem rather than
ours.</p>
<p>If the virtual-screen dumps look correct but the bug
persists, it is possible to crank up the trace level to give
more and more information about the library's update actions
and the control sequences it issues to perform them. The test
directory of the distribution contains a tool for digesting
these logs to make them less tedious to wade through.</p>
<p>Often you will find terminfo problems at this stage by
noticing that the escape sequences put out for various
capabilities are wrong. If not, you are likely to learn
enough to be able to characterize any bug in the
screen-update logic quite exactly.</p>
</li>
<li><p>Report details and symptoms, not just interpretations.
<p>If you do the preceding two steps, it is very likely that
you will discover the nature of the problem yourself and be
able to send us a fix. This will create happy feelings all
around and earn you good karma for the first time you run
into a bug you really cannot characterize and fix
yourself.</p>
<p>If you are still stuck, at least you will know what to
tell us. Remember, we need details. If you guess about what
is safe to leave out, you are too likely to be wrong.</p>
<p>If your bug produces a bad update, include a trace file.
Try to make the trace at the <em>least</em> voluminous level
that pins down the bug. Logs that have been through
tracemunch are OK, it does not throw away any information
(actually they are better than un-munched ones because they
are easier to read).</p>
<p>If your bug produces a core-dump, please include a
symbolic stack trace generated by gdb(1) or your local
equivalent.</p>
<p>Tell us about every terminal on which you have reproduced
the bug &mdash; and every terminal on which you cannot.
Ideally, send us terminfo sources for all of these (yours
might differ from ours).</p>
<p>Include your ncurses version and your OS/machine type, of
course! You can find your ncurses version in the
<code>curses.h</code> file.</p>
</li>
</ol>
<p>If your problem smells like a logic error or in cursor
movement or scrolling or a bad capability, there are a couple of
tiny test frames for the library algorithms in the progs
directory that may help you isolate it. These are not part of the
normal build, but do have their own make productions.</p>
<p>The most important of these is <code>mvcur</code>, a test
frame for the cursor-movement optimization code. With this
program, you can see directly what control sequences will be
emitted for any given cursor movement or scroll/insert/delete
operations. If you think you have got a bad capability
identified, you can disable it and test again. The program is
command-driven and has on-line help.</p>
<p>If you think the vertical-scroll optimization is broken, or
just want to understand how it works better, build
<code>hashmap</code> and read the header comments of
<code>hardscroll.c</code> and <code>hashmap.c</code>; then try it
out. You can also test the hardware-scrolling optimization
separately with <code>hardscroll</code>.</p>
<h2><a name="ncurslib" id="ncurslib">A Tour of the Ncurses
Library</a></h2>
<h3><a name="loverview" id="loverview">Library Overview</a></h3>
<p>Most of the library is superstructure &mdash; fairly trivial
convenience interfaces to a small set of basic functions and data
structures used to manipulate the virtual screen (in particular,
none of this code does any I/O except through calls to more
fundamental modules described below). The files</p>
<blockquote>
<code>lib_addch.c lib_bkgd.c lib_box.c lib_chgat.c lib_clear.c
lib_clearok.c lib_clrbot.c lib_clreol.c lib_colorset.c
lib_data.c lib_delch.c lib_delwin.c lib_echo.c lib_erase.c
lib_gen.c lib_getstr.c lib_hline.c lib_immedok.c lib_inchstr.c
lib_insch.c lib_insdel.c lib_insstr.c lib_instr.c
lib_isendwin.c lib_keyname.c lib_leaveok.c lib_move.c
lib_mvwin.c lib_overlay.c lib_pad.c lib_printw.c lib_redrawln.c
lib_scanw.c lib_screen.c lib_scroll.c lib_scrollok.c
lib_scrreg.c lib_set_term.c lib_slk.c lib_slkatr_set.c
lib_slkatrof.c lib_slkatron.c lib_slkatrset.c lib_slkattr.c
lib_slkclear.c lib_slkcolor.c lib_slkinit.c lib_slklab.c
lib_slkrefr.c lib_slkset.c lib_slktouch.c lib_touch.c
lib_unctrl.c lib_vline.c lib_wattroff.c lib_wattron.c
lib_window.c</code>
</blockquote>
<p>are all in this category. They are very unlikely to need
change, barring bugs or some fundamental reorganization in the
underlying data structures.</p>
<p>These files are used only for debugging support:</p>
<blockquote>
<code>lib_trace.c lib_traceatr.c lib_tracebits.c lib_tracechr.c
lib_tracedmp.c lib_tracemse.c trace_buf.c</code>
</blockquote>
<p>It is rather unlikely you will ever need to change these,
unless you want to introduce a new debug trace level for some
reason.</p>
<p>There is another group of files that do direct I/O via
<em>tputs()</em>, computations on the terminal capabilities, or
queries to the OS environment, but nevertheless have only fairly
low complexity. These include:</p>
<blockquote>
<code>lib_acs.c lib_beep.c lib_color.c lib_endwin.c
lib_initscr.c lib_longname.c lib_newterm.c lib_options.c
lib_termcap.c lib_ti.c lib_tparm.c lib_tputs.c lib_vidattr.c
read_entry.c.</code>
</blockquote>
<p>They are likely to need revision only if ncurses is being
ported to an environment without an underlying terminfo
capability representation.</p>
<p>These files have serious hooks into the tty driver and signal
facilities:</p>
<blockquote>
<code>lib_kernel.c lib_baudrate.c lib_raw.c lib_tstp.c
lib_twait.c</code>
</blockquote>
<p>If you run into porting snafus moving the package to another
UNIX, the problem is likely to be in one of these files. The file
<code>lib_print.c</code> uses sleep(2) and also falls in this
category.</p>
<p>Almost all of the real work is done in the files</p>
<blockquote>
<code>hardscroll.c hashmap.c lib_addch.c lib_doupdate.c
lib_getch.c lib_mouse.c lib_mvcur.c lib_refresh.c lib_setup.c
lib_vidattr.c</code>
</blockquote>
<p>Most of the algorithmic complexity in the library lives in
these files. If there is a real bug in <strong>ncurses</strong>
itself, it is probably here. We will tour some of these files in
detail below (see <a href="#engine">The Engine Room</a>).</p>
<p>Finally, there is a group of files that is actually most of
the terminfo compiler. The reason this code lives in the
<strong>ncurses</strong> library is to support fallback to
/etc/termcap. These files include</p>
<blockquote>
<code>alloc_entry.c captoinfo.c comp_captab.c comp_error.c
comp_hash.c comp_parse.c comp_scan.c parse_entry.c
read_termcap.c write_entry.c</code>
</blockquote>
<p>We will discuss these in the compiler tour.</p>
<h3><a name="engine" id="engine">The Engine Room</a></h3>
<h4><a name="input" id="input">Keyboard Input</a></h4>
<p>All <code>ncurses</code> input funnels through the function
<code>wgetch()</code>, defined in <code>lib_getch.c</code>. This
function is tricky; it has to poll for keyboard and mouse events
and do a running match of incoming input against the set of
defined special keys.</p>
<p>The central data structure in this module is a FIFO queue,
used to match multiple-character input sequences against
special-key capabilities; also to implement pushback via
<code>ungetch()</code>.</p>
<p>The <code>wgetch()</code> code distinguishes between function
key sequences and the same sequences typed manually by doing a
timed wait after each input character that could lead a function
key sequence. If the entire sequence takes less than 1 second, it
is assumed to have been generated by a function key press.</p>
<p>Hackers bruised by previous encounters with variant
<code>select(2)</code> calls may find the code in
<code>lib_twait.c</code> interesting. It deals with the problem
that some BSD selects do not return a reliable time-left value.
The function <code>timed_wait()</code> effectively simulates a
System V select.</p>
<h4><a name="mouse" id="mouse">Mouse Events</a></h4>
<p>If the mouse interface is active, <code>wgetch()</code> polls
for mouse events each call, before it goes to the keyboard for
input. It is up to <code>lib_mouse.c</code> how the polling is
accomplished; it may vary for different devices.</p>
<p>Under xterm, however, mouse event notifications come in via
the keyboard input stream. They are recognized by having the
<strong>kmous</strong> capability as a prefix. This is kind of
klugey, but trying to wire in recognition of a mouse key prefix
without going through the function-key machinery would be just
too painful, and this turns out to imply having the prefix
somewhere in the function-key capabilities at terminal-type
initialization.</p>
<p>This kluge only works because <strong>kmous</strong> is not
actually used by any historic terminal type or curses
implementation we know of. Best guess is it is a relic of some
forgotten experiment in-house at Bell Labs that did not leave any
traces in the publicly-distributed System V terminfo files. If
System V or XPG4 ever gets serious about using it again, this
kluge may have to change.</p>
<p>Here are some more details about mouse event handling:</p>
<p>The <code>lib_mouse()</code> code is logically split into a
lower level that accepts event reports in a device-dependent
format and an upper level that parses mouse gestures and filters
events. The mediating data structure is a circular queue of event
structures.</p>
<p>Functionally, the lower level's job is to pick up primitive
events and put them on the circular queue. This can happen in one
of two ways: either (a) <code>_nc_mouse_event()</code> detects a
series of incoming mouse reports and queues them, or (b) code in
<code>lib_getch.c</code> detects the <strong>kmous</strong>
prefix in the keyboard input stream and calls _nc_mouse_inline to
queue up a series of adjacent mouse reports.</p>
<p>In either case, <code>_nc_mouse_parse()</code> should be
called after the series is accepted to parse the digested mouse
reports (low-level events) into a gesture (a high-level or
composite event).</p>
<h4><a name="output" id="output">Output and Screen Updating</a></h4>
<p>With the single exception of character echoes during a
<code>wgetnstr()</code> call (which simulates cooked-mode line
editing in an ncurses window), the library normally does all its
output at refresh time.</p>
<p>The main job is to go from the current state of the screen (as
represented in the <code>curscr</code> window structure) to the
desired new state (as represented in the <code>newscr</code>
window structure), while doing as little I/O as possible.</p>
<p>The brains of this operation are the modules
<code>hashmap.c</code>, <code>hardscroll.c</code> and
<code>lib_doupdate.c</code>; the latter two use
<code>lib_mvcur.c</code>. Essentially, what happens looks like
this:</p>
<ul>
<li>
<p>The <code>hashmap.c</code> module tries to detect vertical
motion changes between the real and virtual screens. This
information is represented by the oldindex members in the
newscr structure. These are modified by vertical-motion and
clear operations, and both are re-initialized after each
update. To this change-journalling information, the hashmap
code adds deductions made using a modified Heckel algorithm
on hash values generated from the line contents.</p>
</li>
<li>
<p>The <code>hardscroll.c</code> module computes an optimum
set of scroll, insertion, and deletion operations to make the
indices match. It calls <code>_nc_mvcur_scrolln()</code> in
<code>lib_mvcur.c</code> to do those motions.</p>
</li>
<li>
<p>Then <code>lib_doupdate.c</code> goes to work. Its job is
to do line-by-line transformations of <code>curscr</code>
lines to <code>newscr</code> lines. Its main tool is the
routine <code>mvcur()</code> in <code>lib_mvcur.c</code>.
This routine does cursor-movement optimization, attempting to
get from given screen location A to given location B in the
fewest output characters possible.</p>
</li>
</ul>
<p>If you want to work on screen optimizations, you should use
the fact that (in the trace-enabled version of the library)
enabling the <code>TRACE_TIMES</code> trace level causes a report
to be emitted after each screen update giving the elapsed time
and a count of characters emitted during the update. You can use
this to tell when an update optimization improves efficiency.</p>
<p>In the trace-enabled version of the library, it is also
possible to disable and re-enable various optimizations at
runtime by tweaking the variable
<code>_nc_optimize_enable</code>. See the file
<code>include/curses.h.in</code> for mask values, near the
end.</p>
<h2><a name="fmnote" id="fmnote">The Forms and Menu Libraries</a></h2>
<p>The forms and menu libraries should work reliably in any
environment you can port ncurses to. The only portability issue
anywhere in them is what flavor of regular expressions the
built-in form field type TYPE_REGEXP will recognize.</p>
<p>The configuration code prefers the POSIX regex facility,
modeled on System V's, but will settle for BSD regexps if the
former is not available.</p>
<p>Historical note: the panels code was written primarily to
assist in porting u386mon 2.0 (comp.sources.misc v14i001-4) to
systems lacking panels support; u386mon 2.10 and beyond use it.
This version has been slightly cleaned up for
<code>ncurses</code>.</p>
<h2><a name="tic" id="tic">A Tour of the Terminfo Compiler</a></h2>
<p>The <strong>ncurses</strong> implementation of
<strong>tic</strong> is rather complex internally; it has to do a
trying combination of missions. This starts with the fact that,
in addition to its normal duty of compiling terminfo sources into
loadable terminfo binaries, it has to be able to handle termcap
syntax and compile that too into terminfo entries.</p>
<p>The implementation therefore starts with a table-driven,
dual-mode lexical analyzer (in <code>comp_scan.c</code>). The
lexer chooses its mode (termcap or terminfo) based on the first
&ldquo;,&rdquo; or &ldquo;:&rdquo; it finds in each entry. The
lexer does all the work of recognizing capability names and
values; the grammar above it is trivial, just "parse entries till
you run out of file".</p>
<h3><a name="nonuse" id="nonuse">Translation of
Non-<strong>use</strong> Capabilities</a></h3>
<p>Translation of most things besides <strong>use</strong>
capabilities is pretty straightforward. The lexical analyzer's
tokenizer hands each capability name to a hash function, which
drives a table lookup. The table entry yields an index which is
used to look up the token type in another table, and controls
interpretation of the value.</p>
<p>One possibly interesting aspect of the implementation is the
way the compiler tables are initialized. All the tables are
generated by various awk/sed/sh scripts from a master table
<code>include/Caps</code>; these scripts actually write C
initializers which are linked to the compiler. Furthermore, the
hash table is generated in the same way, so it doesn't have to be
generated at compiler startup time (another benefit of this
organization is that the hash table can be in shareable text
space).</p>
<p>Thus, adding a new capability is usually pretty trivial, just
a matter of adding one line to the <code>include/Caps</code>
file. We will have more to say about this in the section on
<a href="#translation">Source-Form Translation</a>.</p>
<h3><a name="uses" id="uses">Use Capability Resolution</a></h3>
<p>The background problem that makes <strong>tic</strong> tricky
is not the capability translation itself, it is the resolution of
<strong>use</strong> capabilities. Older versions would not
handle forward <strong>use</strong> references for this reason
(that is, a using terminal always had to follow its use target in
the source file). By doing this, they got away with a simple
implementation tactic; compile everything as it blows by, then
resolve uses from compiled entries.</p>
<p>This will not do for <strong>ncurses</strong>. The problem is
that that the whole compilation process has to be embeddable in
the <strong>ncurses</strong> library so that it can be called by
the startup code to translate termcap entries on the fly. The
embedded version cannot go promiscuously writing everything it
translates out to disk &mdash; for one thing, it will typically
be running with non-root permissions.</p>
<p>So our <strong>tic</strong> is designed to parse an entire
terminfo file into a doubly-linked circular list of entry
structures in-core, and then do <strong>use</strong> resolution
in-memory before writing everything out. This design has other
advantages: it makes forward and back use-references equally easy
(so we get the latter for free), and it makes checking for name
collisions before they are written out easy to do.</p>
<p>And this is exactly how the embedded version works. But the
stand-alone user-accessible version of <strong>tic</strong>
partly reverts to the historical strategy; it writes to disk (not
keeping in core) any entry with no <strong>use</strong>
references.</p>
<p>This is strictly a core-economy kluge, implemented because the
terminfo master file is large enough that some core-poor systems
swap like crazy when you compile it all in memory...there have
been reports of this process taking <strong>three hours</strong>,
rather than the twenty seconds or less typical on the author's
development box.</p>
<p>So. The executable <strong>tic</strong> passes the
entry-parser a hook that <em>immediately</em> writes out the
referenced entry if it has no use capabilities. The compiler main
loop refrains from adding the entry to the in-core list when this
hook fires. If some other entry later needs to reference an entry
that got written immediately, that is OK; the resolution code
will fetch it off disk when it cannot find it in core.</p>
<p>Name collisions will still be detected, just not as cleanly.
The <code>write_entry()</code> code complains before overwriting
an entry that postdates the time of <strong>tic</strong>'s first
call to <code>write_entry()</code>, Thus it will complain about
overwriting entries newly made during the <strong>tic</strong>
run, but not about overwriting ones that predate it.</p>
<h3><a name="translation" id="translation">Source-Form
Translation</a></h3>
<p>Another use of <strong>tic</strong> is to do source
translation between various termcap and terminfo formats. There
are more variants out there than you might think; the ones we
know about are described in the <strong>captoinfo(1)</strong>
manual page.</p>
<p>The translation output code (<code>dump_entry()</code> in
<code>ncurses/dump_entry.c</code>) is shared with the
<strong>infocmp(1)</strong> utility. It takes the same internal
representation used to generate the binary form and dumps it to
standard output in a specified format.</p>
<p>The <code>include/Caps</code> file has a header comment
describing ways you can specify source translations for
nonstandard capabilities just by altering the master table. It is
possible to set up capability aliasing or tell the compiler to
plain ignore a given capability without writing any C code at
all.</p>
<p>For circumstances where you need to do algorithmic
translation, there are functions in <code>parse_entry.c</code>
called after the parse of each entry that are specifically
intended to encapsulate such translations. This, for example, is
where the AIX <strong>box1</strong> capability get translated to
an <strong>acsc</strong> string.</p>
<h2><a name="utils" id="utils">Other Utilities</a></h2>
<p>The <strong>infocmp</strong> utility is just a wrapper around
the same entry-dumping code used by <strong>tic</strong> for
source translation. Perhaps the one interesting aspect of the
code is the use of a predicate function passed in to
<code>dump_entry()</code> to control which capabilities are
dumped. This is necessary in order to handle both the ordinary
De-compilation case and entry difference reporting.</p>
<p>The <strong>tput</strong> and <strong>clear</strong> utilities
just do an entry load followed by a <code>tputs()</code> of a
selected capability.</p>
<h2><a name="style" id="style">Style Tips for Developers</a></h2>
<p>See the TO-DO file in the top-level directory of the source
distribution for additions that would be particularly useful.</p>
<p>The prefix <code>_nc_</code> should be used on library public
functions that are not part of the curses API in order to prevent
pollution of the application namespace. If you have to add to or
modify the function prototypes in curses.h.in, read
ncurses/MKlib_gen.sh first so you can avoid breaking XSI
conformance. Please join the ncurses mailing list. See the
INSTALL file in the top level of the distribution for details on
the list.</p>
<p>Look for the string <code>FIXME</code> in source files to tag
minor bugs and potential problems that could use fixing.</p>
<p>Do not try to auto-detect OS features in the main body of the
C code. That is the job of the configuration system.</p>
<p>To hold down complexity, do make your code data-driven.
Especially, if you can drive logic from a table filtered out of
<code>include/Caps</code>, do it. If you find you need to augment
the data in that file in order to generate the proper table, that
is still preferable to ad-hoc code &mdash; that is why the fifth
field (flags) is there.</p>
<p>Have fun!</p>
<h2><a name="port" id="port">Porting Hints</a></h2>
<p>The following notes are intended to be a first step towards
DOS and Macintosh ports of the ncurses libraries.</p>
<p>The following library modules are &ldquo;pure curses&rdquo;;
they operate only on the curses internal structures, do all
output through other curses calls (not including
<code>tputs()</code> and <code>putp()</code>) and do not call any
other UNIX routines such as signal(2) or the stdio library. Thus,
they should not need to be modified for single-terminal
ports.</p>
<blockquote>
<code>lib_addch.c lib_addstr.c lib_bkgd.c lib_box.c lib_clear.c
lib_clrbot.c lib_clreol.c lib_delch.c lib_delwin.c lib_erase.c
lib_inchstr.c lib_insch.c lib_insdel.c lib_insstr.c
lib_keyname.c lib_move.c lib_mvwin.c lib_newwin.c lib_overlay.c
lib_pad.c lib_printw.c lib_refresh.c lib_scanw.c lib_scroll.c
lib_scrreg.c lib_set_term.c lib_touch.c lib_tparm.c lib_tputs.c
lib_unctrl.c lib_window.c panel.c</code>
</blockquote>
<p>This module is pure curses, but calls outstr():</p>
<blockquote>
<code>lib_getstr.c</code>
</blockquote>
<p>These modules are pure curses, except that they use
<code>tputs()</code> and <code>putp()</code>:</p>
<blockquote>
<code>lib_beep.c lib_color.c lib_endwin.c lib_options.c
lib_slk.c lib_vidattr.c</code>
</blockquote>
<p>This modules assist in POSIX emulation on non-POSIX
systems:</p>
<dl>
<dt>sigaction.c</dt>
<dd>signal calls</dd>
</dl>
<p>The following source files will not be needed for a
single-terminal-type port.</p>
<blockquote>
<code>alloc_entry.c captoinfo.c clear.c comp_captab.c
comp_error.c comp_hash.c comp_main.c comp_parse.c comp_scan.c
dump_entry.c infocmp.c parse_entry.c read_entry.c tput.c
write_entry.c</code>
</blockquote>
<p>The following modules will use
open()/read()/write()/close()/lseek() on files, but no other OS
calls.</p>
<dl>
<dt>lib_screen.c</dt>
<dd>used to read/write screen dumps</dd>
<dt>lib_trace.c</dt>
<dd>used to write trace data to the logfile</dd>
</dl>
<p>Modules that would have to be modified for a port start
here:</p>
<p>The following modules are &ldquo;pure curses&rdquo; but
contain assumptions inappropriate for a memory-mapped port.</p>
<dl>
<dt>lib_longname.c</dt>
<dd>assumes there may be multiple terminals</dd>
<dt>lib_acs.c</dt>
<dd>assumes acs_map as a double indirection</dd>
<dt>lib_mvcur.c</dt>
<dd>assumes cursor moves have variable cost</dd>
<dt>lib_termcap.c</dt>
<dd>assumes there may be multiple terminals</dd>
<dt>lib_ti.c</dt>
<dd>assumes there may be multiple terminals</dd>
</dl>
<p>The following modules use UNIX-specific calls:</p>
<dl>
<dt>lib_doupdate.c</dt>
<dd>input checking</dd>
<dt>lib_getch.c</dt>
<dd>read()</dd>
<dt>lib_initscr.c</dt>
<dd>getenv()</dd>
<dt>lib_newterm.c</dt>
<dt>lib_baudrate.c</dt>
<dt>lib_kernel.c</dt>
<dd>various tty-manipulation and system calls</dd>
<dt>lib_raw.c</dt>
<dd>various tty-manipulation calls</dd>
<dt>lib_setup.c</dt>
<dd>various tty-manipulation calls</dd>
<dt>lib_restart.c</dt>
<dd>various tty-manipulation calls</dd>
<dt>lib_tstp.c</dt>
<dd>signal-manipulation calls</dd>
<dt>lib_twait.c</dt>
<dd>gettimeofday(), select().</dd>
</dl>
<hr>
<address>
Eric S. Raymond &lt;esr@snark.thyrsus.com&gt;
</address>
(Note: This is <em>not</em> the <a href="#bugtrack">bug
address</a>!)
</body>
</html>
File diff suppressed because it is too large Load Diff
+2 -3
View File
@@ -153,9 +153,8 @@ Introduction
source-code or documentation; the tic and infocmp programs are the
exceptions.
System V Release 3 (System III UNIX) from Bell Labs featured a
rewritten and much-improved curses library, along with the tic program
(late 1986).
System V Release 3 from Bell Labs featured a rewritten and
much-improved curses library, along with the tic program (late 1986).
To recap, terminfo is based on Berkeley's termcap database, but
contains a number of improvements and extensions. Parameterized
+21 -7
View File
@@ -1,6 +1,6 @@
# $Id: Makefile.in,v 1.72 2021/07/03 15:45:33 tom Exp $
# $Id: Makefile.in,v 1.78 2025/10/25 17:58:52 tom Exp $
##############################################################################
# Copyright 2020,2021 Thomas E. Dickey #
# Copyright 2020-2024,2025 Thomas E. Dickey #
# Copyright 1998-2015,2018 Free Software Foundation, Inc. #
# #
# Permission is hereby granted, free of charge, to any person obtaining a #
@@ -47,11 +47,14 @@ SHELL = @SHELL@
VPATH = @srcdir@
THIS = Makefile
@SET_MAKE@
@SET_DESTDIR@
TOP_MFLAGS = DESTDIR="$(DESTDIR)" RPATH_LIST="$(RPATH_LIST)"
x = @EXEEXT@
o = .@OBJEXT@
MODEL = @DFT_LWR_MODEL@
DESTDIR = @DESTDIR@
top_srcdir = @top_srcdir@
srcdir = @srcdir@
prefix = @prefix@
@@ -61,7 +64,9 @@ libdir = @libdir@
includedir = @includedir@
includesubdir = @includesubdir@
INCLUDEDIR = $(DESTDIR)$(includedir)$(includesubdir)
INCLUDEDIR = $(DESTDIR)$(includedir@MERGE_PREFIX@)$(includesubdir)
BINDIR = $(DESTDIR)$(bindir@MERGE_PREFIX@)
LIBDIR = $(DESTDIR)$(libdir@MERGE_PREFIX@)
PACKAGE = @PACKAGE@
@@ -110,7 +115,7 @@ LINK = $(LIBTOOL_LINK)
LDFLAGS = @LDFLAGS@ @LD_MODEL@ @LIBS@
SHLIB_DIRS = -L../lib
SHLIB_LIST = $(SHLIB_DIRS) -lncurses@USE_LIB_SUFFIX@ @SHLIB_LIST@
SHLIB_LIST = $(SHLIB_DIRS) -lncurses@ABI_SUFFIX@ @SHLIB_LIST@
RPATH_LIST = @RPATH_LIST@
RESULTING_SYMS = @RESULTING_SYMS@
@@ -151,10 +156,13 @@ all \
libs \
install :: $(AUTO_SRC) $(LIBRARIES)
check ::
@echo "no unit-test implemented"
sources : $(AUTO_SRC)
$(DESTDIR)$(bindir) \
$(DESTDIR)$(libdir) :
$(BINDIR) \
$(LIBDIR) :
mkdir -p $@
# make copies to simplify include-paths while still keeping form's include
@@ -201,6 +209,12 @@ distclean :: clean
realclean :: distclean
# These rules are used to allow "make -n" to work on a clean directory-tree
../include/curses.h \
../include/ncurses_def.h \
../include/term.h :
( cd ../include && $(MAKE) $(TOP_MFLAGS) )
../include/mf_common.h \
../include/eti.h :
( cd ../menu && $(MAKE) $@ )
+3 -3
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2018,2020 Thomas E. Dickey *
* Copyright 2018-2020,2024 Thomas E. Dickey *
* Copyright 1998-2012,2016 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -33,7 +33,7 @@
#include "form.priv.h"
MODULE_ID("$Id: fld_arg.c,v 1.18 2020/12/11 22:05:24 tom Exp $")
MODULE_ID("$Id: fld_arg.c,v 1.19 2024/12/07 23:00:37 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnform
@@ -75,7 +75,7 @@ set_fieldtype_arg(FIELDTYPE *typ,
TR_FUNC_ARG(1, copy_arg),
TR_FUNC_ARG(2, free_arg)));
if (typ != 0 && make_arg != (void *)0)
if (typ != NULL && make_arg != NULL)
{
SetStatus(typ, _HAS_ARGS);
typ->makearg = make_arg;
+3 -3
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2020 Thomas E. Dickey *
* Copyright 2020,2024 Thomas E. Dickey *
* Copyright 1998-2010,2016 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -33,7 +33,7 @@
#include "form.priv.h"
MODULE_ID("$Id: fld_attr.c,v 1.15 2020/12/11 22:05:24 tom Exp $")
MODULE_ID("$Id: fld_attr.c,v 1.16 2024/12/07 23:01:42 tom Exp $")
/*----------------------------------------------------------------------------
Field-Attribute manipulation routines
@@ -47,7 +47,7 @@ FORM_IMPEXP int NCURSES_API set_field_ ## name (FIELD * field, chtype attr)\
if ( attr==A_NORMAL || ((attr & A_ATTRIBUTES)==attr) )\
{\
Normalize_Field( field );\
if (field != 0) \
if (field != NULL) \
{ \
if ((field -> name) != attr)\
{\
+6 -6
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2020 Thomas E. Dickey *
* Copyright 2020,2024 Thomas E. Dickey *
* Copyright 1998-2010,2016 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -33,7 +33,7 @@
#include "form.priv.h"
MODULE_ID("$Id: fld_current.c,v 1.16 2020/05/24 01:40:20 anonymous.maarten Exp $")
MODULE_ID("$Id: fld_current.c,v 1.17 2024/12/07 23:01:42 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnform
@@ -54,7 +54,7 @@ set_current_field(FORM *form, FIELD *field)
int err = E_OK;
T((T_CALLED("set_current_field(%p,%p)"), (void *)form, (void *)field));
if (form == 0 || field == 0)
if (form == NULL || field == NULL)
{
RETURN(E_BAD_ARGUMENT);
}
@@ -117,11 +117,11 @@ FORM_EXPORT(int)
unfocus_current_field(FORM *const form)
{
T((T_CALLED("unfocus_current_field(%p)"), (const void *)form));
if (form == 0)
if (form == NULL)
{
RETURN(E_BAD_ARGUMENT);
}
else if (form->current == 0)
else if (form->current == NULL)
{
RETURN(E_REQUEST_DENIED);
}
@@ -158,7 +158,7 @@ FORM_EXPORT(int)
field_index(const FIELD *field)
{
T((T_CALLED("field_index(%p)"), (const void *)field));
returnCode((field != 0 && field->form != 0) ? (int)field->index : -1);
returnCode((field != NULL && field->form != NULL) ? (int)field->index : -1);
}
/* fld_current.c ends here */
+15 -15
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2020,2021 Thomas E. Dickey *
* Copyright 2020-2021,2024 Thomas E. Dickey *
* Copyright 1998-2012,2014 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -33,7 +33,7 @@
#include "form.priv.h"
MODULE_ID("$Id: fld_def.c,v 1.44 2021/03/27 23:49:53 tom Exp $")
MODULE_ID("$Id: fld_def.c,v 1.46 2024/12/07 21:56:21 tom Exp $")
/* this can't be readonly */
static FIELD default_field =
@@ -87,14 +87,14 @@ _nc_Make_Argument(const FIELDTYPE *typ, va_list *ap, int *err)
{
TypeArgument *res = (TypeArgument *)0;
if (typ != 0 && (typ->status & _HAS_ARGS) != 0)
if (typ != NULL && (typ->status & _HAS_ARGS) != 0)
{
assert(err != 0 && ap != (va_list *)0);
if ((typ->status & _LINKED_TYPE) != 0)
{
TypeArgument *p = typeMalloc(TypeArgument, 1);
if (p != 0)
if (p != NULL)
{
p->left = _nc_Make_Argument(typ->left, ap, err);
p->right = _nc_Make_Argument(typ->right, ap, err);
@@ -134,14 +134,14 @@ _nc_Copy_Argument(const FIELDTYPE *typ, const TypeArgument *argp, int *err)
{
TypeArgument *res = (TypeArgument *)0;
if (typ != 0 && (typ->status & _HAS_ARGS) != 0)
if (typ != NULL && (typ->status & _HAS_ARGS) != 0)
{
assert(err != 0 && argp != 0);
if ((typ->status & _LINKED_TYPE) != 0)
{
TypeArgument *p = typeMalloc(TypeArgument, 1);
if (p != 0)
if (p != NULL)
{
p->left = _nc_Copy_Argument(typ, argp->left, err);
p->right = _nc_Copy_Argument(typ, argp->right, err);
@@ -180,11 +180,11 @@ _nc_Copy_Argument(const FIELDTYPE *typ, const TypeArgument *argp, int *err)
FORM_EXPORT(void)
_nc_Free_Argument(const FIELDTYPE *typ, TypeArgument *argp)
{
if (typ != 0 && (typ->status & _HAS_ARGS) != 0)
if (typ != NULL && (typ->status & _HAS_ARGS) != 0)
{
if ((typ->status & _LINKED_TYPE) != 0)
{
if (argp != 0)
if (argp != NULL)
{
_nc_Free_Argument(typ->left, argp->left);
_nc_Free_Argument(typ->right, argp->right);
@@ -229,7 +229,7 @@ _nc_Copy_Type(FIELD *dst, FIELD const *src)
}
else
{
if (dst->type != 0)
if (dst->type != NULL)
{
dst->type->ref++;
}
@@ -249,7 +249,7 @@ FORM_EXPORT(void)
_nc_Free_Type(FIELD *field)
{
assert(field != 0);
if (field->type != 0)
if (field->type != NULL)
{
field->type->ref--;
_nc_Free_Argument(field->type, (TypeArgument *)(field->arg));
@@ -289,7 +289,7 @@ new_field(int rows, int cols, int frow, int fcol, int nrow, int nbuf)
nrow >= 0 &&
nbuf >= 0 &&
((err = E_SYSTEM_ERROR) != 0) && /* trick: this resets the default error */
(New_Field = typeMalloc(FIELD, 1)) != 0)
(New_Field = typeMalloc(FIELD, 1)) != NULL)
{
T((T_CREATE("field %p"), (void *)New_Field));
*New_Field = default_field;
@@ -313,7 +313,7 @@ new_field(int rows, int cols, int frow, int fcol, int nrow, int nbuf)
size_t len;
len = Total_Buffer_Size(New_Field);
if ((New_Field->buf = (FIELD_CELL *)malloc(len)))
if ((New_Field->buf = (FIELD_CELL *)malloc(len)) != NULL)
{
/* Prefill buffers with blanks and insert terminating zeroes
between buffers */
@@ -360,13 +360,13 @@ free_field(FIELD *field)
{
RETURN(E_BAD_ARGUMENT);
}
else if (field->form != 0)
else if (field->form != NULL)
{
RETURN(E_CONNECTED);
}
else if (field == field->link)
{
if (field->buf != 0)
if (field->buf != NULL)
free(field->buf);
}
else
@@ -380,7 +380,7 @@ free_field(FIELD *field)
}
_nc_Free_Type(field);
#if USE_WIDEC_SUPPORT
if (field->expanded != 0)
if (field->expanded != NULL)
{
int n;
+3 -3
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2020 Thomas E. Dickey *
* Copyright 2020,2024 Thomas E. Dickey *
* Copyright 1998-2010,2012 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -33,7 +33,7 @@
#include "form.priv.h"
MODULE_ID("$Id: fld_dup.c,v 1.18 2020/05/24 01:40:20 anonymous.maarten Exp $")
MODULE_ID("$Id: fld_dup.c,v 1.19 2024/11/30 21:40:55 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnform
@@ -83,7 +83,7 @@ dup_field(FIELD *field, int frow, int fcol)
size_t len;
len = Total_Buffer_Size(New_Field);
if ((New_Field->buf = (FIELD_CELL *)malloc(len * 20)))
if ((New_Field->buf = (FIELD_CELL *)malloc(len * 20)) != NULL)
{
memcpy(New_Field->buf, field->buf, len);
returnField(New_Field);
+9 -6
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2018-2021,2024 Thomas E. Dickey *
* Copyright 2018-2024,2025 Thomas E. Dickey *
* Copyright 1998-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -31,7 +31,7 @@
* Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
/* $Id: form.priv.h,v 0.49 2024/02/24 12:17:31 tom Exp $ */
/* $Id: form.priv.h,v 0.52 2025/11/01 20:16:03 tom Exp $ */
#ifndef FORM_PRIV_H
#define FORM_PRIV_H 1
@@ -93,11 +93,11 @@ extern FORM_EXPORT_VAR(FIELDTYPE *) _nc_Default_FieldType;
/* If form is NULL replace form argument by default-form */
#define Normalize_Form(form) \
((form) = (form != 0) ? (form) : _nc_Default_Form)
((form) = (form != NULL) ? (form) : _nc_Default_Form)
/* If field is NULL replace field argument by default-field */
#define Normalize_Field(field) \
((field) = (field != 0) ? (field) : _nc_Default_Field)
((field) = (field != NULL) ? (field) : _nc_Default_Field)
#if NCURSES_SP_FUNCS
#define Get_Form_Screen(form) \
@@ -172,6 +172,9 @@ TypeArgument;
#define C_ZEROS '\0'
#define MAX_DIGITS 64
#define MaxDigits(n) ((n) > MAX_DIGITS ? MAX_DIGITS : ((n) > 0 ? (n) : 0))
extern FORM_EXPORT(TypeArgument *) _nc_Make_Argument (const FIELDTYPE*, va_list*, int*);
extern FORM_EXPORT(TypeArgument *) _nc_Copy_Argument (const FIELDTYPE*, const TypeArgument*, int*);
extern FORM_EXPORT(void) _nc_Free_Argument (const FIELDTYPE*, TypeArgument*);
@@ -260,7 +263,7 @@ extern FORM_EXPORT(Form_Hook) _nc_retrace_form_hook (Form_Hook);
int len; \
int n; \
wchar_t *list = _nc_Widen_String((char *)buffer, &len); \
if (list != 0) \
if (list != NULL) \
{ \
result = TRUE; \
for (n = 0; n < len; ++n) \
@@ -278,7 +281,7 @@ extern FORM_EXPORT(Form_Hook) _nc_retrace_form_hook (Form_Hook);
blank = TRUE; \
result = (n + 1 >= width); \
} \
else if (!ccheck(list[n], NULL)) \
else if (!ccheck((int) list[n], NULL)) \
{ \
result = FALSE; \
break; \
+4 -4
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2020,2021 Thomas E. Dickey *
* Copyright 2020-2021,2024 Thomas E. Dickey *
* Copyright 1998-2010,2013 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -33,7 +33,7 @@
#include "form.priv.h"
MODULE_ID("$Id: frm_data.c,v 1.21 2021/06/17 21:11:08 tom Exp $")
MODULE_ID("$Id: frm_data.c,v 1.22 2024/07/27 18:35:02 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnform
@@ -54,7 +54,7 @@ data_behind(const FORM *form)
if (form && (form->status & _POSTED) && form->current)
{
FIELD *field;
const FIELD *field;
field = form->current;
if (!Single_Line_Field(field))
@@ -141,7 +141,7 @@ data_ahead(const FORM *form)
if (form && (form->status & _POSTED) && form->current)
{
FIELD *field;
const FIELD *field;
bool cursor_moved = FALSE;
int pos;
+47 -44
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2018-2020,2021 Thomas E. Dickey *
* Copyright 2018-2021,2024 Thomas E. Dickey *
* Copyright 1998-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -33,7 +33,7 @@
#include "form.priv.h"
MODULE_ID("$Id: frm_driver.c,v 1.135 2021/09/01 23:34:01 tom Exp $")
MODULE_ID("$Id: frm_driver.c,v 1.137 2024/12/07 21:57:21 tom Exp $")
/*----------------------------------------------------------------------------
This is the core module of the form library. It contains the majority
@@ -313,7 +313,7 @@ cell_base(WINDOW *win, int y, int x)
while (LEGALYX(win, y, x))
{
cchar_t *data = &(win->_line[y].text[x]);
const cchar_t *data = &(win->_line[y].text[x]);
if (isWidecBase(CHDEREF(data)) || !isWidecExt(CHDEREF(data)))
{
@@ -387,7 +387,7 @@ NCURSES_INLINE static FIELD_CELL *
Get_Start_Of_Data(FIELD_CELL *buf, int blen)
{
FIELD_CELL *p = buf;
FIELD_CELL *end = &buf[blen];
const FIELD_CELL *end = &buf[blen];
assert(buf && blen >= 0);
while ((p < end) && ISBLANK(*p))
@@ -429,7 +429,7 @@ NCURSES_INLINE static FIELD_CELL *
Get_First_Whitespace_Character(FIELD_CELL *buf, int blen)
{
FIELD_CELL *p = buf;
FIELD_CELL *end = &p[blen];
const FIELD_CELL *end = &p[blen];
assert(buf && blen >= 0);
while ((p < end) && !ISBLANK(*p))
@@ -479,7 +479,7 @@ After_Last_Whitespace_Character(FIELD_CELL *buf, int blen)
NCURSES_INLINE static void
Adjust_Cursor_Position(FORM *form, const FIELD_CELL *pos)
{
FIELD *field;
const FIELD *field;
int idx;
field = form->current;
@@ -716,7 +716,7 @@ Field_Grown(FIELD *field, int amount)
for (i = 0; i <= field->nbuf; i++)
{
FIELD_CELL *new_bp = Address_Of_Nth_Buffer(field, i);
FIELD_CELL *old_bp = oldbuf + i * (1 + old_buflen);
const FIELD_CELL *old_bp = oldbuf + i * (1 + old_buflen);
for (j = 0; j < old_buflen; ++j)
new_bp[j] = old_bp[j];
@@ -734,7 +734,7 @@ Field_Grown(FIELD *field, int amount)
{
WINDOW *new_window = newpad(field->drows, field->dcols);
if (new_window != 0)
if (new_window != NULL)
{
assert(form != (FORM *)0);
if (form->w)
@@ -802,7 +802,7 @@ static int
Field_encloses(FIELD *field, int ry, int rx)
{
T((T_CALLED("Field_encloses(%p)"), (void *)field));
if (field != 0
if (field != NULL
&& field->frow <= ry
&& (field->frow + field->rows) > ry
&& field->fcol <= rx
@@ -830,7 +830,7 @@ Field_encloses(FIELD *field, int ry, int rx)
FORM_EXPORT(int)
_nc_Position_Form_Cursor(FORM *form)
{
FIELD *field;
const FIELD *field;
WINDOW *formwin;
if (!form)
@@ -1005,7 +1005,7 @@ _nc_Refresh_Current_Field(FORM *form)
static void
Perform_Justification(FIELD *field, WINDOW *win)
{
FIELD_CELL *bp;
const FIELD_CELL *bp;
int len;
bp = (Field_Has_Option(field, O_NO_LEFT_STRIP)
@@ -1053,7 +1053,7 @@ Perform_Justification(FIELD *field, WINDOW *win)
static void
Undo_Justification(FIELD *field, WINDOW *win)
{
FIELD_CELL *bp;
const FIELD_CELL *bp;
int y, x;
int len;
@@ -1251,7 +1251,7 @@ Synchronize_Linked_Fields(FIELD *field)
return (E_SYSTEM_ERROR);
for (linked_field = field->link;
(linked_field != field) && (linked_field != 0);
(linked_field != field) && (linked_field != NULL);
linked_field = linked_field->link)
{
int syncres;
@@ -1458,7 +1458,7 @@ _nc_Unset_Current_Field(FORM *form)
werase(form->w);
Perform_Justification(field, form->w);
if (Field_Has_Option(field, O_DYNAMIC_JUSTIFY) &&
(form->w->_parent == 0))
(form->w->_parent == NULL))
{
copywin(form->w,
Get_Form_Window(form),
@@ -1480,7 +1480,7 @@ _nc_Unset_Current_Field(FORM *form)
}
delwin(form->w);
form->w = (WINDOW *)0;
form->current = 0;
form->current = NULL;
}
/*---------------------------------------------------------------------------
@@ -1702,10 +1702,10 @@ IFN_Previous_Line(FORM *form)
static int
IFN_Next_Word(FORM *form)
{
FIELD *field = form->current;
const FIELD *field = form->current;
FIELD_CELL *bp = Address_Of_Current_Position_In_Buffer(form);
FIELD_CELL *s;
FIELD_CELL *t;
const FIELD_CELL *t;
T((T_CALLED("IFN_Next_Word(%p)"), (void *)form));
@@ -1745,9 +1745,9 @@ static int
IFN_Previous_Word(FORM *form)
{
FIELD *field = form->current;
FIELD_CELL *bp = Address_Of_Current_Position_In_Buffer(form);
FIELD_CELL *s;
FIELD_CELL *t;
const FIELD_CELL *bp = Address_Of_Current_Position_In_Buffer(form);
const FIELD_CELL *s;
const FIELD_CELL *t;
bool again = FALSE;
T((T_CALLED("IFN_Previous_Word(%p)"), (void *)form));
@@ -1845,7 +1845,7 @@ IFN_End_Of_Field(FORM *form)
static int
IFN_Beginning_Of_Line(FORM *form)
{
FIELD *field = form->current;
const FIELD *field = form->current;
T((T_CALLED("IFN_Beginning_Of_Line(%p)"), (void *)form));
Synchronize_Buffer(form);
@@ -1869,7 +1869,7 @@ IFN_Beginning_Of_Line(FORM *form)
static int
IFN_End_Of_Line(FORM *form)
{
FIELD *field = form->current;
const FIELD *field = form->current;
FIELD_CELL *pos;
FIELD_CELL *bp;
@@ -2009,7 +2009,7 @@ IFN_Down_Character(FORM *form)
static int
VSC_Generic(FORM *form, int nlines)
{
FIELD *field = form->current;
const FIELD *field = form->current;
int res = E_REQUEST_DENIED;
int rows_to_go = (nlines > 0 ? nlines : -nlines);
@@ -2189,7 +2189,7 @@ VSC_Scroll_Half_Page_Backward(FORM *form)
static int
HSC_Generic(FORM *form, int ncolumns)
{
FIELD *field = form->current;
const FIELD *field = form->current;
int res = E_REQUEST_DENIED;
int cols_to_go = (ncolumns > 0 ? ncolumns : -ncolumns);
@@ -2365,7 +2365,8 @@ NCURSES_INLINE static bool
Is_There_Room_For_A_Line(FORM *form)
{
FIELD *field = form->current;
FIELD_CELL *begin_of_last_line, *s;
FIELD_CELL *begin_of_last_line;
const FIELD_CELL *s;
Synchronize_Buffer(form);
begin_of_last_line = Address_Of_Row_In_Buffer(field, (field->drows - 1));
@@ -2419,7 +2420,7 @@ Is_There_Room_For_A_Char_In_Line(FORM *form)
| E_SYSTEM_ERROR - system error
+--------------------------------------------------------------------------*/
static int
Insert_String(FORM *form, int row, FIELD_CELL *txt, int len)
Insert_String(FORM *form, int row, const FIELD_CELL *txt, int len)
{
FIELD *field = form->current;
FIELD_CELL *bp = Address_Of_Row_In_Buffer(field, row);
@@ -2450,7 +2451,7 @@ Insert_String(FORM *form, int row, FIELD_CELL *txt, int len)
if (row < (field->drows - 1))
{
FIELD_CELL *split;
const FIELD_CELL *split;
split =
After_Last_Whitespace_Character(bp,
@@ -2507,7 +2508,7 @@ Wrapping_Not_Necessary_Or_Wrapping_Ok(FORM *form)
(!Last_Row || Growable(field))) /* there are more lines */
{
FIELD_CELL *bp;
FIELD_CELL *split;
const FIELD_CELL *split;
int chars_to_be_wrapped;
int chars_to_remain_on_line;
@@ -2633,7 +2634,7 @@ static int
FE_New_Line(FORM *form)
{
FIELD *field = form->current;
FIELD_CELL *bp, *t;
FIELD_CELL *bp;
bool Last_Row = ((field->drows - 1) == form->currow);
T((T_CALLED("FE_New_Line(%p)"), (void *)form));
@@ -2682,6 +2683,7 @@ FE_New_Line(FORM *form)
}
else
{
const FIELD_CELL *t;
bool May_Do_It = !Last_Row && Is_There_Room_For_A_Line(form);
if (!(May_Do_It || Growable(field)))
@@ -2810,7 +2812,7 @@ FE_Delete_Character(FORM *form)
static int
FE_Delete_Previous(FORM *form)
{
FIELD *field = form->current;
const FIELD *field = form->current;
T((T_CALLED("FE_Delete_Previous(%p)"), (void *)form));
if (First_Position_In_Current_Field(form))
@@ -2818,7 +2820,8 @@ FE_Delete_Previous(FORM *form)
if ((--(form->curcol)) < 0)
{
FIELD_CELL *this_line, *prev_line, *prev_end, *this_end;
FIELD_CELL *this_line, *prev_line;
const FIELD_CELL *prev_end, *this_end;
int this_row = form->currow;
form->curcol++;
@@ -2898,9 +2901,9 @@ FE_Delete_Line(FORM *form)
static int
FE_Delete_Word(FORM *form)
{
FIELD *field = form->current;
const FIELD *field = form->current;
FIELD_CELL *bp = Address_Of_Current_Row_In_Buffer(form);
FIELD_CELL *ep = bp + field->dcols;
const FIELD_CELL *ep = bp + field->dcols;
FIELD_CELL *cp = bp + form->curcol;
FIELD_CELL *s;
@@ -4440,7 +4443,7 @@ form_driver(FORM *form, int c)
{
MEVENT event;
WINDOW *win = form->win ? form->win : StdScreen(Get_Form_Screen(form));
WINDOW *sub = form->sub ? form->sub : win;
const WINDOW *sub = form->sub ? form->sub : win;
getmouse(&event);
if ((event.bstate & (BUTTON1_CLICKED |
@@ -4641,7 +4644,7 @@ form_driver_w(FORM *form, int type, wchar_t c)
{
MEVENT event;
WINDOW *win = form->win ? form->win : StdScreen(Get_Form_Screen(form));
WINDOW *sub = form->sub ? form->sub : win;
const WINDOW *sub = form->sub ? form->sub : win;
getmouse(&event);
if ((event.bstate & (BUTTON1_CLICKED |
@@ -4755,7 +4758,7 @@ set_field_buffer(FIELD *field, int buffer, const char *value)
int len;
#if USE_WIDEC_SUPPORT
FIELD_CELL *widevalue = 0;
FIELD_CELL *widevalue = NULL;
#endif
T((T_CALLED("set_field_buffer(%p,%d,%s)"), (void *)field, buffer, _nc_visbuf(value)));
@@ -4804,7 +4807,7 @@ set_field_buffer(FIELD *field, int buffer, const char *value)
wclear(field->working);
(void)mvwaddstr(field->working, 0, 0, value);
if ((widevalue = typeCalloc(FIELD_CELL, len + 1)) == 0)
if ((widevalue = typeCalloc(FIELD_CELL, len + 1)) == NULL)
{
RETURN(E_SYSTEM_ERROR);
}
@@ -4866,7 +4869,7 @@ set_field_buffer(FIELD *field, int buffer, const char *value)
FORM_EXPORT(char *)
field_buffer(const FIELD *field, int buffer)
{
char *result = 0;
char *result = NULL;
T((T_CALLED("field_buffer(%p,%d)"), (const void *)field, buffer));
@@ -4887,14 +4890,14 @@ field_buffer(const FIELD *field, int buffer)
size_t next;
init_mb(state);
next = _nc_wcrtomb(0, data[n].chars[0], &state);
next = _nc_wcrtomb(NULL, data[n].chars[0], &state);
if (next > 0)
need += next;
}
}
/* allocate a place to store the expanded string */
if (field->expanded[buffer] != 0)
if (field->expanded[buffer] != NULL)
free(field->expanded[buffer]);
field->expanded[buffer] = typeMalloc(char, need + 1);
@@ -4906,7 +4909,7 @@ field_buffer(const FIELD *field, int buffer)
* contain embedded wide-character extensions). Change the null-padding
* to blanks as needed.
*/
if ((result = field->expanded[buffer]) != 0)
if ((result = field->expanded[buffer]) != NULL)
{
wclear(field->working);
wmove(field->working, 0, 0);
@@ -4934,8 +4937,8 @@ field_buffer(const FIELD *field, int buffer)
FORM_EXPORT(wchar_t *)
_nc_Widen_String(char *source, int *lengthp)
{
wchar_t *result = 0;
wchar_t wch;
wchar_t *result = NULL;
wchar_t wch = 0;
size_t given = strlen(source);
size_t tries;
int pass;
@@ -4996,7 +4999,7 @@ _nc_Widen_String(char *source, int *lengthp)
result = typeCalloc(wchar_t, need);
*lengthp = (int)need;
if (result == 0)
if (result == NULL)
break;
}
}
+3 -3
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2020 Thomas E. Dickey *
* Copyright 2020,2024 Thomas E. Dickey *
* Copyright 1998-2010,2012 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -33,7 +33,7 @@
#include "form.priv.h"
MODULE_ID("$Id: frm_post.c,v 1.14 2020/05/24 01:40:20 anonymous.maarten Exp $")
MODULE_ID("$Id: frm_post.c,v 1.15 2024/07/27 18:35:02 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnform
@@ -51,7 +51,7 @@ MODULE_ID("$Id: frm_post.c,v 1.14 2020/05/24 01:40:20 anonymous.maarten Exp $")
FORM_EXPORT(int)
post_form(FORM *form)
{
WINDOW *formwin;
const WINDOW *formwin;
int err;
int page;
+3 -3
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2020,2021 Thomas E. Dickey *
* Copyright 2020-2021,2024 Thomas E. Dickey *
* Copyright 1998-2012,2015 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -38,7 +38,7 @@
#include "form.priv.h"
MODULE_ID("$Id: frm_req_name.c,v 1.23 2021/06/17 21:11:08 tom Exp $")
MODULE_ID("$Id: frm_req_name.c,v 1.24 2024/12/07 23:00:37 tom Exp $")
#define DATA(s) { s }
@@ -153,7 +153,7 @@ form_request_by_name(const char *str)
T((T_CALLED("form_request_by_name(%s)"), _nc_visbuf(str)));
if (str != 0 && (i = strlen(str)) != 0)
if (str != NULL && (i = strlen(str)) != 0)
{
char buf[16]; /* longest name is 10 chars */
+6 -9
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2020,2021 Thomas E. Dickey *
* Copyright 2020-2021,2024 Thomas E. Dickey *
* Copyright 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -33,7 +33,7 @@
#include "form.priv.h"
MODULE_ID("$Id: frm_sub.c,v 1.15 2021/06/17 21:20:30 tom Exp $")
MODULE_ID("$Id: frm_sub.c,v 1.16 2024/07/27 18:35:02 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnform
@@ -54,9 +54,8 @@ set_form_sub(FORM *form, WINDOW *win)
else
{
#if NCURSES_SP_FUNCS
FORM *f = Normalize_Form(form);
f->sub = win ? win : StdScreen(Get_Form_Screen(f));
(void) Normalize_Form(form);
form->sub = win ? win : StdScreen(Get_Form_Screen(form));
RETURN(E_OK);
#else
Normalize_Form(form)->sub = win;
@@ -76,12 +75,10 @@ set_form_sub(FORM *form, WINDOW *win)
FORM_EXPORT(WINDOW *)
form_sub(const FORM *form)
{
const FORM *f;
T((T_CALLED("form_sub(%p)"), (const void *)form));
f = Normalize_Form(form);
returnWin(Get_Form_Window(f));
(void) Normalize_Form(form);
returnWin(Get_Form_Window(form));
}
/* frm_sub.c ends here */
+7 -9
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2020,2021 Thomas E. Dickey *
* Copyright 2020-2021,2024 Thomas E. Dickey *
* Copyright 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -33,7 +33,7 @@
#include "form.priv.h"
MODULE_ID("$Id: frm_win.c,v 1.19 2021/06/17 21:20:30 tom Exp $")
MODULE_ID("$Id: frm_win.c,v 1.20 2024/07/27 18:35:02 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnform
@@ -54,9 +54,8 @@ set_form_win(FORM *form, WINDOW *win)
else
{
#if NCURSES_SP_FUNCS
FORM *f = Normalize_Form(form);
f->win = win ? win : StdScreen(Get_Form_Screen(f));
(void) Normalize_Form(form);
form->win = win ? win : StdScreen(Get_Form_Screen(form));
RETURN(E_OK);
#else
Normalize_Form(form)->win = win;
@@ -77,15 +76,14 @@ FORM_EXPORT(WINDOW *)
form_win(const FORM *form)
{
WINDOW *result;
const FORM *f;
T((T_CALLED("form_win(%p)"), (const void *)form));
f = Normalize_Form(form);
(void) Normalize_Form(form);
#if NCURSES_SP_FUNCS
result = (f->win ? f->win : StdScreen(Get_Form_Screen(f)));
result = (form->win ? form->win : StdScreen(Get_Form_Screen(form)));
#else
result = (f->win ? f->win : stdscr);
result = (form->win ? form->win : stdscr);
#endif
returnWin(result);
}
+29 -28
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2020,2021 Thomas E. Dickey *
* Copyright 2020-2024,2025 Thomas E. Dickey *
* Copyright 1998-2009,2010 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -35,7 +35,7 @@
#include "form.priv.h"
MODULE_ID("$Id: fty_enum.c,v 1.33 2021/06/17 21:11:08 tom Exp $")
MODULE_ID("$Id: fty_enum.c,v 1.36 2025/11/15 18:12:38 tom Exp $")
typedef struct
{
@@ -104,7 +104,7 @@ Generic_Enum_Type(void *arg)
argp->kwds = typeMalloc(char *, cnt + 1);
kp = kwds;
if ((kptarget = argp->kwds) != 0)
if ((kptarget = argp->kwds) != NULL)
{
while (kp && (*kp))
{
@@ -168,7 +168,7 @@ Copy_Enum_Type(const void *argp)
char **kp = ap->kwds;
result->kwds = typeMalloc(char *, 1 + ap->count);
if ((kptarget = result->kwds) != 0)
if ((kptarget = result->kwds) != NULL)
{
while (kp && (*kp))
{
@@ -209,6 +209,7 @@ Free_Enum_Type(void *argp)
}
assert(cnt == ap->count);
free(ap->kwds);
(void) cnt;
}
free(argp);
}
@@ -291,21 +292,21 @@ Check_Enum_Field(FIELD *field, const void *argp)
char **kwds = ((const enumARG *)argp)->kwds;
bool ccase = ((const enumARG *)argp)->checkcase;
bool unique = ((const enumARG *)argp)->checkunique;
unsigned char *bp = (unsigned char *)field_buffer(field, 0);
char *s, *t, *p;
const unsigned char *bp = (unsigned char *)field_buffer(field, 0);
const char *s, *t, *p;
while (kwds && (s = (*kwds++)))
{
int res;
if ((res = Compare((unsigned char *)s, bp, ccase)) != NOMATCH)
if ((res = Compare((const unsigned char *)s, bp, ccase)) != NOMATCH)
{
p = t = s; /* t is at least a partial match */
if ((unique && res != EXACT))
{
while (kwds && (p = *kwds++))
{
if ((res = Compare((unsigned char *)p, bp, ccase)) != NOMATCH)
if ((res = Compare((const unsigned char *)p, bp, ccase)) != NOMATCH)
{
if (res == EXACT)
{
@@ -313,7 +314,7 @@ Check_Enum_Field(FIELD *field, const void *argp)
break;
}
else
t = (char *)0;
t = NULL;
}
}
}
@@ -347,12 +348,13 @@ Next_Enum(FIELD *field, const void *argp)
{
const enumARG *args = (const enumARG *)argp;
char **kwds = args->kwds;
bool ccase = args->checkcase;
int cnt = args->count;
unsigned char *bp = (unsigned char *)field_buffer(field, 0);
const unsigned char *bp = (const unsigned char *)field_buffer(field, 0);
if (kwds)
{
int cnt = args->count;
bool ccase = args->checkcase;
while (cnt--)
{
if (Compare((unsigned char *)(*kwds++), bp, ccase) == EXACT)
@@ -386,26 +388,25 @@ Previous_Enum(FIELD *field, const void *argp)
const enumARG *args = (const enumARG *)argp;
int cnt = args->count;
char **kwds = &args->kwds[cnt - 1];
const unsigned char *bp = (const unsigned char *)field_buffer(field, 0);
bool ccase = args->checkcase;
unsigned char *bp = (unsigned char *)field_buffer(field, 0);
if (kwds)
while (cnt--)
{
while (cnt--)
{
if (Compare((unsigned char *)(*kwds--), bp, ccase) == EXACT)
break;
}
if (cnt <= 0)
kwds = &args->kwds[args->count - 1];
if ((cnt >= 0) || (Compare((const unsigned char *)dummy, bp, ccase) == EXACT))
{
set_field_buffer(field, 0, *kwds);
return TRUE;
}
if (Compare((unsigned char *)(*kwds--), bp, ccase) == EXACT)
break;
}
if (cnt <= 0)
kwds = &args->kwds[args->count - 1];
if ((cnt >= 0) || (Compare((const unsigned char *)dummy, bp, ccase) == EXACT))
{
set_field_buffer(field, 0, *kwds);
return TRUE;
}
return FALSE;
}
+10 -7
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2018-2020,2021 Thomas E. Dickey *
* Copyright 2018-2021,2024 Thomas E. Dickey *
* Copyright 2008-2012,2016 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -35,7 +35,7 @@
#include "form.priv.h"
MODULE_ID("$Id: fty_generic.c,v 1.15 2021/03/27 23:49:53 tom Exp $")
MODULE_ID("$Id: fty_generic.c,v 1.17 2024/12/07 23:12:11 tom Exp $")
/*
* This is not a full implementation of a field type, but adds some
@@ -170,7 +170,10 @@ GenericArgument(const FIELDTYPE *typ,
{
TypeArgument *res = (TypeArgument *)0;
if (typ != 0 && (typ->status & _HAS_ARGS) != 0 && err != 0 && argiterator != 0)
if (typ != NULL
&& (typ->status & _HAS_ARGS) != 0
&& err != NULL
&& argiterator != NULL)
{
if (typ->status & _LINKED_TYPE)
{
@@ -189,14 +192,14 @@ GenericArgument(const FIELDTYPE *typ,
else
{
assert(typ->genericarg != (void *)0);
if (typ->genericarg == 0)
if (typ->genericarg == NULL)
*err += 1;
else
{
void *argp;
int valid = argiterator(&argp);
if (valid == 0 || argp == 0 ||
if (valid == 0 || argp == NULL ||
!(res = (TypeArgument *)typ->genericarg(argp)))
{
*err += 1;
@@ -231,7 +234,7 @@ _nc_set_generic_fieldtype(FIELD *field,
if (field)
{
if (field && field->type)
if (field->type)
_nc_Free_Type(field);
field->type = ftyp;
@@ -282,7 +285,7 @@ _nc_form_cursor(const FORM *form, int *pRow, int *pCol)
int code = E_SYSTEM_ERROR;
WINDOW *res = (WINDOW *)0;
if (form != 0 && pRow != 0 && pCol != 0)
if (form != NULL && pRow != NULL && pCol != NULL)
{
*pRow = form->currow;
*pCol = form->curcol;
+7 -7
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2020,2021 Thomas E. Dickey *
* Copyright 2020,2021,2024 Thomas E. Dickey *
* Copyright 1998-2010,2012 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -35,7 +35,7 @@
#include "form.priv.h"
MODULE_ID("$Id: fty_int.c,v 1.33 2021/06/17 21:11:08 tom Exp $")
MODULE_ID("$Id: fty_int.c,v 1.36 2024/12/21 17:14:36 tom Exp $")
#if USE_WIDEC_SUPPORT
#define isDigit(c) (iswdigit((wint_t)(c)) || isdigit(UChar(c)))
@@ -73,7 +73,7 @@ static void *
Generic_This_Type(void *arg)
{
thisARG *argp = (thisARG *)0;
thisARG *param = (thisARG *)arg;
const thisARG *param = (thisARG *)arg;
if (param)
{
@@ -169,7 +169,7 @@ Check_This_Field(FIELD *field, const void *argp)
long high = argi->high;
int prec = argi->precision;
unsigned char *bp = (unsigned char *)field_buffer(field, 0);
char *s = (char *)bp;
const char *s = (char *)bp;
bool result = FALSE;
while (*bp == ' ')
@@ -184,7 +184,7 @@ Check_This_Field(FIELD *field, const void *argp)
int len;
wchar_t *list = _nc_Widen_String((char *)bp, &len);
if (list != 0)
if (list != NULL)
{
bool blank = FALSE;
int n;
@@ -235,10 +235,10 @@ Check_This_Field(FIELD *field, const void *argp)
}
if (result)
{
char buf[100];
char buf[MAX_DIGITS + 3];
_nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf))
"%.*ld", (prec > 0 ? prec : 0), val);
"%.*ld", MaxDigits(prec), val);
set_field_buffer(field, 0, buf);
}
}
+8 -8
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2019-2020,2021 Thomas E. Dickey *
* Copyright 2019-2021,2024 Thomas E. Dickey *
* Copyright 1998-2010,2012 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -35,7 +35,7 @@
#include "form.priv.h"
MODULE_ID("$Id: fty_num.c,v 1.37 2021/03/27 23:49:58 tom Exp $")
MODULE_ID("$Id: fty_num.c,v 1.40 2024/12/21 17:16:09 tom Exp $")
#if HAVE_LOCALE_H
#include <locale.h>
@@ -84,7 +84,7 @@ static void *
Generic_This_Type(void *arg)
{
thisARG *argn = (thisARG *)0;
thisPARM *args = (thisPARM *)arg;
const thisPARM *args = (thisPARM *)arg;
if (args)
{
@@ -187,8 +187,8 @@ Check_This_Field(FIELD *field, const void *argp)
double high = argn->high;
int prec = argn->precision;
unsigned char *bp = (unsigned char *)field_buffer(field, 0);
char *s = (char *)bp;
struct lconv *L = argn->L;
const char *s = (char *)bp;
const struct lconv *L = argn->L;
bool result = FALSE;
while (*bp == ' ')
@@ -203,7 +203,7 @@ Check_This_Field(FIELD *field, const void *argp)
int len;
wchar_t *list = _nc_Widen_String((char *)bp, &len);
if (list != 0)
if (list != NULL)
{
bool blank = FALSE;
int state = 0;
@@ -273,10 +273,10 @@ Check_This_Field(FIELD *field, const void *argp)
}
if (result)
{
char buf[64];
char buf[MAX_DIGITS * 6];
_nc_SPRINTF(buf, _nc_SLIMIT(sizeof(buf))
"%.*f", (prec > 0 ? prec : 0), val);
"%.*f", MaxDigits(prec), val);
set_field_buffer(field, 0, buf);
}
}
+4 -4
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2018-2020,2021 Thomas E. Dickey *
* Copyright 2018-2021,2024 Thomas E. Dickey *
* Copyright 1998-2012,2015 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -35,7 +35,7 @@
#include "form.priv.h"
MODULE_ID("$Id: fty_regex.c,v 1.33 2021/08/14 15:01:52 tom Exp $")
MODULE_ID("$Id: fty_regex.c,v 1.34 2024/12/07 23:02:27 tom Exp $")
#if HAVE_REGEX_H_FUNCS || HAVE_LIB_PCRE2 /* We prefer POSIX regex */
@@ -157,12 +157,12 @@ Generic_RegularExpression_Type(void *arg MAYBE_UNUSED)
if (preg)
{
T((T_CREATE("RegExp_Arg %p"), (void *)preg));
if (((preg->pRegExp = typeMalloc(regex_t, 1)) != 0)
if (((preg->pRegExp = typeMalloc(regex_t, 1)) != NULL)
&& !regcomp(preg->pRegExp, rx,
(REG_EXTENDED | REG_NOSUB | REG_NEWLINE)))
{
T((T_CREATE("regex_t %p"), (void *)preg->pRegExp));
if ((preg->refCount = typeMalloc(unsigned long, 1)) != 0)
if ((preg->refCount = typeMalloc(unsigned long, 1)) != NULL)
*(preg->refCount) = 1;
}
else
+26 -18
View File
@@ -1,5 +1,5 @@
##############################################################################
# Copyright 2019-2023,2024 Thomas E. Dickey #
# Copyright 2019-2024,2025 Thomas E. Dickey #
# Copyright 1998-2015,2016 Free Software Foundation, Inc. #
# #
# Permission is hereby granted, free of charge, to any person obtaining a #
@@ -30,7 +30,7 @@
# Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995
# and: Eric S. Raymond <esr@snark.thyrsus.com>
#
# $Id: Caps,v 1.56 2024/04/20 21:05:02 tom Exp $
# $Id: Caps,v 1.62 2025/11/12 01:06:36 Branden.Robinson Exp $
#
# This is the master termcap/terminfo capability table.
#
@@ -167,8 +167,10 @@
# The tables are a tight fit on traditional man(7) implementations that
# use a line length of 65n, and the "Description" column has little room
# within which the formatter can make breaking or adjustment decisions.
# Words like "micro_..._address" and "parm_..._micro" don't break.
# Reducing the inter-column gaps to 2 ens gives them enough room. --GBR
# (MKterminfo.sh causes such columns to be formatted in tbl(1) text
# blocks.) Words like "micro_..._address" and "parm_..._micro" don't
# break. Reducing the inter-column gaps to 2 ens gives them enough
# room. --GBR
#
#############################################################################
#
@@ -241,12 +243,15 @@
#%behavior,
#%for instance if the string contains percent signs.
#%.
#%.br
#%.if n .ne 4v
#%.if t .ne 3v
#%.PP
#%.TS
#%center;
#%Lb Cb S Lb
#%Lb Lb Lb Lb
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
#%\& Code \&
#%Boolean Capability Name TI TC Description
#%_
@@ -294,7 +299,7 @@ lpi_changes_res lpix bool YG - - ----- changing line pitch changes resolution
#%center;
#%Lb Cb S Lb
#%Lb Lb Lb Lb
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
#%\& Code \&
#%Numeric Capability Name TI TC Description
#%_
@@ -311,7 +316,10 @@ label_height lh num lh - - ----- rows in each label
label_width lw num lw - - ----- columns in each label
max_attributes ma num ma - - YBC-- maximum combined attributes terminal can handle
maximum_windows wnum num MW - - ----- maximum number of definable windows
# These came in with SVr4's color support
# The following were introduced by SVr3.2's color support.
# https://github.com/ryanwoodsmall/oldsysv/blob/\
# e68293af91e2dc39f5f29c20d7e429f9e0cabc75/\
# sysvr3/32/usr/src/lib/libcurses/screen/caps#L64
max_colors colors num Co - - ----- maximum number of colors on screen
max_pairs pairs num pa - - ----- maximum number of color-pairs on the screen
no_color_video ncv num NC - - ----- video attributes that cannot be used with colors
@@ -327,7 +335,7 @@ no_color_video ncv num NC - - ----- video attributes that cannot be used with
#%center;
#%Lb Cb S Lb
#%Lb Lb Lb Lb
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
#%\& Code \&
#%Numeric Capability Name TI TC Description
#%_
@@ -355,7 +363,7 @@ bit_image_type bitype num Yp - - ----- type of bit-image device
#%center;
#%Lb Cb S Lb
#%Lb Lb Lb Lb
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
#%\& Code \&
#%String Capability Name TI TC Description
#%_
@@ -424,7 +432,7 @@ key_down kcud1 str kd KEY_DOWN 0402 YBCGE down-arrow key
#%.TE
#%.TS
#%center;
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
key_eic krmir str kM KEY_EIC 0514 -B-G-* sent by rmir or smir in insert mode
key_eol kel str kE KEY_EOL 0517 -B-G-* clear-to-end-of-line key
key_eos ked str kS KEY_EOS 0516 -B-G-* clear-to-end-of-screen key
@@ -451,8 +459,8 @@ key_sf kind str kF KEY_SF 0520 -B-G-* scroll-forward key
key_sr kri str kR KEY_SR 0521 -B-G-* scroll-backward key
key_stab khts str kT KEY_STAB 0524 -B-G-* set-tab key
key_up kcuu1 str ku KEY_UP 0403 YBCGE up-arrow key
keypad_local rmkx str ke - - YBCGE leave keyboard transmit mode
keypad_xmit smkx str ks - - YBCGE enter keyboard transmit mode
keypad_local rmkx str ke - - YBCGE leave keypad transmit mode
keypad_xmit smkx str ks - - YBCGE enter keypad transmit mode
lab_f0 lf0 str l0 - - -B-G-* label on function key f0 if not f0
lab_f1 lf1 str l1 - - -B-G-* label on function key f1 if not f1
lab_f10 lf10 str la - - ----- label on function key f10 if not f10
@@ -490,7 +498,7 @@ reset_2string rs2 str r2 - - -B--- reset string
#%.TE
#%.TS
#%center;
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
reset_3string rs3 str r3 - - -B--- reset string
reset_file rf str rf - - -B--- name of reset file
restore_cursor rc str rc - - YBCG- restore cursor to position of last save_cursor
@@ -560,7 +568,7 @@ key_undo kund str &8 KEY_UNDO 0630 ----- undo key
#%.TE
#%.TS
#%center;
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
key_sbeg kBEG str &9 KEY_SBEG 0572 ----- shifted begin key
key_scancel kCAN str &0 KEY_SCANCEL 0573 ----- shifted cancel key
key_scommand kCMD str *1 KEY_SCOMMAND 0574 ----- shifted command key
@@ -626,7 +634,7 @@ key_f42 kf42 str FW KEY_F(42) - ----E F42 function key
#%.TE
#%.TS
#%center;
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
key_f43 kf43 str FX KEY_F(43) - ----E F43 function key
key_f44 kf44 str FY KEY_F(44) - ----E F44 function key
key_f45 kf45 str FZ KEY_F(45) - ----E F45 function key
@@ -698,7 +706,7 @@ enter_doublewide_mode swidm str ZF - - ----- Enter double-wide mode
#%.TE
#%.TS
#%center;
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
enter_draft_quality sdrfq str ZG - - ----- Enter draft-quality mode
enter_italics_mode sitm str ZH - - ----- Enter italic mode
enter_leftward_mode slm str ZI - - ----- Start leftward carriage motion
@@ -754,7 +762,7 @@ zero_motion zerom str Zx - - ----- No motion for subsequent character
#%center;
#%Lb Cb S Lb
#%Lb Lb Lb Lb
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
#%\& Code \&
#%String Capability Name TI TC Description
#%_
@@ -810,7 +818,7 @@ alt_scancode_esc scesa str S8 - - ----- Alternate escape for scancode emulatio
#%center;
#%Lb Cb S Lb
#%Lb Lb Lb Lb
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
#%\& Code \&
#%String Capability Name TI TC Description
#%_
+13 -13
View File
@@ -1,5 +1,5 @@
##############################################################################
# Copyright 2019-2023,2024 Thomas E. Dickey #
# Copyright 2019-2024,2025 Thomas E. Dickey #
# Copyright 2001-2015,2016 Free Software Foundation, Inc. #
# #
# Permission is hereby granted, free of charge, to any person obtaining a #
@@ -29,7 +29,7 @@
#
# Author: Thomas Dickey
#
# $Id: Caps.aix4,v 1.28 2024/04/20 21:05:02 tom Exp $
# $Id: Caps.aix4,v 1.30 2025/11/12 01:27:41 tom Exp $
#
# This is an adaptation of ncurses' termcap/terminfo capability table, which
# is designed to align with AIX 4.x's terminfo.
@@ -246,7 +246,7 @@
#%center;
#%Lb Cb S Lb
#%Lb Lb Lb Lb
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
#%\& Code \&
#%Boolean Capability Name TI TC Description
#%_
@@ -294,7 +294,7 @@ lpi_changes_res lpix bool YG - - ----- changing line pitch changes resolution
#%center;
#%Lb Cb S Lb
#%Lb Lb Lb Lb
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
#%\& Code \&
#%Numeric Capability Name TI TC Description
#%_
@@ -327,7 +327,7 @@ no_color_video ncv num NC - - ----- video attributes that cannot be used with
#%center;
#%Lb Cb S Lb
#%Lb Lb Lb Lb
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
#%\& Code \&
#%Numeric Capability Name TI TC Description
#%_
@@ -355,7 +355,7 @@ bit_image_type bitype num Yp - - ----- type of bit-image device
#%center;
#%Lb Cb S Lb
#%Lb Lb Lb Lb
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
#%\& Code \&
#%String Capability Name TI TC Description
#%_
@@ -424,7 +424,7 @@ key_down kcud1 str kd KEY_DOWN 0402 YBCGE down-arrow key
#%.TE
#%.TS
#%center;
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
key_eic krmir str kM KEY_EIC 0514 -B-G-* sent by rmir or smir in insert mode
key_eol kel str kE KEY_EOL 0517 -B-G-* clear-to-end-of-line key
key_eos ked str kS KEY_EOS 0516 -B-G-* clear-to-end-of-screen key
@@ -490,7 +490,7 @@ reset_2string rs2 str r2 - - -B--- reset string
#%.TE
#%.TS
#%center;
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
reset_3string rs3 str r3 - - -B--- reset string
reset_file rf str rf - - -B--- name of reset file
restore_cursor rc str rc - - YBCG- restore cursor to position of last save_cursor
@@ -642,7 +642,7 @@ key_f42 kf42 str FW KEY_F(42) - ----E F42 function key
#%.TE
#%.TS
#%center;
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
key_f43 kf43 str FX KEY_F(43) - ----E F43 function key
key_f44 kf44 str FY KEY_F(44) - ----E F44 function key
key_f45 kf45 str FZ KEY_F(45) - ----E F45 function key
@@ -719,7 +719,7 @@ key_undo kund str &8 KEY_UNDO 0630 ----- undo key
#%.TE
#%.TS
#%center;
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
key_sbeg kBEG str &9 KEY_SBEG 0572 ----- shifted begin key
key_scancel kCAN str &0 KEY_SCANCEL 0573 ----- shifted cancel key
key_scommand kCMD str *1 KEY_SCOMMAND 0574 ----- shifted command key
@@ -800,7 +800,7 @@ enter_doublewide_mode swidm str ZF - - ----- Enter double-wide mode
#%.TE
#%.TS
#%center;
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
enter_draft_quality sdrfq str ZG - - ----- Enter draft-quality mode
enter_italics_mode sitm str ZH - - ----- Enter italic mode
enter_leftward_mode slm str ZI - - ----- Start leftward carriage motion
@@ -856,7 +856,7 @@ zero_motion zerom str Zx - - ----- No motion for subsequent character
#%center;
#%Lb Cb S Lb
#%Lb Lb Lb Lb
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
#%\& Code \&
#%String Capability Name TI TC Description
#%_
@@ -912,7 +912,7 @@ alt_scancode_esc scesa str S8 - - ----- Alternate escape for scancode emulatio
#%center;
#%Lb Cb S Lb
#%Lb Lb Lb Lb
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
#%\& Code \&
#%String Capability Name TI TC Description
#%_
+13 -13
View File
@@ -1,5 +1,5 @@
##############################################################################
# Copyright 2019-2023,2024 Thomas E. Dickey #
# Copyright 2019-2024,2025 Thomas E. Dickey #
# Copyright 2002-2015,2016 Free Software Foundation, Inc. #
# #
# Permission is hereby granted, free of charge, to any person obtaining a #
@@ -29,7 +29,7 @@
#
# Author: Thomas Dickey
#
# $Id: Caps.hpux11,v 1.26 2024/04/20 21:05:02 tom Exp $
# $Id: Caps.hpux11,v 1.28 2025/11/12 01:27:41 tom Exp $
#
# This is an adaptation of ncurses' termcap/terminfo capability table, which
# is designed to align with HPUX 11.x's terminfo.
@@ -246,7 +246,7 @@
#%center;
#%Lb Cb S Lb
#%Lb Lb Lb Lb
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
#%\& Code \&
#%Boolean Capability Name TI TC Description
#%_
@@ -295,7 +295,7 @@ lpi_changes_res lpix bool YG - - ----- changing line pitch changes resolution
#%center;
#%Lb Cb S Lb
#%Lb Lb Lb Lb
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
#%\& Code \&
#%Numeric Capability Name TI TC Description
#%_
@@ -329,7 +329,7 @@ no_color_video ncv num NC - - ----- video attributes that cannot be used with
#%center;
#%Lb Cb S Lb
#%Lb Lb Lb Lb
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
#%\& Code \&
#%Numeric Capability Name TI TC Description
#%_
@@ -357,7 +357,7 @@ bit_image_type bitype num Yp - - ----- type of bit-image device
#%center;
#%Lb Cb S Lb
#%Lb Lb Lb Lb
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
#%\& Code \&
#%String Capability Name TI TC Description
#%_
@@ -426,7 +426,7 @@ key_down kcud1 str kd KEY_DOWN 0402 YBCGE down-arrow key
#%.TE
#%.TS
#%center;
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
key_eic krmir str kM KEY_EIC 0514 -B-G-* sent by rmir or smir in insert mode
key_eol kel str kE KEY_EOL 0517 -B-G-* clear-to-end-of-line key
key_eos ked str kS KEY_EOS 0516 -B-G-* clear-to-end-of-screen key
@@ -492,7 +492,7 @@ reset_2string rs2 str r2 - - -B--- reset string
#%.TE
#%.TS
#%center;
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
reset_3string rs3 str r3 - - -B--- reset string
reset_file rf str rf - - -B--- name of reset file
restore_cursor rc str rc - - YBCG- restore cursor to position of last save_cursor
@@ -561,7 +561,7 @@ key_f42 kf42 str FW KEY_F(42) - ----E F42 function key
#%.TE
#%.TS
#%center;
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
key_f43 kf43 str FX KEY_F(43) - ----E F43 function key
key_f44 kf44 str FY KEY_F(44) - ----E F44 function key
key_f45 kf45 str FZ KEY_F(45) - ----E F45 function key
@@ -625,7 +625,7 @@ key_undo kund str &8 KEY_UNDO 0630 ----- undo key
#%.TE
#%.TS
#%center;
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
key_sbeg kBEG str &9 KEY_SBEG 0572 ----- shifted begin key
key_scancel kCAN str &0 KEY_SCANCEL 0573 ----- shifted cancel key
key_scommand kCMD str *1 KEY_SCOMMAND 0574 ----- shifted command key
@@ -706,7 +706,7 @@ enter_doublewide_mode swidm str ZF - - ----- Enter double-wide mode
#%.TE
#%.TS
#%center;
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
enter_draft_quality sdrfq str ZG - - ----- Enter draft-quality mode
enter_italics_mode sitm str ZH - - ----- Enter italic mode
enter_leftward_mode slm str ZI - - ----- Start leftward carriage motion
@@ -762,7 +762,7 @@ zero_motion zerom str Zx - - ----- No motion for subsequent character
#%center;
#%Lb Cb S Lb
#%Lb Lb Lb Lb
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
#%\& Code \&
#%String Capability Name TI TC Description
#%_
@@ -820,7 +820,7 @@ alt_scancode_esc scesa str S8 - - ----- Alternate escape for scancode emulatio
#%center;
#%Lb Cb S Lb
#%Lb Lb Lb Lb
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
#%\& Code \&
#%String Capability Name TI TC Description
#%_
+13 -13
View File
@@ -1,5 +1,5 @@
##############################################################################
# Copyright 2019-2023,2024 Thomas E. Dickey #
# Copyright 2019-2024,2025 Thomas E. Dickey #
# Copyright 2001-2015,2016 Free Software Foundation, Inc. #
# #
# Permission is hereby granted, free of charge, to any person obtaining a #
@@ -30,7 +30,7 @@
# Author: Thomas Dickey
# and: Ilya Zakharevich
#
# $Id: Caps.keys,v 1.25 2024/04/20 21:05:02 tom Exp $
# $Id: Caps.keys,v 1.27 2025/11/12 01:27:41 tom Exp $
#
# This is an adaptation of ncurses' termcap/terminfo capability table, which
# is illustrates an experimental extension to describe alt-, shift- and
@@ -249,7 +249,7 @@
#%center;
#%Lb Cb S Lb
#%Lb Lb Lb Lb
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
#%\& Code \&
#%Boolean Capability Name TI TC Description
#%_
@@ -297,7 +297,7 @@ lpi_changes_res lpix bool YG - - ----- changing line pitch changes resolution
#%center;
#%Lb Cb S Lb
#%Lb Lb Lb Lb
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
#%\& Code \&
#%Numeric Capability Name TI TC Description
#%_
@@ -330,7 +330,7 @@ no_color_video ncv num NC - - ----- video attributes that cannot be used with
#%center;
#%Lb Cb S Lb
#%Lb Lb Lb Lb
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
#%\& Code \&
#%Numeric Capability Name TI TC Description
#%_
@@ -358,7 +358,7 @@ bit_image_type bitype num Yp - - ----- type of bit-image device
#%center;
#%Lb Cb S Lb
#%Lb Lb Lb Lb
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
#%\& Code \&
#%String Capability Name TI TC Description
#%_
@@ -427,7 +427,7 @@ key_down kcud1 str kd KEY_DOWN 0402 YBCGE down-arrow key
#%.TE
#%.TS
#%center;
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
key_eic krmir str kM KEY_EIC 0514 -B-G-* sent by rmir or smir in insert mode
key_eol kel str kE KEY_EOL 0517 -B-G-* clear-to-end-of-line key
key_eos ked str kS KEY_EOS 0516 -B-G-* clear-to-end-of-screen key
@@ -493,7 +493,7 @@ reset_2string rs2 str r2 - - -B--- reset string
#%.TE
#%.TS
#%center;
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
reset_3string rs3 str r3 - - -B--- reset string
reset_file rf str rf - - -B--- name of reset file
restore_cursor rc str rc - - YBCG- restore cursor to position of last save_cursor
@@ -563,7 +563,7 @@ key_undo kund str &8 KEY_UNDO 0630 ----- undo key
#%.TE
#%.TS
#%center;
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
key_sbeg kBEG str &9 KEY_SBEG 0572 ----- shifted begin key
key_scancel kCAN str &0 KEY_SCANCEL 0573 ----- shifted cancel key
key_scommand kCMD str *1 KEY_SCOMMAND 0574 ----- shifted command key
@@ -629,7 +629,7 @@ key_f42 kf42 str FW KEY_F(42) - ----E F42 function key
#%.TE
#%.TS
#%center;
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
key_f43 kf43 str FX KEY_F(43) - ----E F43 function key
key_f44 kf44 str FY KEY_F(44) - ----E F44 function key
key_f45 kf45 str FZ KEY_F(45) - ----E F45 function key
@@ -789,7 +789,7 @@ enter_doublewide_mode swidm str ZF - - ----- Enter double-wide mode
#%.TE
#%.TS
#%center;
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
enter_draft_quality sdrfq str ZG - - ----- Enter draft-quality mode
enter_italics_mode sitm str ZH - - ----- Enter italic mode
enter_leftward_mode slm str ZI - - ----- Start leftward carriage motion
@@ -845,7 +845,7 @@ zero_motion zerom str Zx - - ----- No motion for subsequent character
#%center;
#%Lb Cb S Lb
#%Lb Lb Lb Lb
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
#%\& Code \&
#%String Capability Name TI TC Description
#%_
@@ -901,7 +901,7 @@ alt_scancode_esc scesa str S8 - - ----- Alternate escape for scancode emulatio
#%center;
#%Lb Cb S Lb
#%Lb Lb Lb Lb
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
#%\& Code \&
#%String Capability Name TI TC Description
#%_
+10 -10
View File
@@ -1,5 +1,5 @@
##############################################################################
# Copyright 2019-2023,2024 Thomas E. Dickey #
# Copyright 2019-2024,2025 Thomas E. Dickey #
# Copyright 2002-2015,2016 Free Software Foundation, Inc. #
# #
# Permission is hereby granted, free of charge, to any person obtaining a #
@@ -29,7 +29,7 @@
#
# Author: Thomas Dickey
#
# $Id: Caps.osf1r5,v 1.24 2024/04/20 21:05:02 tom Exp $
# $Id: Caps.osf1r5,v 1.26 2025/11/12 01:27:41 tom Exp $
#
# This is an adaptation of ncurses' termcap/terminfo capability table, which
# is designed to align with OSF/1 version 5 (Tru64) terminfo.
@@ -246,7 +246,7 @@
#%center;
#%Lb Cb S Lb
#%Lb Lb Lb Lb
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
#%\& Code \&
#%Boolean Capability Name TI TC Description
#%_
@@ -294,7 +294,7 @@ semi_auto_right_margin sam bool YE - - ----- printing in last column causes cr
#%center;
#%Lb Cb S Lb
#%Lb Lb Lb Lb
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
#%\& Code \&
#%Numeric Capability Name TI TC Description
#%_
@@ -338,7 +338,7 @@ wide_char_size widcs num Yn - - ----- character step size when in double wide
#%center;
#%Lb Cb S Lb
#%Lb Lb Lb Lb
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
#%\& Code \&
#%String Capability Name TI TC Description
#%_
@@ -407,7 +407,7 @@ key_down kcud1 str kd KEY_DOWN 0402 YBCGE down-arrow key
#%.TE
#%.TS
#%center;
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
key_eic krmir str kM KEY_EIC 0514 -B-G-* sent by rmir or smir in insert mode
key_eol kel str kE KEY_EOL 0517 -B-G-* clear-to-end-of-line key
key_eos ked str kS KEY_EOS 0516 -B-G-* clear-to-end-of-screen key
@@ -473,7 +473,7 @@ reset_2string rs2 str r2 - - -B--- reset string
#%.TE
#%.TS
#%center;
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
reset_3string rs3 str r3 - - -B--- reset string
reset_file rf str rf - - -B--- name of reset file
restore_cursor rc str rc - - YBCG- restore cursor to position of last save_cursor
@@ -632,7 +632,7 @@ enter_doublewide_mode swidm str ZF - - ----- Enter double-wide mode
#%.TE
#%.TS
#%center;
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
enter_draft_quality sdrfq str ZG - - ----- Enter draft-quality mode
enter_italics_mode sitm str ZH - - ----- Enter italic mode
enter_leftward_mode slm str ZI - - ----- Start leftward carriage motion
@@ -682,7 +682,7 @@ key_f42 kf42 str FW KEY_F(42) - ----E F42 function key
#%.TE
#%.TS
#%center;
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
key_f43 kf43 str FX KEY_F(43) - ----E F43 function key
key_f44 kf44 str FY KEY_F(44) - ----E F44 function key
key_f45 kf45 str FZ KEY_F(45) - ----E F45 function key
@@ -724,7 +724,7 @@ key_save ksav str &6 KEY_SAVE 0571 ----- save key
#%.TE
#%.TS
#%center;
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lx.
#%Lbw(25n)2 Lbw(8n)2 Lb2 Lw(17n)x.
key_sbeg kBEG str &9 KEY_SBEG 0572 ----- shifted begin key
key_scancel kCAN str &0 KEY_SCANCEL 0573 ----- shifted cancel key
key_scommand kCMD str *1 KEY_SCOMMAND 0574 ----- shifted command key
+10 -10
View File
@@ -1,5 +1,5 @@
##############################################################################
# Copyright 2019-2023,2024 Thomas E. Dickey #
# Copyright 2019-2024,2025 Thomas E. Dickey #
# Copyright 2001-2015,2016 Free Software Foundation, Inc. #
# #
# Permission is hereby granted, free of charge, to any person obtaining a #
@@ -29,7 +29,7 @@
#
# Author: Thomas Dickey
#
# $Id: Caps.uwin,v 1.23 2024/04/20 21:05:02 tom Exp $
# $Id: Caps.uwin,v 1.25 2025/11/12 01:06:36 Branden.Robinson Exp $
#
# This is an adaptation of ncurses' termcap/terminfo capability table, which
# is designed to align with U/Win's terminfo.
@@ -246,7 +246,7 @@
#%center;
#%Lb Cb S Lb
#%Lb Lb Lb Lb
#%Lbw(24n)2 Lbw(7n)2 Lb2 Lx.
#%Lbw(24n)2 Lbw(7n)2 Lb2 Lw(17n)x.
#%\& Code \&
#%Boolean Capability Name TI TC Description
#%_
@@ -287,7 +287,7 @@ hue_lightness_saturation hls bool hl - - ----- terminal uses only HLS color nota
#%center;
#%Lb Cb S Lb
#%Lb Lb Lb Lb
#%Lbw(24n)2 Lbw(7n)2 Lb2 Lx.
#%Lbw(24n)2 Lbw(7n)2 Lb2 Lw(17n)x.
#%\& Code \&
#%Numeric Capability Name TI TC Description
#%_
@@ -304,7 +304,7 @@ label_height lh num lh - - ----- rows in each label
label_width lw num lw - - ----- columns in each label
buttons btns num BT - - ----- number of buttons on mouse
#max_attributes ma num ma - - YBC-- maximum combined attributes terminal can handle
#maximum_windows wnum num MW - - ----- maximum number of defineable windows
#maximum_windows wnum num MW - - ----- maximum number of definable windows
# These came in with SVr4's color support
max_colors colors num Co - - ----- maximum number of colors on screen
max_pairs pairs num pa - - ----- maximum number of color-pairs on the screen
@@ -316,7 +316,7 @@ no_color_video ncv num NC - - ----- video attributes that cannot be used with
#%center;
#%Lb Cb S Lb
#%Lb Lb Lb Lb
#%Lbw(24n)2 Lbw(7n)2 Lb2 Lx.
#%Lbw(24n)2 Lbw(7n)2 Lb2 Lw(17n)x.
#%\& Code \&
#%String Capability Name TI TC Description
#%_
@@ -385,7 +385,7 @@ key_down kcud1 str kd KEY_DOWN 0402 YBCGE down-arrow key
#%.TE
#%.TS
#%center;
#%Lbw(24n)2 Lbw(7n)2 Lb2 Lx.
#%Lbw(24n)2 Lbw(7n)2 Lb2 Lw(17n)x.
key_eic krmir str kM KEY_EIC 0514 -B-G-* sent by rmir or smir in insert mode
key_eol kel str kE KEY_EOL 0517 -B-G-* clear-to-end-of-line key
key_eos ked str kS KEY_EOS 0516 -B-G-* clear-to-end-of-screen key
@@ -451,7 +451,7 @@ reset_2string rs2 str r2 - - -B--- reset string
#%.TE
#%.TS
#%center;
#%Lbw(24n)2 Lbw(7n)2 Lb2 Lx.
#%Lbw(24n)2 Lbw(7n)2 Lb2 Lw(17n)x.
reset_3string rs3 str r3 - - -B--- reset string
reset_file rf str rf - - -B--- name of reset file
restore_cursor rc str rc - - YBCG- restore cursor to position of last save_cursor
@@ -521,7 +521,7 @@ key_undo kund str &8 KEY_UNDO 0630 ----- undo key
#%.TE
#%.TS
#%center;
#%Lbw(24n)2 Lbw(7n)2 Lb2 Lx.
#%Lbw(24n)2 Lbw(7n)2 Lb2 Lw(17n)x.
key_sbeg kBEG str &9 KEY_SBEG 0572 ----- shifted begin key
key_scancel kCAN str &0 KEY_SCANCEL 0573 ----- shifted cancel key
key_scommand kCMD str *1 KEY_SCOMMAND 0574 ----- shifted command key
@@ -587,7 +587,7 @@ key_f42 kf42 str FW KEY_F(42) - ----E F42 function key
#%.TE
#%.TS
#%center;
#%Lbw(24n)2 Lbw(7n)2 Lb2 Lx.
#%Lbw(24n)2 Lbw(7n)2 Lb2 Lw(17n)x.
key_f43 kf43 str FX KEY_F(43) - ----E F43 function key
key_f44 kf44 str FY KEY_F(44) - ----E F44 function key
key_f45 kf45 str FZ KEY_F(45) - ----E F45 function key
+4 -4
View File
@@ -1,7 +1,7 @@
#! /bin/sh
# $Id: MKkey_defs.sh,v 1.24 2024/01/19 12:26:17 tom Exp $
# $Id: MKkey_defs.sh,v 1.25 2025/06/14 14:44:56 tom Exp $
##############################################################################
# Copyright 2019-2022,2024 Thomas E. Dickey #
# Copyright 2019-2024,2025 Thomas E. Dickey #
# Copyright 2001-2013,2017 Free Software Foundation, Inc. #
# #
# Permission is hereby granted, free of charge, to any person obtaining a #
@@ -110,8 +110,8 @@ function decode(keycode) {
}
BEGIN {
maxkey='$maxkey';
pass='$pass';
maxkey='"$maxkey"';
pass='"$pass"';
key_max=1;
bits=1;
while (key_max < maxkey) {
+30 -27
View File
@@ -26,7 +26,7 @@ BEGIN {
lcurl = "{";
rcurl = "}";
print "/****************************************************************************"
print " * Copyright 2018-2021,2023 Thomas E. Dickey *"
print " * Copyright 2018-2024,2025 Thomas E. Dickey *"
print " * Copyright 1998-2013,2017 Free Software Foundation, Inc. *"
print " * *"
print " * Permission is hereby granted, free of charge, to any person obtaining a *"
@@ -60,7 +60,7 @@ BEGIN {
print "/* and: Thomas E. Dickey 1995-on */"
print "/****************************************************************************/"
print ""
print "/* $Id: MKterm.h.awk.in,v 1.85 2023/04/23 19:15:36 tom Exp $ */"
print "/* $Id: MKterm.h.awk.in,v 1.94 2025/12/26 23:33:14 tom Exp $ */"
print ""
print "/*"
print "** term.h -- Definition of struct term"
@@ -86,6 +86,7 @@ BEGIN {
print ""
print "typedef struct screen SCREEN;"
print ""
print "/* configured with --enable-sp-funcs? */"
print "#if @NCURSES_SP_FUNCS@"
print "#undef NCURSES_SP_FUNCS"
print "#define NCURSES_SP_FUNCS @NCURSES_PATCH@"
@@ -115,65 +116,62 @@ BEGIN {
print "#undef NCURSES_XNAMES"
print "#define NCURSES_XNAMES @NCURSES_XNAMES@"
print ""
print "/* We will use these symbols to hide differences between"
print "/* TTY, SET_TTY and GET_TTY are used internally */"
print "#ifdef NCURSES_INTERNALS"
print ""
print "/* We use these symbols to hide differences between"
print " * termios/termio/sgttyb interfaces."
print " */"
print "#undef TTY"
print "#undef SET_TTY"
print "#undef GET_TTY"
print ""
print "/* Assume POSIX termio if we have the header and function */"
print "/* #if HAVE_TERMIOS_H && HAVE_TCGETATTR */"
print "#if @HAVE_TERMIOS_H@ && @HAVE_TCGETATTR@"
print "#if @HAVE_TERMIOS_H@ && @HAVE_TCGETATTR@ /* #if HAVE_TERMIOS_H && HAVE_TCGETATTR */"
print ""
print "#undef TERMIOS"
print "#define TERMIOS 1"
print ""
print "#include <termios.h>"
print "#define TTY struct termios"
print ""
print "#else /* !HAVE_TERMIOS_H */"
print ""
print "/* #if HAVE_TERMIO_H */"
print "#if @HAVE_TERMIO_H@"
print "#elif @HAVE_TERMIO_H@ /* HAVE_TERMIO_H */"
print ""
print "#undef TERMIOS"
print "#define TERMIOS 1"
print ""
print "#include <termio.h>"
print "#define TTY struct termio"
print ""
print "#else /* !HAVE_TERMIO_H */"
print "#elif (defined(_WIN32) || defined(_WIN64) || defined(__MINGW32__) || defined(__MINGW64__))"
print ""
print "#include <nc_win32.h>"
print "#define TTY ConsoleMode"
print ""
print "#elif @HAVE_SGTTY_H@ /* HAVE_SGTTY_H */"
print ""
print "#if (defined(_WIN32) || defined(_WIN64))"
print "#if @EXP_WIN32_DRIVER@"
print "#include <win32_curses.h>"
print "#define TTY struct winconmode"
print "#else"
print "#include <ncurses_mingw.h>"
print "#define TTY struct termios"
print "#endif"
print "#else"
print "#undef TERMIOS"
print "#include <sgtty.h>"
print "#include <sys/ioctl.h>"
print "#define TTY struct sgttyb"
print "#endif /* MINGW32 */"
print "#endif /* HAVE_TERMIO_H */"
print ""
print "#else"
print ""
print "#error no termio/termios/sgtty found"
print ""
print "#endif /* HAVE_TERMIOS_H */"
print ""
print "#ifdef TERMIOS"
print "#define GET_TTY(fd, buf) tcgetattr(fd, buf)"
print "#define SET_TTY(fd, buf) tcsetattr(fd, TCSADRAIN, buf)"
print "#elif @EXP_WIN32_DRIVER@ && (defined(_WIN32) || defined(_WIN64))"
print "/* configured with --enable-exp-win32? */"
print "#elif defined(_WIN32) || defined(_WIN64)"
print "#define GET_TTY(fd, buf) _nc_console_getmode(_nc_console_fd2handle(fd),buf)"
print "#define SET_TTY(fd, buf) _nc_console_setmode(_nc_console_fd2handle(fd),buf)"
print "#else"
print "#elif @HAVE_SGTTY_H@ /* HAVE_SGTTY_H */"
print "#define GET_TTY(fd, buf) gtty(fd, buf)"
print "#define SET_TTY(fd, buf) stty(fd, buf)"
print "#endif"
print ""
print "#endif /* NCURSES_INTERNALS */"
print ""
print "#ifndef GCC_NORETURN"
print "#define GCC_NORETURN /* nothing */"
print "#endif"
@@ -255,6 +253,7 @@ END {
print "TERMINAL;"
print ""
if (@NCURSES_EXT_COLORS@) {
print "/* configured with --enable-ext-colors */"
declare_termtype("int","2");
} else {
print "#undef TERMTYPE2"
@@ -268,9 +267,10 @@ END {
print ""
print "#endif /* NCURSES_INTERNALS */"
print ""
print ""
print "/* configured with --enable-broken_linker and reentrancy disabled */"
print "#if @BROKEN_LINKER@ && !@cf_cv_enable_reentrant@"
print "extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term;"
print "/* reentrancy enabled */"
print "#elif @cf_cv_enable_reentrant@"
print "NCURSES_WRAPPED_VAR(TERMINAL *, cur_term);"
print "#define cur_term NCURSES_PUBLIC_VAR(cur_term())"
@@ -278,6 +278,7 @@ END {
print "extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term;"
print "#endif"
print ""
print "/* configured with --enable-broken_linker or reentrancy enabled */"
print "#if @BROKEN_LINKER@ || @cf_cv_enable_reentrant@"
print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolnames);"
print "NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolcodes);"
@@ -348,6 +349,7 @@ END {
print "extern NCURSES_EXPORT(int) tigetflag (const char *);"
print "extern NCURSES_EXPORT(int) tigetnum (const char *);"
print ""
print "/* configured without --disable-tparm-varargs? */"
print "#if @NCURSES_TPARM_VARARGS@ /* NCURSES_TPARM_VARARGS */"
print "extern NCURSES_EXPORT(char *) tparm (const char *, ...); /* special */"
print "#else"
@@ -380,6 +382,7 @@ END {
print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tigetflag) (SCREEN*, const char *);"
print "extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tigetnum) (SCREEN*, const char *);"
print ""
print "/* configured without --disable-tparm-varargs? */"
print "#if @NCURSES_TPARM_VARARGS@ /* NCURSES_TPARM_VARARGS */"
print "extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm) (SCREEN*, const char *, ...); /* special */"
print "#else"
+5 -4
View File
@@ -1,6 +1,6 @@
# $Id: Makefile.in,v 1.53 2021/07/03 18:56:51 tom Exp $
# $Id: Makefile.in,v 1.56 2025/10/18 13:33:46 tom Exp $
##############################################################################
# Copyright 2019-2020,2021 Thomas E. Dickey #
# Copyright 2019-2024,2025 Thomas E. Dickey #
# Copyright 1998-2013,2015 Free Software Foundation, Inc. #
# #
# Permission is hereby granted, free of charge, to any person obtaining a #
@@ -44,14 +44,14 @@ SHELL = @SHELL@
VPATH = @srcdir@
THIS = Makefile
DESTDIR = @DESTDIR@
@SET_DESTDIR@
srcdir = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
includedir = @includedir@
includesubdir = @includesubdir@
INCLUDEDIR = $(DESTDIR)$(includedir)$(includesubdir)
INCLUDEDIR = $(DESTDIR)$(includedir@MERGE_PREFIX@)$(includesubdir)
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@@ -78,6 +78,7 @@ CAPLIST = $(TERMINFO_CAPS) \
CONFIG_SRC = \
MKterm.h.awk \
curses.head \
nc_win32.h \
ncurses_dll.h \
termcap.h \
unctrl.h
+3 -3
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2020,2021 Thomas E. Dickey *
* Copyright 2020-2021,2024 Thomas E. Dickey *
* Copyright 1998-2000,2008 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -33,7 +33,7 @@
* and: Thomas E. Dickey 1996-on *
****************************************************************************/
/* $Id: capdefaults.c,v 1.16 2021/09/04 10:52:55 tom Exp $ */
/* $Id: capdefaults.c,v 1.17 2024/07/27 19:19:23 tom Exp $ */
/*
* Compute obsolete capabilities. The reason this is an include file is
@@ -45,7 +45,7 @@
* postprocess_termcap().
*/
{
char *strp;
const char *strp;
short capval;
#define EXTRACT_DELAY(str) \
+58 -46
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2018-2023,2024 Thomas E. Dickey *
* Copyright 2018-2024,2025 Thomas E. Dickey *
* Copyright 1998-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -33,7 +33,7 @@
* and: Thomas E. Dickey 1996-on *
****************************************************************************/
/* $Id: curses.h.in,v 1.282 2024/01/19 11:50:07 tom Exp $ */
/* $Id: curses.h.in,v 1.299 2025/08/08 23:19:21 tom Exp $ */
#ifndef __NCURSES_H
#define __NCURSES_H
@@ -109,7 +109,7 @@
* User-definable tweak to disable the include of <stdbool.h>.
*/
#ifndef NCURSES_ENABLE_STDBOOL_H
#define NCURSES_ENABLE_STDBOOL_H @cf_cv_header_stdbool_h@
#define NCURSES_ENABLE_STDBOOL_H @USE_STDBOOL_H@
#endif
/*
@@ -125,10 +125,10 @@
* doing so makes it incompatible with other implementations of X/Open Curses.
*/
#undef NCURSES_CONST
#define NCURSES_CONST @NCURSES_CONST@
#define NCURSES_CONST @NCURSES_CONST@ /* for old compilers */
#undef NCURSES_INLINE
#define NCURSES_INLINE @NCURSES_INLINE@
#define NCURSES_INLINE @NCURSES_INLINE@ /* for old compilers */
/*
* The standard type used for color values, and for color-pairs. The latter
@@ -175,14 +175,14 @@
* KEY_RESIZE is an extended feature that relies upon the SIGWINCH handler
* in ncurses.
*/
#if @NCURSES_EXT_FUNCS@
#if @NCURSES_EXT_FUNCS@ /* NCURSES_EXT_FUNCS */
#ifndef NCURSES_SIGWINCH
#define NCURSES_SIGWINCH @cf_cv_enable_sigwinch@
#endif
#else
#undef NCURSES_SIGWINCH
#define NCURSES_SIGWINCH 0
#endif
#endif /* NCURSES_EXT_FUNCS */
/*
* In certain environments, we must work around linker problems for data
@@ -232,12 +232,12 @@
#undef NCURSES_CH_T
#define NCURSES_CH_T @NCURSES_CH_T@
#if @cf_cv_enable_lp64@ && defined(_LP64)
#if @cf_cv_enable_lp64@ /* cf_cv_enable_lp64 */ && defined(_LP64)
typedef unsigned chtype;
typedef unsigned mmask_t;
#else
typedef @cf_cv_typeof_chtype@ chtype;
typedef @cf_cv_typeof_mmask_t@ mmask_t;
typedef @cf_cv_typeof_chtype@ chtype; /* cf_cv_typeof_chtype */
typedef @cf_cv_typeof_mmask_t@ mmask_t; /* cf_cv_typeof_mmask_t */
#endif
/*
@@ -296,7 +296,7 @@ typedef @cf_cv_type_of_bool@ NCURSES_BOOL;
#include <stdbool.h>
/* use whatever the C compiler decides bool really is */
#define NCURSES_BOOL bool
#else
#elif !defined(__cplusplus) && !@USE_BUILTIN_BOOL@ /* USE_BUILTIN_BOOL */
/* there is no predefined bool - use our own */
#undef bool
#define bool NCURSES_BOOL
@@ -311,7 +311,7 @@ extern "C" {
#define NCURSES_CAST(type,value) (type)(value)
#endif
#define NCURSES_OK_ADDR(p) (0 != NCURSES_CAST(const void *, (p)))
#define NCURSES_OK_ADDR(p) (NULL != NCURSES_CAST(const void *, (p)))
/*
* X/Open attributes. In the ncurses implementation, they are identical to the
@@ -335,7 +335,7 @@ extern "C" {
#define WA_TOP A_TOP
#define WA_VERTICAL A_VERTICAL
#if @NCURSES_EXT_FUNCS@
#if @NCURSES_EXT_FUNCS@ /* NCURSES_EXT_FUNCS */
#define WA_ITALIC A_ITALIC /* ncurses extension */
#endif
@@ -351,7 +351,7 @@ extern "C" {
/* line graphics */
#if @BROKEN_LINKER@ || NCURSES_REENTRANT
#if @BROKEN_LINKER@ /* BROKEN_LINKER */ || NCURSES_REENTRANT
NCURSES_WRAPPED_VAR(chtype*, acs_map);
#define acs_map NCURSES_PUBLIC_VAR(acs_map())
#else
@@ -459,22 +459,22 @@ typedef chtype attr_t; /* ...must be at least as wide as chtype */
#if NCURSES_WIDECHAR
#if @NCURSES_LIBUTF8@
#if @NCURSES_LIBUTF8@ /* NCURSES_LIBUTF8 */
#ifdef mblen /* libutf8.h defines it w/o undefining first */
#undef mblen
#endif
#include <libutf8.h>
#endif
#if @NEED_WCHAR_H@
#if @NEED_WCHAR_H@ /* NEED_WCHAR_H */
#include <wchar.h> /* ...to get mbstate_t, etc. */
#endif
#if @NCURSES_WCHAR_T@
#if @NCURSES_WCHAR_T@ /* NCURSES_WCHAR_T */
typedef unsigned short wchar_t@NCURSES_OK_WCHAR_T@;
#endif
#if @NCURSES_WINT_T@
#if @NCURSES_WINT_T@ /* NCURSES_WINT_T */
typedef unsigned int wint_t@NCURSES_OK_WCHAR_T@;
#endif
@@ -484,16 +484,19 @@ typedef unsigned int wint_t@NCURSES_OK_WCHAR_T@;
* (spacing and nonspacing) do not fill the array, a null L'\0' follows.
* Otherwise, a null is assumed to follow when extracting via getcchar().
*/
#define CCHARW_MAX @NCURSES_CCHARW_MAX@
#define CCHARW_MAX @NCURSES_CCHARW_MAX@ /* NCURSES_CCHARW_MAX */
typedef struct
{
attr_t attr;
wchar_t chars[CCHARW_MAX];
#if @NCURSES_EXT_COLORS@
#if @NCURSES_EXT_COLORS@ /* NCURSES_EXT_COLORS */
#undef NCURSES_EXT_COLORS
#define NCURSES_EXT_COLORS @NCURSES_PATCH@
#define NCURSES_EXT_COLORS @NCURSES_PATCH@ /* NCURSES_PATCH */
int ext_color; /* color pair, must be more than 16-bits */
#if @NCURSES_RGB_COLORS@ /* NCURSES_RGB_COLORS */
int rgb_color; /* extra data for direct-color (rgb) */
#endif
#endif /* NCURSES_EXT_COLORS */
}
cchar_t;
@@ -549,9 +552,9 @@ struct _win_st
NCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */
#if NCURSES_WIDECHAR
#if NCURSES_WIDECHAR /* NCURSES_WIDECHAR */
cchar_t _bkgrnd; /* current background char/attribute pair */
#if @NCURSES_EXT_COLORS@
#if @NCURSES_EXT_COLORS@ /* NCURSES_EXT_COLORS */
int _color; /* current color-pair for non-space character */
#endif
#endif
@@ -833,7 +836,7 @@ extern NCURSES_EXPORT(int) vline (chtype, int); /* generated */
extern NCURSES_EXPORT(int) vwprintw (WINDOW *, const char *, va_list) GCC_DEPRECATED(use vw_printw) /* implemented */
GCC_PRINTFLIKE(2,0);
extern NCURSES_EXPORT(int) vw_printw (WINDOW *, const char *, va_list) /* implemented */
GCC_PRINTFLIKE(2,0);
GCC_PRINTFLIKE(2,0);
extern NCURSES_EXPORT(int) vwscanw (WINDOW *, const char *, va_list) GCC_DEPRECATED(use vw_scanw) /* implemented */
GCC_SCANFLIKE(2,0);
extern NCURSES_EXPORT(int) vw_scanw (WINDOW *, const char *, va_list) /* implemented */
@@ -936,9 +939,9 @@ extern NCURSES_EXPORT(int) getpary (const WINDOW *); /* generated */
/*
* These functions are extensions - not in X/Open Curses.
*/
#if @NCURSES_EXT_FUNCS@
#if @NCURSES_EXT_FUNCS@ /* NCURSES_EXT_FUNCS */
#undef NCURSES_EXT_FUNCS
#define NCURSES_EXT_FUNCS @NCURSES_PATCH@
#define NCURSES_EXT_FUNCS @NCURSES_PATCH@ /* NCURSES_PATCH */
typedef int (*NCURSES_WINDOW_CB)(WINDOW *, void *);
typedef int (*NCURSES_SCREEN_CB)(SCREEN *, void *);
extern NCURSES_EXPORT(int) alloc_pair (int, int);
@@ -973,9 +976,9 @@ extern NCURSES_EXPORT(int) use_screen (SCREEN *, NCURSES_SCREEN_CB, void *);
extern NCURSES_EXPORT(int) use_window (WINDOW *, NCURSES_WINDOW_CB, void *);
extern NCURSES_EXPORT(int) wresize (WINDOW *, int, int);
#if @NCURSES_XNAMES@
#if @NCURSES_XNAMES@ /* NCURSES_XNAMES */
#undef NCURSES_XNAMES
#define NCURSES_XNAMES @NCURSES_XNAMES@
#define NCURSES_XNAMES @NCURSES_XNAMES@ /* NCURSES_XNAMES */
extern NCURSES_EXPORT(int) use_extended_names (bool);
#endif
@@ -999,17 +1002,17 @@ extern NCURSES_EXPORT(bool) is_syncok (const WINDOW *); /* @GENERATED_EXT_FUNCS
extern NCURSES_EXPORT(int) wgetdelay (const WINDOW *); /* @GENERATED_EXT_FUNCS@ */
extern NCURSES_EXPORT(int) wgetscrreg (const WINDOW *, int *, int *); /* @GENERATED_EXT_FUNCS@ */
#else
#else /* !NCURSES_EXT_FUNCS */
#define curses_version() NCURSES_VERSION
#endif
#endif /* NCURSES_EXT_FUNCS */
/*
* Extra extension-functions, which pass a SCREEN pointer rather than using
* a global variable SP.
*/
#if @NCURSES_SP_FUNCS@
#if @NCURSES_SP_FUNCS@ /* NCURSES_SP_FUNCS */
#undef NCURSES_SP_FUNCS
#define NCURSES_SP_FUNCS @NCURSES_PATCH@
#define NCURSES_SP_FUNCS @NCURSES_PATCH@ /* NCURSES_PATCH */
#define NCURSES_SP_NAME(name) name##_sp
/* Define the sp-funcs helper function */
@@ -1091,7 +1094,7 @@ extern NCURSES_EXPORT(void) NCURSES_SP_NAME(use_env) (SCREEN*, bool); /* impleme
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(use_tioctl) (SCREEN*, bool); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vidattr) (SCREEN*, chtype); /* implemented:SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(vidputs) (SCREEN*, chtype, NCURSES_SP_OUTC); /* implemented:SP_FUNC */
#if @NCURSES_EXT_FUNCS@
#if @NCURSES_EXT_FUNCS@ /* NCURSES_EXT_FUNCS */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(alloc_pair) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(assume_default_colors) (SCREEN*, int, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(define_key) (SCREEN*, const char *, int); /* implemented:EXT_SP_FUNC */
@@ -1119,13 +1122,13 @@ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(set_escdelay) (SCREEN*, int); /* impl
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(set_tabsize) (SCREEN*, int); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_default_colors) (SCREEN*); /* implemented:EXT_SP_FUNC */
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_legacy_coding) (SCREEN*, int); /* implemented:EXT_SP_FUNC */
#endif
#else
#endif /* NCURSES_EXT_FUNCS */
#else /* !NCURSES_SP_FUNCS */
#undef NCURSES_SP_FUNCS
#define NCURSES_SP_FUNCS 0
#define NCURSES_SP_NAME(name) name
#define NCURSES_SP_OUTC NCURSES_OUTC
#endif
#endif /* NCURSES_SP_FUNCS */
/* attributes */
@@ -1143,8 +1146,12 @@ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_legacy_coding) (SCREEN*, int); /*
#define A_DIM NCURSES_BITS(@cf_cv_1UL@,12)
#define A_BOLD NCURSES_BITS(@cf_cv_1UL@,13)
#define A_ALTCHARSET NCURSES_BITS(@cf_cv_1UL@,14)
/* SVr4 curses marks these as "subject to change" */
#define A_INVIS NCURSES_BITS(@cf_cv_1UL@,15)
#define A_PROTECT NCURSES_BITS(@cf_cv_1UL@,16)
/* X/Open features not found in SVr4 curses */
#define A_HORIZONTAL NCURSES_BITS(@cf_cv_1UL@,17)
#define A_LEFT NCURSES_BITS(@cf_cv_1UL@,18)
#define A_LOW NCURSES_BITS(@cf_cv_1UL@,19)
@@ -1152,9 +1159,14 @@ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_legacy_coding) (SCREEN*, int); /*
#define A_TOP NCURSES_BITS(@cf_cv_1UL@,21)
#define A_VERTICAL NCURSES_BITS(@cf_cv_1UL@,22)
#if @NCURSES_EXT_FUNCS@
#if @NCURSES_EXT_FUNCS@ /* NCURSES_EXT_FUNCS */
#define A_ITALIC NCURSES_BITS(@cf_cv_1UL@,23) /* ncurses extension */
#endif
#if @NCURSES_RGB_COLORS@ /* NCURSES_RGB_COLORS */
#define A_FOREGROUND NCURSES_BITS(@cf_cv_1UL@,17) /* ncurses extension */
#define A_BACKGROUND NCURSES_BITS(@cf_cv_1UL@,18) /* ncurses extension */
#define A_DIRECT (A_FOREGROUND|A_BACKGROUND)
#endif /* NCURSES_RGB_COLORS */
#endif /* NCURSES_EXT_FUNCS */
/*
* Most of the pseudo functions are macros that either provide compatibility
@@ -1228,7 +1240,7 @@ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_legacy_coding) (SCREEN*, int); /*
#if !NCURSES_OPAQUE
#if NCURSES_WATTR_MACROS
#if NCURSES_WIDECHAR && @NCURSES_EXT_COLORS@
#if NCURSES_WIDECHAR && @NCURSES_EXT_COLORS@ /* NCURSES_EXT_COLORS */
#define wattrset(win,at) \
(NCURSES_OK_ADDR(win) \
? ((win)->_color = NCURSES_CAST(int, PAIR_NUMBER(at)), \
@@ -1380,7 +1392,7 @@ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_legacy_coding) (SCREEN*, int); /*
#if !NCURSES_OPAQUE
#if NCURSES_WATTR_MACROS
#if NCURSES_WIDECHAR && @NCURSES_EXT_COLORS@
#if NCURSES_WIDECHAR && @NCURSES_EXT_COLORS@ /* NCURSES_EXT_COLORS */
#define wattr_set(win,a,p,opts) \
(NCURSES_OK_ADDR(win) \
? ((void)((win)->_attrs = ((a) & ~A_COLOR), \
@@ -1400,7 +1412,7 @@ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_legacy_coding) (SCREEN*, int); /*
: OK), \
OK) \
: ERR)
#else /* !(NCURSES_WIDECHAR && NCURSES_EXE_COLORS) */
#else /* !(NCURSES_WIDECHAR && NCURSES_EXT_COLORS) */
#define wattr_set(win,a,p,opts) \
(NCURSES_OK_ADDR(win) \
? ((void)((win)->_attrs = (((a) & ~A_COLOR) | \
@@ -1417,7 +1429,7 @@ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_legacy_coding) (SCREEN*, int); /*
: OK), \
OK) \
: ERR)
#endif /* (NCURSES_WIDECHAR && NCURSES_EXE_COLORS) */
#endif /* (NCURSES_WIDECHAR && NCURSES_EXT_COLORS) */
#endif /* NCURSES_WATTR_MACROS */
#endif /* NCURSES_OPAQUE */
@@ -1433,15 +1445,15 @@ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_legacy_coding) (SCREEN*, int); /*
/*
* Export fallback function for use in C++ binding.
*/
#if !@HAVE_VSSCANF@
#if !@HAVE_VSSCANF@ /* HAVE_VSSCANF */
#define vsscanf(a,b,c) _nc_vsscanf(a,b,c)
NCURSES_EXPORT(int) vsscanf(const char *, const char *, va_list);
extern NCURSES_EXPORT(int) vsscanf(const char *, const char *, va_list);
#endif
/*
* These macros are extensions - not in X/Open Curses.
*/
#if @NCURSES_EXT_FUNCS@
#if @NCURSES_EXT_FUNCS@ /* NCURSES_EXT_FUNCS */
#if !NCURSES_OPAQUE
#define is_cleared(win) (NCURSES_OK_ADDR(win) ? (win)->_clear : FALSE)
#define is_idcok(win) (NCURSES_OK_ADDR(win) ? (win)->_idcok : FALSE)
@@ -1459,7 +1471,7 @@ NCURSES_EXPORT(int) vsscanf(const char *, const char *, va_list);
#define wgetparent(win) (NCURSES_OK_ADDR(win) ? (win)->_parent : 0)
#define wgetscrreg(win,t,b) (NCURSES_OK_ADDR(win) ? (*(t) = (win)->_regtop, *(b) = (win)->_regbottom, OK) : ERR)
#endif
#endif
#endif /* NCURSES_EXT_FUNCS */
/*
* X/Open says this returns a bool; SVr4 also checked for out-of-range line.
+49 -5
View File
@@ -1,4 +1,4 @@
/* $Id: curses.tail,v 1.27 2023/08/05 19:43:46 tom Exp $ */
/* $Id: curses.tail,v 1.29 2025/07/26 15:32:01 tom Exp $ */
/*
* vile:cmode:
* This file is part of ncurses, designed to be appended after curses.h.in
@@ -8,9 +8,9 @@
/* mouse interface */
#if NCURSES_MOUSE_VERSION > 1
#define NCURSES_MOUSE_MASK(b,m) ((m) << (((b) - 1) * 5))
#define NCURSES_MOUSE_MASK(b,m) ((mmask_t)(m) << (((b) - 1) * 5))
#else
#define NCURSES_MOUSE_MASK(b,m) ((m) << (((b) - 1) * 6))
#define NCURSES_MOUSE_MASK(b,m) ((mmask_t)(m) << (((b) - 1) * 6))
#endif
#define NCURSES_BUTTON_RELEASED 001UL
@@ -62,7 +62,51 @@
#define BUTTON_ALT NCURSES_MOUSE_MASK(6, 0004L)
#define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(6, 0010L)
#else
/*
* If mmask_T is 64-bits, we can define another 6 button stanzas, for a total
* of 11, which happens to be the maximum number supported in the X11 protocol.
*/
#if NCURSES_MOUSE_VERSION > 2
#define BUTTON6_RELEASED NCURSES_MOUSE_MASK(6, NCURSES_BUTTON_RELEASED)
#define BUTTON6_PRESSED NCURSES_MOUSE_MASK(6, NCURSES_BUTTON_PRESSED)
#define BUTTON6_CLICKED NCURSES_MOUSE_MASK(6, NCURSES_BUTTON_CLICKED)
#define BUTTON6_DOUBLE_CLICKED NCURSES_MOUSE_MASK(6, NCURSES_DOUBLE_CLICKED)
#define BUTTON6_TRIPLE_CLICKED NCURSES_MOUSE_MASK(6, NCURSES_TRIPLE_CLICKED)
#define BUTTON7_RELEASED NCURSES_MOUSE_MASK(7, NCURSES_BUTTON_RELEASED)
#define BUTTON7_PRESSED NCURSES_MOUSE_MASK(7, NCURSES_BUTTON_PRESSED)
#define BUTTON7_CLICKED NCURSES_MOUSE_MASK(7, NCURSES_BUTTON_CLICKED)
#define BUTTON7_DOUBLE_CLICKED NCURSES_MOUSE_MASK(7, NCURSES_DOUBLE_CLICKED)
#define BUTTON7_TRIPLE_CLICKED NCURSES_MOUSE_MASK(7, NCURSES_TRIPLE_CLICKED)
#define BUTTON8_RELEASED NCURSES_MOUSE_MASK(8, NCURSES_BUTTON_RELEASED)
#define BUTTON8_PRESSED NCURSES_MOUSE_MASK(8, NCURSES_BUTTON_PRESSED)
#define BUTTON8_CLICKED NCURSES_MOUSE_MASK(8, NCURSES_BUTTON_CLICKED)
#define BUTTON8_DOUBLE_CLICKED NCURSES_MOUSE_MASK(8, NCURSES_DOUBLE_CLICKED)
#define BUTTON8_TRIPLE_CLICKED NCURSES_MOUSE_MASK(8, NCURSES_TRIPLE_CLICKED)
#define BUTTON9_RELEASED NCURSES_MOUSE_MASK(9, NCURSES_BUTTON_RELEASED)
#define BUTTON9_PRESSED NCURSES_MOUSE_MASK(9, NCURSES_BUTTON_PRESSED)
#define BUTTON9_CLICKED NCURSES_MOUSE_MASK(9, NCURSES_BUTTON_CLICKED)
#define BUTTON9_DOUBLE_CLICKED NCURSES_MOUSE_MASK(9, NCURSES_DOUBLE_CLICKED)
#define BUTTON9_TRIPLE_CLICKED NCURSES_MOUSE_MASK(9, NCURSES_TRIPLE_CLICKED)
#define BUTTON10_RELEASED NCURSES_MOUSE_MASK(10, NCURSES_BUTTON_RELEASED)
#define BUTTON10_PRESSED NCURSES_MOUSE_MASK(10, NCURSES_BUTTON_PRESSED)
#define BUTTON10_CLICKED NCURSES_MOUSE_MASK(10, NCURSES_BUTTON_CLICKED)
#define BUTTON10_DOUBLE_CLICKED NCURSES_MOUSE_MASK(10, NCURSES_DOUBLE_CLICKED)
#define BUTTON10_TRIPLE_CLICKED NCURSES_MOUSE_MASK(10, NCURSES_TRIPLE_CLICKED)
#define BUTTON11_RELEASED NCURSES_MOUSE_MASK(11, NCURSES_BUTTON_RELEASED)
#define BUTTON11_PRESSED NCURSES_MOUSE_MASK(11, NCURSES_BUTTON_PRESSED)
#define BUTTON11_CLICKED NCURSES_MOUSE_MASK(11, NCURSES_BUTTON_CLICKED)
#define BUTTON11_DOUBLE_CLICKED NCURSES_MOUSE_MASK(11, NCURSES_DOUBLE_CLICKED)
#define BUTTON11_TRIPLE_CLICKED NCURSES_MOUSE_MASK(11, NCURSES_TRIPLE_CLICKED)
#endif
#else /* NCURSES_MOUSE_VERSION == 1 */
#define BUTTON1_RESERVED_EVENT NCURSES_MOUSE_MASK(1, NCURSES_RESERVED_EVENT)
#define BUTTON2_RESERVED_EVENT NCURSES_MOUSE_MASK(2, NCURSES_RESERVED_EVENT)
@@ -74,7 +118,7 @@
#define BUTTON_ALT NCURSES_MOUSE_MASK(5, 0004L)
#define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(5, 0010L)
#endif
#endif /* NCURSES_MOUSE_VERSION >= 1 */
#define ALL_MOUSE_EVENTS (REPORT_MOUSE_POSITION - 1)
+4 -3
View File
@@ -1,4 +1,4 @@
/* $Id: curses.wide,v 1.51 2021/05/22 20:28:29 tom Exp $ */
/* $Id: curses.wide,v 1.53 2025/01/18 21:08:32 Branden.Robinson Exp $ */
/*
* vile:cmode:
* This file is part of ncurses, designed to be appended after curses.h.in
@@ -213,7 +213,7 @@ extern NCURSES_EXPORT(int) winnwstr (WINDOW *, wchar_t *, int); /* implemented
extern NCURSES_EXPORT(int) wins_nwstr (WINDOW *, const wchar_t *, int); /* implemented */
extern NCURSES_EXPORT(int) wins_wch (WINDOW *, const cchar_t *); /* implemented */
extern NCURSES_EXPORT(int) wins_wstr (WINDOW *, const wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(int) winwstr (WINDOW *, wchar_t *); /* implemented */
extern NCURSES_EXPORT(int) winwstr (WINDOW *, wchar_t *); /* generated:WIDEC */
extern NCURSES_EXPORT(wchar_t*) wunctrl (cchar_t *); /* implemented */
extern NCURSES_EXPORT(int) wvline_set (WINDOW *, const cchar_t *, int); /* implemented */
@@ -240,7 +240,7 @@ extern NCURSES_EXPORT(wchar_t*) NCURSES_SP_NAME(wunctrl) (SCREEN*, cchar_t *); /
#define bkgrnd(c) wbkgrnd(stdscr,(c))
#define bkgrndset(c) wbkgrndset(stdscr,(c))
#define border_set(l,r,t,b,tl,tr,bl,br) wborder_set(stdscr,(l),(r),(t),(b),tl,tr,bl,br)
#define box_set(w,v,h) wborder_set((w),(v),(v),(h),(h),0,0,0,0)
#define box_set(w,v,h) wborder_set((w),(v),(v),(h),(h),NULL,NULL,NULL,NULL)
#define echo_wchar(c) wecho_wchar(stdscr,(c))
#define get_wch(c) wget_wch(stdscr,(c))
#define get_wstr(t) wget_wstr(stdscr,(t))
@@ -261,6 +261,7 @@ extern NCURSES_EXPORT(wchar_t*) NCURSES_SP_NAME(wunctrl) (SCREEN*, cchar_t *); /
#define wget_wstr(w,t) wgetn_wstr((w),(t),-1)
#define win_wchstr(w,c) win_wchnstr((w),(c),-1)
#define wins_wstr(w,t) wins_nwstr((w),(t),-1)
#define winwstr(w,c) winnwstr((w),(c),-1)
#if !NCURSES_OPAQUE
#define wgetbkgrnd(win,wch) (NCURSES_OK_ADDR(wch) ? ((win) ? (*(wch) = (win)->_bkgrnd) : *(wch), OK) : ERR)
+4 -5
View File
@@ -1,6 +1,6 @@
# $Id: headers,v 1.16 2023/04/22 12:09:09 tom Exp $
# $Id: headers,v 1.22 2025/12/26 23:33:03 tom Exp $
##############################################################################
# Copyright 2020,2023 Thomas E. Dickey #
# Copyright 2020-2023,2025 Thomas E. Dickey #
# Copyright 1998-2012,2013 Free Software Foundation, Inc. #
# #
# Permission is hereby granted, free of charge, to any person obtaining a #
@@ -45,9 +45,8 @@ $(srcdir)/term_entry.h
# Porting
@ port_win32con
$(srcdir)/ncurses_mingw.h
$(srcdir)/nc_mingw.h
nc_win32.h
@ port_win32
$(srcdir)/win32_curses.h
nc_win32.h
# vile:makemode
+23 -2
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2019-2020,2021 Thomas E. Dickey *
* Copyright 2019-2021,2025 Thomas E. Dickey *
* Copyright 1998-2013,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -30,7 +30,7 @@
/****************************************************************************
* Author: Thomas E. Dickey 1996-on *
****************************************************************************/
/* $Id: nc_alloc.h,v 1.30 2021/11/20 23:33:38 tom Exp $ */
/* $Id: nc_alloc.h,v 1.36 2025/03/01 15:02:06 tom Exp $ */
#ifndef NC_ALLOC_included
#define NC_ALLOC_included 1
@@ -118,6 +118,27 @@ extern NCURSES_EXPORT(void) _nc_leaks_tinfo(void);
#define typeCalloc(type,elts) (type *)calloc((size_t)(elts),sizeof(type))
#define typeRealloc(type,elts,ptr) (type *)_nc_doalloc(ptr, (size_t)(elts)*sizeof(type))
/* provide for using VLAs if supported, otherwise assume alloca() */
#ifndef __STDC_VERSION__
#define __STDC_VERSION__ 0
#endif
#ifndef __STDC_NO_VLA__
#define __STDC_NO_VLA__ 1
#endif
#if __STDC_VERSION__ >= 19901L && (__STDC_VERSION__ < 201000L || !__STDC_NO_VLA__)
#define MakeArray(name,type,count) type name[count]
#else
#if HAVE_ALLOCA_H
#include <alloca.h>
#elif HAVE_MALLOC_H
#include <malloc.h>
#endif
#define MakeArray(name,type,count) type *name = (type*) alloca(sizeof(type) * (size_t) (count))
#endif
#ifdef __cplusplus
}
#endif
+4 -87
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2018,2020 Thomas E. Dickey *
* Copyright 2018-2020,2025 Thomas E. Dickey *
* Copyright 2011-2014,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -31,7 +31,7 @@
* Author: Thomas E. Dickey 2011 *
****************************************************************************/
/* $Id: nc_termios.h,v 1.8 2020/08/29 20:53:19 tom Exp $ */
/* $Id: nc_termios.h,v 1.10 2025/10/18 17:53:13 tom Exp $ */
#ifndef NC_TERMIOS_included
#define NC_TERMIOS_included 1
@@ -70,97 +70,14 @@
#define tcflush(fd, arg) ioctl(fd, TCFLSH, arg)
#endif
#if defined(EXP_WIN32_DRIVER)
#if defined(_WIN32)
#undef TERMIOS
#endif
#else /* !HAVE_TERMIO_H */
#if defined(_WIN32) && !defined(EXP_WIN32_DRIVER)
#undef TERMIOS
/* lflag bits */
#define ISIG 0x0001
#define ICANON 0x0002
#define ECHO 0x0004
#define ECHOE 0x0008
#define ECHOK 0x0010
#define ECHONL 0x0020
#define NOFLSH 0x0040
#define IEXTEN 0x0100
#define VEOF 4
#define VERASE 5
#define VINTR 6
#define VKILL 7
#define VMIN 9
#define VQUIT 10
#define VTIME 16
/* iflag bits */
#define IGNBRK 0x00001
#define BRKINT 0x00002
#define IGNPAR 0x00004
#define INPCK 0x00010
#define ISTRIP 0x00020
#define INLCR 0x00040
#define IGNCR 0x00080
#define ICRNL 0x00100
#define IXON 0x00400
#define IXOFF 0x01000
#define PARMRK 0x10000
/* oflag bits */
#define OPOST 0x00001
/* cflag bits */
#define CBAUD 0x0100f
#define B0 0x00000
#define B50 0x00001
#define B75 0x00002
#define B110 0x00003
#define B134 0x00004
#define B150 0x00005
#define B200 0x00006
#define B300 0x00007
#define B600 0x00008
#define B1200 0x00009
#define B1800 0x0000a
#define B2400 0x0000b
#define B4800 0x0000c
#define B9600 0x0000d
#define CSIZE 0x00030
#define CS8 0x00030
#define CSTOPB 0x00040
#define CREAD 0x00080
#define PARENB 0x00100
#define PARODD 0x00200
#define HUPCL 0x00400
#define CLOCAL 0x00800
#define TCIFLUSH 0
#define TCSADRAIN 3
#ifndef cfgetospeed
#define cfgetospeed(t) ((t)->c_cflag & CBAUD)
#endif
#ifndef tcsetattr
#define tcsetattr(fd, opt, arg) _nc_mingw_tcsetattr(fd, opt, arg)
#endif
#ifndef tcgetattr
#define tcgetattr(fd, arg) _nc_mingw_tcgetattr(fd, arg)
#endif
#ifndef tcflush
#define tcflush(fd, queue) _nc_mingw_tcflush(fd, queue)
#endif
#undef ttyname
#define ttyname(fd) NULL
#endif /* _WIN32 */
#endif /* HAVE_TERMIO_H */
#endif /* HAVE_TERMIOS_H */
+3 -2
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2018-2020,2023 Thomas E. Dickey *
* Copyright 2018-2023,2025 Thomas E. Dickey *
* Copyright 2006-2012,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -31,7 +31,7 @@
* Author: Thomas E. Dickey 2006 *
****************************************************************************/
/* $Id: nc_tparm.h,v 1.12 2023/04/16 17:57:28 tom Exp $ */
/* $Id: nc_tparm.h,v 1.13 2025/01/04 23:42:30 tom Exp $ */
#ifndef NC_TPARM_included
#define NC_TPARM_included 1
@@ -88,6 +88,7 @@
#define TIPARM_7(s,a,b,c,d,e,f,g) _nc_tiparm(7,s,a,b,c,d,e,f,g)
#define TIPARM_8(s,a,b,c,d,e,f,g,h) _nc_tiparm(8,s,a,b,c,d,e,f,g,h)
#define TIPARM_9(s,a,b,c,d,e,f,g,h,i) _nc_tiparm(9,s,a,b,c,d,e,f,g,h,i)
#define TIPARM_N(N,s,a,b,c,d,e,f,g,h,i) _nc_tiparm(N,s,a,b,c,d,e,f,g,h,i)
#endif
#endif /* NC_TPARM_included */
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2018-2020,2023 Thomas E. Dickey *
* Copyright 2018-2024,2025 Thomas E. Dickey *
* Copyright 2008-2010,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -31,23 +31,27 @@
* Author: Thomas Dickey, 2008-on *
****************************************************************************/
/* $Id: nc_win32.h,v 1.10 2023/02/25 20:09:23 tom Exp $ */
/* $Id: nc_win32.h.in,v 1.19 2025/12/26 23:32:43 tom Exp $ */
#ifndef NC_WIN32_H
#define NC_WIN32_H 1
#if defined(_WIN32) || defined(_WIN64)
#include <ncurses_cfg.h>
#ifndef _NC_WINDOWS
#define _NC_WINDOWS
#if defined(_WIN32) || defined(_WIN64) || defined(USE_WIN32CON_DRIVER)
#if @USE_NAMED_PIPES@ /* USE_NAMED_PIPES */
#ifndef _NC_WINDOWS_NATIVE
#define _NC_WINDOWS_NATIVE
#endif
#ifdef TERMIOS
#error TERMIOS must not be defined on Windows
#endif
/* We no longer support WindowsXP.
Minimum requirement is Windows Vista or Server2008,
/*
Minimum requirement for named pipes is Windows Vista or Server2008,
aka Windows NT 6.0
*/
#ifdef WINVER
@@ -65,59 +69,46 @@
#include <windows.h>
#else /* !USE_NAMED_PIPES */
#ifdef WINVER
# if WINVER < 0x0501
# error WINVER must at least be 0x0501
# endif
#else
# define WINVER 0x0501
#endif
#include <windows.h>
#undef sleep
#define sleep(n) Sleep((n) * 1000)
#endif /* USE_NAMED_PIPES */
#if HAVE_SYS_TIME_H
#include <sys/time.h> /* for struct timeval */
#endif
#ifdef _NC_MSC
#ifdef _MSC_VER
#include <winsock2.h> /* for struct timeval */
#endif
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h> /* for uint32_t */
#include <ncurses_dll.h>
#if !HAVE_CLOCK_GETTIME && !HAVE_GETTIMEOFDAY
#undef HAVE_GETTIMEOFDAY
#define HAVE_GETTIMEOFDAY 2
extern NCURSES_EXPORT(int) _nc_gettimeofday(struct timeval *, void *);
#endif
#undef wcwidth
#define wcwidth(ucs) _nc_wcwidth((wchar_t)(ucs))
extern NCURSES_EXPORT(int) _nc_wcwidth(wchar_t);
#ifdef EVENTLIST_2nd /* test.priv.h just needs the preceding */
extern NCURSES_EXPORT(void) _nc_console_size(int* Lines, int* Cols);
extern NCURSES_EXPORT(HANDLE) _nc_console_handle(int fd);
extern NCURSES_EXPORT(int) _nc_console_isatty(int fd);
extern NCURSES_EXPORT(int) _nc_console_test(int fd);
extern NCURSES_EXPORT(int) _nc_console_read(SCREEN *sp,HANDLE hdl,int *buf);
extern NCURSES_EXPORT(int) _nc_console_twait(SCREEN *, HANDLE,int,int,int * EVENTLIST_2nd(_nc_eventlist * evl));
extern NCURSES_EXPORT(WORD) _nc_console_MapColor(bool fore, int color);
extern NCURSES_EXPORT(void) _nc_console_selectActiveHandle(void);
extern NCURSES_EXPORT(bool) _nc_console_get_SBI(void);
extern NCURSES_EXPORT(void) _nc_console_set_scrollback(bool normal, CONSOLE_SCREEN_BUFFER_INFO * info);
extern NCURSES_EXPORT(int) _nc_console_testmouse(SCREEN *,HANDLE,int EVENTLIST_2nd(_nc_eventlist*));
extern NCURSES_EXPORT(int) _nc_console_keyok(int keycode,int flag);
extern NCURSES_EXPORT(bool) _nc_console_keyExist(int keycode);
extern NCURSES_EXPORT(bool) _nc_console_checkinit(bool initFlag, bool assumeTermInfo);
extern NCURSES_EXPORT(int) _nc_console_vt_supported(void);
#ifdef _NC_CHECK_MINTTY
extern NCURSES_EXPORT(int) _nc_console_checkmintty(int fd, LPHANDLE pMinTTY);
/*
* Allow for build-override, e.g., MinGW used "cygwin".
*/
#ifndef DEFAULT_TERM_ENV
#define DEFAULT_TERM_ENV "ms-terminal"
#endif
#undef VALID_TERM_ENV
#define MS_TERMINAL "ms-terminal"
#define VALID_TERM_ENV(term_env, no_terminal) \
(term_env = (NonEmpty(term_env) \
? term_env \
: (_nc_console_vt_supported() \
? MS_TERMINAL \
? DEFAULT_TERM_ENV \
: no_terminal)), \
NonEmpty(term_env))
@@ -137,11 +128,35 @@ extern NCURSES_EXPORT(int) _nc_console_checkmintty(int fd, LPHANDLE pMinTTY);
#define CONMODE_NORAW (ENABLE_PROCESSED_INPUT|ENABLE_LINE_INPUT)
#define CONMODE_NOCBREAK (ENABLE_LINE_INPUT)
#include <ncurses_dll.h>
#if defined(USE_TERM_DRIVER) && defined(USE_WIN32CON_DRIVER)
extern NCURSES_EXPORT_VAR(TERM_DRIVER) _nc_WIN_DRIVER;
#ifdef __cplusplus
extern "C" {
#endif
#if defined(CURSES_PRIV_H) || defined(TEST_PRIV_H)
#if !HAVE_CLOCK_GETTIME && !HAVE_GETTIMEOFDAY
extern NCURSES_EXPORT(int) _nc_gettimeofday(struct timeval *, void *);
#undef HAVE_GETTIMEOFDAY
#define HAVE_GETTIMEOFDAY 2
#define gettimeofday(tv,tz) _nc_gettimeofday(tv,tz)
#endif
#endif /* defined(CURSES_PRIV_H) || defined(TEST_PRIV_H) */
#if !HAVE_WCWIDTH
#undef wcwidth
#define wcwidth(ucs) _nc_wcwidth((wchar_t)(ucs))
extern NCURSES_EXPORT(int) _nc_wcwidth(uint32_t);
#endif
typedef struct
{
DWORD dwFlagIn;
DWORD dwFlagOut;
} ConsoleMode;
#define CON_NUMPAIRS 64
typedef struct {
BOOL initialized;
@@ -166,20 +181,32 @@ typedef struct {
CONSOLE_SCREEN_BUFFER_INFO SBI;
CONSOLE_SCREEN_BUFFER_INFO save_SBI;
CONSOLE_CURSOR_INFO save_CI;
TTY originalMode;
ConsoleMode originalMode;
} ConsoleInfo;
extern NCURSES_EXPORT_VAR(ConsoleInfo) _nc_CONSOLE;
#define WINCONSOLE _nc_CONSOLE
#define TypeAlloca(type,count)(type*) _alloca(sizeof(type)*(size_t)(count))
#endif /* EVENTLIST_2nd */
#ifdef __cplusplus
}
#endif
#ifdef CURSES_PRIV_H /* test.priv.h just needs the preceding */
#include <term.h>
#endif
#if USE_DOS_PATHS
NCURSES_EXPORT(const char *) _nc_to_dospath(const char *, char *);
#define FixupPathname(path) \
char fixed_pathname[PATH_MAX]; \
path = _nc_to_dospath(path, fixed_pathname)
#define FixupPathname2(path,buffer) \
path = _nc_to_dospath(path, buffer)
#endif
#undef ttyname
#define ttyname(fd) NULL
#endif /* _WIN32 || _WIN64 */
#endif /* NC_WIN32_H */
+3 -3
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2020 Thomas E. Dickey *
* Copyright 2020,2024 Thomas E. Dickey *
* Copyright 1998-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -31,7 +31,7 @@
* Author: Thomas E. Dickey 1997-on *
****************************************************************************/
/*
* $Id: ncurses_cfg.hin,v 1.13 2020/03/08 12:37:59 tom Exp $
* $Id: ncurses_cfg.hin,v 1.15 2024/06/08 14:04:14 tom Exp $
*
* Both ncurses_cfg.h and ncurses_def.h are internal header-files used when
* building ncurses.
@@ -44,7 +44,7 @@
*
* See:
* https://invisible-island.net/autoconf/
* ftp://ftp.invisible-island.net/autoconf/
* https://invisible-island.net/archives/autoconf/
*/
#ifndef NC_CONFIG_H
#define NC_CONFIG_H
+18 -5
View File
@@ -1,6 +1,6 @@
# $Id: ncurses_defs,v 1.110 2024/03/02 20:38:23 tom Exp $
# $Id: ncurses_defs,v 1.123 2025/12/27 12:45:14 tom Exp $
##############################################################################
# Copyright 2018-2023,2024 Thomas E. Dickey #
# Copyright 2018-2024,2025 Thomas E. Dickey #
# Copyright 2000-2016,2017 Free Software Foundation, Inc. #
# #
# Permission is hereby granted, free of charge, to any person obtaining a #
@@ -42,6 +42,7 @@ DECL_ERRNO
ETIP_NEEDS_MATH_H
GCC_NORETURN /* nothing */
GCC_UNUSED /* nothing */
HAVE_ALLOCA_H
HAVE_ALLOC_PAIR
HAVE_ASSUME_DEFAULT_COLORS
HAVE_BIG_CORE
@@ -50,6 +51,7 @@ HAVE_BSD_SIGNAL_H
HAVE_BSD_STRING_H
HAVE_BTOWC
HAVE_BUILTIN_H
HAVE_CC_T
HAVE_CHGAT 1
HAVE_CLOCK_GETTIME
HAVE_COLOR_CONTENT 1
@@ -111,6 +113,7 @@ HAVE_LINK
HAVE_LOCALECONV
HAVE_LOCALE_H
HAVE_LONG_FILE_NAMES
HAVE_MALLOC_H
HAVE_MATH_FUNCS
HAVE_MATH_H
HAVE_MBLEN
@@ -158,11 +161,13 @@ HAVE_SETUPTERM 1
HAVE_SETVBUF
HAVE_SGTTY_H
HAVE_SIGACTION
HAVE_SIGSET_T
HAVE_SIGVEC
HAVE_SIZECHANGE
HAVE_SLK_COLOR
HAVE_SLK_INIT 1
HAVE_SNPRINTF
HAVE_SPEED_T
HAVE_STDINT_H
HAVE_STRDUP
HAVE_STRLCAT
@@ -170,8 +175,9 @@ HAVE_STRLCPY
HAVE_STRSTR
HAVE_SYMLINK
HAVE_SYSCONF
HAVE_SYS_BSDTYPES_H
HAVE_SYS_AUXV_H
HAVE_SYS_BSDTYPES_H
HAVE_SYS_FSUID_H
HAVE_SYS_IOCTL_H
HAVE_SYS_PARAM_H
HAVE_SYS_POLL_H
@@ -180,6 +186,7 @@ HAVE_SYS_TERMIO_H
HAVE_SYS_TIMES_H
HAVE_SYS_TIME_H
HAVE_SYS_TIME_SELECT
HAVE_TCFLAG_T
HAVE_TCGETATTR
HAVE_TCGETPGRP
HAVE_TELL
@@ -193,10 +200,10 @@ HAVE_TERM_H 1
HAVE_TGETENT 1
HAVE_TIGETNUM 1
HAVE_TIGETSTR 1
HAVE_TIMES
HAVE_TIPARM 1
HAVE_TIPARM_S 1
HAVE_TISCAN_S 1
HAVE_TIMES
HAVE_TPUTS_SP
HAVE_TSEARCH
HAVE_TYPEAHEAD 1
@@ -224,6 +231,7 @@ HAVE_WCSTOMBS
HAVE_WCTOB
HAVE_WCTOMB
HAVE_WCTYPE_H
HAVE_WCWIDTH
HAVE_WINSDELLN 1
HAVE_WINSSTR 1
HAVE_WMEMCHR
@@ -231,8 +239,8 @@ HAVE_WORKING_POLL
HAVE_WRESIZE
HAVE_WSYNCDOWN 1
HAVE__DOSCAN
HAVE__TRACEF
HAVE__NC_TPARM_ANALYZE 1
HAVE__TRACEF
MIXEDCASE_FILENAMES
NCURSES_CHAR_EQ
NCURSES_EXPANDED
@@ -242,6 +250,7 @@ NCURSES_EXT_PUTWIN
NCURSES_NO_PADDING
NCURSES_OSPEED_COMPAT
NCURSES_PATHSEP ':'
NCURSES_RGB_COLORS
NCURSES_WIDECHAR
NEED_PTEM_H
NO_LEAKS
@@ -255,6 +264,7 @@ TERMPATH "none"
TIME_WITH_SYS_TIME
TYPEOF_CHTYPE
USE_COLORFGBG
USE_DOS_PATHS
USE_FOPEN_BIN_R
USE_GETCAP
USE_GETCAP_CACHE
@@ -264,6 +274,7 @@ USE_HASHMAP
USE_HOME_TERMINFO
USE_LINKS
USE_MY_MEMMOVE
USE_NAMED_PIPES
USE_OK_BCOPY
USE_PTHREADS_EINTR
USE_RCS_IDS
@@ -271,9 +282,11 @@ USE_REENTRANT
USE_SAFE_SPRINTF
USE_SCROLL_HINTS
USE_SIGWINCH
USE_STDBOOL_H
USE_STRING_HACKS
USE_SYMLINKS
USE_SYSMOUSE
USE_TERM_DRIVER
USE_WEAK_SYMBOLS
USE_WIDEC_SUPPORT
USE_XMC_SUPPORT
-82
View File
@@ -1,82 +0,0 @@
/****************************************************************************
* Copyright 2018-2020,2021 Thomas E. Dickey *
* Copyright 2008-2014,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "Software"), to deal in the Software without restriction, including *
* without limitation the rights to use, copy, modify, merge, publish, *
* distribute, distribute with modifications, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included *
* in all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/****************************************************************************
* Author: Juergen Pfeifer, 2008-on *
****************************************************************************/
/* $Id: ncurses_mingw.h,v 1.7 2021/06/17 21:26:02 tom Exp $ */
/*
* This is a placeholder up to now and describes what needs to be implemented
* to support I/O to external terminals with ncurses on the Windows OS.
*/
#ifdef _WIN32
#ifndef _NC_MINGWH
#define _NC_MINGWH
#define USE_CONSOLE_DRIVER 1
#undef TERMIOS
#define TERMIOS 1
typedef unsigned char cc_t;
typedef unsigned int tcflag_t;
typedef unsigned int speed_t;
typedef unsigned short otcflag_t;
typedef unsigned char ospeed_t;
#define NCCS 18
struct termios
{
tcflag_t c_iflag;
tcflag_t c_oflag;
tcflag_t c_cflag;
tcflag_t c_lflag;
char c_line;
cc_t c_cc[NCCS];
speed_t c_ispeed;
speed_t c_ospeed;
};
extern NCURSES_EXPORT(int) _nc_mingw_tcsetattr(
int fd,
int optional_actions,
const struct termios* arg);
extern NCURSES_EXPORT(int) _nc_mingw_tcgetattr(
int fd,
struct termios* arg);
extern NCURSES_EXPORT(int) _nc_mingw_tcflush(
int fd,
int queue);
extern NCURSES_EXPORT(void) _nc_set_term_driver(void* term);
#endif /* _NC_MINGWH */
#endif /* _WIN32 */
+5 -4
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2018-2022,2023 Thomas E. Dickey *
* Copyright 2018-2023,2025 Thomas E. Dickey *
* Copyright 1998-2015,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -33,7 +33,7 @@
* and: Thomas E. Dickey 1998-on *
****************************************************************************/
/* $Id: term_entry.h,v 1.64 2023/04/22 13:37:14 tom Exp $ */
/* $Id: term_entry.h,v 1.65 2025/01/11 20:37:28 tom Exp $ */
/*
* term_entry.h -- interface to entry-manipulation code
@@ -108,7 +108,8 @@ typedef enum {
dbdLAST
} DBDIRS;
#define MAX_USES 32
#define WARN_MAX_USES 32
#define HARD_MAX_USES 40
#define MAX_CROSSLINKS 16
typedef struct entry ENTRY;
@@ -122,7 +123,7 @@ typedef struct {
struct entry {
TERMTYPE2 tterm;
unsigned nuses;
ENTRY_USES uses[MAX_USES];
ENTRY_USES uses[HARD_MAX_USES];
int ncrosslinks;
ENTRY *crosslinks[MAX_CROSSLINKS];
long cstart;
+6 -4
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2018-2022,2023 Thomas E. Dickey *
* Copyright 2018-2023,2025 Thomas E. Dickey *
* Copyright 1998-2012,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -34,7 +34,7 @@
****************************************************************************/
/*
* $Id: tic.h,v 1.87 2023/04/22 13:37:21 tom Exp $
* $Id: tic.h,v 1.91 2025/12/25 21:23:29 tom Exp $
* tic.h - Global variables and structures for the terminfo compiler.
*/
@@ -47,6 +47,7 @@ extern "C" {
#include <ncurses_cfg.h>
#include <sys/stat.h>
#include <curses.h> /* for the _tracef() prototype, ERR/OK, bool defs */
/*
@@ -270,6 +271,7 @@ extern NCURSES_EXPORT(unsigned) _nc_pathlast (const char *);
extern NCURSES_EXPORT(bool) _nc_is_abs_path (const char *);
extern NCURSES_EXPORT(bool) _nc_is_dir_path (const char *);
extern NCURSES_EXPORT(bool) _nc_is_file_path (const char *);
extern NCURSES_EXPORT(bool) _nc_is_path_found (const char *, struct stat *);
extern NCURSES_EXPORT(char *) _nc_basename (char *);
extern NCURSES_EXPORT(char *) _nc_rootname (char *);
@@ -313,8 +315,8 @@ extern NCURSES_EXPORT_VAR(bool) _nc_suppress_warnings;
extern NCURSES_EXPORT_VAR(struct token) _nc_curr_token;
/* comp_userdefs.c */
NCURSES_EXPORT(const struct user_table_entry *) _nc_get_userdefs_table (void);
NCURSES_EXPORT(const HashData *) _nc_get_hash_user (void);
extern NCURSES_EXPORT(const struct user_table_entry *) _nc_get_userdefs_table (void);
extern NCURSES_EXPORT(const HashData *) _nc_get_hash_user (void);
/* captoinfo.c: capability conversion */
extern NCURSES_EXPORT(char *) _nc_captoinfo (const char *, const char *, int const);
+5 -5
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright 2020 Thomas E. Dickey *
* Copyright 2020,2025 Thomas E. Dickey *
* Copyright 1998-2001,2009 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
@@ -40,7 +40,7 @@
* as ^?. Printable characters are displayed as is.
*/
/* $Id: unctrl.h.in,v 1.12 2020/02/02 23:34:34 tom Exp $ */
/* $Id: unctrl.h.in,v 1.14 2025/08/08 23:19:21 tom Exp $ */
#ifndef NCURSES_UNCTRL_H_incl
#define NCURSES_UNCTRL_H_incl 1
@@ -55,10 +55,10 @@ extern "C" {
#include <curses.h>
#undef unctrl
NCURSES_EXPORT(NCURSES_CONST char *) unctrl (chtype);
extern NCURSES_EXPORT(NCURSES_CONST char *) unctrl (chtype);
#if @NCURSES_SP_FUNCS@
NCURSES_EXPORT(NCURSES_CONST char *) NCURSES_SP_NAME(unctrl) (SCREEN*, chtype);
#if @NCURSES_SP_FUNCS@ /* NCURSES_SP_FUNCS */
extern NCURSES_EXPORT(NCURSES_CONST char *) NCURSES_SP_NAME(unctrl) (SCREEN*, chtype);
#endif
#ifdef __cplusplus
-75
View File
@@ -1,75 +0,0 @@
/****************************************************************************
* Copyright 2018-2020,2021 Thomas E. Dickey *
* Copyright 2008-2014,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* "Software"), to deal in the Software without restriction, including *
* without limitation the rights to use, copy, modify, merge, publish, *
* distribute, distribute with modifications, sublicense, and/or sell *
* copies of the Software, and to permit persons to whom the Software is *
* furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included *
* in all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/****************************************************************************
* Author: Juergen Pfeifer, 2008-on *
****************************************************************************/
/* $Id: win32_curses.h,v 1.3 2021/06/17 21:26:02 tom Exp $ */
/*
* This is the interface we use on Windows to mimic the control of the settings
* of what acts like the classic TTY - the Windows Console.
*/
#if (defined(_WIN32) || defined(_WIN64))
#ifndef _NC_WIN32_CURSES_H
#define _NC_WIN32_CURSES_H 1
struct winconmode
{
unsigned long dwFlagIn;
unsigned long dwFlagOut;
};
extern NCURSES_EXPORT(void*) _nc_console_fd2handle(int fd);
extern NCURSES_EXPORT(int) _nc_console_setmode(void* handle, const struct winconmode* arg);
extern NCURSES_EXPORT(int) _nc_console_getmode(void* handle, struct winconmode* arg);
extern NCURSES_EXPORT(int) _nc_console_flush(void* handle);
/*
A few definitions of Unix functions we need to emulate
*/
#define SIGHUP 1
#define SIGKILL 9
#undef getlogin
#define getlogin() getenv("USERNAME")
#undef ttyname
#define ttyname(fd) NULL
#undef sleep
#define sleep(n) Sleep((n) * 1000)
#undef gettimeofday
#define gettimeofday(tv,tz) _nc_gettimeofday(tv,tz)
#endif /* _NC_WIN32_CURSES_H */
#endif /* _WIN32||_WIN64 */
+17 -10
View File
@@ -3,10 +3,18 @@
scriptversion=2020-11-14.01; # UTC
# https://lists.gnu.org/archive/html/automake/2018-09/msg00002.html
#
# Originally X11R4 util/scripts/install.sh, the following comments, copyright
# and license were added by an autoconf developer in 1998 (about nine years
# later). I have made a minor change to the wording, i.e., "copyright holders"
# vs "X Consortium", for reusability -TD
#
# -----------------------------------------------------------------------------
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# -----------------------------------------------------------------------------
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -22,16 +30,15 @@ scriptversion=2020-11-14.01; # UTC
# 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
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
# ABOVE LISTED COPYRIGHT HOLDER(S) 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.
# -----------------------------------------------------------------------------
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
+5 -3
View File
@@ -1,5 +1,5 @@
.\"***************************************************************************
.\" Copyright 2019-2023,2024 Thomas E. Dickey *
.\" Copyright 2019-2024,2025 Thomas E. Dickey *
.\" Copyright 2010-2014,2016 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@@ -27,8 +27,8 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: MKada_config.in,v 1.35 2024/04/20 21:13:27 tom Exp $
.TH adacurses@USE_CFG_SUFFIX@\-config 1 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands"
.\" $Id: MKada_config.in,v 1.37 2025/04/05 22:26:08 tom Exp $
.TH adacurses@USE_CFG_SUFFIX@\-config 1 2025-04-05 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands"
.ds C adacurses@USE_CFG_SUFFIX@\-config
.ie \n(.g \{\
.ds `` \(lq
@@ -97,6 +97,7 @@ Populate a file \fIhello.adb\fP with the following.
.PP
.if \n(LL>67n .RS 4
.EX
.nf
with Terminal_Interface.Curses; use Terminal_Interface.Curses;
procedure Hello is
@@ -127,6 +128,7 @@ begin
End_Windows;
end Hello;
.fi
.EE
.if \n(LL>67n .RE
.ne 2
+2 -2
View File
@@ -27,8 +27,8 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: MKncu_config.in,v 1.24 2024/04/20 21:13:38 tom Exp $
.TH @LIB_NAME@@DFT_ARG_SUFFIX@@cf_cv_abi_version@-config 1 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands"
.\" $Id: MKncu_config.in,v 1.25 2024/05/11 20:39:53 tom Exp $
.TH @LIB_NAME@@DFT_ARG_SUFFIX@@cf_cv_abi_version@\-config 1 2024-05-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands"
.SH NAME
\fB\%@LIB_NAME@@DFT_ARG_SUFFIX@@cf_cv_abi_version@-config\fP \-
configuration helper for \fI\%ncurses\fP libraries
+45 -21
View File
@@ -1,10 +1,10 @@
#!/bin/sh
# $Id: MKterminfo.sh,v 1.20 2024/01/13 20:37:40 tom Exp $
# $Id: MKterminfo.sh,v 1.28 2025/11/12 01:07:10 Branden.Robinson Exp $
#
# MKterminfo.sh -- generate terminfo.5 from Caps tabular data
#
#***************************************************************************
# Copyright 2018-2020,2022 Thomas E. Dickey *
# Copyright 2018-2024,2025 Thomas E. Dickey *
# Copyright 1998-2003,2017 Free Software Foundation, Inc. *
# *
# Permission is hereby granted, free of charge, to any person obtaining a *
@@ -49,33 +49,50 @@ if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
if test "${LC_COLLATE+set}" = set; then LC_COLLATE=C; export LC_COLLATE; fi
#
# collect the command-line parameters of the script
head="$1"
shift 1
shift
caps=
capstext=
while test $# -gt 1
do
caps="$caps $1"
shift 1
capstext="$capstext, $1"
shift
done
tail="$1"
MYTEMP=`mktemp -d 2>/dev/null`
if [ -z "$MYTEMP" ]
then
MYTEMP=${TMPDIR:-/tmp}/ncurses$$
fi
mkdir -p "$MYTEMP" || failed "cannot mkdir $MYTEMP"
trap "rm -rf $MYTEMP; exit 1" HUP INT QUIT TERM
trap "rm -rf $MYTEMP" EXIT
temp=$MYTEMP/temp
pass1=$MYTEMP/pass1
pass2=$MYTEMP/pass2
pass3=$MYTEMP/pass3
sorted=$MYTEMP/sorted
unsorted=$MYTEMP/unsorted
cat <<EOF
'\\" t
.\\" DO NOT EDIT THIS FILE BY HAND!
.\\" It is generated from terminfo.head, $caps, and terminfo.tail.
.\\" man/MKterminfo.sh generated it from:
.\\" terminfo.head$capstext,
.\\" and terminfo.tail.
.\\"
.\\" Note: this must be run through tbl before nroff.
.\\" The magic cookie on the first line triggers this under some man programs.
.\\" Note: this document must be run through tbl before nroff or troff.
.\\" Some man(1) programs recognize the token in the first-line comment
.\\" as directing them to arrange such a pipeline.
EOF
cat "$head"
temp=temp$$
sorted=sorted$$
unsorted=unsorted$$
trap 'code=$?; rm -f $sorted $temp $unsorted; exit $code' EXIT HUP INT QUIT TERM
rm -f $sorted $temp $unsorted
cat $caps | sed -n "\
cat >$pass1 <<EOF
/%%-STOP-HERE-%%/q
/^#%center/s, expand,,
/^#%lw25/s, lw6 , lw7 ,
@@ -84,12 +101,16 @@ cat $caps | sed -n "\
s/[ ][ ]*/ /g
s/$/T}/
s/ [A-Z0-9_()\-][A-Z0-9_()\-]* [0-9\-][0-9\-]* [Y\-][B\-][C\-][G\-][EK\-]\** / T{\\
.ad l\
.na\
/
s/ bool / /p
s/ num / /p
s/ str / /p
" |sed -e 's/^$/../' | tr "\134" "\006" >$unsorted
EOF
echo 's/^$/../' > $pass2
sed -n -f $pass1 $caps | sed -f $pass2 | tr "\134" "\006" >$unsorted
rm -f $sorted
rm -f $temp
@@ -116,8 +137,11 @@ do
done <$unsorted
test $saved = yes && sort $temp >>$sorted
sed -e 's/^\.\.$//' $sorted | tr "\005\006" "\012\134"
sed -e 's/^\.\.$//' $sorted | tr "\005\006" "\012\134" | sed -e '/^$/d'
sed -e '/^center expand;/s, expand,,' \
-e '/^\.TS/,/^\\/s, lw[1-9][0-9]*\., l.,' \
"$tail"
cat > $pass3 << "EOF"
/^center expand;/s, expand,,
/^\.TS/,/^\\/s, lw[1-9][0-9]*\., l.,
EOF
sed -f $pass3 "$tail"
+14 -10
View File
@@ -1,6 +1,6 @@
# $Id: Makefile.in,v 1.54 2022/10/22 16:36:40 tom Exp $
# $Id: Makefile.in,v 1.60 2025/11/02 01:23:25 tom Exp $
##############################################################################
# Copyright 2019-2021,2022 Thomas E. Dickey #
# Copyright 2019-2024,2025 Thomas E. Dickey #
# Copyright 1998-2013,2015 Free Software Foundation, Inc. #
# #
# Permission is hereby granted, free of charge, to any person obtaining a #
@@ -38,7 +38,7 @@
SHELL = @SHELL@
VPATH = @srcdir@
DESTDIR = @DESTDIR@
@SET_DESTDIR@
srcdir = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
@@ -47,7 +47,8 @@ datadir = @datadir@
mandir = @mandir@
includesubdir = @includesubdir@
INCLUDEDIR = $(DESTDIR)$(includedir)$(includesubdir)
INCLUDEDIR = $(DESTDIR)$(includedir@MERGE_PREFIX@)$(includesubdir)
MANDIR = $(DESTDIR)$(mandir@MERGE_PREFIX@)
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@@ -72,12 +73,15 @@ sources : terminfo.5
depend :
tags :
$(DESTDIR)$(mandir) :
check ::
@echo "no unit-test implemented"
$(MANDIR) :
mkdir -p $@
EDITARGS = $(DESTDIR)$(mandir) $(srcdir) terminfo.5 *-config.1 $(srcdir)/*.[0-9]*
EDITARGS = $(MANDIR) $(srcdir) terminfo.5 *-config.1 $(srcdir)/*.[0-9]*
install install.man : terminfo.5 $(DESTDIR)$(mandir)
install install.man : terminfo.5 $(MANDIR)
$(SHELL) ../edit_man.sh normal installing $(EDITARGS)
uninstall uninstall.man :
@@ -90,8 +94,8 @@ CAPLIST = \
terminfo.5: $(srcdir)/terminfo.head \
$(CAPLIST) \
$(srcdir)/terminfo.tail \
Makefile $(srcdir)/MKterminfo.sh
$(SHELL) $(srcdir)/MKterminfo.sh $(srcdir)/terminfo.head $(CAPLIST) $(srcdir)/terminfo.tail >terminfo.5
Makefile MKterminfo.tmp
$(SHELL) MKterminfo.tmp $(srcdir)/terminfo.head $(CAPLIST) $(srcdir)/terminfo.tail >terminfo.5
mostlyclean :
-rm -f core tags TAGS *~ *.bak *.ln *.atac trace
@@ -103,4 +107,4 @@ clean: mostlyclean
$(SHELL) $(srcdir)/make_sed.sh @MANPAGE_RENAMES@ >../edit_man.sed
distclean realclean: clean
-rm -f Makefile *-config.1 ../edit_man.* ../man_alias.* man_db.renames
-rm -f Makefile *-config.1 ../edit_man.* ../man_alias.* man_db.renames MKterminfo.tmp
+108 -51
View File
@@ -1,6 +1,6 @@
'\" t
.\"***************************************************************************
.\" Copyright 2018-2023,2024 Thomas E. Dickey *
.\" Copyright 2018-2024,2025 Thomas E. Dickey *
.\" Copyright 1998-2010,2016 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@@ -28,8 +28,8 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: captoinfo.1m,v 1.63 2024/03/23 20:37:25 tom Exp $
.TH @CAPTOINFO@ 1M 2024-03-23 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands"
.\" $Id: captoinfo.1m,v 1.77 2025/11/12 01:03:56 tom Exp $
.TH @CAPTOINFO@ 1M 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
@@ -51,52 +51,79 @@ convert a \fItermcap\fP description into a \fI\%term\%info\fP description
.P
.B "@CAPTOINFO@ \-V"
.SH DESCRIPTION
\fB\%@CAPTOINFO@\fP translates terminal descriptions.
It looks in each given text \fIfile\fP for \fI\%termcap\fP entries and,
.B \%@CAPTOINFO@
translates terminal descriptions.
It looks in each given text
.I file
for
.I termcap
entries and,
for each one found,
writes an equivalent \fI\%\%term\%info\fP description to the standard
output stream.
\fI\%termcap\fP \fBtc\fP capabilities translate to \fI\%\%term\%info\fP
\*(``\fBuse\fP\*('' capabilities.
writes an equivalent
.I term\%info
description to the standard output stream.
.I termcap
.B tc
capabilities translate to
.I term\%info
.RB \*(`` use \*(''
capabilities.
.PP
If no \fIfile\fPs are specified,
\fB\%@CAPTOINFO@\fP interprets the content of the environment variable
\fI\%TERMCAP\fP as a file name,
and extracts only the entry for the terminal named in the environment
variable \fITERM\fP from it.
If the environment variable \fI\%TERMCAP\fP is not set,
\fB\%@CAPTOINFO@\fP reads
.IR \%/etc/termcap .
If no
.IR file s
are specified,
.B \%@CAPTOINFO@
interprets the content of the environment variable
.I \%TERMCAP
as a file name,
and extracts only the entry for the terminal type named
in the environment variable
.I TERM
from it.
If the environment variable
.I \%TERMCAP
is not set,
.B \%@CAPTOINFO@
reads
.IR \%/etc/termcap "."
.PP
This utility is implemented as a link to \fB\%@TIC@\fP(1M),
with the latter's
.B \-I
option implied.
You can use other \fB\%@TIC@\fP options such as
You can use other
.B \%@TIC@
options such as
.BR \-1 ,
.BR \-f ,
.BR \-v ,
.BR \-w ,
and
.BR \-x .
The \fB\-V\fP option reports the version of \fI\%ncurses\fP associated
with this program and exits with a successful status.
The
.B \-V
option reports the version of
.I \%ncurses
associated with this program and exits with a successful status.
.SS "Translations from Nonstandard Capabilities"
\fB\%@CAPTOINFO@\fP translates some obsolete,
.B \%@CAPTOINFO@
translates some obsolete,
nonstandard capabilities into standard
(SVr4/XSI Curses)
\fI\%\%term\%info\fP capabilities.
.I term\%info
capabilities.
It issues a diagnostic to the standard error stream for each,
inviting the user to check that it has not mistakenly translated an
unknown or mistyped capability name.
.PP
.\" DWB 3.3 tbl requires the two junk "L" specifiers in the first row.
.\" DWB 3.3 and Plan 9 tbl require the two junk "L" specifiers in the
.\" first row description. System V, GNU, and Heirloom Doctools tbl do
.\" not; they "rectangularize" the table geometry.
.TS
center;
Cb S L L
Cb Cb Cb Cb
Cb Cb C Lb.
Name
\f(BItermcap\fP Code
Obsolete Standard Origin \f(BIterminfo\fP capability
_
BO mr AT&T enter_reverse_mode
@@ -129,16 +156,18 @@ FC Sf Tektronix set_foreground
HS mh IRIX enter_dim_mode
.TE
.PP
XENIX \fI\%termcap\fP had a set of extension capabilities,
XENIX
.I termcap
had a set of extension capabilities,
corresponding to box drawing characters of CCSID
(\*(``code page\*('') 437,
as follows.
.PP
.TS
center;
cb cb
cb l .
\f(BItermcap\fP Name Graphic
Cb Cb
Cb L .
\f(BItermcap\fP Code Graphic
_
G2 upper left corner
G3 lower left corner
@@ -170,21 +199,30 @@ Gc double intersection
GG ACS magic cookie count
.TE
.PP
\fB\%@CAPTOINFO@\fP composes single-line capabilities into an \fBacsc\fP
string,
and discards \fBGG\fP and double-line capabilities with a warning
.B \%@CAPTOINFO@
composes single-line box-drawing capabilities into a
.I term\%info
.B \%acs_chars
.RB \%( acsc )
string capability,
and discards
.B GG
and double-line capabilities with a warning
diagnostic.
.PP
IBM's AIX has a \fI\%\%term\%info\fP facility descended from SVr1
\fI\%\%term\%info\fP,
AIX has a
.I term\%info
facility descended from SVr2
.IR term\%info ","
but which is incompatible with the SVr4 format.
\fB\%@CAPTOINFO@\fP translates the following AIX extensions.
.B \%@CAPTOINFO@
translates the following AIX extensions.
.PP
.TS
center;
cb cb
l l .
IBM XSI
Cb Cb
L L .
IBM X/Open
_
ksel kslt
kbtab kcbt
@@ -194,25 +232,44 @@ font2 s2ds
font3 s3ds
.TE
.PP
Additionally,
this program translates the AIX \fBbox1\fP capability to an \fBacsc\fP
string.
It furthermore translates the AIX
.B box1
capability to an
.B \%acs_chars
.RB \%( acsc )
string capability.
.PP
The HP-UX \fI\%\%term\%info\fP library supports two nonstandard
\fI\%\%term\%info\fP capabilities,
\fBmeml\fP (memory lock) and \fBmemu\fP (memory unlock).
\fB\%@CAPTOINFO@\fP discards these with a warning message.
The HP-UX
.I \%term\%info
library supports two nonstandard
.I \%term\%info
capabilities:
.B \%memory_lock
.RB ( meml )
and
.B \%memory_unlock
.RB ( memu ).
.B \%@CAPTOINFO@
discards these with a warning message.
.SH FILES
.TP
.I /etc/termcap
default \fI\%termcap\fP terminal capability database
default
.I termcap
terminal capability database
.SH EXTENSIONS
This command is an SVr4
.I curses
and
.I \%ncurses
extension.
.SH PORTABILITY
X/Open Curses,
Issue 7 (2009) describes \fBtic\fP briefly,
but omits this program.
X/Open Curses Issue\ 7 (2009) does not specify this command.
.PP
SVr4 systems provide \fB\%captoinfo\fP as a separate application from
\fBtic\fP.
SVr4 systems provide
.I \%captoinfo
as a separate application from
.IR \%tic "."
Its
.B \-v
option does not accept a trace level argument
+7 -5
View File
@@ -1,5 +1,5 @@
.\"***************************************************************************
.\" Copyright 2018-2023,2024 Thomas E. Dickey *
.\" Copyright 2018-2024,2025 Thomas E. Dickey *
.\" Copyright 1998-2016,2017 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@@ -27,8 +27,8 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: clear.1,v 1.48 2024/03/16 15:35:01 tom Exp $
.TH @CLEAR@ 1 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands"
.\" $Id: clear.1,v 1.53 2025/04/05 21:56:26 tom Exp $
.TH @CLEAR@ 1 2025-04-05 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
@@ -91,8 +91,8 @@ exits with a successful status.
.B \-x
prevents \fB\%@CLEAR@\fP from attempting to clear the scrollback buffer.
.SH PORTABILITY
Neither IEEE Std 1003.1/The Open Group Base Specifications Issue 7
(POSIX.1-2008) nor X/Open Curses Issue 7 documents \fB\%@CLEAR@\fP.
Neither IEEE Std 1003.1/The Open Group Base Specifications Issue\ 7
(POSIX.1-2008) nor X/Open Curses Issue\ 7 documents \fB\%@CLEAR@\fP.
.PP
The latter documents \fBtput\fP,
which could be used to replace this utility either via a shell script or
@@ -113,8 +113,10 @@ and replaced the \fBclear\fP program with a shell script that called
.PP
.RS 4
.EX
.nf
/usr/bin/tput ${1:+\-T$1} clear 2> /dev/null
exit
.fi
.EE
.RE
.PP
+544 -199
View File
@@ -1,6 +1,6 @@
'\" t
.\"***************************************************************************
.\" Copyright 2019-2023,2024 Thomas E. Dickey *
.\" Copyright 2019-2024,2025 Thomas E. Dickey *
.\" Copyright 2001-2015,2017 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@@ -28,8 +28,8 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: curs_add_wch.3x,v 1.62 2024/04/20 21:20:07 tom Exp $
.TH curs_add_wch 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.\" $Id: curs_add_wch.3x,v 1.125 2025/11/12 01:06:36 tom Exp $
.TH curs_add_wch 3X 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
@@ -52,230 +52,442 @@
\fB\%mvwadd_wch\fP,
\fB\%echo_wchar\fP,
\fB\%wecho_wchar\fP \-
add a \fIcurses\fR complex character to a window and advance the cursor
add a \fIcurses\fR complex character to a window, possibly advancing the cursor
.SH SYNOPSIS
.nf
\fB#include <curses.h>
.PP
\fBint add_wch(const cchar_t *\fIwch\fP);
\fBint wadd_wch(WINDOW *\fIwin\fP, const cchar_t *\fIwch\fP);
\fBint mvadd_wch(int \fIy\fP, int \fIx\fP, const cchar_t *\fIwch\fP);
\fBint mvwadd_wch(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const cchar_t *\fIwch\fP);
\fBint add_wch(const cchar_t * \fIwch\fP);
\fBint wadd_wch(WINDOW * \fIwin\fP, const cchar_t * \fIwch\fP);
\fBint mvadd_wch(int \fIy\fP, int \fIx\fP, const cchar_t * \fIwch\fP);
\fBint mvwadd_wch(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, const cchar_t * \fIwch\fP);
.PP
\fBint echo_wchar(const cchar_t *\fIwch\fP);
\fBint wecho_wchar(WINDOW *\fIwin\fP, const cchar_t *\fIwch\fP);
\fBint echo_wchar(const cchar_t * \fIwch\fP);
\fBint wecho_wchar(WINDOW * \fIwin\fP, const cchar_t *\fIwch\fP);
.PP
\fI/* (integer) constants */\fP
/*\fI .\|.\|. */ \fBWACS_BLOCK;\fR
/*\fI .\|.\|. */ \fBWACS_BOARD;\fR
/*\fI .\|.\|. */ \fBWACS_BTEE;\fR
/*\fI .\|.\|. */ \fBWACS_BULLET;\fR
/*\fI .\|.\|. */ \fBWACS_CKBOARD;\fR
/*\fI .\|.\|. */ \fBWACS_DARROW;\fR
/*\fI .\|.\|. */ \fBWACS_DEGREE;\fR
/*\fI .\|.\|. */ \fBWACS_DIAMOND;\fR
/*\fI .\|.\|. */ \fBWACS_HLINE;\fR
/*\fI .\|.\|. */ \fBWACS_LANTERN;\fR
/*\fI .\|.\|. */ \fBWACS_LARROW;\fR
/*\fI .\|.\|. */ \fBWACS_LLCORNER;\fR
/*\fI .\|.\|. */ \fBWACS_LRCORNER;\fR
/*\fI .\|.\|. */ \fBWACS_LTEE;\fR
/*\fI .\|.\|. */ \fBWACS_PLMINUS;\fR
/*\fI .\|.\|. */ \fBWACS_PLUS;\fR
/*\fI .\|.\|. */ \fBWACS_RARROW;\fR
/*\fI .\|.\|. */ \fBWACS_RTEE;\fR
/*\fI .\|.\|. */ \fBWACS_S1;\fR
/*\fI .\|.\|. */ \fBWACS_S9;\fR
/*\fI .\|.\|. */ \fBWACS_TTEE;\fR
/*\fI .\|.\|. */ \fBWACS_UARROW;\fR
/*\fI .\|.\|. */ \fBWACS_ULCORNER;\fR
/*\fI .\|.\|. */ \fBWACS_URCORNER;\fR
/*\fI .\|.\|. */ \fBWACS_VLINE;\fR
\fI/* extensions */\fP
/*\fI .\|.\|. */ \fBWACS_GEQUAL;\fR
/*\fI .\|.\|. */ \fBWACS_LEQUAL;\fR
/*\fI .\|.\|. */ \fBWACS_NEQUAL;\fR
/*\fI .\|.\|. */ \fBWACS_PI;\fR
/*\fI .\|.\|. */ \fBWACS_S3;\fR
/*\fI .\|.\|. */ \fBWACS_S7;\fR
/*\fI .\|.\|. */ \fBWACS_STERLING;\fR
\fI/* extensions for thick lines */\fP
/*\fI .\|.\|. */ \fBWACS_T_BTEE;\fR
/*\fI .\|.\|. */ \fBWACS_T_HLINE;\fR
/*\fI .\|.\|. */ \fBWACS_T_LLCORNER;\fR
/*\fI .\|.\|. */ \fBWACS_T_LRCORNER;\fR
/*\fI .\|.\|. */ \fBWACS_T_LTEE;\fR
/*\fI .\|.\|. */ \fBWACS_T_PLUS;\fR
/*\fI .\|.\|. */ \fBWACS_T_RTEE;\fR
/*\fI .\|.\|. */ \fBWACS_T_TTEE;\fR
/*\fI .\|.\|. */ \fBWACS_T_ULCORNER;\fR
/*\fI .\|.\|. */ \fBWACS_T_URCORNER;\fR
/*\fI .\|.\|. */ \fBWACS_T_VLINE;\fR
\fI/* extensions for double lines */\fP
/*\fI .\|.\|. */ \fBWACS_D_BTEE;\fR
/*\fI .\|.\|. */ \fBWACS_D_HLINE;\fR
/*\fI .\|.\|. */ \fBWACS_D_LLCORNER;\fR
/*\fI .\|.\|. */ \fBWACS_D_LRCORNER;\fR
/*\fI .\|.\|. */ \fBWACS_D_LTEE;\fR
/*\fI .\|.\|. */ \fBWACS_D_PLUS;\fR
/*\fI .\|.\|. */ \fBWACS_D_RTEE;\fR
/*\fI .\|.\|. */ \fBWACS_D_TTEE;\fR
/*\fI .\|.\|. */ \fBWACS_D_ULCORNER;\fR
/*\fI .\|.\|. */ \fBWACS_D_URCORNER;\fR
/*\fI .\|.\|. */ \fBWACS_D_VLINE;\fR
.fi
.SH DESCRIPTION
.SS add_wch
The
\fBadd_wch\fP,
\fBwadd_wch\fP,
\fBmvadd_wch\fP, and
\fBmvwadd_wch\fP
functions put the complex character \fIwch\fP into the given
window at its current position,
which is then advanced.
These functions perform
wrapping and special-character processing as follows:
.bP
If \fIwch\fP refers to a spacing character,
then any previous character at that location is removed.
A new character specified by \fIwch\fP is
placed at that location with rendition specified by \fIwch\fP.
The cursor then advances after this spacing character,
to prepare for writing the next character on the screen.
.IP
The newly added spacing character is the base of the active complex character.
Subsequent non-spacing characters can be combined with this base
until another spacing character is written to the screen,
or the cursor is moved, e.g., using \fBwmove\fP.
.bP
If \fIwch\fP refers to a non-spacing character,
it is appended to the active complex character,
retaining the previous characters at that location.
The rendition specified by \fIwch\fP is ignored.
.IP
The cursor is not advanced after adding a non-spacing character.
Subsequent calls to add non-spacing characters will update the same position.
.bP
If the character part of \fIwch\fP is
a tab, newline, backspace or other control character,
the window is updated and the cursor moves as if \fBaddch\fP were called.
.SS echo_wchar
The \fBecho_wchar\fP
function is functionally equivalent to a call to
\fBadd_wch\fP
followed by a call to
\fB\%refresh\fP(3X).
Similarly, the
\fBwecho_wchar\fP
is functionally equivalent to a call to
\fBwadd_wch\fP
followed by a call to
\fBwrefresh\fP.
The knowledge
that only a single character is being output is taken into consideration and,
for non-control characters, a considerable performance gain might be seen
by using the *\fBecho\fP* functions instead of their equivalents.
.SS "Line Graphics"
Like \fB\%addch\fP(3X),
\fBaddch_wch\fP accepts symbols which make it simple to draw lines and other
frequently used special characters.
These symbols correspond to the same VT100 line-drawing set as
\fB\%addch\fP(3X).
.SS wadd_wch
.B \%wadd_wch
writes the
.I curses
complex character
.I wch
to the window
.IR win ","
then may advance the cursor position,
analogously to the standard C library's \fI\%putwchar\fP(3).
\fB\%ncurses\fP(3X) describes the variants of this function.
.PP
Construct a
.I curses
complex character
from a
.I wchar_t
with \fB\%setcchar\fP(3X).
A
.I \%cchar_t
can be copied from place to place using \fB\%win_wch\fP(3X) and
.BR \%wadd_wch "."
.I curses
defines constants to aid the manipulation of character attributes;
see \fB\%curs_attr\fP(3X).
A complex character whose only character component is a wide space,
and whose only attribute is
.BR \%WA_NORMAL ,
is a
.IR "blank character" ","
and therefore combines with the window's background character;
see \fB\%curs_bkgrnd\fP(3X).
.PP
Much behavior depends on whether the wide characters in
.I wch
are spacing or non-spacing;
see subsection \*(``Complex Characters\*('' below.
.bP
If
.I wch
contains a spacing character,
then any character at the cursor is first removed.
The complex character
.IR wch ","
with its attributes and color pair identifier,
becomes the
.I base
of the
.IR "active complex character" "."
.bP
If
.I wch
contains only non-spacing characters,
.\" XXX: see wadd_wch_literal (the beginning of the array may be
.\" nonspacing)
they are combined with the active complex character.
.I curses
ignores its attributes and color pair identifier,
and does not advance the cursor.
.PP
Further non-spacing characters added with
.B \%wadd_wch
are not written at the new cursor position but combine with the active
complex character until another spacing character is written to the
window or the cursor is moved.
.PP
If
.I wch
is a
backspace,
carriage return,
line feed,
or
tab,
the cursor moves appropriately within the window.
.bP
Backspace moves the cursor one character left;
at the left margin of a window,
it does nothing.
.bP
Carriage return moves the cursor to the left margin on the same line of
the window.
.bP
Line feed does a \fB\%clrtoeol\fP(3X),
then advances as if from the right margin.
.bP
Tab advances the cursor to the next tab stop
(possibly on the next line);
these are placed at every eighth column by default.
.IP
Alter the tab interval with the
.B \%TABSIZE
extension;
see \fB\%curs_variables\fP(3X).
.PP
If
.I wch
is any other nonprintable character,
.I curses
draws it in printable form using the same convention as
\fB\%wunctrl\fP(3X).
Calling \fB\%win_wch\fP(3X) on the location of a nonprintable character
does not retrieve the character itself,
but its \fB\%wunctrl\fP(3X) representation.
.PP
Adding spacing characters with \fB\%wadd_wch\fP
causes it to wrap at the right margin of the window:
.bP
If the cursor is not at the bottom of the scrolling region
and advancement occurs at the right margin,
the cursor automatically wraps to the beginning of the next line.
.bP
If the cursor is at the bottom of the scrolling region
when advancement occurs at the right margin,
and \fB\%scrollok\fP(3X) is enabled for
.IR win ,
the scrolling region scrolls up one line
and the cursor wraps as above.
Otherwise,
advancement and scrolling do not occur,
and
.B \%wadd_wch
returns
.BR ERR "."
.PP
A window's margins may coincide with the screen boundaries.
This may be a problem when
.I \%ncurses
updates the screen to match the curses window.
When their right and bottom margins coincide,
.I \%ncurses
uses different strategies to handle the variations of scrolling and wrapping
at the lower-right corner
by depending on the terminal capabilities:
.bP
If the terminal does not automatically wrap as characters
are added at the right margin
(i.e., auto right margins),
.I \%ncurses
writes the character directly.
.bP
If the terminal has auto right margins,
but also has capabilities for turning auto margins off and on,
.I \%ncurses
turns the auto margin feature off temporarily
when writing to the lower-right corner.
.bP
If the terminal has an insertion mode which can be turned off and on,
.I \%ncurses
writes the character just before the lower-right corner,
and then inserts a character to push the update into the corner.
.SS wecho_wchar
.B \%echo_wchar
and
.B \%wecho_wchar
are equivalent to calling
.RB \%( w ) add_wch
followed by
.RB \%( w ) refresh
on
.B \%stdscr
or the specified window.
.I curses
interprets these functions as a hint that only a single (complex)
character is being output;
for non-control characters,
a considerable performance gain may be enjoyed by employing them.
.\" TODO: Combine the following with the "Line Drawing" subsection of
.\" terminfo(5) and replace this with a cross reference there.
.SS "Forms-Drawing Characters"
.I curses
defines macros starting with
.B \%WACS_
that can be used with
.B \%wadd_wch
to write line-drawing and other symbols to the screen.
.I \%ncurses
terms these
.I "forms-drawing characters."
.I curses
uses the ACS default listed below if the terminal type lacks the
.B \%acs_chars
.RB \%( acsc )
capability;
that capability does not define a replacement for the character;
or if the terminal type and locale configuration
require Unicode to access these characters,
but the library is unable to use Unicode.
The \*(``acsc char\*('' column corresponds to how the characters are
specified in the
.B \%acs_chars
.RB \%( acsc )
string capability,
and the characters in it may appear on the screen if the terminal type's
database entry incorrectly advertises ACS support.
The name \*(``ACS\*('' originates in the Alternate Character Set feature
of the DEC VT100 terminal.
.PP
.ie t .ne 4v
.el .ne 5v
.TS
Lb Lb Lb Lb Lb
Lb Lb Lb Lb Lb
Lb L L L Lx.
\& Unicode ASCII acsc \&
ACS Name Default Default Char Glyph Name
Lb L L L Lw(15n)x.
\& Unicode ACS acsc \&
Symbol Default Default char Glyph Name
_
WACS_BLOCK 0x25ae # 0 T{
WACS_BLOCK U+25ae # 0 T{
solid square block
T}
WACS_BOARD 0x2592 # h board of squares
WACS_BTEE 0x2534 + v bottom tee
WACS_BULLET 0x00b7 o ~ bullet
WACS_CKBOARD 0x2592 : a T{
WACS_BOARD U+2592 # h board of squares
WACS_BTEE U+2534 + v bottom tee
WACS_BULLET U+00b7 o ~ bullet
WACS_CKBOARD U+2592 : a T{
checker board (stipple)
T}
WACS_DARROW 0x2193 v . T{
WACS_DARROW U+2193 v . T{
arrow pointing down
T}
WACS_DEGREE 0x00b0 ' f degree symbol
WACS_DIAMOND 0x25c6 + \(ga diamond
WACS_GEQUAL 0x2265 > > T{
WACS_DEGREE U+00b0 ' f degree symbol
WACS_DIAMOND U+25c6 + \(ga diamond
WACS_GEQUAL U+2265 > > T{
.if n .na \" avoid adjustment warning from groff
greater-than-or-equal-to
T}
WACS_HLINE 0x2500 \- q horizontal line
WACS_LANTERN 0x2603 # i lantern symbol
WACS_LARROW 0x2190 < , T{
WACS_HLINE U+2500 \- q horizontal line
WACS_LANTERN U+2603 # i lantern symbol
WACS_LARROW U+2190 < , T{
arrow pointing left
T}
WACS_LEQUAL 0x2264 < y T{
WACS_LEQUAL U+2264 < y T{
.if n .na \" avoid adjustment warning from groff
less-than-or-equal-to
T}
WACS_LLCORNER 0x2514 + m T{
WACS_LLCORNER U+2514 + m T{
lower left-hand corner
T}
WACS_LRCORNER 0x2518 + j T{
WACS_LRCORNER U+2518 + j T{
lower right-hand corner
T}
WACS_LTEE 0x2524 + t left tee
WACS_NEQUAL 0x2260 ! | not-equal
WACS_PI 0x03c0 * { greek pi
WACS_PLMINUS 0x00b1 # g plus/minus
WACS_PLUS 0x253c + n plus
WACS_RARROW 0x2192 > + T{
WACS_LTEE U+2524 + t left tee
WACS_NEQUAL U+2260 ! | not-equal
WACS_PI U+03c0 * { greek pi
WACS_PLMINUS U+00b1 # g plus/minus
WACS_PLUS U+253c + n plus
WACS_RARROW U+2192 > + T{
arrow pointing right
T}
WACS_RTEE 0x251c + u right tee
WACS_S1 0x23ba \- o scan line 1
WACS_S3 0x23bb \- p scan line 3
WACS_S7 0x23bc \- r scan line 7
WACS_S9 0x23bd \&_ s scan line 9
WACS_STERLING 0x00a3 f } T{
WACS_RTEE U+251c + u right tee
WACS_S1 U+23ba \- o scan line 1
WACS_S3 U+23bb \- p scan line 3
WACS_S7 U+23bc \- r scan line 7
WACS_S9 U+23bd \&_ s scan line 9
WACS_STERLING U+00a3 f } T{
.if n .na \" avoid adjustment warning from groff
pound-sterling symbol
T}
WACS_TTEE 0x252c + w top tee
WACS_UARROW 0x2191 ^ \- T{
WACS_TTEE U+252c + w top tee
WACS_UARROW U+2191 ^ \- T{
arrow pointing up
T}
WACS_ULCORNER 0x250c + l T{
WACS_ULCORNER U+250c + l T{
upper left-hand corner
T}
WACS_URCORNER 0x2510 + k T{
WACS_URCORNER U+2510 + k T{
upper right-hand corner
T}
WACS_VLINE 0x2502 | x vertical line
WACS_VLINE U+2502 | x vertical line
.TE
.PP
The wide-character configuration of \fI\%ncurses\fP also defines symbols
for thick lines (\fBacsc\fP \*(``J\*('' to \*(``V\*(''):
The
.I \%ncurses
wide API also defines symbols for thick lines
.RB \%( acsc
\*(``J\*('' through \*(``N\*('',
\*(``T\*('' through \*(``X\*('',
and \*(``Q\*(''):
.PP
.TS
Lb Lb Lb Lb Lb
Lb Lb Lb Lb Lb
Lb L L L Lx.
Lb L L L Lw(14n)x.
\& Unicode ASCII acsc \&
ACS Name Default Default Char Glyph Name
_
WACS_T_BTEE 0x253b + V T{
WACS_T_BTEE U+253b + V T{
thick tee pointing up
T}
WACS_T_HLINE 0x2501 - Q T{
WACS_T_HLINE U+2501 - Q T{
thick horizontal line
T}
WACS_T_LLCORNER 0x2517 + M T{
WACS_T_LLCORNER U+2517 + M T{
thick lower left corner
T}
WACS_T_LRCORNER 0x251b + J T{
WACS_T_LRCORNER U+251b + J T{
thick lower right corner
T}
WACS_T_LTEE 0x252b + T T{
WACS_T_LTEE U+252b + T T{
thick tee pointing right
T}
WACS_T_PLUS 0x254b + N T{
WACS_T_PLUS U+254b + N T{
thick large plus
T}
WACS_T_RTEE 0x2523 + U T{
WACS_T_RTEE U+2523 + U T{
thick tee pointing left
T}
WACS_T_TTEE 0x2533 + W T{
WACS_T_TTEE U+2533 + W T{
thick tee pointing down
T}
WACS_T_ULCORNER 0x250f + L T{
WACS_T_ULCORNER U+250f + L T{
thick upper left corner
T}
WACS_T_URCORNER 0x2513 + K T{
WACS_T_URCORNER U+2513 + K T{
thick upper right corner
T}
WACS_T_VLINE 0x2503 | X T{
WACS_T_VLINE U+2503 | X T{
thick vertical line
T}
.TE
.PP
and for double-lines (\fBacsc\fP \*(``A\*('' to \*(``I\*(''):
and for double lines
.RB \%( acsc
\*(``A\*('' through \*(``I\*('',
plus \*(``R\*('' and \*(``Y\*(''):
.PP
.TS
Lb Lb Lb Lb Lb
Lb Lb Lb Lb Lb
Lb L L L Lx.
Lb L L L Lw(14n)x.
\& Unicode ASCII acsc \&
ACS Name Default Default Char Glyph Name
_
WACS_D_BTEE 0x2569 + H T{
WACS_D_BTEE U+2569 + H T{
double tee pointing up
T}
WACS_D_HLINE 0x2550 - R T{
WACS_D_HLINE U+2550 - R T{
double horizontal line
T}
WACS_D_LLCORNER 0x255a + D T{
WACS_D_LLCORNER U+255a + D T{
double lower left corner
T}
WACS_D_LRCORNER 0x255d + A T{
WACS_D_LRCORNER U+255d + A T{
double lower right corner
T}
WACS_D_LTEE 0x2560 + F T{
WACS_D_LTEE U+2560 + F T{
double tee pointing right
T}
WACS_D_PLUS 0x256c + E T{
WACS_D_PLUS U+256c + E T{
double large plus
T}
WACS_D_RTEE 0x2563 + G T{
WACS_D_RTEE U+2563 + G T{
double tee pointing left
T}
WACS_D_TTEE 0x2566 + I T{
WACS_D_TTEE U+2566 + I T{
double tee pointing down
T}
WACS_D_ULCORNER 0x2554 + C T{
WACS_D_ULCORNER U+2554 + C T{
double upper left corner
T}
WACS_D_URCORNER 0x2557 + B T{
WACS_D_URCORNER U+2557 + B T{
double upper right corner
T}
WACS_D_VLINE 0x2551 | Y T{
WACS_D_VLINE U+2551 | Y T{
double vertical line
T}
.TE
@@ -291,26 +503,36 @@ U+2501 BOX DRAWINGS HEAVY HORIZONTAL
.bP
U+2550 BOX DRAWINGS DOUBLE HORIZONTAL
.SH RETURN VALUE
All routines return the integer \fBERR\fP upon failure and \fBOK\fP on success.
These functions return
.B OK
on success and
.B ERR
on failure.
.PP
X/Open Curses does not specify any error conditions.
This implementation returns an error
In
.IR \%ncurses ,
these functions fail if
.bP
if the window pointer is null or
the
.I curses
screen has not been initialized,
.bP
if it is not possible to add a complete character in the window.
.PP
The latter may be due to different causes:
(for functions taking a
.I \%WINDOW
pointer argument)
.I win
is a null pointer,
.bP
If \fB\%scrollok\fP(3X) is not enabled,
writing a character at the lower right margin succeeds.
However,
an error is returned because it is not possible to wrap to a new line.
wrapping to a new line is impossible because \fB\%scrollok\fP(3X) has
not been called on
.I win
(or
.BR \%stdscr ","
as applicable)
when writing to its bottom right location is attempted,
or
.bP
If an error is detected when converting a multibyte character to a sequence
of bytes,
or if it is not possible to add all of the resulting bytes in the window,
an error is returned.
it is not possible to add a complete character at the cursor position.
.PP
Functions prefixed with \*(``mv\*('' first perform cursor movement and
fail if the position
@@ -318,78 +540,155 @@ fail if the position
.IR x )
is outside the window boundaries.
.SH NOTES
Note that
\fBadd_wch\fP,
\fBmvadd_wch\fP,
\fBmvwadd_wch\fP, and
\fBecho_wchar\fP
may be macros.
.BR add_wch ","
.BR mvadd_wch ","
.BR mvwadd_wch ","
and
.B echo_wchar
may be implemented as macros.
.SH EXTENSIONS
The symbols
.IR \%WACS_S3 ","
.IR \%WACS_S7 ","
.IR \%WACS_LEQUAL ","
.IR \%WACS_GEQUAL ","
.IR \%WACS_PI ","
.IR \%WACS_NEQUAL ","
and
.I \%WACS_STERLING
are not standard.
However,
many publicly available
.I \%term\%info
entries include
.B \%acs_chars
.RB \%( acsc )
capabilities in which their key characters
.RB ( pryz{|} )
are embedded,
and a second-hand list of their character descriptions has come to
light.
The
.I \%ncurses
developers invented WACS-prefixed names for them.
.\" in v5_2_20020209
.SH PORTABILITY
These functions are described in X/Open Curses, Issue 4.
The defaults specified for line-drawing characters apply in the POSIX locale.
.SS "WACS Symbols"
Applications employing
.I \%ncurses
extensions should condition their use on the visibility of the
.B \%NCURSES_VERSION
preprocessor macro.
.PP
These functions are described in X/Open Curses Issue\ 4.
It specifies no error conditions for them.
.PP
The defaults specified for forms-drawing characters apply in the POSIX
locale.
X/Open Curses makes it clear that the WACS_ symbols should be defined as
a pointer to \fBcchar_t\fP data, e.g., in the discussion of \fBborder_set\fP.
a pointer to
.I \%cchar_t
data, e.g., in the discussion of
.IR \%border_set "."
A few implementations are problematic:
.bP
NetBSD curses defines the symbols as a \fBwchar_t\fP within a \fBcchar_t\fP.
NetBSD
.I curses
defines the symbols as a
.I \%wchar_t
within a
.IR \%cchar_t "."
.bP
HP-UX curses equates some of the \fBACS_\fP symbols
to the analogous \fBWACS_\fP symbols as if the \fBACS_\fP symbols were
HP-UX
.I curses
equates some of the
.I \%ACS_
symbols to the analogous
.I \%WACS_
symbols as if the
.I \%ACS_
symbols were
wide characters.
The misdefined symbols are the arrows
and other symbols which are not used for line-drawing.
.PP
X/Open Curses does not specify symbols for thick- or double-lines.
SVr4 curses implementations defined their line-drawing symbols in
terms of intermediate symbols.
This implementation extends those symbols, providing new definitions
which are not in the SVr4 implementations.
SVr4
.I curses
implementations defined their line-drawing symbols
in terms of intermediate symbols.
.I \%ncurses
extends those symbols,
providing new definitions not found in SVr4 implementations.
.PP
Not all Unicode-capable terminals provide support for VT100-style
alternate character sets (i.e., the \fBacsc\fP capability),
alternate character sets (i.e., the
.I \%acsc_chars
.RB ( acsc )
capability),
with their corresponding line-drawing characters.
X/Open Curses did not address the aspect of integrating Unicode with
line-drawing characters.
Existing implementations of Unix curses (AIX, HP-UX, Solaris)
use only the \fBacsc\fP character-mapping to provide this feature.
As a result, those implementations can only use single-byte line-drawing
characters.
\fI\%ncurses\fP 5.3 (2002) provided a table of Unicode values to solve
Existing implementations of System\ V
.I curses
(AIX, HP-UX, Solaris)
use only the
.I \%acsc_chars
.RB ( acsc )
character-mapping to provide this feature.
As a result,
those implementations can use only single-byte line-drawing characters.
.I \%ncurses
5.3 (2002) provided a table of Unicode values to solve
these problems.
NetBSD curses incorporated that table in 2010.
NetBSD
.I curses
incorporated that table in 2010.
.PP
In this implementation, the Unicode values are used instead of the
terminal description's \fBacsc\fP mapping as discussed in
.I \%ncurses
uses the Unicode values instead of the terminal type description's
.I \%acsc_chars
.RB ( acsc )
mapping as discussed in
\fB\%ncurses\fP(3X) for the environment variable
\fINCURSES_NO_UTF8_ACS\fP.
.IR \%NCURSES_NO_UTF8_ACS "."
In contrast, for the same cases, the line-drawing characters
described in \fB\%addch\fP(3X) will use only the ASCII default values.
.PP
Having Unicode available does not solve all of the problems with
line-drawing for curses:
line-drawing for
.IR curses ":"
.bP
The closest Unicode equivalents to the
VT100 graphics \fIS1\fP, \fIS3\fP, \fIS7\fP and \fIS9\fP
VT100 graphics
.IR S1 ","
.IR S3 ","
.IR S7 ","
and
.I S9
frequently are not displayed at
the regular intervals which the terminal used.
.bP
The \fIlantern\fP is a special case.
The
.I lantern
is a special case.
It originated with the AT&T 4410 terminal in the early 1980s.
There is no accessible documentation depicting the lantern symbol
on the AT&T terminal.
.IP
Lacking documentation, most readers assume that a \fIstorm lantern\fP
Lacking documentation, most readers assume that a
.I "storm lantern"
was intended.
But there are several possibilities, all with problems.
.IP
Unicode 6.0 (2010) does provide two lantern symbols: U+1F383 and U+1F3EE.
Those were not available in 2002, and are irrelevant since
they lie outside the BMP and as a result are not generally available
in terminals.
Those were not available in 2002,
and are irrelevant since they lie outside the Basic Multilingual Plane
and as a result are unavailable on many terminals.
They are not storm lanterns, in any case.
.IP
Most \fIstorm lanterns\fP have a tapering glass chimney
Most
.I "storm lanterns"
have a tapering glass chimney
(to guard against tipping);
some have a wire grid protecting the chimney.
.IP
@@ -406,32 +705,77 @@ Others have suggested these alternatives:
\[u256C] U+256C (forms double vertical and horizontal), and
\[u2612] U+2612 (ballot box with x).
.SS "Complex Characters"
The complex character type \fBcchar_t\fR
can store more than one wide character (\fBwchar_t\fR).
The X/Open Curses description does not mention this possibility,
describing only the cases where \fIwch\fP is a spacing character
or a non-spacing character.
The complex character type
.I \%cchar_t
can store more than one wide character
.RI \%( wchar_t ).
X/Open Curses does not mention this possibility,
specifying behavior only where
.I wch
is a single character,
either spacing or non-spacing.
.PP
This implementation assumes that \fIwch\fP is constructed using
\fB\%setcchar\fP(3X), and in turn that the result
.I \%ncurses
assumes that
.I wch
is constructed using \fB\%setcchar\fP(3X),
and in turn that the result
.bP
contains at most one spacing character in the beginning of its list of wide
characters,
and zero or more non-spacing characters
contains at most one spacing character at the beginning of its list of
wide characters,
and zero or more non-spacing characters,
or
.bP
may hold one non-spacing character.
holds one non-spacing character.
.PP
In the latter case,
\fI\%ncurses\fP adds the non-spacing character to the active
(base) spacing character.
.SS TABSIZE
The
.B TABSIZE
variable is implemented in SVr4 and other versions of
.IR curses ,
but is not specified by X/Open Curses
(see \fBcurs_variables\fP(3X)).
.I \%ncurses
adds the non-spacing character to the active complex character.
.SH HISTORY
X/Open Curses Issue\ 4 (1995) initially specified these functions.
The System\ V Interface Definition (SVID) Version\ 4
of the same year
specified functions named
.I \%waddwch
(and the usual variants),
.IR \%echowchar ","
and
.IR \%wechowchar "."
.\" SVID 4, vol 3., p. 475
These were later additions to
.RI SVr4. x ,
not appearing in the first SVr4 (1989).
They differed from X/Open's later
.I \%wadd_wch
and
.I \%wecho_wchar
in that they each took an argument of type
.I \%wchar_t
instead of
.IR \%cchar_t "."
SVID defined no
.I \% WACS_
symbols.
.PP
X/Open Curses Issue\ 4 also defined many of the
.I WACS_
constants,
excepting
.IR \%WACS_GEQUAL ","
.IR \%WACS_LEQUAL ","
.IR \%WACS_NEQUAL ","
.IR \%WACS_PI ","
.IR \%WACS_S3 ","
.IR \%WACS_S7 ","
and
.IR \%WACS_STERLING ";"
and those for drawing thick and double lines.
.PP
.I \%ncurses
5.3 (2002)
furnished the remaining
.I WACS_
constants.
.SH SEE ALSO
\fB\%curs_addch\fP(3X) describes comparable functions of the
.I \%ncurses
@@ -441,6 +785,7 @@ library in its non-wide-character configuration.
\fB\%curs_addwstr\fP(3X),
\fB\%curs_add_wchstr\fP(3X),
\fB\%curs_attr\fP(3X),
\fB\%curs_bkgrnd\fP(3X),
\fB\%curs_clear\fP(3X),
\fB\%curs_getcchar\fP(3X),
\fB\%curs_outopts\fP(3X),
+93 -46
View File
@@ -1,5 +1,5 @@
.\"***************************************************************************
.\" Copyright 2019-2023,2024 Thomas E. Dickey *
.\" Copyright 2019-2024,2025 Thomas E. Dickey *
.\" Copyright 2002-2012,2017 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@@ -27,8 +27,8 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: curs_add_wchstr.3x,v 1.39 2024/04/20 21:20:07 tom Exp $
.TH curs_add_wchstr 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.\" $Id: curs_add_wchstr.3x,v 1.61 2025/10/21 00:06:34 tom Exp $
.TH curs_add_wchstr 3X 2025-10-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
@@ -46,68 +46,91 @@
..
.SH NAME
\fB\%add_wchstr\fP,
\fB\%add_wchnstr\fP,
\fB\%wadd_wchstr\fP,
\fB\%wadd_wchnstr\fP,
\fB\%mvadd_wchstr\fP,
\fB\%mvadd_wchnstr\fP,
\fB\%mvwadd_wchstr\fP,
\fB\%add_wchnstr\fP,
\fB\%wadd_wchnstr\fP,
\fB\%mvadd_wchnstr\fP,
\fB\%mvwadd_wchnstr\fP \-
add a \fIcurses\fR complex character string to a window
.SH SYNOPSIS
.nf
\fB#include <curses.h>
.PP
\fBint add_wchstr(const cchar_t *\fIwchstr\fP);
\fBint wadd_wchstr(WINDOW * \fIwin\fP, const cchar_t *\fIwchstr\fP);
\fBint mvadd_wchstr(int \fIy\fP, int \fIx\fP, const cchar_t *\fIwchstr\fP);
\fBint mvwadd_wchstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const cchar_t *\fIwchstr\fP);
\fBint add_wchstr(const cchar_t * \fIwchstr\fP);
\fBint wadd_wchstr(WINDOW * \fIwin\fP, const cchar_t * \fIwchstr\fP);
\fBint mvadd_wchstr(int \fIy\fP, int \fIx\fP, const cchar_t * \fIwchstr\fP);
\fBint mvwadd_wchstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, const cchar_t * \fIwchstr\fP);
.PP
\fBint add_wchnstr(const cchar_t *\fIwchstr\fP, int \fIn\fP);
\fBint wadd_wchnstr(WINDOW * \fIwin\fP, const cchar_t *\fIwchstr\fP, int \fIn\fP);
\fBint mvadd_wchnstr(int \fIy\fP, int \fIx\fP, const cchar_t *\fIwchstr\fP, int \fIn\fP);
\fBint mvwadd_wchnstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const cchar_t *\fIwchstr\fP, int \fIn\fP);
\fBint add_wchnstr(const cchar_t * \fIwchstr\fP, int \fIn\fP);
\fBint wadd_wchnstr(WINDOW * \fIwin\fP, const cchar_t * \fIwchstr\fP, int \fIn\fP);
\fBint mvadd_wchnstr(int \fIy\fP, int \fIx\fP, const cchar_t * \fIwchstr\fP, int \fIn\fP);
\fBint mvwadd_wchnstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP,
const cchar_t * \fIwchstr\fP, int \fIn\fP);
.fi
.SH DESCRIPTION
These functions copy the (null-terminated)
array of complex characters \fIwchstr\fP
into the window image structure
starting at the current cursor position.
.B \%wadd_wchstr
copies the string of complex characters
.I \%wchstr
to the window
.IR win "."
A null complex character terminates the string.
If a complex character does not completely fit at the end of the line,
.I curses
fills its remaining cells with the window's background character;
see \fB\%bkgrnd\fP(3X).
.B \%wadd_wchnstr
does the same,
but copies at most
.I n
characters,
or as many as possible if
.I n
is
.BR \-1 "."
\fB\%ncurses\fP(3X) describes the variants of these functions.
.PP
The four functions with \fIn\fP as the last
argument copy at most \fIn\fP elements,
but no more than will fit on the line.
If \fBn\fP=\fB\-1\fP then the whole array is copied,
to the maximum number of characters that will fit on the line.
.PP
The window cursor is \fInot\fP advanced.
These functions are faster than \fBwaddnstr\fP.
On the other hand:
Because these functions do not call \fB\%wadd_wch\fP(3X) internally,
they are faster than \fB\%waddwstr\fP(3X) and \fB\%waddnwstr\fP(3X).
On the other hand,
they
.bP
they do not perform checking
(such as for the newline, backspace, or carriage return characters),
do not treat the backspace,
carriage return,
or line feed characters specially;
.bP
they do not advance the current cursor position,
do not represent unprintable characters with \fB\%wunctrl\fP(3X);
.bP
they do not expand other control characters to ^-escapes, and
do not update the cursor position to follow the last character written;
and
.bP
they truncate the string if it crosses the right margin,
rather than wrapping it around to the new line.
.PP
These functions end successfully
on encountering a null \fBcchar_t\fP, or
when they have filled the current line.
If a complex character cannot completely fit at the end of the current line,
the remaining columns are filled with the background character and rendition.
truncate the string at the window's right margin,
rather than wrapping it to the next line and potentially scrolling.
.SH RETURN VALUE
All functions return the integer \fBERR\fP upon failure and \fBOK\fP on success.
These functions return
.B OK
on success and
.B ERR
on failure.
.PP
X/Open Curses does not specify any error conditions.
This implementation returns an error
In
.IR \%ncurses ","
these functions fail if
.bP
if the \fIwin\fP parameter is null or
the
.I curses
screen has not been initialized,
.bP
if the \fIwchstr\fP parameter is null.
.I wchstr
is a null pointer,
or
.bP
(for functions taking a
.I \%WINDOW
pointer argument)
.I win
is a null pointer.
.PP
Functions prefixed with \*(``mv\*('' first perform cursor movement and
fail if the position
@@ -115,9 +138,33 @@ fail if the position
.IR x )
is outside the window boundaries.
.SH NOTES
All functions except \fBwadd_wchnstr\fP may be macros.
All of these functions except
.B \%wadd_wchnstr
may be implemented as macros.
.SH PORTABILITY
These functions are described in X/Open Curses, Issue 4.
X/Open Curses Issue\ 4 describes these functions.
It specifies no error conditions for them.
.SH HISTORY
X/Open Curses Issue\ 4 (1995) initially specified these functions.
The System\ V Interface Definition Version\ 4
of the same year
specified functions named
.I \%waddwchstr
and
.I \%waddwchnstr
(and the usual variants).
.\" SVID 4, vol 3., p. 477
These were later additions to
.RI SVr4. x ,
not appearing in the first SVr4 (1989).
They differed from X/Open's later
.I \%wadd_wchstr
and
.I \%wadd_wchnstr
in that they each took an argument of type
.I \%wchar_t
instead of
.IR \%cchar_t "."
.SH SEE ALSO
\fB\%curs_addchstr\fP(3X) describes comparable functions of the
.I \%ncurses
+369 -160
View File
@@ -1,6 +1,6 @@
'\" t
.\"***************************************************************************
.\" Copyright 2018-2023,2024 Thomas E. Dickey *
.\" Copyright 2018-2024,2025 Thomas E. Dickey *
.\" Copyright 1998-2015,2017 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@@ -28,8 +28,8 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: curs_addch.3x,v 1.85 2024/04/20 19:03:47 tom Exp $
.TH curs_addch 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.\" $Id: curs_addch.3x,v 1.144 2025/11/12 01:04:12 tom Exp $
.TH curs_addch 3X 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
@@ -64,33 +64,91 @@ add a \fIcurses\fP character to a window and advance the cursor
\fB#include <curses.h>
.PP
\fBint addch(const chtype \fIch\fP);
\fBint waddch(WINDOW *\fIwin\fP, const chtype \fIch\fP);
\fBint waddch(WINDOW * \fIwin\fP, const chtype \fIch\fP);
\fBint mvaddch(int \fIy\fP, int \fIx\fP, const chtype \fIch\fP);
\fBint mvwaddch(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const chtype \fIch\fP);
\fBint mvwaddch(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, const chtype \fIch\fP);
.PP
\fBint echochar(const chtype \fIch\fP);
\fBint wechochar(WINDOW *\fIwin\fP, const chtype \fIch\fP);
\fBint wechochar(WINDOW * \fIwin\fP, const chtype \fIch\fP);
.PP
\fI/* (integer) constants */\fP
/*\fI .\|.\|. */ \fBACS_BLOCK;\fR
/*\fI .\|.\|. */ \fBACS_BOARD;\fR
/*\fI .\|.\|. */ \fBACS_BTEE;\fR
/*\fI .\|.\|. */ \fBACS_BULLET;\fR
/*\fI .\|.\|. */ \fBACS_CKBOARD;\fR
/*\fI .\|.\|. */ \fBACS_DARROW;\fR
/*\fI .\|.\|. */ \fBACS_DEGREE;\fR
/*\fI .\|.\|. */ \fBACS_DIAMOND;\fR
/*\fI .\|.\|. */ \fBACS_HLINE;\fR
/*\fI .\|.\|. */ \fBACS_LANTERN;\fR
/*\fI .\|.\|. */ \fBACS_LARROW;\fR
/*\fI .\|.\|. */ \fBACS_LLCORNER;\fR
/*\fI .\|.\|. */ \fBACS_LRCORNER;\fR
/*\fI .\|.\|. */ \fBACS_LTEE;\fR
/*\fI .\|.\|. */ \fBACS_PLMINUS;\fR
/*\fI .\|.\|. */ \fBACS_PLUS;\fR
/*\fI .\|.\|. */ \fBACS_RARROW;\fR
/*\fI .\|.\|. */ \fBACS_RTEE;\fR
/*\fI .\|.\|. */ \fBACS_S1;\fR
/*\fI .\|.\|. */ \fBACS_S9;\fR
/*\fI .\|.\|. */ \fBACS_TTEE;\fR
/*\fI .\|.\|. */ \fBACS_UARROW;\fR
/*\fI .\|.\|. */ \fBACS_ULCORNER;\fR
/*\fI .\|.\|. */ \fBACS_URCORNER;\fR
/*\fI .\|.\|. */ \fBACS_VLINE;\fR
\fI/* extensions */\fP
/*\fI .\|.\|. */ \fBACS_GEQUAL;\fR
/*\fI .\|.\|. */ \fBACS_LEQUAL;\fR
/*\fI .\|.\|. */ \fBACS_NEQUAL;\fR
/*\fI .\|.\|. */ \fBACS_PI;\fR
/*\fI .\|.\|. */ \fBACS_S3;\fR
/*\fI .\|.\|. */ \fBACS_S7;\fR
/*\fI .\|.\|. */ \fBACS_STERLING;\fR
.fi
.SH DESCRIPTION
.SS "Adding Characters"
.SS waddch
.B \%waddch
puts the character
writes the
.I curses
character
.I ch
at the cursor position of window
.IR win ,
to the window
.IR win ","
then advances the cursor position,
analogously to the standard C library's \fI\%putchar\fP(3).
\fB\%ncurses\fP(3X) describes the variants of this function.
.PP
If advancement occurs at the right margin,
.bP
the cursor automatically wraps to the beginning of the next line;
and
.bP
at the bottom of the current scrolling region,
and if \fB\%scrollok\fP(3X) is enabled for
.IR win ,
the scrolling region scrolls up one line.
Construct a
.I curses
character
from a
.I char
by assignment or typecast.
Subsection \*(``Video Attributes\*('' of \fB\%attron\fP(3X) describes
how to manipulate its attributes and color pair.
(A color pair selection is not honored unless initialized;
see \fB\%start_color\fP(3X).)
.PP
The object or expression
.I ch
may contain attributes and/or a color pair identifier.
(A
.I \%chtype
can be copied from place to place using \fB\%winch\fP(3X) and
.BR \%waddch .)
.I curses
defines constants to aid the manipulation of character attributes;
see \fB\%curs_attr\fP(3X).
A
.I ch
whose character component is a space,
and whose only attribute is
.BR \%A_NORMAL ,
is a
.IR "blank character" ","
and therefore combines with the window's background character;
see \fB\%curs_bkgd\fP(3X).
.PP
If
.I ch
@@ -106,18 +164,16 @@ Backspace moves the cursor one character left;
at the left margin of a window,
it does nothing.
.bP
Carriage return moves the cursor to the left margin on the current line
of the window.
Carriage return moves the cursor to the left margin on the same line of
the window.
.bP
Line feed does a \fB\%clrtoeol\fP(3X),
then moves the cursor to the left margin on the next line of the window,
and if \fB\%scrollok\fP(3X) is enabled for
.IR win ,
scrolls the window if the cursor was already on the last line.
then advances as if from the right margin.
.bP
Tab advances the cursor to the next tab stop
(possibly on the next line);
these are placed at every eighth column by default.
.IP
Alter the tab interval with the
.B \%TABSIZE
extension;
@@ -126,33 +182,74 @@ see \fB\%curs_variables\fP(3X).
If
.I ch
is any other nonprintable character,
it is drawn in printable form,
using the same convention as \fB\%unctrl\fP(3X).
.PP
.I curses
draws it in printable form using the same convention as
\fB\%unctrl\fP(3X).
Calling \fB\%winch\fP(3X) on the location of a nonprintable character
does not return the character itself,
but its \fB\%unctrl\fP(3X) representation.
.PP
.I ch
may contain rendering and/or color attributes,
and others can be combined with the parameter
by logically \*(``or\*(''ing with it.
(A character with its attributes can be copied from place to place
using \fB\%winch\fP(3X) and
.BR \%waddch .)
See \fB\%curs_attr\fP(3X) for values of predefined video attribute
constants that can be usefully \*(``or\*(''ed with characters.
.SS "Echoing Characters"
Adding printable characters with \fB\%waddch\fP
causes it to wrap at the right margin of the window:
.bP
If the cursor is not at the bottom of the scrolling region
and advancement occurs at the right margin,
the cursor automatically wraps to the beginning of the next line.
.bP
If the cursor is at the bottom of the scrolling region
when advancement occurs at the right margin,
and \fB\%scrollok\fP(3X) is enabled for
.IR win ,
the scrolling region scrolls up one line
and the cursor wraps as above.
Otherwise,
advancement and scrolling do not occur,
and
.B \%waddch
returns
.BR ERR "."
.PP
A window's margins may coincide with the screen boundaries.
This may be a problem when
.I \%ncurses
updates the screen to match the curses window.
When their right and bottom margins coincide,
.I \%ncurses
uses different strategies to handle the variations of scrolling and wrapping
at the lower-right corner
by depending on the terminal capabilities:
.bP
If the terminal does not automatically wrap as characters
are added at the right margin
(i.e., auto right margins),
.I \%ncurses
writes the character directly.
.bP
If the terminal has auto right margins,
but also has capabilities for turning auto margins off and on,
.I \%ncurses
turns the auto margin feature off temporarily
when writing to the lower-right corner.
.bP
If the terminal has an insertion mode which can be turned off and on,
.I \%ncurses
writes the character just before the lower-right corner,
and then inserts a character to push the update into the corner.
.SS wechochar
.B \%echochar
and
.B \%wechochar
are equivalent to calling
.RB \%( w ) addch
followed by
.RB \%( w ) refresh .
.RB \%( w ) refresh
on
.B \%stdscr
or the specified window.
.I curses
interprets these functions as a hint that only a single character is
being output;
interprets these functions as a hint to its optimizer
that only a single character cell in the window
is being altered between refreshes;
for non-control characters,
a considerable performance gain may be enjoyed by employing them.
.\" TODO: Combine the following with the "Line Drawing" subsection of
@@ -163,26 +260,31 @@ defines macros starting with
.B \%ACS_
that can be used with
.B \%waddch
to write line-drawing and other special characters to the screen.
to write line-drawing and other symbols to the screen.
.I \%ncurses
terms these
.I "forms-drawing characters."
The ACS default listed below is used if the
.I curses
uses the ACS default listed below if the terminal type lacks the
.B \%acs_chars
.RB ( \%acsc )
.I \%term\%info
capability does not define a terminal-specific replacement for it,
or if the terminal and locale configuration requires Unicode to access
these characters but the library is unable to use Unicode.
.RB \%( acsc )
capability;
that capability does not define a replacement for the character;
or if the terminal type and locale configuration
require Unicode to access these characters,
but the library is unable to use Unicode.
The \*(``acsc char\*('' column corresponds to how the characters are
specified in the
.B \%acs_chars
.RB \%( acsc )
string capability,
and the characters in it may appear on the screen if the terminal's
and the characters in it may appear on the screen if the terminal type's
database entry incorrectly advertises ACS support.
The name \*(``ACS\*('' originates in the Alternate Character Set feature
of the DEC VT100 terminal.
.PP
.ie t .ne 4v
.el .ne 5v
.TS
Lb Lb Lb Lb
Lb Lb Lb Lb
@@ -232,26 +334,40 @@ on failure.
.PP
In
.IR \%ncurses ,
.B \%waddch
returns
.B ERR
if it is not possible to add a complete character at the cursor
position,
as when conversion of a multibyte character to a byte sequence fails,
or at least one of the resulting bytes cannot be added to the window.
these functions fail if
.bP
the
.I curses
screen has not been initialized,
.bP
(for functions taking a
.I \%WINDOW
pointer argument)
.I win
is a null pointer,
.bP
wrapping to a new line is impossible because \fB\%scrollok\fP(3X) has
not been called on
.I win
(or
.BR \%stdscr ","
as applicable)
when a write to its bottom right location is attempted,
or
.bP
it is not possible to add a complete character at the cursor position.
.PP
The last may be due to different causes:
.bP
conversion of a wide character to a multibyte character sequence can
fail,
or
.bP
at least one of the bytes resulting from wide character conversion to a
multibyte character sequence cannot be added to the window.
See section \*(``PORTABILITY\*('' below regarding the use of
.B \%waddch
with multibyte characters.
.PP
.B \%waddch
can successfully write a character at the bottom right location of the
window.
However,
.I \%ncurses
returns
.B ERR
if \fB\%scrollok\fP(3X) is not enabled in that event,
because it is not possible to wrap to a new line.
with wide characters.
.PP
Functions prefixed with \*(``mv\*('' first perform cursor movement and
fail if the position
@@ -259,69 +375,163 @@ fail if the position
.IR x )
is outside the window boundaries.
.SH NOTES
.BR \%addch ,
.BR \%mvaddch ,
.BR \%mvwaddch ,
.BR \%addch ","
.BR \%mvaddch ","
.BR \%mvwaddch ","
and
.B \%echochar
may be implemented as macros.
.SH EXTENSIONS
The symbols
.IR \%ACS_S3 ","
.IR \%ACS_S7 ","
.IR \%ACS_LEQUAL ","
.IR \%ACS_GEQUAL ","
.IR \%ACS_PI ","
.IR \%ACS_NEQUAL ","
and
.I \%ACS_STERLING
were not documented in any publicly released System\ V
.\" And did not exist yet as late as SVr4.
.\" https://github.com/ryanwoodsmall/oldsysv/blob/master/\
.\" sysvr4/svr4/lib/xlibcurses/screen/curses.ed
and are not standard.
However,
many publicly available
.I \%term\%info
entries include
.B \%acs_chars
.RB \%( acsc )
capabilities in which their key characters
.RB ( pryz{|} )
are embedded,
and a second-hand list of their character descriptions has come to light,
which identifies them as VT100 special characters.
.PP
The DEC Special Character and Line Drawing Set (VT100) is indexed by
an ASCII character in the range 96 (`) to 126 (~).
That index character is part of the definition for the curses
.B \%ACS_
symbols.
The VT100 special characters can be categorized in three groups:
.bP
useful graphic symbols with a standard
.B \%ACS_
symbol,
(e.g., the line-drawing symbols),
.bP
possibly useful characters (these non-standard symbols),
.bP
representations of control characters (e.g., newline and vertical tabulation).
.PP
A few
.B \%ACS_
symbols do not fit into DEC's VT100 scheme.
The AT&T Teletype 5410v1 arrow symbols and
.B \%ACS_BLOCK
use indices outside the range 96 to 126.
Two of the Teletype symbols use indices in that range,
with different meaning versus the VT100:
.bP
.B \%ACS_BOARD
corresponds to the VT100 symbol for newline
.bP
.B \%ACS_LANTERN
corresponds to the VT100 symbol for vertical tabulation
.PP
AT&T defined
.B \%ACS_
names for the most useful graphic symbols,
as well as for its own.
Its header file commented:
.PP
.EX
.nf
.\" Fill at 65 columns in your editor.
/*
* Standard alternate character set. The current ACS world is
* evolving, so we support only a widely available subset: the
* line drawing characters from the VT100, plus a few from the
* Teletype 5410v1. Eventually there may be support of more
* sophisticated ACS line drawing, such as that in the Teletype
* 5410, the HP line drawing set, and the like. There may be
* support for some non line oriented characters as well.
*
* Line drawing ACS names are of the form ACS_trbl, where t is
* the top, r is the right, b is the bottom, and l is the left.
* t, r, b, and l might be B (blank), S (single), D (double), or
* T (thick). The subset defined here only uses B and S.
*/
.fi
.EE
.PP
Although these less-useful graphic symbols were not given names,
they were used in
.I \%terminfo
entries.
The
.I \%ncurses
developers invented ACS-prefixed names for them.
.\" in v1_9_5_950928_e227
.SH PORTABILITY
X/Open Curses,
Issue 4 describes these functions.
Applications employing
.I \%ncurses
extensions should condition their use on the visibility of the
.B \%NCURSES_VERSION
preprocessor macro.
.PP
X/Open Curses Issue\ 4 describes these functions.
It specifies no error conditions for them.
.PP
SVr4
.I curses
describes a successful return value only as
SVr4 describes a successful return value only as
\*(``an integer value other than
.BR ERR \*(''.
.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 472
.PP
The defaults specified for forms-drawing characters apply in the POSIX
locale.
.SS "ACS Symbols"
X/Open Curses states that the
.B \%ACS_
.I \%ACS_
definitions are
.I char
constants.
.PP
Some implementations are problematic.
.bP
Solaris
.IR curses ,
for example,
define the ACS symbols as constants;
defines the ACS symbols as constants;
others define them as elements of an array.
.IP
This implementation uses an array,
.BR \%acs_map ,
as did SVr4
.IR curses .
NetBSD also uses an array,
SVr4 used an array,
.IR \%acs_map ,
as does
.IR \%ncurses "."
NetBSD
.I curses
also uses an array,
actually named
.BR \%_acs_char ,
with a
.B \%#define
for compatibility.
.IR \%_acs_char ,
with a \%\*(``#define\*('' for compatibility.
.bP
HP-UX
.I curses
equates some of the
.B \%ACS_
.I \%ACS_
symbols to the analogous
.B \%WACS_
.I \%WACS_
symbols as if the
.B \%ACS_
.I \%ACS_
symbols were wide characters
(see \fB\%curs_add_wch\fP(3X)).
The misdefined symbols are the arrows and others that are not used for
line drawing.
.bP
X/Open Curses
(Issues 2 through 7)
(Issues\ 2 through 7)
has a typographical error
for the
.B \%ACS_LANTERN
.I \%ACS_LANTERN
symbol, equating its \*(``VT100+ Character\*('' to \*(``I\*(''
(capital I),
while the header files for SVr4
@@ -341,39 +551,16 @@ its
(AT&T PC6300 with EMOTS Terminal Emulator)
description uses lowercase i.
.PP
Some ACS symbols
.RB ( \%ACS_S3 ,
.BR \%ACS_S7 ,
.BR \%ACS_LEQUAL ,
.BR \%ACS_GEQUAL ,
.BR \%ACS_PI ,
.BR \%ACS_NEQUAL ,
and
.BR \%ACS_STERLING )
were not documented in any publicly released System\ V.
However,
many publicly available
.I \%term\%info
entries include
.B \%acsc
strings in which their key characters
.BR ( pryz{|} )
are embedded,
and a second-hand list of their character descriptions has come to
light.
The
.I \%ncurses
developers invented ACS-prefixed names for them.
.PP
The
.I displayed
values of
.B \%ACS_
.I \%ACS_
constants depend on
.bP
the
.I \%ncurses
ABI\(emfor example,
ABI \(em
for example,
wide-character versus non-wide-character configurations
(the former is capable of displaying Unicode while the latter is not),
and
@@ -386,89 +573,111 @@ the terminal is unable to display forms-drawing characters
by using UTF-8;
see the discussion of the
.I \%NCURSES_NO_UTF8_ACS
environment variable in \fB\%ncurses\fP(3X)).
environment variable in \fB\%ncurses\fP(3X).
.SS "Character Set"
X/Open Curses assumes that the parameter passed to
.B \%waddch
.I \%waddch
contains a single character.
As discussed in \fB\%curs_attr\fP(3X),
that character may have been more than eight bits wide in an SVr3 or
That character may have been more than eight bits wide in an SVr3 or
SVr4 implementation,
but in the X/Open Curses model,
the details are not given.
The important distinction between SVr4
.I curses
and X/Open Curses is that the latter separates non-character information
(attributes and color)
from the character code,
which SVr4 packs into a
but X/Open Curses leaves the width of a non-wide character code
unspecified.
The standard further does not specify the internal structure of a
.IR chtype ","
though the use of bitwise operators to combine the character code with
attributes and a color pair identifier into a
.I \%chtype
for passage to
.BR \%waddch .
.I \%waddch
is common.
A portable application uses only the macros discussed in
\fB\%curs_attr\fP(3X) to manipulate a
.IR \%chtype "."
.PP
In
.IR \%ncurses ,
.I \%chtype
holds an eight-bit character.
But the library allows a multibyte character to be passed in a
holds an eight-bit character,
but the library allows a multibyte character sequence to be passed via a
succession of calls to
.BR \%waddch .
.IR \%waddch "."
Other implementations do not;
a
.B \%waddch
.I \%waddch
call transmits exactly one character,
which may be rendered in one or more screen locations depending on
whether it is printable.
.PP
Depending on the locale settings,
whether it is printable
(see \fB\%unctrl\fP(3X)).
Depending on the locale,
.I \%ncurses
inspects the byte passed in each
.B \%waddch
call,
and checks whether the latest call continues a multibyte sequence.
.I \%waddch
call and checks whether the latest call continues a multibyte character.
When a character is
.IR complete ,
.IR complete ","
.I \%ncurses
displays the character and advances the cursor.
.PP
If the calling application interrupts the succession of bytes in
a multibyte character sequence by changing the current location\(emfor
example,
with \fB\%wmove\fP(3X)\(em\c
a multibyte character sequence by changing the current location \(em
for example,
with \fB\%wmove\fP(3X) \(em
.I \%ncurses
discards the incomplete character.
.PP
For portability to other implementations,
do not rely upon this behavior.
do not rely upon the foregoing behavior.
Check whether a character can be represented as a single byte in the
current locale.
.bP
If it can,
call either
.B \%waddch
or \fB\%wadd_wch\fP(3X).
.I \%waddch
or
.IR \%wadd_wch "."
.bP
If it cannot,
use only
\fB\%wadd_wch\fP(3X).
.SS TABSIZE
SVr4 and other versions of
.I curses
implement the
.B \%TABSIZE
variable,
but X/Open Curses does not specify it
(see \fB\%curs_variables\fP(3X)).
.IR \%wadd_wch "."
.SH HISTORY
4BSD (1980)
introduced
.I \%waddch
and its variants.
.PP
SVr3 (1987)
added the
.I \%echochar
and
.I \%wechochar
functions and most of the
.I ACS_
constants,
except for
.IR \%ACS_GEQUAL ","
.IR \%ACS_LEQUAL ","
.IR \%ACS_NEQUAL ","
.IR \%ACS_PI ","
.IR \%ACS_S3 ","
.IR \%ACS_S7 ","
and
.IR \%ACS_STERLING "."
.PP
.I \%ncurses
1.9.6 (1995)
furnished the remaining
.I ACS_
constants.
.SH SEE ALSO
\fB\%curs_add_wch\fP(3X) describes comparable functions of the
.I \%ncurses
library in its wide-character configuration
.RI ( \%ncursesw ).
.RI \%( ncursesw ).
.PP
\fB\%curses\fP(3X),
\fB\%curs_addchstr\fP(3X),
\fB\%curs_addstr\fP(3X),
\fB\%curs_attr\fP(3X),
\fB\%curs_bkgd\fP(3X),
\fB\%curs_clear\fP(3X),
\fB\%curs_inch\fP(3X),
\fB\%curs_outopts\fP(3X),
+81 -41
View File
@@ -1,5 +1,5 @@
.\"***************************************************************************
.\" Copyright 2019-2023,2024 Thomas E. Dickey *
.\" Copyright 2019-2024,2025 Thomas E. Dickey *
.\" Copyright 1998-2012,2017 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@@ -27,8 +27,8 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: curs_addchstr.3x,v 1.45 2024/04/20 21:20:07 tom Exp $
.TH curs_addchstr 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.\" $Id: curs_addchstr.3x,v 1.64 2025/08/16 19:56:13 tom Exp $
.TH curs_addchstr 3X 2025-08-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
@@ -46,62 +46,92 @@
..
.SH NAME
\fB\%addchstr\fP,
\fB\%addchnstr\fP,
\fB\%waddchstr\fP,
\fB\%waddchnstr\fP,
\fB\%mvaddchstr\fP,
\fB\%mvaddchnstr\fP,
\fB\%mvwaddchstr\fP,
\fB\%addchnstr\fP,
\fB\%waddchnstr\fP,
\fB\%mvaddchnstr\fP,
\fB\%mvwaddchnstr\fP \-
add a \fIcurses\fR character string to a window
.SH SYNOPSIS
.nf
\fB#include <curses.h>
.PP
\fBint addchstr(const chtype *\fIchstr\fP);
\fBint waddchstr(WINDOW *\fIwin\fP, const chtype *\fIchstr\fP);
\fBint mvaddchstr(int \fIy\fP, int \fIx\fP, const chtype *\fIchstr\fP);
\fBint mvwaddchstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const chtype *\fIchstr\fP);
\fBint addchstr(const chtype * \fIchstr\fP);
\fBint waddchstr(WINDOW * \fIwin\fP, const chtype * \fIchstr\fP);
\fBint mvaddchstr(int \fIy\fP, int \fIx\fP, const chtype * \fIchstr\fP);
\fBint mvwaddchstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP,
const chtype * \fIchstr\fP);
.PP
\fBint addchnstr(const chtype *\fIchstr\fP, int \fIn\fP);
\fBint waddchnstr(WINDOW *\fIwin\fP, const chtype *\fIchstr\fP, int \fIn\fP);
\fBint mvaddchnstr(int \fIy\fP, int \fIx\fP, const chtype *\fIchstr\fP, int \fIn\fP);
\fBint mvwaddchnstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const chtype *\fIchstr\fP, int \fIn\fP);
\fBint addchnstr(const chtype * \fIchstr\fP, int \fIn\fP);
\fBint waddchnstr(WINDOW * \fIwin\fP, const chtype * \fIchstr\fP, int \fIn\fP);
\fBint mvaddchnstr(int \fIy\fP, int \fIx\fP, const chtype * \fIchstr\fP, int \fIn\fP);
\fBint mvwaddchnstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP,
const chtype * \fIchstr\fP, int \fIn\fP);
.fi
.SH DESCRIPTION
These functions copy the (null-terminated)
\fIchstr\fP array
into the window image structure
starting at the current cursor position.
.B \%waddchstr
copies the string of
.I curses
characters
.I \%chstr
to the window
.IR win "."
A null
.I curses
character terminates the string.
.B \%waddchnstr
does the same,
but copies at most
.I n
characters,
or as many as possible if
.I n
is
.BR \-1 "."
\fB\%ncurses\fP(3X) describes the variants of these functions.
.PP
The four functions with \fIn\fP as the last
argument copy at most \fIn\fP elements,
but no more than will fit on the line.
If \fBn\fP=\fB\-1\fP then the whole array is copied,
to the maximum number of characters that will fit on the line.
.PP
The window cursor is \fInot\fP advanced.
These functions are faster than \fBwaddnstr\fP.
On the other hand:
Because these functions do not call \fB\%waddch\fP(3X) internally,
they are faster than \fB\%waddstr\fP(3X) and \fB\%waddnstr\fP(3X).
On the other hand,
they
.bP
they do not perform checking
(such as for the newline, backspace, or carriage return characters),
do not treat the backspace,
carriage return,
or line feed characters specially;
.bP
they do not advance the current cursor position,
do not represent unprintable characters with \fB\%unctrl\fP(3X);
.bP
they do not expand other control characters to ^-escapes, and
do not update the cursor position to follow the last character written;
and
.bP
they truncate the string if it crosses the right margin,
rather than wrapping it around to the new line.
truncate the string at the window's right margin,
rather than wrapping it to the next line and potentially scrolling.
.SH RETURN VALUE
All functions return the integer \fBERR\fP upon failure and \fBOK\fP on success.
These functions return
.B OK
on success and
.B ERR
on failure.
.PP
X/Open Curses does not specify any error conditions.
This implementation returns an error
In
.IR \%ncurses ","
these functions fail if
.bP
if the \fIwin\fP parameter is null or
the
.I curses
screen has not been initialized,
.bP
if the \fIwchstr\fP parameter is null.
.I chstr
is a null pointer,
or
.bP
(for functions taking a
.I \%WINDOW
pointer argument)
.I win
is a null pointer.
.PP
Functions prefixed with \*(``mv\*('' first perform cursor movement and
fail if the position
@@ -109,14 +139,24 @@ fail if the position
.IR x )
is outside the window boundaries.
.SH NOTES
All functions except \fBwaddchnstr\fP may be macros.
All of these functions except
.B \%waddchnstr
may be implemented as macros.
.SH PORTABILITY
These functions are described in X/Open Curses, Issue 4.
X/Open Curses Issue\ 4 describes these functions.
It specifies no error conditions for them.
.PP
SVr4 describes a successful return value only as
\*(``an integer value other than
.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 473
.SH HISTORY
SVr3.1 (1987)
introduced these functions.
.SH SEE ALSO
\fB\%curs_add_wchstr\fP(3X) describes comparable functions of the
.I \%ncurses
library in its wide-character configuration
.RI ( \%ncursesw ).
.RI \%( ncursesw ).
.PP
\fB\%curses\fP(3X),
\fB\%curs_addch\fP(3X),
+62 -39
View File
@@ -1,5 +1,5 @@
.\"***************************************************************************
.\" Copyright 2019-2023,2024 Thomas E. Dickey *
.\" Copyright 2019-2024,2025 Thomas E. Dickey *
.\" Copyright 1998-2012,2017 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@@ -27,8 +27,8 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: curs_addstr.3x,v 1.45 2024/04/20 19:18:18 tom Exp $
.TH curs_addstr 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.\" $Id: curs_addstr.3x,v 1.71 2025/10/21 00:09:34 tom Exp $
.TH curs_addstr 3X 2025-10-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
@@ -46,53 +46,48 @@
..
.SH NAME
\fB\%addstr\fP,
\fB\%addnstr\fP,
\fB\%waddstr\fP,
\fB\%waddnstr\fP,
\fB\%mvaddstr\fP,
\fB\%mvaddnstr\fP,
\fB\%mvwaddstr\fP,
\fB\%addnstr\fP,
\fB\%waddnstr\fP,
\fB\%mvaddnstr\fP,
\fB\%mvwaddnstr\fP \-
add a string to a \fIcurses\fR window and advance the cursor
.SH SYNOPSIS
.nf
\fB#include <curses.h>
.PP
\fBint addstr(const char *\fIstr\fP);
\fBint mvaddstr(int \fIy\fP, int \fIx\fP, const char *\fIstr\fP);
\fBint mvwaddstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const char *\fIstr\fP);
\fBint waddstr(WINDOW *\fIwin\fP, const char *\fIstr\fP);
\fBint addstr(const char * \fIstr\fP);
\fBint waddstr(WINDOW * \fIwin\fP, const char * \fIstr\fP);
\fBint mvaddstr(int \fIy\fP, int \fIx\fP, const char * \fIstr\fP);
\fBint mvwaddstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, const char * \fIstr\fP);
.PP
\fBint addnstr(const char *\fIstr\fP, int \fIn\fP);
\fBint mvaddnstr(int \fIy\fP, int \fIx\fP, const char *\fIstr\fP, int \fIn\fP);
\fBint mvwaddnstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const char *\fIstr\fP, int \fIn\fP);
\fBint waddnstr(WINDOW *\fIwin\fP, const char *\fIstr\fP, int \fIn\fP);
\fBint addnstr(const char * \fIstr\fP, int \fIn\fP);
\fBint waddnstr(WINDOW * \fIwin\fP, const char * \fIstr\fP, int \fIn\fP);
\fBint mvaddnstr(int \fIy\fP, int \fIx\fP, const char * \fIstr\fP, int \fIn\fP);
\fBint mvwaddnstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, const char * \fIstr\fP, int \fIn\fP);
.fi
.SH DESCRIPTION
.B waddstr
.B \%waddstr
writes the characters of the (null-terminated) string
.I str
to the window
.IR win .
Its process is similar to calling \fB\%waddch\fP(3X) for each
.IR win ,
as if by calling \fB\%waddch\fP(3X) for each
.I char
in
.IR str .
Control characters are processed as in \fB\%waddch\fP(3X).
.PP
.B waddnstr
writes at most
.B \%waddnstr
is similar,
but writes at most
.I n
characters,
or until a terminating null character occurs in
.IR str .
characters.
If
.I n
is \-1,
.B
.B waddnstr
.B \%waddnstr
writes the entire string.
.PP
\fB\%ncurses\fP(3X) describes the variants of these functions.
.SH RETURN VALUE
These functions return
@@ -101,18 +96,26 @@ on success and
.B ERR
on failure.
.PP
X/Open Curses does not specify any error conditions.
.I \%ncurses
returns an error
In
.IR \%ncurses ","
these functions fail if
.bP
if the window pointer is
.BR NULL ,
the
.I curses
screen has not been initialized,
.bP
if the string pointer is
.BR NULL ,
.I str
is a null pointer,
.bP
(for functions taking a
.I \%WINDOW
pointer argument)
.I win
is a null pointer,
or
.bP
if an internal \fB\%waddch\fP(3X) call returns an error.
an internal \fB\%waddch\fP(3X) call returns
.BR ERR "."
.PP
Functions prefixed with \*(``mv\*('' first perform cursor movement and
fail if the position
@@ -120,15 +123,35 @@ fail if the position
.IR x )
is outside the window boundaries.
.SH NOTES
All of these functions except \fBwaddnstr\fP may be macros.
All of these functions except
.B \%waddnstr
may be implemented as macros.
.SH PORTABILITY
X/Open Curses,
Issue 4 describes these functions.
X/Open Curses Issue\ 4 describes these functions.
It specifies no error conditions for them.
.PP
SVr4 describes a successful return value only as
\*(``an integer value other than
.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 474
.SH HISTORY
4BSD (1980)
introduced
.I \%waddstr
along with its variants,
the latter defined as macros.
.PP
SVr3.1 (1987)
added
.I \%waddnstr
(and its variants)
redefining
.I \%waddstr
as a macro wrapping it.
.SH SEE ALSO
\fB\%curs_addwstr\fP(3X) describes comparable functions of the
.I \%ncurses
library in its wide-character configuration
.RI ( \%ncursesw ).
.RI \%( ncursesw ).
.PP
\fB\%curses\fP(3X),
\fB\%curs_addch\fP(3X),
+64 -43
View File
@@ -1,5 +1,5 @@
.\"***************************************************************************
.\" Copyright 2019-2023,2024 Thomas E. Dickey *
.\" Copyright 2019-2024,2025 Thomas E. Dickey *
.\" Copyright 2002-2012,2017 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@@ -27,8 +27,8 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: curs_addwstr.3x,v 1.37 2024/04/20 19:18:18 tom Exp $
.TH curs_addwstr 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.\" $Id: curs_addwstr.3x,v 1.60 2025/03/15 20:41:04 tom Exp $
.TH curs_addwstr 3X 2025-03-15 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
@@ -46,36 +46,39 @@
..
.SH NAME
\fB\%addwstr\fP,
\fB\%addnwstr\fP,
\fB\%waddwstr\fP,
\fB\%waddnwstr\fP,
\fB\%mvaddwstr\fP,
\fB\%mvaddnwstr\fP,
\fB\%mvwaddwstr\fP,
\fB\%addnwstr\fP,
\fB\%waddnwstr\fP,
\fB\%mvaddnwstr\fP,
\fB\%mvwaddnwstr\fP \-
add a wide-character string to a \fIcurses\fR window and advance the cursor
.SH SYNOPSIS
.nf
\fB#include <curses.h>
.PP
\fBint addwstr(const wchar_t *\fIwstr\fP);
\fBint mvaddwstr(int \fIy\fP, int \fIx\fP, const wchar_t *\fIwstr\fP);
\fBint mvwaddwstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const wchar_t *\fIwstr\fP);
\fBint waddwstr(WINDOW *\fIwin\fP, const wchar_t *\fIwstr\fP);
\fBint addwstr(const wchar_t * \fIwstr\fP);
\fBint waddwstr(WINDOW * \fIwin\fP, const wchar_t * \fIwstr\fP);
\fBint mvaddwstr(int \fIy\fP, int \fIx\fP, const wchar_t * \fIwstr\fP);
\fBint mvwaddwstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP,
const wchar_t * \fIwstr\fP);
.PP
\fBint addnwstr(const wchar_t *\fIwstr\fP, int \fIn\fP);
\fBint mvaddnwstr(int \fIy\fP, int \fIx\fP, const wchar_t *\fIwstr\fP, int \fIn\fP);
\fBint mvwaddnwstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const wchar_t *\fIwstr\fP, int \fIn\fP);
\fBint waddnwstr(WINDOW *\fIwin\fP, const wchar_t *\fIwstr\fP, int \fIn\fP);
\fBint addnwstr(const wchar_t * \fIwstr\fP, int \fIn\fP);
\fBint waddnwstr(WINDOW * \fIwin\fP, const wchar_t * \fIwstr\fP, int \fIn\fP);
\fBint mvaddnwstr(int \fIy\fP, int \fIx\fP, const wchar_t * \fIwstr\fP, int \fIn\fP);
\fBint mvwaddnwstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP,
const wchar_t * \fIwstr\fP, int \fIn\fP);
.fi
.SH DESCRIPTION
.B waddwstr
.B \%waddwstr
writes the characters of the (wide-null-terminated) wide-character
string
.I wstr
to the window
.IR win .
Its process is similar to constructing a
.IR win ,
as if by
constructing a
.I cchar_t
for each
.I wchar_t
@@ -83,26 +86,20 @@ in
.IR wstr ,
then calling \fB\%wadd_wch\fP(3X) with the resulting
.IR cchar_t .
.bP
Spacing and non-spacing characters in the string
are processed one at a time,
and
.bP
control characters are processed as in \fB\%wadd_wch\fP(3X).
.PP
.B waddnwstr
writes at most
.I curses
processes spacing and non-spacing characters in
.I wstr
one at a time.
.B \%waddnwstr
is similar,
but writes at most
.I n
wide characters,
or until a terminating wide null character occurs in
.IR wstr .
wide characters.
If
.I n
is \-1,
.B
.B waddnwstr
.B \%waddnwstr
writes the entire wide string.
.PP
\fB\%ncurses\fP(3X) describes the variants of these functions.
.SH RETURN VALUE
These functions return
@@ -111,18 +108,26 @@ on success and
.B ERR
on failure.
.PP
X/Open Curses does not specify any error conditions.
.I \%ncurses
returns an error
In
.IR \%ncurses ","
these functions fail if
.bP
if the window pointer is
.BR NULL ,
the
.I curses
screen has not been initialized,
.bP
if the string pointer is
.BR NULL ,
.I wstr
is a null pointer,
.bP
(for functions taking a
.I \%WINDOW
pointer argument)
.I win
is a null pointer,
or
.bP
if an internal \fB\%wadd_wch\fP(3X) call returns an error.
an internal \fB\%wadd_wch\fP(3X) call returns
.BR ERR "."
.PP
Functions prefixed with \*(``mv\*('' first perform cursor movement and
fail if the position
@@ -131,11 +136,27 @@ fail if the position
is outside the window boundaries.
.SH NOTES
All of these functions except
.B waddnwstr
.B \%waddnwstr
may be implemented as macros.
.SH PORTABILITY
X/Open Curses,
Issue 4 describes these functions.
X/Open Curses Issue\ 4 describes these functions.
.PP
SVr4 describes a successful return value only as
\*(``an integer value other than
.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 478
.SH HISTORY
X/Open Curses Issue\ 4 (1995) initially specified these functions.
The System\ V Interface Definition Version\ 4
of the same year
specified functions named
.I \%waddwstr
and
.I \%waddnwstr
(and the usual variants).
.\" SVID 4, vol 3., p. 478
These were later additions to
.RI SVr4. x ,
not appearing in the first SVr4 (1989).
.SH SEE ALSO
\fB\%curs_addstr\fP(3X) describes comparable functions of the
.I \%ncurses
+344 -150
View File
@@ -1,6 +1,6 @@
'\" t
.\"***************************************************************************
.\" Copyright 2018-2023,2024 Thomas E. Dickey *
.\" Copyright 2018-2024,2025 Thomas E. Dickey *
.\" Copyright 1998-2016,2017 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@@ -28,8 +28,8 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: curs_attr.3x,v 1.105 2024/04/27 17:54:42 tom Exp $
.TH curs_attr 3X 2024-04-27 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.\" $Id: curs_attr.3x,v 1.142 2025/11/12 01:05:49 tom Exp $
.TH curs_attr 3X 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
@@ -142,68 +142,88 @@ of the given window to \fIattrs\fP, with color specified by \fIpair\fP.
Use \fBwattr_get\fP to retrieve attributes for the given window.
.PP
Use \fBattr_on\fP and \fBwattr_on\fP to turn on window attributes, i.e.,
values OR'd together in \fIattr\fP,
values logically \*(``or\*(''-ed together in \fIattr\fP,
without affecting other attributes.
Use \fBattr_off\fP and \fBwattr_off\fP to turn off window attributes,
again values OR'd together in \fIattr\fP,
again values logically \*(``or\*(''-ed together in \fIattr\fP,
without affecting other attributes.
.\" ---------------------------------------------------------------------------
.SS "Legacy Window Attributes"
The X/Open window attribute routines which \fIset\fP or \fIget\fP,
turn \fIon\fP or \fIoff\fP
are extensions of older routines
which assume that color pairs are OR'd into the attribute parameter.
which assume that color pairs are logically \*(``or\*(''-ed
into the attribute parameter.
These newer routines use similar names, because
X/Open simply added an underscore (\fB_\fP) for the newer names.
.PP
The \fBint\fP datatype used in the legacy routines is treated as if
it is the same size as \fBchtype\fP (used by \fBaddch\fP(3X)).
The
.I int
datatype used in the legacy routines is treated as if
it is the same size as
.I \%chtype
(used by \fBaddch\fP(3X)).
It holds the common video attributes (such as bold, reverse),
as well as a few bits for color.
Those bits correspond to the \fBA_COLOR\fP symbol.
The \fBCOLOR_PAIR\fP macro provides a value which can be OR'd into
the attribute parameter.
The \fBCOLOR_PAIR\fP macro provides a value which can be
logically \*(``or\*(''-ed into the attribute parameter.
For example,
as long as that value fits into the \fBA_COLOR\fP mask,
then these calls produce similar results:
.PP
.RS 4
.EX
.nf
attrset(A_BOLD | COLOR_PAIR(\fIpair\fP));
attr_set(A_BOLD, \fIpair\fP, NULL);
.fi
.EE
.RE
.PP
However, if the value does not fit, then the \fBCOLOR_PAIR\fP macro
uses only the bits that fit.
For example,
because in \fI\%ncurses\fP \fBA_COLOR\fP has eight (8) bits,
because in
.I \%ncurses
\fBA_COLOR\fP has eight (8) bits,
then \fBCOLOR_PAIR(\fI259\fB)\fR is 4
(i.e., 259 is 4 more than the limit 255).
.PP
The \fBPAIR_NUMBER\fP macro extracts a pair number from an \fBint\fP
(or \fBchtype\fP).
The \fBPAIR_NUMBER\fP macro extracts a pair number from an
.I int
(or
.IR \%chtype ")."
For example, the \fIinput\fP and \fIoutput\fP values in these statements
would be the same:
.PP
.RS 4
.EX
.nf
int value = A_BOLD | COLOR_PAIR(\fIinput\fP);
int \fIoutput\fP = PAIR_NUMBER(value);
.fi
.EE
.RE
.PP
The \fBattrset\fP routine is a legacy feature predating SVr4 curses
but kept in X/Open Curses for the same reason that SVr4 curses kept it:
The \fBattrset\fP routine is a legacy feature predating SVr4
.I curses
but kept in X/Open Curses for the same reason that SVr4
.I curses
kept it:
compatibility.
.PP
The remaining \fBattr\fP* functions operate exactly like the corresponding
\fBattr_\fP* functions, except that they take arguments of type \fBint\fP
rather than \fBattr_t\fP.
\fBattr_\fP* functions, except that they take arguments of type
.I int
rather than
.IR \%attr_t "."
.PP
There is no corresponding \fB\%attrget\fP function as such
in X/Open Curses,
although \fI\%ncurses\fP provides \fB\%getattrs\fP
although
.I \%ncurses
provides \fB\%getattrs\fP
(see \fB\%curs_legacy\fP(3X)).
.\" ---------------------------------------------------------------------------
.SS "Change Character Rendition"
@@ -240,11 +260,18 @@ there is no ambiguity about the way the attributes
might be combined with a color pair.
.\" ---------------------------------------------------------------------------
.SS "Video Attributes"
The following video attributes, defined in \fB<curses.h>\fP, can be passed to
the routines \fBattron\fP, \fBattroff\fP, and \fBattrset\fP, or OR'd with the
characters passed to \fBaddch\fP (see \fBcurs_addch\fP(3X)).
The following video attributes,
defined in
.IR \%curses.h ","
can be passed to
.BR \%attron ","
.BR \%attroff ","
.BR \%attrset ","
and
logically \*(``or\*(''-ed with characters passed to \fBaddch\fP(3X).
.PP
.ne 15
.if t .ne 15
.if n .ne 16
.RS
.TS
Lb Lb
@@ -252,9 +279,7 @@ Lb Lx.
Name Description
_
A_NORMAL Normal display (no highlight)
A_STANDOUT T{
Best highlighting mode of the terminal
T}
A_STANDOUT Best highlighting mode available
A_UNDERLINE Underlining
A_REVERSE Reverse video
A_BLINK Blinking
@@ -264,16 +289,20 @@ A_PROTECT Protected mode
A_INVIS Invisible or blank mode
A_ALTCHARSET Alternate character set
A_ITALIC Italics (non-X/Open extension)
A_CHARTEXT Bit-mask to extract a character
A_COLOR T{
Bit-mask to extract a color (legacy routines)
T}
A_ATTRIBUTES Mask to extract character code
A_CHARTEXT Mask to extract attributes
A_COLOR Mask to extract color pair identifier
.TE
.RE
.PP
These video attributes are supported by \fBattr_on\fP and related functions
(which also support the attributes recognized by \fBattron\fP, etc.):
.BR \%attr_on ","
.BR \%attr_off ","
and
.B \%attr_set
support the foregoing as well as the following additional attributes.
.PP
.if t .ne 7
.if n .ne 8
.RS
.TS
Lb Lb
@@ -288,25 +317,40 @@ WA_TOP Top highlight
WA_VERTICAL Vertical highlight
.TE
.RE
.PP
The return values of many of these routines are not meaningful (they are
implemented as macro-expanded assignments and simply return their argument).
The SVr4 manual page claims (falsely) that these routines always return \fB1\fP.
.\" ---------------------------------------------------------------------------
.SH RETURN VALUE
All routines return the integer \fBOK\fP on success, or \fBERR\fP on failure.
These functions return
.B OK
on success and
.B ERR
on failure.
.PP
X/Open Curses does not specify any error conditions.
In
.IR \%ncurses ","
they return
.B ERR
if
.I win
is
.IR NULL "."
.PP
This implementation
.bP
returns an error if the window pointer is null.
.bP
returns an error if the color pair parameter
for \fBwcolor_set\fP is outside the range 0..COLOR_PAIRS\-1.
.bP
does not return an error if either of the parameters of \fBwattr_get\fP
used for retrieving attribute or color pair values is \fBNULL\fP.
.B \%wcolor_set
returns
.B ERR
if
.I pair
is outside the range
.BR 0 .\|. COLOR_PAIRS\-1 .
.PP
.B \%wattr_get
does
.I not
fail if its
.I \%attrs
or
.I \%pair
parameter is
.IR NULL "."
.PP
Functions prefixed with \*(``mv\*('' first perform cursor movement and
fail if the position
@@ -315,20 +359,43 @@ fail if the position
is outside the window boundaries.
.\" ---------------------------------------------------------------------------
.SH NOTES
These functions may be macros:
.sp
.RS
\fBattroff\fP, \fBwattroff\fP, \fBattron\fP, \fBwattron\fP,
\fBattrset\fP, \fBwattrset\fP, \fBstandend\fP and \fBstandout\fP.
.RE
.BR \%attr_on ","
.BR \%attr_off ","
.BR \%attr_set ","
.BR \%wattr_set ","
.BR \%chgat ","
.BR \%mvchgat ","
.BR \%mvwchgat ","
.BR \%wchgat ","
and
.B \%color_set
are part of
.IR \%ncurses "'s"
wide-character API,
and are not available in its non-wide-character configuration.
.PP
Color pair values can only be OR'd with attributes if the pair
number is less than 256.
.BR \%attron ","
.BR \%wattron ","
.BR \%attroff ","
.BR \%wattroff ","
.BR \%attrset ","
.BR \%wattrset ","
.BR \%standout ","
and
.B \%standend
may be implemented as macros.
.PP
Color pair values may be logically \*(``or\*(''-ed with attributes
if the pair number is less than 256.
The alternate functions such as \fBcolor_set\fP can pass a color pair
value directly.
However, \fI\%ncurses\fP ABI 4 and 5 simply OR this value
However,
.I \%ncurses
ABI 4 and 5 simply logically \*(``or\*('' this value
within the alternate functions.
You must use \fI\%ncurses\fP ABI 6 to support more than 256 color pairs.
You must use
.I \%ncurses
ABI 6 to support more than 256 color pairs.
.\" ---------------------------------------------------------------------------
.SH EXTENSIONS
This implementation provides the \fBA_ITALIC\fP attribute for terminals
@@ -342,32 +409,55 @@ This implementation makes the assumption that
.PP
Each of the functions added by XSI Curses has a parameter \fIopts\fP,
which X/Open Curses still (after more than twenty years) documents
as reserved for future use, saying that it should be \fBNULL\fP.
as reserved for future use, saying that it should be
.IR NULL "."
This implementation uses that parameter in ABI 6 for the functions which
have a color pair parameter to support \fIextended color pairs\fP:
.bP
For functions which modify the color, e.g.,
\fBwattr_set\fP and \fBwattr_on\fP,
if \fIopts\fP is set it is treated as a pointer to \fBint\fP,
and used to set the color pair instead of the \fBshort\fP \fIpair\fP parameter.
if \fIopts\fP is set it is treated as a pointer to
.IR int ","
and used to set the color pair instead of the
.I short
.I pair
parameter.
.bP
For functions which retrieve the color, e.g.,
\fBwattr_get\fP,
if \fIopts\fP is set it is treated as a pointer to \fBint\fP,
and used to retrieve the color pair as an \fBint\fP value,
if \fIopts\fP is set it is treated as a pointer to
.IR int ","
and used to retrieve the color pair as an
.I int
value,
in addition to
retrieving it via the standard pointer to \fBshort\fP parameter.
retrieving it via the standard pointer to
.I short
parameter.
.bP
For functions which turn attributes off, e.g.,
\fBwattr_off\fP,
the \fIopts\fP parameter is ignored except
except to check that it is \fBNULL\fP.
the \fIopts\fP parameter is ignored except to check that it is
.IR NULL "."
.\" ---------------------------------------------------------------------------
.SH PORTABILITY
These functions are described in X/Open Curses, Issue 4.
These functions are described in X/Open Curses Issue\ 4.
It specifies no error conditions for them.
.PP
The standard defined the dedicated type for highlights,
\fBattr_t\fP, which was not defined in SVr4 curses.
The functions taking \fBattr_t\fP arguments were not supported under SVr4.
.IR \%attr_t ","
which was not defined in SVr4
.IR curses "."
The functions taking
.I \%attr_t
arguments were not supported under SVr4.
.PP
SVr4 describes the functions not taking
.I \%attr_t
or
.I pair
arguments as always returning
.BR 1 "." \" Courier roman in source; SVID 4, vol. 3, p. 480
.PP
Very old versions of this library did not force an update of the screen
when changing the attributes.
@@ -378,7 +468,9 @@ X/Open Curses states that whether the traditional functions
\fBA_BLINK\fP, \fBA_BOLD\fP, \fBA_DIM\fP, \fBA_REVERSE\fP, \fBA_STANDOUT\fP, or
\fBA_UNDERLINE\fP is \*(``unspecified\*(''.
Under this implementation as well as
SVr4 curses, these functions correctly manipulate all other highlights
SVr4
.IR curses ","
these functions correctly manipulate all other highlights
(specifically, \fBA_ALTCHARSET\fP, \fBA_PROTECT\fP, and \fBA_INVIS\fP).
.PP
X/Open Curses added these entry points:
@@ -397,13 +489,11 @@ The older macros have direct counterparts in the newer set of names:
.ne 9
.TS
Lb Lb
Lb Lx.
Lb L .
Name Description
_
WA_NORMAL Normal display (no highlight)
WA_STANDOUT T{
Best highlighting mode of the terminal
T}
WA_STANDOUT Best highlighting mode available
WA_UNDERLINE Underlining
WA_REVERSE Reverse video
WA_BLINK Blinking
@@ -423,18 +513,29 @@ information.
.bP
However, in some implementations, those symbols have unrelated values.
.IP
For example, the Solaris \fIxpg4\fP (X/Open) curses declares
\fBattr_t\fP to be an unsigned short integer (16-bits),
while \fBchtype\fP is a unsigned integer (32-bits).
For example, the Solaris \fIxpg4\fP (X/Open)
.I curses
declares
.I \%attr_t
to be an unsigned short integer (16-bits),
while
.I \%chtype
is a unsigned integer (32-bits).
The \fBWA_\fP symbols in this case are different from the \fBA_\fP symbols
because they are used for a smaller datatype which does not
represent \fBA_CHARTEXT\fP or \fBA_COLOR\fP.
.IP
In this implementation (as in many others), the values happen to be
the same because it simplifies copying information between
\fBchtype\fP and \fBcchar_t\fP variables.
.I \%chtype
and
.I \%cchar_t
variables.
.bP
Because \fI\%ncurses\fP's \fBattr_t\fP can hold a color pair
Because
.IR \%ncurses 's
.I \%attr_t
can hold a color pair
(in the \fBA_COLOR\fP field),
a call to
\fBwattr_on\fP,
@@ -444,7 +545,8 @@ may alter the window's color.
If the color pair information in the attribute parameter is zero,
no change is made to the window's color.
.IP
This is consistent with SVr4 curses;
This is consistent with SVr4
.IR curses ";"
X/Open Curses does not specify this.
.PP
The X/Open Curses extended conformance level adds new highlights
@@ -455,62 +557,123 @@ no known terminal provides these highlights
(i.e., via the \fBsgr1\fP capability).
.\" ---------------------------------------------------------------------------
.SH HISTORY
X/Open Curses is largely based on SVr4 curses,
adding support for \*(``wide-characters\*('' (not specific to Unicode).
Some of the X/Open differences from SVr4 curses address the way
video attributes can be applied to wide-characters.
But aside from that, \fBattrset\fP and \fBattr_set\fP are similar.
SVr4 curses provided the basic features for manipulating video attributes.
However, earlier versions of curses provided a part of these features.
4BSD (1980)
used a
.I char
to represent each cell of the terminal screen.
It assumed 7-bit character codes,
employing the eighth bit of a byte to represent a
.I \%standout
attribute
(often implemented as bold and/or reverse video).
It introduced
.IR \%standout ","
.IR \%standend ","
.IR \%wstandout ","
and
.I \%wstandend
functions to manipulate this bit.
Despite their inflexibility,
they carried over into System\ V
.I curses
and ultimately X/Open Curses
due to their pervasive use in legacy applications.
While some 1980s terminals supported a variety of video attributes,
BSD
.I curses
could do nothing with them.
.PP
As seen in 2.8BSD, curses assumed 7-bit characters,
using the eighth bit of a byte to represent the \fIstandout\fP
feature (often implemented as bold and/or reverse video).
The BSD curses library provided functions \fBstandout\fP and \fBstandend\fP
which were carried along into X/Open Curses due to their pervasive use
in legacy applications.
SVr2 (1984)
provided an improved
.I curses
library,
introducing
.I \%chtype
to create the abstract notion of a
.I curses
character;
this was by default an
.IR "unsigned short" ","
with a provision for compile-time redefinition to other integral types
(a freedom not necessarily available to users of shared libraries,
and in any event a source license was necessary to exercise it).
It added the functions
.IR \%attron ","
.IR \%attroff ","
.IR \%attrset ","
.IR \%wattron ","
.IR \%wattroff ","
and
.IR \%wattrset ","
and defined the
.I A_
macros listed above
(except for
.I \%A_ITALIC
and
.IR \%A_COLOR ")"
for use by applications to manipulate other attributes.
The values of these macros
were not necessarily the same in different systems,
even among those certified as System\ V.
.PP
Some terminals in the 1980s could support a variety of video attributes,
although the BSD curses library could do nothing with those.
System V (1983) provided an improved curses library.
It defined the \fBA_\fP symbols for use by applications to manipulate the
other attributes.
There are few useful references for the chronology.
SVr3.2 (1988)
added the
.I \%A_COLOR
macro along with a color system;
see \fBcurs_color\fP(3X).
.PP
Goodheart's book
\fIUNIX Curses Explained\fP (1991) describes SVr3 (1987),
commenting on several functions:
.bP
the \fBattron\fP, \fBattroff\fP, \fBattrset\fP functions
(and most of the functions found in SVr4 but not in BSD curses) were
introduced by System V,
.bP
the alternate character set feature with \fBA_ALTCHARSET\fP was
added in SVr2 and improved in SVr3 (by adding \fBacs_map[]\fP),
.bP
\fBstart_color\fP and related color-functions were introduced by System V.3.2,
.bP
pads, soft-keys were added in SVr3, and
X/Open Curses Issue\ 4 (1995) is largely based on SVr4
.IR curses ","
but recognized that the
.I \%wchar_t
type of ISO C95 was intended to house only a single character code,
not a sequence of codes combining with a base character,
let alone could it reliably offer room for a color pair identifier
and a set of attribute bits with a potential for further growth \(em
thus the standard invented the
.I curses
complex character type
.I \%cchar_t
and a separate type
.I \%attr_t
for storage of attribute bits.
The new types brought along several new functions to manipulate them,
some corresponding to existing
.IR chtype -based
functions
.RI \%( attr_on ,
.IR \%attr_off ","
.IR \%attr_set ","
.IR \%wattr_on ","
.IR \%wattr_off ","
and
.IR \%wattr_set "),"
and some new
.RI \%( chgat
and its variants,
.IR \%color_set ","
and
.IR \%wcolor_set ")."
.PP
Goodheart did not mention the background character or the \fBcchar_t\fP type.
Those are respectively SVr4 and X/Open features.
He did mention the \fBA_\fP constants, but did not indicate their values.
Those were not the same in different systems,
even for those marked as System V.
Different Unix systems used differently sized bit fields in
.I \%chtype
for the character code and the color pair identifier,
and took into account platforms' different integer sizes
(32- versus 64-bit).
.PP
Different Unix systems used different sizes for the bit-fields in \fBchtype\fP
for \fIcharacters\fP and \fIcolors\fP, and took into account the different
integer sizes (32-bit versus 64-bit).
.PP
This table showing the number of bits for \fBA_COLOR\fP
and \fBA_CHARTEXT\fP
was gleaned from the curses header files for
various operating systems and architectures.
The inferred architecture and notes reflect
the format and size of the defined constants
The following table showing the number of bits for
.I \%A_COLOR
and
.I \%A_CHARTEXT
was gleaned from the
.I curses
header files for various operating systems and architectures.
The inferred architecture and notes
reflect the format and size of the defined constants
as well as clues such as the alternate character set implementation.
A 32-bit library can be used on a 64-bit system,
but not necessarily the reverse.
but not necessarily the converse.
.PP
.TS
Lb Lb Lb Cb S Lb
@@ -529,7 +692,7 @@ _
1996 AIX 4.2 32 7 16 X/Open \fIcurses\fP
1996 OSF/1 r4 32 6 16 X/Open \fIcurses\fP
1997 HP-UX 11.00 32 6 8 X/Open \fIcurses\fP
2000 U/Win 32/64 7/31 16 uses \fIchtype\fP
2000 UWIN 32/64 7/31 16 uses \fIchtype\fP
.TE
.PP
Notes:
@@ -540,54 +703,85 @@ Regarding HP-UX,
HP-UX 10.20 (1996) added support for 64-bit PA-RISC processors in 1996.
.bP
HP-UX 10.30 (1997) marked \*(``curses_colr\*('' obsolete.
That version of curses was dropped with HP-UX 11.30 in 2006.
That version of
.I curses
was dropped with HP-UX 11.30 in 2006.
.PP
Regarding OSF/1 (and Tru64),
.bP
These used 64-bit hardware.
Like \fI\%ncurses\fP,
the OSF/1 curses interface is not customized for 32-bit and 64-bit
Like
.IR \%ncurses ","
the OSF/1
.I curses
interface is not customized for 32-bit and 64-bit
versions.
.bP
Unlike other systems which evolved from AT&T code,
OSF/1 provided a new implementation for X/Open curses.
OSF/1 provided a new implementation for X/Open Curses.
.PP
Regarding Solaris,
.bP
The initial release of Solaris was in 1992.
.bP
The \fIxpg4\fP (X/Open) curses was developed by MKS from 1990 to 1995.
Its XPG4
(X/Open Curses-conforming)
.I xcurses
library was developed by Mortice Kern Systems from 1990 to 1995.
Sun's copyright began in 1996.
.bP
Sun updated the X/Open curses interface
Sun updated the X/Open Curses interface
after 64-bit support was introduced in 1997,
but did not modify the SVr4 curses interface.
but did not modify the SVr4
.I curses
interface.
.PP
Regarding U/Win,
Regarding UWIN,
.bP
Development of the curses library began in 1991, stopped in 2000.
Development of the
.I curses
library began in 1991, stopped in 2000.
.bP
Color support was added in 1998.
.bP
The library uses only \fBchtype\fP (no \fBcchar_t\fP).
The library uses only
.I \%chtype
(not
.IR \%cchar_t ")."
.RE
.PP
Once X/Open curses was adopted in the mid-1990s, the constraint of
a 32-bit interface with many colors and wide-characters for \fBchtype\fP
Once X/Open Curses was adopted in the mid-1990s, the constraint of
a 32-bit interface with many colors and wide-characters for
.I \%chtype
became a moot point.
The \fBcchar_t\fP structure (whose size and
members are not specified in X/Open Curses) could be extended as needed.
The
.I \%cchar_t
structure
(whose size and members are not specified in X/Open Curses)
could be extended as needed.
.PP
Other interfaces are rarely used now:
Other interfaces are rarely used now.
.bP
BSD curses was improved slightly in 1993/1994 using Keith Bostic's
modification to make the library 8-bit clean for \fBnvi\fP(1).
He moved \fIstandout\fP attribute to a structure member.
.IP
The resulting 4.4BSD curses was replaced by \fI\%ncurses\fP over the
next ten years.
BSD
.I curses
was improved slightly in 1993/1994 using Keith Bostic's
modification to make the library 8-bit clean for \fInvi\fP(1).
He moved the
.I \%standout
attribute to a structure member.
The resulting 4.4BSD
.I curses
was replaced by
.I \%ncurses
over the next ten years.
.bP
U/Win is rarely used now.
UWIN has been defunct since 2012.
.PP
.I \%ncurses
6.0 (2015)
added the
.I A_ITALIC
macro.
.\" ---------------------------------------------------------------------------
.SH SEE ALSO
\fB\%curses\fP(3X),
+66 -19
View File
@@ -1,5 +1,5 @@
.\"***************************************************************************
.\" Copyright 2018-2023,2024 Thomas E. Dickey *
.\" Copyright 2018-2024,2025 Thomas E. Dickey *
.\" Copyright 1998-2005,2010 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@@ -27,8 +27,8 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: curs_beep.3x,v 1.29 2024/04/20 21:20:07 tom Exp $
.TH curs_beep 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.\" $Id: curs_beep.3x,v 1.42 2025/02/01 23:46:11 tom Exp $
.TH curs_beep 3X 2025-02-01 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.SH NAME
\fB\%beep\fP,
\fB\%flash\fP \-
@@ -41,23 +41,70 @@ ring the (visual) bell of the terminal with \fIcurses\fR
\fBint flash(void);
.fi
.SH DESCRIPTION
The \fBbeep\fP and \fBflash\fP routines are used to alert the terminal user.
The routine \fBbeep\fP sounds an audible alarm on the terminal, if possible;
otherwise it flashes the screen (visible bell).
The routine \fBflash\fP
flashes the screen, and if that is not possible, sounds the alert.
If neither
alert is possible, nothing happens.
Nearly all terminals have an audible alert
(bell or beep), but only some can flash the screen.
.B beep
and
.B flash
alert the terminal user:
the former by sounding the terminal's audible alarm,
and the latter by visibly attracting attention.
Commonly,
a terminal implements a visual bell by momentarily reversing the
character foreground and background colors on the entire display;
even a monochrome device can do this.
These functions each attempt the other alert type if the one requested
is unavailable.
If neither is available,
.I curses
performs no action.
Nearly all terminals have an audible alert mechanism such as a bell or
piezoelectric buzzer,
but only some can flash the screen.
.SH RETURN VALUE
These routines return \fBOK\fP if they succeed in beeping or flashing,
\fBERR\fP otherwise.
These functions return
.B OK
on success and
.B ERR
on failure.
.PP
In
.IR \%ncurses ","
.B beep
and
.B flash
return
.B OK
if the terminal type supports the corresponding capability:
.B bell
.RB ( bel )
for
.B beep
and
.B \%flash_screen
.RB ( flash )
for
.BR flash "."
Otherwise they return
.BR ERR "."
.SH EXTENSIONS
SVr4's beep and flash routines always returned \fBOK\fP, so it was not
possible to tell when the beep or flash failed.
In
.IR \%ncurses ","
these functions can return
.BR ERR "."
.SH PORTABILITY
These functions are described in X/Open Curses, Issue 4.
Like SVr4, it specifies that they always return \fBOK\fP.
X/Open Curses Issue\ 4 describes these functions.
It specifies no error conditions for them.
.PP
On SVr4
.IR curses ","
they always return
.IR OK ","
and X/Open Curses specifies them as doing so.
.SH HISTORY
SVr2 (1984)
introduced
.I beep
and
.IR flash "."
.SH SEE ALSO
\fB\%curses\fP(3X)
\fB\%curses\fP(3X),
\fB\%terminfo\fP(5)
+161 -82
View File
@@ -1,5 +1,5 @@
.\"***************************************************************************
.\" Copyright 2018-2023,2024 Thomas E. Dickey *
.\" Copyright 2018-2024,2025 Thomas E. Dickey *
.\" Copyright 1998-2015,2017 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@@ -27,8 +27,8 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: curs_bkgd.3x,v 1.61 2024/04/20 18:54:36 tom Exp $
.TH curs_bkgd 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.\" $Id: curs_bkgd.3x,v 1.76 2025/08/23 22:39:20 tom Exp $
.TH curs_bkgd 3X 2025-08-23 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
@@ -64,37 +64,55 @@ manipulate background of a \fIcurses\fR window of characters
\fBchtype getbkgd(WINDOW *\fIwin\fP);
.fi
.SH DESCRIPTION
The
.I background
of a
Every
.I curses
window
(in the library's non-\*(``wide\*('' configuration)
is a
.I \%chtype
combining a set of attributes
(see \fB\%curs_attr\fP(3X))
with a character called the
.I "blank character."
window has a
.I "background character"
property:
in the library's non-wide-character configuration,
it is a
.I curses
character
.RI \%( chtype )
that combines a set of attributes
(and,
if colors are enabled,
a color pair identifier)
with a character code.
When erasing
(parts of)
a window,
.I curses
replaces the erased cells with the background character.
.PP
The blank character is a spacing character that populates a window's
character cells when their contents are erased without replacement.
The background's attributes are combined with all non-blank characters
written to the window,
as with the \fB\%waddch\fP(3X) and \fB\%winsch\fP(3X) families of
functions.
.I curses
also uses the background character when writing characters to a
populated window.
.bP
The attribute part of the background character combines with all
non-blank character cells in the window,
as populated by the \fB\%waddch\fP(3X) and \fB\%winsch\fP(3X)
families of functions
(and those that call them).
.bP
Both the character code and attributes of the background character
combine with blank character cells in the window.
.PP
The blank character and attributes of the background combine with
characters written to the window as described below.
The background becomes a property of the character and moves with it
through any scrolling and insert/delete line/character operations.
.PP
To the extent possible on a given terminal,
the attribute part of the background is displayed as the graphic
rendition of the character put on the screen.
The background character's set of attributes becomes a property
of the character cell
and move with it through any scrolling
and insert/delete line/character operations.
To the extent possible on the terminal type,
.I curses
displays the attributes of the background character
as the graphic rendition of a character cell on the display.
.SS "bkgd, wbkgd"
\fB\%bkgd\fP and \fB\%wbkgd\fP set the background property of
\fB\%stdscr\fP or the specified window and then apply this setting to
.B \%bkgd
and
.B \%wbkgd
set the background property of
.B \%stdscr
or the specified window and then apply this setting to
every character cell in that window.
.bP
The rendition of every character in the window changes to the new
@@ -106,19 +124,19 @@ it changes to the new background character.
.I \%ncurses
updates the rendition of each character cell by comparing the character,
non-color attributes,
and colors.
The library applies to following procedure to each cell in the window,
and color pair selection.
The library applies the following procedure to each cell in the window,
whether or not it is blank.
.bP
.I \%ncurses
first compares the cell's character to the previously specified blank
character;
first compares the cell's character to the previously specified
background character;
if they match,
.I \%ncurses
writes the new blank character to the cell.
writes the new background character to the cell.
.bP
.I \%ncurses
then checks if the cell uses color,
then checks whether the cell uses color;
that is,
its color pair value is nonzero.
If not,
@@ -141,85 +159,146 @@ updates only the non-color attributes,
first removing those that may have come from the current background,
and then adding attributes from the new background.
.PP
If the new background's character is non-spacing
(for example,
if it is a control character),
.I \%ncurses
treats a background character value of zero (0) as a blank character.
retains the existing background character,
except for one special case:
.I \%ncurses
treats a background character code of zero (0) as a space.
.PP
If the terminal does not support color,
or if color has not been initialized with \fB\%start_color\fP(3X),
.I \%ncurses
ignores the new background character's color attribute.
ignores the new background character's color pair selection.
.SS "bkgdset, wbkgdset"
\fB\%bkgdset\fP and \fB\%wbkgdset\fP manipulate the background of
the applicable window,
without updating the character cells as \fB\%bkgd\fP and
\fB\%wbkgd\fP do;
.B \%bkgdset
and
.B \%wbkgdset
manipulate the background of the applicable window,
without updating the character cells as
.B \%bkgd
and
.B \%wbkgd
do;
only future writes reflect the updated background.
.SS getbkgd
\fB\%getbkgd\fP obtains the given window's background character and
attribute combination.
.B \%getbkgd
returns the given window's background character,
attributes,
and color pair as a
.IR \%chtype "."
.SH RETURN VALUE
Functions returning an \fIint\fP return \fBOK\fP on success.
\fB\%bkgd\fP returns \fBERR\fP if the library has not been initialized.
\fB\%wbkgd\fP and \fB\%getbkgd\fP return \fBERR\fP if a \fI\%WINDOW\fP
pointer argument is null.
.B \%bkgdset
and
.B \%wbkgdset
do not return a value.
.PP
\fB\%bkgdset\fP and \fBwbkgdset\fP do not return a value.
Functions returning an
.I int
return
.B ERR
upon failure and
.B OK
upon success.
In
.IR \%ncurses ","
failure occurs if
.bP
the
.I curses
screen has not been initialized,
or
.bP
.I win
is
.IR NULL "."
.PP
\fB\%getbkgd\fP returns a window's background character and attribute
combination.
.BR \%getbkgd 's
return value is as described above.
.SH NOTES
Unusually,
there is no \fB\%wgetbkgd\fP function;
\fB\%getbkgd\fP behaves as one would expect \fB\%wgetbkgd\fP to,
accepting a \fI\%WINDOW\fP pointer argument.
there is no
.B \%wgetbkgd
function;
.B \%getbkgd
behaves as one would expect
.B \%wgetbkgd
to,
accepting a
.I \%WINDOW
pointer argument.
.PP
\fB\%bkgd\fP and
\fB\%bkgdset\fP
.B \%bkgd
and
.B \%bkgdset
may be implemented as macros.
.PP
X/Open Curses mentions that the character part of the background must
be a single-byte value.
\fI\%ncurses\fP,
like SVr4 \fIcurses\fP,
checks to ensure that,
and will reuse the old background character if the check fails.
.IR \%ncurses ","
like SVr4
.IR curses ","
checks to ensure that it is,
and retains the existing background character if the check fails.
.SH PORTABILITY
X/Open Curses,
Issue 4 describes these functions.
It specifies that
\fB\%bkgd\fP,
\fB\%wbkgd\fP,
X/Open Curses Issue\ 4 describes these functions.
It indicates that
.IR bkgd ","
.IR wbkgd ","
and
\fB\%getbkgd\fP
return \fBERR\fP on failure
.I getbkgd
return
.I ERR
on failure
(in the case of the last,
this value is cast to
.IR \%chtype ),
but describes no failure conditions.
but specifies no error conditions for them.
.PP
The SVr4.0 manual says that \fB\%bkgd\fP and \fB\%wbkgd\fP may return
\fBOK\fP
\*(``or a non-negative integer if \fB\%immedok\fP is set\*('',
which refers to the return value from \fB\%wrefresh\fP(3X),
used to implement the immediate repainting.
SVr4 \fIcurses\fP's \fB\%wrefresh\fP returns the number of characters
written to the screen during the refresh.
\fI\%ncurses\fP does not do that.
SVr4 documentation
.\" SVID 4, vol. 3, p. 482
says that
.I \%bkgd
and
.I \%wbkgd
return
.I OK
\*(``or a non-negative integer if
.I \%immedok() \" Courier roman in source
is set\*('',
referring to the return value from
.IR \%wrefresh ","
which in SVr4 returns a count of characters
written to the window if its
.I \%immedok
property is set;
.\" ...though its wrefresh() man page says nothing about immedok()...
in
.IR \%ncurses ","
it does not.
.PP
Neither X/Open Curses nor the SVr4 manual pages detail how the rendition
of characters on the screen updates when \fB\%bkgd\fP or \fB\%wbkgd\fP
of characters in the window updates when
.I \%bkgd
or
.I \%wbkgd
changes the background character.
.IR \%ncurses ,
.IR \%ncurses ","
like SVr4
.IR curses ,
.IR curses ","
does not
(in its non-\*(``wide\*('' configuration)
(in its non-wide-character configuration)
store the background and window attribute contributions to each
character cell separately.
.SH HISTORY
SVr3.1 (1987)
introduced these functions.
.SH SEE ALSO
\fB\%curs_bkgrnd\fP(3X) describes the corresponding functions in the
\*(``wide\*('' configuration of
.IR \%ncurses .
wide configuration of
.IR \%ncurses "."
.PP
\fB\%curses\fP(3X),
\fB\%curs_addch\fP(3X),
+116 -82
View File
@@ -1,5 +1,5 @@
.\"***************************************************************************
.\" Copyright 2018-2023,2024 Thomas E. Dickey *
.\" Copyright 2018-2024,2025 Thomas E. Dickey *
.\" Copyright 2002-2015,2017 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@@ -27,19 +27,8 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: curs_bkgrnd.3x,v 1.42 2024/04/20 18:54:36 tom Exp $
.TH curs_bkgrnd 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
.\}
.el \{\
.ie t .ds `` ``
.el .ds `` ""
.ie t .ds '' ''
.el .ds '' ""
.\}
.
.\" $Id: curs_bkgrnd.3x,v 1.60 2025/08/23 22:39:20 tom Exp $
.TH curs_bkgrnd 3X 2025-08-23 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.de bP
.ie n .IP \(bu 4
.el .IP \(bu 2
@@ -66,37 +55,55 @@ manipulate background of a \fIcurses\fP window of wide characters
\fBint wgetbkgrnd(WINDOW *\fIwin\fP, cchar_t *\fIwch\fP);
.fi
.SH DESCRIPTION
The
.I background
of a
Every
.I curses
window
(in the library's \*(``wide\*('' configuration)
is a
.I \%cchar_t
combining a set of attributes
(see \fB\%curs_attr\fP(3X))
with a complex character called the
.I "blank character."
window has a
.I "background character"
property:
in the library's wide configuration,
it is a
.I curses
complex character
.RI \%( cchar_t )
that combines a set of attributes
(and,
if colors are enabled,
a color pair identifier)
with a character code.
When erasing
(parts of)
a window,
.I curses
replaces the erased cells with the background character.
.PP
The blank character is a spacing character that populates a window's
character cells when their contents are erased without replacement.
The background's attributes are combined with all non-blank characters
written to the window,
as with the \fB\%wadd_wch\fP(3X) and \fB\%wins_wch\fP(3X) families of
functions.
.I curses
also uses the background character when writing characters to a
populated window.
.bP
The attribute part of the background character combines with all
non-blank character cells in the window,
as populated by the \fB\%wadd_wch\fP(3X) and \fB\%wins_wch\fP(3X)
families of functions
(and those that call them).
.bP
Both the character code and attributes of the background character
combine with blank character cells in the window.
.PP
The blank character and attributes of the background combine with
characters written to the window as described below.
The background becomes a property of the character and moves with it
through any scrolling and insert/delete line/character operations.
.PP
To the extent possible on a given terminal,
the attribute part of the background is displayed as the graphic
rendition of the character put on the screen.
The background character's set of attributes becomes a property
of the character cell
and move with it through any scrolling
and insert/delete line/character operations.
To the extent possible on the terminal type,
.I curses
displays the attributes of the background character
as the graphic rendition of a character cell on the display.
.SS "bkgrnd, wbkgrnd"
\fB\%bkgrnd\fP and \fB\%wbkgrnd\fP set the background property of
\fB\%stdscr\fP or the specified window and then apply this setting to
.B \%bkgrnd
and
.B \%wbkgrnd
set the background property of
.B \%stdscr
or the specified window and then apply this setting to
every character cell in that window.
.bP
The rendition of every character in the window changes to the new
@@ -108,19 +115,19 @@ it changes to the new background character.
.I \%ncurses
updates the rendition of each character cell by comparing the character,
non-color attributes,
and colors.
and color pair selection.
The library applies to following procedure to each cell in the window,
whether or not it is blank.
.bP
.I \%ncurses
first compares the cell's character to the previously specified blank
character;
first compares the cell's character to the previously specified
background character;
if they match,
.I \%ncurses
writes the new blank character to the cell.
writes the new background character to the cell.
.bP
.I \%ncurses
then checks if the cell uses color,
then checks whether the cell uses color;
that is,
its color pair value is nonzero.
If not,
@@ -143,73 +150,100 @@ updates only the non-color attributes,
first removing those that may have come from the current background,
and then adding attributes from the new background.
.PP
If the new background's character is non-spacing,
.I \%ncurses
treats a background character value of zero (0) as a blank character.
reuses the old background character,
except for one special case:
.I \%ncurses
treats a background character code of zero (0) as a space.
.PP
If the terminal does not support color,
or if color has not been initialized with \fB\%start_color\fP(3X),
.I \%ncurses
ignores the new background character's color attribute.
ignores the new background character's color pair selection.
.SS "bkgrndset, wbkgrndset"
\fB\%bkgrndset\fP and \fB\%wbkgrndset\fP manipulate the background of
the applicable window,
without updating the character cells as \fB\%bkgrnd\fP and
\fB\%wbkgrnd\fP do;
.B \%bkgrndset
and
.B \%wbkgrndset
manipulate the background of the applicable window,
without updating the character cells as
.B \%bkgrnd
and
.B \%wbkgrnd
do;
only future writes reflect the updated background.
.SS "getbkgrnd, wgetbkgrnd"
The \fB\%getbkgrnd\fP and \fB\%wgetbkgrnd\fP functions obtain the
background character and attribute pair of \fB\%stdscr\fP or the
specified window and store it via the
.B \%getbkgrnd
and
.B \%wgetbkgrnd
respectively obtain
.BR \%stdscr 's
or the given window's background character,
attributes,
and color pair,
and store it in their
.I wch
pointer.
argument.
.SH RETURN VALUE
\fBbkgrndset\fP and \fBwbkgrndset\fP do not return a value.
.B \%bkgrndset
and
.B \%wbkgrndset
do not return a value.
.PP
The other functions return
Functions returning an
.I int
return
.B ERR
upon failure and
.B OK
upon success.
In
.IR \%ncurses ,
.IR \%ncurses ","
failure occurs if
.bP
a
.I \%WINDOW
pointer
.I win
is null, or
the
.I curses
screen has not been initialized,
.bP
.I win
is
.IR NULL ","
or
.bP
a
.I \%cchar_t
pointer
.I wch
is null.
is
.IR NULL "."
.SH NOTES
\fB\%bkgrnd\fP,
\fB\%bkgrndset\fP, and
\fB\%getbkgrnd\fP
.BR \%bkgrnd ","
.BR \%bkgrndset ","
and
.B \%getbkgrnd
may be implemented as macros.
.PP
Unlike their counterparts in the non-\*(``wide\*('' configuration of
.IR \%ncurses ,
\fB\%getbkgrnd\fP and \fB\%wgetbkgrnd\fP supply the background character
and attribute in a modifiable
Unlike their counterparts in the non-wide-character configuration of
.IR \%ncurses ","
.B \%getbkgrnd
and
.B \%wgetbkgrnd
store the background character in a modifiable
.I \%cchar_t
parameter,
not as the return value.
rather than supplying it as the return value.
.SH PORTABILITY
X/Open Curses,
Issue 4 describes these functions.
X/Open Curses Issue\ 4 describes these functions.
It specifies no error conditions for them.
.PP
X/Open Curses does not provide details of how the rendition is updated.
This implementation follows the approach used in SVr4
.IR curses .
.I \%ncurses
follows the approach used in SVr4
.IR curses 's
non-wide functions for manipulating the window background.
.SH HISTORY
X/Open Curses Issue\ 4 (1995) initially specified these functions.
.SH SEE ALSO
\fB\%curs_bkgd\fP(3X) describes the corresponding functions in the
non-\*(``wide\*('' configuration of
.IR \%ncurses .
non-wide-character configuration of
.IR \%ncurses "."
.PP
\fB\%curses\fP(3X),
\fB\%curs_add_wch\fP(3X),
+180 -59
View File
@@ -1,5 +1,5 @@
.\"***************************************************************************
.\" Copyright 2018-2023,2024 Thomas E. Dickey *
.\" Copyright 2018-2024,2025 Thomas E. Dickey *
.\" Copyright 1998-2007,2010 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@@ -27,8 +27,8 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: curs_border.3x,v 1.49 2024/04/20 21:20:07 tom Exp $
.TH curs_border 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.\" $Id: curs_border.3x,v 1.65 2025/10/20 23:42:24 tom Exp $
.TH curs_border 3X 2025-10-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
@@ -39,6 +39,11 @@
.ie t .ds '' ''
.el .ds '' ""
.\}
.
.de bP
.ie n .IP \(bu 4
.el .IP \(bu 2
..
.SH NAME
\fB\%border\fP,
\fB\%wborder\fP,
@@ -57,93 +62,131 @@ draw borders and lines in a \fIcurses\fR window of characters
\fB#include <curses.h>
.PP
\fBint border(chtype \fIls\fP, chtype \fIrs\fP, chtype \fIts\fP, chtype \fIbs\fP,
\fBchtype \fItl\fB, chtype \fItr\fB, chtype \fIbl\fB, chtype \fIbr\fB);\fR
\fBchtype \fItl\fB, chtype \fItr\fB, chtype \fIbl\fB, chtype \fIbr\fB);\fR
\fBint wborder(WINDOW *\fIwin\fB, chtype \fIls\fB, chtype \fIrs\fB,\fR
\fBchtype \fIts\fB, chtype \fIbs\fB, chtype \fItl\fB, chtype \fItr\fB,\fR
\fBchtype \fIbl\fB, chtype \fIbr\fB);\fR
\fBchtype \fIts\fB, chtype \fIbs\fB, chtype \fItl\fB, chtype \fItr\fB,\fR
\fBchtype \fIbl\fB, chtype \fIbr\fB);\fR
.PP
\fBint box(WINDOW *\fIwin\fB, chtype \fIverch\fB, chtype \fIhorch\fB);\fR
.PP
\fBint hline(chtype \fIch\fB, int \fIn\fB);\fR
\fBint whline(WINDOW *\fIwin\fB, chtype \fIch\fB, int \fIn\fB);\fR
\fBint vline(chtype \fIch\fB, int \fIn\fB);\fR
\fBint wvline(WINDOW *\fIwin\fB, chtype \fIch\fB, int \fIn\fB);\fR
.PP
\fBint mvhline(int \fIy\fB, int \fIx\fB, chtype \fIch\fB, int \fIn\fB);\fR
\fBint mvwhline(WINDOW *\fIwin\fB, int \fIy\fB, int \fIx\fB, chtype \fIch\fB, int \fIn\fB);\fR
.PP
\fBint vline(chtype \fIch\fB, int \fIn\fB);\fR
\fBint wvline(WINDOW *\fIwin\fB, chtype \fIch\fB, int \fIn\fB);\fR
\fBint mvvline(int \fIy\fB, int \fIx\fB, chtype \fIch\fB, int \fIn\fB);\fR
\fBint mvwvline(WINDOW *\fIwin\fB, int \fIy\fB, int \fIx\fB, chtype \fIch\fB, int \fIn\fB);\fR
.fi
.SH DESCRIPTION
The \fBborder\fP, \fBwborder\fP and \fBbox\fP routines
draw a box around the edges of a window.
Other than the window, each argument is a character with attributes:
.sp
.B \%wborder
and
.B \%border
draw a box at the edges of the specified window or
.BR \%stdscr ","
respectively.
Each
.I \%chtype
argument corresponds to a geometric component of the border as follows:
.RS
\fIls\fP \- left side,
.I ls
\- left side,
.br
\fIrs\fP \- right side,
.I rs
\- right side,
.br
\fIts\fP \- top side,
.I ts
\- top side,
.br
\fIbs\fP \- bottom side,
.I bs
\- bottom side,
.br
\fItl\fP \- top left-hand corner,
.I tl
\- top left-hand corner,
.br
\fItr\fP \- top right-hand corner,
.I tr
\- top right-hand corner,
.br
\fIbl\fP \- bottom left-hand corner, and
.I bl
\- bottom left-hand corner, and
.br
\fIbr\fP \- bottom right-hand corner.
.I br
\- bottom right-hand corner.
.RE
.PP
If any of these arguments is zero, then the corresponding
default values (defined in \fBcurses.h\fP) are used instead:
.sp
If any
.I \%chtype
argument is
.BR 0 ","
then
.I curses
uses forms-drawing characters
(see \fBaddch\fP(3X))
in the following correspondence:
.RS
\fBACS_VLINE\fP,
.BR \%ACS_VLINE ","
.br
\fBACS_VLINE\fP,
.BR \%ACS_VLINE ","
.br
\fBACS_HLINE\fP,
.BR \%ACS_HLINE ","
.br
\fBACS_HLINE\fP,
.BR \%ACS_HLINE ","
.br
\fBACS_ULCORNER\fP,
.BR \%ACS_ULCORNER ","
.br
\fBACS_URCORNER\fP,
.BR \%ACS_URCORNER ","
.br
\fBACS_LLCORNER\fP,
.BR \%ACS_LLCORNER ","
and
.br
\fBACS_LRCORNER\fP.
.BR \%ACS_LRCORNER "."
.RE
.PP
\fBbox(\fIwin\fB, \fIverch\fB, \fIhorch\fB)\fR is a shorthand
for the following call: \fBwborder(\fIwin\fB,\fR \fIverch\fB,\fR
\fIverch\fB,\fR \fIhorch\fB,\fR \fIhorch\fB, 0, 0, 0, 0)\fR.
.BI \%box( win ","
.IB verch ,
.IB horch )
is shorthand for
.RB \%\*(`` wborder(\c
.IB win ,
.IB verch ,
.IB verch ,
.IB horch ,
.IB horch ,
.BR "0, 0, 0, 0)" "\*(''."
.PP
The \fBhline\fP and \fBwhline\fP functions draw a horizontal (left to right)
line using \fIch\fP starting at the current cursor position in the window.
The
current cursor position is not changed.
The line is at most \fIn\fP characters
long, or as many as fit into the window.
.PP
The \fBvline\fP and \fBwvline\fP functions draw a vertical (top to bottom) line
using \fIch\fP starting at the current cursor position in the window.
The
current cursor position is not changed.
The line is at most \fIn\fP characters
long, or as many as fit into the window.
.B \%whline
draws a horizontal line of
.I ch
from left to right,
and
.B \%wvline
a vertical one from top to bottom,
stopping once
.I n
characters have been drawn or upon reaching the boundary of
.IR win "."
These functions do not update the cursor position
(beyond any motion directed by their \*(``mv\*('' variants).
\fB\%ncurses\fP(3X) describes the variants of these functions.
.SH RETURN VALUE
All routines return the integer \fBOK\fP.
The SVr4.0 manual says
\*(``or a non-negative integer if \fB\%immedok\fP is set\*('',
but this appears to be an error.
These functions return
.B OK
on success and
.B ERR
on failure.
.PP
X/Open Curses does not specify any error conditions.
This implementation returns an error
if the window pointer is null.
In
.IR \%ncurses ","
.bP
these functions fail if the screen is not initialized;
and
.bP
functions taking a
.I \%WINDOW
pointer argument fail if
.I win
is a null pointer.
.PP
Functions prefixed with \*(``mv\*('' first perform cursor movement and
fail if the position
@@ -151,12 +194,90 @@ fail if the position
.IR x )
is outside the window boundaries.
.SH NOTES
The borders generated by these functions are \fIinside\fP borders (this
is also true of SVr4 curses, though the fact is not documented).
Unusually,
there is no
.B \%wbox
function;
.B \%box
behaves as one would expect
.B \%wbox
to,
accepting a
.I \%WINDOW
pointer argument.
.PP
Note that \fBborder\fP and \fBbox\fP may be macros.
.BR \%border ","
.BR \%box ","
.BR \%hline ","
.BR \%mvhline ","
.BR \%mvwhline ","
.BR \%vline ","
.BR \%mvvline ","
and
.B \%mvwvline
may be implemented as macros.
.PP
Borders drawn by these functions are
.I interior
borders.
.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4BSD/usr/src/lib/libcurses/box.c
.SH PORTABILITY
These functions are described in X/Open Curses, Issue 4.
These functions are described in X/Open Curses Issue\ 4.
It specifies no error conditions for them.
.PP
SVr4 documentation
.\" SVID 4, vol. 3, p. 483
says that these functions return
.I OK
\*(``or a non-negative integer if
.I \%immedok() \" Courier roman in source
is set\*('',
referring to the return value from
.IR \%wrefresh ","
which in SVr4 returns a count of characters
written to the window if its
.I \%immedok
property is set;
.\" ...though its wrefresh() man page says nothing about immedok()...
in
.IR \%ncurses ","
it does not.
.PP
BSD
.I curses
drew boxes with
.I horch
in
.I every
character cell of the top and bottom lines of the window,
whereas SVr3.1 and later
.IR curses ","
because its
.I box
wrapped
.IR wborder ","
used the default corner characters.
.\" https://github.com/ryanwoodsmall/oldsysv/blob/master/sysvr3/31/\
.\" usr/src/lib/libcurses/screen/curses.ed#L454
.SH HISTORY
4BSD (1980)
introduced
.IR box ","
defining it as a function.
.PP
SVr3.1 (1987)
added
.I \%whline
and
.I \%wvline
and their variants,
as well as
.I \%border
and
.IR \%wborder ","
redefining
.I \%box
as a macro wrapping the latter.
.SH SEE ALSO
\fB\%curses\fP(3X),
\fB\%curs_outopts\fP(3X)
+43 -53
View File
@@ -1,5 +1,5 @@
.\"***************************************************************************
.\" Copyright 2019-2023,2024 Thomas E. Dickey *
.\" Copyright 2019-2024,2025 Thomas E. Dickey *
.\" Copyright 2002-2011,2012 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@@ -27,8 +27,8 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: curs_border_set.3x,v 1.36 2024/04/20 21:20:07 tom Exp $
.TH curs_border_set 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.\" $Id: curs_border_set.3x,v 1.50 2025/10/21 00:10:56 tom Exp $
.TH curs_border_set 3X 2025-10-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
@@ -56,46 +56,31 @@ draw borders and lines in a \fIcurses\fR window of wide characters
.nf
\fB#include <curses.h>
.PP
\fBint border_set(
\fBconst cchar_t *\fIls\fB, const cchar_t *\fIrs\fP,
\fBconst cchar_t *\fIts\fB, const cchar_t *\fIbs\fP,
\fBconst cchar_t *\fItl\fB, const cchar_t *\fItr\fP,
\fBconst cchar_t *\fIbl\fB, const cchar_t *\fIbr\fB);\fR
\fBint border_set(const cchar_t *\fIls\fB, const cchar_t *\fIrs\fP,
\fBconst cchar_t *\fIts\fB, const cchar_t *\fIbs\fP,
\fBconst cchar_t *\fItl\fB, const cchar_t *\fItr\fP,
\fBconst cchar_t *\fIbl\fB, const cchar_t *\fIbr\fB);\fR
.br
\fBint wborder_set(\fP
\fBWINDOW *\fIwin\fP,
\fBconst cchar_t *\fIls\fB, const cchar_t *\fIrs\fP,
\fBconst cchar_t *\fIts\fB, const cchar_t *\fIbs\fP,
\fBconst cchar_t *\fItl\fB, const cchar_t *\fItr\fP,
\fBconst cchar_t *\fIbl\fB, const cchar_t *\fIbr\fB);\fR
\fBint box_set(\fP
\fBWINDOW *\fIwin\fP,
\fBconst cchar_t *\fIverch\fP,
\fBconst cchar_t *\fIhorch\fB);\fR
\fBint hline_set(\fP
\fBconst cchar_t *\fIwch\fB, int \fIn\fB);\fR
\fBint whline_set(\fP
\fBWINDOW *\fIwin\fP,
\fBconst cchar_t *\fIwch\fB, int \fIn\fB);\fR
\fBint mvhline_set(\fP
\fBint \fIy\fB, int \fIx\fP,
\fBconst cchar_t *\fIwch\fB, int \fIn\fB);\fR
\fBint mvwhline_set(\fP
\fBWINDOW *\fIwin\fP,
\fBint \fIy\fB, int \fIx\fP,
\fBconst cchar_t *\fIwch\fB, int \fIn\fB);\fR
\fBint vline_set(\fP
\fBconst cchar_t *\fIwch\fB, int \fIn\fB);\fR
\fBint wvline_set(\fP
\fBWINDOW *\fIwin\fP,
\fBconst cchar_t *\fIwch\fB, int \fIn\fB);\fR
\fBint mvvline_set(\fP
\fBint \fIy\fB, int \fIx\fP,
\fBconst cchar_t *\fIwch\fB, int \fIn\fB);\fR
\fBint mvwvline_set(\fP
\fBWINDOW *\fIwin\fP,
\fBint \fIy\fB, int \fIx\fP,
\fBconst cchar_t *\fIwch\fB, int \fIn\fB);\fR
\fBint wborder_set(\fBWINDOW *\fIwin\fP,
\fBconst cchar_t *\fIls\fB, const cchar_t *\fIrs\fP,
\fBconst cchar_t *\fIts\fB, const cchar_t *\fIbs\fP,
\fBconst cchar_t *\fItl\fB, const cchar_t *\fItr\fP,
\fBconst cchar_t *\fIbl\fB, const cchar_t *\fIbr\fB);\fR
.PP
\fBint box_set(\fBWINDOW *\fIwin\fP, \fBconst cchar_t *\fIverch\fP,
\fBconst cchar_t *\fIhorch\fB);\fR
.PP
\fBint hline_set(const cchar_t *\fIwch\fB, int \fIn\fB);\fR
\fBint whline_set(WINDOW *\fIwin\fP, \fBconst cchar_t *\fIwch\fB, int \fIn\fB);\fR
\fBint mvhline_set(int \fIy\fB, int \fIx\fP, \fBconst cchar_t *\fIwch\fB,\fR \fBint \fIn\fB);\fR
\fBint mvwhline_set(WINDOW *\fIwin\fP, \fBint \fIy\fB, int \fIx\fP,
\fBconst cchar_t *\fIwch\fB, int \fIn\fB);\fR
.PP
\fBint vline_set(const cchar_t *\fIwch\fB, int \fIn\fB);\fR
\fBint wvline_set(WINDOW *\fIwin\fP, \fBconst cchar_t *\fIwch\fB, int \fIn\fB);\fR
\fBint mvvline_set(int \fIy\fB, int \fIx\fP, \fBconst cchar_t *\fIwch\fB,\fR \fBint \fIn\fB);\fR
\fBint mvwvline_set(WINDOW *\fIwin\fP, \fBint \fIy\fB, int \fIx\fP,
\fBconst cchar_t *\fIwch\fB, int \fIn\fB);\fR
.fi
.SH DESCRIPTION
The
@@ -177,7 +162,9 @@ Upon successful completion, these functions return
Otherwise, they return
\fBERR\fP.
.PP
Functions using a window parameter return an error if it is null.
Functions using a window parameter return
.B ERR
if it is null.
.PP
Functions prefixed with \*(``mv\*('' first perform cursor movement and
fail if the position
@@ -185,17 +172,20 @@ fail if the position
.IR x )
is outside the window boundaries.
.SH NOTES
Note that
\fBborder_set\fP,
\fBhline_set\fP,
\fBmvhline_set\fP,
\fBmvvline_set\fP,
\fBmvwhline_set\fP,
\fBmvwvline_set\fP, and
\fBvline_set\fP
may be macros.
.BR \%border_set ","
.BR \%hline_set ","
.BR \%mvhline_set ","
.BR \%mvvline_set ","
.BR \%mvwhline_set ","
.BR \%mvwvline_set ","
and
.B \%vline_set
may be implemented as macros.
.SH PORTABILITY
These functions are described in X/Open Curses, Issue 4.
X/Open Curses Issue\ 4 describes these functions.
It specifies no error conditions for them.
.SH HISTORY
X/Open Curses Issue\ 4 (1995) initially specified these functions.
.SH SEE ALSO
\fB\%curses\fP(3X),
\fB\%curs_add_wch\fP(3X),
+33 -13
View File
@@ -1,5 +1,5 @@
.\"***************************************************************************
.\" Copyright 2018-2023,2024 Thomas E. Dickey *
.\" Copyright 2018-2024,2025 Thomas E. Dickey *
.\" Copyright 1998-2010,2016 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@@ -27,8 +27,8 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: curs_clear.3x,v 1.48 2024/04/20 21:20:07 tom Exp $
.TH curs_clear 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.\" $Id: curs_clear.3x,v 1.58 2025/01/19 00:49:39 tom Exp $
.TH curs_clear 3X 2025-01-18 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
@@ -93,24 +93,44 @@ to the right of the cursor, inclusive, to the end of the current line.
.SH RETURN VALUE
All routines return the integer \fBOK\fP on success and \fBERR\fP on failure.
.PP
X/Open defines no error conditions.
In this implementation,
.bP
functions using a window pointer parameter return an error if it is null
functions using a window pointer parameter return
.B ERR
if it is null
.bP
\fBwclrtoeol\fP returns an error
if the cursor position is about to wrap.
.SH NOTES
Note that \fBerase\fP, \fBwerase\fP, \fBclear\fP, \fBwclear\fP,
\fBclrtobot\fP, and \fBclrtoeol\fP may be macros.
.BR \%erase ","
.BR \%werase ","
.BR \%clear ","
.BR \%wclear ","
.BR \%clrtobot ","
and
.B \%clrtoeol
may be implemented as macros.
.SH PORTABILITY
These functions are described in X/Open Curses, Issue 4.
X/Open Curses Issue\ 4 describes these functions.
It specifies no error conditions for them.
.PP
The SVr4.0 manual says that these functions could return
\*(``or a non-negative integer if \fB\%immedok\fP is set\*('',
referring to the return-value of \fBwrefresh\fP.
In that implementation, \fBwrefresh\fP would return a count of
the number of characters written to the terminal.
SVr4 documentation
.\" SVID 4, vol. 3, p. 485
says that these functions return
.I OK
\*(``or a non-negative integer if
.I \%immedok() \" Courier roman in source
is set\*('',
referring to the return value from
.IR \%wrefresh ","
which in SVr4 returns a count of characters
written to the window if its
.I \%immedok
property is set;
.\" ...though its wrefresh() man page says nothing about immedok()...
in
.IR \%ncurses ","
it does not.
.PP
Some historic curses implementations had, as an undocumented feature, the
ability to do the equivalent of \fBclearok(..., 1)\fP by saying
+361 -149
View File
@@ -1,5 +1,5 @@
.\"***************************************************************************
.\" Copyright 2018-2023,2024 Thomas E. Dickey *
.\" Copyright 2018-2024,2025 Thomas E. Dickey *
.\" Copyright 1998-2016,2017 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@@ -27,8 +27,8 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: curs_color.3x,v 1.100 2024/04/20 21:24:19 tom Exp $
.TH curs_color 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.\" $Id: curs_color.3x,v 1.126 2025/08/23 22:39:20 tom Exp $
.TH curs_color 3X 2025-08-23 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
@@ -69,7 +69,8 @@
\fB\%COLOR_BLUE\fP,
\fB\%COLOR_MAGENTA\fP,
\fB\%COLOR_CYAN\fP,
\fB\%COLOR_WHITE\fP \-
\fB\%COLOR_WHITE\fP,
\fB\%A_COLOR\fP \-
manipulate terminal colors with \fIcurses\fR
.SH SYNOPSIS
.nf
@@ -99,8 +100,18 @@ manipulate terminal colors with \fIcurses\fR
\fI/* extension */
\fBvoid reset_color_pairs(void);
.PP
\fI/* macros */
\fBint COLOR_PAIR(int \fIn\fP);
\fBPAIR_NUMBER(int \fIattr\fP);
\fBCOLOR_BLACK
\fBCOLOR_RED
\fBCOLOR_GREEN
\fBCOLOR_YELLOW
\fBCOLOR_BLUE
\fBCOLOR_MAGENTA
\fBCOLOR_CYAN
\fBCOLOR_WHITE
\fBA_COLOR
.fi
.SH DESCRIPTION
.SS Overview
@@ -160,9 +171,8 @@ pairs in an internal function called from \fB\%waddch\fP:
.bP
If the parameter passed to \fB\%waddch\fP is \fIblank\fP,
and it uses the special color pair 0,
.RS
.bP
\fIcurses\fP next checks the window attribute.
.RS
.bP
If the window attribute does not use color pair 0,
\fIcurses\fP uses the color pair from the window attribute.
@@ -182,24 +192,36 @@ Those do not combine its parameter with a color pair.
Consequently those calls use only the window attribute or
the background character.
.SH CONSTANTS
In \fB\%<curses.h>\fP the following macros are defined.
These are the standard colors (ISO-6429).
\fIcurses\fP also assumes that \fB\%COLOR_BLACK\fP is the default
background color for all terminals.
ISO\ 6429 and ECMA-48
define eight standard colors
(also known as \*(``ANSI\*('' colors).
.I curses\.h
defines object-like macros
.BR \%COLOR_BLACK ","
.BR \%COLOR_RED ","
.BR \%COLOR_GREEN ","
.BR \%COLOR_YELLOW ","
.BR \%COLOR_BLUE ","
.BR \%COLOR_MAGENTA ","
.BR \%COLOR_CYAN ","
and
.B \%COLOR_WHITE
accordingly.
.I curses
assumes that
.B \%COLOR_BLACK
is the default background color for all terminals.
.I \%ncurses
offers an extension to override that assumption;
see \fB\%assume_default_colors\fP(3X).
Some terminals support additional colors that lack standard names.
.PP
.nf
\fBCOLOR_BLACK\fP
\fBCOLOR_RED\fP
\fBCOLOR_GREEN\fP
\fBCOLOR_YELLOW\fP
\fBCOLOR_BLUE\fP
\fBCOLOR_MAGENTA\fP
\fBCOLOR_CYAN\fP
\fBCOLOR_WHITE\fP
.fi
.PP
Some terminals support more than the eight (8) \*(``ANSI\*('' colors.
There are no standard names for those additional colors.
.B \%A_COLOR
is a bit mask that,
when bitwise \*(``and\*(''-ed with a
.IR \%chtype ","
.\" XXX: and right-shifted by...?
extracts its color pair identifier.
.SH VARIABLES
.SS COLORS
is initialized by \fB\%start_color\fP to the maximum number of colors
@@ -291,12 +313,48 @@ Color pair \fB0\fP is assumed to be white on black,
but is actually whatever the terminal implements before color is initialized.
It cannot be modified by the application.
.SS has_colors
The \fB\%has_colors\fP routine requires no arguments.
It returns \fBTRUE\fP if
the terminal can manipulate colors; otherwise, it returns \fBFALSE\fP.
This routine facilitates writing terminal-independent programs.
For example, a programmer can use it to decide
whether to use color or some other video attribute.
.B \%has_colors
returns
.B TRUE
if the terminal supports colors and
.B FALSE
if it does not.
\fB\%initscr\fP(3X) or \fB\%newterm\fP(3X) must be called first,
but
.B \%start_color
need not be.
An application might call
.B \%has_colors
to decide whether to use color
or a video attribute like
.B \%A_BOLD
to render text.
.PP
Color support in
.I curses
requires that the terminal type description
support the capabilities
.B \%max_colors
.RB \%( colors ),
.B \%max_pairs
.RB \%( pairs ),
and any of
.bP
.B \%set_foreground
.RB ( setf )
and
.B \%set_background
.RB ( setb );
.bP
.B \%set_a_foreground
.RB ( setaf )
and
.B \%set_a_background
.RB ( setab );
or
.bP
.B \%set_color_pair
.RB ( scp ).
.SS can_change_color
The \fB\%can_change_color\fP routine requires no arguments.
It returns \fBTRUE\fP if the terminal supports colors
@@ -418,87 +476,173 @@ rather than the legacy functions such as \fB\%attrset\fP.
\fIattr\fP parameter and returns it as a color pair number;
it is the inverse operation of \fB\%COLOR_PAIR\fP.
.SH RETURN VALUE
The routines \fB\%can_change_color\fP and \fB\%has_colors\fP return \fBTRUE\fP
or \fBFALSE\fP.
.PP
All other routines return the integer \fBERR\fP upon failure and an \fBOK\fP
(SVr4 specifies only \*(``an integer value
other than \fBERR\fP\*('') upon successful completion.
.PP
X/Open defines no error conditions.
SVr4 does document some error conditions which apply in general:
.bP
This implementation will return \fBERR\fP on attempts to
use color values outside the range \fB0\fP to \fB\%COLORS\fP\-1
(except for the default colors extension),
or use color pairs outside the range \fB0\fP to \fB\%COLOR_PAIRS\-1\fP.
.IP
Color values used in \fB\%init_color\fP must be
in the range \fB0\fP to \fB1000\fP.
.IP
An error is returned from all functions
if the terminal has not been initialized.
.IP
An error is returned from secondary functions such as \fB\%init_pair\fP
if \fB\%start_color\fP was not called.
.bP
SVr4 does much the same, except that
it returns \fBERR\fP from \fB\%pair_content\fP if the pair was not initialized
using \fB\%init_pairs\fP
.B \%can_change_color
and
it returns \fBERR\fP from \fB\%color_content\fP
if the terminal does not support changing colors.
.IP
This implementation does not return \fBERR\fP for either case.
.B \%has_colors
return
.B TRUE
or
.BR FALSE "."
The other functions return
.B OK
on success and
.B ERR
on failure.
.PP
Specific functions make additional checks:
.RS 3
.TP 5
\fB\%init_color\fP
returns an error if the terminal does not support
this feature, e.g., if the \fB\%initialize_color\fP capability is absent
from the terminal description.
.TP 5
\fB\%start_color\fP
returns an error if the color table cannot be allocated.
In
.IR \%ncurses ","
functions returning an
.I int
recognize several error conditions.
.bP
All return
.B ERR
if the screen has not been initialized;
see \fBinitscr\fP(3X) or \fBnewterm\fP(3X).
.bP
All except
.B \%start_color
return
.B ERR
if
.B \%start_color
has not been called,
or itself returned
.BR ERR "."
.bP
.B \%start_color
returns
.B ERR
if it cannot allocate memory for its color pair table.
.bP
.B \%init_color
returns
.B ERR
if the terminal type does not support assignable color values;
that is,
if the
.B \%initialize_color
.RB ( initc )
capability is absent from its description.
.bP
.B \%init_color
returns
.B ERR
if any of its
.IR r ","
.IR g ","
.I b
arguments is outside the range 0-1000 inclusive.
.bP
.BR \%init_pair ","
.BR \%init_color ","
.BR \%init_extended_pair ","
.BR \%init_extended_color ","
.BR \%color_content ","
.BR \%pair_content ","
.BR \%extended_color_content ","
and
.B \%extended_pair_content
return
.B ERR
on attempts to use
.RS
.bP
color identifiers outside the range
.RB \%0- COLORS \-1
inclusive,
the default colors extension notwithstanding,
or
.bP
color pair identifiers outside the range
.RB \%0- COLOR_PAIRS \-1
inclusive.
.RE
.SH NOTES
In the \fI\%ncurses\fP implementation,
there is a separate color activation flag,
color palette, color pairs table,
and associated \fB\%COLORS\fP and \fB\%COLOR_PAIRS\fP counts
for each screen; the \fB\%start_color\fP function only affects the current
screen.
The SVr4/XSI interface is not really designed with this in mind, and
In
.IR \%ncurses ","
.B \%init_pair
accepts negative foreground and background color arguments
to support its \fB\%use_default_colors\fP(3X) extension,
but only after the latter function has been called.
.PP
The assumption that
.B \%COLOR_BLACK
is the terminal's default background color can be overridden using
.IR \%ncurses 's
\fB\%assume_default_colors\fP(3X) extension.
.PP
In
.IR \%ncurses ","
each pointer passed to
.B \%color_content
and
.B \%pair_content
can be null,
in which case the library ignores it,
permitting the application to disregard unnecessary information.
.PP
In
.IR \%ncurses ","
each screen has a
color activation flag,
color palette,
color pair table,
and associated
.B \%COLORS
and
.B \%COLOR_PAIRS
values;
.B \%start_color
affects only the current screen.
The SVr4 and X/Open Curses interface was not really designed
with this in mind;
historical implementations may use a single shared color palette.
.PP
Setting an implicit background color via a color pair affects only
character cells that a character write operation explicitly touches.
To change
the background color used when parts of a window are blanked by erasing or
scrolling operations, see \fB\%curs_bkgd\fP(3X).
To change the background color used
when parts of a window are blanked by erasing or scrolling operations,
see \fB\%curs_bkgd\fP(3X).
.PP
Several caveats apply on older x86 machines
(e.g., i386, i486) with VGA-compatible graphics:
Several caveats apply to IBM PC-compatible machines
of the 80486 era and earlier
with CGA/EGA/VGA video.
.bP
COLOR_YELLOW is actually brown.
To get yellow, use COLOR_YELLOW combined with the \fBA_BOLD\fP attribute.
.B \%COLOR_YELLOW
was frequently converted,
in the analog domain,
to a shade of brown if the intensity bit was not set.
.\" https://nerdlypleasures.blogspot.com/2023/03/the-saga-of-color-brown-in-early-years.html
To get yellow on such devices,
one would combine
.B \%COLOR_YELLOW
with the
.B \%A_BOLD
attribute.
.bP
The A_BLINK attribute should in theory cause the background to go bright.
This often fails to work, and even some cards for which it mostly works
(such as the
Paradise and compatibles) do the wrong thing when you try to set a bright
\*(``yellow\*('' background (you get a blinking yellow foreground instead).
The
.B \%A_BLINK
attribute should in theory make the background bright.
This often fails to work,
and even VGA controllers for which it mostly works,
such as those from Paradise and compatibles,
do the wrong thing
when you try to set a bright \*(``yellow\*('' background \(em
you get a blinking yellow foreground instead.
.bP
Color RGB values are not settable.
Color RGB values are not configurable on these devices
(in text mode).
.SH EXTENSIONS
The functions marked as extensions were designed for
\fB\%ncurses\fP(3X),
The functions marked as extensions originated in
.IR \%ncurses ","
and are not found in SVr4
.IR curses ,
4.4BSD
.IR curses ,
or any other previous curses implementation.
or any other previous
.I curses
implementation.
.SH PORTABILITY
Applications employing
.I \%ncurses
@@ -506,81 +650,149 @@ extensions should condition their use on the visibility of the
.B \%NCURSES_VERSION
preprocessor macro.
.PP
This implementation satisfies X/Open Curses's minimum maximums
for \fB\%COLORS\fP and \fB\%COLOR_PAIRS\fP.
X/Open Curses Issue\ 4 describes these functions.
It specifies no error conditions for them.
.PP
The \fB\%init_pair\fP routine accepts negative values of foreground
and background color to support the \fB\%use_default_colors\fP(3X) extension,
but only if that routine has been first invoked.
.PP
The assumption that \fB\%COLOR_BLACK\fP is the default
background color for all terminals can be modified using the
\fB\%assume_default_colors\fP(3X) extension.
.PP
This implementation checks the pointers,
e.g., for the values returned by
\fB\%color_content\fP and \fB\%pair_content\fP,
and will treat those as optional parameters when null.
.I \%ncurses
satisfies X/Open Curses's minimum maximums for
.I \%COLORS
and
.IR \%COLOR_PAIRS "."
.PP
X/Open Curses does not specify a limit for the number of colors and
color pairs which a terminal can support.
However, in its use of \fBshort\fP for the parameters,
However,
in its use of
.I short
for the parameters,
it carries over SVr4's implementation detail for the compiled
terminfo database, which uses signed 16-bit numbers.
This implementation provides extended versions of those functions
which use \fBshort\fP parameters,
allowing applications to use larger color- and pair-numbers.
.I \%term\%info
database,
which uses signed 16-bit numbers.
.I \%ncurses
provides extended versions of the functions using
.I short
parameters,
allowing applications to use larger color and pair identifiers.
.PP
The \fB\%reset_color_pairs\fP function is an extension of
\fI\%ncurses\fP.
SVr4
.I curses
returns
.I ERR
from
.I \%pair_content
if its
.I pair
argument
was not initialized using
.IR \%init_pairs ,
and from
.I \%color_content
if the terminal does not support changing colors.
.I \%ncurses
does neither.
.SH HISTORY
SVr3.2 introduced color support to curses in 1987.
SVr3.2 (1987) introduced color support to
.I curses
with all of the symbols
in the synopsis above except those marked as extensions.
It reserved color pair 0 as the terminal's initial,
\*(``uncolored\*('' state,
.\" "we assume that color 0 is always a default background.", SVr3.2
.\" usr/src/lib/libcurses/screen/start_col.c
and limited the number of possible color pairs to 64,
because the color pair datum was encoded in six bits of a
.IR \%chtype "."
.PP
SVr4 made internal changes,
e.g., moving the storage for the color state
from \fBSP\fP (the \fISCREEN\fP structure)
to \fB\%cur_term\fP (the \fI\%TERMINAL\fP structure),
but provided the same set of library functions.
SVr4 made only internal changes,
such as moving the storage of color state
from the
.I SCREEN
structure
(pointed to by
.IR SP )
to the
.I \%TERMINAL
structure
(pointed to by
.IR \%cur_term ")."
.PP
SVr4 curses limits the number of color pairs to 64,
reserving color pair zero (0) as the terminal's initial uncolored state.
This limit arises because the color pair information is a bitfield
in the \fB\%chtype\fP data type (denoted by \fB\%A_COLOR\fP).
.PP
Other implementations of curses had different limits:
Other
.I curses
implementations impose different limits on the number of colors and
color pairs.
.bP
PCCurses (1987-1990) provided for only eight (8) colors.
.I \%PCCurses
(1987-1990) provided for only 8 colors
(and therefore required at most 8\(mu8 = 64 color pairs).
.bP
PDCurses (1992-present) inherited the 8-color limitation from PCCurses,
.I \%PDCurses
(1992-present) inherited the 8-color limitation from
.IR \%PCCurses ,
but changed this to 256 in version 2.5 (2001),
along with changing \fB\%chtype\fP from 16-bits to 32-bits.
and widened its
.I \%chtype
from 16 to 32 bits.
.bP
X/Open Curses (1992-present)
added a new structure \fB\%cchar_t\fP to store the character,
attributes and color pair values, allowing increased range of color pairs.
Both color pairs and color-values used a signed \fBshort\fP,
limiting values to 15 bits.
specified a new structure type,
.IR \%cchar_t ","
to store the character code,
attribute flags,
and color pair identifier,
allowing an increased range of color pairs.
It specifies a
.I short
as storing identifiers for colors and color pairs,
limiting portable values to 15 bits;
negative values are invalid in System\ V.
.bP
\fI\%ncurses\fP (1992-present) uses eight bits
for \fB\%A_COLOR\fP in \fB\%chtype\fP values.
.I \%ncurses
(1992-present),
in its non-wide-character configuration,
uses 8 bits of
.I \%chtype
for the color pair identifier.
.IP
Version 5.3 provided a wide-character interface (2002),
but left color pairs as part of the attributes-field.
Version 5.3 (2002) offered a wide-character interface,
but encoded the color pair identifier with attributes
in the character type.
.IP
Since version 6 (2015),
ncurses uses a separate \fBint\fP for color pairs in the \fB\%cchar_t\fP values.
When those color pair values fit in 8 bits,
ncurses allows color pairs to be manipulated
via the functions using \fB\%chtype\fP values.
.I \%ncurses
uses a separate
.I int
for the color pair identifier in a
.IR \%cchar_t ","
introducing extension functions to manage the wider type.
When a color pair value fits in 8 bits,
.I \%ncurses
permits color pair data to be manipulated
via the functions taking
.I \%chtype
arguments,
even when a
.I curses
window uses wide-character cells.
.bP
NetBSD curses used 6 bits from
2000 (when colors were first supported) until 2004.
At that point, NetBSD changed to use 10 bits.
As of 2021, that size is unchanged.
Like \fI\%ncurses\fP before version 6,
the NetBSD color pair information is stored in
the attributes field of \fB\%cchar_t\fP, limiting the number of color pairs
by the size of the bitfield.
NetBSD
.I curses
used 6 bits for the color pair identifier from 2000
(when it first added color support)
until 2004.
At that point,
NetBSD widened the color pair identifier to use 9 bits.
As of 2025,
that size is unchanged.
.\" http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libcurses/curses.h?rev=1.133
.\" indicates a mask of 0x03fe0000.
Like
.I \%ncurses
before version 6,
the NetBSD color pair datum is stored in
the attributes field of
.IR \%cchar_t ","
limiting the number of color pairs.
.SH SEE ALSO
\fB\%curses\fP(3X),
\fB\%curs_attr\fP(3X),
+35 -21
View File
@@ -1,5 +1,5 @@
.\"***************************************************************************
.\" Copyright 2018-2023,2024 Thomas E. Dickey *
.\" Copyright 2018-2024,2025 Thomas E. Dickey *
.\" Copyright 1998-2006,2010 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@@ -27,8 +27,8 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: curs_delch.3x,v 1.34 2024/04/20 19:24:14 tom Exp $
.TH curs_delch 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.\" $Id: curs_delch.3x,v 1.49 2025/04/05 21:59:53 tom Exp $
.TH curs_delch 3X 2025-04-05 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
@@ -39,6 +39,11 @@
.ie t .ds '' ''
.el .ds '' ""
.\}
.
.de bP
.ie n .IP \(bu 4
.el .IP \(bu 2
..
.SH NAME
\fB\%delch\fP,
\fB\%wdelch\fP,
@@ -50,27 +55,25 @@ delete a character from a \fIcurses\fR window
\fB#include <curses.h>
.PP
\fBint delch(void);
\fBint wdelch(WINDOW *\fIwin\fP);
\fBint wdelch(WINDOW * \fIwin\fP);
\fBint mvdelch(int \fIy\fP, int \fIx\fP);
\fBint mvwdelch(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP);
\fBint mvwdelch(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP);
.fi
.SH DESCRIPTION
.B \%wdelch
deletes the character at the cursor position in
.IR win .
\fB\%ncurses\fP(3X) describes the variants of this function.
.PP
.B \%wdelch
moves all characters to the right of the cursor on the same line to the
left one position and replaces the contents of the rightmost position on
the line with the window's blank character;
It moves all characters to the right of the cursor on the same line to
the left one position and replaces the contents of the rightmost
position on the line with the window's background character;
see \fB\%bkgd\fP(3X)
(wide-character API users may consult \fB\%bkgrnd\fP(3X) instead).
(wide-character API users: \fB\%bkgrnd\fP(3X)).
The cursor position does not change
(after moving to
.RI ( y ,
.IR x ),
if specified).
\fB\%ncurses\fP(3X) describes the variants of this function.
.SH RETURN VALUE
These functions return
.B OK
@@ -78,10 +81,20 @@ on success and
.B ERR
on failure.
.PP
Functions taking a
In
.IR \%ncurses ,
these functions fail if
.bP
the
.I curses
screen has not been initialized,
or
.bP
(for functions taking a
.I \%WINDOW
pointer argument fail if the pointer is
.BR NULL .
pointer argument)
.I win
is a null pointer.
.PP
Functions prefixed with \*(``mv\*('' first perform cursor movement and
fail if the position
@@ -101,13 +114,14 @@ A terminal's
capability
is not necessarily employed.
.SH PORTABILITY
X/Open Curses,
Issue 4 describes these functions.
X/Open Curses Issue\ 4 describes these functions.
It specifies no error conditions for them.
.PP
SVr4
.I curses
describes a successful return value only as
SVr4 describes a successful return value only as
\*(``an integer value other than
.BR ERR \*(''.
.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 489
.SH HISTORY
SVr2 (1984) introduced
.IR \%wdelch "."
.SH SEE ALSO
\fB\%curses\fP(3X)
+85 -41
View File
@@ -1,5 +1,5 @@
.\"***************************************************************************
.\" Copyright 2018-2023,2024 Thomas E. Dickey *
.\" Copyright 2018-2024,2025 Thomas E. Dickey *
.\" Copyright 1998-2007,2010 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@@ -27,8 +27,8 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: curs_deleteln.3x,v 1.38 2024/04/20 21:20:07 tom Exp $
.TH curs_deleteln 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.\" $Id: curs_deleteln.3x,v 1.55 2025/07/05 12:46:36 tom Exp $
.TH curs_deleteln 3X 2025-07-05 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
@@ -43,62 +43,106 @@
.SH NAME
\fB\%deleteln\fP,
\fB\%wdeleteln\fP,
\fB\%insdelln\fP,
\fB\%winsdelln\fP,
\fB\%insertln\fP,
\fB\%winsertln\fP \-
\fB\%winsertln\fP,
\fB\%insdelln\fP,
\fB\%winsdelln\fP \-
delete or insert lines in a \fIcurses\fR window
.SH SYNOPSIS
.nf
\fB#include <curses.h>
.PP
\fBint deleteln(void);
\fBint wdeleteln(WINDOW *\fIwin\fP);
.PP
\fBint insdelln(int \fIn\fP);
\fBint winsdelln(WINDOW *\fIwin\fP, int \fIn\fP);
\fBint wdeleteln(WINDOW * \fIwin\fP);
.PP
\fBint insertln(void);
\fBint winsertln(WINDOW *\fIwin\fP);
\fBint winsertln(WINDOW * \fIwin\fP);
.PP
\fBint insdelln(int \fIn\fP);
\fBint winsdelln(WINDOW * \fIwin\fP, int \fIn\fP);
.fi
.SH DESCRIPTION
The \fBdeleteln\fP and \fBwdeleteln\fP routines delete the line under the
cursor in the window; all lines below the current line are moved up one line.
The bottom line of the window is cleared.
.B \%wdeleteln
deletes the line at the cursor in
.IR win ;
all lines below it move up one line.
.I curses
then fills the bottom line of
.I win
with the background character
configured by \fB\%wbkgdset\fP(3X)
(wide-character API users: \fB\%wbkgrndset\fP(3X)).
The cursor position does not change.
.PP
The \fBinsdelln\fP and \fBwinsdelln\fP routines, for positive \fIn\fP, insert
\fIn\fP lines into the specified window above the current line.
The \fIn\fP
bottom lines are lost.
For negative \fIn\fP, delete \fIn\fP lines (starting
with the one under the cursor), and move the remaining lines up.
The bottom
\fIn\fP lines are cleared.
The current cursor position remains the same.
.B \%winsertln
inserts a new, empty line of characters above the line at the cursor in
.IR win ,
shifting the existing lines down by one.
The content of the window's bottom line is lost;
.I curses
fills the new line with the background character.
The cursor position does not change.
.PP
The \fBinsertln\fP and \fBwinsertln\fP routines insert a blank line above the
current line and the bottom line is lost.
.B \%winsdelln
inserts or deletes
.IR n\ lines
in
.I win
as
.I n
is positive or negative,
respectively,
as if by repeatedly calling
.B \%winsertln
or
.BR \%wdeleteln "."
.BR \%winsdelln( ".\|.\|." ", 0)"
performs no operation.
.SH RETURN VALUE
These routines return the integer \fBERR\fP upon failure and an \fBOK\fP
(SVr4 specifies only
\*(``an integer value other than \fBERR\fP\*('')
upon successful completion.
These functions return
.B OK
on success and
.B ERR
on failure.
.PP
X/Open defines no error conditions.
In this implementation,
if the window parameter is null, an error is returned.
In
.IR \%ncurses ","
they fail if
.I win
is
.IR NULL "."
.SH NOTES
Note that all but \fBwinsdelln\fP may be macros.
All of these functions except
.B \%winsdelln
may be implemented as macros.
.PP
These routines do not require a hardware line delete or insert feature in the
terminal.
In fact, they will not use hardware line delete/insert unless
\fBidlok(..., TRUE)\fP has been set on the current window.
These functions do not require the terminal
to possess hardware line deletion or insertion capabilities.
Even if available,
by default
.I curses
does not use them;
see \fB\%idlok\fP(3X).
.SH PORTABILITY
These functions are described in X/Open Curses, Issue 4.
The
standard specifies that they return \fBERR\fP on failure, but specifies no
error conditions.
X/Open Curses Issue\ 4 describes these functions.
It specifies no error conditions for them.
.PP
SVr4 describes a successful return value only as
\*(``an integer value other than
.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 490
.SH HISTORY
4BSD (1980)
introduced
.IR \%deleteln ","
.IR \%wdeleteln ","
.IR \%insertln ","
and
.IR \%winsertln "."
.PP
SVr3.1 (1987)
added
.I \%insdelln
and
.IR \%winsdelln "."
.SH SEE ALSO
\fB\%curses\fP(3X)
+62 -31
View File
@@ -1,5 +1,5 @@
.\"***************************************************************************
.\" Copyright 2018-2023,2024 Thomas E. Dickey *
.\" Copyright 2018-2024,2025 Thomas E. Dickey *
.\" Copyright 1999-2010,2016 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@@ -29,8 +29,8 @@
.\"
.\" Author: Thomas E. Dickey 1999-on
.\"
.\" $Id: curs_extend.3x,v 1.46 2024/03/16 15:35:01 tom Exp $
.TH curs_extend 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.\" $Id: curs_extend.3x,v 1.67 2025/11/12 00:46:51 tom Exp $
.TH curs_extend 3X 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
@@ -44,59 +44,89 @@
.SH NAME
\fB\%curses_version\fP,
\fB\%use_extended_names\fP \-
miscellaneous \fIcurses\fR extensions
miscellaneous \fIncurses\fR extensions
.SH SYNOPSIS
.nf
\fB#include <curses.h>
.PP
\fBconst char * curses_version(void);
\fBint use_extended_names(bool \fIenable\fP);
\fBint use_extended_names(bool \fIbf\fP);
.fi
.SH DESCRIPTION
These functions are extensions to the curses library
which do not fit easily into other categories.
These
.I \%ncurses
extensions to the
.I curses
library do not fit easily into other functional categories.
.SS curses_version
Use \fBcurses_version\fP
to get the version number, including patch level of the library,
prefixed by \*(``ncurses\*('', e.g.,
.RS
.sp
.B ncurses 5.0.19991023
.RE
.B \%curses_version
returns a pointer to a string containing the library's name
and version number,
including its patch level,
for example
\*(``ncurses 6.5.20240720\*(''.
.SS use_extended_names
The \fBuse_extended_names\fP
function controls whether the calling application
is able to use user-defined or nonstandard names
which may be compiled into the terminfo
description, i.e., via the terminfo or termcap interfaces.
Normally these names are available for use, since the essential decision
is made by using the \fB\-x\fP option of \fB@TIC@\fP to compile
extended terminal definitions.
However you can disable this feature
to ensure compatibility with other implementations of curses.
.B \%use_extended_names
configures whether the library recognizes
user-defined or nonstandard
.I \%term\%info
capability names that may be compiled into terminal type descriptions
via the \fB\%curs_terminfo\fP(3X) or \fB\%curs_termcap\fP(3X) interfaces.
Normally these names are available for use,
since the essential decision
is made through use of \fB\%@TIC@\fP(1)'s
.B \-x
option to include such extensions in terminal type descriptions.
.B \%use_extended_names(FALSE)
prevents
.I \%ncurses
from recognizing these capabilities
to ensure compatibility with other implementations of
.IR curses .
.SH RETURN VALUE
\fBcurses_version\fP returns a pointer to static memory; you should not free
this in your application.
.B \%curses_version
returns a constant string.
.PP
\fBuse_extended_names\fP returns the previous state, allowing you to
save this and restore it.
.B \%use_extended_names
returns the previous state of extended capability name recognition,
allowing you to save this property and restore it.
.SH NOTES
The pointer returned by
.B \%curses_version
corresponds to statically allocated memory;
do not attempt to \fIfree\fP(3) it.
.SH EXTENSIONS
These functions are \fB\%ncurses\fP(3X) extensions,
These functions are
.I \%ncurses
extensions,
and are not found in SVr4
.IR curses ,
4.4BSD
.IR curses ,
or any other previous curses implementation.
or any other previous
.I curses
implementation.
.SH PORTABILITY
Applications employing
.I \%ncurses
extensions should condition their use on the visibility of the
.B \%NCURSES_VERSION
preprocessor macro.
.PP
NetBSD 9 added a
.I \%curses_version
function
that intentionally returns a string devoid of version information.
.\" See https://mail-index.netbsd.org/tech-userlevel/2019/08/27/\
.\" msg012068.html and follow-up messages.
.SH AUTHORS
Thomas Dickey.
Thomas Dickey
.SH SEE ALSO
.I \%ncurses
offers several other extensions to the X/Open Curses API.
.PP
\fB\%curs_getch\fP(3X),
\fB\%curs_inopts\fP(3X),
\fB\%curs_mouse\fP(3X),
\fB\%curs_print\fP(3X),
\fB\%curs_util\fP(3X),
@@ -104,5 +134,6 @@ Thomas Dickey.
\fB\%define_key\fP(3X),
\fB\%keybound\fP(3X),
\fB\%keyok\fP(3X),
\fB\%new_pair\fP(3X),
\fB\%resizeterm\fP(3X),
\fB\%wresize\fP(3X)
+115 -60
View File
@@ -1,5 +1,5 @@
.\"***************************************************************************
.\" Copyright 2018-2023,2024 Thomas E. Dickey *
.\" Copyright 2018-2024,2025 Thomas E. Dickey *
.\" Copyright 2002-2016,2017 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@@ -27,8 +27,8 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: curs_get_wch.3x,v 1.40 2024/04/20 19:23:03 tom Exp $
.TH curs_get_wch 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.\" $Id: curs_get_wch.3x,v 1.71 2025/08/16 19:11:47 tom Exp $
.TH curs_get_wch 3X 2025-08-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
@@ -50,27 +50,25 @@
\fB\%mvget_wch\fP,
\fB\%mvwget_wch\fP,
\fB\%unget_wch\fP \-
get (or push back) a wide character from \fIcurses\fR terminal keyboard
get (or push back) a wide character from \fIcurses\fR terminal keyboard buffer
.SH SYNOPSIS
.nf
\fB#include <curses.h>
.PP
\fBint get_wch(wint_t *\fIwch\fP);
\fBint wget_wch(WINDOW *\fIwin\fP, wint_t *\fIwch\fP);
\fBint mvget_wch(int \fIy\fP, int \fIx\fP, wint_t *\fIwch\fP);
\fBint mvwget_wch(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, wint_t *\fIwch\fP);
\fBint get_wch(wint_t * \fIwch\fP);
\fBint wget_wch(WINDOW * \fIwin\fP, wint_t * \fIwch\fP);
\fBint mvget_wch(int \fIy\fP, int \fIx\fP, wint_t * \fIwch\fP);
\fBint mvwget_wch(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, wint_t * \fIwch\fP);
.PP
\fBint unget_wch(const wchar_t \fIwc\fP);
.fi
.SH DESCRIPTION
.SS "Reading Characters"
.B \%wget_wch
gathers a key stroke
.I wch
from the terminal keyboard associated with a
gathers a key event from the terminal keyboard associated with a
.I curses
window
.IR win ,
.IR win ","
returning
.B OK
if a wide character is read,
@@ -84,48 +82,55 @@ if no key event is available.
When input is pending,
.B \%wget_wch
stores an integer
identifying the key stroke in
.IR wch ;
identifying the key event in
.IR wch ";"
for alphanumeric and punctuation keys,
this value corresponds to the character encoding used by the terminal.
Use of the control key as a modifier often results in a distinct code.
Use of the control key as a modifier,
by holding it down while pressing and releasing another key,
often results in a distinct code.
The behavior of other keys depends on whether
.I win
is in keypad mode;
see subsections \*(``Keypad Mode\*('' and \*(``Predefined Key Codes\*(''
see subsections \*(``Keypad Mode\*('' and \*(``Key Codes\*(''
in \fB\%getch\fP(3X).
.PP
If no input is pending,
then if the no-delay flag is set in the window
(see \fB\%nodelay\fP(3X)),
the function returns
.BR ERR ;
.BR ERR ";"
otherwise,
.I curses
waits until the terminal has input.
If \fB\%cbreak\fP(3X)
If \fB\%cbreak\fP(3X) or \fB\%raw\fP(3X)
has been called,
this happens after one character is read.
If \fB\%nocbreak\fP(3X)
If \fB\%nocbreak\fP(3X) or \fB\%noraw\fP(3X)
has been called,
it occurs when the next newline is read.
(Because the terminal's canonical or \*(``cooked\*('' mode
is line-buffered,
multiple
.B \%wget_wch
calls may then be necessary to empty the input queue.)
If \fB\%halfdelay\fP(3X)
has been called,
.I curses
waits until a character is typed or the specified delay elapses.
waits until input is available or the specified delay elapses.
.PP
If \fB\%echo\fP(3X) has been called,
and the window is not a pad,
.I curses
writes
.I wch
writes the wide character
from the input queue
to the window
(at the cursor position)
per the following rules.
.bP
If
.I wch
matches the terminal's erase character,
If the wide character
matches the terminal's erase character
(see \fB\%erasewchar\fP(3X)),
the cursor moves leftward one position
and the new position is erased
as if \fB\%wmove\fP(3X) and then \fB\%wdelch\fP(3X) were called.
@@ -138,62 +143,73 @@ are handled the same way.
.bP
.I curses
writes any other
.I wch
wide character
to the window,
as with \fB\%wecho_wchar\fP(3X).
.bP
If the window has been moved or modified since the last call to
If the window
.I win
has been moved or modified since the last call to
\fB\%wrefresh\fP(3X),
.I curses
calls
.BR \%wrefresh .
.B \%wrefresh
on it.
.PP
If
.I wch
If the wide character
is a carriage return and \fBnl\fP(3X) has been called,
.B \%wgetch
stores the the character code for newline
(line feed)
in
.B \%wget_wch
stores the wide character code for line feed in
.I wch
instead.
.SS "Ungetting Characters"
.B \%unget_wch
places
.I wch
into the input queue to be returned by the next call to
.BR \%wget_wch .
A single input queue serves all windows.
.I wc
into the input queue to be retrieved by the next call to
.BR \%wget_wch "."
A single input queue serves all windows associated with the screen.
.SH RETURN VALUE
.B \%wget_wch
returns
.B OK
when it reads a wide character and
when it reads a wide character,
.B \%KEY_CODE_YES
when it reads a function key code.
It returns
when it reads a function key code,
and
.B ERR
if
on failure.
.B \%wget_wch
fails if
its timeout expires without any data arriving,
which cannot happen if \fB\%nodelay\fP(3X) is in effect on the window.
.PP
In
.IR \%ncurses ,
.B \%wget_wch
also fails if
.bP
the
.I \%WINDOW
pointer is
.BR NULL ,
or
.I curses
screen has not been initialized,
.bP
its timeout expires without any data arriving,
(for functions taking a
.I \%WINDOW
pointer argument)
.I win
is a null pointer,
or
.bP
execution was interrupted by a signal,
in which case
.B \%errno
.I \%errno
is set to
.BR \%EINTR .
.IR \%EINTR "."
.PP
Functions prefixed with \*(``mv\*('' first perform cursor movement and
fail if the position
.RI ( y ,
.IR x )
.IR x ")"
is outside the window boundaries.
.PP
.B \%unget_wch
@@ -201,7 +217,18 @@ returns
.B OK
on success and
.B ERR
if there is no more room in the input queue.
on failure.
In
.IR \%ncurses ,
.B \%unget_wch
fails if
.bP
the
.I curses
screen has not been initialized,
or
.bP
there is no more room in the input queue.
.SH NOTES
See the \*(``NOTES\*('' section of \fB\%wgetch\fP(3X).
.PP
@@ -213,23 +240,21 @@ may be implemented as macros.
.PP
Unlike \fB\%wgetch\fP(3X),
.B \%wget_wch
and its variants store the value of the input character in an additional
stores the value of the input character in an additional
.I wch
parameter instead of the return value.
.PP
Unlike
.BR \%ungetch ,
.BR \%ungetch ","
.B \%unget_wch
cannot distinguish function key codes
.B \%wget_wch
from conventional character codes.
cannot distinguish function key codes from conventional character codes.
An application can overcome this limitation by pushing function key
codes with
.B \%ungetch
and subsequently checking the return value of
.B \%wget_wch
for a match with
.BR \%KEY_CODE_YES .
.BR \%KEY_CODE_YES "."
.SH EXTENSIONS
See the \*(``EXTENSIONS\*('' section of \fB\%wgetch\fP(3X).
.SH PORTABILITY
@@ -239,14 +264,44 @@ extensions should condition their use on the visibility of the
.B \%NCURSES_VERSION
preprocessor macro.
.PP
X/Open Curses,
Issue 4 describes these functions.
X/Open Curses Issue\ 4 describes these functions.
It specifies no error conditions for them.
.PP
See the \*(``PORTABILITY\*('' section of \fB\%wgetch\fP(3X) regarding
the interaction of
.B \%wget_wch
.I \%wget_wch
with signal handlers.
.SH HISTORY
X/Open Curses Issue\ 4 (1995) initially specified these functions.
The System\ V Interface Definition Version\ 4
of the same year
specified functions named
.I \%wgetwch
(with its variants)
.IR \%ungetwch "."
.\" SVID 4, vol 3., pp. 496-499
These were later additions to
.RI SVr4. x ,
not appearing in the first SVr4 (1989).
They differ from X/Open's later
.I \%wget_wch
and
.I \%unget_wch
in that
.I \%wgetwch
takes no
.I wch
argument,
but returns the (wide) key code as an
.I int
(with no provision for distinguishing a character code
from a function key code);
and
.I \%ungetwch
takes a
.RI non- const
.I int
argument.
.SH SEE ALSO
\fB\%curs_getch\fP(3X) describes comparable functions of the
.I \%ncurses
+300 -125
View File
@@ -1,5 +1,5 @@
.\"***************************************************************************
.\" Copyright 2018-2023,2024 Thomas E. Dickey *
.\" Copyright 2018-2024,2025 Thomas E. Dickey *
.\" Copyright 2002-2012,2017 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@@ -27,17 +27,19 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: curs_get_wstr.3x,v 1.48 2024/04/20 19:18:18 tom Exp $
.TH curs_get_wstr 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.\" $Id: curs_get_wstr.3x,v 1.79 2025/10/21 00:08:50 tom Exp $
.TH curs_get_wstr 3X 2025-10-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
.ds ^ \(ha
.\}
.el \{\
.ie t .ds `` ``
.el .ds `` ""
.ie t .ds '' ''
.el .ds '' ""
.ds ^ ^
.\}
.
.de bP
@@ -53,99 +55,136 @@
\fB\%mvgetn_wstr\fP,
\fB\%mvwget_wstr\fP,
\fB\%mvwgetn_wstr\fP \-
get a wide-character string from a \fIcurses\fR terminal keyboard
read a wide-character string from a \fIcurses\fR terminal keyboard
.SH SYNOPSIS
.nf
\fB#include <curses.h>
.PP
\fBint get_wstr(wint_t *\fIwstr\fP);
\fBint getn_wstr(wint_t *\fIwstr\fP, int \fIn\fP);
\fBint wget_wstr(WINDOW *\fIwin\fP, wint_t *\fIwstr\fP);
\fBint wgetn_wstr(WINDOW *\fIwin\fP, wint_t *\fIwstr\fP, int \fIn\fP);
\fBint get_wstr(wint_t * \fIwstr\fP);
\fBint wget_wstr(WINDOW * \fIwin\fP, wint_t * \fIwstr\fP);
\fBint mvget_wstr(int \fIy\fP, int \fIx\fP, wint_t * \fIwstr\fP);
\fBint mvwget_wstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, wint_t * \fIwstr\fP);
.PP
\fBint mvget_wstr(int \fIy\fP, int \fIx\fP, wint_t *\fIwstr\fP);
\fBint mvgetn_wstr(int \fIy\fP, int \fIx\fP, wint_t *\fIwstr\fP, int \fIn\fP);
\fBint mvwget_wstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, wint_t *\fIwstr\fP);
\fBint mvwgetn_wstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, wint_t *\fIwstr\fP, int \fIn\fP);
\fBint getn_wstr(wint_t * \fIwstr\fP, int \fIn\fP);
\fBint wgetn_wstr(WINDOW * \fIwin\fP, wint_t * \fIwstr\fP, int \fIn\fP);
\fBint mvgetn_wstr(int \fIy\fP, int \fIx\fP, wint_t * \fIwstr\fP, int \fIn\fP);
\fBint mvwgetn_wstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, wint_t * \fIwstr\fP, int \fIn\fP);
.fi
.SH DESCRIPTION
.B \%wget_wstr
populates a user-supplied wide-character string buffer
.I wstr
by repeatedly calling \fBwget_wch\fP(3X)
with the
.I win
argument
until a line feed or carriage return character is input.
The function
\fBwgetn_wstr\fP
is equivalent to a series of calls to
\fBwget_wch\fP(3X)
until a newline or carriage return terminates the series:
.bP
The terminating character is not included in the returned string.
does not copy the terminating character to
.IR wstr ";"
.bP
An end-of-file condition is represented by \fBWEOF\fP,
as defined in \fB<wchar.h>\fP.
populates
.I wstr
with
.I WEOF
(as defined in
.IR \%wchar.h )
if an end-of-file condition occurs on the input;
.bP
In all instances, the end of the string is terminated
by a null \fBwchar_t\fP.
always terminates the string with a null wide character
(after any
.IR WEOF );
.bP
The function stores the result in the area pointed to
by the \fIwstr\fP parameter.
interprets the screen's wide erase and wide kill characters
(see \fB\%erasewchar\fP(3X) and \fB\%killwchar\fP(3X));
.bP
The function reads at most \fIn\fP characters,
thus preventing a possible overflow of the input buffer.
.IP
Any attempt to enter more characters
(other than the terminating newline or carriage return)
causes a beep.
.IP
Function keys also cause a beep and are ignored.
recognizes function keys only if the screen's keypad option is enabled
(see \fB\%keypad\fP(3X));
.bP
treats the function keys
.B \%KEY_LEFT
and
.B \%KEY_BACKSPACE
the same as the wide erase character;
and
.bP
discards function key inputs other than those
treated as the wide erase or wide kill characters,
calling \fBbeep\fP(3X).
.PP
The user's \fIerase\fP and \fIkill\fP characters are interpreted:
.bP
The \fIerase\fP character (e.g., \fB^H\fP) erases the character
at the end of the buffer, moving the cursor to the left.
.IP
If \fIkeypad\fP mode is on for the window,
\fBKEY_LEFT\fP and \fBKEY_BACKSPACE\fP
are both considered equivalent to the user's \fIerase\fP character.
.bP
The \fIkill\fP character (e.g., \fB^U\fP) erases the entire buffer,
leaving the cursor at the beginning of the buffer.
The wide erase character replaces the character at the end of the buffer
with a null wide character,
while the wide kill character does the same for the entire buffer.
.PP
Characters input are echoed only if \fBecho\fP is currently on.
In that case,
backspace is echoed as deletion of the previous character
(typically a left motion).
If the screen's echo option is enabled
(see \fBecho\fP(3X)),
.B \%wget_wstr
updates
.I win
with \fB\%wadd_wch\fP(3X).
Further,
.bP
the wide erase character
and its function key synonyms
move the cursor to the left,
and
.bP
the wide kill character returns the cursor to where it was located when
.B \%wget_wstr
was called.
.PP
The
\fBgetn_wstr\fP,
\fBmvgetn_wstr\fP,
\fBmvwgetn_wstr\fP, and
\fBwgetn_wstr\fP
functions are identical
to the
\fBget_wstr\fP,
\fBmvget_wstr\fP,
\fBmvwget_wstr\fP, and
\fBwget_wstr\fP
functions, respectively,
except that the
\fB*n_*\fP
versions read at most
\fIn\fP
characters, letting the application prevent overflow of the
input buffer.
.B \%wgetn_wstr
is similar,
but reads at most
.I n
wide characters,
aiding the application to avoid overrunning the buffer to which
.I wstr
points.
.I curses
ignores an attempt to input more than
.I n
wide characters
(other than the terminating line feed or carriage return),
calling \fBbeep\fP(3X).
If
.I n
is negative,
.B \%wgetn_wstr
reads up to
.I LINE_MAX
wide characters
(see
.IR sysconf (3)).
.PP
\fB\%ncurses\fP(3X) describes the variants of these functions.
.SH RETURN VALUE
All of these functions return the integer \fBOK\fP upon successful completion.
If unsuccessful, they return \fBERR\fP.
These functions return
.B OK
on success and
.B ERR
on failure.
.PP
X/Open defines no error conditions.
.PP
In this implementation,
these functions return an error
In
.IR \%ncurses ","
these functions fail if
.bP
if the window pointer is null,
the
.I curses
screen has not been initialized,
.bP
if its timeout expires without having any data, or
(for functions taking a
.I \%WINDOW
pointer argument)
.I win
is a null pointer,
.bP
if the associated call to
\fBwget_wch\fP
failed.
.I wstr
is a null pointer,
or
.bP
an internal \fB\%wget_wch\fP(3X) call fails.
.PP
Functions prefixed with \*(``mv\*('' first perform cursor movement and
fail if the position
@@ -153,70 +192,206 @@ fail if the position
.IR x )
is outside the window boundaries.
.SH NOTES
Any of these functions other than
\fBwgetn_wstr\fP
may be macros.
All of these functions except
.B \%wgetn_wstr
may be implemented as macros.
.PP
Using
\fBget_wstr\fP,
\fBmvget_wstr\fP,
\fBmvwget_wstr\fP, or
\fBwget_wstr\fP
to read a line that
overflows the array pointed to by
\fBwstr\fP
causes undefined
results.
The use of
\fBgetn_wstr\fP,
\fBmvgetn_wstr\fP,
\fBmvwgetn_wstr\fP, or
\fBwgetn_wstr\fP,
respectively, is recommended.
Reading input that overruns the buffer pointed to by
.I wstr
causes undefined results.
Use the
.BR n -infixed
functions,
and allocate sufficient storage for
.I wstr
\(em at least
.IR n +1
times
.BR sizeof(wchar_t) "."
.PP
These functions cannot return \fBKEY_\fP values because there
is no way to distinguish a \fBKEY_\fP value from a valid \fBwchar_t\fP value.
These functions cannot store a
.B KEY_
value in
.I wstr
because there is no way to distinguish it
from a valid
.I \%wchar_t
value.
.PP
While these functions conceptually implement
a series of calls to
.BR \%wget_wch ","
they also temporarily change properties of the
.I curses
screen to permit simple editing of the input buffer.
Each function saves the screen's state,
calls \fBnl\fP(3X),
and,
if the screen was in canonical (\*(``cooked\*('') mode,
\fB\%cbreak\fP(3X).
Before returning,
it restores the saved screen state.
Other implementations differ in detail,
affecting which control characters they can accept in the buffer;
see section \*(``PORTABILITY\*('' below.
.PP
Unlike \fBgetstr\fP(3X) and related functions of
.IR \%ncurses 's
non-wide API,
these functions do not return
.B \%KEY_RESIZE
if a
.I \%SIGWINCH
event interrupts the function.
.SH EXTENSIONS
.BR \%getn_wstr ","
.BR \%wgetn_wstr ","
.BR \%mvgetn_wstr ","
and
.BR \%mvwgetn_wstr "'s"
handing of negative
.I n
values is an
.I \%ncurses
extension.
.SH PORTABILITY
These functions are described in The Single Unix Specification, Version 2.
No error conditions are defined.
Applications employing
.I \%ncurses
extensions should condition their use on the visibility of the
.B \%NCURSES_VERSION
preprocessor macro.
.PP
This implementation returns \fBERR\fP if the window pointer is null,
or if the lower-level \fBwget_wch\fP call returns an \fBERR\fP.
In the latter case,
an \fBERR\fP return without other data is treated as an end-of-file condition,
and the returned array contains a \fBWEOF\fP followed by a null \fBwchar_t\fP.
X/Open Curses Issue\ 4 describes these functions.
It specifies no error conditions for them.
.PP
X/Open curses documented these functions to pass an array of \fBwchar_t\fP
in 1997, but that was an error because of this part of the description:
Issue\ 4 documented these functions as passing an array of
.IR wchar_t ","
but that was an error,
conflicting with the following language in the standard.
.RS
.PP
The effect of \fBget_wstr\fP is as though a series of calls to
\fBget_wch\fP were made, until a newline character, end-of-line character, or
end-of-file character is processed.
The effect of
.IR \%get_wstr "()"
is as though a series of calls to
.IR \%get_wch "()"
were made,
until a newline character,
end-of-line character,
or end-of-file character is processed.
.\" X/Open Curses Issue 4, Version 2, p. 96.
.RE
.PP
The latter function \fIget_wch\fP can return a negative value,
while \fBwchar_t\fP is a unsigned type.
All of the vendors implement this using \fBwint_t\fP, following the standard.
.I \%get_wch
can return a negative value
.RI ( WEOF ),
but
.I \%wchar_t
is a unsigned type.
All of the vendors implement these functions using
.IR \%wint_t ","
following the Issue\ 7 standard.
.PP
X/Open Curses, Issue 7 (2009) is unclear regarding whether
the terminating \fInull \fBwchar_t\fR
value is counted in the length parameter \fIn\fP.
X/Open Curses, Issue 7 revised the corresponding description
of \fBwgetnstr\fP to address this issue.
The unrevised description of \fBwget_nwstr\fP can be interpreted either way.
This implementation counts the terminator in the length.
X/Open Curses Issue\ 7 is unclear whether the terminating null wide character
counts toward the length parameter
.IR n "."
A similar issue affected
.I \%wgetnstr
in Issue\ 4,
Version\ 2;
Issue\ 7 revised that function's description to address the issue,
but not that of
.IR \%wget_nwstr ","
leaving it ambiguous.
.I \%ncurses
counts the terminator in the length.
.PP
X/Open Curses does not specify what happens if the length \fIn\fP is negative.
X/Open Curses does not specify what happens if the length
.I n
is negative.
.bP
For analogy with \fBwgetnstr\fP,
\fI\%ncurses\fP 6.2 uses a limit (based on \fBLINE_MAX\fP).
For consistency with
.IR \%wgetnstr ","
.I \%ncurses
6.2 uses a limit based on
.IR LINE_MAX "."
.bP
Some other implementations (such as Solaris xcurses) do the same,
while others (PDCurses) do not allow this.
Some other implementations
(such as Solaris
.IR xcurses )
do the same,
while others
.RI \%( PDCurses )
do not permit a negative
.IR n "."
.bP
NetBSD 7 curses imitates \fI\%ncurses\fP 6.1 in this regard,
treating a \fB\-1\fP as an indefinite number of characters.
NetBSD\ 7
.I curses
imitates
.I \%ncurses
6.1 and earlier,
treating a negative
.I n
as an unbounded count of wide characters.
.PP
Implementations vary in their handling of input control characters.
.bP
While they may enable the screen's echo option,
some do not take it out of raw mode,
and may take cbreak mode into account
when deciding whether to handle echoing within
.I \%wgetn_wstr
or to rely on it as a side effect of calling
.IR \%wget_wch "."
.IP
Since 1995,
.I \%ncurses
has provided handlers for
.I SIGINTR
and
.I SIGQUIT
events,
which are typically generated at the keyboard with
.B \*^C
and
.B \*^\e
respectively.
In cbreak mode,
those handlers catch a signal and stop the program,
whereas other implementations write those characters into the buffer.
.bP
Starting with
.I \%ncurses
6.3 (2021),
.I \%wgetn_wstr
preserves raw mode if the screen was already in that state,
allowing one to enter the characters the terminal interprets
as interrupt and quit events
into the buffer,
for consistency with SVr4
.IR curses 's
.IR \%wgetnstr .
.SH HISTORY
X/Open Curses Issue\ 4 (1995) initially specified these functions.
The System\ V Interface Definition Version\ 4
of the same year
specified functions named
.I \%wgetwstr
and
.I \%wgetnwstr
(and the usual variants).
.\" SVID 4, vol 3., p. 500
These were later additions to
.RI SVr4. x ,
not appearing in the first SVr4 (1989).
Except in name,
their declarations did not differ from X/Open's later
.I \%wget_wstr
and
.I \%wgetn_wstr
until
X/Open Curses Issue 7 (2009)
eventually changed the type of the buffer argument to a pointer to
.IR \%wint_t "."
.SH SEE ALSO
\fB\%curs_getstr\fP(3X) describes comparable functions of the
.I \%ncurses
+279 -115
View File
@@ -1,5 +1,5 @@
.\"***************************************************************************
.\" Copyright 2019-2023,2024 Thomas E. Dickey *
.\" Copyright 2019-2024,2025 Thomas E. Dickey *
.\" Copyright 2001-2015,2017 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@@ -27,8 +27,16 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: curs_getcchar.3x,v 1.49 2024/04/20 18:55:09 tom Exp $
.TH curs_getcchar 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.\" $Id: curs_getcchar.3x,v 1.57 2025/02/23 13:48:31 tom Exp $
.TH curs_getcchar 3X 2025-02-23 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.ie \n(.g \{\
.ds ' \(aq
.\}
.el \{\
.ie t .ds ' \(aq
.el .ds ' '
.\}
.
.de bP
.ie n .IP \(bu 4
.el .IP \(bu 2
@@ -41,146 +49,302 @@ convert between a wide-character string and a \fIcurses\fR complex character
.nf
\fB#include <curses.h>
.PP
\fBint getcchar(
.B " const cchar_t *\fIwch\fP,"
.B " wchar_t *\fIwc\fP,"
.B " attr_t *\fIattrs\fP,"
.B " short *\fIcolor_pair\fP,"
.B " void *\fIopts\fP );"
.PP
.B "int setcchar("
.B " cchar_t *\fIwch\fP,"
.B " const wchar_t *\fIwc\fP,"
.B " const attr_t \fIattrs\fP,"
.B " short \fIcolor_pair\fP,"
.B " const void *\fIopts\fP );"
\fBint getcchar(const cchar_t * \fIwch\fP, wchar_t * \fIwc\fP,
attr_t * \fIattrs\fP, short * \fIpair\fP, void * \fIopts\fP);
\fBint setcchar(cchar_t * \fIwch\fP, const wchar_t * \fIwc\fP,
const attr_t \fIattrs\fP, short \fIpair\fP, const void * \fIopts\fP);
.fi
.SH DESCRIPTION
The
.I curses
complex character data type
.I \%cchar_t
is a structure type comprising
a wide-character string,
a set of attributes,
and
a color pair identifier.
The
.I \%cchar_t
structure is opaque;
do not attempt to access its members directly.
The library provides functions to manipulate this type.
.SS getcchar
The \fBgetcchar\fP function gets a wide-character string
and rendition from a \fBcchar_t\fP argument.
When \fIwc\fP is not a null pointer,
the \fBgetcchar\fP function does the following:
.bP
Extracts information from a \fBcchar_t\fP value \fIwch\fP
.bP
Stores the character attributes in the location pointed to by \fIattrs\fP
.bP
Stores the color pair in the location pointed to by \fIcolor_pair\fP
.bP
Stores the wide-character string,
characters referenced by \fIwch\fP, into the array pointed to by \fIwc\fP.
.B \%getcchar
destructures a
.I \%cchar_t
into its components.
.PP
When
\fIwc\fP
is a null pointer, the
\fBgetcchar\fP
function does the following:
If
.I wc
is not a null pointer,
.BR \%getcchar :
.bP
Obtains the number of wide characters pointed to by \fIwch\fP
stores the wide-character string in the
.I curses
complex character
.I wch
into
.IR wc ;
.bP
Does not change the data referenced by
\fIattrs\fP
or
\fIcolor_pair\fP
stores the attributes in
.IR attrs ;
and
.bP
stores the color pair identifier in
.IR pair .
.PP
If
.I wc
is a null pointer,
.B \%getcchar
counts the
.I \%wchar_t
wide characters in
.IR wch ,
returns that value,
and leaves
.I attrs
and
.I pair
unchanged.
.SS setcchar
The \fBsetcchar\fP function initializes the location pointed to by \fIwch\fP
by using:
.bP
The character attributes in
\fIattrs\fP
.bP
The color pair in
\fIcolor_pair\fP
.bP
The wide-character string pointed to by \fIwc\fP.
The string must be L'\e0' terminated,
contain at most one spacing character,
which must be the first.
.IP
Up to \fBCCHARW_MAX\fP\-1 non-spacing characters may follow.
Additional non-spacing characters are ignored.
.IP
.B \%setcchar
constructs a
.I curses
complex character
.I wch
from the components
.IR wc ,
.IR attrs ,
and
.IR pair .
The wide-character string
.I wch
must be terminated with a null wide character
.B L\*'\e0\*'
and must contain at most one spacing character,
which,
if present,
must be the first wide character in the string.
.PP
Up to
.BR \%CCHARW_MAX\ \-\ 1
non-spacing characters may follow
(see \fB\%curs_variables\fP(3X)).
.I \%ncurses
ignores any additional non-spacing characters.
.PP
The string may contain a single control character instead.
In that case, no non-spacing characters are allowed.
In that case,
no non-spacing characters are allowed.
.SH RETURN VALUE
When \fIwc\fP is a null pointer,
\fBgetcchar\fP returns the number of wide characters referenced by
\fIwch\fP,
including one for a trailing null.
If
.B \%getcchar
is passed a null pointer as its
.I wc
argument,
it returns the number of wide characters for a given
.I wch
that it would store in
.IR wc ","
counting a trailing null wide character.
If
.B \%getcchar
is not passed a null pointer as its
.I wc
argument,
it returns
.B OK
on success and
.B ERR
on failure.
.PP
When \fIwc\fP is not a null pointer,
\fBgetcchar\fP returns \fBOK\fP upon successful completion,
and \fBERR\fP otherwise.
In
.IR \%ncurses ,
.B \%getcchar
returns
.B ERR
if either
.I attrs
or
.I pair
is a null pointer and
.I wc
is not.
.PP
Upon successful completion, \fBsetcchar\fP returns \fBOK\fP.
Otherwise, it returns \fBERR\fP.
.B \%setcchar
returns
.B OK
on success and
.B ERR
on failure.
.PP
In
.IR \%ncurses ,
.B \%setcchar
returns
.B ERR
if
.bP
.I wch
is a null pointer,
.bP
.I wc
starts with a (wide) control character
and contains any other wide characters,
or
.bP
.I pair
has a negative value.
.SH NOTES
The \fIwch\fP argument may be a value generated by a call to
\fBsetcchar\fP or by a function that has a \fBcchar_t\fP output argument.
If \fIwch\fP is constructed by any other means, the effect is unspecified.
.I wch
may be a value stored by
.B \%setcchar
or another
.I curses
function with a writable
.I \%cchar_t
argument.
If
.I wch
is constructed by any other means,
the library's behavior is unspecified.
.SH EXTENSIONS
X/Open Curses documents the \fIopts\fP argument as reserved for future use,
saying that it must be null.
This implementation
uses that parameter in ABI 6 for the functions which have a color pair
parameter to support extended color pairs:
X/Open Curses documents the
.I opts
argument as reserved for future use,
saying that it must be a null pointer.
The
.IR \%ncurses \ 6
ABI uses it with functions that have a color pair parameter
to support extended color pairs.
.bP
For functions which modify the color, e.g., \fBsetcchar\fP,
if \fIopts\fP is set it is treated as a pointer to \fBint\fP,
and used to set the color pair instead of the \fBshort\fP pair parameter.
In functions that assign colors,
such as
.BR \%setcchar ","
if
.I opts
is not a null pointer,
.I \%ncurses
treats it as a pointer to
.IR int ","
and interprets it instead of the
.I short
.I pair
parameter as a color pair identifier.
.bP
For functions which retrieve the color, e.g., \fBgetcchar\fP,
if \fIopts\fP is set it is treated as a pointer to \fBint\fP,
and used to retrieve the color pair as an \fBint\fP value,
in addition retrieving it via the standard pointer to \fBshort\fP parameter.
In functions that retrieve colors,
such as
.BR \%getcchar ","
if
.I opts
is not a null pointer,
.I \%ncurses
treats it as a pointer to
.IR int ","
and stores the retrieved color pair identifier there
as well as in the
.I short
.I pair
parameter
(which may therefore undergo a narrowing conversion).
.SH PORTABILITY
The \fBCCHARW_MAX\fP symbol is specific to \fI\%ncurses\fP.
X/Open Curses does not provide details for the layout of the \fBcchar_t\fP
structure.
It tells what data are stored in it:
.bP
a spacing character (\fBwchar_t\fP, i.e., 32-bits).
.bP
non-spacing characters (again, \fBwchar_t\fP's).
.bP
attributes (at least 16 bits, inferred from the various ACS- and WACS-flags).
.bP
color pair (at least 16 bits, inferred from the \fBunsigned short\fP type).
Applications employing
.I \%ncurses
extensions should condition their use on the visibility of the
.B \%NCURSES_VERSION
preprocessor macro.
.PP
The non-spacing characters are optional,
in the sense that zero or more may be stored in a \fBcchar_t\fP.
These functions are described in X/Open Curses Issue\ 4.
It specifies no error conditions for them.
.PP
X/Open Curses does not detail the layout of the
.I \%cchar_t
structure,
describing only its minimal required contents:
.bP
a spacing wide character
.RI \%( wchar_t ),
.bP
at least five non-spacing wide characters
.RI \%( wchar_t ;
see below),
.bP
attributes
(at least 15 bits' worth,
inferred from the count of specified
.I WA_
constants),
.\" See X/Open Curses Issue 7, p. 307.
.bP
a color pair identifier
(at least 16 bits,
inferred from the
.I short
type used to encode it).
.PP
Non-spacing characters are optional,
in the sense that zero or more may be stored in a
.IR \%cchar_t "."
XOpen/Curses specifies a limit:
.RS 4
.PP
Implementations may limit the number of non-spacing characters that can be
associated with a spacing character, provided any limit is at least 5.
Implementations may limit the number of non-spacing characters that can
be associated with a spacing character,
provided any limit is at least 5.
.RE
.PP
The Unix implementations at the time follow that limit:
Then-contemporary Unix implementations adhered to that limit.
.bP
AIX\ 4 and OSF1\ 4 use the same declaration with an array of 5 non-spacing
characters \fIz\fP and a single spacing character \fIc\fP.
AIX\ 4 and OSF/1\ 4 used the same declaration with
a single spacing wide character
.I c
and an array of 5 non-spacing wide characters
.IR z "."
.bP
HP-UX\ 10 uses an opaque structure with 28 bytes,
which is large enough for the 6 \fBwchar_t\fP values.
HP-UX\ 10 used an opaque structure of 28 bytes,
large enough for 6
.I \%wchar_t
values.
.bP
Solaris \fIxpg4\fP curses uses a single array of 6 \fBwchar_t\fP values.
Solaris
.I xcurses
uses a single array of 6
.I \%wchar_t
values.
.PP
This implementation's \fBcchar_t\fP was defined in 1995
using \fB5\fP for the total of spacing and non-spacing characters
(\fBCCHARW_MAX\fP).
.I \%ncurses
defined its
.I \%cchar_t
in 1995 using 5 as the
.I total
of spacing and non-spacing characters
.RB \%( CCHARW_MAX ).
That was probably due to a misreading of the AIX\ 4 header files,
because the X/Open Curses document was not generally available at that time.
Later (in 2002), this detail was overlooked when beginning to implement
the functions using the structure.
because the X/Open Curses document
was not generally available at that time.
Later (in 2002),
this detail was overlooked when work began to implement the functions
using the structure.
.PP
In practice, even four non-spacing characters may seem enough.
X/Open Curses documents possible uses for non-spacing characters,
including using them for ligatures between characters
(a feature apparently not supported by any curses implementation).
Unicode does not limit the (analogous) number of combining characters,
so some applications may be affected.
In practice,
a mere four non-spacing characters may seem adequate.
X/Open Curses documents possible applications of non-spacing characters,
including their use as ligatures
(a feature apparently not supported by any
.I curses
implementation).
Unicode does not limit the (analogous) number of combining characters
in a grapheme cluster;
some applications may be affected.
.I \%ncurses
can be compiled with a different
.B CCHARW_MAX
value;
doing so alters the library's ABI.
.SH HISTORY
X/Open Curses Issue\ 4 (1995) initially specified these functions.
.SH SEE ALSO
\fB\%curses\fP(3X),
\fB\%curs_attr\fP(3X),
+274 -167
View File
@@ -1,6 +1,6 @@
'\" t
.\"***************************************************************************
.\" Copyright 2018-2023,2024 Thomas E. Dickey *
.\" Copyright 2018-2024,2025 Thomas E. Dickey *
.\" Copyright 1998-2016,2017 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@@ -28,8 +28,8 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: curs_getch.3x,v 1.87 2024/04/20 19:18:18 tom Exp $
.TH curs_getch 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.\" $Id: curs_getch.3x,v 1.134 2025/11/12 01:06:36 tom Exp $
.TH curs_getch 3X 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
@@ -57,15 +57,15 @@
\fB\%mvwgetch\fP,
\fB\%ungetch\fP,
\fB\%has_key\fP \-
get (or push back) characters from \fIcurses\fR terminal keyboard
get (or push back) characters from \fIcurses\fR terminal keyboard buffer
.SH SYNOPSIS
.nf
.B #include <curses.h>
.PP
.B int getch(void);
.B int wgetch(WINDOW *\fIwin\fP);
.B int wgetch(WINDOW * \fIwin\fP);
.B int mvgetch(int \fIy\fP, int \fIx\fP);
.B int mvwgetch(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP);
.B int mvwgetch(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP);
.PP
.B int ungetch(int \fIc\fP);
.PP
@@ -76,18 +76,25 @@ get (or push back) characters from \fIcurses\fR terminal keyboard
.SH DESCRIPTION
.SS "Reading Characters"
.B \%wgetch
gathers a key stroke from the terminal keyboard associated with a
gathers a key event from the terminal keyboard associated with a
.I curses
window
.IR win .
.IR win "."
\fB\%ncurses\fP(3X) describes the variants of this function.
.PP
When input is pending,
.B \%wgetch
returns an integer identifying the key stroke;
returns an integer identifying the key event;
for alphanumeric and punctuation keys,
the space bar,
and (usually) the Backspace,
Tab,
Return,
and Escape keys,
this value corresponds to the character encoding used by the terminal.
Use of the control key as a modifier often results in a distinct code.
Use of the control key as a modifier,
by holding it down while pressing and releasing another key,
often results in a distinct code.
The behavior of other keys depends on whether
.I win
is in keypad mode;
@@ -97,20 +104,29 @@ If no input is pending,
then if the no-delay flag is set in the window
(see \fB\%nodelay\fP(3X)),
the function returns
.BR ERR ;
.BR ERR ";"
otherwise,
.I curses
waits until the terminal has input.
If \fB\%cbreak\fP(3X)
If \fB\%cbreak\fP(3X) or \fB\%raw\fP(3X)
has been called,
this happens after one character is read.
If \fB\%nocbreak\fP(3X)
this happens after
.I curses
reads one key event.
If \fB\%nocbreak\fP(3X) or \fB\%noraw\fP(3X)
has been called,
it occurs when the next newline is read.
it occurs when
.I curses
reads a newline. \" "newline" because canonical mode normalizes NL/CR
(Because the terminal's canonical or \*(``cooked\*('' mode
is line-buffered,
multiple
.B \%wgetch
calls may then be necessary to empty the input queue.)
If \fB\%halfdelay\fP(3X)
has been called,
.I curses
waits until a character is typed or the specified delay elapses.
waits until input is available or the specified delay elapses.
.PP
If \fB\%echo\fP(3X) has been called,
and the window is not a pad,
@@ -123,7 +139,9 @@ per the following rules.
.bP
If
.I c
matches the terminal's erase character,
matches the terminal's erase character
(see \fB\%erasechar\fP(3X)),
and the cursor is not at the window's leftmost column,
the cursor moves leftward one position
and the new position is erased
as if \fB\%wmove\fP(3X) and then \fB\%wdelch\fP(3X) were called.
@@ -140,11 +158,14 @@ writes any other
to the window,
as with \fB\%wechochar\fP(3X).
.bP
If the window has been moved or modified since the last call to
If the window
.I win
has been moved or modified since the last call to
\fB\%wrefresh\fP(3X),
.I curses
calls
.BR \%wrefresh .
.B \%wrefresh
on it.
.PP
If
.I c
@@ -152,48 +173,52 @@ is a carriage return and \fBnl\fP(3X) has been called,
.B \%wgetch
returns the character code for line feed instead.
.SS "Keypad Mode"
To
.IR curses ,
key strokes not from the alphabetic section of the keyboard
(those corresponding to the ECMA-6 character set\(emsee
\fIascii\fP(7)\(emoptionally modified by either the control or shift
keys)
are treated as
Call \fB\%keypad\fP(3X) on a window to configure keypad mode
when reading input from it.
In
.IR "keypad mode" ","
.I curses
treats key strokes not from the alphabetic section of the keyboard
(those corresponding to the ECMA-6 character set \(em
see \fI\%ascii\fP(7) \(em
optionally modified by either the control or shift keys)
as
.I function
keys.
(In
.IR curses ,
.IR curses ","
the term \*(``function key\*('' includes but is not limited to keycaps
engraved with \*(``F1\*('',
\*(``PF1\*('',
and so on.)
If the window is in keypad mode,
these produce a numeric code corresponding to the
If a window is in keypad mode,
.B \%wgetch
translates these key strokes to a numeric code corresponding to the
.B KEY_
symbols listed in subsection \*(``Predefined Key Codes\*('' below;
otherwise,
they transmit a sequence of codes typically starting with the escape
character,
and which must be collected with multiple
symbols listed in subsection \*(``Key Codes\*('' below.
If the window is not in keypad mode,
the input queue populates with
the characters of the function key's escape sequence,
which the application must collect individually with multiple
.B \%wgetch
calls.
.bP
The
.I \%curses.h
header file declares many
.I "predefined function keys"
.I "function keys"
whose names begin with
.BR KEY_ ;
these object-like macros have values outside the range of eight-bit
character codes.
.BR KEY_ ";"
these object-like macros
have integer values outside the range of eight-bit character codes.
.bP
In
.IR \%ncurses ,
.IR \%ncurses ","
.I "user-defined function keys"
are configured with \fB\%define_key\fP(3X);
they have no names,
but are also expected to have values outside the range of eight-bit
codes.
but are also expected to
have integer values outside the range of eight-bit character codes.
.PP
A variable intended to hold a function key code must thus be of type
.I short
@@ -204,55 +229,78 @@ their function keys produce character sequences prefixed with the
escape character ESC.
This fact implies that
.I curses
cannot know whether the terminal has sent an ESC key stroke or the
beginning of a function key's character sequence without waiting to see
if,
cannot distinguish a user's press of the escape key
(assuming it sends ESC)
from the beginning of a function key's character sequence without
waiting to see if,
and how soon,
further input arrives.
When
.I curses
reads such an ambiguous character,
it sets a timer.
If the remainder of the sequence does not arrive within the designated
time,
.bP
If the escape sequence
matches a string capability defining a function key
for the terminal type
(such as
.B \%key_home
.RB \%( khome )
or
.B \%key_up
.RB \%( kuu1 )),
.B \%wgetch
returns the prefix character;
otherwise,
it returns the function key code corresponding to the unique sequence
returns the function key code corresponding to the unique sequence
defined by the terminal.
.bP
If the escape sequence matches no function keys
defined for the terminal type,
call
.B \%wgetch
repeatedly to obtain
the codes of the individual characters of the sequence,
in the order they occurred in the input.
.bP
If
.B \%wgetch
cannot decide the validity of the input as a function key
because it has not read enough characters to disambiguate it,
the function waits until it has this information or the
.I "escape delay"
elapses.
Configure the escape delay
with the global variable
.BR \%ESCDELAY ","
an extension
(see section \*(``EXTENSIONS\*('' below),
or the environment variable of the same name
(see section \*(``ENVIRONMENT\*('' of \fB\%ncurses\fP(3X)),
also an extension.
.PP
Consequently,
a user of a
.I curses
application may experience a delay after pressing ESC while
application that employs keypad mode
may experience a pause or \*(``hang\*(''
after pressing the escape key while
.I curses
disambiguates the input;
see section \*(``EXTENSIONS\*('' below.
collects sufficient characters to disambiguate the input.
If the window is in \*(``no time-out\*('' mode,
the timer does not expire;
it is an infinite
(or very large)
value.
See \fB\%notimeout\fP(3X).
Because function key sequences usually begin with an escape character,
the terminal may appear to hang in no time-out mode after the user has
pressed ESC.
Generally,
the escape delay is effectively infinite;
see \fB\%notimeout\fP(3X).
In the event of such a pause,
further typing \*(``awakens\*(''
.IR curses .
.IR curses "."
.SS "Ungetting Characters"
.B \%ungetch
places
.I c
into the input queue to be returned by the next call to
.BR \%wgetch .
A single input queue serves all windows.
.SS "Predefined Key Codes"
.BR \%wgetch "."
A single input queue serves all windows associated with the screen.
.SS "Key Codes"
The header file
.I \%curses.h
defines the following function key codes.
.bP
Except for the special case of
.BR \%KEY_RESIZE ,
.BR \%KEY_RESIZE ","
a window's keypad mode must be enabled for
.B \%wgetch
to read these codes from it.
@@ -273,10 +321,11 @@ dominant position in industry.
.\" get_wch(3X) or having that page cross reference this one?
.TS
Lb Lb
Lb Lx.
Lb Lw(36n)x.
Symbol Key name
=
KEY_BREAK Break key
.ne 4
KEY_DOWN Arrow keys
KEY_UP \^
KEY_LEFT \^
@@ -394,13 +443,15 @@ correspond to a physical key.
.bP
.B \%wgetch
returns
.BR \%KEY_RESIZE ,
.BR \%KEY_RESIZE ","
even if the window's keypad mode is disabled,
when
if
.I \%ncurses
handles a
.B \%SIGWINCH
signal;
has handled a
.I \%SIGWINCH
signal since
.B \%wgetch
was called;
see \fB\%initscr\fP(3X) and \fB\%resizeterm\fP(3X).
.bP
.B \%wgetch
@@ -410,59 +461,92 @@ to indicate that a mouse event is pending collection;
see \fB\%curs_mouse\fP(3X).
Receipt of this code requires a window's keypad mode to be enabled,
because to interpret mouse input
(as with with \fI\%xterm\fP(1)'s mouse prototocol),
(as with \fI\%xterm\fP(1)'s mouse protocol),
.I \%ncurses
must read an escape sequence,
as with a function key.
.SS "Testing Key Codes"
In
.IR \%ncurses ,
.IR \%ncurses ","
.B \%has_key
returns a Boolean value indicating whether the terminal type recognizes
its parameter as a key code value.
See also
\fB\%define_key\fP(3X) and \fB\%key_defined\fP(3X).
.SH RETURN VALUE
Except for
.BR \%has_key ,
these functions return
.B OK
on success and
.B \%wgetch
returns a key code identifying the key event as described above,
which may include
.B \%KEY_RESIZE
or
.B \%KEY_MOUSE
indicating non-key events,
or
.B ERR
on failure.
.B \%wgetch
fails if
its timeout expires without any data arriving,
which cannot happen if \fB\%nodelay\fP(3X) is in effect on the window.
.PP
Functions taking a
In
.IR \%ncurses ,
.B \%wgetch
also fails if
.bP
the
.I curses
screen has not been initialized,
.bP
(for functions taking a
.I \%WINDOW
pointer argument fail if the pointer is
.BR NULL .
pointer argument)
.I win
is a null pointer,
or
.bP
execution was interrupted by a signal,
in which case the library sets
.I \%errno
to
.IR \%EINTR "."
.PP
Functions prefixed with \*(``mv\*('' first perform cursor movement and
fail if the position
.RI ( y ,
.IR x )
.IR x ")"
is outside the window boundaries.
.PP
.B \%wgetch
also fails if
.B \%ungetch
returns
.B OK
on success and
.B ERR
on failure.
In
.IR \%ncurses ,
.B \%ungetch
fails if
.bP
its timeout expires without any data arriving,
the
.I curses
screen has not been initialized,
or
.bP
execution was interrupted by a signal,
in which case
.B \%errno
is set to
.BR \%EINTR .
.PP
.B \%ungetch
fails if there is no more room in the input queue.
there is no more room in the input queue.
.PP
.B \%has_key
returns
.B TRUE
or
.BR FALSE .
.BR FALSE "."
.SH NOTES
.BR \%getch ","
.BR \%mvgetch ","
and
.B \%mvwgetch
may be implemented as macros.
.PP
.I curses
discourages assignment of the ESC key to a discrete function by the
programmer because the library requires a delay while it awaits the
@@ -472,7 +556,7 @@ Some key strokes are indistinguishable from control characters;
for example,
.B \%KEY_ENTER
may be the same as
.BR \*^M ,
.BR \*^M ","
.\" as with att630 or pccon+keys
and
.B \%KEY_BACKSPACE
@@ -480,17 +564,17 @@ may be the same as
.B \*^H
.\" as with att505 or vt52-basic
or
.BR \*^? .
.BR \*^? "."
.\" as with pccon+keys or vt320
Consult the terminal's
Consult the
.I \%term\%info
entry to determine whether this is the case;
entry for the terminal type to determine whether this is the case;
see \fB\%infocmp\fP(1).
Some
.I curses
implementations,
including
.IR \%ncurses ,
.IR \%ncurses ","
honor the
.I \%term\%info
key definitions;
@@ -502,7 +586,7 @@ sections of a keyboard because (most) terminals do.
.B \%KEY_ENTER
refers to the key on the numeric keypad and,
like other function keys,
and is reliably recognized only if the window's keypad mode is enabled.
is reliably recognized only if the window's keypad mode is enabled.
.bP
The
.I \%term\%info
@@ -529,7 +613,7 @@ Depending on the terminal mode
(raw,
cbreak,
or
\*(``cooked\*(''),
canonical),
and whether \fB\%nl\fP(3X) or \fB\%nonl\fP(3X) has been called,
.B \%wgetch
may return either a carriage return or line feed upon an Enter or Return
@@ -541,22 +625,22 @@ with \fB\%echo\fP(3X) and neither \fB\%cbreak\fP(3X) nor \fB\%raw\fP(3X)
is not well-defined.
.PP
Historically,
the list of key code macros above was influenced by the
function-key-rich keyboard of the AT&T 7300
the list of key code macros above was influenced by the keyboard of the
AT&T 7300
(also known variously as the \*(``3B1\*('', \*(``Safari 4\*('', and
\*(``UNIX PC\*(''),
a 1985 machine.
Today's computer keyboards are based that of the IBM PC/AT and tend to
have fewer.
a 1985 machine rich in function keys.
Today's computer keyboards are based on that of the IBM PC/AT
and tend to have fewer.
A
.I curses
application can expect such a keyboard to transmit key codes
.BR \%KEY_UP ,
.BR \%KEY_DOWN ,
.BR \%KEY_LEFT ,
.BR \%KEY_RIGHT ,
.BR \%KEY_HOME ,
.BR \%KEY_END ,
.BR \%KEY_UP ","
.BR \%KEY_DOWN ","
.BR \%KEY_LEFT ","
.BR \%KEY_RIGHT ","
.BR \%KEY_HOME ","
.BR \%KEY_END ","
.B \%KEY_PPAGE
(Page Up),
.B \%KEY_NPAGE
@@ -565,20 +649,23 @@ application can expect such a keyboard to transmit key codes
(Insert),
.B \%KEY_DC
(Delete),
.BR \%KEY_A1 ","
.BR \%KEY_A3 ","
.BR \%KEY_B2 ","
.BR \%KEY_C1 ","
.BR \%KEY_C3 ","
and
.BI \%KEY_F( n )
for 1 \(<=
.I n
\(<= 12.
.PP
.BR \%getch ,
.BR \%mvgetch ,
and
.B \%mvwgetch
may be implemented as macros.
.\" Other numeric keypad keys from the DEC VT220 (specifically, the
.\" LK201 commonly used with it) and IBM PC/AT keyboards -- the comma
.\" (DEC); plus, star, and slash (PC); and zero, dot, and minus (both)
.\" have no standard key capability codes.
.SH EXTENSIONS
In
.IR \%ncurses ,
.IR \%ncurses ","
when a window's \*(``no time-out\*('' mode is
.I not
set,
@@ -590,12 +677,17 @@ with ESC typed by the user;
see
\fB\%curs_variables\fP(3X).
.PP
\fB\%has_key\fP was designed for \fB\%ncurses\fP(3X),
.B \%has_key
is an
.I \%ncurses
extension,
and is not found in SVr4
.IR curses ,
.IR curses ","
4.4BSD
.IR curses ,
or any other previous curses implementation.
.IR curses ","
or any other previous
.I curses
implementation.
.SH PORTABILITY
Applications employing
.I \%ncurses
@@ -603,51 +695,51 @@ extensions should condition their use on the visibility of the
.B \%NCURSES_VERSION
preprocessor macro.
.PP
X/Open Curses,
Issue 4 describes
\fB\%getch\fP,
\fB\%wgetch\fP,
\fB\%mvgetch\fP,
\fB\%mvwgetch\fP,
and
\fB\%ungetch\fP.
Except as noted in section \*(``EXTENSIONS\*('' above,
X/Open Curses Issue\ 4 describes these functions.
It specifies no error conditions for them.
.PP
.B \%wgetch
SVr4 describes a successful return value only as
\*(``an integer value other than
.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 494
.PP
.I \%wgetch
reads only single-byte characters.
.PP
The echo behavior of these functions on input of
.B KEY_
or backspace characters was not specified in the SVr4 documentation.
This description is adapted from X/Open Curses.
.I KEY_
or backspace characters is not documented in SVr4
.IR curses "."
.PP
The behavior of
.B \%wgetch
in the presence of signal handlers is unspecified in the SVr4
documentation and X/Open Curses.
.I \%wgetch
in the presence of signal handlers is not documented in SVr4
.I curses
and is unspecified by X/Open Curses.
In historical
.I curses
implementations,
it varied depending on whether the operating system's dispatch of a
signal to a handler interrupting a \fIread\fP(2) call in progress,
signal to a handler interrupted a \fIread\fP(2) call in progress,
and also
(in some implementations)
whether an input timeout or non-blocking mode has been set.
Programmers concerned about portability should be prepared for either of
two cases:
whether an input timeout or non-blocking mode had been set.
A portable
.I curses
application prepares for two cases:
(a) signal receipt does not interrupt
.BR \%wgetch ;
or
.IR \%wgetch ";"
and
(b) signal receipt interrupts
.B \%wgetch
.I \%wgetch
and causes it to return
.B ERR
.I ERR
with
.B \%errno
.I \%errno
set to
.BR \%EINTR .
.IR \%EINTR "."
.PP
.B \%KEY_MOUSE
.I \%KEY_MOUSE
is mentioned in X/Open Curses,
along with a few related
.I \%term\%info
@@ -657,11 +749,11 @@ The implementation in
.I \%ncurses
is an extension.
.PP
.B \%KEY_RESIZE
.I \%KEY_RESIZE
and
.B \%has_key
.I \%has_key
are extensions first implemented for
.IR \%ncurses .
.IR \%ncurses "."
By 2022,
.I \%PDCurses
.\" https://web.archive.org/web/20220117232009/https://pdcurses.org/docs/MANUAL.html
@@ -670,12 +762,35 @@ NetBSD
.I curses
.\" https://web.archive.org/web/20200923185647/https://man.netbsd.org/curses_input.3
had added them along with
.BR \%KEY_MOUSE .
.IR \%KEY_MOUSE "."
.SH HISTORY
4BSD (1980)
introduced
.I \%wgetch
and its variants.
.PP
SVr3 (1987)
added
.IR \%ungetch "."
.PP
.I \%ncurses
1.9.9g (1996)
furnished the
.I \%has_key
extension.
.SH SEE ALSO
ECMA-6 \*(``7-bit coded Character Set\*(''
\%<https://\*:ecma\-international\*:.org/\
\*:publications\-and\-standards/\*:standards/\*:ecma\-6/>
.PP
ECMA-48 \*(``Control Functions for Coded Character Sets\*(''
\%<https://\*:ecma\-international\*:.org/\
\*:publications\-and\-standards/\*:standards/\*:ecma\-48/>
.PP
\fB\%curs_get_wch\fP(3X) describes comparable functions of the
.I \%ncurses
library in its wide-character configuration
.RI ( \%ncursesw ).
.RI \%( ncursesw ).
.PP
\fB\%curses\fP(3X),
\fB\%curs_addch\fP(3X),
@@ -687,11 +802,3 @@ library in its wide-character configuration
\fB\%curs_variables\fP(3X),
\fB\%resizeterm\fP(3X),
\fB\%ascii\fP(7)
.PP
ECMA-6 \*(``7-bit coded Character Set\*(''
\%<https://\*:ecma\-international\*:.org/\
\*:publications\-and\-standards/\*:standards/\*:ecma\-6/>
.PP
ECMA-48 \*(``Control Functions for Coded Character Sets\*(''
\%<https://\*:ecma\-international\*:.org/\
\*:publications\-and\-standards/\*:standards/\*:ecma\-48/>
+421 -199
View File
@@ -1,5 +1,5 @@
.\"***************************************************************************
.\" Copyright 2018-2023,2024 Thomas E. Dickey *
.\" Copyright 2018-2024,2025 Thomas E. Dickey *
.\" Copyright 1998-2010,2017 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@@ -27,17 +27,19 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: curs_getstr.3x,v 1.58 2024/04/20 19:18:18 tom Exp $
.TH curs_getstr 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.\" $Id: curs_getstr.3x,v 1.94 2025/10/21 00:09:04 tom Exp $
.TH curs_getstr 3X 2025-10-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
.ds ^ \(ha
.\}
.el \{\
.ie t .ds `` ``
.el .ds `` ""
.ie t .ds '' ''
.el .ds '' ""
.ds ^ ^
.\}
.
.de bP
@@ -53,101 +55,146 @@
\fB\%mvgetnstr\fP,
\fB\%mvwgetstr\fP,
\fB\%mvwgetnstr\fP \-
accept character strings from \fIcurses\fR terminal keyboard
read a character string from \fIcurses\fR terminal keyboard
.SH SYNOPSIS
.nf
\fB#include <curses.h>
.PP
\fBint getstr(char *\fIstr\fP);
\fBint getnstr(char *\fIstr\fP, int \fIn\fP);
\fBint wgetstr(WINDOW *\fIwin\fP, char *\fIstr\fP);
\fBint wgetnstr(WINDOW *\fIwin\fP, char *\fIstr\fP, int \fIn\fP);
\fBint getstr(char * \fIstr\fP);
\fBint wgetstr(WINDOW * \fIwin\fP, char * \fIstr\fP);
\fBint mvgetstr(int \fIy\fP, int \fIx\fP, char * \fIstr\fP);
\fBint mvwgetstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, char * \fIstr\fP);
.PP
\fBint mvgetstr(int \fIy\fP, int \fIx\fP, char *\fIstr\fP);
\fBint mvwgetstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, char *\fIstr\fP);
\fBint mvgetnstr(int \fIy\fP, int \fIx\fP, char *\fIstr\fP, int \fIn\fP);
\fBint mvwgetnstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, char *\fIstr\fP, int \fIn\fP);
\fBint getnstr(char * \fIstr\fP, int \fIn\fP);
\fBint wgetnstr(WINDOW * \fIwin\fP, char * \fIstr\fP, int \fIn\fP);
\fBint mvgetnstr(int \fIy\fP, int \fIx\fP, char * \fIstr\fP, int \fIn\fP);
\fBint mvwgetnstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, char * \fIstr\fP, int \fIn\fP);
.fi
.SH DESCRIPTION
.B \%wgetstr
populates a user-supplied string buffer
.I str
by repeatedly calling \fBwgetch\fP(3X)
with the
.I win
argument
until a line feed or carriage return character is input.
.\" Of the two, because wgetnstr() calls nl(), only a line feed (\n)
.\" will ever be returned by wgetch().
The function
\fBwgetnstr\fP
is equivalent to a series of calls to
\fBwgetch\fP(3X),
until a newline or carriage return terminates the series:
.bP
The terminating character is not included in the returned string.
does not copy the terminating character to
.IR str ";"
.bP
In all instances, the end of the string is terminated
by a NUL.
always terminates
.I str
with a null character;
.bP
The function stores the result in the area pointed to
by the \fIstr\fP parameter.
interprets the screen's erase and kill characters
(see \fB\%erasechar\fP(3X) and \fB\%killchar\fP(3X));
.bP
The function reads at most \fIn\fP characters,
thus preventing a possible overflow of the input buffer.
.IP
Any attempt to enter more characters
(other than the terminating newline or carriage return)
causes a beep.
.IP
Function keys also cause a beep and are ignored.
recognizes function keys only if the screen's keypad option is enabled
(see \fB\%keypad\fP(3X));
.bP
treats the function keys
.B \%KEY_LEFT
and
.B \%KEY_BACKSPACE
the same as the erase character;
and
.bP
discards function key inputs other than those
treated as the erase or kill characters,
calling \fBbeep\fP(3X).
.PP
The user's \fIerase\fP and \fIkill\fP characters are interpreted:
.bP
The \fIerase\fP character (e.g., \fB^H\fP) erases the character
at the end of the buffer, moving the cursor to the left.
.IP
If \fIkeypad\fP mode is on for the window,
\fBKEY_LEFT\fP and \fBKEY_BACKSPACE\fP
are both considered equivalent to the user's \fIerase\fP character.
.bP
The \fIkill\fP character (e.g., \fB^U\fP) erases the entire buffer,
leaving the cursor at the beginning of the buffer.
If any characters have been written to the input buffer,
the erase character replaces the character
at the current position in the buffer
with a null character,
then decrements the position by one;
the kill character does the same repeatedly,
backtracking to the beginning of the buffer.
.PP
Characters input are echoed only if \fBecho\fP is currently on.
In that case,
backspace is echoed as deletion of the previous character
(typically a left motion).
If the screen's echo option is enabled
(see \fBecho\fP(3X)),
.B \%wgetstr
updates
.I win
with \fB\%waddch\fP(3X).
Further,
.bP
the erase character
and its function key synonyms
move the cursor to the left
(if not already where it was located when
.B \%wgetstr
was called)
and
.bP
the kill character returns the cursor to where it was located when
.B \%wgetstr
was called.
.PP
The
\fBgetnstr\fP,
\fBmvgetnstr\fP,
\fBmvwgetnstr\fP, and
\fBwgetnstr\fP
functions are identical
to the
\fBgetstr\fP,
\fBmvgetstr\fP,
\fBmvwgetstr\fP, and
\fBwgetstr\fP
functions, respectively,
except that the
\fB*n*\fP
versions read at most
\fIn\fP
characters, letting the application prevent overflow of the
input buffer.
.B \%wgetnstr
is similar,
but reads at most
.I n
characters,
aiding the application to avoid overrunning the buffer to which
.I str
points.
.I curses
ignores an attempt to input more than
.I n
characters
(other than the terminating line feed or carriage return),
calling \fBbeep\fP(3X).
If
.I n
is negative,
.B \%wgetn_wstr
reads up to
.I LINE_MAX
characters
(see
.IR sysconf (3)).
.PP
\fB\%ncurses\fP(3X) describes the variants of these functions.
.SH RETURN VALUE
All of these functions return the integer \fBOK\fP upon successful completion.
(SVr4 specifies only \*(``an integer value other than \fBERR\fP\*('')
If unsuccessful, they return \fBERR\fP.
These functions return
.B OK
on success and
.B ERR
on failure.
.PP
X/Open defines no error conditions.
In
.IR \%ncurses ,
these functions fail if
.bP
the
.I curses
screen has not been initialized,
.bP
(for functions taking a
.I \%WINDOW
pointer argument)
.I win
is a null pointer,
.bP
.I str
is a null pointer,
or
.bP
an internal \fB\%wgetch\fP(3X) call fails.
.PP
In this implementation,
these functions return an error
.bP
if the window pointer is null,
.bP
if its timeout expires without having any data, or
.bP
if the associated call to
\fBwgetch\fP
failed.
.PP
This implementation provides an extension as well.
If a \fBSIGWINCH\fP interrupts the function, it will return \fBKEY_RESIZE\fP
rather than \fBOK\fP or \fBERR\fP.
Further,
in
.IR \%ncurses ","
these functions return
.B \%KEY_RESIZE
if a
.I \%SIGWINCH
event interrupts the function.
.PP
Functions prefixed with \*(``mv\*('' first perform cursor movement and
fail if the position
@@ -155,147 +202,322 @@ fail if the position
.IR x )
is outside the window boundaries.
.SH NOTES
Any of these functions other than
\fBwgetnstr\fP
may be macros.
All of these functions except
.B \%wgetnstr
may be implemented as macros.
.PP
Using
\fBgetstr\fP,
\fBmvgetstr\fP,
\fBmvwgetstr\fP, or
\fBwgetstr\fP
to read a line that
overflows the array pointed to by
\fBstr\fP
causes undefined
results.
The use of
\fBgetnstr\fP,
\fBmvgetnstr\fP,
\fBmvwgetnstr\fP, or
\fBwgetnstr\fP,
respectively, is recommended.
Reading input that overruns the buffer pointed to by
.I str
causes undefined results.
Use the
.BR n -infixed
functions,
and allocate sufficient storage for
.I str
\(em at least
.IR n +1
times
.BR sizeof(char) "."
.PP
While these functions conceptually implement
a series of calls to
.BR \%wgetch ","
they also temporarily change properties of the
.I curses
screen to permit simple editing of the input buffer.
Each function saves the screen's state,
calls \fBnl\fP(3X),
and,
if the screen was in canonical (\*(``cooked\*('') mode,
\fB\%cbreak\fP(3X).
Before returning,
it restores the saved screen state.
Other implementations differ in detail,
affecting which control characters they can accept in the buffer;
see section \*(``PORTABILITY\*('' below.
.SH EXTENSIONS
.BR \%getnstr ","
.BR \%wgetnstr ","
.BR \%mvgetnstr ","
and
.BR \%mvwgetnstr "'s"
handing of negative
.I n
values is an
.I \%ncurses
extension.
.PP
The return value
.B \%KEY_RESIZE
is an
.I \%ncurses
extension.
.SH PORTABILITY
These functions are described in The Single Unix Specification, Version 2.
No error conditions are defined.
Applications employing
.I \%ncurses
extensions should condition their use on the visibility of the
.B \%NCURSES_VERSION
preprocessor macro.
.PP
This implementation returns \fBERR\fP if the window pointer is null,
or if the lower-level \fBwgetch\fP(3X) call returns an \fBERR\fP.
X/Open Curses Issue\ 4 describes these functions.
It specifies no error conditions for them,
but indicates that
.I \%wgetnstr
and its variants read
\*(``the entire multi-byte sequence associated with a character\*(''
and \*(``fail\*('' if
.I n
and
.I str
together do not describe a buffer
\*(``large enough to contain any complete characters\*(''.
In
.IR \%ncurses ","
however,
.I \%wgetch
reads only single-byte characters,
so this scenario does not arise.
.\" You can pass ncurses wgetnstr n=0 and it will beep at you with each
.\" key stroke.
.PP
SVr3 and early SVr4 curses implementations did not reject function keys;
the SVr4.0 documentation claimed that \*(``special keys\*(''
SVr4 describes a successful return value only as
\*(``an integer value other than
.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 495
.PP
SVr3 and early SVr4
.I curses
implementations did not reject function keys;
the SVr4 documentation asserted that,
like the screen's erase and kill characters,
they were
.PP
.RS
interpreted,
as well as any special keys
(such as function keys,
\*(``home\*('' key,
\*(``clear\*('' key,
\fIetc\fP.) are \*(``interpreted\*('',
without giving details.
.IR etc. )
.\" SVID 4, vol. 3, p. 495
.RE
.PP
without further detail.
It lied.
In fact, the \*(``character\*('' value appended to the
string by those implementations was predictable but not useful
(being, in fact, the low-order eight bits of the key's KEY_ value).
The \*(``character\*('' value
appended to the string
by those implementations
was predictable but not useful \(em
being,
in fact,
the low-order eight bits of the key code's
.I KEY_
constant value.
(The same language,
unchanged except for styling,
survived into X/Open Curses Issue\ 4,
Version\ 2 \" p. 94 (PDF 114)
but disappeared from Issue\ 7.) \" p. 105 (PDF 119)
.PP
The functions \fBgetnstr\fP, \fBmvgetnstr\fP, and \fBmvwgetnstr\fP were
present but not documented in SVr4.
A draft of X/Open Curses Issue\ 5
(which never saw final release)
stated that these functions
\*(``read at most
.I n
bytes\*(''
but did not state whether the terminating null character
counted toward that limit.
X/Open Curses Issue\ 7 changed that to say they
\*(``read at most
.IR n \-1
bytes\*(''
to allow for the terminating null character.
As of 2018,
some implementations count it,
some do not.
.bP
.I \%ncurses
6.1 and
.I \%PDCurses
do not count the null character toward the limit,
while Solaris and NetBSD
.I curses
do.
.bP
Solaris
.I xcurses
offers both behaviors:
its wide-character
.I \%wgetn_wstr
reserves room for a wide null character,
but its non-wide
.I \%wgetnstr
does not consistently count a null character toward the limit.
.PP
X/Open Curses, Issue 5 (2007) stated that these functions
\*(``read at most \fIn\fP bytes\*(''
but did not state whether the terminating NUL is counted in that limit.
X/Open Curses, Issue 7 (2009) changed that to say they
\*(``read at most \fIn\fP\-1 bytes\*(''
to allow for the terminating NUL.
As of 2018, some implementations count it, some do not:
X/Open Curses does not specify what happens if the length
.I n
is negative.
.bP
\fI\%ncurses\fP 6.1 and PDCurses do not count the NUL in the given limit, while
.bP
Solaris SVr4 and NetBSD curses count the NUL as part of the limit.
.bP
Solaris xcurses provides both:
its wide-character \fBwget_nstr\fP reserves a NUL,
but its \fBwgetnstr\fP does not count the NUL consistently.
.PP
In SVr4 curses,
a negative value of \fIn\fP tells \fBwgetnstr\fP to assume that the
caller's buffer is large enough to hold the result,
i.e., to act like \fBwgetstr\fP.
X/Open Curses does not mention this
(or anything related to negative or zero values of \fIn\fP),
however most implementations
use the feature, with different limits:
.bP
Solaris SVr4 curses and PDCurses limit the result to 255 bytes.
Other Unix systems than Solaris are likely to use the same limit.
.bP
Solaris xcurses limits the result to \fBLINE_MAX\fP bytes.
.bP
NetBSD 7 assumes no particular limit for the result from \fBwgetstr\fP.
However, it limits the \fBwgetnstr\fP parameter \fIn\fP to ensure
that it is greater than zero.
.IP
A comment in NetBSD's source code states that this is specified in SUSv2.
.bP
\fI\%ncurses\fP (before 6.2) assumes no particular limit for the result
from \fBwgetstr\fP, and treats the \fIn\fP parameter of \fBwgetnstr\fP
like SVr4 curses.
.bP
\fI\%ncurses\fP 6.2 uses \fBLINE_MAX\fP,
.I \%ncurses
6.2 uses
.I LINE_MAX
or a larger (system-dependent) value
which the \fBsysconf\fP function may provide.
If neither \fBLINE_MAX\fP or \fBsysconf\fP is available,
\fI\%ncurses\fP uses the POSIX value for \fBLINE_MAX\fP (a 2048 byte limit).
In either case, it reserves a byte for the terminating NUL.
provided by \fI\%sysconf\fP(3).
If neither
.I LINE_MAX
nor
.I \%sysconf
is available,
.I \%ncurses
uses the POSIX minimum value for
.I LINE_MAX
(2048). \" _POSIX2_LINE_MAX
In either case,
it reserves a byte for the terminating null character.
.bP
In SVr4
.IR curses ","
a negative
.I n
tells
.I \%wgetnstr
to assume that the caller's buffer
is large enough to hold the result;
that is,
the function then acts like
.IR \%wgetstr "."
X/Open Curses does not mention this behavior
(or anything related to nonpositive
.I n
values),
however most
.I curses
libraries implement it.
Most implementations nevertheless enforce an upper limit
on the count of bytes they write to the destination buffer
.IR str "."
.bP
BSD
.I curses
lacked
.IR \%wgetnstr ","
and its
.I \%wgetstr
wrote to
.I str
unboundedly,
.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4BSD/usr/src/lib/\
.\" libcurses/getstr.c
.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/src/lib/\
.\" libcurses/getstr.c
as did that in SVr2.
.\" https://github.com/ryanwoodsmall/oldsysv/blob/master/sysvr2-vax/\
.\" src/lib/libcurses/screen/getstr.c
.bP
.IR PDCurses ","
and
SVr3 and later,
.\" https://github.com/ryanwoodsmall/oldsysv/blob/master/\
.\" sysvr3/301/usr/src/lib/libcurses/screen/getstr.c#L21
.\" sysvr3/31/usr/src/lib/libcurses/screen/wgetstr.c#L10
.\" sysvr4/svr4/lib/xlibcurses/screen/wgetstr.c#L12
and
Solaris
.I curses
limit both functions to writing 256 bytes.
Other System\ V-based platforms likely use the same limit.
.bP
Solaris
.I xcurses
limits the write to
.I LINE_MAX
bytes
(see
.IR sysconf (3)).
.bP
NetBSD 7
.I curses
imposes no particular limit on the length of the write,
but does validate
.I n
to ensure that it is greater than zero.
A comment in NetBSD's source code asserts that SUSv2 specifies this.
.PP
Although \fBgetnstr\fP is equivalent to a series of calls to \fBgetch\fP,
it also makes changes to the curses modes to allow simple editing of
the input buffer:
Implementations vary in their handling of input control characters.
.bP
\fBgetnstr\fP saves the current value of the \fBnl\fP, \fBecho\fP,
\fBraw\fP and \fBcbreak\fP modes, and sets
\fBnl\fP,
\fBnoecho\fP,
\fBnoraw\fP, and
\fBcbreak\fP.
.IP
\fBgetnstr\fP handles the echoing of characters,
rather than relying on the caller to set an appropriate mode.
While they may enable the screen's echo option,
some do not take it out of raw mode,
and may take cbreak mode into account
when deciding whether to handle echoing within
.I \%wgetnstr
or to rely on it as a side effect of calling
.IR \%wgetch "."
.bP
It also obtains the \fIerase\fP and \fIkill\fP characters
from \fBerasechar\fP and \fBkillchar\fP, respectively.
.bP
On return, \fBgetnstr\fP restores the modes to their previous values.
.PP
Other implementations differ in their treatment of special characters:
.bP
While they may set the \fIecho\fP mode,
other implementations do not modify the \fIraw\fP mode,
They may take the \fIcbreak\fP
mode set by the caller into account when deciding whether to handle
echoing within \fBgetnstr\fP or as a side-effect of the \fBgetch\fP calls.
.bP
The original \fI\%ncurses\fP
(as \fIpcurses\fP in 1986)
set \fBnoraw\fP and \fBcbreak\fP when accepting input for \fBgetnstr\fP.
That may have been done to make function- and cursor-keys work;
it is not necessary with \fI\%ncurses\fP.
Originally,
.IR \%ncurses ","
like its progenitor
.IR \%pcurses ","
had its
.I \%wgetnstr
call
.I \%noraw
and
.I \%cbreak
before accepting input.
That may have been done to make function keys work;
it is not necessary with modern
.IR \%ncurses "."
.IP
Since 1995,
\fI\%ncurses\fP has provided signal handlers for INTR and QUIT
(e.g., \fB^C\fP or \fB^\e\fP).
With the \fBnoraw\fP and \fBcbreak\fP settings,
those may catch a signal and stop the program,
where other implementations allow one to enter those characters in the buffer.
.I \%ncurses
has provided handlers for
.I SIGINTR
and
.I SIGQUIT
events,
which are typically generated at the keyboard with
.B \*^C
and
.B \*^\e
respectively.
In cbreak mode,
those handlers catch a signal and stop the program,
whereas other implementations write those characters into the buffer.
.bP
Starting in 2021
(\fI\%ncurses\fP 6.3),
\fBgetnstr\fP sets \fBraw\fP,
rather than \fBnoraw\fP and \fBcbreak\fP for better compatibility with
SVr4-curses, e.g., allowing one to enter a \fB^C\fP into the buffer.
Starting with
.I \%ncurses
6.3 (2021),
.I \%wgetnstr
preserves raw mode if the screen was already in that state,
allowing one to enter the characters the terminal interprets
as interrupt and quit events
into the buffer,
for better compatibility with SVr4
.IR curses "."
.SH HISTORY
4BSD (1980)
introduced
.I \%wgetstr
along with its variants.
.PP
SVr3.1 (1987)
added
.IR \%wgetnstr ","
but none of its variants.
.PP
X/Open Curses Issue\ 4 (1995)
specified
.IR \%getnstr ","
.IR \%mvgetnstr ","
and
.IR \%mvwgetnstr "."
.SH SEE ALSO
\fB\%curs_get_wstr\fP(3X) describes comparable functions of the
.I \%ncurses
library in its wide-character configuration
.RI ( \%ncursesw ).
.RI \%( ncursesw ).
.PP
\fB\%curses\fP(3X),
\fB\%curs_addch\fP(3X),
\fB\%curs_getch\fP(3X),
\fB\%curs_termattrs\fP(3X),
\fB\%curs_variables\fP(3X)
\fB\%curs_inopts\fP(3X), \" echo(), keypad()
\fB\%curs_termattrs\fP(3X), \" erasechar(), killchar()
+105 -45
View File
@@ -1,5 +1,5 @@
.\"***************************************************************************
.\" Copyright 2020-2023,2024 Thomas E. Dickey *
.\" Copyright 2020-2024,2025 Thomas E. Dickey *
.\" Copyright 1998-2007,2010 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@@ -27,8 +27,8 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: curs_getyx.3x,v 1.44 2024/04/20 21:20:07 tom Exp $
.TH curs_getyx 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.\" $Id: curs_getyx.3x,v 1.55 2025/02/01 22:48:11 tom Exp $
.TH curs_getyx 3X 2025-02-01 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
@@ -51,62 +51,122 @@ get \fIcurses\fR cursor and window coordinates
\fB#include <curses.h>
.PP
\fBvoid getyx(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP);
\fBvoid getparyx(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP);
\fBvoid getbegyx(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP);
\fBvoid getmaxyx(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP);
.PP
\fBvoid getparyx(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP);
.fi
.SH DESCRIPTION
The \fB\%getyx\fP macro places the current cursor position
of the given window in the two integer variables \fIy\fP and \fIx\fP.
These macros obtain the cursor position and bounds information of a
.I curses
window
.IR win "."
.B \%getyx
stores
.IR win "'s"
cursor position in the variables
.I y
and
.IR x "."
.B \%getmaxyx
stores
.IR win "'s"
maximum valid line and column numbers in
.I y
and
.IR x ","
respectively.
.B \%getbegyx
similarly stores the position of
.IR win "'s"
origin relative to that of the screen
(for
.BR stdscr ","
these coordinates are always
.BR 0 ")."
.PP
If \fIwin\fP is a subwindow, the \fB\%getparyx\fP macro places the beginning
coordinates of the subwindow relative to the parent window into two integer
variables \fIy\fP and \fIx\fP.
Otherwise, \fB\-1\fP is placed into \fIy\fP and \fIx\fP.
.PP
Like \fB\%getyx\fP, the \fB\%getbegyx\fP and \fB\%getmaxyx\fP macros store
the current beginning coordinates and size of the specified window.
If
.I win
is a subwindow
(see \fB\%subwin\fP(3X)),
the
.B \%getparyx
macro places the coordinates of its origin relative to its parent window
into
.I y
and
.IR x ","
and
.B \-1
into both if it is not.
.SH RETURN VALUE
The return values of these macros are undefined (i.e.,
they should not be used as the right-hand side of assignment statements).
No return values are defined for macros.
Do not use them as the right-hand side of assignment statements.
.SH NOTES
All of these interfaces are macros.
A \*(``&\*('' is not necessary before the variables \fIy\fP and \fIx\fP.
All of these interfaces are implemented as macros.
An \*(``&\*('' operator is not necessary before the variables
.I y
and
.IR x "."
.SH PORTABILITY
The
\fB\%getyx\fP,
\fB\%getparyx\fP,
\fB\%getbegyx\fP and
\fB\%getmaxyx\fP
macros are described in X/Open Curses, Issue 4.
These macros are described in X/Open Curses Issue\ 4.
.PP
This implementation also provides functions
\fB\%getbegx\fP,
\fB\%getbegy\fP,
\fB\%getcurx\fP,
\fB\%getcury\fP,
\fB\%getmaxx\fP,
\fB\%getmaxy\fP,
\fB\%getparx\fP and
\fB\%getpary\fP
for compatibility with older versions of \fIcurses\fP;
.I \%ncurses
also provides functions
.IR \%getbegy ","
.IR \%getbegx ","
.IR \%getcury ","
.IR \%getcurx ","
.IR \%getmaxy ","
.IR \%getmaxx ","
.IR \%getpary ","
and
.I \%getparx
for compatibility with System\ V
.I curses
that were not standardized;
.\" even by SVID 4
see \fB\%curs_legacy\fP(3X).
.PP
Although X/Open Curses does not address this,
many implementations provide members of the \fB\%WINDOW\fP structure
containing values corresponding to these macros.
For best portability, do not rely on using the data in \fB\%WINDOW\fP,
since some implementations make \fB\%WINDOW\fP opaque (do not allow
direct use of its members).
Although X/Open Curses does not address the issue,
many implementations expose members of the
.I \%WINDOW
structure containing values corresponding to these macros.
Do not rely on their availability;
some implementations make
.I \%WINDOW
opaque
(that is,
they do not allow direct access to its members).
.PP
Besides the problem of opaque structures,
the data stored in like-named members may not have like-values in
different implementations.
For example, the \fB\%WINDOW._maxx\fP and \fB\%WINDOW._maxy\fP values
in \fI\%ncurses\fP have
(at least since release 1.8.1)
the data stored in like-named members may not have values of the same
meaning across different implementations.
For example,
the values of
.I \%WINDOW._maxx
and
.I \%WINDOW._maxy
in
.I \%ncurses
have long
.\" (at least since its initial release, 1.8.1)
differed by one from some other implementations.
The difference is hidden by means of the macro \fB\%getmaxyx\fP.
The
.I \%getmaxyx
macro hides this difference.
.SH HISTORY
4BSD (1980)
introduced
.IR \%getyx "."
.PP
SVr3 (1987)
added
.I \%getbegyx
and
.IR \%getmaxyx "."
SVr3.1 later that year supplied
.IR \%getparyx "."
.SH SEE ALSO
\fB\%curses\fP(3X),
\fB\%curs_legacy\fP(3X),
+65 -20
View File
@@ -1,5 +1,5 @@
.\"***************************************************************************
.\" Copyright 2018-2023,2024 Thomas E. Dickey *
.\" Copyright 2018-2024,2025 Thomas E. Dickey *
.\" Copyright 2002-2010,2017 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@@ -27,8 +27,8 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: curs_in_wch.3x,v 1.31 2024/04/20 21:20:07 tom Exp $
.TH curs_in_wch 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.\" $Id: curs_in_wch.3x,v 1.44 2025/02/01 22:54:32 tom Exp $
.TH curs_in_wch 3X 2025-02-01 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
@@ -41,30 +41,46 @@
.\}
.SH NAME
\fB\%in_wch\fP,
\fB\%win_wch\fP,
\fB\%mvin_wch\fP,
\fB\%mvwin_wch\fP,
\fB\%win_wch\fP \-
\fB\%mvwin_wch\fP \-
get a \fIcurses\fR complex character from a window
.SH SYNOPSIS
.nf
\fB#include <curses.h>
.PP
\fBint in_wch(cchar_t *\fIwch\fP);
\fBint win_wch(WINDOW *\fIwin\fP, cchar_t *\fIwch\fP);
.PP
\fBint mvin_wch(int \fIy\fP, int \fIx\fP, cchar_t *\fIwch\fP);
\fBint mvwin_wch(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, cchar_t *\fIwch\fP);
\fBint in_wch(cchar_t * \fIwch\fP);
\fBint win_wch(WINDOW * \fIwin\fP, cchar_t * \fIwch\fP);
\fBint mvin_wch(int \fIy\fP, int \fIx\fP, cchar_t * \fIwch\fP);
\fBint mvwin_wch(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, cchar_t * \fIwch\fP);
.fi
.SH DESCRIPTION
These functions extract the complex character and rendition from
the current position in the named window into the \fBcchar_t\fP object
referenced by wch.
.B \%win_wch
copies the
.I curses
complex character at the cursor position in
.I win
into
.IR wch "."
Use \fB\%getcchar\fP(3X) to extract its character code,
attributes,
and color pair identifier.
\fB\%ncurses\fP(3X) describes the variants of this function.
.SH RETURN VALUE
No errors are defined in X/Open Curses.
This implementation checks for null pointers, returns \fBERR\fP in that case.
Also, the \fImv\fP routines check for error moving the cursor,
returning \fBERR\fP in that case.
Otherwise they return \fBOK\fP.
These functions return
.B OK
on success and
.B ERR
on failure.
.PP
In
.IR \%ncurses ","
they return
.B ERR
if
.I win
is
.IR NULL "."
.PP
Functions prefixed with \*(``mv\*('' first perform cursor movement and
fail if the position
@@ -72,9 +88,38 @@ fail if the position
.IR x )
is outside the window boundaries.
.SH NOTES
Note that all of these routines may be macros.
.BR \%in_wch ","
.BR mvin_wch ","
and
.B mvwin_wch
may be implemented as macros.
.PP
Unlike \fB\%winch\fP(3X),
.B \%win_wch
and its variants store the value of the retrieved character in an
additional
.I wch
parameter instead of the return value.
.SH PORTABILITY
These functions are described in X/Open Curses, Issue 4.
X/Open Curses Issue\ 4 describes these functions.
It specifies no error conditions for them.
.SH HISTORY
X/Open Curses Issue\ 4 (1995) initially specified these functions.
The System\ V Interface Definition Version\ 4
of the same year
specified a function named
.I \%winwch
(and the usual variants).
.\" SVID 4, vol 3., p. 514
This was a later addition to
.RI SVr4. x ,
not appearing in the first SVr4 (1989).
It differed from X/Open's later
.I \%win_wch
in that it returned a value of type
.I \%chtype
instead of
.IR \%cchar_t "."
.SH SEE ALSO
\fB\%curs_inch\fP(3X) describes comparable functions of the
.I \%ncurses
+89 -50
View File
@@ -1,5 +1,5 @@
.\"***************************************************************************
.\" Copyright 2018-2023,2024 Thomas E. Dickey *
.\" Copyright 2018-2024,2025 Thomas E. Dickey *
.\" Copyright 2002-2012,2017 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@@ -27,8 +27,8 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: curs_in_wchstr.3x,v 1.39 2024/04/20 21:24:19 tom Exp $
.TH curs_in_wchstr 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.\" $Id: curs_in_wchstr.3x,v 1.56 2025/10/21 00:03:06 tom Exp $
.TH curs_in_wchstr 3X 2025-10-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
@@ -58,42 +58,68 @@ get a \fIcurses\fR complex character string from a window
.nf
\fB#include <curses.h>
.PP
\fBint in_wchstr(cchar_t *\fIwchstr\fP);
\fBint win_wchstr(WINDOW *\fIwin\fP, cchar_t *\fIwchstr\fP);
\fBint mvin_wchstr(int \fIy\fP, int \fIx\fP, cchar_t *\fIwchstr\fP);
\fBint mvwin_wchstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, cchar_t *\fIwchstr\fP);
\fBint in_wchstr(cchar_t * \fIwchstr\fP);
\fBint win_wchstr(WINDOW * \fIwin\fP, cchar_t * \fIwchstr\fP);
\fBint mvin_wchstr(int \fIy\fP, int \fIx\fP, cchar_t * \fIwchstr\fP);
\fBint mvwin_wchstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, cchar_t * \fIwchstr\fP);
.PP
\fBint in_wchnstr(cchar_t *\fIwchstr\fP, int \fIn\fP);
\fBint win_wchnstr(WINDOW *\fIwin\fP, cchar_t *\fIwchstr\fP, int \fIn\fP);
\fBint mvin_wchnstr(int \fIy\fP, int \fIx\fP, cchar_t *\fIwchstr\fP, int \fIn\fP);
\fBint mvwin_wchnstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, cchar_t *\fIwchstr\fP, int \fIn\fP);
\fBint in_wchnstr(cchar_t * \fIwchstr\fP, int \fIn\fP);
\fBint win_wchnstr(WINDOW * \fIwin\fP, cchar_t * \fIwchstr\fP, int \fIn\fP);
\fBint mvin_wchnstr(int \fIy\fP, int \fIx\fP, cchar_t * \fIwchstr\fP, int \fIn\fP);
\fBint mvwin_wchnstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, cchar_t * \fIwchstr\fP, int \fIn\fP)
.fi
.SH DESCRIPTION
These functions return an array of complex characters in \fIwchstr\fP,
starting at the current cursor position in the named window.
Attributes (rendition) are stored with the characters.
.PP
The four functions with \fIn\fP as the last argument return
a leading substring at most \fIn\fP characters long
(exclusive of the trailing zeroed \fBcchar_t\fR.
Transfer stops at the end of the current line, or when \fIn\fP characters have
been stored at the location referenced by \fIwchstr\fP.
.PP
Constants defined in \fB<curses.h>\fP can be used with the \fB&\fP (logical
AND) operator to extract the character or the attribute alone from any position
in the \fIwchstr\fP [see \fBgetcchar\fP(3X)].
.B \%win_wchstr
extracts a
.I curses
complex character string from a
.I curses
window
.IR win ","
starting at the cursor and stopping at the end of the line,
and stores it in
.IR wchstr ","
terminating it with a wide null
.I curses
character.
.B \%win_wchnstr
does the same,
but copies at most
.I n
.I curses
complex characters from
.IR win "."
A negative
.I n
implies no limit;
.B \%win_wchnstr
then works like
.BR \%win_wchstr "."
\fB\%ncurses\fP(3X) describes the variants of these functions.
.SH RETURN VALUE
Upon successful completion, these functions return
\fBOK\fP.
Otherwise, they return
\fBERR\fP.
These functions return
.B OK
on success and
.B ERR
on failure.
.PP
X/Open Curses defines no error conditions.
This implementation returns an error
In
.IR \%ncurses ","
these functions fail if
.bP
if the \fIwin\fP parameter is null or
the
.I curses
screen has not been initialized,
.bP
if the \fIwchstr\fP parameter is null.
(for functions taking a
.I \%WINDOW
pointer argument)
.I win
is a null pointer,
or
.bP
.I wchstr
is a null pointer.
.PP
Functions prefixed with \*(``mv\*('' first perform cursor movement and
fail if the position
@@ -101,27 +127,40 @@ fail if the position
.IR x )
is outside the window boundaries.
.SH NOTES
All routines except \fBwin_wchnstr\fP may be macros.
All of these functions except
.B \%win_wchnstr
may be implemented as macros.
.PP
Reading a line that overflows the array pointed to by
\fIwchstr\fP
with
\fBin_wchstr\fP,
\fBmvin_wchstr\fP,
\fBmvwin_wchstr\fP
or
\fBwin_wchstr\fP
causes undefined results.
Therefore, the use of
\fBin_wchnstr\fP,
\fBmvin_wchnstr\fP,
\fBmvwin_wchnstr\fP, or
\fBwin_wchnstr\fP
is recommended.
.I wchstr
and its variants causes undefined results.
Instead,
use the
.IR n -infixed
functions with a positive
.I n
argument no larger than the size of the buffer backing
.IR wchstr "."
.SH PORTABILITY
X/Open Curses defines no error conditions.
This implementation checks for null pointers,
returning \fBERR\fP in that case.
X/Open Curses Issue\ 4 describes these functions.
It specifies no error conditions for them.
.SH HISTORY
X/Open Curses Issue\ 4 (1995) initially specified these functions.
The System\ V Interface Definition Version\ 4
of the same year
specified a function named
.I \%winwchstr
(and the usual variants).
.\" SVID 4, vol 3., p. 515
This was a later addition to
.RI SVr4. x ,
not appearing in the first SVr4 (1989).
It differed from X/Open's later
.I \%win_wchstr
in that it took an argument of type
.RI pointer-to- chtype
instead of
.RI pointer-to- cchar_t "."
.SH SEE ALSO
\fB\%curs_inchstr\fP(3X) describes comparable functions of the
.I \%ncurses
+94 -54
View File
@@ -1,6 +1,6 @@
'\" t
.\"***************************************************************************
.\" Copyright 2018-2023,2024 Thomas E. Dickey *
.\" Copyright 2018-2024,2025 Thomas E. Dickey *
.\" Copyright 1998-2010,2017 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@@ -28,8 +28,8 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: curs_inch.3x,v 1.51 2024/04/20 21:20:07 tom Exp $
.TH curs_inch 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.\" $Id: curs_inch.3x,v 1.70 2025/02/15 19:36:03 tom Exp $
.TH curs_inch 3X 2025-02-15 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
@@ -56,73 +56,113 @@ get a \fIcurses\fR character from a window
\fB#include <curses.h>
.PP
\fBchtype inch(void);
\fBchtype winch(WINDOW *\fIwin\fP);
.PP
\fBchtype winch(WINDOW * \fIwin\fP);
\fBchtype mvinch(int \fIy\fP, int \fIx\fP);
\fBchtype mvwinch(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP);
\fBchtype mvwinch(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP);
.fi
.SH DESCRIPTION
These routines return the character, of type \fBchtype\fP, at the current
position in the named window.
If any attributes are set for that position,
their values are OR'ed into the value returned.
Constants defined in
\fB<curses.h>\fP can be used with the \fB&\fP (logical AND) operator to
extract the character or attributes alone.
.
.SS Attributes
The following bit masks may be AND-ed with characters returned by \fBwinch\fP.
.PP
.TS
Lb Lb
Lb Lx.
Name Description
_
A_CHARTEXT Extract character
A_ATTRIBUTES Extract attributes
A_COLOR Extract color pair information
.TE
.B \%winch
returns the
.I curses
character,
including its attributes and color pair identifier,
at the cursor position in the window
.IR win "."
Subsection \*(``Video Attributes\*('' of \fB\%attron\fP(3X) explains
how to extract these data from a
.IR chtype "."
\fB\%ncurses\fP(3X) describes the variants of this function.
.SH RETURN VALUE
These functions return
.B OK
on success and
.B ERR
on failure.
.PP
In
.IR \%ncurses ","
they return
.B ERR
if
.I win
is
.IR NULL "."
.PP
Functions prefixed with \*(``mv\*('' first perform cursor movement and
fail if the position
.RI ( y ,
.IR x )
is outside the window boundaries.
.PP
The \fBwinch\fP function does not return an error if the window contains
characters larger than 8-bits (255).
Only the low-order 8 bits of the character are used by \fBwinch\fP.
.SH NOTES
Note that all of these routines may be macros.
.BR \%inch ,
.BR \%mvinch ,
and
.B \%mvwinch
may be implemented as macros.
.PP
These functions do not fail if the window contains cells of
.I curses
complex characters;
that is,
if they contain characters with codes wider than eight bits
(or greater than 255 as an unsigned decimal integer).
They instead extract only the low-order eight bits of the character code
from the cell.
.SH PORTABILITY
These functions are described in X/Open Curses, Issue 4.
X/Open Curses Issue\ 4 describes these functions.
It specifies no error conditions for them.
.SH HISTORY
The original
.I curses
in 4BSD (1980) defined
.I \%winch
as a macro accessing the
.I \%WINDOW
structure member representing character cell data,
at that time a
.IR char ","
containing only a 7-bit ASCII character code
and a \*(``standout\*(`` attribute bit,
the only one the library supported.
.PP
Very old systems (before standardization) provide a different function
with the same name:
.bP
The \fBwinch\fP function was part of the original BSD curses library,
which stored a 7-bit character combined with the \fIstandout\fP attribute.
.IP
In BSD curses, \fBwinch\fP returned only the character (as an integer)
with the \fIstandout\fP attribute removed.
.bP
System V curses added support for several video attributes which
could be combined with characters in the window.
.IP
Reflecting this improvement, the function was altered to return the
character combined with all video attributes in a \fBchtype\fP value.
.PP
X/Open Curses does not specify
the size and layout of attributes, color and character values in
\fBchtype\fP; it is implementation-dependent.
This implementation uses 8 bits for character values.
An application using more bits, e.g., a Unicode value,
should use the wide-character equivalents to these functions.
SVr2
.I curses
(1984)
extended this approach,
widening the character code to eight bits
and permitting several attributes to be combined with it
by storing them together in a
.IR \%chtype ","
an alias of
.IR "unsigned short" "."
.\" ...indirectly through a preprocessor macro named CHTYPE, encouraging
.\" builders to change the typedef to `char` or `long` as desired. More
.\" innocent times with respect to ABI compatibility concerns... --GBR
Because a macro was used,
its value was not type-checked
as a function return value could have been.
Goodheart documented SVr3 (1987)
.I \%winch
as returning an
.IR int "."
.\" ...but the implementation remained unchanged.
SVr3.1's (1987)
.I \%chtype
became an alias of
.IR "unsigned long" ","
using 16 bits for the character code and
widening the type in practical terms to 32 bits,
as 64-bit Unix systems were not yet in wide use,
and fixed-width integral types would not be standard until ISO C99.
.\" Cray's UNICOS was 1985 (how many shops had Crays?). DEC OSF/1 for
.\" the Alpha arrived in 1993. --GBR
SVr3.2 (1988)
added a 6-bit color pair identifier alongside the attributes.
.SH SEE ALSO
\fB\%curs_in_wch\fP(3X) describes comparable functions of the
.I \%ncurses
library in its wide-character configuration
.RI ( \%ncursesw ).
.RI \%( ncursesw ).
.PP
\fB\%curses\fP(3X),
\fB\%curs_instr\fP(3X)
+121 -58
View File
@@ -1,5 +1,5 @@
.\"***************************************************************************
.\" Copyright 2018-2023,2024 Thomas E. Dickey *
.\" Copyright 2018-2024,2025 Thomas E. Dickey *
.\" Copyright 1998-2010,2017 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@@ -27,8 +27,8 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: curs_inchstr.3x,v 1.45 2024/04/20 21:20:07 tom Exp $
.TH curs_inchstr 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.\" $Id: curs_inchstr.3x,v 1.65 2025/10/21 00:05:02 tom Exp $
.TH curs_inchstr 3X 2025-10-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
@@ -58,41 +58,68 @@ get a \fIcurses\fR character string from a window
.nf
\fB#include <curses.h>
.PP
\fBint inchstr(chtype *\fIchstr\fP);
\fBint inchnstr(chtype *\fIchstr\fP, int \fIn\fP);
\fBint winchstr(WINDOW *\fIwin\fP, chtype *\fIchstr\fP);
\fBint winchnstr(WINDOW *\fIwin\fP, chtype *\fIchstr\fP, int \fIn\fP);
\fBint inchstr(chtype * \fIchstr\fP);
\fBint inchnstr(chtype * \fIchstr\fP, int \fIn\fP);
\fBint winchstr(WINDOW * \fIwin\fP, chtype * \fIchstr\fP);
\fBint winchnstr(WINDOW * \fIwin\fP, chtype * \fIchstr\fP, int \fIn\fP);
.PP
\fBint mvinchstr(int \fIy\fP, int \fIx\fP, chtype *\fIchstr\fP);
\fBint mvinchnstr(int \fIy\fP, int \fIx\fP, chtype *\fIchstr\fP, int \fIn\fP);
\fBint mvwinchstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, chtype *\fIchstr\fP);
\fBint mvwinchnstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, chtype *\fIchstr\fP, int \fIn\fP);
\fBint mvinchstr(int \fIy\fP, int \fIx\fP, chtype * \fIchstr\fP);
\fBint mvinchnstr(int \fIy\fP, int \fIx\fP, chtype * \fIchstr\fP, int \fIn\fP);
\fBint mvwinchstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, chtype * \fIchstr\fP);
\fBint mvwinchnstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, chtype * \fIchstr\fP, int \fIn\fP);
.fi
.SH DESCRIPTION
These routines return a NULL-terminated array of \fBchtype\fP quantities,
starting at the current cursor position in the named window and ending at the
right margin of the window.
.PP
The four functions with \fIn\fP as the last argument, return
a leading substring at most \fIn\fP characters long
(exclusive of the trailing (chtype)0).
Transfer stops at the end of the current line, or when \fIn\fP characters have
been stored at the location referenced by \fIchstr\fP.
.PP
Constants defined in \fB<curses.h>\fP can be used with the \fB&\fP (logical
AND) operator to extract the character or the attribute alone from any position
in the \fIchstr\fP [see \fBcurs_inch\fP(3X)].
.B \%winchstr
extracts a
.I curses
character string from a
.I curses
window
.IR win ","
starting at the cursor and stopping at the end of the line,
and stores it in
.IR chstr ","
terminating it with a null
.I curses
character.
.B \%winchnstr
does the same,
but copies at most
.I n
.I curses
characters from
.IR win "."
A negative
.I n
implies no limit;
.B \%winchnstr
then works like
.BR \%winchstr "."
\fB\%ncurses\fP(3X) describes the variants of these functions.
.SH RETURN VALUE
All routines return the integer \fBERR\fP upon failure and an integer value
other than \fBERR\fP upon successful completion (the number of characters
retrieved, exclusive of the trailing 0).
These functions return
.B OK
on success and
.B ERR
on failure.
.PP
X/Open Curses defines no error conditions.
This implementation returns an error
In
.IR \%ncurses ","
these functions fail if
.bP
if the \fIwin\fP parameter is null or
the
.I curses
screen has not been initialized,
.bP
if the \fIchstr\fP parameter is null.
(for functions taking a
.I \%WINDOW
pointer argument)
.I win
is a null pointer,
or
.bP
.I chstr
is a null pointer.
.PP
Functions prefixed with \*(``mv\*('' first perform cursor movement and
fail if the position
@@ -100,36 +127,72 @@ fail if the position
.IR x )
is outside the window boundaries.
.SH NOTES
All routines except \fBwinchnstr\fP may be macros.
.PP
SVr4 does not
document whether the result string is zero-terminated; it does not document
whether a length limit argument includes any trailing 0; and it does not
document the meaning of the return value.
All of these functions except
.B \%winchnstr
may be implemented as macros.
.PP
Reading a line that overflows the array pointed to by
\fIchstr\fP
with
\fBinchstr\fP,
\fBmvinchstr\fP,
\fBmvwinchstr\fP
or
\fBwinchstr\fP
causes undefined results.
Therefore, the use of
\fBinchnstr\fP,
\fBmvinchnstr\fP,
\fBmvwinchnstr\fP, or
\fBwinchnstr\fP
is recommended.
.I chstr
and its variants causes undefined results.
Instead,
use the
.IR n -infixed
functions with a positive
.I n
argument no larger than the size of the buffer backing
.IR chstr "."
.SH EXTENSIONS
.BR \%inchnstr ","
.BR \%winchnstr ","
.BR \%mvinchnstr ","
and
.BR \%mvwinchnstr "'s"
acceptance of negative
.I n
values is an
.I \%ncurses
extension.
.SH PORTABILITY
These functions are described in X/Open Curses, Issue 4.
It is no
more specific than the SVr4 documentation on the trailing 0.
It does specify
that the successful return of the functions is \fBOK\fP.
Applications employing
.I \%ncurses
extensions should condition their use on the visibility of the
.B \%NCURSES_VERSION
preprocessor macro.
.PP
X/Open Curses Issue\ 4 describes these functions.
It specifies no error conditions for them.
It characterizes the strings stored by these functions as containing
\*(``at most
.I n
elements\*('' from a window,
.\" X/Open Issue 4, Version 2, p. 113, PDF p. 133
.\" Issue 7 doesn't change this wording at all.
but does not specify whether the string stored by these functions is
null-terminated.
.PP
SVr4 does not document whether it null-terminates the
.I curses
character string it stores
in
.IR chstr ","
and does not document whether a trailing null
.I curses
character counts
toward the length limit
.IR n "."
.PP
SVr4 describes a successful return value only as
\*(``an integer value other than
.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 503
.SH HISTORY
SVr3.1 (1987)
introduced these functions.
.SH SEE ALSO
\fB\%curs_in_wchstr\fP(3X) describes comparable functions of the
.I \%ncurses
library in its wide-character configuration
.RI \%( ncursesw ).
.PP
\fB\%curses\fP(3X),
\fB\%curs_inch\fP(3X),
\fB\%curs_inwstr\fP(3X),
\fB\%curs_in_wchstr\fP(3X)
\fB\%curs_inwstr\fP(3X)
+496 -179
View File
@@ -1,5 +1,5 @@
.\"***************************************************************************
.\" Copyright 2018-2023,2024 Thomas E. Dickey *
.\" Copyright 2018-2024,2025 Thomas E. Dickey *
.\" Copyright 1998-2016,2017 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@@ -27,8 +27,8 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: curs_initscr.3x,v 1.69 2024/04/20 21:24:19 tom Exp $
.TH curs_initscr 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.\" $Id: curs_initscr.3x,v 1.112 2025/08/23 22:41:44 tom Exp $
.TH curs_initscr 3X 2025-08-23 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
@@ -56,205 +56,545 @@ initialize, manipulate, or tear down \fIcurses\fR terminal interface
.nf
\fB#include <curses.h>
.PP
\fBWINDOW *initscr(void);
\fBWINDOW * initscr(void);
\fBint endwin(void);
.PP
\fBbool isendwin(void);
.PP
\fBSCREEN *newterm(const char *\fItype\fP, FILE *\fIoutf\fP, FILE *\fIinf\fP);
\fBSCREEN *set_term(SCREEN *\fInew\fP);
\fBvoid delscreen(SCREEN* \fIsp\fP);
\fBSCREEN * newterm(const char * \fItype\fP, FILE * \fIoutf\fP, FILE * \fIinf\fP);
\fBSCREEN * set_term(SCREEN * \fInew\fP);
\fBvoid delscreen(SCREEN * \fIsp\fP);
.fi
.SH DESCRIPTION
.SS initscr
\fBinitscr\fP is normally the first \fBcurses\fP routine to call when
initializing a program.
A few special routines sometimes need to be called before it;
these are \fBslk_init\fP(3X), \fBfilter\fP, \fBripoffline\fP,
\fBuse_env\fP.
For multiple-terminal applications,
\fBnewterm\fP may be called before \fBinitscr\fP.
.B \%initscr
determines the terminal type and initializes the library's
.IR SCREEN ","
.IR WINDOW ","
and other data structures.
It is normally the first
.I curses
function call a program performs.
However,
an application with unusual needs might employ a few other
.I curses
functions beforehand:
.bP
\fB\%slk_init\fP(3X) to set up soft-label keys;
.bP
\fB\%filter\fP(3X) if the program is designed to operate in a process
pipeline;
.bP
\fB\%ripoffline\fP(3X) to reserve up to five lines at the top and/or
bottom of the screen from management by
.BR \%stdscr ","
the standard
.I curses
window;
and
.bP
\fB\%use_env\fP(3X) and/or \fB\%use_tioctl\fP(3X) to configure use of
the process environment and operating system's terminal driver,
respectively,
when determining the dimensions of the terminal display.
.PP
The initscr code determines the terminal type and initializes all \fBcurses\fP
data structures.
\fBinitscr\fP also causes the first call to \fBrefresh\fP(3X)
to clear the screen.
If errors occur, \fBinitscr\fP writes an appropriate error
message to standard error and exits;
otherwise, a pointer is returned to \fBstdscr\fP.
Further,
a
.I curses
program might call
.B \%newterm
prior to or instead of
.B \%initscr
in two specialized cases described in its subsection below.
.PP
.B \%initscr
causes the first \fB\%refresh\fP(3X) call to clear the screen.
If errors occur,
.B \%initscr
writes an appropriate diagnostic message to the standard error stream
and exits;
otherwise,
it returns a pointer to
.BR stdscr "."
.SS newterm
A program that outputs to more than one terminal should use the \fBnewterm\fP
routine for each terminal instead of \fBinitscr\fP.
A program that needs to inspect capabilities,
so it can continue to run in a line-oriented mode if the
terminal cannot support a screen-oriented program, would also use
\fBnewterm\fP.
.PP
The routine \fBnewterm\fP should be called once for each terminal.
It returns a variable of type \fISCREEN *\fP which should be saved
as a reference to that terminal.
\fBnewterm\fP's arguments are
An application that manages multiple terminals should call
.B \%newterm
once for each such device
.I instead
of
.BR \%initscr "."
.BR \%newterm 's
arguments are
.bP
the \fItype\fP of the terminal to be used in place of \fB$TERM\fP,
the
.I type
of the associated terminal,
or a null pointer to use the
.I TERM
environment variable;
.bP
an output stream connected to the terminal, and
an output stream
.I outf
connected to the terminal;
and
.bP
an input stream connected to the terminal
an input stream
.I inf
connected to the terminal.
.PP
If the \fItype\fP parameter is \fBNULL\fP, \fB$TERM\fP will be used.
.B \%newterm
returns a variable of
.RI pointer-to- SCREEN
type,
which should be saved for later use with
.B \%set_term
and
.BR \%delscreen "."
.PP
The file descriptor of the output stream is passed to \fBsetupterm\fP(3X),
which returns a pointer to a \fI\%TERMINAL\fP structure.
\fBnewterm\fP's return value holds a pointer to the \fI\%TERMINAL\fP structure.
.B \%newterm
passes the file descriptor of the output stream to the
.I \%term\%info
function \fB\%setupterm\fP(3X),
which returns a pointer to a
.I \%TERMINAL
structure that
.B \%newterm
stores in the
.I SCREEN
it returns to the application.
.PP
An application that needs to inspect a terminal type's capabilities,
so that it can continue to run in a line-oriented mode
if the terminal type does not support capabilities the application
demands,
would also use
.BR \%newterm "."
If at most one terminal connection is needed,
the programmer could perform such a capability test,
decide the mode in which to operate,
then call
.B \%delscreen
on the pointer returned by
.BR \%newterm ","
and proceed with either
.B \%initscr
or a
.RI non- curses
interface.
.SS endwin
The program must also call
\fBendwin\fP for each terminal being used before exiting from \fBcurses\fP.
If \fBnewterm\fP is called more than once for the same terminal, the first
terminal referred to must be the last one for which \fBendwin\fP is called.
.B \%endwin
for each terminal being used before exiting from
.IR curses "."
If
.B \%newterm
is called more than once for the same terminal,
the first terminal referred to must be the last one for which
.B \%endwin
is called.
.PP
A program should always call \fBendwin\fP before exiting or escaping from
\fBcurses\fP mode temporarily.
This routine
A program should always call
.B \%endwin
before exiting the application
or temporarily suspending
.IR curses "'s"
management of the terminal.
.BR \%endwin ":"
.bP
resets colors to correspond with the default color pair 0,
(if \fB\%start_color\fP(3X) has been called)
resets the terminal's foreground and background colors
to correspond with those of color pair 0
(the default pair),
.bP
moves the cursor to the lower left-hand corner of the screen,
.bP
clears the remainder of the line so that it uses the default colors,
(if \fB\%start_color\fP(3X) has been called)
restores the default color pair,
.bP
sets the cursor to normal visibility (see \fBcurs_set\fP(3X)),
clears the line,
.bP
stops cursor-addressing mode using the \fIexit_ca_mode\fP terminal capability,
sets the cursor to normal visibility
(see \fB\%curs_set\fP(3X)),
.bP
restores tty modes (see \fBreset_shell_mode\fP(3X)).
if applicable,
stops cursor-addressing mode using the
.B \%exit_ca_mode
.RB \%( rmcup )
terminal capability,
and
.bP
restores terminal modes (see \fB\%reset_shell_mode\fP(3X)).
.PP
Calling \fBrefresh\fP(3X) or \fBdoupdate\fP(3X) after a
temporary escape causes the program to resume visual mode.
Calling \fB\%refresh\fP(3X) or \fB\%doupdate\fP(3X) after a
temporary suspension causes
.I curses
to resume managing the terminal.
.SS isendwin
The \fBisendwin\fP routine returns \fBTRUE\fP if \fBendwin\fP has been
called without any subsequent calls to \fBwrefresh\fP,
and \fBFALSE\fP otherwise.
.B \%isendwin
returns
.B TRUE
if \fB\%wrefresh\fP(3X)
has not been called since the most recent
.B \%endwin
call,
and
.B FALSE
otherwise.
.SS set_term
The \fBset_term\fP routine is used to switch between different terminals.
The screen reference \fInew\fP becomes the new current terminal.
The previous terminal is returned by the routine.
This is the only routine which manipulates \fISCREEN\fP pointers;
all other routines affect only the current terminal.
.B \%set_term
re-orients the
.I curses
library's operations to another terminal
when the application has arranged to manage more than one with
.BR \%newterm "."
.B \%set_term
expects a
.I SCREEN
pointer previously returned by
.B \%newterm
as an argument,
and returns the previous one.
.B \%set_term
is the only standard
.I curses
API function that manipulates
.I SCREEN
pointers;
all others affect only the current terminal
(but see \fBcurs_sp_funcs\fP(3X)).
.SS delscreen
The \fBdelscreen\fP routine frees storage associated with the
\fISCREEN\fP data structure.
The \fBendwin\fP routine does not do
this, so \fBdelscreen\fP should be called after \fBendwin\fP if a
particular \fISCREEN\fP is no longer needed.
.B \%delscreen
frees the storage backing the supplied
.I SCREEN
pointer argument.
.B \%endwin
does not,
so that an application can resume managing a terminal with
.I curses
after a
(possibly conditional or temporary)
suspension;
see \fB\%curs_kernel\fP(3X).
Use
.B \%delscreen
after
.B \%endwin
when the application has no more need of a terminal device
but will not soon exit.
.SH RETURN VALUE
\fBendwin\fP returns the integer \fBERR\fP upon failure and \fBOK\fP
upon successful completion.
.B \%delscreen
returns no value.
.B \%endwin
returns
.B OK
on success and
.B ERR
on failure.
.B \%isendwin
returns
.B TRUE
or
.B FALSE
as described above.
.PP
Routines that return pointers always return \fBNULL\fP on error.
.PP
X/Open defines no error conditions.
In this implementation
In
.IR \%ncurses ","
.bP
\fBendwin\fP returns an error if
.B \%endwin
returns
.B ERR
if
.RS
.bP
the terminal was not initialized, or
the terminal was not initialized,
.bP
\fBendwin\fP is called more than once without updating the screen, or
it is called more than once without updating the screen,
or
.bP
\fBreset_shell_mode\fP(3X) returns an error.
its call of \fB\%reset_shell_mode\fP(3X) returns
.BR ERR ";"
and
.RE
.bP
\fBnewterm\fP
returns an error if it cannot allocate the data structures for the screen,
or for the top-level windows within the screen,
i.e.,
\fBcurscr\fP, \fBnewscr\fP, or \fBstdscr\fP.
.B \%newterm
returns
.B ERR
if it cannot allocate storage for the
.I SCREEN
structure
or the
.I WINDOW
structures automatically associated with it:
.BR \%curscr ","
.BR \%newscr ","
and
.BR \%stdscr "."
.PP
Functions that return pointers return null pointers on error.
In
.IR \%ncurses ","
.B \%set_term
does not fail,
and
.B \%initscr
exits the application if it does not operate successfully.
.SH NOTES
.I \%ncurses
establishes signal handlers when a function that initializes a
.IR SCREEN ","
either
.B \%initscr
or
.BR \%newterm ","
is first called.
Applications that wish to handle the following signals themselves
should set up their corresponding handlers
.I after
initializing the screen.
.TP
.I SIGINT
.IR \%ncurses 's
handler
.I attempts
to clean up the screen on exit.
Although it
.I usually
works as expected,
there are limitations.
.RS
.bP
\fBset_term\fP
returns no error.
Walking the
.I SCREEN
list is unsafe, since all list management
is done without any signal blocking.
.bP
When an application has been built with the
.I \%_REENTRANT
macro defined
(and corresponding system support),
.B \%set_term
uses functions that could deadlock or misbehave in other ways.
.bP
.B \%endwin
calls other functions,
many of which use \fI\%stdio\fP(3) or other library functions that are
clearly unsafe.
.RE
.TP
.I SIGTERM
.I \%ncurses
uses the same handler as for
.IR \%SIGINT ","
with the same limitations.
It is not mentioned in X/Open Curses,
but is more suitable for this purpose than
.I \%SIGQUIT
(which is used in debugging).
.TP
.I SIGTSTP
.IR \%ncurses 's
handler manages the terminal-generated stop signal,
used in job control.
When resuming the process,
.I \%ncurses
discards pending input with \fB\%flushinp\fP(3X)
and repaints the screen,
assuming that it has been completely altered.
It also updates the saved terminal modes with
\fB\%def_shell_mode\fP(3X).
.TP
.I SIGWINCH
.I \%ncurses
handles changes to the terminal's window size,
a phenomenon ignored in standardization efforts.
It sets a (signal-safe) variable
that is later tested by \fB\%wgetch\fP(3X) and \fB\%wget_wch\fP(3X).
.RS
.bP
.B \%wgetch
returns the key code
.BR \%KEY_RESIZE "."
.bP
.B \%wget_wch
returns
.B \%KEY_CODE_YES
and sets its
.I wch
parameter to
.BR \%KEY_RESIZE "."
.RE
.IP
At the same time,
.I \%ncurses
calls \fB\%resizeterm\fP(3X)
to adjust the standard screen
.B \%stdscr
and update global variables such as
.B LINES
and
.BR COLS "."
.SH PORTABILITY
These functions were described in X/Open Curses, Issue 4.
As of 2015, the current document is X/Open Curses, Issue 7.
X/Open Curses Issue\ 4 describes these functions.
It specifies no error conditions for them.
.SS Differences
X/Open Curses specifies that portable applications must not
call \fBinitscr\fP more than once:
call
.I \%initscr
more than once.
.bP
The portable way to use \fBinitscr\fP is once only,
using \fB\%refresh\fP(3X)
to restore the screen after \fBendwin\fP.
The portable way to use
.I \%initscr
is once only,
using
.I \%refresh
to restore the screen after
.IR \%endwin "."
.bP
This implementation allows using \fBinitscr\fP after \fBendwin\fP.
.I \%ncurses
permits use of
.I \%initscr
after
.IR \%endwin "."
.PP
Old versions of curses, e.g., BSD 4.4, would return a null pointer
from \fBinitscr\fP when an error is detected, rather than exiting.
It is safe but redundant to check the return value of \fBinitscr\fP
.I \%initscr
in BSD,
from its inception (1980) through the Net/2 release (1991) returned
.I ERR
cast to a
.I \%WINDOW
pointer when detecting an error.
.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4BSD/usr/src/lib/libcurses/initscr.c
.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=Net2/usr/src/lib/libcurses/initscr.c
4.4BSD (1995)
instead returned a null pointer.
.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/src/lib/libcurses/initscr.c
Neither exited the application.
It is safe but redundant to check the return value of
.I \%initscr
in X/Open Curses.
.PP
Calling \fBendwin\fP does not dispose of the memory allocated in \fBinitscr\fP
or \fBnewterm\fP.
Deleting a \fISCREEN\fP provides a way to do this:
Calling
.I \%endwin
does not dispose of the memory allocated by
.I \%initscr
or
.IR \%newterm "."
Deleting a
.I SCREEN
provides a way to do this.
.bP
X/Open Curses does not say what happens to \fI\%WINDOW\fPs when \fBdelscreen\fP
\*(``frees storage associated with the \fISCREEN\fP\*(''
X/Open Curses does not say what happens to
.IR \%WINDOW s
when
.I \%delscreen
\*(``frees storage associated with the
.IR SCREEN "\*(''"
nor does the SVr4 documentation help,
adding that it should be called after \fBendwin\fP if a \fISCREEN\fP
adding that it should be called after
.I \%endwin
if a
.I SCREEN
is no longer needed.
.bP
However, \fI\%WINDOW\fPs are implicitly associated with a \fISCREEN\fP.
so that it is reasonable to expect \fBdelscreen\fP to deal with these.
However,
every
.I \%WINDOW
is implicitly associated with a
.IR SCREEN ","
so it is reasonable to expect
.I \%delscreen
to dispose of them.
.bP
SVr4 curses deletes the standard \fI\%WINDOW\fP structures
\fBstdscr\fP and \fBcurscr\fP as well as a work area \fBnewscr\fP.
SVr4 curses ignores other windows.
SVr4 deletes the standard
.I \%WINDOW
structures
.I \%stdscr
and
.I \%curscr
as well as a work area
.IR \%newscr "."
It ignores other windows.
.bP
Since version 4.0 (1996),
\fI\%ncurses\fP has maintained a list of all windows for each screen,
using that information to delete those windows when \fBdelscreen\fP is called.
.I \%ncurses
has maintained a list of all windows for each screen,
using that information to delete those windows when
.I \%delscreen
is
called.
.bP
NetBSD copied this feature of \fI\%ncurses\fP in 2001.
PDCurses follows the SVr4 model,
deleting only the standard \fI\%WINDOW\fP structures.
.SS "High-level versus Low-level"
Different implementations may disagree regarding the level of some functions.
For example, \fISCREEN\fP (returned by \fBnewterm\fP) and
\fI\%TERMINAL\fP (returned by \fBsetupterm\fP(3X)) hold file descriptors for
the output stream.
If an application switches screens using \fBset_term\fR,
or switches terminals using \fBset_curterm\fP(3X),
applications which use the output file descriptor can have different
behavior depending on which structure holds the corresponding descriptor.
.PP
For example
NetBSD copied this feature of
.I \%ncurses
in 2001.
.I \%PDCurses
follows the SVr4 model,
deleting only the standard
.I \%WINDOW
structures and
.IR \%newscr "."
.SS "High-level versus Low-level Functions"
Implementations disagree
regarding the level of abstraction applicable to a function or property.
For example,
.I SCREEN
(returned by
.IR \%newterm ")"
and
.I \%TERMINAL
(returned by \fB\%setupterm\fP(3X)) hold file
descriptors for the output stream.
If an application switches screens using
.IR \%set_term ","
or switches terminals using \fB\%set_curterm\fP(3X),
applications
using the output file descriptor can behave differently
depending on the structure holding the corresponding descriptor.
.bP
NetBSD's \fBbaudrate\fP(3X) function uses the descriptor in \fI\%TERMINAL\fP.
\fI\%ncurses\fP and SVr4 use the descriptor in \fISCREEN\fP.
NetBSD's
.I \%baudrate
function uses the descriptor in
.IR \%TERMINAL "."
.I \%ncurses
and SVr4 use the descriptor in
.IR SCREEN "."
.bP
NetBSD and \fI\%ncurses\fP use the descriptor
in \fI\%TERMINAL\fP
NetBSD and
.I \%ncurses
use the descriptor
in
.I \%TERMINAL
for terminal I/O modes,
e.g.,
\fBdef_shell_mode\fP(3X),
\fBdef_prog_mode\fP(3X).
SVr4 curses uses the descriptor in \fISCREEN\fP.
.SS "Unset \fITERM\fP Variable"
If the \fITERM\fP variable is missing or empty, \fBinitscr\fP uses the
value \*(``unknown\*('',
which normally corresponds to a terminal entry with the \fIgeneric\fP
(\fIgn\fP) capability.
Generic entries are detected by \fBsetupterm\fP(3X)
\fB\%def_shell_mode\fP(3X),
\fB\%def_prog_mode\fP(3X).
SVr4 uses the descriptor in
.IR SCREEN "."
.SS "Unset \fITERM\fP Environment Variable"
If the
.I TERM
variable is not set in the environment or has an empty value,
.I \%initscr
uses the value \*(``unknown\*('',
which normally corresponds to a terminal entry with the
.B \%generic
.RB ( gn )
capability.
Generic entries are detected by \fB\%setupterm\fP(3X)
and cannot be used for full-screen operation.
Other implementations may handle
a missing/empty \fITERM\fP variable differently.
a missing or empty
.I TERM
variable differently.
.SS "Signal Handlers"
Quoting from X/Open Curses Issue 7, section 3.1.1:
Quoting X/Open Curses Issue\ 7,
section 3.1.1:
.RS 5
.PP
Curses implementations may provide for special handling of the
\%SIGINT,
\%SIGQUIT,
and \%SIGTSTP signals if their disposition is \%SIG_DFL at the time
.I \%initscr
.IR \%initscr ()
is called.\|.\|.
.PP
Any special handling for these signals may remain in effect for the
@@ -265,50 +605,27 @@ None of the Curses functions are required to be safe
with respect to signals.\|.\|.
.RE
.PP
This implementation establishes signal handlers during initialization,
e.g., \fBinitscr\fP or \fBnewterm\fP.
Applications which must handle these signals should set up the corresponding
handlers \fIafter\fP initializing the library:
.TP 5
.B SIGINT
The handler \fIattempts\fP to clean up the screen on exit.
Although it \fIusually\fP works as expected, there are limitations:
.RS 5
.bP
Walking the \fISCREEN\fP list is unsafe, since all list management
is done without any signal blocking.
.bP
On systems which have \fBREENTRANT\fP turned on, \fBset_term\fP uses
functions which could deadlock or misbehave in other ways.
.bP
\fBendwin\fP calls other functions,
many of which use \fI\%stdio\fP(3) or other library functions which are
clearly unsafe.
.RE
.TP 5
.B SIGTERM
This uses the same handler as \fBSIGINT\fP, with the same limitations.
It is not mentioned in X/Open Curses, but is more suitable for this
purpose than \fBSIGQUIT\fP (which is used in debugging).
.TP 5
.B SIGTSTP
This handles the \fIstop\fP signal, used in job control.
When resuming the process, this implementation discards pending
input with \fB\%flushinp\fP(3X), and repaints the screen
assuming that it has been completely altered.
It also updates the saved terminal modes with
\fB\%def_shell_mode\fP(3X).
.TP 5
.B SIGWINCH
This handles the window-size changes which were ignored in
the standardization efforts.
The handler sets a (signal-safe) variable
which is later tested in \fB\%wgetch\fP(3X).
If \fBkeypad\fP has been enabled for the corresponding window,
\fBwgetch\fP returns the key symbol \fBKEY_RESIZE\fP.
At the same time, \fBwgetch\fP calls \fBresizeterm\fP to adjust the
standard screen \fBstdscr\fP,
and update other data such as \fBLINES\fP and \fBCOLS\fP.
Section \*(``NOTES\*('' above discusses
.IR \%ncurses 's
signal handlers.
.SH HISTORY
4BSD (1980)
introduced
.I \%initscr
and
.IR \%endwin "."
.PP
SVr2 (1984)
added
.I \%newterm
and
.IR \%set_term "."
.PP
SVr3.1 (1987)
supplied
.I \%delscreen
and
.IR \%isendwin "."
.SH SEE ALSO
\fB\%curses\fP(3X),
\fB\%curs_kernel\fP(3X),
File diff suppressed because it is too large Load Diff
+70 -40
View File
@@ -1,5 +1,5 @@
.\"***************************************************************************
.\" Copyright 2019-2023,2024 Thomas E. Dickey *
.\" Copyright 2019-2024,2025 Thomas E. Dickey *
.\" Copyright 2002-2010,2017 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@@ -27,8 +27,8 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: curs_ins_wch.3x,v 1.30 2024/04/20 19:18:18 tom Exp $
.TH curs_ins_wch 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.\" $Id: curs_ins_wch.3x,v 1.52 2025/10/21 00:09:49 tom Exp $
.TH curs_ins_wch 3X 2025-10-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
@@ -39,41 +39,64 @@
.ie t .ds '' ''
.el .ds '' ""
.\}
.
.de bP
.ie n .IP \(bu 4
.el .IP \(bu 2
..
.SH NAME
\fB\%ins_wch\fP,
\fB\%wins_wch\fP,
\fB\%mvins_wch\fP,
\fB\%mvwins_wch\fP,
\fB\%wins_wch\fP \-
\fB\%mvwins_wch\fP \-
insert a \fIcurses\fR complex character in a window
.SH SYNOPSIS
.nf
\fB#include <curses.h>\fP
.PP
\fBint ins_wch(const cchar_t *\fIwch\fP);
\fBint wins_wch(WINDOW *\fIwin\fP, const cchar_t *\fIwch\fP);
\fBint mvins_wch(int \fIy\fP, int \fIx\fP, const cchar_t *\fIwch\fP);
\fBint mvwins_wch(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const cchar_t *\fIwch\fP);
\fBint ins_wch(const cchar_t * \fIwch\fP);
\fBint wins_wch(WINDOW * \fIwin\fP, const cchar_t * \fIwch\fP);
\fBint mvins_wch(int \fIy\fP, int \fIx\fP, const cchar_t * \fIwch\fP);
\fBint mvwins_wch(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, const cchar_t * \fIwch\fP);
.fi
.SH DESCRIPTION
These functions insert the
.B \%wins_wch
inserts the
.I curses
complex character
.I wch
at the cursor in the specified window
.I win
(or
.BR \%stdscr ).
at the cursor position in the window
.IR win "."
The character previously at the cursor and any to its right move one
cell to the right;
the rightmost character on the line is discarded.
The cursor does not advance.
the formerly rightmost character on the line is discarded.
Unlike \fB\%add_wch\fP(3X),
.B \%wins_wch
does not advance the cursor.
\fB\%ncurses\fP(3X) describes the variants of this function.
.SH "RETURN VALUE"
These functions return \fBOK\fP on success and \fBERR\fP on failure.
These functions return
.B OK
on success and
.B ERR
on failure.
.PP
Functions taking a
In
.IR \%ncurses ,
they return
.B ERR
if
.bP
the
.I curses
screen has not been initialized,
or
.bP
(for functions taking a
.I \%WINDOW
pointer argument fail if the pointer is
.BR NULL .
pointer argument)
.I win
is a null pointer.
.PP
Functions prefixed with \*(``mv\*('' first perform cursor movement and
fail if the position
@@ -81,30 +104,37 @@ fail if the position
.IR x )
is outside the window boundaries.
.SH NOTES
A terminal's
.BR \%ins_wch ","
.BR \%mvins_wch ","
and
.B \%mvwins_wch
may be implemented as macros.
.PP
.I curses
does not necessarily employ the terminal's
.B \%insert_character
.RB ( ich1 )
capability
is not necessarily employed.
.PP
\fB\%ins_wch\fP,
\fB\%mvins_wch\fP,
and
\fB\%mvwins_wch\fP
may be implemented as macros.
capability to achieve insertion.
.SH PORTABILITY
X/Open Curses,
Issue 4 describes these functions.
.PP
SVr4 describes successful return values only as
\*(``an integer value other than \fBERR\fP\*(''.
X/Open Curses Issue\ 4 describes these functions.
It specifies no error conditions for them.
.SH HISTORY
SVr4 (1989) implemented these functions under the names
.BR inswch ,
.BR winswch ,
.BR mvinswch ,
and
.BR mvwinswch .
X/Open Curses Issue\ 4 (1995) initially specified these functions.
The System\ V Interface Definition Version\ 4
of the same year
specified a function named
.I \%winswch
(and the usual variants).
.\" SVID 4, vol 3., p. 512
This was a later addition to
.RI SVr4. x ,
not appearing in the first SVr4 (1989).
It differed from X/Open's later
.I \%wins_wch
in that it took an argument of type
.I \%chtype
instead of
.IR \%cchar_t "."
.SH "SEE ALSO"
\fB\%curs_insch\fP(3X) describes comparable functions in the
non-wide-character
+134 -47
View File
@@ -1,5 +1,5 @@
.\"***************************************************************************
.\" Copyright 2019-2023,2024 Thomas E. Dickey *
.\" Copyright 2019-2024,2025 Thomas E. Dickey *
.\" Copyright 2002-2012,2017 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
@@ -27,8 +27,8 @@
.\" authorization. *
.\"***************************************************************************
.\"
.\" $Id: curs_ins_wstr.3x,v 1.38 2024/04/20 21:23:08 tom Exp $
.TH curs_ins_wstr 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.\" $Id: curs_ins_wstr.3x,v 1.60 2025/03/01 21:30:14 tom Exp $
.TH curs_ins_wstr 3X 2025-03-01 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
@@ -46,57 +46,93 @@
..
.SH NAME
\fB\%ins_wstr\fP,
\fB\%ins_nwstr\fP,
\fB\%wins_wstr\fP,
\fB\%wins_nwstr\fP,
\fB\%mvins_wstr\fP,
\fB\%mvins_nwstr\fP,
\fB\%mvwins_wstr\fP,
\fB\%ins_nwstr\fP,
\fB\%wins_nwstr\fP,
\fB\%mvins_nwstr\fP,
\fB\%mvwins_nwstr\fP \-
insert a wide-character string in a \fIcurses\fR window
.SH SYNOPSIS
.nf
\fB#include <curses.h>
.PP
\fBint ins_wstr(const wchar_t *\fIwstr\fP);
\fBint ins_nwstr(const wchar_t *\fIwstr\fP, int \fIn\fP);
\fBint wins_wstr(WINDOW *\fIwin\fP, const wchar_t *\fIwstr\fP);
\fBint wins_nwstr(WINDOW *\fIwin\fP, const wchar_t *\fIwstr\fP, int \fIn\fP);
\fBint ins_wstr(const wchar_t * \fIwstr\fP);
\fBint wins_wstr(WINDOW * \fIwin\fP, const wchar_t * \fIwstr\fP);
\fBint mvins_wstr(int \fIy\fP, int \fIx\fP, const wchar_t * \fIwstr\fP);
\fBint mvwins_wstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP,
const wchar_t * \fIwstr\fP);
.PP
\fBint mvins_wstr(int \fIy\fP, int \fIx\fP, const wchar_t *\fIwstr\fP);
\fBint mvins_nwstr(int \fIy\fP, int \fIx\fP, const wchar_t *\fIwstr\fP, int \fIn\fP);
\fBint mvwins_wstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const wchar_t *\fIwstr\fP);
\fBint mvwins_nwstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const wchar_t *\fIwstr\fP, int \fIn\fP);
\fBint ins_nwstr(const wchar_t * \fIwstr\fP, int \fIn\fP);
\fBint wins_nwstr(WINDOW * \fIwin\fP, const wchar_t * \fIwstr\fP, int \fIn\fP);
\fBint mvins_nwstr(int \fIy\fP, int \fIx\fP, const wchar_t * \fIwstr\fP, int \fIn\fP);
\fBint mvwins_nwstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP,
const wchar_t * \fIwstr\fP, int \fIn\fP);
.fi
.SH DESCRIPTION
These routines insert a \fBwchar_t\fP character string
(as many characters as will fit on the line)
before the character under the cursor,
as if calling \fBwins_wch\fP(3X).
All characters to the right of the cursor are shifted right,
with the possibility of the rightmost characters on the line being lost.
No wrapping is performed.
.PP
.B \%wins_wstr
inserts a wide-character string
.I wstr
before the character at the cursor in window
.I win
as if by calling \fBwins_wch\fP(3X) for each
.I \%wchar_t
in
.IR wstr "."
No line wrapping is performed.
Characters to the right of the cursor are shifted right;
those at the right edge of the window may be lost.
.B \%wins_wstr
stops inserting if it would have to wrap to the next line to write the
next
.I \%wchar_t
in
.IR wstr "."
The cursor position does not change
(after moving to \fIy\fP, \fIx\fP, if specified).
.PP
The functions with \fIn\fP as the last argument
insert a leading substring of at most \fIn\fP \fBwchar_t\fP characters.
If \fIn\fP is less than zero, the entire string is inserted
(stopping on a L'\e0' character).
.PP
Special characters are handled as in \fBwadd_wch\fP(3X).
(after moving to
.RI ( y ,
.IR x "),"
if specified).
.B \%wins_nwstr
does the same,
but inserts at most
.I n
wide characters,
or as many as possible
(up to the end of the line)
if
.I n
is negative.
\fB\%ncurses\fP(3X) describes the variants of these functions.
.SH RETURN VALUE
All functions return the integer \fBERR\fP upon failure and \fBOK\fP on success.
These functions return
.B OK
on success and
.B ERR
on failure.
.PP
X/Open Curses does not specify any error conditions.
This implementation returns an error
In
.IR \%ncurses ","
they return
.B ERR
if
.bP
if the \fIwin\fP parameter is null or
.I win
is
.IR NULL ","
.bP
if the \fIwstr\fP parameter is null or
.I wstr
is
.IR NULL ","
.bP
if the \fBwins_wch\fP function returns an error.
the first wide character in
.I wstr
is a non-spacing character,
or
.bP
an internal \fB\%wins_wch\fP(3X) call returns
.BR ERR "."
.PP
Functions prefixed with \*(``mv\*('' first perform cursor movement and
fail if the position
@@ -104,20 +140,71 @@ fail if the position
.IR x )
is outside the window boundaries.
.SH NOTES
All but \fBwins_nwstr\fP may be macros.
.PP
If the first character in the string is a non-spacing character, these
functions will fail.
X/Open Curses does not define what will happen
if a non-spacing character follows a control character.
All of these functions except
.B \%wins_nwstr
may be implemented as macros.
.SH EXTENSIONS
.BR \%ins_nwstr ","
.BR \%wins_nwstr ","
.BR \%mvins_nwstr ","
and
.BR \%mvwins_nwstr "'s"
acceptance of negative
.I n
values is an
.I \%ncurses
extension.
.SH PORTABILITY
These functions are described in X/Open Curses, Issue 4,
which adds \fI\%const\fP qualifiers to the arguments.
Applications employing
.I \%ncurses
extensions should condition their use on the visibility of the
.B \%NCURSES_VERSION
preprocessor macro.
.PP
X/Open states that the entire string is inserted if \fIn\fP is less than 1.
X/Open Curses Issue\ 4 describes these functions.
It specifies no error conditions for them.
.PP
X/Open Curses does not specify what happens
if a non-spacing character follows a control character.
.PP
Issue\ 4 states that the entire string is inserted if
.I n
is less than 1.
This is probably an error,
because it is inconsistent with other functions,
and differs from the X/Open implementation on Solaris.
.\" ...copied from SVID 4, which made the same error; see p. 513.
because it is inconsistent with other functions
such as
.IR \%waddwstr ","
and differs from the SVr4
.I curses
and Solaris
.I xcurses
implementations.
Nevertheless,
Issue\ 7 retains the language.
.SH HISTORY
X/Open Curses Issue\ 4 (1995) initially specified these functions.
The System\ V Interface Definition Version\ 4 (1995),
specified functions named
.I \%winswstr
and
.I \%winsnwstr
(and the usual variants).
.\" SVID 4, vol 3., p. 513
.\" The prototypes also identify the data type as `wchar`, not
.\" `wchar_t`, but this may be an error since the "DESCRIPTION" section
.\" consistently uses the latter. --GBR
These were later additions to
.RI SVr4. x ,
not appearing in the first SVr4 (1989).
They differ from X/Open's later
.I \%wins_wstr
and
.I \%wins_nwstr
in that their
.I wstr
parameters are not
.IR const "-qualified."
.SH SEE ALSO
\fB\%curs_insstr\fP(3X) describes comparable functions of the
.I \%ncurses

Some files were not shown because too many files have changed in this diff Show More