home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 1.ddi / CLIBSRC.ZIP / ISATTY.CAS < prev    next >
Encoding:
Text File  |  1992-06-10  |  1.3 KB  |  50 lines

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