This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

vfscanf in newlib


Is there a reason, other than 'nobody has gotten round tuit yet', that
vfscanf is not implemented 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?

Please copy me on any replies as I am not subscribed to the list.

--Chuck

possible implementation (vfscanf, vscanf, vsscanf)...

#ifdef _HAVE_STDC
_DEFUN (vfscanf, (fp, fmt, ap), register FILE *fp _AND _CONST char *fmt
_AND va_list ap)
#else
int
vfscanf (fp, fmt, ap)
    register FILE *fp;
    _CONST char *fmt;
    va_list ap;
#endif
{
  return __svfscanf (fp, fmt, ap);
}

#ifdef _HAVE_STDC
_DEFUN (vscanf, (fmt, ap), _CONST char *str _AND va_list ap)
#else
int
vscanf (fmt, ap)
    _CONST char *fmt;
    va_list ap;
#endif
{
  return __svfscanf (stdin, fmt0, ap);
}

/* brazenly adapted from newlib's sscanf.c */
#ifdef _HAVE_STDC
_DEFUN (vsscanf, (str, fmt, ap), _CONST char *str _AND _CONST char *fmt
_AND va_list ap)
#else
int
vsscanf (str, fmt, ap)
    _CONST char *str;
    _CONST char *fmt;
    va_list ap;
#endif
{
  FILE f;

  f._flags = __SRD;
  f._bf._base = f._p = (unsigned char *) str;
  f._bf._size = f._r = strlen (str);
  f._read = eofread;
  f._ub._base = NULL;
  f._lb._base = NULL;
  f._data = _REENT;
  return __svfscanf (&f, fmt, ap);    
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]