JTC1/SC22/WG14
N701
Document Number: WG14 N701/X3J11 97-064
C9X Revision Proposal
=====================
Title: ____vscanf___________________________________________
Author: _____________Larry Jones____________________________
Author Affiliation: _SDRC___________________________________
Postal Address: _____2000 Eastman Dr, Milford, OH 45150_____
E-mail Address: _____larry.jones@sdrc.com___________________
Telephone Number: ___513-576-2070___________________________
Fax Number: _________513-576-2843___________________________
Sponsor: ____________Larry Jones____________________________
Date: _______________22 May 1997____________________________
Proposal Category:
__ Editorial change/non-normative contribution
__ Correction
X_ New feature
__ Addition to obsolescent feature list
__ Addition to Future Directions
__ Other (please specify)
Area of Standard Affected:
__ Environment
__ Language
__ Preprocessor
X_ Library
__ Macro/typedef/tag name
X_ Function
__ Header
__ Other (please specify) ______________________________
Prior Art: HP-UX, GNU libc, 4.4BSD, others__________________
Target Audience: C Programmers______________________________
____________________________________________________________
____________________________________________________________
Related Documents (if any): ________________________________
____________________________________________________________
____________________________________________________________
Proposal Attached: X_ Yes __ No, but what's your interest?
Abstract:
Although the standard library provides va_list versions
of the printf family of functions, it does not provide
them for the scanf family. Although the scanf versions
are not needed nearly as often, they are exceedingly
difficult for the user to implement whereas the
implementor need only make very minor changes to the
existing scanf functions to provide them.
Proposal
In subclause 7.1.1 Definitions of terms, paragraph [#3]
The decimal-point character, revise the footnote [109] to
read:
109. The functions that make use of the
decimal-point character are localeconv, fprintf,
fscanf, printf, scanf, sprintf, sscanf,
vfprintf, vfscanf, vprintf, vscanf, vsprintf,
vsscanf, atof, strtod, fwprintf, fwscanf,
wprintf, wscanf, swprintf, swscanf, vfwprintf,
vfwscanf, vwprintf, vwscanf, vswprintf, and
vswscanf.
[[Editorial note: the wide-character versions were not
listed in draft 9, but presumably should be.]]
In subclause 7.12.1 Introduction (Input/output
<stdio.h>), paragraph [#6], revise the first bullet to
read:
The wide-character input functions - those
functions described in this subclause that
perform input into wide characters and wide
strings: fgetwc, fgetws, getwc, getwchar,
fwscanf, wscanf, vfwscanf, and vwscanf.
Revise the last bullet to read:
The byte input/output functions - those
functions described in this subclause that
perform input/output: fgetc, fgets, fprintf,
fputc, fputs, fread, fscanf, fwrite, getc,
getchar, gets, printf, putc, putchar, puts,
scanf, ungetc, vfprintf, vfscanf, vprintf, and
vscanf.
In subclause 7.12.6.7 The vfprintf function, paragraph
[#2], change the footnote [186] to:
186. As the functions vfprintf, vfscanf,
vprintf, vscanf, vsprintf, and vsscanf invoke the
va_arg macro, the value of arg after the return
is indeterminate.
In subclause 7.12.6 Formatted input/output functions, add
new subclauses:
7.12.6.X The vfscanf function
Synopsis
#include <stdarg.h>
#include <stdio.h>
int vfscanf(FILE * restrict stream,
const char * restrict format,
va_list arg);
Description
The vfscanf function is equivalent to fscanf,
with the variable argument list replaced by arg,
which shall have been initialized by the va_start
macro (and possibly subsequent va_arg calls).
The vfscanf does not invoke the va_end macro.186
Returns
The vfscanf function returns the value of the
macro EOF if an input failure occurs before any
conversion. Otherwise, the vfscanf function
returns the number of input items assigned,
which can be fewer than provided for, or even
zero, in the event of an early matching failure.
7.12.6.X The vscanf function
Synopsis
#include <stdarg.h>
#include <stdio.h>
int vscanf(const char * restrict format,
va_list arg);
Description
The vscanf function is equivalent to scanf, with
the variable argument list replaced by arg,
which shall have been initialized by the
va_start macro (and possibly subsequent va_arg
calls). The vfscanf does not invoke the va_end
macro.186
Returns
The vscanf function returns the value of the
macro EOF if an input failure occurs before any
conversion. Otherwise, the vscanf function
returns the number of input items assigned,
which can be fewer than provided for, or even
zero, in the event of an early matching failure.
7.12.6.X The vsscanf function
Synopsis
#include <stdarg.h>
#include <stdio.h>
int vsscanf(const char * restrict s,
const char * restrict format,
va_list arg);
Description
The vsscanf function is equivalent to sscanf,
with the variable argument list replaced by arg,
which shall have been initialized by the va_start
macro (and possibly subsequent va_arg calls).
The vsscanf does not invoke the va_end macro.186
Returns
The vsscanf function returns the value of the
macro EOF if an input failure occurs before any
conversion. Otherwise, the vsscanf function
returns the number of input items assigned,
which can be fewer than provided for, or even
zero, in the event of an early matching failure.
In subclause 7.18.2.7 The vfwprintf function, paragraph
[#2], change the footnote [222] to:
222. As the functions vfwprintf, vfwscanf,
vwprintf, vwscanf, vswprintf, and vswscanf
invoke the va_arg macro, the value of arg after
the return is indeterminate.
In subclause 7.18.2 Formatted wide-character
input/output functions, add new subclauses:
7.18.2.X The vfwscanf function
Synopsis
#include <stdarg.h>
#include <stdio.h>
#include <wchar.h>
int vfwscanf(FILE * restrict stream,
const wchar_t * restrict format,
va_list arg);
Description
The vfwscanf function is equivalent to fwscanf,
with the variable argument list replaced by arg,
which shall have been initialized by the
va_start macro (and possibly subsequent va_arg
calls). The vfwscanf does not invoke the va_end
macro.222
Returns
The vfwscanf function returns the value of the
macro EOF if an input failure occurs before any
conversion. Otherwise, the vfwscanf function
returns the number of input items assigned,
which can be fewer than provided for, or even
zero, in the event of an early matching failure.
7.18.2.X The vwscanf function
Synopsis
#include <stdarg.h>
#include <stdio.h>
#include <wchar.h>
int vwscanf(const wchar_t * restrict format,
va_list arg);
Description
The vwscanf function is equivalent to wscanf,
with the variable argument list replaced by arg,
which shall have been initialized by the
va_start macro (and possibly subsequent va_arg
calls). The vfwscanf does not invoke the va_end
macro.222
Returns
The vwscanf function returns the value of the
macro EOF if an input failure occurs before any
conversion. Otherwise, the vwscanf function
returns the number of input items assigned,
which can be fewer than provided for, or even
zero, in the event of an early matching failure.
7.18.2.X The vswscanf function
Synopsis
#include <stdarg.h>
#include <stdio.h>
#include <wchar.h>
int vswscanf(const wchar_t * restrict s,
const wchar_t * restrict format,
va_list arg);
Description
The vswscanf function is equivalent to swscanf,
with the variable argument list replaced by arg,
which shall have been initialized by the
va_start macro (and possibly subsequent va_arg
calls). The vswscanf does not invoke the va_end
macro.222
Returns
The vswscanf function returns the value of the
macro EOF if an input failure occurs before any
conversion. Otherwise, the vswscanf function
returns the number of input items assigned,
which can be fewer than provided for, or even
zero, in the event of an early matching failure.
In subclause 7.18.3.9 The ungetwc function, paragraph
[#3], first sentence, change ``(fwscanf or wscanf)'' to
``(fwscanf, wscanf, vfwscanf, or vwscanf)''.
Add the corresponding entries to Annex D Library summary.