[an error occurred while processing this directive]

HP OpenVMS Systems

ask the wizard
Content starts here

» close window

The Question is:

 
 
What signal is generated when user presses
CTRL-Y ? I tested for SIGTERM but it did not
work. I could not find any signal number
matching CTRL-Y in signal.h.
Help would be greatly apprecicated.
 
Regards,
Raj Mohan
 
 


The Answer is :

There are a few basic things you need to understand, in order to address your
question.
 
First, Unix signals are not implemented by the operating system on VMS; instead,
they are simulated for your application by the C run-time library.
 
Second, hitting Ctrl-Y (usually) does nothing more than suspend your application
and return control to the CLI (i.e., DCL).  [Hitting Ctrl-Y on VMS is very
similar to hitting Ctrl-Z on Unix.]  Once at the DCL prompt, your major options
are:
 
	CONTINUE causes your application to resume as if the interrupt had
		not occured.
	SPAWN	causes DCL to create a subprocess, and leaves your application
		suspended (you will be able continue its execution when you
		return from the subprocess).
	STOP	causes your application to terminate without running exit
		handlers, and returns you to the DCL prompt.
	EXIT	causes your application to terminate by immediately running exit
		handlers, and returns you to the DCL prompt.
	Most other commands have the same effect as typing EXIT, except that,
		after your application exits, your command is executed before
		returning to the prompt.
 
Thus, just hitting Ctrl-Y has no effect on your application, other than
suspending it; that is, no signal is sent to your application as a result of
hitting Ctrl-Y.
 
Now, hitting Ctrl-C is a different story.  If you make no arrangements to handle
it, hitting Ctrl-C has exactly the same effect as hitting Ctrl-Y.  However, if
you establish a handler for SIGINT, then hitting Ctrl-C will invoke your handler
instead of suspending your application.  (You should note that hitting Ctrl-Y
produces output on your terminal like "*Interrupt*"; hitting Ctrl-C will produce
the same output if it is unhandled, and it will produce "*Cancel*" if it is
handled.)
 
As for catching Ctrl-Y, yes, it can be done.  However, this Wizard doesn't
recommend doing it:  whatever you wanted to do in the Ctrl-Y handler is probably
better done with an exit handler -- see $DCLEXH.  Nevertheless, if you must do
it, look up the documentation on the terminal driver and "out of band ASTs".

answer written or last revised on ( 14-OCT-1998 )

» close window