home *** CD-ROM | disk | FTP | other *** search
/ Atari FTP / ATARI_FTP_0693.zip / ATARI_FTP_0693 / Mint / mntlib32.zoo / close.c < prev    next >
C/C++ Source or Header  |  1993-02-28  |  408b  |  29 lines

  1. /*
  2.  * close(): close a file. written by Eric R. Smith and placed in the public
  3.  * domain
  4.  */
  5.  
  6. #include <osbind.h>
  7. #include <fcntl.h>
  8. #include <errno.h>
  9. #include "lib.h"
  10.  
  11. int
  12. close(fd)
  13.     int fd;
  14. {
  15.     int r;
  16.  
  17.     r = Fclose(fd);
  18.     if (r < 0) {
  19.         errno = -r;
  20.         return -1;
  21.     }
  22.     fd = __OPEN_INDEX(fd);
  23.     if (fd >= 0 && fd < __NHANDLES) {
  24.         __open_stat[fd].status = FH_UNKNOWN;
  25.         __open_stat[fd].flags = 0;
  26.     }
  27.     return 0;
  28. }
  29.