1TERMCAP(3X) TERMCAP(3X)
2
3
4
6 tgetent, tgetnum, tgetflag, tgetstr, tgoto, tputs - terminal indepen‐
7 dent operation routines
8
10 char PC;
11 char *BC;
12 char *UP;
13 short ospeed;
14
15 tgetent(bp, name)
16 char *bp, *name;
17
18 tgetnum(id)
19 char *id;
20
21 tgetflag(id)
22 char *id;
23
24 char *
25 tgetstr(id, area)
26 char *id, **area;
27
28 char *
29 tgoto(cm, destcol, destline)
30 char *cm;
31
32 tputs(cp, affcnt, outc)
33 register char *cp;
34 int affcnt;
35 int (*outc)();
36
38 These functions extract and use capabilities from the terminal capabil‐
39 ity data base termcap(5). These are low level routines; see curses(3X)
40 for a higher level package.
41
42 Tgetent extracts the entry for terminal name into the buffer at bp. Bp
43 should be a character buffer of size 1024 and must be retained through
44 all subsequent calls to tgetnum, tgetflag, and tgetstr. Tgetent
45 returns -1 if it cannot open the termcap file, 0 if the terminal name
46 given does not have an entry, and 1 if all goes well. It will look in
47 the environment for a TERMCAP variable. If found, and the value does
48 not begin with a slash, and the terminal type name is the same as the
49 environment string TERM, the TERMCAP string is used instead of reading
50 the termcap file. If it does begin with a slash, the string is used as
51 a path name rather than /etc/termcap. This can speed up entry into
52 programs that call tgetent, as well as to help debug new terminal
53 descriptions or to make one for your terminal if you can't write the
54 file /etc/termcap.
55
56 Tgetnum gets the numeric value of capability id, returning -1 if is not
57 given for the terminal. Tgetflag returns 1 if the specified capability
58 is present in the terminal's entry, 0 if it is not. Tgetstr returns
59 the string value of the capability id, places it in the buffer at area,
60 and advances the area pointer. It decodes the abbreviations for this
61 field described in termcap(5), except for cursor addressing and padding
62 information. Tgetstr returns NULL if the capability was not found.
63
64 Tgoto returns a cursor addressing string decoded from cm to go to col‐
65 umn destcol in line destline. It uses the external variables UP (from
66 the up capability) and BC (if bc is given rather than bs) if necessary
67 to avoid placing \n, ^D or ^@ in the returned string. (Programs which
68 call tgoto should be sure to turn off the XTABS bit(s), since tgoto may
69 now output a tab. Note that programs using termcap should in general
70 turn off XTABS anyway since some terminals use control I for other
71 functions, such as nondestructive space.) If a % sequence is given
72 which is not understood, then tgoto returns “OOPS”.
73
74 Tputs decodes the leading padding information of the string cp; affcnt
75 gives the number of lines affected by the operation, or 1 if this is
76 not applicable, outc is a routine which is called with each character
77 in turn. The external variable ospeed should contain the output speed
78 of the terminal as encoded by stty(3). The external variable PC should
79 contain a pad character to be used (from the pc capability) if a null
80 (^@) is inappropriate.
81
83 /usr/lib/libtermcap.a -ltermcap library
84 /etc/termcap data base
85
87 ex(1), curses(3X), termcap(5)
88
90 William Joy
91
92
93
944th Berkeley Distribution May 15, 1985 TERMCAP(3X)