Subversion Repositories Kolibri OS

Rev

Rev 4921 | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. /*
  2.  * Code created by modifying scanf.c which has following copyright.
  3.  *
  4.  * Copyright (c) 1990 The Regents of the University of California.
  5.  * All rights reserved.
  6.  *
  7.  * Redistribution and use in source and binary forms are permitted
  8.  * provided that the above copyright notice and this paragraph are
  9.  * duplicated in all such forms and that any documentation,
  10.  * advertising materials, and other materials related to such
  11.  * distribution and use acknowledge that the software was developed
  12.  * by the University of California, Berkeley.  The name of the
  13.  * University may not be used to endorse or promote products derived
  14.  * from this software without specific prior written permission.
  15.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  16.  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  17.  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  18.  */
  19.  
  20. #include <_ansi.h>
  21. #include <reent.h>
  22. #include <stdio.h>
  23. #include <string.h>
  24. #ifdef _HAVE_STDC
  25. #include <stdarg.h>
  26. #else
  27. #include <varargs.h>
  28. #endif
  29. #include "local.h"
  30.  
  31. /*
  32.  * vsscanf
  33.  */
  34.  
  35. #ifndef _REENT_ONLY
  36.  
  37. int
  38. _DEFUN(vsscanf, (str, fmt, ap),
  39.        _CONST char *__restrict str _AND
  40.        _CONST char *__restrict fmt _AND
  41.        va_list ap)
  42. {
  43.   return _vsscanf_r (_REENT, str, fmt, ap);
  44. }
  45.  
  46. #ifdef _NANO_FORMATTED_IO
  47. int
  48. _EXFUN(vsiscanf, (const char *, const char *, __VALIST)
  49.        _ATTRIBUTE ((__alias__("vsscanf"))));
  50. #endif
  51.  
  52. #endif /* !_REENT_ONLY */
  53.  
  54. int
  55. _DEFUN(_vsscanf_r, (ptr, str, fmt, ap),
  56.        struct _reent *ptr _AND
  57.        _CONST char *__restrict str   _AND
  58.        _CONST char *__restrict fmt   _AND
  59.        va_list ap)
  60. {
  61.   FILE f;
  62.  
  63.   f._flags = __SRD | __SSTR;
  64.   f._bf._base = f._p = (unsigned char *) str;
  65.   f._bf._size = f._r = strlen (str);
  66.   f._read = __seofread;
  67.   f._ub._base = NULL;
  68.   f._lb._base = NULL;
  69.   f._file = -1;  /* No file. */
  70.   return __ssvfscanf_r (ptr, &f, fmt, ap);
  71. }
  72.  
  73. #ifdef _NANO_FORMATTED_IO
  74. int
  75. _EXFUN(_vsiscanf_r, (struct _reent *, const char *, const char *, __VALIST)
  76.        _ATTRIBUTE ((__alias__("_vsscanf_r"))));
  77. #endif
  78.