_isatty.c 723 B

1234567891011121314151617181920212223242526
  1. /*
  2. Copyright (c) 1990-2000 Info-ZIP. All rights reserved.
  3. See the accompanying file LICENSE, version 2000-Apr-09 or later
  4. (the contents of which are also included in zip.h) for terms of use.
  5. If, for some reason, all these files are missing, the Info-ZIP license
  6. also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
  7. */
  8. /* replace standard library function who needs a FILE* */
  9. #pragma library
  10. #include <stdio.h>
  11. #include <fcntl.h>
  12. #include <sc.h>
  13. #include <lub.h>
  14. short _isatty(int fd)
  15. {
  16. register short lub;
  17. lub = (int) _fcntl(&stdin[fd], 5, (size_t) 0);
  18. return (lub >= CONIN && lub <= CONOUT)
  19. || (lub >= COM1 && lub <= COM4)
  20. || (lub >= COM5 && lub <= COM16);
  21. }