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