ack/lang/m2/libm2/TTY.mod

20 lines
450 B
Modula-2
Raw Normal View History

1987-05-13 14:36:45 +00:00
#
1987-08-19 18:07:01 +00:00
(*$R-*)
1987-05-13 14:36:45 +00:00
IMPLEMENTATION MODULE TTY;
FROM Unix IMPORT ioctl;
FROM SYSTEM IMPORT ADR;
PROCEDURE isatty(fd: INTEGER): BOOLEAN;
VAR buf: ARRAY[1..100] OF CHAR;
BEGIN
#ifdef __USG
RETURN ioctl(fd, INTEGER(ORD('T') * 256 + 1), ADR(buf)) >= 0;
#else
#ifdef __BSD4_2
RETURN ioctl(fd, INTEGER(ORD('t') * 256 + 8 + 6*65536 + 40000000H), ADR(buf)) >= 0;
#else
RETURN ioctl(fd, INTEGER(ORD('t') * 256 + 8), ADR(buf)) >= 0;
#endif
#endif
END isatty;
END TTY.