vsscanf.c revision 1574
11541Srgrimes/*- 21541Srgrimes * Copyright (c) 1990, 1993 31541Srgrimes * The Regents of the University of California. All rights reserved. 41541Srgrimes * 51541Srgrimes * This code is derived from software contributed to Berkeley by 61541Srgrimes * Donn Seeley at UUNET Technologies, Inc. 71541Srgrimes * 81541Srgrimes * Redistribution and use in source and binary forms, with or without 91541Srgrimes * modification, are permitted provided that the following conditions 101541Srgrimes * are met: 111541Srgrimes * 1. Redistributions of source code must retain the above copyright 121541Srgrimes * notice, this list of conditions and the following disclaimer. 131541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 141541Srgrimes * notice, this list of conditions and the following disclaimer in the 151541Srgrimes * documentation and/or other materials provided with the distribution. 161541Srgrimes * 3. All advertising materials mentioning features or use of this software 171541Srgrimes * must display the following acknowledgement: 181541Srgrimes * This product includes software developed by the University of 191541Srgrimes * California, Berkeley and its contributors. 201541Srgrimes * 4. Neither the name of the University nor the names of its contributors 211541Srgrimes * may be used to endorse or promote products derived from this software 221541Srgrimes * without specific prior written permission. 231541Srgrimes * 241541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 251541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 261541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 271541Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 281541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2922521Sdyson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 3050477Speter * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 311541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 321541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3315493Sbde * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3415493Sbde * SUCH DAMAGE. 3515493Sbde */ 3622521Sdyson 3777508Sjhb#if defined(LIBC_SCCS) && !defined(lint) 381541Srgrimesstatic char sccsid[] = "@(#)vsscanf.c 8.1 (Berkeley) 6/4/93"; 391541Srgrimes#endif /* LIBC_SCCS and not lint */ 401541Srgrimes 4133054Sbde#include <stdio.h> 421541Srgrimes#include <string.h> 4383366Sjulian 4428270Swollman/* ARGSUSED */ 451541Srgrimesstatic int 4633054Sbdeeofread(cookie, buf, len) 471541Srgrimes void *cookie; 4834826Sbde char *buf; 4933054Sbde int len; 501541Srgrimes{ 5192728Salfred 5298542Smckusick return (0); 5398542Smckusick} 5492728Salfred 5598542Smckusickvsscanf(str, fmt, ap) 5698542Smckusick const char *str; 5792728Salfred const char *fmt; 5898542Smckusick _BSD_VA_LIST_ ap; 5998542Smckusick{ 6098542Smckusick int ret; 61111239Smckusick FILE f; 6298542Smckusick 6398542Smckusick f._flags = __SRD; 64136963Sphk f._bf._base = f._p = (unsigned char *)str; 65101777Sphk f._bf._size = f._r = strlen(str); 6692728Salfred f._read = eofread; 6792728Salfred f._ub._base = NULL; 68111239Smckusick f._lb._base = NULL; 6998542Smckusick return (__svfscanf(&f, fmt, ap)); 70108315Sphk} 7192728Salfred