home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!dtix!darwin.sura.net!ukma!usenet.ins.cwru.edu!news.ysu.edu!psuvm!frmop11!dearn!dmswwu1a!reschke
- From: RESCHKE@DMSWWU1A.UNI-MUENSTER.DE (Julian F. Reschke)
- Newsgroups: comp.sys.atari.st.tech
- Subject: Re: Trapping ^C
- Message-ID: <92227.122551RESCHKE@DMSWWU1A.UNI-MUENSTER.DE>
- Date: 14 Aug 92 11:40:33 GMT
- References: <1992Aug14.071027.24659@mnemosyne.cs.du.edu>
- Lines: 26
- Organisation: Westfaelische Wilhelms-Universitaet, Muenster, Germany
-
- In article <1992Aug14.071027.24659@mnemosyne.cs.du.edu>, ilepore@nyx.cs.du.edu
- (Ian Lepore) says:
- >
- > What's a good method of trapping a ^C from within a program and ignoring
- >it? I've tried using the terminate handler (vector 0x0102) but that gets
- >control on *any* type of program exit (ie, even if you called exit()). I
- >can't find anything in the atari docs that says how to tell if the terminate
- >handler was invoked by a detection of ^C in DOS, but (oddly enough) they
- >call that vector the ^C handler in the docs.
- >
- > (Actually, leave out the "and ignoring it" part of that question. I can
- >handle that part of it with a longjmp, I just need to be sure it's a ^C
- >termination and not a normal program exit.)
-
- According to the official documentation, you are not allowed to to
- further GEMDOS calls from within the terminate handler. This means, that
- all current 'solutions' that *do* catch CTRL-C this way are doing
- something unofficial (note that it's easy when you are using MiNT...).
-
- >
- > (Also, suggestions like "uninstall your 0x0102 handler in the exit()
- >routine" are Not An Option for me -- the program could have done a Pterm()
- >or a gemdos(0) or something else that I can't catch at all.)
-
- The terminate handler is called *BY* the Pterm*() functions -- you can rely
- on that to remove your handler.
-