Include the system limits.h first since it may contain other stuff
[pcc-libs.git] / libF77 / main.c
blob34c0e25f7553a004c2eda5f7a6690689068cbabf
1 /* $Id: main.c,v 1.3 2008/02/28 16:48:50 ragge Exp $ */
2 /*
3 * Copyright(C) Caldera International Inc. 2001-2002. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
9 * Redistributions of source code and documentation must retain the above
10 * copyright notice, this list of conditions and the following disclaimer.
11 * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditionsand the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * All advertising materials mentioning features or use of this software
15 * must display the following acknowledgement:
16 * This product includes software developed or owned by Caldera
17 * International, Inc.
18 * Neither the name of Caldera International, Inc. nor the names of other
19 * contributors may be used to endorse or promote products derived from
20 * this software without specific prior written permission.
22 * USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA
23 * INTERNATIONAL, INC. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE LIABLE
27 * FOR ANY DIRECT, INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OFLIABILITY, WHETHER IN CONTRACT,
31 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
32 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
35 /* STARTUP PROCEDURE FOR UNIX FORTRAN PROGRAMS */
37 #include <stdio.h>
38 #include <signal.h>
39 #include <stdlib.h>
41 static void sigfdie(int), sigidie(int);
42 static void sigdie(char *s);
43 void MAIN__(void);
44 void f_exit(void);
46 int xargc;
47 char **xargv;
49 int
50 main(int argc, char **argv, char **arge)
53 xargc = argc;
54 xargv = argv;
55 signal(SIGFPE, sigfdie); /* ignore underflow, enable overflow */
56 signal(SIGIOT, sigidie);
57 MAIN__();
58 f_exit();
59 return 0;
62 static void
63 sigfdie(int a)
65 sigdie("Floating Exception");
68 static void
69 sigidie(int a)
71 sigdie("IOT Trap");
74 static void
75 sigdie(char *s)
77 /* print error message, then clear buffers */
78 fflush(stderr);
79 fprintf(stderr, "%s\n", s);
80 f_exit();
81 fflush(stderr);
83 /* now get a core */
84 signal(SIGIOT, 0);
85 abort();