1TERMCAP(3) 386BSD Programmer's Manual TERMCAP(3) 2 3NNAAMMEE 4 ttggeetteenntt, ttggeettnnuumm, ttggeettffllaagg, ttggeettssttrr, ttggoottoo, ttppuuttss - terminal independent 5 operation routines 6 7SSYYNNOOPPSSIISS 8 _c_h_a_r _P_C; 9 _c_h_a_r *_B_C; 10 _c_h_a_r *_U_P; 11 _s_h_o_r_t _o_s_p_e_e_d; 12 13 ttggeetteenntt(_c_h_a_r *_b_p, _c_h_a_r *_n_a_m_e) 14 15 ttggeettnnuumm(_c_h_a_r *_i_d) 16 17 ttggeettffllaagg(_c_h_a_r *_i_d) 18 19 _c_h_a_r * 20 ttggeettssttrr(_c_h_a_r *_i_d, _c_h_a_r *_a_r_e_a) 21 22 _c_h_a_r * 23 ttggoottoo(_c_h_a_r *_c_m, _d_e_s_t_c_o_l, _d_e_s_t_l_i_n_e) 24 25 ttppuuttss(_r_e_g_i_s_t_e_r _c_h_a_r *_c_p, _i_n_t _a_f_f_c_n_t, _i_n_t (*_o_u_t_c)()) 26 27DDEESSCCRRIIPPTTIIOONN 28 These functions extract and use capabilities from a terminal capability 29 data base, usually /_u_s_r/_s_h_a_r_e/_m_i_s_c/_t_e_r_m_c_a_p, the format of which is 30 described in termcap(5). These are low level routines; see curses(3) for 31 a higher level package. 32 33 The ttggeetteenntt() function extracts the entry for terminal _n_a_m_e into the 34 buffer at _b_p. The _b_p argument should be a character buffer of size 1024 35 and must be retained through all subsequent calls to ttggeettnnuumm(), 36 ttggeettffllaagg(), and ttggeettssttrr(). The ttggeetteenntt() function returns -1 if none of 37 the tteerrmmccaapp data base files could be opened, 0 if the terminal name given 38 does not have an entry, and 1 if all goes well. It will look in the 39 environment for a TERMCAP variable. If found, and the value does not 40 begin with a slash, and the terminal type _n_a_m_e is the same as the 41 environment string TERM, the TERMCAP string is used instead of reading a 42 tteerrmmccaapp file. If it does begin with a slash, the string is used as a 43 path name of the tteerrmmccaapp file to search. If TERMCAP does not begin with 44 a slash and _n_a_m_e is different from TERM, ttggeetteenntt() searches the files 45 $_H_O_M_E/._t_e_r_m_c_a_p and /_u_s_r/_s_h_a_r_e/_m_i_s_c/_t_e_r_m_c_a_p, in that order, unless the 46 environment variable TERMPATH exists, in which case it specifies a list 47 of file pathnames (separated by spaces or colons) to be searched instead. 48 Whenever multiple files are searched and a ttcc field occurs in the 49 requested entry, the entry it names must be found in the same file or one 50 of the succeeding files. This can speed up entry into programs that call 51 ttggeetteenntt(), as well as help debug new terminal descriptions or make one 52 for your terminal if you can't write the file /_u_s_r/_s_h_a_r_e/_m_i_s_c/_t_e_r_m_c_a_p. 53 54 The ttggeettnnuumm() function gets the numeric value of capability _i_d, returning 55 -1 if is not given for the terminal. The ttggeettffllaagg() function returns 1 56 if the specified capability is present in the terminal's entry, 0 if it 57 is not. The ttggeettssttrr() function returns the string value of the 58 capability _i_d, places it in the buffer at _a_r_e_a, and advances the _a_r_e_a 59 pointer. It decodes the abbreviations for this field described in 60 termcap(5), except for cursor addressing and padding information. The 61 ttggeettssttrr() function returns NULL if the capability was not found. 62 63 The ttggoottoo() function returns a cursor addressing string decoded from _c_m 64 to go to column _d_e_s_t_c_o_l in line _d_e_s_t_l_i_n_e. It uses the external variables 65 _U_P (from the uupp capability) and _B_C (if bbcc is given rather than bbss) if 66 necessary to avoid placing \\nn, ^^DD or ^^@@ in the returned string. 67 (Programs which call ttggoottoo() should be sure to turn off the XTABS bit(s), 68 since ttggoottoo() may now output a tab. Note that programs using termcap 69 should in general turn off XTABS anyway since some terminals use control- 70 I for other functions, such as nondestructive space.) If a %% sequence is 71 given which is not understood, then ttggoottoo() returns (OOPS). 72 73 The ttppuuttss() function decodes the leading padding information of the 74 string _c_p; _a_f_f_c_n_t gives the number of lines affected by the operation, or 75 1 if this is not applicable, _o_u_t_c is a routine which is called with each 76 character in turn. The external variable _o_s_p_e_e_d should contain the 77 output speed of the terminal as encoded by stty(3). The external 78 variable _P_C should contain a pad character to be used (from the 79 capability) if a null (^^@@) is inappropriate. 80 81FFIILLEESS 82 /usr/lib/libtermcap.a --ll _l_t_e_r_m_c_a_p library (also known as --ll _l_t_e_r_m_l_i_b) 83 /usr/share/misc/termcap standard terminal capability data base 84 $HOME/.termcap user's terminal capability data base 85 86SSEEEE AALLSSOO 87 ex(1), curses(3), termcap(5) 88 89HHIISSTTOORRYY 90 The ttggeetteenntt functions appeared in 4.0BSD. 91 924th Berkeley Distribution April 19, 1991 2 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133