1curs_get_wstr(3X)                                            curs_get_wstr(3X)
2
3
4

NAME

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

SYNOPSIS

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       int mvget_wstr(int y, int x, wint_t *wstr);
18       int mvgetn_wstr(int y, int x, wint_t *wstr, int n);
19       int mvwget_wstr(WINDOW *win, int y, int x, wint_t *wstr);
20       int mvwgetn_wstr(WINDOW *win, int y, int x, wint_t *wstr, int n);
21

DESCRIPTION

23       The  effect  of  get_wstr is as though a series of calls to get_wch(3X)
24       were made, until a newline, other end-of-line, or end-of-file condition
25       is  processed.  An end-of-file condition is represented by WEOF, as de‐
26       fined in <wchar.h>.  The newline and end-of-line conditions are  repre‐
27       sented  by  the  \n  wchar_t  value.   In all instances, the end of the
28       string is terminated by a null wchar_t.  The routine  places  resulting
29       values in the area pointed to by wstr.
30
31       The  user's  erase and kill characters are interpreted.  If keypad mode
32       is on for the window, KEY_LEFT and KEY_BACKSPACE  are  both  considered
33       equivalent to the user's kill character.
34
35       Characters  input  are  echoed  only  if echo is currently on.  In that
36       case, backspace is echoed as deletion of the previous character  (typi‐
37       cally a left motion).
38
39       The effect of wget_wstr is as though a series of calls to wget_wch were
40       made.
41
42       The effect of mvget_wstr is as though a call to move and then a  series
43       of calls to get_wch were made.
44
45       The  effect  of mvwget_wstr is as though a call to wmove and then a se‐
46       ries of calls to wget_wch were made.
47
48       The getn_wstr, mvgetn_wstr, mvwgetn_wstr, and wgetn_wstr functions  are
49       identical to the get_wstr, mvget_wstr, mvwget_wstr, and wget_wstr func‐
50       tions, respectively, except that the *n_* versions read at most n char‐
51       acters, letting the application prevent overflow of the input buffer.
52

NOTES

54       Using  get_wstr,  mvget_wstr,  mvwget_wstr, or wget_wstr to read a line
55       that overflows the array pointed to by wstr causes  undefined  results.
56       The use of getn_wstr, mvgetn_wstr, mvwgetn_wstr, or wgetn_wstr, respec‐
57       tively, is recommended.
58
59       These functions cannot return KEY_ values because there is  no  way  to
60       distinguish a KEY_ value from a valid wchar_t value.
61
62       All of these routines except wgetn_wstr may be macros.
63

RETURN VALUE

65       All  of  these  functions return OK upon successful completion.  Other‐
66       wise, they return ERR.
67
68       Functions using a window parameter return an error if it is null.
69
70              wgetn_wstr
71                   returns an error if the associated call to wget_wch failed.
72
73       Functions with a “mv” prefix first  perform  a  cursor  movement  using
74       wmove, and return an error if the position is outside the window, or if
75       the window pointer is null.
76

PORTABILITY

78       These functions are described in The Single Unix Specification, Version
79       2.   No  error conditions are defined.  This implementation returns ERR
80       if the window pointer is null, or if the lower-level wget_wch call  re‐
81       turns  an ERR.  In the latter case, an ERR return without other data is
82       treated as an end-of-file condition, and the returned array contains  a
83       WEOF followed by a null wchar_t.
84
85       X/Open curses documented these functions to pass an array of wchar_t in
86       1997, but that was an error because of this part of the description:
87
88              The effect of get_wstr() is as  though  a  series  of  calls  to
89              get_wch()  were  made,  until  a  newline character, end-of-line
90              character, or end-of-file character is processed.
91
92       The latter function  get_wch()  can  return  a  negative  value,  while
93       wchar_t  is  a  unsigned type.  All of the vendors implement this using
94       wint_t, following the standard.
95
96       X/Open Curses, Issue 7 (2009) is unclear regarding whether  the  termi‐
97       nating null wchar_t value is counted in the length parameter n.  X/Open
98       Curses, Issue 7 revised the corresponding description  of  wgetnstr  to
99       address this issue.  The unrevised description of wget_nwstr can be in‐
100       terpreted either way.  This implementation counts the terminator in the
101       length.
102
103       X/Open  Curses  does  not specify what happens if the length n is nega‐
104       tive.
105
106       ·   For analogy with wgetnstr, ncurses  6.2  uses  a  limit  (based  on
107           LINE_MAX).
108
109       ·   Some  other  implementations (such as Solaris xcurses) do the same,
110           while others (PDCurses) do not allow this.
111
112       ·   NetBSD 7 curses imitates ncurses 6.1 in this regard, treating a  -1
113           as an indefinite number of characters.
114

SEE ALSO

116       Functions: curses(3X), curs_get_wch(3X), curs_getstr(3X).
117
118
119
120                                                             curs_get_wstr(3X)
Impressum