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