corrections by Bob Corbett. DLW
[unix-history] / usr / src / usr.bin / f77 / libF77 / s_paus.c
CommitLineData
936699f8
DW
1/*
2 * "@(#)s_paus.c 1.1"
3 */
4
5#include <stdio.h>
6#define PAUSESIG 15
7
8
9s_paus(s, n)
10char *s;
11long int n;
12{
13int i;
14int waitpause();
15
16fprintf(stderr, "PAUSE: ");
17if(n > 0)
18 {
19 for(i = 0; i<n ; ++i)
20 putc(*s++, stderr);
21 putc('\n', stderr);
22 }
23if( isatty(fileno(stdin)) )
24 {
25 fprintf(stderr, "To resume execution, type: go\nAny other input will terminate the program.\n");
26 if( getchar()!='g' || getchar()!='o' || getchar()!='\n' )
27 {
28 fprintf(stderr, "STOP\n");
29 f_exit();
30 _cleanup();
31 exit(0);
32 }
33 }
34else
35 {
36 fprintf(stderr, "To resume execution, type: kill -%d %d\n",
37 PAUSESIG, getpid() );
38 signal(PAUSESIG, waitpause);
39 pause();
40 }
41fprintf(stderr, "Execution resumed after PAUSE.\n");
42}
43
44
45
46
47
48static waitpause()
49{
50return;
51}