delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/08/05:51:30

Xref: news2.mv.net comp.os.msdos.djgpp:3551
From: stwand07 AT uctvms DOT uct DOT ac DOT za
Newsgroups: comp.os.msdos.djgpp
Subject: Re: ANSI C signal definitions
Date: 8 May 96 10:08:08 +0200
Organization: University of Cape Town
Lines: 38
Message-ID: <1996May8.100808@uctvms.uct.ac.za>
References: <Pine DOT LNX DOT 3 DOT 91 DOT 960507120012 DOT 353A-100000 AT abigail DOT eee DOT upd DOT edu DOT ph>
NNTP-Posting-Host: uctvms.uct.ac.za
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <Pine DOT LNX DOT 3 DOT 91 DOT 960507120012 DOT 353A-100000 AT abigail DOT eee DOT upd DOT edu DOT ph>, Orlando Andico <orly AT abigail DOT eee DOT upd DOT edu DOT ph> writes:
> On 7 May 1996, Barry A Giffel wrote:
> 
> <snip>
>> Next, if SIGINT should not be defined, what's the best way to trap
>> this signal. When a user presses Control-C, the SIGINT signal is
>> generated, I need to be able to catch this signal and run a signal
>> handler routine before exiting.
> <snip>
> 
> The naive solution if you're using Unix is just to set up a signal 
> handler for the appropriate signal:
> 
> void sighandler (int signal)
> {
>   /* do whatever */
> }
> and then in your main code
> 
> signal (SIGINT, sighandler);
> at least, that should work. I'm not too sure under DJGPP because of all 
> the glitches associated with DOS. But since v2 aims for POSIX compliance, 
> it should support this behavior.
>

As far as I know, this will work under DJGPP v2.0 also, but it is dependant on
the DPMI server running. Windows and QDPMI may handle the signals differently.
I think CSDPMI works fine though, and trapping Ctrl-C is as easy as installing
a signal handler. Allegro used to use Ctrl-C as a "hard break" to stop one's
program, but now uses Ctrl-Alt-Del, although I don't think signals were used
for this (Shawn ?)

One should be aware that the Ctrl-C signal will not work 100% of the time,
depending on DPMI ...

Adios
Mark Wodrich.
 

- Raw text -


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