.TITLE DIRPAR - DIRectory Table Parser .IDENT /1.4/ .ENABL LC ;+ ; ; Free software BY ; Project Software & Development, Inc. ; ; This software is furnished for free and may be used and copied as ; desired. This software or any other copies thereof may be provided or ; otherwise made available to any other person. No title to and ; ownership of the software is hereby transferred or allowed. ; ; The information in this software is subject to change without notice ; and should not be construed as a commitment by PROJECT SOFTWARE ; AND DEVELOPMENT, INC. ; ; PROJECT SOFTWARE assumes no responsibility for the use or reliability ; of this software on any equipment whatsoever. ; ; Project Software & Development, Inc. ; 14 Story St. ; Cambridge, Ma. 02138 ; 617-661-1444 ; ; ; Title: DIRPAR.MAC ; Author: Robin Miller ; Date: February 19, 1985 ; ; Description: ; ; Table parser for the DIRectory program. ; ; Modification History: ; ; July 22, 1985 by Robin Miller. Edit (04), Version 1.4 ; Add /APPEND quailifer to append to existing output file. ; ; April 25, 1985 by Robin Miller. Edit (03), Version 1.3 ; Make sure the display date bit (B.DATE) gets set if a date ; is specified. The command "/BR/DATE=EXPIRED" did not work. ; ; April 11, 1985 by Robin Miller. Edit (02), Version 1.2 ; Add /FORMAT qualifier to allow specific output format. ; ; April 11, 1985 by Robin Miller. Edit (01), Version 1.1 ; Add /REWIND qualifier to rewind the magtape. ; ;- .ENABL AMA .NLIST BEX ; .MCALL ISTAT$, STATE$, TRAN$ .MCALL ISTAT$, STATE$ ;+ ; ; ; Description: ; ; DIR is a program used to list directorys in various formats. ; ; There are two methods of starting DIR; they are: ; ; 1. > RUN $DIR ; File(s): ; ; This is the interactive mode. DIR continues to prompt for ; input until end of file (CTRL/Z) is encountered to exit. ; The length of the command lines can be up to a maximum of ; 132 characters. The continuation character "-" is allowed ; at the end of a line. If command file input is used "@", ; and the extension isn't specified the default is .CMD. ; ; 2. > DIR command_line ; ; DIR processes the specified command line and then exits. ; ; Command lines are of the form: ; ; input_file1,input_file2, ... input_filen/switches ; ;- ;+ ; ; The following patches from the MULTI-TASKER Volume 16, Number 3, allow ; unlimited keywords in TPARS. The artical was submitted by Ken Cross of ; Perceptics Corporation (thank-you Ken, this limitation was been a pain). ; ; >LBR TRANS.ORG=LB:[1,1]RSXMAC.SML/EX:TRAN$ ; >SLP @TRANS.COR ; ; TRANS.COR contents: ; ; TRANS.MAC=TRANS.ORG ; -29,37 ; .MACRO $$$TYP ; .BYTE 200 ; .ENDM $$$TYP ; $$$KEY = $$$KEY+1 ; $$$FLG = $$$FLG!1 ; .MACRO $$$EXT ; .WORD $$$TMP ; .ENDM ; / ; ; >LBR LB:[1,1]RSXMAC.SML=TRANS.MAC/RP ; ; The patch to TPARS changes five words using the ZAP utility: ; ; >LBR TPARS.OBJ=LB:[1,1]SYSLIB/EX:.TPARS ; >ZAP ; ZAP>TPARS.OBJ/AB ; Location Change To ; -------- ------ -- ; 2:202/ 042700 16500 ; 2:204/ 177700 1 ; 2:206/ 006300 240 ; 2:210/ 061600 240 ; 2:212/ 011000 240 ; 1:16/ 146400 146401 ; ; The last word changes the version from V0122 to V0122A. The revised ; module can then be replaced in SYSLIB if desried. ; ;- ; Modified version of TRAN$ macro. .MACRO TRAN$ TYPE,LABEL,ACTION,MASK,ADDR .PSECT $STATE MTRAN$ DBGTP$ .IF NB ACTION $$$FLG = $$$FLG!2 .MACRO $$$ACT .WORD ACTION .ENDM $$$ACT .ENDC .IF NB MASK $$$FLG = $$$FLG!30 .IF B ADDR .ERROR "MASK ADDRESS NOT PRESENT" .ENDC .MACRO $$$BIT .WORD MASK,ADDR .ENDM $$$BIT .ENDC .IF NB LABEL $$$FLG = $$$FLG!4 $$$STA = LABEL .ENDC .IRPC $$$$$X, .IF IDN <$$$$$X>,<"> .PSECT $KSTR $$$TMP = . .ASCII TYPE<377> .MACRO $$$TYP ;**NEW** .BYTE 200 ;**NEW** .ENDM $$$TYP ;**NEW** $$$KEY = $$$KEY+1 ;**NEW** $$$FLG = $$$FLG!1 ;**NEW** .MACRO $$$EXT ;**NEW** .WORD $$$TMP ;**NEW** .ENDM ;**NEW** .MEXIT ;**-9 .ENDC .IF IDN <$$$$$X>, $$$FLG = $$$FLG!1 .MACRO $$$EXT .WORD 0'TYPE .ENDM $$$EXT .MACRO $$$TYP .BYTE $SUBXP .ENDM $$$TYP .MEXIT .ENDC .MACRO $$$TYP .BYTE TYPE .ENDM $$$TYP .MEXIT .ENDM .PSECT .ENDM TRAN$ ; Define start of state and keyword tables. ISTAT$ STATE, KEYWRD ; Now define the actual state table. .GLOBL START ; Skip any comment lines. STATE$ START TRAN$ <'!>,$EXIT,,B.CMNT,STATUS TRAN$ <'?>,$EXIT,HELP,B.CMNT,STATUS TRAN$ $LAMDA ; Parse the input file name(s) and switches. STATE$ IFILE TRAN$ '/,ISW TRAN$ $ANY,IFILE,SIFILE,B.IFIL,STATUS TRAN$ $EOS,$EXIT ; Check for valid switches. STATE$ ISW TRAN$ !SWTBL,IFILE ;*************************************************************************** ; ; Subexpression to check for valid startup switches. ; STATE$ SWTBL ; Found the start of a switch. ; ; TRAN$ key_word,next_state,action_routine,bit,status_word TRAN$ !CHKNEG,SWSTA,SETNEG TRAN$ $LAMDA,,SETPOS STATE$ SWSTA ; TRAN$ "ACL" TRAN$ "APPEND",$EXIT,,B.APND,STATUS ; (04) ; TRAN$ "BACKUP" TRAN$ "ALL",$EXIT,ALLSW TRAN$ "BEFORE",BEFSTA TRAN$ "BRIEF",$EXIT,BREFSW ; TRAN$ "BYOWNER",$EXIT,,B.BOWN,SWMASK TRAN$ "COLUMNS",COLSTA TRAN$ "CREATED",$EXIT,CREASW,B.CDAT,SWMASK TRAN$ "DATE",DATSTA TRAN$ "DETACH",$EXIT,,B.DET,STATUS ; TRAN$ "EXCLUDE" TRAN$ "EXPIRED",$EXIT,EXPISW,B.EDAT,SWMASK TRAN$ "FID",FIDSTA TRAN$ "FILEID",$EXIT,,B.FID,SWMASK TRAN$ "FF",$EXIT,,B.FF,STATUS TRAN$ "FORMAT",FMTSTA ; (02) TRAN$ "FORMFEED",$EXIT,,B.FF,STATUS TRAN$ "FULL",$EXIT,,B.FULL,SWMASK TRAN$ "GRANDTOTAL",$EXIT,,B.GTOT,SWMASK TRAN$ "HELP",$EXIT,HELP,B.CMNT,STATUS TRAN$ "HEADING",$EXIT,HEADSW TRAN$ "MODIFIED",$EXIT,MODISW,B.MDAT,SWMASK TRAN$ "OUTPUT",OFILE TRAN$ "OWNER",$EXIT,,B.OWNR,SWMASK TRAN$ "PRINTER",$EXIT,PRINTR,B.OFIL!B.PRI,STATUS TRAN$ "PROTECTION",$EXIT,,B.PROT,SWMASK TRAN$ "REVISED",$EXIT,MODISW,B.MDAT,SWMASK TRAN$ "REWIND",$EXIT,REWIND ; (01) TRAN$ "SINCE",SINSTA TRAN$ "SIZE",SIZSTA TRAN$ "SPOOL",$EXIT,,B.SPOL,STATUS TRAN$ "TODAY",$EXIT,SINTOD,D.SIN,DATESW TRAN$ "TOTAL",$EXIT,,B.TOT,SWMASK TRAN$ "TRAILING",$EXIT,TAILSW TRAN$ "VERSION",$EXIT,SHOVER,B.CMNT,STATUS ; TRAN$ "WIDTH" ;****************************************************************************** ; ; Parse the format string. ; ; Format: /FORMAT="format string" ; STATE$ FMTSTA TRAN$ '=,FMTST1 TRAN$ ': STATE$ FMTST1 TRAN$ $ANY,$EXIT,SAVFMT,B.FMT,STATUS ;****************************************************************************** ; ; Parse the output file name and switches. ; ; Format: /OUTPUT[=file_name] ; ; If no file name is specified, the default name is used. ; STATE$ OFILE TRAN$ '=,OFILE1 TRAN$ ':,OFILE1 TRAN$ $LAMDA,$EXIT,,B.OFIL,STATUS STATE$ OFILE1 TRAN$ $ANY,$EXIT,SOFILE,B.OFIL,STATUS ;****************************************************************************** ; ; Parse the number of columns to display. ; ; Format: /COLUMNS=n (n = 1 - 25) ; STATE$ COLSTA TRAN$ '=,COLST1 TRAN$ ': STATE$ COLST1 TRAN$ $DNUMB,$EXIT,SAVCOL ;****************************************************************************** ; ; Parse the date(s) to display. ; ; Format: /DATE ; /DATE=ALL ; /DATE=CREATED ; /DATE=EXPIRED ; /DATE=MODIFIED (or REVISED) ; /NODATE ; ; If just /DATE is specified, CREATED is the default. ; STATE$ DATSTA TRAN$ '=,DATTYP,CLRDAT TRAN$ ':,DATTYP,CLRDAT TRAN$ $LAMDA,$EXIT,DATES,DEFDAT,DATESW STATE$ DATTYP TRAN$ "ALL",$EXIT,DATES,D.ALL,DATESW ; (03) TRAN$ "CREATED",$EXIT,DATES,D.CDAT,DATESW ; (03) TRAN$ "EXPIRED",$EXIT,DATES,D.EDAT,DATESW ; (03) TRAN$ "MODIFIED",$EXIT,DATES,D.MDAT,DATESW ; (03) TRAN$ "REVISED",$EXIT,DATES,D.MDAT,DATESW ; (03) ;****************************************************************************** ; ; Parse the file identification. ; ; Format: /FID=(fid1,fid2[,fid3]) ; or ; /FID=(fid1:fid2:[fid3]) ; or ; /FID:fid1:fid2:fid2 ! Same format as PIP. ; STATE$ FIDSTA TRAN$ '=,FIDST0 TRAN$ ': STATE$ FIDST0 TRAN$ '(,FIDST1 TRAN$ $LAMDA STATE$ FIDST1 TRAN$ $NUMBR,,SFID1 STATE$ TRAN$ <',>,FIDST2 TRAN$ ': STATE$ FIDST2 TRAN$ $NUMBR,,SFID2 STATE$ ; The third file ID word is optional. TRAN$ <',>,FIDST3 TRAN$ ':,FIDST3 TRAN$ $LAMDA,FIDFIN STATE$ FIDST3 TRAN$ $NUMBR,,SFID3 STATE$ FIDFIN TRAN$ '),$EXIT,,B.BFID,STATUS TRAN$ $LAMDA,$EXIT,,B.BFID,STATUS ;****************************************************************************** ; ; Parse the size(s) to display. ; ; Format: /SIZE ; /SIZE=ALL ; /SIZE=ALLOCATION ; /SIZE=USED ; /NOSIZE ; ; If just /SIZE is specified, ALL is the default. ; STATE$ SIZSTA TRAN$ '=,SIZTYP TRAN$ ':,SIZTYP TRAN$ $LAMDA,$EXIT,SIZESW STATE$ SIZTYP TRAN$ "ALL",$EXIT,,B.SIZA!B.SIZU,SWMASK TRAN$ "ALLOCATION",$EXIT,,B.SIZA,SWMASK TRAN$ "USED",$EXIT,,B.SIZU,SWMASK ;****************************************************************************** ; ; Parse the /BEFORE date to display. ; ; Format: /BEFORE[=option] ; ; See the date parsing states for the valid options. ; STATE$ BEFSTA TRAN$ '=,BEFST1 TRAN$ ':,BEFST1 TRAN$ $LAMDA,$EXIT,BEFTOD,D.BEF,DATESW STATE$ BEFST1 TRAN$ !PARDAT,$EXIT,SAVBEF,D.BEF,DATESW ;****************************************************************************** ; ; Parse the /SINCE date to display. ; ; Format: /SINCE[=option] ; ; See the date parsing states for the valid options. ; STATE$ SINSTA TRAN$ '=,SINST1 TRAN$ ':,SINST1 TRAN$ $LAMDA,$EXIT,SINTOD,D.SIN,DATESW STATE$ SINST1 TRAN$ !PARDAT,$EXIT,SAVSIN,D.SIN,DATESW ;****************************************************************************** ; Check for negation of a command (either - or NO). STATE$ CHKNEG TRAN$ '-,$EXIT TRAN$ 'N STATE$ TRAN$ 'O,$EXIT ;****************************************************************************** ; ; Parse the /BEFORE and/or /SINCE dates. ; ; Format: dd-mmm-yyyy hh:mm ; MONTH ; TODAY ; YEAR ; STATE$ PARDAT TRAN$ $DNUMB,MONSTA,SAVDAY TRAN$ "MONTH",$EXIT,SETMON TRAN$ "TODAY",$EXIT,SETTOD TRAN$ "YEAR",$EXIT,SETYR TRAN$ "YESTERDAY",$EXIT,SETYES STATE$ MONSTA TRAN$ '- STATE$ TRAN$ "JAN",YEARST,,1,TMPMON TRAN$ "FEB",YEARST,,2,TMPMON TRAN$ "MAR",YEARST,,3,TMPMON TRAN$ "APR",YEARST,,4,TMPMON TRAN$ "MAY",YEARST,,5,TMPMON TRAN$ "JUN",YEARST,,6,TMPMON TRAN$ "JUL",YEARST,,7,TMPMON TRAN$ "AUG",YEARST,,8.,TMPMON TRAN$ "SEP",YEARST,,9.,TMPMON TRAN$ "OCT",YEARST,,10.,TMPMON TRAN$ "NOV",YEARST,,11.,TMPMON TRAN$ "DEC",YEARST,,12.,TMPMON STATE$ YEARST TRAN$ '- STATE$ YEARS1 TRAN$ $DNUMB,,SAVEYR STATE$ TRAN$ $DNUMB,HOURST,SAVEHR TRAN$ $LAMDA,$EXIT STATE$ HOURST TRAN$ ': STATE$ TRAN$ $DNUMB,$EXIT,SAVMIN ;****************************************************************************** ; The next STATE$ is needed for the end of the table. STATE$ ; Action routines for TPARS. ; Registers R0, R1, and R2 may be used by the action routines. ; All other registers must be preserved. ;****************************************************************************** ; Tell TPARS to ignore blanks during parse. ; This is used to ignore blanks in the options. IBLANK: CLRB .PFLAG ; Ignore blanks. RETURN ; Action routine to tell TPARS to pass blanks. ; This is used to pass blanks in the message. PBLANK: MOVB #1,.PFLAG ; Pass blanks. RETURN ;****************************************************************************** ; Action routines to set the negate flag true or false. SETNEG: MOV #-1,NEGFLG ; Show command is being negated. RETURN SETPLU: CLR NEGFLG ; Reset the negation flag. RETURN SETPOS: CLR NEGFLG ; Reset the negation flag. RETURN ;****************************************************************************** ; Enable or disable the /ALL bits. ALLSW: MOV #B.ALL,R0 ; Set the ALL bit numbers. JMP DOSWM ; Turn the switchs on or off. ;****************************************************************************** ; Enable a brief directory format (normally the default). BREFSW: CLRB SWMASK ; Set for brief directory format. RETURN ;****************************************************************************** ; Clear the date switch. Needed to clear default date switch. CLRDAT: CLRB DATESW ; Clear the date switch. RETURN ;****************************************************************************** ; Save the number of columns for display. SAVCOL: MOV .PNUMB,R0 ; Copy the number specified. BEQ FAIL ; If EQ, illegal number. CMP R0,#25. ; Is number of columns too big ? BHI FAIL ; If HI, yes. MOV R0,NUMCOL ; No, set new number of columns. RETURN ;****************************************************************************** ; Disable expired and modified date switches for /CREATED. CREASW: BIC #B.EDAT!B.MDAT,SWMASK ; Set for created date only. RETURN ; Disable created and modified date switches for /EXPIRED. EXPISW: BIC #B.CDAT!B.MDAT,SWMASK ; Set for expired date only. RETURN ; Disable created and expired date switches for /MODIFIED. MODISW: BIC #B.CDAT!B.EDAT,SWMASK ; Set for modified date only. RETURN ;****************************************************************************** ; Enable or disable the directory date. DATES: MOV #B.DATE,R0 ; Set the DATE bit number. JMP DOSWM ; Turn the switch on or off. ;****************************************************************************** ; Enable or disable the directory heading text. HEADSW: MOV #B.HEAD,R0 ; Set the HEADING bit number. JMP DOSWM ; Turn the switch on or off. ;****************************************************************************** ; Rewind the magtape. REWIND: JSR R5,$SAVRG ; Save R3 - R5. Added for edit (01) MOV IENTRY,R2 ; Copy the input file entry. MOV O.FDB(R2),R0 ; Copy the input FDB address. MOV #FF.RWD,R1 ; Set the rewind function. CLR R2 ; Make sure these CLR R3 ; registers are zero. JMP .CTRL ; Rewind the magtape and return. ;****************************************************************************** ; Enable or disable the size used/allocated. SIZESW: MOV #B.SIZA!B.SIZU,R0 ; Set the SIZE bit numbers. JMP DOSWM ; Turn the switch on or off. ;****************************************************************************** ; Enable or disable the directory trailing text. TAILSW: MOV #B.TAIL,R0 ; Set the TRAILING bit number. JMP DOSWM ; Turn the switch on or off. ;****************************************************************************** ; Return failure to the table parser. FAIL:: ADD #2,(SP) ; Return failure to .TPARS. RETURN .SBTTL Copy the input or output file name(s) ;****************************************************************************** ; Save the input file name(s). SIFILE: MOV INPTR,R0 ; Copy address to store file names. CALL CPYFIL ; Now, copy the file specification. BCS FAIL ; If CS, the buffer was exceeded. MOV R0,INPTR ; Save the updated buffer address. RETURN ;****************************************************************************** ; Save the output file name. SOFILE: MOV OENTRY,R2 ; Copy the output file entry address. MOV O.FNAM(R2),R0 ; Copy address to store file name. CALL CPYFIL ; Now, copy the file specification. BCS FAIL ; If CS, the buffer was exceeded. RETURN .ENABL LSB ; Direct the output to the line printer. PRINTR: BIT #B.OFIL,STATUS ; Output file already specified ? BNE 10$ ; If NE, yes. MOV OENTRY,R2 ; Copy the output file entry address. MOV O.FNAM(R2),R0 ; Copy address to store file name. MVS ; Write output to the line printer. BR 100$ ; Use common return ... ; If an output file was specified, set to spool to the printer. 10$: BIS #B.SPOL,STATUS ; Spool output file to the printer. 100$: RETURN .DSABL LSB ;****************************************************************************** ; Check and save the day. SAVDAY: MOV .PNUMB,R0 ; Copy the specified day. CMP R0,#31. ; Is the date within range ? BHI FAIL ; If HI, no (return failure). MOV R0,TMPDAY ; Else, save the day. RETURN ; Save the specified year. SAVEYR: MOV .PNUMB,R0 ; Copy the specified year. CMP R0,#1900. ; Did they specify the 19xx ? BLO 10$ ; If LO, no. SUB #1900.,R0 ; Yes, subtract out century. 10$: MOV R0,TMPYR ; Save the specified year. RETURN ; Check and save the hour. SAVEHR: MOV .PNUMB,R0 ; Copy the specified hour. CMP R0,#23. ; Is the hour within range ? BHI FAIL ; If HI, no. MOV R0,TMPHR ; Else, save the hour. RETURN ; Check and save the minute. SAVMIN: MOV .PNUMB,R0 ; Copy the specified minute. CMP R0,#59. ; Is the minute within range ? BHI FAIL ; If HI, no. MOV R0,TMPMIN ; Yes, save the minute. RETURN ;*************************************************************************** ; Set for all files this month. SETMON: MOV #1,TMPDAY ; Set for first day. MOV CURMON,TMPMON ; Copy the current month. MOV CURYR,TMPYR ; Copy the current year. RETURN ; Set for all files today. SETTOD: MOV CURDAY,TMPDAY ; Copy the current day. MOV CURMON,TMPMON ; Copy the current month. MOV CURYR,TMPYR ; Copy the current year. RETURN ; Set for all files this year. SETYR: MOV #1,TMPDAY ; Set for the first day. MOV #1,TMPMON ; Set for the first month. MOV CURYR,TMPYR ; Copy the current year. RETURN ; Number of days in each month. DAYMON: .BYTE 0 ; No month zero. .BYTE 31.,28.,31.,30.,31.,30. ; Jan|Feb|Mar|Apr|May|Jun .BYTE 31.,31.,30.,31.,30.,31. ; Jul|Aug|Sep|Oct|Nov|Dec .EVEN ; Set for yesterday's date. SETYES: MOV CURDAY,R0 ; Copy the current day. MOV CURMON,R1 ; Copy the current month. MOV CURYR,R2 ; Copy the current year. DEC R0 ; Adjust day of the month. BGT 20$ ; If GT, not first day. DEC R1 ; Adjust month of the year. BGT 10$ ; If GT, not first month. MOV #12.,R1 ; Set month to December. ; Get last day of previous month. 10$: MOVB DAYMON(R1),R0 ; Copy last day of last month. 20$: MOV R0,TMPDAY ; Save day of the month. MOV R1,TMPMON ; Save month of the year. MOV R2,TMPYR ; Save year if the century. RETURN ;*************************************************************************** ; Select all files /BEFORE=TODAY. BEFTOD: CALL SETTOD ; Set for today's files. ; Fall through to copy. ; Copy the temporary date/hour to before storage area. SAVBEF: MOV #TMPDAY,R0 ; Set starting buffer address. MOV #BEFDAY,R1 ; Copy it to this address. MOV #DTSIZE,R2 ; Set number of words to copy. 10$: MOV (R0)+,(R1)+ ; Copy the temporary storage. SOB R2,10$ ; Loop until done. RETURN ; Select all files /SINCE=TODAY. SINTOD: CALL SETTOD ; Set for today's files. ; Fall through to copy. ; Copy the temporary date/hour to since storage area. SAVSIN: MOV #TMPDAY,R0 ; Set starting buffer address. MOV #SINDAY,R1 ; Copy it to this address. MOV #DTSIZE,R2 ; Set number of words to copy. 10$: MOV (R0)+,(R1)+ ; Copy the temporary storage. SOB R2,10$ ; Loop until done. RETURN ;*************************************************************************** ; Save the file ID for /FID qualifier. SFID1: MOV .PNUMB,TMPFID ; Save the first FID word. RETURN SFID2: MOV .PNUMB,TMPFID+2 ; Save the second FID word. CLR TMPFID+4 ; Clear third optional word. RETURN SFID3: MOV .PNUMB,TMPFID+4 ; Save the third FID word. RETURN .SBTTL SAVFMT - Save format string pointer. ;+ ; ; SAVFMT - Save format string pointer. ; ; This routins save the starting address of the format string. The last ; byte of the format string (double quote (")) is converted to a null. ; ; Inputs: ; R3 = The remaining input string byte count. ; R4 = The input string buffer address. ; ; Implicit inputs: ; .PCHAR = The character matched by the $ANY transition. ; ; Outputs: ; R3 = The adjusted input string byte count. ; R4 = The updated input string buffer address. ; ; *** This routine added for edit number (02) *** ;- SAVFMT::CMPB .PCHAR,#'" ; Is first character a (") ? BNE 90$ ; If NE, no (illegal format). TST R3 ; Is there any byte count ? BEQ 90$ ; If EQ, no (illegal format). MOV R4,SOFFMT ; Copy starting buffer address. 10$: CMPB (R4)+,#'" ; End of quotes format string ? BEQ 100$ ; If EQ, yes (finish up). SOB R3,10$ ; Check the next character. 90$: JMP FAIL ; Return failure to .TPARS. 100$: CLRB -1(R4) ; Convert double quote to null. DEC R3 ; Adjust for the double quote. CLRB SWMASK ; Set for brief directory format. BIC #B.HEAD!B.TAIL,SWMASK ; Don't display head/tail lines. RETURN .SBTTL CHKOPE - Check for an open file. ;+ ; ; CHKOPE - Check for an open file. ; ; This routine is used to pass back a status as to whether an input file ; is open when executing a common command. If a file is not open, we ; presume we're parsing the switches on the command line, otherwise we ; presume we're currently listing a file. ; ; Inputs: ; None. ; ; Outputs: ; C bit clear/set = not open/file open. ; R2 = The file entry address. ; ; All other registers are preserved. ; ;- CHKOPE::MOV IENTRY,R2 ; Copy the file entry address. JSR R2,$SAVVR ; Save R0 - R2. MOV O.FDB(R2),R0 ; Copy the FDB address. TST F.BDB(R0) ; Is an input file open ? BEQ 10$ ; If EQ, no (C bit clear). SEC ; Show the file is open. 10$: RETURN .SBTTL CPYFIL - Copy the file specification. ;+ ; ; CPYFIL - Copy the file specification. ; ; This routine is called by action routines to copy the file name strings ; from the input string being parsed. Syntax checking of the file name is ; done by the CSI routines called when opening a file. ; ; Inputs: ; R0 = The file name buffer address. ; R3 = The remaining input string byte count. ; R4 = The input string buffer address. ; ; Implicit inputs: ; .PCHAR = The character matched by the $ANY transition. ; ; Outputs: ; C bit clear/set = success/failure. ; ; R0 = The updated buffer address. ; R3 = The adjusted input string byte count. ; R4 = The updated input string buffer address. ; ;- CPYFIL::MOVB .PCHAR,(R0)+ ; Copy the first character. 10$: TST R3 ; Is there any count left ? BEQ 100$ ; If EQ, no (end of string). ; A slash, space, or horizontal tab stops the file copy. CMPB (R4),#'/ ; Encountering a switch ? BEQ 100$ ; If EQ, yes. CMPB (R4),#SPACE ; Encountering a delimiter ? BEQ 100$ ; If EQ, yes. CMPB (R4),#HT ; Encountering a delimiter ? BEQ 100$ ; If EQ, yes. TSTB (R0) ; Are we at end of the buffer ? BMI 90$ ; If MI, yes (file name too big). MOVB (R4)+,(R0)+ ; Else, copy the character. SOB R3,10$ ; Adjust the count and loop. BR 100$ ; Use common return ... 90$: SEC ; Show failure ... RETURN 100$: CLRB (R0) ; Terminate the file name. RETURN .SBTTL DOSWM - Change a switch mask status bit. ;+ ; ; DOSWM - Change a switch mask status bit. ; ; Inputs: ; R0 = The status bit number. ; ; Outputs: ; C bit clear/set = status bit set/cleared. ; ; All registers are preserved. ; ;- DOSWM:: BIS R0,SWMASK ; Presume we're setting switch. TST NEGFLG ; Are we setting the switch ? BEQ 10$ ; If EQ, yes. BIC R0,SWMASK ; Else, disable the switch. SEC ; Show status bit was cleared. 10$: RETURN .SBTTL DOSWS - Change a status bit. ;+ ; ; DOSWS - Change a status bit. ; ; Inputs: ; R0 = The status bit number. ; ; Outputs: ; C bit clear/set = status bit set/cleared. ; ; All registers are preserved. ; ;- DOSWS:: BIS R0,STATUS ; Presume we're setting switch. TST NEGFLG ; Are we setting the switch ? BEQ 10$ ; If EQ, yes. BIC R0,STATUS ; Else, disable the switch. SEC ; Show status bit was cleared. 10$: RETURN .SBTTL DOSWT - Change a table entry status bit. ;+ ; ; DOSWT - Change a table entry status bit. ; ; Inputs: ; R0 = The status bit number. ; ; Outputs: ; R2 = The file entry address. ; ; C bit clear/set = status bit set/cleared. ; ;- DOSWT:: MOV IENTRY,R2 ; Copy the file entry address. BIS R0,(R2) ; Presume we're setting switch. TST NEGFLG ; Are we setting the switch ? BEQ 10$ ; If EQ, yes (C bit is cleared). BIC R0,(R2) ; Else, disable the switch. SEC ; Show status bit was cleared. 10$: RETURN .END