Back to index

cell-binutils  2.17cvs20070401
vsprintf.c
Go to the documentation of this file.
00001 /* Simple implementation of vsprintf for systems without it.
00002    Highly system-dependent, but should work on most "traditional"
00003    implementations of stdio; newer ones should already have vsprintf.
00004    Written by Per Bothner of Cygnus Support.
00005    Based on libg++'s "form" (written by Doug Lea; dl@rocky.oswego.edu).
00006    Copyright (C) 1991, 1995, 2002 Free Software Foundation, Inc.
00007 
00008 This file is part of the libiberty library.  This library is free
00009 software; you can redistribute it and/or modify it under the
00010 terms of the GNU General Public License as published by the
00011 Free Software Foundation; either version 2, or (at your option)
00012 any later version.
00013 
00014 This library is distributed in the hope that it will be useful,
00015 but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 GNU General Public License for more details.
00018 
00019 You should have received a copy of the GNU General Public License
00020 along with GNU CC; see the file COPYING.  If not, write to
00021 the Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
00022 
00023 As a special exception, if you link this library with files
00024 compiled with a GNU compiler to produce an executable, this does not cause
00025 the resulting executable to be covered by the GNU General Public License.
00026 This exception does not however invalidate any other reasons why
00027 the executable file might be covered by the GNU General Public License. */
00028 
00029 #include <ansidecl.h>
00030 #include <stdarg.h>
00031 #include <stdio.h>
00032 #undef vsprintf
00033 
00034 #if defined _IOSTRG && defined _IOWRT
00035 
00036 int
00037 vsprintf (char *buf, const char *format, va_list ap)
00038 {
00039   FILE b;
00040   int ret;
00041 #ifdef VMS
00042   b->_flag = _IOWRT|_IOSTRG;
00043   b->_ptr = buf;
00044   b->_cnt = 12000;
00045 #else
00046   b._flag = _IOWRT|_IOSTRG;
00047   b._ptr = buf;
00048   b._cnt = 12000;
00049 #endif
00050   ret = _doprnt(format, ap, &b);
00051   putc('\0', &b);
00052   return ret;
00053 
00054 }
00055 
00056 #endif