vsscanf.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. Copyright 锟?1995-2001, The AROS Development Team. All rights reserved.
  3. $Id: vsscanf.c 19082 2003-08-05 13:18:17Z chodorowski $
  4. C function vsscanf().
  5. */
  6. /* Original source from libnix */
  7. #include "precompile.h"
  8. #include "vsscanf.h"
  9. #include <stdio.h>
  10. static int _vsscanf_get (char ** str)
  11. {
  12. if (!**str)
  13. return EOF;
  14. return *(*str)++;
  15. }
  16. static int _vsscanf_unget (int c, char ** str)
  17. {
  18. (*str)--;
  19. return c;
  20. }
  21. /*****************************************************************************
  22. NAME */
  23. #include <stdio.h>
  24. #include <stdarg.h>
  25. int __vcscan (
  26. /* SYNOPSIS */
  27. void * data,
  28. int (* f_getc)(void *),
  29. int (* f_ungetc)(int,void *),
  30. const char * format,
  31. va_list args);
  32. #if defined(_MSC_VER) && _MSC_VER < 1900
  33. TOOLKIT_API int vsscanf (
  34. /* SYNOPSIS */
  35. const char *str,
  36. const char *format,
  37. va_list args)
  38. /* FUNCTION
  39. Scan a string and convert it into the arguments as specified
  40. by format.
  41. INPUTS
  42. str - Scan this string
  43. format - A scanf() format string.
  44. args - A list of arguments for the results
  45. RESULT
  46. The number of arguments converted.
  47. NOTES
  48. EXAMPLE
  49. BUGS
  50. SEE ALSO
  51. scanf(), sscanf(), fscanf(), vscanf(), vfscanf(), snscanf(),
  52. vsnscanf()
  53. INTERNALS
  54. ******************************************************************************/
  55. {
  56. int rc;
  57. rc = __vcscan (&str,
  58. (void *)_vsscanf_get,
  59. (void *)_vsscanf_unget,
  60. format,
  61. args
  62. );
  63. return rc;
  64. } /* vsscanf */
  65. #endif //defined(_MSC_VER) && _MSC_VER < 1900