Subversion Repositories Kolibri OS

Rev

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