]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_getstr.3x
ncurses 5.0
[ncurses.git] / man / curs_getstr.3x
1 .\"***************************************************************************
2 .\" Copyright (c) 1998 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.7 1998/03/11 21:12:53 juergen Exp $
30 .TH curs_getstr 3X ""
31 .SH NAME
32 \fBgetstr\fR, \fBwgetstr\fR, \fBmvgetstr\fR,
33 \fBmvwgetstr\fR, \fBwgetnstr\fR - accept character strings from
34 \fBcurses\fR terminal keyboard
35 .SH SYNOPSIS
36 \fB#include <curses.h>\fR
37
38 \fBint getstr(char *str);\fR
39 .br
40 \fBint getnstr(char *str, int n);\fR
41 .br
42 \fBint wgetstr(WINDOW *win, char *str);\fR
43 .br
44 \fBint mvgetstr(int y, int x, char *str);\fR
45 .br
46 \fBint mvwgetstr(WINDOW *win, int y, int x, char *str);\fR
47 .br
48 \fBint mvgetnstr(int y, int x, char *str, int n);\fR
49 .br
50 \fBint mvwgetnstr(WINDOW *, int y, int x, char *str, int n);\fR
51 .br
52 \fBint wgetnstr(WINDOW *win, char *str, int n);\fR
53 .br
54 .SH DESCRIPTION
55 The function \fBgetstr\fR is equivalent to a series of calls to \fBgetch\fR,
56 until a newline or carriage return is received (the terminating character is
57 not included in the returned string).  The resulting value is placed in the
58 area pointed to by the character pointer \fIstr\fR.
59
60 \fBwgetnstr\fR reads at most \fIn\fR characters, thus preventing a possible
61 overflow of the input buffer.  Any attempt to enter more characters (other
62 than the terminating newline or carriage return) causes a beep.  Function
63 keys also cause a beep and are ignored.  The \fBgetnstr\fR function reads
64 from the \fIstdscr\fR default window.
65
66 The user's erase and kill characters are interpreted.  If keypad
67 mode is on for the window, \fBKEY_LEFT\fR and \fBKEY_BACKSPACE\fR
68 are both considered equivalent to the user's kill character.
69
70 Characters input are echoed only if \fBecho\fR is currently on.  In that case,
71 backspace is echoed as deletion of the previous character (typically a left
72 motion).
73 .SH RETURN VALUE
74 All routines return the integer \fBERR\fR upon failure and an \fBOK\fR (SVr4
75 specifies only "an integer value other than \fBERR\fR") upon successful
76 completion.
77 .SH NOTES
78 Note that \fBgetstr\fR, \fBmvgetstr\fR, and \fBmvwgetstr\fR may be macros.
79 .SH PORTABILITY
80 These functions are described in the XSI Curses standard, Issue 4.  They read
81 single-byte characters only.  The standard specifies that they return \fBERR\fR
82 on failure, but the single error condition \fBEOVERFLOW\fR associated with
83 extended-level conformance is not yet returned (the XSI curses support for
84 multi-byte characters is not yet present).
85
86 SVr3 and early SVr4 curses implementations did not reject function keys;
87 the SVr4.0 documentation claimed that "special keys" (such as function
88 keys, "home" key, "clear" key, \fIetc\fR.) are interpreted" without
89 giving details.  It lied.  In fact, the `character' value appended to the
90 string by those implementations was predictable but not useful
91 (being, in fact, the low-order eight bits of the key's KEY_ value).
92
93 The functions \fBgetnstr\fR, \fBmvgetnstr\fR, and \fBmvwgetnstr\fR were
94 present but not documented in SVr4.
95 .SH SEE ALSO
96 \fBcurses\fR(3X), \fBcurs_getch\fR(3X).
97 .\"#
98 .\"# The following sets edit modes for GNU EMACS
99 .\"# Local Variables:
100 .\"# mode:nroff
101 .\"# fill-column:79
102 .\"# End: