-
-#else /* CONFIG_CMDLINE_EDITING */
- char *p_buf = p;
- int n = 0; /* buffer index */
- int plen = 0; /* prompt length */
- int col; /* output column cnt */
- char c;
-
- /* print prompt */
- if (prompt) {
- plen = strlen_P(prompt);
- my_puts_P(prompt);
- }
- col = plen;
-
- for (;;) {
-
- c = my_getchar(1);
-
- /*
- * Special character handling
- */
- switch (c) {
- case '\r': /* Enter */
- case '\n':
- *p = '\0';
- my_puts_P(PSTR("\r\n"));
- return p - p_buf;
-
- case '\0': /* nul */
- continue;
-
- case 0x03: /* ^C - break */
- p_buf[0] = '\0'; /* discard input */
- return -1;
-
- case 0x15: /* ^U - erase line */
- while (col > plen) {
- my_puts_P(erase_seq);
- --col;
- }
- p = p_buf;
- n = 0;
- continue;
-
- case 0x17: /* ^W - erase word */
- p = delete_char(p_buf, p, &col, &n, plen);
- while ((n > 0) && (*p != ' '))
- p = delete_char(p_buf, p, &col, &n, plen);
- continue;
-
- case 0x08: /* ^H - backspace */
- case 0x7F: /* DEL - backspace */
- p = delete_char(p_buf, p, &col, &n, plen);
- continue;
-
- default:
- /*
- * Must be a normal character then
- */
- if (n < CONFIG_SYS_CBSIZE-2) {
- if (c == '\t') { /* expand TABs */
-#ifdef CONFIG_AUTO_COMPLETE
- /*
- * if auto completion triggered just
- * continue
- */
- *p = '\0';
- if (cmd_auto_complete(prompt,
- console_buffer,
- &n, &col)) {
- p = p_buf + n; /* reset */
- continue;
- }
-#endif
- my_puts_P(tab_seq + (col & 07));
- col += 8 - (col & 07);
- } else {
- ++col;
- putchar(c);
- }
- *p++ = c;
- ++n;
- } else { /* Buffer full */
- putchar('\a');
- }
- }
- }
-#endif /* CONFIG_CMDLINE_EDITING */