ffmpeg: fix read_yn() if HAVE_TERMIOS_H || HAVE_KBHIT == 0
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 8 Oct 2011 17:43:10 +0000 (19:43 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 8 Oct 2011 17:43:10 +0000 (19:43 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
ffmpeg.c

index 5e9fcf1..b290022 100644 (file)
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -611,11 +611,13 @@ static int read_key(void)
 
 static int read_yn(void)
 {
-    int c;
+    int c, t;
 #if HAVE_TERMIOS_H || HAVE_KBHIT
     while((c=read_key()) < 0);
 #else
-    c= getchar();
+    t=c= getchar();
+    while (t != '\n' && t != EOF)
+        t = getchar();
 #endif
 
     return (toupper(c) == 'Y');