unistd.c 517 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. * Copyright (c) 2006-2018, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2020-09-01 Meco Man First Version
  9. */
  10. #include <termios.h>
  11. #include <unistd.h>
  12. #ifdef RT_USING_POSIX
  13. #ifdef RT_USING_POSIX_TERMIOS
  14. int isatty(int fd)
  15. {
  16. struct termios ts;
  17. return(tcgetattr(fd,&ts) != -1);/*true if no error (is a tty)*/
  18. }
  19. #endif
  20. char *ttyname(int fd)
  21. {
  22. return "/dev/tty0"; /*TODO: need to add more specific*/
  23. }
  24. #endif