aruu

[MIRROR] Actual replacement for Busybox | suckless
git clone https://git.daat.foo/aruu.git
Log | Files | Refs | README | LICENSE

clear.c (391B)


      1 /* see LICENSE file for copyright and license details */
      2 
      3 #include <stdio.h>
      4 
      5 #include "util.h"
      6 
      7 static void
      8 usage(void)
      9 {
     10   eprintf("usage: %s\n", argv0);
     11 }
     12 
     13 // ?man clear: clear terminal screen
     14 // ?man clear the terminal screen and scrollback buffer
     15 int
     16 main(int argc, char *argv[])
     17 {
     18   argv0 = argv[0], argc--, argv++;
     19 
     20   if (argc)
     21     usage();
     22 
     23   printf("\x1b[2J\x1b[H");
     24 
     25   return 0;
     26 }