home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c065 / 2.ddi / CLIB2.ZIP / ISATTY.CAS < prev    next >
Encoding:
Text File  |  1990-06-07  |  1.6 KB  |  51 lines

  1. /*-----------------------------------------------------------------------*
  2.  * filename - isatty.cas
  3.  *
  4.  * function(s)
  5.  *        isatty - checks for device type
  6.  *-----------------------------------------------------------------------*/
  7.  
  8. /*[]------------------------------------------------------------[]*/
  9. /*|                                                              |*/
  10. /*|     Turbo C Run Time Library - Version 3.0                   |*/
  11. /*|                                                              |*/
  12. /*|                                                              |*/
  13. /*|     Copyright (c) 1987,1988,1990 by Borland International    |*/
  14. /*|     All Rights Reserved.                                     |*/
  15. /*|                                                              |*/
  16. /*[]------------------------------------------------------------[]*/
  17.  
  18. #pragma inline
  19. #include <io.h>
  20.  
  21. /*-----------------------------------------------------------------------*
  22.  
  23. Name        isatty - checks for device type
  24.  
  25. Usage        int isatty(int handle);
  26.  
  27. Prototype in    io.h
  28.  
  29. Description    isatty    is  a  function   that    determines  whether  handle
  30.         represents any one of the following character devices:
  31.             - a terminal
  32.             - a console
  33.             - a printer
  34.             - a serial port
  35.  
  36. Return value    If  the  device  is  character    device,  isatty  returns  a
  37.         non-zero  integer.  If    it  is    not  such  a device, isatty
  38.         returns 0.
  39.  
  40. *------------------------------------------------------------------------*/
  41. int isatty( int handle )
  42.   {
  43.   asm    mov    ax,4400h
  44.   asm    mov    bx,handle
  45.   asm    int    21h
  46.   asm   xchg    ax,dx
  47.   asm    and    ax,0080h
  48.  
  49.   return( _AX );
  50.   }
  51.