source: trunk/minix/lib/stdio/vsprintf.c@ 15

Last change on this file since 15 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 762 bytes
Line 
1/*
2 * vsprintf - print formatted output without ellipsis on an array
3 */
4/* $Header: /cvsup/minix/src/lib/stdio/vsprintf.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
11int
12vsnprintf(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
30int
31vsprintf(char *s, const char *format, va_list arg)
32{
33 return vsnprintf(s, INT_MAX, format, arg);
34}
Note: See TracBrowser for help on using the repository browser.