home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJLSR201.ZIP / src / libc / posix / termios / tcdrain.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-15  |  770 b   |  40 lines

  1. #include <errno.h>
  2. #include <io.h>
  3. #include <termios.h>
  4. #include <libc/bss.h>
  5. #include <libc/ttyprvt.h>
  6.  
  7. #define _DEV_STDIN  0x0001
  8. #define _DEV_STDOUT 0x0002
  9. #define _DEV_NUL    0x0004
  10. #define _DEV_CLOCK  0x0008
  11. #define _DEV_RAW    0x0020
  12. #define _DEV_CDEV   0x0080
  13. #define _DEV_IOCTRL 0x4000
  14.  
  15. int
  16. tcdrain (int handle)
  17. {
  18.   short devmod;
  19.  
  20.   /* initialize */
  21.   if (__libc_termios_hook_common_count != __bss_count)
  22.     __libc_termios_init ();
  23.  
  24.   /* check handle whether valid or not */
  25.   devmod = _get_dev_info (handle);
  26.   if (devmod == -1)
  27.     return -1;
  28.  
  29.   /* check console */
  30.   if (! (devmod & _DEV_CDEV) || ! (devmod & (_DEV_STDIN|_DEV_STDOUT)))
  31.     {
  32.       errno = ENOTTY;
  33.       return -1;
  34.     }
  35.  
  36.   /* nothing */
  37.  
  38.   return 0;
  39. }
  40.