Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!cbmvax!vu-vlsi!colin From: colin@vu-vlsi.UUCP Newsgroups: comp.lang.c,comp.sys.ibm.pc Subject: Re: Help with ^C in MS-DOS Message-ID: <667@vu-vlsi.UUCP> Date: Tue, 24-Mar-87 16:00:24 EST Article-I.D.: vu-vlsi.667 Posted: Tue Mar 24 16:00:24 1987 Date-Received: Thu, 26-Mar-87 02:44:02 EST References: <234@cup.portal.com> <1922@hoptoad.uucp> Reply-To: colin@vu-vlsi.UUCP (Colin Kelley) Distribution: world Organization: Villanova Univ. EE Dept. Lines: 26 Xref: utgpu comp.lang.c:1315 comp.sys.ibm.pc:2518 In article <1922@hoptoad.uucp> pozar@hoptoad.UUCP (Tim Pozar) writes: >In article <234@cup.portal.com> RichardKitts@cup.portal.com writes: >> >> I am trying to prevent a ^C break in MS-DOS using MSC 4.0. > > There are a couple of ways to handle a ^C. > MSC provides the best way. Look up signal() (page 350 Run Time >Library Manual). Signal() will let you define what should go on when >a ^C is received by the programme. In this way you can define how the >programme should go through an orderly exit of the routine or the programme >itself. The example on page 352 is a good example of this. > Tim Pozar Beware that MS-DOS (starting with version 3.0) uses its own stack, and as a result, the stack segment will not be correct when the signal handler is started. (Don't the compiler writers talk to the MS-DOS people???) The symptom of this problem is a "stack overflow" message when the ^C handler is invoked. I've got a very short assembly language routine to get around this--it first restores the stack segment, then calls the C signal handler. I can mail you the routine if you want it. (It's not worth posting since I just posted it a few months ago...) -Colin Kelley ..{cbmvax,pyrnj,bpa}!vu-vlsi!colin >terrorist cryptography DES drugs cipher secret decode NSA CIA NRO IRS >coke crack pot LSD russian missile atom nuclear assassinate libyan RSA