aboutsummaryrefslogtreecommitdiffstats
path: root/src/term.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c47
1 files changed, 24 insertions, 23 deletions
diff --git a/src/term.c b/src/term.c
index 8770aff8a92..3d7f4ada0b9 100644
--- a/src/term.c
+++ b/src/term.c
@@ -22,7 +22,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
22#include <config.h> 22#include <config.h>
23#include <errno.h> 23#include <errno.h>
24#include <fcntl.h> 24#include <fcntl.h>
25#include <stdio.h>
26#include <stdlib.h> 25#include <stdlib.h>
27#include <sys/file.h> 26#include <sys/file.h>
28#include <sys/time.h> 27#include <sys/time.h>
@@ -45,6 +44,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
45#include "keymap.h" 44#include "keymap.h"
46#include "blockinput.h" 45#include "blockinput.h"
47#include "syssignal.h" 46#include "syssignal.h"
47#include "sysstdio.h"
48#ifdef MSDOS 48#ifdef MSDOS
49#include "msdos.h" 49#include "msdos.h"
50static int been_here = -1; 50static int been_here = -1;
@@ -146,7 +146,7 @@ tty_ring_bell (struct frame *f)
146 OUTPUT (tty, (tty->TS_visible_bell && visible_bell 146 OUTPUT (tty, (tty->TS_visible_bell && visible_bell
147 ? tty->TS_visible_bell 147 ? tty->TS_visible_bell
148 : tty->TS_bell)); 148 : tty->TS_bell));
149 fflush (tty->output); 149 fflush_unlocked (tty->output);
150 } 150 }
151} 151}
152 152
@@ -167,9 +167,10 @@ tty_send_additional_strings (struct terminal *terminal, Lisp_Object sym)
167 Lisp_Object string = XCAR (extra_codes); 167 Lisp_Object string = XCAR (extra_codes);
168 if (STRINGP (string)) 168 if (STRINGP (string))
169 { 169 {
170 fwrite (SDATA (string), 1, SBYTES (string), tty->output); 170 fwrite_unlocked (SDATA (string), 1, SBYTES (string), tty->output);
171 if (tty->termscript) 171 if (tty->termscript)
172 fwrite (SDATA (string), 1, SBYTES (string), tty->termscript); 172 fwrite_unlocked (SDATA (string), 1, SBYTES (string),
173 tty->termscript);
173 } 174 }
174 } 175 }
175} 176}
@@ -197,7 +198,7 @@ tty_set_terminal_modes (struct terminal *terminal)
197 OUTPUT_IF (tty, tty->TS_keypad_mode); 198 OUTPUT_IF (tty, tty->TS_keypad_mode);
198 losecursor (tty); 199 losecursor (tty);
199 tty_send_additional_strings (terminal, Qtty_mode_set_strings); 200 tty_send_additional_strings (terminal, Qtty_mode_set_strings);
200 fflush (tty->output); 201 fflush_unlocked (tty->output);
201 } 202 }
202} 203}
203 204
@@ -220,7 +221,7 @@ tty_reset_terminal_modes (struct terminal *terminal)
220 /* Output raw CR so kernel can track the cursor hpos. */ 221 /* Output raw CR so kernel can track the cursor hpos. */
221 current_tty = tty; 222 current_tty = tty;
222 cmputc ('\r'); 223 cmputc ('\r');
223 fflush (tty->output); 224 fflush_unlocked (tty->output);
224 } 225 }
225} 226}
226 227
@@ -235,7 +236,7 @@ tty_update_end (struct frame *f)
235 tty_show_cursor (tty); 236 tty_show_cursor (tty);
236 tty_turn_off_insert (tty); 237 tty_turn_off_insert (tty);
237 tty_background_highlight (tty); 238 tty_background_highlight (tty);
238 fflush (tty->output); 239 fflush_unlocked (tty->output);
239} 240}
240 241
241/* The implementation of set_terminal_window for termcap frames. */ 242/* The implementation of set_terminal_window for termcap frames. */
@@ -497,8 +498,8 @@ tty_clear_end_of_line (struct frame *f, int first_unused_hpos)
497 for (i = curX (tty); i < first_unused_hpos; i++) 498 for (i = curX (tty); i < first_unused_hpos; i++)
498 { 499 {
499 if (tty->termscript) 500 if (tty->termscript)
500 fputc (' ', tty->termscript); 501 fputc_unlocked (' ', tty->termscript);
501 fputc (' ', tty->output); 502 fputc_unlocked (' ', tty->output);
502 } 503 }
503 cmplus (tty, first_unused_hpos - curX (tty)); 504 cmplus (tty, first_unused_hpos - curX (tty));
504 } 505 }
@@ -771,11 +772,11 @@ tty_write_glyphs (struct frame *f, struct glyph *string, int len)
771 if (coding->produced > 0) 772 if (coding->produced > 0)
772 { 773 {
773 block_input (); 774 block_input ();
774 fwrite (conversion_buffer, 1, coding->produced, tty->output); 775 fwrite_unlocked (conversion_buffer, 1, coding->produced, tty->output);
775 if (ferror (tty->output)) 776 clearerr_unlocked (tty->output);
776 clearerr (tty->output);
777 if (tty->termscript) 777 if (tty->termscript)
778 fwrite (conversion_buffer, 1, coding->produced, tty->termscript); 778 fwrite_unlocked (conversion_buffer, 1, coding->produced,
779 tty->termscript);
779 unblock_input (); 780 unblock_input ();
780 } 781 }
781 string += n; 782 string += n;
@@ -832,11 +833,11 @@ tty_write_glyphs_with_face (register struct frame *f, register struct glyph *str
832 if (coding->produced > 0) 833 if (coding->produced > 0)
833 { 834 {
834 block_input (); 835 block_input ();
835 fwrite (conversion_buffer, 1, coding->produced, tty->output); 836 fwrite_unlocked (conversion_buffer, 1, coding->produced, tty->output);
836 if (ferror (tty->output)) 837 clearerr_unlocked (tty->output);
837 clearerr (tty->output);
838 if (tty->termscript) 838 if (tty->termscript)
839 fwrite (conversion_buffer, 1, coding->produced, tty->termscript); 839 fwrite_unlocked (conversion_buffer, 1, coding->produced,
840 tty->termscript);
840 unblock_input (); 841 unblock_input ();
841 } 842 }
842 843
@@ -918,11 +919,11 @@ tty_insert_glyphs (struct frame *f, struct glyph *start, int len)
918 if (coding->produced > 0) 919 if (coding->produced > 0)
919 { 920 {
920 block_input (); 921 block_input ();
921 fwrite (conversion_buffer, 1, coding->produced, tty->output); 922 fwrite_unlocked (conversion_buffer, 1, coding->produced, tty->output);
922 if (ferror (tty->output)) 923 clearerr_unlocked (tty->output);
923 clearerr (tty->output);
924 if (tty->termscript) 924 if (tty->termscript)
925 fwrite (conversion_buffer, 1, coding->produced, tty->termscript); 925 fwrite_unlocked (conversion_buffer, 1, coding->produced,
926 tty->termscript);
926 unblock_input (); 927 unblock_input ();
927 } 928 }
928 929
@@ -3327,7 +3328,7 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx,
3327 which calls tty_show_cursor. Re-hide it, so it doesn't show 3328 which calls tty_show_cursor. Re-hide it, so it doesn't show
3328 through the menus. */ 3329 through the menus. */
3329 tty_hide_cursor (tty); 3330 tty_hide_cursor (tty);
3330 fflush (tty->output); 3331 fflush_unlocked (tty->output);
3331 } 3332 }
3332 3333
3333 sf->mouse_moved = 0; 3334 sf->mouse_moved = 0;
@@ -3335,7 +3336,7 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx,
3335 while (statecount--) 3336 while (statecount--)
3336 free_saved_screen (state[statecount].screen_behind); 3337 free_saved_screen (state[statecount].screen_behind);
3337 tty_show_cursor (tty); /* Turn cursor back on. */ 3338 tty_show_cursor (tty); /* Turn cursor back on. */
3338 fflush (tty->output); 3339 fflush_unlocked (tty->output);
3339 3340
3340/* Clean up any mouse events that are waiting inside Emacs event queue. 3341/* Clean up any mouse events that are waiting inside Emacs event queue.
3341 These events are likely to be generated before the menu was even 3342 These events are likely to be generated before the menu was even