RichardKitts@cup.portal.com.UUCP (03/22/87)
I am trying to prevent a ^C break in MS-DOS using MSC 4.0. If anyone could mail me some generic routines, pointers, or reference sources I would be grateful. Thanx in advance. sun!cup.portal.com!RichardKitts
pozar@hoptoad.UUCP (03/24/87)
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. >If anyone could mail me some generic routines, pointers, or reference >sources I would be grateful. I assume your refering to a programme that was compiled under MSC 4.0, not while MSC is compiling. 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. You can also put the Console into the 'RAW' mode where MS-DOS does not do any ^C checking. This can be done with the dos call 'I/O Control for Devices', (44h). And can be accessed through the intdos() function provided by MSC 4.0. -- Tim Pozar UUCP pozar@hoptoad.UUCP Fido 125/406 USNail KLOK-FM 77 Maiden Lane San Francisco CA 94108 terrorist cryptography DES drugs cipher secret decode NSA CIA NRO IRS coke crack pot LSD russian missile atom nuclear assassinate libyan RSA
colin@vu-vlsi.UUCP (03/25/87)
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
geoffs@gssc.UUCP (03/27/87)
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. >If anyone could mail me some generic routines, pointers, or reference >sources I would be grateful. > Thanx in advance. > > > sun!cup.portal.com!RichardKitts The MSC 4.0 library contains a function named 'signal' which allows you to trap ^C breaks at the keyboard. Its use is straightforward and looks something like this: signal(SIGINT,KeyBreak); /* SIGINT means trap Int23h */ /* KeyBreak is a function -> to a user-defined routine to handle the ^C break */ KeyBreak looks like this: int KeyBreak() { /* body of code implementing what you would like to do in the ^C handler */ signal(SIGINT,KeyBreak); /* ensure ^C break next time also */ } Hope this helps you. Be sure to look in the MSC reference manual for more complete descriptions. Geoffs (Geoffrey Shapiro)