/* clr() - Used to clear the screen. */ #include #include #include #define ERROR -1 void clr() { char *clear; char clbuf[1024]; char *clbp = clbuf; if (tgetent(clbuf, getenv("TERM")) == ERROR) { perror("tgetent"); exit(ERROR); } /* This will give a warning without the typecast (broken prototype?) */ if ((clear = tgetstr("cl", &clbp)) == NULL) { perror("tgetstr"); exit(ERROR); } if (clear) tputs(clear, tgetnum("li"), putchar); }