summaryrefslogtreecommitdiff
path: root/avr/cli_readline.c
diff options
context:
space:
mode:
Diffstat (limited to 'avr/cli_readline.c')
-rw-r--r--avr/cli_readline.c56
1 files changed, 31 insertions, 25 deletions
diff --git a/avr/cli_readline.c b/avr/cli_readline.c
index 1dbc73b..1a0aaf2 100644
--- a/avr/cli_readline.c
+++ b/avr/cli_readline.c
@@ -64,20 +64,26 @@ static char *delete_char (char *buffer, char *p, int *colp, int *np, int plen)
* Author: Janghoon Lyu <nandy@mizi.com>
*/
-#define putnstr(str, n) printf_P(PSTR("%.*s"), (int)n, str)
+static void putnstr(char *str, int n)
+{
+ /* printf_P(PSTR("%.*s"), (int)n, str) */
+ while (n--)
+ putchar(*str++);
+}
-#define CTL_CH(c) ((c) - 'a' + 1)
+
+#define CTL_CH(c) ((c) - 'a' + 1)
#define CTL_BACKSPACE ('\b')
-#define DEL ((char)255)
-#define DEL7 ((char)127)
+#define DEL ((char)255)
+#define DEL7 ((char)127)
#define CREAD_HIST_CHAR ('!')
#define getcmd_putch(ch) putchar(ch)
#define getcmd_getch() my_getchar(1)
#define getcmd_cbeep() getcmd_putch('\a')
-#define HIST_MAX 5
-#define HIST_SIZE CONFIG_SYS_CBSIZE
+#define HIST_MAX 5
+#define HIST_SIZE CONFIG_SYS_CBSIZE
static int hist_max;
static int hist_add_idx;
@@ -181,28 +187,29 @@ static void cread_print_hist_list(void)
}
#endif /* CONFIG_CMDLINE_EDITING */
-#define BEGINNING_OF_LINE() { \
- while (num) { \
- getcmd_putch(CTL_BACKSPACE); \
- num--; \
- } \
+#define BEGINNING_OF_LINE() { \
+ while (num) { \
+ getcmd_putch(CTL_BACKSPACE); \
+ num--; \
+ } \
}
-#define ERASE_TO_EOL() { \
- if (num < eol_num) { \
- printf_P(PSTR("%*S"), (int)(eol_num - num), PSTR("")); \
- do { \
- getcmd_putch(CTL_BACKSPACE); \
- } while (--eol_num > num); \
- } \
+#define ERASE_TO_EOL() { \
+ if (num < eol_num) { \
+ /* printf_P(PSTR("%*S"), (int)(eol_num - num), PSTR("")); */ \
+ print_blanks(eol_num - num); \
+ do { \
+ getcmd_putch(CTL_BACKSPACE); \
+ } while (--eol_num > num); \
+ } \
}
-#define REFRESH_TO_EOL() { \
- if (num < eol_num) { \
- wlen = eol_num - num; \
- putnstr(buf + num, wlen); \
- num = eol_num; \
- } \
+#define REFRESH_TO_EOL() { \
+ if (num < eol_num) { \
+ wlen = eol_num - num; \
+ putnstr(buf + num, wlen); \
+ num = eol_num; \
+ } \
}
static void cread_add_char(char ichar, int insert, unsigned long *num,
@@ -591,4 +598,3 @@ int cli_readline(const FLASH char *const prompt)
return cli_readline_into_buffer(prompt, console_buffer);
}
-