/* Copyright (C) 2018 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 2017 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ #include #include #include int vfprintf(FILE *f, const char *fmt, va_list ap) { int len; char localbuf[BUFSIZ]; if (f->_flag & _IONBF) { f->_flag &= ~_IONBF; f->_ptr = f->_base = localbuf; f->_bufsiz = BUFSIZ; len = _doprnt(fmt, ap, f); (void)fflush(f); f->_flag |= _IONBF; f->_base = NULL; f->_bufsiz = 0; f->_cnt = 0; } else len = _doprnt(fmt, ap, f); return (ferror(f) ? EOF : len); }