]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - libiberty/vsprintf.c
*** empty log message ***
[thirdparty/binutils-gdb.git] / libiberty / vsprintf.c
CommitLineData
252b5132
RH
1/* Simple implementation of vsprintf for systems without it.
2 Highly system-dependent, but should work on most "traditional"
3 implementations of stdio; newer ones should already have vsprintf.
4 Written by Per Bothner of Cygnus Support.
5 Based on libg++'s "form" (written by Doug Lea; dl@rocky.oswego.edu).
cc096b71 6 Copyright (C) 1991, 1995, 2002 Free Software Foundation, Inc.
252b5132
RH
7
8This file is part of the libiberty library. This library is free
9software; you can redistribute it and/or modify it under the
10terms of the GNU General Public License as published by the
11Free Software Foundation; either version 2, or (at your option)
12any later version.
13
14This library is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17GNU General Public License for more details.
18
19You should have received a copy of the GNU General Public License
20along with GNU CC; see the file COPYING. If not, write to
21the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
23As a special exception, if you link this library with files
24compiled with a GNU compiler to produce an executable, this does not cause
25the resulting executable to be covered by the GNU General Public License.
26This exception does not however invalidate any other reasons why
27the executable file might be covered by the GNU General Public License. */
28
1ea16ec5
DD
29#include <ansidecl.h>
30#ifdef ANSI_PROTOTYPES
31#include <stdarg.h>
32#else
252b5132 33#include <varargs.h>
1ea16ec5 34#endif
252b5132 35#include <stdio.h>
252b5132
RH
36#undef vsprintf
37
cc096b71
DD
38#if defined _IOSTRG && defined _IOWRT
39
252b5132
RH
40int
41vsprintf (buf, format, ap)
42 char *buf;
43 const char *format;
44 va_list ap;
45{
46 FILE b;
47 int ret;
48#ifdef VMS
49 b->_flag = _IOWRT|_IOSTRG;
50 b->_ptr = buf;
51 b->_cnt = 12000;
52#else
53 b._flag = _IOWRT|_IOSTRG;
54 b._ptr = buf;
55 b._cnt = 12000;
56#endif
57 ret = _doprnt(format, ap, &b);
58 putc('\0', &b);
59 return ret;
60
61}
cc096b71
DD
62
63#endif