1502 Remove conversion cruft from manpages
[unleashed.git] / usr / src / man / man3curses / curs_terminfo.3curses
blobd915d9b0c7d56fd40940d723e39377a8b8a780ce
1 '\" te
2 .\" Copyright 1989 AT&T
3 .\" Portions Copyright (c) 1996, Sun Microsystems, Inc. All Rights Reserved.
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
5 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
6 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH CURS_TERMINFO 3CURSES "Dec 31, 1996"
8 .SH NAME
9 curs_terminfo, setupterm, setterm, set_curterm, del_curterm, restartterm,
10 tparm, tputs, putp, vidputs, vidattr, mvcur, tigetflag, tigetnum, tigetstr \-
11 curses interfaces to terminfo database
12 .SH SYNOPSIS
13 .LP
14 .nf
15 \fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-lcurses\fR [ \fIlibrary\fR ... ]
16 #include <curses.h>
17 #include <term.h>
19 \fBint\fR \fBsetupterm\fR(\fBchar *\fR\fIterm\fR, \fBint\fR \fIfildes\fR, \fBint *\fR\fIerrret\fR);
20 .fi
22 .LP
23 .nf
24 \fBint\fR \fBsetterm\fR(\fBchar *\fR\fIterm\fR);
25 .fi
27 .LP
28 .nf
29 \fBint\fR \fBset_curterm\fR(\fBTERMINAL *\fR\fInterm\fR);
30 .fi
32 .LP
33 .nf
34 \fBint\fR \fBdel_curterm\fR(\fBTERMINAL *\fR\fIoterm\fR);
35 .fi
37 .LP
38 .nf
39 \fBint\fR \fBrestartterm\fR(\fBchar *\fR\fIterm\fR, \fBint\fR \fIfildes\fR, \fBint *\fR\fIerrret\fR);
40 .fi
42 .LP
43 .nf
44 \fBchar *\fR\fBtparm\fR(\fBchar *\fR\fIstr\fR, \fBlong int\fR \fIp1\fR, \fBlong int\fR \fIp2\fR, \fBlong int\fR \fIp3\fR, \fBlong int\fR \fIp4\fR,
45      \fBlong int\fR \fIp5\fR, \fBlong int\fR \fIp6\fR, \fBlong int\fR \fIp7\fR, \fBlong int\fR \fIp8\fR, \fBlong int\fR \fIp9\fR);
46 .fi
48 .LP
49 .nf
50 \fBint\fR \fBtputs\fR(\fBchar *\fR\fIstr\fR, \fBint\fR \fIaffcnt\fR, \fBint (*\fR\fIputc\fR)(\fIchar\fR));
51 .fi
53 .LP
54 .nf
55 \fBint\fR \fBputp\fR(\fBchar *\fR\fIstr\fR);
56 .fi
58 .LP
59 .nf
60 \fBint\fR \fBvidputs\fR(\fBchtype\fR \fIattrs\fR, \fBint (*\fR\fIputc\fR)(\fIchar\fR));
61 .fi
63 .LP
64 .nf
65 \fBint\fR \fBvidattr\fR(\fBchtype\fR \fIattrs\fR);
66 .fi
68 .LP
69 .nf
70 \fBint\fR \fBmvcur\fR(\fBint\fR \fIoldrow\fR, \fBint\fR \fIoldcol\fR, \fBint\fR \fInewrow\fR, \fBint\fR \fInewcol\fR);
71 .fi
73 .LP
74 .nf
75 \fBint\fR \fBtigetflag\fR(\fBchar *\fR\fIcapname\fR);
76 .fi
78 .LP
79 .nf
80 \fBint\fR \fBtigetnum\fR(\fBchar *\fR\fIcapname\fR);
81 .fi
83 .LP
84 .nf
85 \fBchar *\fR\fBtigetstr\fR(\fBchar *\fR\fIcapname\fR);
86 .fi
88 .SH DESCRIPTION
89 .sp
90 .LP
91 These low-level routines must be called by programs that have to deal directly
92 with the \fIterminfo\fR database to handle certain terminal capabilities, such
93 as programming function keys. For all other functionality, \fBcurses\fR
94 routines are more suitable and their use is recommended.
95 .sp
96 .LP
97 Initially, \fBsetupterm()\fR should be called. Note that \fBsetupterm()\fR is
98 automatically called by \fBinitscr()\fR and \fBnewterm()\fR. This defines the
99 set of terminal-dependent variables (listed in \fBterminfo\fR(4)). The
100 \fIterminfo\fR variables \fBlines\fR and \fBcolumns\fR are initialized by
101 \fBsetupterm()\fR as follows:  If \fBuse_env(FALSE)\fR has been called, values
102 for \fBlines\fR and \fBcolumns\fR specified in \fIterminfo\fR are used.
103 Otherwise, if the environment variables \fBLINES\fR and \fBCOLUMNS\fR exist,
104 their values are used. If these environment variables do not exist and the
105 program is running in a window, the current window size is used. Otherwise, if
106 the environment variables do not exist, the values for \fBlines\fR and
107 \fBcolumns\fR specified in the \fIterminfo\fR database are used.
110 The headers \fB<curses.h>\fR and \fB<term.h>\fR should be included (in this
111 order) to get the definitions for these strings, numbers, and flags.
112 Parameterized strings should be passed through \fBtparm()\fR to instantiate
113 them. All \fIterminfo\fR strings (including the output of \fBtparm()\fR) should
114 be printed with \fBtputs()\fR or \fBputp()\fR. Call the
115 \fBreset_shell_mode()\fR routine to restore the tty modes before exiting (see
116 \fBcurs_kernel\fR(3CURSES)). Programs which use cursor addressing should output
117 \fBenter_ca_mode\fR upon startup and should output \fBexit_ca_mode\fR before
118 exiting. Programs desiring shell escapes should call \fBreset_shell_mode\fR and
119 output \fBexit_ca_mode\fR before the shell is called and should output
120 \fBenter_ca_mode\fR and call \fBreset_prog_mode\fR after returning from the
121 shell.
124 The \fBsetupterm()\fR routine reads in the \fIterminfo\fR database,
125 initializing the \fIterminfo\fR structures, but does not set up the output
126 virtualization structures used by \fBcurses\fR. The terminal type is the
127 character string \fIterm;\fR if \fIterm\fR is null, the environment variable
128 \fBTERM\fR is used. All output is to file descriptor \fIfildes\fR which is
129 initialized for output. If \fIerrret\fR is not null, then \fBsetupterm()\fR
130 returns \fBOK\fR or \fBERR\fR and stores a status value in the integer pointed
131 to by \fIerrret\fR. A status of \fB1\fR in \fIerrret\fR is normal, \fB0\fR
132 means that the terminal could not be found, and \fB\(mi1\fR means that the
133 \fIterminfo\fR database could not be found. If \fIerrret\fR is null,
134 \fBsetupterm()\fR prints an error message upon finding an error and exits.
135 Thus, the simplest call is:
138 setupterm((char *)0, 1, (int *)0);,
141 which uses all the defaults and sends the output to \fBstdout\fR.
144 The \fBsetterm()\fR routine is being replaced by \fBsetupterm()\fR. The call:
147 \fBsetupterm(\fR\fIterm\fR, 1, (int *)0)
150 provides the same functionality as \fBsetterm(\fR\fIterm\fR). The
151 \fBsetterm()\fR routine is included here for compatibility and is supported at
152 Level 2.
155 The \fBset_curterm()\fR routine sets the variable \fBcur_term\fR to
156 \fInterm\fR, and makes all of the \fIterminfo\fR boolean, numeric, and string
157 variables use the values from \fInterm\fR.
160 The \fBdel_curterm()\fR routine frees the space pointed to by \fIoterm\fR and
161 makes it available for further use. If \fIoterm\fR is the same as
162 \fBcur_term\fR, references to any of the \fIterminfo\fR boolean, numeric, and
163 string variables thereafter may refer to invalid memory locations until another
164 \fBsetupterm()\fR has been called.
167 The \fBrestartterm()\fR routine is similar to \fBsetupterm()\fR and
168 \fBinitscr()\fR, except that it is called after restoring memory to a previous
169 state. It assumes that the windows and the input and output options are the
170 same as when memory was saved, but the terminal type and baud rate may be
171 different.
174 The \fBtparm()\fR routine instantiates the string \fIstr\fR with parameters
175 \fIpi\fR. A pointer is returned to the result of \fIstr\fR with the parameters
176 applied.
179 The \fBtputs()\fR routine applies padding information to the string \fIstr\fR
180 and outputs it. The \fIstr\fR must be a terminfo string variable or the return
181 value from \fBtparm()\fR, \fBtgetstr()\fR, or \fBtgoto()\fR. \fIaffcnt\fR is
182 the number of lines affected, or 1 if not applicable. \fIputc\fR is a
183 \fBputchar()\fR-like routine to which the characters are passed, one at a time.
186 The \fBputp()\fR routine calls \fBtputs(\fR\fIstr\fR, 1, putchar). Note that
187 the output of \fBputpA()\fR always goes to \fBstdout\fR, not to the
188 \fIfildes\fR specified in \fBsetupterm()\fR.
191 The \fBvidputs()\fR routine displays the string on the terminal in the video
192 attribute mode \fIattrs\fR, which is any combination of the attributes listed
193 in \fBcurses\fR(3CURSES). The characters are passed to the \fBputchar()\fR-like
194 routine \fBputc()\fR \fB\&.\fR
197 The \fBvidattr()\fR routine is like the \fBvidputs()\fR routine, except that it
198 outputs through \fBputchar()\fR.
201 The \fBmvcur()\fR routine provides low-level cursor motion.
204 The \fBtigetflag()\fR, \fBtigetnum()\fR and \fBtigetstr()\fR routines return
205 the value of the capability corresponding to the \fIterminfo\fR \fIcapname\fR
206 passed to them, such as \fBxenl\fR.
209 With the \fBtigetflag()\fR routine, the value \fB\(mi1\fR is returned if
210 \fIcapname\fR is not a boolean capability.
213 With the \fBtigetnum()\fR routine, the value \fB\(mi2\fR is returned if
214 \fIcapname\fR is not a numeric capability.
217 With the \fBtigetstr()\fR routine, the value \fB(char *)\(mi1\fR is returned if
218 \fIcapname\fR is not a string capability.
221 The \fIcapname\fR for each capability is given in the table column entitled
222 \fIcapname\fR code in the capabilities section of \fBterminfo\fR(4).
224 .in +2
226 char *boolnames, *boolcodes, *boolfnames
227 char *numnames, *numcodes, *numfnames
228 char *strnames, *strcodes, *strfnames
230 .in -2
234 These null-terminated arrays contain the \fIcapnames\fR, the \fItermcap\fR
235 codes, and the full C names, for each of the \fIterminfo\fR variables.
236 .SH RETURN VALUES
239 All routines return the integer \fBERR\fR upon failure and an integer value
240 other than \fBERR\fR upon successful completion, unless otherwise noted in the
241 preceding routine descriptions.
244 Routines that return pointers always return \fINULL\fR on error.
245 .SH ATTRIBUTES
248 See \fBattributes\fR(5) for descriptions of the following attributes:
253 box;
254 c | c
255 l | l .
256 ATTRIBUTE TYPE  ATTRIBUTE VALUE
258 MT-Level        Unsafe
261 .SH SEE ALSO
264 \fBcurs_initscr\fR(3CURSES), \fBcurs_kernel\fR(3CURSES),
265 \fBcurs_termcap\fR(3CURSES), \fBcurses\fR(3CURSES), \fBputc\fR(3C),
266 \fBterminfo\fR(4), \fBattributes\fR(5)
267 .SH NOTES
270 The header <\fBcurses.h\fR> automatically includes the headers  <\fBstdio.h\fR>
271 and <\fBunctrl.h\fR>.
274 The \fBsetupterm()\fR routine should be used in place of \fBsetterm()\fR.
277 Note that \fBvidattr()\fR and \fBvidputs()\fR may be macros.