# 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
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.
-
-/* alarm.c -- seligman 6/92 */
+/* alarm.c -- wakeup calls */
/*
-- Implementation of alarm.h
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:
*/
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*/
-
}
}
-#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
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)
{
static void
suspend (int sig)
{
- signal (SIGTSTP, suspend);
+ sigset (SIGTSTP, suspend);
cleanup ();
kill (getpid (), SIGSTOP);
if (termopen)