Date: Wed, 7 Feb 1996 13:58:18 -0800 (GMT) From: Orlando Andico To: cameronbuschardt cc: djgpp AT delorie DOT com Subject: Re: signal Message-ID: MIME-Version: 1.0 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 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 | \----------------------------------------------------------------------------/