From fadd46012c9974931add6c36e69636d3cbc6906f Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Sun, 20 Sep 2020 14:50:12 -0400 Subject: history when getting line from user in knob --- src/user/highway/line.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/user/highway/line.c') diff --git a/src/user/highway/line.c b/src/user/highway/line.c index 40dccfa..b5a54c5 100644 --- a/src/user/highway/line.c +++ b/src/user/highway/line.c @@ -57,25 +57,28 @@ void run_line(const char *original_line) { const char *space; for (space = line; *space && (*space != ' '); ++space) ; - if (blockequ(line, "source", space - line)) + if (blockequ(line, "source ", 7)) source(space + 1); - else if (blockequ(line, "set", space - line)) + else if (blockequ(line, "set ", 4)) set(space + 1); - else if (blockequ(line, "echo", space - line)) { + else if (blockequ(line, "echo ", 5)) { tell_user_sz(space + 1); tell_user_sz("\n"); } - else if (blockequ(line, "vars", space - line)) + else if (blockequ(line, "vars", 5)) dump_vars(); - else if (blockequ(line, "quit", space - line)) + else if (blockequ(line, "quit", 5)) __pcrt_quit(); - else if (blockequ(line, "help", space - line)) + else if (blockequ(line, "clear", 6)) + _clear_screen(); + else if (blockequ(line, "help", 5)) tell_user_sz("Highway is a command shell for Portland OS. It includes variables and a couple\n" "of pseudo-commands. Variables are addressed by surrounding with \"$\". The\n" "following list shows each of the pseudo-commands.\n\n" " source FILE run each command in FILE\n" - " set VAR VALUE set $VAR$ to VALUE\n" + " clear clear the screen\n" " echo STRING print STRING\n" + " set VAR VALUE set $VAR$ to VALUE\n" " vars dump variables\n" " quit exit highway\n" " help show this\n"); -- cgit v1.2.3