[Info-vax] login information capture
George Cornelius
cornelius at encompasserve.org
Wed Feb 26 14:00:38 EST 2014
Gotfryd Smolik wrote:
> On Tue, 18 Feb 2014, Stephen Hoffman wrote:
>
>> $ if f$mode() .eqs. "INTERACTIVE"
>> $ then
>> $ read/prompt="Why are you here? " sys$command reason
>
>
> Ensures occurrence of Murphy's laws.
> Paul goes on vacation, someone tries X-windows session :)
> Interactive session does not mean "terminal session" (not only).
>
> IMO the only safe resolution is a double IF: one checking for existence
> of "TT:" *or* interactive mode, and second for DEVCLASS of TT:
>
> $ if f$getdvi("TT:","EXISTS") then - ! or: $ if
> f$mode().eqs."INTERACTIVE")
> if f$getdvi("TT:","DEVCLASS").eq.66 then [...the action...]
>
> Preventing the question - in detached mode "TT" is not defined.
> Yes, checked sometime also by Murphy law ;>
>
> best regards, Gotfryd
Amazing how many things can go wrong in the login command procedures;
especially true for SYS$SYLOGIN. For X window sessions, you generally
do not want to exit with an error status, so it is not uncommon to
end with the command $ EXIT 1.
I generally check SYS$COMMAND and not "TT", but I'm not sure there's
a difference. I believe I use
$ IF F$MODE().EQS."INTERACTIVE" THEN -
$ IF F$GETDVI("SYS$COMMAND","TRM") THEN -
[...]
or an equivalent.
In the case of a $ READ/PROMPT, adding /ERROR=... is probably a
good idea, even if all it does is substitute a default response
string when the read op fails. And if no data is provided you
may want to just loop back and ask again.
George
More information about the Info-vax
mailing list