110543Sdlw /* 2*22982Skre * Copyright (c) 1980 Regents of the University of California. 3*22982Skre * All rights reserved. The Berkeley software License Agreement 4*22982Skre * specifies the terms and conditions for redistribution. 5*22982Skre * 6*22982Skre * @(#)s_paus.c 5.1 06/07/85 710543Sdlw */ 810543Sdlw 910543Sdlw #include <stdio.h> 1010543Sdlw #define PAUSESIG 15 1110543Sdlw 1210543Sdlw 1310543Sdlw s_paus(s, n) 1410543Sdlw char *s; 1510543Sdlw long int n; 1610543Sdlw { 1710543Sdlw int i; 1810543Sdlw int waitpause(); 1910543Sdlw 2010543Sdlw fprintf(stderr, "PAUSE: "); 2110543Sdlw if(n > 0) 2210543Sdlw { 2310543Sdlw for(i = 0; i<n ; ++i) 2410543Sdlw putc(*s++, stderr); 2510543Sdlw putc('\n', stderr); 2610543Sdlw } 2710543Sdlw if( isatty(fileno(stdin)) ) 2810543Sdlw { 2910543Sdlw fprintf(stderr, "To resume execution, type: go\nAny other input will terminate the program.\n"); 3010543Sdlw if( getchar()!='g' || getchar()!='o' || getchar()!='\n' ) 3110543Sdlw { 3210543Sdlw fprintf(stderr, "STOP\n"); 3310543Sdlw f_exit(); 3410543Sdlw _cleanup(); 3510543Sdlw exit(0); 3610543Sdlw } 3710543Sdlw } 3810543Sdlw else 3910543Sdlw { 4010543Sdlw fprintf(stderr, "To resume execution, type: kill -%d %d\n", 4110543Sdlw PAUSESIG, getpid() ); 4210543Sdlw signal(PAUSESIG, waitpause); 4310543Sdlw pause(); 4410543Sdlw } 4510543Sdlw fprintf(stderr, "Execution resumed after PAUSE.\n"); 4610543Sdlw } 4710543Sdlw 4810543Sdlw 4910543Sdlw 5010543Sdlw 5110543Sdlw 5210543Sdlw static waitpause() 5310543Sdlw { 5410543Sdlw return; 5510543Sdlw } 56