| 709 | |
| 710 | #ifndef SHAREDLIB |
| 711 | void |
| 712 | Abort(long rc) |
| 713 | { |
| 714 | int fault = 1; |
| 715 | #ifdef CHDIR |
| 716 | extern char orgdir[]; |
| 717 | chdir(orgdir); |
| 718 | #endif |
| 719 | #ifdef AMII_GRAPHICS |
| 720 | if (Initialized && ConsoleDevice |
| 721 | && windowprocs.win_init_nhwindows == amii_procs.win_init_nhwindows) { |
| 722 | printf("\n\nAbort with alert code %08lx...\n", rc); |
| 723 | amii_getret(); |
| 724 | } else |
| 725 | #endif |
| 726 | printf("\n\nAbort with alert code %08lx...\n", rc); |
| 727 | /* Alert(rc); this is too severe */ |
| 728 | #ifdef __SASC |
| 729 | #ifdef INTUI_NEW_LOOK |
| 730 | if (IntuitionBase->LibNode.lib_Version >= 37) { |
| 731 | struct EasyStruct es = { |
| 732 | sizeof(struct EasyStruct), 0, "NetHack Panic Request", |
| 733 | "NetHack is Aborting with code == 0x%08lx", |
| 734 | "Continue Abort|Return to Program|Clean up and exit", |
| 735 | }; |
| 736 | fault = EasyRequest(NULL, &es, NULL, (long) rc); |
| 737 | if (fault == 2) |
| 738 | return; |
| 739 | } |
| 740 | #endif |
| 741 | if (fault == 1) { |
| 742 | /* __emit(0x4afc); */ /* illegal instruction */ |
| 743 | __emit(0x40fc); /* divide by */ |
| 744 | __emit(0x0000); /* #0 */ |
| 745 | /* NOTE: don't move amii_cleanup() above here - */ |
| 746 | /* it is too likely to kill the system */ |
| 747 | /* before it can get the SnapShot out, if */ |
| 748 | /* there is something really wrong. */ |
| 749 | } |
| 750 | #endif |
| 751 | #ifdef AMII_GRAPHICS |
| 752 | if (windowprocs.win_init_nhwindows == amii_procs.win_init_nhwindows) |
| 753 | amii_cleanup(); |
| 754 | #endif |
| 755 | #undef exit |
| 756 | #ifdef AZTEC_C |
| 757 | _abort(); |
| 758 | #endif |
| 759 | exit((int) rc); |
| 760 | } |
| 761 | |
| 762 | void |
| 763 | CleanUp(void) |
no test coverage detected