summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
author[email protected] <[email protected]>2012-11-13 15:30:31 +0000
committer[email protected] <[email protected]>2012-11-13 15:30:31 +0000
commite57800785658cc8854791554ac59e8bd72c28628 (patch)
tree4f5be51864b6b8680b49c0765331cd0f7e121bcb /components
parentd48ef70ecd46acf9e104befed50b42699d3824cc (diff)
modified _write_r(), use CONSOLE to output stdout and stderr
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2411 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'components')
-rw-r--r--components/libc/newlib/syscalls.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/components/libc/newlib/syscalls.c b/components/libc/newlib/syscalls.c
index 4405c5ce71..796c3159b7 100644
--- a/components/libc/newlib/syscalls.c
+++ b/components/libc/newlib/syscalls.c
@@ -199,19 +199,27 @@ _write_r(struct _reent *ptr, int fd, const void *buf, size_t nbytes)
{
if (fd < 3)
{
+#ifdef RT_USING_CONSOLE
rt_device_t console_device;
extern rt_device_t rt_console_get_device(void);
console_device = rt_console_get_device();
if (console_device != 0) rt_device_write(console_device, 0, buf, nbytes);
return nbytes;
+#else
+ return 0;
+#endif
}
else
{
+#ifdef RT_USING_DFS
_ssize_t rc;
rc = write(fd, buf, nbytes);
return rc;
+#else
+ return 0;
+#endif
}
}
#endif