From 5b2644cafc8a619b617ba0fbb5473667dbd634ba Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Thu, 14 May 2015 13:43:01 -0500 Subject: Promote reset (actually write a new one using the simple man 4 console_codes terminal reset escape sequence) and add gettty() function to lib so terminal gets reset even when we redirect stdout/stderr. (This is apparently the expected behavior.) --- toys/other/reset.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 toys/other/reset.c (limited to 'toys/other/reset.c') diff --git a/toys/other/reset.c b/toys/other/reset.c new file mode 100644 index 00000000..0c2089cc --- /dev/null +++ b/toys/other/reset.c @@ -0,0 +1,23 @@ +/* reset.c - reset the terminal. + * + * Copyright 2015 Rob Landley + * + * No standard. + +USE_RESET(NEWTOY(reset, 0, TOYFLAG_USR|TOYFLAG_BIN)) + +config RESET + bool "reset" + default y + help + usage: reset + + reset the terminal +*/ +#include "toys.h" + +void reset_main(void) +{ + // man 4 console codes: reset terminal is ESC (no left bracket) c + xwrite(xgettty(), "\033c", 2); +} -- cgit v1.2.3