[hackers] [ubase] Refactor clear(1) || FRIGN
commit 7b27c7f87c01b00b6a3e5cd7a60fb832681d5ccc
Author: FRIGN <dev_AT_frign.de>
AuthorDate: Mon Sep 7 12:33:16 2015 +0200
Commit: sin <sin_AT_2f30.org>
CommitDate: Mon Sep 7 11:47:10 2015 +0100
Refactor clear(1)
Adopting best practices(tm) we developed with sbase.
diff --git a/clear.1 b/clear.1
index b22a6a7..d3c6870 100644
--- a/clear.1
+++ b/clear.1
_AT_@ -8,4 +8,4 @@
.Nm
.Sh DESCRIPTION
.Nm
-clears the screen
+clears the screen.
diff --git a/clear.c b/clear.c
index 8f4a014..6d94533 100644
--- a/clear.c
+++ b/clear.c
_AT_@ -2,9 +2,23 @@
#include <stdio.h>
#include <stdlib.h>
+#include "util.h"
+
+static void
+usage(void)
+{
+ eprintf("usage: %s\n", argv0);
+}
+
int
-main(void)
+main(int argc, char *argv[])
{
+ argv0 = argv[0], argc--, argv++;
+
+ if (argc)
+ usage();
+
printf("\x1b[2J\x1b[H");
+
return 0;
}
Received on Mon Sep 07 2015 - 12:47:16 CEST
This archive was generated by hypermail 2.3.0
: Mon Sep 07 2015 - 12:48:15 CEST