changeset 104816:4129eea9d003

(Fsend_string_to_terminal): Make it work again on the initial terminal as well.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 03 Sep 2009 00:36:11 +0000
parents b3c991e42448
children 90d1a4410a0c
files src/ChangeLog src/dispnew.c
diffstat 2 files changed, 28 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Wed Sep 02 17:03:20 2009 +0000
+++ b/src/ChangeLog	Thu Sep 03 00:36:11 2009 +0000
@@ -1,7 +1,12 @@
+2009-09-03  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* dispnew.c (Fsend_string_to_terminal): Make it work again on the
+	initial terminal as well.
+
 2009-09-02  Jan Djärv  <jan.h.d@swipnet.se>
 
 	* xterm.h: Rename x_non_menubar_window_to_frame to
-	x_menubar_window_to_frame
+	x_menubar_window_to_frame.
 
 	* xterm.c: Remove declarations also in xterm.h
 	(XTmouse_position): Do not return valid positions
--- a/src/dispnew.c	Wed Sep 02 17:03:20 2009 +0000
+++ b/src/dispnew.c	Thu Sep 03 00:36:11 2009 +0000
@@ -6475,8 +6475,8 @@
      Lisp_Object string;
      Lisp_Object terminal;
 {
-  struct terminal *t = get_tty_terminal (terminal, 1);
-  struct tty_display_info *tty;
+  struct terminal *t = get_terminal (terminal, 1);
+  FILE *out;
 
   /* ??? Perhaps we should do something special for multibyte strings here.  */
   CHECK_STRING (string);
@@ -6485,18 +6485,26 @@
   if (!t)
     error ("Unknown terminal device");
 
-  tty = t->display_info.tty;
-
-  if (! tty->output)
-    error ("Terminal is currently suspended");
-
-  if (tty->termscript)
-    {
-      fwrite (SDATA (string), 1, SBYTES (string), tty->termscript);
-      fflush (tty->termscript);
-    }
-  fwrite (SDATA (string), 1, SBYTES (string), tty->output);
-  fflush (tty->output);
+  if (t->type == output_initial)
+    out = stdout;
+  else if (t->type != output_termcap && t->type != output_msdos_raw)
+    error ("Device %d is not a termcap terminal device", t->id);
+  else
+    {
+      struct tty_display_info *tty = t->display_info.tty;
+
+      if (! tty->output)
+	error ("Terminal is currently suspended");
+
+      if (tty->termscript)
+	{
+	  fwrite (SDATA (string), 1, SBYTES (string), tty->termscript);
+	  fflush (tty->termscript);
+	}
+      out = tty->output;
+    }
+  fwrite (SDATA (string), 1, SBYTES (string), out);
+  fflush (out);
   UNBLOCK_INPUT;
   return Qnil;
 }