BSD 4_2 development
[unix-history] / usr / man / man3 / termcap.3x
CommitLineData
415c724e
C
1.TH TERMCAP 3X "9 February 1983"
2.UC 4
3.SH NAME
4tgetent, tgetnum, tgetflag, tgetstr, tgoto, tputs \- terminal independent operation routines
5.SH SYNOPSIS
6.nf
7.B char PC;
8.B char *BC;
9.B char *UP;
10.B short ospeed;
11.PP
12.B tgetent(bp, name)
13.B char *bp, *name;
14.PP
15.B tgetnum(id)
16.B char *id;
17.PP
18.B tgetflag(id)
19.B char *id;
20.PP
21.B char *
22.B tgetstr(id, area)
23.B char *id, **area;
24.PP
25.B char *
26.B tgoto(cm, destcol, destline)
27.B char *cm;
28.PP
29.B tputs(cp, affcnt, outc)
30.B register char *cp;
31.B int affcnt;
32.B int (*outc)();
33.fi
34.SH DESCRIPTION
35These functions extract and use capabilities from the terminal capability data
36base
37.IR termcap (5).
38These are low level routines;
39see
40.IR curses (3X)
41for a higher level package.
42.PP
43.I Tgetent
44extracts the entry for terminal
45.I name
46into the buffer at
47.I bp.
48.I Bp
49should be a character buffer of size
501024 and must be retained through all subsequent calls
51to
52.I tgetnum,
53.I tgetflag,
54and
55.I tgetstr.
56.I Tgetent
57returns \-1 if it cannot open the
58.I termcap
59file, 0 if the terminal name given does not have an entry,
60and 1 if all goes well.
61It will look in the environment for a TERMCAP variable.
62If found, and the value does not begin with a slash,
63and the terminal type
64.B name
65is the same as the environment string TERM,
66the TERMCAP string is used instead of reading the termcap file.
67If it does begin with a slash, the string is used as a path name rather than
68.I /etc/termcap.
69This can speed up entry into programs that call
70.IR tgetent ,
71as well as to help debug new terminal descriptions
72or to make one for your terminal if you can't write the file
73.I /etc/termcap.
74.PP
75.I Tgetnum
76gets the numeric value of capability
77.I id,
78returning \-1 if is not given for the terminal.
79.I Tgetflag
80returns 1 if the specified capability is present in
81the terminal's entry, 0 if it is not.
82.I Tgetstr
83gets the string value of capability
84.I id,
85placing it in the buffer at
86.I area,
87advancing the
88.I area
89pointer.
90It decodes the abbreviations for this field described in
91.IR termcap (5),
92except for cursor addressing and padding information.
93.PP
94.I Tgoto
95returns a cursor addressing string decoded from
96.I cm
97to go to column
98.I destcol
99in line
100.I destline.
101It uses the external variables
102.B UP
103(from the \fBup\fR capability)
104and
105.B BC
106(if \fBbc\fR is given rather than \fBbs\fR)
107if necessary to avoid placing \fB\en\fR, \fB^D\fR or \fB^@\fR in
108the returned string.
109(Programs which call tgoto should be sure to turn off the XTABS bit(s),
110since
111.I tgoto
112may now output a tab.
113Note that programs using termcap should in general turn off XTABS
114anyway since some terminals use control I for other functions,
115such as nondestructive space.)
116If a \fB%\fR sequence is given which is not understood, then
117.I tgoto
118returns \*(lqOOPS\*(rq.
119.PP
120.I Tputs
121decodes the leading padding information of the string
122.IR cp ;
123.I affcnt
124gives the number of lines affected by the operation, or 1 if this is
125not applicable,
126.I outc
127is a routine which is called with each character in turn.
128The external variable
129.I ospeed
130should contain the output speed of the terminal as encoded by
131.IR stty (3).
132The external variable
133.B PC
134should contain a pad character to be used (from the \fBpc\fR capability)
135if a null (\fB^@\fR) is inappropriate.
136.SH FILES
137.ta \w'/usr/lib/libtermcap.a 'u
138/usr/lib/libtermcap.a \-ltermcap library
139.br
140/etc/termcap data base
141.DT
142.SH SEE ALSO
143ex(1), curses(3X), termcap(5)
144.SH AUTHOR
145William Joy