* Makefile.tpl: Fix stupid pasto.
[official-gcc.git] / libf2c / libF77 / s_paus.c
blob79691366e6fdcb803499c4d91724629934c2e780
1 #include <stdio.h>
2 #include "f2c.h"
3 #define PAUSESIG 15
5 #include "signal1.h"
6 #undef abs
7 #undef min
8 #undef max
9 #include <stdlib.h>
10 extern int getpid (void), isatty (int), pause (void);
12 extern void f_exit (void);
14 static void
15 waitpause (Sigarg)
17 Use_Sigarg;
18 return;
21 static void
22 s_1paus (FILE * fin)
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')
29 fprintf (stderr, "STOP\n");
30 #ifdef NO_ONEXIT
31 f_exit ();
32 #endif
33 exit (0);
37 int
38 s_paus (char *s, ftnlen n)
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
48 #if (defined (MSDOS) && !defined (GO32)) || defined (_WIN32)
49 FILE *fin;
50 fin = fopen ("con", "r");
51 if (!fin)
53 fprintf (stderr, "s_paus: can't open con!\n");
54 fflush (stderr);
55 exit (1);
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
68 fprintf (stderr, "Execution resumes after PAUSE.\n");
69 fflush (stderr);
70 return 0; /* NOT REACHED */