diff options
| author | Baptiste Daroussin <bapt@FreeBSD.org> | 2026-01-14 12:37:49 +0000 |
|---|---|---|
| committer | Baptiste Daroussin <bapt@FreeBSD.org> | 2026-01-14 12:37:49 +0000 |
| commit | c5a1e08b52b2f6c05e0116d46277904b711b6bdb (patch) | |
| tree | a6ad7350d1b1100356ca59616d22c51dd29743eb /man | |
| parent | 24fa7a5107c5b75d1c197accf0305be64bc72882 (diff) | |
Vendor import ncurses 6.6vendor/ncurses/6.6vendor/ncurses
Diffstat (limited to 'man')
128 files changed, 13807 insertions, 6590 deletions
diff --git a/man/MKada_config.in b/man/MKada_config.in index ee037ff4fdc0..58bae88dfa9e 100644 --- a/man/MKada_config.in +++ b/man/MKada_config.in @@ -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 diff --git a/man/MKncu_config.in b/man/MKncu_config.in index 14690a544c5e..856e64b02ed7 100644 --- a/man/MKncu_config.in +++ b/man/MKncu_config.in @@ -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 diff --git a/man/MKterminfo.sh b/man/MKterminfo.sh index 882ef2ad093b..d5cdbc852429 100755 --- a/man/MKterminfo.sh +++ b/man/MKterminfo.sh @@ -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 "$head" -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' + +cat > $pass3 << "EOF" +/^center expand;/s, expand,, +/^\.TS/,/^\\/s, lw[1-9][0-9]*\., l., +EOF -sed -e '/^center expand;/s, expand,,' \ - -e '/^\.TS/,/^\\/s, lw[1-9][0-9]*\., l.,' \ - "$tail" +sed -f $pass3 "$tail" diff --git a/man/Makefile.in b/man/Makefile.in index 9d08a7eed8ba..c7a6083b1552 100644 --- a/man/Makefile.in +++ b/man/Makefile.in @@ -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 diff --git a/man/captoinfo.1m b/man/captoinfo.1m index 4693b06b36e8..58dcb7359e07 100644 --- a/man/captoinfo.1m +++ b/man/captoinfo.1m @@ -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 diff --git a/man/clear.1 b/man/clear.1 index a1034db7cb1a..3d3a68f85b6d 100644 --- a/man/clear.1 +++ b/man/clear.1 @@ -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 diff --git a/man/curs_add_wch.3x b/man/curs_add_wch.3x index d1eb9a311fc8..c413fcb1fcbf 100644 --- a/man/curs_add_wch.3x +++ b/man/curs_add_wch.3x @@ -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: +.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 \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. +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 -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. +Tab advances the cursor to the next tab stop +(possibly on the next line); +these are placed at every eighth column by default. .IP -The cursor is not advanced after adding a non-spacing character. -Subsequent calls to add non-spacing characters will update the same position. +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 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). +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), diff --git a/man/curs_add_wchstr.3x b/man/curs_add_wchstr.3x index 5dd3e8f4e131..b5d30e60521b 100644 --- a/man/curs_add_wchstr.3x +++ b/man/curs_add_wchstr.3x @@ -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. -.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. +.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 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 +the +.I curses +screen has not been initialized, .bP -if the \fIwin\fP parameter is null or +.I wchstr +is a null pointer, +or .bP -if the \fIwchstr\fP parameter is null. +(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 diff --git a/man/curs_addch.3x b/man/curs_addch.3x index ad548520ce84..4fc248015698 100644 --- a/man/curs_addch.3x +++ b/man/curs_addch.3x @@ -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. -See section \*(``PORTABILITY\*('' below regarding the use of -.B \%waddch -with multibyte characters. +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 -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), diff --git a/man/curs_addchstr.3x b/man/curs_addchstr.3x index 25d322aff0be..99bbc9bcac54 100644 --- a/man/curs_addchstr.3x +++ b/man/curs_addchstr.3x @@ -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. -.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. +.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 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), diff --git a/man/curs_addstr.3x b/man/curs_addstr.3x index 1244001dbd95..fbfb8e03b23f 100644 --- a/man/curs_addstr.3x +++ b/man/curs_addstr.3x @@ -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), diff --git a/man/curs_addwstr.3x b/man/curs_addwstr.3x index 78d5788ebc22..d618bf837cd2 100644 --- a/man/curs_addwstr.3x +++ b/man/curs_addwstr.3x @@ -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 diff --git a/man/curs_attr.3x b/man/curs_attr.3x index 37774602be8c..99c3941c70d5 100644 --- a/man/curs_attr.3x +++ b/man/curs_attr.3x @@ -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)). -.PP -.ne 15 +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 +.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. -.PP -X/Open Curses does not specify any error conditions. -.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. +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 +.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 -.PP -Color pair values can only be OR'd with attributes if the pair -number is less than 256. +.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 +.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. -.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. -.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. -.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 -.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. -.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 +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 +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 +SVr3.2 (1988) +added the +.I \%A_COLOR +macro along with a color system; +see \fBcurs_color\fP(3X). +.PP +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 +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 +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), diff --git a/man/curs_beep.3x b/man/curs_beep.3x index 9806f42b3ad8..3221dfd4955c 100644 --- a/man/curs_beep.3x +++ b/man/curs_beep.3x @@ -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) diff --git a/man/curs_bkgd.3x b/man/curs_bkgd.3x index 25ba1f9f72c8..e61b48bce615 100644 --- a/man/curs_bkgd.3x +++ b/man/curs_bkgd.3x @@ -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." -.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. +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 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. +.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 -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), diff --git a/man/curs_bkgrnd.3x b/man/curs_bkgrnd.3x index 2551924c11a3..1239a7a924c1 100644 --- a/man/curs_bkgrnd.3x +++ b/man/curs_bkgrnd.3x @@ -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." -.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. +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 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. +.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 -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 +reuses the old background character, +except for one special case: .I \%ncurses -treats a background character value of zero (0) as a blank character. +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 +the +.I curses +screen has not been initialized, +.bP .I win -is null, or +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), diff --git a/man/curs_border.3x b/man/curs_border.3x index 2a5e72c141e2..c5aed64d2f8d 100644 --- a/man/curs_border.3x +++ b/man/curs_border.3x @@ -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 +.BR \%border "," +.BR \%box "," +.BR \%hline "," +.BR \%mvhline "," +.BR \%mvwhline "," +.BR \%vline "," +.BR \%mvvline "," +and +.B \%mvwvline +may be implemented as macros. .PP -Note that \fBborder\fP and \fBbox\fP may be macros. +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) diff --git a/man/curs_border_set.3x b/man/curs_border_set.3x index 3077da6b49f7..d41460a4041d 100644 --- a/man/curs_border_set.3x +++ b/man/curs_border_set.3x @@ -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), diff --git a/man/curs_clear.3x b/man/curs_clear.3x index 0ab00645197a..8a25bd45f6dc 100644 --- a/man/curs_clear.3x +++ b/man/curs_clear.3x @@ -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 diff --git a/man/curs_color.3x b/man/curs_color.3x index 7a5a02f27de3..799f462bb6e6 100644 --- a/man/curs_color.3x +++ b/man/curs_color.3x @@ -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. -.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. +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 +.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: +.B \%can_change_color +and +.B \%has_colors +return +.B TRUE +or +.BR FALSE "." +The other functions return +.B OK +on success and +.B ERR +on failure. +.PP +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 -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. +color identifiers outside the range +.RB \%0- COLORS \-1 +inclusive, +the default colors extension notwithstanding, +or .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 -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. -.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. +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). -.PP -Several caveats apply on older x86 machines -(e.g., i386, i486) with VGA-compatible graphics: -.bP -COLOR_YELLOW is actually brown. -To get yellow, use COLOR_YELLOW combined with the \fBA_BOLD\fP 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). +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 to IBM PC-compatible machines +of the 80486 era and earlier +with CGA/EGA/VGA video. +.bP +.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 -Color RGB values are not settable. +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 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. -.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. +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. .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. -.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. -.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: +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 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 +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. -.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. +.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 +.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), diff --git a/man/curs_delch.3x b/man/curs_delch.3x index e62ecc130de1..e4bf86cba174 100644 --- a/man/curs_delch.3x +++ b/man/curs_delch.3x @@ -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) diff --git a/man/curs_deleteln.3x b/man/curs_deleteln.3x index 6d70a4358c4f..46a9554629e3 100644 --- a/man/curs_deleteln.3x +++ b/man/curs_deleteln.3x @@ -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) diff --git a/man/curs_extend.3x b/man/curs_extend.3x index 01cf9d2ece71..1e5e2cfe1770 100644 --- a/man/curs_extend.3x +++ b/man/curs_extend.3x @@ -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) diff --git a/man/curs_get_wch.3x b/man/curs_get_wch.3x index 02932b91a6e4..55d9ff264600 100644 --- a/man/curs_get_wch.3x +++ b/man/curs_get_wch.3x @@ -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 diff --git a/man/curs_get_wstr.3x b/man/curs_get_wstr.3x index 32ae541abaf9..b6daab6b64fe 100644 --- a/man/curs_get_wstr.3x +++ b/man/curs_get_wstr.3x @@ -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: +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 +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 \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. -.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). -.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. -.SH RETURN VALUE -All of these functions return the integer \fBOK\fP upon successful completion. -If unsuccessful, they return \fBERR\fP. +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 +.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 -X/Open defines no error conditions. +\fB\%ncurses\fP(3X) describes the variants of these functions. +.SH RETURN VALUE +These functions return +.B OK +on success and +.B ERR +on failure. .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. -.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. -.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. +All of these functions except +.B \%wgetn_wstr +may be implemented as macros. +.PP +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 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 diff --git a/man/curs_getcchar.3x b/man/curs_getcchar.3x index 523cc99df92c..3318c4f7f816 100644 --- a/man/curs_getcchar.3x +++ b/man/curs_getcchar.3x @@ -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 +.B \%getcchar +destructures a +.I \%cchar_t +into its components. +.PP +If +.I wc +is not a null pointer, +.BR \%getcchar : .bP -Stores the character attributes in the location pointed to by \fIattrs\fP +stores the wide-character string in the +.I curses +complex character +.I wch +into +.IR wc ; .bP -Stores the color pair in the location pointed to by \fIcolor_pair\fP +stores the attributes in +.IR attrs ; +and .bP -Stores the wide-character string, -characters referenced by \fIwch\fP, into the array pointed to by \fIwc\fP. +stores the color pair identifier in +.IR pair . .PP -When -\fIwc\fP -is a null pointer, the -\fBgetcchar\fP -function does the following: -.bP -Obtains the number of wide characters pointed to by \fIwch\fP -.bP -Does not change the data referenced by -\fIattrs\fP -or -\fIcolor_pair\fP +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 +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 -When \fIwc\fP is not a null pointer, -\fBgetcchar\fP returns \fBOK\fP upon successful completion, -and \fBERR\fP otherwise. +.B \%setcchar +returns +.B OK +on success and +.B ERR +on failure. .PP -Upon successful completion, \fBsetcchar\fP returns \fBOK\fP. -Otherwise, it returns \fBERR\fP. +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: +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 +X/Open Curses does not detail the layout of the +.I \%cchar_t +structure, +describing only its minimal required contents: .bP -a spacing character (\fBwchar_t\fP, i.e., 32-bits). +a spacing wide character +.RI \%( wchar_t ), .bP -non-spacing characters (again, \fBwchar_t\fP's). +at least five non-spacing wide characters +.RI \%( wchar_t ; +see below), .bP -attributes (at least 16 bits, inferred from the various ACS- and WACS-flags). +attributes +(at least 15 bits' worth, +inferred from the count of specified +.I WA_ +constants), +.\" See X/Open Curses Issue 7, p. 307. .bP -color pair (at least 16 bits, inferred from the \fBunsigned short\fP type). +a color pair identifier +(at least 16 bits, +inferred from the +.I short +type used to encode it). .PP -The non-spacing characters are optional, -in the sense that zero or more may be stored in a \fBcchar_t\fP. +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), diff --git a/man/curs_getch.3x b/man/curs_getch.3x index 9433c6148583..1d32d89f4d45 100644 --- a/man/curs_getch.3x +++ b/man/curs_getch.3x @@ -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/> diff --git a/man/curs_getstr.3x b/man/curs_getstr.3x index 4a49352a146c..da1436bb3f89 100644 --- a/man/curs_getstr.3x +++ b/man/curs_getstr.3x @@ -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: +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 +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 \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. +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 \fIkill\fP character (e.g., \fB^U\fP) erases the entire buffer, -leaving the cursor at the beginning of the buffer. +the kill character returns the cursor to where it was located when +.B \%wgetstr +was called. .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). +.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 -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. +\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. -.PP -In this implementation, -these functions return an error +In +.IR \%ncurses , +these functions fail if +.bP +the +.I curses +screen has not been initialized, .bP -if the window pointer is null, +(for functions taking a +.I \%WINDOW +pointer argument) +.I win +is a null pointer, .bP -if its timeout expires without having any data, or +.I str +is a null pointer, +or .bP -if the associated call to -\fBwgetch\fP -failed. +an internal \fB\%wgetch\fP(3X) call fails. .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 +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 -This implementation returns \fBERR\fP if the window pointer is null, -or if the lower-level \fBwgetch\fP(3X) call returns an \fBERR\fP. +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 curses implementations did not reject function keys; -the SVr4.0 documentation claimed that \*(``special keys\*('' +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. -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). +.IR etc. ) +.\" SVID 4, vol. 3, p. 495 +.RE .PP -The functions \fBgetnstr\fP, \fBmvgetnstr\fP, and \fBmvwgetnstr\fP were -present but not documented in SVr4. +without further detail. +It lied. +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 -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: -.bP -\fI\%ncurses\fP 6.1 and PDCurses do not count the NUL in the given limit, while +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 -Solaris SVr4 and NetBSD curses count the NUL as part of the limit. +.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 xcurses provides both: -its wide-character \fBwget_nstr\fP reserves a NUL, -but its \fBwgetnstr\fP does not count the NUL consistently. +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 -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. +X/Open Curses does not specify what happens if the length +.I n +is negative. .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. +.I \%ncurses +6.2 uses +.I LINE_MAX +or a larger (system-dependent) value +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 -\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. +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 -\fI\%ncurses\fP 6.2 uses \fBLINE_MAX\fP, -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. -.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: +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 -\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. +.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 -It also obtains the \fIerase\fP and \fIkill\fP characters -from \fBerasechar\fP and \fBkillchar\fP, respectively. +Solaris +.I xcurses +limits the write to +.I LINE_MAX +bytes +(see +.IR sysconf (3)). .bP -On return, \fBgetnstr\fP restores the modes to their previous values. +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 -Other implementations differ in their treatment of special characters: +Implementations vary in their handling of input control 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. +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 -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() diff --git a/man/curs_getyx.3x b/man/curs_getyx.3x index eadcecef2cad..18bb0c5b7967 100644 --- a/man/curs_getyx.3x +++ b/man/curs_getyx.3x @@ -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), diff --git a/man/curs_in_wch.3x b/man/curs_in_wch.3x index 8512e6d3b51e..1c93952a430e 100644 --- a/man/curs_in_wch.3x +++ b/man/curs_in_wch.3x @@ -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 diff --git a/man/curs_in_wchstr.3x b/man/curs_in_wchstr.3x index 53c984647507..39cadcdb4203 100644 --- a/man/curs_in_wchstr.3x +++ b/man/curs_in_wchstr.3x @@ -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 diff --git a/man/curs_inch.3x b/man/curs_inch.3x index 962e9dc868d4..72100af27be8 100644 --- a/man/curs_inch.3x +++ b/man/curs_inch.3x @@ -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. -.SH PORTABILITY -These functions are described in X/Open Curses, Issue 4. +.BR \%inch , +.BR \%mvinch , +and +.B \%mvwinch +may be implemented as macros. .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. +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 +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 -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) diff --git a/man/curs_inchstr.3x b/man/curs_inchstr.3x index bcd5d6855e1f..66f1389a57c9 100644 --- a/man/curs_inchstr.3x +++ b/man/curs_inchstr.3x @@ -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) diff --git a/man/curs_initscr.3x b/man/curs_initscr.3x index 0f460af14eee..ee8359593e8e 100644 --- a/man/curs_initscr.3x +++ b/man/curs_initscr.3x @@ -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. -.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. +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 -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 +.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 +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 +clears the line, .bP -sets the cursor to normal visibility (see \fBcurs_set\fP(3X)), +sets the cursor to normal visibility +(see \fB\%curs_set\fP(3X)), .bP -stops cursor-addressing mode using the \fIexit_ca_mode\fP terminal capability, +if applicable, +stops cursor-addressing mode using the +.B \%exit_ca_mode +.RB \%( rmcup ) +terminal capability, +and .bP -restores tty modes (see \fBreset_shell_mode\fP(3X)). +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. -.PP -Routines that return pointers always return \fBNULL\fP on error. +.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 -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. -.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 +.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 +.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), diff --git a/man/curs_inopts.3x b/man/curs_inopts.3x index 63db4967eebc..c0db26d6fd1c 100644 --- a/man/curs_inopts.3x +++ b/man/curs_inopts.3x @@ -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_inopts.3x,v 1.66 2024/04/13 22:20:29 tom Exp $ -.TH curs_inopts 3X 2024-04-13 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_inopts.3x,v 1.116 2025/10/04 20:15:02 tom Exp $ +.TH curs_inopts 3X 2025-10-04 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -40,6 +40,11 @@ .ie t .ds '' '' .el .ds '' "" .\} +. +.de bP +.ie n .IP \(bu 4 +.el .IP \(bu 2 +.. .SH NAME \fB\%cbreak\fP, \fB\%echo\fP, @@ -75,24 +80,24 @@ get and set \fIcurses\fR terminal input options \fBint echo(void); \fBint noecho(void); .PP -\fBint intrflush(WINDOW *\fIwin\fP, bool \fIbf\fP); -\fBint keypad(WINDOW *\fIwin\fP, bool \fIbf\fP); -\fBint meta(WINDOW *\fIwin\fP, bool \fIbf\fP); -\fBint nodelay(WINDOW *\fIwin\fP, bool \fIbf\fP); -\fBint notimeout(WINDOW *\fIwin\fP, bool \fIbf\fP); +\fBint intrflush(WINDOW * \fIwin\fP \fI/* ignored */\fP, bool \fIbf\fP); +\fBint keypad(WINDOW * \fIwin\fP, bool \fIbf\fP); +\fBint meta(WINDOW * \fIwin\fP \fI/* ignored */\fP, bool \fIbf\fP); +\fBint nodelay(WINDOW * \fIwin\fP, bool \fIbf\fP); +\fBint notimeout(WINDOW * \fIwin\fP, bool \fIbf\fP); .PP \fBint nl(void); \fBint nonl(void); .PP -\fBint raw(void); -\fBint noraw(void); -.PP \fBvoid qiflush(void); \fBvoid noqiflush(void); .PP +\fBint raw(void); +\fBint noraw(void); +.PP \fBint halfdelay(int \fItenths\fP); \fBvoid timeout(int \fIdelay\fP); -\fBvoid wtimeout(WINDOW *\fIwin\fP, int \fIdelay\fP); +\fBvoid wtimeout(WINDOW * \fIwin\fP, int \fIdelay\fP); .PP \fBint typeahead(int \fIfd\fP); .PP @@ -103,287 +108,552 @@ get and set \fIcurses\fR terminal input options \fBint is_raw(void); .fi .SH DESCRIPTION -.I \%ncurses -provides several functions that let an application change the way input -from the terminal is handled. -Some are global, -applying to all windows. -Others apply only to a specific window. -Window-specific settings are not automatically applied to new or derived -windows. -An application must apply these to each window if the same behavior is -desired. +.I curses +offers configurable parameters permitting an application to control the +handling of input from the terminal. +Some, +such as those affecting the terminal's +.I mode +or line discipline, +are global, +applying to all windows; +others apply only to a specific window. +The library does not automatically apply such parameters to new or +derived windows; +an application must configure each window for the desired behavior. +.PP +Some descriptions below make reference to an +.IR "input character reading function" ":" +this is \fB\%wgetch\fP(3X) in the non-wide character +.I curses +API and \fB\%wget_wch\fP(3X) in the wide character API. +In addition to the variant forms of these described in +\fB\%ncurses\fP(3X), +the +.I curses +functions \fB\%wgetstr\fP(3X) and \fB\%wget_wstr\fP(3X) and their own +variants call the appropriate input character reading function. .\" .SS "cbreak, nocbreak" Normally, -the terminal driver buffers typed characters until a newline or carriage -return is typed. -The \fB\%cbreak\fP routine disables line buffering and -erase/kill character-processing -(interrupt and flow control characters are unaffected), -making characters typed by the user immediately available to the +the terminal driver buffers typed characters, +not delivering them to an application +until a line feed or carriage return is typed. +This canonical (\*(``cooked\*('') line discipline also supports +software flow control, +simple line editing functions +(character and word erase, +and whole-line erasure or \*(``kill\*(''), +and job control. +.B \%cbreak +configures the terminal in +.IR "cbreak mode" "," +which disables line buffering +and erase and kill character processing \(em +the interrupt, +quit, +suspend, +and flow control characters are unaffected \(em +and makes characters typed by the user immediately available to the program. -The \fB\%nocbreak\fP routine returns the terminal to normal (cooked) -mode. +.B \%nocbreak +restores canonical (\*(``cooked\*('') mode. .PP -Initially the terminal may or may not be in \fB\%cbreak\fP mode, -as the mode is inherited; +The state of the terminal is unknown to a +.I curses +application when it starts; therefore, -a program should call \fB\%cbreak\fP or \fB\%nocbreak\fP explicitly. +a program should call +.B \%cbreak +or +.B \%nocbreak +explicitly. Most interactive programs using .I curses -set the \fB\%cbreak\fP mode. -Note that \fB\%cbreak\fP overrides \fBraw\fP. -[See \fB\%curs_getch\fP(3X) for a discussion of how these routines -interact with \fBecho\fP and \fB\%noecho\fP.] +set \%cbreak +mode. +Calling +.B \%cbreak +overrides +.BR raw "." +The man page for the input character reading function +discusses how +.B \%cbreak +and +.B \%nocbreak +interact with +.B echo +and +.BR \%noecho "." .\" .SS "echo, noecho" -The \fBecho\fP and \fB\%noecho\fP routines control whether characters -typed by the user are echoed by \fB\%getch\fP(3X) as they are typed. -Echoing by the terminal driver is always disabled, -but initially \fB\%getch\fP is in echo mode, -so characters typed are echoed. -Authors of most interactive programs prefer to do -their own echoing in a controlled area of the screen, +.B echo +and +.B \%noecho +determine whether characters typed by the user are written to the +.I curses +window by the input character reading function as they are typed. +.I curses +always disables the terminal driver's own echoing. +By default, +a +.I curses +screen's echo option is set. +Authors of most interactive programs prefer +to do their own echoing in a controlled area of the screen, or not to echo at all, -so they disable echoing by calling \fB\%noecho\fP. -[See \fB\%curs_getch\fP(3X) for a -discussion of how these routines interact with \fB\%cbreak\fP and -\fB\%nocbreak\fP.] +so they call +.BR \%noecho "." +The man page for the input character reading function +discusses how +.B echo +and +.B \%noecho +interact with +.B \%cbreak +and +.BR \%nocbreak "." .\" .SS halfdelay -The \fB\%halfdelay\fP routine is used for half-delay mode, -which is similar to \fB\%cbreak\fP mode in that characters typed by the -user are immediately available to the program. +.B \%halfdelay +configures +.IR "half-delay mode" "," +which is similar to \%cbreak mode in that characters typed by the user +are immediately available to the program. However, -after blocking for \fItenths\fP tenths of seconds, -\fBERR\fP is returned if nothing has been typed. -The value of \fItenths\fP must be a number between 1 and 255. -Use \fB\%nocbreak\fP to leave half-delay mode. +after blocking for +.I tenths +tenth-seconds, +an input character reading function returns +.B ERR +if no input is pending. +The value of +.I tenths +must be between 1 and 255. +Use +.B \%nocbreak +to leave half-delay mode. .\" .SS intrflush -If the \fB\%intrflush\fP option is enabled -.RI ( bf +.B \%intrflush +calls +.B \%qiflush +(see below) +if +.I bf is -.BR TRUE ), -and an interrupt key is pressed on the keyboard -(interrupt, -break, -quit), -all output in the terminal driver queue is flushed, -giving the effect of faster response to the interrupt, -but causing -.I curses -to have the wrong idea of what is on the screen. -Disabling the option -.RI ( bf +.BR TRUE "," +and +.B \%noqiflush +if +.I bf is -.BR FALSE ), -prevents the flush. -The default for the option is inherited from the terminal driver -settings. -The +.BR FALSE "." +It ignores its .I win -argument is ignored. +argument. .\" .SS keypad -The \fB\%keypad\fP option enables the keypad of the user's terminal. +.B keypad +enables recognition of a terminal's function keys. If enabled .RI ( bf is -.BR TRUE ), -the user can press a function key -(such as an arrow key) -and \fB\%wgetch\fP(3X) returns a single value representing the function -key, -as in \fB\%KEY_LEFT\fP. +.BR TRUE ")" +then when an input character reading function reads ESC, +it waits for further input corresponding to an escape sequence +defined by the terminal type description. +If a valid sequence populates the input stream, +the input character reading function +returns a value representing the function key, +such as +.BR KEY_LEFT "." +(Wide-character API users: +\fB\%wget_wch\fP(3X) returns +.B \%KEY_CODE_YES +to indicate the availability of a function key code in its +.I wch +parameter.) +If the sequence is invalid, +the input character reading function returns only its last character. If disabled -(\fIbf\fP is \fBFALSE\fP), +.RI ( bf +is +.BR FALSE ), .I curses does not treat function keys specially and the program has to interpret -the escape sequences itself. -If the keypad in the terminal can be turned on -(made to transmit) -and off -(made to work locally), -turning on this option causes the terminal keypad to be turned on when -\fB\%wgetch\fP(3X) is called. -The default value for keypad is \fBFALSE\fP. +escape sequences itself. +If the terminal type description defines the +.B \%keypad_local +.RB ( rmkx ) +and +.B \%keypad_xmit +.RB ( smkx ) +capabilities, +enabling a window's keypad mode +sets the terminal's keypad to transmit, +and disabling keypad mode +sets the terminal's keypad to work locally. +By default, +a window's keypad mode is off. .\" .SS meta Initially, -whether the terminal returns 7 or 8 significant bits on input depends on -the control mode of the terminal driver [see \fI\%termios\fP(3)]. +whether the terminal returns 7- or 8-bit character codes on input +depends on the configuration of the terminal driver; +on POSIX systems, +see \fI\%termios\fP(3). To force 8 bits to be returned, -invoke -\fBmeta\fP(\fIwin\fP, \fBTRUE\fP); +call +.BR meta( .\|.\|. , +.BR TRUE) ; this is equivalent, -under POSIX, +on POSIX systems, to setting the CS8 flag on the terminal. To force 7 bits to be returned, -invoke -\fBmeta\fP(\fIwin\fP, \fBFALSE\fP); +call +.BR meta( .\|.\|. , +.BR FALSE) ; this is equivalent, -under POSIX, +on POSIX systems, to setting the CS7 flag on the terminal. -The window argument, -.IR win , -is always ignored. -If the terminfo capabilities -\fBsmm\fP (meta_on) and -\fBrmm\fP (meta_off) are defined for the terminal, -\fBsmm\fP is sent to the terminal when -\fBmeta\fP(\fIwin\fP, \fBTRUE\fP) -is called and \fBrmm\fP is sent when -\fBmeta\fP(\fIwin\fP, \fBFALSE\fP) is called. +.I curses +ignores the window argument +.IR win "." +If the +.I \%term\%info +string capabilities +.B \%meta_on +.RB ( smm ) +and +.B \%meta_off +.RB ( rmm ) +are defined for the terminal type, +enabling meta mode sends +.BR smm 's +value to the terminal and disabling it sends that of +.B rmm +to the terminal. .\" .SS "nl, nonl" -The \fBnl\fP and \fBnonl\fP routines control whether the underlying -display device translates the return key into newline on input. +Initially, +whether the terminal reports a carriage return +using the character code for a line feed +in cbreak or raw modes +depends on the configuration of the terminal driver; +see \fI\%termios\fP(3). +.B nl +configures the terminal to perform this translation. +.B nonl +disables it. +Under its canonical (\*(``cooked\*('') line discipline, +the terminal driver always translates carriage returns to line feeds. .\" .SS nodelay -The \fB\%nodelay\fP option causes \fB\%getch\fP to be a non-blocking -call. +.B \%nodelay +configures the input character reading function to be non-blocking for +window +.IR "win" . If no input is ready, -\fB\%getch\fP returns \fBERR\fP. +the reading function returns +.BR ERR "." If disabled .RI ( bf is .BR FALSE ), -\fB\%getch\fP waits until a key is pressed. +the reading function does not return until it has input. .SS notimeout -When interpreting an escape sequence, -\fB\%wgetch\fP(3X) sets a timer -while waiting for the next character. -If -\fB\%notimeout(\fIwin\fR, \fBTRUE\fP) -is called, -then \fB\%wgetch\fP does not set a timer. +When +.B \%keypad +has been called on a window +and the input character reading function reads an ESC character from it, +.I curses +sets a timer while waiting for the next character. +If the timer elapses, +.I curses +interprets the ESC as an explicit press of the terminal's Escape key +(or equivalent). +.\" like Control+[ +.BI \%notimeout( win , +.B TRUE) +disables this timer. The purpose of the timeout is to distinguish sequences produced by a function key from those typed by a user. +If this timer is disabled, +.I curses +waits forever for subsequent keystrokes +until it determines the escape sequence to be valid or invalid. +.\" +.SS "qiflush, noqiflush" +.\" +.B \%qiflush +and +.B \%noqiflush +configure the terminal driver's treatment of its input and output queues +when it handles the interrupt, +suspend, +or quit characters under the canonical (\*(``cooked\*('') +or cbreak line disciplines on POSIX systems; +see \fI\%termios\fP(3). +The default behavior is inherited from the terminal driver settings. +Calling +.B \%qiflush +configures the terminal to +.I flush +the queues +(discarding their contents) +when any of these events occurs, +giving the impression of faster response to user input, +but making the library's model of the screen contents incorrect. +Calling +.B \%noqiflush +prevents such flushing, +but might frustrate impatient users on slow connections if a +.I curses +update of the screen is in progress when the event occurs; +see +.B \%typeahead +below for a mitigation of this problem. +You may want to call +.B \%noqiflush +in a signal handler if, +after the handler exits, +you want output to continue +as though the signal had not occurred. .\" .SS "raw, noraw" -The \fBraw\fP and \fB\%noraw\fP routines place the terminal into or out -of raw mode. -Raw mode is similar to \fB\%cbreak\fP mode, -in that characters typed are immediately passed through to the user -program. -The differences are that in raw mode, -the interrupt, +.B raw +configures the terminal to read input in +.IR "raw mode" , +which is similar to cbreak mode +(see +.B \%cbreak +above) +except that it furthermore passes through the terminal's configured +interrupt, quit, suspend, -and flow control characters are all -passed through uninterpreted, -instead of generating a signal. -The behavior of the BREAK key depends on other bits in the terminal -driver that are not set by -.IR curses . -.\" -.SS "qiflush, nqiflush" -When the \fB\%noqiflush\fP routine is used, -normal flush of input and output queues associated with the \fBINTR\fP, -\fBQUIT\fP and \fBSUSP\fP characters will not be done -[see \fB\%termios\fP(3)]. -When -\fB\%qiflush\fP is called, -the queues will be flushed when these control characters are read. -You may want to call \fB\%noqiflush\fP in a signal handler if you want -output to continue as though the interrupt had not occurred, -after the handler exits. +and flow control characters +uninterpreted to the application, +instead of generating a signal or acting on I/O flow. +The behavior of the terminal's \*(``Break\*('' key +(if any) +depends on terminal driver configuration parameters that +.I curses +does not handle. +.B \%noraw +restores the terminal's canonical (\*(``cooked\*('') line discipline. .\" .SS "timeout, wtimeout" -The \fB\%timeout\fP and \fB\%wtimeout\fP routines set blocking or -non-blocking read for a given window. -If \fIdelay\fP is negative, -a blocking read is used -(i.e., -waits indefinitely for input). -If \fIdelay\fP is zero, -then a non-blocking read is used -(i.e., -.I read -returns \fBERR\fP if no input is waiting). +.B \%wtimeout +configures whether a +.I curses +input character reading function called on window +.I win +uses blocking or non-blocking reads. If -\fIdelay\fP is positive, -then -.I read -blocks for \fIdelay\fP milliseconds, -and returns \fBERR\fP if there is still no input. -Hence, -these routines provide the same functionality as \fB\%nodelay\fP, -plus the additional capability of being able to block for only -\fIdelay\fP milliseconds -(where \fIdelay\fP is positive). +.I delay +is negative, +.I curses +uses a blocking read, +waiting indefinitely for input. +If +.I delay +is zero, +the read is non-blocking; +an input character reading function returns +.B ERR +if no input is pending. +If +.I delay +is positive, +an input character reading function +blocks for +.I delay +milliseconds, +and returns +.B ERR +if the delay elapses and there is still no input pending. +.B \%timeout +calls +.B \%wtimeout +on +.BR stdscr "." .\" .SS typeahead -.I curses -does \*(``line-breakout optimization\*('' by looking for typeahead -periodically while updating the screen. -If input is found, -and it is coming from a terminal, -the current update is postponed until -\fB\%refresh\fP(3X) or \fB\%doupdate\fP is called again. -This allows faster response to commands typed in advance. Normally, -the input +a +.I curses +library checks the terminal's input file descriptor for activity +with \fIpoll\fP(2) or \fI\%select\fP(2) +while updating the screen; +if it finds any, +it postpones output +until the next \fB\%wrefresh\fP(3X) or \fB\%doupdate\fP(3X) call, +allowing faster response to user key strokes. +The library tests the file descriptor corresponding to the .I FILE -pointer passed to \fB\%newterm\fP, -or \fBstdin\fP in the case that \fB\%initscr\fP was used, -will be used to do this typeahead checking. -The \fB\%typeahead\fP routine specifies that the file descriptor -\fIfd\fP is to be used to check for typeahead instead. -If \fIfd\fP is -\-1, -then no typeahead checking is done. +stream pointer passed to \fB\%newterm\fP(3X) +(or +.I stdin +if \fB\%initscr\fP(3X) was called), +for pending input. +.B \%typeahead +instructs +.I curses +to test file descriptor +.I fd +instead. +An +.I fd +of +.B \-1 +disables the check. .\" .SH RETURN VALUE -All routines that return an integer return \fBERR\fP upon failure and -\fBOK\fP -(SVr4 specifies only \*(``an integer value other than \fBERR\fP\*('') -upon successful completion, -unless otherwise noted in the preceding routine descriptions. +.B \%timeout +and +.B \%wtimeout +return no value. +.PP +.BR \%cbreak "," +.BR \%nocbreak "," +.BR \%echo "," +.BR \%noecho "," +.BR \%halfdelay "," +.BR \%intrflush "," +.BR \%keypad "," +.BR \%meta "," +.BR \%nodelay "," +.BR \%notimeout "," +.BR \%nl "," +.BR \%nonl "," +.BR \%raw "," +.BR \%noraw "," +and +.B \%typeahead +return +.B OK +on success and +.B ERR +on failure. +.PP +In +.IR \%ncurses "," +the functions in the previous paragraph return +.B ERR +if +.bP +the library's +.I \%TERMINAL +structure for the device has not been initialized with +\fB\%initscr\fP(3X), +\fB\%newterm\fP(3X), +or +\fB\%setupterm\fP(3X), +or +.bP +.I win +is a null pointer +(except with +.B \%intrflush +and +.BR meta "," +which ignore its value). +.PP +Further, +.B \%halfdelay +returns +.B ERR +if +.I delay +is outside the range 1..255. .PP -X/Open Curses does not specify any error conditions. -In this implementation, -functions with a window parameter will return an error if it is null. -Any function will also return an error if the terminal was not -initialized. -Also, -.RS 3 -.TP 5 -\fB\%halfdelay\fP -returns an error -if its parameter is outside the range 1..255. -.RE +See section \*(``EXTENSIONS\*('' below for the +return values of +.BR is_cbreak "," +.BR is_echo "," +.BR is_nl "," +and +.BR is_raw "." .SH NOTES -\fBecho\fP, -\fB\%noecho\fP, -\fB\%halfdelay\fP, -\fB\%intrflush\fP, -\fBmeta\fP, -\fBnl\fP, -\fBnonl\fP, -\fB\%nodelay\fP, -\fB\%notimeout\fP, -\fB\%noqiflush\fP, -\fB\%qiflush\fP, -\fB\%timeout\fP, +.BR echo "," +.BR \%noecho "," +.BR \%halfdelay "," +.BR \%intrflush "," +.BR meta "," +.BR nl "," +.BR nonl "," +.BR \%nodelay "," +.BR \%notimeout "," +.BR \%noqiflush "," +.BR \%qiflush "," +.BR \%timeout "," and -\fB\%wtimeout\fP +.B \%wtimeout may be implemented as macros. .PP -\fB\%noraw\fP and \fB\%nocbreak\fP follow historical practice in that -they attempt to restore normal (\*(``cooked\*('') mode -from raw and cbreak modes respectively. -Mixing \fBraw\fP/\fB\%noraw\fP and \fB\%cbreak\fP/\fB\%nocbreak\fP calls -leads to terminal driver control states that are hard to predict or -understand; +.B \%noraw +and +.B \%nocbreak +follow historical practice in that they attempt to restore +the terminal's canonical (\*(``cooked\*('') line discipline +from raw and cbreak, +respectively. +Mixing +.BR \%raw / noraw +calls with +.BR \%cbreak / nocbreak +calls leads to terminal driver control states that are hard to predict +or understand; doing so is not recommended. +.PP +.I curses +documentation uses the terms \*(``delay\*('' and \*(``timeout\*('' +freely to describe two related but distinct aspects of input handling, +at the risk of confusing the user. +The functions +.BR \%halfdelay "," +.BR \%nodelay "," +.BR \%timeout "," +and +.B \%wtimeout +configure whether the input character reading function +\%(\fBwgetch\fP(3X) or \fB\%wget_wch\fP(3X)) +waits for keyboard input to begin, +and for how long. +.B \%keypad +configures whether that function waits for further input +if the first character it reads is ESC. +Calling +.BR \%notimeout "," +which has nothing to do with +.B \%timeout +or +.BR \%wtimeout "," +makes this delay in expectation of further characters +effectively infinite. +X/Open Curses affords no means of otherwise configuring +the length of this second delay, +but an AIX and +.I \%ncurses +extension, +.BR \%ESCDELAY , +is available both as an environment variable and a global symbol +permitting the user and application, +respectively, +to do so; +see \fB\%ncurses\fP(3X) and \fB\%curs_variables\fP(3X). .SH EXTENSIONS .I \%ncurses -provides four \*(``is_\*('' functions that may be used to detect if the -corresponding flags were set or reset. +provides four \*(``is_\*('' functions corresponding to +.BR \%cbreak "," +.BR echo "," +.BR nl "," +and +.BR raw "," +permitting their states to be queried by the application. .PP .TS center; @@ -399,26 +669,18 @@ is_raw raw noraw .PP In each case, the function returns -.TP 4 \" "-1" + 2n -1 -if the flag is set, +.TP 5 \" "-1" + 2n tag separation + 1n fudge for typesetters like grops +.B 1 +if the option is set, .TP -0 -if the flag is reset, +.B 0 +if the option is unset, or .TP -\-1 -if the library is not initialized. -.PP -They were designed for -\fB\%ncurses\fP(3X), -and are not found in SVr4 -.IR curses , -4.4BSD -.IR curses , -or any other previous -.I curses -implementation. +.B \-1 +if the library's +.I \%TERMINAL +structure for the device has not been initialized. .SH PORTABILITY Applications employing .I \%ncurses @@ -427,33 +689,54 @@ extensions should condition their use on the visibility of the preprocessor macro. .PP Except as noted in section \*(``EXTENSIONS\*('' above, -X/Open Curses, Issue 4, Version 2 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. 508 +.\" It continues "unless otherwise noted in the preceding routine +.\" descriptions", but no notes otherwise are present; the man page +.\" discusses getch()'s return value repeatedly, but never those of the +.\" functions the page ostensibly documents. .PP .I \%ncurses follows X/Open Curses -and the historical practice of AT&T -.I curses -implementations, -in that the echo bit is cleared when -.I curses -initializes the terminal state. +and the historical practice of System\ V +.IR curses "," +clearing the terminal driver's \*(``echo\*('' flag when initializing the +screen. BSD .I curses -differed from this slightly; -it left the echo bit on at initialization, -but the BSD \fBraw\fP call turned it off as a side effect. +did not, +but its +.I raw +function turned it off as a side effect. +.\" SGTTY's sg_flags had a "RAW" symbol; termio in SVr1 for the PDP-11 +.\" did not. +.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4BSD/usr/include/curses.h +.\" https://github.com/ryanwoodsmall/oldsysv/blob/master/sysv-pdp11_man/a_man/man7/termio.7 For best portability, -set \fBecho\fP or \fB\%noecho\fP explicitly just after initialization, -even if your program remains in cooked mode. +call +.I echo +or +.I \%noecho +explicitly just after initialization, +even if your program retains the terminal's canonical (\*(``cooked\*('') +line discipline. .PP -X/Open Curses is ambiguous regarding whether \fBraw\fP should disable -the CR/LF translations controlled by \fBnl\fP and \fBnonl\fP. +X/Open Curses is ambiguous regarding whether +.I raw +should disable the carriage return and line feed translation feature +controlled by +.I nl +and +.IR \%nonl "." BSD .I curses -did turn off these translations; -AT&T +turned off these translations; +System\ V .I curses -(at least as late as SVr1) did not. .I \%ncurses does so, @@ -462,65 +745,124 @@ on the assumption that a programmer requesting raw input wants a clean 8-bit clean) connection that the operating system will not alter. .PP -When \fB\%keypad\fP is first enabled, +When +.B \%keypad +is first enabled for a window, .I \%ncurses -loads the key definitions for the current terminal description. -If the terminal description includes extended string capabilities, -e.g., -from using the +loads the standard function key string capabilities +for the terminal type description of its screen; +see the entries beginning with \*(``key_\*('' in \fB\%terminfo\fP(5). +If that description includes extended string capabilities, +produced by the .B \-x -option of \fB\%@TIC@\fP, +option of \fB\%@TIC@\fP(1), +for example, then .I \%ncurses -also defines keys for the capabilities whose names begin with +also defines keys for the capabilities whose codes begin with \*(``k\*(''. -The corresponding keycodes are generated and -(depending on previous loads of terminal descriptions) -may differ from one execution of a program to the next. -The generated keycodes are recognized by the \fB\%keyname\fP(3X) -function -(which will then return a name beginning with \*(``k\*('' denoting the -terminfo capability name rather than \*(``K\*('', +.I \%ncurses +generates a numeric key code for each such extended capability; +depending on previous loads of terminal type descriptions, +these may differ from one execution of a program to the next. +\fB\%keyname\fP(3X) recognizes the generated key codes +and returns a name beginning with \*(``k\*('' denoting the +.I \%term\%info +capability name rather than \*(``KEY_\*('', used for .I curses -key names). +key names. On the other hand, -an application can use \fB\%define_key\fP(3X) to establish -a specific keycode for a given string. -This makes it possible for an application to check for an extended -capability's presence with \fB\%tigetstr\fP, -and reassign the keycode to match its own needs. +an application can use \fB\%define_key\fP(3X) to bind +a selected key to a string of the programmer's choice. +This feature enables an application to check for its presence +with \fB\%tigetstr\fP(3X), +and reassign the numeric key code to match its own needs. .PP -Low-level applications can use \fB\%tigetstr\fP to obtain the definition -of any particular string capability. -Higher-level applications which use the +Low-level applications can use \fB\%tigetstr\fP(3X) to obtain the +definition of any string capability. .I curses -\fB\%wgetch\fP and similar functions to return keycodes rely upon the -order in which the strings are loaded. -If more than one key definition has the same string value, -then \fB\%wgetch\fP can return only one keycode. +applications use the input character reading function +to obtain key codes from input +and rely upon the order in which the string capabilities are loaded. +Multiple key capability strings can have the same value, +but the input character reading function can report only one key code. Most .I curses implementations (including .IR \%ncurses ) load key definitions in the order -defined by the array of string capability names. -The last key to be loaded determines the keycode which will be returned. +they appear in the +.B \%strfnames +array of string capability names; +see \fB\%term_variables\fP(3X). +.\" ncurses/tinfo/parse_entry.c:lookup_fullname, I think --GBR +The last capability read using a particular definition determines the +key code to be reported. In .IR \%ncurses , -you may also have extended capabilities interpreted as key definitions. -These are loaded after the predefined keys, -and if a capability's value is the same as a previously-loaded -key definition, -the later definition is the one used. +extended capabilities can be interpreted as key definitions. +The library loads these after its built-in definitions, +and if an extended capability's value +is the same as one previously loaded, +the library uses the later definition. .SH HISTORY +4BSD (1980) +introduced +.IR echo "," +.IR \%noecho "," +.IR nl "," +.IR \%nonl "," +.IR raw "," +and +.IR \%noraw "." \" also crmod and nocrmod, never standardized +.PP +SVr2 (1984) +featured a new terminal driver, +extending the +.I curses +API to support it with +.IR \%cbreak "," +.IR \%nocbreak "," +.IR \%intrflush "," +.IR \%keypad "," +.IR \%meta "," +.IR \%nodelay "," +and +.IR \%typeahead "." +.PP +SVr3 (1987) +added +.IR \%halfdelay "," +.IR \%notimeout "," +and +.IR \%wtimeout "." +.I \%qiflush +and +.I \%noqiflush +appeared in SVr3.1 (1987), +at which point +.I \%intrflush +became a wrapper for either of these functions, +depending on the value of its Boolean argument. +SVr3.1 also added +.IR \%timeout "." +.PP +.I \%ncurses +6.5 (2024) introduced +.IR is_cbreak "," +.IR is_echo "," +.IR is_nl "," +and +.IR is_raw "." +.PP Formerly, .I \%ncurses used -.B \%nl +.I \%nl and -.B \%nonl +.I \%nonl to control the conversion of newlines to carriage return/line feed on output as well as input. X/Open Curses documents the use of these functions only for input. @@ -535,15 +877,15 @@ to .I \%termios (the POSIX terminal API). In the former, -both input and output were controlled via a single option -.BR \%CRMOD , +both input and output conversions were controlled via a single option +\%\*(``CRMOD\*('', while the latter separates these features. Because that conversion interferes with output optimization, .I \%ncurses 6.2 (2020) amended -.B \%nl +.I \%nl and -.B \%nonl +.I \%nonl to eliminate their effect on output. .SH SEE ALSO \fB\%curses\fP(3X), @@ -551,4 +893,5 @@ to eliminate their effect on output. \fB\%curs_initscr\fP(3X), \fB\%curs_util\fP(3X), \fB\%define_key\fP(3X), -\fB\%termios\fP(3) +\fB\%termios\fP(3), +\fB\%term_variables\fP(3X) diff --git a/man/curs_ins_wch.3x b/man/curs_ins_wch.3x index 90b03f64f4d1..a4194eaf27fb 100644 --- a/man/curs_ins_wch.3x +++ b/man/curs_ins_wch.3x @@ -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 -.B \%insert_character -.RB ( ich1 ) -capability -is not necessarily employed. -.PP -\fB\%ins_wch\fP, -\fB\%mvins_wch\fP, +.BR \%ins_wch "," +.BR \%mvins_wch "," and -\fB\%mvwins_wch\fP +.B \%mvwins_wch may be implemented as macros. -.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\*(''. +.I curses +does not necessarily employ the terminal's +.B \%insert_character +.RB ( ich1 ) +capability to achieve insertion. +.SH PORTABILITY +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 diff --git a/man/curs_ins_wstr.3x b/man/curs_ins_wstr.3x index 4ebd3ace2c5a..14654cce3e13 100644 --- a/man/curs_ins_wstr.3x +++ b/man/curs_ins_wstr.3x @@ -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. +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 +Applications employing +.I \%ncurses +extensions should condition their use on the visibility of the +.B \%NCURSES_VERSION +preprocessor macro. .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 +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. -.SH PORTABILITY -These functions are described in X/Open Curses, Issue 4, -which adds \fI\%const\fP qualifiers to the arguments. .PP -X/Open states that the entire string is inserted if \fIn\fP is less than 1. +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 diff --git a/man/curs_insch.3x b/man/curs_insch.3x index baf2f6cc1bbb..5a760415071f 100644 --- a/man/curs_insch.3x +++ b/man/curs_insch.3x @@ -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_insch.3x,v 1.40 2024/04/20 19:03:47 tom Exp $ -.TH curs_insch 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_insch.3x,v 1.56 2025/03/08 23:10:02 tom Exp $ +.TH curs_insch 3X 2025-03-08 "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\%insch\fP, \fB\%winsch\fP, @@ -50,23 +55,25 @@ insert a \fIcurses\fP character in a window \fB#include <curses.h>\fP .PP \fBint insch(chtype \fIch\fP); -\fBint winsch(WINDOW *\fIwin\fP, chtype \fIch\fP); +\fBint winsch(WINDOW * \fIwin\fP, chtype \fIch\fP); \fBint mvinsch(int \fIy\fP, int \fIx\fP, chtype \fIch\fP); -\fBint mvwinsch(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, chtype \fIch\fP); +\fBint mvwinsch(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, chtype \fIch\fP); .fi .SH DESCRIPTION -These functions insert the +.B \%winsch +inserts the .I curses character .I ch -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\%addch\fP(3X), +.B \%winsch +does not advance the cursor. +\fB\%ncurses\fP(3X) describes the variants of this function. .SH "RETURN VALUE" These functions return .B OK @@ -74,10 +81,22 @@ 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 @@ -85,26 +104,26 @@ fail if the position .IR x ) is outside the window boundaries. .SH NOTES -.BR \%insch , -.BR \%mvinsch , +.BR \%insch "," +.BR \%mvinsch "," and .B \%mvwinsch may be implemented as macros. .PP -A terminal's +.I curses +does not necessarily employ the terminal's .B \%insert_character .RB ( ich1 ) -capability -is not necessarily employed. +capability to achieve insertion. .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. 509 +.SH HISTORY +SVr2 (1984) introduced these functions. .SH "SEE ALSO" \fB\%curs_ins_wch\fP(3X) describes comparable functions in the wide-character diff --git a/man/curs_insstr.3x b/man/curs_insstr.3x index 888d4250091f..4c347227c98e 100644 --- a/man/curs_insstr.3x +++ b/man/curs_insstr.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2019-2023,2024 Thomas E. Dickey * +.\" Copyright 2019-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_insstr.3x,v 1.51 2024/04/20 21:20:07 tom Exp $ -.TH curs_insstr 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_insstr.3x,v 1.72 2025/10/21 00:11:17 tom Exp $ +.TH curs_insstr 3X 2025-10-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -46,56 +46,87 @@ .. .SH NAME \fB\%insstr\fP, -\fB\%insnstr\fP, \fB\%winsstr\fP, -\fB\%winsnstr\fP, \fB\%mvinsstr\fP, \fB\%mvinsnstr\fP, +\fB\%insnstr\fP, +\fB\%winsnstr\fP, \fB\%mvwinsstr\fP, \fB\%mvwinsnstr\fP \- insert a string in a \fIcurses\fR window .SH SYNOPSIS .nf \fB#include <curses.h> -\fBint insstr(const char *\fIstr\fP); -\fBint insnstr(const char *\fIstr\fP, int \fIn\fP); -\fBint winsstr(WINDOW *\fIwin\fP, const char *\fIstr\fP); -\fBint winsnstr(WINDOW *\fIwin\fP, const char *\fIstr\fP, int \fIn\fP); .PP -\fBint mvinsstr(int \fIy\fP, int \fIx\fP, const char *\fIstr\fP); -\fBint mvinsnstr(int \fIy\fP, int \fIx\fP, const char *\fIstr\fP, int \fIn\fP); -\fBint mvwinsstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const char *\fIstr\fP); -\fBint mvwinsnstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const char *\fIstr\fP, int \fIn\fP); +\fBint insstr(const char * \fIstr\fP); +\fBint winsstr(WINDOW * \fIwin\fP, const char * \fIstr\fP); +\fBint mvinsstr(int \fIy\fP, int \fIx\fP, const char * \fIstr\fP); +\fBint mvwinsstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, const char * \fIstr\fP); +.PP +\fBint insnstr(const char * \fIstr\fP, int \fIn\fP); +\fBint winsnstr(WINDOW * \fIwin\fP, const char * \fIstr\fP, int \fIn\fP); +\fBint mvinsnstr(int \fIy\fP, int \fIx\fP, const char * \fIstr\fP, int \fIn\fP); +\fBint mvwinsnstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, const char * \fIstr\fP, int \fIn\fP); .fi .SH DESCRIPTION -These routines insert a character string -(as many characters as will fit on the line) -before the character under the cursor, -as if calling \fBwinsch\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 \%winsstr +inserts a string +.I str +before the character at the cursor in window +.I win +as if by calling \fBwinsch\fP(3X) for each +.I char +in +.IR str "." +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 \%winsstr +stops inserting if it would have to wrap to the next line to write the +next +.I \%char +in +.IR str "." 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 characters. -If \fIn\fP is less than zero, the entire string is inserted -(stopping on a NUL character). -.PP -Special characters are handled as in \fBwaddch\fP(3X). +(after moving to +.RI ( y , +.IR x ")," +if specified). +.B \%insnstr +does the same, +but inserts at most +.I n +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 \fIstr\fP parameter is null or +.I str +is +.IR NULL "," +or .bP -the \fBwinsch\fP(3X) function returns an error. +an internal \fBwinsch\fP(3X) call returns +.BR ERR "." .PP Functions prefixed with \*(``mv\*('' first perform cursor movement and fail if the position @@ -103,21 +134,75 @@ fail if the position .IR x ) is outside the window boundaries. .SH NOTES -All but \fBwinsnstr\fP may be macros. +All of these functions except +.B \%winsnstr +may be implemented as macros. +.SH EXTENSIONS +.BR \%insnstr "," +.BR \%winsnstr "," +.BR \%mvinsnstr "," +and +.BR \%mvwinsnstr "'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 -The Single Unix Specification, Version 2 states that -\fBinsnstr\fP and \fBwinsnstr\fP perform wrapping. -This is probably an error, since it makes this group of functions inconsistent. -Also, no implementation of curses documents this inconsistency. +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. .PP -X/Open states that the entire string is inserted if \fIn\fP is less than 1. +SVr4 describes a successful return value only as +\*(``an integer value other than +.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 510 +.PP +Issue\ 4 distinguished +.I \%insnstr +and +.I \%winsnstr +from the other functions documented above +by stating they \*(``do not perform wrapping\*(''. +This was probably an error, +since it makes this group of functions inconsistent. +No implementation of +.I curses +manifests this inconsistency, +and Issue\ 7 removed the claim. +.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 SVr4 and X/Open implementations on Solaris. +.\" ...copied from SVID 4, which made the same error; see p. 510. +because it is inconsistent with other functions +such as +.IR \%waddstr "," +and differs from the SVr4 +.I curses +and Solaris +.I xcurses +implementations. +Nevertheless, +Issue\ 7 retains the language. +.SH HISTORY +SVr3.1 (1987) +introduced +.I \%winsstr +and +.I \%winsnstr +and their variants. .SH SEE ALSO +\fB\%curs_ins_wstr\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_ins_wstr\fP(3X), diff --git a/man/curs_instr.3x b/man/curs_instr.3x index 5b6e4b760301..0facc12c34c1 100644 --- a/man/curs_instr.3x +++ b/man/curs_instr.3x @@ -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_instr.3x,v 1.51 2024/04/20 21:24:19 tom Exp $ -.TH curs_instr 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_instr.3x,v 1.82 2025/10/21 00:04:35 tom Exp $ +.TH curs_instr 3X 2025-10-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -46,48 +46,83 @@ .. .SH NAME \fB\%instr\fP, -\fB\%innstr\fP, \fB\%winstr\fP, -\fB\%winnstr\fP, \fB\%mvinstr\fP, -\fB\%mvinnstr\fP, \fB\%mvwinstr\fP, +\fB\%innstr\fP, +\fB\%winnstr\fP, +\fB\%mvinnstr\fP, \fB\%mvwinnstr\fP \- get a string from a \fIcurses\fR window .SH SYNOPSIS .nf \fB#include <curses.h> .PP -\fBint instr(char *\fIstr\fP); -\fBint innstr(char *\fIstr\fP, int \fIn\fP); -\fBint winstr(WINDOW *\fIwin\fP, char *\fIstr\fP); -\fBint winnstr(WINDOW *\fIwin\fP, char *\fIstr\fP, int \fIn\fP); +\fBint instr(char * \fIstr\fP); +\fBint winstr(WINDOW * \fIwin\fP, char * \fIstr\fP); +\fBint mvinstr(int \fIy\fP, int \fIx\fP, char * \fIstr\fP); +\fBint mvwinstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, char * \fIstr\fP); .PP -\fBint mvinstr(int \fIy\fP, int \fIx\fP, char *\fIstr\fP); -\fBint mvinnstr(int \fIy\fP, int \fIx\fP, char *\fIstr\fP, int \fIn\fP); -\fBint mvwinstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, char *\fIstr\fP); -\fBint mvwinnstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, char *\fIstr\fP, int \fIn\fP); +\fBint innstr(char * \fIstr\fP, int \fIn\fP); +\fBint winnstr(WINDOW * \fIwin\fP, char * \fIstr\fP, int \fIn\fP); +\fBint mvinnstr(int \fIy\fP, int \fIx\fP, char * \fIstr\fP, int \fIn\fP); +\fBint mvwinnstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, char * \fIstr\fP, int \fIn\fP); .fi .SH DESCRIPTION -These routines return a string of characters in \fIstr\fP, -starting at the current cursor position in the named window. -Attributes are stripped from 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 NUL). -Transfer stops at the end of the current line, or when \fIn\fP characters have -been stored at the location referenced by \fIstr\fP. +.B \%winstr +extracts a 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 str "," +terminating it with a null character +and +omitting any attributes and color pair identifier +that +.I curses +associates with each character. +.B \%winnstr +does the same, +but copies at most +.I n +characters from +.IR win "." +A negative +.I n +implies no limit; +.B \%winnstr +then works like +.BR \%winstr "." +\fB\%ncurses\fP(3X) describes the variants of these functions. .SH RETURN VALUE -All of the functions return \fBERR\fP upon failure, -or the number of characters actually read into the string. +These functions return the count of characters copied from +.I win +to +.I str +(not including the null terminator), +or +.B ERR +upon 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 str +is a null pointer. .PP Functions prefixed with \*(``mv\*('' first perform cursor movement and fail if the position @@ -95,35 +130,88 @@ fail if the position .IR x ) is outside the window boundaries. .SH NOTES -All routines except \fBwinnstr\fP may be macros. +All of these functions except +.B \%winnstr +may be implemented as macros. .PP Reading a line that overflows the array pointed to by -\fIstr\fP +.I str with -\fBinstr\fP, -\fBmvinstr\fP, -\fBmvwinstr\fP -or -\fBwinstr\fP -causes undefined results. -Therefore, the use of -\fBinnstr\fP, -\fBmvinnstr\fP, -\fBmvwinnstr\fP, or -\fBwinnstr\fP -is recommended. +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 str "." +.SH EXTENSIONS +.BR \%innstr "," +.BR \%winnstr "," +.BR \%mvinnstr "," +and +.BR \%mvwinnstr "'s" +acceptance of negative +.I n +values is an +.I \%ncurses +extension. .SH PORTABILITY -SVr4 does not -document whether a length limit includes or excludes the trailing NUL. +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 +X/Open Curses Issues 4 and 7 both state that +.IR \%instr "," +.IR \%winstr "," +.IR \%mvinstr "," +and +.I \%mvwinstr +return +.I OK +rather than a character count. +.\" X/Open Issue 4, Version 2, p. 117, PDF p. 137 +.\" Issue 7 makes the same claim. +This is likely an erratum. +.bP +SVr3.1 and SVr4 implemented +.I \%winstr +as a wrapper around +.IR \%winnstr "," +returning the latter's return value. +X/Open Curses's specification thus may have been an editorial solecism +copied from System\ V's documentation +(see below) +by X/Open, +rather than an intentional change. +.bP +.I \%ncurses +retains compatibility with System\ V +.I curses +behavior. .PP -The \fI\%ncurses\fP library extends the X/Open Curses description by allowing a -negative value for \fIn\fP. -In this case, the functions return the string ending at the right margin. +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 +.PP +SVr4 does not +document whether +.I n +counts the null terminator that these functions write to +.IR str "." +.SH HISTORY +SVr3.1 (1987) +introduced these functions. .SH SEE ALSO -\fB\%curs_ins_wstr\fP(3X) describes comparable functions of the +\fB\%curs_inwstr\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_inch\fP(3X), diff --git a/man/curs_inwstr.3x b/man/curs_inwstr.3x index eec361d77af9..d29f23ef6c4c 100644 --- a/man/curs_inwstr.3x +++ b/man/curs_inwstr.3x @@ -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_inwstr.3x,v 1.41 2024/04/20 21:20:07 tom Exp $ -.TH curs_inwstr 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_inwstr.3x,v 1.66 2025/10/21 00:04:48 tom Exp $ +.TH curs_inwstr 3X 2025-10-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -45,59 +45,100 @@ .. .SH NAME \fB\%inwstr\fP, -\fB\%innwstr\fP, \fB\%winwstr\fP, -\fB\%winnwstr\fP, \fB\%mvinwstr\fP, -\fB\%mvinnwstr\fP, \fB\%mvwinwstr\fP, +\fB\%innwstr\fP, +\fB\%winnwstr\fP, +\fB\%mvinnwstr\fP, \fB\%mvwinnwstr\fP \- get a wide-character string from a \fIcurses\fR window .SH SYNOPSIS .nf \fB#include <curses.h> .PP -\fBint inwstr(wchar_t *\fIwstr\fP); -\fBint innwstr(wchar_t *\fIwstr\fP, int \fIn\fP); -\fBint winwstr(WINDOW *\fIwin\fP, wchar_t *\fIwstr\fP); -\fBint winnwstr(WINDOW *\fIwin\fP, wchar_t *\fIwstr\fP, int \fIn\fP); +\fBint inwstr(wchar_t * \fIwstr\fP); +\fBint winwstr(WINDOW * \fIwin\fP, wchar_t * \fIwstr\fP); +\fBint mvinwstr(int \fIy\fP, int \fIx\fP, wchar_t * \fIwstr\fP); +\fBint mvwinwstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, wchar_t * \fIwstr\fP); .PP -\fBint mvinwstr(int \fIy\fP, int \fIx\fP, wchar_t *\fIwstr\fP); -\fBint mvinnwstr(int \fIy\fP, int \fIx\fP, wchar_t *\fIwstr\fP, int \fIn\fP); -\fBint mvwinwstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, wchar_t *\fIwstr\fP); -\fBint mvwinnwstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, wchar_t *\fIwstr\fP, int \fIn\fP); +\fBint innwstr(wchar_t * \fIwstr\fP, int \fIn\fP); +\fBint winnwstr(WINDOW * \fIwin\fP, wchar_t * \fIwstr\fP, int \fIn\fP); +\fBint mvinnwstr(int \fIy\fP, int \fIx\fP, wchar_t * \fIwstr\fP, int \fIn\fP); +\fBint mvwinnwstr(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP, wchar_t * \fIwstr\fP, int \fIn\fP); .fi .SH DESCRIPTION -These routines return a string of \fBwchar_t\fP wide characters in \fIwstr\fP, -starting at the current cursor position in the named 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 NUL). -Transfer stops at the end of the current line, or when \fIn\fP characters have -been stored at the location referenced by \fIwstr\fP. -.PP -If the size \fIn\fP is not large enough to store a complete complex character, -an error is generated. +.B \%winwstr +extracts a wide-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 wstr "," +terminating it with a wide null character +and +omitting any attributes and color pair identifier +that +.I curses +associates with each character. +.B \%winnwstr +does the same, +but copies at most +.I n +wide characters from +.IR win "." +A negative +.I n +implies no limit; +.B \%winnwstr +then works like +.BR \%winwstr "." +\fB\%ncurses\fP(3X) describes the variants of these functions. .SH RETURN VALUE -All routines return -\fBERR\fP +On successful operation, +these functions return the count of wide characters copied from +.I win +to +.I wstr +(not including the wide null terminator), +or +.B ERR upon failure. -Upon -successful completion, the *\fBinwstr\fP -routines return -\fBOK\fP, and the *\fBinnwstr\fP -routines return the -number of characters read into the string. +.BR \%innwstr "," +.BR \%winnwstr "," +.BR \%mvinnwstr "," +and +.B \%mvwinnwstr +return +.B ERR +if +.I n +is insufficiently large to store a complete wide character string. +(Recall that a +.I curses +complex character can contain multiple wide characters, +some of which may be non-spacing.) .PP -X/Open defines no error conditions. -This implementation returns an error +In +.IR \%ncurses "," +these functions return +.B ERR +if .bP -if the \fIwin\fP parameter is null or +the +.I curses +screen has not been initialized, .bP -if the \fIwstr\fP parameter is null, or +(for functions taking a +.I \%WINDOW +pointer argument) +.I win +is a null pointer, +or .bP -if no characters could be read. +.I wstr +is a null pointer. .PP Functions prefixed with \*(``mv\*('' first perform cursor movement and fail if the position @@ -105,37 +146,103 @@ fail if the position .IR x ) is outside the window boundaries. .SH NOTES -All routines except -\fBwinnwstr\fP -may be macros. -.PP -Each cell in the window holds a complex character -(a spacing character and zero or more non-spacing characters) -together with attributes and color. -These functions store only the wide characters, -ignoring attributes and color. -Use \fBin_wchstr\fP to return the complex characters from a window. +All of these functions except +.B \%winnwstr +may be implemented as macros. .PP Reading a line that overflows the array pointed to by -\fIwstr\fP -with -\fBinwstr\fP, -\fBmvinwstr\fP, -\fBmvwinwstr\fP -or -\fBwinwstr\fP -causes undefined results. -Therefore, the use of -\fBinnwstr\fP, -\fBmvinnwstr\fP, -\fBmvwinnwstr\fP, or -\fBwinnwstr\fP -is recommended. +.I wstr +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 wstr "." +.SH EXTENSIONS +.BR \%innwstr "," +.BR \%winnwstr "," +.BR \%mvinnwstr "," +and +.BR \%mvwinnwstr "'s" +acceptance of negative +.I n +values is an +.I \%ncurses +extension. .SH PORTABILITY -These functions are described in X/Open Curses, Issue 4. +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 +Notwithstanding the foregoing, +X/Open Curses Issues 4 and 7 both state that +.IR \%innwstr "," +.IR \%winnwstr "," +.IR \%mvinnwstr "," +and +.I \%mvwinnwstr +\*(``fail .\|.\|. [i]f the array is not large enough to contain any +complete characters\*(''. +Strictly interpreted, +this means that a caller of these functions cannot use their return +values to detect truncation of a wide-character string copied from more +than one character cell in +.IR win "." +.I \%ncurses +reports any truncation with +.IR ERR "." +.PP +X/Open Curses specifies +.IR \%inwstr "," +.IR \%winwstr "," +.IR \%mvinwstr "," +and +.I \%mvwinwstr +as returning +.I OK +rather than a (wide) character count, +unlike their non-wide counterparts +.IR \%instr "," +.IR \%winstr "," +.IR \%mvinstr "," +and +.IR \%mvwinstr "." +.I \%ncurses +regards this inconsistency as an error in the standard. +.SH HISTORY +The System\ V Interface Definition, +Version 4 (1995), +specified +.I \%winwstr +and +.I \%winnwstr +(and the usual variants). +.\" SVID 4, vol 3., p. 516 +These were later additions to +.RI SVr4. x , +not appearing in the first SVr4 (1989). +Their synopses described each function as taking +an argument of type +.RI pointer-to- char +instead of +.RI pointer-to- wchar_t , +despite describing them as \*(``returning the string of +.I \%wchar_t +in +.IR str "\*(''." +Presumably this was an error in the System\ V Interface Definition. .SH SEE ALSO +\fB\%curs_instr\fP(3X) describes comparable functions of the +.I \%ncurses +library in its non-wide-character configuration. +.PP \fB\%curses\fP(3X), -\fB\%curs_inch\fP(3X), -\fB\%curs_inchstr\fP(3X), -\fB\%curs_instr\fP(3X), +\fB\%curs_in_wch\fP(3X), \fB\%curs_in_wchstr\fP(3X) diff --git a/man/curs_kernel.3x b/man/curs_kernel.3x index e85c132768a3..98c93aa64061 100644 --- a/man/curs_kernel.3x +++ b/man/curs_kernel.3x @@ -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_kernel.3x,v 1.61 2024/04/20 21:24:19 tom Exp $ -.TH curs_kernel 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_kernel.3x,v 1.89 2025/08/16 19:50:07 tom Exp $ +.TH curs_kernel 3X 2025-08-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -53,9 +53,10 @@ \fB\%savetty\fP, \fB\%getsyx\fP, \fB\%setsyx\fP, -\fB\%ripoffline\fP, \fB\%curs_set\fP, -\fB\%napms\fP \- +\fB\%mvcur\fP, +\fB\%napms\fP, +\fB\%ripoffline\fP \- low-level \fIcurses\fR routines .SH SYNOPSIS .nf @@ -73,9 +74,10 @@ low-level \fIcurses\fR routines \fBvoid getsyx(int \fIy\fP, int \fIx\fP); \fBvoid setsyx(int \fIy\fP, int \fIx\fP); .PP -\fBint ripoffline(int \fIline\fP, int (*\fIinit\fP)(WINDOW *, int)); \fBint curs_set(int \fIvisibility\fP); +\fBint mvcur(int \fIoldrow\fP, int \fIoldcol\fP, int \fInewrow\fP, int \fInewcol\fP); \fBint napms(int \fIms\fP); +\fBint ripoffline(int \fIline\fP, int (*\fIinit\fP)(WINDOW *, int)); .fi .SH DESCRIPTION The following routines give low-level access @@ -104,67 +106,118 @@ state of the terminal modes. a buffer and \fBresetty\fP restores the state to what it was at the last call to \fBsavetty\fP. .SS getsyx -The \fBgetsyx\fP routine returns the current coordinates -of the \fIvirtual screen\fP cursor in \fIy\fP and \fIx\fP. -If \fBleaveok\fP is currently \fBTRUE\fP, then -\fB\-1\fP,\fB\-1\fP is returned. -If lines have been removed from the top of the -screen, using \fBripoffline\fP, \fIy\fP and \fIx\fP include these lines; -therefore, \fIy\fP and \fIx\fP should be used only as arguments for -\fBsetsyx\fP. -.PP -Few applications will use this feature, -most use \fBgetyx\fP instead. -.SS setsyx -The \fBsetsyx\fP routine sets -the \fIvirtual screen\fP cursor to \fIy\fP, \fIx\fP. -If \fIy\fP and \fIx\fP are both \fB\-1\fP, then -\fBleaveok\fP is set. -The two routines \fBgetsyx\fP and \fBsetsyx\fP -are designed to be used by a library routine, which manipulates -\fBcurses\fP windows but does not want to change the current position -of the program's cursor. -The library routine would call \fBgetsyx\fP -at the beginning, do its manipulation of its own windows, do a -\fBwnoutrefresh\fP on its windows, call \fBsetsyx\fP, and then call -\fBdoupdate\fP. -.PP -Few applications will use this feature, -most use \fBwmove\fP instead. -.SS ripoffline -.B \%ripoffline -provides access to the same facility that \fB\%slk_init\fP(3X) uses to -reduce the size of the screen. -\fB\%ripoffline\fP must be called before \fBinitscr\fP or -\fBnewterm\fP is called, to prepare these initial actions: -.bP -If \fIline\fP is positive, a line is removed from the top of \fBstdscr\fP. -.bP -if \fIline\fP is negative, a line is removed from the bottom. +.B \%getsyx +stores the coordinates of virtual screen +.RB \%( newscr ) +cursor in +.I y +and +.IR x "." +If +.BR \%newscr 's +\fB\%leaveok\fP(3X) output option is +.BR TRUE "," +.B \%getsyx +stores +.B \-1 +in both +.I y +and +.IR x "." +If lines have been removed from the top of the screen using +.BR \%ripoffline "," +.I y +includes these lines; +therefore, +.I y +and +.I x +populated by +.B \%getsyx +should be used only as arguments for +.BR \%setsyx "." .PP -When the resulting initialization is done inside \fBinitscr\fP, the -routine \fBinit\fP (supplied by the user) is called with two -arguments: -.bP -a window pointer to the one-line window that has been -allocated and -.bP -an integer with the number of columns in the window. +Few applications use this feature; +most call \fB\%getyx\fP(3X) instead. +.SS setsyx +.B \%setsyx +sets the virtual screen +.RB \%( newscr ) +cursor location to +.RI ( y , +.IR x ")." +.B "\%setsyx(\-1, \-1)" +is equivalent to +.BR "\%leaveok(newscr, TRUE)" "." .PP -Inside this initialization routine, the integer variables \fBLINES\fP -and \fBCOLS\fP (defined in \fB<curses.h>\fP) are not guaranteed to be -accurate and \fBwrefresh\fP or \fBdoupdate\fP must not be called. -It is allowable to call \fBwnoutrefresh\fP during the initialization routine. +.B \%getsyx +and +.B \%setsyx +are designed to be used by a function that manipulates +.I curses +windows but seeks to avoid changing the cursor position. +Such a function would first call +.BR \%getsyx "," +modify its windows' content, +call \fB\%wnoutrefresh\fP(3X) on them, +call +.BR \%setsyx "," +then call \fB\%doupdate\fP(3X). .PP -\fBripoffline\fP can be called up to five times before calling \fBinitscr\fP or -\fBnewterm\fP. +Few applications use this feature; +most call \fB\%wmove\fP(3X) instead. .SS curs_set -The \fBcurs_set\fP routine sets the cursor state to invisible, -normal, or very visible for \fBvisibility\fP equal to \fB0\fP, -\fB1\fP, or \fB2\fP respectively. -If the terminal supports the \fIvisibility\fP requested, -the previous \fIcursor\fP state is returned; -otherwise, \fBERR\fP is returned. +.B \%curs_set +adjusts the cursor visibility to +\*(``invisible\*('', +\*(``visible\*('', +\*(``very visible\*('', +as its argument is +.BR 0 , +.BR 1 , +or +.BR 2 , +respectively. +It returns the previous +.I visibility +if the requested one is supported, +and +.B ERR +otherwise. +.SS mvcur +.B \%mvcur +provides low-level cursor motion. +It takes effect immediately, +rather than at the next refresh. +Unlike the other low-level output functions, +which either write to the standard output stream +or are passed a function pointer to perform output, +.B \%mvcur +uses a file descriptor derived from the output stream parameter of +\fB\%newterm\fP(3X). +.PP +One application of +.B \%mvcur +accompanies the temporary use of another program to write to the +terminal screen. +For example, +first call \fB\%refresh\fP(3X) to ensure that the screen and the +library's model of it are up to date; +then call +.BR \%reset_shell_mode ";" +write to the screen with the external application; +call +.BR \%reset_prog_mode ";" +and finally call +.BR \%mvcur( ".\|.\|." , +.RB .\|.\|. , +.B \-1, \-1) +to move the terminal cursor to where +.I \%curses +thinks it is, +since the library has no knowledge of how the external application +moved it. +.\" https://lists.gnu.org/archive/html/bug-ncurses/2016-10/msg00002.html .SS napms .B \%napms sleeps for @@ -174,53 +227,263 @@ If .I ms exceeds 30,000 (thirty seconds), -it is capped at that value. +.I \%ncurses +caps it at that value. +.SS ripoffline +.B \%ripoffline +provides access to the same facility that \fB\%slk_init\fP(3X) uses to +reduce the size of the screen. +The application must call +.B \%ripoffline +before \fB\%initscr\fP(3X) or \fB\%newterm\fP(3X) +so that the latter functions prepare a +.B \%stdscr +of the correct size. +.bP +If +.I line +is positive, +.B \%ripoffline +removes a line from the top of what will become +.BR \%stdscr "." +.bP +If +.I line +is negative, +.B \%ripoffline +removes a line from the bottom of what will become +.BR \%stdscr "." +.PP +When +.B \%initscr +initializes +.IR curses "," +it calls the +.I init +function supplied to +.B \%ripoffline +by the application with two arguments: +.bP +a pointer to the one-line +.I \%WINDOW +that it allocates, +and +.bP +an integer with the number of columns in the window. +.PP +Inside this +.I init +function, +the values of the integer variables +.B LINES +and +.B COLS +(see \fB\%curs_variables\fP(3X)) +are not guaranteed to be reliable; +it must not call \fB\%wrefresh\fP(3X) or \fB\%doupdate\fP(3X). +A \fB\%wnoutrefresh\fP(3X) call is permissible. +.PP +.B \%ripoffline +can be called up to five times before +.B \%initscr +or +.BR \%newterm "." .SH RETURN VALUE -Except for \fBcurs_set\fP, these routines always return \fBOK\fP. -.PP -\fBcurs_set\fP -returns the previous cursor state, or \fBERR\fP if the -requested \fIvisibility\fP is not supported. -.PP -X/Open defines no error conditions. -In this implementation -.TP 5 -\fBdef_prog_mode\fP, \fBdef_shell_mode\fP, \fBreset_prog_mode\fP, \fBreset_shell_mode\fP -return an error -if the terminal was not initialized, or -if the I/O call to obtain the terminal settings fails. -.TP 5 -\fBripoffline\fP -returns an error if the maximum number of ripped-off lines -exceeds the maximum (5). -.SH NOTES -Note that \fBgetsyx\fP is a macro, so \fB&\fP is not necessary before -the variables \fIy\fP and \fIx\fP. +Except for +.BR \%curs_set "," +these functions return +.B OK +on success and +.B ERR +on failure. .PP -Older SVr4 man pages warn that the return value -of \fBcurs_set\fP \*(``is currently incorrect\*(''. -This implementation gets it right, but it may be unwise to count -on the correctness of the return value anywhere else. +.B \%curs_set +returns the previous cursor visibility, +and returns +.B ERR +if the terminal type does not support the requested +.IR visibility "." +.PP +.B \%napms +always succeeds. +.PP +.B \%mvcur +fails if the position +.RI ( newrow , +.IR newcol ) +is outside the screen boundaries. +.PP +In +.IR \%ncurses "," +.bP +.BR \%def_prog_mode "," +.BR \%def_shell_mode "," +.BR \%reset_prog_mode "," +and +.B \%reset_shell_mode +return +.B ERR +if the terminal was not initialized, +or if the operating system's function for obtaining terminal settings +fails. +.bP +.B \%ripoffline +returns +.B ERR +if the accumulated quantity of ripped-off lines +would exceed the maximum (5). +.SH NOTES +.B \%getsyx +is a macro; +use of the +.B & +operator before its arguments is unnecessary. .PP -Both \fI\%ncurses\fP and SVr4 will call \fBcurs_set\fP in \fBendwin\fP -if \fBcurs_set\fP -has been called to make the cursor other than normal, i.e., either +The +.B \%endwin +function of both +.I \%ncurses +and SVr4 +.I curses +calls +.B \%curs_set +if the latter has previously been called to set the cursor visibility +to a value other than normal; +that is, +either invisible or very visible. -There is no way for \fI\%ncurses\fP to determine the initial cursor -state to restore that. +There is no way for +.I \%ncurses +to determine the initial cursor visibility to restore it. +.PP +.I \%ncurses +imposes a limit of 30 seconds on a delay requested of +.BR \%napms . +.PP +While the +.I init +function called by +.B \%ripoffline +is specified to return an +.IR int "," +.I \%ncurses +pays no attention to its return value. +.PP +If +.B \%ripoffline +cannot allocate memory for the required +.I \%WINDOW +structure backing the ripped-off line, +it stores a null pointer to the +.I \%WINDOW +pointer argument supplied by the +.I init +function the application specifies. +The application must check this argument for validity after calling +.B \%initscr +and prior to performing +.I curses +operations on that window. +.SH EXTENSIONS +In +.IR \%ncurses "," +.B \%mvcur +accepts +.B \-1 +for either or both old coordinates. +This value tells +.I \%ncurses +that the old location is unknown, +and that it must use only absolute motion, +as with the +.B \%cursor_address +.RB ( cup ) +capability, +rather than the least costly combination of absolute and relative +motion. .SH PORTABILITY -The \fIvirtual screen\fP functions \fBsetsyx\fP and \fBgetsyx\fP -are not described in X/Open Curses, Issue 4. +Applications employing +.I \%ncurses +extensions should condition their use on the visibility of the +.B \%NCURSES_VERSION +preprocessor macro. +.PP +The +.I "virtual screen" +functions +.I \%setsyx +and +.I \%getsyx +are not described in X/Open Curses Issue\ 4. +SVr4 documents each of them +as returning an +.IR int "." +This is misleading, +as they are macros with no documented semantics for returning values. +.PP All other functions are as described in X/Open Curses. +It specifies no error conditions for them, +except as described for +.I \%curs_set +in section \*(``RETURN VALUE\*('' above. +.PP +The System\ V Interface Definition, +Version 4 (1995), +specified all of these functions except +.I \%curs_set +as returning +.IR OK "." +.\" SVID 4, vol 3., p. 518 +.PP +Older SVr4 man pages warn that the return value of +.I \%curs_set +\*(``is currently incorrect\*(''. +This implementation gets it right, +but counting on its correctness anywhere else may be unwise. +.PP +X/Open Curses specifies +.I \%ripoffline +as returning +.I OK +with no possibility of failure +(\*(``[c]alls to +.I \%ripoffline +above this limit +[five lines] +have no effect but report success\*(''). +.PP +X/Open Curses notes: +.RS +.PP +After use of +.IR \%mvcur "()," +the model Curses maintains of the state of the terminal might not +match the actual state of the terminal. +An application should touch and refresh the window before +resuming conventional use of Curses. +.RE .PP -The SVr4 documentation describes \fBsetsyx\fP and \fBgetsyx\fP -as having return type int. -This is misleading, as they are macros with no documented semantics -for the return value. +Both +.I \%ncurses +and SVr4 +.I curses +implement +.I \%mvcur +using the +.I SCREEN +object allocated in either \fB\%initscr\fP(3X) or \fB\%newterm\fP(3X). +X/Open Curses states that the old location must be given for +.I \%mvcur +to accommodate terminals that lack absolute cursor positioning. +.\" X/Open Curses Issue 7, p. 161 .PP -If interrupted, \fI\%ncurses\fP restarts \fBnapms\fP. -That, and the limitation to 30 seconds, -are different from other implementations. +If interrupted by a signal, +.I \%ncurses +restarts +.IR \%napms "." +That, +and the limitation to 30 seconds, +differ from other implementations. .SH SEE ALSO \fB\%curses\fP(3X), \fB\%curs_initscr\fP(3X), diff --git a/man/curs_legacy.3x b/man/curs_legacy.3x index 24be01b85269..ddc2c19b7994 100644 --- a/man/curs_legacy.3x +++ b/man/curs_legacy.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2019-2023,2024 Thomas E. Dickey * +.\" Copyright 2019-2024,2025 Thomas E. Dickey * .\" Copyright 2007-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_legacy.3x,v 1.32 2024/03/16 15:35:01 tom Exp $ -.TH curs_legacy 3X 2024-03-16 "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_legacy.3x,v 1.36 2025/02/15 18:43:02 tom Exp $ +.TH curs_legacy 3X 2025-02-15 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .de bP .ie n .IP \(bu 4 .el .IP \(bu 2 @@ -107,24 +96,6 @@ data as \fB\%getparyx\fP. Except as noted, these functions return an integer, or \fBERR\fP if the window parameter is null. -.SH NOTES -All of these interfaces are implemented as macros and functions. -The macros are suppressed -(and only the functions provided) -in an \*(``opaque\*('' -.I \%ncurses -build, -which defines the preprocessor symbol -.BR \%NCURSES_OPAQUE . -See section \*(``ALTERNATE CONFIGURATIONS\*('' in \fB\%ncurses\fP(3X). -.PP -The standard forms such as \fB\%getyx\fP -.I must -be implemented as macros, -and -(in this implementation) -are defined in terms of the functions described here, -to avoid reliance on internal details of the \fI\%WINDOW\fP structure. .SH PORTABILITY These functions were supported on Version 7, BSD or System V implementations. None of those implementations checked the window parameter. diff --git a/man/curs_mouse.3x b/man/curs_mouse.3x index 8e5c70181345..69dcbff75062 100644 --- a/man/curs_mouse.3x +++ b/man/curs_mouse.3x @@ -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_mouse.3x,v 1.98 2024/04/20 19:02:07 tom Exp $ -.TH curs_mouse 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_mouse.3x,v 1.131 2025/11/12 01:06:36 tom Exp $ +.TH curs_mouse 3X 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -53,75 +53,127 @@ \fB\%wenclose\fP, \fB\%mouse_trafo\fP, \fB\%wmouse_trafo\fP, -\fB\%mouseinterval\fP \- -get mouse events in \fIcurses\fR +\fB\%mouseinterval\fP, +\fB\%mmask_t\fP, +\fB\%MEVENT\fP \- +get mouse events in \fIncurses\fR .SH SYNOPSIS .nf \fB#include <curses.h> .PP +\fI/* data types */ \fBtypedef unsigned long mmask_t; .PP \fBtypedef struct { -\fB short id; \fI/* ID to distinguish multiple devices */ -\fB int x, y, z; \fI/* event coordinates */ -\fB mmask_t bstate; \fI/* button state bits */ +\fB short id; \fI/* ID to distinguish multiple devices */ +\fB int x, y, z; \fI/* event coordinates */ +\fB mmask_t bstate; \fI/* button state bits */ \fB} MEVENT; .PP +\fI/* functions */ \fBbool has_mouse(void); .PP -\fBmmask_t mousemask(mmask_t \fInewmask\fP, mmask_t *\fIoldmask\fP); +\fBmmask_t mousemask(mmask_t \fInew-mask\fP, mmask_t * \fIold-mask\fP); .PP -\fBint getmouse(MEVENT *\fIevent\fP); -\fBint ungetmouse(MEVENT *\fIevent\fP); +\fBint getmouse(MEVENT * \fIevent\fP); +\fBint ungetmouse(MEVENT * \fIevent\fP); .PP -\fBbool wenclose(const WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP); +\fBbool wenclose(const WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP); .PP -\fBbool mouse_trafo(int* \fIpY\fP, int* \fIpX\fP, bool \fIto_screen\fP); -\fBbool wmouse_trafo(const WINDOW* \fIwin\fP, -.ti +18n \" "bool wmouse_trafo(" -\fBint* \fIpY\fB, int* \fIpX\fB, bool \fIto_screen\fB); +\fBbool mouse_trafo(int * \fIpY\fP, int * \fIpX\fP, bool \fIto-screen\fP); +\fBbool wmouse_trafo(const WINDOW * \fIwin\fP, + \fBint * \fIpY\fB, int * \fIpX\fB, bool \fIto-screen\fB); .PP \fBint mouseinterval(int \fIerval\fB);\fR .fi .SH DESCRIPTION -These functions provide an interface to mouse events from -\fB\%ncurses\fP(3X). -Mouse events are represented by \fB\%KEY_MOUSE\fP -pseudo-key values in the \fB\%wgetch\fP(3X) input stream. +.I \%ncurses +provides an interface to the mouse or other pointing device. +An application can register its interest in such events; +the library then exposes the availability of a mouse event via an +.IR "input character reading function" ":" +this is \fB\%wgetch\fP(3X) in the non-wide character +.I curses +API and \fB\%wget_wch\fP(3X) in the wide character API. +A queue distinct from that used for keyboard events +accumulates the details of mouse events. +The input character reading function +reports the +.B \%KEY_MOUSE +key code when a mouse event is available for collection. +A single mouse event queue serves all windows +associated with the screen. +.PP +The +.I \%MEVENT +structure describes a mouse event. +Its +.I y +and +.I x +coordinates are screen-, +not window-, +relative. +The +.I \%bstate +member has exactly one bit set indicating the event type. +.PP +.I \%ncurses +ignores mouse events when input is in canonical (\*(``cooked\*('') mode, +and produces an error beep when they occur +while the library simulates canonical mode in a window, +as with \fB\%getstr\fP(3X) +(wide-character API users: \fB\%get_wstr\fP(3X)), +which expects a line feed to terminate its input loop. .SS has_mouse -The \fB\%has_mouse\fP function returns \fBTRUE\fP if the mouse driver -has been successfully initialized, -and \fBFALSE\fP otherwise. -.PP -Mouse events are ignored when input is in cooked mode, and -cause an error beep when cooked mode is being simulated in a window by a -function such as \fB\%getstr\fP that expects a linefeed for input-loop -termination. +The terminal type or operating system interface +must support the encoding of mouse events. +.B \%has_mouse +returns +.B TRUE +if +.IR \%ncurses 's +mouse driver initialized successfully, +and +.B FALSE +otherwise. .SS mousemask -To make mouse events visible, use the \fB\%mousemask\fP function. -This sets the mouse events to be reported. -By default, no mouse events are reported. +Use +.B \%mousemask +to select the varieties of mouse event your application wishes to +receive. +By default, +.I \%ncurses +reports no mouse events. .bP -The function returns an updated copy of \fInewmask\fP -to indicate which of the specified mouse events can be reported. +The function returns an updated copy of +.I new-mask +indicating which event types of interest +are reportable by the terminal's mouse protocol. .IP -If the screen has not been initialized, -or if the terminal does not support mouse-events, -this function returns 0. +If the screen is not initialized, +or the terminal interface does not report mouse events, +.B \%mousemask +returns 0. .bP -If \fIoldmask\fP is non-\fBNULL\fP, -this function fills the indicated location with the previous value of the -current screen's mouse event mask. -.PP -As a side effect, setting a zero mouse mask may turn off the mouse pointer; +If +.I old-mask +is not a null pointer, +.B \%mousemask +stores the previous value +of the screen's mouse event mask there. +.PP +As a side effect, +setting a zero mouse mask may turn off the mouse cursor; setting a nonzero mask may turn it on. Whether this happens is device-dependent. .SS "Mouse Events" -Here are the mouse event type masks which may be defined: +Several mouse event types may be selected; +construct a mask by logically \*(``or\*(''-ing their values. .PP .TS Lb Lb -Lb Lx. +Lb Lw(33n)x. Name Description = BUTTON1_PRESSED mouse button 1 down @@ -155,90 +207,165 @@ BUTTON5_DOUBLE_CLICKED mouse button 5 double clicked BUTTON5_TRIPLE_CLICKED mouse button 5 triple clicked _ BUTTON_SHIFT T{ -shift was down during button state change +a shift key was down during button state change T} BUTTON_CTRL T{ -control was down during button state change +a control key was down during button state change T} BUTTON_ALT T{ -alt was down during button state change +an alt key was down during button state change T} ALL_MOUSE_EVENTS report all button state changes REPORT_MOUSE_POSITION report mouse movement _ .TE .SS getmouse -Once a class of mouse events has been made visible in a window, -calling the \fB\%wgetch\fP function on that window may return -\fB\%KEY_MOUSE\fP as an indicator that a mouse event has been queued. -To read the event data and pop the event off the queue, call -\fB\%getmouse\fP. -This function will return \fBOK\fP if a mouse event -is actually visible in the given window, \fBERR\fP otherwise. -When \fB\%getmouse\fP returns \fBOK\fP, the data deposited as y and -x in the event structure coordinates will be screen-relative character-cell -coordinates. -The returned state mask will have exactly one bit set to -indicate the event type. -The corresponding data in the queue is marked invalid. -A subsequent call to \fB\%getmouse\fP will retrieve the next older -item from the queue. +When a window is configured to report a non-empty set of event types, +calling the input character reading function on that window may return +.B \%KEY_MOUSE +to indicate availability of an enqueued mouse event. +To read the event data and remove it from the queue, +call +.BR \%getmouse "," +which returns +.B OK +if a mouse event is visible in the given window +and +.B ERR +otherwise. +When +.B \%getmouse +returns +.BR OK "," +it deposits data describing the mouse event in the +.I event +pointer you supply. +A subsequent +.B \%getmouse +call retrieves the next older event from the queue. .SS ungetmouse -The \fB\%ungetmouse\fP function behaves analogously to \fB\%ungetch\fP. -It pushes -a \fB\%KEY_MOUSE\fP event onto the input queue, and associates with that event -the given state data and screen-relative character-cell coordinates. +.B \%ungetmouse +behaves analogously to \fB\%ungetch\fP(3X). +It pushes a +.B \%KEY_MOUSE +event onto the screen's input queue, +and +.I event +onto the mouse event queue. .SS wenclose -The \fB\%wenclose\fP function tests whether a given pair of screen-relative -character-cell coordinates is enclosed by a given window, returning \fBTRUE\fP -if it is and \fBFALSE\fP otherwise. -It is useful for determining what subset of -the screen windows enclose the location of a mouse event. -.PP -If the parameter is a pad, -\fB\%wenclose\fP uses the most recent screen coordinates used for -this pad in -\fB\%prefresh\fP(3X) or -\fB\%pnoutrefresh\fP(3X). +.B \%wenclose +returns +.B TRUE +if the pair of screen-relative coordinates +.RI ( y , +.IR x ")" +is enclosed by the given window +.IR win "," +and +.B FALSE +otherwise. +If +.I win +is a pad, +.B \%wenclose +uses its most recent screen coordinates as specified in +a \fB\%prefresh\fP(3X) or \fB\%pnoutrefresh\fP(3X) call. +.PP +.B \%wenclose +is useful for determining what subset of the screen's windows +encloses the location of a mouse event; +it is otherwise independent of the +.I \%ncurses +mouse API. .SS wmouse_trafo -The \fB\%wmouse_trafo\fP function transforms a given pair of coordinates -from \fB\%stdscr\fP-relative coordinates -to coordinates relative to the given window or vice versa. -The resulting \fB\%stdscr\fP-relative coordinates are not always -identical to screen coordinates due to the mechanism to reserve -lines on top or bottom of the screen for other purposes -(see the \fB\%ripoffline\fP(3X) and \fB\%slk_init\fP(3X) calls, for example). -.bP -If the parameter \fIto_screen\fP is \fBTRUE\fP, the pointers -\fIpY, pX\fP must reference the coordinates of a location -inside the window \fIwin\fP. -They are converted to \fB\%stdscr\fP-relative coordinates and returned -through the pointers. -If the conversion was successful, the function returns \fBTRUE\fP. -.IP -If one of the parameters was \fBNULL\fP or the location is -not inside the window, \fBFALSE\fP is returned. -.bP -If \fIto_screen\fP is -\fBFALSE\fP, the pointers \fIpY, pX\fP must reference -\fB\%stdscr\fP-relative coordinates. -They are converted to window-relative coordinates if the -window \fIwin\fP encloses this point. -In this case the function returns \fBTRUE\fP. -.IP -If one of the parameters is \fBNULL\fP or the point is not inside the -window, \fBFALSE\fP is returned. -.PP -The referenced coordinates -are only replaced by the converted coordinates if the transformation was -successful. +.B \%wmouse_trafo +transforms the given pair of coordinate pointers +.RI ( pY , +.IR pX ")" +from a +.IR win -relative +basis to a screen-relative one or +.IR "vice versa" "," +as +.I to-screen +is +.B TRUE +or +.BR FALSE "," +respectively. +.BR \%stdscr -relative +coordinates are not always identical to screen coordinates: +.I curses +supports reservation of screen lines at the top and/or bottom +for other purposes; +see \fB\%ripoffline\fP(3X) and \fB\%slk_init\fP(3X). +.PP +If +.I to-screen is +.B TRUE +and the pointers +.RI ( pY , +.IR pX ")" +reference coordinates inside +.IR win "," +.I \%ncurses +updates their values to +.BR \%stdscr -relative +coordinates and returns +.BR TRUE "." +If either +.I pY +or +.I pX +is a null pointer, +or +.RI ( pY , +.IR pX ")" +is not inside +.IR win "," +.B \%wmouse_trafo +returns +.BR FALSE "." +.PP +If +.I to-screen is +.B FALSE +and the pointers +.RI ( pY , +.IR pX ")" +reference coordinates inside +.BR stdscr "," +.I \%ncurses +updates their values to +.IR win -relative +coordinates and returns +.BR TRUE "." +If either +.I pY +or +.I pX +is a null pointer, +or +.RI ( pY , +.IR pX ")" +is not inside +.BR stdscr "," +.B \%wmouse_trafo +returns +.BR FALSE "." .SS mouse_trafo -The \fB\%mouse_trafo\fP function performs the same translation -as \fB\%wmouse_trafo\fP, -using \fB\%stdscr\fP for \fIwin\fP. +.B \%mouse_trafo +applies the +.B \%wmouse_trafo +translation to +.BR \%stdscr "." +If no screen lines are reserved by \fB\%ripoffline\fP(3X) or +\fB\%slk_init\fP(3X), +this is the identity transformation. .SS mouseinterval -The \fB\%mouseinterval\fP function sets the maximum time -(in thousands of a second) +.B \%mouseinterval +sets the maximum time +(in thousandths of a second) that can elapse between press and release events for them to be resolved as a .IR click . @@ -248,55 +375,76 @@ or, with motion, as a \*(``drag\*(''. .PP -Calling \fB\%mouseinterval(0)\fP disables click resolution. When .I \%ncurses detects a mouse event, it awaits further input activity up to this interval, and then checks for a subsequent mouse event which can be combined with the first event. -If the timeout expires without input activity -(which would happen with a zero interval), -then no click resolution will occur. -.PP -This function returns the previous interval value. -Use \fB\%mouseinterval(\-1)\fP to obtain the interval without altering it. +If the timeout expires without input activity, +then no click resolution occurs. +Calling +.B \%mouseinterval(0) +disables click resolution. +.PP +.B \%mouseinterval +returns the previous interval value. +Use +.B \%mouseinterval(\-1) +to obtain the interval without altering it. .PP The mouse interval is set to one sixth of a second when the corresponding screen is initialized, e.g., in \fBinitscr\fP(3X) or \fBsetupterm\fP(3X). .SH RETURN VALUE -\fB\%has_mouse\fP, -\fB\%wenclose\fP, -\fB\%mouse_trafo\fP, +.BR \%has_mouse "," +.BR \%wenclose "," +.BR \%mouse_trafo "," and -\fB\%wmouse_trafo\fP -return \fBTRUE\fP or \fBFALSE\fP as noted above. -.PP -\fB\%getmouse\fP and \fB\%ungetmouse\fP -return \fBERR\fP upon failure and \fBOK\fP upon success. -.PP -\fB\%getmouse\fP fails if: +.B \%wmouse_trafo +return +.B TRUE +or +.B FALSE +as noted above. +.PP +.B \%getmouse +and +.B \%ungetmouse +return +.B ERR +upon failure and +.B OK +upon success. +.PP +.B \%getmouse +fails if: .bP no mouse driver was initialized, .bP the mask of reportable events is zero, .bP a mouse event was detected that does not match the mask, +or .bP -or if no more events remain in the queue. +no more events remain in the queue. .PP -\fB\%ungetmouse\fP returns an error if the event queue is full. +.B \%ungetmouse +returns +.B ERR +if the event queue is full. .PP -\fB\%mousemask\fP +.B \%mousemask returns the mask of reportable events. .PP -\fB\%mouseinterval\fP +.B \%mouseinterval returns the previous interval value, unless the terminal was not initialized. In that case, it returns the maximum interval value (166). .SH NOTES -The order of the \fB\%MEVENT\fP structure members is not guaranteed. +The order of the +.B \%MEVENT +structure members is not guaranteed. Additional fields may be added to the structure in the future. .PP Under @@ -315,41 +463,66 @@ OS/2 EMX .RE .PP If you are using an unsupported configuration, -mouse events will not be visible to -\fI\%ncurses\fP (and the \fB\%mousemask\fP function will always -return \fB0\fP). +mouse events are not visible to +.I \%ncurses +(and the +.B \%mousemask +function always returns +.BR 0 ")." .PP -If the +If the terminal type possesses the (nonstandard) .I \%term\%info -entry contains a \fBXM\fP string, -this is used in the +string capability +.BR XM "," +.IR \%ncurses "'s" .I \%xterm -mouse driver to control the -way the terminal is initialized for mouse operation. -The default, if \fBXM\fP is not found, +mouse driver uses it when initializing the terminal for mouse operation. +The default, +if +.B XM +is not found, corresponds to private mode 1000 of -.I \%xterm: +.IR \%xterm "." .PP .RS 3 +.EX \eE[?1000%?%p1%{1}%=%th%el%; +.EE .RE .PP -The mouse driver also recognizes a newer -.I \%xterm -private mode 1006, -e.g., +.I \%ncurses +also recognizes +.IR \%xterm 's +newer private mode 1006. .PP .RS 3 +.EX \eE[?1006;1000%?%p1%{1}%=%th%el%; +.EE .RE .PP -The \fIz\fP member in the event structure is not presently used. +The +.I id +member of the mouse event structure is not presently used; +no terminal type or operating system interface supports reporting events +from distinguishable pointing devices. +If you synthesize an +.IR \%MEVENT "," +use an +.I id +of 0. +.PP +The +.I z +member of the mouse event structure is not presently used. It is intended for use with touch screens (which may be pressure-sensitive) or with 3D-mice/trackballs/power gloves. .PP -The \fB\%ALL_MOUSE_EVENTS\fP class does not -include \fB\%REPORT_MOUSE_POSITION\fP. +The +.B \%ALL_MOUSE_EVENTS +class does not include +.BR \%REPORT_MOUSE_POSITION "." They are distinct. For example, in @@ -357,19 +530,23 @@ in wheel/scrolling mice send position reports as a sequence of presses of buttons 4 or 5 without matching button-releases. .SH EXTENSIONS -These functions were designed for -\fB\%ncurses\fP(3X), +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. (SVr4 .I curses did have a .I \%getmouse function, -which took no argument and returned a different type.) +which took no argument and returned an +.IR "unsigned long" ".)" .SH PORTABILITY Applications employing the .I \%ncurses @@ -385,27 +562,27 @@ see section \*(``ALTERNATE CONFIGURATIONS\*('' of \fB\%ncurses\fP(3X). The following values may be specified. .RS 3 .TP 3 -1 +.B 1 has definitions for reserved events. The mask uses 28 bits. .TP 3 -2 +.B 2 adds definitions for button 5, removes the definitions for reserved events. The mask uses 29 bits. .RE -.PP -SVr4 -.I curses -had support for the mouse in a variant of \fI\%xterm\fP(1). +.SH HISTORY +SVr4 (1989) added mouse support to its variant of \fI\%xterm\fP(1). It is mentioned in a few places, with little supporting documentation. .bP Its \*(``libcurses\*('' manual page lists functions for this feature -prototyped in \fI\%curses.h\fP. +prototyped in +.IR \%curses.h "." .PP .RS 8 .EX +.nf extern int mouse_set(long int); extern int mouse_on(long int); extern int mouse_off(long int); @@ -413,16 +590,18 @@ extern int request_mouse_pos(void); extern int map_button(unsigned long); extern void wmouse_position(WINDOW *, int *, int *); extern unsigned long getmouse(void), getbmap(void); +.fi .EE .RE .bP Its \*(``terminfo\*('' manual page lists capabilities for the feature. -.\" These don't appear in in the SVID 4th edition, Volume 3, +.PP +.\" These don't appear in the SVID 4th edition, Volume 3, .\" terminfo(TI_ENV) man page. They can be found in, e.g., the "z/OS .\" V1R1.0 C Curses" book, Chapter 17, pp. 179-186 (PDF 213-220). .RS 8 .TS -Lb Lb Lb Lx. +Lb Lb Lb Lw(23n)x. buttons btns BT T{ Number of buttons on the mouse T} @@ -449,11 +628,17 @@ about the escape sequences sent to and received from the terminal. For instance, the SVr4 .I curses -library used the \fB\%get_mouse\fP capability to tell the terminal which +library used the +.B \%get_mouse +.RB ( getm ) +capability to tell the terminal which mouse button events it should send, passing the mouse-button bit mask to the terminal. Also, it could ask the terminal -where the mouse was using the \fB\%req_mouse_pos\fP capability. +where the mouse was using the +.B \%req_mouse_pos +.RB ( reqmp ) +capability. .IP Those features required a terminal program that had been modified to work with SVr4 @@ -481,37 +666,54 @@ Mouse events from .I \%xterm are .I not -ignored in cooked mode if they have been enabled by \fB\%mousemask\fP. +ignored in canonical (\*(``cooked\*('') mode +if they have been enabled by +.BR \%mousemask "." Instead, the .I \%xterm mouse report sequence appears in the string read. .PP -Mouse event reports from +An +.I \%ncurses +window must enable \fB\%keypad\fP(3X) to correctly receive mouse event +reports from .I \%xterm -are not detected correctly in a window with keypad application mode -disabled, -since they are interpreted as a variety of function key. +since they are encoded like function keys. Set the terminal's .I \%term\%info -capability \fB\%kmous\fP to \*(``\eE[M\*('' +capability +.B \%key_mouse +.RB ( \%kmous ) +to \*(``\eE[M\*('' (the beginning of the response from .I \%xterm for mouse clicks). -Other values of \fB\%kmous\fP are permitted under the same assumption, +Other values of +.B \%key_mouse +are permitted under the same assumption \(em that is, -the report begins with that sequence. +a mouse report begins with the value of the +.B \%key_mouse +.RB ( \%kmous ) +string capability. .PP Because there are no standard response sequences that serve to identify terminals supporting the .I \%xterm mouse protocol, .I \%ncurses -assumes that if \fB\%kmous\fP is defined in the terminal description, +assumes that if +.B \%key_mouse +.RB ( \%kmous ) +is defined in the terminal description, or if the terminal type's primary name or aliases contain the string \%\*(``xterm\*('', then the terminal may send mouse events. -The \fB\%kmous\fP capability is checked first, +.I \%ncurses +checks the +.B \%kmous +cap-code first, allowing use of newer .I \%xterm mouse protocols, diff --git a/man/curs_move.3x b/man/curs_move.3x index c3b68e813d1c..97e9384f6ce3 100644 --- a/man/curs_move.3x +++ b/man/curs_move.3x @@ -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,23 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_move.3x,v 1.40 2024/04/27 17:56:05 tom Exp $ -.TH curs_move 3X 2024-04-27 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_move.3x,v 1.63 2025/04/05 22:08:55 tom Exp $ +.TH curs_move 3X 2025-04-05 "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 '' "" +.\} +. +.de bP +.ie n .IP \(bu 4 +.el .IP \(bu 2 +.. .SH NAME \fB\%move\fP, \fB\%wmove\fP \- @@ -38,7 +53,7 @@ move cursor in a \fIcurses\fR window \fB#include <curses.h> .PP \fBint move(int \fIy\fP, int \fIx\fP); -\fBint wmove(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP); +\fBint wmove(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP); .fi .SH DESCRIPTION .B \%wmove @@ -57,32 +72,47 @@ The position is relative to the upper left-hand corner of the window, which has coordinates (0,\ 0). -\fB\%ncurses\fP(3X) describes the -.B \%move -variant of this function. +.B move +similarly moves the cursor in the +.B \%stdscr +window. .SH RETURN VALUE These functions return .B OK on success and .B ERR on failure. -.PP -They fail if the position +In +.IR \%ncurses , +these functions fail if +.bP +the +.I curses +screen has not been initialized, +.bP +(for +.BR \%wmove ")" +.I win +is a null pointer, +or +.bP +the position .RI ( y , .IR x ) is outside the window boundaries. -.PP -.B \%wmove -fails if its -.I \%WINDOW -pointer argument is -.BR NULL . .SH NOTES .B \%move may be implemented as a macro. .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. 503 +.SH HISTORY +4BSD (1980) +introduced these functions. .SH SEE ALSO \fB\%curses\fP(3X), \fB\%curs_refresh\fP(3X) diff --git a/man/curs_opaque.3x b/man/curs_opaque.3x index fa623eea1e96..7269598fa2e3 100644 --- a/man/curs_opaque.3x +++ b/man/curs_opaque.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2020-2023,2024 Thomas E. Dickey * +.\" Copyright 2020-2024,2025 Thomas E. Dickey * .\" Copyright 2007-2014,2015 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_opaque.3x,v 1.43 2024/03/16 15:35:01 tom Exp $ -.TH curs_opaque 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_opaque.3x,v 1.50 2025/02/15 19:36:24 tom Exp $ +.TH curs_opaque 3X 2025-02-15 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -136,10 +136,12 @@ returns the delay timeout set by \fB\%wtimeout\fP(3X). .TP \fBwgetparent\fP returns the parent \fI\%WINDOW\fP pointer for subwindows, -or \fBNULL\fP for windows having no parent. +or +.I NULL +for windows having no parent. .TP \fBwgetscrreg\fP -stores the the top and bottom rows for the scrolling margin set by +stores the top and bottom rows for the scrolling margin set by \fB\%wsetscrreg\fP(3X) in the corresponding arguments, returning \fBERR\fP upon failure and \fBOK\fP upon successful completion. @@ -148,11 +150,24 @@ These functions return \fBTRUE\fP or \fBFALSE\fP except as noted. .SH NOTES \fI\%ncurses\fP provides both a C function and a preprocessor macro for each function documented in this page. +.SH EXTENSIONS +These functions originated with +.IR \%ncurses "." .SH PORTABILITY -These routines are specific to \fI\%ncurses\fP. -They were not supported on Version 7, BSD or System V implementations. -It is recommended that any code depending on \fI\%ncurses\fP extensions -be conditioned using \fB\%NCURSES_VERSION\fP. +Applications employing +.I \%ncurses +extensions should condition their use on the visibility of the +.B \%NCURSES_VERSION +preprocessor macro. +.PP +NetBSD +.I curses +since 10.1 (2024) supports +.IR \%wgetscr_reg "." +It also implements +.IR \%getscr_reg "," +operating on +.IR \%stdscr "." .SH SEE ALSO \fB\%curses\fP(3X), \fB\%curs_inopts\fP(3X), diff --git a/man/curs_outopts.3x b/man/curs_outopts.3x index df263f2c1a81..cdf814ef9422 100644 --- a/man/curs_outopts.3x +++ b/man/curs_outopts.3x @@ -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,164 +27,348 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_outopts.3x,v 1.64 2024/04/20 21:24:19 tom Exp $ -.TH curs_outopts 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_outopts.3x,v 1.106 2025/11/12 00:52:57 tom Exp $ +.TH curs_outopts 3X 2025-11-11 "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 '' "" +.\} +. .de bP .ie n .IP \(bu 4 .el .IP \(bu 2 .. .SH NAME \fB\%clearok\fP, -\fB\%idlok\fP, \fB\%idcok\fP, +\fB\%idlok\fP, \fB\%immedok\fP, \fB\%leaveok\fP, +\fB\%scrollok\fP, \fB\%setscrreg\fP, -\fB\%wsetscrreg\fP, -\fB\%scrollok\fP \- +\fB\%wsetscrreg\fP \- set \fIcurses\fR output options .SH SYNOPSIS .nf \fB#include <curses.h> .PP -\fBint clearok(WINDOW *\fIwin\fP, bool \fIbf\fP); -\fBint idlok(WINDOW *\fIwin\fP, bool \fIbf\fP); -\fBvoid idcok(WINDOW *\fIwin\fP, bool \fIbf\fP); -\fBvoid immedok(WINDOW *\fIwin\fP, bool \fIbf\fP); -\fBint leaveok(WINDOW *\fIwin\fP, bool \fIbf\fP); -\fBint scrollok(WINDOW *\fIwin\fP, bool \fIbf\fP); +\fBint clearok(WINDOW * \fIwin\fP, bool \fIbf\fP); +\fBvoid idcok(WINDOW * \fIwin\fP, bool \fIbf\fP); +\fBint idlok(WINDOW * \fIwin\fP, bool \fIbf\fP); +\fBvoid immedok(WINDOW * \fIwin\fP, bool \fIbf\fP); +\fBint leaveok(WINDOW * \fIwin\fP, bool \fIbf\fP); +\fBint scrollok(WINDOW * \fIwin\fP, bool \fIbf\fP); .PP \fBint setscrreg(int \fItop\fP, int \fIbot\fP); -\fBint wsetscrreg(WINDOW *\fIwin\fP, int \fItop\fP, int \fIbot\fP); +\fBint wsetscrreg(WINDOW * \fIwin\fP, int \fItop\fP, int \fIbot\fP); .fi .SH DESCRIPTION -These routines set options that change the style of output within -\fBcurses\fP. -All options are initially \fBFALSE\fP, unless otherwise stated. -It is not necessary to turn these options off before calling \fBendwin\fP(3X). +These functions configure properties of +.I curses +windows that affect their manner of output. +Boolean-valued properties are initially +.B FALSE +except where noted. +\fBendwin\fP(3X) resets any terminal modes corresponding to these +properties; +an application need not restore their initial values. .SS clearok -If \fBclearok\fP is called with \fBTRUE\fP as argument, the next -call to \fBwrefresh\fP with this window will clear the screen completely and -redraw the entire screen from scratch. -This is useful when the contents of the -screen are uncertain, or in some cases for a more pleasing visual effect. +Setting +.IR win 's +.B \%clearok +property to +.B TRUE +causes the next +.B \%wrefresh +call on it to clear the terminal screen and redraw it entirely. +This property is useful to restore the contents of the screen +(perhaps because another process has written to the terminal), +or in some cases to achieve a more pleasing visual effect. If -the \fIwin\fP argument to \fBclearok\fP is the global variable \fBcurscr\fP, -the next call to \fBwrefresh\fP with any window causes the screen to be cleared -and repainted from scratch. -.SS idlok -If \fBidlok\fP is called with \fBTRUE\fP as second argument, \fBcurses\fP -considers using the hardware insert/delete line feature of terminals so -equipped. -Calling \fBidlok\fP with \fBFALSE\fP as second argument disables use -of line insertion and deletion. -This option should be enabled only if the -application needs insert/delete line, for example, for a screen editor. -It is -disabled by default because insert/delete line tends to be visually annoying -when used in applications where it is not really needed. -If insert/delete line -cannot be used, \fBcurses\fP redraws the changed portions of all lines. +.I \%win +is +.B \%curscr +(see \fBcurs_variables\fP(3X)), +the next +.B \%wrefresh +call on +.I any +window causes the terminal screen to clear and redraw as above. +.B \%wrefresh +resets this property to +.BR FALSE "." .SS idcok -If \fBidcok\fP is called with \fBFALSE\fP as second argument, \fBcurses\fP -no longer considers using the hardware insert/delete character feature of -terminals so equipped. -Use of character insert/delete is enabled by default. -Calling \fBidcok\fP with \fBTRUE\fP as second argument re-enables use -of character insertion and deletion. +(This property defaults +.BR TRUE ".)" +Setting +.IR win 's +.B \%idcok +property to +.B FALSE +prevents +.I curses +from using the insert/delete character capabilities of terminal types +possessing them according to the +.I \%term\%info +database. +.SS idlok +Setting +.IR win 's +.B \%idlok +property to +.B TRUE +causes +.I curses +to consider +using the insert/delete line capabilities of terminal types +possessing them according to the +.I \%term\%info +database. +Enable this option +if the application explicitly requires these operations, +as a full-screen text editor might; +otherwise the results may be visually annoying to the user. +.\" TODO: Substantiate that claim. .SS immedok -If \fBimmedok\fP is called with \fBTRUE\fP as second argument, -any change in the window image, -such as the ones caused by \fBwaddch, wclrtobot, wscrl\fP, -etc., automatically causes a call to \fBwrefresh\fP. -However, it may degrade performance considerably, -due to repeated calls to \fBwrefresh\fP. -Calling \fBimmedok\fP with \fBFALSE\fP as second argument +If +.B \%immedok +is called with +.B TRUE +as second argument, +changes to the window image, +such as those caused by +.BR \%waddch "," +.BR \%wclrtobot "," +or +.BR \%wscrl "," +automatically cause a call to +.BR wrefresh "." +Setting a window's +.B \%immedok +property may degrade performance considerably +if writes are frequent. +Calling +.B \%immedok +with +.B FALSE +as second argument restores the default behavior, -i.e., deferring screen updates until a refresh is needed. +deferring screen updates until a refresh is needed +or explicitly directed by the application. .SS leaveok -Normally, the hardware cursor is left at the location of the window cursor -being refreshed. -The \fBleaveok\fP option allows the cursor to be left +Normally, +.I curses +leaves the hardware cursor at the library's cursor location +of the window being refreshed. +The +.B \%leaveok +option allows the cursor to be left wherever the update happens to leave it. -It is useful for applications where -the cursor is not used, since it reduces the need for cursor motions. +It is useful for applications that do not employ a visible cursor, +since it reduces the need for cursor motions. .SS scrollok -The \fBscrollok\fP option controls what happens when the cursor of a window is -moved off the edge of the window or scrolling region, either as a result of a -newline action on the bottom line, or typing the last character of the last -line. -If disabled, (\fIbf\fP is \fBFALSE\fP), the cursor is left on the bottom -line. -If enabled, (\fIbf\fP is \fBTRUE\fP), the window is scrolled up one line -(Note that to get the physical scrolling effect on the terminal, it is -also necessary to call \fBidlok\fP). -.SS "setscrreg, wsetscrreg" -The \fBsetscrreg\fP and \fBwsetscrreg\fP routines allow the application -programmer to set a software scrolling region in a window. -The \fItop\fP and -\fIbot\fP parameters +The +.B \%scrollok +option controls what happens when a window's cursor +moves off the edge of the window or scrolling region, +as a result of either +(1) writing a newline anywhere on its bottom line, +or +(2) writing a character that advances the cursor to the last position +on its bottom line. +If disabled +.RI ( bf +is +.BR FALSE ")," +.I curses +leaves the cursor on the bottom line of the window. +If enabled +.RI ( bf +is +.BR TRUE ")," +.I curses +scrolls the window up one line. +(To get the physical scrolling effect on the terminal, +the application must also enable +.BR idlok ")." +.SS "setscrreg, wsetscrreg" +The +.B \%wsetscrreg +and +.B \%setscrreg +functions allow the application +to set a software scrolling region in the specified window or +.BR \%stdscr "," +respectively. +The +.I top +and +.I bot +parameters are the line numbers of the top and bottom margin of the scrolling region. -(Line 0 is the top line of the window.) If this option and -\fBscrollok\fP are enabled, an attempt to move off the bottom margin line -causes all lines in the scrolling region to scroll one line in the direction -of the first line. +If this option and +.B scrollok +are enabled, +an attempt to move off the bottom margin line +causes all lines in the scrolling region +to scroll one line in the direction of the first line. Only the text of the window is scrolled. -(Note that this -has nothing to do with the use of a physical scrolling region capability in the -terminal, like that in the VT100. -If \fBidlok\fP is enabled and the terminal -has either a scrolling region or insert/delete line capability, they will -probably be used by the output routines.) +(This process has nothing to do +with the scrolling region capability of the terminal, +as found in the DEC VT100.) +If +.B \%idlok +is enabled and the terminal +has either a scrolling region or insert/delete line capability, +they will probably be used by the output routines. .SH RETURN VALUE -The functions \fBsetscrreg\fP and \fBwsetscrreg\fP return \fBOK\fP upon success -and \fBERR\fP upon failure. +The functions +.B \%setscrreg +and +.B \%wsetscrreg +return +.B OK +upon success +and +.B ERR +upon failure. All other routines that return an integer always -return \fBOK\fP. -.PP -X/Open Curses does not specify any error conditions. +return +.BR OK "." .PP -In this implementation, +In +.IR \%ncurses "," +these functions fail if .bP -those functions that have a window pointer -will return an error if the window pointer is null +the +.I curses +screen has not been initialized, .bP -\fBwsetscrreg\fP -returns an error if the scrolling region limits extend outside the -window boundaries. +(for functions taking a +.I \%WINDOW +pointer argument) +.I win +is a null pointer, +or +.bP +(for +.B \%setscrreg +and +.BR \%wsetscrreg ")" +the function is passed arguments describing a scrolling region +with limits that extend outside the window boundaries. .SH NOTES -Note that -\fBclearok\fP, -\fBleaveok\fP, -\fBscrollok\fP, -\fBidcok\fP, and -\fBsetscrreg\fP may be macros. +.BR \%clearok "," +.BR \%leaveok "," +.BR \%scrollok "," +.BR \%idcok "," +and +.B \%setscrreg +may be implemented as macros. +.PP +Unlike the other functions described by this page, +.B \%setscrreg +does not accept a +.RI pointer-to- WINDOW +parameter, +but operates on +.BR stdscr "." +Use +.B \%wsetscrreg +to configure the scrolling region of a selected window. .PP -The \fBimmedok\fP routine is useful for windows that are used as terminal -emulators. +Historically, +applications used +.B \%idcok(FALSE) +to accommodate the \*(``magic cookie\*('' feature +of some terminal types; +see subsection \*(``Highlighting, Underlining, and Visible Bells\*('' +of \fB\%terminfo\fP(5). +When updating a line, +the presence of character cells with magic cookies in them +made the +.I curses +library's computations of characters to be rewritten inaccurate. +A better solution is to indicate the +.B \%magic_cookie_glitch +.RB ( xmc ) +capability in the terminal's type description. +.PP +.B \%immedok +is useful for windows that are used as terminal emulators. .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 -Some historic curses implementations had, as an undocumented feature, the -ability to do the equivalent of \fBclearok(..., 1)\fP by saying -\fBtouchwin(stdscr)\fP or \fBclear(stdscr)\fP. -This will not work under \fI\%ncurses\fP. +Some historic +.I curses +implementations, +as an undocumented feature, +did the equivalent of +.RB \*(`` \%clearok( .\|.\|. ", 1)" \*('' +when +.B \%touchwin(stdstr) +or +.B \%clear(stdstr) +were used. +This trick does not work with +.IR \%ncurses . .PP -Earlier System V curses implementations specified that with \fBscrollok\fP -enabled, any window modification triggering a scroll also forced a physical -refresh. -X/Open Curses does not require this, and \fI\%ncurses\fP avoids doing -it to perform better vertical-motion optimization at \fBwrefresh\fP -time. +Early System\ V +.I curses +implementations specified that with +.I \%scrollok +enabled, +any window modification triggering a scroll +also forced a physical refresh. +X/Open Curses does not require this, +and +.I \%ncurses +avoids doing so to better optimize vertical motions upon a +.IR \%wrefresh "." .PP X/Open Curses does not mention that the cursor should be -made invisible as a side-effect of \fBleaveok\fP. -SVr4 curses documentation does this, but the code does not. -Use \fBcurs_set\fP to make the cursor invisible. +made invisible as a side effect of +.IR \%leaveok "." +SVr4 +.I curses +documentation notes this behavior, +but the code neglects to implement it. +Use \fB\%curs_set\fP(3X) to make the cursor invisible. .SH HISTORY +4BSD (1980) +introduced +.IR \%clearok "," +.IR \%leaveok "," +and +.IR \%scrollok "." +.PP +SVr2 (1984) +supplied +.IR \%idlok "," +.IR \%setscrreg "," +and +.IR \%wsetscrreg "." +.PP +SVr3.1 (1987) +implemented +.I \%idcok +and +.IR \%immedok "." +.PP .I \%ncurses -formerly treated \fBnl\fP(3X) and \fBnonl\fP(3X) as both input +formerly treated +.I nl +and +.I nonl +as both input .I and output options, but no longer; diff --git a/man/curs_overlay.3x b/man/curs_overlay.3x index 2d4eb729bc22..ae40f80b40e7 100644 --- a/man/curs_overlay.3x +++ b/man/curs_overlay.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2020-2023,2024 Thomas E. Dickey * +.\" Copyright 2020-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 * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_overlay.3x,v 1.43 2024/04/20 21:20:07 tom Exp $ -.TH curs_overlay 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_overlay.3x,v 1.55 2025/01/19 00:51:10 tom Exp $ +.TH curs_overlay 3X 2025-01-18 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -40,6 +40,10 @@ .el .ds '' "" .\} . +.de bP +.ie n .IP \(bu 4 +.el .IP \(bu 2 +.. .SH NAME \fB\%overlay\fP, \fB\%overwrite\fP, @@ -74,24 +78,41 @@ If the argument \fIoverlay\fP is \fBtrue\fP, then copying is non-destructive, as in \fBoverlay\fP. .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, -\fBcopywin\fP, -\fBoverlay\fP and \fBoverwrite\fP return an error -if either of the window pointers are null, or -if some part of the window would be placed off-screen. +In +.IR \%ncurses , +they return +.B ERR +if +.bP +either of the window pointers are null, +or +.bP +any part of the window would be placed off-screen. .SH NOTES -Note that \fBoverlay\fP and \fBoverwrite\fP may be macros. +.B \%overlay +and +.B \%overwrite +may be implemented as macros. .SH PORTABILITY -These functions are described in X/Open Curses, Issue 4, -which adds \fI\%const\fP qualifiers to the arguments. +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. +It adds +.I \%const +qualifiers to the arguments. +. \" TODO: migrate to HISTORY section It further specifies their behavior in the presence of characters with multibyte renditions (not yet supported in this implementation). +.\" XXX: stale? ncurses is fine with multibyte characters now, no? +.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. 522 .SH SEE ALSO \fB\%curses\fP(3X), \fB\%curs_pad\fP(3X), diff --git a/man/curs_pad.3x b/man/curs_pad.3x index 21cc405c731b..911b7276c9ea 100644 --- a/man/curs_pad.3x +++ b/man/curs_pad.3x @@ -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_pad.3x,v 1.61 2024/04/27 17:55:43 tom Exp $ -.TH curs_pad 3X 2024-04-27 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_pad.3x,v 1.81 2025/08/23 22:50:00 tom Exp $ +.TH curs_pad 3X 2025-08-23 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -87,7 +87,8 @@ or .B \%pnoutrefresh instead. .SS newpad -\fB\%newpad\fP creates and returns a pointer to a new pad data structure +.B \%newpad +creates and returns a pointer to a new pad data structure with the given number of lines, .IR nlines , and columns, @@ -114,7 +115,7 @@ it is often necessary to call \fB\%touchwin\fP(3X) or before calling .BR \%prefresh . .SS "prefresh, pnoutrefresh" -.B \%prefresh\fP +.B \%prefresh and .B \%pnoutrefresh are analogous to \fB\%wrefresh\fP(3X) and \fB\%wnoutrefresh\fP(3X) @@ -156,7 +157,7 @@ The location of the character written to the pad is used to populate the arguments to .BR \%prefresh . .SS pecho_wchar -.B \%pecho_wchar\fP +.B \%pecho_wchar is functionally equivalent to calling \fB\%wadd_wch\fP(3X) followed by .BR \%prefresh . It suggests to the @@ -168,111 +169,206 @@ The location of the character written to the pad is used to populate the arguments to .BR \%prefresh . .SH RETURN VALUE -Functions that return an integer return \fBERR\fP upon failure and -\fBOK\fP -(SVr4 specifies only -\*(``an integer value other than \fBERR\fP\*('') +Functions that return an integer return +.B ERR +upon failure and +.B OK upon successful completion. .PP -Functions that return pointers return \fBNULL\fP on error, -and set \fB\%errno\fP to \fB\%ENOMEM\fP. +Functions that return pointers return a null pointer on failure, +and set +.I \%errno +to +.BR \%ENOMEM "." .PP -X/Open Curses does not specify any error conditions. In this implementation .RS 3 .TP 5 -\fB\%prefresh\fP and \fB\%pnoutrefresh\fP -return an error +.BR prefresh\ and\ pnoutrefresh +return +.B ERR if the window pointer is null, or if the window is not really a pad or if the area to refresh extends off-screen or if the minimum coordinates are greater than the maximum. .TP 5 -\fBpechochar\fP -returns an error -if the window is not really a pad, and the associated call -to \fB\%wechochar\fP returns an error. +.B pechochar +returns +.B ERR +if the window is not really a pad, +and the associated call to +.B \%wechochar +returns +.BR ERR "." .TP 5 -\fBpecho_wchar\fP -returns an error -if the window is not really a pad, and the associated call -to \fB\%wecho_wchar\fP returns an error. +.B pecho_wchar +returns +.B ERR +if the window is not really a pad, +and the associated call to +.B \%wecho_wchar +returns +.BR ERR "." .RE .SH NOTES -\fB\%pechochar\fP may be a macro. -.SH PORTABILITY -BSD \fIcurses\fP has no \fIpad\fP feature. -.PP -SVr2 \fIcurses\fP (1986) provided the \fB\%newpad\fP and related functions, -documenting them in a single line each. -SVr3 (1987) provided more extensive documentation. +.B \%pechochar +may be implemented as a macro. .PP -The documentation does not explain the term \fIpad\fP. -However, the Apollo \fIAegis\fP workstation operating system -supported a graphical \fIpad\fP feature: +.I curses +documentation is traditionally averse to motivating the term +\*(``pad\*(''. +The Apollo Aegis workstation operating system +.RI ( circa +1981) +supported a graphical pad feature. .bP These graphical pads could be much larger than the computer's display. .bP -The read-only output from a command could be scrolled back to inspect, +The read-only output from a command could be scrolled back to inspect and select text from the pad. .PP The two uses may be related. +.SH PORTABILITY +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. 524 .PP -X/Open Curses, Issue 4 describes these functions, -without significant change from the SVr3 documentation. -It describes no error conditions. -The behavior of \fB\%subpad\fP if the parent window is not -a pad is undocumented, -and is not checked by the vendor Unix implementations: +The behavior of +.I \%subpad +if the parent window is not a pad is undocumented, +and is not checked by the vendor Unix implementations. .bP -SVr4 \fIcurses\fP sets a flag in the \fI\%WINDOW\fP structure in -\fB\%newpad\fP which tells if the window is a \fIpad\fP. +SVr4 +.IR curses 's +.I \%newpad +sets a flag in the +.I \%WINDOW +structure indicating that the window is a pad. .IP -However, it uses this information only in -\fB\%waddch\fP (to decide if it should call \fB\%wrefresh\fP) and -\fB\%wscrl\fP (to avoid scrolling a pad), -and does not check in \fB\%wrefresh\fP to ensure that the pad -is refreshed properly. +However, +it uses this information only in +.I \%waddch +(to decide if it should call +.IR \%wrefresh ")" +and +.I \%wscrl +(to avoid scrolling a pad); +its +.I \%wrefresh +does not check it to ensure that a pad is properly updated. .bP -Solaris \fI\%xcurses\fP checks whether a window is a pad in -\fB\%wnoutrefresh\fP, -returning \fBERR\fP in that case. +Solaris +.I \%xcurses +checks whether a window is a pad in its +.IR \%wnoutrefresh "," +returning +.I ERR +in that case. .IP However, -it only sets the flag for subwindows if the parent window is a pad. -Its \fB\%newpad\fP function does not set this information. -Consequently, the check will never fail. +it sets the flag on subwindows only if the parent window is a pad. +Its +.I \%newpad +does not set this information. +Consequently, +the check never fails. .IP -It makes no comparable check in \fB\%pnoutrefresh\fP, -though interestingly enough, a comment in the source code -states that the lack of a check was an MKS extension. +It makes no comparable check in +.I \%pnoutrefresh +\(em though interestingly enough, +a comment in the source code states that the lack of a check +was an MKS extension. .bP -NetBSD 7 \fIcurses\fP -sets a flag in the \fI\%WINDOW\fP structure -for \fB\%newpad\fP and \fB\%subpad\fP, -using this to help with the distinction between \fB\%wnoutrefresh\fP -and \fB\%pnoutrefresh\fP. +NetBSD\ 7 +.I curses +sets a flag in the +.I \%WINDOW +structure for +.I \%newpad +and +.IR \%subpad "," +aiding itself to distinguish between +.I \%wnoutrefresh +and +.IR \%pnoutrefresh "." .IP It does not check for the case where a subwindow is created in -a pad using \fB\%subwin\fP or \fB\%derwin\fP. +a pad using +.I \%subwin +or +.IR \%derwin "." .IP -The \fB\%dupwin\fP function returns a regular window when duplicating a pad. -Likewise, \fB\%getwin\fP always returns a window, even if the saved -data was from a pad. +Its +.I \%dupwin +returns a regular window when duplicating a pad. +Likewise, +its +.I \%getwin +always returns a window, +even if the saved data was from a pad. .PP -This implementation +.IR \%ncurses ":" .bP -sets a flag in the \fI\%WINDOW\fP structure -for \fB\%newpad\fP and \fB\%subpad\fP, +sets a flag in the +.I \%WINDOW +structure for +.I \%newpad +and +.IR \%subpad "," .bP -allows a \fB\%subwin\fP or \fB\%derwin\fP call to succeed having a pad parent by -forcing the subwindow to be a pad, +allows a +.I \%subwin +or +.I \%derwin +call to succeed having a pad parent +by forcing the subwindow to be a pad, .bP -checks in both \fB\%wnoutrefresh\fP and \fB\%pnoutrefresh\fP to ensure -that pads and windows are handled distinctly, and +checks in both +.I \%wnoutrefresh +and +.I \%pnoutrefresh +to ensure that pads and windows are handled distinctly, +and .bP -ensures that \fB\%dupwin\fP and \fB\%getwin\fP treat -pads versus windows consistently. +ensures that +.I \%dupwin +and +.I \%getwin +treat pads versus windows consistently. +.SH HISTORY +SVr2 (1984) introduced +.IR \%newpad "," +.IR \%prefresh "," +and +.IR \%pnoutrefresh "," +documenting them in a single line each. +.PP +SVr3 (1987) added +.I \%subpad +and +.IR \%pechochar "," +and provided more extensive documentation. +.PP +The System\ V Interface Definition, +Version 4 (1995), +specified a function named +.IR \%pechowchar "." +This was a later addition to +.RI SVr4. x , +not appearing in the first SVr4 (1989). +It differs from X/Open's later +.I \%pecho_wchar +in that its +.I wstr +parameter was a +.I \%chtype +instead of a +.IR \%wchar_t "," +and was not +.IR const "-qualified." .SH SEE ALSO \fB\%curses\fP(3X), \fB\%curs_addch\fP(3X), diff --git a/man/curs_print.3x b/man/curs_print.3x index 3694beffcca1..a87c407209a1 100644 --- a/man/curs_print.3x +++ b/man/curs_print.3x @@ -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_print.3x,v 1.38 2024/03/16 15:35:01 tom Exp $ -.TH curs_print 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_print.3x,v 1.41 2025/02/15 18:42:34 tom Exp $ +.TH curs_print 3X 2025-02-15 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fB\%mcprint\fP \- write binary data to printer using \fIterminfo\fR capabilities @@ -36,54 +36,93 @@ write binary data to printer using \fIterminfo\fR capabilities .nf \fB#include <curses.h> .PP -\fBint mcprint(char *\fIdata\fP, int \fIlen\fP); +\fBint mcprint(char * \fIdata\fP, int \fIlen\fP); .fi .SH DESCRIPTION -This function uses the \fBmc5p\fP or \fBmc4\fP and \fBmc5\fP capabilities, -if they are present, to ship given data to a printer attached to the terminal. +.BR \%mcprint "," +an +.I \%ncurses +extension to the +.I curses +library, +uses the terminal's +.B \%prtr_non +.RB ( mc5p ) +or +.B \%prtr_on +.RB ( mc5 ) +and +.B \%prtr_off +.RB ( mc4 ) +media copy capabilities, +if defined, +to send +.I len +bytes of the given string +.I data +to a printer attached to the terminal. .PP -Note that the \fB\%mcprint\fP code has no way -to do flow control with the printer -or to know how much buffering it has. -Your application is responsible for -keeping the rate of writes to the printer below its continuous throughput rate -(typically about half of its nominal cps rating). +.B \%mcprint +has no means of flow control to the printer +nor of knowing how much buffering it has. +Your application is responsible +for keeping the rate of writes to the printer +below its continuous throughput rate, +typically about half of its nominal characters-per-second (cps) rating. Dot-matrix printers and -6-page-per-minute lasers can typically handle 80cps, so a good conservative -rule of thumb is to sleep for a second after shipping each 80-character line. -. +6-page-per-minute laser printers can typically handle 80 cps, +so a conservative rule of thumb +is to sleep for one second after sending an 80-character line. .SH RETURN VALUE -The \fB\%mcprint\fP function returns \fBERR\fP if the write operation aborted -for some reason. -In this case, \fB\%errno\fP will contain either an error associated -with \fBwrite\fP(2) or one of the following: +On success, +.B \%mcprint +returns the number of characters sent to the printer. +.PP +.B \%mcprint +returns +.B ERR +if the write operation fails for any reason. +In that event, +.B errno +contains either a value set by \fIwrite\fP(2), +or one of the following. .TP 5 \fBENODEV\fP -Capabilities for printer redirection do not exist. +The terminal lacks relevant media copy capabilities. .TP 5 \fBENOMEM\fP -Couldn't allocate sufficient memory to buffer the printer write. -.PP -When \fB\%mcprint\fP succeeds, it returns the number of characters actually -sent to the printer. +.I \%ncurses +could not allocate sufficient memory to buffer the write operation. .SH EXTENSIONS -\fB\%mcprint\fP was designed for -\fB\%ncurses\fP(3X), -and was not found in SVr4 -.IR curses , +.B \%mcprint +is an \fB\%ncurses\fP(3X) extension, +and is not found in SVr4 +.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 this .I \%ncurses extension should condition its use on the visibility of the .B \%NCURSES_VERSION preprocessor macro. +.SH HISTORY +.I \%ncurses +introduced +.I \%mcprint +prior to version 1.9.9g (1996). .SH BUGS Padding in the -\fBmc5p\fP, -\fBmc4\fP, and -\fBmc5\fP capabilities is not interpreted. +.B \%prtr_non +.RB ( mc5p ), +.B \%prtr_on +.RB ( mc5 ), +and +.B \%prtr_off +.RB ( mc4 ) +capabilities is not interpreted. .SH SEE ALSO \fB\%curses\fP(3X) diff --git a/man/curs_printw.3x b/man/curs_printw.3x index 282536b363e0..906be3b842cf 100644 --- a/man/curs_printw.3x +++ b/man/curs_printw.3x @@ -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_printw.3x,v 1.53 2024/04/20 19:18:18 tom Exp $ -.TH curs_printw 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_printw.3x,v 1.65 2025/08/16 19:59:33 tom Exp $ +.TH curs_printw 3X 2025-08-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -118,8 +118,7 @@ To format and write a wide-character string to a window, consider using \fI\%swprintf\fP(3) and \fB\%waddwstr\fP(3X) or similar. .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 .I \%ncurses @@ -128,75 +127,135 @@ legacy applications. However, the latter is obsolete. .bP -X/Open Curses, -Issue 4 Version 2 (1996), +X/Open Curses Issue\ 4 Version\ 2 (1996), marked \fB\%vwprintw\fP as requiring \fI\%varargs.h\fP and \*(``TO BE WITHDRAWN\*('', and specified \fB\%vw_printw\fP using the \fI\%stdarg.h\fP interface. .bP -X/Open Curses, Issue 5, Draft 2 +X/Open Curses Issue\ 5, Draft 2 (December 2007) marked \fBvwprintw\fP (along with \fBvwscanw\fP and the \fItermcap\fP interface) as withdrawn. After incorporating review comments, this became -X/Open Curses, Issue 7 (2009). +X/Open Curses Issue\ 7 (2009). .bP .I \%ncurses provides \fB\%vwprintw\fP, but marks it as deprecated. .SH HISTORY -While \fB\%printw\fP was implemented in 4BSD -(November 1980), +4BSD (1980) +introduced +.I \%wprintw +and its variants. .\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4BSD/usr/src/lib/\ .\" libcurses/printw.c -it was unused until 4.2BSD -(August 1983), -which employed it for games. -That early version of +.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4BSD/usr/src/lib/\ +.\" libcurses/mvprintw.c +It implemented all as functions, +not macros; +this initial distribution of .I curses -preceded the ANSI C standard of 1989. -It did not use \fI\%varargs.h\fP, -though that had been available since Seventh Edition Unix (1979). +preceded the ANSI C standard of 1989, +prior to which a variadic macro facility was not widely available +in the language. +.I \%printw +went unused in Berkeley distributions until 4.1cBSD (1983), +which employed it in games. +.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.1cBSD/usr/src/\ +.\" games/canfield.c +.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.1cBSD/usr/src/\ +.\" games/worm.c +4BSD's +.I \%wprintw +did not use +.IR \%varargs.h "," +which had been available since Seventh Edition Unix (1979). .\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/include/\ .\" varargs.h In 1991 (a couple of years after SVr4 was generally available, and after the C standard was published), other developers updated the library, -using \fI\%stdarg.h\fP internally in 4.4BSD +using +.I \%stdarg.h +internally in 4.4BSD .IR curses . Even with this improvement, BSD .I curses did not use function prototypes (nor even declare functions) -in \fI\%curses.h\fP until 1992. +in +.I \%curses.h +until 1992. .PP -SVr2 (1984) documented \fB\%printw\fP and \fB\%wprintw\fP tersely as -\*(``printf on \fB\%stdscr\fP\*('' and -\*(``printf on \fIwin\fP\*('', +4BSD documented +.I \%printw +and +.I \%wprintw +tersely as \*(``printf on +.IR \%stdscr "\*(''" +and \*(``printf on +.IR win "\*(''," respectively. +.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4BSD/usr/man/man3/\ +.\" curses.3 +.PP +SVr3 summarized the functions in three lines, +asserting that they were analogous to \fI\%printf\fP(3) +and explaining that the string that \fI\%printf\fP(3) would write to the +standard output stream would instead be output using +.I \%waddstr +to the given window. +.\" GBR can't find a source to cite for this paraphrase, +.\" even after checking +.\" <https://github.com/ryanwoodsmall/oldsysv/tree/master>. +.\" +.\" The indicated paraphrase is from page 432: +.\" Unix System V Programmer's Reference Manual +.\" Prentice-Hall +.\" ISBN 0-13-940479-1 +.\" (bitsavers has 3rd printing from 1987) +.\" +.\" This lists mvprintw without detail, and printw as "printf on stdscr": +.\" Unix Programmer's Manual +.\" System Calls and Library Routines +.\" CBS College Publishing's UNIX System Library +.\" Holt, Rinehard and Winston, 1986 +.\" ISBN 0-03-009314-7 .PP -SVr3 (1987) added \fB\%mvprintw\fP and \fB\%mvwprintw\fP, -with a three-line summary asserting that they were analogous to -\fI\%printf\fP(3), -explaining that the string that \fI\%printf\fP(3) would write to the -standard output stream would instead be output using \fB\%waddstr\fP to -the given window. -SVr3 also implemented \fB\%vwprintw\fP, -describing its third parameter as a \fI\%va_list\fP, -defined in \fI\%varargs.h\fP, -and referred the reader to the manual pages for \fI\%varargs\fP and -\fI\%vprintf\fP for detailed descriptions. +SVr3 added +.IR \%vwprintw "," +describing its third parameter as a +.IR \%va_list "," +defined in +.IR \%varargs.h "," +and referred the reader to the manual pages for +.I \%varargs +and +.I \%vprintf +for detailed descriptions. .PP -SVr4 (1989) introduced no new variations of \fI\%printw\fP, -but provided for using either \fI\%varargs.h\fP or \fI\%stdarg.h\fP to -define the \fI\%va_list\fP type. +SVr4 (1989) introduced no new variations of +.IR \%printw "," +but provided for using either +.I \%varargs.h +or +.I \%stdarg.h +to define the +.I \%va_list +type. .\" either header declares "va_list", but only one can be used .PP -X/Open Curses, Issue 4 (1995), -defined \fB\%vw_printw\fP to replace \fB\%vwprintw\fP, -stating that its \fI\%va_list\fP type is defined in \fI\%stdarg.h\fP. +X/Open Curses Issue\ 4 (1995), +defined +.I \%vw_printw +to replace +.IR \%vwprintw "," +stating that its +.I \%va_list +type is defined in +.IR \%stdarg.h "." .SH SEE ALSO \fB\%curses\fP(3X), \fB\%curs_addstr\fP(3X), diff --git a/man/curs_refresh.3x b/man/curs_refresh.3x index ac81d1e6393e..37fd5f19f17b 100644 --- a/man/curs_refresh.3x +++ b/man/curs_refresh.3x @@ -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_refresh.3x,v 1.46 2024/04/20 21:20:07 tom Exp $ -.TH curs_refresh 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_refresh.3x,v 1.58 2025/01/19 00:51:10 tom Exp $ +.TH curs_refresh 3X 2025-01-18 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -129,27 +129,34 @@ It touches the indicated lines (marking them changed). The routine \fBredrawwin\fP touches the entire window. .SH RETURN VALUE These routines return the integer \fBERR\fP upon failure and \fBOK\fP -(SVr4 specifies only -\*(``an integer value other than \fBERR\fP\*('') -upon successful completion. .PP -X/Open Curses does not specify any error conditions. In this implementation .RS 3 .TP 5 \fBwnoutrefresh\fP -returns an error +returns +.B ERR if the window pointer is null, or if the window is really a pad. .TP 5 \fBwredrawln\fP -returns an error -if the associated call to \fBtouchln\fP returns an error. +return +.B ERR +if the associated call to \fBtouchln\fP returns +.BR ERR "." .RE .SH NOTES -Note that \fBrefresh\fP and \fBredrawwin\fP may be macros. +.B \%refresh +and +.B \%redrawwin +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. 527 .PP Whether \fBwnoutrefresh\fP copies to the virtual screen the entire contents of a window or just its changed portions has never been well-documented in @@ -161,5 +168,5 @@ Instead, you can do an explicit \fBtouchwin\fP before the \fBwnoutrefresh\fP call to guarantee an entire-contents copy anywhere. .SH SEE ALSO \fB\%curses\fP(3X), -\fB\%curs_outopts\fP(3X) +\fB\%curs_outopts\fP(3X), \fB\%curs_variables\fP(3X) diff --git a/man/curs_scanw.3x b/man/curs_scanw.3x index 409c297fb233..afdc1c4a8aac 100644 --- a/man/curs_scanw.3x +++ b/man/curs_scanw.3x @@ -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_scanw.3x,v 1.53 2024/04/20 19:18:18 tom Exp $ -.TH curs_scanw 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_scanw.3x,v 1.62 2025/07/05 13:03:05 tom Exp $ +.TH curs_scanw 3X 2025-07-05 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -126,8 +126,7 @@ respectively. implements \fI\%vsscanf\fP(3) internally if it is unavailable when the library is configured. .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 .I \%ncurses @@ -136,19 +135,17 @@ legacy applications. However, the latter is obsolete. .bP -X/Open Curses, -Issue 4 Version 2 (1996), +X/Open Curses Issue\ 4 Version\ 2 (1996), marked \fB\%vwscanw\fP as requiring \fI\%varargs.h\fP and \*(``TO BE WITHDRAWN\*('', and specified \fB\%vw_scanw\fP using the \fI\%stdarg.h\fP interface. .bP -X/Open Curses, -Issue 5, +X/Open Curses Issue\ 5, Draft 2 (December 2007) marked \fB\%vwscanw\fP (along with \fB\%vwscanw\fP and the \fItermcap\fP interface) as withdrawn. After incorporating review comments, this became -X/Open Curses, Issue 7 (2009). +X/Open Curses Issue\ 7 (2009). .bP .I \%ncurses provides \fB\%vwscanw\fP, @@ -188,65 +185,111 @@ conversion at the end of the format string, and check the value of the corresponding variable to determine how many conversions succeeded. .SH HISTORY -\fB\%scanw\fP was implemented in 4BSD -(November 1980); +4BSD (1980) +introduced +.I \%wscanw +and its variants. .\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4BSD/usr/src/lib/\ .\" libcurses/scanw.c -that early version of +.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4BSD/usr/src/lib/\ +.\" libcurses/mvscanw.c +It implemented all as functions, +not macros; +this initial distribution of .I curses -preceded the ANSI C standard of 1989. -The function was unused in Berkeley distributions for over ten years, -until 4.4BSD, +preceded the ANSI C standard of 1989, +prior to which a variadic macro facility was not widely available. +.I \%scanw +went unused in Berkeley distributions until 4.3BSD-Reno (1990), which employed it in a game. -The 4BSD \fB\%scanw\fP did not use \fI\%varargs.h\fP, -though that had been available since Seventh Edition Unix (1979). +.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.3BSD-Reno/src/\ +.\" games/chess/uxdsp.c +4BSD's +.I \%wscanw +did not use +.IR \%varargs.h "," +which had been available since Seventh Edition Unix (1979). .\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/include/\ .\" varargs.h In 1991 (a couple of years after SVr4 was generally available, and after the C standard was published), other developers updated the library, -using \fI\%stdarg.h\fP internally in 4.4BSD +using +.I \%stdarg.h +internally in 4.4BSD .IR curses . Even with this improvement, BSD .I curses did not use function prototypes (nor even declare functions) -in \fI\%curses.h\fP until 1992. +in +.I \%curses.h +until 1992. .PP -SVr2 (1984) documented \fB\%scanw\fP and \fB\%wscanw\fP tersely as -\*(``scanf through \fB\%stdscr\fP\*('' and -\*(``scanf through \fIwin\fP\*('', +4BSD documented +.I \%scanw +and +.I \%wscanw +tersely as \*(``scanf through +.IR \%stdscr "\*(''" +and \*(``scanf through +.IR win "\*(''," respectively. -.PP -SVr3 (1987) added -\fB\%mvscanw\fP, and -\fB\%mvwscanw\fP, stating +.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4BSD/usr/man/man3/\ +.\" curses.3 +SVr3 (1987) +stated .RS .PP -\*(``[t]hese routines correspond to \fIscanf\fP(3S), +[t]hese routines correspond to \fIscanf\fP(3S), as do their arguments and return values. -\fB\%wgetstr\fP() is called on the window, -and the resulting line is used as input for the scan.\*('' +.IR \%wgetstr "()" +is called on the window, +and the resulting line is used as input for the scan. .RE +.\" GBR can't find a source to cite for this quotation, +.\" even after checking +.\" <https://github.com/ryanwoodsmall/oldsysv/tree/master>. .PP -SVr3 also implemented \fB\%vwscanw\fP, -describing its third parameter as a \fI\%va_list\fP, -defined in \fI\%varargs.h\fP, -and referred the reader to the manual pages for \fI\%varargs\fP and -\fI\%vprintf\fP for detailed descriptions. -(Because the SVr3 documentation does not mention \fI\%vscanf\fP, -the reference to \fI\%vprintf\fP might not be an error). +SVr3 added +.IR \%vwscanw "," +describing its third parameter as a +.IR \%va_list "," +defined in +.IR \%varargs.h "," +and referred the reader to the manual pages for +.I \%varargs +and +.I \%vprintf +for detailed descriptions. +(Because SVr3 documentation does not mention +.IR \%vscanf "," +the reference to +.I \%vprintf +might not be an error). .PP -SVr4 (1989) introduced no new variations of \fI\%scanw\fP, -but provided for using either \fI\%varargs.h\fP or \fI\%stdarg.h\fP to -define the \fI\%va_list\fP type. +SVr4 (1989) introduced no new variations of +.IR \%scanw "," +but provided for using either +.I \%varargs.h +or +.I \%stdarg.h +to define the +.I \%va_list +type. .\" either header declares "va_list", but only one can be used .PP -X/Open Curses, Issue 4 (1995), -defined \fI\%vw_scanw\fP to replace \fI\%vwscanw\fP, -stating that its \fI\%va_list\fP type is defined in \fI\%stdarg.h\fP. +X/Open Curses Issue\ 4 (1995) +defined +.I \%vw_scanw +to replace +.IR \%vwscanw "," +stating that its +.I \%va_list +type is defined in +.IR \%stdarg.h "." .SH SEE ALSO \fB\%curses\fP(3X), \fB\%curs_getstr\fP(3X), diff --git a/man/curs_scr_dump.3x b/man/curs_scr_dump.3x index 5f14a2287268..0cb7215d7bd6 100644 --- a/man/curs_scr_dump.3x +++ b/man/curs_scr_dump.3x @@ -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_scr_dump.3x,v 1.43 2024/04/20 18:54:36 tom Exp $ -.TH curs_scr_dump 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_scr_dump.3x,v 1.55 2025/01/19 00:51:10 tom Exp $ +.TH curs_scr_dump 3X 2025-01-18 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -54,10 +54,10 @@ read/write a \fIcurses\fR screen from/to a file .nf \fB#include <curses.h> .PP -\fBint scr_dump(const char *\fIfilename\fP); -\fBint scr_restore(const char *\fIfilename\fP); -\fBint scr_init(const char *\fIfilename\fP); -\fBint scr_set(const char *\fIfilename\fP); +\fBint scr_dump(const char * \fIfilename\fP); +\fBint scr_restore(const char * \fIfilename\fP); +\fBint scr_init(const char * \fIfilename\fP); +\fBint scr_set(const char * \fIfilename\fP); .fi .SH DESCRIPTION .I curses @@ -70,83 +70,183 @@ use \fB\%getwin\fP(3X) and \fB\%putwin\fP(3X), respectively. .SS scr_dump -\fB\%scr_dump\fP writes to +.B \%scr_dump +writes to .I filename the contents of the virtual screen; see \fB\%curscr\fP(3X). .SS scr_restore -\fB\%scr_restore\fP updates the virtual screen to contain the contents -of +.B \%scr_restore +updates the virtual screen to match the contents of .I filename -(if it was validly written with \fB\%scr_dump\fP). -No refresh is performed; -after performing any further desired updates, +(if validly written with +.BR \%scr_dump ")." +.I curses +does not perform a refresh; +after making any desired changes, call \fB\%doupdate\fP(3X) or similar. .SS scr_init -\fB\%scr_init\fP reads -.IR filename , +.B \%scr_init +reads +.IR filename "," using it to initialize .I curses data structures describing the state of the terminal screen. -If these data are valid, .I curses +then, +if it decides the terminal state is valid, bases its next update of the screen on this information rather than clearing it and starting from scratch. .PP -The data fail the validity check +.I curses +regards the terminal as in an invalid state for computation of updates +based on the contents of +.I filename +if +.bP +.I curses +knows that the terminal has been written to since the preceding +.B \%scr_dump +call, +or .bP -if the terminal employs +the terminal type supports the .I \%term\%info capabilities .B \%exit_ca_mode -.RB ( \%rmcup ) +.RB \%( rmcup ) or .B \%non_rev_rmcup -.RB ( \%nrrmc ) -are defined, -or -.bP -if +.RB \%( nrrmc ). +.PP +Either of the foregoing conditions means that .I curses -knows that the terminal has been written to since the preceding -\fB\%scr_dump\fP call. +cannot assume that the terminal's contents +match their representation in +.IR filename "." +The former is due to terminal features +(such as \fI\%xterm\fP(1)'s \*(``alternate screen\*('') +that couple cursor-positioning mode with a local cache of screen +contents. +.I curses +cannot know whether the terminal is displaying from that local cache +at the time the application calls +.BR \%scr_init "," +so it makes a pessimistic assumption that a full redraw is required; +see subsection \*(``Cursor Motions\*('' of \fB\%terminfo\fP(5). .PP -\fB\%scr_init\fP could be used after \fB\%initscr\fP(3X) or -\fB\%system\fP(3) to share the screen with another process that has -done a \fBscr_dump\fP after \fB\%endwin\fP(3X). +.B \%scr_init +could be used after \fB\%initscr\fP(3X) or \fI\%system\fP(3) to share +the screen with another process that has done a +.B \%scr_dump +after \fB\%endwin\fP(3X). +An application that supports suspending its state on exit and subsequent +resumption upon later execution might use +.B \%scr_dump +and +.B \%scr_init +thus. .SS scr_set -The \fBscr_set\fP routine is a combination of \fBscr_restore\fP and -\fBscr_init\fP. It tells the program that the information in \fIfilename\fP is -what is currently on the screen, and also what the program wants on the screen. -This can be thought of as a screen inheritance function. +.B \%scr_set +combines +.B \%scr_restore +and +.BR \%scr_init "," +synchronizing the contents of +.I filename +with the virtual screen. +It can be regarded as a screen inheritance function; +consider a real-time screen-sharing application. .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 -X/Open defines no failure conditions. -In this implementation, -each function fails if it cannot open -.IR filename . +In +.IR \%ncurses "," +each function returns +.B ERR +if it cannot open +.IR filename "." +.BR \%scr_init "," +.BR \%scr_restore "," +and +.B \%scr_set +return +.B ERR +if the contents of +.I filename +are invalid. .SH NOTES -\fB\%scr_init\fP, -\fB\%scr_set\fP, +.BR \%scr_init "," +.BR \%scr_restore "," and -\fB\%scr_restore\fP may be macros. +.B \%scr_set +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. +.\" Unusually, SVID 4 explicitly indicated "OK" as a possible return +.\" value, rather than the "integer other than ERR" refrain (p. 529). .PP .\" SVID 4, p. 529 SVr4 omitted the .I \%const qualifiers. .PP -SVr4 documentation describes \fB\%scr_init\fP such that the dump data is -also considered invalid \*(``if the time-stamp of the tty is old\*('' +SVr4 documentation describes +.I \%scr_init +such that the dump data is also considered invalid +\*(``if the time-stamp of the tty is old\*('' but does not define \*(``old\*(''. +.PP +As of 2024, +.I \%PDCurses +provides these functions. +NetBSD +.I curses +does not. +.PP +Other implementations of +.I curses +store the window in binary form, +which makes the dump dependent +upon the +.I curses +library's internal data structures. +.I \%ncurses +avoids this drawback by storing the dump in textual form, +allowing more flexible use of the data. +For instance, +the +.I \%scr_restore +of SVr4 +.I curses +requires that the dumped window have the same dimensions +as the restored window. +.I \%ncurses +uses its +\fB\%wresize\fP(3X) +extension +to adjust the restored window size. +.SH HISTORY +SVr3 (1987) introduced +.IR \%scr_dump "," +.IR \%scr_init "," +and +.IR \%scr_restore "." +SVr3.1 added +.IR \%scr_set "." .SH SEE ALSO +.na \fB\%curses\fP(3X), \fB\%curs_initscr\fP(3X), \fB\%curs_refresh\fP(3X), \fB\%curs_util\fP(3X), \fB\%system\fP(3), -\fB\%scr_dump\fP(5) +\fB\%scr_dump\fP(5), +\fB\%terminfo\fP(5), +\fB\%wresize\fP(3X) +.ad diff --git a/man/curs_scroll.3x b/man/curs_scroll.3x index 16d5a501094f..aa9fdb8e4f54 100644 --- a/man/curs_scroll.3x +++ b/man/curs_scroll.3x @@ -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_scroll.3x,v 1.43 2024/04/20 18:54:36 tom Exp $ -.TH curs_scroll 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_scroll.3x,v 1.59 2025/04/05 22:20:39 tom Exp $ +.TH curs_scroll 3X 2025-04-05 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -48,43 +48,59 @@ \fB\%scroll\fP, \fB\%scrl\fP, \fB\%wscrl\fP \- -scroll a \fIcurses\fR window +scroll a \fIcurses\fP window .SH SYNOPSIS .nf \fB#include <curses.h> .PP -\fBint scroll(WINDOW *\fIwin\fP); +\fBint scroll(WINDOW * \fIwin\fP); .PP \fBint scrl(int \fIn\fP); -\fBint wscrl(WINDOW *\fIwin\fP, int \fIn\fP); +\fBint wscrl(WINDOW * \fIwin\fP, int \fIn\fP); .fi .SH DESCRIPTION -\fBscroll\fP scrolls the given window up one line. +.B scroll +scrolls the given window up one line. That is, every visible line we might number .I i becomes line .IR i "\-1." -The text of the top line in the window disappears and the bottom line -is populated with blank characters; -see \fB\%bkgd\fP(3X) or \fB\%bkgrnd\fP(3X). -As an optimization, -if the scrolling region of the window is the entire screen, -the physical screen may be scrolled at the same time; -see \fB\%curscr\fP(3X). -.PP -\fB\%scrl\fP and \fB\%wscrl\fP scroll -.B \%stdscr -or the specified window up or down depending on the sign of -.IR n . +.B \%wscrl +and +.B \%scrl +scroll the specified window or +.BR \%stdscr "," +respectively, +up or down per the sign of +.IR n "." .bP For positive -.IR n , -line \fIi\fP+\fIn\fP becomes \fIi\fP (scrolling up); +.IR n "," +line +.IR i + n +becomes +.I i +(scrolling up); .bP for negative -.IR n , -line \fIi\fP-\fIn\fP becomes \fIi\fP (scrolling down). +.IR n "," +line +.IR i \- n +becomes +.I i +(scrolling down). +.PP +A line that scrolls beyond the window boundaries disappears; +.I curses +populates a new one emerging at the opposite boundary +with the background character; +see \fB\%bkgd\fP(3X) +(wide-character API users: \fB\%bkgrnd\fP(3X)). +As an optimization, +if the scrolling region of the window is the entire screen, +the physical screen may be scrolled at the same time; +see \fB\%curscr\fP(3X). .PP The cursor does not move. These functions perform no operation unless scrolling is enabled for the @@ -96,42 +112,79 @@ upon failure and .B OK upon success. .PP -.I \%ncurses -returns \fBERR\fP if scrolling is not enabled in the window, -for example with \fB\%scrollok\fP(3X), -or if the +In +.IR \%ncurses "," +they return +.B ERR +if +.bP +the +.I curses +screen has not been initialized, +.bP +(for functions taking a .I \%WINDOW -pointer is null. +pointer argument) +.I win +is a null pointer, +or +.bP +scrolling is not enabled in the window +(as by \fB\%scrollok\fP(3X)). .SH NOTES -Unusually, -there is no \fB\%wscroll\fP function; -\fBscroll\fP behaves as one would expect \fB\%wscroll\fP to, -accepting a \fI\%WINDOW\fP pointer argument. +.B \%scroll +and +.B \%scrl +may be implemented as macros. .PP -\fB\%scrl\fP and \fB\%scroll\fP may be implemented as macros. +Unusually, +there is no +.B \%wscroll +function; +.B scroll +behaves as one would expect +.B \%wscroll +to, +accepting a +.I \%WINDOW +pointer argument. .SH PORTABILITY -X/Open Curses, -Issue 4 describes these functions. -It defines no error conditions. +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. .PP -SVr4 specifies only -\*(``an integer value other than \fBERR\fP\*('' as a successful return -value. +SVr4 describes a successful return value only as +\*(``an integer value other than +.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 531 .PP SVr4 indicates that the optimization of physically scrolling immediately if the scroll region is the entire screen \*(``is\*('' performed, not \*(``may be\*('' performed. .I \%ncurses -deliberately does not guarantee that this will occur, -to leave open the possibility of smarter optimization of multiple scroll +deliberately does not guarantee that this occurs, +to leave open the possibility of better optimization of multiple scroll actions on the next update. .PP Neither SVr4 .I curses -nor X/Open Curses specify whether the current attribute or current color -pair of blanks generated by the scroll function are zeroed. -.I \%ncurses -does so. +nor X/Open Curses specify whether these functions zero the attributes or +color pair identifier of the background character. +In +.IR \%ncurses "," +they do not. +.SH HISTORY +4BSD (1980) +introduced +.IR scroll "," +defining it as a function. +.PP +SVr3.1 (1987) +added +.I \%scrl +and +.IR \%wscrl "," +redefining +.I \%scroll +as a macro wrapping the latter. .SH SEE ALSO \fB\%curses\fP(3X), \fB\%curs_outopts\fP(3X) diff --git a/man/curs_slk.3x b/man/curs_slk.3x index fbc718115434..f22f48aeb0f5 100644 --- a/man/curs_slk.3x +++ b/man/curs_slk.3x @@ -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_slk.3x,v 1.71 2024/04/20 18:54:36 tom Exp $ -.TH curs_slk 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_slk.3x,v 1.85 2025/01/19 00:51:10 tom Exp $ +.TH curs_slk 3X 2025-01-18 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -135,9 +135,9 @@ helping the user to associate each label with its numbered function key. \fBLINES\fP and the vertical size of \fB\%stdscr\fP are further reduced. .SS Labels Populate the labels with normal strings -(\fB\%slk_set\fP) +\%(\fBslk_set\fP) or wide-character strings -(\fB\%slk_wset\fP). +\%(\fBslk_wset\fP). Each function takes three parameters. .TP 8 \" "labnum" + 2n .I labnum @@ -213,47 +213,54 @@ this implementation provides \fB\%extended_slk_color\fP, which accepts an \fIint\fP value of at least 32 bits. .SH RETURN VALUE -Routines that return an integer return \fBERR\fP upon failure and -\fBOK\fP -(SVr4 specifies only -\*(``an integer value other than \fBERR\fP\*('') -upon successful completion. +Functions that return integers return +.B ERR +upon failure and +.B OK +upon success. .PP -X/Open Curses defines no error conditions. -.PP -In this implementation +In +.IR \%ncurses "," .RS 3 .TP 5 \fBslk_attr\fP returns the attribute used for the soft keys. .TP 5 \fBslk_attroff\fP, \fBslk_attron\fP, \fBslk_clear\fP, \fBslk_noutrefresh\fP, \fBslk_refresh\fP, \fBslk_touch\fP -return an error +return +.B ERR if the terminal or the softkeys were not initialized. .TP 5 \fBslk_attrset\fP -returns an error +returns +.B ERR if the terminal or the softkeys were not initialized. .TP 5 \fBslk_attr_set\fP -returns an error +returns +.B ERR if the terminal or the softkeys were not initialized, or the color pair is outside the range 0..\fBCOLOR_PAIRS\fP\-1. .TP 5 \fBslk_color\fP -returns an error +returns +.B ERR if the terminal or the softkeys were not initialized, or the color pair is outside the range 0..\fBCOLOR_PAIRS\fP\-1. .TP 5 \fBslk_init\fP -returns an error +returns +.B ERR if the format parameter is outside the range 0..3. .TP 5 \fBslk_label\fP -returns \fBNULL\fP on error. +returns +.I NULL +on error. .TP 5 \fBslk_set\fP -returns an error +returns +.B ERR if the terminal or the softkeys were not initialized, or the \fIlabnum\fP parameter is outside the range of label counts, or if the format parameter is outside the range 0..2, or if @@ -263,12 +270,15 @@ memory for the labels cannot be allocated. Most applications would use \fB\%slk_noutrefresh\fP because a \fB\%wrefresh\fP is likely to follow soon. .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 +for the functions that accept a color pair parameter +to support extended color pairs. .PP For functions which modify the color, e.g., @@ -277,9 +287,12 @@ if \fIopts\fP is set it is treated as a pointer to \fIint\fP, and used to set the color pair instead of the \fIshort\fP pair parameter. .SH PORTABILITY -X/Open Curses, -Issue 4 describes these functions, -with some differences from SVr4 \fIcurses\fP: +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. 533 .bP X/Open added functions like the SVr4 attribute-manipulation functions \fB\%slk_attron\fP, @@ -332,11 +345,13 @@ Finally, if there is no \fBfln\fP capability, If \fB\%slk_start\fP is given a non-null \fIgp\fP, it copies the \fIng\fP elements of the group of soft-keys, up to 16. .IP -If there are more than 16 elements, \fB\%slk_start\fP returns an error. +If there are more than 16 elements, \fB\%slk_start\fP returns +.BR ERR "." .bP The format codes \fB2\fP and \fB3\fP for \fB\%slk_init\fP were added by \fI\%ncurses\fP in 1996. -PDCurses 2.4 added this feature in 2001. +.I \%PDCurses +2.4 added this feature in 2001. .PP The function \fB\%slk_attr\fP was added by \fI\%ncurses\fP in 1996. .PP diff --git a/man/curs_sp_funcs.3x b/man/curs_sp_funcs.3x index e58a48e3caea..1e0f22408ae6 100644 --- a/man/curs_sp_funcs.3x +++ b/man/curs_sp_funcs.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 2010-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_sp_funcs.3x,v 1.50 2024/04/20 18:56:31 tom Exp $ -.TH curs_sp_funcs 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_sp_funcs.3x,v 1.57 2025/02/01 22:47:44 tom Exp $ +.TH curs_sp_funcs 3X 2025-02-01 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -46,169 +46,169 @@ .nf \fB#include <curses.h> .PP -\fBint alloc_pair_sp(SCREEN* \fIsp\fP, int \fIfg\fP, int \fIbg\fP); -\fBint assume_default_colors_sp(SCREEN* \fIsp\fP, int \fIfg\fP, int \fIbg\fP); -\fBint baudrate_sp(SCREEN* \fIsp\fP); -\fBint beep_sp(SCREEN* \fIsp\fP); -\fBbool can_change_color_sp(SCREEN* \fIsp\fP); -\fBint cbreak_sp(SCREEN* \fIsp\fP); -\fBint color_content_sp(SCREEN* \fIsp\fP, short \fIcolor\fP, short* \fIr\fP, short* \fIg\fP, short* \fIb\fP); -\fBint curs_set_sp(SCREEN* \fIsp\fP, int \fIvisibility\fP); -\fBint def_prog_mode_sp(SCREEN* \fIsp\fP); -\fBint def_shell_mode_sp(SCREEN* \fIsp\fP); +\fBint alloc_pair_sp(SCREEN * \fIsp\fP, int \fIfg\fP, int \fIbg\fP); +\fBint assume_default_colors_sp(SCREEN * \fIsp\fP, int \fIfg\fP, int \fIbg\fP); +\fBint baudrate_sp(SCREEN * \fIsp\fP); +\fBint beep_sp(SCREEN * \fIsp\fP); +\fBbool can_change_color_sp(SCREEN * \fIsp\fP); +\fBint cbreak_sp(SCREEN * \fIsp\fP); +\fBint color_content_sp(SCREEN * \fIsp\fP, short \fIcolor\fP, short * \fIr\fP, short * \fIg\fP, short * \fIb\fP); +\fBint curs_set_sp(SCREEN * \fIsp\fP, int \fIvisibility\fP); +\fBint def_prog_mode_sp(SCREEN * \fIsp\fP); +\fBint def_shell_mode_sp(SCREEN * \fIsp\fP); .PP -\fBint define_key_sp(SCREEN* \fIsp\fP, const char * \fIdefinition\fP, int \fIkeycode\fP); -\fBint delay_output_sp(SCREEN* \fIsp\fP, int \fIms\fP); -\fBint doupdate_sp(SCREEN* \fIsp\fP); -\fBint echo_sp(SCREEN* \fIsp\fP); -\fBint endwin_sp(SCREEN* \fIsp\fP); -\fBchar erasechar_sp(SCREEN* \fIsp\fP); -\fBint erasewchar_sp(SCREEN* \fIsp\fP, wchar_t *\fIwc\fP); +\fBint define_key_sp(SCREEN * \fIsp\fP, const char * \fIdefinition\fP, int \fIkeycode\fP); +\fBint delay_output_sp(SCREEN * \fIsp\fP, int \fIms\fP); +\fBint doupdate_sp(SCREEN * \fIsp\fP); +\fBint echo_sp(SCREEN * \fIsp\fP); +\fBint endwin_sp(SCREEN * \fIsp\fP); +\fBchar erasechar_sp(SCREEN * \fIsp\fP); +\fBint erasewchar_sp(SCREEN * \fIsp\fP, wchar_t *\fIwc\fP); \fBint extended_color_content_sp(SCREEN * \fIsp\fP, int \fIcolor\fP, int * \fIr\fP, int * \fIg\fP, int * \fIb\fP); -\fBint extended_pair_content_sp(SCREEN* \fIsp\fP, int \fIpair\fP, int * \fIfg\fP, int * \fIbg\fP); -\fBint extended_slk_color_sp(SCREEN* \fIsp\fP, int \fIpair\fP); +\fBint extended_pair_content_sp(SCREEN * \fIsp\fP, int \fIpair\fP, int * \fIfg\fP, int * \fIbg\fP); +\fBint extended_slk_color_sp(SCREEN * \fIsp\fP, int \fIpair\fP); .PP -\fBvoid filter_sp(SCREEN* \fIsp\fP); -\fBint find_pair_sp(SCREEN* \fIsp\fP, int \fIfg\fP, int \fIbg\fP); -\fBint flash_sp(SCREEN* \fIsp\fP); -\fBint flushinp_sp(SCREEN* \fIsp\fP); -\fBint free_pair_sp(SCREEN* \fIsp\fP, int \fIpair\fP); -\fBint get_escdelay_sp(SCREEN* \fIsp\fP); -\fBint getmouse_sp(SCREEN* \fIsp\fP, MEVENT* \fIevent\fP); -\fBWINDOW* getwin_sp(SCREEN* \fIsp\fP, FILE* \fIfilep\fP); -\fBint halfdelay_sp(SCREEN* \fIsp\fP, int \fItenths\fP); -\fBbool has_colors_sp(SCREEN* \fIsp\fP); +\fBvoid filter_sp(SCREEN * \fIsp\fP); +\fBint find_pair_sp(SCREEN * \fIsp\fP, int \fIfg\fP, int \fIbg\fP); +\fBint flash_sp(SCREEN * \fIsp\fP); +\fBint flushinp_sp(SCREEN * \fIsp\fP); +\fBint free_pair_sp(SCREEN * \fIsp\fP, int \fIpair\fP); +\fBint get_escdelay_sp(SCREEN * \fIsp\fP); +\fBint getmouse_sp(SCREEN * \fIsp\fP, MEVENT * \fIevent\fP); +\fBWINDOW * getwin_sp(SCREEN * \fIsp\fP, FILE * \fIfilep\fP); +\fBint halfdelay_sp(SCREEN * \fIsp\fP, int \fItenths\fP); +\fBbool has_colors_sp(SCREEN * \fIsp\fP); .PP -\fBbool has_ic_sp(SCREEN* \fIsp\fP); -\fBbool has_il_sp(SCREEN* \fIsp\fP); -\fBint has_key_sp(SCREEN* \fIsp\fP, int \fIc\fP); -\fBbool has_mouse_sp(SCREEN* \fIsp\fP); -\fBint init_color_sp(SCREEN* \fIsp\fP, short \fIcolor\fP, short \fIr\fP, short \fIg\fP, short \fIb\fP); -\fBint init_extended_color_sp(SCREEN* \fIsp\fP, int \fIcolor\fP, int \fIr\fP, int \fIg\fP, int \fIb\fP); -\fBint init_extended_pair_sp(SCREEN* \fIsp\fP, int \fIpair\fP, int \fIfg\fP, int \fIbg\fP); -\fBint init_pair_sp(SCREEN* \fIsp\fP, short \fIpair\fP, short \fIfg\fP, short \fIbg\fP); -\fBint intrflush_sp(SCREEN* \fIsp\fP, WINDOW* \fIwin\fP, bool \fIbf\fP); -\fBint is_cbreak_sp(SCREEN* \fIsp\fP); +\fBbool has_ic_sp(SCREEN * \fIsp\fP); +\fBbool has_il_sp(SCREEN * \fIsp\fP); +\fBint has_key_sp(SCREEN * \fIsp\fP, int \fIc\fP); +\fBbool has_mouse_sp(SCREEN * \fIsp\fP); +\fBint init_color_sp(SCREEN * \fIsp\fP, short \fIcolor\fP, short \fIr\fP, short \fIg\fP, short \fIb\fP); +\fBint init_extended_color_sp(SCREEN * \fIsp\fP, int \fIcolor\fP, int \fIr\fP, int \fIg\fP, int \fIb\fP); +\fBint init_extended_pair_sp(SCREEN * \fIsp\fP, int \fIpair\fP, int \fIfg\fP, int \fIbg\fP); +\fBint init_pair_sp(SCREEN * \fIsp\fP, short \fIpair\fP, short \fIfg\fP, short \fIbg\fP); +\fBint intrflush_sp(SCREEN * \fIsp\fP, WINDOW * \fIwin\fP, bool \fIbf\fP); +\fBint is_cbreak_sp(SCREEN * \fIsp\fP); .PP -\fBint is_echo_sp(SCREEN* \fIsp\fP); -\fBint is_nl_sp(SCREEN* \fIsp\fP); -\fBint is_raw_sp(SCREEN* \fIsp\fP); -\fBbool is_term_resized_sp(SCREEN* \fIsp\fP, int \fIlines\fP, int \fIcolumns\fP); -\fBbool isendwin_sp(SCREEN* \fIsp\fP); -\fBint key_defined_sp(SCREEN* \fIsp\fP, const char *\fIdefinition\fP); -\fBchar* keybound_sp(SCREEN* \fIsp\fP, int \fIkeycode\fP, int \fIcount\fP); -\fBNCURSES_CONST char* keyname_sp(SCREEN* \fIsp\fP, int \fIc\fP); -\fBint keyok_sp(SCREEN* \fIsp\fP, int \fIkeycode\fP, bool \fIenable\fP); -\fBchar killchar_sp(SCREEN* \fIsp\fP); +\fBint is_echo_sp(SCREEN * \fIsp\fP); +\fBint is_nl_sp(SCREEN * \fIsp\fP); +\fBint is_raw_sp(SCREEN * \fIsp\fP); +\fBbool is_term_resized_sp(SCREEN * \fIsp\fP, int \fIlines\fP, int \fIcolumns\fP); +\fBbool isendwin_sp(SCREEN * \fIsp\fP); +\fBint key_defined_sp(SCREEN * \fIsp\fP, const char *\fIdefinition\fP); +\fBchar * keybound_sp(SCREEN * \fIsp\fP, int \fIkeycode\fP, int \fIcount\fP); +\fBNCURSES_CONST char * keyname_sp(SCREEN * \fIsp\fP, int \fIc\fP); +\fBint keyok_sp(SCREEN * \fIsp\fP, int \fIkeycode\fP, bool \fIenable\fP); +\fBchar killchar_sp(SCREEN * \fIsp\fP); .PP -\fBint killwchar_sp(SCREEN* \fIsp\fP, wchar_t *\fIwc\fP); -\fBchar* longname_sp(SCREEN* \fIsp\fP); -\fBint mcprint_sp(SCREEN* \fIsp\fP, char *\fIdata\fP, int \fIlen\fP); -\fBint mouseinterval_sp(SCREEN* \fIsp\fP, int \fIerval\fP); -\fBmmask_t mousemask_sp(SCREEN* \fIsp\fP, mmask_t \fInewmask\fP, mmask_t *\fIoldmask\fP); -\fBint mvcur_sp(SCREEN* \fIsp\fP, int \fIoldrow\fP, int \fIoldcol\fP, int \fInewrow\fP, int \fInewcol\fP); -\fBint napms_sp(SCREEN* \fIsp\fP, int \fIms\fP); -\fBWINDOW* newpad_sp(SCREEN* \fIsp\fP, int \fInrows\fP, int \fIncols\fP); -\fBSCREEN* new_prescr(void); -\fBSCREEN* newterm_sp(SCREEN* \fIsp\fP, const char *\fItype\fP, FILE *\fIoutfd\fP, FILE *\fIinfd\fP); +\fBint killwchar_sp(SCREEN * \fIsp\fP, wchar_t *\fIwc\fP); +\fBchar * longname_sp(SCREEN * \fIsp\fP); +\fBint mcprint_sp(SCREEN * \fIsp\fP, char *\fIdata\fP, int \fIlen\fP); +\fBint mouseinterval_sp(SCREEN * \fIsp\fP, int \fIerval\fP); +\fBmmask_t mousemask_sp(SCREEN * \fIsp\fP, mmask_t \fInewmask\fP, mmask_t *\fIoldmask\fP); +\fBint mvcur_sp(SCREEN * \fIsp\fP, int \fIoldrow\fP, int \fIoldcol\fP, int \fInewrow\fP, int \fInewcol\fP); +\fBint napms_sp(SCREEN * \fIsp\fP, int \fIms\fP); +\fBWINDOW * newpad_sp(SCREEN * \fIsp\fP, int \fInrows\fP, int \fIncols\fP); +\fBSCREEN * new_prescr(void); +\fBSCREEN * newterm_sp(SCREEN * \fIsp\fP, const char *\fItype\fP, FILE *\fIoutf\fP, FILE *\fIinf\fP); .PP -\fBWINDOW* newwin_sp(SCREEN* \fIsp\fP, int \fInlines\fP, int \fIncols\fP, int \fIbegin_y\fP, int \fIbegin_x\fP); -\fBint nl_sp(SCREEN* \fIsp\fP); -\fBint nocbreak_sp(SCREEN* \fIsp\fP); -\fBint noecho_sp(SCREEN* \fIsp\fP); -\fBvoid nofilter_sp(SCREEN* \fIsp\fP); -\fBint nonl_sp(SCREEN* \fIsp\fP); -\fBvoid noqiflush_sp(SCREEN* \fIsp\fP); -\fBint noraw_sp(SCREEN* \fIsp\fP); -\fBint pair_content_sp(SCREEN* \fIsp\fP, short \fIpair\fP, short* \fIfg\fP, short* \fIbg\fP); -\fBvoid qiflush_sp(SCREEN* \fIsp\fP); +\fBWINDOW * newwin_sp(SCREEN * \fIsp\fP, int \fInlines\fP, int \fIncols\fP, int \fIbegin_y\fP, int \fIbegin_x\fP); +\fBint nl_sp(SCREEN * \fIsp\fP); +\fBint nocbreak_sp(SCREEN * \fIsp\fP); +\fBint noecho_sp(SCREEN * \fIsp\fP); +\fBvoid nofilter_sp(SCREEN * \fIsp\fP); +\fBint nonl_sp(SCREEN * \fIsp\fP); +\fBvoid noqiflush_sp(SCREEN * \fIsp\fP); +\fBint noraw_sp(SCREEN * \fIsp\fP); +\fBint pair_content_sp(SCREEN * \fIsp\fP, short \fIpair\fP, short * \fIfg\fP, short * \fIbg\fP); +\fBvoid qiflush_sp(SCREEN * \fIsp\fP); .PP -\fBint raw_sp(SCREEN* \fIsp\fP); -\fBvoid reset_color_pairs_sp(SCREEN* \fIsp\fP); -\fBint reset_prog_mode_sp(SCREEN* \fIsp\fP); -\fBint reset_shell_mode_sp(SCREEN* \fIsp\fP); -\fBint resetty_sp(SCREEN* \fIsp\fP); -\fBint resize_term_sp(SCREEN* \fIsp\fP, int \fIlines\fP, int \fIcolumns\fP); -\fBint resizeterm_sp(SCREEN* \fIsp\fP, int \fIlines\fP, int \fIcolumns\fP); -\fBint ripoffline_sp(SCREEN* \fIsp\fP, int \fIline\fP, int (*\fIinit\fP)(WINDOW* \fIwin\fP, int \fIfmt\fP)); -\fBint savetty_sp(SCREEN* \fIsp\fP); -\fBint scr_init_sp(SCREEN* \fIsp\fP, const char *\fIfilename\fP); +\fBint raw_sp(SCREEN * \fIsp\fP); +\fBvoid reset_color_pairs_sp(SCREEN * \fIsp\fP); +\fBint reset_prog_mode_sp(SCREEN * \fIsp\fP); +\fBint reset_shell_mode_sp(SCREEN * \fIsp\fP); +\fBint resetty_sp(SCREEN * \fIsp\fP); +\fBint resize_term_sp(SCREEN * \fIsp\fP, int \fIlines\fP, int \fIcolumns\fP); +\fBint resizeterm_sp(SCREEN * \fIsp\fP, int \fIlines\fP, int \fIcolumns\fP); +\fBint ripoffline_sp(SCREEN * \fIsp\fP, int \fIline\fP, int (*\fIinit\fP)(WINDOW * \fIwin\fP, int \fIfmt\fP)); +\fBint savetty_sp(SCREEN * \fIsp\fP); +\fBint scr_init_sp(SCREEN * \fIsp\fP, const char *\fIfilename\fP); .PP -\fBint scr_restore_sp(SCREEN* \fIsp\fP, const char *\fIfilename\fP); -\fBint scr_set_sp(SCREEN* \fIsp\fP, const char *\fIfilename\fP); -\fBint set_escdelay_sp(SCREEN* \fIsp\fP, int \fIms\fP); -\fBint set_tabsize_sp(SCREEN* \fIsp\fP, int \fIcols\fP); -\fBint slk_attrset_sp(SCREEN* \fIsp\fP, const chtype \fIa\fP); -\fBint slk_attr_set_sp(SCREEN* \fIsp\fP, const attr_t \fIattrs\fP, short \fIpair\fP, void*\fIopts\fP); -\fBint slk_attroff_sp(SCREEN* \fIsp\fP, const chtype \fIa\fP); -\fBint slk_attron_sp(SCREEN* \fIsp\fP, const chtype \fIa\fP); -\fBattr_t slk_attr_sp(SCREEN* \fIsp\fP); -\fBint slk_clear_sp(SCREEN* \fIsp\fP); +\fBint scr_restore_sp(SCREEN * \fIsp\fP, const char *\fIfilename\fP); +\fBint scr_set_sp(SCREEN * \fIsp\fP, const char *\fIfilename\fP); +\fBint set_escdelay_sp(SCREEN * \fIsp\fP, int \fIms\fP); +\fBint set_tabsize_sp(SCREEN * \fIsp\fP, int \fIcols\fP); +\fBint slk_attrset_sp(SCREEN * \fIsp\fP, const chtype \fIa\fP); +\fBint slk_attr_set_sp(SCREEN * \fIsp\fP, const attr_t \fIattrs\fP, short \fIpair\fP, void *\fIopts\fP); +\fBint slk_attroff_sp(SCREEN * \fIsp\fP, const chtype \fIa\fP); +\fBint slk_attron_sp(SCREEN * \fIsp\fP, const chtype \fIa\fP); +\fBattr_t slk_attr_sp(SCREEN * \fIsp\fP); +\fBint slk_clear_sp(SCREEN * \fIsp\fP); .PP -\fBint slk_color_sp(SCREEN* \fIsp\fP, short \fIpair\fP); -\fBint slk_init_sp(SCREEN* \fIsp\fP, int \fIfmt\fP); -\fBchar* slk_label_sp(SCREEN* \fIsp\fP, int \fIlabnum\fP); -\fBint slk_noutrefresh_sp(SCREEN* \fIsp\fP); -\fBint slk_refresh_sp(SCREEN* \fIsp\fP); -\fBint slk_restore_sp(SCREEN* \fIsp\fP); -\fBint slk_set_sp(SCREEN* \fIsp\fP, int \fIlabnum\fP, const char * \fIlabel\fP, int \fIfmt\fP); -\fBint slk_touch_sp(SCREEN* \fIsp\fP); -\fBint start_color_sp(SCREEN* \fIsp\fP); -\fBattr_t term_attrs_sp(SCREEN* \fIsp\fP); +\fBint slk_color_sp(SCREEN * \fIsp\fP, short \fIpair\fP); +\fBint slk_init_sp(SCREEN * \fIsp\fP, int \fIfmt\fP); +\fBchar * slk_label_sp(SCREEN * \fIsp\fP, int \fIlabnum\fP); +\fBint slk_noutrefresh_sp(SCREEN * \fIsp\fP); +\fBint slk_refresh_sp(SCREEN * \fIsp\fP); +\fBint slk_restore_sp(SCREEN * \fIsp\fP); +\fBint slk_set_sp(SCREEN * \fIsp\fP, int \fIlabnum\fP, const char * \fIlabel\fP, int \fIfmt\fP); +\fBint slk_touch_sp(SCREEN * \fIsp\fP); +\fBint start_color_sp(SCREEN * \fIsp\fP); +\fBattr_t term_attrs_sp(SCREEN * \fIsp\fP); .PP -\fBchtype termattrs_sp(SCREEN* \fIsp\fP); -\fBchar* termname_sp(SCREEN* \fIsp\fP); -\fBint typeahead_sp(SCREEN* \fIsp\fP, int \fIfd\fP); -\fBint unget_wch_sp(SCREEN* \fIsp\fP, const wchar_t \fIwc\fP); -\fBint ungetch_sp(SCREEN* \fIsp\fP, int \fIc\fP); -\fBint ungetmouse_sp(SCREEN* \fIsp\fP, MEVENT* \fIevent\fP); -\fBint use_default_colors_sp(SCREEN* \fIsp\fP); -\fBvoid use_env_sp(SCREEN* \fIsp\fP, bool \fIbf\fP); -\fBint use_legacy_coding_sp(SCREEN* \fIsp\fP, int \fIlevel\fP); +\fBchtype termattrs_sp(SCREEN * \fIsp\fP); +\fBchar * termname_sp(SCREEN * \fIsp\fP); +\fBint typeahead_sp(SCREEN * \fIsp\fP, int \fIfd\fP); +\fBint unget_wch_sp(SCREEN * \fIsp\fP, const wchar_t \fIwc\fP); +\fBint ungetch_sp(SCREEN * \fIsp\fP, int \fIc\fP); +\fBint ungetmouse_sp(SCREEN * \fIsp\fP, MEVENT * \fIevent\fP); +\fBint use_default_colors_sp(SCREEN * \fIsp\fP); +\fBvoid use_env_sp(SCREEN * \fIsp\fP, bool \fIbf\fP); +\fBint use_legacy_coding_sp(SCREEN * \fIsp\fP, int \fIlevel\fP); \fBvoid use_tioctl_sp(SCREEN *\fIsp\fP, bool \fIbf\fP); .PP -\fBint vid_attr_sp(SCREEN* \fIsp\fP, attr_t \fIattrs\fP, short \fIpair\fP, void * \fIopts\fP); -\fBint vid_puts_sp(SCREEN* \fIsp\fP, attr_t \fIattrs\fP, short \fIpair\fP, void * \fIopts\fP, NCURSES_SP_OUTC \fIputc\fP); -\fBint vidattr_sp(SCREEN* \fIsp\fP, chtype \fIattrs\fP); -\fBint vidputs_sp(SCREEN* \fIsp\fP, chtype \fIattrs\fP, NCURSES_SP_OUTC \fIputc\fP); -\fBwchar_t* wunctrl_sp(SCREEN* \fIsp\fP, cchar_t *\fIwch\fP); +\fBint vid_attr_sp(SCREEN * \fIsp\fP, attr_t \fIattrs\fP, short \fIpair\fP, void * \fIopts\fP); +\fBint vid_puts_sp(SCREEN * \fIsp\fP, attr_t \fIattrs\fP, short \fIpair\fP, void * \fIopts\fP, NCURSES_SP_OUTC \fIputc\fP); +\fBint vidattr_sp(SCREEN * \fIsp\fP, chtype \fIattrs\fP); +\fBint vidputs_sp(SCREEN * \fIsp\fP, chtype \fIattrs\fP, NCURSES_SP_OUTC \fIputc\fP); +\fBwchar_t * wunctrl_sp(SCREEN * \fIsp\fP, cchar_t *\fIwch\fP); .PP \fB#include <form.h> .PP -\fBFORM* new_form_sp(SCREEN* \fIsp\fP, FIELD **\fIfields\fP); +\fBFORM * new_form_sp(SCREEN * \fIsp\fP, FIELD **\fIfields\fP); .PP \fB#include <menu.h> .PP -\fBMENU* new_menu_sp(SCREEN* \fIsp\fP, ITEM **\fIitems\fP); +\fBMENU * new_menu_sp(SCREEN * \fIsp\fP, ITEM **\fIitems\fP); .PP \fB#include <panel.h> .PP -\fBPANEL* ceiling_panel(SCREEN* \fIsp\fP); -\fBPANEL* ground_panel(SCREEN* \fIsp\fP); -\fBvoid update_panels_sp(SCREEN* \fIsp\fP); +\fBPANEL * ceiling_panel(SCREEN * \fIsp\fP); +\fBPANEL * ground_panel(SCREEN * \fIsp\fP); +\fBvoid update_panels_sp(SCREEN * \fIsp\fP); .PP \fB#include <term.h> .PP -\fBint del_curterm_sp(SCREEN* \fIsp\fP, TERMINAL *\fIoterm\fP); -\fBint putp_sp(SCREEN* \fIsp\fP, const char *\fIstr\fP); -\fBint restartterm_sp(SCREEN* \fIsp\fP, NCURSES_CONST char*\fIterm\fP, int \fIfiledes\fP, int *\fIerrret\fP); -\fBTERMINAL* set_curterm_sp(SCREEN* \fIsp\fP, TERMINAL*\fInterm\fP); -\fBint tgetent_sp(SCREEN* \fIsp\fP, char *\fIbp\fP, const char *\fIname\fP); -\fBint tgetflag_sp(SCREEN* \fIsp\fP, const char *\fIcapname\fP); -\fBint tgetnum_sp(SCREEN* \fIsp\fP, const char *\fIcapname\fP); -\fBchar* tgetstr_sp(SCREEN* \fIsp\fP, const char *\fIcapname\fP, char **\fIarea\fP); -\fBchar* tgoto_sp(SCREEN* \fIsp\fP, const char *\fIcapname\fP, int \fIcol\fP, int \fIrow\fP); -\fBint tigetflag_sp(SCREEN* \fIsp\fP, const char *\fIcapname\fP); +\fBint del_curterm_sp(SCREEN * \fIsp\fP, TERMINAL *\fIoterm\fP); +\fBint putp_sp(SCREEN * \fIsp\fP, const char *\fIstr\fP); +\fBint restartterm_sp(SCREEN * \fIsp\fP, NCURSES_CONST char *\fIterm\fP, int \fIfiledes\fP, int *\fIerrret\fP); +\fBTERMINAL * set_curterm_sp(SCREEN * \fIsp\fP, TERMINAL *\fInterm\fP); +\fBint tgetent_sp(SCREEN * \fIsp\fP, char *\fIbp\fP, const char *\fIname\fP); +\fBint tgetflag_sp(SCREEN * \fIsp\fP, const char *\fIcapname\fP); +\fBint tgetnum_sp(SCREEN * \fIsp\fP, const char *\fIcapname\fP); +\fBchar * tgetstr_sp(SCREEN * \fIsp\fP, const char *\fIcapname\fP, char **\fIarea\fP); +\fBchar * tgoto_sp(SCREEN * \fIsp\fP, const char *\fIcapname\fP, int \fIcol\fP, int \fIrow\fP); +\fBint tigetflag_sp(SCREEN * \fIsp\fP, const char *\fIcapname\fP); .PP -\fBint tigetnum_sp(SCREEN* \fIsp\fP, const char *\fIcapname\fP); -\fBchar* tigetstr_sp(SCREEN* \fIsp\fP, const char *\fIcapname\fP); +\fBint tigetnum_sp(SCREEN * \fIsp\fP, const char *\fIcapname\fP); +\fBchar * tigetstr_sp(SCREEN * \fIsp\fP, const char *\fIcapname\fP); \fI/* tparm_sp may use 9 long parameters rather than being variadic */ -\fBchar* tparm_sp(SCREEN* \fIsp\fP, const char *\fIstr\fP, ...); -\fBint tputs_sp(SCREEN* \fIsp\fP, const char *\fIstr\fP, int \fIaffcnt\fP, NCURSES_SP_OUTC \fIputc\fP); +\fBchar * tparm_sp(SCREEN * \fIsp\fP, const char *\fIstr\fP, ...); +\fBint tputs_sp(SCREEN * \fIsp\fP, const char *\fIstr\fP, int \fIaffcnt\fP, NCURSES_SP_OUTC \fIputc\fP); .PP \fB#include <unctrl.h> .PP -\fBNCURSES_CONST char* unctrl_sp(SCREEN* \fIsp\fP, chtype \fIch\fP); +\fBNCURSES_CONST char * unctrl_sp(SCREEN * \fIsp\fP, chtype \fIch\fP); .fi .SH DESCRIPTION This implementation can be configured to provide a set of functions which diff --git a/man/curs_termattrs.3x b/man/curs_termattrs.3x index dacd3b0f4d84..91c206f06bfb 100644 --- a/man/curs_termattrs.3x +++ b/man/curs_termattrs.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2010,2015 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,18 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_termattrs.3x,v 1.41 2024/04/20 21:20:07 tom Exp $ -.TH curs_termattrs 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_termattrs.3x,v 1.61 2025/08/23 22:39:20 tom Exp $ +.TH curs_termattrs 3X 2025-08-23 "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 '' "" +.\} .SH NAME \fB\%baudrate\fP, \fB\%erasechar\fP, @@ -41,88 +51,169 @@ \fB\%term_attrs\fP, \fB\%termattrs\fP, \fB\%termname\fP \- -\fIcurses\fR environment query routines +get and set terminal attributes with \fIcurses\fP .SH SYNOPSIS .nf \fB#include <curses.h> .PP \fBint baudrate(void); \fBchar erasechar(void); -\fBint erasewchar(wchar_t *\fIwc\fP); +\fBint erasewchar(wchar_t * \fIwc\fP); \fBbool has_ic(void); \fBbool has_il(void); \fBchar killchar(void); -\fBint killwchar(wchar_t *\fIwc\fP); -\fBchar *longname(void); +\fBint killwchar(wchar_t * \fIwc\fP); +\fBchar * longname(void); \fBattr_t term_attrs(void); \fBchtype termattrs(void); -\fBchar *termname(void); +\fBchar * termname(void); .fi .SH DESCRIPTION .SS baudrate -The \fBbaudrate\fP routine returns the output speed of the terminal. -The -number returned is in bits per second, for example \fB9600\fP, and is an -integer. +.B \%baudrate +returns the line speed of the terminal, +an integer value measured in bits per second, +for example +.BR 9600 "." .SS "erasechar, erasewchar" -The \fBerasechar\fP routine returns the user's current erase character. +.B \%erasechar +returns the terminal's erase character. .PP -The \fBerasewchar\fP routine stores the current erase character -in the location referenced by \fIwc\fP. -If no erase character has been defined, the routine fails -and the location referenced by \fIwc\fP is not changed. +.B \%erasewchar +stores the erase character in the location referenced by +.IR wc "." +If no erase character has been defined, +it fails and the location referenced by +.I wc +is not changed. .SS "has_ic, has_il" -The \fBhas_ic\fP routine is true if the terminal has insert- and delete- -character capabilities. +.B \%has_ic +returns +.B TRUE +if the terminal has insert- and delete-character capabilities. .PP -The \fBhas_il\fP routine is true if the terminal has insert- and delete-line -capabilities, or can simulate them using scrolling regions. -This might -be used to determine if it would be appropriate to turn on physical -scrolling using \fBscrollok\fP(3X). +.B \%has_il +returns +.B TRUE +if the terminal has insert- and delete-line capabilities, +or can simulate them using scrolling regions. +It might be used to determine whether it would be appropriate +to use \fBscrollok\fP(3X) to turn on scrolling. .SS "killchar, killwchar" -The \fBkillchar\fP routine returns the user's current line kill character. +.B \%killchar +returns the terminal's line kill character. .PP -The \fBkillwchar\fP routine stores the current line-kill character -in the location referenced by \fIwc\fP. +.B \%killwchar +stores the line-kill character in the location referenced by +.IR wc "." If no line-kill character has been defined, -the routine fails and the location referenced by \fIwc\fP is not changed. +it fails and the location referenced by +.I wc +is not changed. .SS longname -The \fBlongname\fP routine returns a pointer to a static area -containing a verbose description of the current terminal. -The maximum -length of a verbose description is 128 characters. -It is defined only -after the call to \fBinitscr\fP or \fBnewterm\fP. The area is -overwritten by each call to \fBnewterm\fP and is not restored by -\fBset_term\fP, so the value should be saved between calls to -\fBnewterm\fP if \fBlongname\fP is going to be used with multiple -terminals. +.B \%longname +returns a pointer to static storage +containing a verbose description of the terminal being managed by +.IR curses "." +The maximum length of a verbose description is 128 characters. +The storage is populated only after \fBinitscr\fP(3X) or +\fBnewterm\fP(3X) is called. +This storage is overwritten by each call to +.B \%newterm +and not restored by \fBset_term\fP(3X), +so its contents should be saved between calls to +.B \%initscr +or +.B \%newterm +if +.B \%longname +is to be used with multiple terminals. .SS "termattrs, term_attrs" If a given terminal does not support a video attribute that an -application program is trying to use, \fBcurses\fP may substitute a +application program is trying to use, +.I curses +may substitute a different video attribute for it. -The \fBtermattrs\fP and \fBterm_attrs\fP functions -return a logical \fBOR\fP of all video attributes supported by the -terminal using \fBA_\fP and \fBWA_\fP constants respectively. -This information is useful when a \fBcurses\fP program +.B \%termattrs +and +.B \%term_attrs +return a logical \*(``or\*('' of all video attributes supported by the +terminal using +.B A_ +and +.B WA_ +constants respectively. +This information is useful when a +.I curses +program needs complete control over the appearance of the screen. .SS termname -The \fBtermname\fP routine returns the terminal name used by \fBsetupterm\fP. +.B \%termname +returns the terminal name used by \fBsetupterm\fP(3X). .SH RETURN VALUE -\fBlongname\fP and \fBtermname\fP return \fBNULL\fP on error. +.B \%longname +and +.B \%termname +return +.I NULL +on error. .PP -Routines that return an integer return \fBERR\fP upon failure and \fBOK\fP -(SVr4 only specifies "an integer value other than \fBERR\fP") upon successful -completion. +Functions that return an integer return +.B ERR +upon failure and +.B OK +upon success. .SH NOTES -Note that \fBtermattrs\fP may be a macro. +.BR \%erasewchar "," +.BR \%killwchar "," +and +.B \%term_attrs +are part of +.IR \%ncurses "'s" +wide-character API, +and are not available in its non-wide-character configuration. +.PP +.B \%termattrs +may be implemented as a macro. .SH PORTABILITY -X/Open Curses, Issue 4 describes these functions. -It changes the -return type of \fBtermattrs\fP to the new type \fBattr_t\fP. -Most versions of curses truncate the result returned by \fBtermname\fP to -14 characters. +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. 535 +.PP +Most versions of +.I curses +truncate the string returned by +.I \%termname +to 14 characters. +.SH HISTORY +4BSD (1980) +introduced +.IR \%longname "." +.PP +SVr2 (1984) +added +.IR \%baudrate "," +.IR \%erasechar "," +.IR \%killchar "," +.IR \%has_ic "," +and +.IR \%has_il "." +.PP +SVr3 (1987) +supplied +.IR \%termname "." +Later that year, +SVr3.1 brought +.IR \%termattrs "." +.PP +X/Open Curses Issue\ 4 (1995) +specified +.IR \%erasewchar "," +.IR \%killwchar "," +and +.IR \%term_attrs "." .SH SEE ALSO \fB\%curses\fP(3X), \fB\%curs_initscr\fP(3X), diff --git a/man/curs_termcap.3x b/man/curs_termcap.3x index 6bd2a66a0b55..2617c8ebc32d 100644 --- a/man/curs_termcap.3x +++ b/man/curs_termcap.3x @@ -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 * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_termcap.3x,v 1.85 2024/04/20 19:13:12 tom Exp $ -.TH curs_termcap 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_termcap.3x,v 1.107 2025/08/16 19:09:12 tom Exp $ +.TH curs_termcap 3X 2025-08-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -40,11 +40,59 @@ .el .ds '' "" .\} . +.ie \n(.g .ds : \: +.el .ds : \" empty +. .de bP .ie n .IP \(bu 4 .el .IP \(bu 2 .. . +.\" URL hyperlink support macros from groff's "an-ext.tmac" +. +.\" Save the automatic hyphenation mode. +.\" +.\" In AT&T troff, there was no register exposing the hyphenation mode, +.\" and no way to save and restore it. Set `mH` to a reasonable value +.\" for your implementation and preference. +.de mY +. ie !\\n(.g \ +. nr mH 14 +. el \ +. do nr mH \\n[.hy] \" groff extension register +.. +. +.\" Prepare link text for mail/web hyperlinks. `MT` and `UR` call this. +.de mV +. ds mU \\$1\" +.. +. +.\" Emit hyperlink. The optional argument supplies trailing punctuation +.\" after link text. `ME` and `UE` call this. +.de mQ +. mY +. nh +<\\*(mU>\\$1 +. hy \\n(mH +. rm mU +.. +. +.\" Start URL. +.\" .UR url +.if !\n(.g \{\ +.de UR +. mV \\$1 +.. +.\} +. +.\" End URL. +.\" .UE [punctuation] +.if !\n(.g \{\ +.de UE +. mQ \\$1 +.. +.\} +. .SH NAME \fB\%PC\fP, \fB\%UP\fP, @@ -67,12 +115,12 @@ \fBchar * BC; \fB@NCURSES_OSPEED@ ospeed; .PP -\fBint tgetent(char *\fIbp\fP, const char *\fIname\fP); -\fBint tgetflag(const char *\fIid\fP); -\fBint tgetnum(const char *\fIid\fP); -\fBchar *tgetstr(const char *\fIid\fP, char **\fIarea\fP); -\fBchar *tgoto(const char *\fIcap\fP, int \fIcol\fP, int \fIrow\fP); -\fBint tputs(const char *\fIstr\fP, int \fIaffcnt\fP, int (*\fIputc\fP)(int)); +\fBint tgetent(char * \fIbp\fP, const char * \fIname\fP); +\fBint tgetflag(const char * \fIid\fP); +\fBint tgetnum(const char * \fIid\fP); +\fBchar * tgetstr(const char * \fIid\fP, char ** \fIsbuf\fP); +\fBchar * tgoto(const char * \fIcap\fP, int \fIcol\fP, int \fIrow\fP); +\fBint tputs(const char * \fIstr\fP, int \fIaffcnt\fP, int (* \fIputc\fP)(int)); .fi .SH DESCRIPTION .I \%ncurses @@ -90,10 +138,10 @@ This must be done before calling any of the other functions. It returns .RS 3 .TP 5 \" "-1" + 2n + adjust for PDF -1 +.B 1 on success, .TP -0 +.B 0 if there is no such entry (or if the matching entry describes a generic terminal, having too little information for @@ -101,20 +149,21 @@ having too little information for applications to run), and .TP -\-1 -if the \fI\%term\%info\fP database could not be found. +.B \-1 +if the +.I \%term\%info +database could not be found. .RE .PP This implementation differs from those of historical \fItermcap\fP libraries. -.RS 3 .bP .I \%ncurses ignores the buffer pointer \fIbp\fP, as do other \fItermcap\fP implementations conforming to portions of X/Open Curses now withdrawn. The BSD \fItermcap\fP library would store a copy of the terminal type -description in the area referenced by this pointer. +description in the buffer referenced by this pointer. \fI\%term\%info\fP stores terminal type descriptions in compiled form, which is not the same thing. .bP @@ -127,7 +176,6 @@ capability, nor whether the terminal type description supports an addressable cursor, a property essential for any \fIcurses\fP implementation to operate. -.RE .SS "Retrieving Capability Values" \fB\%tgetflag\fP reports the Boolean entry for \fIid\fP, or zero if it is not available. @@ -137,38 +185,40 @@ or \-1 if it is not available. .PP \fB\%tgetstr\fP returns the string entry for \fIid\fP, or -.B NULL +.I NULL if it is not available. Use \fB\%tputs\fP to output the string returned. The -.I area +.I sbuf parameter is used as follows. -.RS 3 .bP It is assumed to be the address of a pointer to a buffer managed by the calling application. .bP However, -\fI\%ncurses\fP checks to ensure that -.I area +.I \%ncurses +checks to ensure that +.I sbuf is not -.BR NULL , -and also that the resulting buffer pointer is not -.BR NULL . +.IR NULL "," +and that the pointer obtained by dereferencing +.I sbuf +is also not +.IR NULL "." If either check fails, -.I area -is ignored. +.I \%ncurses +ignores +.IR sbuf . .bP If the checks succeed, \fI\%ncurses\fP also copies the return value to the buffer pointed to by -\fIarea\fP, +\fIsbuf\fP, and the library updates -.I area +.I sbuf to point past the null character terminating this value. .bP The return value itself is an address in the terminal type description loaded into memory. -.RE .SS "Applying String Capabilities" String capabilities can be parameterized; see subsection \*(``Parameterized Strings\*('' in \fB\%terminfo\fP(5). @@ -216,24 +266,48 @@ availability. It can retrieve capabilities by either \fItermcap\fP or \fI\%term\%info\fP code. .SS "Global Variables" -The variables -\fBPC\fP, -\fBUP\fP and -\fBBC\fP -are set by \fB\%tgetent\fP to the \fI\%term\%info\fP entry's data for -\fB\%pad_char\fP, -\fB\%cursor_up\fP and -\fB\%backspace_if_not_bs\fP, +.B \%tgetent +sets the variables +.BR PC "," +.BR UP "," +and +.B BC +to the +.I \%term\%info +entry's data for +.B \%pad_char +.RB ( pad ), +.B \%cursor_up +.RB ( cuu1 ), +and +.B \%backspace_if_not_bs +.RB ( OTbs ), respectively. -\fBUP\fP is not used by \fI\%ncurses\fP. -\fBPC\fP is used by \fB\%delay_output\fP(3X). -\fBBC\fP is used by \fB\%tgoto\fP emulation. -The variable \fB\%ospeed\fP is set by \fI\%ncurses\fP using a -system-specific encoding to indicate the terminal's data rate. +.I \%ncurses +does not employ +.B cuu1 +internally. +\fB\%delay_output\fP(3X) +uses +.BR pad "," +while +.B \%tgoto +emulation uses the obsolete +.I termcap +capability +.BR bs "," +represented in +.I \%ncurses +.I \%term\%info +as \*(``OTbs\*(''. +.I \%ncurses +assigns the variable +.B \%ospeed +a system-specific value to encode the terminal's data rate. .SS "Releasing Memory" The \fItermcap\fP functions provide no means of freeing memory, -because legacy \fItermcap\fP implementations used only the buffer -areas provided by the caller via \fB\%tgetent\fP and \fB\%tgetstr\fP. +because legacy \fItermcap\fP implementations used only the storage +provided by the caller via \fB\%tgetent\fP and \fB\%tgetstr\fP. Those buffers are unused in \fI\%term\%info\fP. .PP By contrast, @@ -254,7 +328,7 @@ The \fIscreen\fP(1) program relies upon this arrangement to improve its performance. .PP An application that uses only the \fItermcap\fP functions, -not the higher level +not the higher-level .I \%curses API, could release the memory using \fB\%del_curterm\fP(3X), @@ -270,12 +344,12 @@ and are documented above. .PP \fB\%tgoto\fP returns -.B NULL +.I NULL on error. Error conditions include: .bP uninitialized state -(\fB\%tgetent\fP was not called successfully), +\%(\fBtgetent\fP was not called successfully), .bP .I cap being a null pointer, @@ -302,110 +376,149 @@ and .SH PORTABILITY These functions are no longer standardized (and the variables never were); -\fI\%ncurses\fP provides them to support legacy applications. -They should not be used in new programs. -.SS Standards -.bP -X/Open Curses, Issue 4, Version 2 (1996), -describes these functions, -marking them as -\*(``TO BE WITHDRAWN\*(''. -.bP -X/Open Curses, Issue 7 (2009) marks the \fItermcap\fP interface -(along with \fB\%vwprintw\fP and \fB\%vwscanw\fP) as withdrawn. +see section \*(``HISTORY\*('' below. +.I \%ncurses +provides them to support legacy applications; +they should not be used in new programs. +.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. 536 .PP Neither X/Open Curses nor the SVr4 man pages documented the return -values of \fB\%tgetent\fP correctly, +values of +.I \%tgetent +correctly, though all three shown here were in fact returned ever since SVr1. In particular, an omission in the X/Open Curses specification has been misinterpreted -to mean that \fB\%tgetent\fP returns \fBOK\fP or \fBERR\fP. +to mean that +.I \%tgetent +returns +.I OK +or +.IR ERR "." Because the purpose of these functions is to provide compatibility with -the \fItermcap\fP library, -that is a defect in X/Open Curses, Issue 4, Version 2 -rather than in \fI\%ncurses\fP. +the +.I termcap +library, +that is a defect in X/Open Curses Issue\ 4 Version\ 2 +rather than in +.IR \%ncurses "." .SS "Compatibility with BSD \fItermcap\fP" -Externally visible variables are provided for support of certain -\fItermcap\fP applications. +.I \%ncurses +provides externally visible variables to support certain +.I termcap +applications. However, their correct usage is poorly documented; for example, it is unclear when reading and writing them is meaningful. In particular, -some applications are reported to declare and/or modify \fB\%ospeed\fP. +some applications are reported to declare and/or modify +.IR \%ospeed "." .PP -The constraint that only the first two characters of the \fIid\fP -parameter are used escapes many application developers. -The BSD \fItermcap\fP library did not require a trailing null character -on the capability identifier passed to \fB\%tgetstr\fP, -\fB\%tgetnum\fP, +The constraint that only the first two characters of the +.I id +parameter are looked up in the terminal database +escapes many application developers. +The BSD +.I termcap +library did not require a trailing null character +after the capability identifier passed to +.IR \%tgetstr "," +.IR \%tgetnum "," and -\fB\%tgetflag\fP. +.IR \%tgetflag "." .\" See <https://minnie.tuhs.org/cgi-bin/utree.pl?file=2BSD/src/\ .\" termlib/termcap.c>. -Some applications thus assume that the \fItermcap\fP interface does not -require the trailing null character for the capability identifier. -.bP +Some applications thus assume that the +.I termcap +interface does not require the trailing null character +for the capability identifier. .I \%ncurses -disallows matches by the \fItermcap\fP interface against extended -capability names that are longer than two characters; +disallows matches by the +.I termcap +interface against extended capability names +that are longer than two characters; see \fB\%user_caps\fP(5). .PP -The BSD \fItermcap\fP function \fB\%tgetent\fP returns the text of a -\fItermcap\fP entry in the buffer passed as an argument. -This library, -like other \fI\%term\%info\fP implementations, +The BSD +.I termcap +function +.I \%tgetent +returns the text of a +.I termcap +entry in the buffer passed as an argument. +.IR \%ncurses "," +like other +.I \%term\%info +implementations, does not store terminal type descriptions as text. It sets the buffer contents to a null-terminated string. .SS "Header File" -This library includes a \fI\%termcap.h\fP header for compatibility with -other implementations, -but the header is rarely used because the other implementations are not -strictly compatible. +.I \%ncurses +includes a +.I \%termcap.h +header file for compatibility with other implementations, +but it is rarely used because the other implementations +are not mutually compatible; +see below. .SH HISTORY .\" See https://www.oreilly.com/openbook/opensources/book/kirkmck.html .\" for much BSD release history. -Bill Joy originated a forerunner of \fItermcap\fP called -\*(``ttycap\*('', +Bill Joy originated a forerunner of +.I termcap +called \*(``ttycap\*('', dated September 1977, and released in 1BSD (March 1978). .\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=1BSD/s7/ttycap.c .\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=1BSD/man7/ttycap.7 -It used many of the same function names as the later \fItermcap\fP, +It used many of the same function names as the later +.IR termcap "," such as -\fB\%tgetent\fP, -\fB\%tgetflag\fP, -\fB\%tgetnum\fP, +.IR \%tgetent "," +.IR \%tgetflag "," +.IR \%tgetnum "," and -\fB\%tgetstr\fP. +.IR \%tgetstr "." .PP A clear descendant, -the \fItermlib\fP library, +the +.I termlib +library, .\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=2BSD/src/termlib/ followed in 2BSD (May 1979), -adding \fB\%tgoto\fP and \fB\%tputs\fP. +adding +.I \%tgoto +and +.IR \%tputs "." The former applied at that time only to cursor positioning capabilities, .\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=2BSD/bin/etc/termcap thus the overly specific name. Little changed in 3BSD (late 1979) -except the addition of test programs and a \fI\%termlib\fP man page, +except the addition of test programs and a +.I termlib +man page, which documented the API shown in section \*(``SYNOPSIS\*('' above. .\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=3BSD/usr/src/lib/\ .\" libtermlib/ .\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=3BSD/usr/man/man3/\ .\" termlib.3 .PP -4BSD -(November 1980) -renamed \fItermlib\fP to \fItermcap\fP +4BSD (November 1980) +renamed +.I termlib +to +.I termcap .\" ...except in the source tree... .\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4BSD/usr/src/lib/\ .\" libtermlib/makefile and added another test program. -The library remained much the same though 4.3BSD +The library remained much the same through 4.3BSD (June 1986). 4.4BSD-Lite (June 1994) @@ -418,10 +531,11 @@ Function prototypes were a feature of ANSI C (1989). The library long antedated the standard and thus provided no header file declaring them. Nevertheless, -the BSD sources included two different \fI\%termcap.h\fP header files -over time. +the BSD sources included two different +.I \%termcap.h +header files over time. .bP -One was used internally by \fBjove\fP(1) from 4.3BSD onward. +One was used internally by \fIjove\fP(1) from 4.3BSD onward. .\" 2BSD became a branch retaining support for non-virtual memory .\" systems (such as the PDP-11) whereas most BSD development focused on .\" the VAX and other VM-enabled systems starting with 3BSD. @@ -435,55 +549,108 @@ One was used internally by \fBjove\fP(1) from 4.3BSD onward. .\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.3BSD/usr/contrib/\ .\" jove/Makefile .\" --much too late for 2BSD (1979). -It declared global symbols for the \fItermcap\fP variables that it used. +It declared global symbols for the +.I termcap +variables that it used. .bP The other appeared in 4.4BSD-Lite Release 2 (June 1995) -as part of \fIlibedit\fP -(also known as the \fI\%edit\%line\fP library). +as part of +.I libedit +(also known as the +.I \%edit\%line +library). CSRG source history shows that this was added in mid-1992. -The \fIlibedit\fP header file was used internally as a convenience for -compiling the \fI\%edit\%line\fP library. +The +.I libedit +header file was used internally as a convenience +for compiling the +.I \%edit\%line +library. It declared function prototypes, but no global variables. -This header file was added to NetBSD's \fItermcap\fP library in -mid-1994. +NetBSD's +.I termcap +library added this header file in mid-1994. .PP Meanwhile, -GNU \fItermcap\fP began development in 1990. -Its first release (1.0) in 1991 included a \fI\%termcap.h\fP header. -Its second (1.1) in September 1992 modified the header to use -\fIconst\fP for the function prototypes in the header where one would -expect the parameters to be read-only. -BSD \fItermcap\fP did not. -The prototype for \fB\%tputs\fP also differed, +GNU +.I termcap +began development in 1990. +Its first release (1.0) in 1991 included a +.I \%termcap.h +header file. +Its second (1.1) release in September 1992 modified the file to use +.I const +for the function prototypes in the header where one would +expect parameters to be read-only. +BSD +.I termcap +did not. +The prototype for +.I \%tputs +also differed, but in that instance, -it was \fIlibedit\fP that differed from BSD \fItermcap\fP. +it was +.I libedit +that differed from BSD +.IR termcap "." .PP -GNU \fItermcap\fP 1.3 was bundled with \fIbash\fP(1) in mid-1993 to -support the \fI\%readline\fP(3) library. +GNU \fIbash\fP(1) has bundled GNU +.I termcap +1.3 since mid-1993 to support its \fI\%readline\fP(3) library, +and continues to use it if configured to do so. .PP -\fI\%ncurses\fP 1.8.1 +.I \%ncurses +1.8.1 (November 1993) -provided a \fI\%termcap.h\fP file. -It reflected influence from GNU \fItermcap\fP and \fBemacs\fP(1) -(rather than \fBjove\fP(1)), +provided a +.I \%termcap.h +file. +It reflected influence from GNU +.I termcap +and \fI\%emacs\fP(1) +(rather than \fIjove\fP(1)), providing the following interface: .bP -global symbols used by \fIemacs\fP, +global symbols used by +.IR \%emacs "," .bP -\fIconst\fP-qualified function prototypes, +.IR const -qualified +function prototypes, and .bP -a prototype for \fBtparam\fP, -a GNU \fItermcap\fP feature. +a prototype for +.IR tparam "," +a GNU +.I termcap +feature. .PP Later (in mid-1996) -the \fB\%tparam\fP function was removed from \fI\%ncurses\fP. +the +.I tparam +function was removed from +.IR \%ncurses "." Any two of the four implementations thus differ, -and programs that intend to work with all \fItermcap\fP library -interfaces must account for that fact. +and programs that intend to work with all +.I termcap +library interfaces must account for that fact. +.PP +X/Open Curses Issue\ 4, +Version\ 2 (1996), +describes these functions, +marking them as +\*(``TO BE WITHDRAWN\*(''. +.PP +X/Open Curses Issue\ 7 (2009) withdrew the +.I termcap +interface +(along with the +.I \%vwprintw +and +.I \%vwscanw +functions). .SH BUGS If you call \fB\%tgetstr\fP to fetch .B \%column_address @@ -510,15 +677,14 @@ users can be surprised. .IP \(bu 4 \fB\%tputs("50")\fP in a \fI\%term\%info\fP system transmits \*(``50\*('' rather than busy-waiting for 50 milliseconds. -.IP \(bu 4 +.IP However, if \fI\%ncurses\fP is configured to support \fItermcap\fP, it may also have been configured to support BSD-style padding. -.IP In that case, \fB\%tputs\fP inspects strings passed to it, looking for digits at the beginning of the string. -.IP +.IP \(bu 4 \fB\%tputs("50")\fP in a \fItermcap\fP system may busy-wait for 50 milliseconds rather than transmitting \*(``50\*(''. .PP @@ -533,15 +699,17 @@ One consequence is that \fItermcap\fP applications assume that .RB ( sgr0 ) capability) does not reset the alternate character set. -\fI\%ncurses\fP checks for, -and modifies the data shared with, -the \fItermcap\fP interface to accommodate the latter's limitation in -this respect. +\fI\%ncurses\fP inspects the data shared with the +.I termcap +interface and modifies it as necessary +to accommodate the latter's limitation in this respect. .SH "SEE ALSO" +.UR https://\*:invisible\-\*:island\*:.net/\*:ncurses/\*:tctest\*:.html +.I "TCTEST \(em A Termcap Test Utility" +.UE +.PP \fB\%curses\fP(3X), \fB\%curs_terminfo\fP(3X), \fB\%putc\fP(3), \fB\%term_variables\fP(3X), \fB\%terminfo\fP(5) -.PP -https://invisible\-island.net/ncurses/tctest.html diff --git a/man/curs_terminfo.3x b/man/curs_terminfo.3x index 10d1fa78b6b4..9a687182512c 100644 --- a/man/curs_terminfo.3x +++ b/man/curs_terminfo.3x @@ -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_terminfo.3x,v 1.136 2024/04/14 00:14:40 tom Exp $ -.TH curs_terminfo 3X 2024-04-13 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_terminfo.3x,v 1.176 2025/11/12 01:06:36 tom Exp $ +.TH curs_terminfo 3X 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -48,7 +48,6 @@ . .SH NAME \fB\%del_curterm\fP, -\fB\%mvcur\fP, \fB\%putp\fP, \fB\%restartterm\fP, \fB\%set_curterm\fP, @@ -71,7 +70,7 @@ \fB#include <curses.h> \fB#include <term.h> .PP -\fBTERMINAL *cur_term; +\fBTERMINAL * cur_term; .PP \fBconst char * const boolnames[]; \fBconst char * const boolcodes[]; @@ -83,40 +82,40 @@ \fBconst char * const strcodes[]; \fBconst char * const strfnames[]; .PP -\fBint setupterm(const char *\fIterm\fP, int \fIfiledes\fP, int *\fIerrret\fP); -\fBTERMINAL *set_curterm(TERMINAL *\fInterm\fP); -\fBint del_curterm(TERMINAL *\fIoterm\fP); -\fBint restartterm(const char *\fIterm\fP, int \fIfiledes\fP, int *\fIerrret\fP); +\fBint setupterm(const char * \fIterm\fP, int \fIfiledes\fP, int * \fIerrret\fP); +\fBTERMINAL * set_curterm(TERMINAL * \fInterm\fP); +\fBint del_curterm(TERMINAL * \fIoterm\fP); +\fBint restartterm(const char * \fIterm\fP, int \fIfiledes\fP, int * \fIerrret\fP); .PP -\fBchar *tparm(const char *\fIstr\fP, \fR.\|.\|.\fP); +\fBchar * tparm(const char * \fIstr\fP, \fR.\|.\|.\fP); \fI/* or */ -\fBchar *tparm(const char *\fIstr\fP, long \fIp1\fP \fR.\|.\|.\fP \fBlong\fP \fIp9\fP); +\fBchar * tparm(const char * \fIstr\fP, long \fIp1\fP \fR.\|.\|.\fP \fBlong\fP \fIp9\fP); .PP -\fBint tputs(const char *\fIstr\fP, int \fIaffcnt\fP, int (*\fIputc\fP)(int)); -\fBint putp(const char *\fIstr\fP); +\fBint tputs(const char * \fIstr\fP, int \fIaffcnt\fP, int (* \fIputc\fP)(int)); +\fBint putp(const char * \fIstr\fP); .PP -\fBint vidputs(chtype \fIattrs\fP, int (*\fIputc\fP)(int)); +\fBint vidputs(chtype \fIattrs\fP, int (* \fIputc\fP)(int)); \fBint vidattr(chtype \fIattrs\fP); -\fBint vid_puts(attr_t \fIattrs\fP, short \fIpair\fP, void *\fIopts\fP, int (*\fIputc\fP)(int)); -\fBint vid_attr(attr_t \fIattrs\fP, short \fIpair\fP, void *\fIopts\fP); +\fBint vid_puts(attr_t \fIattrs\fP, short \fIpair\fP, void * \fIopts\fP, int (* \fIputc\fP)(int)); +\fBint vid_attr(attr_t \fIattrs\fP, short \fIpair\fP, void * \fIopts\fP); .PP -\fBint mvcur(int \fIoldrow\fP, int \fIoldcol\fP, int \fInewrow\fP, int \fInewcol\fP); +\fBint tigetflag(const char * \fIcap-code\fP); +\fBint tigetnum(const char * \fIcap-code\fP); +\fBchar * tigetstr(const char * \fIcap-code\fP); .PP -\fBint tigetflag(const char *\fIcap-code\fP); -\fBint tigetnum(const char *\fIcap-code\fP); -\fBchar *tigetstr(const char *\fIcap-code\fP); -.PP -\fBchar *tiparm(const char *\fIstr\fP, \fR.\|.\|.\fP); +\fBchar * tiparm(const char * \fIstr\fP, \fR.\|.\|.\fP); .PP \fI/* extensions */ -\fBchar *tiparm_s(int \fIexpected\fP, int \fImask\fP, const char *\fIstr\fP, ...); -\fBint tiscan_s(int *\fIexpected\fP, int *\fImask\fP, const char *\fIstr\fP); +\fBchar * tiparm_s(int \fIexpected\fP, int \fImask\fP, const char * \fIstr\fP, .\|.\|.); +\fBint tiscan_s(int * \fIexpected\fP, int * \fImask\fP, const char * \fIstr\fP); .PP \fI/* deprecated */ -\fBint setterm(const char *\fIterm\fP); +\fBint setterm(const char * \fIterm\fP); .fi .SH DESCRIPTION -These low-level functions must be called by programs that deal directly +These lower-level functions of the +.I curses +standard must be called by programs that deal directly with the .I \%term\%info database to handle certain terminal capabilities, @@ -134,92 +133,75 @@ Capability names and codes use the POSIX portable character set. Capability string values have no associated encoding; they are strings of 8-bit characters. .SS Initialization -Initially, -\fB\%setupterm\fP should be called. -The high-level -.I curses -functions \fB\%initscr\fP and \fB\%newterm\fP call \fB\%setupterm\fP to -initialize the low-level set of terminal-dependent variables listed in +Call +.B \%setupterm +from your application to have +.I \%term\%info +manage the terminal device; +this action initializes the terminal-dependent variables listed in \fB\%term_variables\fP(3X). -.PP -Applications can use the terminal capabilities either directly -(via header definitions), -or by special functions. -The header files -.I \%curses.h -and -.I \%term.h -should be included -(in that order) -to get the definitions for these strings, -numbers, -and flags. -.PP -The +(A +.I curses +application calling \fB\%initscr\fP(3X) or \fB\%newterm\fP(3X) achieves +the same result.) +Applications can use the terminal capabilities either directly, +by object definitions corresponding to capability names and codes +(see \fB\%term_variables\fP(3X)) +or by calling the functions documented here. +.B \%setupterm +initializes the .I \%term\%info variables .B \%lines and .B \%columns -are initialized by \fB\%setupterm\fP as follows. -.bP -If \fB\%use_env(FALSE)\fP has been called, -values for -.B \%lines -and -.B \%columns -specified in -.I \%term\%info -are used. -.bP -Otherwise, -if the environment variables -.I LINES -and -.I \%COLUMNS -exist, -their values are used. -If these environment variables do not exist and the program is running -in a window, -the current window size -is used. -Otherwise, -if the environment variables do not exist, -the values for -.B \%lines -and -.B \%columns -specified in the -.I \%term\%info -database are used. +as described in \fB\%use_env\fP(3X). .PP -Parameterized strings should be passed through \fB\%tparm\fP to -instantiate them. +Pass parameterized string capability values through +.B \%tparm +to instantiate them. All .I \%term\%info strings -(including the output of \fB\%tparm\fP) -should be sent to the terminal device with \fB\%tputs\fP or -\fB\%putp\fP. -Call \fB\%reset_shell_mode\fP to restore the terminal modes before -exiting; -see \fB\%curs_kernel\fP(3X). -.PP -Programs that use -cursor addressing should +(including the output of +.BR \%tparm ")" +should be sent to the terminal device with +.B \%tputs +or +.BR \%putp "." +Call +\fB\%reset_shell_mode\fP(3X) to restore the terminal modes before +exiting. +(A +.I curses +application calling \fB\%endwin\fP(3X) achieves the same result.) +.\" XXX: What should a "pure" terminfo application that wants to link +.\" only with libtinfo, and not libcurses, do? +.PP +Programs that use cursor addressing should emit certain capabilities +at specific times. +Specifically, +output .bP -output \fB\%enter_ca_mode\fP upon startup and +.B \%enter_ca_mode +upon startup, +and .bP -output \fB\%exit_ca_mode\fP before exiting. +.B \%exit_ca_mode +before exiting. .PP Programs that execute shell subprocesses should .bP -call \fB\%reset_shell_mode\fP and -output \fB\%exit_ca_mode\fP before the shell -is called and +call \fB\%reset_shell_mode\fP(3X) and output +.B \%exit_ca_mode +before the shell is called, +and .bP -output \fB\%enter_ca_mode\fP and -call \fB\%reset_prog_mode\fP after returning from the shell. +output +.B \%enter_ca_mode +and call \fB\%reset_prog_mode\fP(3X) after returning from the shell. +.\" XXX: What should a "pure" terminfo application that wants to link +.\" only with libtinfo, and not libcurses, do? .PP \fB\%setupterm\fP reads in the .I \%term\%info @@ -228,7 +210,7 @@ initializing the .I \%term\%info structures, but does not set up the output virtualization structures used by -.IR curses . +.IR curses "." Its parameters follow. .RS 3 .TP 5 @@ -250,9 +232,9 @@ terminal, passing an output .I stream rather than a -.IR descriptor . +.IR descriptor "." In -.IR curses , +.IR curses "," the two are the same because \fB\%newterm\fP calls \fB\%setupterm\fP, passing the file descriptor derived from its output stream parameter. .TP 5 @@ -262,12 +244,14 @@ the caller. If .I errret is not null, -then \fB\%setupterm\fP returns +then +.B \%setupterm +returns .B OK or .B ERR and stores a status value in the integer pointed to by -.IR errret . +.IR errret "." A return value of .B OK combined with status of @@ -280,17 +264,16 @@ If .B ERR is returned, examine -.I errret: +.IR errret "." .RS .TP 5 .B 1 -means that the terminal is hardcopy, +means that the terminal is a hard-copy type +(lacks destructive backspace), and cannot be used for .I curses applications. -.IP -\fB\%setupterm\fP determines if the entry is a hardcopy type by -checking the +The library determines this fact by checking the terminal type's .B \%hardcopy .RB ( hc ) capability. @@ -302,8 +285,8 @@ having too little information for .I curses applications to run. .IP -\fB\%setupterm\fP determines if the entry is a generic type by -checking the +.B \%setupterm +determines if the entry is a generic type by checking the .B \%generic_type .RB ( gn ) capability. @@ -317,84 +300,102 @@ database could not be found. If .I errret is null, -\fB\%setupterm\fP reports an error message upon finding an error and -exits. +.B \%setupterm +reports an error message upon finding an error and exits. Thus, the simplest call is: .RS .IP .EX -setupterm((char *)0, 1, (int *)0); +setupterm((char *) NULL, 1, (int *) NULL); .EE .RE .IP which uses all the defaults and sends the output to -.BR stdout . +.IR stdout "." .RE .\" ******************************************************************** .SS "The Terminal State" -\fB\%setupterm\fP stores its information about the terminal in a +.B \%setupterm +stores its information about the terminal in a .I \%TERMINAL -structure pointed to by the global variable \fB\%cur_term\fP. +structure pointed to by the global variable +.BR \%cur_term "." If it detects an error, or decides that the terminal is unsuitable (hardcopy or generic), it discards this information, -making it not available to applications. +making it unavailable to applications. .PP -If \fB\%setupterm\fP is called repeatedly for the same terminal type, -it will reuse the information. -It maintains only one copy of a given terminal's capabilities in memory. -If it is called for different terminal types, -\fB\%setupterm\fP allocates new storage for each set of terminal -capabilities. -.PP -\fB\%set_curterm\fP sets \fB\%cur_term\fP to -.IR \%nterm , -and makes all of the +If +.B \%setupterm +is called repeatedly for the same terminal type, +it reuses the information. +It maintains only one copy of a given type's capabilities in memory. +If called for different types, +.B \%setupterm +allocates new storage for each set of terminal capabilities. +.PP +.B \%set_curterm +sets +.B \%cur_term +to +.IR \%nterm "," +making all of the .I \%term\%info Boolean, numeric, -and string variables use the values from -.IR \%nterm . -It returns the old value of \fB\%cur_term\fP. -.PP -\fB\%del_curterm\fP frees the space pointed to by -.I \%oterm -and makes it available for further use. +and string capabilities use the values from +.IR \%nterm "." +It returns the old value of +.BR \%cur_term "." +.PP +.B \%del_curterm +releases the memory pointed to by +.IR \%oterm "." If .I \%oterm is -the same as \fB\%cur_term\fP, +the same as +.BR \%cur_term "," references to any of the .I \%term\%info Boolean, numeric, -and string variables thereafter may refer to invalid memory locations -until another \fB\%setupterm\fP has been called. -.PP -\fB\%restartterm\fP is similar to \fB\%setupterm\fP and \fB\%initscr\fP, -except that it is called after restoring memory to a previous state +and string capabilities thereafter may refer to invalid memory locations +until +.B \%setupterm +is called again. +.PP +.B \%restartterm +is similar to +.BR \%setupterm "," +but is intended for use after restoring program memory +to a previous state (for example, -when reloading a game saved as a core image dump). -\fB\%restartterm\fP assumes that the windows and the input and output -options are the same as when memory was saved, -but the terminal type and baud rate may be different. +when reloading an application that has been suspended from one terminal +session and restored in another). +.B \%restartterm +assumes that the display dimensions +and the input and output options are the same as when memory was saved, +but the terminal type and line speed may differ. Accordingly, -\fB\%restartterm\fP saves various terminal state bits, -calls \fB\%setupterm\fP, -and then restores the bits. +.B \%restartterm +saves relevant terminal state, +calls +.BR \%setupterm "," +then restores that state. .\" ******************************************************************** .SS "Formatting Output" \fB\%tparm\fP instantiates the string .I str with parameters -.IR pi . -A pointer is returned to the result of +.IR pi "." +It returns a pointer to a character string representing .I str -with the parameters applied. -Application developers should keep in mind these quirks of the -interface: +with the parameters applied to \*(``%\*('' expressions within. +.\" XXX: Whose responsibility is it to free that string? +Application developers should keep in mind some quirks of the interface. .bP Although \fB\%tparm\fP's actual parameters may be integers or strings, the prototype expects @@ -413,67 +414,79 @@ it is interpreted by \fB\%tputs\fP. The capability string is null-terminated. Use \*(``\e200\*('' where an ASCII NUL is needed in the output. .PP -\fB\%tiparm\fP is a newer form of \fB\%tparm\fP which uses +\fB\%tiparm\fP is a newer form of \fB\%tparm\fP that uses .I \%stdarg.h -rather than a fixed-parameter list. +rather than a fixed-length parameter list. Its numeric parameters are .IR int s rather than .IR long "s." .PP -Both \fB\%tparm\fP and \fB\%tiparm\fP assume that the application passes -parameters consistent with the terminal description. -Two extensions are provided as alternatives to deal with untrusted data. +.B \%tparm +and +.B \%tiparm +assume that the application +passes parameters consistent with the terminal description. +.I \%ncurses +provides two extensions as alternatives to deal with untrusted data. .bP -\fB\%tiparm_s\fP is an extension which is a safer formatting function -than \fB\%tparm\fR or \fB\%tiparm\fR, +The +.B \%tiparm_s +extension is a safer formatting function than +.B \%tparm +or +.BR \%tiparm "," because it allows the developer to tell the .I curses library how many parameters to expect in the parameter list, and which may be string parameters. .IP -The \fImask\fP parameter has one bit set for each of the parameters +The +.I mask +parameter has one bit set for each of the parameters (up to 9) passed as .I char pointers rather than numbers. .bP -The extension \fB\%tiscan_s\fP allows the application to inspect a -formatting capability to see what the +The extension +.B \%tiscan_s +allows the application +to inspect a formatting capability to see what the .I curses library would assume. .\" ******************************************************************** .SS "Output Functions" -String capabilities can contain padding information, +String capabilities can contain +.IR padding "," a time delay (accommodating performance limitations of hardware terminals) -expressed as \fB$<\fIn\fB>\fR, -where \fIn\fP is a nonnegative integral count of milliseconds. -If \fIn\fP exceeds 30,000 +expressed as +.BI $< n >\c +, +where +.I n +is a nonnegative integral count of milliseconds. +If +.I n +exceeds 30,000 (thirty seconds), -it is capped at that value. +.I \%ncurses +caps it at that value. .PP -\fB\%tputs\fP interprets time-delay information in the string +.B \%tputs +interprets time delays in the string .I str -and outputs it, -executing the delays: +and acts upon them. .bP The .I str parameter must be a .I \%term\%info -string variable or the return value of -\fB\%tparm\fP, -\fB\%tiparm\fP, -\fB\%tgetstr\fP, -or \fB\%tgoto\fP. -.IP -The \fB\%tgetstr\fP and \fB\%tgoto\fP functions are part of the -.I termcap -interface, -which happens to share these function names with the -.I \%term\%info -API. +string capability or the return value of +.B \%tparm +or +.BR \%tiparm "." .bP .I affcnt is the number of lines affected, @@ -486,9 +499,9 @@ is a .IR \%putchar -like function to which the characters are passed, one at a time. -.IP -If \fB\%tputs\fP processes a time-delay, -it uses the \fB\%delay_output\fP(3X) function, +.PP +.B \%tputs +processes each time delay with the \fB\%delay_output\fP(3X) function, routing any resulting padding characters through this function. .PP \fB\%putp\fR calls @@ -496,19 +509,19 @@ routing any resulting padding characters through this function. .IB str ", 1, putchar)\c" \*(''. The output of \fB\%putp\fP always goes to -.BR stdout , +.IR stdout "," rather than the .I \%file\%des specified in \fB\%setupterm\fP. .PP \fB\%vidputs\fP displays the string on the terminal in the video attribute mode -.IR attrs , +.IR attrs "," which is any combination of the attributes listed in \fB\%curses\fP(3X). The characters are passed to the .IR \%putchar -like function -.IR putc . +.IR putc "." .PP \fB\%vidattr\fP is like \fB\%vidputs\fP, except that it outputs through \fI\%putchar\fP(3). @@ -519,20 +532,20 @@ and correspond to .B \%vidattr and -.BR \%vidputs , +.BR \%vidputs "," respectively. They use multiple parameters to represent the character attributes and color; namely, .bP -.IR \%attrs , +.IR \%attrs "," of type -.IR \%attr_t , +.IR \%attr_t "," for the attributes and .bP -.IR pair , +.IR pair "," of type -.IR short , +.IR short "," for the color pair number. .PP Use the attribute constants prefixed with @@ -540,7 +553,7 @@ Use the attribute constants prefixed with with .B \%vid_attr and -.BR \%vid_puts . +.BR \%vid_puts "." .PP X/Open Curses reserves the .I opts @@ -548,44 +561,39 @@ argument for future use, saying that applications must provide a null pointer for that argument; but see section \*(``EXTENSIONS\*('' below. .PP -\fB\%mvcur\fP provides low-level cursor motion. -It takes effect immediately -(rather than at the next refresh). -Unlike the other low-level output functions, -which either write to the standard output or pass an output function -parameter, -\fB\%mvcur\fP uses an output file descriptor derived from -the output stream parameter of \fB\%newterm\fP(3X). -.PP -While \fB\%putp\fP and \fB\%mvcur\fP are low-level functions that do not -use high-level +While +.B \%putp +is a lower-level function +that does not use higher-level .I curses state, .I \%ncurses -declares them in +declares it in .I \%curses.h -because System\ V did this +because System\ V did so (see section \*(``HISTORY\*('' below). .\" ******************************************************************** .SS "Terminal Capability Functions" -\fB\%tigetflag\fP, -\fB\%tigetnum\fP, -and \fB\%tigetstr\fP return the value of the capability corresponding to +.BR \%tigetflag "," +.BR \%tigetnum "," +and +.B \%tigetstr +return the value of the capability corresponding to the .I \%term\%info -.IR cap-code , +.IR cap-code "," such as -.BR xenl , +.BR xenl "," passed to them. The .I cap-code -for each capability is given in the table column entitled -.I cap-code -code in the capabilities section of \fB\%terminfo\fP(5). +for each capability is given in the table column of that name +in the \*(``Capabilities\*('' section of \fB\%terminfo\fP(5). .PP These functions return special values to denote errors. .PP -\fB\%tigetflag\fP returns +.B \%tigetflag +returns .TP .B \-1 if @@ -596,7 +604,8 @@ or .B 0 if it is canceled or absent from the terminal description. .PP -\fB\%tigetnum\fP returns +.B \%tigetnum +returns .TP .B \-2 if @@ -607,7 +616,8 @@ or .B \-1 if it is canceled or absent from the terminal description. .PP -\fB\%tigetstr\fP returns +.B \%tigetstr +returns .TP .B "(char *)\-1" if @@ -615,7 +625,7 @@ if is not a string capability, or .TP -.B 0 +.B NULL if it is canceled or absent from the terminal description. .\" ******************************************************************** .SS "Terminal Capability Names" @@ -628,9 +638,9 @@ and .bP the long \fI\%term\%info\fP names (\*(``fnames\*('') .PP -for each of the predefined +for each standard .I \%term\%info -variables: +capability name. .PP .RS .nf @@ -646,11 +656,11 @@ terminal description. As a side effect, it sets \fB\%cur_term\fP to point to this memory. If an application calls -.IP +.RS .EX del_curterm(cur_term); .EE -.PP +.RE the memory will be freed. .PP The formatting functions \fB\%tparm\fP and \fB\%tiparm\fP extend the @@ -684,11 +694,16 @@ Normally they do not free this memory, but it is possible to do that using the \fB\%delscreen\fP(3X) function. .\" ******************************************************************** .SH RETURN VALUE -X/Open Curses defines no failure conditions. +Functions that return integers return +.B ERR +upon failure and +.B OK +upon success. +.PP In -.IR \%ncurses , +.IR \%ncurses "," .TP 5 -.B del_curtem +.B del_curterm fails if its terminal parameter is null. .TP 5 .B putp @@ -696,15 +711,16 @@ calls \fB\%tputs\fP, returning the same error codes. .TP 5 .B restartterm -fails if the associated call to \fB\%setupterm\fP returns an error. +fails if the associated call to \fB\%setupterm\fP returns +.BR ERR "." .TP 5 .B setupterm fails if it cannot allocate enough memory, or create the initial windows -.RB ( \%stdscr , -.BR \%curscr , +.RB \%( stdscr , +.BR \%curscr "," and -.BR \%newscr ) +.BR \%newscr ")." Other error conditions are documented above. .TP 5 .B tparm @@ -738,12 +754,12 @@ and unlike the other wide-character functions, is also provided in the non-wide-character configuration. .\" ******************************************************************** .SH EXTENSIONS -The functions marked as extensions were designed for -.IR \%ncurses , +The functions marked as extensions originated in +.IR \%ncurses "," and are not found in SVr4 -.IR curses , +.IR curses "," 4.4BSD -.IR curses , +.IR curses "," or any other previous .I curses implementation. @@ -752,57 +768,84 @@ implementation. allows .I opts to be a pointer to -.IR int , +.IR int "," which overrides the .I pair .RI ( short ) argument. .\" ******************************************************************** .SH PORTABILITY -\fB\%setterm\fP is not described by X/Open and must be considered -non-portable. -All other functions are as described by X/Open. +Except for +.IR \%setterm "," +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. +.PP +SVr4 describes a successful return value +except where \*(``otherwise noted\*('' +as +\*(``an integer value other than +.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 539 +.SS "Header Files" +On legacy +.I curses +systems, +include +.I \%curses.h +and +.I \%term.h +in that order +to make visible the definitions of the string arrays +storing the capability names and codes. .SS "Compatibility Macros" -This implementation provides a few macros for compatibility with systems -before SVr4 +.I \%ncurses +implements a few macros for early System\ V +.I curses +compatibility (see section \*(``HISTORY\*('' below). They include -\fB\%Bcrmode\fP, -\fB\%Bfixterm\fP, -\fB\%Bgettmode\fP, -\fB\%Bnocrmode\fP, -\fB\%Bresetterm\fP, -\fB\%Bsaveterm\fP, +.IR \%crmode "," +.IR \%fixterm "," +.IR \%gettmode "," +.IR \%nocrmode "," +.IR \%resetterm "," +.IR \%saveterm "," and -\fB\%Bsetterm\fP. +.IR \%setterm "." .PP In SVr4, these are found in -.IR \%curses.h , -but except for \fB\%setterm\fP, +.IR \%curses.h "," +but except for +.IR \%setterm "," are likewise macros. The one function, -\fB\%setterm\fP, +.IR \%setterm "," is mentioned in the manual page. -It further notes that \fB\%setterm\fP was replaced by \fB\%setupterm\fP, +It further notes that +.I \%setterm +was replaced by +.IR \%setupterm "," stating that the call .RS .EX -setupterm(\fIterm\fP, 1, (int *)0) +.RI setupterm( term ", 1, (int *)0)" .EE .RE -provides the same functionality as \fB\%setterm(\fIterm\fB)\fR, -discouraging the latter for new programs. -.I \%ncurses -implements each of these symbols as macros for BSD -.I curses -compatibility. +provides the same functionality as +.RS +.EX +.RI setterm( term ) +.EE +.RE +and discouraging the latter for new programs. .SS "Legacy Data" -\fB\%setupterm\fP copies the terminal name to the array \fB\%ttytype\fP. -This is not part of X/Open Curses, +.I \%setupterm +copies the terminal name to the array +.IR \%ttytype "." +This behavior is not specified by X/Open Curses, but is assumed by some applications. .PP -Other implementions may not declare the capability name arrays. +Other implementations may not declare the capability name arrays. Some provide them without declaring them. X/Open Curses does not specify them. .PP @@ -811,29 +854,39 @@ as defined by .RB \%\*(`` "@TIC@ \-x" \*('', are not stored in the arrays described here. .SS "Output Buffering" -Older versions of \fI\%ncurses\fP assumed that the file descriptor -passed to \fB\%setupterm\fP from \fB\%initscr\fP or \fB\%newterm\fP uses -buffered I/O, -and would write to the corresponding stream. +Older versions of +.I \%ncurses +assumed that the file descriptor passed to +.I \%setupterm +from +.I \%initscr +or +.I \%newterm +used buffered I/O, +and wrote to the corresponding +.I stdio +stream. In addition to the limitation that the terminal was left in block-buffered mode on exit (like System\ V -.IR curses ), +.IR curses ")," it was problematic because .I \%ncurses did not allow a reliable way to clean up on receiving -.BR SIGTSTP . +.IR SIGTSTP "." .PP -The current version (ncurses6) +.I \%ncurses +.RI 6. x uses output buffers managed directly by -.IR \%ncurses . -Some of the low-level functions described in this manual page write -to the standard output. -They are not signal-safe. -The high-level functions in +.IR \%ncurses "." +The lower-level functions described here +that write to the terminal device +do so via the standard output stream; +they thus are not signal-safe. +The higher-level functions in .I \%ncurses -employ alternate versions of these functions using the more reliable -buffering scheme. +employ alternate versions of these functions +using a more reliable buffering scheme. .SS "Function Prototypes" The X/Open Curses prototypes are based on the SVr4 .I curses @@ -844,19 +897,23 @@ standardized in the late 1980s. X/Open Curses uses .I \%const less effectively than a later design might, -sometimes applying it needlessly to values that are already constant, -and in most cases overlooking parameters that normally would use -.IR \%const . +sometimes applying it needlessly to function parameters +that are passed by value +(and therefore copied), +and in most cases overlooking parameters +that normally would benefit from +.IR \%const "." Passing .IR \%const -qualified parameters to functions that do not declare them .I \%const may prevent the program from compiling. On the other hand, -\*(``writable strings\*('' are an obsolescent feature. +\*(``writable strings\*('' are an obsolescent C language feature. .IP As an extension, -this implementation can be configured to change the function prototypes +.I \%ncurses +can be configured to change the function prototypes to use the .I \%const keyword. @@ -864,41 +921,55 @@ The .I \%ncurses ABI 6 enables this feature by default. .bP -X/Open Curses prototypes \fB\%tparm\fP with a fixed number of -parameters, +X/Open Curses prototypes +.I \%tparm +with a fixed number of parameters, rather than a variable argument list. .IP -This implementation uses a variable argument list, +.I \%ncurses +uses a variable argument list, but can be configured to use the fixed-parameter list. Portable applications should provide nine parameters after the format; zeroes are fine for this purpose. .IP In response to review comments by Thomas E. Dickey, -X/Open Curses Issue 7 proposed the \fB\%tiparm\fP function in mid-2009. +X/Open Curses Issue\ 7 proposed the +.I \%tiparm +function in mid-2009. .IP -While \fB\%tiparm\fP is always provided in \fI\%ncurses\fP, -the older form is only available as a build-time configuration option. +While +.I \%tiparm +is always provided in +.IR \%ncurses "," +the older form is available only as a build-time configuration option. If not specially configured, -\fB\%tparm\fP is the same as \fB\%tiparm\fP. +.I \%tparm +is the same as +.IR \%tiparm "." .PP -Both forms of \fB\%tparm\fP have drawbacks: +Both forms of +.I \%tparm +have drawbacks. .bP -Most of the calls to \fB\%tparm\fP use only one or two parameters. +Most calls to +.I \%tparm +require only one or two parameters. Passing nine on each call is awkward. .IP Using .I long for the numeric parameter type is a workaround to make the parameter use -the same amount of stack as a pointer. -That approach dates back to the mid-1980s, +the same amount of stack memory as a pointer. +That approach dates to the mid-1980s, before C was standardized. -Since then, -there is a standard -(and pointers are not required to fit in a -.IR long ). +Since ANSI\ C (1989), +C language standards do not require a pointer to fit in a +.IR long ")." .bP Providing the right number of parameters for a variadic function -such as \fB\%tiparm\fP can be a problem, +such as +.I \%tiparm +can be a problem, in particular for string parameters. However, only a few @@ -907,21 +978,35 @@ capabilities use string parameters (for instance, the ones used for programmable function keys). .IP -The \fI\%ncurses\fP library checks usage of these capabilities, -and returns an error if the capability mishandles string parameters. +The +.I \%ncurses +library checks usage of these capabilities, +and returns +.I ERR +if the capability mishandles string parameters. But it cannot check if a calling program provides strings in the right -places for the \fB\%tparm\fP calls. +places for the +.I \%tparm +calls. .IP -The \fB\%@TPUT@\fR(1) program checks its use of these capabilities with -a table, -so that it calls \fB\%tparm\fP correctly. +.IR \%ncurses 's +\fB\%@TPUT@\fR(1) checks its use of these capabilities with a table, +so that it calls +.I \%tparm +correctly. .SS "Special \fITERM\fP treatment" -If configured to use the terminal driver, -.\" XXX: as opposed to the Unix terminal driver, termio(s)? +If +.I \%ncurses +is configured to use a terminal driver +that does not employ the POSIX +.I \%termios +API, as with the MinGW port, .bP -\fB\%setupterm\fP interprets a missing/empty \fITERM\fP variable as the -special value \*(``unknown\*(''. +.I \%setupterm +interprets a missing or empty +.I TERM +variable as the special value \*(``unknown\*(''. .IP SVr4 .I curses @@ -935,69 +1020,47 @@ capability, while the latter does not. A generic terminal is unsuitable for full-screen applications. .bP -\fB\%setupterm\fP allows explicit use of the -the windows console driver by checking if \fB$TERM\fP is set to -\*(``#win32con\*('' or an abbreviation of that string. +.I \%setupterm +allows explicit use of the Microsoft Windows console driver by checking +whether the +.I TERM +environment variable has the value \*(``#win32con\*('' +or an abbreviation of that string. .SS "Other Portability Issues" In SVr4, -\fB\%set_curterm\fP returns an -.IR int , -.B OK +.I \%set_curterm +returns an +.IR int "," +.I OK or -.BR ERR . +.IR ERR "." We have chosen to implement the X/Open Curses semantics. .PP In SVr4, -the third argument of \fB\%tputs\fP has the type -.RB \*(`` "int (*putc)(char)" \*(''. -.PP -At least one implementation of X/Open Curses (Solaris) returns a value -other than -.B OK +the third argument of +.I \%tputs +has the type +.RB \*(`` "int (*)(char)" \*(''. +.PP +At least one implementation of X/Open Curses +(Solaris +.IR \%xcurses ")" +returns a value other than +.I OK or -.B ERR -from \fB\%tputs\fP. +.I ERR +from +.IR \%tputs "." It instead returns the length of the string, and does no error checking. .PP -X/Open Curses notes that after calling \fB\%mvcur\fP, -the -.I curses -state may not match the actual terminal state, -and that an application should touch and refresh the window before -resuming normal -.I curses -calls. -Both -.I \%ncurses -and SVr4 +Very old versions of AIX +.\" Can we be more specific? Like, AIX 4.3.3 and earlier? --GBR .I curses -implement \fB\%mvcur\fP using the -.I SCREEN -data allocated in either \fB\%initscr\fP or \fB\%newterm\fP. -So though it is documented as a -.I \%term\%info -function, -\fB\%mvcur\fP is really a -.I curses -function that is not well specified. -.PP -X/Open Curses states that the old location must be given for -\fB\%mvcur\fP to accommodate terminals that lack absolute cursor -positioning. -.\" X/Open Curses Issue 7, p. 161 -.I \%ncurses -allows the caller to use \-1 for either or both old coordinates. -The \-1 tells -.I \%ncurses -that the old location is unknown, -and that it must use only absolute motion, -as with the -.B \%cursor_address -.RB ( cup ) -capability, -rather than the least costly combination of absolute and relative -motion. +required inclusion of +.I \%curses.h +before +.IR \%term.h . .\" ******************************************************************** .SH HISTORY SVr2 (1984) introduced the @@ -1006,14 +1069,14 @@ feature. Its programming manual mentioned the following low-level functions. .PP .TS -lB lB -lB lx. +Lb Lb +Li Lw(47n)x. Function Description _ fixterm restore terminal to \*(``in \fIcurses\fP\*('' state gettmode establish current terminal modes mvcur low level cursor motion -putp use \fBtputs\fP to send characters via \fIputchar\fP +putp use \fItputs\fP to send characters via \fIputchar\fP resetterm set terminal modes to \*(``out of \fIcurses\fP\*(''\ state resetty reset terminal flags to stored value @@ -1023,7 +1086,7 @@ setterm establish terminal with given type setupterm establish terminal with given type tparm interpolate parameters into string capability tputs apply padding information to a string -vidattr like \fBvidputs\fP, but output through \fIputchar\fP +vidattr like \fIvidputs\fP, but output through \fIputchar\fP vidputs T{ write string to terminal, applying specified attributes T} @@ -1036,8 +1099,8 @@ compatibility (commenting that they \*(``may go away at a later date\*(''). .PP .TS -lB lB -lB lx. +Lb Lb +Li Lw(48n)x. Function Description _ tgetent look up \fItermcap\fP entry for given \fIname\fP @@ -1054,7 +1117,8 @@ Early .I \%term\%info programs obtained capability values from the .I \%TERMINAL -structure initialized by \fB\%setupterm\fP. +structure initialized by +.IR \%setupterm "." .PP SVr3 (1987) extended .I \%term\%info @@ -1062,11 +1126,15 @@ by adding functions to retrieve capability values (like the .I termcap interface), -and reusing \fB\%tgoto\fP and \fB\%tputs\fP. +and reusing +.I \%tgoto +and +.IR \%tputs "." .PP +.ne 4v .TS -lB lB -lB lx. +Lb Lb +LI Lx. Function Description _ tigetflag get Boolean entry for given \fIid\fP @@ -1082,33 +1150,40 @@ interface, documenting them as obsolete. .PP .TS -lB lB -l lx. +Lb Lb +Li Lix. Function Replaced by _ crmode cbreak fixterm reset_prog_mode -gettmode \fIn/a\fP +gettmode \fRn/a\fP nocrmode nocbreak resetterm reset_shell_mode saveterm def_prog_mode setterm setupterm .TE .PP -SVr3 kept the \fB\%mvcur\fP, -\fB\%vidattr\fP, -and \fB\%vidputs\fP functions, -along with \fB\%putp\fP, -\fB\%tparm\fP, -and \fB\%tputs\fP. +SVr3 kept the +.IR \%mvcur "," +.IR \%vidattr "," +and +.I \%vidputs +functions, +along with +.IR \%putp "," +.IR \%tparm "," +and +.IR \%tputs "." The latter were needed to support padding, -and to handle capabilities accessed by functions such as \fB\%vidattr\fP -(which used more than the two parameters supported by \fB\%tgoto\fP). +and to handle capabilities accessed by functions such as +.I \%vidattr +(which used more than the two parameters supported by +.IR \%tgoto ")." .PP SVr3 introduced the functions for switching between terminal descriptions; for example, -\fB\%set_curterm\fP. +.IR \%set_curterm "." Some changes reflected incremental improvements to the SVr2 library. .bP The @@ -1118,11 +1193,16 @@ for the .I term structure provided in SVr2. .bP -Various global variables such as \fB\%boolnames\fP were mentioned -in the programming manual at this point, +Various global variables such as +.I \%boolnames +were mentioned in the programming manual at this point, though the variables had been provided in SVr2. .PP -SVr4 (1989) added the \fB\%vid_attr\fP and \fB\%vid_puts\fP functions. +SVr4 (1989) added the +.I \%vid_attr +and +.I \%vid_puts +functions. .PP Other low-level functions are declared in the .I curses diff --git a/man/curs_threads.3x b/man/curs_threads.3x index d49c16e71f09..a387c874ba74 100644 --- a/man/curs_threads.3x +++ b/man/curs_threads.3x @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright 2021-2023,2024 Thomas E. Dickey * +.\" Copyright 2021-2024,2025 Thomas E. Dickey * .\" Copyright 2008-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_threads.3x,v 1.56 2024/03/16 15:35:01 tom Exp $ -.TH curs_threads 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_threads.3x,v 1.59 2025/02/15 19:41:22 tom Exp $ +.TH curs_threads 3X 2025-02-15 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -102,7 +102,7 @@ It further makes functions of the common global variables \fB\%newscr\fP, and \fB\%ttytype\fP, -maintaining them as as read-only values in the \fISCREEN\fP structure. +maintaining them as read-only values in the \fISCREEN\fP structure. .PP Even this is not enough to make an application using \fIcurses\fP thread-safe. diff --git a/man/curs_touch.3x b/man/curs_touch.3x index 613b6958268d..29a3a3ace011 100644 --- a/man/curs_touch.3x +++ b/man/curs_touch.3x @@ -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,18 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_touch.3x,v 1.47 2024/04/20 21:20:07 tom Exp $ -.TH curs_touch 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_touch.3x,v 1.63 2025/01/19 00:51:10 tom Exp $ +.TH curs_touch 3X 2025-01-18 "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 '' "" +.\} .SH NAME \fB\%touchwin\fP, \fB\%touchline\fP, @@ -77,16 +87,19 @@ call to \fB\%wrefresh\fP; otherwise they return \fBFALSE\fP. In addition, \fB\%is_linetouched\fP returns \fBERR\fP if \fIline\fP is not valid for the given window. .SH RETURN VALUE -All routines return the integer \fBERR\fP upon failure and an integer value -other than \fBERR\fP upon successful completion, unless otherwise noted in the -preceding routine descriptions. +Functions returning integers return +.B ERR +upon failure and +.B OK +upon success. .PP -X/Open Curses does not specify any error conditions. -In this implementation +In +.IR \%ncurses "," .RS 3 .TP 5 \fBis_linetouched\fP -returns an error +returns +.B ERR if the window pointer is null, or if the line number is outside the window boundaries. .IP @@ -101,23 +114,40 @@ the \fBERR\fP is provided by a macro named \fB\%is_linetouched\fP. The actual function returns \fBFALSE\fP when it detects an error. .TP 5 \fBwtouchln\fP -returns an error +returns +.B ERR if the window pointer is null, or if the line number is outside the window boundaries. .RE .SH NOTES -All of these routines except \fB\%wtouchln\fP may be macros. +All of these functions except +.B \%wtouchln +may be implemented as macros. .SH PORTABILITY -These functions were introduced by SVr4. -The Solaris \fIcurses\fP header file, -for instance, defines both an actual function and macro for each. -The macros give the same result as the actual functions. -SVr4 \fIcurses\fP does not check the window parameter \fIwin\fP to ensure -that it is not \fBNULL\fP; -otherwise this implementation behaves the same as SVr4. +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. .PP -X/Open Curses, Issue 4 describes these functions, -but defines no error conditions. +SVr4 describes a successful return value +except where \*(``otherwise noted\*('' +as +\*(``an integer value other than +.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 540 +.PP +SVr4 does not check +.I win +to ensure that it is not a null pointer. +.SH HISTORY +SVr2 (1984) introduced +.IR \%touchwin "," +.PP +SVr3 (1987) added +.IR \%touchline "." +SVr3.1 later that year supplied +.IR \%is_linetouched "," +.IR \%is_wintouched "," +.IR \%untouchwin "," +and +.IR \%wtouchln "." .SH SEE ALSO \fB\%curses\fP(3X), \fB\%curs_refresh\fP(3X), diff --git a/man/curs_trace.3x b/man/curs_trace.3x index ddae79112541..7f9d115e1369 100644 --- a/man/curs_trace.3x +++ b/man/curs_trace.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2019-2023,2024 Thomas E. Dickey * +.\" Copyright 2019-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 * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_trace.3x,v 1.50 2024/04/20 21:24:19 tom Exp $ -.TH curs_trace 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_trace.3x,v 1.55 2025/01/19 00:51:10 tom Exp $ +.TH curs_trace 3X 2025-01-18 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -139,7 +139,7 @@ If the file already exists, no tracing is done. .bP If tracing is not available, \fBcurses_trace\fP returns zero (0). .SS "Trace Parameter" -The trace parameter is formed by OR'ing +The trace parameter is formed by logically \*(``or\*(''-ing values from the list of \fBTRACE_\fIxxx\fR definitions in \fB<curses.h>\fR. These include: .TP 5 @@ -264,13 +264,15 @@ if \fBDEBUG\fP was defined when building the library. .IP The SVr4 tracing feature is undocumented. .bP -PDCurses provides \fBtraceon\fP and \fBtraceoff\fP, +.I \%PDCurses +provides \fBtraceon\fP and \fBtraceoff\fP, which (like SVr4) are always available, and enable tracing to the \*(``trace\*('' file only when a debug-library is built. .IP -PDCurses has a short description of these functions, +.I \%PDCurses +has a short description of these functions, with a note that they are not present in X/Open Curses, \fI\%ncurses\fP or NetBSD. It does not mention SVr4, diff --git a/man/curs_util.3x b/man/curs_util.3x index 1df0a1d3f394..ba2e5ec2defd 100644 --- a/man/curs_util.3x +++ b/man/curs_util.3x @@ -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,17 +28,21 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_util.3x,v 1.101 2024/04/20 21:20:07 tom Exp $ -.TH curs_util 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_util.3x,v 1.151 2025/11/12 01:06:36 tom Exp $ +.TH curs_util 3X 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq +.ds ^ \(ha +.ds ~ \(ti .\} .el \{\ .ie t .ds `` `` .el .ds `` "" .ie t .ds '' '' .el .ds '' "" +.ds ^ ^ +.ds ~ ~ .\} . .de bP @@ -63,53 +67,83 @@ miscellaneous \fIcurses\fR utility routines .nf \fB#include <curses.h> .PP -\fBconst char *unctrl(chtype \fIch\fP); -\fBwchar_t *wunctrl(cchar_t *\fIwch\fP); +\fBconst char * unctrl(chtype \fIch\fP); +\fBwchar_t * wunctrl(cchar_t * \fIwch\fP); .PP -\fBconst char *keyname(int \fIc\fP); -\fBconst char *key_name(wchar_t \fIwc\fP); +\fBconst char * keyname(int \fIc\fP); +\fBconst char * key_name(wchar_t \fIwc\fP); .PP \fBvoid filter(void); +\fI/* extension */ +\fBvoid nofilter(void); .PP -\fBvoid use_env(bool \fIf\fP); +\fBvoid use_env(bool \fIbf\fP); +\fI/* extension */ +\fBvoid use_tioctl(bool \fIbf\fP); .PP -\fBint putwin(WINDOW *\fIwin\fP, FILE *\fIfilep\fP); -\fBWINDOW *getwin(FILE *\fIfilep\fP); +\fBint putwin(WINDOW * \fIwin\fP, FILE * \fIfilep\fP); +\fBWINDOW * getwin(FILE * \fIfilep\fP); .PP \fBint delay_output(int \fIms\fP); -\fBint flushinp(void); .PP -\fI/* extensions */ -\fBvoid nofilter(void); -\fBvoid use_tioctl(bool \fIf\fP); +\fBint flushinp(void); .fi .SH DESCRIPTION -.SS unctrl -The \fBunctrl\fP routine returns a character string which is a printable -representation of the character \fIch\fP: -.bP -Printable characters are displayed as themselves, -e.g., a one-character string containing the key. -.bP -Control characters are displayed in the \fB^\fIX\fR notation. -.bP -Printing characters are displayed as is. -.bP -DEL (character 127) is displayed as \fB^?\fP. -.bP -Values above 128 are either meta characters -(if the screen has not been initialized, -or if \fBmeta\fP(3X) has been called with a \fBTRUE\fP parameter), -shown in the \fBM\-\fIX\fR notation, -or are displayed as themselves. -In the latter case, the values may not be printable; -this follows the X/Open specification. +.SS "unctrl, wunctrl" +.B unctrl +returns a null-terminated character string printably representing the +.I curses +character +.IR ch , +often one that originated in keyboard input; +see \fBgetch\fP(3X). +.bP +Printable characters represent themselves as a one-character string. +.bP +Control characters are expressed in +.BI \*^ X +notation, +where +.I X +is the printable symbol of the control code's value plus 32 +in the ISO\ 646/\*(``ASCII\*('' character set. +.bP +DEL +(character code 127) +is represented as +.BR \*^? . +.bP +A character code greater than 127 is represented in one of two ways. +.IP +If the screen has not been initialized or is in meta mode +(see \fBmeta\fP(3X)), +it is expressed in +.BI M- X +notation, +where X +is the representation of the code's value minus 128, +as described above. +.IP +If the screen is not in meta mode, +the character code is assumed to represent itself. +It nevertheless may not be printable; +this is the case for character codes 128-159 in ISO\ 8859 encodings. +.IP +.IR \%ncurses 's +\fB\%use_legacy_coding\fP(3X) +function configures +.BR \%unctrl 's +handling of these character codes. .PP -The corresponding \fBwunctrl\fP returns a printable representation of -a complex character \fIwch\fP. +.B \%wunctrl +returns a null-terminated wide-character string printably representing +the +.I curses +complex character +.IR wch . .PP -In both \fBunctrl\fP and \fBwunctrl\fP the attributes and color associated -with the character parameter are ignored. +Both functions ignore the attributes and color pair selection +of their argument. .SS "keyname, key_name" The \fBkeyname\fP routine returns a character string corresponding to the key \fIc\fP. @@ -121,22 +155,28 @@ They are displayed using \fBunctrl\fP. Values above 256 may be the codes for function keys. The function key name is displayed. .bP -Otherwise (if there is no corresponding name and the key is not a character) -the function returns null, to denote an error. +Otherwise +(if there is no corresponding name and the key is not a character) +the function returns null, +to denote an error. X/Open also lists an \*(``UNKNOWN KEY\*('' return value, which some implementations return rather than null. .LP The corresponding \fBkey_name\fP returns a multibyte character string corresponding -to the wide-character value \fIw\fP. -The two functions (\fBkeyname\fP and \fBkey_name\fP) +to the wide-character value \fIwc\fP. +The two functions +(\fBkeyname\fP and \fBkey_name\fP) do not return the same set of strings: .bP -\fBkeyname\fP returns null where \fBkey_name\fP would display a meta character. +\fBkeyname\fP returns null where \fBkey_name\fP +would display a meta character. .bP \fBkey_name\fP does not return the name of a function key. .SS "filter, nofilter" -The \fBfilter\fP routine, if used, must be called before \fBinitscr\fP or +The \fBfilter\fP routine, +if used, +must be called before \fBinitscr\fP or \fBnewterm\fP are called. Calling \fBfilter\fP causes these changes in initialization: .bP @@ -156,14 +196,15 @@ the capability \fBed\fP is disabled if \fBbce\fP is set; .bP and the \fBhome\fP string is set to the value of \fBcr\fP. .PP -The \fBnofilter\fP routine cancels the effect of a preceding \fBfilter\fP -call. +The \fBnofilter\fP routine cancels the effect +of a preceding \fBfilter\fP call. That allows the caller to initialize a screen on a different device, using a different value of \fB$TERM\fP. The limitation arises because the \fBfilter\fP routine modifies the in-memory copy of the terminal information. .SS use_env -The \fBuse_env\fP routine, if used, +The \fBuse_env\fP routine, +if used, should be called before \fBinitscr\fP or \fBnewterm\fP are called (because those compute the screen size). @@ -181,43 +222,46 @@ Then it asks for the screen size via operating system calls. If successful, it overrides the values from the terminal database. .bP -Finally (unless \fBuse_env\fP was called with \fBFALSE\fP parameter), +Finally +(unless \fBuse_env\fP was called with \fBFALSE\fP parameter), \fI\%ncurses\fP examines the \fILINES\fP or \fI\%COLUMNS\fP environment variables, using a value in those to override the results from the operating system or terminal database. .IP -\fI\%curses\fP also updates the screen size in response to -\fBSIGWINCH\fP, +.I curses +also updates the screen size in response to +.IR \%SIGWINCH "," unless overridden by the \fILINES\fP or \fI\%COLUMNS\fP environment variables, .SS use_tioctl -The \fBuse_tioctl\fP routine, if used, +The \fBuse_tioctl\fP routine, +if used, should be called before \fBinitscr\fP or \fBnewterm\fP are called (because those compute the screen size). After \fBuse_tioctl\fP is called with \fBTRUE\fP as an argument, \fI\%ncurses\fP modifies the last step in its computation of screen size as follows: .bP -checks if the \fILINES\fP and \fI\%COLUMNS\fP environment variables +checks whether the \fILINES\fP and \fI\%COLUMNS\fP environment variables are set to a number greater than zero. .bP -for each, \fI\%ncurses\fP updates the corresponding environment variable +for each, +\fI\%ncurses\fP updates the corresponding environment variable with the value that it has obtained via operating system call or from the terminal database. .bP \fI\%ncurses\fP re-fetches the value of the environment variables so -that it is still the environment variables which set the screen size. +that it is still the environment variables that set the screen size. .PP The \fB\%use_env\fP and \fB\%use_tioctl\fP routines combine as follows. .IP .TS -lB lB lB -lB lB lx. +Lb Lb Lb +Lb Lb Lw(29n)x. use_env use_tioctl Summary _ TRUE FALSE T{ -This is the default behavior. \fI\%ncurses\fP uses operating system calls unless overridden by \fILINES\fP or \fI\%COLUMNS\fP environment variables; @@ -234,7 +278,9 @@ T} .TE .SS "putwin, getwin" The \fBputwin\fP routine writes all data associated -with window (or pad) \fIwin\fP into +with window +(or pad) +\fIwin\fP into the file to which \fIfilep\fP points. This information can be later retrieved using the \fBgetwin\fP function. @@ -248,16 +294,18 @@ There are a few caveats: .bP the data written is a copy of the \fI\%WINDOW\fP structure, and its associated character cells. -The format differs between the wide-character (\fI\%ncursesw\fP) and -non-wide (\fI\%ncurses\fP) libraries. -You can transfer data between the two, however. +The format differs between the wide-character \%(\fIncursesw\fP) and +non-wide \%(\fIncurses\fP) libraries. +You can transfer data between the two, +however. .bP -the retrieved window is always created as a top-level window (or pad), +the retrieved window is always created as a top-level window +(or pad), rather than a subwindow. .bP the window's character cells contain the color pair \fIvalue\fP, but not the actual color \fInumbers\fP. -If cells in the retrieved window use color pairs which have not been +If cells in the retrieved window use color pairs that have not been created in the application using \fBinit_pair\fP, they will not be colored when the window is refreshed. .SS delay_output @@ -269,7 +317,8 @@ because \fI\%ncurses\fP transmits null characters instead of sleeping and requesting resumption from the operating system. Padding is used unless: .bP -the terminal description has \fBnpc\fP (\fBno_pad_char\fP) capability, or +the terminal description has \fBnpc\fP (\fBno_pad_char\fP) capability, +or .bP the environment variable \fB\%NCURSES_NO_PADDING\fP is set. .PP @@ -279,57 +328,85 @@ If the value of \fIms\fP exceeds 30,000 (thirty seconds), it is capped at that value. .SS flushinp -The \fBflushinp\fP routine throws away any typeahead that has been typed by the -user and has not yet been read by the program. +The \fBflushinp\fP routine throws away any typeahead +that has been typed by the user +and has not yet been read by the program. .SH RETURN VALUE -Except for \fBflushinp\fP, routines that return an integer return \fBERR\fP -upon failure and \fBOK\fP (SVr4 specifies only "an integer value other than -\fBERR\fP") upon successful completion. +Except for +.BR \%flushinp "," +functions that return integers return +.B ERR +upon failure and +.B OK +upon success. .PP -Routines that return pointers return \fBNULL\fP on error. +Functions that return pointers return a null pointer on failure. .PP -X/Open Curses does not specify any error conditions. -In this implementation -.RS 3 -.TP 5 -\fBflushinp\fP -returns an error if the terminal was not initialized. -.TP 5 -\fBputwin\fP -returns an error if the associated \fBfwrite\fP calls return an error. -.RE +In +.IR \%ncurses "," +.bP +.B \%flushinp +returns +.B ERR +if the terminal was not initialized, +and +.bP +.B \%putwin +returns +.B ERR +if its associated \fIwrite\fP(2) calls return +.BR ERR "." +.SH NOTES +.B \%wunctrl +is part of +.IR \%ncurses "'s" +wide-character API, +and is not available in its non-wide-character configuration. .SH PORTABILITY +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. 542 .SS filter -The SVr4 documentation describes the action of \fBfilter\fP only in the vaguest -terms. -The description here is adapted from X/Open Curses (which -erroneously fails to describe the disabling of \fBcuu\fP). +The SVr4 documentation describes the action of \fBfilter\fP +only in the vaguest terms. +The description here is adapted from X/Open Curses +(which erroneously fails to describe the disabling of \fBcuu\fP). .SS "delay_output padding" The limitation to 30 seconds and the use of \fBnapms\fP differ from other implementations. .bP -SVr4 curses does not delay if no padding character is available. +SVr4 +.I curses +does not delay if no padding character is available. .bP -NetBSD curses uses \fBnapms\fP when no padding character is available, +NetBSD +.I curses +uses \fBnapms\fP when no padding character is available, but does not take timing into account when using the padding character. .PP Neither limits the delay. .SS keyname The \fBkeyname\fP function may return the names of user-defined -string capabilities which are defined in the terminfo entry via the \fB\-x\fP +string capabilities that are defined in the terminfo entry +via the \fB\-x\fP option of \fB@TIC@\fP. -This implementation automatically assigns at run-time keycodes to -user-defined strings which begin with \*(``k\*(''. -The keycodes start at KEY_MAX, but are not guaranteed to be -the same value for different runs because user-defined codes are -merged from all terminal descriptions which have been loaded. +This implementation automatically assigns at run-time key codes to +user-defined strings that begin with \*(``k\*(''. +The key codes start at KEY_MAX, +but are not guaranteed to be the same value for different runs +because user-defined codes are merged +from all terminal descriptions that have been loaded. The \fBuse_extended_names\fP(3X) function controls whether this data is loaded when the terminal description is read by the library. .SS "nofilter, use_tioctl" The \fBnofilter\fP and \fBuse_tioctl\fP routines are specific to \fI\%ncurses\fP. -They were not supported on Version 7, BSD or System V implementations. +They were not supported on Version 7, +BSD or System V implementations. It is recommended that any code depending on \fI\%ncurses\fP extensions be conditioned using \fBNCURSES_VERSION\fP. .SS "putwin/getwin file-format" @@ -341,81 +418,134 @@ use an implementation-specific format. Although the format is an obvious target for standardization, it has been overlooked. .IP -Interestingly enough, according to the copyright dates in Solaris source, -the functions (along with \fBscr_init\fP, etc.) originated with -the University of California, Berkeley (in 1982) -and were later (in 1988) incorporated into SVr4. -Oddly, there are no such functions in the 4.3BSD curses sources. -.bP -Most implementations simply dump the binary \fI\%WINDOW\fP structure +Interestingly enough, +according to the copyright dates in Solaris source, +the functions +(along with \fBscr_init\fP, +etc.\&) +originated with the University of California, +Berkeley +(in 1982) +and were later +(in 1988) +incorporated into SVr4. +Oddly, +there are no such functions in the 4.3BSD +.I curses +sources. +.bP +Most implementations simply dump the binary +.I \%WINDOW +structure to the file. -These include SVr4 curses, NetBSD and PDCurses, +These include SVr4 +.IR curses , +NetBSD +.IR curses , +and +.IR \%PDCurses , as well as older \fI\%ncurses\fP versions. This implementation -(as well as the X/Open variant of Solaris curses, dated 1995) +(as well as +.IR \%xcurses "," +the X/Open variant of Solaris +.IR curses "," +dated 1995) uses textual dumps. .IP -The implementations which use binary dumps use block-I/O -(the \fBfwrite\fP and \fBfread\fP functions). -Those that use textual dumps use buffered-I/O. +The implementations that use binary dumps use block I/O +(\fIwrite\fP(2) and \fIread\fP(2) functions). +Those that use textual dumps use buffered I/O. A few applications may happen to write extra data in the file using these functions. -Doing that can run into problems mixing block- and buffered-I/O. -This implementation reduces the problem on writes by flushing the output. -However, reading from a file written using mixed schemes may not be successful. +Doing that can run into problems mixing block and buffered I/O. +This implementation reduces the problem on writes by flushing the +output. +However, +reading from a file written using mixed schemes may not be successful. .SS "unctrl, wunctrl" -X/Open Curses, Issue 4 describes these functions. -It states that \fBunctrl\fP and \fBwunctrl\fP will return a null pointer if -unsuccessful, but does not define any error conditions. +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for them. +It states that \fBunctrl\fP and \fBwunctrl\fP will return a null pointer +if unsuccessful. This implementation checks for three cases: .bP the parameter is a 7-bit US\-ASCII code. This is the case that X/Open Curses documented. .bP -the parameter is in the range 128\-159, i.e., a C1 control code. -If \fBuse_legacy_coding\fP(3X) has been called with a \fB2\fP parameter, -\fBunctrl\fP returns the parameter, i.e., a one-character string with +the parameter is in the range 128\-159, +i.e., +a C1 control code. +If \fB\%use_legacy_coding\fP(3X) has been called with a \fB2\fP parameter, +\fBunctrl\fP returns the parameter, +i.e., +a one-character string with the parameter as the first character. -Otherwise, it returns \*(``~@\*('', \*(``~A\*('', etc., -analogous to \*(``^@\*('', \*(``^A\*('', C0 controls. +Otherwise, +it returns \*(``\*~@\*('', +\*(``\*~A\*('', +etc., +analogous to \*(``\*^@\*('', +\*(``\*^A\*('', +C0 controls. .IP -X/Open Curses does not document whether \fBunctrl\fP can be called before -initializing curses. +X/Open Curses does not document whether \fBunctrl\fP can be called +before initializing +.IR curses "." This implementation permits that, -and returns the \*(``~@\*('', etc., values in that case. +and returns the \*(``\*~@\*('', +etc., +values in that case. .bP parameter values outside the 0 to 255 range. \fBunctrl\fP returns a null pointer. .PP -The strings returned by \fBunctrl\fP in this implementation are determined -at compile time, +The strings returned by \fBunctrl\fP in this implementation +are determined at compile time, showing C1 controls from the upper-128 codes -with a \*(``~\*('' prefix rather than \*(``^\*(''. +with a \*(``\*~\*('' prefix rather than \*(``\*^\*(''. Other implementations have different conventions. -For example, they may show both sets of control characters with \*(``^\*('', +For example, +they may show both sets of control characters with \*(``\*^\*('', and strip the parameter to 7 bits. Or they may ignore C1 controls and treat all of the upper-128 codes as printable. -This implementation uses 8 bits but does not modify the string to reflect -locale. -The \fBuse_legacy_coding\fP(3X) function allows the caller to +This implementation uses 8 bits +but does not modify the string to reflect locale. +The \fB\%use_legacy_coding\fP(3X) function allows the caller to change the output of \fBunctrl\fP. .PP -Likewise, the \fBmeta\fP(3X) function allows the caller to change the -output of \fBkeyname\fP, i.e., +Likewise, +the \fBmeta\fP(3X) function allows the caller to change the output +of \fBkeyname\fP, +i.e., it determines whether to use the \*(``M\-\*('' prefix for \*(``meta\*('' keys (codes in the range 128 to 255). -Both \fBuse_legacy_coding\fP(3X) and \fBmeta\fP(3X) succeed only after -curses is initialized. +Both \fB\%use_legacy_coding\fP(3X) and \fBmeta\fP(3X) succeed only after +.I curses +is initialized. X/Open Curses does not document the treatment of codes 128 to 159. When treating them as \*(``meta\*('' keys -(or if \fBkeyname\fP is called before initializing curses), -this implementation returns strings \*(``M\-^@\*('', \*(``M\-^A\*('', etc. +(or if \fBkeyname\fP is called before initializing +.IR curses ")," +this implementation returns strings \*(``M\-\*^@\*('', +\*(``M\-\*^A\*('', +etc. .PP -X/Open Curses documents \fBunctrl\fP as declared in \fB<unctrl.h>\fP, -which \fI\%ncurses\fP does. -However, \fI\%ncurses\fP' \fB<curses.h>\fP includes \fB<unctrl.h>\fP, -matching the behavior of SVr4 curses. +X/Open Curses documents +.I \%unctrl +as declared in +.IR \%unctrl.h "," +which +.I \%ncurses +does. +However, +.IR \%ncurses 's +.I \%curses.h +includes +.IR \%unctrl.h "," +matching the behavior of SVr4 +.IR curses "." Other implementations may not do that. .SS "use_env, use_tioctl" If \fI\%ncurses\fP is configured to provide the sp-functions extension, @@ -423,8 +553,49 @@ the state of \fBuse_env\fP and \fBuse_tioctl\fP may be updated before creating each \fIscreen\fP rather than once only (\fBcurs_sp_funcs\fP(3X)). This feature of \fBuse_env\fP -is not provided by other implementations of curses. +is not provided by other implementations of +.IR curses "." +.SH HISTORY +4BSD (1980) +introduced +.IR \%unctrl "," +defining it as a macro +in +.IR \%unctrl.h "." +.PP +SVr2 (1984) +added +.IR \%delay_output "," +.IR \%flushinp "," +and +.IR \%keyname "." +.PP +SVr3 (1987) supplied +.IR \%filter "." +Later that year, +SVr3.1 brought +.I \%getwin +and +.IR \%putwin "," +reading and writing window dumps +with \fI\%fread\fP(3) and \fI\%fwrite\fP(3), +respectively. +.PP +SVr4 (1989) furnished +.IR \%use_env "." +.PP +X/Open Curses Issue\ 4 (1995) specified +.I \%key_name +and +.IR \%wunctrl "." +.PP +.I \%ncurses +5.6 (2006) added +.IR \%nofilter "," \" 20060107 +and 6.0 (2015) +.IR \%use_tioctl "." \" 20120714 .SH SEE ALSO +.na \fB\%curses\fP(3X), \fB\%curs_initscr\fP(3X), \fB\%curs_inopts\fP(3X), @@ -433,3 +604,4 @@ is not provided by other implementations of curses. \fB\%curs_sp_funcs\fP(3X), \fB\%curs_variables\fP(3X), \fB\%legacy_coding\fP(3X) +.ad diff --git a/man/curs_variables.3x b/man/curs_variables.3x index 467b69444565..0d2d0beb6466 100644 --- a/man/curs_variables.3x +++ b/man/curs_variables.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 2010-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_variables.3x,v 1.47 2024/04/13 22:37:35 tom Exp $ -.TH curs_variables 3X 2024-04-13 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_variables.3x,v 1.73 2025/08/23 23:02:32 tom Exp $ +.TH curs_variables 3X 2025-08-23 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -48,6 +48,51 @@ .el .IP \(bu 2 .. . +.\" URL hyperlink support macros from groff's "an-ext.tmac" +. +.\" Save the automatic hyphenation mode. +.\" +.\" In AT&T troff, there was no register exposing the hyphenation mode, +.\" and no way to save and restore it. Set `mH` to a reasonable value +.\" for your implementation and preference. +.de mY +. ie !\\n(.g \ +. nr mH 14 +. el \ +. do nr mH \\n[.hy] \" groff extension register +.. +. +.\" Prepare link text for mail/web hyperlinks. `MT` and `UR` call this. +.de mV +. ds mU \\$1\" +.. +. +.\" Emit hyperlink. The optional argument supplies trailing punctuation +.\" after link text. `ME` and `UE` call this. +.de mQ +. mY +. nh +<\\*(mU>\\$1 +. hy \\n(mH +. rm mU +.. +. +.\" Start URL. +.\" .UR url +.if !\n(.g \{\ +.de UR +. mV \\$1 +.. +.\} +. +.\" End URL. +.\" .UE [punctuation] +.if !\n(.g \{\ +.de UE +. mQ \\$1 +.. +.\} +. .SH NAME \fI\%bool\fP, \fI\%chtype\fP, @@ -59,6 +104,7 @@ \fB\%FALSE\fP, \fB\%ERR\fP, \fB\%OK\fP, +\fB\%CCHARW_MAX\fP, \fB\%curscr\fP, \fB\%newscr\fP, \fB\%stdscr\fP, @@ -88,6 +134,9 @@ \fBconst \fI/*\fP .\|.\|. \fI*/\fP ERR; \fBconst \fI/*\fP .\|.\|. \fI*/\fP OK; .PP +\fI/* extension */ +\fBconst \fI/*\fP .\|.\|. \fI*/\fP CCHARW_MAX; +.PP \fI/* variables */ \fBint COLORS; \fBint COLOR_PAIRS; @@ -114,24 +163,49 @@ that provide read-only access to the library's state. In either case, applications should treat them as read-only to avoid confusing the library. -.SH "CONSTANTS" +.SH CONSTANTS .SS "TRUE, FALSE" -The \fIcurses\fP library defines \fBTRUE\fP and \fBFALSE\fP +The +.I curses +library defines +.B TRUE +and +.B FALSE to represent the values of the Boolean data type. .SS "ERR, OK" -\fIcurses\fP and \fIterminfo\fP routines frequently return these -constant integral values indicating failure and success, +.I curses +and +.I \%term\%info +functions frequently return these constant integral values +indicating failure and success, respectively. -.SH "PREDEFINED TYPES" +.SS CCHARW_MAX +This integral value, +an +.I \%ncurses +extension, +indicates the maximum number of +.I \%wchar_t +wide characters that can be stored in a +.I curses +complex character +.IR \%cchar_t "." +.SH "DATA TYPES" .SS "\fIbool\fP" -X/Open Issue 4 \fIcurses\fP (1996) preceded the ISO C99 and ISO C++98 +.I curses +defines an integral type +.IR bool "." +X/Open Issue\ 4 +.I curses +(1996) preceded the ISO\ C99 and ISO\ C++98 standards, -each of which also defined a Boolean data type. -The \fIcurses\fP library requires an integral type \fIbool\fP. +each of which also defined a Boolean data type of the same name. .PP -\fB\%ncurses\fP' configure script attempts to discover the +.IR \%ncurses 's +configure script attempts to discover the data type used by the system's C and C++ compilers, -to reuse for the \fIcurses\fP \fIbool\fP. +to reuse them as its own +.IR bool "." .SS "\fIchtype\fP" The \fI\%chtype\fP integral type combines a (\*(``narrow\*('', @@ -173,7 +247,26 @@ represents rectangular portions of the terminal screen with the structure type; see subsection \*(``Overview\*('' of \fB\%ncurses\fP(3X). .SH "VARIABLES" -.SS "curscr, stdscr, newscr" +.SS "curscr, newscr, stdscr" +When a +.I curses +application calls +\fB\%initscr\fP(3X) or \fB\%newterm\fP(3X), +the library creates a window named +.B \%stdscr +that is the same size as the terminal screen, +(minus any lines reserved by +\fB\%ripoffline\fP(3X) or \fB\%slk_init\fP(3X)) +and is the implicit window used by functions +that interact with a window +but do not take a parameter identifying one; +many +.I curses +functions use it. +An application need not use +.BR \%stdscr ";" +it might prefer to tile the display into multiple windows instead. +.PP The library records updates to the terminal screen in a window named \fB\%curscr\fP. This object is referred to as the \*(``physical screen\*('' in @@ -190,40 +283,41 @@ and When the screen is refreshed, \fIcurses\fP determines a minimal set of updates using the terminal's capabilities to make \fB\%curscr\fP look like \fB\%newscr\fP. -.PP -Once \fIcurses\fP is initialized, -it creates a window named \fB\%stdscr\fP. -It is the same size as the terminal screen and is the default window -used by routines that do not take a parameter identifying one. -Many \fIcurses\fP functions use this window. .SS COLORS -Once \fIcurses\fP is initialized, -\fB\%COLORS\fP +Once a +.I curses +screen is initialized, +.B \%COLORS contains the number of colors supported by the terminal; see \fB\%curs_color\fP(3X). .SS COLOR_PAIRS -Once \fIcurses\fP is initialized, -\fB\%COLOR_PAIRS\fP +Once a +.I curses +screen is initialized, +.B \%COLOR_PAIRS contains the number of color pairs supported by the terminal; see \fB\%curs_color\fP(3X). .SS "COLS, LINES" -Once \fIcurses\fP is initialized, +Once a +.I curses +screen is initialized, .B \%COLS and .B LINES -contain the screen's width and height in character cells, +contain its width and height in character cells, respectively; that is, the number of columns and lines. .SS ESCDELAY -For +When reading key strokes from a window in keypad mode, .I curses -to distinguish the ESC character resulting from a user's press of the -\*(``Escape\*('' key on the input device from one beginning an -.I "escape sequence" -(as commonly produced by function keys), -it waits after the escape character to see if further characters are -available on the input stream within a short interval. +distinguishes the ESC character resulting from a user's press of the +\*(``Escape\*('' key on the input device +from one beginning an escape sequence +(commonly produced by function keys), +by waiting after receiving the escape character +to see if further characters are available +on the input stream within a short interval. .B \%ESCDELAY stores this interval in milliseconds. .PP @@ -236,8 +330,9 @@ The \fIcurses\fP library converts a tab character to this number of spaces as it adds a tab to a window; see \fB\%curs_addch\fP(3X). .SH NOTES -Either \fB\%initscr\fP(3X) or \fB\%newterm\fP(3X) initializes -\fIcurses\fP. +Initialize a +.I curses +screen with either \fB\%initscr\fP(3X) or \fB\%newterm\fP(3X). .PP If .I \%ncurses @@ -246,12 +341,39 @@ is configured to provide separate and .I \%tinfo libraries, -most of these variables reside in the former. +most of these symbols reside in the former. +Both use the +.B bool +data type. +.SH EXTENSIONS +The +.B \%CCHARW_MAX +constant, +and +.BR \%ESCDELAY "," +.BR \%TABSIZE "," +and +.B \%newscr +variables, +are +extensions, +the first of these originating in +.\" Solaris xcurses calls it M_CCHAR_MAX. +.IR \%ncurses "." .SH PORTABILITY +Applications employing +.I \%ncurses +extensions should condition their use on the visibility of the +.B \%NCURSES_VERSION +preprocessor macro. +.PP The X/Open Curses standard documents all of the foregoing types and -symbols except for \fB\%newscr\fP, -\fB\%TABSIZE\fP, -and \fB\%ESCDELAY\fP. +symbols except for +.BR \%CCHARW_MAX "," +.BR \%newscr "," +.BR \%TABSIZE "," +and +.BR \%ESCDELAY "." .PP X/Open Curses describes \fB\%curscr\fP only as \*(``an internal data structure\*(''; @@ -270,52 +392,98 @@ it is used as a working area for combining the standard window When the update of \fB\%newscr\fP is complete, \fIcurses\fP modifies \fB\%curscr\fP to match \fB\%newscr\fP. .PP -\fB\%TABSIZE\fP is a feature of SVr4 \fIcurses\fP. +.B \%TABSIZE +is a feature of SVr4 +.IR curses "." .bP -SVr4 initially sets \fB\%TABSIZE\fP from the terminal description's -\fB\%init_tabs\fP capability. +SVr4 initially sets +.B \%TABSIZE +from the terminal description's +.B \%init_tabs +.RB ( it ) +capability. After that, -it can be altered by applications using SVr4 \fIcurses\fP. +it can be altered by applications using SVr4 +.IR curses "." .bP -SVr4 \fIcurses\fP uses the value of \fB\%TABSIZE\fP to compute the -position of tab stops when updating both +SVr4 +.I curses +uses +.BR \%TABSIZE 's +value to compute the position of tab stops when updating both the virtual screen with \fB\%addch\fP(3X) and the physical screen with \fB\%mvcur\fP(3X). .bP -\fI\%ncurses\fP uses the value of \fB\%TABSIZE\fP only to update the -virtual screen. -It uses the terminal description's \*(``\fBit\fP\*('' -(\fB\%init_tabs\fP) capability for computing hardware tabs +In +.IR \%ncurses "," +.BR \%TABSIZE 's +value affects only the virtual screen. +The library uses the terminal type description's +.B \%init_tabs +.RB ( it ) +capability to compute hardware tabs (that is, tab stops on the physical screen). .bP Other implementations differ. For instance, -NetBSD \fIcurses\fP allows \fB\%TABSIZE\fP to be set through an -environment variable. -\fI\%ncurses\fP does not. +NetBSD +.I curses +allows +.B \%TABSIZE +to be set through an environment variable. +.I \%ncurses +does not. .IP -NetBSD \fIcurses\fP does not support hardware tabs; -it uses the \fB\%init_tabs\fP capability and the \fB\%TABSIZE\fP -variable only for updating the virtual screen. +NetBSD +.I curses +does not support hardware tabs; +it uses the +.B \%init_tabs +.RB ( it ) +capability and the +.B \%TABSIZE +variable only to update the virtual screen. .PP -\fB\%ESCDELAY\fP is a feature of AIX \fIcurses\fP. +.B \%ESCDELAY +is a feature of AIX +.IR curses "." .bP -In AIX, -the units for \fB\%ESCDELAY\fP are \fIfifths\fP of milliseconds. +AIX treats +.BR \%ESCDELAY 's +value as counting +.I fifths +of milliseconds. .bP -The default value for AIX's \fB\%ESCDELAY\fP equals 0.1 seconds. +AIX's default +.B \%ESCDELAY +equals 0.1 seconds. .bP -AIX also enforces a limit of 10,000 seconds for \fB\%ESCDELAY\fP; -\fI\%ncurses\fP does not enforce any upper limit. +AIX also enforces a limit of 10,000 seconds for +.BR \%ESCDELAY ";" +.I \%ncurses +does not enforce an upper limit. .PP -\fI\%ncurses\fP has long used \fB\%ESCDELAY\fP with units of -milliseconds, +.I \%ncurses +has long interpreted +.B \%ESCDELAY +as a count of milliseconds, making it impossible to be completely compatible with AIX. Consequently, most users have decided either to override the value, or to rely upon its default. .SH SEE ALSO +.UR https://\*:unicode\*:.org/\*:reports/\*:tr29/ +[UAX #29] \*(``Unicode Standard Annex #29: Unicode Text +Segmentation\*('' +.UE +.PP +\fB\%getcchar\fP(3X) +further discusses the +.I \%ncurses +extension +.BR \%CCHARW_MAX "." +.PP \fB\%curses\fP(3X), \fB\%curs_color\fP(3X), \fB\%curs_opaque\fP(3X), @@ -323,7 +491,3 @@ or to rely upon its default. \fB\%curs_threads\fP(3X), \fB\%term_variables\fP(3X), \fB\%terminfo\fP(5) -.PP -[UAX #29] \*(``Unicode Standard Annex #29: Unicode Text -Segmentation\*(''; -\%<https://\*:unicode\*:.org/\*:reports/\*:tr29/> diff --git a/man/curs_window.3x b/man/curs_window.3x index d3d55c751444..b930a4c85a8e 100644 --- a/man/curs_window.3x +++ b/man/curs_window.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2020-2023,2024 Thomas E. Dickey * +.\" Copyright 2020-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 * @@ -27,8 +27,19 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_window.3x,v 1.48 2024/04/20 21:20:07 tom Exp $ -.TH curs_window 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: curs_window.3x,v 1.71 2025/08/23 22:50:00 tom Exp $ +.TH curs_window 3X 2025-08-23 "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 '' "" +.\} +. .de bP .ie n .IP \(bu 4 .el .IP \(bu 2 @@ -50,23 +61,23 @@ create and manipulate \fIcurses\fR windows .nf \fB#include <curses.h> .PP -\fBWINDOW *newwin( - \fBint \fInlines\fB, int \fIncols\fB,\fR - \fBint \fIbegin_y\fB, int \fIbegin_x\fB);\fR -\fBint delwin(WINDOW *\fIwin\fB);\fR -\fBint mvwin(WINDOW *\fIwin\fB, int \fIy\fB, int \fIx\fB);\fR -\fBWINDOW *subwin(WINDOW *\fIorig\fB,\fR - \fBint \fInlines\fB, int \fIncols\fB,\fR - \fBint \fIbegin_y\fB, int \fIbegin_x\fB);\fR -\fBWINDOW *derwin(WINDOW *\fIorig\fB,\fR - \fBint \fInlines\fB, int \fIncols\fB,\fR - \fBint \fIbegin_y\fB, int \fIbegin_x\fB);\fR -\fBint mvderwin(WINDOW *\fIwin\fB, int \fIpar_y\fB, int \fIpar_x\fB);\fR -\fBWINDOW *dupwin(WINDOW *\fIwin\fB);\fR -\fBvoid wsyncup(WINDOW *\fIwin\fB);\fR -\fBint syncok(WINDOW *\fIwin\fB, bool \fIbf\fB);\fR -\fBvoid wcursyncup(WINDOW *\fIwin\fB);\fR -\fBvoid wsyncdown(WINDOW *\fIwin\fB);\fR +\fBWINDOW * newwin(\fR + \fBint \fInlines\fP, int \fIncols\fP, + \fBint \fIbegin_y\fP, int \fIbegin_x\fP); +\fBint delwin(WINDOW * \fIwin\fP); +\fBint mvwin(WINDOW * \fIwin\fP, int \fIy\fP, int \fIx\fP); +\fBWINDOW * subwin(WINDOW * \fIorig\fP, + \fBint \fInlines\fP, int \fIncols\fP, + \fBint \fIbegin_y\fP, int \fIbegin_x\fP); +\fBWINDOW * derwin(WINDOW * \fIorig\fP, + \fBint \fInlines\fP, int \fIncols\fP, + \fBint \fIbegin_y\fP, int \fIbegin_x\fP); +\fBint mvderwin(WINDOW * \fIwin\fP, int \fIpar_y\fP, int \fIpar_x\fP); +\fBWINDOW * dupwin(WINDOW * \fIwin\fP); +\fBvoid wsyncup(WINDOW * \fIwin\fP); +\fBint syncok(WINDOW * \fIwin\fP, bool \fIbf\fP); +\fBvoid wcursyncup(WINDOW * \fIwin\fP); +\fBvoid wsyncdown(WINDOW * \fIwin\fP); .fi .SH DESCRIPTION .SS newwin @@ -94,21 +105,23 @@ Regardless of the function used for creating a new window (e.g., \fBnewwin\fP, \fBsubwin\fP, \fBderwin\fP, \fBnewpad\fP), rather than a duplicate (with \fBdupwin\fP), all of the window modes are initialized to the default values. -These functions set window modes after a window is created: +The following functions set a window's modes after it is created: .RS .PP -\fB\%idcok\fP -\fB\%idlok\fP -\fB\%immedok\fP -\fB\%keypad\fP -\fB\%leaveok\fP -\fB\%nodelay\fP -\fB\%scrollok\fP -\fB\%setscrreg\fP -\fB\%syncok\fP -\fB\%wbkgdset\fP -\fB\%wbkgrndset\fP and -\fB\%wtimeout\fP. +.BR \%idcok "," +.BR \%idlok "," +.BR \%immedok "," +.BR \%keypad "," +.BR \%leaveok "," +.BR \%nodelay "," +.BR \%notimeout "," +.BR \%scrollok "," +.BR \%setscrreg "," +.BR \%syncok "," +.BR \%wbkgdset "," +.BR \%wbkgrndset "," +and +.BR \%wtimeout "." .RE .SS delwin Calling \fBdelwin\fP deletes the named window, freeing all memory @@ -163,105 +176,168 @@ The routine \fBwcursyncup\fP updates the current cursor position of all the ancestors of the window to reflect the current cursor position of the window. .SH RETURN VALUE -Routines that return an integer return the integer \fBERR\fP upon failure and -\fBOK\fP (SVr4 only specifies "an integer value other than \fBERR\fP") upon -successful completion. +Functions that return integers return +.B ERR +upon failure and +.B OK +upon success. .PP -Routines that return pointers return \fBNULL\fP on error. +Functions that return pointers return a null pointer on failure. .PP -X/Open defines no error conditions. -In this implementation -.TP 5 -\fBdelwin\fP -returns an error if the window pointer is null, or -if the window is the parent of another window. -.TP 5 -\fBderwin\fP -returns an error if the parent window pointer is null, or -if any of its ordinates or dimensions is negative, or -if the resulting window does not fit inside the parent window. -.TP 5 -\fBdupwin\fP -returns an error if the window pointer is null. +.I \%ncurses +defines several error conditions. +.bP +.B \%delwin +returns +.B ERR +if +.I win +is a null pointer, +or if it is the parent of another window. .IP -This implementation also maintains a list of windows, -and checks that the pointer passed to \fBdelwin\fP is one that -it created, returning an error if it was not.. -.TP 5 -\fBmvderwin\fP -returns an error -if the window pointer is null, or -if some part of the window would be placed off-screen. -.TP 5 -\fBmvwin\fP -returns an error -if the window pointer is null, or -if the window is really a pad, or -if some part of the window would be placed off-screen. -.TP 5 -\fBnewwin\fP -will fail if either of its beginning ordinates is negative, or -if either the number of lines or columns is negative. -.TP 5 -\fBsyncok\fP -returns an error -if the window pointer is null. -.TP 5 -\fBsubwin\fP -returns an error if the parent window pointer is null, or -if any of its ordinates or dimensions is negative, or -if the resulting window does not fit inside the parent window. +.I \%ncurses +maintains a list of windows, +and checks that the pointer passed to +.B \%delwin +is one that it created, +returning +.B ERR +if it was not. +.bP +.B \%derwin +returns +.B ERR +if +.I orig +is a null pointer, +or if any of the ordinate or dimension arguments is negative, +or if the resulting window does not fit inside the parent window. +.bP +.B \%dupwin +returns +.B ERR +if +.I win +is a null pointer. +.bP +.B \%mvderwin +returns +.B ERR +if +.I win +is a null pointer, +or if any part of the window would be placed off-screen. +.bP +.B \%mvwin +returns +.B ERR +if +.I win +is a null pointer, +if +.I win +is a pad, +or if any part of the window would be placed off-screen. +.bP +.B \%newwin +returns +.B ERR +if any of its arguments is negative. +.bP +.B \%subwin +returns +.B ERR +if +.I orig +is a null pointer, +or if any of the ordinate or dimension arguments is negative, +or if the resulting window does not fit inside the parent window. +.bP +.B \%syncok +returns +.B ERR +if +.I win +is a null pointer. +.PP +Functions that return a window pointer fail if memory allocation +for their data structures fails. .PP -The functions which return a window pointer -may also fail if there is insufficient memory for its data structures. -Any of these functions will fail if the screen has not been initialized, -i.e., with \fBinitscr\fP or \fBnewterm\fP. +All of these functions fail if the screen has not been initialized; +see \fBinitscr\fP(3X) or \fBnewterm\fP(3X). .SH NOTES -If many small changes are made to the window, the \fBwsyncup\fP option could -degrade performance. +.B \%syncok +may be implemented as a macro. .PP -Note that \fBsyncok\fP may be a macro. +Calling +.B \%syncup +on a window and making many small changes to it +could degrade performance. .SH PORTABILITY -X/Open Curses, Issue 4 describes these functions. +X/Open Curses Issue\ 4 describes these functions. +It specifies no error conditions for +.IR \%delwin "," +.IR \%derwin "," +.IR \%dupwin "," +.IR \%newwin "," +.IR \%mvderwin "," +or +.IR \%syncok "." .PP -X/Open Curses states regarding \fBdelwin\fP: -.bP -It must delete subwindows before deleting their parent. -.bP -If \fBdelwin\fP is asked to delete a parent window, -it can only succeed if the curses library keeps a list of the subwindows. -SVr4 curses kept a count of the number of subwindows rather than a list. -It simply returned \fBERR\fP when asked to delete a subwindow. -Solaris X/Open curses does not even make that check, -and will delete a parent window which still has subwindows. -.bP -Since release 4.0 (1996), -\fI\%ncurses\fP maintains a list of windows for each screen, -to ensure that a window has no subwindows before allowing deletion. -.bP -NetBSD copied this feature of \fI\%ncurses\fP in 2003. -.br -PDCurses follows the scheme used in Solaris X/Open curses. -.SH BUGS -The subwindow functions -\fB\%subwin\fP, -\fB\%derwin\fP, -\fB\%mvderwin\fP, -\fB\%wsyncup\fP, -\fB\%wsyncdown\fP, -\fB\%wcursyncup\fP, -and -\fB\%syncok\fP -are flaky, -incompletely implemented, -and not well tested. +For functions returning integers +(except +.IR \%delwin ")," +SVr4 describes a successful return value only as +\*(``an integer value other than +.IR ERR \*(''. \" Courier roman in source; SVID 4, vol. 3, p. 544 +.PP +Regarding +.IR \%delwin "," +X/Open Curses states that +.RS +.PP +[t]he application must delete subwindows before deleting the main +window. +.RE .PP -System\ V's \fIcurses\fP documentation is unclear about what -\fB\%wsyncup\fP and \fB\%wsyncdown\fP actually do. +If +.I \%delwin +is asked to delete a parent window, +it can succeed only if the +.I curses +library keeps a list of its subwindows. +SVr4 +.I curses +kept a count of the number of subwindows rather than a list. +It simply returned +.B ERR +when asked to delete a subwindow. +Solaris X/Open +.I curses +.RI \%( xcurses ) +does not make even that check, +and will delete a parent window that still has subwindows. +.I \%PDCurses +also behaves this way. +.PP +.I \%ncurses +4.0 (1996) and later maintains a list of windows for each screen +to ensure that a window has no subwindows before allowing its deletion. +NetBSD +.I curses +has followed suit since 2003. +.PP +SVr4 +.I curses +documentation is unclear about what +.I \%wsyncup +and +.I \%wsyncdown +actually do. It seems to imply that they are supposed to touch only those lines that are affected by changes to a window's ancestors. -The language here, -and behavior of \fI\%ncurses\fP, +The description and behavior of these functions in +.I \%ncurses is patterned on the X/Open Curses standard; this approach may result in slower updates. .SH SEE ALSO diff --git a/man/define_key.3x b/man/define_key.3x index 667d8cd312fe..a64c9a06e065 100644 --- a/man/define_key.3x +++ b/man/define_key.3x @@ -29,43 +29,101 @@ .\" .\" Author: Thomas E. Dickey 1997 .\" -.\" $Id: define_key.3x,v 1.42 2024/03/16 15:35:01 tom Exp $ -.TH define_key 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: define_key.3x,v 1.52 2024/12/28 21:26:21 tom Exp $ +.TH define_key 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +. +.de bP +.ie n .IP \(bu 4 +.el .IP \(bu 2 +.. +. .SH NAME \fB\%define_key\fP \- -define a \fIcurses\fR keycode +define a \fIcurses\fP function key code .SH SYNOPSIS .nf \fB#include <curses.h> .PP -\fBint define_key(const char *\fIdefinition\fP, int \fIkeycode\fP); +\fBint define_key(const char * \fIdefinition\fP, int \fIkey-code\fP); .fi .SH DESCRIPTION -This is an extension to the \fIcurses\fP library. -It permits an application to define keycodes with their corresponding control -strings, -so that the \fI\%ncurses\fP library will interpret them just as it would -the predefined codes in the terminfo database. +The +.B \%define_key +.I \%ncurses +extension permits a +.I curses +application to +.I bind +a string +.I definition +to the function key +.I key-code +returned by \fB\%wgetch\fP(3X) +(wide-character API users: +\fB\%wget_wch\fP(3X)) +when \fB\%keypad\fP(3X) is enabled in a window and a function key is +pressed. +.I \%ncurses +interprets such a binding as it does those in the +.I \%term\%info +database entry for the terminal type. .PP -If \fIdefinition\fP is \fBNULL\fP, -any existing one for the keycode is removed. -Similarly, if the given keycode is negative or zero, any existing string -for the given definition is removed. +A +.I definition +of +.I NULL +removes any existing binding from +.IR key-code "." +Similarly, +a non-positive +.I key-code +removes an existing binding for +.IR definition "," +if any. .SH RETURN VALUE -Either \fIkeycode\fP must be greater than zero, -or \fIdefinition\fP must be non-\fBNULL\fP, -otherwise \fBERR\fP is returned. -\fBERR\fP may also be returned if there is insufficient memory to allocate the -data to store the definition. -If no error is detected, \fBOK\fP is returned. +.B \%define_key +returns +.B ERR +if +.bP +.I definition +is +.I NULL +and +.I key-code +is nonpositive, +or +.bP +insufficient memory is available to bind +.I definition +to +.IR key-code "." +.PP +Otherwise, +.B \%define_key +returns +.BR OK "." +.SH EXTENSIONS +.B \%define_key +is an +.I \%ncurses +extension. .SH PORTABILITY -These routines are specific to \fI\%ncurses\fP. -They were not supported on -Version 7, BSD or System V implementations. -It is recommended that -any code depending on them be conditioned using \fB\%NCURSES_VERSION\fP. +Applications employing +.I \%ncurses +extensions should condition their use on the visibility of the +.B \%NCURSES_VERSION +preprocessor macro. +.PP +NetBSD +.I curses +since 2.0 (2004) supports +.IR \%define_key "." .SH AUTHORS Thomas Dickey .SH SEE ALSO +\fB\%curses\fP(3X), +\fB\%keybound\fP(3X), \fB\%keyok\fP(3X), -\fB\%key_defined\fP(3X) +\fB\%key_defined\fP(3X), +\fB\%terminfo\fP(5) diff --git a/man/form.3x b/man/form.3x index 2f8f884861fa..c54a4e1438bb 100644 --- a/man/form.3x +++ b/man/form.3x @@ -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: form.3x,v 1.54 2024/03/16 15:35:01 tom Exp $ -.TH form 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: form.3x,v 1.62 2025/11/12 01:27:41 tom Exp $ +.TH form 3X 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -47,7 +47,7 @@ .. .SH NAME \fBform\fP \- -curses extension for programming forms +present user-fillable forms in \fIcurses\fP windows .SH SYNOPSIS .nf \fB#include <form.h> @@ -79,7 +79,9 @@ The \fBform\fP library maintains a default value for field attributes. You can get or set this default by calling the appropriate \fBset_\fP or retrieval -routine with a \fBNULL\fP field pointer. +routine with a +.I NULL +field pointer. Changing this default with a \fBset_\fP function affects future field creations, but does not change the rendering of fields already created. @@ -92,10 +94,9 @@ Routines flagged with \*(``*\*('' are \fI\%ncurses\fP-specific, not present in SVr4. .PP .TS -l l -l l . +L L. \fBcurses\fP Routine Name Manual Page Name -= +_ current_field \fBform_page\fP(3X) data_ahead \fBform_data\fP(3X) data_behind \fBform_data\fP(3X) @@ -173,7 +174,9 @@ unfocus_current_field \fBform_page\fP(3X)* unpost_form \fBform_post\fP(3X) .TE .SH RETURN VALUE -Routines that return pointers return \fBNULL\fP on error, +Routines that return pointers return +.I NULL +on error, and set \fBerrno\fP to the corresponding error-code returned by functions returning an integer. Routines that return diff --git a/man/form_driver.3x b/man/form_driver.3x index 882a49dd4634..1a1773a6faec 100644 --- a/man/form_driver.3x +++ b/man/form_driver.3x @@ -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: form_driver.3x,v 1.61 2024/04/20 18:55:09 tom Exp $ -.TH form_driver 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: form_driver.3x,v 1.64 2025/10/04 20:59:08 tom Exp $ +.TH form_driver 3X 2025-10-04 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .de bP .ie n .IP \(bu 4 .el .IP \(bu 2 @@ -51,7 +51,8 @@ Once a form has been posted (displayed), you should funnel input events to it through \fBform_driver\fP. This routine has three major input cases: .bP The input is a form navigation request. -Navigation request codes are constants defined in \fB<form.h>\fP, +Navigation request codes are constants defined in +.IR form.h "," which are distinct from the key- and character codes returned by \fBwgetch\fP(3X). .bP diff --git a/man/form_field.3x b/man/form_field.3x index 9799d0c0cfda..700a97cd4be6 100644 --- a/man/form_field.3x +++ b/man/form_field.3x @@ -28,8 +28,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: form_field.3x,v 1.34 2024/03/16 15:35:01 tom Exp $ -.TH form_field 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: form_field.3x,v 1.36 2024/12/28 21:26:21 tom Exp $ +.TH form_field 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBform_field\fP \- make and break connections between fields and forms @@ -44,7 +44,8 @@ make and break connections between fields and forms .fi .SH DESCRIPTION The function \fBset_form_fields\fP changes the field pointer array of -the given \fIform\fP. The array must be terminated by a \fBNULL\fP. +the given \fIform\fP. The array must be terminated by a +.IR NULL "." .PP The function \fBform_fields\fP returns the field array of the given form. .PP @@ -53,11 +54,13 @@ The function \fBfield_count\fP returns the count of fields in \fIform\fP. The function \fBmove_field\fP moves the given field (which must be disconnected) to a specified location on the screen. .SH RETURN VALUE -The function \fBform_fields\fP returns a pointer (which may be \fBNULL\fP). +The function \fBform_fields\fP returns a pointer (which may be +.IR NULL ")." It does not set \fBerrno\fP. .PP -The function \fBfield_count\fP returns \fBERR\fP if the \fIform\fP parameter -is \fBNULL\fP. +The function \fBfield_count\fP returns \fBERR\fP if the \fIform\fP +parameter is +.IR NULL "." .PP The functions \fBset_form_fields\fP and \fBmove_field\fP return one of the following codes on error: diff --git a/man/form_field_buffer.3x b/man/form_field_buffer.3x index ba176d3e122b..020ce41c204c 100644 --- a/man/form_field_buffer.3x +++ b/man/form_field_buffer.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: form_field_buffer.3x,v 1.45 2024/03/16 15:35:01 tom Exp $ -.TH form_field_buffer 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: form_field_buffer.3x,v 1.47 2024/12/28 21:26:21 tom Exp $ +.TH form_field_buffer 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -104,7 +104,9 @@ is set to a nonzero value whenever the field changes. The function \fBset_max_field\fP sets the maximum size for a dynamic field. An argument of 0 turns off any maximum size threshold for that field. .SH RETURN VALUE -The \fBfield_buffer\fP function returns NULL on error. +The \fBfield_buffer\fP function returns +.I NULL +on error. It sets \fBerrno\fP according to their success: .TP 5 .B E_OK diff --git a/man/form_field_new.3x b/man/form_field_new.3x index 9cf08adb521c..fdf1ff5585b9 100644 --- a/man/form_field_new.3x +++ b/man/form_field_new.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: form_field_new.3x,v 1.41 2024/03/16 15:35:01 tom Exp $ -.TH form_field_new 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: form_field_new.3x,v 1.43 2024/12/28 21:26:21 tom Exp $ +.TH form_field_new 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBnew_field\fP, \fBdup_field\fP, @@ -66,7 +66,8 @@ Attribute data is separate. The function \fBfree_field\fP de-allocates storage associated with a field. .SH RETURN VALUE The functions \fBnew_field\fP, \fBdup_field\fP, \fBlink_field\fP return -\fBNULL\fP on error. +.I NULL +on error. They set \fBerrno\fP according to their success: .TP 5 .B E_OK diff --git a/man/form_field_opts.3x b/man/form_field_opts.3x index 9ab3ad0cb32a..8972a7ffa61c 100644 --- a/man/form_field_opts.3x +++ b/man/form_field_opts.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2014,2015 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,18 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: form_field_opts.3x,v 1.44 2024/03/16 15:35:01 tom Exp $ -.TH form_field_opts 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: form_field_opts.3x,v 1.47 2025/01/19 00:51:10 tom Exp $ +.TH form_field_opts 3X 2025-01-18 "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 '' "" +.\} .SH NAME \fBset_field_opts\fP, \fBfield_opts_on\fP, @@ -46,8 +56,8 @@ set and get field options \fBint field_opts_off(FIELD *\fIfield\fP, Field_Options \fIopts\fP); .fi .SH DESCRIPTION -The function \fBset_field_opts\fP sets all the given field's option bits (field -option bits may be logically-OR'ed together). +The function \fBset_field_opts\fP sets all the given field's option bits +(field option bits may be logically \*(``or\*(''-ed together). .PP The function \fBfield_opts_on\fP turns on the given option bits, and leaves others alone. diff --git a/man/form_field_userptr.3x b/man/form_field_userptr.3x index 6eea09201e76..ef511e59fb35 100644 --- a/man/form_field_userptr.3x +++ b/man/form_field_userptr.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: form_field_userptr.3x,v 1.30 2024/03/16 15:35:01 tom Exp $ -.TH form_field_userptr 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: form_field_userptr.3x,v 1.32 2024/12/28 21:26:21 tom Exp $ +.TH form_field_userptr 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBset_field_userptr\fP, \fBfield_userptr\fP \- @@ -46,7 +46,8 @@ Every form field has a field that can be used to hold application-specific data These functions get and set that field. .SH RETURN VALUE -The function \fBfield_userptr\fP returns a pointer (which may be \fBNULL\fP). +The function \fBfield_userptr\fP returns a pointer (which may be +.IR NULL ")." It does not set \fBerrno\fP. .PP The function \fBset_field_userptr\fP returns \fBE_OK\fP (success). diff --git a/man/form_field_validation.3x b/man/form_field_validation.3x index 54fa2a72a4b4..c196f08e318a 100644 --- a/man/form_field_validation.3x +++ b/man/form_field_validation.3x @@ -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: form_field_validation.3x,v 1.53 2024/03/16 15:35:01 tom Exp $ -.TH form_field_validation 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: form_field_validation.3x,v 1.62 2025/08/16 19:11:47 tom Exp $ +.TH form_field_validation 3X 2025-08-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -55,7 +55,7 @@ data type validation for fields \fBFIELDTYPE *field_type(const FIELD *\fIfield\fP); \fBint set_field_type(FIELD *\fIfield\fP, FIELDTYPE *\fItype\fP, ...); .PP -\fI/* predefined field types */\fP +\fI/* field types */\fP \fBFIELDTYPE *TYPE_ALNUM; \fBFIELDTYPE *TYPE_ALPHA; \fBFIELDTYPE *TYPE_ENUM; @@ -66,7 +66,7 @@ data type validation for fields .fi .SH DESCRIPTION By default, no validation is done on form fields. -You can associate a form with with a \fIfield type\fP, +You can associate a form with a \fIfield type\fP, making the form library validate input. .SS field_arg Returns a pointer to the field's argument block. @@ -81,12 +81,12 @@ a field type with a given form field. This is the type checked by validation functions. Most field types are configurable, via arguments which the caller provides when calling \fBset_field_type\fP. -.PP -Several field types are predefined by the form library. -.SH PREDEFINED TYPES -It is possible to set up new programmer-defined field types. -Field types are implemented via the \fBFIELDTYPE\fP data -structure, which contains several pointers to functions. +.SH "FIELD TYPES" +The +.I form +library defines several field types. +They are implemented via the \fBFIELDTYPE\fP data structure, +which contains several pointers to functions. .PP See the \fBform_fieldtype\fP(3X) manual page, which describes functions which can be used to construct @@ -174,7 +174,7 @@ trailing spaces (up to an empty field), or "^ *[0\-9]* *$" which is good for leading and trailing spaces around the digits. .SS TYPE_IPV4 -An Internet Protocol Version 4 address. +An Internet Protocol Version\ 4 address. Required parameter: .bP none @@ -186,8 +186,12 @@ The address itself is not validated. .PP This is an \fI\%ncurses\fP extension; this field type may not be available in other curses implementations. +.PP +It is possible to set up new programmer-defined field types. .SH RETURN VALUE -The functions \fBfield_type\fP and \fBfield_arg\fP return \fBNULL\fP on error. +The functions \fBfield_type\fP and \fBfield_arg\fP return +.I NULL +on error. The function \fBset_field_type\fP returns one of the following: .TP 5 .B E_OK diff --git a/man/form_fieldtype.3x b/man/form_fieldtype.3x index 81a58b1d8e48..0422a17fe4ef 100644 --- a/man/form_fieldtype.3x +++ b/man/form_fieldtype.3x @@ -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,19 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: form_fieldtype.3x,v 1.46 2024/03/16 15:35:01 tom Exp $ -.TH form_fieldtype 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: form_fieldtype.3x,v 1.51 2025/01/19 00:51:10 tom Exp $ +.TH form_fieldtype 3X 2025-01-18 "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 '' "" +.\} +. .de bP .ie n .IP \(bu 4 .el .IP \(bu 2 @@ -102,7 +113,9 @@ This function may be used by applications to copy argument-blocks. Frees an argument-block structure. .PP You must supply the \fImake_arg\fP function. -The other two are optional: you may supply NULL for them. +The other two are optional: you may supply +.I NULL +for them. In this case, the form library assumes that \fImake_arg\fP does not allocate memory but simply loads the argument into a single scalar value. @@ -119,7 +132,7 @@ argument-block structure as arguments. .SS link_fieldtype The function \fBlink_fieldtype\fP creates a new field type from the two given types. -They are connected by an logical 'OR'. +They are connected by a logical \*(``or\*(''. .SH RETURN VALUE The pointer-valued routines return NULL on error. They set \fBerrno\fP according to their success: diff --git a/man/form_hook.3x b/man/form_hook.3x index d93d8d875cb0..f75b85ecdb34 100644 --- a/man/form_hook.3x +++ b/man/form_hook.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: form_hook.3x,v 1.37 2024/03/16 15:35:01 tom Exp $ -.TH form_hook 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: form_hook.3x,v 1.39 2024/12/28 21:26:21 tom Exp $ +.TH form_hook 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBform_hook\fP \- set hooks for automatic invocation by applications @@ -55,28 +55,35 @@ points in the automatic processing of input event codes by \fBform_driver\fP. sets a hook to be called at form-post time and each time the selected field changes (after the change). .SS field_init -returns the current field init hook, if any (\fBNULL\fP if there is no such -hook). +returns the current field init hook, if any +.RI ( NULL +if there is no such hook). .SS set_field_term sets a hook to be called at form-unpost time and each time the selected field changes (before the change). .SS field_term -returns the current field term hook, if any (\fBNULL\fP if there is no such -hook). +returns the current field term hook, if any +.RI ( NULL +if there is no such hook). .SS set_form_init sets a hook to be called at form-post time and just after a page change once it is posted. .SS form_init returns the current form init hook, -if any (\fBNULL\fP if there is no such hook). +if any +.RI ( NULL +if there is no such hook). .SS set_form_term sets a hook to be called at form-unpost time and just before a page change once it is posted. .SS form_term -returns the current form term hook, if any (\fBNULL\fP if there is no such -hook). +returns the current form term hook, if any +.RI ( NULL +if there is no such hook). .SH RETURN VALUE -Routines that return pointers return \fBNULL\fP on error. +Routines that return pointers return +.I NULL +on error. Other routines return one of the following: .TP 5 diff --git a/man/form_new.3x b/man/form_new.3x index dc45e183f8aa..0fd4a0210c23 100644 --- a/man/form_new.3x +++ b/man/form_new.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: form_new.3x,v 1.32 2024/03/16 15:35:01 tom Exp $ -.TH form_new 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: form_new.3x,v 1.34 2024/12/28 21:26:21 tom Exp $ +.TH form_new 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBnew_form\fP, \fBfree_form\fP \- @@ -42,12 +42,15 @@ create and destroy forms .fi .SH DESCRIPTION The function \fBnew_form\fP creates a new form connected to a specified field -pointer array (which must be \fBNULL\fP-terminated). +pointer array (which must be +.IR NULL -terminated). .PP The function \fBfree_form\fP disconnects \fIform\fP from its field array and frees the storage allocated for the form. .SH RETURN VALUE -The function \fBnew_form\fP returns \fBNULL\fP on error. +The function \fBnew_form\fP returns +.I NULL +on error. It sets \fBerrno\fP according to the function's success: .TP 5 .B E_OK diff --git a/man/form_opts.3x b/man/form_opts.3x index 74a36d2b3d8e..3c92ecc6f4e7 100644 --- a/man/form_opts.3x +++ b/man/form_opts.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2010,2015 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,18 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: form_opts.3x,v 1.34 2024/03/16 15:35:01 tom Exp $ -.TH form_opts 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: form_opts.3x,v 1.37 2025/01/19 00:51:10 tom Exp $ +.TH form_opts 3X 2025-01-18 "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 '' "" +.\} .SH NAME \fBset_form_opts\fP, \fBform_opts_on\fP, @@ -46,8 +56,8 @@ set and get form options \fBint form_opts_off(FORM *\fIform\fP, Field_Options \fIopts\fP); .fi .SH DESCRIPTION -The function \fBset_form_opts\fP sets all the given form's option bits (form -option bits may be logically-OR'ed together). +The function \fBset_form_opts\fP sets all the given form's option bits +(form option bits may be logically \*(``or\*(''-ed together). .PP The function \fBform_opts_on\fP turns on the given option bits, and leaves others alone. diff --git a/man/form_page.3x b/man/form_page.3x index fa538c620143..47f60a7bd8e8 100644 --- a/man/form_page.3x +++ b/man/form_page.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: form_page.3x,v 1.37 2024/03/16 15:35:01 tom Exp $ -.TH form_page 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: form_page.3x,v 1.39 2024/12/28 21:26:21 tom Exp $ +.TH form_page 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBform_page\fP \- set and get form page number @@ -52,7 +52,9 @@ form; \fBcurrent_field\fP returns the current field of the given form. .PP The function \fBunfocus_current_field\fP removes the focus from the current field of the form. -In such state, inquiries via \fBcurrent_field\fP shall return a NULL pointer. +In such state, inquiries via \fBcurrent_field\fP shall return a +.I NULL +pointer. .PP The function \fBset_form_page\fP sets the form's page number (goes to page \fIn\fP of the form). diff --git a/man/form_requestname.3x b/man/form_requestname.3x index 4075ea73c756..27c897c961d2 100644 --- a/man/form_requestname.3x +++ b/man/form_requestname.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: form_requestname.3x,v 1.35 2024/03/16 15:35:01 tom Exp $ -.TH form_requestname 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: form_requestname.3x,v 1.37 2024/12/28 21:26:21 tom Exp $ +.TH form_requestname 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBform_request_by_name\fP, \fBform_request_name\fP \- @@ -47,7 +47,9 @@ The function \fBform_request_by_name\fP searches in the name-table for a request with the given name and returns its request code. Otherwise E_NO_MATCH is returned. .SH RETURN VALUE -\fBform_request_name\fP returns \fBNULL\fP on error and sets \fBerrno\fP +\fBform_request_name\fP returns +.I NULL +on error and sets \fBerrno\fP to \fBE_BAD_ARGUMENT\fP. .PP \fBform_request_by_name\fP returns \fBE_NO_MATCH\fP on error. diff --git a/man/form_userptr.3x b/man/form_userptr.3x index 11c990c0030b..b4f5d576a3af 100644 --- a/man/form_userptr.3x +++ b/man/form_userptr.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: form_userptr.3x,v 1.36 2024/03/16 15:35:01 tom Exp $ -.TH form_userptr 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: form_userptr.3x,v 1.38 2024/12/28 21:26:21 tom Exp $ +.TH form_userptr 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBset_form_userptr\fP, \fBform_userptr\fP \- @@ -45,7 +45,8 @@ Every form and every form item has a field that can be used to hold application-specific data (that is, the form-driver code leaves it alone). These functions get and set the form user pointer field. .SH RETURN VALUE -The function \fBform_userptr\fP returns a pointer (which may be \fBNULL\fP). +The function \fBform_userptr\fP returns a pointer (which may be +.IR NULL ")." It does not set \fBerrno\fP. .PP The function \fBset_form_userptr\fP returns \fBE_OK\fP (success). diff --git a/man/form_win.3x b/man/form_win.3x index 4a75b294ce01..ef6b27cfbea9 100644 --- a/man/form_win.3x +++ b/man/form_win.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: form_win.3x,v 1.35 2024/03/16 15:35:01 tom Exp $ -.TH form_win 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: form_win.3x,v 1.37 2024/12/28 21:26:21 tom Exp $ +.TH form_win 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBform_win\fP \- make and break form window and subwindow associations @@ -54,14 +54,20 @@ The first four functions get and set those windows. It is not necessary to set either window; by default, the driver code uses \fBstdscr\fP for both. .PP -In the \fBset_\fP functions, window argument of \fBNULL\fP is treated as though -it were \fBstsdcr\fP. A form argument of \fBNULL\fP is treated as a request +In the \fBset_\fP functions, window argument of +.I NULL +is treated as though +it were \fBstsdcr\fP. A form argument of +.I NULL +is treated as a request to change the system default form window or subwindow. .PP The function \fBscale_form\fP returns the minimum size required for the subwindow of \fIform\fP. .SH RETURN VALUE -Routines that return pointers return \fBNULL\fP on error. +Routines that return pointers return +.I NULL +on error. Routines that return an integer return one of the following error codes: .TP 5 diff --git a/man/infocmp.1m b/man/infocmp.1m index 5f92c96dd63b..2868da57d5e2 100644 --- a/man/infocmp.1m +++ b/man/infocmp.1m @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" 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 * @@ -28,8 +28,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: infocmp.1m,v 1.109 2024/03/16 15:35:01 tom Exp $ -.TH @INFOCMP@ 1M 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" +.\" $Id: infocmp.1m,v 1.128 2025/11/12 00:52:57 tom Exp $ +.TH @INFOCMP@ 1M 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -49,12 +49,13 @@ .el .IP \(bu 2 .. . -.ds d @TERMINFO@ .SH NAME \fB@INFOCMP@\fP \- compare or print out \fIterminfo\fP descriptions .SH SYNOPSIS -\fB@INFOCMP@\fP [\fB\-\ +.HP +.B @INFOCMP@ +.RB [ \-\ 1\ c\ C\ @@ -81,70 +82,59 @@ U\ V\ W\ x\ -\fP] - [\fB\-v\fR \fIn\fR] [\fB\-s d\fR| \fBi\fR| \fBl\fR| \fBc\fR] [\fB\-Q\fR \fIn\fR] [\fB\-R \fBsubset\fR] - [\fB\-w\fP\ \fIwidth\fP] [\fB\-A\fP\ \fIdirectory\fP] [\fB\-B\fP\ \fIdirectory\fP] - [\fIterminal-type\fP ...] +] +.RB [ \-A\ \c +.IR directory ] +.RB [ \-B\ \c +.IR directory ] +.RB [ \-Q\ \c +.IR encoding ] +.RB [ \-R\ \c +.IR subset ] +.RB [ \-s\ \c +.IR key ] +.RB [ \-v\ \c +.IR level ] +.RB [ \-w\ \c +.IR width ] +.RI [ \%terminal\%-type +\&.\|.\|.\& ] .SH DESCRIPTION -\fB@INFOCMP@\fP can be used to compare a binary \fBterminfo\fP entry with other -terminfo entries, rewrite a \fBterminfo\fP description to take advantage of the -\fBuse=\fP terminfo field, or print out a \fBterminfo\fP description from the -binary file (\fBterm\fP) in a variety of formats. -In all cases, the Boolean -fields will be printed first, followed by the numeric fields, followed by the -string fields. +.B @INFOCMP@ +reports a human-readable terminal type description +from a compiled entry in the +.I \%term\%info +database in a variety of selectable formats, +compares such entries to each other, +and rewrites an entry to replace +.RB \*(`` use \*('' +expressions with the content of other entries by reference. +A +.I "\%term\%info entry" +comprises +a list of one or more terminal type identifiers, +a human-readable description of the terminal type, +and a list of terminal +.I capabilities +that characterize its programming interface. +In all cases, +the program reports +Boolean-valued capabilities first, +followed by numeric ones, +and then string-valued capabilities. .SS "Default Options" -If no options are specified and zero or one \fIterminal-types\fP are -specified, -the -\fB\-I\fP option will be assumed. -If more than one \fIterminal-type\fP is specified, -the \fB\-d\fP option will be assumed. -.SS "Comparison Options [\-d] [\-c] [\-n]" -\fB@INFOCMP@\fP compares the \fBterminfo\fP description of the first terminal -\fIterminal-type\fP with each of the descriptions given by the entries -for the other terminal's \fIterminal-types\fP. -If a capability is defined for only one of the -terminals, the value returned depends on the type of the capability: -.bP -\fBF\fP for missing Boolean variables -.bP -\fBNULL\fP for missing integer or string variables -.PP -Use the \fB\-q\fP option to show the distinction between -\fIabsent\fP and \fIcancelled\fP capabilities. -.PP -These options produce a list which you can use to compare two -or more terminal descriptions: -.TP 5 -\fB\-d\fP -produces a list of each capability that is \fIdifferent\fP -between two entries. -Each item in the list shows \*(``:\*('' after the capability name, -followed by the capability values, separated by a comma. -.TP -\fB\-c\fP -produces a list of each capability that is \fIcommon\fP between -two or more entries. -Missing capabilities are ignored. -Each item in the list shows \*(``=\*('' after the capability name, -followed by the capability value. -.IP -The \fB\-u\fP option provides a related output, -showing the first terminal description rewritten to use the second -as a building block via the \*(``use=\*('' clause. -.TP -\fB\-n\fP -produces a list of each capability that is in \fInone\fP of the given entries. -Each item in the list shows \*(``!\*('' before the capability name. -.IP -Normally only the conventional capabilities are shown. -Use the \fB\-x\fP option to add the BSD-compatibility -capabilities (names prefixed with \*(``OT\*(''). -.IP -If no \fIterminal-types\fP are given, -\fB@INFOCMP@\fP uses the environment variable \fITERM\fP -for each of the \fIterminal-types\fP. +If no options are specified and zero or one +.I terminal-types +is specified, +.B @INFOCMP@ +assumes the +.B \-I +option. +If more than one is specified, +the program +assumes the +.B \-d +option. .SS "Source Listing Options [\-I] [\-L] [\-C] [\-r]" The \fB\-I\fP, \fB\-L\fP, and \fB\-C\fP options will produce a source listing for each terminal named. @@ -231,6 +221,90 @@ _ .\" hpgeneric cup %p2\fR\|.\|.\|.\|\fP%p1 %r hpgeneric .TE +.SS "Entry Comparison Options [-d] [-c] [-n]" +Given +.BR \-c , +.BR \-d , +or +.BR \-n , +.B @INFOCMP@ +compares the +.I \%term\%info +description of the first specified +.I terminal-type +with those of each of the subsequent operands. +If fewer +.I terminal-types +than required are specified, +.B @INFOCMP@ +uses the environment variable +.I TERM +in their place. +.PP +If a capability is defined for only one terminal type, +the value reported depends on the capability's type: +.bP +.B F +for missing Boolean variables +.bP +.B NULL +for missing integer or string variables +.PP +The +.B \-c +and +.B \-d +options report string capability values +between \*(``\*'\*('' characters. +Use the +.B \-q +option to distinguish +.I absent +and +.I canceled +capabilities; +see \fB\%terminfo\fP(5). +.PP +The comparison option selects the form of report. +.TP 5 +.B \-d +lists each capability that +.I differs +between two entries. +Each capability name is followed by \*(``:\*('' +and comma-separated capability values, +then a period. +.TP +.B \-c +lists each capability that two entries have in +.IR common "." +.B @INFOCMP@ +ignores capabilities missing from either entry. +Each capability name is followed by \*(``=\*('', +a space, +and the capability value, +then a period. +.IP +If the +.B \-u +option is further specified, +.B @INFOCMP@ +rewrites the description of the first type +employing \*(``use=\*('' syntax +to use the second as a building block. +.TP +.B \-n +lists capabilities that are in +.I none +of the given entries. +Each capability name is preceded by \*(``!\*('' +and followed by a period. +.IP +Normally only conventional capabilities are shown. +Use the +.B \-x +option to add BSD-compatibility capabilities +(names prefixed with \*(``OT\*(''). .SS "Use= Option [\-u]" The \fB\-u\fP option produces a \fBterminfo\fP source description of the first terminal \fIterminal-type\fP which is relative to the sum of the @@ -278,7 +352,7 @@ the compilation time, is specifying extra \fBuse=\fP fields that are superfluous. \fB@INFOCMP@\fP will flag any other \fIterminal-type use=\fP fields that were not needed. -.SS "Changing Databases [\-A \fIdirectory\fR] [\-B \fIdirectory\fR]" +.SS "Changing Databases [\-A \fIdirectory\fP] [\-B \fIdirectory\fP]" Like other \fI\%ncurses\fP utilities, \fB@INFOCMP@\fP looks for the terminal descriptions in several places. You can use the \fI\%TERMINFO\fP and \fI\%TERMINFO_DIRS\fP environment @@ -479,7 +553,8 @@ Make the comparison listing shorter by omitting subheadings, and using \*(``\-\*('' for absent capabilities, \*(``@\*('' for canceled rather than \*(``NULL\*(''. .bP -However, show differences between absent and cancelled capabilities. +However, +show differences between absent and canceled capabilities. .bP Omit the \*(``Reconstructed from\*('' comment for source listings. .RE @@ -508,7 +583,7 @@ if they are processed later in the command parameters: .RS .TP 5 \fB\-C\fP -sets the \*(``BSD\*('' subset as a side-effect. +sets the \*(``BSD\*('' subset as a side effect. .TP 5 \fB\-I\fP sets the subset to all capabilities. @@ -584,44 +659,62 @@ These are extensions to the terminfo repertoire which can be loaded using the \fB\-x\fP option of \fB@TIC@\fP. .SH FILES .TP -.I \*d +.I @TERMINFO@ compiled terminal description database .SH EXTENSIONS The -\fB\-0\fP, -\fB\-1\fP, -\fB\-E\fP, -\fB\-F\fP, -\fB\-G\fP, -\fB\-Q\fP, -\fB\-R\fP, -\fB\-T\fP, -\fB\-V\fP, -\fB\-a\fP, -\fB\-e\fP, -\fB\-f\fP, -\fB\-g\fP, -\fB\-i\fP, -\fB\-l\fP, -\fB\-p\fP, -\fB\-q\fP and -\fB\-t\fP -options are not supported in SVr4 curses. +.BR \-0 "," +.BR \-1 "," +.BR \-a "," +.BR \-e "," +.BR \-E "," +.BR \-f "," +.BR \-F "," +.BR \-g "," +.BR \-G "," +.BR \-i "," +.BR \-l "," +.BR \-p "," +.BR \-q "," +.BR \-Q "," +.BR \-R "," +.BR \-t "," +.BR \-T "," +and +.B \-V +options are +.I \%ncurses +extensions. +.SH PORTABILITY +X/Open Curses Issue\ 7 (2009) specifies +.IR \%infocmp "." +It does not mention options for producing descriptions in +.I \%term\%cap +format. .PP -SVr4 infocmp does not distinguish between absent and cancelled capabilities. -Also, it shows missing integer capabilities as \fB\-1\fP -(the internal value used to represent missing integers). -This implementation shows those as \*(``NULL\*('', -for consistency with missing strings. +SVr4 +.I \%infocmp +does not distinguish between absent and canceled capabilities. +It furthermore reports missing integer capabilities as +.B \-1 +(its internal representation). +.I \%ncurses +shows these as \*(``NULL\*('' +for consistency with missing string capabilities. .PP -The \fB\-r\fP option's notion of \*(``termcap\*('' capabilities -is System V Release 4's. -Actual BSD curses versions will have a more restricted set. -To see only the -4.4BSD set, use \fB\-r\fP \fB\-RBSD\fP. -.SH PORTABILITY -X/Open Curses, Issue 7 (2009) provides a description of \fBinfocmp\fP. -It does not mention the options used for converting to termcap format. +The +.B \-r +option +of +.I \%ncurses +.I \%infocmp +uses SVr4's notion of \*(``termcap\*('' capabilities. +BSD +.I curses +had a more restricted set. +To see only those present in 4.4BSD, +use +.RB \*(`` "\-r \-RBSD" \*(''. .SH HISTORY Although System V Release 2 provided a terminfo library, it had no documented tool for decompiling the terminal descriptions. diff --git a/man/infotocap.1m b/man/infotocap.1m index 0f0335d44603..6684f91ad32d 100644 --- a/man/infotocap.1m +++ b/man/infotocap.1m @@ -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 * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: infotocap.1m,v 1.41 2024/03/16 15:35:01 tom Exp $ -.TH @INFOTOCAP@ 1M 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" +.\" $Id: infotocap.1m,v 1.52 2025/10/04 20:10:32 tom Exp $ +.TH @INFOTOCAP@ 1M 2025-10-04 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -40,7 +40,6 @@ .el .ds '' "" .\} . -.ds d @TERMINFO@ .SH NAME \fB\%@INFOTOCAP@\fP \- convert a \fI\%terminfo\fR description into a \fI\%termcap\fR description @@ -52,39 +51,60 @@ convert a \fI\%terminfo\fR description into a \fI\%termcap\fR description .P .B "@INFOTOCAP@ \-V" .SH DESCRIPTION -\fB\%@INFOTOCAP@\fP translates terminal descriptions. -It looks in each given text \fIfile\fP for \fI\%terminfo\fP entries and, -For each one found, -it writes an analogous \fI\%termcap\fP description to the standard -output stream. -\fI\%terminfo\fP \*(``\fBuse\fP\*('' capabilities translate to -\fI\%termcap\fP \fBtc\fP capabilities. -Because \fI\%termcap\fP is a less expressive format than -\fI\%terminfo\fP, +.B \%@INFOTOCAP@ +translates terminal descriptions. +It looks in each given text +.I file +for +.I \%terminfo +entries and, +for each one found, +writes an analogous +.I \%termcap +description to the standard output stream. +.I \%terminfo +.RB \*(`` use \*('' +capabilities translate to +.I \%termcap +.B tc +capabilities. +Because +.I \%termcap +is a less expressive format than +.IR \%terminfo , some capabilities cannot be translated. .PP This utility is implemented as a link to \fB\%@TIC@\fP(1M), with the latter's .B \-C 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. .SH FILES .TP -.I \*d +.I @TERMINFO@ compiled terminal description database +.SH EXTENSIONS +This command is an +.I \%ncurses +extension. .SH PORTABILITY -None of X/Open Curses, -Issue 7 (2009), -SVr4, -or NetBSD document this application. +X/Open Curses Issue\ 7 (2009) does not specify this command. +SVr4 and NetBSD +.I curses +do not implement it. .SH AUTHORS Eric S. Raymond <esr@snark.thyrsus.com> and diff --git a/man/key_defined.3x b/man/key_defined.3x index f0184aa77df1..3c15e67f451f 100644 --- a/man/key_defined.3x +++ b/man/key_defined.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 2003-2006,2010 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -29,33 +29,57 @@ .\" .\" Author: Thomas E. Dickey 2003 .\" -.\" $Id: key_defined.3x,v 1.34 2024/03/16 15:35:01 tom Exp $ -.TH key_defined 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: key_defined.3x,v 1.44 2025/10/04 20:11:22 tom Exp $ +.TH key_defined 3X 2025-10-04 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fB\%key_defined\fP \- -test whether a \fIcurses\fR keycode is defined +obtain key code for an \fIncurses\fP function key definition .SH SYNOPSIS .nf \fB#include <curses.h> .PP -\fBint key_defined(const char *\fIdefinition\fP); +\fBint key_defined(const char * \fIdefinition\fP); .fi .SH DESCRIPTION -This is an extension to the \fIcurses\fP library. -It permits an application to determine if a string is currently bound -to any keycode. +The +.B \%key_defined +.I \%ncurses +extension permits a +.I curses +application to determine the function key code, +if any, +to which the string +.I definition +is bound. .SH RETURN VALUE -If the string is bound to a keycode, its value (greater than zero) is returned. -If no keycode is bound, zero is returned. -If the string conflicts with longer strings -which are bound to keys, \-1 is returned. +.B \%key_defined +returns the first key code to which +.I definition +is bound if any exists. +If none does, +it returns +.BR 0 "." +If +.I definition +is a prefix of another bound definition, +.B \%key_defined +returns +.BR \-1 "." +.SH EXTENSIONS +.B \%key_defined +is an +.I \%ncurses +extension. .SH PORTABILITY -This routine is specific to \fI\%ncurses\fP. -It was not supported on -Version 7, BSD or System V implementations. -It is recommended that -any code depending on them be conditioned using \fB\%NCURSES_VERSION\fP. +Applications employing +.I \%ncurses +extensions should condition their use on the visibility of the +.B \%NCURSES_VERSION +preprocessor macro. .SH AUTHORS Thomas Dickey .SH SEE ALSO -\fB\%define_key\fP(3X) +\fB\%curses\fP(3X), +\fB\%define_key\fP(3X), +\fB\%keybound\fP(3X), +\fB\%keyok\fP(3X) diff --git a/man/keybound.3x b/man/keybound.3x index bd8bb80f3c44..19c14bf6d7e1 100644 --- a/man/keybound.3x +++ b/man/keybound.3x @@ -29,37 +29,76 @@ .\" .\" Author: Thomas E. Dickey 1999 .\" -.\" $Id: keybound.3x,v 1.36 2024/03/16 15:35:01 tom Exp $ -.TH keybound 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: keybound.3x,v 1.42 2024/12/28 21:26:21 tom Exp $ +.TH keybound 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fB\%keybound\fP \- -get definition of \fIcurses\fR keycode +get definition of a \fIcurses\fP function key code .SH SYNOPSIS .nf \fB#include <curses.h> .PP -\fBchar * keybound(int \fIkeycode\fP, int \fIcount\fP); +\fBchar * keybound(int \fIkey-code\fP, int \fIcount\fP); .fi .SH DESCRIPTION -This is an extension to the \fIcurses\fP library. -It permits an application to determine the string which is defined -in the terminfo for specific keycodes. +The +.B \%keybound +.I \%ncurses +extension permits a +.I curses +application to obtain the value of the string +.I bound +to the function key +.IR key-code ";" +see \fB\%wgetch\fP(3X) +(wide-character API users: \fB\%wget_wch\fP(3X)). +By default, +such bindings are string capabilities from the +.I \%term\%info +database entry corresponding to the terminal type. +The application can non-destructively and repeatedly +override such definitions with +\fB\%define_key\fP(3X), +as if by pushing new definitions onto a stack. +The +.I count +parameter accesses the +.IR n th +most recently defined binding; +.B 0 +selects the binding that is used on input. .SH RETURN VALUE -The \fIkeycode\fP parameter must be greater than zero, -else \fBNULL\fP is returned. -If it does not correspond to a defined key, then \fBNULL\fP is returned. -The \fIcount\fP parameter is used to allow the application to iterate -through multiple definitions, counting from zero. -When successful, -the function returns a string which must be freed by the caller. +If +.I key-code +corresponds to a function key defined +by the application +or the terminal type in use, +.B \%keybound +allocates and returns a string +that must be freed by the application. +.B \%keybound +returns +.I NULL +if +.I key-code +is not positive +or if it does not correspond to a key code definition. +.SH EXTENSIONS +.B \%keybound +is an +.I \%ncurses +extension. .SH PORTABILITY -This routine is specific to \fI\%ncurses\fP. -It was not supported on -Version 7, BSD or System V implementations. -It is recommended that -any code depending on them be conditioned using \fB\%NCURSES_VERSION\fP. +Applications employing +.I \%ncurses +extensions should condition their use on the visibility of the +.B \%NCURSES_VERSION +preprocessor macro. .SH AUTHORS Thomas Dickey .SH SEE ALSO +\fB\%curses\fP(3X), \fB\%define_key\fP(3X), -\fB\%keyok\fP(3X) +\fB\%keyok\fP(3X), +\fB\%key_defined\fP(3X), +\fB\%terminfo\fP(5) diff --git a/man/keyok.3x b/man/keyok.3x index b4c7de2b4948..d8072afb1264 100644 --- a/man/keyok.3x +++ b/man/keyok.3x @@ -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 * @@ -29,35 +29,83 @@ .\" .\" Author: Thomas E. Dickey 1997 .\" -.\" $Id: keyok.3x,v 1.40 2024/03/16 15:35:01 tom Exp $ -.TH keyok 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: keyok.3x,v 1.51 2025/10/04 20:59:08 tom Exp $ +.TH keyok 3X 2025-10-04 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +. +.de bP +.ie n .IP \(bu 4 +.el .IP \(bu 2 +.. +. .SH NAME \fB\%keyok\fP \- -enable or disable a \fIcurses\fR keycode +enable or disable an \fIncurses\fP function key code .SH SYNOPSIS .nf \fB#include <curses.h> .PP -\fBint keyok(int \fIkeycode\fP, bool \fIenable\fP); +\fBint keyok(int \fIkey-code\fP, bool \fIbf\fP); .fi .SH DESCRIPTION -This is an extension to the \fIcurses\fP library. -It permits an application to disable specific keycodes, rather than -use the \fB\%keypad\fP function to disable all keycodes. -Keys that have been disabled can be re-enabled. +The +.B \%keyok +.I \%ncurses +extension permits a +.I curses +application to disable a function key +.I key-code +returned by \fB\%wgetch\fP(3X) +(wide-character API users: +\fB\%wget_wch\fP(3X)). +Key codes that have been disabled can be re-enabled. +.I bf +selects the desired enablement status. +This operation is more fine-grained than calling \fB\%keypad\fP(3X), +which affects +.I all +function keys. .SH RETURN VALUE -The keycode must be greater than zero, else \fBERR\fP is returned. -If it does not correspond to a defined key, then \fBERR\fP is returned. -If the \fIenable\fP parameter is true, then the key must have been disabled, -and vice versa. -Otherwise, the function returns \fBOK\fP. +.B \%keyok +returns +.B ERR +if +.bP +.I key-code +is nonpositive, +.bP +.I key-code +is not a recognized value, +or +.bP +enablement of +.I key-code +is already in the desired state. +.PP +Otherwise, +.B \%keyok +returns +.BR OK "." +.SH EXTENSIONS +.B \%keyok +is an +.I \%ncurses +extension. .SH PORTABILITY -This routine is specific to \fI\%ncurses\fP. -It was not supported on -Version 7, BSD or System V implementations. -It is recommended that -any code depending on them be conditioned using \fB\%NCURSES_VERSION\fP. +Applications employing +.I \%ncurses +extensions should condition their use on the visibility of the +.B \%NCURSES_VERSION +preprocessor macro. +.PP +NetBSD +.I curses +since 2.0 (2004) supports +.IR \%keyok "." .SH AUTHORS Thomas Dickey .SH SEE ALSO -\fB\%define_key\fP(3X) +\fB\%curses\fP(3X), +\fB\%define_key\fP(3X), +\fB\%keybound\fP(3X), +\fB\%keyok\fP(3X), +\fB\%key_defined\fP(3X) diff --git a/man/legacy_coding.3x b/man/legacy_coding.3x index ccfdd5564bb9..12b39538b8bc 100644 --- a/man/legacy_coding.3x +++ b/man/legacy_coding.3x @@ -29,8 +29,8 @@ .\" .\" Author: Thomas E. Dickey .\" -.\" $Id: legacy_coding.3x,v 1.28 2024/04/20 19:13:50 tom Exp $ -.TH legacy_coding 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: legacy_coding.3x,v 1.32 2024/09/14 20:06:50 tom Exp $ +.TH legacy_coding 3X 2024-09-14 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fB\%use_legacy_coding\fP \- override \fIcurses\fR locale encoding checks @@ -41,15 +41,18 @@ override \fIcurses\fR locale encoding checks \fBint use_legacy_coding(int \fIlevel\fP); .fi .SH DESCRIPTION -.B \%use_legacy_coding -is an extension to the +.BR \%use_legacy_coding "," +an +.I \%ncurses +extension to the .I curses -library. -It allows the caller to change the result of \fB\%unctrl\fP(3X), +library, +permits customiztion of \fB\%unctrl\fP(3X) behavior, suppressing \fI\%isprint\fP(3)-based checks within the library that would normally cause nonprinting characters to be rendered in visible form. -The alteration affects only eight-bit characters. +The alteration affects only byte-wide characters with the most +significant bit set. .PP The .I level @@ -73,7 +76,9 @@ It also modifies the output of \fB\%unctrl\fP(3X), showing codes in the range 128-159 as is. .RE .SH RETURN VALUE -If the screen has not been initialized, +If the +.I curses +screen has not been initialized, or the .I level parameter is out of range, @@ -81,23 +86,24 @@ parameter is out of range, returns .BR ERR . Otherwise, -it returns the previous level: -.BR 0 , -.BR 1 , -or -.BR 2 . -.SH PORTABILITY +it returns the previous level. +.SH EXTENSIONS .B \%use_legacy_coding -is specific to -.IR \%ncurses . -It was not supported on Version 7, BSD or System V implementations. +is an +.I \%ncurses +extension. +.SH PORTABILITY Applications employing .I \%ncurses extensions should condition their use on the visibility of the .B \%NCURSES_VERSION preprocessor macro. +.SH HISTORY +.I \%ncurses +5.6 (2006) introduced +.I \%use_legacy_coding +to support \fI\%lynx\fP(1)'s font-switching feature. .SH AUTHORS Thomas Dickey -(to support \fI\%lynx\fP(1)'s font-switching feature). .SH SEE ALSO \fB\%unctrl\fP(3X) diff --git a/man/make_sed.sh b/man/make_sed.sh index ee7df41775e0..0151d8706f73 100755 --- a/man/make_sed.sh +++ b/man/make_sed.sh @@ -1,7 +1,7 @@ #!/bin/sh -# $Id: make_sed.sh,v 1.19 2023/12/07 01:16:43 tom Exp $ +# $Id: make_sed.sh,v 1.22 2025/11/12 00:52:57 Branden.Robinson Exp $ ############################################################################## -# Copyright 2020-2022,2023 Thomas E. Dickey # +# Copyright 2020-2023,2025 Thomas E. Dickey # # Copyright 1998-2005,2017 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -31,9 +31,9 @@ # # Author: Thomas E. Dickey 1997 # -# Construct a sed-script to perform renaming within man-pages. Originally +# Construct a sed script to perform renaming within man pages. Originally # written in much simpler form, this one accounts for the common cases of -# section-names in man-pages. +# section names in man pages. if test $# != 1 ; then echo '? expected a single filename' @@ -79,7 +79,7 @@ echo "# Do the embedded references" sed -e 's/</<fB\\(\\\\%\\)\\?/' \ -e 's/\\%</\\%/' \ -e 's/ /\\\\fP(/' \ - -e 's/ /)\/fB\\\\%/' \ + -e 's/ /)\/fB\\1/' \ -e 's/ /\\\\fP(/' \ -e 's/\/$/)\//' \ $UPPER diff --git a/man/man_db.renames.in b/man/man_db.renames.in index 2b18a016eafc..3ae7da2928ad 100644 --- a/man/man_db.renames.in +++ b/man/man_db.renames.in @@ -1,5 +1,5 @@ ############################################################################## -# Copyright 2019-2023,2024 Thomas E. Dickey # +# Copyright 2019-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 # @@ -26,7 +26,7 @@ # use or other dealings in this Software without prior written # # authorization. # ############################################################################## -# $Id: man_db.renames.in,v 1.73 2024/04/13 23:39:11 tom Exp $ +# $Id: man_db.renames.in,v 1.87 2025/08/16 19:36:29 Branden.Robinson Exp $ # Manual-page renamings for the man_db program # # Files: @@ -178,11 +178,13 @@ attr_get.3x attr_get.3ncurses attr_on.3x attr_on.3ncurses attron.3x attron.3ncurses baudrate.3x baudrate.3ncurses +beep.3x beep.3ncurses bkgd.3x bkgd.3ncurses bkgrnd.3x bkgrnd.3ncurses cbreak.3x cbreak.3ncurses clearok.3x clearok.3ncurses clrtoeol.3x clrtoeol.3ncurses +color_content.3x color_content.3ncurses curs_set.3x curs_set.3ncurses curscr.3x curscr.3ncurses curses_trace.3x curses_trace.3ncurses @@ -195,14 +197,19 @@ derwin.3x derwin.3ncurses doupdate.3x doupdate.3ncurses echo.3x echo.3ncurses endwin.3x endwin.3ncurses +erasechar.3x erasechar.3ncurses +erasewchar.3x erasewchar.3ncurses extended_slk_color.3x extended_slk_color.3ncurses filter.3x filter.3ncurses flushinp.3x flushinp.3ncurses get_wch.3x get_wch.3ncurses +get_wstr.3x get_wstr.3ncurses getattr.3x getattr.3ncurses getcchar.3x getcchar.3ncurses getch.3x getch.3ncurses +getstr.3x getstr.3ncurses getwin.3x getwin.3ncurses +getyx.3x getyx.3ncurses halfdelay.3x halfdelay.3ncurses has_key.3x has_key.3ncurses idcok.3x idcok.3ncurses @@ -210,13 +217,18 @@ idlok.3x idlok.3ncurses immedok.3x immedok.3ncurses in_wch.3x in_wch.3ncurses inch.3x inch.3ncurses +init_color.3x init_color.3ncurses initscr.3x initscr.3ncurses +is_cbreak.3x is_cbreak.3ncurses is_scrollok.3x is_scrollok.3ncurses keyname.3x keyname.3ncurses keypad.3x keypad.3ncurses +killchar.3x killchar.3ncurses +killwchar.3x killwchar.3ncurses leaveok.3x leaveok.3ncurses longname.3x longname.3ncurses meta.3x meta.3ncurses +mousemask.3x mousemask.3ncurses move.3x move.3ncurses mvcur.3x mvcur.3ncurses mvwin.3x mvwin.3ncurses @@ -227,14 +239,16 @@ nl.3x nl.3ncurses nocbreak.3x nocbreak.3ncurses nodelay.3x nodelay.3ncurses nonl.3x nonl.3ncurses +noraw.3x noraw.3ncurses notimeout.3x notimeout.3ncurses pnoutrefresh.3x pnoutrefresh.3ncurses prefresh.3x prefresh.3ncurses printw.3x printw.3ncurses -putp.3x putp.3ncurses +putp.3x putp.3ncurses putwin.3x putwin.3ncurses raw.3x raw.3ncurses refresh.3x refresh.3ncurses +reset_prog_mode.3x reset_prog_mode.3ncurses reset_shell_mode.3x reset_shell_mode.3ncurses restartterm.3x restartterm.3ncurses ripoffline.3x ripoffline.3ncurses @@ -251,6 +265,8 @@ start_color.3x start_color.3ncurses subwin.3x subwin.3ncurses syncok.3x syncok.3ncurses terminfo.3x terminfo.3ncurses +tigetflag.3x tigetflag.3ncurses +tigetnum.3x tigetnum.3ncurses tigetstr.3x tigetstr.3ncurses touchline.3x touchline.3ncurses touchwin.3x touchwin.3ncurses @@ -258,6 +274,7 @@ tparm.3x tparm.3ncurses tputs.3x tputs.3ncurses trace.3x trace.3ncurses unctrl.3x unctrl.3ncurses +ungetch.3x ungetch.3ncurses use_default_colors.3x use_default_colors.3ncurses use_env.3x use_env.3ncurses use_extended_names.3x use_extended_names.3ncurses @@ -266,6 +283,8 @@ use_tioctl.3x use_tioctl.3ncurses vidputs.3x vidputs.3ncurses wadd_wch.3x wadd_wch.3ncurses waddch.3x waddch.3ncurses +waddnstr.3x waddnstr.3ncurses +waddnwstr.3x waddnwstr.3ncurses waddstr.3x waddstr.3ncurses waddwstr.3x waddwstr.3ncurses wattr_set.3x wattr_set.3ncurses @@ -276,8 +295,10 @@ wdelch.3x wdelch.3ncurses wecho_wchar.3x wecho_wchar.3ncurses wechochar.3x wechochar.3ncurses wget_wch.3x wget_wch.3ncurses +wget_wstr.3x wget_wstr.3ncurses wgetch.3x wgetch.3ncurses wgetstr.3x wgetstr.3ncurses +win_wch.3x win_wch.3ncurses winch.3x winch.3ncurses wins_wch.3x wins_wch.3ncurses winsch.3x winsch.3ncurses @@ -286,6 +307,7 @@ wnoutrefresh.3x wnoutrefresh.3ncurses wrefresh.3x wrefresh.3ncurses wsetscrreg.3x wsetscrreg.3ncurses wtimeout.3x wtimeout.3ncurses +wunctrl.3x wunctrl.3ncurses # # Other: getty.8 getty.8 diff --git a/man/manhtml.aliases b/man/manhtml.aliases index 7599c74a8a27..31b1aee24ff8 100644 --- a/man/manhtml.aliases +++ b/man/manhtml.aliases @@ -1,6 +1,6 @@ -# $Id: manhtml.aliases,v 1.35 2024/04/14 00:36:21 tom Exp $ +# $Id: manhtml.aliases,v 1.50 2025/11/12 00:49:19 Branden.Robinson Exp $ #*************************************************************************** -# Copyright 2019-2023,2024 Thomas E. Dickey * +# Copyright 2019-2024,2025 Thomas E. Dickey * # Copyright 2013,2017 Free Software Foundation, Inc. * # * # Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,7 +27,7 @@ # sale, use or other dealings in this Software without prior written * # authorization. * #*************************************************************************** -# Items in this list will be linked to the corresponding manpages by man2html +# Items in this list will be linked to the corresponding man pages by man2html add_wch(3X) curs_add_wch(3X) addch(3X) curs_addch(3X) assume_default_colors(3X) default_colors(3X) @@ -35,11 +35,13 @@ attr_get(3X) curs_attr(3X) attr_on(3X) curs_attr(3X) attron(3X) curs_attr(3X) baudrate(3X) curs_termattrs(3X) +beep(3X) curs_beep(3X) bkgd(3X) curs_bkgd(3X) bkgrnd(3X) curs_bkgrnd(3X) cbreak(3X) curs_inopts(3X) clearok(3X) curs_outopts(3X) clrtoeol(3X) curs_clear(3X) +color_content(3X) curs_color(3X) curs_set(3X) curs_kernel(3X) curscr(3X) curs_variables(3X) curses_trace(3X) curs_trace(3X) @@ -51,13 +53,18 @@ delscreen(3X) curs_initscr(3X) doupdate(3X) curs_refresh(3X) echo(3X) curs_inopts(3X) endwin(3X) curs_initscr(3X) +erasechar(3X) curs_termattrs(3X) +erasewchar(3X) curs_termattrs(3X) extended_slk_color(3X) curs_slk(3X) filter(3X) curs_util(3X) flushinp(3X) curs_util(3X) get_wch(3X) curs_get_wch(3X) +get_wstr(3X) curs_get_wstr(3X) getcchar(3X) curs_getcchar(3X) getch(3X) curs_getch(3X) +getstr(3X) curs_getstr(3X) getwin(3X) curs_util(3X) +getyx(3X) curs_getyx(3X) halfdelay(3X) curs_inopts(3X) has_key(3X) curs_getch(3X) immedok(3X) curs_outopts(3X) @@ -65,12 +72,17 @@ in_wch(3X) curs_in_wch(3X) inch(3X) curs_inch(3X) infocmp(1) infocmp(1M) initscr(3X) curs_initscr(3X) +init_color(3X) curs_color(3X) +is_cbreak(3X) curs_inopts(3X) is_scrollok(3X) curs_opaque(3X) keyname(3X) curs_util(3X) keypad(3X) curs_inopts(3X) +killchar(3X) curs_termattrs(3X) +killwchar(3X) curs_termattrs(3X) longname(3X) curs_termattrs(3X) meta(3X) curs_inopts(3X) move(3X) curs_move(3X) +mousemask(3X) curs_mouse(3X) mvcur(3X) curs_terminfo(3X) mvwin(3X) curs_window(3X) newterm(3X) curs_initscr(3X) @@ -78,6 +90,7 @@ newwin(3X) curs_window(3X) nl(3X) curs_inopts(3X) nocbreak(3X) curs_inopts(3X) nonl(3X) curs_inopts(3X) +noraw(3X) curs_inopts(3X) pnoutrefresh(3X) curs_pad(3X) prefresh(3X) curs_pad(3X) printw(3X) curs_printw(3X) @@ -85,6 +98,7 @@ putp(3X) curs_terminfo(3X) putwin(3X) curs_util(3X) raw(3X) curs_inopts(3X) refresh(3X) curs_refresh(3X) +reset_prog_mode(3X) curs_kernel(3X) reset_shell_mode(3X) curs_kernel(3X) restartterm(3X) curs_terminfo(3X) ripoffline(3X) curs_kernel(3X) @@ -99,11 +113,15 @@ slk_touch(3X) curs_slk(3X) start_color(3X) curs_color(3X) terminfo(3X) curs_terminfo(3X) tic(1) tic(1M) +tigetflag(3X) curs_terminfo(3X) +tigetnum(3X) curs_terminfo(3X) tigetstr(3X) curs_terminfo(3X) touchline(3X) curs_touch(3X) touchwin(3X) curs_touch(3X) tparm(3X) curs_terminfo(3X) tputs(3X) curs_terminfo(3X) +trace(3X) curs_trace(3X) +ungetch(3X) curs_util(3X) use_default_colors(3X) default_colors(3X) use_env(3X) curs_util(3X) use_extended_names(3X) curs_extend(3X) @@ -112,6 +130,8 @@ use_tioctl(3X) curs_util(3X) vidputs(3X) curs_terminfo(3X) wadd_wch(3X) curs_add_wch(3X) waddch(3X) curs_addch(3X) +waddnstr(3X) curs_addstr(3X) +waddnwstr(3X) curs_addwstr(3X) waddstr(3X) curs_addstr(3X) waddwstr(3X) curs_addwstr(3X) wattr_set(3X) curs_attr(3X) @@ -122,8 +142,10 @@ wdelch(3X) curs_delch(3X) wecho_wchar(3X) curs_add_wch(3X) wechochar(3X) curs_addch(3X) wget_wch(3X) curs_get_wch(3X) +wget_wstr(3X) curs_get_wstr(3X) wgetch(3X) curs_getch(3X) wgetstr(3X) curs_getstr(3X) +win_wch(3X) curs_in_wch(3X) winch(3X) curs_inch(3X) wins_wch(3X) curs_ins_wch(3X) winsch(3X) curs_insch(3X) @@ -131,3 +153,4 @@ wmove(3X) curs_move(3X) wnoutrefresh(3X) curs_refresh(3X) wrefresh(3X) curs_refresh(3X) wsetscrreg(3X) curs_outopts(3X) +wunctrl(3X) curs_util(3X) diff --git a/man/manhtml.externs b/man/manhtml.externs index 41aa6359df10..7090ef011494 100644 --- a/man/manhtml.externs +++ b/man/manhtml.externs @@ -1,7 +1,7 @@ -# $Id: manhtml.externs,v 1.25 2024/04/20 19:26:05 tom Exp $ +# $Id: manhtml.externs,v 1.30 2025/03/01 22:00:03 tom Exp $ # Items in this list will not be linked by man2html #*************************************************************************** -# Copyright 2019-2023,2024 Thomas E. Dickey * +# Copyright 2019-2024,2025 Thomas E. Dickey * # Copyright 2013,2017 Free Software Foundation, Inc. * # * # Permission is hereby granted, free of charge, to any person obtaining a * @@ -41,25 +41,31 @@ emacs(1) environ(7) errno(3) file(1) +fread(3) +free(3) +fwrite(3) getty(8) +ioctl(2) +isprint(3) jove(1) lynx(1) mutt(1) nvi(1) od(1) -ioctl(2) -isprint(3) +poll(2) printf(3) profile(5) putc(3) putchar(3) putwc(3) +putwchar(3) read(2) readline(3) resize(1) scanf(3) scanf(3S) screen(1) +select(2) setbuf(3) setgid(2) setlocale(3) @@ -69,6 +75,7 @@ sscanf(3) stdio(3) stty(1) swprintf(3) +sysconf(3) system(3) termios(3) tmux(1) diff --git a/man/manlinks.sed b/man/manlinks.sed index 6e2d2b869970..d1eba54438ca 100644 --- a/man/manlinks.sed +++ b/man/manlinks.sed @@ -1,6 +1,6 @@ -# $Id: manlinks.sed,v 1.21 2024/04/20 22:25:36 tom Exp $ +# $Id: manlinks.sed,v 1.27 2025/11/12 00:49:19 Branden.Robinson Exp $ ############################################################################## -# Copyright 2020-2023,2024 Thomas E. Dickey # +# Copyright 2020-2024,2025 Thomas E. Dickey # # Copyright 2000-2003,2008 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -27,11 +27,11 @@ # use or other dealings in this Software without prior written # # authorization. # ############################################################################## -# Given a manpage (nroff) as input, writes a list of the names that are +# Given a man page (nroff) as input, writes a list of the names that are # listed in the "NAME" section, i.e., the names that we would like to use -# as aliases for the manpage -T.Dickey +# as aliases for the man page. -T.Dickey # -# workaround for manpages without a SYNOPSIS +# workaround for man pages without a SYNOPSIS s/^\.\\"SH/.SH/ # # eliminate formatting controls that get in the way @@ -53,6 +53,7 @@ s/^[ ][ ]*// s/[ ][ ]*$// s/[ ][ ]*/ /g /^$/d +/^[<>]/d # # convert ".SH" into a more manageable form s/\.SH[ ][ ]*/.SH_(/ @@ -79,7 +80,7 @@ s/ /\ # still want to make aliases for those. Do this by extracting names from the # list of function prototypes in the synopsis. # -# Remove any line that does not contain a '(', since we only want functions. +# Remove any line that does not contain a '(', since we only want functions. # then strip off return-type of each function. # # Finally, remove the parameter list, which begins with a '('. diff --git a/man/menu.3x b/man/menu.3x index a833c3b55123..f86f3b5e606a 100644 --- a/man/menu.3x +++ b/man/menu.3x @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2014,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -28,8 +28,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: menu.3x,v 1.45 2024/03/16 15:35:01 tom Exp $ -.TH menu 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: menu.3x,v 1.54 2025/11/12 01:27:41 tom Exp $ +.TH menu 3X 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -47,7 +47,7 @@ .. .SH NAME \fBmenu\fP \- -curses extension for programming menus +present menus in \fIcurses\fP windows .SH SYNOPSIS .nf \fB#include <menu.h> @@ -70,7 +70,9 @@ To use the \fBmenu\fP library, link with the options The \fBmenu\fP library maintains a default value for item attributes. You can get or set this default by calling the appropriate \fBget_\fP or \fBset_\fP -routine with a \fBNULL\fP item pointer. +routine with a +.I NULL +item pointer. Changing this default with a \fBset_\fP function affects future item creations, but does not change the rendering of items already created. @@ -81,48 +83,48 @@ The following table lists each \fBmenu\fP routine and the name of the manual page on which it is described. .PP .TS -l l . +L L. \fBcurses\fP Routine Name Manual Page Name -= +_ current_item \fBmitem_current\fP(3X) -free_item \fBmitem_new\fP(3X) -free_menu \fBmenu_new\fP(3X) +free_item \fBmitem_new\fP(3X) +free_menu \fBmenu_new\fP(3X) item_count \fBmenu_items\fP(3X) item_description \fBmitem_name\fP(3X) item_index \fBmitem_current\fP(3X) -item_init \fBmenu_hook\fP(3X) -item_name \fBmitem_name\fP(3X) -item_opts \fBmitem_opts\fP(3X) +item_init \fBmenu_hook\fP(3X) +item_name \fBmitem_name\fP(3X) +item_opts \fBmitem_opts\fP(3X) item_opts_off \fBmitem_opts\fP(3X) item_opts_on \fBmitem_opts\fP(3X) -item_term \fBmenu_hook\fP(3X) +item_term \fBmenu_hook\fP(3X) item_userptr \fBmitem_userptr\fP(3X) item_value \fBmitem_value\fP(3X) item_visible \fBmitem_visible\fP(3X) -menu_back \fBmenu_attributes\fP(3X) +menu_back \fBmenu_attributes\fP(3X) menu_driver \fBmenu_driver\fP(3X) -menu_fore \fBmenu_attributes\fP(3X) +menu_fore \fBmenu_attributes\fP(3X) menu_format \fBmenu_format\fP(3X) -menu_grey \fBmenu_attributes\fP(3X) -menu_init \fBmenu_hook\fP(3X) +menu_grey \fBmenu_attributes\fP(3X) +menu_init \fBmenu_hook\fP(3X) menu_items \fBmenu_items\fP(3X) -menu_mark \fBmenu_mark\fP(3X) -menu_opts \fBmenu_opts\fP(3X) +menu_mark \fBmenu_mark\fP(3X) +menu_opts \fBmenu_opts\fP(3X) menu_opts_off \fBmenu_opts\fP(3X) menu_opts_on \fBmenu_opts\fP(3X) -menu_pad \fBmenu_attributes\fP(3X) +menu_pad \fBmenu_attributes\fP(3X) menu_pattern \fBmenu_pattern\fP(3X) menu_request_by_name \fBmenu_requestname\fP(3X) menu_request_name \fBmenu_requestname\fP(3X) menu_spacing \fBmenu_spacing\fP(3X) -menu_sub \fBmenu_win\fP(3X) -menu_term \fBmenu_hook\fP(3X) +menu_sub \fBmenu_win\fP(3X) +menu_term \fBmenu_hook\fP(3X) menu_userptr \fBmenu_userptr\fP(3X) -menu_win \fBmenu_win\fP(3X) -new_item \fBmitem_new\fP(3X) -new_menu \fBmenu_new\fP(3X) +menu_win \fBmenu_win\fP(3X) +new_item \fBmitem_new\fP(3X) +new_menu \fBmenu_new\fP(3X) pos_menu_cursor \fBmenu_cursor\fP(3X) -post_menu \fBmenu_post\fP(3X) +post_menu \fBmenu_post\fP(3X) scale_menu \fBmenu_win\fP(3X) set_current_item \fBmitem_current\fP(3X) set_item_init \fBmenu_hook\fP(3X) @@ -146,11 +148,13 @@ set_menu_term \fBmenu_hook\fP(3X) set_menu_userptr \fBmenu_userptr\fP(3X) set_menu_win \fBmenu_win\fP(3X) set_top_row \fBmitem_current\fP(3X) -top_row \fBmitem_current\fP(3X) +top_row \fBmitem_current\fP(3X) unpost_menu \fBmenu_post\fP(3X) .TE .SH RETURN VALUE -Routines that return pointers return \fBNULL\fP on error. +Routines that return pointers return +.I NULL +on error. Routines that return an integer return one of the following error codes: .TP 5 diff --git a/man/menu_driver.3x b/man/menu_driver.3x index 6a117283705f..e3baee4bb932 100644 --- a/man/menu_driver.3x +++ b/man/menu_driver.3x @@ -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: menu_driver.3x,v 1.47 2024/03/16 15:35:01 tom Exp $ -.TH menu_driver 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: menu_driver.3x,v 1.51 2025/10/04 20:59:08 tom Exp $ +.TH menu_driver 3X 2025-10-04 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .de bP .ie n .IP \(bu 4 .el .IP \(bu 2 @@ -46,8 +46,9 @@ command-processing loop of the menu system Once a menu has been posted (displayed), you should funnel input events to it through \fBmenu_driver\fP. This routine has three major input cases: .bP -The input is a form navigation request. -Navigation request codes are constants defined in \fB<form.h>\fP, +The input is a menu navigation request. +Navigation request codes are constants defined in +.IR menu.h "," which are distinct from the key- and character codes returned by \fBwgetch\fP(3X). .bP diff --git a/man/menu_hook.3x b/man/menu_hook.3x index 839e199b8c4f..66bc383c8ce9 100644 --- a/man/menu_hook.3x +++ b/man/menu_hook.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: menu_hook.3x,v 1.32 2024/03/16 15:35:01 tom Exp $ -.TH menu_hook 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: menu_hook.3x,v 1.34 2024/12/28 21:26:21 tom Exp $ +.TH menu_hook 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBmenu_hook\fP \- set hooks for automatic invocation by applications @@ -55,27 +55,33 @@ points in the automatic processing of input event codes by \fBmenu_driver\fP. The function \fBset_item_init\fP sets a hook to be called at menu-post time and each time the selected item changes (after the change). \fBitem_init\fP -returns the current item init hook, if any (\fBNULL\fP if there is no such -hook). +returns the current item init hook, if any +.RI ( NULL +if there is no such hook). .PP The function \fBset_item_term\fP sets a hook to be called at menu-unpost time and each time the selected item changes (before the change). \fBitem_term\fP -returns the current item term hook, if any (\fBNULL\fP if there is no such -hook). +returns the current item term hook, if any +.RI ( NULL +if there is no such hook). .PP The function \fBset_menu_init\fP sets a hook to be called at menu-post time and just after the top row on the menu changes once it is posted. \fBmenu_init\fP -returns the current menu init hook, if any (\fBNULL\fP if there is no such -hook). +returns the current menu init hook, if any +.RI ( NULL +if there is no such hook). .PP The function \fBset_menu_term\fP sets a hook to be called at menu-unpost time and just before the top row on the menu changes once it is posted. -\fBmenu_term\fP returns the current menu term hook, if any (\fBNULL\fP if there -is no such hook). +\fBmenu_term\fP returns the current menu term hook, if any +.RI ( NULL +if there is no such hook). .SH RETURN VALUE -Routines that return pointers return \fBNULL\fP on error. +Routines that return pointers return +.I NULL +on error. Other routines return one of the following: .TP 5 diff --git a/man/menu_items.3x b/man/menu_items.3x index 43409fef812b..8def448ea12f 100644 --- a/man/menu_items.3x +++ b/man/menu_items.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: menu_items.3x,v 1.34 2024/03/16 15:35:01 tom Exp $ -.TH menu_items 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: menu_items.3x,v 1.36 2024/12/28 21:26:21 tom Exp $ +.TH menu_items 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBset_menu_items\fP, \fBmenu_items\fP, @@ -44,17 +44,20 @@ make and break connections between items and menus .fi .SH DESCRIPTION The function \fBset_menu_items\fP changes the item pointer array of the given -\fImenu\fP. The array must be terminated by a \fBNULL\fP. +\fImenu\fP. The array must be terminated by a +.IR NULL "." .PP The function \fBmenu_items\fP returns the item array of the given menu. .PP The function \fBitem_count\fP returns the count of items in \fImenu\fP. .SH RETURN VALUE -The function \fBmenu_items\fP returns a pointer (which may be \fBNULL\fP). +The function \fBmenu_items\fP returns a pointer (which may be +.IR NULL ")." It does not set \fBerrno\fP. .PP The function \fBitem_count\fP returns \fBERR\fP (the general \fBcurses\fP error -return value) if its \fImenu\fP parameter is \fBNULL\fP. +return value) if its \fImenu\fP parameter is +.I NULL "." .PP The function \fBset_menu_items\fP returns one of the following codes on error: .TP 5 diff --git a/man/menu_mark.3x b/man/menu_mark.3x index e3f3a92869d3..7630e2e532f3 100644 --- a/man/menu_mark.3x +++ b/man/menu_mark.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: menu_mark.3x,v 1.35 2024/03/16 15:35:01 tom Exp $ -.TH menu_mark 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: menu_mark.3x,v 1.37 2024/12/28 21:26:21 tom Exp $ +.TH menu_mark 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBset_menu_mark\fP, \fBmenu_mark\fP \- @@ -51,13 +51,16 @@ Note that changing the length of the mark string for a menu while the menu is posted is likely to produce unhelpful behavior. .PP The default string is "\-" (a dash). -Calling \fBset_menu_mark\fP with -a non-\fBNULL\fP menu argument will change this default. +Calling \fBset_menu_mark\fP with a +.IR non- NULL +menu argument will change this default. .PP -The function \fBmenu_mark\fP returns the menu's mark string (or \fBNULL\fP if -there is none). +The function \fBmenu_mark\fP returns the menu's mark string (or +.I NULL +if there is none). .SH RETURN VALUE -The function \fBmenu_mark\fP returns a pointer (which may be \fBNULL\fP). +The function \fBmenu_mark\fP returns a pointer (which may be +.IR NULL ")." It does not set \fBerrno\fP. .PP The function \fBset_menu_mark\fP may return the following error codes: diff --git a/man/menu_new.3x b/man/menu_new.3x index 1a133745a9b7..af781e3d4722 100644 --- a/man/menu_new.3x +++ b/man/menu_new.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: menu_new.3x,v 1.35 2024/03/16 15:35:01 tom Exp $ -.TH menu_new 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: menu_new.3x,v 1.37 2024/12/28 21:26:21 tom Exp $ +.TH menu_new 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBnew_menu\fP, \fBfree_menu\fP \- @@ -42,12 +42,15 @@ create and destroy menus .fi .SH DESCRIPTION The function \fBnew_menu\fP creates a new menu connected to a specified item -pointer array (which must be \fBNULL\fP-terminated). +pointer array (which must be +.IR NULL -terminated). .PP The function \fBfree_menu\fP disconnects \fImenu\fP from its item array and frees the storage allocated for the menu. .SH RETURN VALUE -The function \fBnew_menu\fP returns \fBNULL\fP on error. +The function \fBnew_menu\fP returns +.I NULL +on error. It sets \fBerrno\fP according to the function's failure: .TP 5 .B E_NOT_CONNECTED diff --git a/man/menu_opts.3x b/man/menu_opts.3x index ad7fe97f348f..fcb9df410d45 100644 --- a/man/menu_opts.3x +++ b/man/menu_opts.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-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 * @@ -27,8 +27,18 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: menu_opts.3x,v 1.35 2024/03/16 15:35:01 tom Exp $ -.TH menu_opts 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: menu_opts.3x,v 1.38 2025/01/19 00:51:10 tom Exp $ +.TH menu_opts 3X 2025-01-18 "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 '' "" +.\} .SH NAME \fBset_menu_opts\fP, \fBmenu_opts_on\fP, @@ -46,8 +56,8 @@ set and get menu options \fBint menu_opts_off(MENU *\fImenu\fP, Menu_Options \fIopts\fP); .fi .SH DESCRIPTION -The function \fBset_menu_opts\fP sets all the given menu's option bits (menu -option bits may be logically-OR'ed together). +The function \fBset_menu_opts\fP sets all the given menu's option bits +(menu option bits may be logically \*(``or\*(''-ed together). .PP The function \fBmenu_opts_on\fP turns on the given option bits, and leaves others alone. diff --git a/man/menu_pattern.3x b/man/menu_pattern.3x index a66a368dd0c9..eae1001931a4 100644 --- a/man/menu_pattern.3x +++ b/man/menu_pattern.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: menu_pattern.3x,v 1.38 2024/03/16 15:35:01 tom Exp $ -.TH menu_pattern 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: menu_pattern.3x,v 1.40 2024/12/28 21:26:21 tom Exp $ +.TH menu_pattern 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBset_menu_pattern\fP, \fBmenu_pattern\fP \- @@ -55,7 +55,10 @@ The function \fBmenu_pattern\fP returns the pattern buffer of the given \fImenu\fP. .SH RETURN VALUE The function \fBmenu_pattern\fP returns a pointer, -which is \fBNULL\fP if the \fImenu\fP parameter is \fBNULL\fP. +which is +.I NULL +if the \fImenu\fP parameter is +.IR NULL "." Otherwise, it is a pointer to a string which is empty if no pattern has been set. It does not set \fBerrno\fP. diff --git a/man/menu_requestname.3x b/man/menu_requestname.3x index a0363fb28585..71e47fdba014 100644 --- a/man/menu_requestname.3x +++ b/man/menu_requestname.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: menu_requestname.3x,v 1.33 2024/03/16 15:35:01 tom Exp $ -.TH menu_requestname 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: menu_requestname.3x,v 1.35 2024/12/28 21:26:21 tom Exp $ +.TH menu_requestname 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBmenu_request_by_name\fP, \fBmenu_request_name\fP \- @@ -48,7 +48,9 @@ The function \fBmenu_request_by_name\fP searches in the name-table for a request with the given name and returns its request code. Otherwise E_NO_MATCH is returned. .SH RETURN VALUE -\fBmenu_request_name\fP returns \fBNULL\fP on error +\fBmenu_request_name\fP returns +.I NULL +on error and sets \fBerrno\fP to \fBE_BAD_ARGUMENT\fP. .br \fBmenu_request_by_name\fP returns \fBE_NO_MATCH\fP on error. diff --git a/man/menu_spacing.3x b/man/menu_spacing.3x index d15e77d542a5..abfe15a90080 100644 --- a/man/menu_spacing.3x +++ b/man/menu_spacing.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: menu_spacing.3x,v 1.37 2024/03/16 15:35:01 tom Exp $ -.TH menu_spacing 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: menu_spacing.3x,v 1.39 2024/12/28 21:26:21 tom Exp $ +.TH menu_spacing 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBset_menu_spacing\fP, \fBmenu_spacing\fP \- @@ -73,7 +73,9 @@ A value of 0 for all the spacing values resets them to the default, which is 1 for all of them. .PP The function \fBmenu_spacing\fP returns the spacing information for the menu. -If a pointer is NULL, the corresponding information is simply not returned. +If a pointer is +.IR NULL "," +the corresponding information is simply not returned. .SH RETURN VALUE Both routines return \fBE_OK\fP on success. \fBset_menu_spacing\fP may return diff --git a/man/menu_userptr.3x b/man/menu_userptr.3x index 292bbd6b85e8..4465bc791454 100644 --- a/man/menu_userptr.3x +++ b/man/menu_userptr.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: menu_userptr.3x,v 1.33 2024/03/16 15:35:01 tom Exp $ -.TH menu_userptr 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: menu_userptr.3x,v 1.35 2024/12/28 21:26:21 tom Exp $ +.TH menu_userptr 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBset_menu_userptr\fP, \fBmenu_userptr\fP \- @@ -45,7 +45,8 @@ Every menu and every menu item has a field that can be used to hold application-specific data (that is, the menu-driver code leaves it alone). These functions get and set the menu user pointer field. .SH RETURN VALUE -\fBmenu_userptr\fP returns a pointer (which may be \fBNULL\fP). +\fBmenu_userptr\fP returns a pointer (which may be +.IR NULL ")." It does not set \fBerrno\fP. .PP \fBset_menu_userptr\fP returns \fBE_OK\fP (success). diff --git a/man/menu_win.3x b/man/menu_win.3x index 36f6129dc2a8..b9d8b4974e7a 100644 --- a/man/menu_win.3x +++ b/man/menu_win.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: menu_win.3x,v 1.32 2024/03/16 15:35:01 tom Exp $ -.TH menu_win 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: menu_win.3x,v 1.34 2024/12/28 21:26:21 tom Exp $ +.TH menu_win 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBmenu_win\fP \- make and break menu window and subwindow associations @@ -54,14 +54,20 @@ The first four functions get and set those windows. It is not necessary to set either window; by default, the driver code uses \fBstdscr\fP for both. .PP -In the \fBset_\fP functions, window argument of \fBNULL\fP is treated as though -it were \fBstsdcr\fP. A menu argument of \fBNULL\fP is treated as a request +In the \fBset_\fP functions, window argument of +.I NULL +is treated as though +it were \fBstsdcr\fP. A menu argument of +.I NULL +is treated as a request to change the system default menu window or subwindow. .PP The function \fBscale_menu\fP returns the minimum size required for the subwindow of \fImenu\fP. .SH RETURN VALUE -Routines that return pointers return \fBNULL\fP on error. +Routines that return pointers return +.I NULL +on error. Routines that return an integer return one of the following error codes: .TP 5 diff --git a/man/mitem_current.3x b/man/mitem_current.3x index 42d36c39754b..39e8053834a9 100644 --- a/man/mitem_current.3x +++ b/man/mitem_current.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: mitem_current.3x,v 1.37 2024/03/16 15:35:01 tom Exp $ -.TH mitem_current 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: mitem_current.3x,v 1.39 2024/12/28 21:26:21 tom Exp $ +.TH mitem_current 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBmitem_current\fP \- set and get current_menu_item @@ -61,11 +61,13 @@ row being displayed. The function \fBitem_index\fP returns the (zero-origin) index of \fIitem\fP in the menu's item pointer list. .SH RETURN VALUE -\fBcurrent_item\fP returns a pointer (which may be \fBNULL\fP). +\fBcurrent_item\fP returns a pointer (which may be +.IR NULL ")." It does not set \fBerrno\fP. .PP \fBtop_row\fP and \fBitem_index\fP return \fBERR\fP (the general \fBcurses\fP -error value) if their \fImenu\fP parameter is \fBNULL\fP. +error value) if their \fImenu\fP parameter is +.IR NULL "." .PP \fBset_current_item\fP and \fBset_top_row\fP return one of the following: .TP 5 diff --git a/man/mitem_name.3x b/man/mitem_name.3x index 3606bb5d2455..d92477c8a9ad 100644 --- a/man/mitem_name.3x +++ b/man/mitem_name.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: mitem_name.3x,v 1.31 2024/03/16 15:35:01 tom Exp $ -.TH mitem_name 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: mitem_name.3x,v 1.33 2024/12/28 21:26:21 tom Exp $ +.TH mitem_name 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBitem_name\fP, \fBitem_description\fP \- @@ -46,7 +46,8 @@ The function \fBitem_name\fP returns the name part of the given item. The function \fBitem_description\fP returns the description part of the given item. .SH RETURN VALUE -These routines return a pointer (which may be \fBNULL\fP). +These routines return a pointer (which may be +.IR NULL ")." They do not set \fBerrno\fP. .SH PORTABILITY These routines emulate the System V menu library. diff --git a/man/mitem_new.3x b/man/mitem_new.3x index 66bd29bce3a8..1ca7edba0fcf 100644 --- a/man/mitem_new.3x +++ b/man/mitem_new.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: mitem_new.3x,v 1.36 2024/03/16 15:35:01 tom Exp $ -.TH mitem_new 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: mitem_new.3x,v 1.38 2024/12/28 21:26:21 tom Exp $ +.TH mitem_new 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBnew_item\fP, \fBfree_item\fP \- @@ -55,7 +55,9 @@ Please notice that it is the responsibility of the application to release the memory for the name or the description of the item. .SH RETURN VALUE -The function \fBnew_item\fP returns \fBNULL\fP on error. +The function \fBnew_item\fP returns +.I NULL +on error. It sets \fBerrno\fP according to the function's failure: .TP 5 .B E_BAD_ARGUMENT diff --git a/man/mitem_opts.3x b/man/mitem_opts.3x index 5a86516f5a24..430ab6bffec5 100644 --- a/man/mitem_opts.3x +++ b/man/mitem_opts.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2010,2015 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,18 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: mitem_opts.3x,v 1.33 2024/03/16 15:35:01 tom Exp $ -.TH mitem_opts 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: mitem_opts.3x,v 1.36 2025/01/19 00:51:10 tom Exp $ +.TH mitem_opts 3X 2025-01-18 "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 '' "" +.\} .SH NAME \fBset_item_opts\fP, \fBitem_opts_on\fP, @@ -46,8 +56,8 @@ set and get menu item options \fBint item_opts_off(ITEM *\fIitem\fP, Item_Options \fIopts\fP); .fi .SH DESCRIPTION -The function \fBset_item_opts\fP sets all the given item's option bits (menu -option bits may be logically-OR'ed together). +The function \fBset_item_opts\fP sets all the given item's option bits +(menu option bits may be logically \*(``or\*(''-ed together). .PP The function \fBitem_opts_on\fP turns on the given option bits, and leaves others alone. diff --git a/man/mitem_userptr.3x b/man/mitem_userptr.3x index f0eab8bd8058..219618dfb742 100644 --- a/man/mitem_userptr.3x +++ b/man/mitem_userptr.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: mitem_userptr.3x,v 1.34 2024/03/16 15:35:01 tom Exp $ -.TH mitem_userptr 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: mitem_userptr.3x,v 1.36 2024/12/28 21:26:21 tom Exp $ +.TH mitem_userptr 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fBset_item_userptr\fP, \fBitem_userptr\fP \- @@ -46,7 +46,8 @@ Every menu item has a field that can be used to hold application-specific data These functions get and set that field. .SH RETURN VALUE -The function \fBitem_userptr\fP returns a pointer (possibly \fBNULL\fP). +The function \fBitem_userptr\fP returns a pointer (possibly +.IR NULL ")." It does not set \fBerrno\fP. .PP The \fBset_item_userptr\fP always returns \fBE_OK\fP (success). diff --git a/man/ncurses.3x b/man/ncurses.3x index 9aaa7adf54bf..21799fdd2296 100644 --- a/man/ncurses.3x +++ b/man/ncurses.3x @@ -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: ncurses.3x,v 1.214 2024/04/27 17:55:43 tom Exp $ -.TH ncurses 3X 2024-04-27 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: ncurses.3x,v 1.289 2025/11/12 01:01:34 tom Exp $ +.TH ncurses 3X 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -54,7 +54,6 @@ . TP .. . -.ds d @TERMINFO@ .SH NAME \fB\%ncurses\fP \- character-cell terminal interface with optimized output @@ -65,7 +64,7 @@ character-cell terminal interface with optimized output .SH DESCRIPTION The \*(``new curses\*('' library offers the programmer a terminal-independent means of reading keyboard and mouse input and -updating character-cell terminals with output optimized to minimize +writing to character-cell displays with output optimized to minimize screen updates. .I \%ncurses replaces the @@ -86,15 +85,15 @@ abstraction and subdivision thereof with .I windows and .IR pads ; -the reading of terminal input; -control of terminal input and output options; -environment query routines; -color manipulation; +acquisition of keyboard and mouse events; +selection of color and rendering attributes +(such as bold or underline); the definition and use of .I "soft label" keys; +access to the .I \%term\%info -capability access; +terminal capability database; a .I termcap compatibility interface; @@ -102,8 +101,7 @@ and an abstraction of the system's API for manipulating the terminal (such as \fI\%termios\fP(3)). .PP .I \%ncurses -implements the standard interface described by -X/Open Curses Issue\ 7. +implements the interface described by X/Open Curses Issue\ 7. In many behavioral details not standardized by X/Open, .I \%ncurses emulates the @@ -122,8 +120,8 @@ API should be aware, such as limitations on the size of an underlying integral type or the availability of a preprocessor macro exclusive of a function definition (which prevents its address from being taken). -This section also describes implementation details that will be -significant to the programmer but which are not standardized. +This section also describes implementation details +of significance to the programmer but which are not standardized. .bP \*(``EXTENSIONS\*('' presents .I \%ncurses @@ -162,22 +160,21 @@ option to your compiler or linker. A debugging version of the library may be available; if so, link with it using -.BR \-lncurses_g . +.BR \-lncurses_g "." (Your system integrator may have installed these libraries such that you can use the options .B \-lcurses and -.BR \-lcurses_g , +.BR \-lcurses_g "," respectively.) The .I \%ncurses_g -library generates trace logs -(in a file called -.I \%trace -in the current directory) -that describe +library logs events describing .I \%ncurses -actions. +actions +to a file called +.I \%trace +in the application's working directory at startup. See section \*(``ALTERNATE CONFIGURATIONS\*('' below. .SS "Application Structure" A @@ -203,10 +200,13 @@ not been set up. \fB\%initscr\fP(3X) or \fB\%newterm\fP(3X) must be called to initialize .I curses -before use of any functions that deal with windows and screens. +before use of any functions +that access or manipulate windows or screens. .PP -To get character-at-a-time input without echoing\(emmost interactive, -screen-oriented programs want this\(emuse the following sequence. +To get character-at-a-time input without echoing \(em +most interactive, +screen-oriented programs want this \(em +use the following sequence. .PP .RS 4 .EX @@ -214,36 +214,55 @@ initscr(); cbreak(); noecho(); .EE .RE .PP -Most applications perform further setup as follows. +Most applications would perform further setup as follows. .PP .RS 4 .EX -intrflush(stdscr, FALSE); +.nf +noqiflush(); keypad(stdscr, TRUE); +.fi .EE .RE .PP A .I curses -program then often enters an event loop of some sort. +program then often enters an event-handling loop. Call \fB\%endwin\fP(3X) before exiting. .SS Overview A .I curses -library abstracts the terminal screen by representing all or part of it -as a +library abstracts the terminal with a +.I \%SCREEN +data structure, +and represents all or part of its display +with .I \%WINDOW -data structure. +structures. +Distinct properties apply to each; +for example, +the +.I "line discipline" +of a typical Unix terminal driver +is in one of three modes: +raw, +\%cbreak, +or canonical (\*(``cooked\*(''). +In +.IR curses "," +the line discipline is a property of the screen, +applying identically to all windows associated with it. +.PP A .I window is a rectangular grid of character cells, -addressed by row and column coordinates -.RI ( y , +addressed by line and column coordinates +.RI ( y "," .IR x ), with the upper left corner as (0, 0). A window called -.BR \%stdscr , -the same size as the terminal screen, +.BR \%stdscr "," +by default the same size as the terminal screen, is always available. Create others with \fB\%newwin\fP(3X). .PP @@ -262,17 +281,16 @@ effects. .PP Functions permit manipulation of a window and the .I cursor -identifying the cell within it at which the next output operation will -occur. +identifying the cell within it at which the next operation will occur. Among those, the most basic are \fB\%move\fP(3X) and \fB\%addch\fP(3X): -these place the cursor and write a character to -.BR \%stdscr , +these place the cursor within and write a character to +.BR \%stdscr "," respectively. .PP Frequent changes to the terminal screen can cause unpleasant flicker or inefficient use of the communication channel to the device, -so the library does not generally update it automatically. +so as a rule the library does not update it automatically. Therefore, after using .I curses @@ -284,7 +302,7 @@ The library .\" X/Open Curses Issue 7 assumes some optimization will be done, but .\" does not mandate it in any way. .I optimizes -its output by computing a minimal number of operations to mutate the +its output by computing a minimal volume of operations to mutate the screen from its state at the previous refresh to the new one. Effective optimization demands accurate information about the terminal device: @@ -297,48 +315,54 @@ implementation. Special windows called .I pads may also be manipulated. -These are windows that are not constrained to the size of the terminal -screen and whose contents need not be completely displayed. +These are not constrained to the size of the terminal screen and their +contents need not be completely displayed. See \fB\%curs_pad\fP(3X). .PP -In addition to drawing characters on the screen, -rendering attributes and colors may be supported, -causing the characters to show up in such modes as underlined, -in reverse video, -or in color on terminals that support such display enhancements. -See \fB\%curs_attr\fP(3X). +Many terminals support configuration of character cell foreground and +background colors as well as +.IR attributes "," +which cause characters to render in such modes as +boldfaced, +underlined, +or in reverse video. +See \fB\%curs_color\fP(3X) and \fB\%curs_attr\fP(3X). .PP .I curses -predefines constants for a small set of forms-drawing graphics +defines constants to simplify access +to a small set of forms-drawing graphics corresponding to the DEC Alternate Character Set (ACS), a feature of VT100 and other terminals. -See \fB\%waddch\fP(3X). +See \fB\%addch\fP(3X). .PP .I curses is implemented using the operating system's terminal driver; -keystroke events are received not as scan codes but as byte sequences. -Graphical keycaps +key events are received not as scan codes but as byte sequences. +The driver reports graphical keycaps (alphanumeric and punctuation keys, and the space) -appear as-is. +as-is. Everything else, including the tab, enter/return, keypad, arrow, and function keys, -appears as a control character or a multibyte +appears to +.I curses +as a control character or a multibyte .I "escape sequence." .I curses -translates these into unique +can translate the latter into unique .I "key codes." -See \fB\%getch\fP(3X). +See \fB\%keypad\fP(3X) and \fB\%getch\fP(3X). .PP .I \%ncurses provides reimplementations of the SVr4 \fBpanel\fP(3X), \fBform\fP(3X), -and \fBmenu\fP(3X) libraries to ease construction of user interfaces +and \fBmenu\fP(3X) libraries; +they permit overlapping windows and ease construction of user interfaces with -.IR curses . +.IR curses "." .SS "Initialization" The selection of an appropriate value of .I TERM @@ -352,10 +376,9 @@ A well-configured system selects a correct value automatically; \fB\%tset\fP(1) may assist with troubleshooting exotic situations. .PP -If you change the terminal type, -export the -.I TERM -environment variable in the shell, +If you change the terminal type from a shell, +export +.IR TERM "," then run \fB\%tset\fP(1) or the .RB \*(`` "@TPUT@ init" \*('' command. @@ -370,10 +393,10 @@ or if the .I curses program is executing in a graphical windowing environment, the information obtained thence overrides that obtained by -.IR \%term\%info . +.IR \%term\%info "." An .I \%ncurses -extension supports resizable terminals; +extension supports resizable terminal displays; see \fB\%wresize\fP(3X). .PP If the environment variable @@ -384,9 +407,8 @@ a program checks first for a terminal type description in the location it identifies. .I \%TERMINFO -is useful for developing experimental type descriptions or when write -permission to -.I \%\*d +is useful for developing type descriptions or when write permission to +.I \%@TERMINFO@ is not available. .PP See section \*(``ENVIRONMENT\*('' below. @@ -402,41 +424,61 @@ those with a \*(``mv\*('' prefix first perform cursor movement using a \*(``mvw\*('' prefix indicates both. The \*(``w\*('' function is typically the elemental one; the removal of this prefix usually indicates operation on -.BR \%stdscr . +.BR \%stdscr "." .PP -Four functions prefixed with \*(``p\*('' require a pad argument. +Four functions prefixed with \*(``p\*('' require a +.I pad +argument; +see below. .PP In function synopses, .I \%ncurses man pages apply the following names to parameters. +We introduce the character types in the next subsection. .PP .TS center; Li L. -bf \fIbool\fP (\fBTRUE\fP or \fBFALSE\fP) +bf a \fIbool\fP (\fBTRUE\fP or \fBFALSE\fP) c a \fIchar\fP or \fIint\fP ch a \fIchtype\fP wc a \fIwchar_t\fP or \fIwint_t\fP wch a \fIcchar_t\fP win pointer to a \fIWINDOW\fP pad pointer to a \fIWINDOW\fP that is a pad +pair a foreground/background color pair identifier .TE .SS "Wide and Non-wide Character Configurations" -This manual page describes functions that appear in any configuration -of the library. +This man page primarily surveys functions that appear in any +configuration of the library. There are two common configurations; +for others, see section \*(``ALTERNATE CONFIGURATIONS\*('' below. .TP 10 \" "ncursesw" + 2n .I \%ncurses is the library in its \*(``non-wide\*('' configuration, handling only eight-bit characters. -It stores a character combined with attributes in a +It stores a character combined with attributes +and a color pair identifier +in a .I \%chtype datum, which is often an alias of -.IR int . +.IR int "." +A string of +.I curses +characters is similar to a C +.I char +string; +a +.I chtype +string ends with an integral +.BR 0 "," +the null +.I curses +character. .IP -Attributes alone +Attributes and a color pair identifier (with no corresponding character) can be stored in variables of .I \%chtype @@ -444,12 +486,24 @@ or .I \%attr_t type. In either case, -they are represented as an integral bit mask. +they are accessed via an integral bit mask. .IP -Each cell of a +.I \%ncurses +stores each cell of a .I \%WINDOW -is stored as a -.IR \%chtype . +as a +.IR \%chtype "." +X/Open Curses does not specify the sizes of the character code or +color pair identifier, +nor the quantity of attribute bits, +in +.IR chtype ";" +these are implementation-dependent. +.I \%ncurses +uses eight bits for the character code. +An application requiring a wider character type, +for instance to represent Unicode, +should use the wide-character API. .TP 10 .I \%ncursesw is the library in its \*(``wide\*('' configuration, @@ -457,19 +511,49 @@ which handles character encodings requiring a larger data type than .I \%char (a byte-sized type) can represent. -It adds about one third more calls using additional data types that -can store such -.I multibyte -characters. +It provides additional functions that complement those in +the non-wide library where the size of the underlying character type is +significant. +A somewhat regular naming convention relates many of the wide variants +to their non-wide counterparts; +where a non-wide function name contains \*(``ch\*('' or \*(``str\*('', +prefix it with \*(``_w\*('' to obtain the wide counterpart. +For example, +\fB\%waddch\fP becomes \fB\%wadd_wch\fP. +An exception is +.B \%ins_nwstr +(and its variants), +spelled thus instead of \*(``insn_wstr\*(''. +(Exceptions that add only \*(``w\*('' comprise +.BR \%addwstr "," +.BR \%inwstr "," +and their variants.) +.\" This is because they operate on "plain" wide-character strings +.\" (`wchar_t*`) and not curses complex character strings (`cchar_t*`). +.\" SVID 4 did specify functions like `addwch()` and `inswch()` that +.\" operated on `chtype`s assuming that they were wide enough for a +.\" `wchar_t` plus attribute and color pair bits; X/Open Curses did not +.\" standardize these. +.IP +This convention is inapplicable to some non-wide function names, +so other transformations are used for the wide configuration: +the window background management function \*(``bkgd\*('' becomes +\*(``bkgrnd\*(''; +the window border-drawing and -clearing functions are suffixed with +\*(``_set\*(''; +and character attribute manipulation functions like +\*(``attron\*('' become \*(``attr_on\*(''. .RS 10 \" same as foregoing tag width .TP 9 \" "cchar_t" + 2n .I \%cchar_t -corresponds to the non-wide configuration's -.IR \%chtype . -It always a structure type, -because it stores more data than fit into a standard scalar type. +is a +.I "curses complex character" +and corresponds to the non-wide-character configuration's +.IR \%chtype "." +It is a structure type +because it requires more storage than a standard scalar type offers. A character code may not be representable as a -.IR \%char , +.IR \%char "," and moreover more than one character may occupy a cell (as with accent marks and other diacritics). Each character is of type @@ -477,20 +561,26 @@ Each character is of type a complex character contains one spacing character and zero or more non-spacing characters (see below). -Attributes and color data are stored in separate fields of the -structure, -not combined as in -.IR \%chtype . +A string of complex characters ends with a +.I \%cchar_t +whose +.I \%wchar_t +member is the null wide character. +Attributes and a color pair identifier are stored in separate fields of +the structure, +not combined into an integer as in +.IR \%chtype "." .PP -Each cell of a +.I \%ncurses +stores each cell of a .I \%WINDOW -is stored as a -.IR \%cchar_t . -.PP +as a +.IR \%cchar_t "." \fB\%setcchar\fP(3X) and \fB\%getcchar\fP(3X) store and retrieve .I \%cchar_t data. +.PP The wide library API of .I \%ncurses depends on two data types standardized by ISO C95. @@ -498,16 +588,16 @@ depends on two data types standardized by ISO C95. .I \%wchar_t stores a wide character. Like -.IR \%chtype , +.IR \%chtype "," it may be an alias of -.IR int . +.IR int "." Depending on the character encoding, a wide character may be -.IR spacing , +.IR spacing "," meaning that it occupies a character cell by itself and typically accompanies cursor advancement, or -.IR non-spacing , +.IR non-spacing "," meaning that it occupies the same cell as a spacing character, is often regarded as a \*(``modifier\*('' of the base glyph with which it combines, @@ -517,35 +607,12 @@ and typically does not advance the cursor. can store a .I \%wchar_t or the constant -.BR \%WEOF , +.IR \%WEOF "," analogously to the .IR int -sized character manipulation functions of ISO C and its constant -.BR \%EOF . +.IR \%EOF "." .RE -.IP -The wide library provides additional functions that complement those in -the non-wide library where the size of the underlying character type is -significant. -A somewhat regular naming convention relates many of the wide variants -to their non-wide counterparts; -where a non-wide function name contains \*(``ch\*('' or \*(``str\*('', -prefix it with \*(``_w\*('' to obtain the wide counterpart. -For example, -\fB\%waddch\fP becomes \fB\%wadd_wch\fP. -(Exceptions that add only \*(``w\*('' comprise -.BR \%addwstr , -.BR \%inwstr , -and their variants.) -.IP -This convention is inapplicable to some non-wide function names, -so other transformations are used for the wide configuration: -the window background management function \*(``bkgd\*('' becomes -\*(``bkgrnd\*(''; -the window border-drawing and -clearing functions are suffixed with -\*(``_set\*(''; -and character attribute manipulation functions like -\*(``attron\*('' become \*(``attr_on\*(''. .\" .SS "Function Name Index" The following table lists the @@ -559,8 +626,8 @@ neither described by X/Open Curses nor present in SVr4. .PP .TS center tab(/); -l l . -\f(BIcurses\fP Function Name/Man Page +L L. +\fIcurses\fP Function Name/Man Page _ COLOR_PAIR/\fBcurs_color\fP(3X) PAIR_NUMBER/\fBcurs_color\fP(3X) @@ -743,7 +810,7 @@ mvaddnwstr/\fBcurs_addwstr\fP(3X) mvaddstr/\fBcurs_addstr\fP(3X) mvaddwstr/\fBcurs_addwstr\fP(3X) mvchgat/\fBcurs_attr\fP(3X) -mvcur/\fBcurs_terminfo\fP(3X) +mvcur/\fBcurs_kernel\fP(3X) mvdelch/\fBcurs_delch\fP(3X) mvderwin/\fBcurs_window\fP(3X) mvget_wch/\fBcurs_get_wch\fP(3X) @@ -1033,20 +1100,19 @@ see sections \*(``ALTERNATE CONFIGURATIONS\*('' and \*(``EXTENSIONS\*('' below. .SH RETURN VALUE Unless otherwise noted, -functions that return an integer return +functions that return integers return the constants .B OK on success and .B ERR -on failure. -Functions that return pointers return -.B NULL -on failure. +on failure; +see \fB\%curs_variables\fP(3X). +Functions that return pointers return a null pointer on failure. Typically, .I \%ncurses treats a null pointer passed as a function parameter as a failure. Functions prefixed with \*(``mv\*('' first perform cursor movement and fail if the position -.RI ( y , +.RI ( y "," .IR x ) is outside the window boundaries. .SH ENVIRONMENT @@ -1055,27 +1121,30 @@ runtime behavior of .I \%ncurses applications. The library may be configured to disregard the variables -.IR \%TERMINFO , -.IR \%TERMINFO_DIRS , -.IR \%TERMPATH , +.IR \%TERMINFO "," +.IR \%TERMINFO_DIRS "," +.IR \%TERMPATH "," and -.IR HOME , +.IR HOME "," if the user is the superuser (root), or the application uses \fI\%setuid\fP(2) or \fI\%setgid\fP(2). .SS "\fIBAUDRATE\fP" The debugging library checks this variable when the application has redirected output to a file. -Its integral value is used for the baud rate. +.I \%ncurses +interprets its integral value as the terminal's line speed +in bits per second. If that value is absent or invalid, .I \%ncurses uses 9600. -This feature allows testers to construct repeatable test cases -that take into account optimization decisions that depend on baud rate. +This feature allows developers to construct repeatable test cases +that take into account optimization decisions that depend +on the terminal's line speed. .SS "\fICC\fP (command character)" When set, the .B \%command_character -.RB ( \%cmdch ) +.RB \%( cmdch ) capability value of loaded .I \%term\%info entries changes to the value of this variable. @@ -1083,14 +1152,16 @@ Very few .I \%term\%info entries provide this feature. .PP -Because this name is also used in development environments to represent -the C compiler's name, +Because this name is also used in development environments to store the +C compiler's name, .I \%ncurses ignores its value if it is not one character in length. .SS "\fICOLUMNS\fP" -This variable specifies the width of the screen in characters. +This variable specifies the width of the screen in character cells. Applications running in a windowing environment usually are able to obtain the width of the window in which they are executing. +.I \%ncurses +enforces an upper limit of 512 when reading the value. If .I \%COLUMNS is not defined and the terminal's screen size is not available from the @@ -1098,7 +1169,7 @@ terminal driver, .I \%ncurses uses the size specified by the .B \%columns -.RB ( \%cols ) +.RB \%( cols ) capability of the terminal type's entry in the .I \%term\%info database, @@ -1156,7 +1227,11 @@ stores this interval in milliseconds. The default value of 1000 (one second) is adequate for most uses. -This environment variable overrides it. +This environment variable overrides it; +.I \%ncurses +enforces an upper limit of 30,000 +(30 seconds) +when reading the value. .PP The most common instance where you may wish to change this value is to work with a remote host over a slow communication channel. @@ -1165,6 +1240,10 @@ If the host running a application does not receive the characters of an escape sequence in a timely manner, the library can interpret them as multiple key stroke events. +Conversely, +a fast typist on a low-latency connection who happens to input an ESC +followed by characters that match an escape sequence may experience +confusing application behavior. .PP \fI\%xterm\fP(1) mouse events are a form of escape sequence; therefore, @@ -1181,7 +1260,9 @@ does not create problems when compiling an application. If \fB\%keypad\fP(3X) is disabled for the .I curses window receiving input, -a program must disambiguate escape sequences itself. +.B \%ESCDELAY +is irrelevant +and a program must disambiguate escape sequences itself. .SS "\fIHOME\fP" .I \%ncurses may read and write auxiliary terminal descriptions in @@ -1196,7 +1277,7 @@ specifies the height of the screen in characters. The corresponding .I \%term\%info capability and code is -.BR \%lines . +.BR \%lines "." See the description of the .I \%COLUMNS variable above. @@ -1228,21 +1309,22 @@ to tell .I \%ncurses not to assume anything about the colors, use a value of \*(``\-1,\-1\*(''. -To make the default color scheme green on black, +To make the default color scheme green on black on a terminal +that uses ANSI\ X3.64/ECMA-48/ISO\ 6429 color assignments, use \*(``2,0\*(''. .I \%ncurses accepts integral values from \-1 up to the value of the .I \%term\%info .B \%max_colors .RB ( colors ) -capability. +capability for the selected terminal type. .SS "\fINCURSES_CONSOLE2\fP" (MinGW port only) The .I \%Console2 .\" https://www.hanselman.com/blog/console2-a-better-windows-command-prompt program defectively handles the Microsoft Console API call -.IR \%Create\%Console\%Screen\%Buffer . +.IR \%Create\%Console\%Screen\%Buffer "." Applications that use it will hang. However, it is possible to simulate the action of this call by mapping @@ -1256,7 +1338,11 @@ has the same effect. When .I \%ncurses is configured to use the GPM interface, -this variable may list one or more terminal names +this variable may list one or more terminal type names, +delimited by vertical bars +.RB ( | ) +or colons +.RB ( : ), against which the .I TERM variable @@ -1265,7 +1351,7 @@ is matched. An empty value disables the GPM interface, using .IR \%ncurses 's -built-in support for \fIxterm\fP(1) mouse protocols instead. +built-in support for \fI\%xterm\fP(1) mouse protocols instead. If the variable is absent, .I \%ncurses attempts to open GPM if @@ -1279,18 +1365,20 @@ your terminal driver may not handle them properly. Set this environment variable to any value to disable the feature. You can also adjust your \fI\%stty\fP(1) settings to avoid the problem. .SS "\fINCURSES_NO_MAGIC_COOKIE\fP" -Many terminals store video attributes as a property of a character cell, +Many terminals store video attributes as properties of a character cell, as .I curses does. Historically, -some recorded changes in video attributes as data that logically -.I occupies +some recorded changes in video attributes as data +that logically +(but invisibly) +.I occupied character cells on the display, switching attributes on or off, -similarly to tags in a markup language; -these are termed \*(``magic cookies\*('', -and must be subsequently overprinted. +similarly to tags in a markup language, +which then had to be overprinted to depict the cells' desired contents; +these are termed \*(``magic cookies\*(''. If the .I \%term\%info entry for your terminal type does not adequately describe its handling @@ -1315,12 +1403,13 @@ that is, limiting the speed of communication to what the hardware could handle. Unless a hardware terminal is interfaced into a terminal concentrator (which does flow control), -an application must manage flow control itself to prevent overruns and -data loss. +an application must manage flow itself to prevent overruns and data +loss. .PP -A solution that comes at no hardware cost is for an application to pause -after directing a terminal to execute an operation that it performs -slowly, +A solution that comes at no hardware cost +is for an application to pause transmission +after directing a terminal to execute an operation +that it performs slowly, such as clearing the display. Many terminal type descriptions, including that for the VT100, @@ -1343,7 +1432,7 @@ the library used \fI\%setbuf\fP(3) to enable fully buffered output when initializing the terminal. This was done, as in SVr4 -.IR curses , +.IR curses "," to increase performance. For testing purposes, both of @@ -1359,8 +1448,7 @@ Nowadays, .I \%ncurses performs its own buffering and does not require this workaround; it does not modify the buffering of the standard output stream. -This approach makes signal handling, -as for interrupts, +This approach makes the library's handling of keyboard-initiated signals more robust. A drawback is that certain unconventional programs mixed \fI\%stdio\fP(3) calls with @@ -1421,6 +1509,7 @@ Examples follow. .PP .RS 3 .EX +.nf # linux console, if patched to provide working # VT100 shift\-in/shift\-out, with corresponding font. linux\-vt100|linux console with VT100 line\-graphics, @@ -1429,6 +1518,7 @@ linux\-vt100|linux console with VT100 line\-graphics, # uxterm with vt100Graphics resource set to false xterm\-utf8|xterm relying on UTF\-8 line\-graphics, U8#1, use=xterm, +.fi .EE .RE .PP @@ -1507,8 +1597,8 @@ This variable overrides the default location. Descriptions in .I \%term\%info format are normally stored in a directory tree using subdirectories -named by the common first letters of the terminal types named therein. -This is the scheme used in System\ V. +named for the common first letters of the terminal types named therein. +System\ V used this scheme. .bP If .I \%ncurses @@ -1517,16 +1607,16 @@ then .I \%TERM\%INFO may name its location, such as -.IR \%/usr/share/terminfo.db , +.IR \%/usr/share/terminfo.db "," rather than -.IR \%/usr/share/terminfo/ . +.IR \%/usr/share/terminfo/ "." .PP The hashed database uses less disk space and is a little faster than the directory tree. However, -some applications assume the existence of the directory tree, -and read it directly -rather than using the +some applications assume the existence of the directory tree +and read it directly, +ignoring the .I \%term\%info API. .bP @@ -1550,14 +1640,17 @@ You might produce the base64 format using \fB\%infocmp\fP(1M). .RS 4 .IP .EX +.nf TERMINFO=$(infocmp \-0 \-Q2 \-q) export TERMINFO +.fi .EE .RE .IP -The compiled description is used only if it corresponds to the terminal -type identified by -.IR TERM . +.I \%ncurses +uses the compiled description only if it corresponds +to the terminal type identified by +.IR TERM "." .PP Setting .I \%TERM\%INFO @@ -1588,7 +1681,7 @@ environment variable .bP location(s) configured and compiled into .I \%ncurses -.RS 3 +.RS .if !'\*(td'' \{\ .bP .I \%@TERMINFO_DIRS@ @@ -1602,7 +1695,7 @@ location(s) configured and compiled into .SS "\fITERMINFO_DIRS\fP" This variable specifies a list of locations, akin to -.IR PATH , +.IR PATH "," in which .I \%ncurses searches for the terminal type descriptions described by @@ -1624,10 +1717,10 @@ does not hold a terminal type description or file name, then .I \%ncurses checks the contents of -.IR \%TERMPATH , +.IR \%TERMPATH "," a list of locations, akin to -.IR PATH , +.IR PATH "," in which it searches for .I termcap terminal type descriptions. @@ -1641,10 +1734,10 @@ and are unset or invalid, .I \%ncurses searches for the files -.IR \%/etc/termcap , -.IR \%/usr/share/misc/termcap , +.IR \%/etc/termcap "," +.IR \%/usr/share/misc/termcap "," and -.IR \%$HOME/.termcap , +.IR \%$HOME/.termcap "," in that order. .SH "ALTERNATE CONFIGURATIONS" Many different @@ -1654,102 +1747,204 @@ determined by the options given to the .I \%configure script when building the library. Run the script with the -.B \-\-help +.B \%\-\-help option to peruse them all. A few are of particular significance to the application developer employing -.IR \%ncurses . +.IR \%ncurses "." .TP 5 .B \-\-disable\-overwrite -The standard include for \fI\%ncurses\fP is as noted in \fBSYNOPSIS\fP: +Avoid file name conflicts between +.I \%ncurses +and an existing +.I curses +installation on the system. +The standard C preprocessor inclusion for the +.I curses +library is as follows. .RS 5 .PP .RS 4 .EX -\fB#include <curses.h>\fP +.nf +.\" The dummy character prevents undesired rewriting of the next line on +.\" installation of the man page. +\fB#\&include <curses.h>\fP +.fi .EE .RE .PP -This option is used to avoid filename conflicts when \fI\%ncurses\fP -is not the main implementation of curses of the computer. -If \fI\%ncurses\fP is installed disabling overwrite, -it puts its headers in a subdirectory, -e.g., +If +.I \%ncurses +is installed disabling overwrite, +it puts its header files in a subdirectory. +Here is an example. .PP .RS 4 .EX -\fB#include <ncurses/curses.h>\fP +.\" The dummy character prevents undesired rewriting of the next line on +.\" installation of the man page. +\fB#\&include <ncurses/curses.h>\fP .EE .RE .PP -It also omits a symbolic link which would allow you to use \fB\-lcurses\fP -to build executables. +With +.BR \%\-\-disable\-overwrite "," +installation also omits a symbolic link that would cause the compiler's +.B \%\-lcurses +option to link object files with +.I \%ncurses +instead of the system +.I curses +library. +.PP +The directory used by this configuration of +.I \%ncurses +is shown in section \*(``SYNOPSIS\*('' above. .RE .TP 5 .B \-\-enable\-widec -The configure script renames the library and -(if the \fB\-\-disable\-overwrite\fP option is used) -puts the header files in a different subdirectory. -All of the library names have a \*(``w\*('' appended to them, -i.e., instead of -.RS 5 -.PP -.RS 4 -.EX -\fB\-lncurses\fP -.EE -.RE -.PP -you link with -.PP -.RS 4 -.EX -\fB\-lncursesw\fP -.EE -.RE -.PP -You must also enable the wide-character features in the header file -when compiling for the wide-character library +(default for ABI\ 6+ since 2023-10-21) +Enable support for wide characters. +The +.I \%configure +script renames the +.I \%ncurses +library +(and the +.I tinfo +library, +if +.B \%\-\-with\-termlib +is also specified), +appending \*(``w\*(''. +An application desirous of wide-character support then uses +.B \%\-lncursesw +(or +.BR \%\-ltinfow ) +instead of +.B \%\-lncurses +(or +.BR \%\-ltinfo ) +as its linker option. +The +.IR ncurses++ "," +.IR panel "," +.IR form "," +and +.I menu +libraries are renamed similarly. +.IP +An application must also +define certain C preprocessor symbols +to enable wide-character features +in +.I curses +header files to use the extended (wide-character) functions. -The symbol which enables these features has changed -since X/Open Curses, Issue 4: +The symbol that enables these features has changed +since X/Open Curses Issue\ 4. +.RS 5 .bP -Originally, the wide-character feature required the symbol -\fB_XOPEN_SOURCE_EXTENDED\fP -but that was only valid for XPG4 (1996). +Originally, +the wide-character feature required the symbol +.IR \%_XOPEN_SOURCE_EXTENDED "," +but that was valid only for XPG4 (1996). .bP -Later, that was deemed conflicting with \fB_XOPEN_SOURCE\fP defined to 500. +Later, +that was deemed conflicting with an +.I \%_XOPEN_SOURCE +value of 500. .bP As of mid-2018, -none of the features in this implementation require a \fB_XOPEN_SOURCE\fP -feature greater than 600. -However, X/Open Curses, Issue 7 (2009) recommends defining it to 700. +no +.I \%ncurses +feature requires a +.I \%_XOPEN_SOURCE +value greater than 600. +However, +X/Open Curses Issue\ 7 (2009) recommends defining it to 700. .bP -Alternatively, you can enable the feature by defining \fBNCURSES_WIDECHAR\fP -with the caveat that some other header file than \fBcurses.h\fP -may require a specific value for \fB_XOPEN_SOURCE\fP +Alternatively, +you can enable the feature by defining +.B \%NCURSES_WIDECHAR +with the caveat that some header file other than +.I \%curses.h +may require a specific value for +.I \%_XOPEN_SOURCE (or a system-specific symbol). -.PP -The \fI\%curses.h\fP header file installed for the wide-character -library is designed to be compatible with the non-wide library's header. -Only the size of the \fI\%WINDOW\fP structure differs; -few applications require more than pointers to \fI\%WINDOW\fPs. -.PP -If the headers are installed allowing overwrite, -the wide-character library's headers should be installed last, +.RE +.IP +The +.I \%curses.h +header file installed +for the wide-character library +is designed to be compatible with the non-wide library's header. +Only the size of the +.I \%WINDOW +structure differs; +few applications require more than pointers to +.IR \%WINDOW "." +.\" XXX: What's different in term.h? +.IP +If +.IR \%ncurses 's +header files are installed allowing overwrite +(the default, +but see +.B \%\-\-disable\-overwrite +above), +the wide-character library's headers should be installed last +by packaging systems and similar, to allow applications to be built using either library from the same set of headers. -.RE .TP 5 .B \-\-with\-pthread -The configure script renames the library. -All of the library names have a \*(``t\*('' appended to them -(before any \*(``w\*('' added by \fB\-\-enable\-widec\fP). +Enable support for multi-threaded applications. +The +.I \%configure +script renames the +.I \%ncurses +library +(and the +.I tinfo +library, +if +.B \%\-\-with\-termlib +is also specified), +appending \*(``t\*('' +(before any \*(``w\*('' added by +.BR \%\-\-enable\-widec ). +An application desirous of support for multiple threads of execution +then uses, +for example, +.B \%\-lncursest +(or +.BR \%\-ltinfot ) +instead of +.B \%\-lncurses +(or +.BR \%\-ltinfo ) +as its linker option. +The +.IR ncurses++ "," +.IR panel "," +.IR form "," +and +.I menu +libraries are renamed similarly. .IP -The global variables such as \fBLINES\fP are replaced by macros to -allow read-only access. -At the same time, setter-functions are provided to set these values. -Some applications (very few) may require changes to work with this convention. +.I \%ncursest +and +.I \%ncursestw +replace global variables such as +.B \%LINES +with macros allowing read-only access. +At the same time, +they provide functions to set these values. +Very few applications require changes +to work with this convention. +.\" see definition of NCURSES_WRAPPED_VAR .TP 5 .B \-\-with\-shared .tQ @@ -1758,24 +1953,60 @@ Some applications (very few) may require changes to work with this convention. .B \-\-with\-debug .tQ .B \-\-with\-profile +Mandate compilation of the +.I \%ncurses +library +(and the +.I tinfo +library, +if +.B \%\-\-with\-termlib +is also specified) +in the specified forms. The shared and normal (static) library names differ by their suffixes, -e.g., \fBlibncurses.so\fP and \fBlibncurses.a\fP. -The debug and profiling libraries add a \*(``_g\*('' -and a \*(``_p\*('' to the root names respectively, -e.g., \fBlibncurses_g.a\fP and \fBlibncurses_p.a\fP. +as with +.I \%libncurses.so +and +.IR \%libncurses.a "." +The debugging and profiling libraries add a \*(``_g\*('' +and a \*(``_p\*('' to the roots of these respective names, +forming +.I \%libncurses_g.so +and +.IR \%libncurses_p.a "," +for example. +The +.IR ncurses++ "," +.IR panel "," +.IR form "," +and +.I menu +libraries are made available similarly. .TP 5 .B \-\-with\-termlib -Low-level functions which do not depend upon whether the library -supports wide-characters, are provided in the tinfo library. -.IP -By doing this, it is possible to share the tinfo library between -wide/normal configurations as well as reduce the size of the library -when only low-level functions are needed. +Provide +.IR \%ncurses 's +lower-level terminal interface functions +(those that do not depend +on the +.I \%SCREEN +and +.I \%WINDOW +abstractions) +in a library named +.IR \%tinfo "." +This arrangement reduces an application's linking and/or loading times +when it does not require +.IR curses 's +higher-level features. .IP -Those functions are described in these pages: +The following pages document +.I curses +functions provided by +.IR \%tinfo "." .RS .bP -\fB\%curs_extend\fP(3X) \- miscellaneous \fIcurses\fP extensions +\fB\%curs_extend\fP(3X) \- miscellaneous \fIncurses\fP extensions .bP \fB\%curs_inopts\fP(3X) \- \fIcurses\fP input options .bP @@ -1792,16 +2023,28 @@ database .RE .TP 5 .B \-\-with\-trace -The \fBtrace\fP function normally resides in the debug library, -but it is sometimes useful to configure this in the shared library. -Configure scripts should check for the function's existence rather -than assuming it is always in the debug library. +Expose the \fBcurses_trace\fP(3X) function +in the +.I ncurses(w) +shared and static libraries. +Normally, +it is available only in the debugging library. +(If +.B \-\-with\-termlib +is also specified, +.I tinfo(w) +rather than +.I ncurses(w) +supplies the deprecated \fBtrace\fP(3X) function.) +An application's configuration script should check +for the function's existence +rather than assuming its confinement to the debugging library. .SH FILES .TP .I @DATADIR@/tabset tab stop initialization database .TP -.I \*d +.I @TERMINFO@ compiled terminal capability database .SH NOTES X/Open Curses permits most functions it specifies to be made available @@ -1819,20 +2062,20 @@ to reuse functions those that move the cursor before another operation), and .bP -a few special cases. +in a few special cases. .PP If the standard output file descriptor of an .I \%ncurses program is redirected to something that is not a terminal device, the library writes screen updates to the standard error file descriptor. This was an undocumented feature of SVr3 -.IR curses . +.IR curses "." .PP See subsection \*(``Header Files\*('' below regarding symbols exposed by inclusion of \fI\%curses.h\fP. .SH EXTENSIONS .I \%ncurses -enables an application to capture mouse events on certain terminals, +enables an application to capture mouse events from certain terminals, including \fI\%xterm\fP(1); see \fB\%curs_mouse\fP(3X). .PP @@ -1872,14 +2115,17 @@ See \fB\%default_colors\fP(3X). An .I \%ncurses application can eschew knowledge of +.I \%SCREEN +and .I \%WINDOW structure internals, instead using accessor functions such as +\fB\%is_cbreak\fP(3X) and \fB\%is_scrollok\fP(3X). .PP .I \%ncurses -enables an application to direct application output to a printer -attached to the terminal device; +enables an application to direct its output to a printer attached to the +terminal device; see \fB\%curs_print\fP(3X). .PP .I \%ncurses @@ -1889,37 +2135,35 @@ and \fB\%extended_slk_color\fP(3X) as a form of \fB\%slk_color\fP(3X) that can gather color information from them when many colors are supported. .PP -Some extensions are available only if .I \%ncurses permits modification of \fB\%unctrl\fP(3X)'s behavior; see \fB\%use_legacy_coding\fP(3X). -.I \%ncurses -is compiled to support them; -section \*(``ALTERNATE CONFIGURATIONS\*('' describes how. -.bP +.PP Rudimentary support for multi-threaded applications may be available; see \fBcurs_threads\fP(3X). -.bP +.PP Functions that ease the management of multiple screens can be exposed; see \fBcurs_sp_funcs\fP(3X). -.bP +.PP To aid applications to debug their memory usage, -.I ncurses +.I \%ncurses optionally offers functions to more aggressively free memory it dynamically allocates itself; see \fBcurs_memleaks\fP(3X). -.bP +.PP The library facilitates auditing and troubleshooting of its behavior; see \fBcurs_trace\fP(3X). -.bP -The compiler option +.PP +Compiling +.I \%ncurses +with the option .B \%\-DUSE_GETCAP -causes the library to fall back to reading +causes it to fall back to reading .I \%/etc/termcap if the terminal setup code cannot find a .I \%term\%info entry corresponding to -.IR TERM . +.IR TERM "." Use of this feature is not recommended, as it essentially includes an entire .I termcap @@ -1943,7 +2187,9 @@ such as wide-character and color support. .I \%ncurses intends base-level conformance with X/Open Curses, and supports all features of its enhanced level -except the \fB\%untic\fP utility. +except the +.I \%untic +utility. .PP Differences between X/Open Curses and .I \%ncurses @@ -1963,11 +2209,10 @@ to ensure that they are not null. This is done primarily to guard against programmer error. The standard interface does not provide a way for the library to tell an application which of several possible errors occurred. -Relying on this -(or some other) -extension adversely affects the portability of -.I curses -applications. +An application that relies on +.I \%ncurses +to check its function parameters for validity limits its portability and +robustness. .SS "Padding Differences" In historical .I curses @@ -1998,7 +2243,7 @@ The header file itself includes the header files .I \%stdio.h and -.IR \%unctrl.h . +.IR \%unctrl.h "." .PP X/Open Curses has more to say, .RS 4 @@ -2006,20 +2251,20 @@ X/Open Curses has more to say, The inclusion of .I \%curses.h may make visible all symbols from the headers -.IR \%stdio.h , -.IR \%term.h , -.IR \%termios.h , +.IR \%stdio.h "," +.IR \%term.h "," +.IR \%termios.h "," and -.IR \%wchar.h . +.IR \%wchar.h "." .RE .PP but does not finish the story. A more complete account follows. .bP -Starting with 4BSD -.I curses -(1980) -all implementations have provided a +The first +.IR curses "," +in 4BSD, +provided a .I \%curses.h file. .IP @@ -2030,7 +2275,7 @@ code included and .I \%unctrl.h from an internal header file -.IR \%curses.ext , +.IR \%curses.ext "," where \*(``ext\*('' abbreviated \*(``externs\*(''. .IP @@ -2045,12 +2290,12 @@ and but nothing in .I \%curses.h itself relied upon -.IR \%stdio.h . +.IR \%stdio.h "." .bP SVr2 .I curses added -.IR \%newterm , +.IR \%newterm "," which relies upon .I \%stdio.h because its function prototype employs the @@ -2062,9 +2307,9 @@ SVr4 added .I \%putwin and -.IR \%getwin , +.IR \%getwin "," which also use -.IR \%stdio.h . +.IR \%stdio.h "." .IP X/Open Curses specifies all three of these functions. .IP @@ -2073,22 +2318,22 @@ SVr4 and X/Open Curses do not require the developer to include .I \%stdio.h before -.IR \%curses.h . +.IR \%curses.h "." Both document use of .I curses as requiring only -.IR \%curses.h . +.IR \%curses.h "." .IP As a result, standard .I \%curses.h always includes -.IR \%stdio.h . +.IR \%stdio.h "." .bP X/Open Curses and SVr4 .I curses are inconsistent with respect to -.IR \%unctrl.h . +.IR \%unctrl.h "." .IP As noted in \fBcurs_util\fP(3X), .I \%ncurses @@ -2113,7 +2358,7 @@ from to declare .I \%setupterm in -.IR \%curses.h , +.IR \%curses.h "," but .I \%ncurses and Solaris @@ -2125,7 +2370,7 @@ AIX includes .I \%term.h and -.IR \% termios.h . +.IR \%termios.h "." Again, .I \%ncurses and Solaris @@ -2136,20 +2381,15 @@ X/Open Curses says that .I \%curses.h .B may include -.IR \%term.h , +.IR \%term.h "," but does not require it to do so. .IP Some programs use functions declared in both .I \%curses.h and -.IR \%term.h , -and must include both header files in the same module. -Very old versions of AIX -.I curses -required inclusion of -.I \%curses.h -before -.IR \%term.h . +.IR \%term.h "," +and must include both header files in the same translation unit. +.\" Is that true in ncurses? Can we supply an example? --GBR .IP The header files supplied by .I \%ncurses @@ -2157,11 +2397,11 @@ include the standard library headers required for its declarations, so .IR \%ncurses 's own header files can be included in any order. -But for portability, -you should include +For portability even to old AIX systems, +include .I \%curses.h before -.IR \%term.h . +.IR \%term.h "." .bP X/Open Curses says \*(``may make visible\*('' because including a header file does not necessarily make visible all of the symbols in it @@ -2185,7 +2425,7 @@ is included, its symbols .B may \" bold for consistency in this paragraph be made visible depending on the value of the -.B _XOPEN_SOURCE +.I \%_XOPEN_SOURCE feature test macro. .bP X/Open Curses mandates an application's inclusion of one standard C @@ -2218,11 +2458,11 @@ SVr4 provided for the possibility that an application might include either .I \%varargs.h or -.IR \%stdarg.h . +.IR \%stdarg.h "." These represented contrasting approaches to handling variadic argument lists. The older interface, -.IR \%varargs.h , +.IR \%varargs.h "," used a pointer to .I char \" V7, 32V, System III, 3BSD for variadic functions' @@ -2230,9 +2470,9 @@ for variadic functions' parameter. Later, the list acquired its own standard data type, -.IR \%va_list , +.IR \%va_list "," defined in -.IR \%stdarg.h , +.IR \%stdarg.h "," empowering the compiler to check the types of a function call's actual parameters against the formal ones declared in its prototype. .IP @@ -2244,7 +2484,7 @@ before because they either have allowed for a special type, or, like -.IR \%ncurses , +.IR \%ncurses "," they include .I \%stdarg.h themselves to provide a portable interface. diff --git a/man/new_pair.3x b/man/new_pair.3x index 5e844bf8fc25..58dd75733589 100644 --- a/man/new_pair.3x +++ b/man/new_pair.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -29,8 +29,8 @@ .\" .\" Author: Thomas E. Dickey .\" -.\" $Id: new_pair.3x,v 1.46 2024/03/16 15:35:01 tom Exp $ -.TH new_pair 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: new_pair.3x,v 1.51 2025/08/16 19:11:47 tom Exp $ +.TH new_pair 3X 2025-08-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -101,7 +101,7 @@ add to the possible combinations, producing this total: .RE .bP An application might use up to a few dozen color pairs to -implement a predefined color scheme. +implement a color scheme. .IP Beyond that lies in the realm of programs using the foreground and background colors for \*(``ASCII art\*('' @@ -115,7 +115,8 @@ manage color pairs. .SS alloc_pair The \fBalloc_pair\fP function accepts parameters for foreground and background color, and -checks if that color combination is already associated with a color pair. +checks whether that color combination +is already associated with a color pair. .bP If the combination already exists, \fBalloc_pair\fP returns the existing pair. @@ -135,7 +136,8 @@ to the colors versus color pairs. .SS find_pair The \fBfind_pair\fP function accepts parameters for foreground and background color, and -checks if that color combination is already associated with a color pair, +checks whether that color combination +is already associated with a color pair, returning the pair number if it has been allocated. Otherwise it returns \-1. .SS free_pair diff --git a/man/panel.3x b/man/panel.3x index c63b4315699b..15bc81fdfa4f 100644 --- a/man/panel.3x +++ b/man/panel.3x @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: panel.3x,v 1.63 2024/03/16 15:35:01 tom Exp $ -.TH panel 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: panel.3x,v 1.68 2024/12/28 21:26:21 tom Exp $ +.TH panel 3X 2024-12-28 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -46,7 +46,7 @@ .. .SH NAME panel \- -panel stack extension for \fIcurses\fP +manage overlapping \fIcurses\fP windows .SH SYNOPSIS .nf \fB#include <panel.h> @@ -215,8 +215,9 @@ Use this function and not \fB\%wrefresh\fP(3X) or but \fB\%doupdate\fP is the function responsible for updating the physical screen. .SH "RETURN VALUE" -Each routine that returns a pointer returns \fBNULL\fP if an error -occurs. +Each routine that returns a pointer returns +.I NULL +if an error occurs. Each routine that returns an int value returns \fBOK\fP if it executes successfully and \fBERR\fP if not. .PP @@ -226,7 +227,10 @@ If either is null, an error is returned. .PP The \fB\%move_panel\fP function uses \fBmvwin\fP(3X), -and returns an error if \fB\%mvwin\fP returns an error. +and returns +.B ERR +if \fB\%mvwin\fP returns +.BR ERR "." .SH NOTES The header file \fI\%panel.h\fP itself includes the header file \fI\%curses.h\fP. @@ -260,9 +264,14 @@ Systems based on SVr4 source code, such as Solaris, provide this library. .bP -\fI\%ncurses\fP (since version 0.6 in 1993) -and \fIPDCurses\fP (since version 2.2 in 1995) -provide a panel library whose common ancestor +.I \%ncurses +(since version 0.6 in 1993) +and +.I \%PDCurses +(since version 2.2 in 1995) +provide a +.I panel +library whose common ancestor is a public domain implementation by Warren Tucker published in \fIu386mon\fP 2.20 (1990). .IP diff --git a/man/resizeterm.3x b/man/resizeterm.3x index 5e23d9fb37bb..bf098d23e60d 100644 --- a/man/resizeterm.3x +++ b/man/resizeterm.3x @@ -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 * @@ -29,8 +29,8 @@ .\" .\" Author: Thomas E. Dickey 1996-on .\" -.\" $Id: resizeterm.3x,v 1.56 2024/03/16 15:35:01 tom Exp $ -.TH resizeterm 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: resizeterm.3x,v 1.65 2025/07/05 13:06:45 tom Exp $ +.TH resizeterm 3X 2025-07-05 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .de bP .ie n .IP \(bu 4 .el .IP \(bu 2 @@ -62,11 +62,17 @@ If the terminal is stretched, rows and/or columns can be added to existing windows. The added cells should match the current attributes of the windows. .PP -If the calling program has not set up a handler for \fB\%SIGWINCH\fP -when it initializes \fI\%ncurses\fP -(e.g., using \fB\%initscr\fP(3X) or \fB\%newterm\fP(3X)), -then \fI\%ncurses\fP sets a handler for \fB\%SIGWINCH\fP which notifies -the library when a window-size event has occurred. +If the application has not set up a handler for +.I \%SIGWINCH +when it initializes +.I \%ncurses +(by calling \fB\%initscr\fP(3X) or \fB\%newterm\fP(3X)), +then +.I \%ncurses +establishes a +.I \%SIGWINCH +handler that notifies the library +when a window-resizing event has occurred. The library checks for this notification .bP when reading input data, @@ -80,10 +86,13 @@ when explicitly resuming program mode in \fB\%restartterm\fP(3X). When the library has found that the terminal's window-size has changed, it calls \fB\%resizeterm\fP to update its data structures. .PP -An application which establishes its own \fB\%SIGWINCH\fP handler +An application which establishes its own +.I \%SIGWINCH +handler can call \fB\%resizeterm\fP, but in that case, the library will not -see \fB\%SIGWINCH\fP, and proper layout will rely upon the application. -.SH FUNCTIONS +see +.IR \%SIGWINCH "," +and proper layout will rely upon the application. .SS resizeterm The function \fB\%resizeterm\fP resizes the standard and current windows (i.e., \fB\%stdscr\fP and \fB\%curscr\fP) @@ -94,7 +103,9 @@ such as the \fB\%LINES\fP and \fB\%COLS\fP variables. Most of the work for \fB\%resizeterm\fP is done by the inner function \fB\%resize_term\fP. The outer function \fB\%resizeterm\fP adds bookkeeping -for the \fB\%SIGWINCH\fP handler, +for the +.I \%SIGWINCH +handler, as well as repainting the soft-key area (see \fB\%slk_touch\fP(3X)). .PP The \fB\%resize_term\fP function attempts to resize all windows. @@ -127,14 +138,19 @@ They will fail if either of the dimensions are less than or equal to zero, or if an error occurs while (re)allocating memory for the windows. .SH NOTES While these functions are intended to be used to support a signal handler -(i.e., for \fB\%SIGWINCH\fP), care should be taken to avoid invoking them in a +(i.e., for +.IR \%SIGWINCH ")," +care should be taken to avoid invoking them in a context where \fB\%malloc\fP or \fB\%realloc\fP may have been interrupted, since it uses those functions. .PP -If \fI\%ncurses\fP is configured to supply its own \fB\%SIGWINCH\fP +If \fI\%ncurses\fP is configured to supply its own +.I \%SIGWINCH handler, .bP -on receipt of a \fB\%SIGWINCH\fP, the handler sets a flag +on receipt of a +.IR \%SIGWINCH "," +the handler sets a flag .bP which is tested in \fB\%wgetch\fP(3X), @@ -158,7 +174,9 @@ This indirect method is used to provide a safe way to resize the If the environment variables \fILINES\fP or \fI\%COLUMNS\fP are set, this overrides the library's use of the window size obtained from the operating system. -Thus, even if a \fB\%SIGWINCH\fP is received, +Thus, even if a +.I \%SIGWINCH +is received, no screen size change may be recorded. .SH PORTABILITY It is possible to resize the screen with SVr4 \fIcurses\fP, @@ -170,8 +188,13 @@ resuming using \fB\%refresh\fP(3X). .PP Doing that clears the screen and is visually distracting. .PP -This extension of \fI\%ncurses\fP was introduced in mid-1995. -It was adopted in NetBSD \fIcurses\fP (2001) and PDCurses (2003). +.I \%ncurses +introduced this extension in mid-1995. +NetBSD +.I curses +adopted it in 2001 and +.I \%PDCurses +in 2003. .SH AUTHORS Thomas Dickey (from an equivalent function written in 1988 for BSD \fIcurses\fP) .SH SEE ALSO diff --git a/man/scr_dump.5 b/man/scr_dump.5 index 95b2142ee6af..27dcaf4fcc33 100644 --- a/man/scr_dump.5 +++ b/man/scr_dump.5 @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: scr_dump.5,v 1.46 2024/03/23 20:42:29 tom Exp $ -.TH scr_dump 5 2024-03-23 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "File formats" +.\" $Id: scr_dump.5,v 1.52 2025/04/05 21:56:26 tom Exp $ +.TH scr_dump 5 2025-04-05 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "File formats" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -87,6 +87,7 @@ This is the pattern submitted to the maintainers of the \fBfile\fP program: .PP .RS 4 .EX +.nf # # ncurses5 (and before) did not use a magic number, # making screen dumps "data". @@ -94,6 +95,7 @@ This is the pattern submitted to the maintainers of the \fBfile\fP program: # ncurses6 (2015) uses this format, ignoring byte-order 0 string \e210\e210\e210\e210ncurses ncurses6 screen image # +.fi .EE .RE .RE @@ -135,7 +137,7 @@ There is no standard format for screen dumps. A brief survey of the existing implementations follows. .SS "X/Open Curses" -X/Open Curses, Issue 7 specifies little. +X/Open Curses Issue\ 7 specifies little. It says (boldface emphasis added) .RS 3 @@ -173,12 +175,14 @@ has the following definitions. .PP .RS 4 .EX +.nf /* terminfo magic number */ #define MAGNUM 0432 /* curses screen dump magic number */ #define SVR2_DUMP_MAGIC_NUMBER 0433 #define SVR3_DUMP_MAGIC_NUMBER 0434 +.fi .EE .RE .PP @@ -193,8 +197,10 @@ use a magic number that would correspond to the following. .PP .RS 4 .EX +.nf /* curses screen dump magic number */ #define SVR4_DUMP_MAGIC_NUMBER 0435 +.fi .EE .RE .PP @@ -315,6 +321,7 @@ Given a simple program which writes text to the screen .PP .RS 4 .EX +.nf #include <curses.h> int @@ -339,6 +346,7 @@ main(void) endwin(); return 0; } +.fi .EE .RE .PP @@ -346,6 +354,7 @@ When run using ncurses6, the output looks like this: .PP .RS 4 .EX +.nf \e210\e210\e210\e210ncurses 6.0.20170415 _cury=5 _curx=11 @@ -368,6 +377,7 @@ rows: 8:\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es 9:\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es 10:\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es\es +.fi .EE .RE .PP @@ -391,6 +401,7 @@ Running the same program with Solaris \fIxpg4\fP curses gives this dump: .PP .RS 4 .EX +.nf MAX=10,20 BEG=0,0 SCROLL=0,10 @@ -424,6 +435,7 @@ BG=0,0, 9,0,0,1, 9,19,0,0, CUR=11,5 +.fi .EE .RE .PP @@ -439,6 +451,7 @@ Here is the corresponding dump (using \*(``od \-t x1\*(''): .PP .RS 4 .EX +.nf 0000000 1c 01 c3 d6 f3 58 05 00 0b 00 0a 00 14 00 00 00 0000020 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 0000040 00 00 b8 1a 06 08 cc 1a 06 08 00 00 09 00 10 00 @@ -461,6 +474,7 @@ Here is the corresponding dump (using \*(``od \-t x1\*(''): 0001620 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 * 0002371 +.fi .EE .RE .SH AUTHORS diff --git a/man/tabs.1 b/man/tabs.1 index 059bc1ec66fc..8ad8c6125763 100644 --- a/man/tabs.1 +++ b/man/tabs.1 @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 2008-2016,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: tabs.1,v 1.59 2024/04/20 19:08:15 tom Exp $ -.TH @TABS@ 1 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" +.\" $Id: tabs.1,v 1.74 2025/08/16 19:11:47 tom Exp $ +.TH @TABS@ 1 2025-08-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -78,7 +78,7 @@ you should either reset tab-stops to the standard interval .PP .RS 4 .EX -tabs \-8 +@TABS@ \-8 .EE .RE .PP @@ -128,8 +128,10 @@ They are separated by a comma or a blank, for example, .PP .RS 4 .EX -tabs 1,6,11,16,21 -tabs 1 6 11 16 21 +.nf +@TABS@ 1,6,11,16,21 +@TABS@ 1 6 11 16 21 +.fi .EE .RE .PP @@ -139,13 +141,13 @@ e.g., .PP .RS 4 .EX -tabs 1,+5,+5,+5,+5 +@TABS@ 1,+5,+5,+5,+5 .EE .RE .PP which is equivalent to the 1,6,11,16,21 example. -.SS "Predefined Tab Stops" -POSIX defines several predefined lists of tab stops. +.SS "Standard Tab Stops" +POSIX defines several lists of tab stops. .TP 5 .B \-a Assembler, IBM S/370, first format @@ -229,10 +231,10 @@ When setting or resetting the left margin, .I @DATADIR@/tabset tab stop initialization database .SH PORTABILITY -IEEE Std 1003.1/The Open Group Base Specifications Issue 7 +IEEE Std 1003.1/The Open Group Base Specifications Issue\ 7 (POSIX.1-2008) describes a -.B tabs +.I tabs utility. However, .bP @@ -247,8 +249,10 @@ or .RB \%( smglp ) capabilities needed to support the feature. .bP -There is no counterpart in X/Open Curses Issue 7 for this utility, -unlike \fB@TPUT@\fP(1). +Unlike +.IR tput , +.I tabs +has no specification in X/Open Curses Issue\ 7. .PP The .B \-d @@ -259,7 +263,7 @@ The extensions not provided by other implementations. .SH HISTORY A -.B tabs +.I tabs utility appeared in PWB/Unix 1.0 (1977). .\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=PWB1/sys/source/s2/\ .\" tabs.c @@ -270,12 +274,12 @@ and in 3BSD .\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=3BSD/usr/src/cmd/\ .\" tabs.c (later the same year); -it supported a \*(``\-n\*('' option to set the first tab stop at the +it supported an option \*(``\-n\*('' to set the first tab stop at the left margin. That option is not specified by POSIX. .PP The PWB/Unix -.B tabs +.I tabs utility returned in System III (1980), and used built-in tables to support a half-dozen hardcopy terminal (printer) types. @@ -289,9 +293,9 @@ added support for the terminal database, but retained the tables to support the printers. By this time, System\ V -.B tput +.I tput had incorporated the tab stop initialization feature of BSD's -.B tset +.I tset from 1982, but employed the .I \%term\%info @@ -299,57 +303,58 @@ database to do so. .PP The .B +m -option was documented in the POSIX Base Specifications Issue 5 +option was documented in the POSIX Base Specifications Issue\ 5 (Unix98, 1997), -then omitted in Issue 6 +then omitted in Issue\ 6 (Unix03, 2004) without express motivation, though an introductory comment \*(``and optionally adjusts the margin\*('' remains, overlooked in the removal. The -.B tabs +.I tabs utility documented in Issues 6 and later has no mechanism for setting margins. The .B +m option in -.I \%ncurses -\fB\%@TABS@\fP differs from the SVr4 feature by using terminal -capabilities rather than built-in tables. +.IR \%ncurses 's +implementation +differs from the SVr4 feature by using terminal capabilities +rather than built-in tables. .PP POSIX documents no limit on the number of tab stops. Other implementations impose one; the limit is 20 in PWB/Unix's -.B tabs +.I tabs utility. While some terminals may not accept an arbitrary number of tab stops, .I \%ncurses -\fB\%@TABS@\fP attempts to set tab stops up to the right margin if the -list thereof is sufficiently long. +attempts to set tab stops up to the right margin +if the list thereof is sufficiently long. .PP -The \*(``Rationale\*('' section of the Issue 6 -.B tabs +The \*(``Rationale\*('' section of the Issue\ 6 +.I tabs reference page .\" https://pubs.opengroup.org/onlinepubs/009604499/utilities/tabs.html details how the committee considered redesigning the -.B tabs +.I tabs and -.B tput +.I tput utilities, without settling on an improved solution. It claims that .PP .RS 4 -\*(``no known historical version of +no known historical version of .I tabs -supports the capability of setting arbitrary tab stops.\*('' +supports the capability of setting arbitrary tab stops. .RE .PP The feature described in subsection \*(``Explicit Lists\*('' above was implemented in PWB/Unix, .\" see URL above -and permitted the setting of abitrary tab stops nevertheless. +and permitted the setting of arbitrary tab stops nevertheless. .SH SEE ALSO \fB\%@INFOCMP@\fP(1M), \fB\%@TSET@\fP(1), diff --git a/man/term.5 b/man/term.5 index cec231f551a3..fa15453c04a8 100644 --- a/man/term.5 +++ b/man/term.5 @@ -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: term.5,v 1.77 2024/04/20 21:24:19 tom Exp $ -.TH term 5 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "File formats" +.\" $Id: term.5,v 1.85 2025/08/16 19:11:47 tom Exp $ +.TH term 5 2025-08-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "File formats" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -55,69 +55,102 @@ .el .IP \(bu 2 .. . -.ds d @TERMINFO@ .SH NAME term \- -compiled \fIterminfo\fR terminal description -.SH SYNOPSIS -.B term +compiled \fI\%term\%info\fP terminal description +.\"SH SYNOPSIS .SH DESCRIPTION +\fB\%@TIC@\fP(1) compiles a +.I \%term\%info +terminal type description, +and \fB\%setupterm\fP(3X) reads it. +A compiled description may be stored in a file or in a database of, +potentially, +many such descriptions. +Further, +a compiled description may be in one of two formats: +one similar to that used by System\ V, +and a newer, +extensible format employed exclusively by +.IR \%ncurses . .SS "Storage Location" -Compiled terminfo descriptions are placed under the directory \fB\*d\fP. -Two configurations are supported -(when building the \fI\%ncurses\fP libraries): +Compiled +.I \%term\%info descriptions are placed +under the directory +.IR \%@TERMINFO@ . +One of two configurations is selected +when building the +.I \%ncurses +libraries. .TP 5 .B directory tree A two-level scheme is used to avoid a linear search -of a huge Unix system directory: \fB\*d/c/name\fP where +of a huge Unix system directory: +.IR \%@TERMINFO@/ c / name +where .I name -is the name of the terminal, and +is the name of the terminal, +and .I c is the first character of .IR name . Thus, -.I act4 -can be found in the file \fB\*d/a/act4\fP. +the compiled description of terminal type \*(``act4\*('' +is found in the file +.IR \%@TERMINFO@/a/act4 . Synonyms for the same terminal are implemented by multiple links to the same compiled file. .TP 5 .B hashed database -Using Berkeley database, two types of records are stored: -the terminfo data in the same format as stored in a directory tree with -the terminfo's primary name as a key, +Using the Berkeley database API, +two types of records are stored: +the +.I \%term\%info +data in the same format as that stored in a directory tree with +the terminal's primary type name as a key, and records containing only aliases pointing to the primary name. .IP If built to write hashed databases, -\fI\%ncurses\fP can still read terminfo databases organized as a +.I \%ncurses +can still read +.I \%term\%info +databases organized as a directory tree, but cannot write entries into the directory tree. -It can write (or rewrite) entries in the hashed database. +It can write +(or rewrite) +entries in the hashed database. .IP -\fI\%ncurses\fP distinguishes the two cases in the \fI\%TERMINFO\fP and -\fI\%TERMINFO_DIRS\fP environment variable by assuming a directory tree -for entries that correspond to an existing directory, -and hashed database otherwise. +.I \%ncurses +distinguishes the two cases in the +.I \%TERMINFO +and +.I \%TERMINFO_DIRS +environment variable by assuming a directory tree for entries that +correspond to an existing directory, +and a hashed database otherwise. .SS "Legacy Storage Format" The format has been chosen so that it will be the same on all hardware. -An 8 or more bit byte is assumed, but no assumptions about byte ordering +A byte of at least eight bits' width is assumed, +but no assumptions about bit ordering or sign extension are made. .PP -The compiled file is created with the \fB@TIC@\fP program, -and read by the routine \fBsetupterm\fP(3X). The file is divided into six parts: .RS 5 -.TP 3 -a) \fIheader\fP, -.TP 3 -b) \fIterminal names\fP, -.TP 3 -c) \fIBoolean flags\fP, -.TP 3 -d) \fInumbers\fP, -.TP 3 -e) \fIstrings\fP, and -.TP 3 -f) \fIstring table\fP. +.IP (a) 4 +.IR header , +.IP (b) +.IR "terminal names" , +.IP (c) +.IR "Boolean flags" , +.IP (d) +.IR numbers , +.IP (e) +.IR strings , +and +.IP (f) +a +.IR "string table" . .RE .PP The \fIheader\fP section begins the file. @@ -126,54 +159,64 @@ described below. These integers are .RS 5 .TP 5 -(1) the \fImagic number\fP (octal 0432); +(1) the \fImagic number\fP +(octal 0432); .TP 5 -(2) the size, in bytes, of the \fIterminal names\fP section; +(2) the size, +in bytes, +of the \fIterminal names\fP section; .TP 5 (3) the number of bytes in the \fIBoolean flags\fP section; .TP 5 (4) the number of short integers in the \fInumbers\fP section; .TP 5 -(5) the number of offsets (short integers) in the \fIstrings\fP section; +(5) the number of offsets +(short integers) +in the \fIstrings\fP section; .TP 5 -(6) the size, in bytes, of the \fIstring table\fP. +(6) the size, +in bytes, +of the \fIstring table\fP. .RE .PP The capabilities in the \fIBoolean flags\fP, -\fInumbers\fP, and +\fInumbers\fP, +and \fIstrings\fP -sections are in the same order as the file <term.h>. +sections are in the same order as in the header file +.IR term.h . .PP -Short integers are signed, in the range \-32768 to 32767. -They are stored as two 8-bit bytes. -The first byte contains the least significant 8 bits of the value, -and the second byte contains the most significant 8 bits. -(Thus, the value represented is 256*second+first.) -This format corresponds to the hardware of the \s-1VAX\s+1 -and \s-1PDP\s+1-11 (that is, little-endian machines). -Machines where this does not correspond to the hardware must read the -integers as two bytes and compute the little-endian value. +Short integers are signed, +in the range \-32768 to 32767, +and stored in little-endian format. .PP Numbers in a terminal description, whether they are entries in the \fInumbers\fP or \fIstrings\fP table, are positive integers. Boolean flags are treated as positive one-byte integers. -In each case, those positive integers represent a terminal capability. -The terminal compiler @TIC@ uses negative integers to handle the cases where -a capability is not available: +In each case, +those positive integers represent a terminal capability. +The terminal compiler +.I \%@TIC@ +uses negative integers to handle the cases where a capability is not +available: .bP If a capability is absent from this terminal, -@TIC@ stores a \-1 in the corresponding table. +.I \%@TIC@ +stores a \-1 in the corresponding table. .IP -The integer value \-1 is represented by two bytes 0377, 0377. +The integer value \-1 is represented by two bytes 0377, +0377. .br Absent Boolean values are represented by the byte 0 (false). .bP If a capability has been canceled from this terminal, -@TIC@ stores a \-2 in the corresponding table. +.I \%@TIC@ +stores a \-2 in the corresponding table. .IP -The integer value \-2 is represented by two bytes 0377, 0376. +The integer value \-2 is represented by two bytes 0377, +0376. .br The Boolean value \-2 is represented by the byte 0376. .br @@ -181,18 +224,22 @@ The Boolean value \-2 is represented by the byte 0376. Other negative values are illegal. .PP The \fIterminal names\fP section comes after the \fIheader\fP. -It contains the first line of the terminfo description, +It contains the first line of the +.I \%term\%info +description, listing the various names for the terminal, separated by the \*(``|\*('' character. The \fIterminal names\fP section is terminated with an \s-1ASCII NUL\s+1 character. .PP The \fIBoolean flags\fP section has one byte for each flag. -Boolean capabilities are either 1 or 0 (true or false) +Boolean capabilities are either 1 or 0 +(true or false) according to whether the terminal supports the given capability or not. .PP Between the \fIBoolean flags\fP section and the \fInumber\fP section, -a null byte will be inserted, if necessary, +a null byte will be inserted, +if necessary, to ensure that the \fInumber\fP section begins on an even byte This is a relic of the PDP\-11's word-addressed architecture, originally designed to avoid traps induced @@ -212,27 +259,42 @@ It contains all of the values of string capabilities referenced in the \fIstrings\fP section. Each string is null-terminated. Special characters in \*^X or \ec notation are stored in their -interpreted form, not the printing representation. -Padding information $<nn> and parameter information %x are -stored intact in uninterpreted form. +interpreted form, +not the printing representation. +Padding information +.BI $< nn > +and parameter information +.B %x +are stored intact in uninterpreted form. .SS "Extended Storage Format" -The previous section describes the conventional terminfo binary format. -With some minor variations of the offsets (see PORTABILITY), +The previous section describes the conventional +.I \%term\%info +binary format. +With some minor variations of the offsets +(see PORTABILITY), the same binary format is used in all modern Unix systems. -Each system uses a predefined set of Boolean, number or string capabilities. +Each system uses a standard set of Boolean, +numeric, +or string capabilities. .PP -The \fI\%ncurses\fP libraries and applications support -extended terminfo binary format, -allowing users to define capabilities which are loaded at runtime. -This -extension is made possible by using the fact that the other implementations -stop reading the terminfo data when they have reached the end of the size given -in the header. -\fI\%ncurses\fP checks the size, -and if it exceeds that due to the predefined data, +The +.I \%ncurses +libraries and applications support extended +.I \%term\%info +binary format, +allowing users to define capabilities that are loaded at runtime. +This extension is made possible by using the fact that the other +implementations stop reading the +.I \%term\%info +data when they reach the end of the size given in the header. +.I \%ncurses +checks the size, +and if it exceeds that specified in the header, continues to parse according to its own scheme. .PP -First, it reads the extended header (5 short integers): +First, +it reads the extended header +(5 short integers): .RS 5 .TP 5 (1) @@ -256,45 +318,62 @@ include the extended capability \fInames\fP as well as extended capability \fIvalues\fP. .PP Using the counts and sizes, -\fI\%ncurses\fP allocates arrays and reads data for the extended -capabilities in the same order as the header information. +.I \%ncurses +allocates arrays and reads data for the extended capabilities in the +same order as the header information. .PP The extended string table contains values for string capabilities. -After the end of these values, it contains the names for each of -the extended capabilities in order, e.g., Booleans, then numbers and -finally strings. +After the end of these values, +it contains the names for each of +the extended capabilities in order: +Boolean, +numeric, +and string. .PP By storing terminal descriptions in this way, -\fI\%ncurses\fP is able to provide a database useful with legacy -applications, -as well as providing data for applications which need more than the -predefined capabilities. -See \fBuser_caps\fP(5) for an overview -of the way \fI\%ncurses\fP uses this extended information. +.I \%ncurses +is able to provide a database useful with legacy applications, +as well as providing data for applications that require more information +about a terminal type than was anticipated +by X/Open Curses. +See \fB\%user_caps\fP(5) for an overview of the way +.I \%ncurses +uses this extended information. .PP -Applications which manipulate terminal data can use the definitions -described in \fBterm_variables\fP(3X) which associate the long capability -names with members of a \fBTERMTYPE\fP structure. +Applications that manipulate terminal data can use the definitions +described in \fB\%term_variables\fP(3X) associating the long capability +names with members of a +.I \%TERMTYPE +structure. . .SS "Extended Number Format" -On occasion, 16-bit signed integers are not large enough. -With \fI\%ncurses\fP 6.1, -a new format was introduced by making a few changes -to the legacy format: +On occasion, +16-bit signed integers are not large enough. +.I \%ncurses +6.1 introduced a new format +by making a few changes to the legacy format: .bP -a different magic number (octal 01036) +a different magic number +(octal 01036) .bP changing the type for the \fInumber\fP array from signed 16-bit integers to signed 32-bit integers. .PP -To maintain compatibility, the library presents the same data structures -to direct users of the \fBTERMTYPE\fP structure as in previous formats. -However, that cannot provide callers with the extended numbers. -The library uses a similar but hidden data structure \fBTERMTYPE2\fP -to provide data for the terminfo functions. +To maintain compatibility, +the library presents the same data structures +to direct users of the +.I \%TERMTYPE +structure as in previous formats. +However, +that cannot provide callers with the extended numbers. +The library uses a similar but hidden data structure +.I \%TERMTYPE2 +to provide data for the +.I \%term\%info +functions. .SH FILES .TP -.I \*d +.I @TERMINFO@ compiled terminal description database .SH PORTABILITY .SS setupterm @@ -313,69 +392,101 @@ The routine .B setupterm must be prepared for both possibilities \- this is why the numbers and sizes are included. -Also, new capabilities must always be added at the end of the lists -of Boolean, number, and string capabilities. +Also, +new capabilities must always be added at the end of the lists +of Boolean, +number, +and string capabilities. .SS "Binary Format" -X/Open Curses does not specify a format for the terminfo database. -System V curses used a directory-tree of binary files, +X/Open Curses does not specify a format for the +.I \%term\%info +database. +System\ V +.I curses +used a directory-tree of binary files, one per terminal description. .PP -Despite the consistent use of little-endian for numbers and the otherwise -self-describing format, it is not wise to count on portability of binary -terminfo entries between commercial Unix versions. -The problem is that there -are at least three versions of terminfo (under HP\-UX, AIX, and OSF/1) which -diverged from System V terminfo after SVr1, and have added extension -capabilities to the string table that (in the binary format) collide with -System V and X/Open Curses extensions. -See \fBterminfo\fP(5) for detailed -discussion of terminfo source compatibility issues. +Despite the consistent use of little-endian numbers and the otherwise +self-describing format, +it is not wise to count on portability of binary +.I \%term\%info +entries between commercial Unix versions. +The problem is that there are at least three versions of +.I \%term\%info +(under HP\-UX, +AIX, +and OSF/1) +each of which diverged from System\ V +.I \%term\%info +after SVr1, +and added extension capabilities to the string table that +(in the binary format) +collide with System\ V and X/Open Curses extensions. +See \fB\%terminfo\fP(5) for detailed +discussion of +.I \%term\%info +source compatibility issues. .PP This implementation is by default compatible with the binary -terminfo format used by Solaris curses, +.I \%term\%info +format used by Solaris +.IR curses , except in a few less-used details where it was found that the latter did not match X/Open Curses. The format used by the other Unix versions -can be matched by building \fI\%ncurses\fP +can be matched by building +.I \%ncurses with different configuration options. .SS "Magic Codes" -The magic number in a binary terminfo file is the first 16-bits (two bytes). -Besides making it more reliable for the library to check that a file -is terminfo, -utilities such as \fBfile\fP(1) also use that to tell what the file-format is. -System V defined more than one magic number, -with 0433, 0435 as screen-dumps (see \fBscr_dump\fP(5)). +The magic number in a binary +.I \%term\%info +file is the first 16 bits +(two bytes). +Besides making it more reliable for the library to check that a file is +.IR \%term\%info , +utilities such as \fIfile\fP(1) also use that to tell what the +file-format is. +System\ V defined more than one magic number, +with 0433, +0435 as screen-dumps +(see \fB\%scr_dump\fP(5)). This implementation uses 01036 as a continuation of that sequence, but with a different high-order byte to avoid confusion. .SS "The \fITERMTYPE\fP Structure" -Direct access to the \fBTERMTYPE\fP structure is provided for legacy -applications. -Portable applications should use the \fBtigetflag\fP and related functions -described in \fBcurs_terminfo\fP(3X) for reading terminal capabilities. +Direct access to the +.I \%TERMTYPE +structure is provided for legacy applications. +Portable applications should use \fB\%tigetflag\fP(3X) and related +functions to read terminal capabilities. .SS "Mixed-case Terminal Names" A small number of terminal descriptions use uppercase characters in their names. -If the underlying filesystem ignores the difference between +If the underlying file system ignores the difference between uppercase and lowercase, -\fI\%ncurses\fP represents the \*(``first character\*('' -of the terminal name used as -the intermediate level of a directory tree in (two-character) hexadecimal form. +.I \%ncurses +represents the \*(``first character\*('' of the terminal name used as +the intermediate level of a directory tree in (two-character) +hexadecimal form. .SS Limits -\fI\%ncurses\fP stores compiled terminal descriptions -in three related formats, -described in the sections +.I \%ncurses +stores compiled terminal descriptions in three related formats, +described in the subsections .bP -\fBLEGACY STORAGE FORMAT\fP, and +.BR "Legacy Storage Format" , +and .bP -\fBEXTENDED STORAGE FORMAT\fP, and +.BR "Extended Storage Format" , +and .bP -\fBEXTENDED NUMBER FORMAT\fP. +.BR "Extended Number Format" . .PP The legacy storage format and the extended number format differ by -the types of numeric capability which they can store -(i.e., 16-bit versus 32-bit integers). -The extended storage format introduced by \fI\%ncurses\fP 5.0 adds data -to either of these formats. +the types of numeric capability that they can store +(for example, +16- versus 32-bit integers). +The extended storage format introduced by +.I \%ncurses +5.0 adds data to either of these formats. .PP Some limitations apply: .bP @@ -390,19 +501,25 @@ Compiled entries are limited to 32768 bytes because offsets into the The legacy format could have supported 32768-byte entries, but was limited to a virtual memory page's 4096 bytes. .SH EXAMPLES -As an example, here is a description for the Lear-Siegler -ADM\-3, a popular though rather stupid early terminal: +Here is a +.I \%term\%info +description of the Lear-Siegler ADM-3, +a popular though rather stupid early terminal. .PP .EX +.nf adm3a|lsi adm3a, am, cols#80, lines#24, bel=\*^G, clear=\e032$<1>, cr=\*^M, cub1=\*^H, cud1=\*^J, cuf1=\*^L, cup=\eE=%p1%{32}%+%c%p2%{32}%+%c, cuu1=\*^K, home=\*^\*^, ind=\*^J, +.fi .EE .PP -and a hexadecimal dump of the compiled terminal description: +A hexadecimal dump of its compiled terminal description +(in legacy format) +follows. .PP .if t .in +4n .ft \*(CW @@ -436,15 +553,27 @@ Lp-1. .SH AUTHORS Thomas E. Dickey .br -extended terminfo format for \fI\%ncurses\fP 5.0 +extended +.I \%term\%info +format for +.I \%ncurses +5.0 .br -hashed database support for \fI\%ncurses\fP 5.6 +hashed database support for +.I \%ncurses +5.6 .br -extended number support for \fI\%ncurses\fP 6.1 +extended number support for +.I \%ncurses +6.1 .sp Eric S. Raymond .br -documented legacy terminfo format, e.g., from \fIpcurses\fP. +documented legacy +.I \%term\%info +format +(that used by +.IR \%pcurses ). .SH SEE ALSO \fB\%curses\fP(3X), \fB\%curs_terminfo\fP(3X), diff --git a/man/term.7 b/man/term.7 index 84d100d840ca..80cc74c73485 100644 --- a/man/term.7 +++ b/man/term.7 @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2011,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: term.7,v 1.48 2024/03/16 15:35:01 tom Exp $ -.TH term 7 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" Miscellaneous +.\" $Id: term.7,v 1.52 2025/08/16 20:08:21 tom Exp $ +.TH term 7 2025-08-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" Miscellaneous .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -40,7 +40,6 @@ .el .ds '' "" .\} . -.ds d @TERMINFO@ .SH NAME term \- conventions for naming terminal types @@ -83,7 +82,7 @@ a custom entry incorporating options which you wish to override the system default type for your line. .PP Terminal type descriptions are stored as files of capability data underneath -\*d. +.IR \%@TERMINFO@ "." To browse a list of all terminal names recognized by the system, do .sp @TOE@ | more @@ -97,8 +96,9 @@ Invoke it as follows: @INFOCMP@ \fIentry_name\fP .sp where \fIentry_name\fP is the name of the type you wish to examine (and the -name of its capability file the subdirectory of \*d named for its first -letter). +name of its capability file the subdirectory of +.I \%@TERMINFO@ +named for its first letter). This command dumps a capability file in the text format described by \fBterminfo\fP(5). .PP @@ -221,7 +221,7 @@ Such programs should fall back on the \fITERM\fP environment variable when no \-T option is specified. .SH FILES .TP -.I \*d +.I @TERMINFO@ compiled terminal description database .TP .I /etc/inittab diff --git a/man/term_variables.3x b/man/term_variables.3x index 6aee63f487ed..eb244f7a4887 100644 --- a/man/term_variables.3x +++ b/man/term_variables.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2019-2023,2024 Thomas E. Dickey * +.\" Copyright 2019-2024,2025 Thomas E. Dickey * .\" Copyright 2010-2015,2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -27,8 +27,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: term_variables.3x,v 1.36 2024/03/16 15:35:01 tom Exp $ -.TH term_variables 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: term_variables.3x,v 1.44 2025/11/12 01:27:41 tom Exp $ +.TH term_variables 3X 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -81,99 +81,193 @@ \fBNCURSES_CONST char * const strnames[]; .fi .SH DESCRIPTION -This page summarizes variables provided by the \fBcurses\fP library's -low-level terminfo interface. -A more complete description is given in the \fBcurs_terminfo\fP(3X) manual page. -.PP -Depending on the configuration, these may be actual variables, -or macros (see \fBcurs_threads\fP(3X)) -which provide read-only access to \fIcurses\fP's state. -In either case, applications should treat them as read-only to avoid -confusing the library. +This page summarizes variables provided by the +.I curses +library's lower-level +.I \%term\%info +interface. +Locate a more complete description in the \fBcurs_terminfo\fP(3X) manual +page. +.PP +Depending on +.IR \%ncurses 's +build-time configuration, +these may be actual variables, +or macros +(see \fBcurs_threads\fP(3X)) +that provide read-only access to +.IR curses 's +state. +In either case, +applications should treat them as read-only to avoid confusing the +library. .SS "Alternate Character Set Mapping" -After initializing the curses or terminfo interfaces, -the \fBacs_map\fP array holds information used to translate cells -with the \fBA_ALTCHARSET\fP video attribute into line-drawing characters. +After initializing the +.I curses +or +.I \%term\%info +interfaces, +the +.B acs_map +array holds information used to translate cells with the +.B \%A_ALTCHARSET +video attribute into line-drawing characters. .PP The encoding of the information in this array has changed periodically. -Application developers need only know that it is used for the \*(``ACS_\*('' -constants in <curses.h>. +Application developers need only know that it is used for the +\*(``ACS_\*('' constants in +.IR \%curses.h "." .PP -The comparable data for the wide-character library is a private variable. +The comparable data for the wide-character library are not exposed as +symbols in the API. .SS "Current Terminal Data" -After initializing the curses or terminfo interfaces, -the \fBcur_term\fP contains data describing the current terminal. -This variable is also set as a side-effect of \fBset_term\fP(3X) -and \fBdelscreen\fP(3X). -.PP -It is possible to save a value of \fBcur_term\fP for subsequent -use as a parameter to \fBset_term\fP, for switching between screens. -Alternatively, one can save the return value from \fBnewterm\fP -or \fBsetupterm\fP(3X) to reuse in \fBset_term\fP. +After initializing the +.I curses +or +.I \%term\%info +interfaces, +.B cur_term +contains data describing the current terminal. +It is also updated as a side effect of \fBset_term\fP(3X) and +\fBdelscreen\fP(3X). +.PP +It is possible to save a value of +.B cur_term +for subsequent use as a parameter to \fBset_term\fP(3X) +for switching between screens. +Alternatively, +one can save the return value from \fBnewterm\fP(3X) or +\fBsetupterm\fP(3X) to reuse in \fBset_term\fP(3X). .SS "\fIterminfo\fP Lookup Tables" The \fB@TIC@\fP(1) and \fB@INFOCMP@\fP(1) programs use lookup tables for -the long and short names of terminfo capabilities, -as well as the corresponding names for termcap capabilities. +the long and short names of +.I \%term\%info +capabilities, +as well as the corresponding names for +.I termcap +capabilities. These are available to other applications, -although the hash-tables used by -the terminfo and termcap functions are not available. -.PP -The long terminfo capability names use a \*(``f\*('' (eff) in their names: -\fBboolfnames\fP, -\fBnumfnames\fP, and -\fBstrfnames\fP. -.PP -These are the short names for terminfo capabilities: -\fBboolnames\fP, -\fBnumnames\fP, and -\fBstrnames\fP. -.PP -These are the corresponding names used for termcap descriptions: -\fBboolcodes\fP, -\fBnumcodes\fP, and -\fBstrcodes\fP. +though the hash tables used by the +.I \%term\%info +and +.I termcap +functions are not. +.PP +.I \%term\%info +stores capability names in arrays with an \*(``f\*('' (eff) in their +names: +.BR \%boolfnames "," +.BR \%numfnames "," +and +.BR \%strfnames "." +It stores the briefer capability codes in arrays without the +\*(``f\*('': +.BR \%boolnames "," +.BR \%numnames "," +and +.BR \%strnames "." +The corresponding +.I termcap +capability codes are stored in +.BR \%boolcodes "," +.BR \%numcodes "," +and +.BR \%strcodes "." +\fB\%terminfo\fP(5) catalogs these. .\" .SS "Terminal Type" A terminal description begins with one or more terminal names separated by \*(``|\*('' (vertical bars). -On initialization of the curses or terminfo interfaces, -\fBsetupterm\fP(3X) copies the terminal names to the array \fBttytype\fP. +On initialization of the +.I curses +or +.I \%term\%info +interfaces, +\fBsetupterm\fP(3X) copies the terminal name to the array +.BR ttytype "." .\" .SS "\fIterminfo\fP Names" -In addition to the variables, \fB<term.h>\fP also defines a symbol for each -terminfo capability \fIlong name\fP. -These are in terms of the symbol \fBCUR\fP, +In addition to the variables, +.I term.h +also defines a symbol for each +.I \%term\%info +capability name. +These are in terms of the symbol +.BR CUR "," which is defined .PP +.RS .EX #define CUR ((TERMTYPE *)(cur_term))\-> .EE +.RE .PP -These symbols provide a faster method of accessing terminfo capabilities -than using \fBtigetstr\fP(3X), etc. +These symbols provide a faster method of accessing +.I \%term\%info +capabilities than using, +for example, +\fBtigetstr\fP(3X). .PP -The actual definition of \fBCUR\fP depends upon the implementation, -but each terminfo library provides these long names defined to point -into the current terminal description loaded into memory. +The definition of +.B CUR +is implementation-dependent, +but each +.I \%term\%info +library defines these names to point +into the in-memory description of the current terminal. +For example, +in +.IR \%ncurses "," +the expressions +.B tigetstr("key_dc") +and +\*(``\c\" `` string not reliable in a macro call on DWB/Heirloom nroffs +.B "CUR Strings[59]\c" +\*('' \" '' string not reliable in a macro call on DWB/Heirloom nroffs +are equivalent. .\" -.SH NOTES -The low-level terminfo interface is initialized using -\fB\%setupterm\fP(3X). -The upper-level curses interface uses the low-level terminfo interface, -internally. +.SS "\fIterminfo\fP and \fIcurses" +\fB\%setupterm\fP(3X) initializes the lower-level +.I \%term\%info +interface. +The higher-level +.I curses +interface uses the +.I \%term\%info +interface internally; +the symbol +.B SP +bridges the +.I curses +.I SCREEN +type with the +.I \%term\%info +.I TERMINAL +type. .\" .SH PORTABILITY -X/Open Curses does not describe any of these except for \fBcur_term\fP. -(The inclusion of \fBcur_term\fP appears to be an oversight, -since other comparable low-level information is omitted by X/Open). +X/Open Curses does not describe any of these symbols except for +.IR \%cur_term "." +(The inclusion of +.I \%cur_term +appears to be an oversight, +since other comparable low-level information is omitted by X/Open.) .PP Other implementations may have comparable variables. Some implementations provide the variables in their libraries, but omit them from the header files. .PP -All implementations which provide terminfo interfaces add definitions -as described in the \fBTerminfo Names\fP section. -Most, but not all, base the definition upon the \fBcur_term\fP variable. +All implementations that provide +.I \%term\%info +interfaces add definitions +as described in the +.RI \*(`` terminfo +Names\*('' section above. +Most, +but not all, +base the definition upon the +.I \%cur_term +variable. .SH SEE ALSO \fB\%curses\fP(3X), \fB\%curs_terminfo\fP(3X), diff --git a/man/terminfo.head b/man/terminfo.head index 717f849e25fb..90b1af604135 100644 --- a/man/terminfo.head +++ b/man/terminfo.head @@ -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: terminfo.head,v 1.65 2024/04/20 21:14:00 tom Exp $ -.TH terminfo 5 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "File formats" +.\" $Id: terminfo.head,v 1.69 2025/08/16 21:50:23 tom Exp $ +.TH terminfo 5 2025-08-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "File formats" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -51,12 +51,11 @@ .el .IP \(bu 2 .. . -.ds d @TERMINFO@ .SH NAME \fB\%terminfo\fP \- terminal capability database .SH SYNOPSIS -\*d/*/* +@TERMINFO@/*/* .SH DESCRIPTION .I Terminfo is a database describing terminals, @@ -222,6 +221,6 @@ user preferences. An entry included via \fBuse\fP can contain canceled capabilities, which have the same effect as if those cancels were inline in the using terminal entry. -.SS "Predefined Capabilities" +.SS "Standard Capabilities" .\" Head of terminfo man page ends here .ps -1 diff --git a/man/terminfo.tail b/man/terminfo.tail index 4d6daa38b692..f98acc73816f 100644 --- a/man/terminfo.tail +++ b/man/terminfo.tail @@ -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,66 +27,118 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: terminfo.tail,v 1.148 2024/04/20 21:24:19 tom Exp $ +.\" $Id: terminfo.tail,v 1.163 2025/11/12 01:01:34 Branden.Robinson Exp $ .ps +1 .SS "User-Defined Capabilities" . -The preceding section listed the \fIpredefined\fP capabilities. -They deal with some special features for terminals no longer -(or possibly never) produced. -Occasionally there are special features of newer terminals which -are awkward or impossible to represent by reusing the predefined +The preceding section listed the +.I standard capabilities. -.PP -\fI\%ncurses\fP addresses this limitation by allowing user-defined -capabilities. -The \fB@TIC@\fP and \fB@INFOCMP@\fP programs provide -the \fB\-x\fP option for this purpose. -When \fB\-x\fP is set, -\fB@TIC@\fP treats unknown capabilities as user-defined. -That is, if \fB@TIC@\fP encounters a capability name -which it does not recognize, -it infers its type (Boolean, number or string) from the syntax +Some are esoteric, +supporting functionality that terminal emulators do not implement, +or may never have been realized in manufactured hardware. +Occasionally, +emulators have special features +that are awkward or impossible to represent +via standard capabilities. +.PP +.I \%ncurses +addresses this limitation by allowing user-defined capabilities. +The +.B \%@TIC@ +and +.B \%@INFOCMP@ +programs provide an +.B \-x +option for this purpose. +When +.B \-x +is used, +.B \%@TIC@ +treats unknown capabilities as user-defined. +That is, +if +.B \%@TIC@ +encounters a capability name +that it does not recognize, +the program infers the capability's type +(Boolean, +numeric, +or +string) +from the syntax of the capability value and makes an extended table entry for that capability. -The \fBuse_extended_names\fP(3X) function makes this information +\fBuse_extended_names\fP(3X) makes this information conditionally available to applications. -The \fI\%ncurses\fP library provides the data leaving most of the -behavior to applications: -.bP -User-defined capability strings whose name begins -with \*(``k\*('' are treated as function keys. -.bP -The types (Boolean, number, string) determined by \fB@TIC@\fP -can be inferred by successful calls on \fBtigetflag\fP, etc. +.I \%ncurses +library functions supply callers with capability data, +the interpretation of which is mostly up to the application. +.bP +.I \%ncurses +treats user-defined string capabilities +whose names begin with \*(``k\*('' +as function keys. +.bP +Capability types +(Boolean, +numeric, +or +string) +determined by +.B \%@TIC@ +can be inferred by successful +\fB\%tigetflag\fP(3X), +\fB\%tigetnum\fP(3X), +and +\fB\%tigetstr\fP(3X) +calls. .bP If the capability name happens to be two characters, the capability is also available through the termcap interface. .PP -While termcap is said to be extensible because it does not use a predefined set -of capabilities, -in practice it has been limited to the capabilities defined by -terminfo implementations. +While +.I termcap +is said to be extensible because it mandates no capabilities, +in practice it has been limited to those defined by +.I \%term\%info +implementations. As a rule, -user-defined capabilities intended for use by termcap applications should -be limited to Booleans and numbers to avoid running past the 1023 byte -limit assumed by termcap implementations and their applications. -In particular, providing extended sets of function keys (past the 60 -numbered keys and the handful of special named keys) is best done using -the longer names available using terminfo. -.PP -The \fI\%ncurses\fP library uses a few of these user-defined -capabilities, +employ only user-defined capabilities of Boolean and numeric type +with +.I termcap +applications to avoid overrunning the 1023 byte limit +assumed by +.I termcap +implementations and their applications. +Specifically, +support for extended sets of function keys +(past the 60 numbered keys and the handful of special named keys) +is better achieved with longer names available via +.IR \%term\%info "." +.PP +The +.I \%ncurses +library uses a few of these user-defined capabilities, as described in \fBuser_caps\fR(5). -Other user-defined capabilities (including function keys) are -described in the terminal database, in the section on -.I "NCURSES USER-DEFINABLE CAPABILITIES" +For other user-defined capabilities, +including function keys, +consult the source form of the terminal database, +.IR \%terminfo.src "," +under the heading \*(``NCURSES USER-DEFINABLE CAPABILITIES\*(''. . .SS "A Sample Entry" . -The following entry, describing an ANSI-standard terminal, is representative -of what a \fBterminfo\fP entry for a modern terminal typically looks like. +The following entry, describing an ANSI\ X3.64- +(or ECMA-48-) +-standard terminal +(henceforth \*(``ANSI-standard\*('' for brevity), +is representative +of what a +.I \%term\%info +entry for a modern terminal typically looks like. .PP .EX +.nf \s-2ansi|ansi/pc\-term compatible with color, am, mc5i, mir, msgr, colors#8, cols#80, it#8, lines#24, ncv#3, pairs#64, @@ -117,6 +169,7 @@ of what a \fBterminfo\fP entry for a modern terminal typically looks like. sgr0=\eE[0;10m, smacs=\eE[11m, smpch=\eE[11m, smso=\eE[7m, smul=\eE[4m, tbc=\eE[3g, u6=\eE[%i%d;%dR, u7=\eE[6n, u8=\eE[?%[;0123456789]c, u9=\eE[c, vpa=\eE[%i%p1%dd, +.fi .EE .PP Entries may continue onto multiple lines by placing white space at @@ -186,7 +239,8 @@ respectively. X/Open Curses does not say what \*(``appropriate \fIx\fP\*('' might be. In practice, that is a printable ASCII graphic character. The special case \*(``\*^?\*('' is interpreted as DEL (127). -In all other cases, the character value is AND'd with 0x1f, +In all other cases, +the character value is logically \*(``and\*(''-ed with 0x1f, mapping to ASCII control codes in the range 0 through 31. .PP Other escapes include @@ -277,14 +331,14 @@ as a list of colon-separated pathnames of terminal databases to be searched. .IP An empty pathname (i.e., if the variable begins or ends with a colon, or contains adjacent colons) -is interpreted as the system location \fI\*d\fP. +is interpreted as the system location \fI@TERMINFO@\fP. .bP Finally, \fI\%ncurses\fP searches these compiled-in locations: .RS .bP a list of directories (@TERMINFO_DIRS@), and .bP -the system terminfo directory, \fI\*d\fP +the system terminfo directory, \fI@TERMINFO@\fP .RE .PP The \fBTERMINFO\fP variable can contain a terminal description instead @@ -348,7 +402,7 @@ and applies to storage scope terminals, such as \s-1TEKTRONIX\s+1 4010 series, as well as hard copy and APL terminals.) If there is a code to move the cursor to the left edge of the current -row, give this as +line, give this as .BR cr . (Normally this will be carriage return, control/M.) If there is a code to produce an audible signal (bell, beep, etc) @@ -412,7 +466,7 @@ The only local motion which is defined from the left edge is if .B bw is given, then a .B cub1 -from the left edge will move to the right edge of the previous row. +from the left edge will move to the right edge of the previous line. If .B bw is not given, the effect is undefined. @@ -448,11 +502,13 @@ Thus the model 33 teletype is described as while the Lear Siegler \s-1ADM-3\s0 is described as .PP .EX +.nf .\".in -2 \s-1adm3\||\|3\||\|lsi adm3, am, bel=\*^G, clear=\*^Z, cols#80, cr=\*^M, cub1=\*^H, cud1=\*^J, ind=\*^J, lines#24,\s+1 .\".in +2 +.fi .EE .SS "Parameterized Strings" Cursor addressing and other strings requiring parameters @@ -462,8 +518,8 @@ with \fIprintf\fP-like escapes such as \fI%x\fP in it. For example, to address the cursor, the .B cup capability is given, using two parameters: -the row and column to address to. -(Rows and columns are numbered from zero and refer to the +the line and column to address to. +(Lines and columns are numbered from zero and refer to the physical screen visible to the user, not to any unseen memory.) If the terminal has memory relative cursor addressing, that can be indicated by @@ -569,13 +625,15 @@ push strlen(pop) arithmetic (%m is \fImod\fP): \fIpush(pop() op pop())\fP .TP \fB%&\fP, \fB%|\fP, \fB%\*^\fP -bit operations (AND, OR and exclusive-OR): \fIpush(pop() op pop())\fP +bit operations +(\*(``and\*('', \*(``or\*('' and exclusive \*(``or\*(''): +\fIpush(pop() op pop())\fP .TP \fB%=\fP, \fB%>\fP, \fB%<\fP logical operations: \fIpush(pop() op pop())\fP .TP \fB%A\fP, \fB%O\fP -logical AND and OR operations (for conditionals) +logical \*(``and\*('' and \*(``or\*('' operations (for conditionals) .TP \fB%!\fP, \fB%\*~\fP unary operations (logical and bit complement): \fIpush(op pop())\fP @@ -608,17 +666,17 @@ That is, to get x\-5 one would use \*(``%gx%{5}%\-\*(''. \fB%P\fP and \fB%g\fP variables are persistent across escape-string evaluations. .PP -Consider the HP2645, which, to get to row 3 and column 12, needs +Consider the HP2645, which, to get to line 3 and column 12, needs to be sent \eE&a12c03Y padded for 6 milliseconds. -The order of the rows and columns is inverted here, -and the row and column are printed as two digits. +The order of the lines and columns is inverted here, +and the lines and column are printed as two digits. The corresponding terminal description is expressed thus: .RS cup=\eE&a%p2%dc%p1%dY$<6>, .RE .PP -The Microterm \s-1ACT-IV\s0 needs the current row and column sent -preceded by a \fB\*^T\fP, with the row and column simply encoded in binary, +The Microterm \s-1ACT-IV\s0 needs the current line and column sent +preceded by a \fB\*^T\fP, with the line and column simply encoded in binary, .RS cup=\*^T%p1%c%p2%c .RE @@ -632,10 +690,13 @@ This is necessary because it is not always safe to transmit \fB\en\fP tabs are never expanded, so \et is safe to send. This turns out to be essential for the Ann Arbor 4080.) .PP -A final example is the \s-1LSI ADM\s0-3a, which uses row and column -offset by a blank character, thus +A final example is the LSI ADM-3A, +which uses line and column offset by a space, +thus .RS +.EX cup=\eE=%p1%\*' \*'%+%c%p2%\*' \*'%+%c +.EE .RE .PP After sending \*(``\eE=\*('', this pushes the first parameter, pushes the @@ -656,7 +717,7 @@ to the top left corner of the screen, not of memory. (Thus, the \eEH sequence on HP terminals cannot be used for .BR home .) .PP -If the terminal has row or column absolute cursor addressing, +If the terminal has line or column absolute cursor addressing, these can be given as single parameter capabilities .B hpa (horizontal position absolute) @@ -713,7 +774,7 @@ the ability to set a top and/or bottom margin using the current line position, and .bP parameterized capabilities for setting the top, bottom, left, right margins -given the number of rows or columns. +given the number of lines or columns. .RE .PP In practice, the categorization into \*(``terminal\*('' and \*(``printer\*('' @@ -744,8 +805,8 @@ These are the margin-related capabilities: .PP .TS center; -lb lb -lb l . +Lb Lb +Lb L . Name Description _ smgl Set left margin at current column @@ -1008,7 +1069,7 @@ to delete a single character, with one parameter, .IR n , to delete -.IR n "characters," +.IR n " characters," and delete mode by giving \fBsmdc\fP and \fBrmdc\fP to enter and exit delete mode (any mode the terminal needs to be placed in for @@ -1088,8 +1149,8 @@ For example, the DEC vt220 supports most of the modes: .PP .TS center; -lb lb lb -l l l . +Lb Lb Lb +L L L . tparm Parameter Attribute Escape Sequence _ none none \eE[0m @@ -1123,8 +1184,8 @@ Writing out the above sequences, along with their dependencies yields .ne 11 .TS center; -lb lb lb -l l l . +Lb Lb Lb +L L L . Sequence When to Output terminfo Translation _ \eE[0 always \eE[0 @@ -1140,8 +1201,10 @@ m always m Putting this all together into the sgr sequence gives: .PP .EX +.nf sgr=\eE[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p4%t;5%; %?%p1%p3%|%t;7%;%?%p7%t;8%;m%?%p9%t\e016%e\e017%;, +.fi .EE .PP Remember that if you specify sgr, you must also specify sgr0. @@ -1296,38 +1359,61 @@ give them in \fBsmln\fP and \fBrmln\fP. \fBsmln\fP is normally output after one or more pln sequences to make sure that the change becomes visible. .SS "Tabs and Initialization" -A few capabilities are used only for tabs: -.bP -If the terminal has hardware tabs, the command to advance to the next -tab stop can be given as -.B ht -(usually control/I). -.bP -A \*(``back-tab\*('' command which moves leftward to the preceding tab stop can -be given as -.BR cbt . +A few capabilities are used only to manage tab stops. +.bP +If the terminal has hardware tabs, +specify the character sequence that advances to the next tab stop +as the value of the +.B tab +.RB ( ht ) +string capability +(usually Control+I). +.bP +Specify a character sequence that retreats +(moves leftward) +to the preceding tab stop +as the value of the +.B \%back_tab +.RB ( cbt ) +string capability. .IP -By convention, if the teletype modes indicate that tabs are being -expanded by the computer rather than being sent to the terminal, -programs should not use -.B ht +By convention, +if the terminal modes are configured such that tabs are expanded +by the host rather than terminal, +applications should not employ the +.B tab +.RB ( ht ) or -.B cbt -even if they are present, since the user may not have the tab stops -properly set. +.B \%back_tab +.RB ( cbt ) +capabilities even if they are present, +since the user may not have the tab stops properly set. .bP -If the terminal has hardware tabs which are initially set every +If the terminal has hardware tab stops that are set at every +.I n +character cells when the terminal is powered up, +specify .I n -spaces when the terminal is powered up, -the numeric parameter -.B it -is given, showing the number of spaces the tabs are set to. +as the value of the the numeric capability +.B \%init_tabs +.RB ( it )\c +\&. .IP -The \fBit\fP capability is normally used by the \fB@TSET@\fP -command to determine whether to set the mode for hardware tab expansion, -and whether to set the tab stops. +The +.B \%@TSET@ +and +.RB \*(`` \%@TPUT@ +.BR init \*('' +commands interpret the presence of the +.B \%init_tabs +.RB ( it ) +capability as implying that the terminal +is responsible for tab stop expansion +as well as an instruction to set the tab stops to its value. If the terminal has tab stops that can be saved in non-volatile memory, -the terminfo description can assume that they are properly set. +its +.I \%term\%info +type description can assume that they are properly set. .PP Other capabilities include @@ -1446,7 +1532,7 @@ If there are commands to set and clear tab stops, they can be given as (clear all tab stops) and .B hts -(set a tab stop in the current column of every row). +(set a tab stop in the current column of every line). If a more complex sequence is needed to set the tabs than can be described by this, the sequence can be placed in .B is2 @@ -1618,40 +1704,85 @@ as the corresponding graphic. Then read off the VT100/your terminal character pairs right to left in sequence; these become the ACSC string. .SS "Color Handling" -The curses library functions \fBinit_pair\fP and \fBinit_color\fP -manipulate the \fIcolor pairs\fP and \fIcolor values\fP discussed in this -section -(see \fBcurs_color\fP(3X) for details on these and related functions). -.PP -Most color terminals are either \*(``Tektronix-like\*('' or \*(``HP-like\*('': -.bP -Tektronix-like -terminals have a predefined set of \fIN\fP colors -(where \fIN\fP is usually 8), -and can set -character-cell foreground and background characters independently, mixing them -into \fIN\fP\ *\ \fIN\fP color pairs. -.bP -On HP-like terminals, the user must set each color -pair up separately (foreground and background are not independently settable). -Up to \fIM\fP color pairs may be set up from 2*\fIM\fP different colors. -ANSI-compatible terminals are Tektronix-like. -.PP -Some basic color capabilities are independent of the color method. -The numeric -capabilities \fBcolors\fP and \fBpairs\fP specify the maximum numbers of colors -and color pairs that can be displayed simultaneously. -The \fBop\fP (original -pair) string resets foreground and background colors to their default values -for the terminal. -The \fBoc\fP string resets all colors or color pairs to -their default values for the terminal. -Some terminals (including many PC -terminal emulators) erase screen areas with the current background color rather -than the power-up default background; these should have the Boolean capability -\fBbce\fP. -.PP -While the curses library works with \fIcolor pairs\fP +The +.I curses +library functions +.B \%init_pair +and +.B \%init_color +manipulate the +.I "color pairs" +and +.I colors +(color values or indices, +such as \*(``1=red\*('') +discussed in this section +(see \fB\%curs_color\fP(3X) for details on these and related functions). +.PP +Most color terminals are either \*(``Tektronix-like\*('' +or \*(``HP-like\*('' +in their approach to color management. +.bP +.I Tektronix-like +terminals define a set of +.I n +colors +(where +.I n +is usually 8), +and can alter +character-cell foreground and background colors independently, +mixing them into +.IR n \(mu n +color pairs. +ANSI-standard terminals are Tektronix-like. +.bP +On +.I HP-like +terminals, +the user must set up each color pair separately; +foreground and background are not independently alterable. +Up to +.I m +color pairs may be configured from +.RI 2\(mu m +different colors. +.PP +Some basic color management capabilities +are independent of the color encoding method. +The numeric capabilities +.B \%max_colors +.RB ( \%colors ) +and +.B \%max_pairs +.RB ( \%pairs ) +specify the maximum numbers of colors +and color pairs that the device can display simultaneously. +The +.B \%orig_pair +.RB ( \%op ) +(\*(``original pair\*('') +string capability +resets foreground and background colors +to their default values for the terminal. +The +.B \%orig_colors +.RB ( \%oc ) +(\*(``original colors\*('') +string capability +resets all colors or color pairs +to their default values for the terminal. +Some terminal types +(including many PC terminal emulators) +erase screen areas with the current background color rather +than the power-up default background; +these should declare the Boolean capability +.B \%back_color_erase +.RB ( bce ). +.PP +While the +.I curses +library works with \fIcolor pairs\fP (reflecting the inability of some devices to set foreground and background colors independently), there are separate capabilities for setting these features: @@ -1682,8 +1813,8 @@ space. .PP .TS center; -cb cb cb cb s s -l lb c l1 l1 l . +Cb Cb Cb Cb S S +L Lb C L1 L1 L . Color #define Value RGB _ black COLOR_BLACK 0 0, 0, 0 @@ -1703,8 +1834,8 @@ a different mapping, i.e., .PP .TS center; -cb cb cb cb s s -l lb c l1 l1 l . +Cb Cb Cb Cb S S +L Lb C L1 L1 L . Color #define Value RGB _ black COLOR_BLACK 0 0, 0, 0 @@ -1755,8 +1886,8 @@ attributes understood by \fBcurses\fP is as follows: .PP .TS center; -cb cb cb cb -lb n n lb. +Cb Cb Cb Cb +Lb N N Lb. Attribute Bit Decimal Set by _ A_STANDOUT 0 1 sgr @@ -2019,7 +2150,7 @@ The \-c (check) option also checks resolved (after tc expansion) lengths. .SH FILES .TP -.I \*d +.I @TERMINFO@ compiled terminal description database directory .SH EXTENSIONS Searching for terminal descriptions in @@ -2059,7 +2190,7 @@ Portable applications must assume that numeric capabilities are signed 16-bit values. This includes the \fIno_color_video\fP (\fBncv\fP) capability. The 32768 mask value used for italics with \fBncv\fP can be confused with -an absent or cancelled \fBncv\fP. +an absent or canceled \fBncv\fP. If italics should work with colors, then the \fBncv\fP value must be specified, even if it is zero. .PP @@ -2076,7 +2207,7 @@ Solaris, and \fI\%ncurses\fP support all SVr4 capabilities. .bP IRIX supports the SVr4 set and adds one undocumented extended string -capability (\fB\%set_pglen\fP). +capability \%(\fBset_pglen\fP). .bP SVr1 and Ultrix support a restricted subset of \fI\%terminfo\fP capabilities. diff --git a/man/tic.1m b/man/tic.1m index 9c3181ed5c7d..c0a39f7fa390 100644 --- a/man/tic.1m +++ b/man/tic.1m @@ -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: tic.1m,v 1.110 2024/04/27 17:57:06 tom Exp $ -.TH @TIC@ 1M 2024-04-27 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" +.\" $Id: tic.1m,v 1.128 2025/11/12 00:49:19 tom Exp $ +.TH @TIC@ 1M 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -45,10 +45,9 @@ .el .IP \(bu 2 .. . -.ds d @TERMINFO@ .SH NAME \fB\%@TIC@\fP \- -compile terminal descriptions for \fIterminfo\fR or \fItermcap\fR +compile terminal descriptions for \%\fIterm\%info\fR or \fItermcap\fR .SH SYNOPSIS \fB@TIC@\fP [\fB\-\ @@ -83,134 +82,260 @@ x\ [\fB\-w\fP[\fIn\fP]] \fIfile\fP .SH DESCRIPTION -The \fB@TIC@\fP command translates a \fBterminfo\fP file from source -format into compiled format. -The compiled format is necessary for use with -the library routines in \fB\%ncurses\fP(3X). +.B \%@TIC@ +translates a +.I \%term\%info +file from source format +into the compiled format +used by the +\fB\%ncurses\fP(3X) +library. .PP -As described in \fBterm\fP(5), the database may be either a directory -tree (one file per terminal entry) or a hashed database (one record per entry). -The \fB@TIC@\fP command writes only one type of entry, -depending on how it was built: +As described in \fBterm\fP(5), +the database may be either a directory tree +(one file per terminal entry) +or a hashed database +(one record per entry). +The +.B \%@TIC@ +command writes only one type of entry, +depending on how it was built. .bP -For directory trees, the top-level directory, e.g., /usr/share/terminfo, +For directory trees, +the top-level directory, +such as +.IR \%/usr/share/terminfo "," specifies the location of the database. .bP For hashed databases, a filename is needed. If the given file is not found by that name, -but can be found by adding the suffix ".db", +but can be found by adding the suffix \*(``.db\*('', then that is used. .IP The default name for the hashed database is the same as the -default directory name (only adding a ".db" suffix). +default directory name (only adding a \*(``.db\*('' suffix). .PP In either case (directory or hashed database), -\fB@TIC@\fP will create the container if it does not exist. +.B \%@TIC@ +will create the container if it does not exist. For a directory, this would be the \*(``terminfo\*('' leaf, -versus a "terminfo.db" file. +versus a +.I terminfo.db +file. .PP -The results are normally placed in the system terminfo database \fB\*d\fP. +The results are normally placed +in the system +.I \%term\%info +database +.IR \%@TERMINFO@ "." The compiled terminal description can be placed -in a different terminfo database. +in a different +.I \%term\%info +database. There are two ways to achieve this: .bP First, you may override the system default either by using the \fB\-o\fP option, or by setting the variable \fI\%TERMINFO\fP -in your shell environment to a valid database location. +in the process environment to a valid database location. .bP -Secondly, if \fB@TIC@\fP cannot write in \fI\*d\fP -or the location specified using your \fI\%TERMINFO\fP variable, -it looks for the directory \fI$HOME/.terminfo\fP -(or hashed database \fI$HOME/.terminfo.db)\fP; +Secondly, if +.B \%@TIC@ +cannot write in +.I \%@TERMINFO@ +or the location specified using your +.I \%TERMINFO +variable, +it looks for the directory +.I \%$HOME/.terminfo +(or hashed database +.IR $HOME/.terminfo.db ); if that location exists, the entry is placed there. .PP -Libraries that read terminfo entries are expected to check in succession +Libraries that read +.I \%term\%info +entries are expected to check in succession .bP -a location specified with the \fI\%TERMINFO\fP environment variable, +a location specified by the +.I \%TERMINFO +environment variable, .bP -\fI$HOME/.terminfo\fP, +.IR \%$HOME/.terminfo "," .bP -directories listed in the \fI\%TERMINFO_DIRS\fP environment variable, +directories listed in the +.I \%TERMINFO_DIRS +environment variable, .bP -a compiled-in list of directories (@TERMINFO_DIRS@), and +a compiled-in list of directories +.RI \%( @TERMINFO_DIRS@ ), +and .bP -the system terminfo database (\fI\*d\fP). +the system +.I \%term\%info +database +.RI \%( @TERMINFO@ ). .PP -The \fIFetching Compiled Descriptions\fP section in the \fBterminfo\fR(5) -manual goes into further detail. +Section \*(``Fetching Compiled Descriptions\*('' in \fBterminfo\fP(5) +goes into further detail. .SS Aliases -This is the same program as @INFOTOCAP@ and @CAPTOINFO@; -usually those are linked to, or copied from this program: +.B \%@TIC@ +is the same program as +.B \%@INFOTOCAP@ +and +.BR \%@CAPTOINFO@ ";" +usually those are linked to, +or copied from, this program. .bP -When invoked as @INFOTOCAP@, @TIC@ sets the \fB\-I\fP option. +When invoked as +.BR \%@INFOTOCAP@ "," +.B \%@TIC@ +sets the +.B \-I +option. .bP -When invoked as @CAPTOINFO@, @TIC@ sets the \fB\-C\fP option. +When invoked as +.BR \%@CAPTOINFO@ "," +.B \%@TIC@ +sets the +.B \-C +option. .SH OPTIONS .TP -\fB\-0\fP -restricts the output to a single line +.B \-0 +restricts the output to a single line. .TP -\fB\-1\fP -restricts the output to a single column +.B \-1 +restricts the output to a single column. .TP -\fB\-a\fP -tells \fB@TIC@\fP to retain commented-out capabilities rather than discarding -them. +.B \-a +tells +.B \%@TIC@ +to retain commented-out capabilities rather than discarding them. Capabilities are commented by prefixing them with a period. -This sets the \fB\-x\fP option, because it treats the commented-out -entries as user-defined names. -If the source is termcap, accept the 2-character names required by version 6. +.B \-a +implies +.BR \-x "," +because +.B \%@TIC@ +treats the commented-out entries as user-defined names. +If the source is in +.I termcap +format, +.B \%@TIC@ +accepts the 2-character names required by version 6. +.\" TD added this comment in 2003, prompted by discussion with Don Libes. +.\" Quoting from SunOS 4.1.3 termcap(5): +.\" Each termcap entry consist of a number of colon-separated (:) fields. +.\" The first field for each terminal lists the various names by which it +.\" is known, separated by bar ( | ) characters. The first name is always +.\" two characters long, and is used by older (version 6) systems (which +.\" store the terminal type in a 16-bit word in a system-wide database). +.\" Version 6 sounds like Unix version 6, but termcap was introduced a few +.\" years later. The SunOS man page was based on material in 4.2BSD. Otherwise these are ignored. .TP \fB\-C\fP -Force source translation to termcap format. -Note: this differs from the \fB\-C\fP -option of \fB@INFOCMP@\fP(1M) in that it does not merely translate capability -names, but also translates terminfo strings to termcap format. -Capabilities -that are not translatable are left in the entry under their terminfo names +Force source translation to +.I termcap +format. +Note: this option differs from the +.B \-C +option of \fB\%@INFOCMP@\fP(1M) +in that it does not merely translate capability names, +but also translates +.I \%term\%info +string capability values to +.I termcap +format. +.B \%@TIC@ +leaves capabilities that are not translatable +in the entry under their +.I \%term\%info +names, but commented out with two preceding dots. -The actual format used incorporates some improvements for escaped characters -from terminfo format. -For a stricter BSD-compatible translation, add the \fB\-K\fP option. +The actual format used +incorporates some improvements for escaped characters +from +.I \%term\%info +format. +For a stricter BSD-compatible translation, +specify +.B \-K +as well. .IP -If this is combined with \fB\-c\fP, \fB@TIC@\fP makes additional checks -to report cases where the terminfo values do not have an exact equivalent -in termcap form. +If +.B \-C +is combined with +.BR \-c "," +.B \%@TIC@ +makes additional checks, +reporting cases where +.I \%term\%info +capability values do not have an exact equivalent +in +.I termcap +syntax. For example: .RS .bP -\fBsgr\fP usually will not convert, because termcap lacks the ability to -work with more than two parameters, and because termcap lacks many of -the arithmetic/logical operators used in terminfo. -.bP -capabilities with more than one delay or with delays before the end of -the string will not convert completely. +.B sgr +usually does not convert, +because +.I termcap +is unable to work with more than two parameters, +and because +.I termcap 's +language for encoding parameterized capabilities +lacks many of +.IR \%term\%info 's +arithmetic and logical operators. .RE .TP -\fB\-c\fP -tells \fB@TIC@\fP to only check \fIfile\fP for errors, -including syntax problems and bad use-links. -If you specify \fB\-C\fP (\fB\-I\fP) with this option, the code -will print warnings about entries which, after use resolution, are more than -1023 (4096) bytes long. -Due to a fixed buffer length in older termcap libraries, -as well as buggy checking for the buffer length -(and a documented limit in terminfo), -these entries may cause core -dumps with other implementations. +.B \-c +tells +.B \%@TIC@ +to perform only validation of +.I file "," +including syntax problems and invalid +.RB \*(`` use \*('' +references; +no output is produced. +If you specify +.B \-C +.RB ( \-I ) +with this option, +.B \%@TIC@ +warns about entries that, +after +.RB \*(`` use \*('' +resolution, +exceed 1023 (4096) bytes. +Due to a fixed buffer length in older +.I termcap +libraries, +as well as buggy checking of the buffer length +(and a documented limit in +.IR \%term\%info ), +these entries may cause core dumps +with other implementations. .IP -\fB@TIC@\fP checks string capabilities to ensure that those with parameters -will be valid expressions. -It does this check only for the predefined string capabilities; -those which are defined with the \fB\-x\fP option are ignored. +.B \%@TIC@ +checks string capabilities +to ensure that those with parameters are valid expressions. +It validates only standard string capabilities, +ignoring those defined with the +.B \-x +option. .TP \fB\-D\fP -tells \fB@TIC@\fP to print the database locations that it knows about, and exit. +tells +.B \%@TIC@ +to print the database locations that it knows about, and exit. The first location shown is the one to which it would write compiled terminal descriptions. -If \fB@TIC@\fP is not able to find a writable database location +If +.B \%@TIC@ +is not able to find a writable database location according to the rules summarized above, it will print a diagnostic and exit with an error rather than printing a list of database locations. @@ -223,7 +348,9 @@ the list, the entry will be written or translated as normal. Otherwise no output will be generated for it. The option value is interpreted as a file containing the list if it contains a '/'. -(Note: depending on how @TIC@ was compiled, +(Note: depending on how +.B \%@TIC@ +was compiled, this option may require \fB\-I\fP or \fB\-C\fP.) .TP \fB\-f\fP @@ -321,12 +448,16 @@ This is mainly useful for testing and analysis, since the compiled descriptions are limited (e.g., 1023 for termcap, 4096 for terminfo). .TP \fB\-t\fP -tells \fB@TIC@\fP to discard commented-out capabilities. +tells +.B \%@TIC@ +to discard commented-out capabilities. Normally when translating from terminfo to termcap, untranslatable capabilities are commented-out. .TP \fB\-U\fP -tells \fB@TIC@\fP to not post-process the data after parsing the source file. +tells +.B \%@TIC@ +to not post-process the data after parsing the source file. Normally, it infers data which is commonly missing in older terminfo data, or in termcaps. .TP @@ -336,7 +467,9 @@ and exits. .TP \fB\-v\fIn\fR specifies that (verbose) output be written to standard error trace -information showing \fB@TIC@\fP's progress. +information showing +.BR \%@TIC@ 's +progress. .IP The optional parameter \fIn\fP is a number from 1 to 9, inclusive, indicating the desired level of detail of information. @@ -397,43 +530,91 @@ If it is omitted, it defaults to 60. .TP \fB\-x\fP Treat unknown capabilities as user-defined (see \fBuser_caps\fP(5)). -That is, if you supply a capability name which \fB@TIC@\fP does not recognize, +That is, if you supply a capability name which +.B \%@TIC@ +does not recognize, it will infer its type (Boolean, number or string) from the syntax and make an extended table entry for that. User-defined capability strings whose name begins with \*(``k\*('' are treated as function keys. .SS Parameters .TP -\fIfile\fP -contains one or more \fBterminfo\fP terminal descriptions in source -format [see \fBterminfo\fP(5)]. +.I file +contains one or more +.I \%term\%info +terminal descriptions in source format; see \fBterminfo\fP(5). Each description in the file -describes the capabilities of a particular terminal. +describes the capabilities of a particular terminal type. .IP -If \fIfile\fP is \*(``-\*('', then the data is read from the standard input. -The \fIfile\fP parameter may also be the path of a character-device. +If +.I file +is \*(``\-\*('', +the data are read from the standard input stream. +The +.I file +parameter may also be the path of a character device. .SS Processing -All but one of the capabilities recognized by \fB@TIC@\fP are documented -in \fBterminfo\fP(5). -The exception is the \fBuse\fP capability. +\fBterminfo\fP(5) documents all but one of the capabilities +recognized by +.BR \%@TIC@ "." +The exception is the +.B use +capability, +which enables a terminal type description to incorporate others +by reference. .PP -When a \fBuse\fP=\fIentry\fP\-\fIname\fP field is discovered in a -terminal entry currently being compiled, \fB@TIC@\fP reads in the binary -from \fB\*d\fP to complete the entry. -(Entries created from -\fIfile\fP will be used first. -\fB@TIC@\fP duplicates the capabilities in -\fIentry\fP\-\fIname\fP for the current entry, with the exception of -those capabilities that explicitly are defined in the current entry. +.B \%@TIC@ +serially reads and compiles terminal type descriptions; +at any given time, +the program compiles at most one +.I current +entry. +.\" That is, tic doesn't recursively compile entries to resolve "use=". +When +.B \%@TIC@ +encounters a +.BI use= entry-name +field in the current entry, +it reads the compiled description of +.I entry-name +from +.I \%@TERMINFO@ +to complete the current entry. +If +.B \%@TIC@ +has already compiled a description of +.I entry-name +preceding the current entry in +.IR file "," +.B \%@TIC@ +uses it preferentially. +.\" XXX: Check this--tic doesn't read ahead in or index the input file, +.\" does it? Otherwise this feature would break when reading from a +.\" pipe. --GBR +.B \%@TIC@ +duplicates the capabilities in +.I entry-name +for the current entry, +excepting those that the current entry explicitly defines. +The foregoing has implications for capability cancellation. +When +.I entry-1 +declares +.RB \*(`` use=\c +.IR entry-2 \*(``, +any canceled capabilities in +.I entry-2 +must also appear in +.I entry-1 +prior to +.RB \*(`` use=\c +.IR entry-2 \*(`` +for these capabilities to be canceled in +.IR entry-1 "." .PP -When an entry, e.g., \fBentry_name_1\fP, contains a -\fBuse=\fIentry\fR_\fIname\fR_\fI2\fR field, any canceled -capabilities in \fIentry\fR_\fIname\fR_\fI2\fP must also appear in -\fBentry_name_1\fP before \fBuse=\fP for these capabilities to be -canceled in \fBentry_name_1\fP. -.PP -Total compiled entries cannot exceed -4096 bytes in the legacy storage format, or +Compiled entries cannot exceed +4096 bytes in the legacy storage format, +or 32768 using the extended number format. The name field cannot exceed 512 bytes. @@ -443,90 +624,148 @@ will be truncated to the maximum alias length and a warning message will be printed. .SH FILES .TP -.I \*d +.I @TERMINFO@ compiled terminal description database .SH NOTES -There is some evidence that historic \fB@TIC@\fP implementations treated +There is some evidence that historic +.B \%@TIC@ +implementations treated description fields with no whitespace in them as additional aliases or short names. -This \fB@TIC@\fP does not do that, but it does warn when +This +.B \%@TIC@ +does not do that, but it does warn when description fields may be treated that way and check them for dangerous characters. .SH EXTENSIONS -Unlike the SVr4 \fB@TIC@\fP command, this implementation can actually -compile termcap sources. -In fact, entries in terminfo and termcap syntax can -be mixed in a single source file. +Unlike the SVr4 +.I tic +command, +.I \%ncurses +.I tic +can compile +.I termcap +sources. +In fact, +entries in +.I \%term\%info +and +.I termcap +syntax can be mixed in a single source file. See \fBterminfo\fP(5) for the list of -termcap names taken to be equivalent to terminfo names. +.I termcap +capability names +.I \%ncurses +.B \%@TIC@ +treats as equivalent to +.I \%term\%info +names. .PP -The SVr4 manual pages are not clear on the resolution rules for \fBuse\fP +The SVr4 man pages are not clear on the resolution rules for +.RB \*(`` use \*('' capabilities. -This implementation of \fB@TIC@\fP will find \fBuse\fP targets anywhere -in the source file, -or anywhere in the file tree rooted at -\fI\%TERMINFO\fP +.IR ncurses 's +.B \%@TIC@ +finds +.RB \*(`` use \*('' +targets anywhere in the source file, +or anywhere in the file tree rooted at the location in the +.I \%TERMINFO +environment variable (if -\fI\%TERMINFO\fP is defined), -or in the user's \fI$HOME/.terminfo\fP database +.I \%TERMINFO +is defined), +or in the user's +.I \%$HOME/.terminfo +database (if it exists), -or (finally) anywhere in the system's file tree of -compiled entries. +or (finally) anywhere in the system's collection of compiled entries. .PP -The error messages from this \fB@TIC@\fP have the same format as GNU C -error messages, and can be parsed by GNU Emacs's compile facility. +The error messages from +.I \%ncurses +.B \%@TIC@ +have the same format as GNU C error messages, +and can be parsed by GNU Emacs's \*(``compile\*('' facility. .PP -Aside from \fB\-c\fP and \fB\-v\fP, options are not portable: +Aside from +.B \-c +and +.BR \-v "," +options are not portable. .bP -Most of @TIC@'s options -are not supported by SVr4 \fBtic\fP: -.sp +Most of +.I \%ncurses +.BR \%@TIC@ 's +options are not supported by SVr4 +.IR tic "." +.PP .RS -\fB\-0\fP -\fB\-1\fP -\fB\-C\fP -\fB\-G\fP -\fB\-I\fP -\fB\-N\fP -\fB\-R\fP -\fB\-T\fP -\fB\-V\fP -\fB\-a\fP -\fB\-e\fP -\fB\-f\fP -\fB\-g\fP -\fB\-o\fP -\fB\-r\fP -\fB\-s\fP -\fB\-t\fP -\fB\-x\fP +.B \-0 +.B \-1 +.B \-C +.B \-G +.B \-I +.B \-N +.B \-R +.B \-T +.B \-V +.B \-a +.B \-e +.B \-f +.B \-g +.B \-o +.B \-r +.B \-s +.B \-t +.B \-x .RE .bP -The NetBSD \fBtic\fP supports a few of the \fI\%ncurses\fP options -.sp +NetBSD +.I tic +supports a few of the +.I \%ncurses +.B \%@TIC@ +options. +.PP .RS -\fB\-a\fP -\fB\-o\fP -\fB\-x\fP +.B \-a +.B \-o +.B \-x .RE -.IP -and adds \fB\-S\fP -(a feature which does the same thing -as @INFOCMP@'s \fB\-e\fP and \fB\-E\fP options). +.bP +NetBSD +.I tic +also adds +.BR \-S "," +a feature which does the same thing as +.I \%ncurses +.BR \%@INFOCMP@ 's +.B \-e +and +.B \-E +options. .PP -The SVr4 \fB\-c\fP mode does not report bad \*(``use=\*('' links. +SVr4 +.IR tic 's +.B \-c +mode does not report bad +.RB \*(`` use \*('' +links. .PP -System V does not compile entries to or read entries from your -\fI$HOME/.terminfo\fP database unless \fI\%TERMINFO\fP is explicitly set -to it. +SVr4 does not compile entries to +or read entries from your +.I \%$HOME/.terminfo +database unless the +.I \%TERMINFO +environment variable is explicitly set to it. .SH PORTABILITY -X/Open Curses, Issue 7 (2009) provides a brief description of \fBtic\fP. +X/Open Curses Issue\ 7 (2009) provides a brief description of \fBtic\fP. It lists one option: \fB\-c\fP. The omission of \fB\-v\fP is unexpected. The change history states that the description is derived from Tru64. According to its manual pages, that system also supported the \fB\-v\fP option. .PP -Shortly after Issue 7 was released, Tru64 was discontinued. +Shortly after Issue\ 7 was released, Tru64 was discontinued. As of 2019, the surviving implementations of \fBtic\fP are SVr4 (AIX, HP-UX and Solaris), \fI\%ncurses\fP @@ -547,7 +786,7 @@ System V Release 2 provided a \fBtic\fP utility. It accepted a single option: \fB\-v\fP (optionally followed by a number). According to Ross Ridge's comment in \fImytinfo\fP, this version of \fBtic\fP was -unable to represent cancelled capabilities. +unable to represent canceled capabilities. .PP System V Release 3 provided a different \fBtic\fP utility, written by Pavel Curtis, @@ -583,28 +822,43 @@ to support user-defined capabilities. In 2010, Roy Marples provided a \fBtic\fP program and terminfo library for NetBSD. That implementation adapts several features from \fI\%ncurses\fP, -including \fB@TIC@\fP's \fB\-x\fP option. +including +.BR \%@TIC@ 's +\fB\-x\fP option. .PP -The \fB\-c\fP option tells \fB@TIC@\fP to check for problems in the +The \fB\-c\fP option tells +.B \%@TIC@ +to check for problems in the terminfo source file. Continued development provides additional checks: .bP -\fIpcurses\fP had 8 warnings +.I pcurses +had 8 warnings. .bP -\fI\%ncurses\fP in 1996 had 16 warnings +.I \%ncurses +in 1996 had 16 warnings. .bP -Solaris (SVr4) curses has 28 warnings +Solaris (SVr4) +.I curses +has 28 warnings. .bP -NetBSD tic in 2019 has 19 warnings. +NetBSD +.I tic +in 2019 has 19 warnings. .bP -\fI\%ncurses\fP in 2019 has 96 warnings +.I \%ncurses +in 2019 has 96 warnings. .PP -The checking done in \fI\%ncurses\fP' \fB@TIC@\fP helps with the +The checking done in +.IR \%ncurses 's +.B \%@TIC@ +helps with the conversion to termcap, as well as pointing out errors and inconsistencies. It is also used to ensure consistency with the user-defined capabilities. -There are 527 distinct capabilities in \fI\%ncurses\fP' terminal -database; +There are 527 distinct capabilities in +.IR \%ncurses 's +terminal database; 128 of those are user-defined. .SH AUTHORS Eric S. Raymond <esr@snark.thyrsus.com> diff --git a/man/toe.1m b/man/toe.1m index c4eba848e06b..4f92ec021976 100644 --- a/man/toe.1m +++ b/man/toe.1m @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright 2019-2023,2024 Thomas E. Dickey * +.\" Copyright 2019-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: toe.1m,v 1.68 2024/04/20 18:59:26 tom Exp $ -.TH @TOE@ 1M 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" +.\" $Id: toe.1m,v 1.75 2025/11/12 01:06:36 tom Exp $ +.TH @TOE@ 1M 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -50,7 +50,6 @@ .ie n .IP \(bu 4 .el .IP \(bu 2 .. -.ds d @TERMINFO@ .SH NAME \fB\%@TOE@\fP \- list table of entries of \fIterminfo\fR terminal types @@ -99,7 +98,7 @@ Without the \fB\-s\fP option, \fB\%@TOE@\fP does not attempt to merge duplicates in its report. .TP .B \-h -writes a heading naming each each directory as it is accessed. +writes a heading naming each directory as it is accessed. .TP .B \-s sorts the output by the entry names. @@ -143,7 +142,7 @@ reports the version of \fI\%ncurses\fP associated with this program and exits with a successful status. .SH FILES .TP -.I \*d +.I @TERMINFO@ compiled terminal description database .SH PORTABILITY \fB\%@TOE@\fP is not provided by other implementations. @@ -172,7 +171,7 @@ terminal database directories named in the \fI\%TERMINFO\fP and .\" toe -a | grep -E '^(xterm|vt)' .ft \*(CW .TS -L2 Lx. +L2 Lw(32n)x. xterm\-color generic color xterm xterm\-xfree86 xterm terminal emulator (XFree86) xterm\-vt220 xterm emulating vt220 @@ -181,7 +180,7 @@ xterm\-r6 xterm X11R6 version xterm\-r5 xterm R5 version xterm\-mono monochrome xterm xterm T{ -.ad l +.na xterm terminal emulator (X Window System) T} vt220 dec vt220 @@ -202,19 +201,19 @@ terminal description was found. .\" toe -as | grep -E '(^-+>|:.(xterm|vt))' .ft \*(CW .TS -Lx. +Lw(31n)x. \-\-> /etc/terminfo \-\-\-\-> /lib/terminfo \-\-\-\-\-\-> /usr/share/terminfo .TE .TS -L1 L2 Lx. +L1 L2 Lw(31n)x. \-\-*\-\-\-: vt100 dec vt100 (w/advanced video) \-\-*\-\-\-: vt102 dec vt102 \-\-*\-\-\-: vt220 dec vt220 \-\-*\-\-\-: vt52 dec vt52 \-\-*\-\-\-: xterm T{ -.ad l +.na xterm terminal emulator (X Window System) T} \-\-*\-\-\-: xterm\-256color xterm with 256 colors @@ -224,7 +223,7 @@ T} \-\-*\-\-\-: xterm\-r6 xterm X11R6 version \-\-*\-\-\-: xterm\-vt220 xterm emulating vt220 \-\-*\-\-\-: xterm\-xfree86 T{ -.ad l +.na xterm terminal emulator (XFree86) T} .T& diff --git a/man/tput.1 b/man/tput.1 index eba073390df5..f27a529c29e3 100644 --- a/man/tput.1 +++ b/man/tput.1 @@ -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,44 +28,44 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: tput.1,v 1.113 2024/04/20 19:58:50 tom Exp $ -.TH @TPUT@ 1 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" +.\" $Id: tput.1,v 1.149 2025/11/12 01:05:03 tom Exp $ +.TH @TPUT@ 1 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq .\} .el \{\ .ie t .ds `` `` -.el .ds `` "" +.el .ds `` ""\" cannot be used in quoted macro argument w/ AT&T troff .ie t .ds '' '' -.el .ds '' "" +.el .ds '' ""\" cannot be used in quoted macro argument w/ AT&T troff .\} . .de bP .ie n .IP \(bu 4 .el .IP \(bu 2 .. -.ds d @TERMINFO@ .SH NAME \fB\%@TPUT@\fP \- initialize a terminal, exercise its capabilities, or query \fI\%term\%info\fP database .SH SYNOPSIS -\fB@TPUT@\fP [\fB\-T\fP \fIterminal-type\fP] +\fB@TPUT@\fP [\fB\-v\fP] [\fB\-T\fP \fIterminal-type\fP] {\fIcap-code\fP [\fIparameter\fP .\|.\|.\&]} .\|.\|. .PP -\fB@TPUT@\fP [\fB\-T\fP \fIterminal-type\fP] [\fB\-x\fP] \fBclear\fP +\fB@TPUT@\fP [\fB\-v\fP] [\fB\-T\fP \fIterminal-type\fP] [\fB\-x\fP] \fBclear\fP .PP -\fB@TPUT@\fP [\fB\-T\fP \fIterminal-type\fP] \fBinit\fP +\fB@TPUT@\fP [\fB\-v\fP] [\fB\-T\fP \fIterminal-type\fP] \fBinit\fP .PP -\fB@TPUT@\fP [\fB\-T\fP \fIterminal-type\fP] \fB\%reset\fP +\fB@TPUT@\fP [\fB\-v\fP] [\fB\-T\fP \fIterminal-type\fP] \fB\%reset\fP .PP -\fB@TPUT@\fP [\fB\-T\fP \fIterminal-type\fP] \fB\%longname\fP +\fB@TPUT@\fP [\fB\-v\fP] [\fB\-T\fP \fIterminal-type\fP] \fB\%longname\fP .PP -\fB@TPUT@ \-S\fP +\fB@TPUT@\fP [\fB\-v\fP] \fB\-S\fP .PP -\fB@TPUT@ \-V\fP +\fB@TPUT@\fP [\fB\-v\fP] \fB\-V\fP .SH DESCRIPTION -\fB\%@TPUT@\fP uses the +.B \%@TPUT@ +uses the .I \%term\%info library and database to make terminal-specific capabilities and information available to the shell, @@ -75,26 +75,30 @@ to report a description of the current (or specified) terminal type. Terminal capabilities are accessed by -.IR cap-code . +.IR cap-code "." .PP \fB\%terminfo\fP(5) discusses terminal capabilities at length -and presents a complete list of -.IR cap-codes . +and presents a complete list of standardized +.IR cap-codes "." +\fB\%user_caps\fP(5) presents other widely used +but non-standard capabilities. .PP When retrieving capability values, the result depends upon the capability's type. .TP 9 \" "Boolean" + 2n Boolean -\fB\%@TPUT@\fP sets its exit status to +.B \%@TPUT@ +sets its exit status to .B 0 if the terminal possesses -.IR cap-code , +.IR cap-code "," and .B 1 if it does not. .TP numeric -\fB\%@TPUT@\fP writes +.B \%@TPUT@ +writes .IR cap-code 's decimal value to the standard output stream if defined .RB ( \-1 @@ -102,26 +106,30 @@ if it is not) followed by a newline. .TP string -\fB\%@TPUT@\fP writes +.B \%@TPUT@ +writes .IR cap-code 's value to the standard output stream if defined, without a trailing newline. .PP Before using a value returned on the standard output, -the application should test \fB\%@TPUT@\fP's exit status +the application should test +.BR \%@TPUT@ 's +exit status to be sure it is 0; see section \*(``EXIT STATUS\*('' below. .SS Operands Generally, an operand is a -.IR cap-code , +.IR cap-code "," a capability code from the terminal database, or a parameter thereto. -Three others are specially recognized by \fB\%@TPUT@\fP: -.BR init , -.BR \%reset , +Three others are specially recognized by +.BR \%@TPUT@ ":" +.BR init "," +.BR \%reset "," and -.BR \%longname . +.BR \%longname "." Although these resemble capability codes, they in fact receive special handling; we term them \*(``pseudo-capabilities\*(''. @@ -132,18 +140,23 @@ indicates a capability from the terminal database. If .I cap-code is of string type and takes parameters, -\fB\%@TPUT@\fP interprets arguments following +.B \%@TPUT@ +interprets arguments following .I cap-code as the parameters, up to the (fixed) quantity the capability requires. .IP Most parameters are numeric. Only a few terminal capabilities require string parameters; -\fB\%@TPUT@\fP uses a table to decide which to pass as strings. -Normally \fB\%@TPUT@\fP uses \fB\%tparm\fP(3X) to perform the +.B \%@TPUT@ +uses a table to decide which to pass as strings. +Normally +.B \%@TPUT@ +uses \fB\%tparm\fP(3X) to perform the substitution. If no parameters are given for the capability, -\fB\%@TPUT@\fP writes the string without performing the substitution. +.B \%@TPUT@ +writes the string without performing the substitution. .TP .B init initializes the terminal. @@ -153,7 +166,8 @@ the following occur. .RS .TP 5 (1) -\fB\%@TPUT@\fP retrieves the terminal's mode settings. +.B \%@TPUT@ +retrieves the terminal's mode settings. It successively tests the file descriptors corresponding to .RS .bP @@ -169,22 +183,20 @@ and .IP to obtain terminal settings. Having retrieved them, -\fB\%@TPUT@\fP remembers which descriptor to use for further updates. +.B \%@TPUT@ +remembers which descriptor to use for further updates. .TP (2) If the terminal dimensions cannot be obtained from the operating system, but the environment or terminal type database entry describes them, -\fB\%@TPUT@\fP updates the operating system's notion of them. +.B \%@TPUT@ +updates the operating system's notion of them. .TP (3) -\fB\%@TPUT@\fP updates the terminal modes. +.B \%@TPUT@ +updates the terminal modes. .RS .bP -Any delays specified in the entry -(for example, -when a newline is sent) -are set in the terminal driver. -.bP Tab expansion is turned on or off per the specification in the entry, and .bP @@ -199,10 +211,12 @@ If initialization capabilities, detailed in subsection \*(``Tabs and Initialization\*('' of \fB\%terminfo\fP(5), are present, -\fB\%@TPUT@\fP writes them to the standard output stream. +.B \%@TPUT@ +writes them to the standard output stream. .TP (5) -\fB\%@TPUT@\fP flushes the standard output stream. +.B \%@TPUT@ +flushes the standard output stream. .RE .IP If an entry lacks the information needed for an activity above, @@ -214,24 +228,27 @@ A reset differs from initialization in two ways. .RS .TP 5 (1) -\fB\%@TPUT@\fP sets the the terminal modes to a \*(``sane\*('' state, +.B \%@TPUT@ +sets the terminal modes to a \*(``sane\*('' state, .RS .bP -enabling cooked and echo modes, +enabling canonical (\*(``cooked\*('') and echo modes, .bP disabling cbreak and raw modes, .bP enabling newline translation, and .bP -setting any unset special characters to their default values. +setting any special input characters to their default values. .RE .TP 5 (2) If any reset capabilities are defined for the terminal type, -\fB\%@TPUT@\fP writes them to the output stream. +.B \%@TPUT@ +writes them to the output stream. Otherwise, -\fB\%@TPUT@\fP uses any defined initialization capabilities. +.B \%@TPUT@ +uses any defined initialization capabilities. Reset capabilities are detailed in subsection \*(``Tabs and Initialization\*('' of \fB\%terminfo\fP(5). .RE @@ -246,7 +263,8 @@ The names are separated by \*(``|\*('' characters. X/Open Curses terms the last name the \*(``long name\*('', and indicates that it may include blanks. .IP -\fB\%@TIC@\fP warns if the last name does not include blanks, +.B \%@TIC@ +warns if the last name does not include blanks, to accommodate old .I \%term\%info entries that treated the long name as an optional feature. @@ -254,37 +272,48 @@ The long name is often referred to as the description field. .IP If the terminal database is present and an entry for the user's terminal type exists, -\fB\%@TPUT@\fP reports its description to the standard output stream, +.B \%@TPUT@ +reports its description to the standard output stream, without a trailing newline. See \fB\%terminfo\fP(5). .PP .I Note: Redirecting the output of -.RB \%\*(`` "@TPUT@ init" \*('' +\*(``\c +.B "@TPUT@ init\c" +\*('' or -.RB \%\*(`` "@TPUT@ reset" \*('' +\*(``\c +.B "@TPUT@ reset\c" +\*('' to a file will capture only part of their actions. Changes to the terminal modes are not affected by file descriptor redirection, -since the terminal modes are altered via \fB\%ioctl\fP(2). +since the terminal modes are altered via \fI\%ioctl\fP(2). .SS Aliases -If \fB\%@TPUT@\fP is invoked via link with any of the names -.BR clear , -.BR init , +If +.B \%@TPUT@ +is invoked via link with any of the names +.BR clear "," +.BR init "," or -.BR \%reset , +.BR \%reset "," it operates as if run with the corresponding (pseudo-)capability operand. For example, executing a link named .B \%reset -that points to \fB\%@TPUT@\fP has the same effect as -.RB \%\*(`` "@TPUT@ \%reset" \*(''. +that points to +.B \%@TPUT@ +has the same effect as +\%\*(``\c +.B "@TPUT@ \%reset\c" +\*(''. .PP This feature was introduced by .I \%ncurses 5.2 in 2000. -It is rarely used: +It is rarely used. .TP .B \%clear is a separate program, @@ -296,12 +325,13 @@ has the same name as another program in widespread use. .B \%reset is provided by the \fB\%@TSET@\fP(1) utility (also via a link named -.BR \%reset ")." +.BR \%reset ). .SS "Terminal Size" Besides the pseudo-capabilities (such as .BR init ), -\fB\%@TPUT@\fP treats the +.B \%@TPUT@ +treats the .B lines and .B cols @@ -310,7 +340,8 @@ specially: it may call \fB\%setupterm\fP(3X) to obtain the terminal size. .bP First, -\fB\%@TPUT@\fP attempts to obtain these capabilities from the terminal +.B \%@TPUT@ +attempts to obtain these capabilities from the terminal database. This generally fails for terminal emulators, which lack a fixed window size and thus omit the capabilities. @@ -324,14 +355,15 @@ Finally, it inspects the environment variables .I LINES and -.IR \%COLUMNS , +.IR \%COLUMNS "," which may override the terminal size. .PP If the .B \-T option is given, -\fB\%@TPUT@\fP ignores the environment variables by calling -.BR \%use_tioctl(TRUE) , +.B \%@TPUT@ +ignores the environment variables by calling +.BR \%use_tioctl(TRUE) "," relying upon the operating system (or, ultimately, @@ -339,8 +371,11 @@ the terminal database). .SH OPTIONS .TP 9n \" "-T type" + 2n .B \-S -retrieves more than one capability per invocation of \fB\%@TPUT@\fP. -The capabilities must be passed to \fB\%@TPUT@\fP from the standard +retrieves more than one capability per invocation of +.BR \%@TPUT@ "." +The capabilities must be passed to +.B \%@TPUT@ +from the standard input stream instead of from the command line (see section \*(``EXAMPLES\*('' below). Only one @@ -356,13 +391,14 @@ exit statuses (see section \*(``EXIT STATUS\*('' below). .IP Some capabilities use string parameters rather than numeric ones. -\fB\%@TPUT@\fP employs a built-in table and the presence of parameters +.B \%@TPUT@ +employs a built-in table and the presence of parameters in its input to decide how to interpret them, and whether to use \fB\%tparm\fP(3X). .TP .BI \-T\ type indicates the terminal's -.IR type . +.IR type "." Normally this option is unnecessary, because a default is taken from the .I TERM @@ -374,19 +410,30 @@ and .I \%COLUMNS are also ignored. .TP +.B \-v +causes +.B \%@TPUT@ +to operate verbosely, +reporting warnings. +.TP .B \-V reports the version of .I \%ncurses -associated with \fB\%@TPUT@\fP, +associated with +.BR \%@TPUT@ "," and exits with a successful status. .TP .B \-x prevents -.RB \%\*(`` "@TPUT@ clear" \*('' +\%\*(``\c +.B "@TPUT@ clear\c" +\*('' from attempting to clear the scrollback buffer. .SH EXIT STATUS Normally, -one should interpret \fB\%@TPUT@\fP's exit statuses as follows. +one should interpret +.BR \%@TPUT@ "'s" +exit statuses as follows. .PP .if n .ne 3 .if t .ne 2 @@ -420,30 +467,37 @@ _ 4 some operands not interpreted .TE .SH ENVIRONMENT -\fB@TPUT@\fP reads one environment variable. -.TP 8n \" "TERM" + 2n + adjustment for PDF +.B \%@TPUT@ +reads up to three environment variables +if the +.B \-T +option is not specified. +.TP 9n \" "COLUMNS" + 2n +.I COLUMNS +specifies the width of the screen in characters. +.TP +.I LINES +specifies the height of the screen in characters. +.TP .I TERM denotes the terminal type. Each terminal type is distinct, though many are similar. -The -.B \-T -option overrides its value. .SH FILES .TP .I @DATADIR@/tabset tab stop initialization database .TP -.I \*d +.I @TERMINFO@ compiled terminal description database .SH PORTABILITY Over time .I \%ncurses -\fB\%@TPUT@\fP +.B \%@TPUT@ has differed from that of System\ V in two important respects, one now mostly historical. .bP -\%\*(``\fB@TPUT@\fP +.RB \%\*(`` @TPUT@ .IR cap-code \*('' writes to the standard output, which need not be a terminal device. @@ -452,16 +506,16 @@ the operands that manipulate terminal modes might not use the standard output. .IP System\ V -.BR tput 's +.IR tput 's .B init and .B \%reset operands use logic from 4.1cBSD -.BR tset , +.IR tset "," manipulating terminal modes. It checks the same file descriptors (and -.IR \%/dev/tty ) +.IR \%/dev/tty ")" for association with a terminal device as .I \%ncurses now does, @@ -474,18 +528,21 @@ Until .I \%ncurses 6.1 (see section \*(``HISTORY\*('' below), -\fB\%@TPUT@\fP did not modify terminal modes. +.B \%@TPUT@ +did not modify terminal modes. It now employs a scheme similar to System\ V, -using functions shared with \fB\%@TSET@\fP +using functions shared with +.B \%@TSET@ (and ultimately based on 4.4BSD -.BR tset ). +.IR tset ). If it is not able to open a terminal (for instance, when run by \fIcron\fP(1)), -\fB\%@TPUT@\fP exits with an error status. +.B \%@TPUT@ +exits with an error status. .bP System\ V -.B tput +.I tput assumes that the type of a .I cap-code operand is numeric if all the characters of its value are decimal @@ -499,10 +556,12 @@ Most implementations that provide support for .I cap-code operands use the \fB\%tparm\fP(3X) function to expand its parameters. That function expects a mixture of numeric and string parameters, -requiring \fB\%@TPUT@\fP to know which type to use. +requiring +.B \%@TPUT@ +to know which type to use. .IP .I \%ncurses -\fB\%@TPUT@\fP +.B \%@TPUT@ uses a table to determine the parameter types for the standard .I cap-code @@ -517,9 +576,9 @@ An OpenBSD developer adapted the internal library function from .I \%ncurses to port NetBSD's .IR termcap -based -.B tput +.I tput to -.IR \%term\%info , +.IR \%term\%info "," and modified it to interpret multiple .I cap-codes (and parameters) @@ -528,7 +587,9 @@ Portable applications should not rely upon this feature; .I \%ncurses offers it to support applications written specifically for OpenBSD. .PP -This implementation, +.IR \%ncurses 's +implementation of +.IR tput ","\" generic unlike others, accepts both .I termcap @@ -540,7 +601,6 @@ if support is compiled in. In that case, however, -the predefined .I termcap and .I \%term\%info @@ -561,17 +621,17 @@ to but .B \%parm_delete_line to -.IR \%term\%info . +.IR \%term\%info "." .I termcap uses the code .B DL for -.BR \%parm_delete_line . +.BR \%parm_delete_line "." .I \%term\%info uses the code .B dl1 for -.BR \%delete_line . +.BR \%delete_line "." .bP The .I cap-code @@ -583,17 +643,17 @@ to but .B \%clr_eos to -.IR \%term\%info . +.IR \%term\%info "." .I termcap uses the code .B cd for -.BR \%clr_eos . +.BR \%clr_eos "." .I \%term\%info uses the code .B rmdc for -.BR \%exit_delete_mode . +.BR \%exit_delete_mode "." .PP The .B \%longname @@ -609,16 +669,16 @@ AT&T/USL before SVr4 (1989). Later, 4.3BSD-Reno (1990) added support for -.BR \%longname , +.BR \%longname "," .\" longname was added in October 1989. and in 1994, NetBSD added support for the parameter-substitution features. .PP -IEEE Std 1003.1/The Open Group Base Specifications Issue 7 +IEEE Std 1003.1/The Open Group Base Specifications Issue\ 7 (POSIX.1-2008) documents only the -.BR clear , -.BR init , +.BR clear "," +.BR init "," and .B \%reset operands. @@ -628,15 +688,15 @@ A few observations of interest arise from that selection. supports .B clear as it does any other standard -.IR cap-code . +.IR cap-code "." The others .RB ( init and -.BR \%longname ) +.BR \%longname ")" do not correspond to terminal capabilities. .bP The -.B tput +.I tput on SVr4-based systems such as Solaris, IRIX64, and HP-UX, @@ -650,11 +710,11 @@ A few platforms such as FreeBSD recognize codes rather than .I \%term\%info capability codes in their respective -.B tput +.I tput commands. Since 2010, NetBSD's -.B tput +.I tput uses .I \%term\%info codes. @@ -668,7 +728,7 @@ codes. Beginning in 2021, FreeBSD uses .I \%ncurses -.BR tput , +.BR tput "," configured for both .I \%term\%info (tested first) @@ -681,7 +741,7 @@ Because (apparently) all Unix systems support the full set of capability codes, the reason for documenting only a few may not be apparent. .bP -X/Open Curses Issue 7 documents +X/Open Curses Issue\ 7 documents .B tput differently, with @@ -690,23 +750,23 @@ and the other features used in this implementation. .bP That is, there are two standards for -.BR tput : +.IR tput ":" POSIX (a subset) and X/Open Curses (the full implementation). POSIX documents a subset to avoid the complication of including X/Open Curses and the terminal capability database. .bP While it is certainly possible to write a -.B tput +.I tput program without using -.IR curses , +.IR curses "," no system with a .I curses implementation provides a -.B tput +.I tput utility that does not also support standard -.IR cap-codes . +.IR cap-codes "." .PP -X/Open Curses Issue 7 (2009) is the first version to document utilities. +X/Open Curses Issue\ 7 (2009) is the first version to document utilities. However that part of X/Open Curses does not follow existing practice (that is, System\ V @@ -727,14 +787,14 @@ in the database. That likely is a documentation error, mistaking the \*(``\-1\*('' written to the standard output to indicate -an absent or cancelled numeric capability for an (unsigned) exit status. +an absent or canceled numeric capability for an (unsigned) exit status. .PP The various System\ V implementations (AIX, HP-UX, Solaris) use the same exit statuses as -.IR \%ncurses . +.IR \%ncurses "." .PP NetBSD .I curses @@ -743,7 +803,7 @@ documents exit statuses that correspond to neither nor X/Open Curses. .SH HISTORY Bill Joy wrote a -.B tput +.I tput command during development of 4BSD in October 1980. This initial version only cleared the screen, and did not ship with official distributions. @@ -753,15 +813,15 @@ and did not ship with official distributions. .\" See Spinellis's "unix-history-repo" on GitHub. .PP System\ V developed a different -.B tput +.I tput command. .bP SVr2 (1984) provided a rudimentary -.B tput +.I tput that checked the parameter against each -predefined capability and returned the corresponding value. +capability name and returned the corresponding value. This version of -.B tput +.I tput did not use \fB\%tparm\fP(3X) for parameterized capabilities. .bP SVr3 (1987) replaced that @@ -777,7 +837,7 @@ operands incorporated the .B \%reset feature of BSD -.B tset +.I tset written by Eric Allman. .bP SVr4 (1989) added color initialization by using the @@ -791,19 +851,21 @@ capabilities in its logic. .PP Keith Bostic refactored BSD -.B tput -for shipment in 4.3BSD-Tahoe (1988), -then replaced it the next year with a new implementation based on -System\ V -.BR tput . -Bostic's version similarly accepted some parameters named for +.I tput +for shipment in 4.3BSD-Reno (1990), +making it follow the interface of System\ V +.I tput +.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.3BSD-Reno/src/usr.bin/tput/tput.c +.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=Net2/usr/src/usr.bin/tput/tput.c +.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/src/usr.bin/tput/tput.c +by accepting some parameters named for .I \%term\%info (pseudo-)capabilities: -.BR clear , -.BR init , -.BR \%longname , +.BR clear "," +.BR init "," +.BR \%longname "," and -.BR \%reset . +.BR \%reset "." However, because he had only .I termcap @@ -813,22 +875,22 @@ it accepted codes for other capabilities. Also, Bostic's BSD -.B tput +.I tput did not modify the terminal modes as the earlier BSD -.B tset +.I tset had done. -.PP At the same time, Bostic added a shell script named \*(``clear\*('' that used -.B tput +.I tput to clear the screen. -Both of these appeared in 4.4BSD, -becoming the \*(``modern\*('' BSD implementation of -.BR tput . +.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.3BSD-Reno/src/usr.bin/tput/clear.sh +These became the \*(``modern\*('' BSD implementation of +.IR tput "." .PP The origin of .I \%ncurses -\fB\%@TPUT@\fP lies outside both System\ V and BSD, +.B \%@TPUT@ +lies outside both System\ V and BSD, in Ross Ridge's .I \%mytinfo package, @@ -838,10 +900,10 @@ in December 1992. Ridge's program made more sophisticated use of the terminal capabilities than the BSD program. Eric Raymond used that -.B tput +.I tput program (and other parts of -.IR \%mytinfo ) +.IR \%mytinfo ")" in .I \%ncurses in June 1995. @@ -853,13 +915,19 @@ were handled. Before .I \%ncurses 6.1 (2018), -its \fB\%@TSET@\fP and \fB\%@TPUT@\fP utilities differed. +its +.B \%@TSET@ +and +.B \%@TPUT@ +utilities differed. .bP -\fB\%@TSET@\fP was more effective, -resetting the terminal modes and special characters. +.B \%@TSET@ +was more effective, +resetting the terminal's modes and special input characters. .bP On the other hand, -\fB\%@TSET@\fP's repertoire of terminal capabilities for resetting the +.BR \%@TSET@ "'s" +repertoire of terminal capabilities for resetting the terminal was more limited; it had only equivalents of .B \%reset_1string @@ -869,12 +937,15 @@ it had only equivalents of and .B \%reset_file .RB ( rf ), -and not the tab stop and margin update features of \fB\%@TPUT@\fP. +and not the tab stop and margin update features of +.BR \%@TPUT@ "." .PP The -.B \%reset -program is traditionally an alias for \fB\%@TSET@\fP due to its ability -to reset terminal modes and special characters. +.I \%reset +program is traditionally an alias for +.B \%@TSET@ +due to its ability +to reset the terminal's modes and special input characters. .PP As of .I \%ncurses @@ -882,14 +953,24 @@ As of the \*(``reset\*('' features of the two programs are (mostly) the same. Two minor differences remain. .bP -The \fB\%@TSET@\fP program waits one second when resetting, -in case the terminal happens to be a hardware device. +When issuing a reset, +the +.B \%@TSET@ +program +checks whether the device appears to be a pseudoterminal +(as might be used by a terminal emulator program), +and, +if it does not, +waits one second in case it is communicating with a hardware terminal. .bP The two programs write the terminal initialization strings to different streams; that is, -standard error for \fB\%@TSET@\fP and -standard output for \fB\%@TPUT@\fP. +standard error for +.B \%@TSET@ +and +standard output for +.BR \%@TPUT@ "." .SH EXAMPLES .TP .B "@TPUT@ init" @@ -914,7 +995,7 @@ environment variable. Set cursor to normal visibility. .TP .B "@TPUT@ home" -Move the cursor to row 0, +Move the cursor to line 0, column 0: the upper left corner of the screen, usually known as the \*(``home\*('' cursor position. @@ -935,7 +1016,7 @@ Report the number of columns used by an ADM-3A terminal. Set shell variables to capability values: .B strong and -.BR normal , +.BR normal "," to begin and end, respectively, stand-out mode for the terminal. @@ -951,7 +1032,7 @@ printf "${strong}Username:${normal} " Indicate via exit status whether the terminal is a hard copy device. .TP .B "@TPUT@ cup 23 4" -Move the cursor to row 23, +Move the cursor to line 23, column 4. .TP .B "@TPUT@ cup" @@ -976,11 +1057,13 @@ The option can be profitably used with a shell \*(``here document\*(''. .IP .EX +.nf .RB $\ "@TPUT@ \-S <<!" .RB >\ clear .RB >\ "cup 10 10" .RB >\ bold .RB >\ ! +.fi .EE .IP The foregoing @@ -993,7 +1076,9 @@ mode. .TP .B "@TPUT@ clear cup 10 10 bold" Perform the same actions as the foregoing -.RB \%\*(`` "@TPUT@ \-S" \*('' +\%\*(``\c +.B "@TPUT@ \-S\c" +\*('' example. .SH SEE ALSO \fB\%@CLEAR@\fP(1), @@ -1001,4 +1086,5 @@ example. \fB\%@TABS@\fP(1), \fB\%@TSET@\fP(1), \fB\%curs_termcap\fP(3X), -\fB\%terminfo\fP(5) +\fB\%terminfo\fP(5), +\fB\%user_caps\fP(5) diff --git a/man/tset.1 b/man/tset.1 index 185227dcdb03..3e7b0fc10c73 100644 --- a/man/tset.1 +++ b/man/tset.1 @@ -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: tset.1,v 1.85 2024/04/27 17:57:47 tom Exp $ -.TH @TSET@ 1 2024-04-27 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" +.\" $Id: tset.1,v 1.94 2025/01/19 00:51:54 tom Exp $ +.TH @TSET@ 1 2025-01-18 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "User commands" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -47,7 +47,6 @@ .el .IP \(bu 2 .. . -.ds d @TERMINFO@ .SH NAME \fB\%@TSET@\fP, \fB\%@RESET@\fP \- @@ -124,7 +123,10 @@ the backspace, interrupt and line kill characters unless the \*(``\fB\-I\fP\*('' option is enabled, the terminal and tab \fIinitialization\fP strings are sent to the standard error output, -and \fB@TSET@\fP waits one second (in case a hardware reset was issued). +and, +if the terminal device does not appear to be a pseudoterminal +(as might be used by a terminal emulator program), +\fB@TSET@\fP waits one second in case a hardware reset was issued. .bP Finally, if the erase, interrupt and line kill characters have changed, or are not set to their default values, their values are displayed to the @@ -133,13 +135,13 @@ standard error output. When invoked as \fB@RESET@\fP, \fB@TSET@\fP sets the terminal modes to \*(``sane\*('' values: .bP -sets cooked and echo modes, +sets canonical (\*(``cooked\*('') and echo modes, .bP turns off cbreak and raw modes, .bP turns on newline translation and .bP -resets any unset special characters to their default values +resets special input characters to their default values .PP before doing the terminal initialization described above. @@ -314,12 +316,12 @@ for the terminal description. .I /etc/ttys system port name to terminal type mapping database (BSD versions only). .TP -.I \*d +.I @TERMINFO@ compiled terminal description database directory .SH PORTABILITY -Neither IEEE Std 1003.1/The Open Group Base Specifications Issue 7 +Neither IEEE Std 1003.1/The Open Group Base Specifications Issue\ 7 (POSIX.1-2008) nor -X/Open Curses Issue 7 documents \fB@TSET@\fP or \fB@RESET@\fP. +X/Open Curses Issue\ 7 documents \fB@TSET@\fP or \fB@RESET@\fP. .PP The AT&T \fBtput\fP utility (AIX, HP-UX, Solaris) incorporated the terminal-mode manipulation as well as termcap-based features diff --git a/man/user_caps.5 b/man/user_caps.5 index 219bbf5f9976..e4057737e9cb 100644 --- a/man/user_caps.5 +++ b/man/user_caps.5 @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 2017 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -28,8 +28,8 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: user_caps.5,v 1.49 2024/03/16 15:35:01 tom Exp $ -.TH user_caps 5 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "File formats" +.\" $Id: user_caps.5,v 1.60 2025/11/12 01:01:01 tom Exp $ +.TH user_caps 5 2025-11-11 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "File formats" .ie \n(.g \{\ .ds `` \(lq .ds '' \(rq @@ -47,260 +47,456 @@ .. .SH NAME user_caps \- -user-defined \fIterminfo\fR capability format +user-defined \%\fIterm\%info\fP capability format .SH SYNOPSIS .B @INFOCMP@ \-x .PP .B @TIC@ \-x .SH DESCRIPTION .SS Background -Before \fI\%ncurses\fP 5.0, -terminfo databases used a \fIfixed repertoire\fP of terminal -capabilities designed for the SVr2 terminal database in 1984, -and extended in stages through SVr4 (1989), -and standardized in the Single Unix Specification beginning in 1995. +Prior to +.I \%ncurses +5.0 (1999), +.I \%term\%info +databases used a +.I "fixed repertoire" +of terminal capabilities designed +for the SVr2 terminal database in 1984, +added to in stages through SVr4 (1989), +and standardized in X/Open Curses starting in 1995. +.\" That date is a surmise based on the capability list appearing in +.\" Issue 4, Version 2 (1996). That list is not in man page format in +.\" the standard, so lacks a "HISTORY" section. However, `tigetstr()` +.\" and `tputs()` are identified in the same document as new to Issue 4, +.\" so GBR conjectures that the list came in at the same time. +.\" +.\" TED: the list is reflected in term.h, seen in examples from AIX 3 and 4, +.\" HP-UX 9, OSF/1, Solaris 2.4, dating from 1992-1994 -- all before 1996. +.\" The AIX 4 file has copyright dates starting in 1984; +.\" the Solaris file cites 1988 (the others have no copyright comments). +.\" Those term.h files note in a comment that it is generated by a script with +.\" a data file, i.e., +.\" term.h - this file is automatically made from caps and maketerm.ex. +.\" illumos-gate has related source, with a "caps" file having AT&T copyright +.\" for 1988, and UCB copyright for 1982, 1986, 1988. That 1982 is interesting +.\" (hinting that something may have been in the initial releases of System V) +.\" but the first release with tic appears to be SVr2 in 1984. .PP -Most of the \fIextensions\fP in this fixed repertoire were additions -to the tables of Boolean, numeric and string capabilities. -Rather than change the meaning of an existing capability, a new name was added. -The terminfo database uses a binary format; binary compatibility was -ensured by using a header which gave the number of items in the -tables for each type of capability. -The standardization was incomplete: +Most such additions to this fixed repertoire +suppelmented the tables of Boolean, +numeric, +and string capabilities. +Rather than changing the meaning of an existing capability, +a new name was added. +The +.I \%term\%info +database uses a binary format; +binary compatibility was ensured +by using a header +that counted the number of items in the tables +for each type of capability. +Because each +.I curses +vendor extended the standard capability lists in distinct ways, +a library could be programmed to recognize only compiled +.I \%term\%info +entries that it was prepared to interpret. +Standardization was incomplete. .bP -The \fIbinary format\fP itself is not described -in the X/Open Curses documentation. -Only the \fIsource format\fP is described. +X/Open Curses describes only the +.I source +format, +not its +.I binary +representation on disk. .IP -Library developers rely upon the SVr4 documentation, -and reverse-engineering the compiled terminfo files to match the binary format. +Library developers rely upon SVr4 documentation +and reverse engineering of compiled +.I \%term\%info +files to match the binary format. .bP -Lacking a standard for the binary format, most implementations -copy the SVr2 binary format, which uses 16-bit signed integers, +Lacking a standard for the binary format, +most implementations copy the SVr2 binary format, +which uses 16-bit signed integers, and is limited to 4096-byte entries. .IP -The format cannot represent very large numeric capabilities, -nor can it represent large numbers of special keyboard definitions. +The SVr2 format cannot represent very large numeric capability values, +nor can it represent large numbers of key definitions, +as are required to distinguish multiple modifier keys used +in combination with a function key. .bP The tables of capability names differ between implementations. .IP -Although they \fImay\fP provide all of the standard capability names, -the position in the tables differs because some features were added as needed, -while others were added (out of order) to comply with X/Open Curses. +Although they +.I may +provide all of the standard capability names, +each arranges its table entries differently +because some features were added as needed, +while others were added +\(em out of order \(em +for X/Open Curses conformance. .IP -While \fI\%ncurses\fP' repertoire of predefined capabilities is closest -to Solaris, -Solaris's terminfo database has a few differences from -the list published by X/Open Curses. -For example, -\fI\%ncurses\fP can be configured with tables which match the terminal -databases for AIX, HP-UX or OSF/1, +While +.IR ncurses 's +capability repertoire is closest to that of Solaris, +the set of capabilities supported by +each vendor's +.I \%term\%info +database differs +from the list published by X/Open Curses. +.I \%ncurses +can be configured +with tables that match the terminal databases +for AIX, +HP-UX, +or OSF/1, rather than the default Solaris-like configuration. .bP -In SVr4 curses and \fI\%ncurses\fP, -the terminal database is defined at compile-time using a text file -which lists the different terminal capabilities. +In SVr4 +.I curses +and +.IR \%ncurses "," +the terminal database is defined at compile time +by interpolating a text file +that lists the different terminal capabilities. .IP -In principle, the text-file can be extended, -but doing this requires recompiling and reinstalling the library. -The text-file used in \fI\%ncurses\fP for terminal capabilities includes -details for various systems past the documented X/Open Curses features. -For example, \fI\%ncurses\fP supports these capabilities in each configuration: +In principle, +the text file can be extended, +but doing so requires recompiling and reinstalling the library. +The text file used by +.I \%ncurses +for terminal capabilities includes details of extensions +to X/Open Curses +made by various systems. +For example, +.I \%ncurses +supports the following nonstandard capabilities in each configuration. .RS 8 .TP 5 -memory_lock -(meml) +.B memory_lock +.RB ( meml ) lock memory above cursor .TP 5 -memory_unlock -(memu) +.B memory_unlock +.RB ( memu ) unlock memory .TP 5 -box_chars_1 -(box1) +.B box_chars_1 +.RB ( box1 ) box characters primary set .RE .IP The memory lock/unlock capabilities were included because they were used -in the X11R6 terminal description for \fBxterm\fP(1). -The \fIbox1\fP capability is used in @TIC@ to help with terminal descriptions -written for AIX. +in the X11R6 terminal description for \fIxterm\fP(1). +.B \%@TIC@ +uses the +.B box1 +capability to cope with terminal descriptions written for AIX. .PP -During the 1990s, some users were reluctant to use terminfo -in spite of its performance advantages over termcap: +During the 1990s, +some application developers were reluctant to use +.I \%term\%info +in spite of its performance +(and other) +advantages over +.IR termcap "." .bP -The fixed repertoire prevented users from adding features -for unanticipated terminal improvements +The fixed repertoire prevented users from adding support +for terminal features unanticipated by X/Open Curses (or required them to reuse existing capabilities as a workaround). .bP The limitation to 16-bit signed integers was also mentioned. -Because termcap stores everything as a string, +Because +.I termcap +stores everything as a string, it could represent larger numbers. .PP -Although termcap's extensibility was rarely used -(it was never the \fIspeaker\fP who had actually used the feature), +Although +.IR termcap 's +extensibility was rarely used +\(em the claimant was never an implementor +who had actually exercised it \(em the criticism had a point. -\fI\%ncurses\fP 5.0 provided a way to detect nonstandard capabilities, -determine their -type and optionally store and retrieve them in a way which did not interfere -with other applications. -These are referred to as \fIuser-defined capabilities\fP because no -modifications to the toolset's predefined capability names are needed. +.I \%ncurses +5.0 provided a way to detect nonstandard capabilities, +to determine their type, +and to optionally store and retrieve them +in a way that did not interfere with other applications. +.I ncurses +terms these +.I "user-defined capabilities" +because no modifications +to the standard capability list are needed. .PP -The \fI\%ncurses\fP utilities \fB@TIC@\fP and \fB@INFOCMP@\fP have a -command-line option \*(``\-x\*('' to control whether the nonstandard -capabilities are stored or retrieved. -A library function \fBuse_extended_names\fP -is provided for the same purpose. +The +.I \%ncurses +utilities +.B \%@TIC@ +and +.B \%@INFOCMP@ +have a command-line option \*(``\-x\*('' +to control whether the nonstandard capabilities +are stored or retrieved. +.I \%ncurses +provides \fBuse_extended_names\fP(3X) to programs for the same purpose. .PP -When compiling a terminal database, if \*(``\-x\*('' is set, -\fB@TIC@\fP will store a user-defined capability if the capability name is not -one of the predefined names. +When compiling a terminal database, if \*(``\-x\*('' is used, +.B \%@TIC@ +stores a user-defined capability +if the capability name is not standard. .PP -Because \fI\%ncurses\fP provides a termcap library interface, -these user-defined capabilities may be visible to termcap applications: +Because +.I \%ncurses +provides a +.I termcap +library interface, +these user-defined capabilities may be visible to +.I termcap +applications. .bP -The termcap interface (like all implementations of termcap) -requires that the capability names are 2-characters. +The +.I termcap +interface +(like all implementations of +.IR termcap ) +restricts capability names to two characters. .IP -When the capability is simple enough for use in a termcap application, -it is provided as a 2-character name. +When the capability is simple enough for use in a +.I termcap +application, +it is provided as a two-character name. .bP -There are other -user-defined capabilities which refer to features not usable in termcap, -e.g., parameterized strings that use more than two parameters -or use more than the trivial expression support provided by termcap. -For these, the terminfo database should have only capability names with -3 or more characters. +Other user-defined capabilities employ features not usable in +.IR termcap "," +such as parameterized strings that use more than two parameters +or require more powerful expressions than +.I termcap +supports. +Such capabilities should, +in the +.I \%term\%info +database, +have names at least three characters in length. .bP Some terminals can send distinct strings for special keys (cursor-, keypad- or function-keys) depending on modifier keys (shift, control, etc.). -While terminfo and termcap have a set of 60 predefined function-key names, +While +.I \%term\%info +and +.I termcap +define a set of sixty function key names, to which a series of keys can be assigned, that is insufficient for more than a dozen keys multiplied by more than a couple of modifier combinations. -The \fI\%ncurses\fP database uses a convention based on \fBxterm\fP(1) +The +.I \%ncurses +database uses a convention based on \fIxterm\fP(1) to provide extended special-key names. .IP -Fitting that into termcap's limitation of 2-character names +Fitting that into +.IR termcap 's +limitation of 2-character names would be pointless. -These extended keys are available only with terminfo. +These extended keys are available only with +.IR \%term\%info "." .SS "Recognized Capabilities" -The \fI\%ncurses\fP library uses the user-definable capabilities. -While the terminfo database may have other extensions, -\fI\%ncurses\fP makes explicit checks for these: +The +.I \%ncurses +library employs user-definable capabilities. +While the +.I \%term\%info +database may have other extensions, +.I \%ncurses +makes explicit checks for the following. .RS 3 .TP 3 -AX -\fIBoolean\fP, asserts that the terminal interprets SGR 39 and SGR 49 -by resetting the foreground and background color, respectively, to the default. +.B AX +(Boolean) +asserts that the terminal interprets SGR 39 and SGR 49 +by resetting the foreground and background colors, +respectively, +to the default. .IP -This is a feature recognized by the \fBscreen\fP program as well. +\fBscreen\fP(1) +recognizes this capability as well. .TP 3 -E3 -\fIstring\fP, tells how to clear the terminal's scrollback buffer. -When present, the \fBclear\fP(1) program sends this before clearing -the terminal. +.B E3 +(string) +tells an application how to clear the terminal's scrollback buffer. +When present, +the \fBclear\fP(1) program sends this before clearing the terminal. .IP -The command \*(``\fBtput clear\fP\*('' does the same thing. +The command +.RB \*(`` "tput clear" \*('' +does the same thing. .TP 3 -NQ -\fIBoolean\fP, -used to suppress a consistency check in @TIC@ for the \fI\%ncurses\fP -capabilities -in user6 through user9 (u6, u7, u8 and u9) -which tell how to query the terminal's cursor position +.B NQ +(Boolean) +suppresses a consistency check in +.B \%@TIC@ +for the +.I \%ncurses +string capabilities +.B user6 +.RB ( u6 ) +through +.B user9 +.RB ( u9 ), +which tell an application how to query the terminal's cursor position and its device attributes. .TP 3 -RGB -\fIBoolean\fP, \fInumber\fP \fBor\fP \fIstring\fP, -used to assert that the -\fBset_a_foreground\fP and -\fBset_a_background\fP capabilities correspond to \fIdirect colors\fP, +.B RGB +(Boolean, +numeric, +or +string) +asserts that the +.B \%set_a_foreground +.RB ( setaf ) +and +.B \%set_a_background +.RB ( setab ) +capabilities employ +.IR "direct colors" "," using an RGB (red/green/blue) convention. -This capability allows the \fBcolor_content\fP function to -return appropriate values without requiring the application -to initialize colors using \fBinit_color\fP. +This capability allows \fBcolor_content\fP(3X) +to return appropriate values +without requiring the application +to initialize colors using \fBinit_color\fP(3X). .IP -The capability type determines the values which \fI\%ncurses\fP sees: +The capability type determines the values +.I \%ncurses +sees. .RS 3 .TP 3 -\fIBoolean\fP -implies that the number of bits for red, green and blue are the same. -Using the maximum number of colors, -\fI\%ncurses\fP adds two, -divides that sum by three, +Boolean +implies that the number of bits for red, +green, +and blue are the same. +Starting with the value of the capability +.B max_colors +.RB \%( colors ; +.I termcap: +.BR co ), +.I \%ncurses +adds two, +divides the sum by three, and assigns the result to red, -green and blue in that order. +green, +and blue, +in that order. .IP -If the number of bits needed for the number of colors is not a multiple -of three, the blue (and green) components lose in comparison to red. +If the number of bits needed for the number of colors +is not a multiple of three, +the blue (and green) color channels lose in comparison to red. .TP 3 -\fInumber\fP -tells \fI\%ncurses\fP what result to add to red, green and blue. -If \fI\%ncurses\fP runs out of bits, -blue (and green) lose just as in the \fIBoolean\fP case. +numeric +tells +.I \%ncurses +what result to add to red, +green, +and blue. +If +.I \%ncurses +runs out of bits, +blue (and green) lose just as in the Boolean case. .TP 3 -\fIstring\fP -explicitly list the number of bits used for red, green and blue components +string +specify the quantity of bits used for +red, +green, +and blue color channels as a slash-separated list of decimal integers. .RE .IP Because there are several RGB encodings in use, -applications which make assumptions about the number of bits per color +applications that make assumptions +about the number of bits per color channel are unlikely to work reliably. -As a trivial case, for example, one could define \fBRGB#1\fP -to represent the standard eight ANSI colors, i.e., one bit per color. +As a trivial case, +one could define +.B RGB#1 +to represent the standard eight ANSI\ X3.64/ECMA-48/ISO\ 6429 colors +using one bit per color channel. .TP 3 -U8 -\fInumber\fP, -asserts that \fI\%ncurses\fP must use Unicode values for line-drawing -characters, -and that it should ignore the alternate character set capabilities +.B U8 +(numeric) +asserts whether +.I \%ncurses +must use Unicode values for line-drawing characters, +and that it should ignore the alternate character set (ACS) capabilities when the locale uses UTF-8 encoding. -For more information, see the discussion of -\fBNCURSES_NO_UTF8_ACS\fP in \fB\%ncurses\fP(3X). +See the discussion of +.B \%NCURSES_NO_UTF8_ACS +in section \*(``ENVIRONMENT\*('' of \fB\%ncurses\fP(3X). .IP Set this capability to a nonzero value to enable it. .TP 3 -XM -\fIstring\fP, -override \fI\%ncurses\fP's built-in string which -enables/disables \fBxterm\fP(1) mouse mode. +.B XM +(string) +override +.IR \%ncurses 's +built-in string that directs \fIxterm\fP(1) +to enable or disable mouse mode. .IP -\fI\%ncurses\fP sends a character sequence to the terminal to initialize mouse mode, -and when the user clicks the mouse buttons or (in certain modes) moves the -mouse, handles the characters sent back by the terminal to tell it what -was done with the mouse. +.I \%ncurses +sends a character sequence to the terminal to initialize mouse mode, +and when the user clicks the mouse buttons or +(in certain modes) +moves the mouse, +handles the characters sent back by the terminal +to tell the application what was done with the mouse. .IP -The mouse protocol is enabled when -the \fImask\fP passed in the \fBmousemask\fP function is nonzero. +The mouse protocol is enabled +when the +.I \fImask\fP +argument to the \fBmousemask\fP(3X) function is nonzero. By default, -\fI\%ncurses\fP handles the responses for the X11 xterm mouse protocol. -It also knows about the \fISGR 1006\fP xterm mouse protocol, -but must to be told to look for this specifically. -It will not be able to guess which mode is used, +.I \%ncurses +handles the responses for the X11 +.I xterm +mouse protocol. +It also knows about the SGR\ 1006 +.I xterm +mouse protocol, +but must to be told to look for it specifically. +.I \%ncurses +is not be able to guess which of the two modes is used, because the responses are enough alike that only confusion would result. .IP -The \fBXM\fP capability has a single parameter. -If nonzero, the mouse protocol should be enabled. -If zero, the mouse protocol should be disabled. -\fI\%ncurses\fP inspects this capability if it is present, +The +.B XM +capability has a single numeric parameter. +If nonzero, +the mouse protocol should be enabled. +If zero, +the mouse protocol should be disabled. +.I \%ncurses +inspects this capability if it is present, to see whether the 1006 protocol is used. -If so, it expects the responses to use the \fISGR 1006\fP xterm mouse protocol. +If so, +it expects the responses to use the SGR\ 1006 +.I xterm +mouse protocol. .IP -The xterm mouse protocol is used by other terminal emulators. -The terminal database uses building-blocks for the various xterm mouse -protocols which can be used in customized terminal descriptions. +The +.I xterm +mouse protocol is used by other terminal emulators. +The terminal database uses building blocks for the various +.I xterm +mouse protocols usable in customized terminal descriptions. .IP -The terminal database building blocks for this mouse -feature also have an experimental capability \fIxm\fP. -The \*(``xm\*('' capability describes the mouse response. -Currently there is no interpreter which would use this -information to make the mouse support completely data-driven. +The terminal database building blocks for this mouse feature +also have an experimental capability, +.BR xm "," +that describes the mouse response. +No known interpreter uses this information, +which could make mouse support completely data-driven. .IP -\fIxm\fP shows the format of the mouse responses. -In this experimental capability, the parameters are +.B xm +shows the format of the mouse responses. +In this experimental capability, +the parameters are as follows. .RS 5 .TP 5 .I p1 @@ -329,8 +525,10 @@ x-ordinate ending region .RE .IP Here are examples from the terminal database for the most commonly used -xterm mouse protocols: +.I xterm +mouse protocols. .IP +.EX .nf xterm+x11mouse|X11 xterm mouse protocol, kmous=\eE[M, XM=\eE[?1000%?%p1%{1}%=%th%el%;, @@ -338,7 +536,7 @@ xterm mouse protocols: %?%p4%t%p3%e%{3}%;%'\ '%+%c %p2%'!'%+%c %p1%'!'%+%c, - +.IP xterm+sm+1006|xterm SGR-mouse, kmous=\eE[<, XM=\eE[?1006;1000%?%p1%{1}%=%th%el%;, xm=\eE[<%i%p3%d; @@ -346,18 +544,20 @@ xterm mouse protocols: %p2%d; %?%p4%tM%em%;, .fi +.EE . .SS "Extended Key Definitions" Several terminals provide the ability to send distinct strings for combinations of modified special keys. There is no standard for what those keys can send. .PP -Since 1999, \fBxterm\fP(1) has supported +Since 1999, \fIxterm\fP(1) has supported \fIshift\fP, \fIcontrol\fP, \fIalt\fP, and \fImeta\fP modifiers which produce distinct special-key strings. In a terminal description, \fI\%ncurses\fP has no special knowledge of the modifiers used. -Applications can use the \fInaming convention\fP established for \fBxterm\fP +Applications can use the \fInaming convention\fP established for +\fIxterm\fP to find these special keys in the terminal description. .PP Starting with the @@ -403,9 +603,10 @@ These are the suffixes used to denote the modifiers: .PP .RS 5 .TS -tab(/) ; -l l . -\fBValue\fP/\fBDescription\fP +tab(/); +Lb Lb +L L . +Value/Description _ 2/Shift 3/Alt @@ -425,8 +626,14 @@ _ .TE .RE .PP -None of these are predefined; terminal descriptions can refer to \fInames\fP -which \fI\%ncurses\fP will allocate at runtime to \fIkey-codes\fP. +.I ncurses +defines no capabilities for modified F-keys; +terminal descriptions can refer to +.I names +that +.I \%ncurses +allocates at runtime to +.IR "key codes" "." To use these keys in an \fI\%ncurses\fP program, an application could do this: .bP @@ -438,27 +645,34 @@ ask \fBkey_defined\fP(3X) for the \fIkey-code\fP which would be returned for those keys by \fBwgetch\fP(3X). .\" .SH PORTABILITY -The \*(``\-x\*('' extension feature of \fB@TIC@\fP and \fB@INFOCMP@\fP -has been adopted in NetBSD curses. +The \*(``\-x\*('' extension feature of +.B \%@TIC@ +and +.B \%@INFOCMP@ +has been adopted in NetBSD +.IR curses "." That implementation stores user-defined capabilities, but makes no use of these capabilities itself. .\" .SH AUTHORS Thomas E. Dickey .br -beginning with \fI\%ncurses\fP 5.0 (1999) +beginning with +.I \%ncurses +5.0 (1999) .\" .SH SEE ALSO \fB\%@INFOCMP@\fP(1M), \fB\%@TIC@\fP(1M) .PP -The terminal database section -.I "NCURSES USER-DEFINABLE CAPABILITIES" +In the source form of the terminal database, +.IR \%terminfo.src "," +the section \*(``NCURSES USER-DEFINABLE CAPABILITIES\*(''. summarizes commonly-used user-defined capabilities -which are used in the terminal descriptions. +employed in the terminal descriptions. Some of those features are mentioned in \fB\%screen\fP(1) or \fBtmux\fP(1). .PP .I "XTerm Control Sequences" -provides further information on the \fB\%xterm\fP(1) features +provides further information on the \fI\%xterm\fP(1) features that are used in these extended capabilities. diff --git a/man/wresize.3x b/man/wresize.3x index b67feada0dc0..2e22d2fb4d0e 100644 --- a/man/wresize.3x +++ b/man/wresize.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright 2018-2023,2024 Thomas E. Dickey * +.\" Copyright 2018-2024,2025 Thomas E. Dickey * .\" Copyright 1998-2010,2015 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * @@ -29,8 +29,8 @@ .\" .\" Author: Thomas E. Dickey 1996 .\" -.\" $Id: wresize.3x,v 1.36 2024/03/16 15:35:01 tom Exp $ -.TH wresize 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" +.\" $Id: wresize.3x,v 1.47 2025/01/19 00:51:54 tom Exp $ +.TH wresize 3X 2025-01-18 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" .SH NAME \fB\%wresize\fP \- resize a \fIcurses\fR window @@ -38,35 +38,94 @@ resize a \fIcurses\fR window .nf \fB#include <curses.h> .PP -\fBint wresize(WINDOW *\fIwin\fP, int \fIlines\fP, int \fIcolumns\fP); +\fBint wresize(WINDOW * \fIwin\fP, int \fIlines\fP, int \fIcolumns\fP); .fi .SH DESCRIPTION -This \fI\%ncurses\fP extension to standard \fIcurses\fP reallocates -storage for a \fIcurses\fP window to adjust its dimensions to the -specified values. +.BR \%wresize "," +an +.I \%ncurses +extension to the +.I curses +library, +reallocates storage for +.IR win , +adjusting its dimensions to +.I lines +and +.IR columns "." If either dimension is larger than its current value, -the expanded part of the window is filled with blanks merged with -current background rendition -(as set by \fB\%wbkgdset\fP(3X)). +.I \%ncurses +fills the expanded part of the window +with the window's background character as configured by +\fB\%wbkgdset\fP(3X) +(wide-character API: \fB\%wbkgrndset\fP(3X)). .SH RETURN VALUE -\fB\%wresize\fP returns \fBERR\fP upon failure and \fBOK\fP on success. -It will fail if either of the dimensions is less than or equal to zero, -or if an error occurs while (re)allocating memory for the window. +.B \%wresize +returns +.B OK +on success and +.B ERR +on failure. +It fails if either +.I lines +or +.I columns +is less than or equal to zero, +or if an error occurs while (re)allocating memory for +.IR win "." .SH NOTES -The only restriction placed on the dimensions is that they be greater -than zero. -They are \fInot\fP compared to the \fIcurses\fP screen dimensions; +The only restriction placed on the values of +.I lines +and +.I columns +is that they be greater than zero. +They are +.I not +compared to the dimensions of the +.I curses +screen; this keeps the logic of \fB\%resizeterm\fP(3X) simple. -The caller must ensure that the window's dimensions fit within the -actual screen dimensions. +The caller must ensure that +.IR win 's +dimensions fit within those of the screen. +.SH EXTENSIONS +.B \%wresize +is an \fB\%ncurses\fP(3X) extension, +and is not found in SVr4 +.IR curses "," +4.4BSD +.IR curses "," +or any other previous +.I curses +implementation. .SH PORTABILITY -It is not possible to resize windows with SVr4 \fIcurses\fP. +Applications employing +.I \%ncurses +extensions should condition their use on the visibility of the +.B \%NCURSES_VERSION +preprocessor macro. .PP -\fI\%ncurses\fP introduced this extension in mid-1995. -NetBSD \fIcurses\fP adopted it in 2001, -and \fI\%PDCurses\fP in 2003. +NetBSD +.I curses +adopted +.I \%wresize +in 2001 (release 1.5.3), +and +.I \%PDCurses +in 2004 (version 2.7). +.PP +It is not possible to resize windows with SVr4 +.IR curses "." +.SH HISTORY +Thomas Dickey developed +.I \%wresize +as an extension to BSD +.I curses +in 1988, +and brought it to +.I \%ncurses +in mid-1995. .SH AUTHORS Thomas Dickey -(from an equivalent function written in 1988 for BSD \fIcurses\fP). .SH SEE ALSO \fB\%resizeterm\fP(3X) |
