]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/libncurses/curs_termin.3
Make bdev userland access work like cdev userland access unless
[FreeBSD/FreeBSD.git] / lib / libncurses / curs_termin.3
1 .\" $FreeBSD$
2 .\"
3 .TH curs_terminfo 3 ""
4 .ds n 5
5 .SH NAME
6 \fBsetupterm\fR, \fBsetterm\fR,
7 \fBset_curterm\fR, \fBdel_curterm\fR, \fBrestartterm\fR, \fBtparm\fR,
8 \fBtputs\fR, \fBputp\fR, \fBvidputs\fR, \fBvidattr\fR, \fBmvcur\fR,
9 \fBtigetflag\fR, \fBtigetnum\fR, 
10 \fBtigetstr\fR - \fBncurses\fR interfaces to terminfo database
11 .SH SYNOPSIS
12 \fB#include <ncurses.h>\fR
13 .br
14 \fB#include <term.h>\fR
15
16 \fBint setupterm(char *term, int fildes, int *errret);\fR
17 .br
18 \fBint setterm(char *term);\fR
19 .br
20 \fBint set_curterm(TERMINAL *nterm);\fR
21 .br
22 \fBint del_curterm(TERMINAL *oterm);\fR
23 .br
24 \fBint restartterm(char *term, int fildes, int *errret);\fR
25 .br
26 \fBchar *tparm(char *str, long int p1, long int p2, 
27       long int p3, long int p4, long int p5, long int p6, 
28       long int p7, long int p8, long int p9);\fR
29 .br
30 \fBint tputs(char *str, int affcnt, int (*putc)(char));\fR
31 .br
32 \fBint putp(char *str);\fR
33 .br
34 \fBint vidputs(chtype attrs, int (*putc)(char));\fR
35 .br
36 \fBint vidattr(chtype attrs);\fR
37 .br
38 \fBint mvcur(int oldrow, int oldcol, int newrow, int newcol);\fR
39 .br
40 \fBint tigetflag(char *capname);\fR
41 .br
42 \fBint tigetnum(char *capname);\fR
43 .br
44 \fBchar *tigetstr(char *capname);\fR
45 .br
46 .SH DESCRIPTION
47 These low-level routines must be called by programs that have to deal
48 directly with the \fBterminfo\fR database to handle certain terminal
49 capabilities, such as programming function keys.  For all other
50 functionality, \fBncurses\fR routines are more suitable and their use is
51 recommended.
52
53 Initially, \fBsetupterm\fR should be called.  Note that
54 \fBsetupterm\fR is automatically called by \fBinitscr\fR and
55 \fBnewterm\fR.  This defines the set of terminal-dependent variables
56 [listed in \fBterminfo\fR(5)].  The \fBterminfo\fR variables
57 \fBlines\fR and \fBcolumns\fR are initialized by \fBsetupterm\fR as
58 follows: If \fBuse_env(FALSE)\fR has been called, values for
59 \fBlines\fR and \fBcolumns\fR specified in \fBterminfo\fR are used.
60 Otherwise, if the environment variables \fBLINES\fR and \fBCOLUMNS\fR
61 exist, their values are used.  If these environment variables do not
62 exist and the program is running in a window, the current window size
63 is used.  Otherwise, if the environment variables do not exist, the
64 values for \fBlines\fR and \fBcolumns\fR specified in the
65 \fBterminfo\fR database are used.
66
67 The header files \fBncurses.h\fR and \fBnterm.h\fR should be included (in this
68 order) to get the definitions for these strings, numbers, and flags (these
69 correspond to the SVr4 headers \fBcurses.h\fR and \fBterm.h\fR).  Parameterized
70 strings should be passed through \fBtparm\fR to instantiate them.  All
71 \fBterminfo\fR strings [including the output of \fBtparm\fR] should be printed
72 with \fBtputs\fR or \fBputp\fR.  Call the \fBreset_shell_mode\fR to restore the
73 tty modes before exiting [see \fBcurs_kernel\fR(3)].  Programs which use
74 cursor addressing should output \fBenter_ca_mode\fR upon startup and should
75 output \fBexit_ca_mode\fR before exiting.  Programs desiring shell escapes
76 should call
77
78 \fBreset_shell_mode\fR and output \fBexit_ca_mode\fR before the shell
79 is called and should output \fBenter_ca_mode\fR and call
80 \fBreset_prog_mode\fR after returning from the shell.
81
82 The \fBsetupterm\fR routine reads in the \fBterminfo\fR database,
83 initializing the \fBterminfo\fR structures, but does not set up the
84 output virtualization structures used by \fBncurses\fR.  The terminal
85 type is the character string \fIterm\fR; if \fIterm\fR is null, the
86 environment variable \fBTERM\fR is used.  All output is to file
87 descriptor \fBfildes\fR which is initialized for output.  If
88 \fIerrret\fR is not null, then \fBsetupterm\fR returns \fBOK\fR or
89 \fBERR\fR and stores a status value in the integer pointed to by
90 \fIerrret\fR.  A status of \fB1\fR in \fIerrret\fR is normal, \fB0\fR
91 means that the terminal could not be found, and \fB-1\fR means that
92 the \fBterminfo\fR database could not be found.  If \fIerrret\fR is
93 null, \fBsetupterm\fR prints an error message upon finding an error
94 and exits.  Thus, the simplest call is:
95
96       \fBsetupterm((char *)0, 1, (int *)0);\fR,
97
98 which uses all the defaults and sends the output to \fBstdout\fR.
99
100 The \fBsetterm\fR routine is being replaced by \fBsetupterm\fR.  The call:
101
102       \fBsetupterm(\fR\fIterm\fR\fB, 1, (int *)0)\fR
103
104 provides the same functionality as \fBsetterm(\fR\fIterm\fR\fB)\fR.
105 The \fBsetterm\fR routine is included here for BSD compatibility, and
106 is not recommended for new programs.
107
108 The \fBset_curterm\fR routine sets the variable \fBcur_term\fR to
109 \fInterm\fR, and makes all of the \fBterminfo\fR boolean, numeric, and
110 string variables use the values from \fInterm\fR.
111
112 The \fBdel_curterm\fR routine frees the space pointed to by
113 \fIoterm\fR and makes it available for further use.  If \fIoterm\fR is
114 the same as \fBcur_term\fR, references to any of the \fBterminfo\fR
115 boolean, numeric, and string variables thereafter may refer to invalid
116 memory locations until another \fBsetupterm\fR has been called.
117
118 The \fBrestartterm\fR routine is similar to \fBsetupterm\fR and
119 \fBinitscr\fR, except that it is called after restoring memory to a
120 previous state.  It assumes that the windows and the input and output
121 options are the same as when memory was saved, but the terminal type
122 and baud rate may be different.
123
124 The \fBtparm\fR routine instantiates the string \fIstr\fR with
125 parameters \fIpi\fR.  A pointer is returned to the result of \fIstr\fR
126 with the parameters applied.
127
128 The \fBtputs\fR routine applies padding information to the string
129 \fIstr\fR and outputs it.  The \fIstr\fR must be a terminfo string
130 variable or the return value from \fBtparm\fR, \fBtgetstr\fR, or
131 \fBtgoto\fR.  \fIaffcnt\fR is the number of lines affected, or 1 if
132 not applicable.  \fIputc\fR is a \fBputchar\fR-like routine to which
133 the characters are passed, one at a time.
134
135 The \fBputp\fR routine calls \fBtputs(\fR\fIstr\fR\fB, 1, putchar)\fR.
136 Note that the output of \fBputp\fR always goes to \fBstdout\fR, not to
137 the \fIfildes\fR specified in \fBsetupterm\fR.
138
139 The \fBvidputs\fR routine displays the string on the terminal in the
140 video attribute mode \fIattrs\fR, which is any combination of the
141 attributes listed in \fBncurses\fR(3).  The characters are passed to
142 the \fBputchar\fR-like routine \fIputc\fR.
143
144 The \fBvidattr\fR routine is like the \fBvidputs\fR routine, except
145 that it outputs through \fBputchar\fR.
146
147 The \fBmvcur\fR routine provides low-level cursor motion.  It takes
148 effect immediately (rather than at the next refresh).
149
150 The \fBtigetflag\fR, \fBtigetnum\fR and \fBtigetstr\fR routines return
151 the value of the capability corresponding to the \fBterminfo\fR
152 \fIcapname\fR passed to them, such as \fBxenl\fR.
153
154 With the \fBtigetflag\fR routine, the value \fB-1\fR is returned if
155 \fIcapname\fR is not a boolean capability.
156
157 With the \fBtigetnum\fR routine, the value \fB-2\fR is returned if
158 \fIcapname\fR is not a numeric capability.
159
160 With the \fBtigetstr\fR routine, the value \fB(char *)-1\fR is
161 returned if \fIcapname\fR is not a string capability.
162
163 The \fIcapname\fR for each capability is given in the table column entitled
164 \fIcapname\fR code in the capabilities section of \fBterminfo\fR(5).
165
166 \fBchar *boolnames\fR, \fB*boolcodes\fR, \fB*boolfnames\fR
167
168 \fBchar *numnames\fR, \fB*numcodes\fR, \fB*numfnames\fR
169
170 \fBchar *strnames\fR, \fB*strcodes\fR, \fB*strfnames\fR
171
172 These null-terminated arrays contain the \fIcapnames\fR, the
173 \fBtermcap\fR codes, and the full C names, for each of the
174 \fBterminfo\fR variables.
175 .SH RETURN VALUE
176 All routines return the integer \fBERR\fR upon failure and an integer value
177 other than \fBERR\fR upon successful completion, unless otherwise noted in the
178 preceding routine descriptions.
179
180 Routines that return pointers always return \fBNULL\fR on error.
181 .SH NOTES
182 The \fBsetupterm\fR routine should be used in place of \fBsetterm\fR.
183
184 Note that \fBvidattr\fR and \fBvidputs\fR may be macros.
185 .SH SEE ALSO
186 \fBncurses\fR(3), \fBcurs_initscr\fR(3), \fBcurs_kernel\fR(3),
187 \fBputc\fR(3), \fBterminfo\fR(5)
188 .\"#
189 .\"# The following sets edit modes for GNU EMACS
190 .\"# Local Variables:
191 .\"# mode:nroff
192 .\"# fill-column:79
193 .\"# End: