home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GEMini Atari
/
GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso
/
zip
/
mint
/
mntlib16.lzh
/
MNTLIB16
/
SIGNAL.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-08-03
|
1KB
|
55 lines
/* signal() for MiNT; written by ERS, placed in the public domain */
#include <errno.h>
#include <osbind.h>
#include <mintbind.h>
#include <signal.h>
/* vector of signal handlers (for TOS) */
__Sigfunc _sig_handler[NSIG];
/* vector giving which signals are currently blocked from delivery (for TOS) */
long _sigmask;
/* vector giving an indication of which signals are currently pending (for TOS) */
long _sigpending;
__Sigfunc
signal(sig, func)
int sig;
__Sigfunc func;
{
long old;
extern int __mint;
__Sigfunc oldfunc;
if (__mint == 0) {
if (sig < 0 || sig >= NSIG) {
errno = ERANGE;
return SIG_ERR;
}
oldfunc = _sig_handler[sig];
_sig_handler[sig] = func;
return oldfunc;
}
old = Psignal((short)sig, (long)func);
if (old < 0) {
errno = -old;
return SIG_ERR;
}
return (__Sigfunc) old;
}
/* initialize signal handlers (for dumped applications) */
void
_init_signal()
{
int i;
for (i = 0; i < NSIG; i++)
_sig_handler[i] = SIG_DFL;
_sigpending = _sigmask = 0;
}