changeset 97653:8e2483da8823

Include frame.h before termhooks.h. (dos_cleanup): Use CURTTY ()->termscript instead of a global variable termscript.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 23 Aug 2008 16:50:44 +0000
parents d711e8ee1f6b
children 912b1321ba0d
files src/dosfns.c
diffstat 1 files changed, 16 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/dosfns.c	Sat Aug 23 16:50:02 2008 +0000
+++ b/src/dosfns.c	Sat Aug 23 16:50:44 2008 +0000
@@ -29,8 +29,8 @@
 #include "lisp.h"
 #include "buffer.h"
 #include "termchar.h"
+#include "frame.h"
 #include "termhooks.h"
-#include "frame.h"
 #include "blockinput.h"
 #include "window.h"
 #include "dosfns.h"
@@ -536,15 +536,27 @@
 void
 dos_cleanup (void)
 {
+  struct tty_display_info *tty;
+
 #ifndef HAVE_X_WINDOWS
   restore_parent_vm_title ();
 #endif
   /* Make sure the termscript file is committed, in case we are
      crashing and some vital info was written there.  */
-  if (termscript)
+  if (FRAMEP (selected_frame))
     {
-      fflush (termscript);
-      fsync (fileno (termscript));
+      struct frame *sf = XFRAME (selected_frame);
+
+      if (FRAME_LIVE_P (sf)
+	  && (FRAME_MSDOS_P (sf) || FRAME_TERMCAP_P (sf)))
+	{
+	  tty = CURTTY ();
+	  if (tty->termscript)
+	    {
+	      fflush (tty->termscript);
+	      fsync (fileno (tty->termscript));
+	    }
+	}
     }
 }