Operating System - OpenVMS
1820890 Members
3887 Online
109628 Solutions
New Discussion юеВ

How to disable <ctrl>-c for an OpenVms account?

 
SOLVED
Go to solution
CO_5
Advisor

How to disable <ctrl>-c for an OpenVms account?

It seems there is no flag for ctrl-c, under uaf. I found RCTRLC after goggling on web. But, RCTRLC needs to be incorporated in code.

Questions:
1. How to disable CTRL C for an account ?
2. If RCTRLC is the only way, how should i incorporate it so that when the user account logins into VMS, he/she is prevented from using CTRL -C ?

Thks.
CO
14 REPLIES 14
Volker Halle
Honored Contributor

Re: How to disable <ctrl>-c for an OpenVms account?

CO,

you can use SET NOCONTROL=Y (see $ HELP SET CONTROL EXAMPLE) and the associated /FLAGS in UAF (e.g. DISCTLY).

In a program, you can use LIB$DISABLE_CTRL.

You may also want to read chapter 5.2.1.2 (Terminal Driver Features) in the I/O User's Reference Manual.

You may also want to consider setting the user account CAPTIVE, depending on what you're trying to achieve by disabling CTRL-C.

Volker.
Steven Schweda
Honored Contributor

Re: How to disable <ctrl>-c for an OpenVms account?

1. Remove one or more keys from the users'
keyboards?

2. If the RCTRLC at which you're looking is
the RCTRLC at which I'm looking, then it's a
BASIC feature, not a general VMS feature.

CTRL/C does different things in different
situations. Exactly what is it that you
don't want the users to be able to do?
Steven Schweda
Honored Contributor

Re: How to disable <ctrl>-c for an OpenVms account?

1. Remove one or more keys from the users'
keyboards?

2. If the RCTRLC at which you're looking is
the RCTRLC at which I'm looking, then it's a
BASIC feature, not a general VMS feature.

CTRL/C does different things in different
situations. Exactly what is it that you
don't want the users to be able to do?

SET TERMINAL /PASTHRU
(Probably not what you want, but I don't
really know what you want.)
Jeremy Begg
Trusted Contributor

Re: How to disable <ctrl>-c for an OpenVms account?

Do you mean Ctrl-C or Ctrl-Y? By default, both have the same effect, i.e. abort the currently executing program or DCL command.

However, by convention, Ctrl-C can be used by programs to mean "abort the current operation, but not the program" and hence it's relatively easy to include code in an application program to detect when Ctrl-C has been pressed. Ctrl-Y on the other hand generally means "abort the program" and is more difficult to trap. (You can however enable or disable it under program control.)
If a program doesn't include code to trap Ctrl-C the VMS device drivers will treat Ctrl-C as if the user had pressed Ctrl-Y.

I suspect you really want to be able to disable Ctrl-Y, and this is easily done via a flag in SYSUAF. For example:

$ MCR AUTHORIZE
UAF> MODIFY username/FLAG=DISCTLY

With DISCTLY in effect, the user process is started with Ctrl-Y disabled. However it's intended to be used with CAPTIVE or RESTRICTED accounts that don't allow the user to access the DCL command prompt. If the user is able to type DCL commands he or she could use the $ SET CONTROL=Y command to enable Ctrl-Y once logged in.

Regards,

Jeremy Begg
CO_5
Advisor

Re: How to disable <ctrl>-c for an OpenVms account?

thks for the fast response. ok. Guys. here is what i want to achieve.

I know how to disable ctrl y BUT not ctrl C.

Basically, I have a program which does not work well when ctrl C invoked. I want to prevent users from using ctrl c.

Removing the key probably is the last creative resort i wnt to try. :)

SET TERMINAL /PASTHRU , i am not sure what this does.

What is this LIB$DISABLE_CTRL ? can it be incorporated in a login file/script ?

Captive flag does not help much in my case, as it only disable ctrl y behavior.

Thks for the feedbacks.



Volker Halle
Honored Contributor

Re: How to disable <ctrl>-c for an OpenVms account?

CO,

did you bother to read the I/O User's Reference Manual ?

There is even an example included (Example 5-4) on using CTRL-C and CTRL-Y handling - including the LIB$DISABLE_CTRL RTL routine.

http://h71000.www7.hp.com/doc/82FINAL/aa-pv6sg-tk/aa-pv6sg-tk.PDF

Typing CTRL-C when running a program invokes a CTRL-C AST routine, if one has been set up by the program. If not, it's converted to a CTRL-Y.

Volker.
Robert Gezelter
Honored Contributor

Re: How to disable <ctrl>-c for an OpenVms account?

CO,

I am unclear as to what "does not work well" means. If interrupting the program is bad, then BOTH CNTRL/Y and CNTRL/C are an issue, and the command SET NOCOMMAND=(Y) is the correct response.

Remember, for all intents and purposes either interrupts the program's execution unless other provisions have been made.

Please clarify what the precise problem is.

- Bob Gezelter, http://www.rlgsc.com
CO_5
Advisor

Re: How to disable <ctrl>-c for an OpenVms account?

I am trying to prevent users from using ctrl-c in a program.

Anyway, after some consideration, i think it is still the best way to advise users to avoid use it, rather than have to disable it.

Thks.
Jon Pinkley
Honored Contributor

Re: How to disable <ctrl>-c for an OpenVms account?

CO,

Did you try the suggestion to use

$ set nocontrol=y

That will disable both Control-Y and Control-C. And it requires no changes to your programs.

This is assuming the program isn't doing something to enable it, but if the program was going to the trouble to do that, it would be catching the exception and doing cleanup work before shutting down.

The only downsides of doing this is that you will not be able to abort a program that has a bug, and you will have to issue a

$ stop/id=xxxx[/image][/exit]

from another process in that case.

Also, if you start doing something that takes a long time, you will not be able to abort it.

Your alternative, if you have sourcecode and the programming skills, is to modify your programs so they handle a control-C and do the right thing. For an example, look at the EDT editor. If you open a large text file, and then search for something, you are able to press control-c and it will abort the search, but not exit the editor.

Good luck in training your users not to use control-C or control-Y.

Jon
it depends
John Abbott_2
Esteemed Contributor
Solution

Re: How to disable <ctrl>-c for an OpenVms account?

CO,

You have my sympathy. We have restricted & DisCtlY accounts also with set nocontrol=Y in the DCL, yet the 3rd party app aborts in a mess when ctrlC is pressed (user thinks they can copy (windows!)). CTRLY does nothing - as expected. I explored the LIB$DISABLE_CTRL RTL avenue, it didn't work for me. We ended up disabling CTRL_C key sequence in the PC VT emulator we use.

Regards
John.
Don't do what Donny Dont does
Jon Pinkley
Honored Contributor

Re: How to disable <ctrl>-c for an OpenVms account?

John Abbott>>>You have my sympathy. We have restricted & DisCtlY accounts also with set nocontrol=Y in the DCL, yet the 3rd party app aborts in a mess when ctrlC is pressed (user thinks they can copy (windows!)). CTRLY does nothing - as expected. I explored the LIB$DISABLE_CTRL RTL avenue, it didn't work for me. We ended up disabling CTRL_C key sequence in the PC VT emulator we use.<<<

So this third party product is trapping Control-C but not handling it correctly? I suppose that's possible. I just tried using EDT after $ set nocontrol=y, and it does behave differently, the CANCEL mesage from the terminal driver is displayed, and nothing else happens until you enter another key, then it displays "CTRL/C ignored" at the bottom of the screen. Control-Y just messes up the screen with the Interrupt message from the terminal driver, but is otherwise ignored, and the screen can be fixed with Control-W.

Does the application normally do something different when Control-C is pressed vs. Control-Y? What message is displayed by the terminal driver, Cancel or Interrupt? If the program isn't trapping control-C you will get "Interrupt" when Control-C is pressed.

Some terminal emulators are more capable than others, and allow you to map keyboard scan codes instead of ascii characters, so you could make the combination of left-contrl+C and right-contrl+C do nothing but allow some other combination to send a 0x03 (ASCII Control-C). That way you could still send a control-C when necessary, but the standard key combination wouldn't trigger the bug.

Jon
it depends
John Abbott_2
Esteemed Contributor

Re: How to disable <ctrl>-c for an OpenVms account?

Hi Jon,

> So this third party product is trapping Control-C but not handling it correctly?

Correct.

We don't get INTERRUPT or CANCEL, but a nasty Internal i/o terminal driver error.

Kind Regards,
John.
Don't do what Donny Dont does
CO_5
Advisor

Re: How to disable <ctrl>-c for an OpenVms account?

that is a good one: disabling CTRL_C key sequence in the PC VT emulator. Bravo!
CO_5
Advisor

Re: How to disable <ctrl>-c for an OpenVms account?

close