aboutsummaryrefslogtreecommitdiff
path: root/toys/clear.c
diff options
context:
space:
mode:
Diffstat (limited to 'toys/clear.c')
-rw-r--r--toys/clear.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/toys/clear.c b/toys/clear.c
new file mode 100644
index 00000000..8cfceff3
--- /dev/null
+++ b/toys/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);
+}