1: /* STARTUP PROCEDURE FOR UNIX FORTRAN PROGRAMS */
   2: char id_libF77[] = "@(#)main.c	2.15	8/25/83";
   3: 
   4: #include <stdio.h>
   5: #include <signal.h>
   6: #include <sys/types.h>
   7: #ifdef  pdp11
   8: #include <sys/fperr.h>
   9: #endif
  10: #include "../libI77/fiodefs.h"
  11: 
  12: int xargc;
  13: char **xargv;
  14: 
  15: main(argc, argv, arge)
  16: int argc;
  17: char **argv;
  18: char **arge;
  19: {
  20: int sigdie();
  21: int (*sigf)();
  22: int signum;
  23: 
  24: xargc = argc;
  25: xargv = argv;
  26: 
  27: for (signum=1; signum<=16; signum++)
  28: {
  29:     if (signum == (int) SIGILL || signum == (int) SIGKILL)
  30:         continue;
  31:     if ((sigf = signal(signum, sigdie)) != SIG_DFL && sigf != BADSIG)
  32:         signal(signum, sigf);
  33: }
  34: 
  35: #ifdef pdp11
  36:     ldfps(FPS_FIV | FPS_FD); /* detect overflow as an exception */
  37: #endif
  38: 
  39: f_init();
  40: MAIN__();
  41: f_exit();
  42: }
  43: 
  44: struct action {
  45:     char *mesg;
  46:     int   core;
  47: } sig_act[16] = {
  48:     {"Hangup", 0},          /* SIGHUP  */
  49:     {"Interrupt!", 0},      /* SIGINT  */
  50:     {"Quit!", 1},           /* SIGQUIT */
  51:     {"Illegal instruction", 1}, /* SIGILL  */
  52:     {"Trace Trap", 1},      /* SIGTRAP */
  53:     {"IOT Trap", 1},        /* SIGIOT  */
  54:     {"EMT Trap", 1},        /* SIGEMT  */
  55:     {"Floating Point Exception", 1},/* SIGFPE  */
  56:     { 0, 0},            /* SIGKILL */
  57:     {"Bus error", 1},       /* SIGBUS  */
  58:     {"Segmentation violation", 1},  /* SIGSEGV */
  59:     {"Sys arg", 1},         /* SIGSYS  */
  60:     {"Open pipe", 0},       /* SIGPIPE */
  61:     {"Alarm", 0},           /* SIGALRM */
  62:     {"Terminated", 0},      /* SIGTERM */
  63:     {"Sig 16", 0},          /* unassigned */
  64: };
  65: 
  66: sigdie(s)
  67: int s;
  68: {
  69: extern unit units[];
  70: register struct action *act = &sig_act[s-1];
  71: /* print error message, then flush buffers */
  72: 
  73: if (s == SIGHUP || s == SIGINT || s == SIGQUIT)
  74:     signal(s, SIG_IGN); /* don't allow it again */
  75: else
  76:     signal(s, SIG_DFL); /* shouldn't happen again, but ... */
  77: 
  78: if (act->mesg)
  79:     fprintf(units[STDERR].ufd, "*** %s\n", act->mesg);
  80: f_exit();
  81: _cleanup();
  82: 
  83: if(act->core)
  84:     {
  85:     /* now get a core */
  86: #if vax
  87:     signal(SIGILL, SIG_DFL);
  88: #else   pdp11
  89:     signal(SIGIOT, SIG_DFL);
  90: #endif	vax
  91:     abort();
  92:     }
  93: exit(s);
  94: }

Defined functions

main defined in line 15; never used
sigdie defined in line 66; used 4 times

Defined variables

id_libF77 defined in line 2; never used
sig_act defined in line 47; used 1 times
  • in line 70
xargc defined in line 12; used 2 times
xargv defined in line 13; used 1 times
  • in line 25

Defined struct's

action defined in line 44; used 2 times
  • in line 70(2)
Last modified: 1983-08-29
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 796
Valid CSS Valid XHTML 1.0 Strict