%μ VAX-11 Librarian V04-00@΅Ε K– ˜ά K–'x( (ΆDIRPJPIDEF’LIBDEFΤPCBDEFRESTORE_RECALL_BUFFER REV_DATDSAVE_RECALL_BUFFER&h SMGTRMPTRDEF&ΆSSDEF&φSTATEDEF&^ TIME_USEROPEN­ΐ띅J–F;*********************************************************************;; Title: D I R . M A R; Get directory.; .; Unit Name: ; DIR.MAR; . ; Purpose:9; The subroutine will return all the files that match the; input file. ; . ; Language:; VAX-11 MACRO; .; Revision History:'; DATE PROGRAMMER REVISION FUNCTION; . ; Calling sequence:#; NUM = DIR ( FILE_SPEC, OUT_ARRY ); $; NUM - Number of files that matchA; FILE_SPEC - Input File Spec ( input parameter ) CHARACTER*80E; OUT_ARRY - Output File Array ( output parameter ) CHARACTER*80 (*); .; Local Data:; VARIABLE TYPE/SIZE DEFINITION; .; -F;********************************************************************* .TITLE DIR C; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - .PSECT DATA,LONG,WRT,NOEXENAM_BLK: $NAM RSA=RES_STR,- RSS=80,- ESA=EXP_STR,- ESS=80 FAB_BLK::( $FAB FOP=NAM,- ; "Use NAM block option( NAM=NAM_BLK,- ; Pointer to NAM block FNS=80EXP_STR: .BLKB 80RES_STR: .BLKB 80FIL_ADR: .BLKL 1FIL_NUM: .BLKL 1 C; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - .PSECT CODE,LONG,NOWRT,EXE .ENTRY DIR,^M MOVL 4(AP),R2 MOVL 4(R2),FAB$L_FNA+FAB_BLK MOVL 8(AP),R2 MOVL 4(R2),FIL_ADR $PARSE FAB = FAB_BLK BLBC R0,F_ERR BRB SRCHSRCH: $SEARCH FAB = FAB_BLK BLBC R0,ERROR% INCL FIL_NUM MOVL #RES_STR,R3 MOVL FIL_ADR,R4 MOVC3 #80,(R3),(R4) ADDL2 #80,FIL_ADR BRW SRCHERROR: CMPL R0,#RMS$_NMF BNEQ F_ERR MOVL FIL_NUM,R0 BRB EXITF_ERR: PUSHL FAB_BLK+FAB$L_STV PUSHL FAB_BLK+FAB$L_STS CALLS #2,G^LIB$SIGNAL MOVL #0,R0 EXIT: RET .ENDww­(–‰J– .TITLE JPIDEF $JPIDEF GLOBAL .ENDww­`TχŒJ– .TITLE LIBDEF $LIBDEF GLOBAL .ENDww­@›^J– .TITLE PCBDEF $PCBDEF  GLOBAL .ENDww­€αυ•J–P;*******************************************************************************0; TRIUMF - Vancouver, British Columbia, CanadaP;*******************************************************************************<; Filespec: 41::$disk1:sys$manager:restore_recall_buffer.mar;P;*******************************************************************************F; Please note: This program takes routes into certain areas of the CLIB; storage area by using hardwi red displacements that may vary withC; the version of VMS. The present version of restore_recall_bufferF; works with VMS version 4.2 - 4.4 but has not been tested with higherC; versions. To minimize the chance of problems, the displacementsF; should be checked in each new version of VMS to make sure that there; are no changes.;1; PPD$L_PRC = ^X08 ; Displ into ppd for cli ptr;; PRC_G_COMMANDS = ^X133 ; Displ into cliarea for rec ptr:; PRC_L_RECALLPTR = ^X12F ; Displ to current command ptr;@; Description: This is a macro assembler program that may run onG; any VAX running VMS version 4.x. This program reads 1029. bytes fromG; a disk file and puts these bytes into the cli's private storage area.D; The data being restored is the last set of cli commands saved by a7; program called save_recall_buffer.exe. The disk file:; is located in sys$login and is called recall_buffer.dat.A; If the system does not have read and write access to the user's1; sys$login direct ory then the program will fail.;B; At the beginning of a terminal session (for example: as the lastI; command in the login file) this program can be run to restore the savedD; cli environment. To make proper use of this program the user mustD; run a program called save_recall_buffer at the end of the terminalD; session so that the cli commands get saved in the disk file called; sys$login:recall_buffer.dat.;-; This program needs CMEXEC privilege to run.;I; The command buffer is 10 25. bytes long. The organization ( not that itJ; matters here) is as a circular buffer therefore the first and last bytesD; will probably be string bytes from the middle of a command string.;; .; .; .; null byte of string n; length byte of string n; string byte of string n; string byte of string n; .; .; string byte of string n; length byte of string n; null byte of string n + 1; length byte of string n + 1; string byte of string n +  1; string byte of string n + 1; .; .; string byte of string n + 1; length byte of string n + 1; null byte of string n + 2; length byte of string n + 2; string byte of string n + 2; .; .P;*******************************************************************************&; Assemble, link, and run instructions;!; macro restore_recall_buffer.mar?; link/notrace restore_recall_buffer,sys$library:sys.stb/select; run restore_recall_buffer;P;*******************************************************************************; History of Revisions;; Rev Date Name Comments; --- ---- ---- --------;.; 1.0 86/9/12 Mike Mouat -initial development;P;******************************************************************************* .TITLE RESTORE_RECALL_BUFFER .LIBRARY /SYS$LIBRARY:LIB.MLB/ .PSECT DATA,WRT,NOEXEFINFAB: $FAB FNM = ; Primary o/p filename,INRAB: $RAB FAB = INFAB,- ; Pointer to FAB# ROP = RAH,- ; Read-ahead option# UBF = REC_BUF,- ; Record buffer USZ = REC_SIZE ; Record size)REC_SIZE = 1029 ; Maximum record size0PPD$L_PRC = ^X08 ; Displ into ppd for cli ptr:PRC_G_COMMANDS = ^X133 ; Displ into cliarea for rec ptr9PRC_L_RECALLPTR = ^X12F ; Displ to current command ptrREC_BUF:# .BLKB REC_SIZE-4 ; Record buffer RECALL_PTR:* .LONG 0 ; Save current command pointer& ; Note: REC_BUFF and RECALL_PTR # ;... are stored as one record .PSECT CODE,NOWRT,EXEF .ENTRY RESTORERB,^M ; Save reg's 2-7,10,11I; Open the data file that contains the set of cli commands that are to be"; restored and then connect to it.& $OPEN FAB = INFAB ; Open input file BLBC R0,EXIT1 ; Quit on error' $CONNECT RAB=INRAB ; Connect to input& BLBS R0,READ ; Branch to read loop" BRB EXIT2 ; Trap connect-error*EXIT1: MOVAL INFAB,R6 ; Keep fab address# BRB F_ERR ; Signal record error5EXIT2: MOVAL  INRAB,R6 ; If error retain rab address# BRB R_ERR ; Signal record errorG; Start by getting the address of the process permenant data (ppd) areaH; because it has a pointer to the CLI private storage area where the CLIE; commands go. Then get the address of the CLI private storage area.I; Note: a process running in user mode cannot write into the CLI privateH; storage area (work area) so there must be a change to exec-mode before,; the commands and the pointer are restored.6READ : $GET RAB=INRAB ; Get a record (buffer&pointer)1 MOVAB G^CTL$AG_CLIDATA,R10 ; Get address of ppd: MOVL PPD$L_PRC(R10),R11 ; Get addr of cli privatestorage9 $CMEXEC_S ROUTIN=STORE ; Go to exec mode and store data, BRB DONE ; Finished, so cleanup and stop: .ENTRY STORE,^M ; Save reg's 2-5,7,11D MOVL RECALL_PTR,PRC_L_RECALLPTR(R11) ; Restore current command ptr > MOVAB PRC_G_COMMANDS(R11), R7 ; Get start addr of recall buf2 MOVC3 #1025,REC_BUF,(R7) ; Restore recall buffer7 MOVL #SS$_NORMAL, R0 ; Pass a normal completion code RET ; Return to user mode6F_ERR: PUSHL FAB$L_STV(R6) ; Push stv and sts of fab% PUSHL FAB$L_STS(R6) ; on the stack' CALLS #2,G^LIB$SIGNAL ; Signal error BRB EXIT ;6R_ERR: PUSHL RAB$L_STV(R6) ; Push stv and sts of rab% PUSHL RAB$L_STS(R6) ; on the stack' CALLS #2,G^LIB$SIGNAL ; Signal error+DONE: $CLOSE FAB=INFAB ; Close input file)EXIT: RET ; Return with status in r0  .END RESTORERBww­ΰ(šJ–F;*********************************************************************; ; Title:*; Get the revision date for the input file; .; Unit Name: ; REV_DAT.MAR; . ; Purpose:6; The subroutine will return the revision date for the; input file. ; . ; Language:; VAX-11 MACRO; .; Revision History:'; DATE PROGRAMMER REVISION FUNCTION>; 25-Dec-85 S.M. Harrison Original Development and debug?; 28-May-87 Les Stockton  Longer Filename; . ; Calling sequence:; STAT = REV_DAT ( FILE, DATE ); ; STAT - 1 = File exists; 0 = File doesn't exist; -1 = Fatal error8; FILE - Input File ( input parameter ) CHARACTER*808; DATE - Date returned ( output parameter ) CHARACTER*23; .; Local Data:; VARIABLE TYPE/SIZE DEFINITION; .; -F;********************************************************************* .TITLE REV_DAT C; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - .PSECT DATA,LONG,WRT,NOEXE FAB_BLK: ; File access block$ $FAB FAC = , - ; File access! FNS = 255, - ; File name size XAB = DAT_BLK ; XAB pointer,DAT_BLK: ; Allocation block for rev date $XABRDT ASC_TIM: ; ASCII time buffer .BLKB 23-ASC_TIM_D: ; ASCII time string descriptor"A_LEN: .LONG 23 ; String length(A_ADR: .LONG ASC_TIM ; String pointer C; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - .PSECT CODE,LONG,NOWRT,EXE .ENTRY REV_DAT,^M#; ...Get address of input file name. MOVL 4(AP),R2 ; Get pointer to string desc.= MOVL 4(R2),FAB_BLK+FAB$L_FNA ; Get pointer to string buffer+; ...Open the file to get the revision date $OPEN FAB=FAB_BLK ; Open file( CMPL R0,#RMS$_FNF ; Is file present ? BEQL EX_FNF ; Exit BLBC R0,ERROR ; Quit on error3; ...Convert the revision date from binary to ASCII= $ASCTIM_S TIMBUF=ASC_TIM_D, - ; Convert binary time to ASCII TIMADR=DAT_BLK+XAB$Q_RDT! BLBC R0,SS_ERR ; Quit on error; ...Close the file" $CLOSE FAB=FAB_BLK ; Close fileI; ...Move the revision date from the internal buffer to the return buffer. MOVL 8(AP),R2 ; Get pointer to string desc./ MOVL 4(R2),R2 ; Get pointer to string buffer0 MOVAB ASC_TIM,R3 ; Get pointer to time buffer3 MOVC3 #23,(R3),(R2) ; Move time to return buffer BRB EX_OK ; Exit; ...Signal file error3ERROR: PUSHL FAB_BLK+FAB$L_STV ; Save status value, PUSHL FAB_BLK+FAB$L_STS ; Save status code' CALLS #2,G^LIB$SIGNAL ; Signal error BRB EX_FTL ; Exit; ...Signal time convert error&SS_ERR: PUSHL R0 ; Save status code' CALLS #1,G^LIB$SIGNAL ; Signal error!; ...Return fatal error to caller(EX_FTL: MOVL #-1,R0 ; Set fatal error BRB EXIT ; Exit*; ...Return file not found error to caller0EX_FNF: MOVL #0,R0 ; Set file not found error BRB EXIT ; Exit; ...Return no error to caller#EX_OK: MOVL #1,R0 ; Set no errorEXIT: RET ; Exit .ENDww­ΐgšžJ–P;*******************************************************************************0; TRIUMF - Vancouver, British Columbia, CanadaP;*******************************************************************************9; Filespec: 41::$disk1:sys$manager:save_recall_buffer.mar;P;*******************************************************************************F; Please note: This program takes routes into certain areas of t he CLIB; storage area by using hardwired displacements that may vary with@; the version of VMS. The present version of save_recall_bufferF; works with VMS version 4.2 - 4.4 but has not been tested with higherC; versions. To minimize the chance of problems, the displacementsF; should be checked in each new version of VMS to make sure that there; are no changes.;1; PPD$L_PRC = ^X08 ; Displ into ppd for cli ptr;; PRC_G_COMMANDS = ^X133 ; Displ into cliarea for rec ptr:; PRC_L_RECA LLPTR = ^X12F ; Displ to current command ptr;@; Description: This is a macro assembler program that may run on@; any VAX running VMS version 4.x. This program reads the cli'sD; recall command buffer and stores it in a disk file. The disk fileH; is located in sys$login and is called recall_buffer.dat. Before a newB; file is created, the last copy of recall_buffer.dat is deleted.C; If the system does not have delete and write access to the user's1; sys$login directory then the program will fail.;B; At the end of a terminal session this program can be run to saveE; the cli environment. The next time that the user logs-in a program?; called restore_recall_buffer can be run to setup the last cli; commands used.;I; The command buffer is 1025. bytes long. The organization ( not that itJ; matters here) is as a circular buffer therefore the first and last bytesD; will probably be string bytes from the middle of a command string.;; .; .; .; null byte of string n; length byte of string n; string byte of string n; string byte of string n; .; .; string byte of string n; length byte of string n; null byte of string n + 1; length byte of string n + 1; string byte of string n + 1; string byte of string n + 1; .; .; string byte of string n + 1; length byte of string n + 1; null byte of string n + 2; length byte of string n + 2; string byte of string n + 2; .; .P;*******************************************************************************&; Assemble, link, and run instructions;; macro save_recall_buffer.mar4; link save_recall_buffer,sys$library:sys.stb/select; run save_recall_buffer;P;*******************************************************************************; History of Revisions;; Rev Date Name Comments; --- ---- ---- --------;.; 1.0 86/9/12 Mike Mouat -initial development:; 1.1 86/9/17 Mike Mouat -set sys$login:recall_ buffer.dat%; file prot=s:rwed,o:rwed,g:,w:;P;******************************************************************************* .TITLE SAVE_RECALL_BUFFER .LIBRARY /SYS$LIBRARY:LIB.MLB/D; The recall command buffer is located in the CLI private area (workC; area). There is a pointer to the CLI private area in the processG; permanent data (ppd) area. The system has a global symbol definitionA; of the start of the ppd so its best to begin there and then get ; pointers to the reca!ll buffer. .PSECT DATA,WRT,NOEXEMOUTFAB: $FAB FNM = ,- ; Primary output filename& FOP = CTG,- ; Make contiguous file+ FAC = ,- ; Open for PUT operations) SHR = ,- ; Exclusive file access) MRS = REC_SIZE,- ; Maximum record size) RAT = CR,- ; Implied carriage control1 XAB = DEF_XAB ; Address of start of XAB chain.OUTRAB: $RAB FAB = OUTFAB,- ; Pointer to FAB% ROP = WBH,- ; Write behind option. RBF = REC_BUF ; Output g"ets data from here)REC_SIZE = 1029 ; Maximum record size0PPD$L_PRC = ^X08 ; Displ into ppd for cli ptr:PRC_G_COMMANDS = ^X133 ; Displ into cliarea for rec ptr9PRC_L_RECALLPTR = ^X12F ; Displ to current command ptrDEF_XAB:? $XABPRO PRO = ; File prot=s:rwed,o:rwed,g:,w:REC_BUF:# .BLKB REC_SIZE-4 ; Record buffer RECALL_PTR:* .LONG 0 ; Save current command pointer& ; Note: REC_BUFF and RECALL_PTR # ;... are stored as one recordP;*** #**************************************************************************** .PSECT CODE,NOWRT,EXEC .ENTRY SAVERB,^M ; Save reg's 2-7,10,11F; Delete the last copy of sys$login:recall_buffer.dat so that there isD; no build up of unwanted files. Then create, open and connect to a-; new version of sys$login:recall_buffer.dat.4 $ERASE FAB=OUTFAB ; Delete last copy of data file9 MOVL #4,OUTFAB+FAB$L_ALQ ; Allocate 4 blocks for output3 $CREATE FAB=OUTFAB ; Cr $eate and open output file BLBC R0,EXIT3 ; Quit on error) $CONNECT RAB=OUTRAB ; Connect to output& BLBS R0,WRITE ; Branch to read loop" BRB EXIT4 ; Trap connect-error+EXIT3: MOVAL OUTFAB,R6 ; Keep fab address# BRB F_ERR ; Signal record error6EXIT4: MOVAL OUTRAB,R6 ; If error retain rab address# BRB R_ERR ; Signal record errorJ; The recall command buffer will be saved byte for byte as it exists ( andK; when restored it will be restored byte for byte) . There is a p %ointer inO; the cli private storage area that points to the start of the buffer, get it.P; There is also a pointer that keeps track of the current command, this pointer#; must also be retrieved and saved.7WRITE: MOVAB G^CTL$AG_CLIDATA,R10 ; Get address of ppd: MOVL PPD$L_PRC(R10),R11 ; Get addr of cli privatestorageD MOVL PRC_L_RECALLPTR(R11),RECALL_PTR ; Get current command pointer > MOVAB PRC_G_COMMANDS(R11), R7 ; Get start addr of recall buf8 MOVC3 #1025,(R7),REC_BUF ; Move buff&er to temp storage5 MOVW #1029,OUTRAB+RAB$W_RSZ ; Size of output record% $PUT RAB=OUTRAB ; Write the record BLBC R0,EXIT4 ; Quit on error, BRB DONE ; Finished, so cleanup and stop6F_ERR: PUSHL FAB$L_STV(R6) ; Push stv and sts of fab% PUSHL FAB$L_STS(R6) ; on the stack' CALLS #2,G^LIB$SIGNAL ; Signal error BRB EXIT ;6R_ERR: PUSHL RAB$L_STV(R6) ; Push stv and sts of rab% PUSHL RAB$L_STS(R6) ; on the stack' CALLS #2,G^LIB$SIGNAL ; Signal error-DONE: $CLOSE FAB'=OUTFAB ; Close output file)EXIT: RET ; Return with status in r0 .END SAVERBww­ΰΟB₯J– .TITLE SMGTRMPTRDEF $$SMGTRMPTRDEF GLOBAL .ENDww­€ŸŽ¨J– .TITLE SSDEF $SSDEF GLOBAL .ENDww­ oΪ«J– .TITLE STATEDEF .LIBRARY /SYS$LIBRARY:LIB.MLB/ $STATEDEF GLOBAL .ENDww­ΐ>™K–; TIME_USEROPEN.MAR .TITLE TIME_USEROPEN;1; This procedure will open a file with a time-out0; period of 10 seconds. It is called by the OPEN; statement in TIMEOUT.FOR.;" .PSECT CODE PIC, SHR, NOWRT, LONG .ENTRY TIMEOUT_OPEN, ^M<>;"; Set up RAB for TMO of 10 seconds( MOVL 8(AP), R0 ; Get RAB address $RAB_STORE ROP=TMO, TMO=#240; ; Open file $OPEN FAB=@4(AP) BLBC R0, EXIT;%; Connect a record stream to the file $CONNECT RAB=@8(AP) EXIT: RET .ENDww