m From:	HENRY::IN%"munnari!murdu.oz!u3369429%seismo.css.gov%sri-kl.ARPA%relay.cs.net@rca.com" 17-FEB-1987 09:06  To:	, Subj:	Re: A Useful 'SET DEFAULT' Replacement  ] In article <8702131859.AA01619@blia.BLI> forrest@cgl.ucsf.edu@blia.UUCP (Jon Forrest) writes: 7 >The following is a command procedure that replaces the 5 >'SET DEFAULT' command. There have been many versions  >of such command procedures,  J My hot favourite is "SD" by Richard L.Bryan, Stan Knutson, Vicki, Tom Kent6 and Alan L. Zirkle. Beats everything I've seen so far.  - >The primary feature of my version is that it 9 >sets your prompt to the complete default directory name. N Don't you get into difficulties if the length of your current directory string is greater than 32 characters?  0 I use my prompt-string for two different things:P A "$$ " indicates that my privileges are switched on, a "# " indicates that they
 are disabled. N When I also wanted to include the "current directory" in my prompt, I found itN very inconvenient to look for the cursor all over the screen. I like things toN be predictable. So I came up with a prompt string which displays the directoryL on the far right, while the usual prompt ({"$$ "|"# "}) appears on the left.  J The resulting procedure ("PCD") is called by my version of "cd" ("SD", see above). Here it is:    - $ Verify='F$Verify(F$TRNLNM("COMMAND_DEBUG")) > $! Procedure: PCD.COM  V-1.24  Michael Bednarek  November 19866 $! Sets prompt to Current Directory/CR/Previous PromptL $! It produces a 32 character prompt string with the directory as far to theP $! right as possible, positioning the cursor however after the 'previous prompt'K $! This can result in a strange appearance with long directory names; never  $! mind, just type over it. " $ CR[0,8]=13					! Carriage Return! $ TAB[0,8]=9					! Horizontal Tab $ $ Old_Prompt=F$Environment("Prompt")@ $ pCR=F$Locate(CR,Old_Prompt)			! position of <CR> in Old_Prompt, $ If pCR.eq.F$Length(Old_Prompt) then pCR=-1H $ Prompt=F$Extract(pCR+1,255,Old_Prompt)	! part of Old_Prompt after <CR>) $ lP=F$Length(Prompt)				! length thereof $ $ Directory=F$Environment("DEFAULT") $ lD=F$Length(Directory)  $ If lP+lD.le.31 then goto Do_itK $! If the length of the part of OLD_Prompt that we want to retain (lP) plus H $! the length of the current directory is greater than 31 we extract the* $! rightmost part of the directory string.	 $ x=31-lP + $ Directory=F$Extract(lD-30+lP,x,Directory)  $ lD=xD $ Do_it: n=31-lD-lP	! n indicates the number of <TAB>s we can insert $ If n.lt.0 then n=0J $ If n*8+lD.gt.80 then n=(80-lD)/8	! but don't make it fall off the screen- $!Prompt=F$FAO("!''n'*	")+Directory+CR+Prompt 2 $ Prompt=F$FAO("!''n'*''TAB'")+Directory+CR+Prompt $! $ Set Prompt="''Prompt'" $ Verify=F$Verify(Verify)   ' u3369429@murdu.oz.au (Michael Bednarek)   