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 .Nm
.Sh DESCRIPTION .Sh DESCRIPTION
.Nm .Nm
clears the screen clears the screen.

18
clear.c
View File

@ -2,9 +2,23 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
int #include "util.h"
main(void)
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"); printf("\x1b[2J\x1b[H");
return 0; return 0;
} }