HP Pascal/iX Programmer's Guide (31502-90023)

B- 15
reset (file1);
it is equivalent to the statement:
reset (file1, 'arg1');
If there is no run-time argument for a program header file, then the
upshifted formal name of the file is implicitly associated with it. For
example, if the program above is run with the command:
a.out arg1
then there is no run-time argument for file2, so it is associated with
the file named FILE2. Of course, if you provide an explicit association,
it overrides this implicit association. Also, if the file is already
open before the statement executes, the usual rules apply (that is, the
previous association is maintained).
Interrupt Handling
Your program can trap HP-UX interrupts (SIGINT and SIGQUIT, for example).
The recommended way to trap these signals is to make explicit calls to
the HP-UX system routine
signal
.
NOTE The HP9000 series 200 run-time routine
catch_signals
is supported,
but a call to this routine will severely affect the error-handling
mechanisms described in Chapter 11 , because those depend on
trapping certain HP-UX signals themselves (namely, SIGILL, SIGFPE,
SIGBUS, SIGSEGV, and SIGSYS). Use of this routine is strongly
discouraged.
Example
PROGRAM prog;
CONST
BADSIG = -1;
SIG_DFL = 0;
SIG_IGN = 1;
SIG_INT = 2;
SIG_QUIT = 3;
VAR
Old_Action : integer;
FUNCTION signal (SignalNum : integer;
ProcAddress : integer) : integer; EXTERNAL;
The function signal accepts a signal number, SignalNum, and a procedure
address, ProcAddress. Whenever the signal with the number SignalNum is
raised, the function transfers control to the procedure with the address
ProcAddress. The function signal returns the old stored value of
ProcAddress.
PROCEDURE InterruptHandler (SignalNum : integer); EXTERNAL;
BEGIN
Old_Action := signal (SIGINT, Baddress (InterruptHandler));
IF Old_Action = SIG_IGN THEN
Old_Action := signal (SIGINT, SIG_IGN)
ELSE IF Old_Action = BADSIG THEN
{An invalid SignalNum or ProcAddress was passed};