add current path in prompt.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1184 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
fbe81f8c4c
commit
46914144c9
|
@ -84,6 +84,21 @@ int isprint(unsigned char ch)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(RT_USING_DFS) && defined(DFS_USING_WORKDIR)
|
||||||
|
#include <dfs_posix.h>
|
||||||
|
const char* finsh_get_prompt()
|
||||||
|
{
|
||||||
|
#define _PROMPT "finsh "
|
||||||
|
static char finsh_prompt[RT_CONSOLEBUF_SIZE + 1] = {_PROMPT};
|
||||||
|
|
||||||
|
/* get current working directory */
|
||||||
|
getcwd(&finsh_prompt[6], RT_CONSOLEBUF_SIZE - 8);
|
||||||
|
strcat(finsh_prompt, ">");
|
||||||
|
|
||||||
|
return finsh_prompt;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static rt_err_t finsh_rx_ind(rt_device_t dev, rt_size_t size)
|
static rt_err_t finsh_rx_ind(rt_device_t dev, rt_size_t size)
|
||||||
{
|
{
|
||||||
RT_ASSERT(shell != RT_NULL);
|
RT_ASSERT(shell != RT_NULL);
|
||||||
|
@ -172,7 +187,7 @@ void finsh_auto_complete(char* prefix)
|
||||||
|
|
||||||
rt_kprintf("\n");
|
rt_kprintf("\n");
|
||||||
list_prefix(prefix);
|
list_prefix(prefix);
|
||||||
rt_kprintf("finsh>>%s", prefix);
|
rt_kprintf("%s%s", FINSH_PROMPT, prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
void finsh_run_line(struct finsh_parser* parser, const char *line)
|
void finsh_run_line(struct finsh_parser* parser, const char *line)
|
||||||
|
|
|
@ -13,7 +13,11 @@
|
||||||
#define FINSH_CMD_SIZE 80
|
#define FINSH_CMD_SIZE 80
|
||||||
|
|
||||||
#define FINSH_OPTION_ECHO 0x01
|
#define FINSH_OPTION_ECHO 0x01
|
||||||
|
#if defined(RT_USING_DFS) && defined(DFS_USING_WORKDIR)
|
||||||
|
#define FINSH_PROMPT finsh_get_prompt()
|
||||||
|
#else
|
||||||
#define FINSH_PROMPT "finsh>>"
|
#define FINSH_PROMPT "finsh>>"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef FINSH_USING_HISTORY
|
#ifdef FINSH_USING_HISTORY
|
||||||
enum input_stat
|
enum input_stat
|
||||||
|
|
Loading…
Reference in New Issue