Explorar o código

[Finsh] Use msh as prompt when current mode is msh mode.

bernard %!s(int64=11) %!d(string=hai) anos
pai
achega
33a5abbbf8
Modificáronse 1 ficheiros con 8 adicións e 3 borrados
  1. 8 3
      components/finsh/shell.c

+ 8 - 3
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;