From:	MERC::"uunet!CRVAX.SRI.COM!RELAY-INFO-VAX" 15-MAR-1993 22:06:03.40
To:	Info-VAX@KL.SRI.COM
CC:	
Subj:	Re: How to detect if user logged in with /NOCOMMAND?

In article <14MAR199305494817@spades.aces.com>, gavron@spades.aces.com (Ehud Gavron) writes:
> In article <01GVR56KKG9U8WW1HG@kopc.hhs.dk>, ARNE@kopc.hhs.dk (Arne Vajhj) 
> writes...
> #> Does anybody know how one can detect if someone logged in with the
> #> qualifier /NOCOMMAND.
> 
> No.  (well, you could ask them...)
> 
> The information actually is gone before the command procedures execute
> since it's translated internally to the CLI.  This can be verified via

Well there *may* be a way.  The original question asked if there was a way to
find out if the /NOCOMMAND was used, and not its argument.  I noticed that
there is a field  PPD$B_NPROCS in the CTL region, which goes from 2 to 1 if you
login via /NOCOMMAND (it similarly is one less if you deassign SYS$SYLOGIN). If
this cell is used by the CLI to decide how many PROC symbols to search for,
then it would seem to answer your question.

Here is a procedure which returns the value of this cell.  You could call
it from a program, which then calls LIB$SET_SYMBOL if you need the info from
DCL.  It requires CMEXEC privileges to extract the information.  Please
note that whereas I have just tested it on my workstation (VMS 5.5-2) it is
up to you to test it to your satisfaction (I have not added safety checks for
things like running it from a process without a CLI).

Hope it is of use.

------------------------------------------------------------------------------
Tom Wade        | Internet: T.Wade@vms.eurokom.ie  (all domain mailers).
Network Manager | DEC Enet: DECWRL::"t.wade@vms.eurokom.ie"  (VMS Mail)
EuroKom         | PSI-Mail: PSI%272431001992::_T_WADE
UCD Belfield    | JANET:    t.wade%ie.eurokom.vms@UK.AC.EARN-RELAY
Dublin 4        | X400:     g=tom;s=wade;o=eurokom;p=eurokom;a=eirmail400;c=ie
Ireland         | Telex:       (0500) 91178 UCD EI  ("TO: WADE" at start)
-------------------+----------------------------------------------------------
Tel: +353-1-2830555|  Official Disclaimer:  "This is not a disclaimer"
Fax: +353-1-2838605|          Unix  ....  Just say No !
----------- Cut Here ---------------------------------------------------------
;   Routine to get the number of command files the CLI was required to
;   run before the interactive loop.
;
;	Tom Wade T.Wade@vms.eurokom.ie
;
;   Calling sequence   status_code := GET_NPROCS (nprocs)
;
;    nprocs:   address of longword to receive number of files.
;   Program requires CMEXEC privileges to get at the data.


		.Title	GET_NPROC_NUMBER

		.Link	"SYS$SYSTEM:DCLDEF.STB"/SELECTIVE_SEARCH
		.Link	"SYS$SYSTEM:SYS.STB"/SELECTIVE_SEARCH
                    

		.Entry	GET_NPROCS ^M <R6>

		$CMEXEC_S	-		; Nip upstairs and get the
			routin=GET_INFO		; information.

		Movl	R6,	@4(AP)		; Give it to caller.
		Ret

Get_Info:	.Word	0			; don't save any registers.
		Movl	#Ctl$Ag_Clidata, R6	; get address of CLI data.
		Movzbl	Ppd$B_Nprocs(R6),   R6	; get the required field
		Movl	#SS$_Normal, R0		; indicate OK
		Ret				; and out of here.

		.End                                        
----------------- Cut Here ----------------------------------------------

