summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/dfs/filesystems/nfs/rpc/pmap.c2
-rw-r--r--components/finsh/msh.c11
-rw-r--r--components/finsh/shell.c6
-rw-r--r--components/finsh/shell.h2
4 files changed, 15 insertions, 6 deletions
diff --git a/components/dfs/filesystems/nfs/rpc/pmap.c b/components/dfs/filesystems/nfs/rpc/pmap.c
index fcf8e9d948..4f2cf50c1e 100644
--- a/components/dfs/filesystems/nfs/rpc/pmap.c
+++ b/components/dfs/filesystems/nfs/rpc/pmap.c
@@ -24,7 +24,7 @@ unsigned short pmap_getport(struct sockaddr_in *address, unsigned long program,
{
unsigned short port = 0;
int socket = -1;
- register CLIENT *client;
+ register CLIENT *client = RT_NULL;
struct pmap parms;
address->sin_port = htons((unsigned short)PMAPPORT);
diff --git a/components/finsh/msh.c b/components/finsh/msh.c
index 1492e017e1..49a5d23591 100644
--- a/components/finsh/msh.c
+++ b/components/finsh/msh.c
@@ -180,7 +180,7 @@ static cmd_function_t msh_get_cmd(char *cmd, int size)
#if defined(RT_USING_MODULE) && defined(RT_USING_DFS)
/* Return 0 on module executed. Other value indicate error.
*/
-int msh_exec_module(char* cmd_line, int size)
+int msh_exec_module(const char* cmd_line, int size)
{
int ret;
int fd = -1;
@@ -248,6 +248,11 @@ int msh_exec_module(char* cmd_line, int size)
rt_free(pg_name);
return ret;
}
+
+int system(const char *command)
+{
+ return msh_exec_module(command, rt_strlen(command));
+}
#endif
static int _msh_exec_cmd(char* cmd, rt_size_t length, int *retp)
@@ -346,8 +351,8 @@ static int str_common(const char *str1, const char *str2)
#ifdef RT_USING_DFS
void msh_auto_complete_path(char *path)
{
- DIR* dir;
- struct dirent *dirent;
+ DIR* dir = RT_NULL;
+ struct dirent *dirent = RT_NULL;
char *full_path, *ptr, *index;
full_path = (char*)rt_malloc(256);
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