[shell] Handle backspace properly

This commit is contained in:
Kevin Lange 2011-02-07 15:19:12 -06:00
parent 8a2dd3ade8
commit 29ec9cce80
2 changed files with 24 additions and 3 deletions

View File

@ -113,10 +113,23 @@ void
kgets_handler(
char ch
) {
writech(ch);
if (ch == '\n') {
kgets_newline = 1;
if (ch == 0x08) {
/* Backspace */
if (kgets_collected != 0) {
writech(0x08);
writech(' ');
writech(0x08);
kgets_buffer[kgets_collected] = '\0';
--kgets_collected;
}
return;
} else if (ch == '\n') {
kgets_newline = 1;
writech('\n');
return;
} else {
writech(ch);
}
if (kgets_collected < kgets_want) {
kgets_buffer[kgets_collected] = ch;

View File

@ -114,6 +114,14 @@ start_shell() {
i++;
entry = readdir_fs(node, i);
}
} else if (!strcmp(cmd, "help")) {
settextcolor(9,0);
kprintf(" - ToAruOS Kernel Debug Shell - \n");
resettextcolor();
kprintf(" This is the ToAruOS kernel debugging environment.\n");
kprintf(" From here, you have access to the virtual file system layer and \n");
kprintf(" can read files, list files in directories, dump memory, registers,\n");
kprintf(" and a few other things.\n");
} else {
kprintf("Unrecognized command: %s\n", cmd);
}