diff options
| author | bernard <[email protected]> | 2014-03-11 15:54:21 +0800 |
|---|---|---|
| committer | bernard <[email protected]> | 2014-03-11 15:54:21 +0800 |
| commit | 33a5abbbf85683297a1efdc290786ffe455a3b5d (patch) | |
| tree | a37b01a6ce229b07e55db9baaf6d820c1b1d418d /components/finsh/shell.c | |
| parent | dbcb4a1ccff7c3840a722110d7a98816c0dd5cf2 (diff) | |
[Finsh] Use msh as prompt when current mode is msh mode.
Diffstat (limited to 'components/finsh/shell.c')
| -rw-r--r-- | components/finsh/shell.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/components/finsh/shell.c b/components/finsh/shell.c index 74b7ed7d95..0f1e1c625e 100644 --- a/components/finsh/shell.c +++ b/components/finsh/shell.c @@ -58,11 +58,16 @@ struct finsh_shell* shell; #include <dfs_posix.h> const char* finsh_get_prompt() { - #define _PROMPT "finsh " + #define _MSH_PROMPT "msh " + #define _PROMPT "finsh " static char finsh_prompt[RT_CONSOLEBUF_SIZE + 1] = {_PROMPT}; - + +#ifdef FINSH_USING_MSH + if (msh_is_used()) strcpy(finsh_prompt, _MSH_PROMPT); +#endif + /* get current working directory */ - getcwd(&finsh_prompt[6], RT_CONSOLEBUF_SIZE - 8); + getcwd(&finsh_prompt[rt_strlen(finsh_prompt)], RT_CONSOLEBUF_SIZE - 8); strcat(finsh_prompt, ">"); return finsh_prompt; |
