Article 162609 of comp.os.vms:

In article <970110031729_76702.1567_CHN44-3@CompuServe.COM>, "Richard B. Gilbert" <76702.1567@CompuServe.COM> writes...
>	 "Steve Reece, Systems." <srr3@leicester.ac.uk>  Writes:
> 
>>"steven. wu" <d._wu@ccmailsmtp.ast.com> asked:
>>
>>> how to customize the vms prompt symbol represent current default directory
>>> and my user name?

>>To set the prompt to begin with, use something like
>>
>>$ @SYS$LOGIN:SD.COM SYS$LOGIN
>>
>>in your LOGIN.COM
>>
>>$!  Procedure to set default
>>$ oldir = f$environment("default")
>>$ set def 'P1
>>$ define/nolog oldir 'oldir'
>>$ prompt=f$environment("default")+">"
>>$ set prompt='prompt'
>>
> 
>	What happens when F$LENGTH(OLDIR) .GT. 32?  A directory path
>could conceivably be something like 250 characters long. The prompt is
>limited to 32 characters.  The procedure you use handles only the easy
>cases.
> 

heres a little routine that handles length limits. It also changes the prompt
colour when I'm in a prived account. The checks for LAT etc. are local-
specific, so as to change window labels.

Mike.

-----------<start>---------------
$ def = f$envir("DEFAULT")
$ def1 = f$parse(def,,,"DIRECTORY") - "000000" - "][" - "]["- "[" - "]"
$ if def1 .eqs. "" then def1 = f$parse(def,,,"DEVICE")
$ !
$ lat_terminal = "TRUE"
$ if f$trnlnm("DECW$DISPLAY") .nes. "" then lat_terminal = "FALSE"
$ !
$ if  ( lat_terminal .eqs. "FALSE" )
$ then
$	OSC[0,8] = 157
$	ST[0,8]  = 156
$	nodenm = f$edit$( f$getsyi("NODENAME"),"COLLAPSE" )
$	pc = ""
$	nm = f$process()
$	m = nm + " on " + nodenm +"::" + def
$	write sys$output "''OSC'2L;''nodenm'''ST'"
$	write sys$output "''OSC'21;''m'''ST'"
$ endif
$!
$check_length:
$ if f$len(def1) .gt. 16
$ then
$	x=f$locate(".",def1) + 1
$	if x .ge. f$len(def1) then x=f$len(def1)-13
$	def1 = "->" + f$extract(x,99,def1)
$	goto check_length
$ endif
$!
$ On = ""
$ ESC[0,8] = 27
$ Off = "''ESC'[0m"
$ if ( lat_terminal .eqs. "FALSE" )
$ then
$	On  = "''ESC'[33m"
$	if f$priv("SETPRV")
$	then
$		On  = "''ESC'[31m"
$		write sys$output "''OSC'2L;*''nodenm'*''ST'"
$	endif
$ else
$	On  = "''ESC'[1m"
$	if f$priv("SETPRV") then On  = "''ESC'[1m*"
$ endif
$ set prompt="''On'''def1'''Off'_$"
$ exit
$!
-----------------<end>----------------------------



-------------------------------------------------------------------------------
Usual disclaimers apply. All my opinions are mine alone - perhaps not even that.
Mike Rechtman           rechtman@shani.net  (work rechtman@taveng.enet.dec.com)
Kibbutz Tzor'a.                                     Voice (home): 972-2-9908337
PSI%425120012117::Mike            calling card: http://shani.net/USERS/rechtman
     "20% of a job takes 80% of the time,  the rest takes another 80%"
-------------------------------------------------------------------------------


