summaryrefslogtreecommitdiff
path: root/src/minibuf.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2014-07-11 18:44:25 +0300
committerEli Zaretskii <eliz@gnu.org>2014-07-11 18:44:25 +0300
commitd79194419ba59abef54a9a56a06271e230902271 (patch)
tree21ce8ef882444897e0679fd5d1764d225b2f39b6 /src/minibuf.c
parente8963bd757bce1a58d5c5b081f53a873857d25df (diff)
downloademacs-d79194419ba59abef54a9a56a06271e230902271.tar.gz
Fix reading input without echoing on MS-Windows.
src/minibuf.c (read_minibuf_noninteractive) [WINDOWSNT]: Switch stdin to binary mode when not echoing input. Fixes: debbugs:17839
Diffstat (limited to 'src/minibuf.c')
-rw-r--r--src/minibuf.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/minibuf.c b/src/minibuf.c
index c77f5955d86..5b6c9154621 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -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')