]> thyrsus.com Git - morse-classic.git/commitdiff
Remove BSD signal support.
authorEric S. Raymond <esr@thyrsus.com>
Mon, 24 Jan 2005 15:41:42 +0000 (15:41 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Mon, 24 Jan 2005 15:41:42 +0000 (15:41 +0000)
Makefile
README
alarm.c
morse.c

index 6a17305d901f9017bee36df75cef3774aa1774df..45fdfd394dac92c8cf80fb3dfe6edcdf44dd7701 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -34,9 +34,6 @@ DEVICE = OSS
 # For alternate random number generator, add either -DUSELRAND for lrand48(),
 #   or -DUSERAND for (ugh) rand(). Default is -DUSERANDOM for random().
 #
-# Define BSDSIGS or POSIXSIGS, depending on what kind of signals you
-#   have. "Old-style" signals are not currently supported. Default is BSDSIGS.
-#
 # If the same speaker making the morse code beeps will also make ^G beeps
 #   (which occur when you get a letter wrong), you may want to #define
 #   ERROR_VOLUME to be 1.; this will cause the ^G beeps to be made using
diff --git a/README b/README
index 70b499c83a4148059235c5762f0aac74747d6c18..4755de3cd2a77dee861f32e9ae6a8b9c4dff218c 100644 (file)
--- a/README
+++ b/README
@@ -100,5 +100,5 @@ Since January 2005, maintained by:
   Eric S. Raymond <esr@thyrsus.com>
   * Turned the old compile-time options for expanding the test set into
     runtime options -A, -B, -S, -X, -x.
+  * Wrote the manual page.
   * Updated all code to use ANSI prototypes.
-
diff --git a/alarm.c b/alarm.c
index 16a9ad2900502525295651b21ba9e7417187b502..25eb9cfe16096dd4ef4be9b89b0d07021db02482 100644 (file)
--- a/alarm.c
+++ b/alarm.c
@@ -1,4 +1,4 @@
-/* alarm.c -- seligman 6/92 */
+/* alarm.c -- wakeup calls */
 
 /*
 -- Implementation of alarm.h
@@ -13,32 +13,14 @@ static int alarmPending = 0;  /* Nonzero when the alarm is set. */
 static void ualarm();
 static void AlarmHandler();
 
-/* Default BSDSIGS for backwards compatibility of makefile */
-#ifndef BSDSIGS
-#ifndef POSIXSIGS
-#ifndef OTHERSIGS
-#define BSDSIGS
-#endif
-#endif
-#endif
-
 void AlarmSet(time)
     int time;
 {
     alarmPending = 1;
-#ifdef BSDSIGS
-    signal(SIGALRM, AlarmHandler);
-#else
-#ifdef POSIXSIGS
     sigset(SIGALRM, AlarmHandler);
-#else
-    /* You're on your own... */
-# endif /*POSIXSIGS*/
-#endif /*BSDSIGS*/
     ualarm(1000 * time, 0);
 }
 
-
 /*
 -- If an alarm signal is lurking (due to a prior call to SetAlarm), then
 -- pause until it arrives.  This procedure could have simply been written:
@@ -47,22 +29,10 @@ void AlarmSet(time)
 */
 void AlarmWait()
 {
-#ifdef BSDSIGS
-    long savemask = sigblock(sigmask(SIGALRM));
-    if (alarmPending)
-        sigpause(savemask);
-    sigsetmask(savemask);
-#else
-#ifdef POSIXSIGS
     sighold(SIGALRM);
     if (alarmPending)
       sigpause(SIGALRM);
     sigrelse(SIGALRM);
-#else
-    /* You're on your own */
-#endif /*POSIXSIGS*/
-#endif /*BSDSIGS*/
-
 }
 
 
@@ -82,24 +52,7 @@ static void ualarm(us)
 }
 
 
-#ifdef __hpux
-
-static void AlarmHandler(sig, code, scp)
-    int sig;
-    int code;
-    struct sigcontext *scp;
-{
-    alarmPending = 0;
-    /* Prevent alarm signal from interrupting any pending read. */
-    if (scp->sc_syscall == SYS_READ)
-       scp->sc_syscall_action = SIG_RESTART;
-}
-
-#else
-
 static void AlarmHandler()
 {
     alarmPending = 0;
 }
-
-#endif __hpux
diff --git a/morse.c b/morse.c
index 7962b41c36f74f62ee9f251f5d4f9aa02cf63a30..32c3d08c7f5bbbe0959c94921bd7589ccc59ca25 100644 (file)
--- a/morse.c
+++ b/morse.c
@@ -730,10 +730,10 @@ extern time_t   time ();
 
     time(&starttime);
 
-    signal (SIGINT, die);
-    signal (SIGTERM, die);
-    signal (SIGQUIT, die);
-    signal (SIGTSTP, suspend);
+    sigset (SIGINT, die);
+    sigset (SIGTERM, die);
+    sigset (SIGQUIT, die);
+    sigset (SIGTSTP, suspend);
 
     if (testing || typeaway)
     {
@@ -1926,7 +1926,7 @@ cleanup (void)
 static void
 suspend (int sig)
 {
-    signal (SIGTSTP, suspend);
+    sigset (SIGTSTP, suspend);
     cleanup ();
     kill (getpid (), SIGSTOP);
     if (termopen)