1: #include "stdio.h"
2: #include "lrndef"
3: #include "lrnref"
4: #include "signal.h"
5:
6: main(argc,argv)
7: char *argv[];
8: {
9: extern hangup(), intrpt();
10: extern char * getlogin();
11: extern char _sobuf;
12: char *malloc();
13:
14: speed = 0;
15: more = 1;
16: pwline = getlogin();
17: setbuf(stdout, _sobuf);
18: selsub(argc, argv);
19: signal(SIGHUP, hangup);
20: signal(SIGINT, intrpt);
21: while (more) {
22: selunit();
23: dounit();
24: whatnow();
25: }
26: wrapup(0);
27: }
28:
29: hangup()
30: {
31: wrapup(1);
32: }
33:
34: intrpt()
35: {
36: char response[20], *p;
37:
38: signal(SIGINT, hangup);
39: write(2, "\nInterrupt.\nWant to go on? ", 28);
40: p = response;
41: *p = 'n';
42: while (read(0, p, 1) == 1 && *p != '\n')
43: p++;
44: if (response[0] != 'y')
45: wrapup(1);
46: ungetc('\n', stdin);
47: signal(SIGINT, intrpt);
48: }
Defined functions
main
defined in line
6;
never used