Try OpenEdge Now
skip to main content
Programming Interfaces
External Program Interfaces : Host Language Call Interface : HLC applications on UNIX systems : Handling abnormal exits
Handling abnormal exits
In character mode, if you abort to the operating system during application testing, or otherwise must abort from your production version, make sure your HLC application does not terminate with raw terminal I/O. Set the terminal to cooked terminal I/O before exiting. This prepares the terminal for UNIX operation, as shown in the following example:
* Example of a fatal error exit for an HLC application.
* Note how the terminal is returned to cooked mode before
* exiting. Note also that exiting in this fashion can be
* hazardous to your database. (This function should only
* occur in program development phase for convenience in the
* debugging process.)

void hl_fexit (code)
proscopn(); /* restore terminal to cooked mode */
exit (1);
Caution: An abnormal exit function might be useful during testing, but you should never include it in a production executable. Since it bypasses OpenEdge shutdown processing, this function can cause irrecoverable database damage.
OpenEdge automatically restores cooked-mode terminal I/O before exiting. If your application aborts in raw mode, the user can enter commands but might not see the result.
To reset a character-mode terminal in raw mode at a UNIX shell prompt:
1. Press CONTROL-J several times. Shell prompts appear on the display.
2. If the stty command on your version of UNIX has a sane option, enter the following command, followed by CONTROL-J:
stty sane
If your stty command does not have a sane option, enter the following command, followed by CONTROL-J:
stty echo icanon icrnl opost