提交 e5780078 编写于 作者: X xiongyihui3@gmail.com

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
上级 d48ef70e
...@@ -199,19 +199,27 @@ _write_r(struct _reent *ptr, int fd, const void *buf, size_t nbytes) ...@@ -199,19 +199,27 @@ _write_r(struct _reent *ptr, int fd, const void *buf, size_t nbytes)
{ {
if (fd < 3) if (fd < 3)
{ {
#ifdef RT_USING_CONSOLE
rt_device_t console_device; rt_device_t console_device;
extern rt_device_t rt_console_get_device(void); extern rt_device_t rt_console_get_device(void);
console_device = rt_console_get_device(); console_device = rt_console_get_device();
if (console_device != 0) rt_device_write(console_device, 0, buf, nbytes); if (console_device != 0) rt_device_write(console_device, 0, buf, nbytes);
return nbytes; return nbytes;
#else
return 0;
#endif
} }
else else
{ {
#ifdef RT_USING_DFS
_ssize_t rc; _ssize_t rc;
rc = write(fd, buf, nbytes); rc = write(fd, buf, nbytes);
return rc; return rc;
#else
return 0;
#endif
} }
} }
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册