From 45e33619c81376d46c67647f4c36a4f6c8ca27b9 Mon Sep 17 00:00:00 2001 From: Bill Joy Date: Thu, 2 Oct 1980 01:25:36 -0800 Subject: [PATCH] date and time created 80/10/01 17:25:36 by bill SCCS-vsn: usr.bin/tput/tput.c 4.1 --- usr/src/usr.bin/tput/tput.c | 43 +++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 usr/src/usr.bin/tput/tput.c diff --git a/usr/src/usr.bin/tput/tput.c b/usr/src/usr.bin/tput/tput.c new file mode 100644 index 0000000000..f5166f8f86 --- /dev/null +++ b/usr/src/usr.bin/tput/tput.c @@ -0,0 +1,43 @@ +static char *sccsid = "@(#)tput.c 4.1 (Berkeley) %G%"; +/* load me with -ltermlib */ +/* #include on version 6 */ +/* + * clear - clear the screen + */ + +#include +#include + +char *getenv(); +char *tgetstr(); +char PC; +short ospeed; +#undef putchar +int putchar(); + +main() +{ + char *cp = getenv("TERM"); + char clbuf[20]; + char pcbuf[20]; + char *clbp = clbuf; + char *pcbp = pcbuf; + char *clear; + char buf[1024]; + char *pc; + struct sgttyb tty; + + gtty(1, &tty); + ospeed = tty.sg_ospeed; + if (cp == (char *) 0) + exit(1); + if (tgetent(buf, cp) != 1) + exit(1); + pc = tgetstr("pc", &pcbp); + if (pc) + PC = *pc; + clear = tgetstr("cl", &clbp); + if (clear) + tputs(clear, tgetnum("li"), putchar); + exit (clear != (char *) 0); +} -- 2.20.1