summaryrefslogtreecommitdiff
path: root/components/libc/compilers/dlib/syscall_write.c
diff options
context:
space:
mode:
authorbernard <[email protected]>2017-10-15 22:41:59 +0800
committerbernard <[email protected]>2017-10-15 22:41:59 +0800
commit5c7b16d00bdb536a694e6e31a2e0a1c33cb9dcb9 (patch)
tree5da5e3404e1241b65e90089c4c370b40130df832 /components/libc/compilers/dlib/syscall_write.c
parentb27c7e482648535760e012cd6f1afef1d800e2d2 (diff)
[libc] Update libc.
1. Add POSIX termios implementation; 2. Add POSIX signals implementation; 3. Add stdio for each libc.
Diffstat (limited to 'components/libc/compilers/dlib/syscall_write.c')
-rw-r--r--components/libc/compilers/dlib/syscall_write.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/components/libc/compilers/dlib/syscall_write.c b/components/libc/compilers/dlib/syscall_write.c
index a7140b9818..e2cb04000b 100644
--- a/components/libc/compilers/dlib/syscall_write.c
+++ b/components/libc/compilers/dlib/syscall_write.c
@@ -27,6 +27,7 @@
#include <dfs_posix.h>
#endif
#include <yfuns.h>
+#include "libc.h"
#pragma module_name = "?__write"
@@ -41,6 +42,10 @@ size_t __write(int handle, const unsigned char *buf, size_t len)
#ifndef RT_USING_CONSOLE
return _LLIO_ERROR;
#else
+
+#ifdef RT_USING_POSIX_STDIN
+ return libc_stdio_write((void*)buf, len);
+#else
rt_device_t console_device;
console_device = rt_console_get_device();
@@ -48,14 +53,15 @@ size_t __write(int handle, const unsigned char *buf, size_t len)
return len;
#endif
+#endif
}
- if (handle == _LLIO_STDIN) return -1;
+ if (handle == _LLIO_STDIN) return _LLIO_ERROR;
#ifndef RT_USING_DFS
return _LLIO_ERROR;
#else
- size = write(handle - _LLIO_STDERR - 1, buf, len);
+ size = write(handle, buf, len);
return size;
#endif
}