1*46110Sbostic /*- 2*46110Sbostic * Copyright (c) 1990 The Regents of the University of California. 334471Sbostic * All rights reserved. 434471Sbostic * 5*46110Sbostic * This code is derived from software contributed to Berkeley by 6*46110Sbostic * Chris Torek. 7*46110Sbostic * 842633Sbostic * %sccs.include.redist.c% 934471Sbostic */ 1034471Sbostic 1134471Sbostic #if defined(LIBC_SCCS) && !defined(lint) 12*46110Sbostic static char sccsid[] = "@(#)vsprintf.c 5.4 (Berkeley) 01/20/91"; 1334471Sbostic #endif /* LIBC_SCCS and not lint */ 1434471Sbostic 1534471Sbostic #include <stdio.h> 16*46110Sbostic #include <limits.h> 1734471Sbostic 1834471Sbostic vsprintf(str, fmt, ap) 19*46110Sbostic char *str; 20*46110Sbostic char *fmt; 21*46110Sbostic _VA_LIST_ ap; 2234471Sbostic { 23*46110Sbostic int ret; 2434471Sbostic FILE f; 2534471Sbostic 26*46110Sbostic f._flags = __SWR | __SSTR; 27*46110Sbostic f._bf._base = f._p = (unsigned char *)str; 28*46110Sbostic f._bf._size = f._w = INT_MAX; 29*46110Sbostic ret = vfprintf(&f, fmt, ap); 30*46110Sbostic *f._p = 0; 31*46110Sbostic return (ret); 3234471Sbostic } 33