home *** CD-ROM | disk | FTP | other *** search
/ Power Hacker 2003 / Power_Hacker_2003.iso / Exploit and vulnerability / w00w00 / misc / shokdial / clear.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-13  |  512 b   |  30 lines

  1. /* clr() - Used to clear the screen. */
  2.  
  3. #include <term.h>
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6.  
  7. #define ERROR -1
  8.  
  9. void clr()
  10. {
  11.   char *clear;
  12.   char clbuf[1024];
  13.   char *clbp = clbuf;
  14.  
  15.   if (tgetent(clbuf, getenv("TERM")) == ERROR) {
  16.      perror("tgetent");
  17.      exit(ERROR);
  18.   }
  19.  
  20.   /* This will give a warning without the typecast (broken prototype?) */
  21.   if ((clear = tgetstr("cl", &clbp)) == NULL) {
  22.      perror("tgetstr");
  23.      exit(ERROR);
  24.   }
  25.  
  26.   if (clear)
  27.      tputs(clear, tgetnum("li"), putchar);
  28.  
  29. }
  30.