X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=progs%2Fclear.c;h=559d296c3f4c01816c16535a026500416b35e850;hp=e9203a29e95fff901dcca02ecd64909313a1bfd9;hb=62ca6190a9a8ddccb2c4d5ca7b2ef9f88432da65;hpb=c885a3fdd089f784f17dd2e9c03d8eb774072dc9;ds=sidebyside diff --git a/progs/clear.c b/progs/clear.c index e9203a29..559d296c 100644 --- a/progs/clear.c +++ b/progs/clear.c @@ -36,17 +36,27 @@ * clear.c -- clears the terminal's screen */ -#define USE_LIBTINFO 1 +#define USE_LIBTINFO #include +#include -MODULE_ID("$Id: clear.c,v 1.15 2016/10/23 00:36:36 tom Exp $") +MODULE_ID("$Id: clear.c,v 1.17 2016/12/24 19:33:39 tom Exp $") + +const char *_nc_progname = "clear"; int main( int argc GCC_UNUSED, char *argv[]GCC_UNUSED) { - setupterm((char *) 0, STDOUT_FILENO, (int *) 0); + TTY tty_settings; + int fd; + + _nc_progname = _nc_rootname(argv[0]); + + fd = save_tty_settings(&tty_settings); + + setupterm((char *) 0, fd, (int *) 0); ExitProgram((clear_cmd() == ERR) ? EXIT_FAILURE