Commit | Line | Data |
---|---|---|
936699f8 | 1 | /* |
a6c6a0df RE |
2 | * Copyright (c) 1980 Regents of the University of California. |
3 | * All rights reserved. The Berkeley software License Agreement | |
4 | * specifies the terms and conditions for redistribution. | |
5 | * | |
6 | * @(#)s_paus.c 5.1 %G% | |
936699f8 DW |
7 | */ |
8 | ||
9 | #include <stdio.h> | |
10 | #define PAUSESIG 15 | |
11 | ||
12 | ||
13 | s_paus(s, n) | |
14 | char *s; | |
15 | long int n; | |
16 | { | |
17 | int i; | |
18 | int waitpause(); | |
19 | ||
20 | fprintf(stderr, "PAUSE: "); | |
21 | if(n > 0) | |
22 | { | |
23 | for(i = 0; i<n ; ++i) | |
24 | putc(*s++, stderr); | |
25 | putc('\n', stderr); | |
26 | } | |
27 | if( isatty(fileno(stdin)) ) | |
28 | { | |
29 | fprintf(stderr, "To resume execution, type: go\nAny other input will terminate the program.\n"); | |
30 | if( getchar()!='g' || getchar()!='o' || getchar()!='\n' ) | |
31 | { | |
32 | fprintf(stderr, "STOP\n"); | |
33 | f_exit(); | |
34 | _cleanup(); | |
35 | exit(0); | |
36 | } | |
37 | } | |
38 | else | |
39 | { | |
40 | fprintf(stderr, "To resume execution, type: kill -%d %d\n", | |
41 | PAUSESIG, getpid() ); | |
42 | signal(PAUSESIG, waitpause); | |
43 | pause(); | |
44 | } | |
45 | fprintf(stderr, "Execution resumed after PAUSE.\n"); | |
46 | } | |
47 | ||
48 | ||
49 | ||
50 | ||
51 | ||
52 | static waitpause() | |
53 | { | |
54 | return; | |
55 | } |