Merge pull request #1508 from enkiller/dev
[components][finsh]msh最大参数个数可配置
This commit is contained in:
commit
512c69fdc9
|
@ -70,6 +70,10 @@ config FINSH_USING_MSH_DEFAULT
|
||||||
config FINSH_USING_MSH_ONLY
|
config FINSH_USING_MSH_ONLY
|
||||||
bool "Only using module shell"
|
bool "Only using module shell"
|
||||||
default n
|
default n
|
||||||
|
|
||||||
|
config FINSH_ARG_MAX
|
||||||
|
int "The command arg num for shell"
|
||||||
|
default 10
|
||||||
endif
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -37,7 +37,10 @@
|
||||||
#include <dfs_posix.h>
|
#include <dfs_posix.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define RT_FINSH_ARG_MAX 10
|
#ifndef FINSH_ARG_MAX
|
||||||
|
#define FINSH_ARG_MAX 10
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef int (*cmd_function_t)(int argc, char **argv);
|
typedef int (*cmd_function_t)(int argc, char **argv);
|
||||||
|
|
||||||
#ifdef FINSH_USING_MSH
|
#ifdef FINSH_USING_MSH
|
||||||
|
@ -99,7 +102,7 @@ int msh_help(int argc, char **argv)
|
||||||
}
|
}
|
||||||
FINSH_FUNCTION_EXPORT_ALIAS(msh_help, __cmd_help, RT-Thread shell help.);
|
FINSH_FUNCTION_EXPORT_ALIAS(msh_help, __cmd_help, RT-Thread shell help.);
|
||||||
|
|
||||||
static int msh_split(char *cmd, rt_size_t length, char *argv[RT_FINSH_ARG_MAX])
|
static int msh_split(char *cmd, rt_size_t length, char *argv[FINSH_ARG_MAX])
|
||||||
{
|
{
|
||||||
char *ptr;
|
char *ptr;
|
||||||
rt_size_t position;
|
rt_size_t position;
|
||||||
|
@ -118,7 +121,7 @@ static int msh_split(char *cmd, rt_size_t length, char *argv[RT_FINSH_ARG_MAX])
|
||||||
ptr ++; position ++;
|
ptr ++; position ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(argc >= RT_FINSH_ARG_MAX)
|
if(argc >= FINSH_ARG_MAX)
|
||||||
{
|
{
|
||||||
rt_kprintf("Too many args ! We only Use:\n");
|
rt_kprintf("Too many args ! We only Use:\n");
|
||||||
for(i = 0; i < argc; i++)
|
for(i = 0; i < argc; i++)
|
||||||
|
@ -284,7 +287,7 @@ static int _msh_exec_cmd(char *cmd, rt_size_t length, int *retp)
|
||||||
int argc;
|
int argc;
|
||||||
rt_size_t cmd0_size = 0;
|
rt_size_t cmd0_size = 0;
|
||||||
cmd_function_t cmd_func;
|
cmd_function_t cmd_func;
|
||||||
char *argv[RT_FINSH_ARG_MAX];
|
char *argv[FINSH_ARG_MAX];
|
||||||
|
|
||||||
RT_ASSERT(cmd);
|
RT_ASSERT(cmd);
|
||||||
RT_ASSERT(retp);
|
RT_ASSERT(retp);
|
||||||
|
|
Loading…
Reference in New Issue