vsscanf.c revision 92905
1251881Speter/*- 2251881Speter * Copyright (c) 1990, 1993 3251881Speter * The Regents of the University of California. All rights reserved. 4251881Speter * 5251881Speter * This code is derived from software contributed to Berkeley by 6251881Speter * Donn Seeley at UUNET Technologies, Inc. 7251881Speter * 8251881Speter * Redistribution and use in source and binary forms, with or without 9251881Speter * modification, are permitted provided that the following conditions 10251881Speter * are met: 11251881Speter * 1. Redistributions of source code must retain the above copyright 12251881Speter * notice, this list of conditions and the following disclaimer. 13251881Speter * 2. Redistributions in binary form must reproduce the above copyright 14251881Speter * notice, this list of conditions and the following disclaimer in the 15251881Speter * documentation and/or other materials provided with the distribution. 16251881Speter * 3. All advertising materials mentioning features or use of this software 17251881Speter * must display the following acknowledgement: 18251881Speter * This product includes software developed by the University of 19251881Speter * California, Berkeley and its contributors. 20251881Speter * 4. Neither the name of the University nor the names of its contributors 21251881Speter * may be used to endorse or promote products derived from this software 22251881Speter * without specific prior written permission. 23251881Speter * 24251881Speter * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 25251881Speter * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26251881Speter * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27251881Speter * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28251881Speter * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29251881Speter * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30251881Speter * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31251881Speter * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32251881Speter * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33251881Speter * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34251881Speter * SUCH DAMAGE. 35251881Speter */ 36251881Speter 37251881Speter#if defined(LIBC_SCCS) && !defined(lint) 38251881Speter#if 0 39251881Speterstatic char sccsid[] = "@(#)vsscanf.c 8.1 (Berkeley) 6/4/93"; 40251881Speter#endif 41251881Speterstatic const char rcsid[] = 42251881Speter "$FreeBSD: head/lib/libc/stdio/vsscanf.c 92905 2002-03-21 22:49:10Z obrien $"; 43251881Speter#endif /* LIBC_SCCS and not lint */ 44251881Speter 45251881Speter#include <stdio.h> 46251881Speter#include <string.h> 47251881Speter 48251881Speterstatic int 49251881Spetereofread(void *, char *, int); 50251881Speter 51251881Speter/* ARGSUSED */ 52251881Speterstatic int 53251881Spetereofread(cookie, buf, len) 54251881Speter void *cookie; 55251881Speter char *buf; 56251881Speter int len; 57251881Speter{ 58251881Speter 59251881Speter return (0); 60251881Speter} 61251881Speter 62251881Speterint 63251881Spetervsscanf(str, fmt, ap) 64251881Speter const char *str; 65251881Speter const char *fmt; 66251881Speter _BSD_VA_LIST_ ap; 67251881Speter{ 68251881Speter FILE f; 69251881Speter 70251881Speter f._file = -1; 71251881Speter f._flags = __SRD; 72251881Speter f._bf._base = f._p = (unsigned char *)str; 73251881Speter f._bf._size = f._r = strlen(str); 74251881Speter f._read = eofread; 75251881Speter f._ub._base = NULL; 76251881Speter f._lb._base = NULL; 77251881Speter return (__svfscanf(&f, fmt, ap)); 78251881Speter} 79251881Speter