6 int readline(char *buf, size_t buf_l, const char *prompt, ...)
8 static spinlock_t readline_lock = SPINLOCK_INITIALIZER_IRQSAVE;
9 int i, c, echoing, retval;
12 spin_lock_irqsave(&readline_lock);
23 printk("read error: %d\n", c);
26 } else if (c == '\b' || c == 0x7f) {
33 } else if (c == '\n' || c == '\r') {
34 /* sending a \n regardless, since the serial port gives
35 * us a \r for carriage returns. (probably won't get a
39 assert(i <= buf_l - 1);
40 /* never write to buf_l - 1 til the end */
44 } else if (c >= ' ' && i < buf_l - 1) {
50 spin_unlock_irqsave(&readline_lock);