1 #include "stdio.h"
2 #include "v3p_f2c.h"
3 #define PAUSESIG 15
4
5 #include "signal1.h"
6 #ifdef KR_headers
7 #define Void /* void */
8 #define Int /* int */
9 #else
10 #define Void void
11 #define Int int
12 #undef abs
13 #undef min
14 #undef max
15 #include "stdlib.h"
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 extern int getpid(void), isatty(int), pause(void);
23 #endif
24
25 extern VOID f_exit(Void);
26
27 #ifndef MSDOS
28 static VOID
waitpause(Sigarg)29 waitpause(Sigarg)
30 { Use_Sigarg;
31 return;
32 }
33 #endif
34
35 static VOID
36 #ifdef KR_headers
s_1paus(fin)37 s_1paus(fin) FILE *fin;
38 #else
39 s_1paus(FILE *fin)
40 #endif
41 {
42 fprintf(stderr,
43 "To resume execution, type go. Other input will terminate the job.\n");
44 fflush(stderr);
45 if( getc(fin)!='g' || getc(fin)!='o' || getc(fin)!='\n' ) {
46 fprintf(stderr, "STOP\n");
47 #ifdef NO_ONEXIT
48 f_exit();
49 #endif
50 exit(0);
51 }
52 }
53
54 int
55 #ifdef KR_headers
s_paus(s,n)56 s_paus(s, n) char *s; ftnlen n;
57 #else
58 s_paus(char *s, ftnlen n)
59 #endif
60 {
61 fprintf(stderr, "PAUSE ");
62 if(n > 0)
63 fprintf(stderr, " %.*s", (int)n, s);
64 fprintf(stderr, " statement executed\n");
65 if( isatty(fileno(stdin)) )
66 s_1paus(stdin);
67 else {
68 #ifdef MSDOS
69 FILE *fin;
70 fin = fopen("con", "r");
71 if (!fin) {
72 fprintf(stderr, "s_paus: can't open con!\n");
73 fflush(stderr);
74 exit(1);
75 }
76 s_1paus(fin);
77 fclose(fin);
78 #else
79 fprintf(stderr,
80 "To resume execution, execute a kill -%d %d command\n",
81 PAUSESIG, getpid() );
82 signal1(PAUSESIG, waitpause);
83 fflush(stderr);
84 pause();
85 #endif
86 }
87 fprintf(stderr, "Execution resumes after PAUSE.\n");
88 fflush(stderr);
89 return 0; /* NOT REACHED */
90 #ifdef __cplusplus
91 }
92 #endif
93 }
94 #ifdef __cplusplus
95 }
96 #endif
97