|
|
1.1 ! root 1: #include <stdio.h> ! 2: #define PAUSESIG 15 ! 3: ! 4: ! 5: s_paus(s, n) ! 6: char *s; ! 7: long int n; ! 8: { ! 9: int i; ! 10: int waitpause(); ! 11: ! 12: fprintf(stderr, "PAUSE "); ! 13: if(n > 0) ! 14: for(i = 0; i<n ; ++i) ! 15: putc(*s++, stderr); ! 16: fprintf(stderr, " statement executed\n"); ! 17: if( isatty(fileno(stdin)) ) ! 18: { ! 19: fprintf(stderr, "To resume execution, type go. Any other input will terminate job.\n"); ! 20: if( getchar()!='g' || getchar()!='o' || getchar()!='\n' ) ! 21: { ! 22: fprintf(stderr, "STOP\n"); ! 23: f_exit(); ! 24: _cleanup(); ! 25: exit(0); ! 26: } ! 27: } ! 28: else ! 29: { ! 30: fprintf(stderr, "To resume execution, execute a kill -%d %d command\n", ! 31: PAUSESIG, getpid() ); ! 32: signal(PAUSESIG, waitpause); ! 33: pause(); ! 34: } ! 35: fprintf(stderr, "Execution resumes after PAUSE.\n"); ! 36: } ! 37: ! 38: ! 39: ! 40: ! 41: ! 42: static waitpause() ! 43: { ! 44: return; ! 45: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.