ubase

suckless linux base utils
git clone git://git.2f30.org/ubase.git
Log | Files | Refs | README | LICENSE

commit ccb70299a5c71fa85c12ee515b779af79c940a31
parent 9461c9c8e93bd53be530bdf7673b379fc73c0040
Author: FRIGN <dev@frign.de>
Date:   Mon Sep  7 12:33:16 +0200

Refactor clear(1)

Adopting best practices(tm) we developed with sbase.

Diffstat:
clear.1 | 2+-
clear.c | 16+++++++++++++++-
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/clear.1 b/clear.1 @@ -8,4 +8,4 @@ .Nm .Sh DESCRIPTION .Nm -clears the screen +clears the screen. diff --git a/clear.c b/clear.c @@ -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; }