]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix reading input without echoing on MS-Windows.
authorEli Zaretskii <eliz@gnu.org>
Fri, 11 Jul 2014 15:44:25 +0000 (18:44 +0300)
committerEli Zaretskii <eliz@gnu.org>
Fri, 11 Jul 2014 15:44:25 +0000 (18:44 +0300)
 src/minibuf.c (read_minibuf_noninteractive) [WINDOWSNT]: Switch stdin
 to binary mode when not echoing input.

Fixes: debbugs:17839
src/ChangeLog
src/minibuf.c

index a016f3cadc2a4f2aef30a2300e6be8d6068bb128..282b79eef127b0a18cda98d5e03a063e56ba3a6c 100644 (file)
@@ -2,6 +2,7 @@
 
        * minibuf.c (read_minibuf_noninteractive): Finish reading on '\r',
        not only on '\n'.
+       [WINDOWSNT]: Switch stdin to binary mode when not echoing input.
 
        * sysdep.c (emacs_get_tty, emacs_set_tty, suppress_echo_on_tty)
        [DOS_NT]: Implement for WINDOWSNT.
index c77f5955d86f1bcdf5b0756a3e87abd3f0a3d1ef..5b6c91546219cd009d0fee7d551a2afaf91a8b1d 100644 (file)
@@ -22,6 +22,10 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <errno.h>
 #include <stdio.h>
 
+#ifdef WINDOWSNT
+#include <fcntl.h>     /* For O_BINARY, O_TEXT. */
+#endif
+
 #include "lisp.h"
 #include "commands.h"
 #include "character.h"
@@ -240,6 +244,9 @@ read_minibuf_noninteractive (Lisp_Object map, Lisp_Object initial,
   if (hide_char)
     {
       emacs_get_tty (fileno (stdin), &etty);
+#ifdef WINDOWSNT
+      _setmode (fileno (stdin), O_BINARY);
+#endif
       suppress_echo_on_tty (fileno (stdin));
     }
 
@@ -278,6 +285,9 @@ read_minibuf_noninteractive (Lisp_Object map, Lisp_Object initial,
     {
       fprintf (stdout, "\n");
       emacs_set_tty (fileno (stdin), &etty, 0);
+#ifdef WINDOWSNT
+      _setmode (fileno (stdin), O_TEXT);
+#endif
     }
 
   if (len || c == '\n' || c == '\r')