aboutsummaryrefslogtreecommitdiff
path: root/toys/clear.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2012-03-04 16:43:12 -0600
committerRob Landley <rob@landley.net>2012-03-04 16:43:12 -0600
commit4bb140e1cc68575db7c4b4b5ce339650a56c72d0 (patch)
treef67e0ac862c57eff4da283df5b99dc4883e44fb9 /toys/clear.c
parenta30a84a9052c81b6cf843c979c826274cc284004 (diff)
downloadtoybox-4bb140e1cc68575db7c4b4b5ce339650a56c72d0.tar.gz
Add clear.
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);
+}