isatty.c 351 B

1234567891011121314151617
  1. /*
  2. * _isatty - check if a file descriptor is associated with a terminal
  3. */
  4. /* $Id$ */
  5. int _gtty(int d, char *buf);
  6. int _isatty(int d)
  7. {
  8. char buf[128];
  9. /* not a sgttyb struct; it might not be large enough;
  10. I know for a fact that it isn't large enough on PC/IX,
  11. where gtty is an ioctl(..., TCGETA, ...)
  12. */
  13. return _gtty(d, buf) >= 0;
  14. }