summaryrefslogtreecommitdiff
path: root/components/libc/compilers/common/stdlib.c
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2021-09-28 13:48:39 +0800
committerGitHub <[email protected]>2021-09-28 13:48:39 +0800
commitd43a68e95e026ecc73eab7999677e46bbd4984ef (patch)
tree484d6bbc52f7352eb4b8ccad94e4fbc9b4d54b72 /components/libc/compilers/common/stdlib.c
parentae49c3f560dd4d15f4fa93f0811b6f5ced083da0 (diff)
parentc80688126a013c53334464799e28fcf2e4f4fb8c (diff)
Merge pull request #5105 from mysterywolf/part
[libc]新建gcc文件夹,将newlib和partical文件夹并入
Diffstat (limited to 'components/libc/compilers/common/stdlib.c')
-rw-r--r--components/libc/compilers/common/stdlib.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/components/libc/compilers/common/stdlib.c b/components/libc/compilers/common/stdlib.c
index 16a13afb83..6cc0b9fdac 100644
--- a/components/libc/compilers/common/stdlib.c
+++ b/components/libc/compilers/common/stdlib.c
@@ -25,11 +25,21 @@ void __rt_libc_exit(int status)
}
}
-int __rt_libc_system(const char *string)
-{
#ifdef RT_USING_MSH
+int system(const char *command)
+{
extern int msh_exec(char *cmd, rt_size_t length);
- msh_exec((char*)string, rt_strlen(string));
-#endif
- return 0;
+
+ 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