[comp.os.vms] $TRNLNM System Service problen in VAX C

barsh@stsci.EDU (John Barshinger) (12/02/87)

This is an example of using the ss $TRNLNM in VAX C.  This is
in response to a problem someone had earlier.  Sorry about posting
this instead of mailing, my mailer can't find anybody (the link is
down)


Jeremy,

here's a working version, hope it helps...

				jrbii
				~~~~~



#include stdio
#include descrip
#include ssdef
#include lnmdef

typedef struct 
{
    short buflen;
    short itemcode;
    char  *buff_addr;
    short *retlen_addr;
    int   terminator;
} item_descriptor;

main ()
{

$DESCRIPTOR(tabnam,"LNM$FILE_DEV");
$DESCRIPTOR(lognam,"SYS$COMMAND");

char	device_name[256];
short 	return_length;
int	status;
item_descriptor itemlist = { 256, LNM$_STRING, device_name, &return_length, 0};


status = sys$trnlnm(0,&tabnam,&lognam,0,&itemlist);
if ( status != SS$_NORMAL)
	return(status);

device_name[return_length]=0;
if (device_name[0] = 27)		/* see system service man pg. 6-10 */
	strcpy(device_name, &device_name[4]);

printf("%s\n",device_name);

}

-- 
	        John Barshinger	
		Space Telescope Science Institute
		Baltimore, MD 21218
		plink:jrbii | bix:jrbii | barsh@stsci.edu