76eca5
diff -up ncurses-5.9/man/clear.1.clear ncurses-5.9/man/clear.1
76eca5
--- ncurses-5.9/man/clear.1.clear	2010-12-04 19:36:44.000000000 +0100
76eca5
+++ ncurses-5.9/man/clear.1	2013-01-30 12:33:06.140568071 +0100
76eca5
@@ -37,7 +37,10 @@
76eca5
 .SH DESCRIPTION
76eca5
 \fB@CLEAR@\fR clears your screen if this is possible.  It looks in the
76eca5
 environment for the terminal type and then in the \fBterminfo\fR database to
76eca5
-figure out how to clear the screen.
76eca5
+figure out how to clear the screen.  Some terminals can clear also their
76eca5
+scrollback buffer to prevent access to potentially sensitive data.  If the
76eca5
+\fBterminfo\fR entry for the terminal type contains extended capability
76eca5
+\fBE3\fR, \fB@CLEAR@\fR will use it to clear the scrollback buffer.
76eca5
 .PP
76eca5
 \fB@CLEAR@\fR ignores any command-line parameters that may be present.
76eca5
 .SH SEE ALSO
76eca5
diff -up ncurses-5.9/progs/clear.c.clear ncurses-5.9/progs/clear.c
76eca5
--- ncurses-5.9/progs/clear.c.clear	2007-10-14 00:16:02.000000000 +0200
76eca5
+++ ncurses-5.9/progs/clear.c	2013-01-30 12:13:10.494509019 +0100
76eca5
@@ -52,7 +52,15 @@ main(
76eca5
 	int argc GCC_UNUSED,
76eca5
 	char *argv[]GCC_UNUSED)
76eca5
 {
76eca5
+    char *E3;
76eca5
+
76eca5
     setupterm((char *) 0, STDOUT_FILENO, (int *) 0);
76eca5
+    
76eca5
+    /* Clear the scrollback buffer if possible. */
76eca5
+    E3 = tigetstr("E3");
76eca5
+    if (E3 && E3 != CANCELLED_STRING)
76eca5
+	tputs(E3, lines > 0 ? lines : 1, putch);
76eca5
+
76eca5
     ExitProgram((tputs(clear_screen, lines > 0 ? lines : 1, putch) == ERR)
76eca5
 		? EXIT_FAILURE
76eca5
 		: EXIT_SUCCESS);