Path: utzoo!mnetor!uunet!husc6!hao!ames!pioneer!woo From: woo@pioneer.arpa (Alex Woo) Newsgroups: comp.os.vms Subject: Re: Getting directory in DCL prompt Message-ID: <4507@ames.arpa> Date: 6 Feb 88 23:15:40 GMT References: <8801271320.AA15259@mitre.arpa> <2048@bsu-cs.UUCP> Sender: usenet@ames.arpa Reply-To: woo@pioneer.UUCP (Alex Woo) Organization: NASA Ames Research Center, Moffett Field, Calif. Lines: 109 Summary: Yet another set of command files Here is yet another set of command files for getting the current directory in the DCL prompt. The symbol definitions assume that the command files reside in the top most user directory. They could just as well reside in SYS$MANAGER: or some such and avoid useless redundancy. Alex Woo $!=============================cut here============================= $! $! here are the symbols to be added to your login.com $! $ MkDir :== @sys$login:mkdir !CREATE /DIRECTORY $ rmdir :== @sys$login:rmdir !remove directory (almost) $ CD :== @sys$login:ChDirDO !p1=dirname p2=disk $ DO*wn :== @sys$login:ChDirDO !p1=leaf of current node $ UP :== @sys$login:ChDirUp !no args $ OV*er :== @sys$login:ChDirOV !p1=leaf of the node 1 up $ UPOV*er :== @sys$login:ChdUpov !p1=leaf of the node 2 up $ HO*ME :== @sys$login:ChDirHo !no args $ SD :== @sys$login:ChDir !p1=same as SD, for systems without SD.exe $! SD :== @sys$login:ChDirSD !p1=same as SD, also sets prompt $ TOP :== @sys$login:ChDirTo !no args $!=============================cut here============================= $! CHDIRHO.COM p1=subdirectory path {optional} $! Purpose: changes working directory to user's root dir or a subdir of root $! History: original design mods by feb87 $! eval := write sys$output $ node = f$trnlnm("sys$node")-"::" $! eval "NODE: "+node $ user = f$user() $! eval "USER: "+user $ if p1 .NES. "" then goto path $ set def sys$login: $! sho def $ set prompt = "''node'''user' " $ exit $ path: $ set def sys$login: $ set def [.'p1] $ direc = f$directory() + " " $ set prompt = "''node'''direc'" $ set def [-.'P1'] $ direc = f$directory() + " " $ node = f$trnlnm("sys$node")-"::" $ set prompt = "''node'''direc'" $!=============================cut here============================= $!chdir.com $ if "''p1'" .NES. "" then goto _set_directory $ write sys$output "Usage: changedir directory-name {disk:}" $ goto _set_prompt $_set_directory: $ set def 'p2'['P1'] $_set_prompt: $ DIREC = f$directory() + " " $ node = f$trnlnm("sys$node")-"::" $ set prompt = "''node'''direc'" $!=============================cut here============================= $!chdirdo.com (rename to do*wn) $! $ set def [.'p1'] $ direc = f$directory() + " " $ node = f$trnlnm("sys$node")-"::" $ set prompt = "''node'''direc'" $!=============================cut here============================= $!chdirsd.com (rename to sd) $ @sys$system:sd 'p1' $ DIREC = f$directory() $ node = f$trnlnm("sys$node")-"::" $ set prompt = "''node'''direc' " $!=============================cut here============================= $! chdirto.com change name to 'top' $! move to top of current directory tree $! $ DIREC = f$directory() $ node = f$trnlnm("sys$node")-"::" $ POS = f$locate(".",DIREC) $ ! if "." not found, POS = length of string, and default already top-level $ IF POS .EQ. f$length(DIREC) then EXIT $ TOP = f$extract(0,POS,DIREC) $ set def 'TOP'] $ set prompt = "''node'''TOP'] " $!=============================cut here============================= $! chdirup.com move up one level in directory tree $! change name to UP $ set def [-] $ DIREC = f$directory() + " " $ node = f$trnlnm("sys$node")-"::" $ set prompt = "''node'''direc'" $!=============================cut here============================= $! chdupov.com change name to upov*er in login $! move up and over $ set def [--.'P1'] $ DIREC = f$directory() $ direc = f$directory() + " " $ node = f$trnlnm("sys$node")-"::" $ set prompt = "''node'''direc'" $!=============================cut here============================= $! mkdir.com $crea/dir [.'p1'] $!=============================cut here============================= $!rmdir.com $! this isn't quite right but it works 90% of the time $set prot=w:rwed 'p1'.dir $on error then continue $set prot [.'p1'...]*.*;* $on error then continue $del [.'p1'...]*.*;* $del 'p1'.dir;