date and time created 82/01/07 12:19:43 by dlw
[unix-history] / usr / src / usr.bin / f77 / libU77 / alarm_.c
CommitLineData
205b4dea
DW
1/*
2char id_alarm[] = "@(#)alarm_.c 1.1";
3 *
4 * set an alarm time, arrange for user specified action, and return.
5 *
6 * calling sequence:
7 * integer flag
8 * external alfunc
9 * lastiv = alarm (intval, alfunc)
10 * where:
11 * intval = the alarm interval in seconds; 0 turns off the alarm.
12 * alfunc = the function to be called after the alarm interval,
13 *
14 * The returned value will be the time remaining on the last alarm.
15 */
16
17#include <signal.h>
18
19long alarm_(sec, proc)
20long *sec;
21int (* proc)();
22{
23 register long lt;
24
25 lt = alarm(1000); /* time to maneuver */
26
27 if (*sec)
28 signal(SIGALRM, proc);
29
30 alarm(*sec);
31 return(lt);
32}