6e8652aeb2e19d0168b25aee195e5fbd692b830f
[platform/upstream/gcc.git] / libf2c / libF77 / s_stop.c
1 #include <stdio.h>
2 #include "f2c.h"
3
4 #undef abs
5 #undef min
6 #undef max
7 #include <stdlib.h>
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 void f_exit(void);
12
13 int s_stop(char *s, ftnlen n)
14 {
15 int i;
16
17 if(n > 0)
18         {
19         fprintf(stderr, "STOP ");
20         for(i = 0; i<n ; ++i)
21                 putc(*s++, stderr);
22         fprintf(stderr, " statement executed\n");
23         }
24 #ifdef NO_ONEXIT
25 f_exit();
26 #endif
27 exit(0);
28
29 /* We cannot avoid (useless) compiler diagnostics here:         */
30 /* some compilers complain if there is no return statement,     */
31 /* and others complain that this one cannot be reached.         */
32
33 return 0; /* NOT REACHED */
34 }
35 #ifdef __cplusplus
36 }
37 #endif