home *** CD-ROM | disk | FTP | other *** search
- #ifdef _AMIGA
- #include <string.h>
- #include <signal.h>
- #include <stdlib.h>
- #include <exec/types.h>
- #include <intuition/intuition.h>
- #include <libraries/dosextens.h>
- #include <proto/exec.h>
- #include <proto/dos.h>
- #include <proto/intuition.h>
- #include "f2c.h"
- #else /* AMIGA */
- #include "stdio.h"
- #include "f2c.h"
- #define PAUSESIG 15
- #endif /* AMIGA */
-
- #ifndef _AMIGA
- #ifdef KR_headers
- #define Void /* void */
- #define Int /* int */
- #else
- #define Void void
- #define Int int
- #undef abs
- #include "stdlib.h"
- #include "signal.h"
- extern int getpid(void), isatty(int), pause(void);
- #endif
- #else /* AMIGA */
- #define Void void
- #define Int int
- #endif /* AMIGA */
-
- #ifdef __cplusplus
- extern "C" void f_exit(void);
- #else
- extern VOID f_exit(Void);
- #endif
-
- static VOID waitpause(Int n)
- {
- return;
- }
-
- #ifdef KR_headers
- VOID s_paus(s, n) char *s; ftnlen n;
- #else
- void s_paus(char *s, ftnlen n)
- #endif
- {
- #ifdef _AMIGA
- static struct IntuiText Text2 = {
- -1, -1, /* pen numbers */
- 0, /* draw mode */
- 14, 14, /* starting offsets */
- NULL, /* text attribute pointer */
- "Pause statement executed",
- NULL
- };
-
- static struct IntuiText BodyText = {
- -1, -1, /* pen numbers */
- 0, /* draw mode */
- 4, 4, /* starting offsets */
- NULL, /* text attribute pointer */
- NULL,
- &Text2
- };
-
- static struct IntuiText ContinueText = {
- -1, -1, /* pen numbers */
- 0, /* draw mode */
- 4, 4, /* starting offsets */
- NULL, /* text attribute pointer */
- "CONTINUE",
- NULL
- };
-
- static struct IntuiText AbortText = {
- -1, -1, /* pen numbers */
- 0, /* draw mode */
- 4, 4, /* starting offsets */
- NULL, /* text attribute pointer */
- "ABORT",
- NULL
- };
-
- char temp[81];
- struct IntuitionBase *IntuitionBase;
-
- if (n > 79)
- n = 79;
- memcpy(temp, s, n);
- temp[n+1] = '\0';
-
- IntuitionBase = (struct IntuitionBase *)
- OpenLibrary("intuition.library",0);
- if (IntuitionBase == NULL) {
- f_exit();
- exit(0);
- }
-
- BodyText.IText = temp;
-
- if (AutoRequest(NULL, &BodyText, &ContinueText, &AbortText,
- 0L, 0L, 250L, 60L) != TRUE) {
- CloseLibrary((struct Library *) IntuitionBase);
- f_exit();
- exit(0);
- } else {
- CloseLibrary((struct Library *) IntuitionBase);
- return;
- }
-
- #else /* AMIGA */
- int i;
-
- fprintf(stderr, "PAUSE ");
- if(n > 0)
- for(i = 0; i<n ; ++i)
- putc(*s++, stderr);
- fprintf(stderr, " statement executed\n");
- if( isatty(fileno(stdin)) )
- {
- fprintf(stderr, "To resume execution, type go. Any other input will terminate job.\n");
- fflush(stderr);
- if( getchar()!='g' || getchar()!='o' || getchar()!='\n' )
- {
- fprintf(stderr, "STOP\n");
- f_exit();
- exit(0);
- }
- }
- else
- {
- fprintf(stderr, "To resume execution, execute a kill -%d %d command\n",
- PAUSESIG, getpid() );
- signal(PAUSESIG, waitpause);
- fflush(stderr);
- pause();
- }
- fprintf(stderr, "Execution resumes after PAUSE.\n");
- #endif /* AMIGA */
- }
-