[comp.os.vms] Prompt = Set Default

XRJJM%SCINT.SPAN@STAR.STANFORD.EDU (John McMahon, (01/29/88)

Comment:   Begin User Supplied Mail Headers.
*Site:     NASA Goddard Space Flight Center - Greenbelt, Maryland, USA.
*Position: 76 Deg. 52' 28.5" West, 38 Deg. 59' 59.8" North.
*From:     John J. McMahon, Systems Programmer, STX - ST Systems Corporation.
*Project:  COBE Science Data Room (CSDR), Code 401.1
*Reply-To: (Arpa-Internet)       XRJJM%SCINT.SPAN@VLSI.JPL.NASA.GOV
*Reply-To: (Arpa-Internet)       XRJJM%SCINT.SPAN@STAR.STANFORD.EDU
*Reply-To: (Bitnet)              FASTEDDY@IAFBIT
*Reply-To: (Span/Physnet/Hepnet) 6182::XRJJM = SCINT::XRJJM (Node 6.38)
*Reply-To: (Span/Physnet/Hepnet) 6173::XRJJM =  CSDR::XRJJM (Node 6.29)
*Reply-To: (TEXnet)              UTADNX::UTSPAN::SCINT::XRJJM

X> From: "The Radio Gnome" <V2002A%TEMPLEVM.BITNET@CUNYVM.CUNY.EDU>
X> Hi,
X> 
X>      The logical thing to do would be:
X> 
X> $TEMP = "show default"
X> $SET PROMPT = 'TEMP'
X> 
X> ..but VMS will only take a string for SET PROMPTs argument
X> and the string must not have spaces in it.  VMS complains about
X> "too many parameters" >:-{
X> 
X>     Has anyone else come up with a solution?
X> 
X>      Andy Wing
X> 

I have been playing around with various types of programs along these lines.
My current one changes the window on the VT100, and uses a status line there
with the current default directory.

Several good prompt changing programs have been distributed on INFO-VAX,
but I couldn't locate any of them (Off to tape somewhere).  Here is a simple
one I cooked up in about 10 minutes.

Define a global symbol like CD to equal this command procedure, then use
CD every time you want to do a SET DEFAULT.  It's a good starting point.

Regards,
^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v
John J. McMahon (Fast-Eddie)                     
Disclaimer: Views expressed in this letter are my own, 
            and are not meant to represent the views of my employers.

...................... Cut between dotted lines and save ......................
$!..............................................................................
$! VAX/VMS archive file created by VMS_SHAR V-5.01 01-Oct-1987
$! which was written by Michael Bednarek (U3369429@ucsvc.dn.mu.oz.au)
$! To unpack, simply save and execute (@) this file.
$!
$! This archive was created by XRJJM (John J. McMahon <XRJJM%SCINT.SPAN@VLSI.JPL.NASA.GOV>)
$! on Thursday 28-JAN-1988 16:50:00.87
$!
$! It contains the following 1 file:
$! SET_DEFAULT_PROMPT.COM
$!==============================================================================
$ Set Symbol/Scope=(NoLocal,NoGlobal)
$ Version=F$GetSYI("VERSION") ! See what VMS version we have here:
$ If Version.ges."V4.4" then goto Version_OK
$ Write SYS$Output "Sorry, you are running VMS ",Version, -
                ", but this procedure requires V4.4 or higher."
$ Exit 44
$Version_OK: CR[0,8]=13
$ Pass_or_Failed="failed!,passed."
$ Goto Start
$Convert_File:
$ Read/Time_Out=0/Error=No_Error1/Prompt="creating ''File_is'" SYS$Command ddd
$No_Error1: Define/User_Mode SYS$Output NL:
$ Edit/TPU/NoSection/NoDisplay/Command=SYS$Input/Output='File_is' -
        VMS_SHAR_DUMMY.DUMMY
f:=Get_Info(Command_Line,"File_Name");b:=Create_Buffer("",f);
o:=Get_Info(Command_Line,"Output_File");Set(Output_File,b,o);
Position(Beginning_of(b));Loop x:=Erase_Character(1);Loop ExitIf x<>"V";
Move_Vertical(1);x:=Erase_Character(1);Append_Line;
Move_Horizontal(-Current_Offset);EndLoop;Move_Vertical(1);
ExitIf Mark(None)=End_of(b) EndLoop;Position(Beginning_of(b));Loop
x:=Search("`",Forward,Exact);ExitIf x=0;Position(x);Erase_Character(1);
If Current_Character='`' then Move_Horizontal(1);else
Copy_Text(ASCII(INT(Erase_Character(3))));EndIf;EndLoop;Exit;
$ Delete VMS_SHAR_DUMMY.DUMMY;*
$ Checksum 'File_is
$ Success=F$Element(Check_Sum_is.eq.CHECKSUM$CHECKSUM,",",Pass_or_Failed)+CR
$ Read/Time_Out=0/Error=No_Error2/Prompt=" CHECKSUM ''Success'" SYS$Command ddd
$No_Error2: Return
$Start:
$ File_is="SET_DEFAULT_PROMPT.COM"
$ Check_Sum_is=1562398872
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
X$! 
X$! Simple Set Default And Load Into Prompt Routine.
X$!
X$! By John J. McMahon `009Date: 28 January 1988
X$!    XRJJM%SCINT.SPAN@VLSI.JPL.NASA.GOV (Internet)
X$!    FASTEDDY@IAFBIT (Bitnet)
X$!    SCINT::XRJJM (Span)
X$!
X$! This procedure follows the same rules as the SET DEFAULT
X$! command (e.g. This command procedure can be used in place of it).
X$! This is primarily a demonstration program, it needs some polishing,
X$! and it is public domain code.
X$!
X$! If no parameter, then skip the SET DEFAULT
X$ IF P1 .EQS. "" THEN GOTO SKIP
X$ SET DEFAULT 'P1'
X$! Get the current default directory into string symbol XYZZY
X$ SKIP: XYZZY = F$ENVIRONMENT("DEFAULT")
X$! How long is it ? (PRMPT_L)
X$ PRMPT_L = F$LENGTH(XYZZY)
X$! Calculate the start point for the last 30 characters of the string
X$! (PRMPT_S)
X$ PRMPT_S = PRMPT_L - 30
X$! If it's less than zero, we perform the truncation from the beginning
X$! of the string (Zero)
X$ IF PRMPT_S .LT. 0 THEN PRMPT_S = 0
X$! Truncate the right most 30 characters of the string.
X$! Since the prompt cannot exceed 32 characters, we must truncate.
X$ PRMPT = F$EXTRACT(PRMPT_S,PRMPT_L,XYZZY)
X$! Set the prompt using the string and a "$ "
X$ SET PROMPT="''PRMPT'$ "
X$ EXIT
$ GoSub Convert_File
$ Exit

-------