summaryrefslogtreecommitdiff
path: root/components/libc/compilers/common/stdlib.c
diff options
context:
space:
mode:
authorliukangcc <[email protected]>2021-10-14 10:31:44 +0800
committerliukangcc <[email protected]>2021-10-14 10:32:22 +0800
commit3ac36a31071f66a06217b4676fc7266ba66c906a (patch)
treebe32fc9b7abb102aa905fdba0165bf6adf4c065d /components/libc/compilers/common/stdlib.c
parent0369db718cd3b1ff58ceb2fc44a48641a0fecc66 (diff)
parent33263d7e4ec22b118d0407ec7488ccfa60a8a0a1 (diff)
[update] Fix compiler flags issue
Diffstat (limited to 'components/libc/compilers/common/stdlib.c')
-rw-r--r--components/libc/compilers/common/stdlib.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/components/libc/compilers/common/stdlib.c b/components/libc/compilers/common/stdlib.c
index 9d8952e99e..6cc0b9fdac 100644
--- a/components/libc/compilers/common/stdlib.c
+++ b/components/libc/compilers/common/stdlib.c
@@ -10,19 +10,36 @@
#include <rtthread.h>
+#define DBG_TAG "stdlib"
+#define DBG_LVL DBG_INFO
+#include <rtdbg.h>
+
void __rt_libc_exit(int status)
{
rt_thread_t self = rt_thread_self();
if (self != RT_NULL)
{
- rt_kprintf("thread:%s exit:%d!\n", self->name, status);
+ LOG_E("thread:%s exit:%d!", self->name, status);
rt_thread_control(self, RT_THREAD_CTRL_CLOSE, RT_NULL);
}
}
-int __rt_libc_system(const char *string)
+#ifdef RT_USING_MSH
+int system(const char *command)
{
- /* TODO */
- return 0;
+ extern int msh_exec(char *cmd, rt_size_t length);
+
+ int ret = -RT_ENOMEM;
+ char *cmd = rt_strdup(command);
+
+ if (cmd)
+ {
+ ret = msh_exec(cmd, rt_strlen(cmd));
+ rt_free(cmd);
+ }
+
+ return ret;
}
+RTM_EXPORT(system);
+#endif