home *** CD-ROM | disk | FTP | other *** search
- RCS_ID_C="$Id: isatty.c,v 1.3 1994/03/30 07:39:20 jraja Exp $";
- /*
- * isatty.c --- check is a file is a terminal (interactive) or not.
- *
- * Author: jraja <Jarno.Rajahalme@hut.fi>
- *
- * This file is part of the AmiTCP/IP Network Support Library.
- *
- * Copyright © 1994 AmiTCP/IP Group, <amitcp-group@hut.fi>
- * Helsinki University of Technology, Finland.
- * All rights reserved.
- *
- * Created : Thu Mar 17 22:37:16 1994 jraja
- * Last modified: Wed Mar 30 10:35:58 1994 jraja
- *
- */
-
- #include <ios1.h>
- #include <fcntl.h>
- #include <stdlib.h>
- #include <dos.h>
- #include <dos/dos.h>
- #include <proto/dos.h>
-
- int
- isatty(int fd)
- {
- struct UFB *ufb;
-
- /*
- * find the ufb *
- */
- if ((ufb = __chkufb(fd)) != NULL &&
- !(ufb->ufbflg & UFB_SOCK)) { /* A socket is not a tty */
- /*
- * Convert DOSBOOL to BOOL
- */
- return (IsInteractive(ufb->ufbfh) & 0x1);
- }
-
- return 0;
- }
-