home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / compiler / clib / vsscanf.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-03  |  1.3 KB  |  82 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: vsscanf.c,v 1.2 1997/02/02 19:47:05 ldp Exp $
  4.  
  5.     Desc: C function vsscanf()
  6.     Lang: english
  7. */
  8. /* Original source from libnix */
  9. #define AROS_ALMOST_COMPATIBLE
  10. #include <stdio.h>
  11.  
  12. static int _vsscanf_get (char ** str)
  13. {
  14.     if (!**str)
  15.     return EOF;
  16.  
  17.     return *(*str)++;
  18. }
  19.  
  20. static int _vsscanf_unget (int c, char ** str)
  21. {
  22.     (*str)--;
  23.  
  24.     return c;
  25. }
  26.  
  27. /*****************************************************************************
  28.  
  29.     NAME */
  30.     #include <stdio.h>
  31. #include <stdarg.h>
  32.  
  33.     int vsscanf (
  34.  
  35. /*  SYNOPSIS */
  36.     char       * str,
  37.     const char * format,
  38.     va_list      args)
  39.  
  40. /*  FUNCTION
  41.     Scan a string and convert it into the arguments as specified
  42.     by format.
  43.  
  44.     INPUTS
  45.     str - Scan this string
  46.     format - A scanf() format string.
  47.     args - A list of arguments for the results
  48.  
  49.     RESULT
  50.     The number of arguments converted.
  51.  
  52.     NOTES
  53.  
  54.     EXAMPLE
  55.  
  56.     BUGS
  57.  
  58.     SEE ALSO
  59.     scanf(), sscanf(), fscanf(), vscanf(), vfscanf(), snscanf(),
  60.     vsnscanf()
  61.  
  62.     INTERNALS
  63.  
  64.     HISTORY
  65.     28.01.1997 digulla created
  66.  
  67. ******************************************************************************/
  68. {
  69.     int rc;
  70.  
  71.     rc = __vcscan (&str,
  72.         (void *)_vsscanf_get,
  73.         (void *)_vsscanf_unget,
  74.         format,
  75.         args
  76.     );
  77.  
  78.     *str = 0;
  79.  
  80.     return rc;
  81. } /* vsscanf */
  82.