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: }

Defined functions

main defined in line 17; never used

Defined variables

PC defined in line 12; used 2 times
ospeed defined in line 13; used 3 times
Last modified: 1980-04-26
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 686
Valid CSS Valid XHTML 1.0 Strict