|
|
1.1 ! root 1: /* load me with -ltermlib */ ! 2: /* #include <retrofit.h> on version 6 */ ! 3: /* ! 4: * clear - clear the screen ! 5: */ ! 6: ! 7: #include <stdio.h> ! 8: #include <sgtty.h> ! 9: ! 10: char *getenv(); ! 11: char *tgetstr(); ! 12: char PC; ! 13: short ospeed; ! 14: #undef putchar ! 15: int putchar(); ! 16: ! 17: main() ! 18: { ! 19: char *cp = getenv("TERM"); ! 20: char clbuf[20]; ! 21: char pcbuf[20]; ! 22: char *clbp = clbuf; ! 23: char *pcbp = pcbuf; ! 24: char *clear; ! 25: char buf[1024]; ! 26: char *pc; ! 27: struct sgttyb tty; ! 28: ! 29: gtty(1, &tty); ! 30: ospeed = tty.sg_ospeed; ! 31: if (cp == (char *) 0) ! 32: exit(1); ! 33: if (tgetent(buf, cp) != 1) ! 34: exit(1); ! 35: pc = tgetstr("pc", &pcbp); ! 36: if (pc) ! 37: PC = *pc; ! 38: clear = tgetstr("cl", &clbp); ! 39: if (clear) ! 40: tputs(clear, tgetnum("li"), putchar); ! 41: exit (clear != (char *) 0); ! 42: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.