Rev | Line | |
---|
[9] | 1 | /*
|
---|
| 2 | * sprintf - print formatted output on an array
|
---|
| 3 | */
|
---|
| 4 | /* $Header: /cvsup/minix/src/lib/stdio/sprintf.c,v 1.1.1.1 2005/04/21 14:56:36 beng Exp $ */
|
---|
| 5 |
|
---|
| 6 | #include <stdio.h>
|
---|
| 7 | #include <stdarg.h>
|
---|
| 8 | #include <limits.h>
|
---|
| 9 | #include "loc_incl.h"
|
---|
| 10 |
|
---|
| 11 | int
|
---|
| 12 | sprintf(char *s, const char *format, ...)
|
---|
| 13 | {
|
---|
| 14 | va_list ap;
|
---|
| 15 | int retval;
|
---|
| 16 |
|
---|
| 17 | va_start(ap, format);
|
---|
| 18 |
|
---|
| 19 | retval = vsnprintf(s, INT_MAX, format, ap);
|
---|
| 20 |
|
---|
| 21 | va_end(ap);
|
---|
| 22 |
|
---|
| 23 | return retval;
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | int
|
---|
| 27 | snprintf(char *s, size_t n, const char *format, ...)
|
---|
| 28 | {
|
---|
| 29 | va_list ap;
|
---|
| 30 | int retval;
|
---|
| 31 |
|
---|
| 32 | va_start(ap, format);
|
---|
| 33 |
|
---|
| 34 | retval = vsnprintf(s, n, format, ap);
|
---|
| 35 |
|
---|
| 36 | va_end(ap);
|
---|
| 37 |
|
---|
| 38 | return retval;
|
---|
| 39 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.