BSD 4_2 release
[unix-history] / usr / src / usr.lib / libF77 / main.c
index 03cdef4..9c90400 100644 (file)
@@ -1,5 +1,5 @@
 /* STARTUP PROCEDURE FOR UNIX FORTRAN PROGRAMS */
 /* STARTUP PROCEDURE FOR UNIX FORTRAN PROGRAMS */
-char id_libF77[] = "@(#)main.c 2.10    11/3/81";
+char id_libF77[] = "@(#)main.c 2.15    8/25/83";
 
 #include <stdio.h>
 #include <signal.h>
 
 #include <stdio.h>
 #include <signal.h>
@@ -30,7 +30,7 @@ for (signum=1; signum<=16; signum++)
 #endif
 
 f_init();
 #endif
 
 f_init();
-MAIN__();
+MAIN_();
 f_exit();
 }
 
 f_exit();
 }
 
@@ -41,19 +41,11 @@ struct action {
        {"Hangup", 0},                  /* SIGHUP  */
        {"Interrupt!", 0},              /* SIGINT  */
        {"Quit!", 1},                   /* SIGQUIT */
        {"Hangup", 0},                  /* SIGHUP  */
        {"Interrupt!", 0},              /* SIGINT  */
        {"Quit!", 1},                   /* SIGQUIT */
-#ifdef UCBVAX
        {"Illegal ", 1},                /* SIGILL  */
        {"Illegal ", 1},                /* SIGILL  */
-#else
-       {"Illegal instruction", 1},     /* SIGILL  */
-#endif
        {"Trace Trap", 1},              /* SIGTRAP */
        {"IOT Trap", 1},                /* SIGIOT  */
        {"EMT Trap", 1},                /* SIGEMT  */
        {"Trace Trap", 1},              /* SIGTRAP */
        {"IOT Trap", 1},                /* SIGIOT  */
        {"EMT Trap", 1},                /* SIGEMT  */
-#ifdef UCBVAX
        {"Arithmetic Exception", 1},    /* SIGFPE  */
        {"Arithmetic Exception", 1},    /* SIGFPE  */
-#else
-       {"Floating Point Exception", 1},/* SIGFPE  */
-#endif
        { 0, 0},                        /* SIGKILL */
        {"Bus error", 1},               /* SIGBUS  */
        {"Segmentation violation", 1},  /* SIGSEGV */
        { 0, 0},                        /* SIGKILL */
        {"Bus error", 1},               /* SIGBUS  */
        {"Segmentation violation", 1},  /* SIGSEGV */
@@ -64,13 +56,12 @@ struct action {
        {"Sig 16", 0},                  /* unassigned */
 };
 
        {"Sig 16", 0},                  /* unassigned */
 };
 
-#ifdef UCBVAX
 struct action act_fpe[] = {
        {"Integer overflow", 1},
        {"Integer divide by 0", 1},
 struct action act_fpe[] = {
        {"Integer overflow", 1},
        {"Integer divide by 0", 1},
-       {"Floating point overflow", 1},
-       {"Floating divide by zero", 1},
-       {"Floating point underflow", 1},
+       {"Floating point overflow trap", 1},
+       {"Floating divide by zero trap", 1},
+       {"Floating point underflow trap", 1},
        {"Decimal overflow", 1},
        {"Subscript range", 1},
        {"Floating point overflow", 0},
        {"Decimal overflow", 1},
        {"Subscript range", 1},
        {"Floating point overflow", 0},
@@ -83,18 +74,32 @@ struct action act_ill[] = {
        {"instruction", 1},
        {"operand", 0},
 };
        {"instruction", 1},
        {"operand", 0},
 };
-#endif
 
 
+#if    vax
+sigdie(s, t, sc)
+int s; int t; struct sigcontext *sc;
+
+#else  pdp11
 sigdie(s, t, pc)
 int s; int t; long pc;
 sigdie(s, t, pc)
 int s; int t; long pc;
+
+#endif
 {
 extern unit units[];
 register struct action *act = &sig_act[s-1];
 /* print error message, then flush buffers */
 
 {
 extern unit units[];
 register struct action *act = &sig_act[s-1];
 /* print error message, then flush buffers */
 
+if (s == SIGHUP || s == SIGINT || s == SIGQUIT)
+       signal(s, SIG_IGN);     /* don't allow it again */
+else
+       signal(s, SIG_DFL);     /* shouldn't happen again, but ... */
+
+#if    vax
+sigsetmask(0);                 /* don't block */
+#endif
+
 if (act->mesg)
        {
 if (act->mesg)
        {
-#ifdef UCBVAX
        fprintf(units[STDERR].ufd, "*** %s", act->mesg);
        if (s == SIGFPE)
                {
        fprintf(units[STDERR].ufd, "*** %s", act->mesg);
        if (s == SIGFPE)
                {
@@ -112,9 +117,6 @@ if (act->mesg)
                        fprintf(units[STDERR].ufd, "compat mode: Code=%d", t);
                }
        putc('\n', units[STDERR].ufd);
                        fprintf(units[STDERR].ufd, "compat mode: Code=%d", t);
                }
        putc('\n', units[STDERR].ufd);
-#else
-       fprintf(units[STDERR].ufd, "*** %s\n", act->mesg);
-#endif
        }
 f_exit();
 _cleanup();
        }
 f_exit();
 _cleanup();
@@ -122,9 +124,9 @@ _cleanup();
 if(act->core)
        {
        /* now get a core */
 if(act->core)
        {
        /* now get a core */
-#ifdef VAX
+#if    vax
        signal(SIGILL, SIG_DFL);
        signal(SIGILL, SIG_DFL);
-#else
+#else  pdp11
        signal(SIGIOT, SIG_DFL);
 #endif
        abort();
        signal(SIGIOT, SIG_DFL);
 #endif
        abort();