Function: send-string-to-terminal
send-string-to-terminal is a function defined in dispnew.c.
Signature
(send-string-to-terminal STRING &optional TERMINAL)
Documentation
Send STRING to the terminal without alteration.
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. In batch mode, STRING is sent to stdout when TERMINAL is nil.
Probably introduced at or before Emacs version 16.
Source Code
// Defined in /usr/src/emacs/src/dispnew.c
{
struct terminal *t = decode_live_terminal (terminal);
FILE *out;
/* ??? Perhaps we should do something special for multibyte strings here. */
CHECK_STRING (string);
block_input ();
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;
}
/* STRING might be very long, in which case fwrite could be
interrupted by SIGIO. So we temporarily block SIGIO. */
unrequest_sigio ();
fwrite (SDATA (string), 1, SBYTES (string), out);
fflush (out);
request_sigio ();
unblock_input ();
return Qnil;
}