/* fcloseal.c (emx+gcc) -- Copyright (c) 1990-1993 by Eberhard Mattes */

#include <sys/emx.h>
#include <stdio.h>

int fcloseall (void)
{
  int i, n;
  char ok;

  n = 0; ok = 1;
  for (i = 3; i < _nfiles; ++i)             /* keep stdin, stdout, stderr */
    if (_streamv[i].flags & _IOOPEN)
      if (fclose (&_streamv[i]) == 0)
        ++n;
      else
        ok = 0;
  return (ok ? n : EOF);
}
