home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJLSR201.ZIP / src / libc / ansi / stdio / vfprintf.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-26  |  570 b   |  28 lines

  1. /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
  2. #include <stdio.h>
  3. #include <stdarg.h>
  4. #include <libc/file.h>
  5.  
  6. int
  7. vfprintf(FILE *f, const char *fmt, va_list ap)
  8. {
  9.   int len;
  10.   char localbuf[BUFSIZ];
  11.  
  12.   if (f->_flag & _IONBF)
  13.   {
  14.     f->_flag &= ~_IONBF;
  15.     f->_ptr = f->_base = localbuf;
  16.     f->_bufsiz = BUFSIZ;
  17.     len = _doprnt(fmt, ap, f);
  18.     (void)fflush(f);
  19.     f->_flag |= _IONBF;
  20.     f->_base = NULL;
  21.     f->_bufsiz = 0;
  22.     f->_cnt = 0;
  23.   }
  24.   else
  25.     len = _doprnt(fmt, ap, f);
  26.   return (ferror(f) ? EOF : len);
  27. }
  28.