home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / EMXLIB8F.ZIP / EMX / LIB / SYS / IOCTL1.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-02  |  533 b   |  29 lines

  1. /* sys/ioctl1.c (emx+gcc) -- Copyright (c) 1992-1993 by Eberhard Mattes */
  2.  
  3. #include <sys/emx.h>
  4. #include <errno.h>
  5. #include <os2emx.h>
  6. #include "syscalls.h"
  7.  
  8.  
  9. int __ioctl1 (int handle, int code)
  10. {
  11.   ULONG rc;
  12.   ULONG htype, hflags;
  13.  
  14.   if (code != 0)
  15.     {
  16.       errno = EINVAL;
  17.       return (-1);
  18.     }
  19.   rc = DosQueryHType (handle, &htype, &hflags);
  20.   if (rc != 0)
  21.     {
  22.       _sys_set_errno (rc);
  23.       return (-1);
  24.     }
  25.   if ((htype & 0xff) == 0)
  26.     return (0);
  27.   return ((hflags & 0x0f) | 0x80);
  28. }
  29.