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