aboutsummaryrefslogtreecommitdiff
path: root/toys/other
diff options
context:
space:
mode:
Diffstat (limited to 'toys/other')
-rw-r--r--toys/other/reset.c23
1 files changed, 23 insertions, 0 deletions
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 <rob@landley.net>
+ *
+ * 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);
+}