diff options
| author | mysterywolf <[email protected]> | 2020-09-05 17:50:54 +0800 |
|---|---|---|
| committer | mysterywolf <[email protected]> | 2020-09-05 17:50:54 +0800 |
| commit | 6eb62a3f9de3e45abe91fec03ff45f1a011f48bd (patch) | |
| tree | 320cfcce4d9465624414d32a4b2c3ff09e99ba20 /components/libc/compilers | |
| parent | 8a08be6b9e2ea6bd1dce01a9844a954c3e21a26c (diff) | |
将unistd.c不再放在common中,分散到各个库中
Diffstat (limited to 'components/libc/compilers')
| -rw-r--r-- | components/libc/compilers/armlibc/unistd.c (renamed from components/libc/compilers/common/unistd.c) | 4 | ||||
| -rw-r--r-- | components/libc/compilers/dlib/unistd.c | 29 | ||||
| -rw-r--r-- | components/libc/compilers/newlib/unistd.c | 29 |
3 files changed, 62 insertions, 0 deletions
diff --git a/components/libc/compilers/common/unistd.c b/components/libc/compilers/armlibc/unistd.c index 04a0886655..e2f2827beb 100644 --- a/components/libc/compilers/common/unistd.c +++ b/components/libc/compilers/armlibc/unistd.c @@ -11,6 +11,8 @@ #include <termios.h> #include <unistd.h> +#ifdef RT_USING_POSIX + #ifdef RT_USING_POSIX_TERMIOS int isatty(int fd) { @@ -23,3 +25,5 @@ char *ttyname(int fd) { return "/dev/tty0"; /*TODO: need to add more specific*/ } + +#endif diff --git a/components/libc/compilers/dlib/unistd.c b/components/libc/compilers/dlib/unistd.c new file mode 100644 index 0000000000..e2f2827beb --- /dev/null +++ b/components/libc/compilers/dlib/unistd.c @@ -0,0 +1,29 @@ +/* + * 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 + +#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*/ +} + +#endif diff --git a/components/libc/compilers/newlib/unistd.c b/components/libc/compilers/newlib/unistd.c new file mode 100644 index 0000000000..e2f2827beb --- /dev/null +++ b/components/libc/compilers/newlib/unistd.c @@ -0,0 +1,29 @@ +/* + * 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 + +#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*/ +} + +#endif |
