]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_terminfo.3x
ncurses 6.2 - patch 20210102
[ncurses.git] / man / curs_terminfo.3x
1 .\"***************************************************************************
2 .\" Copyright 2018-2020,2021 Thomas E. Dickey                                *
3 .\" Copyright 1998-2016,2017 Free Software Foundation, Inc.                  *
4 .\"                                                                          *
5 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
6 .\" copy of this software and associated documentation files (the            *
7 .\" "Software"), to deal in the Software without restriction, including      *
8 .\" without limitation the rights to use, copy, modify, merge, publish,      *
9 .\" distribute, distribute with modifications, sublicense, and/or sell       *
10 .\" copies of the Software, and to permit persons to whom the Software is    *
11 .\" furnished to do so, subject to the following conditions:                 *
12 .\"                                                                          *
13 .\" The above copyright notice and this permission notice shall be included  *
14 .\" in all copies or substantial portions of the Software.                   *
15 .\"                                                                          *
16 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
17 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
18 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
19 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
20 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
21 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
22 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
23 .\"                                                                          *
24 .\" Except as contained in this notice, the name(s) of the above copyright   *
25 .\" holders shall not be used in advertising or otherwise to promote the     *
26 .\" sale, use or other dealings in this Software without prior written       *
27 .\" authorization.                                                           *
28 .\"***************************************************************************
29 .\"
30 .\" $Id: curs_terminfo.3x,v 1.72 2021/01/02 23:50:04 tom Exp $
31 .TH curs_terminfo 3X ""
32 .ie \n(.g .ds `` \(lq
33 .el       .ds `` ``
34 .ie \n(.g .ds '' \(rq
35 .el       .ds '' ''
36 .de bP
37 .ie n  .IP \(bu 4
38 .el    .IP \(bu 2
39 ..
40 .ds n 5
41 .na
42 .hy 0
43 .SH NAME
44 \fBdel_curterm\fR,
45 \fBmvcur\fR,
46 \fBputp\fR,
47 \fBrestartterm\fR,
48 \fBset_curterm\fR,
49 \fBsetupterm\fR,
50 \fBtigetflag\fR,
51 \fBtigetnum\fR,
52 \fBtigetstr\fR,
53 \fBtiparm\fR,
54 \fBtparm\fR,
55 \fBtputs\fR,
56 \fBvid_attr\fR,
57 \fBvid_puts\fR,
58 \fBvidattr\fR,
59 \fBvidputs\fR \- \fBcurses\fR interfaces to terminfo database
60 .ad
61 .hy
62 .SH SYNOPSIS
63 .nf
64 \fB#include <curses.h>\fR
65 \fB#include <term.h>\fR
66 .sp
67 \fBTERMINAL *cur_term;\fR
68 .sp
69 \fBconst char * const boolnames[];\fP
70 \fBconst char * const boolcodes[];\fP
71 \fBconst char * const boolfnames[];\fP
72 \fBconst char * const numnames[];\fP
73 \fBconst char * const numcodes[];\fP
74 \fBconst char * const numfnames[];\fP
75 \fBconst char * const strnames[];\fP
76 \fBconst char * const strcodes[];\fP
77 \fBconst char * const strfnames[];\fP
78 .sp
79 \fBint setupterm(const char *\fR\fIterm\fR\fB, int \fR\fIfiledes\fR\fB, int *\fR\fIerrret\fR\fB);\fR
80 .br
81 \fBTERMINAL *set_curterm(TERMINAL *\fR\fInterm\fR\fB);\fR
82 .br
83 \fBint del_curterm(TERMINAL *\fR\fIoterm\fR\fB);\fR
84 .br
85 \fBint restartterm(const char *\fR\fIterm\fR\fB, int \fR\fIfiledes\fR\fB, int *\fR\fIerrret\fR\fB);\fR
86 .sp
87 \fBchar *tparm(const char *\fR\fIstr\fR\fB, ...);\fR
88 .br
89 \fBint tputs(const char *\fR\fIstr\fR\fB, int \fR\fIaffcnt\fR\fB, int (*\fR\fIputc\fR\fB)(int));\fR
90 .br
91 \fBint putp(const char *\fR\fIstr\fR\fB);\fR
92 .sp
93 \fBint vidputs(chtype \fR\fIattrs\fR\fB, int (*\fR\fIputc\fR\fB)(int));\fR
94 .br
95 \fBint vidattr(chtype \fR\fIattrs\fR\fB);\fR
96 .br
97 \fBint vid_puts(attr_t \fR\fIattrs\fR\fB, short \fR\fIpair\fR\fB, void *\fR\fIopts\fR\fB, int (*\fR\fIputc\fR\fB)(int));\fR
98 .br
99 \fBint vid_attr(attr_t \fR\fIattrs\fR\fB, short \fR\fIpair\fR\fB, void *\fR\fIopts\fR\fB);\fR
100 .sp
101 \fBint mvcur(int \fR\fIoldrow\fR\fB, int \fR\fIoldcol\fR\fB, int \fR\fInewrow\fR, int \fR\fInewcol\fR\fB);\fR
102 .sp
103 \fBint tigetflag(const char *\fR\fIcapname\fR\fB);\fR
104 .br
105 \fBint tigetnum(const char *\fR\fIcapname\fR\fB);\fR
106 .br
107 \fBchar *tigetstr(const char *\fR\fIcapname\fR\fB);\fR
108 .sp
109 \fBchar *tiparm(const char *\fR\fIstr\fR\fB, ...);\fR
110 .br
111 .fi
112 .SH DESCRIPTION
113 These low-level routines must be called by programs that have to deal
114 directly with the \fBterminfo\fR database to handle certain terminal
115 capabilities, such as programming function keys.
116 For all other
117 functionality, \fBcurses\fR routines are more suitable and their use is
118 recommended.
119 .PP
120 None of these functions use (or are aware of) multibyte character strings
121 such as UTF-8:
122 .bP
123 capability names use the POSIX portable character set
124 .bP
125 capability string values have no associated encoding;
126 they are strings of 8-bit characters.
127 .SS Initialization
128 .PP
129 Initially, \fBsetupterm\fR should be called.
130 The high-level curses functions \fBinitscr\fR and
131 \fBnewterm\fR call \fBsetupterm\fP to initialize the
132 low-level set of terminal-dependent variables
133 [listed in \fBterminfo\fR(\*n)].
134 .PP
135 Applications can use the
136 terminal capabilities either directly (via header definitions),
137 or by special functions.
138 The header files \fBcurses.h\fR and \fBterm.h\fR should be included (in this
139 order) to get the definitions for these strings, numbers, and flags.
140 .PP
141 The \fBterminfo\fR variables
142 \fBlines\fR and \fBcolumns\fR are initialized by \fBsetupterm\fR as
143 follows:
144 .bP
145 If \fBuse_env(FALSE)\fR has been called, values for
146 \fBlines\fR and \fBcolumns\fR specified in \fBterminfo\fR are used.
147 .bP
148 Otherwise, if the environment variables \fBLINES\fR and \fBCOLUMNS\fR
149 exist, their values are used.
150 If these environment variables do not
151 exist and the program is running in a window, the current window size
152 is used.
153 Otherwise, if the environment variables do not exist, the
154 values for \fBlines\fR and \fBcolumns\fR specified in the
155 \fBterminfo\fR database are used.
156 .PP
157 Parameterized strings should be passed through \fBtparm\fR to instantiate them.
158 All \fBterminfo\fR strings
159 (including the output of \fBtparm\fR)
160 should be printed
161 with \fBtputs\fR or \fBputp\fR.
162 Call \fBreset_shell_mode\fR to restore the
163 tty modes before exiting [see \fBcurs_kernel\fR(3X)].
164 .PP
165 Programs which use
166 cursor addressing should
167 .bP
168 output \fBenter_ca_mode\fR upon startup and
169 .bP
170 output \fBexit_ca_mode\fR before exiting.
171 .PP
172 Programs which execute shell subprocesses should
173 .bP
174 call \fBreset_shell_mode\fR and
175 output \fBexit_ca_mode\fR before the shell
176 is called and
177 .bP
178 output \fBenter_ca_mode\fR and
179 call \fBreset_prog_mode\fR after returning from the shell.
180 .PP
181 The \fBsetupterm\fR routine reads in the \fBterminfo\fR database,
182 initializing the \fBterminfo\fR structures, but does not set up the
183 output virtualization structures used by \fBcurses\fR.
184 These are its parameters:
185 .RS 3
186 .TP 5
187 \fIterm\fP
188 is the terminal type, a character string.
189 If \fIterm\fR is null, the environment variable \fBTERM\fR is used.
190 .TP 5
191 \fIfiledes\fP
192 is the file descriptor used for all output.
193 .TP 5
194 \fIerrret\fP
195 points to an optional location where an error status can be returned to
196 the caller.
197 If \fIerrret\fR is not null,
198 then \fBsetupterm\fR returns \fBOK\fR or
199 \fBERR\fR and stores a status value in the integer pointed to by
200 \fIerrret\fR.
201 A return value of \fBOK\fR combined with status of \fB1\fR in \fIerrret\fR
202 is normal.
203 .IP
204 If \fBERR\fR is returned, examine \fIerrret\fR:
205 .RS
206 .TP 5
207 .B 1
208 means that the terminal is hardcopy, cannot be used for curses applications.
209 .IP
210 \fBsetupterm\fP determines if the entry is a hardcopy type by
211 checking the \fBhc\fP (\fBhardcopy\fP) capability.
212 .TP 5
213 .B 0
214 means that the terminal could not be found,
215 or that it is a generic type,
216 having too little information for curses applications to run.
217 .IP
218 \fBsetupterm\fP determines if the entry is a generic type by
219 checking the \fBgn\fP (\fBgeneric\fP) capability.
220 .TP 5
221 .B \-1
222 means that the \fBterminfo\fR database could not be found.
223 .RE
224 .IP
225 If \fIerrret\fR is
226 null, \fBsetupterm\fR prints an error message upon finding an error
227 and exits.
228 Thus, the simplest call is:
229 .sp
230       \fBsetupterm((char *)0, 1, (int *)0);\fR,
231 .sp
232 which uses all the defaults and sends the output to \fBstdout\fR.
233 .RE
234 .\" ***************************************************************************
235 .SS The Terminal State
236 .PP
237 The \fBsetupterm\fR routine stores its information about the terminal
238 in a \fBTERMINAL\fP structure pointed to by the global variable \fBcur_term\fP.
239 If it detects an error,
240 or decides that the terminal is unsuitable (hardcopy or generic),
241 it discards this information,
242 making it not available to applications.
243 .PP
244 If \fBsetupterm\fP is called repeatedly for the same terminal type,
245 it will reuse the information.
246 It maintains only one copy of a given terminal's capabilities in memory.
247 If it is called for different terminal types,
248 \fBsetupterm\fP allocates new storage for each set of terminal capabilities.
249 .PP
250 The \fBset_curterm\fR routine sets \fBcur_term\fR to
251 \fInterm\fR, and makes all of the \fBterminfo\fR boolean, numeric, and
252 string variables use the values from \fInterm\fR.
253 It returns the old value of \fBcur_term\fR.
254 .PP
255 The \fBdel_curterm\fR routine frees the space pointed to by
256 \fIoterm\fR and makes it available for further use.
257 If \fIoterm\fR is
258 the same as \fBcur_term\fR, references to any of the \fBterminfo\fR
259 boolean, numeric, and string variables thereafter may refer to invalid
260 memory locations until another \fBsetupterm\fR has been called.
261 .PP
262 The \fBrestartterm\fR routine is similar to \fBsetupterm\fR and \fBinitscr\fR,
263 except that it is called after restoring memory to a previous state (for
264 example, when reloading a game saved as a core image dump).
265 \fBrestartterm\fP assumes that the windows and the input and output options
266 are the same as when memory was saved,
267 but the terminal type and baud rate may be different.
268 Accordingly, \fBrestartterm\fP saves various tty state bits,
269 calls \fBsetupterm\fP, and then restores the bits.
270 .\" ***************************************************************************
271 .SS Formatting Output
272 .PP
273 The \fBtparm\fR routine instantiates the string \fIstr\fR with
274 parameters \fIpi\fR.  A pointer is returned to the result of \fIstr\fR
275 with the parameters applied.
276 Application developers should keep in mind these quirks of the interface:
277 .bP
278 Although \fBtparm\fP's actual parameters may be integers or strings,
279 the prototype expects \fBlong\fP (integer) values.
280 .bP
281 Aside from the \fBset_attributes\fP (\fBsgr\fP) capability,
282 most terminal capabilities require no more than one or two parameters.
283 .PP
284 \fBtiparm\fP is a newer form of \fBtparm\fP which uses \fI<stdarg.h>\fP
285 rather than a fixed-parameter list.
286 Its numeric parameters are integers (int) rather than longs.
287 .\" ***************************************************************************
288 .SS Output Functions
289 .PP
290 The \fBtputs\fR routine applies padding information to the string
291 \fIstr\fR and outputs it:
292 .bP
293 The \fIstr\fR parameter must be a terminfo string
294 variable or the return value from
295 \fBtparm\fR, \fBtiparm\fP, \fBtgetstr\fR, or \fBtgoto\fR.
296 .IP
297 The \fBtgetstr\fP and \fBtgoto\fP functions are part of the \fItermcap\fP
298 interface,
299 which happens to share this function name with the \fIterminfo\fP interface.
300 .bP
301 \fIaffcnt\fR is the number of lines affected, or 1 if
302 not applicable.
303 .bP
304 \fIputc\fR is a \fBputchar\fR-like routine to which
305 the characters are passed, one at a time.
306 .PP
307 The \fBputp\fR routine calls \fBtputs(\fR\fIstr\fR\fB, 1, putchar)\fR.
308 The output of \fBputp\fR always goes to \fBstdout\fR, rather than
309 the \fIfiledes\fR specified in \fBsetupterm\fR.
310 .PP
311 The \fBvidputs\fR routine displays the string on the terminal in the
312 video attribute mode \fIattrs\fR, which is any combination of the
313 attributes listed in \fBcurses\fR(3X).
314 The characters are passed to
315 the \fBputchar\fR-like routine \fIputc\fR.
316 .PP
317 The \fBvidattr\fR routine is like the \fBvidputs\fR routine, except
318 that it outputs through \fBputchar\fR.
319 .PP
320 The \fBvid_attr\fR and \fBvid_puts\fR routines correspond
321 to vidattr and vidputs, respectively.
322 They use a set of arguments for representing the video attributes plus color,
323 i.e.,
324 .bP
325 \fIattrs\fP of type \fBattr_t\fP for the attributes and
326 .bP
327 \fIpair\fP of type \fBshort\fP for the color-pair number.
328 .PP
329 The \fBvid_attr\fR and \fBvid_puts\fR routines
330 are designed to use the attribute constants with the \fIWA_\fR prefix.
331 .PP
332 X/Open Curses reserves the \fIopts\fP argument for future use,
333 saying that applications must provide a null pointer for that argument.
334 As an extension,
335 this implementation allows \fIopts\fP to be used as a pointer to \fBint\fP,
336 which overrides the \fIpair\fP (\fBshort\fP) argument.
337 .PP
338 The \fBmvcur\fR routine provides low-level cursor motion.
339 It takes effect immediately (rather than at the next refresh).
340 .PP
341 While \fBputp\fR and \fBmvcur\fP are low-level functions which
342 do not use the high-level curses state,
343 they are declared in \fB<curses.h>\fP because SystemV did this
344 (see \fBHISTORY\fP).
345 .\" ***************************************************************************
346 .SS Terminal Capability Functions
347 .PP
348 The \fBtigetflag\fR, \fBtigetnum\fR and \fBtigetstr\fR routines return
349 the value of the capability corresponding to the \fBterminfo\fR
350 \fIcapname\fR passed to them, such as \fBxenl\fR.
351 The \fIcapname\fR for each capability is given in the table column entitled
352 \fIcapname\fR code in the capabilities section of \fBterminfo\fR(\*n).
353 .PP
354 These routines return special values to denote errors.
355 .PP
356 The \fBtigetflag\fR routine returns
357 .TP
358 \fB\-1\fR
359 if \fIcapname\fR is not a boolean capability,
360 or
361 .TP
362 \fB0\fR
363 if it is canceled or absent from the terminal description.
364 .PP
365 The \fBtigetnum\fR routine returns
366 .TP
367 \fB\-2\fR
368 if \fIcapname\fR is not a numeric capability, or
369 .TP
370 \fB\-1\fR
371 if it is canceled or absent from the terminal description.
372 .PP
373 The \fBtigetstr\fR routine returns
374 .TP
375 \fB(char *)\-1\fR
376 if \fIcapname\fR is not a string capability,
377 or
378 .TP
379 \fB0\fR
380 if it is canceled or absent from the terminal description.
381 .\" ***************************************************************************
382 .SS Terminal Capability Names
383 .PP
384 These null-terminated arrays contain
385 .bP
386 the short terminfo names (\*(``codes\*(''),
387 .bP
388 the \fBtermcap\fR names (\*(``names\*(''), and
389 .bP
390 the long terminfo names (\*(``fnames\*('')
391 .PP
392 for each of the predefined \fBterminfo\fR variables:
393 .sp
394 .RS
395 \fBconst char *boolnames[]\fR, \fB*boolcodes[]\fR, \fB*boolfnames[]\fR
396 .br
397 \fBconst char *numnames[]\fR, \fB*numcodes[]\fR, \fB*numfnames[]\fR
398 .br
399 \fBconst char *strnames[]\fR, \fB*strcodes[]\fR, \fB*strfnames[]\fR
400 .RE
401 .SH RETURN VALUE
402 Routines that return an integer return \fBERR\fR upon failure and \fBOK\fR
403 (SVr4 only specifies \*(``an integer value other than \fBERR\fR\*('')
404 upon successful completion,
405 unless otherwise noted in the preceding routine descriptions.
406 .PP
407 Routines that return pointers always return \fBNULL\fR on error.
408 .PP
409 X/Open defines no error conditions.
410 In this implementation
411 .RS 3
412 .TP 5
413 \fBdel_curterm\fP
414 returns an error
415 if its terminal parameter is null.
416 .TP 5
417 \fBputp\fP
418 calls \fBtputs\fP, returning the same error-codes.
419 .TP 5
420 \fBrestartterm\fP
421 returns an error
422 if the associated call to \fBsetupterm\fP returns an error.
423 .TP 5
424 \fBsetupterm\fP
425 returns an error
426 if it cannot allocate enough memory, or
427 create the initial windows (stdscr, curscr, newscr).
428 Other error conditions are documented above.
429 .TP 5
430 \fBtputs\fP
431 returns an error if the string parameter is null.
432 It does not detect I/O errors:
433 X/Open states that \fBtputs\fP ignores the return value
434 of the output function \fIputc\fP.
435 .RE
436 .\" ***************************************************************************
437 .SS Compatibility macros
438 This implementation provides a few macros for compatibility with systems
439 before SVr4 (see \fBHISTORY\fP).
440 Those include
441 \fBcrmode\fP,
442 \fBfixterm\fP,
443 \fBgettmode\fP,
444 \fBnocrmode\fP,
445 \fBresetterm\fP,
446 \fBsaveterm\fP, and
447 \fBsetterm\fP.
448 .PP
449 In SVr4, those are found in \fB<curses.h>\fP,
450 but except for \fBsetterm\fR, are likewise macros.
451 The one function, \fBsetterm\fR, is mentioned in the manual page.
452 The manual page notes that the \fBsetterm\fR routine
453 was replaced by \fBsetupterm\fR, stating that the call:
454 .sp
455       \fBsetupterm(\fR\fIterm\fR\fB, 1, (int *)0)\fR
456 .sp
457 provides the same functionality as \fBsetterm(\fR\fIterm\fR\fB)\fR,
458 and is not recommended for new programs.
459 This implementation provides each of those symbols
460 as macros for BSD compatibility,
461 .\" ***************************************************************************
462 .SH HISTORY
463 .PP
464 SVr2 introduced the terminfo feature.
465 Its programming manual mentioned these low-level functions:
466 .TS
467 l l
468 _ _
469 l l.
470 \fBFunction\fR  \fBDescription\fR
471 fixterm restore tty to \*(``in curses\*('' state
472 gettmode        establish current tty modes
473 mvcur   low level cursor motion
474 putp    T{
475 utility function that uses \fBtputs\fP to send characters via \fBputchar\fP.
476 T}
477 resetterm       set tty modes to \*(``out of curses\*('' state
478 resetty reset tty flags to stored value
479 saveterm        save current modes as \*(``in curses\*('' state
480 savetty store current tty flags
481 setterm establish terminal with given type
482 setupterm       establish terminal with given type
483 tparm   instantiate a string expression with parameters
484 tputs   apply padding information to a string
485 vidattr like \fBvidputs\fP, but outputs through \fBputchar\fP
486 vidputs T{
487 output a string to put terminal in a specified video attribute mode
488 T}
489 .TE
490 .PP
491 The programming manual also mentioned
492 functions provided for termcap compatibility
493 (commenting that they \*(``may go away at a later date\*(''):
494 .TS
495 l l
496 _ _
497 l l.
498 \fBFunction\fR  \fBDescription\fR
499 tgetent look up termcap entry for given \fIname\fP
500 tgetflag        get boolean entry for given \fIid\fP
501 tgetnum get numeric entry for given \fIid\fP
502 tgetstr get string entry for given \fIid\fP
503 tgoto   apply parameters to given capability
504 tputs   T{
505 apply padding to capability, calling a function to put characters
506 T}
507 .TE
508 .PP
509 Early terminfo programs obtained capability values from the
510 \fBTERMINAL\fP structure initialized by \fBsetupterm\fR.
511 .PP
512 SVr3 extended terminfo by adding functions to retrieve capability values
513 (like the termcap interface),
514 and reusing tgoto and tputs:
515 .TS
516 l l
517 _ _
518 l l.
519 \fBFunction\fR  \fBDescription\fR
520 tigetflag       get boolean entry for given \fIid\fP
521 tigetnum        get numeric entry for given \fIid\fP
522 tigetstr        get string entry for given \fIid\fP
523 .TE
524 .PP
525 SVr3 also replaced several of the SVr2 terminfo functions
526 which had no counterpart in the termcap interface,
527 documenting them as obsolete:
528 .TS
529 l l
530 _ _
531 l l.
532 \fBFunction\fR  \fBReplaced by\fP
533 crmode  cbreak  
534 fixterm reset_prog_mode 
535 gettmode        N/A     
536 nocrmode        nocbreak        
537 resetterm       reset_shell_mode        
538 saveterm        def_prog_mode   
539 setterm setupterm       
540 .TE
541 .PP
542 SVr3 kept the \fBmvcur\fP, \fBvidattr\fP and \fBvidputs\fP functions,
543 along with \fBputp\fP, \fBtparm\fP and \fBtputs\fP.
544 The latter were needed to support padding,
545 and handling functions such as \fBvidattr\fP
546 (which used more than the two parameters supported by \fBtgoto\fP).
547 .PP
548 SVr3 introduced the functions for switching between terminal
549 descriptions, e.g., \fBset_curterm\fP.
550 The various global variables such as \fBboolnames\fP were mentioned
551 in the programming manual at this point.
552 .PP
553 SVr4 added the \fBvid_attr\fP and \fBvid_puts\fP functions.
554 .PP
555 There are other low-level functions declared in the curses header files
556 on Unix systems,
557 but none were documented.
558 The functions marked \*(``obsolete\*('' remained in use
559 by the Unix \fBvi\fP editor.
560 .SH PORTABILITY
561 .SS Legacy functions
562 .PP
563 X/Open notes that \fBvidattr\fR and \fBvidputs\fR may be macros.
564 .PP
565 The function \fBsetterm\fR is not described by X/Open and must
566 be considered non-portable.
567 All other functions are as described by X/Open.
568 .SS Legacy data
569 .PP
570 \fBsetupterm\fP copies the terminal name to the array \fBttytype\fP.
571 This is not part of X/Open Curses, but is assumed by some applications.
572 .PP
573 Other implementions may not declare the capability name arrays.
574 Some provide them without declaring them.
575 X/Open does not specify them.
576 .PP
577 Extended terminal capability names, e.g., as defined by \fB@TIC@\ \-x\fP,
578 are not stored in the arrays described here.
579 .SS Output buffering
580 .PP
581 Older versions of \fBncurses\fP assumed that the file descriptor passed to
582 \fBsetupterm\fP from \fBinitscr\fP or \fBnewterm\fP uses buffered I/O,
583 and would write to the corresponding stream.
584 In addition to the limitation that the terminal was left in block-buffered
585 mode on exit (like System V curses),
586 it was problematic because \fBncurses\fP
587 did not allow a reliable way to cleanup on receiving SIGTSTP.
588 .PP
589 The current version (ncurses6)
590 uses output buffers managed directly by \fBncurses\fP.
591 Some of the low-level functions described in this manual page write
592 to the standard output.
593 They are not signal-safe.
594 The high-level functions in \fBncurses\fP use
595 alternate versions of these functions
596 using the more reliable buffering scheme.
597 .SS Function prototypes
598 .PP
599 The X/Open Curses prototypes are based on the SVr4 curses header declarations,
600 which were defined at the same time the C language was first standardized in
601 the late 1980s.
602 .bP
603 X/Open Curses uses \fBconst\fP less effectively than a later design might,
604 in some cases applying it needlessly to values are already constant,
605 and in most cases overlooking parameters which normally would use \fBconst\fP.
606 Using constant parameters for functions which do not use \fBconst\fP
607 may prevent the program from compiling.
608 On the other hand, \fIwritable strings\fP are an obsolescent feature.
609 .IP
610 As an extension, this implementation can be configured to change the
611 function prototypes to use the \fBconst\fP keyword.
612 The ncurses ABI 6 enables this feature by default.
613 .bP
614 X/Open Curses prototypes \fBtparm\fR with a fixed number of parameters,
615 rather than a variable argument list.
616 .IP
617 This implementation uses a variable argument list, but can be
618 configured to use the fixed-parameter list.
619 Portable applications should provide 9 parameters after the format;
620 zeroes are fine for this purpose.
621 .IP
622 In response to review comments by Thomas E. Dickey,
623 X/Open Curses Issue 7 proposed the \fBtiparm\fP function in mid-2009.
624 .SS Special TERM treatment
625 .PP
626 If configured to use the terminal-driver,
627 e.g., for the MinGW port,
628 .bP
629 \fBsetupterm\fP interprets a missing/empty TERM variable as the
630 special value \*(``unknown\*(''.
631 .bP
632 \fBsetupterm\fP allows explicit use of the
633 the windows console driver by checking if $TERM is set to
634 \*(``#win32con\*('' or an abbreviation of that string.
635 .SS Other portability issues
636 .PP
637 In System V Release 4, \fBset_curterm\fR has an \fBint\fR return type and
638 returns \fBOK\fR or \fBERR\fR.  We have chosen to implement the X/Open Curses
639 semantics.
640 .PP
641 In System V Release 4, the third argument of \fBtputs\fR has the type
642 \fBint (*putc)(char)\fR.
643 .PP
644 At least one implementation of X/Open Curses (Solaris) returns a value
645 other than \fBOK\fP/\fBERR\fP from \fBtputs\fP.
646 That returns the length of the string, and does no error-checking.
647 .PP
648 X/Open notes that after calling \fBmvcur\fR, the curses state may not match the
649 actual terminal state, and that an application should touch and refresh
650 the window before resuming normal curses calls.
651 Both \fBncurses\fP and System V Release 4 curses implement \fBmvcur\fR using
652 the SCREEN data allocated in either \fBinitscr\fR or \fBnewterm\fR.
653 So though it is documented as a terminfo function,
654 \fBmvcur\fR is really a curses function which is not well specified.
655 .PP
656 X/Open states that the old location must be given for \fBmvcur\fP.
657 This implementation allows the caller to use \-1's for the old ordinates.
658 In that case, the old location is unknown.
659 .SH SEE ALSO
660 \fBcurses\fR(3X),
661 \fBcurs_initscr\fR(3X),
662 \fBcurs_kernel\fR(3X),
663 \fBcurs_termcap\fR(3X),
664 \fBcurs_variables\fR(3X),
665 \fBterm_variables\fR(3X),
666 \fBputc\fR(3),
667 \fBterminfo\fR(\*n)