unistd.c 486 B

12345678910111213141516171819202122232425
  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_TERMIOS
  13. int isatty(int fd)
  14. {
  15. struct termios ts;
  16. return(tcgetattr(fd,&ts) != -1);/*true if no error (is a tty)*/
  17. }
  18. #endif
  19. char *ttyname(int fd)
  20. {
  21. return "/dev/tty0"; /*TODO: need to add more specific*/
  22. }