|
|
1.1 root 1: /*
2: char 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:
19: long alarm_(sec, proc)
20: long *sec;
21: int (* 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: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.