|
|
1.1 root 1: /* naptest.c */
2:
3: #include <signal.h>
4:
5: int bleep;
6:
7: void
8: intHandler()
9: {
10: bleep = 1;
11: }
12:
13: main(argc, argv)
14: int argc;
15: char * argv[];
16: {
17: int naptime, result;
18:
19: if (argc <= 1)
20: printf("Usage: %s <nap-interval-in-milliseconds>\n", argv[0]);
21: else {
22: sigset(SIGINT, intHandler);
23: naptime = atoi(argv[1]);
24: printf("Napping for %d msec.\n", naptime);
25: result = nap(naptime);
26: if (bleep)
27: printf("SIGINT received\n");
28: if (result == -1)
29: perror("Nap test error");
30: else
31: printf("Nap over. Slept for %d msec.\n", result);
32: }
33: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.