diff options
| author | bernard.xiong <[email protected]> | 2010-03-31 22:50:55 +0000 |
|---|---|---|
| committer | bernard.xiong <[email protected]> | 2010-03-31 22:50:55 +0000 |
| commit | 3052a549ef284db71fba60e378ce78f0fb194644 (patch) | |
| tree | 6157829778980fb4004474240a119d53600febc2 | |
| parent | bd5399d04e07276cbf134b6727b1c1d27d21bffd (diff) | |
add prompt output when start and remove the empty history
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@562 bbd45198-f89e-11dd-88c7-29a3b14d5316
| -rw-r--r-- | finsh/cmd.c | 2 | ||||
| -rw-r--r-- | finsh/shell.c | 27 |
2 files changed, 16 insertions, 13 deletions
diff --git a/finsh/cmd.c b/finsh/cmd.c index 15e9a08cef..5e576b275d 100644 --- a/finsh/cmd.c +++ b/finsh/cmd.c @@ -5,7 +5,7 @@ * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at - * http://openlab.rt-thread.com/license/LICENSE + * http://www.rt-thread.org/license/LICENSE * * Change Logs: * Date Author Notes diff --git a/finsh/shell.c b/finsh/shell.c index 70d0033974..3573781389 100644 --- a/finsh/shell.c +++ b/finsh/shell.c @@ -5,7 +5,7 @@ * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at - * http://openlab.rt-thread.com/license/LICENSE + * http://www.rt-thread.org/license/LICENSE * * Change Logs: * Date Author Notes @@ -15,6 +15,7 @@ * 2006-09-24 Bernard remove the code related with hardware * 2010-01-18 Bernard fix down then up key bug. * 2010-03-19 Bernard fix backspace issue and fix device read in shell. + * 2010-04-01 Bernard add prompt output when start and remove the empty history */ #include <rtthread.h> @@ -184,10 +185,10 @@ void finsh_auto_complete(char* prefix) rt_kprintf("\n"); list_prefix(prefix); rt_kprintf("finsh>>%s", prefix); -}
+} -void finsh_run_line(struct finsh_parser *parser, const char* line)
-{
+void finsh_run_line(struct finsh_parser *parser, const char* line) +{ rt_kprintf("\n"); finsh_parser_run(parser, (unsigned char*)line); @@ -223,9 +224,9 @@ void finsh_run_line(struct finsh_parser *parser, const char* line) } } - finsh_flush(parser);
-}
-
+ finsh_flush(parser); +} + void finsh_thread_entry(void* parameter) { struct finsh_parser parser; @@ -236,12 +237,14 @@ void finsh_thread_entry(void* parameter) unsigned short current_history, use_history; #endif + pos = 0; stat = WAIT_NORMAL; current_history = 0; use_history = 0; memset(line, 0, sizeof(line)); finsh_init(&parser); + rt_kprintf("finsh>>"); while (1) { @@ -350,7 +353,7 @@ void finsh_thread_entry(void* parameter) line[pos] = ';'; #ifdef FINSH_USING_HISTORY - if (use_history == 0) + if ((use_history == 0) && (pos != 0)) { /* push history */ if (finsh_history_count >= FINSH_HISTORY_LINES) @@ -378,10 +381,10 @@ void finsh_thread_entry(void* parameter) } } current_history = finsh_history_count; - #endif
-
- if (pos != 0) finsh_run_line(&parser, line);
- else rt_kprintf("\n");
+ #endif + + if (pos != 0) finsh_run_line(&parser, line); + else rt_kprintf("\n"); rt_kprintf("finsh>>"); memset(line, 0, sizeof(line)); |
