]> git.ipfire.org Git - thirdparty/gcc.git/blame - libiberty/vsprintf.c
Fix calling convention incompatibility with vendor compiler
[thirdparty/gcc.git] / libiberty / vsprintf.c
CommitLineData
6599da04
JM
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).
a945c346 6 Copyright (C) 1991-2024 Free Software Foundation, Inc.
6599da04
JM
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
ee58dffd 21the Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
6599da04
JM
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
c9ac9147 29#include <ansidecl.h>
c9ac9147 30#include <stdarg.h>
6599da04 31#include <stdio.h>
6599da04
JM
32#undef vsprintf
33
9ce3f7e5
DD
34#if defined _IOSTRG && defined _IOWRT
35
6599da04 36int
7a17ef5e 37vsprintf (char *buf, const char *format, va_list ap)
6599da04
JM
38{
39 FILE b;
40 int ret;
41#ifdef VMS
42 b->_flag = _IOWRT|_IOSTRG;
43 b->_ptr = buf;
44 b->_cnt = 12000;
45#else
46 b._flag = _IOWRT|_IOSTRG;
47 b._ptr = buf;
48 b._cnt = 12000;
49#endif
50 ret = _doprnt(format, ap, &b);
51 putc('\0', &b);
52 return ret;
53
54}
9ce3f7e5
DD
55
56#endif