From:	CSBVAX::MRGATE!RAND@merrimack.edu@SMTP 25-JAN-1988 22:43
To:	ARISIA::EVERHART
Subj:	Finger mods


Received: from relay2.cs.net by RELAY.CS.NET id ab17930; 25 Jan 88 16:36 EST
Received: from merrimack.edu by RELAY.CS.NET id ab07783; 25 Jan 88 16:17 EST
Date: Mon, 25 Jan 88 14:45 EST
From: "Rand P. Hall" <RAND%merrimack.edu@RELAY.CS.NET>
Subject: Finger mods
To: everhart%arisia.decnet@GE-CRD.ARPA
X-VMS-To: IN%"everhart%arisia.decnet@ge-crd.arpa",RAND        

Glenn,

In the event you haven't ditributed the SIG tape yet, I've enclosed an
updated Get_Location routine. It fixes a couple of bugs that popped up
once my system stayed up long enough to have my terminals roll over to
LTAxxxx. I also made a call to Make_Pretty to spruce up the
server/port names. Just replace the old routine with this one. In the
event that the SIG tape's gone out, at least YOU will have it. I've
also made some mods in the Mail support code so that  there is an
additional option (the current options being show all messages or show
the LAST message). My option is really 'proper' one, show all messages
from the requesting user. I can forward that code too if you'd like
though I'm about to improve upon it. Also, did you notice that whoever
did this latest version made the very bad assumption that you should
only be allowed to finger users registered in the database? How gauche!

rand

c------------------------------------------------------------------------------
	Character*25	Function Get_Location(Terminal,TTType,PID)
c  This routine returns the location and terminal type, giver the
c  terminal name.  It user the data in the shared common section.
c  ! site-specific
c  If the terminal begins with RT it is considered a DECnet terminal.
c  If it begins with PT is ia assumed to be a pseudoterminal.  We use
c  these to connect to a network called jnet.  These can be ignored
c  if you don't have them, otherwise change appropriately.
c  If the terminal begins with VT its considered a VMS V4.x virtual
c  terminal and the associated physical terminal is used.
c  In the normal situation, the 25 characters returned are
c  the location and 25 for the type.  Obviously these can be 
c  can be shortened for printing (I normally print 15 + 25)
	Include		'FingerCom.For'
c Site-specific
c LAT ident stuff
c [rph] 01-06-88 - Server names and port names can be as large as
c		   16 and 12 characters respectively. By default only
c		   the first 8 characters of each are displayed. This
c		   can easily be changed.
	Include 'fingerdef.inc'
	Include '($JPIDEF)'
	Character Server*16, Port*12, Make_Pretty*70
	Integer Session, Status, LAT_Info, colon
	Integer		Privilege(2) /0,0/
	External LAT_Info
c end LAT ident data
	Character	Terminal*8, TTType*25
	Character	Network*20,	Get_Network*20
	Character	Node*12,	Get_Decnet_Node*6
	Character	Get_jnet_Node*8
	Integer		Btrim,		PID
	Integer		I_Device(4)
	Byte		B_Device(16), B_Device_Len
	Character	C_Device*15
	Equivalence	(I_Device, B_Device)
	Equivalence	(B_Device(1), B_Device_Len)
	Equivalence	(B_Device(2), C_Device)
	Integer		Lib$GetDVI
	External	Lib$GetDVI
	Integer DVI$_TT_PhyDevNam/274/
	Character	Phy_Terminal*8
	Integer		L_Phy_Terminal
	Get_Location = ' '	! If location can't be found
	TTType = ' '
c  first see if a VT (virtual terminal) is connected to a physical
c  terminal.
	If ( Terminal(1:2) .eq. 'VT' ) then
	    terminal='_'//terminal
	    Call Lib$GetDVI(DVI$_TT_PhyDevNam,,Terminal,,
     1	      Phy_Terminal,L_Phy_Terminal)
	    If (L_Phy_Terminal.gt.0)
     1	      Terminal = Phy_Terminal(2:L_Phy_Terminal)//':'
	Endif

	If ( Terminal(1:2) .eq. 'RT' ) Then
	    Node = Get_DECnet_Node(PID)
	    Network = Get_Network('D')
	    If ( Network .eq. '?' ) Network = 'DECnet'
	    Get_Location = Node(:Btrim(Node))//
	1	'.'//Network(:Btrim(Network))
	ElseIf ( Terminal(1:2) .eq. 'PT' ) Then	! Site-specific
	    Node = Get_jnet_Node(Terminal)
	    Network = Get_Network('J')
	    If ( Network .eq. '?' ) Network = 'jnet'
	    Get_Location = Node(:Btrim(Node))//
	1	'.'//Network(:Btrim(Network))
	ElseIf ( Terminal(2:3) .eq. 'VT' ) then
	    Get_Location = '<disconnected>'
	ElseIf ( Terminal(1:2) .eq. 'LT' ) then
	    Get_Location = 'Lat'
c ** Site-Specific
c  Call routine to get LAT info
		colon = Index(terminal,':')
		terminal = terminal(1:colon)
c  Turn on CMKRNL privilege
		Privilege(1) =  Prv$M_Cmkrnl
		Call Sys$Setprv(%Val(1),Privilege,,)
c  The LAT session number is returned also. You might find it useful.
		Status = LAT_info (Terminal(1:colon), Session, Server,
     1			Port)
c  Turn off CMKRNL privilege
		Call Sys$Setprv(,Privilege,,)
		If (Status) then
		  Server = Make_Pretty(Server)
		  Port = Make_Pretty(Port)
		  Get_Location = Server(1:8) // ' ' // Port(1:8)
		endif
	ElseIf ( Terminal(1:2) .eq. 'PX' ) then
	    Get_Location = 'PC Network'
	Else
c	  search for Terminal in shared common database
	    Do ii = 1,Loc$I_Last
		If ( Loc$C_Terminal(ii) .eq. Terminal ) then
		    Get_Location = Loc$C_Location(ii)
		    TTType = Loc$C_TTType(ii)
		    Return
	    	End if
	    End do
	EndIf
	Return
	End
