diff options
| author | armink <[email protected]> | 2019-01-05 16:33:36 +0800 |
|---|---|---|
| committer | armink <[email protected]> | 2019-01-05 16:33:36 +0800 |
| commit | c0f15a59bb70b0b53070cfdef5d55bd6a3a98ca7 (patch) | |
| tree | 4fae60bf0aacd80366cca906473d9014f1994c8a /components/libc/compilers | |
| parent | 1805aadbbbb60854164508f25728c91d71785f27 (diff) | |
[component] Sync to master (366e28f47682f76b3f6df85c3dcbd9785a01fa39).
Diffstat (limited to 'components/libc/compilers')
| -rw-r--r-- | components/libc/compilers/armlibc/stubs.c | 5 | ||||
| -rw-r--r-- | components/libc/compilers/newlib/syscalls.c | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/components/libc/compilers/armlibc/stubs.c b/components/libc/compilers/armlibc/stubs.c index 6e9f13d143..820daeff39 100644 --- a/components/libc/compilers/armlibc/stubs.c +++ b/components/libc/compilers/armlibc/stubs.c @@ -270,7 +270,10 @@ long _sys_flen(FILEHANDLE fh) int _sys_istty(FILEHANDLE fh) { - return 0; + if((STDIN <= fh) && (fh <= STDERR)) + return 1; + else + return 0; } int remove(const char *filename) diff --git a/components/libc/compilers/newlib/syscalls.c b/components/libc/compilers/newlib/syscalls.c index e4cda478cb..759feafe67 100644 --- a/components/libc/compilers/newlib/syscalls.c +++ b/components/libc/compilers/newlib/syscalls.c @@ -9,6 +9,8 @@ #include <reent.h> #include <sys/errno.h> #include <sys/time.h> +#include <stdio.h> + #include <rtthread.h> #ifdef RT_USING_DFS @@ -218,7 +220,7 @@ _ssize_t _write_r(struct _reent *ptr, int fd, const void *buf, size_t nbytes) { #ifndef RT_USING_DFS - if (fd == 0) + if (fileno(stdout) == fd) { rt_device_t console; |
