home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / useful / comm / tcp / amitcp / src / netlib / isatty.c < prev    next >
C/C++ Source or Header  |  1994-03-30  |  927b  |  43 lines

  1. RCS_ID_C="$Id: isatty.c,v 1.3 1994/03/30 07:39:20 jraja Exp $";
  2. /*
  3.  * isatty.c --- check is a file is a terminal (interactive) or not.
  4.  *
  5.  * Author: jraja <Jarno.Rajahalme@hut.fi>
  6.  *
  7.  * This file is part of the AmiTCP/IP Network Support Library.
  8.  *
  9.  * Copyright © 1994 AmiTCP/IP Group, <amitcp-group@hut.fi>
  10.  *                  Helsinki University of Technology, Finland.
  11.  *                  All rights reserved.
  12.  *
  13.  * Created      : Thu Mar 17 22:37:16 1994 jraja
  14.  * Last modified: Wed Mar 30 10:35:58 1994 jraja
  15.  *
  16.  */
  17.  
  18. #include <ios1.h>
  19. #include <fcntl.h>
  20. #include <stdlib.h>
  21. #include <dos.h>
  22. #include <dos/dos.h>
  23. #include <proto/dos.h>
  24.  
  25. int
  26. isatty(int fd)
  27. {
  28.   struct UFB *ufb;
  29.  
  30.   /*
  31.    * find the ufb *
  32.    */
  33.   if ((ufb = __chkufb(fd)) != NULL &&
  34.       !(ufb->ufbflg & UFB_SOCK)) { /* A socket is not a tty */
  35.     /*
  36.      * Convert DOSBOOL to BOOL
  37.      */
  38.     return (IsInteractive(ufb->ufbfh) & 0x1);
  39.   }
  40.   
  41.   return 0;
  42. }
  43.