home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / mint / mntlib24 / fcntl.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-08-03  |  550 b   |  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.