Mail Archives: djgpp/1996/02/07/01:07:10
On Tue, 6 Feb 1996, cameronbuschardt wrote:
> I sorry to waste your time, could someone show me how to use SIGNAL(Note:
> NOT THE DECLARATION...)??? Thanx...
>
>
example: you want to catch the "SIGPIPE" signal (I dunno if DJGPP has
this, but it's in SVR4 and BSD4.3+)
(in your code)
...
signal (SIGPIPE, myhandler);
...
you also set up a signal handler called myhandler, it's of the form
void myhandler (int sig) <---- sig is the signal which got caught
{
printf ("Signal %d caught\n", sig);
... anything else...
return;
}
your signal handler can: a) quit (thru abort(), exit() or something
else), b) go on as if nothing happened (the return above). Note that some
signals can't be ignored (i.e. SIGKILL, SIGINT). If you just wanna
ignore a signal, use the predefined SIG_IGN:
signal (whatever-signal, SIG_IGN);
NB signal as such ain't too good because the semantics are vague. POSIX
recommends using sigaction (). You need to #include <signal.h>
PS I'm not sure of what great use signals are in DJGPP, since MS-DOG
ain't multitasking... just a note
/----------------------------------------------------------------------------\
| Orlando A. Andico "I have no concept of time, other than |
| oandico AT eee DOT upd DOT edu DOT ph it is flying." -- Alanis Morissette |
\----------------------------------------------------------------------------/
- Raw text -