update.
[chise/xemacs-chise.git.1] / src / signal.c
index 11ede72..4ff3d1a 100644 (file)
@@ -31,10 +31,7 @@ Boston, MA 02111-1307, USA.  */
 #include "syssignal.h"
 #include "systime.h"
 
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <errno.h>
+#include "sysfile.h"
 
 /* Set to 1 when a quit-check signal (either a SIGIO interrupt or
    the asynch. timeout for poll-for-quit) occurs.  The QUITP
@@ -105,7 +102,7 @@ set_one_shot_timer (EMACS_TIME interval)
   struct itimerval it;
   it.it_value = interval;
   EMACS_SET_SECS_USECS (it.it_interval, 0, 0);
-  setitimer (ITIMER_REAL, &it, 0);
+  qxe_setitimer (ITIMER_REAL, &it, 0);
 #else
   int secs;
   EMACS_TIME_TO_INT (interval, secs);
@@ -180,7 +177,7 @@ alarm_signal (int signo)
         it needs to stay the way it is. */
       quit_check_signal_happened = 1;
 
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
       can_break_system_calls = 0;
 #else
       /* can_break_system_calls is set when we want to break out of
@@ -330,6 +327,7 @@ handle_alarm_going_off (void)
 }
 
 #ifdef HAVE_SETITIMER
+
 unsigned int
 alarm (unsigned int howlong)
 {
@@ -343,19 +341,34 @@ alarm (unsigned int howlong)
   new_it.it_value.tv_usec = 0;
   new_it.it_interval.tv_sec = 0;
   new_it.it_interval.tv_usec = 0;
-  setitimer (ITIMER_REAL, &new_it, &old_it);
+  qxe_setitimer (ITIMER_REAL, &new_it, &old_it);
 
   /* Never return zero if there was a timer outstanding. */
   return old_it.it_value.tv_sec + (old_it.it_value.tv_usec > 0 ? 1 : 0);
 }
+
+int
+qxe_setitimer (int kind, const struct itimerval *itnew,
+              struct itimerval *itold)
+{
+#if defined (WIN32_NATIVE) || defined (CYGWIN)
+  /* setitimer() does not exist on native MS Windows, and appears broken
+     on Cygwin.  See win32.c. */
+  return mswindows_setitimer (kind, itnew, itold);
+#else
+  return setitimer (kind, itnew, itold);
 #endif
+}
+
+#endif /* HAVE_SETITIMER */
+
 
 DEFUN ("waiting-for-user-input-p", Fwaiting_for_user_input_p, 0, 0, 0, /*
 Return non-nil if XEmacs is waiting for input from the user.
 This is intended for use by asynchronous timeout callbacks and by
 asynchronous process output filters and sentinels (not yet implemented
 in XEmacs).  It will always be nil if XEmacs is not inside of
-an asynchronout timeout or process callback.
+an asynchronous timeout or process callback.
 */
        ())
 {
@@ -420,19 +433,16 @@ interrupt_signal (int sig)
       stdout_out ("you can continue or abort.\n");
 #endif /* not SIGTSTP */
       stdout_out ("Auto-save? (y or n) ");
-      fflush (stdout);
       if (((c = getc (stdin)) & ~040) == 'Y')
        Fdo_auto_save (Qnil, Qnil);
       while (c != '\n')
         c = getc (stdin);
       stdout_out ("Abort (and dump core)? (y or n) ");
-      fflush (stdout);
       if (((c = getc (stdin)) & ~040) == 'Y')
-       abort ();
+       ABORT ();
       while (c != '\n')
         c = getc (stdin);
       stdout_out ("Continuing...\n");
-      fflush (stdout);
       reinit_initial_console ();
       MARK_FRAME_CHANGED (XFRAME (DEVICE_SELECTED_FRAME
                                  (XDEVICE (CONSOLE_SELECTED_DEVICE