diff options
| author | mysterywolf <[email protected]> | 2020-09-02 10:22:47 +0800 |
|---|---|---|
| committer | mysterywolf <[email protected]> | 2020-09-02 10:22:47 +0800 |
| commit | 837604553b4483a324357dbbb7060491f3b2f39c (patch) | |
| tree | db8c176752b5fe40c83cf193602dbe8eed740c0a /components/libc | |
| parent | 9b470d448d9fa4beacea532d9e5ab18088a9b38e (diff) | |
增加unistd.c文件
Diffstat (limited to 'components/libc')
| -rw-r--r-- | components/libc/compilers/armlibc/unistd.h | 1 | ||||
| -rw-r--r-- | components/libc/compilers/common/unistd.c | 25 |
2 files changed, 26 insertions, 0 deletions
diff --git a/components/libc/compilers/armlibc/unistd.h b/components/libc/compilers/armlibc/unistd.h index 70187722d8..736fc219a8 100644 --- a/components/libc/compilers/armlibc/unistd.h +++ b/components/libc/compilers/armlibc/unistd.h @@ -7,3 +7,4 @@ * Date Author Notes */ #include "sys/unistd.h" + diff --git a/components/libc/compilers/common/unistd.c b/components/libc/compilers/common/unistd.c new file mode 100644 index 0000000000..04a0886655 --- /dev/null +++ b/components/libc/compilers/common/unistd.c @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2006-2018, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2020-09-01 Meco Man First Version + */ + +#include <termios.h> +#include <unistd.h> + +#ifdef RT_USING_POSIX_TERMIOS +int isatty(int fd) +{ + struct termios ts; + return(tcgetattr(fd,&ts) != -1);/*true if no error (is a tty)*/ +} +#endif + +char *ttyname(int fd) +{ + return "/dev/tty0"; /*TODO: need to add more specific*/ +} |
