Merge branch 'vendor/GDB' into gdb7
[dragonfly.git] / lib / libncurses / man / curs_scanw.3
1 .\"***************************************************************************
2 .\" Copyright (c) 1998,2000 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_scanw.3x,v 1.12 2002/07/20 15:48:09 tom Exp $
30 .\" $DragonFly: src/lib/libncurses/man/curs_scanw.3,v 1.2 2005/08/03 09:56:19 eirikn Exp $
31 .TH curs_scanw 3X ""
32 .SH NAME
33 \fBscanw\fR,
34 \fBwscanw\fR,
35 \fBmvscanw\fR,
36 \fBmvwscanw\fR,
37 \fBvwscanw\fR, \fBvw_scanw\fR - convert formatted input from a \fBcurses\fR window
38 .SH SYNOPSIS
39 \fB#include <curses.h>\fR
40
41 \fBint scanw(const char *fmt, ...);\fR
42 .br
43 \fBint wscanw(WINDOW *win, const char *fmt, ...);\fR
44 .br
45 \fBint mvscanw(int y, int x, const char *fmt, ...);\fR
46 .br
47 \fBint mvwscanw(WINDOW *win, int y, int x, const char *fmt, ...);\fR
48 .br
49 \fBint vw_scanw(WINDOW *win, const char *fmt, va_list varglist);\fR
50 .br
51 \fBint vwscanw(WINDOW *win, const char *fmt, va_list varglist);\fR
52 .SH DESCRIPTION
53 The \fBscanw\fR, \fBwscanw\fR and \fBmvscanw\fR routines are analogous to
54 \fBscanf\fR [see \fBscanf\fR(3S)].  The effect of these routines is as though
55 \fBwgetstr\fR were called on the window, and the resulting line used as input
56 for \fBsscanf\fR(3).  Fields which do not map to a variable in the \fIfmt\fR
57 field are lost.
58
59 The \fBvwscanw\fR and \fBvw_scanw\fR routines are analogous to \fBvscanf\fR.
60 They perform a \fBwscanw\fR using a variable argument list.
61 The third argument is a \fIva_list\fR,
62 a pointer to a list of arguments, as defined in \fB<stdarg.h>\fR.
63 .SH RETURN VALUE
64 \fBvwscanw\fR returns \fBERR\fR on failure and an integer equal to the
65 number of fields scanned on success.
66
67 Applications may use the return value from the \fBscanw\fR, \fBwscanw\fR,
68 \fBmvscanw\fR and \fBmvwscanw\fR routines to determine the number of fields
69 which were mapped in the call.
70 .SH PORTABILITY
71 The XSI Curses standard, Issue 4 describes these functions.  The function
72 \fBvwscanw\fR is marked TO BE WITHDRAWN, and is to be replaced by a function
73 \fBvw_scanw\fR using the \fB<stdarg.h>\fR interface.
74 The Single Unix Specification, Version 2 states that
75 \fBvw_scanw\fR  is preferred to \fBvwscanw\fR since the latter requires
76 including \fB<varargs.h>\fR, which
77 cannot be used in the same file as \fB<stdarg.h>\fR.
78 This implementation uses \fB<stdarg.h>\fR for both, because that header
79 is included in \fB<curses.h\fR>.
80 .LP
81 Both XSI and The Single Unix Specification, Version 2 state that these
82 functions return ERR or OK.
83 Since the underlying \fBscanf\fR can return the number of items scanned,
84 and the SVr4 code was documented to use this feature,
85 this is probably an editing error which was introduced in XSI,
86 rather than being done intentionally.
87 Portable applications should only test if the return value is ERR,
88 since the OK value (zero) is likely to be misleading.
89 One possible way to get useful results would be to use a "%n" conversion
90 at the end of the format string to ensure that something was processed.
91 .SH SEE ALSO
92 \fBcurses\fR(3X), \fBcurs_getstr\fR(3X), \fBcurs_printw\fR(3X), \fBscanf\fR(3S)
93 .\"#
94 .\"# The following sets edit modes for GNU EMACS
95 .\"# Local Variables:
96 .\"# mode:nroff
97 .\"# fill-column:79
98 .\"# End: