vfscanf in newlib
Wed Apr 18 21:02:00 GMT 2001
"J. Johnston" wrote:
> "Charles S. Wilson" wrote:
> > Is there a reason, other than 'nobody has gotten round tuit yet', that
> > vfscanf is not implemented in newlib?
> It's a glibc extension. Nobody thus far has asked for it in newlib.
> > newlib/libc/stdio/vfscanf.c contains a function "__svfscanf()" that is
> > used as the guts of scanf(), fscanf(), and sscanf(). It seems to me as
> > though vfscanf() would be a trivial wrapper around __svfscanf() -- or am
> > I missing something?
> No, you are correct; they are straightforward to add. I will do so when I get the chance.
How's this? (see attached patch to libc/include/stdio.h,
libc/stdio/Makefile.am, libc/stdio/Makefile.in, libc/stdio/vfscanf.c,
plus new files libc/stdio/vscanf.c and libc/stdio/vsscanf.c)
Note: these modifications compile -- but I have not (can not) test
them. I'm using a cygwin system, which incorporates newlib. So, to
test changes to newlib, I have to build a new cygwin kernel -- but
something seems to have broken *in cygwin* recently and I'm having
trouble building cygwin, but libc.a(newlib) builds okay. Thus, I can't
test these additions to newlib since my runtime (cygwin) already
includes (the old) newlib. Perhaps someone on a different platform can
test these additions to newlib?
I followed the pattern I saw in the scanf family, including the
_function_r reentrant versions -- however, I am not sure that the
functions _vfscanf_r, vscanf_r, and _vsscanf_r are truly reentrant --
again, perhaps someone more knowledgable give the code a look.
I'm providing the patches and new files in the hopes that they will save
somebody (Jeff?) some time, when it comes to adding these six functions
Wed Apr 18 23:45:00 2001 Charles Wilson <firstname.lastname@example.org>
* libc/include/stdio.h: add declarations for new functions
vfscanf, vscanf, vsscanf, _vfscanf_r, _vscanf_r, and _vsscanf_r
* libc/stdio/Makefile.am: add new files vscanf.c and vsscanf.c
to the build list; also, add vfscanf.def to the list of doc
files to be generated (yes, I added documentation on the
six new v?scanf() functions to vfscanf.c). Finally, add
entries for vscanf.o and vsscanf.o in the dependency list --
they depend on local.h
* libc/stdio/Makefile.in: replicate changes in Makefile.am,
also add vscanf.o and vsscanf.o to the OBJ list.
* libc/stdio/vfscanf.c: add documentation for vfscanf(),
vscanf(), and vsscanf(), as well as _vfscanf_r(), _vscanf_r(),
* libc/stdio/vfscanf.c (vfscanf): new function
* libc/stdio/vfscanf.c (_vfscanf_r): new function
* libc/stdio/vscanf.c: new file, contains implementations for
vscanf and _vscanf_r.
* libc/stdio/vsscanf.c: new file, contains implementations for
vsscanf and _vsscanf_r.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 3082 bytes
Desc: not available
More information about the Newlib