s_paus.c
Go to the documentation of this file.
00001 #include "stdio.h"
00002 #include "f2c.h"
00003 #define PAUSESIG 15
00004 
00005 #include "signal1.h"
00006 #ifdef KR_headers
00007 #define Void /* void */
00008 #define Int /* int */
00009 #else
00010 #define Void void
00011 #define Int int
00012 #undef abs
00013 #undef min
00014 #undef max
00015 #include "stdlib.h"
00016 #ifdef __cplusplus
00017 extern "C" {
00018 #endif
00019 #ifdef __cplusplus
00020 extern "C" {
00021 #endif
00022 extern int getpid(void), isatty(int), pause(void);
00023 #endif
00024 
00025 extern VOID f_exit(Void);
00026 
00027 #ifndef MSDOS
00028  static VOID
00029 waitpause(Sigarg)
00030 {       Use_Sigarg;
00031         return;
00032         }
00033 #endif
00034 
00035  static VOID
00036 #ifdef KR_headers
00037 s_1paus(fin) FILE *fin;
00038 #else
00039 s_1paus(FILE *fin)
00040 #endif
00041 {
00042         fprintf(stderr,
00043         "To resume execution, type go.  Other input will terminate the job.\n");
00044         fflush(stderr);
00045         if( getc(fin)!='g' || getc(fin)!='o' || getc(fin)!='\n' ) {
00046                 fprintf(stderr, "STOP\n");
00047 #ifdef NO_ONEXIT
00048                 f_exit();
00049 #endif
00050                 exit(0);
00051                 }
00052         }
00053 
00054  int
00055 #ifdef KR_headers
00056 s_paus(s, n) char *s; ftnlen n;
00057 #else
00058 s_paus(char *s, ftnlen n)
00059 #endif
00060 {
00061         fprintf(stderr, "PAUSE ");
00062         if(n > 0)
00063                 fprintf(stderr, " %.*s", (int)n, s);
00064         fprintf(stderr, " statement executed\n");
00065         if( isatty(fileno(stdin)) )
00066                 s_1paus(stdin);
00067         else {
00068 #ifdef MSDOS
00069                 FILE *fin;
00070                 fin = fopen("con", "r");
00071                 if (!fin) {
00072                         fprintf(stderr, "s_paus: can't open con!\n");
00073                         fflush(stderr);
00074                         exit(1);
00075                         }
00076                 s_1paus(fin);
00077                 fclose(fin);
00078 #else
00079                 fprintf(stderr,
00080                 "To resume execution, execute a   kill -%d %d   command\n",
00081                         PAUSESIG, getpid() );
00082                 signal1(PAUSESIG, waitpause);
00083                 fflush(stderr);
00084                 pause();
00085 #endif
00086                 }
00087         fprintf(stderr, "Execution resumes after PAUSE.\n");
00088         fflush(stderr);
00089         return 0; /* NOT REACHED */
00090 #ifdef __cplusplus
00091         }
00092 #endif
00093 }
00094 #ifdef __cplusplus
00095 }
00096 #endif


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:56