From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX"  9-NOV-1990 21:12:35.74
To:	MRGATE::"ARISIA::EVERHART"
CC:	
Subj:	Need to find RTAx: terminal information

Received:  by crdgw1.ge.com (5.57/GE 1.76)
	 id AA12024; Fri, 9 Nov 90 20:29:30 EST
Received: From CUNYVM.CUNY.EDU by CRVAX.SRI.COM with TCP; Fri,  9 NOV 90 07:45:38 PDT
Received: from MCCLB0.MED.NYU.EDU by CUNYVM.CUNY.EDU (IBM VM SMTP R1.2.2MX) with BSMTP id 3251; Fri, 09 Nov 90 10:42:45 EST
Date: Fri, 9 Nov 90 10:45 EDT
From: "Ross Smith: (212) 340-5356" <SMITH%MCCLB0.MED.NYU.EDU@CUNYVM.CUNY.EDU>
Subject: Need to find RTAx: terminal information
To: info-vax@kl.sri.com
Message-Id: <08C7894A879F0000CB@MCCLB0.MED.NYU.EDU>
X-Organization: NYU Medical Center, 550 1st Ave., New York, NY 10016
X-Envelope-To: info-vax@kl.sri.com
X-Vms-To: in%"info-vax@kl.sri.com"


The following is a snippet of code whcih provides the LAT node and port for a
given terminal.

I would like to modify this to allow the Node and user of a CTERM session to
be provided (as it would be with SHO USERS/FULL) e.g. BIGVAX::SYSTEM.

I thought it would be easy: just look up the I/O maual and pick the correct
bits of things for the QIO call.  I got lost.  If anyone knows how to do this,
I would appreciate some hints.

(I should emphasis that this is not my code: it is a clipping from a TTYLOC
server for the CMU IP/TCP package)

Please reply to me directly, I do not subscribe to this mailing list.

SMITH@NYUMED.BITNET

--------------------------------------------------------------------

static int lat_port(term,len,node,port)
char *term;
int len;
char *node,*port;
{
   char remote[255];    /* Remote Node/Port */
   $DESCRIPTOR(term_d,"");
   short chan;
   short iosb[4];
   int n;
   char *c;
   int err;

   remote[0] = 0;       /* Initialize to null */
   remote[1] = 0;       /* Initialize to null */

   term_d.dsc$a_pointer = term;
   term_d.dsc$w_length = len;
   CHK_R( sys$assign(&term_d,&chan,0,0) );

   err = sys$qiow(0,chan,IO$_TTY_PORT|IO$M_LT_READPORT,iosb,0,0,
    remote,sizeof(remote),0,0,0,0);
   CHK_R( sys$dassgn(chan) );
   CHK_R( err );        /* this order makes sure channel is deassigned */
   CHK_R( iosb[0] );

/* buffer format appears to be 1 byte count, text, 1 byte count text */

   n = remote[0]&0xff;
   for( c = remote+1; n>0; --n )
      *node++ =  *c++;
   *node = EOS;

   n = (*c)&0xff;
   for( ++c; n>0; --n )
      *port++ =  *c++;
   *port = EOS;

   return SS$_NORMAL;
   }

