emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r117516: * sysdep.c (suppress_echo_on_tty): New func


From: Michael Albinus
Subject: [Emacs-diffs] trunk r117516: * sysdep.c (suppress_echo_on_tty): New function.
Date: Fri, 11 Jul 2014 12:35:38 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117516
revision-id: address@hidden
parent: address@hidden
committer: Michael Albinus <address@hidden>
branch nick: trunk
timestamp: Fri 2014-07-11 14:35:23 +0200
message:
  * sysdep.c (suppress_echo_on_tty): New function.
  * minibuf.c (read_minibuf_noninteractive): Use it.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/minibuf.c                  minibuf.c-20091113204419-o5vbwnq5f7feedwu-242
  src/sysdep.c                   sysdep.c-20091113204419-o5vbwnq5f7feedwu-448
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-07-11 12:19:58 +0000
+++ b/src/ChangeLog     2014-07-11 12:35:23 +0000
@@ -1,3 +1,8 @@
+2014-07-11  Michael Albinus  <address@hidden>
+
+       * sysdep.c (suppress_echo_on_tty): New function.
+       * minibuf.c (read_minibuf_noninteractive): Use it.
+
 2014-07-11  Dmitry Antipov  <address@hidden>
 
        * alloc.c (Fmemory_info) [HAVE_LINUX_SYSINFO]: Return nil if

=== modified file 'src/minibuf.c'
--- a/src/minibuf.c     2014-07-11 09:56:58 +0000
+++ b/src/minibuf.c     2014-07-11 12:35:23 +0000
@@ -38,6 +38,7 @@
 #include "systty.h"
 extern void emacs_get_tty (int, struct emacs_tty *);
 extern int emacs_set_tty (int, struct emacs_tty *, bool);
+extern void suppress_echo_on_tty (int);
 
 /* List of buffers for use as minibuffers.
    The first element of the list is used for the outermost minibuffer
@@ -229,7 +230,7 @@
   Lisp_Object val;
   int c;
   unsigned char hide_char = 0;
-  struct emacs_tty old, new;
+  struct emacs_tty etty;
 
   /* Check, whether we need to suppress echoing.  */
   if (CHARACTERP (Vread_hide_char))
@@ -238,13 +239,8 @@
   /* Manipulate tty.  */
   if (hide_char)
     {
-      emacs_get_tty (fileno (stdin), &old);
-      new = old;
-#ifndef WINDOWSNT
-      new.main.c_lflag &= ~ICANON;     /* Disable buffering */
-      new.main.c_lflag &= ~ECHO;       /* Disable echoing */
-#endif
-      emacs_set_tty (fileno (stdin), &new, 0);
+      emacs_get_tty (fileno (stdin), &etty);
+      suppress_echo_on_tty (fileno (stdin));
     }
 
   fprintf (stdout, "%s", SDATA (prompt));
@@ -281,7 +277,7 @@
   if (hide_char)
     {
       fprintf (stdout, "\n");
-      emacs_set_tty (fileno (stdin), &old, 0);
+      emacs_set_tty (fileno (stdin), &etty, 0);
     }
 
   if (len || c == '\n')

=== modified file 'src/sysdep.c'
--- a/src/sysdep.c      2014-07-11 09:09:54 +0000
+++ b/src/sysdep.c      2014-07-11 12:35:23 +0000
@@ -1140,6 +1140,21 @@
   return 0;
 #endif /* DOS_NT */
 }
+
+/* Discard echoing.  */
+
+void
+suppress_echo_on_tty (int fd)
+{
+  struct emacs_tty etty;
+
+  emacs_get_tty (fd, &etty);
+#ifndef WINDOWSNT
+  etty.main.c_lflag &= ~ICANON;        /* Disable buffering */
+  etty.main.c_lflag &= ~ECHO;  /* Disable echoing */
+#endif /* ! WINDOWSNT */
+  emacs_set_tty (fd, &etty, 0);
+}
 
 /* Get terminal size from system.
    Store number of lines into *HEIGHTP and width into *WIDTHP.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]