]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/ncurses.3x
ncurses 6.4 - patch 20231217
[ncurses.git] / man / ncurses.3x
1 '\" t
2 .\"***************************************************************************
3 .\" Copyright 2018-2021,2023 Thomas E. Dickey                                *
4 .\" Copyright 1998-2015,2017 Free Software Foundation, Inc.                  *
5 .\"                                                                          *
6 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
7 .\" copy of this software and associated documentation files (the            *
8 .\" "Software"), to deal in the Software without restriction, including      *
9 .\" without limitation the rights to use, copy, modify, merge, publish,      *
10 .\" distribute, distribute with modifications, sublicense, and/or sell       *
11 .\" copies of the Software, and to permit persons to whom the Software is    *
12 .\" furnished to do so, subject to the following conditions:                 *
13 .\"                                                                          *
14 .\" The above copyright notice and this permission notice shall be included  *
15 .\" in all copies or substantial portions of the Software.                   *
16 .\"                                                                          *
17 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
18 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
19 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
20 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
21 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
22 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
23 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
24 .\"                                                                          *
25 .\" Except as contained in this notice, the name(s) of the above copyright   *
26 .\" holders shall not be used in advertising or otherwise to promote the     *
27 .\" sale, use or other dealings in this Software without prior written       *
28 .\" authorization.                                                           *
29 .\"***************************************************************************
30 .\"
31 .\" $Id: ncurses.3x,v 1.187 2023/12/17 23:44:14 tom Exp $
32 .TH ncurses 3X 2023-12-17 "ncurses 6.4" "Library calls"
33 .ie \n(.g \{\
34 .ds `` \(lq
35 .ds '' \(rq
36 .\}
37 .el \{\
38 .ie t .ds `` ``
39 .el   .ds `` ""
40 .ie t .ds '' ''
41 .el   .ds '' ""
42 .\}
43 .
44 .de bP
45 .ie n  .IP \(bu 4
46 .el    .IP \(bu 2
47 ..
48 .
49 .ds d @TERMINFO@
50 .SH NAME
51 \fB\%ncurses\fP \-
52 character-cell terminal interface with optimized output
53 .SH SYNOPSIS
54 .nf
55 \fB#include <curses.h>
56 .fi
57 .SH DESCRIPTION
58 The \fI\%ncurses\fP library routines give the user a
59 terminal-independent method of updating character screens with
60 reasonable optimization.
61 This implementation is \*(``new curses\*('' (\fI\%ncurses\fP) and
62 is the approved replacement for
63 4.4BSD classic curses, which has been discontinued.
64 This describes \fI\%ncurses\fP
65 version @NCURSES_MAJOR@.@NCURSES_MINOR@ (patch @NCURSES_PATCH@).
66 .PP
67 The \fI\%ncurses\fP library emulates the curses library of
68 System V Release 4 Unix (\*(``SVr4\*(''),
69 and XPG4 (X/Open Portability Guide) curses (also known as XSI curses).
70 XSI stands for X/Open System Interfaces Extension.
71 The \fI\%ncurses\fP library is freely redistributable in source form.
72 .PP
73 \fI\%ncurses\fP man pages employ several sections to clarify matters of
74 usage and interoperability with other \fIcurses\fP implementations.
75 .bP
76 \*(``NOTES\*('' describes matters and caveats of which any user of the
77 \fI\%ncurses\fP API should be aware,
78 such as limitations on the size of an underlying integral type or the
79 availability of a preprocessor macro for a function
80 (which prevents its address from being taken).
81 This section also describes implementation details that will be
82 significant to the programmer but which are not standardized.
83 .bP
84 \*(``EXTENSIONS\*('' presents \fI\%ncurses\fP innovations beyond the
85 X/Open Curses standard and/or the SVr4 \fIcurses\fP implementation.
86 They are termed \fIextensions\fP to indicate that they cannot be
87 implemented solely by using the library API, but require access to the
88 library's internal state.
89 .bP
90 \*(``PORTABILITY\*('' discusses matters
91 (beyond the exercise of extensions)
92 that should be considered when writing to a \fIcurses\fP standard,
93 or to multiple implementations.
94 .bP
95 \*(``HISTORY\*('' examines points of detail in \fI\%ncurses\fP and other
96 \fIcurses\fP implementations over the decades of their development,
97 particularly where precedent or inertia have frustrated better design
98 (and,
99 in a few cases,
100 where such inertia has been overcome).
101 .PP
102 A program using these routines must be linked with the \fB\-lncurses\fP option,
103 or (if it has been generated) with the debugging library \fB\-lncurses_g\fP.
104 (Your system integrator may also have installed these libraries under
105 the names \fB\-lcurses\fP and \fB\-lcurses_g\fP.)
106 The ncurses_g library generates trace logs
107 (in a file called \*(``trace\*('' in the current directory)
108 that describe curses actions.
109 See also the section on \fBALTERNATE CONFIGURATIONS\fP.
110 .PP
111 The \fI\%ncurses\fP package supports: overall screen, window and pad
112 manipulation; output to windows and pads; reading terminal input; control over
113 terminal and \fBcurses\fP input and output options; environment query
114 routines; color manipulation; use of soft label keys; terminfo capabilities;
115 and access to low-level terminal-manipulation routines.
116 .SS Initialization
117 The library uses the locale which the calling program has initialized.
118 That is normally done with \fBsetlocale\fP(3):
119 .PP
120 .RS 4
121 .EX
122 \fBsetlocale(LC_ALL, "");\fP
123 .EE
124 .RE
125 .PP
126 If the locale is not initialized,
127 the library assumes that characters are printable as in ISO\-8859\-1,
128 to work with certain legacy programs.
129 You should initialize the locale and not rely on specific details of
130 the library when the locale has not been setup.
131 .PP
132 The function \fBinitscr\fP or \fBnewterm\fP
133 must be called to initialize the library
134 before any of the other routines that deal with windows
135 and screens are used.
136 The routine \fBendwin\fP(3X) must be called before exiting.
137 .PP
138 To get character-at-a-time input without echoing (most
139 interactive, screen oriented programs want this), the following
140 sequence should be used:
141 .PP
142 .RS 4
143 .EX
144 \fBinitscr(); cbreak(); noecho();\fP
145 .EE
146 .RE
147 .PP
148 Most programs would additionally use the sequence:
149 .PP
150 .RS 4
151 .EX
152 \fBintrflush(stdscr, FALSE);\fP
153 \fBkeypad(stdscr, TRUE);\fP
154 .EE
155 .RE
156 .PP
157 Before a \fBcurses\fP program is run, the tab stops of the terminal
158 should be set and its initialization strings, if defined, must be output.
159 This can be done by executing the \fB@TPUT@ init\fP command
160 after the shell environment variable \fITERM\fP has been exported.
161 (The BSD-style \fB\%@TSET@\fP(1) utility also performs this function.)
162 See subsection \*(``Tabs and Initialization\*('' of \fBterminfo\fP(5).
163 .SS Overview
164 A
165 .I curses
166 library abstracts the terminal screen by representing all or part of it
167 as a
168 .I \%WINDOW
169 data structure.
170 A
171 .I window
172 is a rectangular grid of character cells,
173 addressed by row and column coordinates
174 .RI ( y ,
175 .IR x ),
176 with the upper left corner as (0, 0).
177 A window called \fB\%stdscr\fP,
178 the same size as the terminal screen,
179 is always available.
180 Create others with \fB\%newwin\fP(3X).
181 .PP
182 A
183 .I curses
184 library does not manage overlapping windows.
185 (See \fBpanel\fP(3X) if you desire this.)
186 You can either use \fB\%stdscr\fP to manage one screen-filling window,
187 or tile the screen into non-overlapping windows and not use
188 \fB\%stdscr\fP at all.
189 Mixing the two approaches will result in unpredictable,
190 and undesired,
191 effects.
192 .PP
193 Functions permit manipulation of a window and the
194 .I cursor
195 identifying the cell within it at which the next output operation will
196 occur.
197 Among those,
198 the most basic are \fBmove\fP(3X) and \fB\%addch\fP(3X):
199 these place the cursor and write a character to
200 .BR \%stdscr ,
201 respectively.
202 As a rule,
203 window-addressing functions feature names prefixed
204 (or infixed,
205 see below)
206 with \*(``w\*('';
207 these allow the user to specify a pointer to a
208 .I \%WINDOW.
209 Counterparts not thus prefixed
210 (or infixed)
211 affect \fB\%stdscr\fP.
212 Because moving the cursor prior to another operation is so common,
213 .I curses
214 generally also provides functions with a \*(``mv\*('' prefix as a
215 convenience.
216 Thus,
217 the library defines all of
218 \fB\%addch\fP,
219 \fB\%waddch\fP,
220 \fB\%mvaddch\fP,
221 and
222 \fB\%mvwaddch\fP.
223 When both prefixes are present,
224 the order of arguments is a
225 .I \%WINDOW
226 pointer first,
227 then a
228 .I y
229 and
230 .I x
231 coordinate pair.
232 .PP
233 Updating the terminal screen with every
234 .I curses
235 call can cause unpleasant flicker or inefficient use of the
236 communications channel to the device.
237 Therefore,
238 after using
239 .I curses
240 functions to accumulate a set of desired updates that make sense to
241 present together,
242 call \fB\%refresh\fP(3X) to tell the library to make the user's screen
243 look like \fBstdscr\fP.
244 .I \%ncurses
245 .\" X/Open Curses Issue 7 assumes some optimization will be done, but
246 .\" does not mandate it in any way.
247 .I optimizes
248 its output by computing a minimal number of operations to mutate the
249 screen from its state at the previous refresh to the new one.
250 Effective optimization demands accurate information about the terminal
251 device:
252 the management of such information is the province of the
253 \fB\%terminfo\fP(3X) API,
254 a feature of every standard
255 .I curses
256 implementation.
257 .PP
258 Special windows called \fIpads\fP may also be manipulated.
259 These are windows that are not constrained to the size of the terminal
260 screen and whose contents need not be completely displayed.
261 See \fB\%curs_pad\fP(3X).
262 .PP
263 In addition to drawing characters on the screen,
264 rendering attributes and colors may be supported,
265 causing the characters to show up in such modes as underlined,
266 in reverse video,
267 or in color on terminals that support such display enhancements.
268 See \fB\%curs_attr\fP(3X).
269 .PP
270 .I curses
271 predefines symbols for a small set of line graphics characters,
272 corresponding to the VT100 line drawing set.
273 See
274 \fB\%waddch\fP(3X) and
275 \fB\%wadd_wch\fP(3X).
276 .PP
277 .I curses
278 is implemented using the operating system's terminal driver;
279 keystroke events are not received as scan codes but as byte sequences.
280 Graphical keycaps
281 (alphanumeric and punctuation keys,
282 and the space)
283 appear as-is.
284 Everything else,
285 including the tab,
286 enter/return,
287 keypad,
288 arrow,
289 and function keys,
290 appears as a control character or a multibyte
291 .I "escape sequence."
292 .I curses
293 translates these into unique
294 .I "key codes."
295 See \fB\%getch\fP(3X).
296 .SS "Effects of GUIs and Environment Variables"
297 The selection of an approprate value of
298 .I TERM
299 in the process environment is essential to correct
300 .I curses
301 and
302 .I \%term\%info
303 library operation.
304 A well-configured system selects a correct
305 .I TERM
306 value automatically;
307 \fB\%tset\fP(1) may assist with troubleshooting exotic situations.
308 .PP
309 If the environment variables \fILINES\fP and \fI\%COLUMNS\fP are set,
310 or if the
311 .I curses
312 program is executing in a graphical windowing environment,
313 the information obtained thence overrides that obtained by
314 .IR \%term\%info .
315 An
316 .I \%ncurses
317 extension supports resizable terminals;
318 see \fB\%wresize\fP(3X).
319 .PP
320 If the environment variable \fI\%TERMINFO\fP is defined,
321 a
322 .I curses
323 program checks first for a terminal type description in the location it
324 identifies.
325 .I \%TERMINFO
326 is useful for developing experimental type descriptions or when write
327 permission to \fI\*d\fP is not available.
328 .PP
329 See section \*(``ENVIRONMENT\*('' below.
330 .SS "Naming Conventions"
331 Many
332 .I curses
333 functions have two or more versions.
334 Those prefixed with \*(``w\*('' require a window argument.
335 Four functions prefixed with \*(``p\*('' require a pad argument.
336 Those without a prefix generally operate on \fB\%stdscr\fP.
337 .PP
338 In function synopses,
339 .I \%ncurses
340 man pages apply the following names to parameters.
341 .PP
342 .TS
343 center;
344 Li L.
345 bf      \fIbool\fP (\fBTRUE\fP or \fBFALSE\fP)
346 win     pointer to \fIWINDOW\fP
347 pad     pointer to \fIWINDOW\fP that is a pad
348 .TE
349 .SS "Wide and Non-wide Character Configurations"
350 This manual page describes functions that appear in any configuration
351 of the library.
352 There are two common configurations;
353 see section \*(``ALTERNATE CONFIGURATIONS\*('' below.
354 .TP 10 \" "ncursesw" + 2n
355 .I \%ncurses
356 is the library in its \*(``non-wide\*('' configuration,
357 handling only eight-bit characters.
358 It stores a character combined with attributes in a
359 .I \%chtype
360 datum.
361 .IP
362 Attributes alone
363 (with no corresponding character)
364 can be stored in variables of
365 .I \%chtype
366 or
367 .I \%attr_t
368 type.
369 In either case,
370 they are represented as an integral bit mask.
371 .IP
372 Each cell of a
373 .I \%WINDOW
374 is stored as a
375 .I \%chtype.
376 .TP 10
377 .I \%ncursesw
378 is the library in its \*(``wide\*('' configuration,
379 which handles character encodings requiring a larger data type than
380 .I \%char
381 (a byte-sized type)
382 can represent.
383 It adds about one third more calls using additional data types that
384 can store such
385 .I multibyte
386 characters.
387 .RS 10 \" same as foregoing tag width
388 .TP 9 \" "cchar_t" + 2n
389 .I \%cchar_t
390 corresponds to the non-wide configuration's
391 .I \%chtype.
392 It always a structure type,
393 because it stores more data than can fit into an integer.
394 A character code may be larger than can fit in a C
395 .I \%char,
396 and moreover more than one character may occupy a cell
397 (as with accent marks and other diacritics).
398 Each character is of type
399 .I \%wchar_t;
400 a complex character contains one spacing character and zero or more
401 non-spacing characters
402 (see below).
403 Attributes and color data are stored in separate fields of the
404 structure,
405 not combined as in
406 .I \%chtype.
407 .IP
408 Each cell
409 (row and column)
410 .I \%WINDOW
411 is stored as a
412 .I \%cchar_t.
413 .PP
414 The \fB\%setcchar\fP(3X) and \fB\%getcchar\fP(3X)
415 functions store and retrieve the data from a
416 .I \%cchar_t
417 structure.
418 The wide library API of
419 .I \%ncurses
420 depends on two data types standardized by ISO C95.
421 .TP 9
422 .I \%wchar_t
423 stores a wide character.
424 Like
425 .I \%chtype,
426 this may be an integer.
427 Depending on the character encoding,
428 a wide character may be
429 .I spacing,
430 meaning that it occupies a character cell by itself and typically
431 accompanies cursor advancement on input,
432 or
433 .I combining,
434 meaning that it occupies the same cell as a spacing character,
435 is often regarded as a \*(``modifier\*('' of the base glyph with which
436 it combines,
437 and typically does not advance the cursor on input.
438 .TP 9
439 .I \%wint_t
440 can store a
441 .I \%wchar_t
442 or the constant
443 .BR \%WEOF ,
444 analogously to the
445 .IR int -sized
446 character manipulation functions of ISO C and their constant
447 .BR \%EOF .
448 .RE
449 .IP
450 The wide library provides additional functions that complement those in
451 the non-wide library where the size of the underlying character type is
452 significant.
453 A somewhat regular naming convention relates many of the wide variants
454 to their non-wide counterparts;
455 where a non-wide function name contains \*(``ch\*('' or \*(``str\*('',
456 prefix it with \*(``_w\*('' to obtain the wide counterpart.
457 For example,
458 \fB\%waddch\fP becomes \fB\%wadd_wch\fP.
459 .IP
460 This convention is inapplicable to some non-wide function names,
461 so other transformations are used for the wide configuration:
462 in the window background management functions,
463 \*(``bkgd\*('' becomes \*(``bkgrnd\*('';
464 the window border-drawing and -clearing functions are suffixed with
465 \*(``_set\*(''.
466 .\"
467 .SS "Function Name Index"
468 The following table lists the
469 .I curses
470 functions provided in the non-wide and wide APIs and the corresponding
471 man pages that describe them.
472 Those flagged with \*(``*\*(''
473 are
474 .IR \%ncurses -specific,
475 neither described by X/Open Curses nor present in SVr4.
476 .PP
477 .TS
478 center tab(/);
479 l l .
480 \f(BIcurses\fP Function Name/Man Page
481 _
482 COLOR_PAIR/\fBcurs_color\fP(3X)
483 PAIR_NUMBER/\fBcurs_attr\fP(3X)
484 add_wch/\fBcurs_add_wch\fP(3X)
485 add_wchnstr/\fBcurs_add_wchstr\fP(3X)
486 add_wchstr/\fBcurs_add_wchstr\fP(3X)
487 addch/\fBcurs_addch\fP(3X)
488 addchnstr/\fBcurs_addchstr\fP(3X)
489 addchstr/\fBcurs_addchstr\fP(3X)
490 addnstr/\fBcurs_addstr\fP(3X)
491 addnwstr/\fBcurs_addwstr\fP(3X)
492 addstr/\fBcurs_addstr\fP(3X)
493 addwstr/\fBcurs_addwstr\fP(3X)
494 alloc_pair/\fBnew_pair\fP(3X)*
495 assume_default_colors/\fBdefault_colors\fP(3X)*
496 attr_get/\fBcurs_attr\fP(3X)
497 attr_off/\fBcurs_attr\fP(3X)
498 attr_on/\fBcurs_attr\fP(3X)
499 attr_set/\fBcurs_attr\fP(3X)
500 attroff/\fBcurs_attr\fP(3X)
501 attron/\fBcurs_attr\fP(3X)
502 attrset/\fBcurs_attr\fP(3X)
503 baudrate/\fBcurs_termattrs\fP(3X)
504 beep/\fBcurs_beep\fP(3X)
505 bkgd/\fBcurs_bkgd\fP(3X)
506 bkgdset/\fBcurs_bkgd\fP(3X)
507 bkgrnd/\fBcurs_bkgrnd\fP(3X)
508 bkgrndset/\fBcurs_bkgrnd\fP(3X)
509 border/\fBcurs_border\fP(3X)
510 border_set/\fBcurs_border_set\fP(3X)
511 box/\fBcurs_border\fP(3X)
512 box_set/\fBcurs_border_set\fP(3X)
513 can_change_color/\fBcurs_color\fP(3X)
514 cbreak/\fBcurs_inopts\fP(3X)
515 chgat/\fBcurs_attr\fP(3X)
516 clear/\fBcurs_clear\fP(3X)
517 clearok/\fBcurs_outopts\fP(3X)
518 clrtobot/\fBcurs_clear\fP(3X)
519 clrtoeol/\fBcurs_clear\fP(3X)
520 color_content/\fBcurs_color\fP(3X)
521 color_set/\fBcurs_attr\fP(3X)
522 copywin/\fBcurs_overlay\fP(3X)
523 curs_set/\fBcurs_kernel\fP(3X)
524 curses_trace/\fBcurs_trace\fP(3X)*
525 curses_version/\fBcurs_extend\fP(3X)*
526 def_prog_mode/\fBcurs_kernel\fP(3X)
527 def_shell_mode/\fBcurs_kernel\fP(3X)
528 define_key/\fBdefine_key\fP(3X)*
529 del_curterm/\fBcurs_terminfo\fP(3X)
530 delay_output/\fBcurs_util\fP(3X)
531 delch/\fBcurs_delch\fP(3X)
532 deleteln/\fBcurs_deleteln\fP(3X)
533 delscreen/\fBcurs_initscr\fP(3X)
534 delwin/\fBcurs_window\fP(3X)
535 derwin/\fBcurs_window\fP(3X)
536 doupdate/\fBcurs_refresh\fP(3X)
537 dupwin/\fBcurs_window\fP(3X)
538 echo/\fBcurs_inopts\fP(3X)
539 echo_wchar/\fBcurs_add_wch\fP(3X)
540 echochar/\fBcurs_addch\fP(3X)
541 endwin/\fBcurs_initscr\fP(3X)
542 erase/\fBcurs_clear\fP(3X)
543 erasechar/\fBcurs_termattrs\fP(3X)
544 erasewchar/\fBcurs_termattrs\fP(3X)
545 exit_curses/\fBcurs_memleaks\fP(3X)*
546 exit_terminfo/\fBcurs_memleaks\fP(3X)*
547 extended_color_content/\fBcurs_color\fP(3X)*
548 extended_pair_content/\fBcurs_color\fP(3X)*
549 extended_slk_color/\fBcurs_slk\fP(3X)*
550 filter/\fBcurs_util\fP(3X)
551 find_pair/\fBnew_pair\fP(3X)*
552 flash/\fBcurs_beep\fP(3X)
553 flushinp/\fBcurs_util\fP(3X)
554 free_pair/\fBnew_pair\fP(3X)*
555 get_wch/\fBcurs_get_wch\fP(3X)
556 get_wstr/\fBcurs_get_wstr\fP(3X)
557 getattrs/\fBcurs_attr\fP(3X)
558 getbegx/\fBcurs_legacy\fP(3X)*
559 getbegy/\fBcurs_legacy\fP(3X)*
560 getbegyx/\fBcurs_getyx\fP(3X)
561 getbkgd/\fBcurs_bkgd\fP(3X)
562 getbkgrnd/\fBcurs_bkgrnd\fP(3X)
563 getcchar/\fBcurs_getcchar\fP(3X)
564 getch/\fBcurs_getch\fP(3X)
565 getcurx/\fBcurs_legacy\fP(3X)*
566 getcury/\fBcurs_legacy\fP(3X)*
567 getmaxx/\fBcurs_legacy\fP(3X)*
568 getmaxy/\fBcurs_legacy\fP(3X)*
569 getmaxyx/\fBcurs_getyx\fP(3X)
570 getmouse/\fBcurs_mouse\fP(3X)*
571 getn_wstr/\fBcurs_get_wstr\fP(3X)
572 getnstr/\fBcurs_getstr\fP(3X)
573 getparx/\fBcurs_legacy\fP(3X)*
574 getpary/\fBcurs_legacy\fP(3X)*
575 getparyx/\fBcurs_getyx\fP(3X)
576 getstr/\fBcurs_getstr\fP(3X)
577 getsyx/\fBcurs_kernel\fP(3X)
578 getwin/\fBcurs_util\fP(3X)
579 getyx/\fBcurs_getyx\fP(3X)
580 halfdelay/\fBcurs_inopts\fP(3X)
581 has_colors/\fBcurs_color\fP(3X)
582 has_ic/\fBcurs_termattrs\fP(3X)
583 has_il/\fBcurs_termattrs\fP(3X)
584 has_key/\fBcurs_getch\fP(3X)*
585 has_mouse/\fBcurs_mouse\fP(3X)*
586 hline/\fBcurs_border\fP(3X)
587 hline_set/\fBcurs_border_set\fP(3X)
588 idcok/\fBcurs_outopts\fP(3X)
589 idlok/\fBcurs_outopts\fP(3X)
590 immedok/\fBcurs_outopts\fP(3X)
591 in_wch/\fBcurs_in_wch\fP(3X)
592 in_wchnstr/\fBcurs_in_wchstr\fP(3X)
593 in_wchstr/\fBcurs_in_wchstr\fP(3X)
594 inch/\fBcurs_inch\fP(3X)
595 inchnstr/\fBcurs_inchstr\fP(3X)
596 inchstr/\fBcurs_inchstr\fP(3X)
597 init_color/\fBcurs_color\fP(3X)
598 init_extended_color/\fBcurs_color\fP(3X)*
599 init_extended_pair/\fBcurs_color\fP(3X)*
600 init_pair/\fBcurs_color\fP(3X)
601 initscr/\fBcurs_initscr\fP(3X)
602 innstr/\fBcurs_instr\fP(3X)
603 innwstr/\fBcurs_inwstr\fP(3X)
604 ins_nwstr/\fBcurs_ins_wstr\fP(3X)
605 ins_wch/\fBcurs_ins_wch\fP(3X)
606 ins_wstr/\fBcurs_ins_wstr\fP(3X)
607 insch/\fBcurs_insch\fP(3X)
608 insdelln/\fBcurs_deleteln\fP(3X)
609 insertln/\fBcurs_deleteln\fP(3X)
610 insnstr/\fBcurs_insstr\fP(3X)
611 insstr/\fBcurs_insstr\fP(3X)
612 instr/\fBcurs_instr\fP(3X)
613 intrflush/\fBcurs_inopts\fP(3X)
614 inwstr/\fBcurs_inwstr\fP(3X)
615 is_cbreak/\fBcurs_inopts\fP(3X)*
616 is_cleared/\fBcurs_opaque\fP(3X)*
617 is_echo/\fBcurs_inopts\fP(3X)*
618 is_idcok/\fBcurs_opaque\fP(3X)*
619 is_idlok/\fBcurs_opaque\fP(3X)*
620 is_immedok/\fBcurs_opaque\fP(3X)*
621 is_keypad/\fBcurs_opaque\fP(3X)*
622 is_leaveok/\fBcurs_opaque\fP(3X)*
623 is_linetouched/\fBcurs_touch\fP(3X)
624 is_nl/\fBcurs_inopts\fP(3X)*
625 is_nodelay/\fBcurs_opaque\fP(3X)*
626 is_notimeout/\fBcurs_opaque\fP(3X)*
627 is_pad/\fBcurs_opaque\fP(3X)*
628 is_raw/\fBcurs_inopts\fP(3X)*
629 is_scrollok/\fBcurs_opaque\fP(3X)*
630 is_subwin/\fBcurs_opaque\fP(3X)*
631 is_syncok/\fBcurs_opaque\fP(3X)*
632 is_term_resized/\fBresizeterm\fP(3X)*
633 is_wintouched/\fBcurs_touch\fP(3X)
634 isendwin/\fBcurs_initscr\fP(3X)
635 key_defined/\fBkey_defined\fP(3X)*
636 key_name/\fBcurs_util\fP(3X)
637 keybound/\fBkeybound\fP(3X)*
638 keyname/\fBcurs_util\fP(3X)
639 keyok/\fBkeyok\fP(3X)*
640 keypad/\fBcurs_inopts\fP(3X)
641 killchar/\fBcurs_termattrs\fP(3X)
642 killwchar/\fBcurs_termattrs\fP(3X)
643 leaveok/\fBcurs_outopts\fP(3X)
644 longname/\fBcurs_termattrs\fP(3X)
645 mcprint/\fBcurs_print\fP(3X)*
646 meta/\fBcurs_inopts\fP(3X)
647 mouse_trafo/\fBcurs_mouse\fP(3X)*
648 mouseinterval/\fBcurs_mouse\fP(3X)*
649 mousemask/\fBcurs_mouse\fP(3X)*
650 move/\fBcurs_move\fP(3X)
651 mvadd_wch/\fBcurs_add_wch\fP(3X)
652 mvadd_wchnstr/\fBcurs_add_wchstr\fP(3X)
653 mvadd_wchstr/\fBcurs_add_wchstr\fP(3X)
654 mvaddch/\fBcurs_addch\fP(3X)
655 mvaddchnstr/\fBcurs_addchstr\fP(3X)
656 mvaddchstr/\fBcurs_addchstr\fP(3X)
657 mvaddnstr/\fBcurs_addstr\fP(3X)
658 mvaddnwstr/\fBcurs_addwstr\fP(3X)
659 mvaddstr/\fBcurs_addstr\fP(3X)
660 mvaddwstr/\fBcurs_addwstr\fP(3X)
661 mvchgat/\fBcurs_attr\fP(3X)
662 mvcur/\fBcurs_terminfo\fP(3X)
663 mvdelch/\fBcurs_delch\fP(3X)
664 mvderwin/\fBcurs_window\fP(3X)
665 mvget_wch/\fBcurs_get_wch\fP(3X)
666 mvget_wstr/\fBcurs_get_wstr\fP(3X)
667 mvgetch/\fBcurs_getch\fP(3X)
668 mvgetn_wstr/\fBcurs_get_wstr\fP(3X)
669 mvgetnstr/\fBcurs_getstr\fP(3X)
670 mvgetstr/\fBcurs_getstr\fP(3X)
671 mvhline/\fBcurs_border\fP(3X)
672 mvhline_set/\fBcurs_border_set\fP(3X)
673 mvin_wch/\fBcurs_in_wch\fP(3X)
674 mvin_wchnstr/\fBcurs_in_wchstr\fP(3X)
675 mvin_wchstr/\fBcurs_in_wchstr\fP(3X)
676 mvinch/\fBcurs_inch\fP(3X)
677 mvinchnstr/\fBcurs_inchstr\fP(3X)
678 mvinchstr/\fBcurs_inchstr\fP(3X)
679 mvinnstr/\fBcurs_instr\fP(3X)
680 mvinnwstr/\fBcurs_inwstr\fP(3X)
681 mvins_nwstr/\fBcurs_ins_wstr\fP(3X)
682 mvins_wch/\fBcurs_ins_wch\fP(3X)
683 mvins_wstr/\fBcurs_ins_wstr\fP(3X)
684 mvinsch/\fBcurs_insch\fP(3X)
685 mvinsnstr/\fBcurs_insstr\fP(3X)
686 mvinsstr/\fBcurs_insstr\fP(3X)
687 mvinstr/\fBcurs_instr\fP(3X)
688 mvinwstr/\fBcurs_inwstr\fP(3X)
689 mvprintw/\fBcurs_printw\fP(3X)
690 mvscanw/\fBcurs_scanw\fP(3X)
691 mvvline/\fBcurs_border\fP(3X)
692 mvvline_set/\fBcurs_border_set\fP(3X)
693 mvwadd_wch/\fBcurs_add_wch\fP(3X)
694 mvwadd_wchnstr/\fBcurs_add_wchstr\fP(3X)
695 mvwadd_wchstr/\fBcurs_add_wchstr\fP(3X)
696 mvwaddch/\fBcurs_addch\fP(3X)
697 mvwaddchnstr/\fBcurs_addchstr\fP(3X)
698 mvwaddchstr/\fBcurs_addchstr\fP(3X)
699 mvwaddnstr/\fBcurs_addstr\fP(3X)
700 mvwaddnwstr/\fBcurs_addwstr\fP(3X)
701 mvwaddstr/\fBcurs_addstr\fP(3X)
702 mvwaddwstr/\fBcurs_addwstr\fP(3X)
703 mvwchgat/\fBcurs_attr\fP(3X)
704 mvwdelch/\fBcurs_delch\fP(3X)
705 mvwget_wch/\fBcurs_get_wch\fP(3X)
706 mvwget_wstr/\fBcurs_get_wstr\fP(3X)
707 mvwgetch/\fBcurs_getch\fP(3X)
708 mvwgetn_wstr/\fBcurs_get_wstr\fP(3X)
709 mvwgetnstr/\fBcurs_getstr\fP(3X)
710 mvwgetstr/\fBcurs_getstr\fP(3X)
711 mvwhline/\fBcurs_border\fP(3X)
712 mvwhline_set/\fBcurs_border_set\fP(3X)
713 mvwin/\fBcurs_window\fP(3X)
714 mvwin_wch/\fBcurs_in_wch\fP(3X)
715 mvwin_wchnstr/\fBcurs_in_wchstr\fP(3X)
716 mvwin_wchstr/\fBcurs_in_wchstr\fP(3X)
717 mvwinch/\fBcurs_inch\fP(3X)
718 mvwinchnstr/\fBcurs_inchstr\fP(3X)
719 mvwinchstr/\fBcurs_inchstr\fP(3X)
720 mvwinnstr/\fBcurs_instr\fP(3X)
721 mvwinnwstr/\fBcurs_inwstr\fP(3X)
722 mvwins_nwstr/\fBcurs_ins_wstr\fP(3X)
723 mvwins_wch/\fBcurs_ins_wch\fP(3X)
724 mvwins_wstr/\fBcurs_ins_wstr\fP(3X)
725 mvwinsch/\fBcurs_insch\fP(3X)
726 mvwinsnstr/\fBcurs_insstr\fP(3X)
727 mvwinsstr/\fBcurs_insstr\fP(3X)
728 mvwinstr/\fBcurs_instr\fP(3X)
729 mvwinwstr/\fBcurs_inwstr\fP(3X)
730 mvwprintw/\fBcurs_printw\fP(3X)
731 mvwscanw/\fBcurs_scanw\fP(3X)
732 mvwvline/\fBcurs_border\fP(3X)
733 mvwvline_set/\fBcurs_border_set\fP(3X)
734 napms/\fBcurs_kernel\fP(3X)
735 newpad/\fBcurs_pad\fP(3X)
736 newterm/\fBcurs_initscr\fP(3X)
737 newwin/\fBcurs_window\fP(3X)
738 nl/\fBcurs_inopts\fP(3X)
739 nocbreak/\fBcurs_inopts\fP(3X)
740 nodelay/\fBcurs_inopts\fP(3X)
741 noecho/\fBcurs_inopts\fP(3X)
742 nofilter/\fBcurs_util\fP(3X)*
743 nonl/\fBcurs_inopts\fP(3X)
744 noqiflush/\fBcurs_inopts\fP(3X)
745 noraw/\fBcurs_inopts\fP(3X)
746 notimeout/\fBcurs_inopts\fP(3X)
747 overlay/\fBcurs_overlay\fP(3X)
748 overwrite/\fBcurs_overlay\fP(3X)
749 pair_content/\fBcurs_color\fP(3X)
750 pecho_wchar/\fBcurs_pad\fP(3X)
751 pechochar/\fBcurs_pad\fP(3X)
752 pnoutrefresh/\fBcurs_pad\fP(3X)
753 prefresh/\fBcurs_pad\fP(3X)
754 printw/\fBcurs_printw\fP(3X)
755 putp/\fBcurs_terminfo\fP(3X)
756 putwin/\fBcurs_util\fP(3X)
757 qiflush/\fBcurs_inopts\fP(3X)
758 raw/\fBcurs_inopts\fP(3X)
759 redrawwin/\fBcurs_refresh\fP(3X)
760 refresh/\fBcurs_refresh\fP(3X)
761 reset_color_pairs/\fBcurs_color\fP(3X)*
762 reset_prog_mode/\fBcurs_kernel\fP(3X)
763 reset_shell_mode/\fBcurs_kernel\fP(3X)
764 resetty/\fBcurs_kernel\fP(3X)
765 resize_term/\fBresizeterm\fP(3X)*
766 resizeterm/\fBresizeterm\fP(3X)*
767 restartterm/\fBcurs_terminfo\fP(3X)
768 ripoffline/\fBcurs_kernel\fP(3X)
769 savetty/\fBcurs_kernel\fP(3X)
770 scanw/\fBcurs_scanw\fP(3X)
771 scr_dump/\fBcurs_scr_dump\fP(3X)
772 scr_init/\fBcurs_scr_dump\fP(3X)
773 scr_restore/\fBcurs_scr_dump\fP(3X)
774 scr_set/\fBcurs_scr_dump\fP(3X)
775 scrl/\fBcurs_scroll\fP(3X)
776 scroll/\fBcurs_scroll\fP(3X)
777 scrollok/\fBcurs_outopts\fP(3X)
778 set_curterm/\fBcurs_terminfo\fP(3X)
779 set_term/\fBcurs_initscr\fP(3X)
780 setcchar/\fBcurs_getcchar\fP(3X)
781 setscrreg/\fBcurs_outopts\fP(3X)
782 setsyx/\fBcurs_kernel\fP(3X)
783 setupterm/\fBcurs_terminfo\fP(3X)
784 slk_attr/\fBcurs_slk\fP(3X)*
785 slk_attr_off/\fBcurs_slk\fP(3X)
786 slk_attr_on/\fBcurs_slk\fP(3X)
787 slk_attr_set/\fBcurs_slk\fP(3X)
788 slk_attroff/\fBcurs_slk\fP(3X)
789 slk_attron/\fBcurs_slk\fP(3X)
790 slk_attrset/\fBcurs_slk\fP(3X)
791 slk_clear/\fBcurs_slk\fP(3X)
792 slk_color/\fBcurs_slk\fP(3X)
793 slk_init/\fBcurs_slk\fP(3X)
794 slk_label/\fBcurs_slk\fP(3X)
795 slk_noutrefresh/\fBcurs_slk\fP(3X)
796 slk_refresh/\fBcurs_slk\fP(3X)
797 slk_restore/\fBcurs_slk\fP(3X)
798 slk_set/\fBcurs_slk\fP(3X)
799 slk_touch/\fBcurs_slk\fP(3X)
800 slk_wset/\fBcurs_slk\fP(3X)
801 standend/\fBcurs_attr\fP(3X)
802 standout/\fBcurs_attr\fP(3X)
803 start_color/\fBcurs_color\fP(3X)
804 subpad/\fBcurs_pad\fP(3X)
805 subwin/\fBcurs_window\fP(3X)
806 syncok/\fBcurs_window\fP(3X)
807 term_attrs/\fBcurs_termattrs\fP(3X)
808 termattrs/\fBcurs_termattrs\fP(3X)
809 termname/\fBcurs_termattrs\fP(3X)
810 tgetent/\fBcurs_termcap\fP(3X)
811 tgetflag/\fBcurs_termcap\fP(3X)
812 tgetnum/\fBcurs_termcap\fP(3X)
813 tgetstr/\fBcurs_termcap\fP(3X)
814 tgoto/\fBcurs_termcap\fP(3X)
815 tigetflag/\fBcurs_terminfo\fP(3X)
816 tigetnum/\fBcurs_terminfo\fP(3X)
817 tigetstr/\fBcurs_terminfo\fP(3X)
818 timeout/\fBcurs_inopts\fP(3X)
819 tiparm/\fBcurs_terminfo\fP(3X)
820 tiparm_s/\fBcurs_terminfo\fP(3X)*
821 tiscan_s/\fBcurs_terminfo\fP(3X)*
822 touchline/\fBcurs_touch\fP(3X)
823 touchwin/\fBcurs_touch\fP(3X)
824 tparm/\fBcurs_terminfo\fP(3X)
825 tputs/\fBcurs_termcap\fP(3X)
826 tputs/\fBcurs_terminfo\fP(3X)
827 trace/\fBcurs_trace\fP(3X)*
828 typeahead/\fBcurs_inopts\fP(3X)
829 unctrl/\fBcurs_util\fP(3X)
830 unget_wch/\fBcurs_get_wch\fP(3X)
831 ungetch/\fBcurs_getch\fP(3X)
832 ungetmouse/\fBcurs_mouse\fP(3X)*
833 untouchwin/\fBcurs_touch\fP(3X)
834 use_default_colors/\fBdefault_colors\fP(3X)*
835 use_env/\fBcurs_util\fP(3X)
836 use_extended_names/\fBcurs_extend\fP(3X)*
837 use_legacy_coding/\fBlegacy_coding\fP(3X)*
838 use_tioctl/\fBcurs_util\fP(3X)*
839 vid_attr/\fBcurs_terminfo\fP(3X)
840 vid_puts/\fBcurs_terminfo\fP(3X)
841 vidattr/\fBcurs_terminfo\fP(3X)
842 vidputs/\fBcurs_terminfo\fP(3X)
843 vline/\fBcurs_border\fP(3X)
844 vline_set/\fBcurs_border_set\fP(3X)
845 vw_printw/\fBcurs_printw\fP(3X)
846 vw_scanw/\fBcurs_scanw\fP(3X)
847 vwprintw/\fBcurs_printw\fP(3X)
848 vwscanw/\fBcurs_scanw\fP(3X)
849 wadd_wch/\fBcurs_add_wch\fP(3X)
850 wadd_wchnstr/\fBcurs_add_wchstr\fP(3X)
851 wadd_wchstr/\fBcurs_add_wchstr\fP(3X)
852 waddch/\fBcurs_addch\fP(3X)
853 waddchnstr/\fBcurs_addchstr\fP(3X)
854 waddchstr/\fBcurs_addchstr\fP(3X)
855 waddnstr/\fBcurs_addstr\fP(3X)
856 waddnwstr/\fBcurs_addwstr\fP(3X)
857 waddstr/\fBcurs_addstr\fP(3X)
858 waddwstr/\fBcurs_addwstr\fP(3X)
859 wattr_get/\fBcurs_attr\fP(3X)
860 wattr_off/\fBcurs_attr\fP(3X)
861 wattr_on/\fBcurs_attr\fP(3X)
862 wattr_set/\fBcurs_attr\fP(3X)
863 wattroff/\fBcurs_attr\fP(3X)
864 wattron/\fBcurs_attr\fP(3X)
865 wattrset/\fBcurs_attr\fP(3X)
866 wbkgd/\fBcurs_bkgd\fP(3X)
867 wbkgdset/\fBcurs_bkgd\fP(3X)
868 wbkgrnd/\fBcurs_bkgrnd\fP(3X)
869 wbkgrndset/\fBcurs_bkgrnd\fP(3X)
870 wborder/\fBcurs_border\fP(3X)
871 wborder_set/\fBcurs_border_set\fP(3X)
872 wchgat/\fBcurs_attr\fP(3X)
873 wclear/\fBcurs_clear\fP(3X)
874 wclrtobot/\fBcurs_clear\fP(3X)
875 wclrtoeol/\fBcurs_clear\fP(3X)
876 wcolor_set/\fBcurs_attr\fP(3X)
877 wcursyncup/\fBcurs_window\fP(3X)
878 wdelch/\fBcurs_delch\fP(3X)
879 wdeleteln/\fBcurs_deleteln\fP(3X)
880 wecho_wchar/\fBcurs_add_wch\fP(3X)
881 wechochar/\fBcurs_addch\fP(3X)
882 wenclose/\fBcurs_mouse\fP(3X)*
883 werase/\fBcurs_clear\fP(3X)
884 wget_wch/\fBcurs_get_wch\fP(3X)
885 wget_wstr/\fBcurs_get_wstr\fP(3X)
886 wgetbkgrnd/\fBcurs_bkgrnd\fP(3X)
887 wgetch/\fBcurs_getch\fP(3X)
888 wgetdelay/\fBcurs_opaque\fP(3X)*
889 wgetn_wstr/\fBcurs_get_wstr\fP(3X)
890 wgetnstr/\fBcurs_getstr\fP(3X)
891 wgetparent/\fBcurs_opaque\fP(3X)*
892 wgetscrreg/\fBcurs_opaque\fP(3X)*
893 wgetstr/\fBcurs_getstr\fP(3X)
894 whline/\fBcurs_border\fP(3X)
895 whline_set/\fBcurs_border_set\fP(3X)
896 win_wch/\fBcurs_in_wch\fP(3X)
897 win_wchnstr/\fBcurs_in_wchstr\fP(3X)
898 win_wchstr/\fBcurs_in_wchstr\fP(3X)
899 winch/\fBcurs_inch\fP(3X)
900 winchnstr/\fBcurs_inchstr\fP(3X)
901 winchstr/\fBcurs_inchstr\fP(3X)
902 winnstr/\fBcurs_instr\fP(3X)
903 winnwstr/\fBcurs_inwstr\fP(3X)
904 wins_nwstr/\fBcurs_ins_wstr\fP(3X)
905 wins_wch/\fBcurs_ins_wch\fP(3X)
906 wins_wstr/\fBcurs_ins_wstr\fP(3X)
907 winsch/\fBcurs_insch\fP(3X)
908 winsdelln/\fBcurs_deleteln\fP(3X)
909 winsertln/\fBcurs_deleteln\fP(3X)
910 winsnstr/\fBcurs_insstr\fP(3X)
911 winsstr/\fBcurs_insstr\fP(3X)
912 winstr/\fBcurs_instr\fP(3X)
913 winwstr/\fBcurs_inwstr\fP(3X)
914 wmouse_trafo/\fBcurs_mouse\fP(3X)*
915 wmove/\fBcurs_move\fP(3X)
916 wnoutrefresh/\fBcurs_refresh\fP(3X)
917 wprintw/\fBcurs_printw\fP(3X)
918 wredrawln/\fBcurs_refresh\fP(3X)
919 wrefresh/\fBcurs_refresh\fP(3X)
920 wresize/\fBwresize\fP(3X)*
921 wscanw/\fBcurs_scanw\fP(3X)
922 wscrl/\fBcurs_scroll\fP(3X)
923 wsetscrreg/\fBcurs_outopts\fP(3X)
924 wstandend/\fBcurs_attr\fP(3X)
925 wstandout/\fBcurs_attr\fP(3X)
926 wsyncdown/\fBcurs_window\fP(3X)
927 wsyncup/\fBcurs_window\fP(3X)
928 wtimeout/\fBcurs_inopts\fP(3X)
929 wtouchln/\fBcurs_touch\fP(3X)
930 wunctrl/\fBcurs_util\fP(3X)
931 wvline/\fBcurs_border\fP(3X)
932 wvline_set/\fBcurs_border_set\fP(3X)
933 .TE
934 .PP
935 Depending on the configuration,
936 additional sets of functions may be available:
937 .RS 3
938 .TP 5
939 \fBcurs_memleaks\fP(3X) - curses memory-leak checking
940 .TP 5
941 \fBcurs_sp_funcs\fP(3X) - curses screen-pointer extension
942 .TP 5
943 \fBcurs_threads\fP(3X) - curses thread support
944 .TP 5
945 \fBcurs_trace\fP(3X) - curses debugging routines
946 .RE
947 .SH RETURN VALUE
948 Routines that return an integer return \fBERR\fP upon failure and an
949 integer value other than \fBERR\fP upon successful completion, unless
950 otherwise noted in the routine descriptions.
951 .PP
952 As a general rule, routines check for null pointers passed as parameters,
953 and handle this as an error.
954 .PP
955 All macros return the value of the \fBw\fP version, except \fBsetscrreg\fP,
956 \fBwsetscrreg\fP, \fBgetyx\fP, \fBgetbegyx\fP, and \fBgetmaxyx\fP.
957 The return values of
958 \fBsetscrreg\fP,
959 \fBwsetscrreg\fP,
960 \fBgetyx\fP,
961 \fBgetbegyx\fP, and
962 \fBgetmaxyx\fP are undefined (i.e., these should not be used as the
963 right-hand side of assignment statements).
964 .PP
965 Functions with a \*(``mv\*('' prefix first perform cursor movement using
966 \fB\%wmove\fP and return an error if the position is outside the window,
967 or
968 (for \*(``mvw\*('' functions)
969 if the
970 .I \%WINDOW
971 pointer is null.
972 Most \*(``mv\*(''-prefixed functions
973 (except variadic functions such as \fB\%mvprintw\fP)
974 are provided both as macros and functions.
975 .PP
976 Routines that return pointers return \fBNULL\fP on error.
977 .SH ENVIRONMENT
978 The following environment symbols are useful for customizing the
979 runtime behavior of the \fI\%ncurses\fP library.
980 The most important ones have been already discussed in detail.
981 .SS \fICC\fP command-character
982 When set, change occurrences of the command_character
983 (i.e., the \fBcmdch\fP capability)
984 of the loaded terminfo entries to the value of this variable.
985 Very few terminfo entries provide this feature.
986 .PP
987 Because this name is also used in development environments to represent
988 the C compiler's name,
989 \fI\%ncurses\fP ignores it if it does not happen to be a single
990 character.
991 .SS \fIBAUDRATE\fP
992 The debugging library checks this environment variable when the application
993 has redirected output to a file.
994 The variable's numeric value is used for the baudrate.
995 If no value is found, \fI\%ncurses\fP uses 9600.
996 This allows testers to construct repeatable test-cases
997 that take into account costs that depend on baudrate.
998 .SS \fICOLUMNS\fP
999 Specify the width of the screen in characters.
1000 Applications running in a windowing environment usually are able to
1001 obtain the width of the window in which they are executing.
1002 If neither the \fI\%COLUMNS\fP value nor the terminal's screen size is available,
1003 \fI\%ncurses\fP uses the size which may be specified in the terminfo
1004 database
1005 (i.e., the \fBcols\fP capability).
1006 .PP
1007 It is important that your application use a correct size for the screen.
1008 This is not always possible because your application may be
1009 running on a host which does not honor NAWS (Negotiations About Window
1010 Size), or because you are temporarily running as another user.
1011 However,
1012 setting \fI\%COLUMNS\fP and/or \fILINES\fP overrides the library's use
1013 of the screen size obtained from the operating system.
1014 .PP
1015 Either \fI\%COLUMNS\fP or \fILINES\fP symbols may be specified
1016 independently.
1017 This is mainly useful to circumvent legacy misfeatures of terminal descriptions,
1018 e.g., xterm which commonly specifies a 65 line screen.
1019 For best results, \fBlines\fP and \fBcols\fP should not be specified in
1020 a terminal description for terminals which are run as emulations.
1021 .PP
1022 Use the \fBuse_env\fP function to disable all use of external environment
1023 (but not including system calls) to determine the screen size.
1024 Use the \fBuse_tioctl\fP function to update \fI\%COLUMNS\fP or
1025 \fILINES\fP to match the screen size obtained from system calls or the
1026 terminal database.
1027 .SS \fIESCDELAY\fP
1028 Specifies the total time,
1029 in milliseconds,
1030 for which \fI\%ncurses\fP will await a character sequence,
1031 e.g.,
1032 a function key.
1033 The default value, 1000 milliseconds, is enough for most uses.
1034 However, it is made a variable to accommodate unusual applications.
1035 .PP
1036 The most common instance where you may wish to change this value
1037 is to work with slow hosts, e.g., running on a network.
1038 If the host cannot read characters rapidly enough, it will have the same
1039 effect as if the terminal did not send characters rapidly enough.
1040 The library will still see a timeout.
1041 .PP
1042 Note that xterm mouse events are built up from character sequences
1043 received from the xterm.
1044 If your application makes heavy use of multiple-clicking, you may
1045 wish to lengthen this default value because the timeout applies
1046 to the composed multi-click event as well as the individual clicks.
1047 .PP
1048 In addition to the environment variable,
1049 this implementation provides a global variable with the same name.
1050 Portable applications should not rely upon the presence of \fB\%ESCDELAY\fP
1051 in either form,
1052 but setting the environment variable rather than the global variable
1053 does not create problems when compiling an application.
1054 .SS \fIHOME\fP
1055 Tells \fI\%ncurses\fP where your home directory is.
1056 That is where it may read and write auxiliary terminal descriptions:
1057 .PP
1058 .RS 4
1059 .EX
1060 $HOME/.termcap
1061 $HOME/.terminfo
1062 .EE
1063 .RE
1064 .SS \fILINES\fP
1065 Like \fI\%COLUMNS\fP, specify the height of the screen in characters.
1066 See \fI\%COLUMNS\fP for a detailed description.
1067 .SS \fIMOUSE_BUTTONS_123\fP
1068 This applies only to the OS/2 EMX port.
1069 It specifies the order of buttons on the mouse.
1070 OS/2 numbers a 3-button mouse inconsistently from other
1071 platforms:
1072 .PP
1073 .RS 4
1074 .EX
1075 1 = left
1076 2 = right
1077 3 = middle.
1078 .EE
1079 .RE
1080 .PP
1081 This variable lets you customize the mouse.
1082 The variable must be three numeric digits 1\-3 in any order, e.g., 123 or 321.
1083 If it is not specified, \fI\%ncurses\fP uses 132.
1084 .SS \fINCURSES_ASSUMED_COLORS\fP
1085 Override the compiled-in assumption that the
1086 terminal's default colors are white-on-black
1087 (see \fBdefault_colors\fP(3X)).
1088 You may set the foreground and background color values with this environment
1089 variable by proving a 2-element list: foreground,background.
1090 For example, to tell \fI\%ncurses\fP to not assume anything
1091 about the colors, set this to "\-1,\-1".
1092 To make it green-on-black, set it to "2,0".
1093 Any positive value from zero to the terminfo \fBmax_colors\fP value is allowed.
1094 .SS \fINCURSES_CONSOLE2\fP
1095 This applies only to the MinGW port of \fI\%ncurses\fP.
1096 .PP
1097 The \fBConsole2\fP program's handling of the Microsoft Console API call
1098 \fBCreateConsoleScreenBuffer\fP is defective.
1099 Applications which use this will hang.
1100 However, it is possible to simulate the action of this call by
1101 mapping coordinates,
1102 explicitly saving and restoring the original screen contents.
1103 Setting the environment variable \fBNCGDB\fP has the same effect.
1104 .SS \fINCURSES_GPM_TERMS\fP
1105 This applies only to \fI\%ncurses\fP configured to use the GPM
1106 interface.
1107 .PP
1108 If present,
1109 the environment variable is a list of one or more terminal names
1110 against which the \fITERM\fP environment variable is matched.
1111 Setting it to an empty value disables the GPM interface;
1112 using the built-in support for xterm, etc.
1113 .PP
1114 If the environment variable is absent,
1115 \fI\%ncurses\fP will attempt to open GPM if \fITERM\fP contains
1116 \*(``linux\*(''.
1117 .SS \fINCURSES_NO_HARD_TABS\fP
1118 \fI\%ncurses\fP may use tabs as part of cursor movement optimization.
1119 In some cases,
1120 your terminal driver may not handle these properly.
1121 Set this environment variable to any value to disable the feature.
1122 You can also adjust your \fBstty\fP(1) settings to avoid the problem.
1123 .SS \fINCURSES_NO_MAGIC_COOKIE\fP
1124 Some terminals use a magic-cookie feature which requires special handling
1125 to make highlighting and other video attributes display properly.
1126 You can suppress the highlighting entirely for these terminals by
1127 setting this environment variable to any value.
1128 .SS \fINCURSES_NO_PADDING\fP
1129 Most of the terminal descriptions in the terminfo database are written
1130 for real \*(``hardware\*('' terminals.
1131 Many people use terminal emulators
1132 which run in a windowing environment and use curses-based applications.
1133 Terminal emulators can duplicate
1134 all of the important aspects of a hardware terminal, but they do not
1135 have the same limitations.
1136 The chief limitation of a hardware terminal from the standpoint
1137 of your application is the management of dataflow, i.e., timing.
1138 Unless a hardware terminal is interfaced into a terminal concentrator
1139 (which does flow control),
1140 it (or your application) must manage dataflow, preventing overruns.
1141 The cheapest solution (no hardware cost)
1142 is for your program to do this by pausing after
1143 operations that the terminal does slowly, such as clearing the display.
1144 .PP
1145 As a result, many terminal descriptions (including the vt100)
1146 have delay times embedded.
1147 You may wish to use these descriptions,
1148 but not want to pay the performance penalty.
1149 .PP
1150 Set the \fI\%NCURSES_NO_PADDING\fP environment variable
1151 to disable all but mandatory padding.
1152 Mandatory padding is used as a part of special control
1153 sequences such as \fBflash\fP.
1154 .SS \fINCURSES_NO_SETBUF\fP
1155 This setting is obsolete.
1156 Before changes
1157 .RS 3
1158 .bP
1159 started with 5.9 patch 20120825
1160 and
1161 .bP
1162 continued
1163 though 5.9 patch 20130126
1164 .RE
1165 .PP
1166 \fI\%ncurses\fP enabled buffered output during terminal initialization.
1167 This was done (as in SVr4 curses) for performance reasons.
1168 For testing purposes, both of \fI\%ncurses\fP and certain applications,
1169 this feature was made optional.
1170 Setting the \fI\%NCURSES_NO_SETBUF\fP variable
1171 disabled output buffering, leaving the output in the original (usually
1172 line buffered) mode.
1173 .PP
1174 In the current implementation,
1175 \fI\%ncurses\fP performs its own buffering and does not require this
1176 workaround.
1177 It does not modify the buffering of the standard output.
1178 .PP
1179 The reason for the change was to make the behavior for interrupts and
1180 other signals more robust.
1181 One drawback is that certain nonconventional programs would mix
1182 ordinary stdio calls with \fI\%ncurses\fP calls and (usually) work.
1183 This is no longer possible since \fI\%ncurses\fP is not using
1184 the buffered standard output but its own output (to the same file descriptor).
1185 As a special case, the low-level calls such as \fBputp\fP still use the
1186 standard output.
1187 But high-level curses calls do not.
1188 .SS \fINCURSES_NO_UTF8_ACS\fP
1189 During initialization, the \fI\%ncurses\fP library
1190 checks for special cases where VT100 line-drawing (and the corresponding
1191 alternate character set capabilities) described in the terminfo are known
1192 to be missing.
1193 Specifically, when running in a UTF\-8 locale,
1194 the Linux console emulator and the GNU screen program ignore these.
1195 \fI\%ncurses checks the \fITERM\fP environment variable for these.
1196 For other special cases, you should set this environment variable.
1197 Doing this tells \fI\%ncurses\fP to use Unicode values which correspond
1198 to the VT100 line-drawing glyphs.
1199 That works for the special cases cited,
1200 and is likely to work for terminal emulators.
1201 .PP
1202 When setting this variable, you should set it to a nonzero value.
1203 Setting it to zero (or to a nonnumber)
1204 disables the special check for \*(``linux\*('' and \*(``screen\*(''.
1205 .PP
1206 As an alternative to the environment variable,
1207 \fI\%ncurses\fP checks for an extended terminfo capability \fBU8\fP.
1208 This is a numeric capability which can be compiled using \fB@TIC@\ \-x\fP.
1209 For example
1210 .PP
1211 .RS 3
1212 .EX
1213 # linux console, if patched to provide working
1214 # VT100 shift\-in/shift\-out, with corresponding font.
1215 linux\-vt100|linux console with VT100 line\-graphics,
1216         U8#0, use=linux,
1217
1218 # uxterm with vt100Graphics resource set to false
1219 xterm\-utf8|xterm relying on UTF\-8 line\-graphics,
1220         U8#1, use=xterm,
1221 .EE
1222 .RE
1223 .PP
1224 The name \*(``U8\*('' is chosen to be two characters,
1225 to permit it to be used by applications that use \fI\%ncurses\fP'
1226 termcap interface.
1227 .SS \fINCURSES_TRACE\fP
1228 During initialization, the \fI\%ncurses\fP debugging library
1229 checks the \fI\%NCURSES_TRACE\fP environment variable.
1230 If it is defined,
1231 to a numeric value,
1232 \fI\%ncurses\fP calls the \fBtrace\fP function,
1233 using that value as the argument.
1234 .PP
1235 The argument values, which are defined in \fBcurses.h\fP, provide several
1236 types of information.
1237 When running with traces enabled, your application will write the
1238 file \fBtrace\fP to the current directory.
1239 .PP
1240 See \fBcurs_trace\fP(3X) for more information.
1241 .SS \fITERM\fP
1242 Denotes your terminal type.
1243 Each terminal type is distinct, though many are similar.
1244 .PP
1245 \fITERM\fP is commonly set by terminal emulators to help
1246 applications find a workable terminal description.
1247 Some of those choose a popular approximation, e.g.,
1248 \*(``ansi\*('', \*(``vt100\*('', \*(``xterm\*('' rather than an exact fit.
1249 Not infrequently, your application will have problems with that approach,
1250 e.g., incorrect function-key definitions.
1251 .PP
1252 If you set \fITERM\fP in your environment,
1253 it has no effect on the operation of the terminal emulator.
1254 It only affects the way applications work within the terminal.
1255 Likewise, as a general rule (\fBxterm\fP(1) being a rare exception),
1256 terminal emulators which allow you to
1257 specify \fITERM\fP as a parameter or configuration value do
1258 not change their behavior to match that setting.
1259 .SS \fITERMCAP\fP
1260 If the \fI\%ncurses\fP library has been configured with \fItermcap\fP
1261 support, \fI\%ncurses\fP will check for a terminal's description in
1262 termcap form if it is not available in the terminfo database.
1263 .PP
1264 The \fI\%TERMCAP\fP environment variable contains
1265 either a terminal description (with newlines stripped out),
1266 or a file name telling where the information denoted by
1267 the \fITERM\fP environment variable exists.
1268 In either case, setting it directs \fI\%ncurses\fP to ignore
1269 the usual place for this information, e.g., /etc/termcap.
1270 .SS \fITERMINFO\fP
1271 \fI\%ncurses\fP can be configured to read from multiple terminal
1272 databases.
1273 The \fI\%TERMINFO\fP variable overrides the location for
1274 the default terminal database.
1275 Terminal descriptions (in terminal format) are stored in terminal databases:
1276 .bP
1277 Normally these are stored in a directory tree,
1278 using subdirectories named by the first letter of the terminal names therein.
1279 .IP
1280 This is the scheme used in System V, which legacy Unix systems use,
1281 and the \fI\%TERMINFO\fP variable is used by \fIcurses\fP applications
1282 on those
1283 systems to override the default location of the terminal database.
1284 .IP \(bu 4
1285 If \fI\%ncurses\fP is built to use hashed databases,
1286 then each entry in this list may be the path of a hashed database file, e.g.,
1287 .RS 4
1288 .PP
1289 .RS 4
1290 .EX
1291 /usr/share/terminfo.db
1292 .EE
1293 .RE
1294 .PP
1295 rather than
1296 .PP
1297 .RS 4
1298 .EX
1299 /usr/share/terminfo/
1300 .EE
1301 .RE
1302 .PP
1303 The hashed database uses less disk-space and is a little faster than the
1304 directory tree.
1305 However,
1306 some applications assume the existence of the directory tree,
1307 reading it directly
1308 rather than using the terminfo library calls.
1309 .RE
1310 .bP
1311 If \fI\%ncurses\fP is built with a support for reading termcap files
1312 directly, then an entry in this list may be the path of a termcap file.
1313 .IP \(bu 4
1314 If the \fI\%TERMINFO\fP variable begins with
1315 \*(``hex:\*('' or \*(``b64:\*('',
1316 \fI\%ncurses\fP uses the remainder of that variable as a compiled
1317 terminal description.
1318 You might produce the base64 format using \fBinfocmp\fP(1M):
1319 .RS 4
1320 .PP
1321 .RS 4
1322 .EX
1323 TERMINFO="$(infocmp \-0 \-Q2 \-q)"
1324 export TERMINFO
1325 .EE
1326 .RE
1327 .PP
1328 The compiled description is used if it corresponds to the terminal identified
1329 by the \fITERM\fP variable.
1330 .RE
1331 .PP
1332 Setting \fI\%TERMINFO\fP is the simplest,
1333 but not the only way to set location of the default terminal database.
1334 The complete list of database locations in order follows:
1335 .RS 3
1336 .bP
1337 the last terminal database to which \fI\%ncurses\fP wrote,
1338 if any, is searched first
1339 .bP
1340 the location specified by the \fI\%TERMINFO\fP environment variable
1341 .bP
1342 $HOME/.terminfo
1343 .bP
1344 locations listed in the \fI\%TERMINFO_DIRS\fP environment variable
1345 .bP
1346 one or more locations whose names are configured and compiled into the
1347 \fI\%ncurses\fP library, i.e.,
1348 .RS 3
1349 .bP
1350 @TERMINFO_DIRS@ (corresponding to the \fI\%TERMINFO_DIRS\fP variable)
1351 .bP
1352 @TERMINFO@ (corresponding to the \fITERMINFO\fP variable)
1353 .RE
1354 .RE
1355 .SS \fITERMINFO_DIRS\fP
1356 Specifies a list of locations to search for terminal descriptions.
1357 Each location in the list is a terminal database as described in
1358 the section on the \fI\%TERMINFO\fP variable.
1359 The list is separated by colons (i.e., ":") on Unix, semicolons on OS/2 EMX.
1360 .PP
1361 There is no corresponding feature in System V terminfo;
1362 it is an extension developed for \fI\%ncurses\fP.
1363 .SS \fITERMPATH\fP
1364 If \fI\%TERMCAP\fP does not hold a file name then \fI\%ncurses\fP checks
1365 the \fI\%TERMPATH\fP environment variable.
1366 This is a list of filenames separated by spaces or colons (i.e., ":") on Unix,
1367 semicolons on OS/2 EMX.
1368 .PP
1369 If the \fI\%TERMPATH\fP environment variable is not set,
1370 \fI\%ncurses\fP looks in the files
1371 .PP
1372 .RS 4
1373 .EX
1374 /etc/termcap, /usr/share/misc/termcap and $HOME/.termcap,
1375 .EE
1376 .RE
1377 .PP
1378 in that order.
1379 .PP
1380 The library may be configured to disregard the following variables when the
1381 current user is the superuser (root), or if the application uses setuid or
1382 setgid permissions:
1383 .PP
1384 .RS 4
1385 .EX
1386 $TERMINFO, $TERMINFO_DIRS, $TERMPATH, as well as $HOME.
1387 .EE
1388 .RE
1389 .SH ALTERNATE CONFIGURATIONS
1390 Several different configurations are possible,
1391 depending on the configure script options used when building
1392 \fI\%ncurses\fP.
1393 There are a few main options whose effects are visible to the applications
1394 developer using \fI\%ncurses\fP:
1395 .TP 5
1396 \-\-disable\-overwrite
1397 The standard include for \fI\%ncurses\fP is as noted in \fBSYNOPSIS\fP:
1398 .RS 5
1399 .PP
1400 .RS 4
1401 .EX
1402 \fB#include <curses.h>\fP
1403 .EE
1404 .RE
1405 .PP
1406 This option is used to avoid filename conflicts when \fI\%ncurses\fP
1407 is not the main implementation of curses of the computer.
1408 If \fI\%ncurses\fP is installed disabling overwrite,
1409 it puts its headers in a subdirectory,
1410 e.g.,
1411 .PP
1412 .RS 4
1413 .EX
1414 \fB#include <ncurses/curses.h>\fP
1415 .EE
1416 .RE
1417 .PP
1418 It also omits a symbolic link which would allow you to use \fB\-lcurses\fP
1419 to build executables.
1420 .RE
1421 .TP 5
1422 \-\-enable\-widec
1423 The configure script renames the library and
1424 (if the \fB\-\-disable\-overwrite\fP option is used)
1425 puts the header files in a different subdirectory.
1426 All of the library names have a \*(``w\*('' appended to them,
1427 i.e., instead of
1428 .RS 5
1429 .PP
1430 .RS 4
1431 .EX
1432 \fB\-lncurses\fP
1433 .EE
1434 .RE
1435 .PP
1436 you link with
1437 .PP
1438 .RS 4
1439 .EX
1440 \fB\-lncursesw\fP
1441 .EE
1442 .RE
1443 .PP
1444 You must also enable the wide-character features in the header file
1445 when compiling for the wide-character library
1446 to use the extended (wide-character) functions.
1447 The symbol which enables these features has changed since XSI Curses, Issue 4:
1448 .bP
1449 Originally, the wide-character feature required the symbol
1450 \fB_XOPEN_SOURCE_EXTENDED\fP
1451 but that was only valid for XPG4 (1996).
1452 .bP
1453 Later, that was deemed conflicting with \fB_XOPEN_SOURCE\fP defined to 500.
1454 .bP
1455 As of mid-2018,
1456 none of the features in this implementation require a \fB_XOPEN_SOURCE\fP
1457 feature greater than 600.
1458 However, X/Open Curses, Issue 7 (2009) recommends defining it to 700.
1459 .bP
1460 Alternatively, you can enable the feature by defining \fBNCURSES_WIDECHAR\fP
1461 with the caveat that some other header file than \fBcurses.h\fP
1462 may require a specific value for \fB_XOPEN_SOURCE\fP
1463 (or a system-specific symbol).
1464 .PP
1465 The \fI\%curses.h\fP header file installed for the wide-character
1466 library is designed to be compatible with the non-wide library's header.
1467 Only the size of the \fI\%WINDOW\fP structure differs;
1468 few applications require more than pointers to \fI\%WINDOW\fPs.
1469 .PP
1470 If the headers are installed allowing overwrite,
1471 the wide-character library's headers should be installed last,
1472 to allow applications to be built using either library
1473 from the same set of headers.
1474 .RE
1475 .TP 5
1476 \-\-with\-pthread
1477 The configure script renames the library.
1478 All of the library names have a \*(``t\*('' appended to them
1479 (before any \*(``w\*('' added by \fB\-\-enable\-widec\fP).
1480 .IP
1481 The global variables such as \fBLINES\fP are replaced by macros to
1482 allow read-only access.
1483 At the same time, setter-functions are provided to set these values.
1484 Some applications (very few) may require changes to work with this convention.
1485 .TP 5
1486 \-\-with\-shared
1487 .TP
1488 \-\-with\-normal
1489 .TP
1490 \-\-with\-debug
1491 .TP
1492 \-\-with\-profile
1493 The shared and normal (static) library names differ by their suffixes,
1494 e.g., \fBlibncurses.so\fP and \fBlibncurses.a\fP.
1495 The debug and profiling libraries add a \*(``_g\*(''
1496 and a \*(``_p\*('' to the root names respectively,
1497 e.g., \fBlibncurses_g.a\fP and \fBlibncurses_p.a\fP.
1498 .TP 5
1499 \-\-with\-termlib
1500 Low-level functions which do not depend upon whether the library
1501 supports wide-characters, are provided in the tinfo library.
1502 .IP
1503 By doing this, it is possible to share the tinfo library between
1504 wide/normal configurations as well as reduce the size of the library
1505 when only low-level functions are needed.
1506 .IP
1507 Those functions are described in these pages:
1508 .RS
1509 .bP
1510 \fBcurs_extend\fP(3X) \- miscellaneous curses extensions
1511 .bP
1512 \fBcurs_inopts\fP(3X) \- \fBcurses\fP input options
1513 .bP
1514 \fBcurs_kernel\fP(3X) \- low-level \fBcurses\fP routines
1515 .bP
1516 \fBcurs_termattrs\fP(3X) \- \fBcurses\fP environment query routines
1517 .bP
1518 \fBcurs_termcap\fP(3X) \- \fBcurses\fP emulation of termcap
1519 .bP
1520 \fBcurs_terminfo\fP(3X) \- \fBcurses\fP interfaces to terminfo database
1521 .bP
1522 \fBcurs_util\fP(3X) \- miscellaneous \fBcurses\fP utility routines
1523 .RE
1524 .TP 5
1525 \-\-with\-trace
1526 The \fBtrace\fP function normally resides in the debug library,
1527 but it is sometimes useful to configure this in the shared library.
1528 Configure scripts should check for the function's existence rather
1529 than assuming it is always in the debug library.
1530 .SH FILES
1531 .TP
1532 .I @DATADIR@/tabset
1533 tab stop initialization database
1534 .TP
1535 .I \*d
1536 compiled terminal capability database
1537 .SH NOTES
1538 If standard output from a \fI\%ncurses\fP program is re-directed to
1539 something which is not a tty,
1540 screen updates will be directed to standard error.
1541 This was an undocumented feature of AT&T System V Release 3 curses.
1542 .PP
1543 See subsection \*(``Header files\*('' below regarding symbols exposed by
1544 inclusion of \fI\%curses.h\fP.
1545 .SH EXTENSIONS
1546 The \fI\%ncurses\fP library can be compiled with an option
1547 (\fB\-DUSE_GETCAP\fP)
1548 that falls back to the old-style /etc/termcap file if the terminal setup code
1549 cannot find a terminfo entry corresponding to \fITERM\fP.
1550 Use of this feature is not recommended,
1551 as it essentially includes an entire termcap compiler in the
1552 \fI\%ncurses\fP startup code,
1553 at significant cost in core and startup cycles.
1554 .PP
1555 The \fI\%ncurses\fP library includes facilities for capturing mouse
1556 events on certain terminals
1557 (including xterm).
1558 See the \fBcurs_mouse\fP(3X)
1559 manual page for details.
1560 .PP
1561 The \fI\%ncurses\fP library includes facilities for responding to window
1562 resizing events, e.g., when running in an xterm.
1563 See the \fBresizeterm\fP(3X)
1564 and \fBwresize\fP(3X) manual pages for details.
1565 In addition, the library may be configured with a \fBSIGWINCH\fP handler.
1566 .PP
1567 The \fI\%ncurses\fP library extends the fixed set of function key
1568 capabilities of terminals by allowing the application designer to define
1569 additional key sequences at runtime.
1570 See the \fBdefine_key\fP(3X)
1571 \fBkey_defined\fP(3X),
1572 and \fBkeyok\fP(3X) manual pages for details.
1573 .PP
1574 The \fI\%ncurses\fP library can exploit the capabilities of terminals
1575 which implement the ISO\-6429 SGR 39 and SGR 49 controls,
1576 which allow an application to reset the terminal to its original
1577 foreground and background colors.
1578 From the users' perspective, the application is able to draw colored
1579 text on a background whose color is set independently, providing better
1580 control over color contrasts.
1581 See the \fBdefault_colors\fP(3X) manual page for details.
1582 .PP
1583 The \fI\%ncurses\fP library includes a function for directing
1584 application output to a printer attached to the terminal device.
1585 See the \fBcurs_print\fP(3X) manual page for details.
1586 .SH PORTABILITY
1587 The \fI\%ncurses\fP library is intended to be BASE-level conformant with
1588 XSI Curses.
1589 The EXTENDED XSI Curses functionality
1590 (including color support) is supported.
1591 .PP
1592 A small number of local differences
1593 (that is,
1594 individual differences between the XSI Curses and \fI\%ncurses\fP calls)
1595 are described in \fBPORTABILITY\fP sections of the library man pages.
1596 .SS Error checking
1597 In many cases, X/Open Curses is vague about error conditions,
1598 omitting some of the SVr4 documentation.
1599 .PP
1600 Unlike other implementations, this one checks parameters such as pointers
1601 to WINDOW structures to ensure they are not null.
1602 The main reason for providing this behavior is to guard against programmer
1603 error.
1604 The standard interface does not provide a way for the library
1605 to tell an application which of several possible errors were detected.
1606 Relying on this (or some other) extension will adversely affect the
1607 portability of curses applications.
1608 .SS Extensions versus portability
1609 Most of the extensions provided by \fI\%ncurses\fP have not been
1610 standardized.
1611 Some have been incorporated into other implementations, such as
1612 PDCurses or NetBSD curses.
1613 Here are a few to consider:
1614 .bP
1615 The routine \fBhas_key\fP is not part of XPG4, nor is it present in SVr4.
1616 See the \fBcurs_getch\fP(3X) manual page for details.
1617 .bP
1618 The routine \fBslk_attr\fP is not part of XPG4, nor is it present in SVr4.
1619 See the \fBcurs_slk\fP(3X) manual page for details.
1620 .bP
1621 The routines \fBgetmouse\fP, \fBmousemask\fP, \fBungetmouse\fP,
1622 \fBmouseinterval\fP, and \fBwenclose\fP relating to mouse interfacing are not
1623 part of XPG4, nor are they present in SVr4.
1624 See the \fBcurs_mouse\fP(3X) manual page for details.
1625 .bP
1626 The routine \fBmcprint\fP was not present in any previous curses implementation.
1627 See the \fBcurs_print\fP(3X) manual page for details.
1628 .bP
1629 The routine \fBwresize\fP is not part of XPG4, nor is it present in SVr4.
1630 See the \fBwresize\fP(3X) manual page for details.
1631 .bP
1632 The WINDOW structure's internal details can be hidden from application
1633 programs.
1634 See \fBcurs_opaque\fP(3X) for the discussion of \fBis_scrollok\fP, etc.
1635 .bP
1636 This implementation can be configured to provide rudimentary support
1637 for multi-threaded applications.
1638 See \fBcurs_threads\fP(3X) for details.
1639 .bP
1640 This implementation can also be configured to provide a set of functions which
1641 improve the ability to manage multiple screens.
1642 See \fBcurs_sp_funcs\fP(3X) for details.
1643 .SS Padding differences
1644 In historic curses versions, delays embedded in the capabilities \fBcr\fP,
1645 \fBind\fP, \fBcub1\fP, \fBff\fP and \fBtab\fP activated corresponding delay
1646 bits in the Unix tty driver.
1647 In this implementation, all padding is done by sending NUL bytes.
1648 This method is slightly more expensive, but narrows the interface
1649 to the Unix kernel significantly and increases the package's portability
1650 correspondingly.
1651 .SS Header files
1652 The header file \fI\%curses.h\fP itself includes the header files
1653 \fI\%stdio.h\fP and \fI\%unctrl.h\fP.
1654 .PP
1655 X/Open Curses has more to say,
1656 but does not finish the story:
1657 .RS 4
1658 .PP
1659 The inclusion of <curses.h> may make visible all symbols
1660 from the headers <stdio.h>, <term.h>, <termios.h>, and <wchar.h>.
1661 .RE
1662 .PP
1663 Here is a more complete story:
1664 .bP
1665 Starting with BSD curses, all implementations have included <stdio.h>.
1666 .IP
1667 BSD curses included <curses.h> and <unctrl.h> from an internal header
1668 file
1669 .I \%curses.ext
1670 (\*(``ext\*('' abbreviated \*(``externs\*('').
1671 .IP
1672 BSD curses used <stdio.h> internally (for \fBprintw\fP and \fBscanw\fP),
1673 but nothing in <curses.h> itself relied upon <stdio.h>.
1674 .bP
1675 SVr2 curses added \fBnewterm\fP(3X), which relies upon <stdio.h>.
1676 That is, the function prototype uses \fBFILE\fP.
1677 .IP
1678 SVr4 curses added \fBputwin\fP and \fBgetwin\fP, which also use <stdio.h>.
1679 .IP
1680 X/Open Curses documents all three of these functions.
1681 .IP
1682 SVr4 curses and X/Open Curses do not require the developer to
1683 include <stdio.h> before including <curses.h>.
1684 Both document curses showing <curses.h> as the only required header.
1685 .IP
1686 As a result, standard <curses.h> will always include <stdio.h>.
1687 .bP
1688 X/Open Curses is inconsistent with respect to SVr4 regarding <unctrl.h>.
1689 .IP
1690 As noted in \fBcurs_util\fP(3X),
1691 \fI\%ncurses\fP includes <unctrl.h> from <curses.h>
1692 (like SVr4).
1693 .bP
1694 X/Open's comments about <term.h> and <termios.h> may refer to HP-UX and AIX:
1695 .IP
1696 HP-UX curses includes <term.h> from <curses.h>
1697 to declare \fBsetupterm\fP in curses.h,
1698 but \fI\%ncurses\fP (and Solaris curses) do not.
1699 .IP
1700 AIX curses includes <term.h> and <termios.h>.
1701 Again, \fI\%ncurses\fP (and Solaris curses) do not.
1702 .bP
1703 X/Open says that <curses.h> \fImay\fP include <term.h>,
1704 but there is no requirement that it do that.
1705 .IP
1706 Some programs use functions declared in both <curses.h> and <term.h>,
1707 and must include both headers in the same module.
1708 Very old versions of AIX curses required including <curses.h>
1709 before including <term.h>.
1710 .IP
1711 Because \fI\%ncurses\fP header files include the headers needed to
1712 define datatypes used in the headers,
1713 \fI\%ncurses\fP header files can be included in any order.
1714 But for portability, you should include <curses.h> before <term.h>.
1715 .bP
1716 X/Open Curses says \fI"may make visible"\fP
1717 because including a header file does not necessarily make all symbols
1718 in it visible (there are ifdef's to consider).
1719 .IP
1720 For instance, in \fI\%ncurses\fP <wchar.h> \fImay\fP be included if
1721 the proper symbol is defined, and if \fI\%ncurses\fP is configured for
1722 wide-character support.
1723 If the header is included, its symbols may be made visible.
1724 That depends on the value used for \fB_XOPEN_SOURCE\fP
1725 feature test macro.
1726 .bP
1727 X/Open Curses documents one required header,
1728 in a special case: <stdarg.h> before <curses.h> to prototype
1729 the \fBvw_printw\fP and \fBvw_scanw\fP functions
1730 (as well as the obsolete
1731 the \fBvwprintw\fP and \fBvwscanw\fP functions).
1732 Each of those uses a \fBva_list\fP parameter.
1733 .IP
1734 The two obsolete functions were introduced in SVr3.
1735 The other functions were introduced in X/Open Curses.
1736 In between, SVr4 curses provided for the possibility that
1737 an application might include either <varargs.h> or <stdarg.h>.
1738 Initially, that was done by using \fBvoid*\fP for the \fBva_list\fP
1739 parameter.
1740 Later, a special type (defined in <stdio.h>) was introduced,
1741 to allow for compiler type-checking.
1742 That special type is always available,
1743 because <stdio.h> is always included by <curses.h>.
1744 .IP
1745 None of the X/Open Curses implementations require an application
1746 to include <stdarg.h> before <curses.h> because they either
1747 have allowed for a special type,
1748 or
1749 (like \fI\%ncurses\fP)
1750 include <stdarg.h> directly to provide a portable interface.
1751 .SH AUTHORS
1752 Zeyd M. Ben-Halim, Eric S. Raymond, Thomas E. Dickey.
1753 Based on \fIpcurses\fP by Pavel Curtis.
1754 .SH SEE ALSO
1755 \fB\%curs_variables\fP(3X),
1756 \fB\%terminfo\fP(5),
1757 \fB\%user_caps\fP(5)