DU.S: Added -a option, Usage info.

This commit is contained in:
Bobbi Webber-Manners 2021-06-10 22:58:48 -04:00
parent c57b5dc9bc
commit b8d965ff21

View File

@ -16,20 +16,19 @@ X.ENTER.SUBDIR .EQ 1
X.COPY.TO.DEST .EQ 0 X.COPY.TO.DEST .EQ 0
X.DELETE.SOURCE .EQ 0 X.DELETE.SOURCE .EQ 0
*-------------------------------------- *--------------------------------------
.DUMMY .DUMMY
.OR ZPBIN .OR ZPBIN
ZS.START ZS.START
ZPPtr1 .BS 2 ZPPtr1 .BS 2
ZPPtr2 .BS 2 ZPPtr2 .BS 2
ZPFileName .BS 2 ZPFileName .BS 2
ZPFileStat .BS 2 ZPFileStat .BS 2
ZPPW .BS 2 ZPPW .BS 2
bCRLF .BS 1
hLineBuf .BS 1 hLineBuf .BS 1
ZPLineBuf .BS 2 ZPLineBuf .BS 2
bPass2 .BS 1 bPass2 .BS 1
ZS.END ZS.END
.ED .ED
*-------------------------------------- *--------------------------------------
* File Header (16 Bytes) * File Header (16 Bytes)
*-------------------------------------- *--------------------------------------
@ -51,13 +50,13 @@ CS.START cld
.DA CS.RUN .DA CS.RUN
.DA CS.DOEVENT .DA CS.DOEVENT
.DA CS.QUIT .DA CS.QUIT
L.MSG.REGEXT .DA MSG.REGEXT L.MSG.USAGE .DA MSG.USAGE
L.MSG.DIREXT .DA MSG.DIREXT L.MSG.REG1 .DA MSG.REG1
L.MSG.REG2 .DA MSG.REG2
L.MSG.DIRSUMM .DA MSG.DIRSUMM L.MSG.DIRSUMM .DA MSG.DIRSUMM
L.MSG.BDEV .DA MSG.BDEV L.MSG.BDEV .DA MSG.BDEV
L.MSG.BDEVEXT .DA MSG.BDEVEXT L.MSG.BDEVEXT .DA MSG.BDEVEXT
L.MSG.ENTER .DA MSG.ENTER L.MSG.CWD .DA MSG.CWD
L.MSG.EXIT .DA MSG.EXIT
L.MSG.TOTSUMM .DA MSG.TOTSUMM L.MSG.TOTSUMM .DA MSG.TOTSUMM
J.CS.RUN.PRINT .DA CS.RUN.PRINT.REG J.CS.RUN.PRINT .DA CS.RUN.PRINT.REG
.DA CS.RUN.PRINT.DIR .DA CS.RUN.PRINT.DIR
@ -91,6 +90,9 @@ CS.RUN
dex dex
bpl .2 bpl .2
>PUSHW L.MSG.USAGE
>PUSHBI 0
>SYSCALL PrintF
lda #E.SYN lda #E.SYN
sec sec
rts rts
@ -126,19 +128,6 @@ CS.RUN
bcs .9 bcs .9
>STYA ZPLineBuf >STYA ZPLineBuf
stx hLineBuf stx hLineBuf
* ldy #S.PS.hStdOut
* lda (pPS),y
* tax
* lda OF.Table.hFD-1,x
* >SYSCALL GetMemPtr
* >STYA ZPPtr1
* lda (ZPPtr1) S.FD.T
* beq CS.RUN.LOOP S.FD.T.REG
* cmp #S.FD.T.PIPE
* beq CS.RUN.LOOP
dec bCRLF
*-------------------------------------- *--------------------------------------
CS.RUN.LOOP stz bPass2 CS.RUN.LOOP stz bPass2
@ -202,7 +191,7 @@ CS.RUN.LOOP stz bPass2
bne .91 bne .91
jsr CS.RUN.PrintDirSumm jsr CS.RUN.PrintDirSumm
jsr CS.RUN.EXIT.MSG jsr CS.RUN.PrintCwd
jsr CS.RUN.NewLine jsr CS.RUN.NewLine
.91 jsr LeaveSubDir "cd .." .91 jsr LeaveSubDir "cd .."
@ -210,9 +199,6 @@ CS.RUN.LOOP stz bPass2
jsr BasePath.. Prune pathname jsr BasePath.. Prune pathname
* jsr CS.RUN.ENTER.MSG
* bcs .99
jsr GetNextEntry Get next entry jsr GetNextEntry Get next entry
jmp CS.RUN.LOOP Go again jmp CS.RUN.LOOP Go again
@ -229,9 +215,11 @@ CS.RUN.PRINT.JMP
*-------------------------------------- *--------------------------------------
CS.RUN.PRINT.REG CS.RUN.PRINT.REG
bit bPass2 bit bPass2
bpl .8 bmi .1
clc
rts
ldy #S.STAT.BLOCKS+1 .1 ldy #S.STAT.BLOCKS+1
lda (ZPFileStat),y lda (ZPFileStat),y
pha pha
dey dey
@ -257,19 +245,27 @@ CS.RUN.PRINT.REG
adc (pData),y adc (pData),y
sta (pData),y sta (pData),y
* >PUSHW L.MSG.REGEXT >LDA.G bAllFiles
* ldy #S.STAT.BLOCKS+1 beq .8
* ldx #2
*.2 lda (ZPFileStat),y >PUSHW L.MSG.REG1
* >PUSHA ldy #S.STAT.BLOCKS+1
* dey ldx #2
* dex .2 lda (ZPFileStat),y
* bne .2 (2) >PUSHA
* >PUSHW ZPFileName (2) dey
* >PUSHBI 4 dex
* >SYSCALL PrintF bne .2 (2)
* bcs .9 >PUSHBI 2
* jmp CS.RUN.NewLine.1 >SYSCALL PrintF
bcs .9
jsr CS.RUN.PrintCwd
>PUSHW L.MSG.REG2
>PUSHW ZPFileName (2)
>PUSHBI 2
>SYSCALL PrintF
bcs .9
jmp CS.RUN.NewLine.1
.8 clc .8 clc
.9 rts .9 rts
@ -278,27 +274,13 @@ CS.RUN.PRINT.DIR
bit bPass2 bit bPass2
bmi .8 bmi .8
* >PUSHW L.MSG.DIREXT
* >PUSHW ZPFileName
* >PUSHBI 2
* >SYSCALL PrintF
* bcs .9
* jsr CS.RUN.NewLine.1
* bcs .9
lda (ZPFileName) lda (ZPFileName)
cmp #'.' cmp #'.'
beq .8 beq .8
* jsr CS.RUN.NewLine.1
* bcs .9
>LDYA ZPFileName >LDYA ZPFileName
jmp EnterSubDirYA jmp EnterSubDirYA
jmp CS.RUN.ENTER.MSG
.8 clc .8 clc
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
@ -337,8 +319,6 @@ CS.RUN.PRINT.BDEV
jsr EnterSubDirYA jsr EnterSubDirYA
bcs .9 bcs .9
jmp CS.RUN.ENTER.MSG
.8 clc .8 clc
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
@ -360,21 +340,8 @@ CS.RUN.PrintTotSumm >PUSHW L.MSG.TOTSUMM
>SYSCALL PrintF >SYSCALL PrintF
rts rts
*-------------------------------------- *--------------------------------------
CS.RUN.ENTER.MSG CS.RUN.PrintCwd
>PUSHW L.MSG.ENTER >PUSHW L.MSG.CWD
ldy #hSrcBasePath
lda (pData),y
>SYSCALL GetMemPtr
>PUSHYA
>PUSHBI 2
>SYSCALL PrintF
bcc CS.RUN.NewLine.1
rts
*--------------------------------------
CS.RUN.EXIT.MSG
>PUSHW L.MSG.EXIT
ldy #hSrcBasePath ldy #hSrcBasePath
lda (pData),y lda (pData),y
>SYSCALL GetMemPtr >SYSCALL GetMemPtr
@ -415,51 +382,54 @@ MyResetSrcDir jsr GethDIR Not in Kernel I am building against
*---------------------------------------------- *----------------------------------------------
CS.DOEVENT sec CS.DOEVENT sec
rts rts
*-------------------------------------- *--------------------------------------
CS.QUIT CS.QUIT
jsr LeaveSubDir jsr LeaveSubDir
bcc CS.QUIT bcc CS.QUIT
>LDA.G hFilter >LDA.G hFilter
beq .3 beq .3
>SYSCALL FreeMem >SYSCALL FreeMem
.3 >LDA.G hPW .3 >LDA.G hPW
beq .4 beq .4
>SYSCALL FreeMem >SYSCALL FreeMem
.4 lda hLineBuf .4 lda hLineBuf
beq .8 beq .8
>SYSCALL FreeMem >SYSCALL FreeMem
.8 clc .8 clc
rts rts
*-------------------------------------- *--------------------------------------
.INB usr/src/shared/x.fileenum.s .INB usr/src/shared/x.fileenum.s
*-------------------------------------- *--------------------------------------
CS.END CS.END
*-------------------------------------- *--------------------------------------
OptionList .AS "Ss" OptionList .AS "SAsa"
OptionVars .DA #bSummary,#bSummary OptionVars .DA #bSummary,#bAllFiles,#bSummary,#bAllFiles
*-------------------------------------- *--------------------------------------
MSG.REGEXT .AZ "%5D %s" MSG.USAGE .AS "Usage : DU\r\n"
MSG.DIREXT .AZ "<dir> %s" .AS " -A : Show all files (not only directories)\r\n"
MSG.EXIT .AZ "%s " .AZ " -S : Show only summary\r\n"
MSG.REG1 .AZ "%5D "
MSG.REG2 .AZ "%s"
MSG.CWD .AZ "%s"
MSG.DIRSUMM .AZ "%5D " MSG.DIRSUMM .AZ "%5D "
MSG.BDEVEXT .AZ "/%15s s%dd%d Blocks Used:%5D Total:%5D" MSG.BDEVEXT .AZ "/%15s s%dd%d Blocks Used:%5D Total:%5D"
MSG.BDEV .AZ "\e[32m%s/\e[0m" MSG.BDEV .AZ "\e[32m%s/\e[0m"
MSG.ENTER .AZ "Directory:%s"
MSG.TOTSUMM .AZ "Total: %5D blocks" MSG.TOTSUMM .AZ "Total: %5D blocks"
*-------------------------------------- *--------------------------------------
.DUMMY .DUMMY
.OR 0 .OR 0
DS.START DS.START
ArgCount .BS 1 ArgCount .BS 1
TIME.SysTime .BS S.TIME TIME.SysTime .BS S.TIME
bPause .BS 1 bPause .BS 1
bSummary .BS 1 bSummary .BS 1
bAllFiles .BS 1
DirBlksL .BS 1 DirBlksL .BS 1
DirBlksH .BS 1 DirBlksH .BS 1
TotBlksL .BS 1 TotBlksL .BS 1