146110Sbostic /*- 2*61180Sbostic * Copyright (c) 1990, 1993 3*61180Sbostic * The Regents of the University of California. All rights reserved. 434471Sbostic * 546110Sbostic * This code is derived from software contributed to Berkeley by 646110Sbostic * Chris Torek. 746110Sbostic * 842633Sbostic * %sccs.include.redist.c% 934471Sbostic */ 1034471Sbostic 1134471Sbostic #if defined(LIBC_SCCS) && !defined(lint) 12*61180Sbostic static char sccsid[] = "@(#)vsprintf.c 8.1 (Berkeley) 06/04/93"; 1334471Sbostic #endif /* LIBC_SCCS and not lint */ 1434471Sbostic 1534471Sbostic #include <stdio.h> 1646110Sbostic #include <limits.h> 1734471Sbostic vsprintf(str,fmt,ap)1834471Sbosticvsprintf(str, fmt, ap) 1946110Sbostic char *str; 2046272Storek const char *fmt; 2154268Sbostic _BSD_VA_LIST_ ap; 2234471Sbostic { 2346110Sbostic int ret; 2434471Sbostic FILE f; 2534471Sbostic 2646110Sbostic f._flags = __SWR | __SSTR; 2746110Sbostic f._bf._base = f._p = (unsigned char *)str; 2846110Sbostic f._bf._size = f._w = INT_MAX; 2946110Sbostic ret = vfprintf(&f, fmt, ap); 3046110Sbostic *f._p = 0; 3146110Sbostic return (ret); 3234471Sbostic } 33