xref: /csrg-svn/usr.bin/f77/libF77/s_paus.c (revision 47940)
1*47940Sbostic /*-
2*47940Sbostic  * Copyright (c) 1980 The Regents of the University of California.
3*47940Sbostic  * All rights reserved.
422982Skre  *
5*47940Sbostic  * %sccs.include.proprietary.c%
610543Sdlw  */
710543Sdlw 
8*47940Sbostic #ifndef lint
9*47940Sbostic static char sccsid[] = "@(#)s_paus.c	5.2 (Berkeley) 04/12/91";
10*47940Sbostic #endif /* not lint */
11*47940Sbostic 
1210543Sdlw #include <stdio.h>
1310543Sdlw #define PAUSESIG 15
1410543Sdlw 
s_paus(s,n)1510543Sdlw s_paus(s, n)
1610543Sdlw char *s;
1710543Sdlw long int n;
1810543Sdlw {
1910543Sdlw int i;
2010543Sdlw int waitpause();
2110543Sdlw 
2210543Sdlw fprintf(stderr, "PAUSE: ");
2310543Sdlw if(n > 0)
2410543Sdlw 	{
2510543Sdlw 	for(i = 0; i<n ; ++i)
2610543Sdlw 		putc(*s++, stderr);
2710543Sdlw 	putc('\n', stderr);
2810543Sdlw 	}
2910543Sdlw if( isatty(fileno(stdin)) )
3010543Sdlw 	{
3110543Sdlw 	fprintf(stderr, "To resume execution, type:   go\nAny other input will terminate the program.\n");
3210543Sdlw 	if( getchar()!='g' || getchar()!='o' || getchar()!='\n' )
3310543Sdlw 		{
3410543Sdlw 		fprintf(stderr, "STOP\n");
3510543Sdlw 		f_exit();
3610543Sdlw 		_cleanup();
3710543Sdlw 		exit(0);
3810543Sdlw 		}
3910543Sdlw 	}
4010543Sdlw else
4110543Sdlw 	{
4210543Sdlw 	fprintf(stderr, "To resume execution, type:    kill -%d %d\n",
4310543Sdlw 		PAUSESIG, getpid() );
4410543Sdlw 	signal(PAUSESIG, waitpause);
4510543Sdlw 	pause();
4610543Sdlw 	}
4710543Sdlw fprintf(stderr, "Execution resumed after PAUSE.\n");
4810543Sdlw }
4910543Sdlw 
5010543Sdlw 
5110543Sdlw 
5210543Sdlw 
5310543Sdlw 
waitpause()5410543Sdlw static waitpause()
5510543Sdlw {
5610543Sdlw return;
5710543Sdlw }
58