From dea9a31523216caa153c589426b175d52aa43634 Mon Sep 17 00:00:00 2001 From: Leo C Date: Thu, 21 Aug 2014 10:32:33 +0200 Subject: [PATCH] Autocomplete, long way to go... --- avr/command.c | 5 ++++- avr/command.h | 2 +- avr/config.h | 1 + avr/debug.c | 3 +++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/avr/command.c b/avr/command.c index 9eb0ed2..15b1c72 100644 --- a/avr/command.c +++ b/avr/command.c @@ -194,7 +194,7 @@ command_ret_t cmd_usage(const FLASH cmd_tbl_t *cmdtp) int var_complete(int argc, char * const argv[], char last_char, int maxv, char *cmdv[]) { - static char tmp_buf[512]; + static char tmp_buf[CONFIG_SYS_CBSIZE]; int space; space = last_char == '\0' || isblank(last_char); @@ -210,6 +210,8 @@ int var_complete(int argc, char * const argv[], char last_char, int maxv, char * /*************************************************************************************/ +/* TODO: cmdtp points to FLASH */ + static int complete_cmdv(int argc, char * const argv[], char last_char, int maxv, char *cmdv[]) { cmd_tbl_t *cmdtp = cmd_tbl; @@ -357,6 +359,7 @@ static int find_common_prefix(char * const argv[]) static char tmp_buf[CONFIG_SYS_CBSIZE]; /* copy of console I/O buffer */ + int cmd_auto_complete(const FLASH char *const prompt, char *buf, int *np, int *colp) { int n = *np, col = *colp; diff --git a/avr/command.h b/avr/command.h index 4e96903..2fd20a0 100644 --- a/avr/command.h +++ b/avr/command.h @@ -82,7 +82,7 @@ command_ret_t cmd_usage(cmd_tbl_t *cmdtp); #ifdef CONFIG_AUTO_COMPLETE extern int var_complete(int argc, char * const argv[], char last_char, int maxv, char *cmdv[]); -extern int cmd_auto_complete(const char *const prompt, char *buf, int *np, int *colp); +extern int cmd_auto_complete(const FLASH char *const prompt, char *buf, int *np, int *colp); #endif /** diff --git a/avr/config.h b/avr/config.h index 13de63b..08d97bd 100644 --- a/avr/config.h +++ b/avr/config.h @@ -19,6 +19,7 @@ #define CONFIG_SYS_PROMPT "=> " +/* TODO: */ //#define CONFIG_CMDLINE_EDITING 1 //#define CONFIG_AUTO_COMPLETE 1 diff --git a/avr/debug.c b/avr/debug.c index 74d8ab2..fcbd2c1 100644 --- a/avr/debug.c +++ b/avr/debug.c @@ -227,6 +227,8 @@ command_ret_t do_eep_cp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[ /*------------------------------------------------------------------------------*/ +#if 0 + struct __freelist { size_t sz; struct __freelist *nx; @@ -265,6 +267,7 @@ printfreelist(const char * title) (size_t) STACK_POINTER(), (size_t) __brkval, freesum); } +#endif #endif /* DEBUG */ -- 2.39.2