Commit | Line | Data |
---|---|---|
15eea6e6 BJ |
1 | #include <stdio.h> |
2 | #define PAUSESIG 15 | |
3 | ||
4 | ||
5 | s_paus(s, n) | |
6 | char *s; | |
7 | long int n; | |
8 | { | |
9 | int i; | |
10 | int waitpause(); | |
11 | ||
12 | fprintf(stderr, "PAUSE "); | |
13 | if(n > 0) | |
14 | for(i = 0; i<n ; ++i) | |
15 | putc(*s++, stderr); | |
16 | fprintf(stderr, " statement executed\n"); | |
17 | if( isatty(fileno(stdin)) ) | |
18 | { | |
19 | fprintf(stderr, "To resume execution, type go. Any other input will terminate job.\n"); | |
20 | if( getchar()!='g' || getchar()!='o' || getchar()!='\n' ) | |
21 | { | |
22 | fprintf(stderr, "STOP\n"); | |
23 | f_exit(); | |
24 | exit(0); | |
25 | } | |
26 | } | |
27 | else | |
28 | { | |
29 | fprintf(stderr, "To resume execution, execute a kill -%d %d command\n", | |
30 | PAUSESIG, getpid() ); | |
31 | signal(PAUSESIG, waitpause); | |
32 | pause(); | |
33 | } | |
34 | fprintf(stderr, "Execution resumes after PAUSE.\n"); | |
35 | } | |
36 | ||
37 | ||
38 | ||
39 | ||
40 | ||
41 | static waitpause() | |
42 | { | |
43 | return; | |
44 | } |