home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Distributions / ucb / spencer_2bsd.tar.gz / 2bsd.tar / src / clear.c < prev    next >
C/C++ Source or Header  |  1980-02-17  |  704b  |  43 lines

  1. /* Copyright (c) 1979 Regents of the University of California */
  2. #include <retrofit.h>
  3. #include <sgtty.h>
  4. /*
  5.  * clear - clear the screen
  6.  */
  7.  
  8. #include <stdio.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[BUFSIZ];
  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. }
  43.