From: Eric S. Raymond Date: Mon, 24 Jan 2005 15:41:42 +0000 (+0000) Subject: Remove BSD signal support. X-Git-Tag: 2.0~17 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=2c70b55096205713b04e69db1b7cbe4256840679;p=morse-classic.git Remove BSD signal support. --- diff --git a/Makefile b/Makefile index 6a17305..45fdfd3 100644 --- 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 70b499c..4755de3 100644 --- a/README +++ b/README @@ -100,5 +100,5 @@ Since January 2005, maintained by: Eric S. Raymond * 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 16a9ad2..25eb9cf 100644 --- 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 7962b41..32c3d08 100644 --- 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)