tags 316551 patch
thanks

Hello,

On Fri, Jul 01, 2005 at 02:03:14PM -0400, Justin Pryzby wrote:
> 
> This is a request for dpkg to clear the keyboard buffer before
> prompting the user.  (Actually, how does one do that?  I hope its not
> a silly related to getch().

The attached patch flushes the data received on the terminal before
prompting the user.

Kind Regards,
-- 
Nekral
Index: src/configure.c
===================================================================
--- src/configure.c     (révision 257)
+++ src/configure.c     (copie de travail)
@@ -37,6 +37,7 @@
 #include <assert.h>
 #include <sys/wait.h>
 #include <time.h>
+#include <termios.h>
 
 #include <dpkg.h>
 #include <dpkg-db.h>
@@ -553,6 +554,9 @@
        }
 
        do {
+               // Flush the terminal's input in case the user
+               // involuntarily typed some chars
+               tcflush(STDIN_FILENO, TCIFLUSH);
                fprintf(stderr, _("\nConfiguration file `%s'"), cfgfile);
                if (strcmp(cfgfile, realold))
                        fprintf(stderr,_(" (actually `%s')"), realold);

Reply via email to