[444] | 1 | /* |
---|
| 2 | * Code created by modifying iscanf.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 | #include <stdarg.h> |
---|
| 25 | #include "local.h" |
---|
| 26 | |
---|
| 27 | /* |
---|
| 28 | * vsiscanf |
---|
| 29 | */ |
---|
| 30 | |
---|
| 31 | #ifndef _REENT_ONLY |
---|
| 32 | |
---|
| 33 | int |
---|
| 34 | vsiscanf (const char *str, |
---|
| 35 | const char *fmt, |
---|
| 36 | va_list ap) |
---|
| 37 | { |
---|
| 38 | return _vsiscanf_r (_REENT, str, fmt, ap); |
---|
| 39 | } |
---|
| 40 | |
---|
| 41 | #endif /* !_REENT_ONLY */ |
---|
| 42 | |
---|
| 43 | int |
---|
| 44 | _vsiscanf_r (struct _reent *ptr, |
---|
| 45 | const char *str, |
---|
| 46 | const char *fmt, |
---|
| 47 | va_list ap) |
---|
| 48 | { |
---|
| 49 | FILE f; |
---|
| 50 | |
---|
| 51 | f._flags = __SRD | __SSTR; |
---|
| 52 | f._bf._base = f._p = (unsigned char *) str; |
---|
| 53 | f._bf._size = f._r = strlen (str); |
---|
| 54 | f._read = __seofread; |
---|
| 55 | f._ub._base = NULL; |
---|
| 56 | f._lb._base = NULL; |
---|
| 57 | f._file = -1; /* No file. */ |
---|
| 58 | return __ssvfiscanf_r (ptr, &f, fmt, ap); |
---|
| 59 | } |
---|