From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 16-AUG-1989 21:00
To:	MRGATE::"ARISIA::EVERHART"
Subj:	Re: UIS$ logical name utility wanted (here it is)

Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Wed, 16 AUG 89 17:14:32 PDT
Received: from ucbvax.Berkeley.EDU by KL.SRI.COM with TCP; Wed, 16 Aug 89 16:46:12 PDT
Received: by ucbvax.Berkeley.EDU (5.61/1.37)
	id AA03767; Wed, 16 Aug 89 16:21:42 -0700
Received: from USENET by ucbvax.Berkeley.EDU with netnews
	for info-vax@kl.sri.com (info-vax@kl.sri.com)
	(contact usenet@ucbvax.Berkeley.EDU if you have questions)
Date: 16 Aug 89 23:07:25 GMT
From: gjc@bu-cs.bu.edu  (George J. Carrette)
Organization: Boston U. Comp. Sci.
Subject: Re: UIS$ logical name utility wanted (here it is)
Message-Id: <36588@bu-cs.BU.EDU>
References: <8908161924.AA19321@ucbvax.Berkeley.EDU>
Sender: info-vax-request@kl.sri.com
To: info-vax@kl.sri.com

Here is a small program that does a subset of what you want.  It could
be generalized to take more arguments, and could be used for other
purposes not related to UIS.  Install it with SYSNAM priv of course.

/* DBGWINDOW.C */

/* 29-JUN-88 GJC. MiTech Corporation. */

/* 
 Install with SYSNAM so that the UIS$VT_ENABLE_OSC_STRINGS
 logical name can be toggled without the user having SYSNAM
 priv.
 */

#include <stdio.h>
#include <lnmdef.h>
#include <descrip.h>
#include <string.h>
#include <ssdef.h>

#define	PSL$C_KERNEL	0
#define	PSL$C_EXEC	1
#define	PSL$C_SUPER	2
#define	PSL$C_USER	3

struct trnlnm_item
{short buflen;
 short code;
 char *buffer;
 short *retlen;};

$DESCRIPTOR(lname,"UIS$VT_ENABLE_OSC_STRINGS");
$DESCRIPTOR(ltabl,"LNM$SYSTEM_TABLE");
char lmode = PSL$C_EXEC;
char *lvalue = "TRUE";

main(argc,argv)
 int argc; char **argv;
{switch (argc)
 {case 1: return(show_logical());
  case 2:
   if (strcmp(argv[1],"true") == 0) return(set_logical()); else
   if (strcmp(argv[1],"false") == 0) return(delete_logical());
  default:
   printf("dbgwindow [true] [false]\n to assign or deassign\n");
   printf("UIS$VT_ENABLE_OSC_STRINGS for debug window handling\n");
   return(SS$_NORMAL);}}

show_logical()
{struct trnlnm_item items[2];
 char buff[256];
 short retsize;
 int retval;
 items[1].buflen = 0;
 items[1].code = 0;
 items[0].buflen = sizeof(buff);
 items[0].code = LNM$_STRING;
 items[0].buffer = buff;
 items[0].retlen = &retsize;
 retval = sys$trnlnm(0,&ltabl,&lname,&lmode,items);
 if (retval == SS$_NORMAL)
  {buff[retsize] = 0;
   printf("%s = %s\n",lname.dsc$a_pointer,buff);}
 return(retval);}

set_logical()
{struct trnlnm_item items[2];
 items[0].buffer = lvalue;
 items[0].buflen = strlen(lvalue);
 items[0].code = LNM$_STRING;
 items[0].retlen = 0;
 items[1].buflen = 0;
 items[1].code = 0;
 return(sys$crelnm(0,&ltabl,&lname,&lmode,&items));}

delete_logical()
{struct trnlnm_item items[2];
 return(sys$dellnm(&ltabl,&lname,&lmode));}

