From:	MERC::"uunet!CRVAX.SRI.COM!RELAY-INFO-VAX"  2-MAY-1992 21:26:15.12
To:	info-vax@kl.sri.com
CC:	
Subj:	Re: defined directory aliases...

doug@jhunix.hcf.jhu.edu (Douglas W O'Neal) writes:
> In article <1992Apr27.152400.6931@cco.caltech.edu> carl@SOL1.GPS.CALTECH.EDU writes:
> >>Add this to your login.com
> >>$ scr = f$trnlnm("SYS$LOGIN") - "]" + ".]"
> >>$ define/exec my$login 'scr
> >>
> >>You can then use my$login:[c] instead of PHYS$DISK:[KICKSTART.C]
> >
> >First, most users don't have the privilege to define an executive_mode logical
> >name.  Second, this will NOT work if SYS$LOGIN_DEVICE is a rooted logical.
> 

Here's a more general procedure that will take care of setting up rooted
logical names for just about everything I've had to deal with -- including
the case of sys$login_device being a rooted logical.

Try it out!


$! ------------------ CUT HERE -----------------------
$ v='f$VERIFY(f$TRNLNM("SHARE_VERIFY"))'
$!
$! This archive created by VMS_SHARE Version 7.2-007  22-FEB-1990
$!   On 28-APR-1992 11:14:48.57   By user DECMCC (DECmcc Manager)
$!
$! This VMS_SHARE Written by:
$!    Andy Harper, Kings College London UK
$!
$! Acknowledgements to:
$!    James Gray       - Original VMS_SHARE
$!    Michael Bednarek - Original Concept and implementation
$!
$! TO UNPACK THIS SHARE FILE, CONCATENATE ALL PARTS IN ORDER
$! AND EXECUTE AS A COMMAND PROCEDURE  (  @name  )
$!
$! THE FOLLOWING FILE(S) WILL BE CREATED AFTER UNPACKING:
$!       1. ROOT_SETUP.COM;15
$!
$set="set"
$set symbol/scope=(nolocal,noglobal)
$f=f$PARSE("SHARE_TEMP","SYS$SCRATCH:.TMP_"+f$GETJPI("","PID"))
$e="write sys$error  ""%UNPACK"", "
$w="write sys$output ""%UNPACK"", "
$ if f$TRNLNM("SHARE_LOG") then $ w = "!"
$ ve=f$GETSYI("version")
$ if ve-f$EXTRACT(0,1,ve) .ges. "4.4" then $ goto START
$ e "-E-OLDVER, Must run at least VMS 4.4"
$ v=f$VERIFY(v)
$ exit 44
$UNPACK: SUBROUTINE ! P1=filename, P2=checksum
$ if f$SEARCH(P1) .eqs. "" then $ goto FILE_ABSENT
$ e "-W-EXISTS, File ''P1' exists. Skipped."
$ delete 'f'*
$ exit
$file_absent:
$ if f$PARSE(P1) .nes. "" then $ goto DIROK
$ dn=f$PARSE(P1,,,"DIRECTORY")
$ w "-I-CREDIR, Creating directory ''dn'."
$ create/dir 'dn'
$ if $status then $ goto DIROK
$ e "-E-CREDIRFAIL, Unable to create ''dn'. File skipped."
$ delete 'f'*
$ exit
$dirok:
$ w "-I-PROCESS, Processing file ''P1'."
$ if .not. f$VERIFY() then $ define/user sys$output nl:
$ EDIT/TPU/NOSEC/NODIS/COM=SYS$INPUT 'f'/OUT='P1'
PROCEDURE Unpacker ON_ERROR ENDON_ERROR;SET(FACILITY_NAME,"UNPACK");SET(
SUCCESS,OFF);SET(INFORMATIONAL,OFF);f:=GET_INFO(COMMAND_LINE,"file_name");b:=
CREATE_BUFFER(f,f);p:=SPAN(" ")@r&LINE_END;POSITION(BEGINNING_OF(b));
LOOP EXITIF SEARCH(p,FORWARD)=0;POSITION(r);ERASE(r);ENDLOOP;POSITION(
BEGINNING_OF(b));g:=0;LOOP EXITIF MARK(NONE)=END_OF(b);x:=ERASE_CHARACTER(1);
IF g=0 THEN IF x="X" THEN MOVE_VERTICAL(1);ENDIF;IF x="V" THEN APPEND_LINE;
MOVE_HORIZONTAL(-CURRENT_OFFSET);MOVE_VERTICAL(1);ENDIF;IF x="+" THEN g:=1;
ERASE_LINE;ENDIF;ELSE IF x="-" THEN IF INDEX(CURRENT_LINE,"+-+-+-+-+-+-+-+")=
1 THEN g:=0;ENDIF;ENDIF;ERASE_LINE;ENDIF;ENDLOOP;t:="0123456789ABCDEF";
POSITION(BEGINNING_OF(b));LOOP r:=SEARCH("`",FORWARD);EXITIF r=0;POSITION(r);
ERASE(r);x1:=INDEX(t,ERASE_CHARACTER(1))-1;x2:=INDEX(t,ERASE_CHARACTER(1))-1;
COPY_TEXT(ASCII(16*x1+x2));ENDLOOP;WRITE_FILE(b,GET_INFO(COMMAND_LINE,
"output_file"));ENDPROCEDURE;Unpacker;QUIT;
$ delete/nolog 'f'*
$ CHECKSUM 'P1'
$ IF CHECKSUM$CHECKSUM .eqs. P2 THEN $ EXIT
$ e "-E-CHKSMFAIL, Checksum of ''P1' failed."
$ ENDSUBROUTINE
$START:
$ create 'f'
X$! Setup logical name in job logical name table for user account root direct
Vory.
X$!
X$!  p1 -- root directory, DEF=SYS$LOGIN
X$!  p2 -- root prefix, DEF=LOGIN
X$!  p3 -- root suffix, def=_ROOT
X$!  p4 -- logical name table to put the logical name into, DEF=LNM$JOB
X$!  SYS$LOGIN points to the home directory.
X$!
X$ home_dir = "sys$login:"
X$ if p1.nes."" then $ home_dir = p1
X$ root_prefix = p2
X$ if root_prefix.eqs."" then $ root_prefix = "LOGIN"
X$ root_suffix = p3
X$ if root_suffix.eqs."" then $ root_suffix = "_ROOT"
X$ root_table = p4
X$ if root_table.nes."" then $ root_table = "/table="+root_table
X$!
X$! Compute the new rooted name construct
X$!
X$ root_device = f$parse(home_dir,,,"device","no_conceal")
X$ home_dir = home_dir -"`5D`5B"`09! remove rooted constructs
X$ if f$loc(".`5D",home_dir).lt.f$len(home_dir) then -
X$`09home_dir = home_dir -".`5D"+"`5D"
X$! `5B000000`5D handles p1 = rooted logical name
X$ root_directory = f$parse(home_dir,"`5B000000`5D",,"directory","no_conceal"
V)-
X`09-"`5B000000`5D"-"`5D`5B"-".`5D"-"`5D"+".`5D"
X$!
X$! Create the logical name
X$!
X$ if root_directory.nes."" then -
X$ define/job/nolog/translation=concealed 'root_prefix''root_suffix' -
X`09`09'root_device''root_directory''root_table'
X$ exit
X$!
X$! Examples:
X$! A.`09In your LOGIN.COM put the line
X$!`09$ @UTL:ROOT_SETUP
X$!`09This will create the logical name LOGIN_ROOT which will point to
X$!`09your home directory root.  For example:
X$!`09LOGIN_ROOT" = "$255$DUA34:`5BRLB.`5D"`20
X$!
X$! B. Pointing to another account directory structure
X$!
X$!`09@UTL:ROOT_SETUP D_UALL:`5BCLARY`5D CLARY
X$!
X$! This will cause the logical name CLARY_ROOT to be defined as below:
X$!
X$!`09"CLARY_ROOT" = "RTP$USER37:`5BCLARY.`5D"
X$!
X$!Last Modified:  28-APR-1992 11:14:25.75, By: DECMCC`20
$ CALL UNPACK ROOT_SETUP.COM;15 1965247741
$ v=f$VERIFY(v)
$ EXIT
--

Bob Boyd                 
rbn@ralph.rtpnc.epa.gov 
Unisys/EPA               

