146111Sbostic /*- 246111Sbostic * Copyright (c) 1990 The Regents of the University of California. 346111Sbostic * All rights reserved. 446111Sbostic * 546111Sbostic * This code is derived from software contributed to Berkeley by 646111Sbostic * Chris Torek. 746111Sbostic * 846111Sbostic * %sccs.include.redist.c% 946111Sbostic */ 1046111Sbostic 1146111Sbostic #if defined(LIBC_SCCS) && !defined(lint) 12*56487Storek static char sccsid[] = "@(#)sscanf.c 5.2 (Berkeley) 10/09/92"; 1346111Sbostic #endif /* LIBC_SCCS and not lint */ 1446111Sbostic 1546111Sbostic #include <stdio.h> 1646111Sbostic #include <string.h> 1746111Sbostic #if __STDC__ 1846111Sbostic #include <stdarg.h> 1946111Sbostic #else 2046111Sbostic #include <varargs.h> 2146111Sbostic #endif 2246111Sbostic #include "local.h" 2346111Sbostic 2446111Sbostic /* ARGSUSED */ 2546111Sbostic static int 2646111Sbostic eofread(cookie, buf, len) 2746111Sbostic void *cookie; 2846111Sbostic char *buf; 2946111Sbostic int len; 3046111Sbostic { 3146111Sbostic 3246111Sbostic return (0); 3346111Sbostic } 3446111Sbostic 3546111Sbostic #if __STDC__ 36*56487Storek sscanf(const char *str, char const *fmt, ...) 3746111Sbostic #else 3846111Sbostic sscanf(str, fmt, va_alist) 3946111Sbostic char *str; 4046111Sbostic char *fmt; 4146111Sbostic va_dcl 4246111Sbostic #endif 4346111Sbostic { 4446111Sbostic int ret; 4546111Sbostic va_list ap; 4646111Sbostic FILE f; 4746111Sbostic 4846111Sbostic f._flags = __SRD; 4946111Sbostic f._bf._base = f._p = (unsigned char *)str; 5046111Sbostic f._bf._size = f._r = strlen(str); 5146111Sbostic f._read = eofread; 5246111Sbostic f._ub._base = NULL; 5346111Sbostic f._lb._base = NULL; 5446111Sbostic #if __STDC__ 5546111Sbostic va_start(ap, fmt); 5646111Sbostic #else 5746111Sbostic va_start(ap); 5846111Sbostic #endif 5946111Sbostic ret = __svfscanf(&f, fmt, ap); 6046111Sbostic va_end(ap); 6146111Sbostic return (ret); 6246111Sbostic } 63