diff options
Diffstat (limited to 'usr.bin/osh/osh.c')
-rw-r--r-- | usr.bin/osh/osh.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/usr.bin/osh/osh.c b/usr.bin/osh/osh.c index 93ac876..db8865d 100644 --- a/usr.bin/osh/osh.c +++ b/usr.bin/osh/osh.c @@ -56,6 +56,7 @@ "kfg - Start up kfgwm\n" \ "bell - Toggle backspace bell\n" \ "time - Get the current time\n" \ + "clear - Clear the screen\n" \ "exit - Exit the shell" #define PROMPT "[root::osmora]~ " @@ -106,6 +107,12 @@ cmd_echo(int argc, char *argv[]) } static void +cmd_clear(int argc, char *argv[]) +{ + fputs("\033[H", stdout); +} + +static void cmd_bell(int argc, char *argv[]) { const char *usage_str = "usage: bell [on/off]"; @@ -219,6 +226,7 @@ static int cmd_run(const char *input, int argc, char *argv[]) { char bin_path[256]; + char *envp[1] = { NULL }; int error; snprintf(bin_path, sizeof(bin_path), "/usr/bin/%s", input); @@ -228,7 +236,7 @@ cmd_run(const char *input, int argc, char *argv[]) return -1; } - if ((error = spawn(bin_path, SPAWN_WAIT)) < 0) { + if ((error = spawn(bin_path, argv, envp, SPAWN_WAIT)) < 0) { return error; } @@ -242,6 +250,7 @@ struct builtin_cmd cmds[] = { {"reboot",cmd_reboot}, {"shutdown", cmd_shutdown}, {"bell", cmd_bell}, + {"clear", cmd_clear}, {NULL, NULL} }; |