Deleted Added
sdiff udiff text old ( 97407 ) new ( 101776 )
full compact
1/*-
2 * Copyright (c) 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Chris Torek.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 24 unchanged lines hidden (view full) ---

33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 */
36
37#if defined(LIBC_SCCS) && !defined(lint)
38static char sccsid[] = "@(#)sprintf.c 8.1 (Berkeley) 6/4/93";
39#endif /* LIBC_SCCS and not lint */
40#include <sys/cdefs.h>
41__FBSDID("$FreeBSD: head/lib/libc/stdio/sprintf.c 101776 2002-08-13 09:30:41Z tjr $");
42
43#include <stdio.h>
44#include <stdarg.h>
45#include <limits.h>
46#include "local.h"
47
48int
49sprintf(char *str, char const *fmt, ...)
50{
51 int ret;
52 va_list ap;
53 FILE f;
54 struct __sFILEX ext;
55
56 f._file = -1;
57 f._flags = __SWR | __SSTR;
58 f._bf._base = f._p = (unsigned char *)str;
59 f._bf._size = f._w = INT_MAX;
60 f._extra = &ext;
61 INITEXTRA(&f);
62 va_start(ap, fmt);
63 ret = __vfprintf(&f, fmt, ap);
64 va_end(ap);
65 *f._p = 0;
66 return (ret);
67}