|
|
1.1 root 1: .\" Copyright (c) 1980 Regents of the University of California.
2: .\" All rights reserved. The Berkeley software License Agreement
3: .\" specifies the terms and conditions for redistribution.
4: .\"
5: .\" @(#)termcap.3 6.2 (Berkeley) 9/14/87
6: .\"
7: .TH TERMCAP 3X "September 14, 1987"
8: .UC 4
9: .SH NAME
10: tgetent, tgetnum, tgetflag, tgetstr, tgoto, tputs \- terminal independent operation routines
11: .SH SYNOPSIS
12: .nf
13: .B char PC;
14: .B char *BC;
15: .B char *UP;
16: .B short ospeed;
17: .PP
18: .B tgetent(bp, name)
19: .B char *bp, *name;
20: .PP
21: .B tgetnum(id)
22: .B char *id;
23: .PP
24: .B tgetflag(id)
25: .B char *id;
26: .PP
27: .B char *
28: .B tgetstr(id, area)
29: .B char *id, **area;
30: .PP
31: .B char *
32: .B tgoto(cm, destcol, destline)
33: .B char *cm;
34: .PP
35: .B tputs(cp, affcnt, outc)
36: .B register char *cp;
37: .B int affcnt;
38: .B int (*outc)();
39: .fi
40: .SH DESCRIPTION
41: These functions extract and use capabilities from a terminal capability data
42: base, usually /etc/termcap, the format of which is described in
43: .IR termcap (5).
44: These are low level routines;
45: see
46: .IR curses (3X)
47: for a higher level package.
48: .PP
49: .I Tgetent
50: extracts the entry for terminal
51: .I name
52: into the buffer at
53: .I bp.
54: .I Bp
55: should be a character buffer of size
56: 1024 and must be retained through all subsequent calls to
57: .I tgetnum,
58: .I tgetflag,
59: and
60: .I tgetstr.
61: .I Tgetent
62: returns \-1 if none of the termcap
63: data base files could be opened,
64: 0 if the terminal name given does not have an entry,
65: and 1 if all goes well.
66: It will look in the environment for a TERMCAP variable.
67: If found, and the value does not begin with a slash,
68: and the terminal type
69: .I name
70: is the same as the environment string TERM,
71: the TERMCAP string is used instead of reading a termcap file.
72: If it does begin with a slash, the string is used as a path name
73: of the termcap file to search.
74: If TERMCAP does not begin with a slash and
75: .I name
76: is different from TERM,
77: .I tgetent
78: searches the files $HOME/.termcap and /etc/termcap,
79: in that order, unless the environment variable TERMPATH exists,
80: in which case it specifies a list of file pathnames
81: (separated by spaces or colons) to be searched instead.
82: Whenever multiple files are searched and a
83: .B tc
84: field occurs in the requested entry, the entry it names must be found
85: in the same file or one of the succeeding files.
86: This can speed up entry into programs that call
87: .IR tgetent ,
88: as well as help debug new terminal descriptions
89: or make one for your terminal if you can't write the file /etc/termcap.
90: .PP
91: .I Tgetnum
92: gets the numeric value of capability
93: .I id,
94: returning \-1 if is not given for the terminal.
95: .I Tgetflag
96: returns 1 if the specified capability is present in
97: the terminal's entry, 0 if it is not.
98: .I Tgetstr
99: returns the string value of the capability
100: .I id,
101: places it in the buffer at
102: .I area,
103: and advances the
104: .I area
105: pointer.
106: It decodes the abbreviations for this field described in
107: .IR termcap (5),
108: except for cursor addressing and padding information.
109: .I Tgetstr
110: returns NULL if the capability was not found.
111: .PP
112: .I Tgoto
113: returns a cursor addressing string decoded from
114: .I cm
115: to go to column
116: .I destcol
117: in line
118: .I destline.
119: It uses the external variables
120: .B UP
121: (from the \fBup\fR capability)
122: and
123: .B BC
124: (if \fBbc\fR is given rather than \fBbs\fR)
125: if necessary to avoid placing \fB\en\fR, \fB^D\fR or \fB^@\fR in
126: the returned string.
127: (Programs which call tgoto should be sure to turn off the XTABS bit(s),
128: since
129: .I tgoto
130: may now output a tab.
131: Note that programs using termcap should in general turn off XTABS
132: anyway since some terminals use control-I for other functions,
133: such as nondestructive space.)
134: If a \fB%\fR sequence is given which is not understood, then
135: .I tgoto
136: returns \*(lqOOPS\*(rq.
137: .PP
138: .I Tputs
139: decodes the leading padding information of the string
140: .IR cp ;
141: .I affcnt
142: gives the number of lines affected by the operation, or 1 if this is
143: not applicable,
144: .I outc
145: is a routine which is called with each character in turn.
146: The external variable
147: .I ospeed
148: should contain the output speed of the terminal as encoded by
149: .IR stty (3).
150: The external variable
151: .B PC
152: should contain a pad character to be used (from the \fBpc\fR capability)
153: if a null (\fB^@\fR) is inappropriate.
154: .SH FILES
155: .ta \w'/usr/lib/libtermcap.a 'u
156: /usr/lib/libtermcap.a \-ltermcap library (also known as \-ltermlib)
157: .br
158: /etc/termcap standard terminal capability data base
159: .br
160: $HOME/.termcap user's terminal capability data base
161: .DT
162: .SH SEE ALSO
163: ex(1), curses(3X), termcap(5)
164: .SH AUTHOR
165: William Joy
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.