| 1 | .\"*************************************************************************** | 
|---|
| 2 | .\" Copyright (c) 1998-2002,2003 Free Software Foundation, Inc.              * | 
|---|
| 3 | .\"                                                                          * | 
|---|
| 4 | .\" Permission is hereby granted, free of charge, to any person obtaining a  * | 
|---|
| 5 | .\" copy of this software and associated documentation files (the            * | 
|---|
| 6 | .\" "Software"), to deal in the Software without restriction, including      * | 
|---|
| 7 | .\" without limitation the rights to use, copy, modify, merge, publish,      * | 
|---|
| 8 | .\" distribute, distribute with modifications, sublicense, and/or sell       * | 
|---|
| 9 | .\" copies of the Software, and to permit persons to whom the Software is    * | 
|---|
| 10 | .\" furnished to do so, subject to the following conditions:                 * | 
|---|
| 11 | .\"                                                                          * | 
|---|
| 12 | .\" The above copyright notice and this permission notice shall be included  * | 
|---|
| 13 | .\" in all copies or substantial portions of the Software.                   * | 
|---|
| 14 | .\"                                                                          * | 
|---|
| 15 | .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  * | 
|---|
| 16 | .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               * | 
|---|
| 17 | .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   * | 
|---|
| 18 | .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   * | 
|---|
| 19 | .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    * | 
|---|
| 20 | .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    * | 
|---|
| 21 | .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               * | 
|---|
| 22 | .\"                                                                          * | 
|---|
| 23 | .\" Except as contained in this notice, the name(s) of the above copyright   * | 
|---|
| 24 | .\" holders shall not be used in advertising or otherwise to promote the     * | 
|---|
| 25 | .\" sale, use or other dealings in this Software without prior written       * | 
|---|
| 26 | .\" authorization.                                                           * | 
|---|
| 27 | .\"*************************************************************************** | 
|---|
| 28 | .\" | 
|---|
| 29 | .\" $Id: curs_termcap.3x,v 1.18 2003/02/08 22:25:47 tom Exp $ | 
|---|
| 30 | .TH curs_termcap 3X "" | 
|---|
| 31 | .ds n 5 | 
|---|
| 32 | .SH NAME | 
|---|
| 33 | \fBtgetent\fR, | 
|---|
| 34 | \fBtgetflag\fR, | 
|---|
| 35 | \fBtgetnum\fR, | 
|---|
| 36 | \fBtgetstr\fR, | 
|---|
| 37 | \fBtgoto\fR, | 
|---|
| 38 | \fBtputs\fR - direct \fBcurses\fR interface to the terminfo capability database | 
|---|
| 39 | .SH SYNOPSIS | 
|---|
| 40 | \fB#include <curses.h>\fR | 
|---|
| 41 | .br | 
|---|
| 42 | \fB#include <term.h>\fR | 
|---|
| 43 | .br | 
|---|
| 44 | \fBextern char PC;\fR | 
|---|
| 45 | \fBextern char * UP;\fR | 
|---|
| 46 | \fBextern char * BC;\fR | 
|---|
| 47 | \fBextern @NCURSES_OSPEED@ ospeed;\fR | 
|---|
| 48 | .br | 
|---|
| 49 | \fBint tgetent(char *bp, const char *name);\fR | 
|---|
| 50 | .br | 
|---|
| 51 | \fBint tgetflag(char *id);\fR | 
|---|
| 52 | .br | 
|---|
| 53 | \fBint tgetnum(char *id);\fR | 
|---|
| 54 | .br | 
|---|
| 55 | \fBchar *tgetstr(char *id, char **area);\fR | 
|---|
| 56 | .br | 
|---|
| 57 | \fBchar *tgoto(const char *cap, int col, int row);\fR | 
|---|
| 58 | .br | 
|---|
| 59 | \fBint tputs(const char *str, int affcnt, int (*putc)(int));\fR | 
|---|
| 60 | .br | 
|---|
| 61 | .SH DESCRIPTION | 
|---|
| 62 | These routines are included as a conversion aid for programs that use | 
|---|
| 63 | the \fItermcap\fR library.  Their parameters are the same and the | 
|---|
| 64 | routines are emulated using the \fIterminfo\fR database.  Thus, they | 
|---|
| 65 | can only be used to query the capabilities of entries for which a | 
|---|
| 66 | terminfo entry has been compiled. | 
|---|
| 67 |  | 
|---|
| 68 | The \fBtgetent\fR routine loads the entry for \fIname\fR. | 
|---|
| 69 | It returns 1 on success, 0 if there is no such entry, and -1 if the | 
|---|
| 70 | terminfo database could not be found. | 
|---|
| 71 | The emulation ignores the buffer pointer \fIbp\fR. | 
|---|
| 72 |  | 
|---|
| 73 | The \fBtgetflag\fR routine gets the boolean entry for \fIid\fR, | 
|---|
| 74 | or zero if it is not available. | 
|---|
| 75 |  | 
|---|
| 76 | The \fBtgetnum\fR routine gets the numeric entry for \fIid\fR, | 
|---|
| 77 | or -1 if it is not available. | 
|---|
| 78 |  | 
|---|
| 79 | The \fBtgetstr\fR routine returns the string entry for \fIid\fR, | 
|---|
| 80 | or zero if it is not available. | 
|---|
| 81 | Use \fBtputs\fR to output the returned string. | 
|---|
| 82 | The return value will also be copied to the buffer pointed to by \fIarea\fR, | 
|---|
| 83 | and the \fIarea\fR value will be updated to point past the null ending | 
|---|
| 84 | this value. | 
|---|
| 85 |  | 
|---|
| 86 | Only the first two characters of the \fBid\fR parameter of | 
|---|
| 87 | \fBtgetflag\fR, | 
|---|
| 88 | \fBtgetnum\fR and | 
|---|
| 89 | \fBtgetstr\fR are compared in lookups. | 
|---|
| 90 |  | 
|---|
| 91 | The \fBtgoto\fR routine instantiates the parameters into the given capability. | 
|---|
| 92 | The output from this routine is to be passed to \fBtputs\fR. | 
|---|
| 93 |  | 
|---|
| 94 | The \fBtputs\fR routine is described on the \fBcurs_terminfo\fR(3X) manual | 
|---|
| 95 | page.  It can retrieve capabilities by either termcap or terminfo name. | 
|---|
| 96 |  | 
|---|
| 97 | The variables | 
|---|
| 98 | \fBPC\fR, | 
|---|
| 99 | \fBUP\fR and | 
|---|
| 100 | \fBBC\fR | 
|---|
| 101 | are set by \fBtgetent\fR to the terminfo entry's data for | 
|---|
| 102 | \fBpad_char\fR, | 
|---|
| 103 | \fBcursor_up\fR and | 
|---|
| 104 | \fBbackspace_if_not_bs\fR, | 
|---|
| 105 | respectively. | 
|---|
| 106 | \fBUP\fR is not used by ncurses. | 
|---|
| 107 | \fBPC\fR is used in the \fBtdelay_output\fR function. | 
|---|
| 108 | \fBBC\fR is used in the \fBtgoto\fR emulation. | 
|---|
| 109 | The variable \fBospeed\fR is set by ncurses in a system-specific coding | 
|---|
| 110 | to reflect the terminal speed. | 
|---|
| 111 |  | 
|---|
| 112 | .SH RETURN VALUE | 
|---|
| 113 | Except where explicitly noted, | 
|---|
| 114 | routines that return an integer return \fBERR\fR upon failure and \fBOK\fR | 
|---|
| 115 | (SVr4 only specifies "an integer value other than \fBERR\fR") upon successful | 
|---|
| 116 | completion. | 
|---|
| 117 |  | 
|---|
| 118 | Routines that return pointers return \fBNULL\fR on error. | 
|---|
| 119 | .SH BUGS | 
|---|
| 120 | If you call \fBtgetstr\fR to fetch \fBca\fR or any other parameterized string, | 
|---|
| 121 | be aware that it will be returned in terminfo notation, not the older and | 
|---|
| 122 | not-quite-compatible termcap notation.  This won't cause problems if all | 
|---|
| 123 | you do with it is call \fBtgoto\fR or \fBtparm\fR, which both expand | 
|---|
| 124 | terminfo-style strings as terminfo. | 
|---|
| 125 | (The \fBtgoto\fR function, if configured to support termcap, will check | 
|---|
| 126 | if the string is indeed terminfo-style by looking for "%p" parameters or | 
|---|
| 127 | "$<..>" delays, and invoke a termcap-style parser if the string does not | 
|---|
| 128 | appear to be terminfo). | 
|---|
| 129 |  | 
|---|
| 130 | Because terminfo conventions for representing padding in string capabilities | 
|---|
| 131 | differ from termcap's, \fBtputs("50");\fR will put out a literal "50" rather | 
|---|
| 132 | than busy-waiting for 50 milliseconds.  Cope with it. | 
|---|
| 133 |  | 
|---|
| 134 | Note that termcap has nothing analogous to terminfo's \fBsgr\fR string. | 
|---|
| 135 | One consequence of this is that termcap applications assume \fRme\fR | 
|---|
| 136 | (terminfo \fBsgr0\fR) does not reset the alternate character set. | 
|---|
| 137 | This implementation checks for, and modifies the data shown to the | 
|---|
| 138 | termcap interface to accommodate termcap's limitation in this respect. | 
|---|
| 139 | .SH PORTABILITY | 
|---|
| 140 | The XSI Curses standard, Issue 4 describes these functions.  However, they | 
|---|
| 141 | are marked TO BE WITHDRAWN and may be removed in future versions. | 
|---|
| 142 |  | 
|---|
| 143 | Neither the XSI Curses standard nor the SVr4 man pages documented the return | 
|---|
| 144 | values of \fBtgetent\fR correctly, though all three were in fact returned ever | 
|---|
| 145 | since SVr1. | 
|---|
| 146 | In particular, an omission in the XSI Curses documentation has been | 
|---|
| 147 | misinterpreted to mean that \fBtgetent\fR returns \fBOK\fR or \fBERR\fR. | 
|---|
| 148 | Because the purpose of these functions is to provide compatibility with | 
|---|
| 149 | the \fItermcap\fR library, that is a defect in XCurses, Issue 4, Version 2 | 
|---|
| 150 | rather than in ncurses. | 
|---|
| 151 |  | 
|---|
| 152 | External variables are provided for support of certain termcap applications. | 
|---|
| 153 | However, termcap applications' use of those variables is poorly documented, | 
|---|
| 154 | e.g., not distinguishing between input and output. | 
|---|
| 155 | In particular, some applications are reported to declare and/or | 
|---|
| 156 | modify \fBospeed\fR. | 
|---|
| 157 | .SH SEE ALSO | 
|---|
| 158 | \fBcurses\fR(3X), \fBterminfo\fR(\*n), \fBputc\fR(3S). | 
|---|
| 159 | .\"# | 
|---|
| 160 | .\"# The following sets edit modes for GNU EMACS | 
|---|
| 161 | .\"# Local Variables: | 
|---|
| 162 | .\"# mode:nroff | 
|---|
| 163 | .\"# fill-column:79 | 
|---|
| 164 | .\"# End: | 
|---|