xref: /original-bsd/usr.bin/f77/libF77/s_paus.c (revision 0f30d223)
1 /*
2  *	"@(#)s_paus.c	1.1"
3  */
4 
5 #include <stdio.h>
6 #define PAUSESIG 15
7 
8 
9 s_paus(s, n)
10 char *s;
11 long int n;
12 {
13 int i;
14 int waitpause();
15 
16 fprintf(stderr, "PAUSE: ");
17 if(n > 0)
18 	{
19 	for(i = 0; i<n ; ++i)
20 		putc(*s++, stderr);
21 	putc('\n', stderr);
22 	}
23 if( 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 	}
34 else
35 	{
36 	fprintf(stderr, "To resume execution, type:    kill -%d %d\n",
37 		PAUSESIG, getpid() );
38 	signal(PAUSESIG, waitpause);
39 	pause();
40 	}
41 fprintf(stderr, "Execution resumed after PAUSE.\n");
42 }
43 
44 
45 
46 
47 
48 static waitpause()
49 {
50 return;
51 }
52