aboutsummaryrefslogtreecommitdiff
path: root/toys/other/clear.c
diff options
context:
space:
mode:
Diffstat (limited to 'toys/other/clear.c')
-rw-r--r--toys/other/clear.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/toys/other/clear.c b/toys/other/clear.c
new file mode 100644
index 00000000..8cfceff3
--- /dev/null
+++ b/toys/other/clear.c
@@ -0,0 +1,23 @@
+/* vi: set sw=4 ts=4:
+ *
+ * clear.c - clear the screen
+ *
+ * Copyright 2012 Rob Landley <rob@landley.net>
+ *
+ * Not in SUSv4.
+
+USE_CLEAR(NEWTOY(clear, NULL, TOYFLAG_USR|TOYFLAG_BIN))
+
+config CLEAR
+ bool "clear"
+ default y
+ help
+ Clear the screen.
+*/
+
+#include "toys.h"
+
+void clear_main(void)
+{
+ write(1, "\e[2J\e[H", 7);
+}