blob: a3208f5627c8238bb0188f1e1fa9d5fde5c17257 [file] [log] [blame]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301.\"***************************************************************************
Steve Kondikae271bc2015-11-15 02:50:53 +01002.\" Copyright (c) 1998-2006,2010 Free Software Foundation, Inc. *
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05303.\" *
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 Kondikae271bc2015-11-15 02:50:53 +010029.\" $Id: curs_scanw.3x,v 1.17 2010/12/04 18:40:45 tom Exp $
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053030.TH curs_scanw 3X ""
31.SH NAME
32\fBscanw\fR,
33\fBwscanw\fR,
34\fBmvscanw\fR,
35\fBmvwscanw\fR,
Steve Kondikae271bc2015-11-15 02:50:53 +010036\fBvwscanw\fR, \fBvw_scanw\fR \- convert formatted input from a \fBcurses\fR window
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053037.SH SYNOPSIS
38\fB#include <curses.h>\fR
39.sp
40\fBint scanw(char *fmt, ...);\fR
41.br
42\fBint wscanw(WINDOW *win, char *fmt, ...);\fR
43.br
44\fBint mvscanw(int y, int x, char *fmt, ...);\fR
45.br
46\fBint mvwscanw(WINDOW *win, int y, int x, char *fmt, ...);\fR
47.br
48\fBint vw_scanw(WINDOW *win, char *fmt, va_list varglist);\fR
49.br
50\fBint vwscanw(WINDOW *win, char *fmt, va_list varglist);\fR
51.SH DESCRIPTION
52The \fBscanw\fR, \fBwscanw\fR and \fBmvscanw\fR routines are analogous to
53\fBscanf\fR [see \fBscanf\fR(3)]. The effect of these routines is as though
54\fBwgetstr\fR were called on the window, and the resulting line used as input
55for \fBsscanf\fR(3). Fields which do not map to a variable in the \fIfmt\fR
56field are lost.
57.PP
58The \fBvwscanw\fR and \fBvw_scanw\fR routines are analogous to \fBvscanf\fR.
59They perform a \fBwscanw\fR using a variable argument list.
60The third argument is a \fIva_list\fR,
61a pointer to a list of arguments, as defined in \fB<stdarg.h>\fR.
62.SH RETURN VALUE
63\fBvwscanw\fR returns \fBERR\fR on failure and an integer equal to the
64number of fields scanned on success.
65.PP
66Applications may use the return value from the \fBscanw\fR, \fBwscanw\fR,
67\fBmvscanw\fR and \fBmvwscanw\fR routines to determine the number of fields
68which were mapped in the call.
Steve Kondikae271bc2015-11-15 02:50:53 +010069.PP
70Functions with a "mv" prefix first perform a cursor movement using
71\fBwmove\fP, and return an error if the position is outside the window,
72or if the window pointer is null.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053073.SH PORTABILITY
74The XSI Curses standard, Issue 4 describes these functions. The function
75\fBvwscanw\fR is marked TO BE WITHDRAWN, and is to be replaced by a function
76\fBvw_scanw\fR using the \fB<stdarg.h>\fR interface.
77The Single Unix Specification, Version 2 states that
78\fBvw_scanw\fR is preferred to \fBvwscanw\fR since the latter requires
79including \fB<varargs.h>\fR, which
80cannot be used in the same file as \fB<stdarg.h>\fR.
81This implementation uses \fB<stdarg.h>\fR for both, because that header
82is included in \fB<curses.h\fR>.
83.LP
84Both XSI and The Single Unix Specification, Version 2 state that these
85functions return ERR or OK.
86Since the underlying \fBscanf\fR can return the number of items scanned,
87and the SVr4 code was documented to use this feature,
88this is probably an editing error which was introduced in XSI,
89rather than being done intentionally.
90Portable applications should only test if the return value is ERR,
91since the OK value (zero) is likely to be misleading.
92One possible way to get useful results would be to use a "%n" conversion
93at the end of the format string to ensure that something was processed.
94.SH SEE ALSO
95\fBcurses\fR(3X), \fBcurs_getstr\fR(3X), \fBcurs_printw\fR(3X), \fBscanf\fR(3)