1 /* 2 * vsprintf - print formatted output without ellipsis on an array 3 */ 4 /* $Header$ */ 5 6 #include <stdio.h> 7 #include <stdarg.h> 8 #include <limits.h> 9 #include "loc_incl.h" 10 11 int 12 vsnprintf(char *s, size_t n, const char *format, va_list arg) 13 { 14 int retval; 15 FILE tmp_stream; 16 17 tmp_stream._fd = -1; 18 tmp_stream._flags = _IOWRITE + _IONBF + _IOWRITING; 19 tmp_stream._buf = (unsigned char *) s; 20 tmp_stream._ptr = (unsigned char *) s; 21 tmp_stream._count = n-1; 22 23 retval = _doprnt(format, arg, &tmp_stream); 24 tmp_stream._count = 1; 25 putc('\0',&tmp_stream); 26 27 return retval; 28 } 29 30 int 31 vsprintf(char *s, const char *format, va_list arg) 32 { 33 return vsnprintf(s, INT_MAX, format, arg); 34 } 35