Commit | Line | Data |
---|---|---|
fcd2465c DF |
1 | /* |
2 | * Copyright (c) 1980 Regents of the University of California. | |
3 | * All rights reserved. The Berkeley software License Agreement | |
4 | * specifies the terms and conditions for redistribution. | |
5 | */ | |
6 | ||
7 | #ifndef lint | |
8 | char copyright[] = | |
9 | "@(#) Copyright (c) 1980 Regents of the University of California.\n\ | |
10 | All rights reserved.\n"; | |
11 | #endif not lint | |
12 | ||
13 | #ifndef lint | |
14 | static char sccsid[] = "@(#)tput.c 5.1 (Berkeley) %G%"; | |
15 | #endif not lint | |
16 | ||
45e33619 BJ |
17 | /* load me with -ltermlib */ |
18 | /* #include <retrofit.h> on version 6 */ | |
19 | /* | |
20 | * clear - clear the screen | |
21 | */ | |
22 | ||
23 | #include <stdio.h> | |
24 | #include <sgtty.h> | |
25 | ||
26 | char *getenv(); | |
27 | char *tgetstr(); | |
28 | char PC; | |
29 | short ospeed; | |
30 | #undef putchar | |
31 | int putchar(); | |
32 | ||
33 | main() | |
34 | { | |
35 | char *cp = getenv("TERM"); | |
36 | char clbuf[20]; | |
37 | char pcbuf[20]; | |
38 | char *clbp = clbuf; | |
39 | char *pcbp = pcbuf; | |
40 | char *clear; | |
41 | char buf[1024]; | |
42 | char *pc; | |
43 | struct sgttyb tty; | |
44 | ||
45 | gtty(1, &tty); | |
46 | ospeed = tty.sg_ospeed; | |
47 | if (cp == (char *) 0) | |
48 | exit(1); | |
49 | if (tgetent(buf, cp) != 1) | |
50 | exit(1); | |
51 | pc = tgetstr("pc", &pcbp); | |
52 | if (pc) | |
53 | PC = *pc; | |
54 | clear = tgetstr("cl", &clbp); | |
55 | if (clear) | |
56 | tputs(clear, tgetnum("li"), putchar); | |
a4c13221 | 57 | exit (clear == (char *) 0); |
45e33619 | 58 | } |