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