1 /*- 2 * Copyright (c) 1980 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.proprietary.c% 6 */ 7 8 #ifndef lint 9 static char sccsid[] = "@(#)s_paus.c 5.2 (Berkeley) 04/12/91"; 10 #endif /* not lint */ 11 12 #include <stdio.h> 13 #define PAUSESIG 15 14 15 s_paus(s, n) 16 char *s; 17 long int n; 18 { 19 int i; 20 int waitpause(); 21 22 fprintf(stderr, "PAUSE: "); 23 if(n > 0) 24 { 25 for(i = 0; i<n ; ++i) 26 putc(*s++, stderr); 27 putc('\n', stderr); 28 } 29 if( isatty(fileno(stdin)) ) 30 { 31 fprintf(stderr, "To resume execution, type: go\nAny other input will terminate the program.\n"); 32 if( getchar()!='g' || getchar()!='o' || getchar()!='\n' ) 33 { 34 fprintf(stderr, "STOP\n"); 35 f_exit(); 36 _cleanup(); 37 exit(0); 38 } 39 } 40 else 41 { 42 fprintf(stderr, "To resume execution, type: kill -%d %d\n", 43 PAUSESIG, getpid() ); 44 signal(PAUSESIG, waitpause); 45 pause(); 46 } 47 fprintf(stderr, "Execution resumed after PAUSE.\n"); 48 } 49 50 51 52 53 54 static waitpause() 55 { 56 return; 57 } 58