X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=progs%2Fclear_cmd.c;h=3d80515c2e9744896cad937d435a3603a88f58e8;hp=07d5636cd7df1dda2674f978a79c7a9d3199aef5;hb=3b3a6d094f484e799b1430782f1130a9af71a94e;hpb=f06e14af5e11df95d6542964bf1b349d2843bb11 diff --git a/progs/clear_cmd.c b/progs/clear_cmd.c index 07d5636c..3d80515c 100644 --- a/progs/clear_cmd.c +++ b/progs/clear_cmd.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 2016 Free Software Foundation, Inc. * + * Copyright 2018,2020 Thomas E. Dickey * + * Copyright 2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -37,7 +38,7 @@ #define USE_LIBTINFO #include -MODULE_ID("$Id: clear_cmd.c,v 1.1 2016/10/21 23:37:35 tom Exp $") +MODULE_ID("$Id: clear_cmd.c,v 1.5 2020/02/02 23:34:34 tom Exp $") static int putch(int c) @@ -46,14 +47,14 @@ putch(int c) } int -clear_cmd(void) +clear_cmd(bool legacy) { - char *E3; - - /* Clear the scrollback buffer if possible. */ - E3 = tigetstr("E3"); - if (E3) - (void) tputs(E3, lines > 0 ? lines : 1, putch); - - return tputs(clear_screen, lines > 0 ? lines : 1, putch); + int retval = tputs(clear_screen, lines > 0 ? lines : 1, putch); + if (!legacy) { + /* Clear the scrollback buffer if possible. */ + char *E3 = tigetstr("E3"); + if (E3) + (void) tputs(E3, lines > 0 ? lines : 1, putch); + } + return retval; }