home *** CD-ROM | disk | FTP | other *** search
/ Atari FTP / ATARI_FTP_0693.zip / ATARI_FTP_0693 / Mint / mntlib32.zoo / fcntl.c < prev    next >
C/C++ Source or Header  |  1992-09-05  |  514b  |  37 lines

  1. /*
  2.  * fcntl() emulation for MiNT; written by Eric R. Smith and placed
  3.  * in the public domain
  4.  */
  5.  
  6. #include <errno.h>
  7. #include <mintbind.h>
  8. #include <fcntl.h>
  9. #include <stdarg.h>
  10.  
  11. extern int __mint;    /* MiNT version */
  12.  
  13. #ifdef __STDC__
  14. int fcntl (int f, int cmd, ...)
  15. #else
  16. int fcntl (f, cmd)
  17. int f;
  18. int cmd;
  19. #endif
  20. {
  21.     long r;
  22.     va_list argp;
  23.  
  24.     va_start(argp, cmd);
  25.  
  26.     if (__mint) {
  27.         r = Fcntl(f, va_arg(argp, void *), cmd);
  28.     }
  29.     else
  30.         r = -EINVAL;
  31.     if (r < 0) {
  32.         errno = (int) -r;
  33.         r = -1L;
  34.     }
  35.     return (int) r;
  36. }
  37.