home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.2 (Developer) / NS_dev_3.2.iso / NextDeveloper / Source / GNU / libg++ / libiberty / vsprintf.c < prev   
C/C++ Source or Header  |  1993-06-29  |  2KB  |  50 lines

  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).
  6.    Copyright (C) 1991 Free Software Foundation, Inc.
  7.  
  8. This file is part of the libiberty library.
  9. Libiberty is free software; you can redistribute it and/or
  10. modify it under the terms of the GNU Library General Public
  11. License as published by the Free Software Foundation; either
  12. version 2 of the License, or (at your option) any later version.
  13.  
  14. Libiberty is distributed in the hope that it will be useful,
  15. but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  17. Library General Public License for more details.
  18.  
  19. You should have received a copy of the GNU Library General Public
  20. License along with libiberty; see the file COPYING.LIB.  If
  21. not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  22. Cambridge, MA 02139, USA.  */
  23.  
  24. #include <varargs.h>
  25. #include <stdio.h>
  26. #undef vsprintf
  27.  
  28. int
  29. vsprintf (buf, format, ap)
  30.      char *buf;
  31.      char *format;
  32.      va_list ap;
  33. {
  34.   FILE b;
  35.   int ret;
  36. #ifdef VMS
  37.   b->_flag = _IOWRT|_IOSTRG;
  38.   b->_ptr = buf;
  39.   b->_cnt = 12000;
  40. #else
  41.   b._flag = _IOWRT|_IOSTRG;
  42.   b._ptr = buf;
  43.   b._cnt = 12000;
  44. #endif
  45.   ret = _doprnt(format, ap, &b);
  46.   putc('\0', &b);
  47.   return ret;
  48.  
  49. }
  50.