diff options
Diffstat (limited to 'c')
| -rw-r--r-- | c/sh.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -104,13 +104,17 @@ void main(void) { unsigned char nt, i, pipepos, c, bg; /* reap finished background jobs */ { unsigned char p; while ((p = reap())) { putc('['); putu(p); puts(" done]"); nl(); } } - puts(cwd); puts("$ "); + puts(cwd); puts("# "); /* read a line (echoing), stop at newline; exit on EOF */ i = 0; for (;;) { c = readc(); if (c == EOF) poweroff(); if (c == '\r' || c == '\n') { nl(); break; } + if (c == 8 || c == 127) { /* backspace: drop last char */ + if (i > 0) { i--; putc(8); } + continue; + } if (i < 79) { line[i++] = c; putc(c); } } line[i] = 0; |
