Annotation of researchv10no/libF77/s_paus.c, revision 1.1

1.1     ! root        1: #include "stdio.h"
        !             2: #include "f2c.h"
        !             3: #define PAUSESIG 15
        !             4: 
        !             5: #ifdef KR_headers
        !             6: #define Void /* void */
        !             7: #define Int /* int */
        !             8: #else
        !             9: #define Void void
        !            10: #define Int int
        !            11: #undef abs
        !            12: #include "stdlib.h"
        !            13: #include "signal.h"
        !            14: #ifdef __cplusplus
        !            15: extern "C" {
        !            16: #endif
        !            17: extern int getpid(void), isatty(int), pause(void);
        !            18: #endif
        !            19: 
        !            20: extern VOID f_exit(Void);
        !            21: 
        !            22: static VOID waitpause(Int n)
        !            23: {
        !            24: return;
        !            25: }
        !            26: 
        !            27: #ifdef KR_headers
        !            28: int s_paus(s, n) char *s; ftnlen n;
        !            29: #else
        !            30: int s_paus(char *s, ftnlen n)
        !            31: #endif
        !            32: {
        !            33: int i;
        !            34: 
        !            35: fprintf(stderr, "PAUSE ");
        !            36: if(n > 0)
        !            37:        for(i = 0; i<n ; ++i)
        !            38:                putc(*s++, stderr);
        !            39: fprintf(stderr, " statement executed\n");
        !            40: if( isatty(fileno(stdin)) )
        !            41:        {
        !            42:        fprintf(stderr, "To resume execution, type go.  Any other input will terminate job.\n");
        !            43:        fflush(stderr);
        !            44:        if( getchar()!='g' || getchar()!='o' || getchar()!='\n' )
        !            45:                {
        !            46:                fprintf(stderr, "STOP\n");
        !            47:                f_exit();
        !            48:                exit(0);
        !            49:                }
        !            50:        }
        !            51: else
        !            52:        {
        !            53:        fprintf(stderr, "To resume execution, execute a   kill -%d %d   command\n",
        !            54:                PAUSESIG, getpid() );
        !            55:        signal(PAUSESIG, waitpause);
        !            56:        fflush(stderr);
        !            57:        pause();
        !            58:        }
        !            59: fprintf(stderr, "Execution resumes after PAUSE.\n");
        !            60: #ifdef __cplusplus
        !            61: return 0; /* NOT REACHED */
        !            62: }
        !            63: #endif
        !            64: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.