X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/708e05dc7a8fd26530bb7daf9025bc53a0985453..659f64e909614e62b939087c625fd9abfbcf7073:/src/dispnew.c diff --git a/src/dispnew.c b/src/dispnew.c index da0deaa90b..ba50b00198 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -22,6 +22,7 @@ along with GNU Emacs. If not, see . */ #include #include #include +#include #ifdef HAVE_UNISTD_H #include @@ -6469,14 +6470,15 @@ DEFUN ("send-string-to-terminal", Fsend_string_to_terminal, Control characters in STRING will have terminal-dependent effects. Optional parameter TERMINAL specifies the tty terminal device to use. -It may be a terminal object, a frame, or nil for the terminal used by the -currently selected frame. */) +It may be a terminal object, a frame, or nil for the terminal used by +the currently selected frame. In batch mode, STRING is sent to stdout +when TERMINAL is nil. */) (string, terminal) 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 +6487,26 @@ currently selected frame. */) if (!t) error ("Unknown terminal device"); - tty = t->display_info.tty; + 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->output) + error ("Terminal is currently suspended"); - if (tty->termscript) - { - fwrite (SDATA (string), 1, SBYTES (string), tty->termscript); - fflush (tty->termscript); + if (tty->termscript) + { + fwrite (SDATA (string), 1, SBYTES (string), tty->termscript); + fflush (tty->termscript); + } + out = tty->output; } - fwrite (SDATA (string), 1, SBYTES (string), tty->output); - fflush (tty->output); + fwrite (SDATA (string), 1, SBYTES (string), out); + fflush (out); UNBLOCK_INPUT; return Qnil; } @@ -6882,7 +6892,7 @@ init_display () #endif ) { - Vinitial_window_system = intern ("x"); + Vinitial_window_system = Qx; #ifdef HAVE_X11 Vwindow_system_version = make_number (11); #endif @@ -6900,7 +6910,7 @@ init_display () #ifdef HAVE_NTGUI if (!inhibit_window_system) { - Vinitial_window_system = intern ("w32"); + Vinitial_window_system = Qw32; Vwindow_system_version = make_number (1); adjust_frame_glyphs_initially (); return; @@ -6914,7 +6924,7 @@ init_display () #endif ) { - Vinitial_window_system = intern("ns"); + Vinitial_window_system = Qns; Vwindow_system_version = make_number(10); adjust_frame_glyphs_initially (); return;