mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-10-19 20:43:43 +08:00
[libc] 优化system 支持gcc
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user