Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libc / stdio / vswscanf.c
blob415c98b0f0ff0c54d8a7acd032f0b371051c9ded
1 /*
2 * Code created by modifying scanf.c which has following copyright.
4 * Copyright (c) 1990 The Regents of the University of California.
5 * All rights reserved.
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 * and/or 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.
19 /* Doc in vfwscanf.c */
21 #include <_ansi.h>
22 #include <reent.h>
23 #include <stdio.h>
24 #include <wchar.h>
25 #include <string.h>
26 #include <stdarg.h>
27 #include "local.h"
30 * vsscanf
33 #ifndef _REENT_ONLY
35 int
36 vswscanf (const wchar_t *__restrict str, const wchar_t * __restrict fmt,
37 va_list ap)
39 return _vswscanf_r (_REENT, str, fmt, ap);
42 #endif /* !_REENT_ONLY */
44 int
45 _vswscanf_r (struct _reent *ptr, const wchar_t *str, const wchar_t *fmt,
46 va_list ap)
48 FILE f;
50 f._flags = __SRD | __SSTR;
51 f._bf._base = f._p = (unsigned char *) str;
52 f._bf._size = f._r = wcslen (str) * sizeof (wchar_t);
53 f._read = __seofread;
54 f._ub._base = NULL;
55 f._lb._base = NULL;
56 f._flags2 = 0;
57 f._ur = 0;
58 f._file = -1; /* No file. */
59 return __ssvfwscanf_r (ptr, &f, fmt, ap);