Deleted Added
full compact
snprintf.c (50476) snprintf.c (72373)
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

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

34 * SUCH DAMAGE.
35 */
36
37#if defined(LIBC_SCCS) && !defined(lint)
38#if 0
39static char sccsid[] = "@(#)snprintf.c 8.1 (Berkeley) 6/4/93";
40#endif
41static const char rcsid[] =
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

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

34 * SUCH DAMAGE.
35 */
36
37#if defined(LIBC_SCCS) && !defined(lint)
38#if 0
39static char sccsid[] = "@(#)snprintf.c 8.1 (Berkeley) 6/4/93";
40#endif
41static const char rcsid[] =
42 "$FreeBSD: head/lib/libc/stdio/snprintf.c 50476 1999-08-28 00:22:10Z peter $";
42 "$FreeBSD: head/lib/libc/stdio/snprintf.c 72373 2001-02-11 22:06:43Z deischen $";
43#endif /* LIBC_SCCS and not lint */
44
45#include <limits.h>
46#include <stdio.h>
47#if __STDC__
48#include <stdarg.h>
49#else
50#include <varargs.h>
51#endif
52
43#endif /* LIBC_SCCS and not lint */
44
45#include <limits.h>
46#include <stdio.h>
47#if __STDC__
48#include <stdarg.h>
49#else
50#include <varargs.h>
51#endif
52
53#include "local.h"
54
53#if __STDC__
54int
55snprintf(char *str, size_t n, char const *fmt, ...)
56#else
57int
58snprintf(str, n, fmt, va_alist)
59 char *str;
60 size_t n;

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

76 va_start(ap, fmt);
77#else
78 va_start(ap);
79#endif
80 f._file = -1;
81 f._flags = __SWR | __SSTR;
82 f._bf._base = f._p = (unsigned char *)str;
83 f._bf._size = f._w = n;
55#if __STDC__
56int
57snprintf(char *str, size_t n, char const *fmt, ...)
58#else
59int
60snprintf(str, n, fmt, va_alist)
61 char *str;
62 size_t n;

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

78 va_start(ap, fmt);
79#else
80 va_start(ap);
81#endif
82 f._file = -1;
83 f._flags = __SWR | __SSTR;
84 f._bf._base = f._p = (unsigned char *)str;
85 f._bf._size = f._w = n;
84 ret = vfprintf(&f, fmt, ap);
86 ret = __vfprintf(&f, fmt, ap);
85 if (on > 0)
86 *f._p = '\0';
87 va_end(ap);
88 return (ret);
89}
87 if (on > 0)
88 *f._p = '\0';
89 va_end(ap);
90 return (ret);
91}