sprintf.c (97407) | sprintf.c (101776) |
---|---|
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> | 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 97407 2002-05-28 17:03:12Z alfred $"); | 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; | 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; |
|
54 55 f._file = -1; 56 f._flags = __SWR | __SSTR; 57 f._bf._base = f._p = (unsigned char *)str; 58 f._bf._size = f._w = INT_MAX; | 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); |
|
59 va_start(ap, fmt); 60 ret = __vfprintf(&f, fmt, ap); 61 va_end(ap); 62 *f._p = 0; 63 return (ret); 64} | 62 va_start(ap, fmt); 63 ret = __vfprintf(&f, fmt, ap); 64 va_end(ap); 65 *f._p = 0; 66 return (ret); 67} |