Path: utzoo!attcan!uunet!cs.utexas.edu!yale!cs.yale.edu!spolsky-joel From: spolsky-joel@CS.YALE.EDU (Joel Spolsky) Newsgroups: comp.sys.ibm.pc.programmer Subject: int24.c - intercept ugly Abort Retry Ignore prompts Message-ID: <19736@cs.yale.edu> Date: 21 Mar 90 20:37:24 GMT Sender: news@cs.yale.edu Reply-To: spolsky-joel@CS.YALE.EDU (Joel Spolsky) Organization: Yale University Computer Science Dept, New Haven CT 06520-2158 Lines: 135 Hi! Enclosed, uuencoded, please find int24.c. It is a routine I wrote to trap interrupt 24 and provide a slightly more user-friendly error message than DOS's usual "Abort, Retry, Ignore...". I thought I'd post it here in case anyone found it useful. To use this, just call install_24() at the beginning of your program and uninstall_24() at the end. If there is a disk error the interrupt will pop up a slightly more friendly message, let the user choose a course of action, and restore the screen. The two most common errors, namely, write-protection and no disk in drive, generate more meaningful error messages than weird errors. This is in Turbo-C. I had to uuencode it because I used some extended line drawing characters for the pop-up box. It's probably easily portable to other compilers. It works with DOS 2.X and up although you should know that DOS 2.X didn't allow "fail" so under 2.X that option won't pop up. (I don't have DOS 2 so I couldn't test that). Please let me know if you find bugs, have comments, etc. Also if you port this to another compiler, please send me the port so I can incorporate it. +----------------+----------------------------------------------------------+ | Joel Spolsky | bitnet: spolsky@yalecs.bitnet uucp: ...!yale!spolsky | | | internet: spolsky@cs.yale.edu voicenet: 203-436-1538 | +----------------+----------------------------------------------------------+ #include begin 644 int24.c M+RHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ*BHJ M*BHJ*BHJ*BHJ*BHJ"B!I;G0R-"YC"@H@*$,I(#$Y.3 @2F]E;"!3<&]L2!T:&4@875T:&]R+@H@66]U M(&-A;B!D;R!W:&%T979E2X*("HJ"B J*B!.;W1E.B!7 M92!D;VXG="!L970@=&AE('5S97(@:6=N;W)E('1H92!E2!S:&]U;&1N)W0*("HJ(&)E(&1O:6YG(&%N>7=A>2X*("HJ"B J*B!( M25-43U)9"B J*B M+2TM+2TM"B J*B Q.2!-87(@.3 )0W)E871E9"!*4PH@ M*BHO"@HC:6YC;'5D92 \8FEO"D["G9O:60@9F%S='!R:6YT>BAI;G0@>"P@:6YT('DL(&EN="!A M='1R+"!C:&%R("IS*3L*"G9O:60@:6YT97)R=7!T("@J;VQD=F5C="DH*3L) M"0D@( IU;G-I9VYE9"!S8W(["0D)"2\J(%1H92!S96=M96YT('=H97)E('1H M92!S8W)E96X@:7,@*B\*"B\J*B!I;G-T86QL7S(T"B J*@H@*BH@26YS=&%L M;',@=&AE(&9A;F-Y(&EN=&5R$(P,# @;W(@,'A".# P("HO"@E?04@@/2 P>#!&.PH)9V5N:6YT97)R=7!T M("@P>#$P*3L*"6EF("A?04P@/3T@-RD*"0ES8W(@/2 P>$(P,# ["@EE;'-E M"@D)PH)+RH@4F5S=&]R92!O;&0@:&%N9&QE"P*"0D)("!U;G-I9VYE9"!C>"P@ M=6YS:6=N960@8G@L('5N# P1D8["2\J M($5RB@@ M.2PR-RPP># W+"*Z17)R;W(A(" @(" @(" @(" @(" @(" @NB(I.PH)9F%S M='!R:6YT>B@Q,"PR-RPP># W+"*Z(" @(" @(" @(" @(" @(" @(" @(" @ MNB(I.PH*"2\J($-O;6UO;B!D:6%G;F]S86)L92!PPH)"6-A# R.@H)9F%S='!R:6YT>B@Q,2PR-RPP># W+"*Z1&ES:R!DB@Q,2PQ-RPP># W+"*Z1&ES:R!E&ET('1H M:7,@<')O9W)A;2 @(" @(+HB*3L*"69A2!C86X@86QS M;R!F86EL('1H92!D:7-K(&%C8V5SPH)9F%S='!R:6YT>B@Q-2PR-RPP># W+"*Z($-A;F-E;"!T:&ES(&]P97)A M=&EO;B @NB(I.PH)9F%S='!R:6YT>B@Q-2PR.2PP>#!F+")#(BD["@E]"@EE M;'-E"@EF87-T<')I;G1Z*#$U+#(W+#!X,#2@P*3L*"@D):68@*&ME>2 F(#!X,#!&1BD*"0D):V5Y("8] M(#!X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