2 * Copyright (c) 1990 The Regents of the University of California.
5 * Redistribution and use in source and binary forms are permitted
6 * provided that the above copyright notice and this paragraph are
7 * duplicated in all such forms and that any documentation,
8 * and/or other materials related to such
9 * distribution and use acknowledge that the software was developed
10 * by the University of California, Berkeley. The name of the
11 * University may not be used to endorse or promote products derived
12 * from this software without specific prior written permission.
13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 <<siscanf>>, <<fiscanf>>, <<iscanf>>---scan and format non-floating input
38 int iscanf(const char *<[format]>, ...);
39 int fiscanf(FILE *<[fd]>, const char *<[format]>, ...);
40 int siscanf(const char *<[str]>, const char *<[format]>, ...);
42 int _iscanf_r(struct _reent *<[ptr]>, const char *<[format]>, ...);
43 int _fiscanf_r(struct _reent *<[ptr]>, FILE *<[fd]>,
44 const char *<[format]>, ...);
45 int _siscanf_r(struct _reent *<[ptr]>, const char *<[str]>,
46 const char *<[format]>, ...);
49 <<iscanf>>, <<fiscanf>>, and <<siscanf>> are the same as
50 <<scanf>>, <<fscanf>>, and <<sscanf>> respectively, only that
51 they restrict the available formats to non-floating-point
54 The routines <<_iscanf_r>>, <<_fiscanf_r>>, and <<_siscanf_r>> are reentrant
55 versions of <<iscanf>>, <<fiscanf>>, and <<siscanf>> that take an additional
56 first argument pointing to a reentrancy structure.
59 <<iscanf>> returns the number of input fields successfully
60 scanned, converted and stored; the return value does
61 not include scanned fields which were not stored.
63 If <<iscanf>> attempts to read at end-of-file, the return
66 If no fields were stored, the return value is <<0>>.
69 <<iscanf>>, <<fiscanf>>, and <<siscanf>> are newlib extensions.
71 Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
72 <<lseek>>, <<read>>, <<sbrk>>, <<write>>.
85 siscanf (const char *str
,
92 f
._flags
= __SRD
| __SSTR
;
94 f
._bf
._base
= f
._p
= (unsigned char *) str
;
95 f
._bf
._size
= f
._r
= strlen (str
);
99 f
._file
= -1; /* No file. */
101 ret
= __ssvfiscanf_r (_REENT
, &f
, fmt
, ap
);
106 #endif /* !_REENT_ONLY */
109 _siscanf_r (struct _reent
*ptr
,
111 const char *fmt
, ...)
117 f
._flags
= __SRD
| __SSTR
;
119 f
._bf
._base
= f
._p
= (unsigned char *) str
;
120 f
._bf
._size
= f
._r
= strlen (str
);
121 f
._read
= __seofread
;
124 f
._file
= -1; /* No file. */
126 ret
= __ssvfiscanf_r (ptr
, &f
, fmt
, ap
);