share subr.c and string.c with pi/pc
[unix-history] / usr / src / usr.bin / tput / tput.c
CommitLineData
a4c13221 1static char *sccsid = "@(#)tput.c 4.2 (Berkeley) %G%";
45e33619
BJ
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
11char *getenv();
12char *tgetstr();
13char PC;
14short ospeed;
15#undef putchar
16int putchar();
17
18main()
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);
a4c13221 42 exit (clear == (char *) 0);
45e33619 43}