Deleted Added
full compact
printf.c (329145) printf.c (334935)
1/*-
2 * Copyright (c) 1986, 1988, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

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

30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)subr_prf.c 8.3 (Berkeley) 1/21/94
35 */
36
37#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1986, 1988, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

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

30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)subr_prf.c 8.3 (Berkeley) 1/21/94
35 */
36
37#include <sys/cdefs.h>
38__FBSDID("$FreeBSD: stable/11/stand/libsa/printf.c 329132 2018-02-11 19:51:29Z kevans $");
38__FBSDID("$FreeBSD: stable/11/stand/libsa/printf.c 334935 2018-06-10 22:26:15Z ian $");
39
40/*
41 * Standaloneified version of the FreeBSD kernel printf family.
42 */
43
44#include <sys/types.h>
45#include <sys/stddef.h>
46#include <sys/stdint.h>

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

75 int retval;
76
77 va_start(ap, fmt);
78 retval = kvprintf(fmt, putchar_wrapper, NULL, 10, ap);
79 va_end(ap);
80 return retval;
81}
82
39
40/*
41 * Standaloneified version of the FreeBSD kernel printf family.
42 */
43
44#include <sys/types.h>
45#include <sys/stddef.h>
46#include <sys/stdint.h>

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

75 int retval;
76
77 va_start(ap, fmt);
78 retval = kvprintf(fmt, putchar_wrapper, NULL, 10, ap);
79 va_end(ap);
80 return retval;
81}
82
83void
83int
84vprintf(const char *fmt, va_list ap)
85{
86
84vprintf(const char *fmt, va_list ap)
85{
86
87 kvprintf(fmt, putchar_wrapper, NULL, 10, ap);
87 return (kvprintf(fmt, putchar_wrapper, NULL, 10, ap));
88}
89
90int
91sprintf(char *buf, const char *cfmt, ...)
92{
93 int retval;
94 va_list ap;
95

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

135 retval = kvprintf(cfmt, &snprint_func, &arg, 10, ap);
136 va_end(ap);
137
138 if (arg.size >= 1)
139 *(arg.buf)++ = 0;
140 return retval;
141}
142
88}
89
90int
91sprintf(char *buf, const char *cfmt, ...)
92{
93 int retval;
94 va_list ap;
95

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

135 retval = kvprintf(cfmt, &snprint_func, &arg, 10, ap);
136 va_end(ap);
137
138 if (arg.size >= 1)
139 *(arg.buf)++ = 0;
140 return retval;
141}
142
143void
143int
144vsnprintf(char *buf, size_t size, const char *cfmt, va_list ap)
145{
146 struct print_buf arg;
147 int retval;
148
149 arg.buf = buf;
150 arg.size = size;
151
152 retval = kvprintf(cfmt, &snprint_func, &arg, 10, ap);
153
154 if (arg.size >= 1)
155 *(arg.buf)++ = 0;
156
157 return (retval);
158}
159
160int
144vsprintf(char *buf, const char *cfmt, va_list ap)
145{
146 int retval;
147
148 retval = kvprintf(cfmt, NULL, (void *)buf, 10, ap);
149 buf[retval] = '\0';
161vsprintf(char *buf, const char *cfmt, va_list ap)
162{
163 int retval;
164
165 retval = kvprintf(cfmt, NULL, (void *)buf, 10, ap);
166 buf[retval] = '\0';
167
168 return (retval);
150}
151
152/*
153 * Put a NUL-terminated ASCII number (base <= 36) in a buffer in reverse
154 * order; return an optional length and a pointer to the last character
155 * written in the buffer (i.e., the first character of the string).
156 * The buffer pointed to by `nbuf' must have length >= MAXNBUF.
157 */

--- 361 unchanged lines hidden ---
169}
170
171/*
172 * Put a NUL-terminated ASCII number (base <= 36) in a buffer in reverse
173 * order; return an optional length and a pointer to the last character
174 * written in the buffer (i.e., the first character of the string).
175 * The buffer pointed to by `nbuf' must have length >= MAXNBUF.
176 */

--- 361 unchanged lines hidden ---