nagy%warner.hepnet@LBL.GOV (Frank J. Nagy, VAX Wizard & Guru) (06/20/88)
Below is PREFIX_SEARCHLIST.COM, a command procedure I wrote to add an additional entry as a "prefix" to an existing search list logical name. I originally wrote this (and use it in my LOGIN.COM) to have LaTeX search my personal set of macro and style files. After initializing LaTeX by calling the system-wide procedure for doing so, I include the call: @MY_COM:PREFIX_SEARCHLIST TEX$INPUTS SYS$LOGIN_DEVICE:[NAGY.TEX] to add my own TeX files area to the search list. A question from a user prompted me to share this with everyone. = Frank J. Nagy "VAX Guru & Wizard" = Fermilab Research Division EED/Controls = HEPNET: WARNER::NAGY (43198::NAGY) or FNAL::NAGY (43009::NAGY) = BitNet: NAGY@FNAL = USnail: Fermilab POB 500 MS/220 Batavia, IL 60510 ....................... 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 NAGY $! on Monday 20-JUN-1988 08:35:02.96 $! $! It contains the following 1 file: $! PREFIX_SEARCHLIST.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="PREFIX_SEARCHLIST.COM" $ Check_Sum_is=2014673880 $ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY X$ old_verify = 'F$VERIFY(0)' X$!.. PREFIX_SEARCHLIST.COM`009Add a prefix item to a logical name search list X$ string = p2 X$ IF F$TRNLNM( p1) .EQS. "" THEN $ GOTO PSL_DEFINE X$ max = F$TRNLNM( p1,,,,, "MAX_INDEX") X$ n = 0 X$PSL_LOOP: X$ string = string + "," + F$TRNLNM( p1,, n) X$ n = n + 1 X$ IF n .LE. max THEN $ GOTO PSL_LOOP X$PSL_DEFINE: X$ DEFINE /NOLOG`009'p1'`009'string' X$ EXIT`009F$VERIFY(old_verify).OR.1 X$!============================================================================= X$!+ PREFIX_SEARCHLIST X$! Add an item as the new first entry in the search list given by a logical X$! name. The new item *does not* replace the existing first item and instead X$! pushes the existing items back one position in the last (the new item is X$! added as a prefix to the list). X$! X$!`009@MY_COM:PREFIX_SEARCHLIST logical-name new-first-entry X$!- X$!============================================================================= X$! Modification History: X$! 23-Oct-87`009FJN`009Created from LOGIN.COM $ GoSub Convert_File $ Exit