www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/02/07/01:07:10

Date: Wed, 7 Feb 1996 13:58:18 -0800 (GMT)
From: Orlando Andico <oandico AT eee DOT upd DOT edu DOT ph>
To: cameronbuschardt <c027319 AT email4 DOT starnetinc DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: signal
Message-ID: <Pine.SOL.3.91.960207135326.14914A-100000@gollum>
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 <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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019