diff src/term.c @ 53340:db645482d6bc

Trivial changes git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-18
author Karoly Lorentey <lorentey@elte.hu>
date Sun, 28 Dec 2003 22:28:52 +0000
parents fe9b37bee5f7
children d4e6a050c9b1
line wrap: on
line diff
--- a/src/term.c	Sun Dec 28 16:05:28 2003 +0000
+++ b/src/term.c	Sun Dec 28 22:28:52 2003 +0000
@@ -917,18 +917,19 @@
 {
   char *buf;
   struct glyph *glyph = NULL;
-  struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
+  struct frame *f;
   struct tty_output *tty;
   
   if (len <= 0)
     return;
 
-  if (insert_glyphs_hook  && ! FRAME_TERMCAP_P (f))
+  if (insert_glyphs_hook)
     {
       (*insert_glyphs_hook) (start, len);
       return;
     }
 
+  f = (updating_frame ? updating_frame : XFRAME (selected_frame));  
   tty = FRAME_TTY (f);
 
   if (tty->TS_ins_multi_chars)
@@ -2156,11 +2157,9 @@
       tty_list = tty;
     }
 
-  if (tty->Wcm)
-    Wcm_clear (tty);
-  else
-    tty->Wcm = (struct cm *) xmalloc (sizeof (struct cm));
-  
+  if (! tty->Wcm)
+      tty->Wcm = (struct cm *) xmalloc (sizeof (struct cm));
+
   if (name)
     {
       int fd;
@@ -2676,24 +2675,6 @@
 {
   Lisp_Object tail, frame;
 
-  FOR_EACH_FRAME (tail, frame)
-    {
-      struct frame *f = XFRAME (frame);
-      if (FRAME_LIVE_P (f) && FRAME_TTY (f) == tty)
-        {
-          Fdelete_frame (frame, Qt);
-          f->output_data.tty = 0;
-        }
-    }
-  
-  /* Close the terminal and free memory. */
-  delete_tty_1 (tty);
-}
-
-static void
-delete_tty_1 (struct tty_output *tty)
-{
-
   if (tty == tty_list)
     tty_list = tty->next;
   else
@@ -2709,13 +2690,25 @@
       p->next = p->next->next;
     }
 
+  FOR_EACH_FRAME (tail, frame)
+    {
+      struct frame *f = XFRAME (frame);
+      if (FRAME_LIVE_P (f) && FRAME_TTY (f) == tty)
+        {
+          Fdelete_frame (frame, Qt);
+          f->output_data.tty = 0;
+        }
+    }
+  
   /* This hangs. */
-  /*  reset_sys_modes (tty); */
-
-    if (tty->name)
+  /*
+  reset_sys_modes (tty);
+
+  if (tty->name)
     xfree (tty->name);
   if (tty->type)
     xfree (tty->type);
+  */
   if (tty->input)
     fclose (tty->input);
   if (tty->output)
@@ -2723,9 +2716,19 @@
   if (tty->termscript)
     fclose (tty->termscript);
 
+  tty->input = 0;
+  tty->output = 0;
+  tty->termscript = 0;
+  
   /*
   if (tty->old_tty)
-    xfree (tty->old_tty);
+    {
+      memset (tty->old_tty, 'Z', sizeof (struct emacs_tty));
+      tty->old_tty = 0;
+    }
+  
+    
+    /*    xfree (tty->old_tty);
 
     if (tty->Wcm)
     {