diff options
| author | bernard <[email protected]> | 2014-03-12 16:25:59 +0800 |
|---|---|---|
| committer | bernard <[email protected]> | 2014-03-12 16:25:59 +0800 |
| commit | 04b5a461799f9be12c72b67a2da87163478fb5d6 (patch) | |
| tree | cfe3c761eee5c22275d30ee5f635f7613080085b /components | |
| parent | 444b928d2247a7dc980cce7852bf74aeb5bb6bc3 (diff) | |
[Finsh] fix the shell prompt issue.
Diffstat (limited to 'components')
| -rw-r--r-- | components/finsh/shell.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/components/finsh/shell.c b/components/finsh/shell.c index 0f1e1c625e..4313fcf6b2 100644 --- a/components/finsh/shell.c +++ b/components/finsh/shell.c @@ -60,14 +60,16 @@ const char* finsh_get_prompt() { #define _MSH_PROMPT "msh " #define _PROMPT "finsh " - static char finsh_prompt[RT_CONSOLEBUF_SIZE + 1] = {_PROMPT}; + static char finsh_prompt[RT_CONSOLEBUF_SIZE + 1] = {0}; #ifdef FINSH_USING_MSH if (msh_is_used()) strcpy(finsh_prompt, _MSH_PROMPT); + else #endif + strcpy(finsh_prompt, _PROMPT); /* get current working directory */ - getcwd(&finsh_prompt[rt_strlen(finsh_prompt)], RT_CONSOLEBUF_SIZE - 8); + getcwd(&finsh_prompt[rt_strlen(finsh_prompt)], RT_CONSOLEBUF_SIZE - rt_strlen(finsh_prompt)); strcat(finsh_prompt, ">"); return finsh_prompt; |
