Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1 | .\"*************************************************************************** |
| 2 | .\" Copyright (c) 1998-2003,2005 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_getstr.3x,v 1.15 2006/01/12 00:30:58 tom Exp $ |
| 30 | .TH curs_getstr 3X "" |
| 31 | .na |
| 32 | .hy 0 |
| 33 | .SH NAME |
| 34 | \fBgetstr\fR, |
| 35 | \fBgetnstr\fR, |
| 36 | \fBwgetstr\fR, |
| 37 | \fBwgetnstr\fR, |
| 38 | \fBmvgetstr\fR, |
| 39 | \fBmvgetnstr\fR, |
| 40 | \fBmvwgetstr\fR, |
| 41 | \fBmvwgetnstr\fR - accept character strings from \fBcurses\fR terminal keyboard |
| 42 | .ad |
| 43 | .hy |
| 44 | .SH SYNOPSIS |
| 45 | \fB#include <curses.h>\fR |
| 46 | .sp |
| 47 | \fBint getstr(char *str);\fR |
| 48 | .br |
| 49 | \fBint getnstr(char *str, int n);\fR |
| 50 | .br |
| 51 | \fBint wgetstr(WINDOW *win, char *str);\fR |
| 52 | .br |
| 53 | \fBint wgetnstr(WINDOW *win, char *str, int n);\fR |
| 54 | .br |
| 55 | \fBint mvgetstr(int y, int x, char *str);\fR |
| 56 | .br |
| 57 | \fBint mvwgetstr(WINDOW *win, int y, int x, char *str);\fR |
| 58 | .br |
| 59 | \fBint mvgetnstr(int y, int x, char *str, int n);\fR |
| 60 | .br |
| 61 | \fBint mvwgetnstr(WINDOW *, int y, int x, char *str, int n);\fR |
| 62 | .br |
| 63 | .SH DESCRIPTION |
| 64 | The function \fBgetstr\fR is equivalent to a series of calls to \fBgetch\fR, |
| 65 | until a newline or carriage return is received (the terminating character is |
| 66 | not included in the returned string). The resulting value is placed in the |
| 67 | area pointed to by the character pointer \fIstr\fR. |
| 68 | .PP |
| 69 | \fBwgetnstr\fR reads at most \fIn\fR characters, thus preventing a possible |
| 70 | overflow of the input buffer. Any attempt to enter more characters (other |
| 71 | than the terminating newline or carriage return) causes a beep. Function |
| 72 | keys also cause a beep and are ignored. The \fBgetnstr\fR function reads |
| 73 | from the \fIstdscr\fR default window. |
| 74 | .PP |
| 75 | The user's erase and kill characters are interpreted. If keypad |
| 76 | mode is on for the window, \fBKEY_LEFT\fR and \fBKEY_BACKSPACE\fR |
| 77 | are both considered equivalent to the user's kill character. |
| 78 | .PP |
| 79 | Characters input are echoed only if \fBecho\fR is currently on. In that case, |
| 80 | backspace is echoed as deletion of the previous character (typically a left |
| 81 | motion). |
| 82 | .SH RETURN VALUE |
| 83 | All routines return the integer \fBERR\fR upon failure and an \fBOK\fR (SVr4 |
| 84 | specifies only "an integer value other than \fBERR\fR") upon successful |
| 85 | completion. |
| 86 | .PP |
| 87 | X/Open defines no error conditions. |
| 88 | .PP |
| 89 | In this implementation, |
| 90 | these functions return an error |
| 91 | if the window pointer is null, or |
| 92 | if its timeout expires without having any data. |
| 93 | .PP |
| 94 | This implementation provides an extension as well. |
| 95 | If a SIGWINCH interrupts the function, it will return \fBKEY_RESIZE\fP |
| 96 | rather than \fBOK\fP or \fBERR\fP. |
| 97 | .SH NOTES |
| 98 | Note that \fBgetstr\fR, \fBmvgetstr\fR, and \fBmvwgetstr\fR may be macros. |
| 99 | .SH PORTABILITY |
| 100 | These functions are described in the XSI Curses standard, Issue 4. |
| 101 | They read single-byte characters only. |
| 102 | The standard does not define any error conditions. |
| 103 | This implementation returns ERR if the window pointer is null, |
| 104 | or if the lower-level \fBwgetch\fR call returns an ERR. |
| 105 | .PP |
| 106 | SVr3 and early SVr4 curses implementations did not reject function keys; |
| 107 | the SVr4.0 documentation claimed that "special keys" (such as function |
| 108 | keys, "home" key, "clear" key, \fIetc\fR.) are "interpreted", without |
| 109 | giving details. It lied. In fact, the `character' value appended to the |
| 110 | string by those implementations was predictable but not useful |
| 111 | (being, in fact, the low-order eight bits of the key's KEY_ value). |
| 112 | .PP |
| 113 | The functions \fBgetnstr\fR, \fBmvgetnstr\fR, and \fBmvwgetnstr\fR were |
| 114 | present but not documented in SVr4. |
| 115 | .SH SEE ALSO |
| 116 | \fBcurses\fR(3X), \fBcurs_getch\fR(3X). |
| 117 | .\"# |
| 118 | .\"# The following sets edit modes for GNU EMACS |
| 119 | .\"# Local Variables: |
| 120 | .\"# mode:nroff |
| 121 | .\"# fill-column:79 |
| 122 | .\"# End: |