summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbernard <[email protected]>2014-09-11 12:47:25 +0800
committerbernard <[email protected]>2014-09-11 12:47:25 +0800
commita8b0fe3f3691f63c002331b844986eaf33eefcee (patch)
tree2f8e44cf92738f74c9deeef422f88f8c09d68ffb
parentd0a78615345898c0db262b6d67f005e76811b4ae (diff)
[shell] Fix compiling issue when DFS is not enable
-rw-r--r--components/finsh/msh.c5
-rw-r--r--components/finsh/msh_cmd.c3
-rw-r--r--components/finsh/shell.c5
3 files changed, 9 insertions, 4 deletions
diff --git a/components/finsh/msh.c b/components/finsh/msh.c
index e585b8d3a1..a976705857 100644
--- a/components/finsh/msh.c
+++ b/components/finsh/msh.c
@@ -315,12 +315,15 @@ int msh_exec(char* cmd, rt_size_t length)
return 0;
}
#endif
-#ifdef DFS_USING_WORKDIR
+
+#if defined(RT_USING_DFS) && defined(DFS_USING_WORKDIR)
+ /* change to this directory */
if (chdir(cmd) == 0)
{
return 0;
}
#endif
+
/* truncate the cmd at the first space. */
{
char *tcmd;
diff --git a/components/finsh/msh_cmd.c b/components/finsh/msh_cmd.c
index 7c67681833..0ec0b07621 100644
--- a/components/finsh/msh_cmd.c
+++ b/components/finsh/msh_cmd.c
@@ -249,6 +249,7 @@ int cmd_ifconfig(int argc, char** argv)
}
FINSH_FUNCTION_EXPORT_ALIAS(cmd_ifconfig, __cmd_ifconfig, list the information of network interfaces);
+#ifdef RT_LWIP_TCP
int cmd_netstat(int argc, char** argv)
{
extern void list_tcps(void);
@@ -257,7 +258,7 @@ int cmd_netstat(int argc, char** argv)
return 0;
}
FINSH_FUNCTION_EXPORT_ALIAS(cmd_netstat, __cmd_netstat, list the information of TCP/IP);
-
+#endif
#endif /* RT_USING_LWIP */
int cmd_ps(int argc, char** argv)
diff --git a/components/finsh/shell.c b/components/finsh/shell.c
index a9559954e6..4d7035c139 100644
--- a/components/finsh/shell.c
+++ b/components/finsh/shell.c
@@ -70,10 +70,11 @@ const char* finsh_get_prompt()
#endif
strcpy(finsh_prompt, _PROMPT);
-#ifdef DFS_USING_WORKDIR
+#if defined(RT_USING_DFS) && defined(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;
@@ -307,7 +308,7 @@ void finsh_thread_entry(void* parameter)
shell->device = rt_console_get_device();
RT_ASSERT(shell->device);
rt_device_set_rx_indicate(shell->device, finsh_rx_ind);
- rt_device_open(shell->device, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_INT_RX);
+ rt_device_open(shell->device, (RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_STREAM | RT_DEVICE_FLAG_INT_RX));
#else
RT_ASSERT(shell->device);
#endif