home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / f2csrc.zip / f2csrc / libF77 / s_paus.c < prev    next >
C/C++ Source or Header  |  1994-07-28  |  1KB  |  69 lines

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