[net.sources] Prompt Wars..How about us VMSers?

vallury@dartvax.UUCP (04/10/87)

Fine.  So you guys have been churning out cute little prompt-setting programs
for the Unix.  So I figured there must be a few other VMS users out there
who were frustrated like me about all this Unix-jive.  Here's 4 little command
files, that together can do some of the stuff.  In order to make them work,
extract them, and create symbols in your login.com file to represent these.
I named them "HOME", "POP" AND "CD" respectively.   And put the line found
in "init.com" into your login.com file to set the prompt when you login.
What they basically do is get the name of the directory that you are in, 
and set the prompt in *inverse video*.  (You could play around with the
escape characters in the prompt-strings, and set them to funkier stuff like
blinking, underline, etc). Pretty straight-forward VMS DCL command stuff.
I know.  Nothing too fancy or anything, but then I wrote these in a weaker
20 minutes when I was terribly bored.  Enjoy!

Umm...There are some escape characters in the "shar"-ed files which follow,
and I'm not sure if they could potentially hang your terminal.  I'm on a
vt220 so it's no problem with me.  However, if you terminal cannot handle
those escape characters, then....I dunno what's going to happen.  So, my
apologies in advance.  I warned you, didn't I?  






--- STONE --- DULLS --- SCISSORS --- CUTS --- PAPER --- COVERS --- STONE ---

: This is a shar archive.  Extract with sh, not csh.
echo x - init.com
sed -e 's/^X//' > init.com << '!Funky!Stuff!'
X
X! ------------------------- INITIAL PROMPT SETTING -----------------------
X! Put this in your "LOGIN.COM" file.  Substitue the {Username} string with
X! your user-id.
X
X$ Set prompt = "[7m{Username}> [m"
X
X! ------------------------- END OF INITIAL DCL COMMAND ------------------
!Funky!Stuff!
echo x - cd.com
sed -e 's/^X//' > cd.com << '!Funky!Stuff!'
X!----------------------------------------------------------------------------
X!	FILE:  CD.COM:    Changes Directory and sets prompt in inverse video
X!----------------------------------------------------------------------------
X
X$MAIN:
X$	W :== Write Sys$output
X$	If P1 .eqs. "" Then Inquire/NoPun/Local P1 "Directory: "
X$	Check_Dir = P1 + ".Dir"					
X$	Check = F$Search (Check_Dir)
X$	If Check .Eqs. "" Then Goto NOT_FOUND			
X$	Def_String = "[." + P1 + "]"	
X$	Set Def 'Def_String'					
X$	Set Prompt = "[7m''P1'>[m "		 	
X$	Exit
X$
X$NOT_FOUND:
X$	W  "Invalid Directory name or Directory not found:  ", P1
X$	Exit
X
X!----------------------------- End of CD.COM ----------------------------!
!Funky!Stuff!
echo x - pop.com
sed -e 's/^X//' > pop.com << '!Funky!Stuff!'
X!--------------------------------------------------------------------------
X!	FILE: POP.COM - Sets default to next higher directory level and
X!			set the prompt accordingly to the directory name.
X!--------------------------------------------------------------------------
X
X$Main:
X$	Set Def [-]
X$	This_Dir = F$Directory()
X$	EOString = F$Length (This_Dir) - 1
X$	Temp_Dir = F$Extract (0, EOString, This_Dir)
X$	Found_Period = 0
X$	Goto Loop_Over_Period
X
X$Loop_Over_Period:
X$	Store_String = Temp_Dir
X$	Found_Period = F$locate (".", Temp_Dir)
X$	Temp_Dir = F$Extract (Found_Period + 1, EOString, Temp_Dir)
X$	If Temp_dir .Eqs. "" Then Goto Found_Last_Period
X$	Goto Loop_Over_Period
X
X$Found_Last_Period:
X$	Set Prompt = "[7m''Store_String'>[m "
X$	Exit
X
X
X!------------------------------- End of POP.COM ---------------------------!
!Funky!Stuff!
echo x - home.com
sed -e 's/^X//' > home.com << '!Funky!Stuff!'
X!----------------------------------------------------------------------------
X!	FILE:  HOME.COM  - 	Sets Default to the home directory and
X!				changes prompt to user name in inverse video.
X!----------------------------------------------------------------------------
X
X$Main:
X$	Set Def Sys$Login:
X$ 	I_Am = F$User()
X$	SOString = F$Locate (",", I_Am) + 1
X$	EOString = F$Length (I_Am) - 1 - SOString
X$	Prompt_String = F$Extract (SOString, EOString, I_Am)
X$	Set Prompt = "[7m''Prompt_String'>[m "
X$	Exit
X
X
X!---------------------------- End of HOME.COM -------------------------------
!Funky!Stuff!
exit