summaryrefslogtreecommitdiff
path: root/components/finsh
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2014-04-08 15:42:25 +0800
committerBernard Xiong <[email protected]>2014-04-08 15:42:25 +0800
commit8de052915f432aa76fdc55978832c2d1eab2049b (patch)
tree2c67ee769dc500ccceba9ea03b0478ad3bed3b0b /components/finsh
parentf4c732ae918d119fdb74e9f03073ec63fe48aad6 (diff)
parent841898abe2357bca732b18eba2dfe17bb3cfd50c (diff)
Merge pull request #257 from grissiom/fix-shellv2.0.0_alpha
[shell] define FINSH_PROMPT as finsh_get_prompt when FINSH_USING_MSH enabled
Diffstat (limited to 'components/finsh')
-rw-r--r--components/finsh/shell.c6
-rw-r--r--components/finsh/shell.h2
2 files changed, 6 insertions, 2 deletions
diff --git a/components/finsh/shell.c b/components/finsh/shell.c
index 4313fcf6b2..393d68713c 100644
--- a/components/finsh/shell.c
+++ b/components/finsh/shell.c
@@ -54,8 +54,10 @@ ALIGN(RT_ALIGN_SIZE)
static char finsh_thread_stack[FINSH_THREAD_STACK_SIZE];
struct finsh_shell* shell;
-#if defined(RT_USING_DFS) && defined(DFS_USING_WORKDIR)
+#if defined(FINSH_USING_MSH) || (defined(RT_USING_DFS) && defined(DFS_USING_WORKDIR))
+#if defined(RT_USING_DFS)
#include <dfs_posix.h>
+#endif
const char* finsh_get_prompt()
{
#define _MSH_PROMPT "msh "
@@ -68,8 +70,10 @@ const char* finsh_get_prompt()
#endif
strcpy(finsh_prompt, _PROMPT);
+#ifdef DFS_USING_WORKDIR
/* get current working directory */
getcwd(&finsh_prompt[rt_strlen(finsh_prompt)], RT_CONSOLEBUF_SIZE - rt_strlen(finsh_prompt));
+#endif
strcat(finsh_prompt, ">");
return finsh_prompt;
diff --git a/components/finsh/shell.h b/components/finsh/shell.h
index 9065f2f5ef..448f9e6fbe 100644
--- a/components/finsh/shell.h
+++ b/components/finsh/shell.h
@@ -43,7 +43,7 @@
#define FINSH_CMD_SIZE 80
#define FINSH_OPTION_ECHO 0x01
-#if defined(RT_USING_DFS) && defined(DFS_USING_WORKDIR)
+#if defined(FINSH_USING_MSH) || (defined(RT_USING_DFS) && defined(DFS_USING_WORKDIR))
#define FINSH_PROMPT finsh_get_prompt()
const char* finsh_get_prompt(void);
#else