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