]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_get_wstr.3x
ncurses 6.1 - patch 20180825
[ncurses.git] / man / curs_get_wstr.3x
1 .\"***************************************************************************
2 .\" Copyright (c) 2002-2017,2018 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_get_wstr.3x,v 1.14 2018/07/28 22:15:59 tom Exp $
30 .TH curs_get_wstr 3X ""
31 .na
32 .hy 0
33 .SH NAME
34 \fBget_wstr\fR,
35 \fBgetn_wstr\fR,
36 \fBwget_wstr\fR,
37 \fBwgetn_wstr\fR,
38 \fBmvget_wstr\fR,
39 \fBmvgetn_wstr\fR,
40 \fBmvwget_wstr\fR,
41 \fBmvwgetn_wstr\fR \- get an array of wide characters from a curses terminal keyboard
42 .ad
43 .hy
44 .SH SYNOPSIS
45 .nf
46 \fB#include <curses.h>\fR
47 .sp
48 \fBint get_wstr(wint_t *\fR\fIwstr\fR\fB);\fR
49 .br
50 \fBint getn_wstr(wint_t *\fR\fIwstr\fR\fB, int \fR\fIn\fR\fB);\fR
51 .br
52 \fBint wget_wstr(WINDOW *\fR\fIwin\fR\fB, wint_t *\fR\fIwstr\fR\fB);\fR
53 .br
54 \fBint wgetn_wstr(WINDOW *\fR\fIwin\fR\fB, wint_t *\fR\fIwstr\fR\fB, int \fR\fIn\fR\fB);\fR
55 .br
56 \fBint mvget_wstr(int \fR\fIy\fR\fB, int \fR\fIx\fR\fB, wint_t *\fR\fIwstr\fR\fB);\fR
57 .br
58 \fBint mvgetn_wstr(int \fR\fIy\fR\fB, int \fR\fIx\fR\fB, wint_t *\fR\fIwstr\fR\fB, int \fR\fIn\fR\fB);\fR
59 .br
60 \fBint mvwget_wstr(WINDOW *\fR\fIwin\fR\fB, int \fR\fIy\fR\fB, int \fR\fIx\fR\fB, wint_t *\fR\fIwstr\fR\fB);\fR
61 .br
62 \fBint mvwgetn_wstr(WINDOW *\fR\fIwin\fR\fB, int \fR\fIy\fR\fB, int \fR\fIx\fR\fB, wint_t *\fR\fIwstr\fR\fB, int \fR\fIn\fR\fB);\fR
63 .fi
64 .SH DESCRIPTION
65 The effect of
66 \fBget_wstr\fR
67 is as though a series of calls
68 to
69 \fBget_wch\fR(3X)
70 were made, until a newline, other end-of-line,
71 or end-of-file condition is processed.
72 An end-of-file condition is represented by \fBWEOF\fR,
73 as defined in \fB<wchar.h>\fR.
74 The newline and end-of-line conditions are represented
75 by the \fB\\n\fR \fBwchar_t\fR value.
76 In all instances, the end of the string is terminated by a null \fBwchar_t\fR.
77 The routine places resulting values in the area pointed to by \fIwstr\fR.
78 .PP
79 The user's erase and kill characters are interpreted.
80 If keypad
81 mode is on for the window, \fBKEY_LEFT\fR and \fBKEY_BACKSPACE\fR
82 are both considered equivalent to the user's kill character.
83 .PP
84 Characters input are echoed only if \fBecho\fR is currently on.
85 In that case,
86 backspace is echoed as deletion of the previous character (typically a left
87 motion).
88 .PP
89 The effect of
90 \fBwget_wstr\fR
91 is as though a series of
92 calls to
93 \fBwget_wch\fR
94 were made.
95 .PP
96 The effect of
97 \fBmvget_wstr\fR
98 is as though a call to
99 \fBmove\fR
100 and then a series of calls to
101 \fBget_wch\fR
102 were
103 made.
104 .PP
105 The effect of
106 \fBmvwget_wstr\fR
107 is as though a call to
108 \fBwmove\fR
109 and then a series of calls to
110 \fBwget_wch\fR
111 were made.
112 .PP
113 The
114 \fBgetn_wstr\fR,
115 \fBmvgetn_wstr\fR,
116 \fBmvwgetn_wstr\fR, and
117 \fBwgetn_wstr\fR
118 functions are identical
119 to the
120 \fBget_wstr\fR,
121 \fBmvget_wstr\fR,
122 \fBmvwget_wstr\fR, and
123 \fBwget_wstr\fR
124 functions, respectively,
125 except that the
126 \fB*n_*\fR
127 versions read at most
128 \fIn\fR
129 characters, letting the application prevent overflow of the
130 input buffer.
131 .SH NOTES
132 Using
133 \fBget_wstr\fR,
134 \fBmvget_wstr\fR,
135 \fBmvwget_wstr\fR, or
136 \fBwget_wstr\fR
137 to read a line that
138 overflows the array pointed to by
139 \fBwstr\fR
140 causes undefined
141 results.
142 The use of
143 \fBgetn_wstr\fR,
144 \fBmvgetn_wstr\fR,
145 \fBmvwgetn_wstr\fR, or
146 \fBwgetn_wstr\fR, respectively, is recommended.
147 .PP
148 These functions cannot return \fBKEY_\fR values because there
149 is no way to distinguish a \fBKEY_\fR value from a valid \fBwchar_t\fR value.
150 .PP
151 All of these routines except \fBwgetn_wstr\fR may be macros.
152 .SH RETURN VALUE
153 All of these functions return \fBOK\fR upon successful completion.
154 Otherwise, they return \fBERR\fR.
155 .PP
156 Functions using a window parameter return an error if it is null.
157 .RS
158 .TP 5
159 \fBwgetn_wstr\fP
160 returns an error if the associated call to \fBwget_wch\fP failed.
161 .RE
162 .PP
163 Functions with a "mv" prefix first perform a cursor movement using
164 \fBwmove\fP, and return an error if the position is outside the window,
165 or if the window pointer is null.
166 .SH PORTABILITY
167 These functions are described in The Single Unix Specification, Version 2.
168 No error conditions are defined.
169 This implementation returns \fBERR\fP if the window pointer is null,
170 or if the lower-level \fBwget_wch\fR call returns an \fBERR\fP.
171 In the latter case,
172 an \fBERR\fP return without other data is treated as an end-of-file condition,
173 and the returned array contains a \fBWEOF\fR followed by a null \fBwchar_t\fR.
174 .PP
175 X/Open curses documented these functions to pass an array of \fBwchar_t\fR
176 in 1997, but that was an error because of this part of the description:
177 .RS
178 .PP
179 The effect of \fIget_wstr()\fP is as though a series of calls to
180 \fIget_wch()\fP were made, until a newline character, end-of-line character, or
181 end-of-file character is processed.
182 .RE
183 .PP
184 The latter function \fIget_wch()\fP can return a negative value,
185 while \fBwchar_t\fP is a unsigned type.
186 All of the vendors implement this using \fBwint_t\fR, following the standard.
187 .SH SEE ALSO
188 Functions:
189 \fBcurses\fR(3X),
190 \fBcurs_get_wch\fR(3X),
191 \fBcurs_getstr\fR(3X).