TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Paul Edwards
from: Rowan_Crowe
date: 1996-10-04 11:22:08
subject: using ctrlbrk()

* Paul Edwards writes to Frank Adam, on Thursday October 03 1996
   at 00:04:

 FA>> Yep, if the handler returns 0 it will quit, make it return 1.
 FA>> Try something like this..

...

 FA>> puts("Quit ? (y/N)");
 FA>> if(getch() != 'y') return (1); /* nah */
 FA>> return (0); /* quit */
 FA>> }

 PE> Well, you got me to look up my standard, but unless your section
 PE> 7.7.1.1 is different from mine, the return value from your handler is
 PE> irrelevant.  Actually, not so much irrelevant as ILLEGAL.  The signal
 PE> handler is meant to be of return type "void".

In that case, it's not possible to write a 'legal' DOS ^C handler.

Return: AH = 00h abort program
        if all registers preserved, restart DOS call

I hope we're both talking about the same thing, I never saw Frank's
original message, and I presume it was in reply to Paul Wankadia, who
wanted to stop people pressing ^C.

I'm not sure that Frank's code would satisfy "all registers
preserved" ... ?

Note that using ^C to terminate a program is usually a fairly violent way
of doing things, if you have interrupts hooked, or other system state
changes that need to be restored. That's why you use the handler, of course
. . .

Cheers.

---
* Origin: Sensation BBS: Jelly-Bean support, Melbourne AUSTRALIA (3:635/728.1)
SEEN-BY: 50/99 620/243 623/630 632/349 635/503 544 727 728 670/218 711/409
SEEN-BY: 711/410 413 430 808 809 932 934 712/515 713/888 714/906 800/1
@PATH: 635/728 727 544 50/99 711/808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.