]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MINICERN/packlib/kernlib/kerngen/ccgen/signalf.c
This commit was generated by cvs2svn to compensate for changes in r2,
[u/mrichter/AliRoot.git] / MINICERN / packlib / kernlib / kerngen / ccgen / signalf.c
1 /*
2  * $Id$
3  *
4  * $Log$
5  * Revision 1.2  1997/02/04 17:34:41  mclareni
6  * Merge Winnt and 97a versions
7  *
8  * Revision 1.1.1.1.2.1  1997/01/21 11:29:41  mclareni
9  * All mods for Winnt 96a on winnt branch
10  *
11  * Revision 1.1.1.1  1996/02/15 17:49:26  mclareni
12  * Kernlib
13  *
14  */
15 #include "kerngen/pilot.h"
16 #include "kerngen/fortranc.h"
17
18 #if defined(CERNLIB_QMSGI)
19 #include "sgigs/signalf.c"
20 #elif defined(CERNLIB_QMIRT)||defined(CERNLIB_QMIRTD)
21 #include "irtgs/signalf.c"
22 #elif defined(CERNLIB_QMOS9)
23 #include "os9gs/signalf.c"
24 #elif defined(CERNLIB_QSIGBSD)
25 #include "sigbsd.c"
26 #elif defined(CERNLIB_QSIGPOSIX)
27 #include "sigposix.c"
28 #else
29 /*>    ROUTINE SIGNALF
30   CERN PROGLIB#         SIGNALF         .VERSION KERNFOR  4.38  931108
31   ORIG. 12/03/91, JZ
32   FORTRAN interface routine to signal
33
34       INTEGER FUNCTION SIGNALF (NUMSIG,PROC,IFLAG)
35
36 C-        NUMSIG :  signal number
37 C-          PROC :  external of the handler, if IFLAG = -1
38 C-         IFLAG :  < 0  instal PROC
39 C-                  = 0  default action
40 C-                  = 1  ignore signal
41 C-                  > 1  adr of handler as returned earlier
42 C-        function value = adr of previous handler
43 */
44 #include <signal.h>
45 #if defined(CERNLIB_QX_SC)
46 int type_of_call signalf_(signum,funct,flag)
47 #endif
48 #if defined(CERNLIB_QXNO_SC)
49 int type_of_call signalf(signum,funct,flag)
50 #endif
51 #if defined(CERNLIB_QXCAPT)
52 int type_of_call SIGNALF(signum,funct,flag)
53 #endif
54       int  *signum, *flag;
55       int  *funct;
56 {
57       int  signo, istat;
58       int  handler;
59       void *oldhand;
60
61       signo = *signum;
62
63 #if defined(CERNLIB_QCCINDAD)
64       if (*flag < 0)          handler = *funct;
65 #endif
66 #if !defined(CERNLIB_QCCINDAD)
67       if (*flag < 0)          handler = (int)funct;
68 #endif
69         else if (*flag == 0)  handler = (int)SIG_DFL;
70         else if (*flag == 1)  handler = (int)SIG_IGN;
71         else                  handler = *flag;
72
73       oldhand = signal(signo,handler);
74       istat   = (int)oldhand;
75 #ifndef __GNUC__
76       if (oldhand == SIG_ERR)  istat = -1;
77 #endif
78       return istat;
79 }
80 /*> END <----------------------------------------------------------*/
81 #endif