blob: 6bd2a66a0b55e025e7731df8489441183468ea75 [file] [log] [blame]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301.\"***************************************************************************
micky3879b9f5e72025-07-08 18:04:53 -04002.\" Copyright 2018-2023,2024 Thomas E. Dickey *
3.\" Copyright 1998-2017,2018 Free Software Foundation, Inc. *
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05304.\" *
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.\"
micky3879b9f5e72025-07-08 18:04:53 -040030.\" $Id: curs_termcap.3x,v 1.85 2024/04/20 19:13:12 tom Exp $
31.TH curs_termcap 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
32.ie \n(.g \{\
33.ds `` \(lq
34.ds '' \(rq
35.\}
36.el \{\
37.ie t .ds `` ``
38.el .ds `` ""
39.ie t .ds '' ''
40.el .ds '' ""
41.\}
42.
Steve Kondikae271bc2015-11-15 02:50:53 +010043.de bP
micky3879b9f5e72025-07-08 18:04:53 -040044.ie n .IP \(bu 4
45.el .IP \(bu 2
Steve Kondikae271bc2015-11-15 02:50:53 +010046..
micky3879b9f5e72025-07-08 18:04:53 -040047.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053048.SH NAME
micky3879b9f5e72025-07-08 18:04:53 -040049\fB\%PC\fP,
50\fB\%UP\fP,
51\fB\%BC\fP,
52\fB\%ospeed\fP,
53\fB\%tgetent\fP,
54\fB\%tgetflag\fP,
55\fB\%tgetnum\fP,
56\fB\%tgetstr\fP,
57\fB\%tgoto\fP,
58\fB\%tputs\fP \-
59\fIcurses\fR emulation of \fItermcap\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053060.SH SYNOPSIS
micky3879b9f5e72025-07-08 18:04:53 -040061.nf
62\fB#include <curses.h>
63\fB#include <term.h>
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053064.PP
micky3879b9f5e72025-07-08 18:04:53 -040065\fBchar PC;
66\fBchar * UP;
67\fBchar * BC;
68\fB@NCURSES_OSPEED@ ospeed;
69.PP
70\fBint tgetent(char *\fIbp\fP, const char *\fIname\fP);
71\fBint tgetflag(const char *\fIid\fP);
72\fBint tgetnum(const char *\fIid\fP);
73\fBchar *tgetstr(const char *\fIid\fP, char **\fIarea\fP);
74\fBchar *tgoto(const char *\fIcap\fP, int \fIcol\fP, int \fIrow\fP);
75\fBint tputs(const char *\fIstr\fP, int \fIaffcnt\fP, int (*\fIputc\fP)(int));
76.fi
77.SH DESCRIPTION
78.I \%ncurses
79provides the foregoing variables and functions as a compatibility layer
80for programs that use the \fItermcap\fP library.
81The API is the same,
82but behavior is emulated using the \fI\%term\%info\fP database.
83Thus,
84it can be used only to query the capabilities of terminal database
85entries for which a \fI\%term\%info\fP entry has been compiled.
86.SS Initialization
87\fB\%tgetent\fP loads the terminal database entry for \fIname\fP;
88see \fBterm\fP(7).
89This must be done before calling any of the other functions.
90It returns
Steve Kondikae271bc2015-11-15 02:50:53 +010091.RS 3
micky3879b9f5e72025-07-08 18:04:53 -040092.TP 5 \" "-1" + 2n + adjust for PDF
Steve Kondikae271bc2015-11-15 02:50:53 +0100931
94on success,
micky3879b9f5e72025-07-08 18:04:53 -040095.TP
Steve Kondikae271bc2015-11-15 02:50:53 +0100960
97if there is no such entry
micky3879b9f5e72025-07-08 18:04:53 -040098(or if the matching entry describes a generic terminal,
99having too little information for
100.I curses
101applications to run),
102and
103.TP
Steve Kondikae271bc2015-11-15 02:50:53 +0100104\-1
micky3879b9f5e72025-07-08 18:04:53 -0400105if the \fI\%term\%info\fP database could not be found.
Steve Kondikae271bc2015-11-15 02:50:53 +0100106.RE
107.PP
micky3879b9f5e72025-07-08 18:04:53 -0400108This implementation differs from those of historical \fItermcap\fP
109libraries.
Steve Kondikae271bc2015-11-15 02:50:53 +0100110.RS 3
111.bP
micky3879b9f5e72025-07-08 18:04:53 -0400112.I \%ncurses
113ignores the buffer pointer \fIbp\fP,
114as do other \fItermcap\fP implementations conforming to portions of
115X/Open Curses now withdrawn.
116The BSD \fItermcap\fP library would store a copy of the terminal type
Steve Kondikae271bc2015-11-15 02:50:53 +0100117description in the area referenced by this pointer.
micky3879b9f5e72025-07-08 18:04:53 -0400118\fI\%term\%info\fP stores terminal type descriptions in compiled form,
119which is not the same thing.
Steve Kondikae271bc2015-11-15 02:50:53 +0100120.bP
micky3879b9f5e72025-07-08 18:04:53 -0400121The meanings of the return values differ.
122The BSD \fItermcap\fP library does not check whether the terminal type
123description includes the
124.B \%generic
125.RB ( gn )
126capability,
127nor whether the terminal type description supports an addressable
128cursor,
129a property essential for any \fIcurses\fP implementation to operate.
Steve Kondikae271bc2015-11-15 02:50:53 +0100130.RE
micky3879b9f5e72025-07-08 18:04:53 -0400131.SS "Retrieving Capability Values"
132\fB\%tgetflag\fP reports the Boolean entry for \fIid\fP,
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530133or zero if it is not available.
134.PP
micky3879b9f5e72025-07-08 18:04:53 -0400135\fB\%tgetnum\fP obtains the numeric entry for \fIid\fP,
Steve Kondikae271bc2015-11-15 02:50:53 +0100136or \-1 if it is not available.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530137.PP
micky3879b9f5e72025-07-08 18:04:53 -0400138\fB\%tgetstr\fP returns the string entry for \fIid\fP,
139or
140.B NULL
141if it is not available.
142Use \fB\%tputs\fP to output the string returned.
143The
144.I area
145parameter is used as follows.
Steve Kondikae271bc2015-11-15 02:50:53 +0100146.RS 3
147.bP
148It is assumed to be the address of a pointer to a buffer managed by the
149calling application.
150.bP
micky3879b9f5e72025-07-08 18:04:53 -0400151However,
152\fI\%ncurses\fP checks to ensure that
153.I area
154is not
155.BR NULL ,
156and also that the resulting buffer pointer is not
157.BR NULL .
158If either check fails,
159.I area
160is ignored.
Steve Kondikae271bc2015-11-15 02:50:53 +0100161.bP
micky3879b9f5e72025-07-08 18:04:53 -0400162If the checks succeed,
163\fI\%ncurses\fP also copies the return value to the buffer pointed to by
164\fIarea\fP,
165and the library updates
166.I area
167to point past the null character terminating this value.
Steve Kondikae271bc2015-11-15 02:50:53 +0100168.bP
micky3879b9f5e72025-07-08 18:04:53 -0400169The return value itself is an address in the terminal type description
170loaded into memory.
Steve Kondikae271bc2015-11-15 02:50:53 +0100171.RE
micky3879b9f5e72025-07-08 18:04:53 -0400172.SS "Applying String Capabilities"
173String capabilities can be parameterized;
174see subsection \*(``Parameterized Strings\*('' in \fB\%terminfo\fP(5).
175\fB\%tgoto\fP applies its second and third arguments to the parametric
176placeholders in the capability stored in the first argument.
177.bP
178The capability may contain padding specifications;
179see subsection \*(``Delays and Padding\*('' of \fB\%terminfo\fP(5).
180The output of \fB\%tgoto\fP should thus be passed to \fB\%tputs\fP
181rather than some other output function such as \fI\%printf\fP(3).
182.bP
183While \fB\%tgoto\fP is assumed to be used for the two-parameter
184cursor positioning capability,
185\fItermcap\fP applications also use it for single-parameter
186capabilities.
187.IP
188Doing so reveals a quirk in \fB\%tgoto\fP:
189most hardware terminals use cursor addressing with \fIrow\fP first,
190but the original developers of the \fItermcap\fP interface chose to
191put the \fIcol\fP (column) parameter first.
192The \fB\%tgoto\fP function swaps the order of its parameters.
193It does this even for calls requiring only a single parameter.
194In that case,
195the first parameter is merely a placeholder.
196.bP
197Normally the \fI\%ncurses\fP library is compiled without
198full \fI\%termcap\fP support.
199In that case,
200\fB\%tgoto\fP uses an internal version of \fB\%tparm\fP(3X)
201(a more capable function).
202.IP
203Because it uses \fB\%tparm\fP internally,
204\fB\%tgoto\fP is able to use some \fI\%term\%info\fP features,
205but not all.
206In particular,
207it allows only numeric parameters;
208\fB\%tparm\fP supports string parameters.
209.IP
210However,
211\fB\%tparm\fP is not a \fItermcap\fP feature,
212and portable \fItermcap\fP applications should not rely upon its
213availability.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530214.PP
micky3879b9f5e72025-07-08 18:04:53 -0400215\fB\%tputs\fP is described in \fB\%curs_terminfo\fP(3X).
216It can retrieve capabilities by either \fItermcap\fP or
217\fI\%term\%info\fP code.
218.SS "Global Variables"
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530219The variables
micky3879b9f5e72025-07-08 18:04:53 -0400220\fBPC\fP,
221\fBUP\fP and
222\fBBC\fP
223are set by \fB\%tgetent\fP to the \fI\%term\%info\fP entry's data for
224\fB\%pad_char\fP,
225\fB\%cursor_up\fP and
226\fB\%backspace_if_not_bs\fP,
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530227respectively.
micky3879b9f5e72025-07-08 18:04:53 -0400228\fBUP\fP is not used by \fI\%ncurses\fP.
229\fBPC\fP is used by \fB\%delay_output\fP(3X).
230\fBBC\fP is used by \fB\%tgoto\fP emulation.
231The variable \fB\%ospeed\fP is set by \fI\%ncurses\fP using a
232system-specific encoding to indicate the terminal's data rate.
233.SS "Releasing Memory"
234The \fItermcap\fP functions provide no means of freeing memory,
235because legacy \fItermcap\fP implementations used only the buffer
236areas provided by the caller via \fB\%tgetent\fP and \fB\%tgetstr\fP.
237Those buffers are unused in \fI\%term\%info\fP.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530238.PP
micky3879b9f5e72025-07-08 18:04:53 -0400239By contrast,
240\fI\%term\%info\fP allocates memory.
241It uses \fB\%setupterm\fP(3X) to obtain the data used by \fB\%tgetent\fP
242and the functions that retrieve capability values.
243One could use
244.RS
245.EX
246del_curterm(cur_term);
247.EE
248.RE
249to free this memory,
250but there is an additional complication with \fI\%ncurses\fP.
251It uses a fixed-size pool of storage locations,
252one per value of the terminal name parameter given to \fB\%tgetent\fP.
253The \fIscreen\fP(1) program relies upon this arrangement to improve its
254performance.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530255.PP
micky3879b9f5e72025-07-08 18:04:53 -0400256An application that uses only the \fItermcap\fP functions,
257not the higher level
258.I \%curses
259API,
260could release the memory using \fB\%del_curterm\fP(3X),
261because the pool is freed using other functions;
262see \fB\%curs_memleaks\fP(3X).
263.SH "RETURN VALUE"
264The return values of
265\fB\%tgetent\fP,
266\fB\%tgetflag\fP,
267\fB\%tgetname\fP,
268and
269\fB\%tgetstr\fP
270are documented above.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530271.PP
micky3879b9f5e72025-07-08 18:04:53 -0400272\fB\%tgoto\fP returns
273.B NULL
274on error.
275Error conditions include:
276.bP
277uninitialized state
278(\fB\%tgetent\fP was not called successfully),
279.bP
280.I cap
281being a null pointer,
282.bP
283.I cap
284referring to a canceled capability,
285.bP
286.I cap
287being a capability with string-valued parameters
288(a \fI\%term\%info\fP-only feature),
289and
290.bP
291.I cap
292being a capability with more than two parameters.
293.PP
294See \fB\%curs_terminfo\fP(3X) regarding \fB\%tputs\fP.
295.SH NOTES
296\fI\%ncurses\fP compares only the first two characters of the \fIid\fP
297parameter of
298\fB\%tgetflag\fP,
299\fB\%tgetnum\fP,
300and
301\fB\%tgetstr\fP to the capability names in the database.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530302.SH PORTABILITY
micky3879b9f5e72025-07-08 18:04:53 -0400303These functions are no longer standardized
304(and the variables never were);
305\fI\%ncurses\fP provides them to support legacy applications.
306They should not be used in new programs.
307.SS Standards
308.bP
309X/Open Curses, Issue 4, Version 2 (1996),
310describes these functions,
311marking them as
312\*(``TO BE WITHDRAWN\*(''.
313.bP
314X/Open Curses, Issue 7 (2009) marks the \fItermcap\fP interface
315(along with \fB\%vwprintw\fP and \fB\%vwscanw\fP) as withdrawn.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530316.PP
micky3879b9f5e72025-07-08 18:04:53 -0400317Neither X/Open Curses nor the SVr4 man pages documented the return
318values of \fB\%tgetent\fP correctly,
319though all three shown here were in fact returned ever since SVr1.
320In particular,
321an omission in the X/Open Curses specification has been misinterpreted
322to mean that \fB\%tgetent\fP returns \fBOK\fP or \fBERR\fP.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530323Because the purpose of these functions is to provide compatibility with
micky3879b9f5e72025-07-08 18:04:53 -0400324the \fItermcap\fP library,
325that is a defect in X/Open Curses, Issue 4, Version 2
326rather than in \fI\%ncurses\fP.
327.SS "Compatibility with BSD \fItermcap\fP"
328Externally visible variables are provided for support of certain
329\fItermcap\fP applications.
330However,
331their correct usage is poorly documented;
332for example,
333it is unclear when reading and writing them is meaningful.
334In particular,
335some applications are reported to declare and/or modify \fB\%ospeed\fP.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530336.PP
micky3879b9f5e72025-07-08 18:04:53 -0400337The constraint that only the first two characters of the \fIid\fP
338parameter are used escapes many application developers.
339The BSD \fItermcap\fP library did not require a trailing null character
340on the capability identifier passed to \fB\%tgetstr\fP,
341\fB\%tgetnum\fP,
342and
343\fB\%tgetflag\fP.
344.\" See <https://minnie.tuhs.org/cgi-bin/utree.pl?file=2BSD/src/\
345.\" termlib/termcap.c>.
346Some applications thus assume that the \fItermcap\fP interface does not
347require the trailing null character for the capability identifier.
348.bP
349.I \%ncurses
350disallows matches by the \fItermcap\fP interface against extended
351capability names that are longer than two characters;
352see \fB\%user_caps\fP(5).
Steve Kondikae271bc2015-11-15 02:50:53 +0100353.PP
micky3879b9f5e72025-07-08 18:04:53 -0400354The BSD \fItermcap\fP function \fB\%tgetent\fP returns the text of a
355\fItermcap\fP entry in the buffer passed as an argument.
356This library,
357like other \fI\%term\%info\fP implementations,
358does not store terminal type descriptions as text.
359It sets the buffer contents to a null-terminated string.
360.SS "Header File"
361This library includes a \fI\%termcap.h\fP header for compatibility with
362other implementations,
363but the header is rarely used because the other implementations are not
364strictly compatible.
365.SH HISTORY
366.\" See https://www.oreilly.com/openbook/opensources/book/kirkmck.html
367.\" for much BSD release history.
368Bill Joy originated a forerunner of \fItermcap\fP called
369\*(``ttycap\*('',
370dated September 1977,
371and released in 1BSD
372(March 1978).
373.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=1BSD/s7/ttycap.c
374.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=1BSD/man7/ttycap.7
375It used many of the same function names as the later \fItermcap\fP,
376such as
377\fB\%tgetent\fP,
378\fB\%tgetflag\fP,
379\fB\%tgetnum\fP,
380and
381\fB\%tgetstr\fP.
382.PP
383A clear descendant,
384the \fItermlib\fP library,
385.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=2BSD/src/termlib/
386followed in 2BSD
387(May 1979),
388adding \fB\%tgoto\fP and \fB\%tputs\fP.
389The former applied at that time only to cursor positioning capabilities,
390.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=2BSD/bin/etc/termcap
391thus the overly specific name.
392Little changed in 3BSD
393(late 1979)
394except the addition of test programs and a \fI\%termlib\fP man page,
395which documented the API shown in section \*(``SYNOPSIS\*('' above.
396.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=3BSD/usr/src/lib/\
397.\" libtermlib/
398.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=3BSD/usr/man/man3/\
399.\" termlib.3
400.PP
4014BSD
402(November 1980)
403renamed \fItermlib\fP to \fItermcap\fP
404.\" ...except in the source tree...
405.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4BSD/usr/src/lib/\
406.\" libtermlib/makefile
407and added another test program.
408The library remained much the same though 4.3BSD
409(June 1986).
4104.4BSD-Lite
411(June 1994)
412refactored it,
413.\" Observe the `tncktc()`, `tnamatch()`, `tskip()`, and `tdecode()`
414.\" entry points disappearing from termcap.c.
415leaving the API unchanged.
416.PP
417Function prototypes were a feature of ANSI C (1989).
418The library long antedated the standard and thus provided no header file
419declaring them.
420Nevertheless,
421the BSD sources included two different \fI\%termcap.h\fP header files
422over time.
Steve Kondikae271bc2015-11-15 02:50:53 +0100423.bP
micky3879b9f5e72025-07-08 18:04:53 -0400424One was used internally by \fBjove\fP(1) from 4.3BSD onward.
425.\" 2BSD became a branch retaining support for non-virtual memory
426.\" systems (such as the PDP-11) whereas most BSD development focused on
427.\" the VAX and other VM-enabled systems starting with 3BSD.
428.\"
429.\" This man page previously located a termcap.h in 2BSD, but that may
430.\" be confusion arising from its backport to 2.9BSD (and still present
431.\" in surviving sources for 2.11BSD, the "end of the line" for that
432.\" branch's development).
433.\"
434.\" Observe the copyright notice in
435.\" https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.3BSD/usr/contrib/\
436.\" jove/Makefile
437.\" --much too late for 2BSD (1979).
438It declared global symbols for the \fItermcap\fP variables that it used.
Steve Kondikae271bc2015-11-15 02:50:53 +0100439.bP
micky3879b9f5e72025-07-08 18:04:53 -0400440The other appeared in 4.4BSD-Lite Release 2
441(June 1995)
442as part of \fIlibedit\fP
443(also known as the \fI\%edit\%line\fP library).
444CSRG source history shows that this was added in mid-1992.
445The \fIlibedit\fP header file was used internally as a convenience for
446compiling the \fI\%edit\%line\fP library.
447It declared function prototypes,
448but no global variables.
449This header file was added to NetBSD's \fItermcap\fP library in
450mid-1994.
451.PP
452Meanwhile,
453GNU \fItermcap\fP began development in 1990.
454Its first release (1.0) in 1991 included a \fI\%termcap.h\fP header.
455Its second (1.1) in September 1992 modified the header to use
456\fIconst\fP for the function prototypes in the header where one would
457expect the parameters to be read-only.
458BSD \fItermcap\fP did not.
459The prototype for \fB\%tputs\fP also differed,
460but in that instance,
461it was \fIlibedit\fP that differed from BSD \fItermcap\fP.
462.PP
463GNU \fItermcap\fP 1.3 was bundled with \fIbash\fP(1) in mid-1993 to
464support the \fI\%readline\fP(3) library.
465.PP
466\fI\%ncurses\fP 1.8.1
467(November 1993)
468provided a \fI\%termcap.h\fP file.
469It reflected influence from GNU \fItermcap\fP and \fBemacs\fP(1)
470(rather than \fBjove\fP(1)),
471providing the following interface:
472.bP
473global symbols used by \fIemacs\fP,
474.bP
475\fIconst\fP-qualified function prototypes,
476and
477.bP
478a prototype for \fBtparam\fP,
479a GNU \fItermcap\fP feature.
480.PP
481Later
482(in mid-1996)
483the \fB\%tparam\fP function was removed from \fI\%ncurses\fP.
484Any two of the four implementations thus differ,
485and programs that intend to work with all \fItermcap\fP library
486interfaces must account for that fact.
487.SH BUGS
488If you call \fB\%tgetstr\fP to fetch
489.B \%column_address
490.RB ( ch )
491or any other parameterized string capability,
492be aware that it is returned in \fI\%term\%info\fP notation,
493not the older and not-quite-compatible \fItermcap\fP notation.
494This does not cause problems if all you do with it is call \fB\%tgoto\fP
495or \fB\%tparm\fP,
496which both parametrically expand \fI\%term\%info\fP-style string
497capabilities as \fI\%term\%info\fP does.
498(If
499.I \%ncurses
500is configured to support \fItermcap,\fP
501\fB\%tgoto\fP checks whether the string is \fI\%term\%info\fP-style by
502looking for \*(``\fB%p\fP\*('' parameters or
503\*(``\fB<\fP.\|.\|.\fB>\fP\*('' delays,
504and invokes a \fItermcap\fP-style parser if the string appears not to
505use \fI\%term\%info\fP syntax.)
506.PP
507Because \fI\%term\%info\fP's syntax for padding in string capabilities
508differs from \fItermcap\fP's,
509users can be surprised.
510.IP \(bu 4
511\fB\%tputs("50")\fP in a \fI\%term\%info\fP system transmits
512\*(``50\*('' rather than busy-waiting for 50 milliseconds.
513.IP \(bu 4
514However,
515if \fI\%ncurses\fP is configured to support \fItermcap\fP,
516it may also have been configured to support BSD-style padding.
517.IP
518In that case,
519\fB\%tputs\fP inspects strings passed to it,
520looking for digits at the beginning of the string.
521.IP
522\fB\%tputs("50")\fP in a \fItermcap\fP system may busy-wait for 50
523milliseconds rather than transmitting \*(``50\*(''.
524.PP
525\fItermcap\fP has nothing analogous to \fI\%term\%info\fP's
526.B \%set_attributes
527.RB ( sgr )
528capability.
529One consequence is that \fItermcap\fP applications assume that
530.RB \*(`` me \*(''
531(equivalent to \fI\%term\%info\fP's
532.B \%exit_attribute_mode
533.RB ( sgr0 )
534capability)
535does not reset the alternate character set.
536\fI\%ncurses\fP checks for,
537and modifies the data shared with,
538the \fItermcap\fP interface to accommodate the latter's limitation in
539this respect.
540.SH "SEE ALSO"
541\fB\%curses\fP(3X),
542\fB\%curs_terminfo\fP(3X),
543\fB\%putc\fP(3),
544\fB\%term_variables\fP(3X),
545\fB\%terminfo\fP(5)
546.PP
547https://invisible\-island.net/ncurses/tctest.html