summaryrefslogtreecommitdiff
path: root/components/libc/compilers/common/stdlib.c
diff options
context:
space:
mode:
author192.168.1.134 <[email protected]>2021-10-09 16:25:13 +0800
committer192.168.1.134 <[email protected]>2021-10-09 16:25:13 +0800
commit1cc7c67850fe8beda95c95ae7f077b30b5088b56 (patch)
tree6c3b12639c7411983833965d638e5e5cc8ad3190 /components/libc/compilers/common/stdlib.c
parentb404f69f851817c62697074ffb363294b91585c6 (diff)
parent50433a51bd328f424172ac8471f4b3044343dcfb (diff)
Merge branch 'master' of https://github.com/RT-Thread/rt-thread
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