source: trunk/gcc/libf2c/libF77/s_paus.c

Last change on this file was 1392, checked in by bird, 21 years ago

This commit was generated by cvs2svn to compensate for changes in r1391,
which included commits to RCS files with non-trunk default branches.

  • Property cvs2svn:cvs-rev set to 1.1.1.2
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 1.4 KB
Line 
1#include <stdio.h>
2#include "f2c.h"
3#define PAUSESIG 15
4
5#include "signal1.h"
6#undef abs
7#undef min
8#undef max
9#include <stdlib.h>
10extern int getpid (void), isatty (int), pause (void);
11
12extern void f_exit (void);
13
14static void
15waitpause (Sigarg)
16{
17 Use_Sigarg;
18 return;
19}
20
21static void
22s_1paus (FILE * fin)
23{
24 fprintf (stderr,
25 "To resume execution, type go. Other input will terminate the job.\n");
26 fflush (stderr);
27 if (getc (fin) != 'g' || getc (fin) != 'o' || getc (fin) != '\n')
28 {
29 fprintf (stderr, "STOP\n");
30#ifdef NO_ONEXIT
31 f_exit ();
32#endif
33 exit (0);
34 }
35}
36
37int
38s_paus (char *s, ftnlen n)
39{
40 fprintf (stderr, "PAUSE ");
41 if (n > 0)
42 fprintf (stderr, " %.*s", (int) n, s);
43 fprintf (stderr, " statement executed\n");
44 if (isatty (fileno (stdin)))
45 s_1paus (stdin);
46 else
47 {
48#if (defined (MSDOS) && !defined (GO32)) || defined (_WIN32)
49 FILE *fin;
50 fin = fopen ("con", "r");
51 if (!fin)
52 {
53 fprintf (stderr, "s_paus: can't open con!\n");
54 fflush (stderr);
55 exit (1);
56 }
57 s_1paus (fin);
58 fclose (fin);
59#else
60 fprintf (stderr,
61 "To resume execution, execute a kill -%d %d command\n",
62 PAUSESIG, getpid ());
63 signal1 (PAUSESIG, waitpause);
64 fflush (stderr);
65 pause ();
66#endif
67 }
68 fprintf (stderr, "Execution resumes after PAUSE.\n");
69 fflush (stderr);
70 return 0; /* NOT REACHED */
71}
Note: See TracBrowser for help on using the repository browser.