1curs_get_wstr(3X) curs_get_wstr(3X)
2
3
4
6 get_wstr, getn_wstr, wget_wstr, wgetn_wstr, mvget_wstr, mvgetn_wstr,
7 mvwget_wstr, mvwgetn_wstr - get an array of wide characters from a
8 curses terminal keyboard
9
11 #include <curses.h>
12
13 int get_wstr(wint_t *wstr);
14 int getn_wstr(wint_t *wstr, int n);
15 int wget_wstr(WINDOW *win, wint_t *wstr);
16 int wgetn_wstr(WINDOW *win, wint_t *wstr, int n);
17
18 int mvget_wstr(int y, int x, wint_t *wstr);
19 int mvgetn_wstr(int y, int x, wint_t *wstr, int n);
20 int mvwget_wstr(WINDOW *win, int y, int x, wint_t *wstr);
21 int mvwgetn_wstr(WINDOW *win, int y, int x, wint_t *wstr, int n);
22
24 The effect of get_wstr is as though a series of calls to get_wch(3X)
25 were made, until a newline, other end-of-line, or end-of-file condition
26 is processed. An end-of-file condition is represented by WEOF, as de‐
27 fined in <wchar.h>. The newline and end-of-line conditions are repre‐
28 sented by the \n wchar_t value. In all instances, the end of the
29 string is terminated by a null wchar_t. The routine places resulting
30 values in the area pointed to by wstr.
31
32 The user's erase and kill characters are interpreted. If keypad mode
33 is on for the window, KEY_LEFT and KEY_BACKSPACE are both considered
34 equivalent to the user's kill character.
35
36 Characters input are echoed only if echo is currently on. In that
37 case, backspace is echoed as deletion of the previous character (typi‐
38 cally a left motion).
39
40 The effect of wget_wstr is as though a series of calls to wget_wch were
41 made.
42
43 The effect of mvget_wstr is as though a call to move and then a series
44 of calls to get_wch were made.
45
46 The effect of mvwget_wstr is as though a call to wmove and then a se‐
47 ries of calls to wget_wch were made.
48
49 The getn_wstr, mvgetn_wstr, mvwgetn_wstr, and wgetn_wstr functions are
50 identical to the get_wstr, mvget_wstr, mvwget_wstr, and wget_wstr func‐
51 tions, respectively, except that the *n_* versions read at most n char‐
52 acters, letting the application prevent overflow of the input buffer.
53
55 Using get_wstr, mvget_wstr, mvwget_wstr, or wget_wstr to read a line
56 that overflows the array pointed to by wstr causes undefined results.
57 The use of getn_wstr, mvgetn_wstr, mvwgetn_wstr, or wgetn_wstr, respec‐
58 tively, is recommended.
59
60 These functions cannot return KEY_ values because there is no way to
61 distinguish a KEY_ value from a valid wchar_t value.
62
63 All of these routines except wgetn_wstr may be macros.
64
66 All of these functions return OK upon successful completion. Other‐
67 wise, they return ERR.
68
69 Functions using a window parameter return an error if it is null.
70
71 wgetn_wstr
72 returns an error if the associated call to wget_wch failed.
73
74 Functions with a “mv” prefix first perform a cursor movement using
75 wmove, and return an error if the position is outside the window, or if
76 the window pointer is null.
77
79 These functions are described in The Single Unix Specification, Version
80 2. No error conditions are defined. This implementation returns ERR
81 if the window pointer is null, or if the lower-level wget_wch call re‐
82 turns an ERR. In the latter case, an ERR return without other data is
83 treated as an end-of-file condition, and the returned array contains a
84 WEOF followed by a null wchar_t.
85
86 X/Open curses documented these functions to pass an array of wchar_t in
87 1997, but that was an error because of this part of the description:
88
89 The effect of get_wstr is as though a series of calls to get_wch
90 were made, until a newline character, end-of-line character, or
91 end-of-file character is processed.
92
93 The latter function get_wch can return a negative value, while wchar_t
94 is a unsigned type. All of the vendors implement this using wint_t,
95 following the standard.
96
97 X/Open Curses, Issue 7 (2009) is unclear regarding whether the termi‐
98 nating null wchar_t value is counted in the length parameter n. X/Open
99 Curses, Issue 7 revised the corresponding description of wgetnstr to
100 address this issue. The unrevised description of wget_nwstr can be in‐
101 terpreted either way. This implementation counts the terminator in the
102 length.
103
104 X/Open Curses does not specify what happens if the length n is nega‐
105 tive.
106
107 • For analogy with wgetnstr, ncurses 6.2 uses a limit (based on
108 LINE_MAX).
109
110 • Some other implementations (such as Solaris xcurses) do the same,
111 while others (PDCurses) do not allow this.
112
113 • NetBSD 7 curses imitates ncurses 6.1 in this regard, treating a -1
114 as an indefinite number of characters.
115
117 Functions: curses(3X), curs_get_wch(3X), curs_getstr(3X).
118
119
120
121 curs_get_wstr(3X)