Commit | Line | Data |
---|---|---|
c9be6cfe KB |
1 | /*- |
2 | * Copyright (c) 1990 The Regents of the University of California. | |
82e2d7ab KB |
3 | * All rights reserved. |
4 | * | |
c9be6cfe KB |
5 | * This code is derived from software contributed to Berkeley by |
6 | * Chris Torek. | |
7 | * | |
019bea33 | 8 | * %sccs.include.redist.c% |
82e2d7ab KB |
9 | */ |
10 | ||
11 | #if defined(LIBC_SCCS) && !defined(lint) | |
d25ccb19 | 12 | static char sccsid[] = "@(#)vsprintf.c 5.5 (Berkeley) %G%"; |
82e2d7ab KB |
13 | #endif /* LIBC_SCCS and not lint */ |
14 | ||
15 | #include <stdio.h> | |
c9be6cfe | 16 | #include <limits.h> |
82e2d7ab | 17 | |
82e2d7ab | 18 | vsprintf(str, fmt, ap) |
c9be6cfe | 19 | char *str; |
d25ccb19 | 20 | const char *fmt; |
c9be6cfe | 21 | _VA_LIST_ ap; |
82e2d7ab | 22 | { |
c9be6cfe | 23 | int ret; |
82e2d7ab | 24 | FILE f; |
82e2d7ab | 25 | |
c9be6cfe KB |
26 | f._flags = __SWR | __SSTR; |
27 | f._bf._base = f._p = (unsigned char *)str; | |
28 | f._bf._size = f._w = INT_MAX; | |
29 | ret = vfprintf(&f, fmt, ap); | |
30 | *f._p = 0; | |
31 | return (ret); | |
82e2d7ab | 32 | } |