Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1 | .\"*************************************************************************** |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 2 | .\" Copyright (c) 2002-2010,2012 Free Software Foundation, Inc. * |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 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 | .\" |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 29 | .\" $Id: curs_get_wstr.3x,v 1.9 2012/11/03 23:03:59 tom Exp $ |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 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 |
| 70 | were made, until a newline, other end-of-line, or end-of-file condition is processed. |
| 71 | An end-of-file condition is represented by \fBWEOF\fR, as defined in \fB<wchar.h>\fR. |
| 72 | The newline and end-of-line conditions are represented by the \fB\\n\fR \fBwchar_t\fR value. |
| 73 | In all instances, the end of the string is terminated by a null \fBwchar_t\fR. |
| 74 | The routine places resulting values in the area pointed to by \fIwstr\fR. |
| 75 | .PP |
| 76 | The user's erase and kill characters are interpreted. If keypad |
| 77 | mode is on for the window, \fBKEY_LEFT\fR and \fBKEY_BACKSPACE\fR |
| 78 | are both considered equivalent to the user's kill character. |
| 79 | .PP |
| 80 | Characters input are echoed only if \fBecho\fR is currently on. In that case, |
| 81 | backspace is echoed as deletion of the previous character (typically a left |
| 82 | motion). |
| 83 | .PP |
| 84 | The effect of |
| 85 | \fBwget_wstr\fR |
| 86 | is as though a series of |
| 87 | calls to |
| 88 | \fBwget_wch\fR |
| 89 | were made. |
| 90 | .PP |
| 91 | The effect of |
| 92 | \fBmvget_wstr\fR |
| 93 | is as though a call to |
| 94 | \fBmove\fR |
| 95 | and then a series of calls to |
| 96 | \fBget_wch\fR |
| 97 | were |
| 98 | made. |
| 99 | .PP |
| 100 | The effect of |
| 101 | \fBmvwget_wstr\fR |
| 102 | is as though a call to |
| 103 | \fBwmove\fR |
| 104 | and then a series of calls to |
| 105 | \fBwget_wch\fR |
| 106 | were made. |
| 107 | .PP |
| 108 | The |
| 109 | \fBgetn_wstr\fR, |
| 110 | \fBmvgetn_wstr\fR, |
| 111 | \fBmvwgetn_wstr\fR, and |
| 112 | \fBwgetn_wstr\fR |
| 113 | functions are identical |
| 114 | to the |
| 115 | \fBget_wstr\fR, |
| 116 | \fBmvget_wstr\fR, |
| 117 | \fBmvwget_wstr\fR, and |
| 118 | \fBwget_wstr\fR |
| 119 | functions, respectively, |
| 120 | except that the |
| 121 | \fB*n_*\fR |
| 122 | versions read at most |
| 123 | \fIn\fR |
| 124 | characters, letting the application prevent overflow of the |
| 125 | input buffer. |
| 126 | .SH NOTES |
| 127 | Using |
| 128 | \fBget_wstr\fR, |
| 129 | \fBmvget_wstr\fR, |
| 130 | \fBmvwget_wstr\fR, or |
| 131 | \fBwget_wstr\fR |
| 132 | to read a line that |
| 133 | overflows the array pointed to by |
| 134 | \fBwstr\fR |
| 135 | causes undefined |
| 136 | results. |
| 137 | The use of |
| 138 | \fBgetn_wstr\fR, |
| 139 | \fBmvgetn_wstr\fR, |
| 140 | \fBmvwgetn_wstr\fR, or |
| 141 | \fBwgetn_wstr\fR, respectively, is recommended. |
| 142 | .PP |
| 143 | These functions cannot return \fBKEY_\fR values because there |
| 144 | is no way to distinguish a \fBKEY_\fR value from a valid \fBwchar_t\fR value. |
| 145 | .PP |
| 146 | All of these routines except \fBwgetn_wstr\fR may be macros. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 147 | .SH RETURN VALUE |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 148 | All of these functions return \fBOK\fR upon successful completion. |
| 149 | Otherwise, they return \fBERR\fR. |
| 150 | .PP |
| 151 | Functions using a window parameter return an error if it is null. |
| 152 | .RS |
| 153 | .TP 5 |
| 154 | \fBwgetn_wstr\fP |
| 155 | returns an error if the associated call to \fBwget_wch\fP failed. |
| 156 | .RE |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 157 | .PP |
| 158 | Functions with a "mv" prefix first perform a cursor movement using |
| 159 | \fBwmove\fP, and return an error if the position is outside the window, |
| 160 | or if the window pointer is null. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 161 | .SH PORTABILITY |
| 162 | These functions are described in The Single Unix Specification, Version 2. |
| 163 | No error conditions are defined. |
| 164 | This implementation returns ERR if the window pointer is null, |
| 165 | or if the lower-level \fBwget_wch\fR call returns an ERR. |
| 166 | In the latter case, |
| 167 | an ERR return without other data is treated as an end-of-file condition, |
| 168 | and the returned array contains a \fBWEOF\fR followed by a null \fBwchar_t\fR. |
| 169 | .PP |
| 170 | X/Open curses documents these functions to pass an array of \fBwchar_t\fR, |
| 171 | but all of the vendors implement this using \fBwint_t\fR. |
| 172 | .SH SEE ALSO |
| 173 | Functions: |
| 174 | \fBcurses\fR(3X), |
| 175 | \fBcurs_get_wch\fR(3X), |
| 176 | \fBcurs_getstr\fR(3X). |