/*                                                       fortentry6.c      */
/* 16/05/88 - Changed fortran entry point to _MAIN_ to be compatible       */
/*            with dbx and f77 (sl).                                       */
#include <signal.h>


    /*******  IMP RUNBASE ( mark 5 ) *******/

     /* Conforms to Convention to access */
     /*   the arguments and environment  */


    /*******  IMP RUNBASE ( mark 4 ) *******/

      /* This version calls MAIN__ rather */
      /* than MAIN.                       */


    /*******  IMP RUNBASE ( mark 3 ) *******/

      /*Routine COREDUMP has been moved has*/
      /*   been moved into NDIAG6, because */
      /*   of problems when an IMP/Fortran */
      /*   procedure is linked in with a C */
      /*   main program.                   */


    /*******  IMP RUNBASE ( mark 2 ) *******/

     /* This version is designed for Perq3 */
     /*   in that On Bound is PNX specific */
     /*   and all signal are trapped by    */
     /*   one routine (in Ndiag)           */


    /*******  IMP RUNBASE ( mark 1 ) *******/

     /* This is more general version and   */
     /*   is to be found in IMPENTRY1.C    */


extern   MAIN__();   /* used to be s_go */
extern    _exit();
extern f_onsignal();


int    xargc;    /* fort progs access from GETARG */
char **xargv;


main(argc,argv,arge)       /* command arguments */
    int   argc;
    char  **argv;
    char  **arge;
  {
         /* Set traps to take interrupts to IMP diagnostics */


    if (signal(SIGFPE,  SIG_IGN) != SIG_IGN) signal(SIGFPE,  f_onsignal);
    if (signal(SIGILL,  SIG_IGN) != SIG_IGN) signal(SIGILL,  f_onsignal);
    if (signal(SIGEMT,  SIG_IGN) != SIG_IGN) signal(SIGEMT,  f_onsignal);
    if (signal(SIGSEGV, SIG_IGN) != SIG_IGN) signal(SIGSEGV, f_onsignal);
    if (signal(SIGIOT,  SIG_IGN) != SIG_IGN) signal(SIGIOT,  f_onsignal);
    if (signal(SIGQUIT, SIG_IGN) != SIG_IGN) signal(SIGQUIT, f_onsignal);
    if (signal(SIGBUS,  SIG_IGN) != SIG_IGN) signal(SIGBUS,  f_onsignal);
    if (signal(SIGTRAP, SIG_IGN) != SIG_IGN) signal(SIGTRAP, f_onsignal);

      xargc =  argc;
      xargv =  argv;

    MAIN__(argc,argv,arge); /* call Imp main program (S#GO) */
                     /* The parameters are ignored by true IMP main programs */
  _exit();    /* crashes system to just return from here */
   }
