1 .\"***************************************************************************
2 .\" Copyright 2018-2021,2022 Thomas E. Dickey *
3 .\" Copyright 2002-2012,2017 Free Software Foundation, Inc. *
5 .\" Permission is hereby granted, free of charge, to any person obtaining a *
6 .\" copy of this software and associated documentation files (the *
7 .\" "Software"), to deal in the Software without restriction, including *
8 .\" without limitation the rights to use, copy, modify, merge, publish, *
9 .\" distribute, distribute with modifications, sublicense, and/or sell *
10 .\" copies of the Software, and to permit persons to whom the Software is *
11 .\" furnished to do so, subject to the following conditions: *
13 .\" The above copyright notice and this permission notice shall be included *
14 .\" in all copies or substantial portions of the Software. *
16 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
17 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
18 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
19 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
20 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
21 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
22 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
24 .\" Except as contained in this notice, the name(s) of the above copyright *
25 .\" holders shall not be used in advertising or otherwise to promote the *
26 .\" sale, use or other dealings in this Software without prior written *
28 .\"***************************************************************************
30 .\" $Id: curs_get_wstr.3x,v 1.26 2022/02/12 20:07:29 tom Exp $
31 .TH curs_get_wstr 3X ""
50 \fBmvwgetn_wstr\fP \- get an array of wide characters from a curses terminal keyboard
55 \fB#include <curses.h>\fP
57 \fBint get_wstr(wint_t *\fIwstr\fB);\fR
59 \fBint getn_wstr(wint_t *\fIwstr\fB, int \fIn\fB);\fR
61 \fBint wget_wstr(WINDOW *\fIwin\fB, wint_t *\fIwstr\fB);\fR
63 \fBint wgetn_wstr(WINDOW *\fIwin\fB, wint_t *\fIwstr\fB, int \fIn\fB);\fR
65 \fBint mvget_wstr(int \fIy\fB, int \fIx\fB, wint_t *\fIwstr\fB);\fR
67 \fBint mvgetn_wstr(int \fIy\fB, int \fIx\fB, wint_t *\fIwstr\fB, int \fIn\fB);\fR
69 \fBint mvwget_wstr(WINDOW *\fIwin\fB, int \fIy\fB, int \fIx\fB, wint_t *\fIwstr\fB);\fR
71 \fBint mvwgetn_wstr(WINDOW *\fIwin\fB, int \fIy\fB, int \fIx\fB, wint_t *\fIwstr\fB, int \fIn\fB);\fR
76 is as though a series of calls
79 were made, until a newline, other end-of-line,
80 or end-of-file condition is processed.
81 An end-of-file condition is represented by \fBWEOF\fP,
82 as defined in \fB<wchar.h>\fP.
83 The newline and end-of-line conditions are represented
84 by the \fB\\n\fP \fBwchar_t\fP value.
85 In all instances, the end of the string is terminated by a null \fBwchar_t\fP.
86 The routine places resulting values in the area pointed to by \fIwstr\fP.
88 The user's erase and kill characters are interpreted.
90 mode is on for the window, \fBKEY_LEFT\fP and \fBKEY_BACKSPACE\fP
91 are both considered equivalent to the user's kill character.
93 Characters input are echoed only if \fBecho\fP is currently on.
95 backspace is echoed as deletion of the previous character (typically a left
100 is as though a series of
107 is as though a call to
109 and then a series of calls to
116 is as though a call to
118 and then a series of calls to
125 \fBmvwgetn_wstr\fP, and
127 functions are identical
131 \fBmvwget_wstr\fP, and
133 functions, respectively,
136 versions read at most
138 characters, letting the application prevent overflow of the
144 \fBmvwget_wstr\fP, or
147 overflows the array pointed to by
154 \fBmvwgetn_wstr\fP, or
155 \fBwgetn_wstr\fP, respectively, is recommended.
157 These functions cannot return \fBKEY_\fP values because there
158 is no way to distinguish a \fBKEY_\fP value from a valid \fBwchar_t\fP value.
160 All of these routines except \fBwgetn_wstr\fP may be macros.
162 All of these functions return \fBOK\fP upon successful completion.
163 Otherwise, they return \fBERR\fP.
165 Functions using a window parameter return an error if it is null.
169 returns an error if the associated call to \fBwget_wch\fP failed.
172 Functions with a \*(``mv\*('' prefix first perform a cursor movement using
173 \fBwmove\fP, and return an error if the position is outside the window,
174 or if the window pointer is null.
176 These functions are described in The Single Unix Specification, Version 2.
177 No error conditions are defined.
178 This implementation returns \fBERR\fP if the window pointer is null,
179 or if the lower-level \fBwget_wch\fP call returns an \fBERR\fP.
181 an \fBERR\fP return without other data is treated as an end-of-file condition,
182 and the returned array contains a \fBWEOF\fP followed by a null \fBwchar_t\fP.
184 X/Open curses documented these functions to pass an array of \fBwchar_t\fP
185 in 1997, but that was an error because of this part of the description:
188 The effect of \fBget_wstr\fP is as though a series of calls to
189 \fBget_wch\fP were made, until a newline character, end-of-line character, or
190 end-of-file character is processed.
193 The latter function \fIget_wch\fP can return a negative value,
194 while \fBwchar_t\fP is a unsigned type.
195 All of the vendors implement this using \fBwint_t\fP, following the standard.
197 X/Open Curses, Issue 7 (2009) is unclear regarding whether
198 the terminating \fInull \fBwchar_t\fR
199 value is counted in the length parameter \fIn\fP.
200 X/Open Curses, Issue 7 revised the corresponding description
201 of \fBwgetnstr\fP to address this issue.
202 The unrevised description of \fBwget_nwstr\fP can be interpreted either way.
203 This implementation counts the terminator in the length.
205 X/Open Curses does not specify what happens if the length \fIn\fP is negative.
207 For analogy with \fBwgetnstr\fP,
208 ncurses 6.2 uses a limit (based on \fBLINE_MAX\fP).
210 Some other implementations (such as Solaris xcurses) do the same,
211 while others (PDCurses) do not allow this.
213 NetBSD 7 curses imitates ncurses 6.1 in this regard,
214 treating a \fB\-1\fP as an indefinite number of characters.
218 \fBcurs_get_wch\fP(3X),
219 \fBcurs_getstr\fP(3X).