* 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;
}
#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,
return cli_readline_into_buffer(prompt, console_buffer);
}
-