Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

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