1 .\"***************************************************************************
2 .\" Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. *
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: *
12 .\" The above copyright notice and this permission notice shall be included *
13 .\" in all copies or substantial portions of the Software. *
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. *
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 *
27 .\"***************************************************************************
29 .\" $Id: curs_util.3x,v 1.12 2004/01/31 17:24:53 tom Exp $
30 .\" $DragonFly: src/lib/libncurses/man/curs_util.3,v 1.2 2005/08/03 09:56:19 eirikn Exp $
42 \fBwunctrl\fR - miscellaneous \fBcurses\fR utility routines
44 \fB#include <curses.h>\fR
46 \fBconst char *unctrl(chtype c);\fR
48 \fBchar *wunctrl(cchar_t *c);\fR
50 \fBconst char *keyname(int c);\fR
52 \fBchar *key_name(wchar_t w);\fR
54 \fBvoid filter(void);\fR
56 \fBvoid use_env(bool f);\fR
58 \fBint putwin(WINDOW *win, FILE *filep);\fR
60 \fBWINDOW *getwin(FILE *filep);\fR
62 \fBint delay_output(int ms);\fR
64 \fBint flushinp(void);\fR
67 The \fBunctrl\fR routine returns a character string which is a printable
68 representation of the character \fIc\fR, ignoring attributes.
69 Control characters are displayed in the \fB^\fR\fIX\fR notation.
70 Printing characters are displayed as is.
71 The corresponding \fBwunctrl\fR returns a printable representation of
74 The \fBkeyname\fR routine returns a character string corresponding to the key \fIc\fR.
75 Control characters are displayed in the \fB^\fR\fIX\fR notation.
76 Values above 128 are either meta characters, shown in the \fBM-\fR\fIX\fR notation,
77 or the names of function keys, or null.
78 The corresponding \fBkey_name\fR returns a character string corresponding
79 to the wide-character value \fIw\fR.
80 The two functions do not return the same set of strings;
81 the latter returns null where the former would display a meta character.
83 The \fBfilter\fR routine, if used, must be called before \fBinitscr\fR or
84 \fBnewterm\fR are called. The effect is that, during those calls, \fBLINES\fR
85 is set to 1; the capabilities \fBclear\fR, \fBcup\fR, \fBcud\fR, \fBcud1\fR,
86 \fBcuu1\fR, \fBcuu\fR, \fBvpa\fR are disabled; and the \fBhome\fR string is
87 set to the value of \fBcr\fR.
89 The \fBuse_env\fR routine, if used, is called before \fBinitscr\fR or
90 \fBnewterm\fR are called. When called with \fBFALSE\fR as an
91 argument, the values of \fBlines\fR and \fBcolumns\fR specified in the
92 \fIterminfo\fR database will be used, even if environment variables
93 \fBLINES\fR and \fBCOLUMNS\fR (used by default) are set, or if
94 \fBcurses\fR is running in a window (in which case default behavior
95 would be to use the window size if \fBLINES\fR and \fBCOLUMNS\fR are
98 The \fBputwin\fR routine writes all data associated with window \fIwin\fR into
99 the file to which \fIfilep\fR points. This information can be later retrieved
100 using the \fBgetwin\fR function.
102 The \fBgetwin\fR routine reads window related data stored in the file by
103 \fBputwin\fR. The routine then creates and initializes a new window using that
104 data. It returns a pointer to the new window.
106 The \fBdelay_output\fR routine inserts an \fIms\fR millisecond pause
107 in output. This routine should not be used extensively because
108 padding characters are used rather than a CPU pause.
109 If no padding character is specified, this uses \fBnapms\fR to perform the delay.
111 The \fBflushinp\fR routine throws away any typeahead that has been typed by the
112 user and has not yet been read by the program.
114 Except for \fBflushinp\fR, routines that return an integer return \fBERR\fR
115 upon failure and \fBOK\fR (SVr4 specifies only "an integer value other than
116 \fBERR\fR") upon successful completion.
118 \fBflushinp\fR always returns \fBOK\fR.
120 Routines that return pointers return \fBNULL\fR on error.
122 The XSI Curses standard, Issue 4 describes these functions.
123 It states that \fBunctrl\fR and \fBwunctrl\fR will return a null pointer if
124 unsuccessful, but does not define any error conditions.
126 The SVr4 documentation describes the action of \fBfilter\fR only in the vaguest
127 terms. The description here is adapted from the XSI Curses standard (which
128 erroneously fails to describe the disabling of \fBcuu\fR).
130 The strings returned by \fBunctrl\fR in this implementation are determined
131 at compile time, showing C1 controls from the upper-128 codes with a `~'
132 prefix rather than `^'.
133 Other implementations typically show both sets of control characters with `^',
134 and may strip the parameter to 7 bits.
135 This implementation uses 8 bits but does not modify the string to reflect
139 \fBcurs_initscr\fR(3X),
140 \fBcurs_kernel\fR(3X),
141 \fBcurs_scr_dump\fR(3X).
143 .\"# The following sets edit modes for GNU EMACS
144 .\"# Local Variables: