10 int readline(char *buf, size_t buf_l, const char *prompt, ...)
12 static spinlock_t readline_lock = SPINLOCK_INITIALIZER_IRQSAVE;
13 int i, c, echoing, retval;
16 spin_lock_irqsave(&readline_lock);
27 printk("read error: %e\n", c); /* %e! */
30 } else if (c == '\b' || c == 0x7f) {
37 } else if (c == '\n' || c == '\r') {
38 /* sending a \n regardless, since the serial port gives us a \r for
39 * carriage returns. (probably won't get a \r anymore) */
42 assert(i <= buf_l - 1); /* never write to buf_l - 1 til the end */
46 } else if (c >= ' ' && i < buf_l - 1) {
52 spin_unlock_irqsave(&readline_lock);