Refactor clear(1)

Adopting best practices(tm) we developed with sbase.
This commit is contained in:
FRIGN 2015-09-07 12:33:16 +02:00 committed by sin
parent b6669b5f19
commit 7b27c7f87c
2 changed files with 17 additions and 3 deletions

View File

@ -8,4 +8,4 @@
.Nm
.Sh DESCRIPTION
.Nm
clears the screen
clears the screen.

18
clear.c
View File

@ -2,9 +2,23 @@
#include <stdio.h>
#include <stdlib.h>
int
main(void)
#include "util.h"
static void
usage(void)
{
eprintf("usage: %s\n", argv0);
}
int
main(int argc, char *argv[])
{
argv0 = argv[0], argc--, argv++;
if (argc)
usage();
printf("\x1b[2J\x1b[H");
return 0;
}