BugFix: All FILEENUM based BINs

This commit is contained in:
Rémy GIBERT 2021-06-27 15:48:04 +02:00
parent 9ae1da903b
commit 4d884ee3b7
8 changed files with 120 additions and 141 deletions

Binary file not shown.

View File

@ -155,7 +155,7 @@ CS.RUN.LOOP ldy #S.PS.hStdIn
.5 cmp /S.STAT.MODE.DIR DIR ?
beq .6
cmp /S.STAT.MODE.BDEV VOL ?
bne .9
@ -260,7 +260,7 @@ CS.RUN.GetFilePath
>SYSCALL GetMemPtr
>PUSHYA
>SYSCALL StrCpy
>PUSHW ZPFullPath
>PUSHW ZPFileName
>SYSCALL StrCat
@ -304,7 +304,6 @@ bRecurse .BS 1
bPause .BS 1
GID .BS 1
STATBUF .BS S.STAT
hSrcFullPath .BS 1
.INB usr/src/shared/x.fileenum.g

View File

@ -42,7 +42,7 @@ CS.START cld
*--------------------------------------
.1 .DA CS.INIT
.DA CS.RUN
.DA CS.DOEVENT
.DA CS.DOEVENT
.DA CS.QUIT
L.MSG.USAGE .DA MSG.USAGE
L.MSG.DIR .DA MSG.DIR
@ -63,7 +63,7 @@ CS.RUN >INC.G ArgIndex
cmp #'-'
bne .4
ldy #1
ldy #1
lda (ZPPtr1),y
ldx #OptionVars-OptionList-1
@ -99,13 +99,13 @@ CS.RUN >INC.G ArgIndex
jsr InitSrcDirYA
bcc CS.RUN
rts
.8 >LDA.G UID
beq .9
jsr CS.RUN.GetUID
bcs .99
>LDA.G hSrcBasePath
beq .9
@ -153,10 +153,10 @@ CS.RUN.LOOP ldy #S.PS.hStdIn
jsr CS.RUN.FILE
bcc CS.RUN.NEXT
rts
.5 cmp /S.STAT.MODE.DIR DIR ?
beq .6
cmp /S.STAT.MODE.BDEV VOL ?
bne .9
@ -170,12 +170,12 @@ CS.RUN.LOOP ldy #S.PS.hStdIn
*--------------------------------------
CS.RUN.NEXT jsr GetNextEntry
bcc CS.RUN.LOOP
CS.RUN.LEAVE jsr LeaveSubDir
bcs .90
jsr BasePath..
jmp CS.RUN.NEXT
.90 lda #0
@ -185,28 +185,28 @@ CS.RUN.LEAVE jsr LeaveSubDir
CS.RUN.DIR lda (ZPFileName)
cmp #'.'
bne .1
ldy #1
lda (ZPFileName),y
beq .8 skip "."
cmp #'.'
bne .1
iny
lda (ZPFileName),y
beq .8 skip ".."
.1 jsr FilterMatch
bcs .8
jsr CS.RUN.GetFilePath
>PUSHW L.MSG.DIR
>PUSHW ZPFullPath
>PUSHBI 2
>SYSCALL PrintF
bcs .9
>PUSHW ZPFullPath
>PUSHB.G UID
>PUSHBI 255
@ -214,17 +214,17 @@ CS.RUN.DIR lda (ZPFileName)
jsr CS.RUN.CheckErr
bcs .9
>LDA.G bRecurse
bpl .8
>LDYA ZPFileName
jmp EnterSubDirYA
.8 clc
.9 rts
*--------------------------------------
CS.RUN.FILE
CS.RUN.FILE
clc
rts
*--------------------------------------
@ -233,9 +233,9 @@ CS.RUN.GetUID >SYSCALL ArgV
>PUSHWI 0
>SYSCALL GetPWName
bcs .9
>STA.G UID
.9 rts
*--------------------------------------
CS.RUN.CheckErr bcs .1
@ -306,13 +306,11 @@ bRecurse .BS 1
bPause .BS 1
UID .BS 1
STATBUF .BS S.STAT
hSrcFullPath .BS 1
.INB usr/src/shared/x.fileenum.g
DS.END
.ED
DS.END .ED
*--------------------------------------
MAN
SAVE usr/src/bin/chown.s

View File

@ -16,7 +16,7 @@ CIFS2.FStat >DEBUG
*--------------------------------------
CIFS.Stat >STYA pPath resolved path
jsr ClearSocket
* jsr ClearSocket
jsr GetCTX
@ -74,7 +74,7 @@ CIFS2.Stat jsr ReadSocket
*--------------------------------------
CIFS.MKDir >STYA pPath resolved path
jsr ClearSocket
* jsr ClearSocket
jsr GetCtx
@ -158,7 +158,7 @@ CIFS2.OpenDir lda #MLI.E.BADCALL
*--------------------------------------
CIFS.ReadDir jsr GetPFD
jsr ClearSocket
* jsr ClearSocket
jsr GetCtx
@ -320,41 +320,22 @@ CIFS2.ReadDir.GetBuf
sta ZPPtr2
stz ZPPtr2+1
.1 lda ZPPtr2
.1 jsr AddSTAT2Ptr2
lda #22
clc
adc #S.STAT
sta ZPPtr2
bcc .2
jsr AddA2Ptr1
inc ZPPtr2+1
.2 lda ZPPtr1
clc
adc #22
sta ZPPtr1
bcc .3
inc ZPPtr1+1
.3 lda (ZPPtr1) Filename Len
pha
lda (ZPPtr1) Filename Len
sec
adc ZPPtr2
sta ZPPtr2
bcc .4
jsr AddA2Ptr2
inc ZPPtr2+1
.4 pla
lda (ZPPtr1) Filename Len
inc
sec
adc ZPPtr1
sta ZPPtr1
bcc .5
jsr AddA2Ptr1
inc ZPPtr1+1
.5 dex
dex
bne .1
>LDYA ZPPtr2
@ -384,15 +365,11 @@ CIFS2.ReadDir.FillBuf
.1 jsr FileInfo2StatBuf
lda ZPPtr1
lda #22
sec skip Filename Len
adc #22
sta ZPPtr1
bcc .2
jsr AddA2Ptr1
inc ZPPtr1+1
.2 ldy #$ff
ldy #$ff
.3 iny
lda (ZPPtr1),y
@ -401,31 +378,17 @@ CIFS2.ReadDir.FillBuf
tya
sec
adc ZPPtr1
sta ZPPtr1
bcc .4
jsr AddA2Ptr1
inc ZPPtr1+1
tya
sec +\0
jsr AddA2Ptr2
jsr StatBuf2Ptr2
.4 tya
sec
adc ZPPtr2
sta ZPPtr2
bcc .5
jsr AddSTAT2Ptr2
inc ZPPtr2+1
.5 jsr StatBuf2Ptr2
lda #S.STAT
clc
adc ZPPtr2
sta ZPPtr2
bcc .7
inc ZPPtr2+1
.7 dex
dex
bne .1
lda #0
@ -957,7 +920,7 @@ CIFS2.FEOF >DEBUG
*--------------------------------------
CIFS.Remove >STYA pPath resolved path
jsr ClearSocket
* jsr ClearSocket
jsr GetCTX
@ -1011,7 +974,7 @@ CIFS2.Remove jsr ReadSocket
*--------------------------------------
CIFS.Rename >STYA pPath resolved src path
jsr ClearSocket
* jsr ClearSocket
jsr GetCTX

View File

@ -1015,6 +1015,14 @@ FileInfo2StatBufDT
rts
* TODO : S.TIME.WDAY
*--------------------------------------
AddA2Ptr1 adc ZPPtr1
sta ZPPtr1
bcc .8
inc ZPPtr1+1
.8 rts
*--------------------------------------
StatBuf2Ptr2 ldy #S.STAT-1
.1 lda StatBuf,y
@ -1024,6 +1032,17 @@ StatBuf2Ptr2 ldy #S.STAT-1
rts
*--------------------------------------
AddSTAT2Ptr2 lda #S.STAT
clc
*--------------------------------------
AddA2Ptr2 adc ZPPtr2
sta ZPPtr2
bcc .8
inc ZPPtr2+1
.8 rts
*--------------------------------------
ClearSocket jsr ReadSocket
bcs .8
@ -1193,7 +1212,8 @@ SMB.ComWrite.H .DA #12 WORD COUNT
.BS 2 FID
.BS 4 Offset
.HS 00000000 Timeout
.HS 0100 WriteMode=WritethroughMode
.HS 0000
* .HS 0100 WriteMode=WritethroughMode
.HS 0000 Remaining
.HS 0000 Reserved
.BS 2 DataLength

View File

@ -37,7 +37,7 @@ CS.START cld
*--------------------------------------
.1 .DA CS.INIT
.DA CS.RUN
.DA CS.DOEVENT
.DA CS.DOEVENT
.DA CS.QUIT
L.MSG.USAGE .DA MSG.USAGE
L.MSG.DIR .DA MSG.DIR
@ -49,7 +49,6 @@ L.MSG.OK .DA MSG.OK
L.MSG.ERR .DA MSG.ERR
L.MSG.CRLF .DA MSG.CRLF
L.MSG.DONE .DA MSG.DONE
L.STAT .DA STAT
.DA 0
*--------------------------------------
CS.INIT
@ -66,7 +65,7 @@ CS.INIT
lda (ZPPtr1),y
ldy #OptionVars-OptionList-1
.2 cmp OptionList,y
beq .3
@ -172,17 +171,17 @@ CS.RUN ldy #S.PS.hStdIn
rts
*--------------------------------------
.1 .DO X.COPY.TO.DEST=1
>LDA.G bCopy
beq .2
jsr CS.RUN.Copy
>LDA.G bCopy Copy completed ?
bne .8 no.....exit
clc
>LDA.G CopyRC
>LDA.G CopyRC
.DO X.DELETE.SOURCE=0
beq .20 no copy error
@ -221,7 +220,7 @@ CS.RUN ldy #S.PS.hStdIn
jsr CS.RUN.GetPathY
>SYSCALL Remove
bcs .22
jsr CS.RUN.CheckErr Success!!!
jsr CS.RUN.IncCount
jmp CS.RUN.NEXT
@ -241,10 +240,10 @@ CS.RUN ldy #S.PS.hStdIn
lda (ZPFileStat),y
and #$70
bne .5 REG file ?
jsr CS.RUN.BuildFilePath
jmp CS.RUN.REG
.5 cmp /S.STAT.MODE.DIR DIR ?
bne .7
@ -257,7 +256,7 @@ CS.RUN ldy #S.PS.hStdIn
jsr CS.RUN.BuildFilePath
jmp CS.RUN.DIR
.7 lda #MLI.E.UNSUPST
sec
.9 rts
@ -277,7 +276,7 @@ CS.RUN.LEAVE jsr LeaveSubDir exit this sub dir....
jsr GetEntry
jsr CS.RUN.BuildFilePath
jsr CS.RUN.DIR.MSG
bcs CS.RUN.LEAVE.RTS
bcs CS.RUN.LEAVE.RTS
ldy #hSrcFullPath
jsr CS.RUN.GetPathY
@ -291,16 +290,16 @@ CS.RUN.LEAVE jsr LeaveSubDir exit this sub dir....
.99 bit bQuiet
bmi .91
>PUSHW L.MSG.DONE
ldy #Count+1
>PUSHB (pData),y
dey
>PUSHB (pData),y
>PUSHBI 2
>SYSCALL PrintF
.91 ldy #RC
lda (pData),y get global RC in case of bContinue
sec
@ -310,10 +309,10 @@ CS.RUN.LEAVE.RTS
CS.RUN.DIR .DO X.COPY.TO.DEST=1
jsr CS.RUN.DIR.MSG
bcs CS.RUN.LEAVE.RTS
jsr CS.RUN.StatDst
bcs .3 File Not exists...go create
bit bNoConfirm
bmi .21 no prompt, nothing to create, enter subdir
@ -326,9 +325,9 @@ CS.RUN.DIR .DO X.COPY.TO.DEST=1
cmp #3
beq .99 abort
jsr CS.RUN.ToUpper
cmp #'N'
bne .2
@ -345,7 +344,7 @@ CS.RUN.DIR .DO X.COPY.TO.DEST=1
.21 clc
lda #0
bra .4
.3 ldy #hDstFullPath
jsr CS.RUN.PushPathY
ldy #S.STAT.MODE+1
@ -355,7 +354,7 @@ CS.RUN.DIR .DO X.COPY.TO.DEST=1
lda (ZPFileStat),y
>PUSHA
>SYSCALL MKDir
.4 jsr CS.RUN.CheckErr
bcs CS.RUN.DIR.RTS
jsr CS.RUN.IncCount
@ -389,9 +388,9 @@ CS.RUN.REG ldx #2
cmp #3
beq .99 abort
jsr CS.RUN.ToUpper
cmp #'N'
bne .11
@ -408,7 +407,7 @@ CS.RUN.REG ldx #2
* sec
ror bNoConfirm
.12 jsr GetEntry get back current entry corrupted by SLEEP
.12 jsr GetEntry get back current entry corrupted by SLEEP
.2 .DO X.DELETE.SOURCE=1 mv file, check if srcbase=dstbase
ldy #hSrcBasePath
@ -508,7 +507,7 @@ CS.RUN.Rename ldy #hSrcFullPath
.9 rts
.FIN
.FIN
.FIN
*--------------------------------------
.DO X.COPY.TO.DEST=1
CS.RUN.CopyStart
@ -516,7 +515,7 @@ CS.RUN.CopyStart
>STA.G hDstFile
>STA.G hCopyBuf
>STA.G CopyRC Reset RC
>LDYAI X.COPY.BUF.SIZE
>SYSCALL GetMem
bcs .9
@ -524,14 +523,14 @@ CS.RUN.CopyStart
>STYA ZPPtr1
txa
>STA.G hCopyBuf
ldy #hSrcFullPath
lda #O.RDONLY
jsr CS.RUN.Open
bcs .9
>STA.G hSrcFile
ldy #hDstFullPath
lda #O.WRONLY+O.CREATE
jsr CS.RUN.Open
@ -581,31 +580,31 @@ CS.RUN.Copy >PUSHB.G hSrcFile
CS.RUN.CopyEnd php
pha
>STA.G CopyRC
>LDA.G hDstFile
beq .1
>SYSCALL FClose
.1 >LDA.G hSrcFile
beq .2
>SYSCALL FClose
.2 >LDA.G hCopyBuf
beq .3
>SYSCALL FreeMem
.3 >STZ.G bCopy
pla
plp
rts
rts
.FIN
*--------------------------------------
CS.RUN.Open pha Save open mode
jsr CS.RUN.PushPathY
pla
>PUSHA
@ -615,7 +614,7 @@ CS.RUN.Open pha Save open mode
ldy #S.STAT.P.AUXTYPE+1
>PUSHB (ZPFileStat),y
dey
>PUSHB (ZPFileStat),y
>PUSHB (ZPFileStat),y
>SYSCALL FOpen
rts
@ -668,7 +667,7 @@ CS.RUN.BuildFilePath
>LDA.G hDstFileName
beq .1
>SYSCALL GetMemPtr
>SYSCALL GetMemPtr
>PUSHYA
bra .2
@ -679,10 +678,10 @@ CS.RUN.BuildFilePath
rts
*--------------------------------------
.DO X.COPY.TO.DEST=1
CS.RUN.StatDst ldy #hDstFullPath
jsr CS.RUN.PushPathY
>PUSHW L.STAT
>PUSHEA.G STATBUF
>SYSCALL Stat
rts
@ -693,15 +692,15 @@ CS.RUN.GetPathY sec
CS.RUN.PushPathY
clc
php
lda (pData),y
>SYSCALL GetMemPtr
plp
bcs .8
>PUSHYA
.8 rts
*--------------------------------------
CS.RUN.IncCount >INCW.G Count
@ -738,10 +737,10 @@ CS.QUIT jsr LeaveSubDir
ldy #hSrcFullPath
jsr .7
ldy #hFilter
jsr .7
ldy #hExclude
.7 lda (pData),y

View File

@ -1,11 +1,11 @@
NEW
AUTO 3,1
*--------------------------------------
*--------------------------------------
index .BS 1
hDIRs .BS X.MAX.RECURSE+1
hDIRENTs .BS X.MAX.RECURSE+1
oDIRENTs .BS X.MAX.RECURSE*2
STAT .BS S.STAT
STATBUF .BS S.STAT
hFullPath .BS 1
hSrcBasePath .BS 1
hFilter .BS 1
@ -13,7 +13,7 @@ hExclude .BS 1
.DO X.COPY.TO.DEST=1
hDstBasePath .BS 1
.FIN
*--------------------------------------
*--------------------------------------
MAN
SAVE usr/src/shared/x.fileenum.g
LOAD usr/src/bin/ls.s

View File

@ -9,7 +9,7 @@ X.MAX.RECURSE .EQ 8
* hDIRs .BS X.MAX.RECURSE+1
* hDIRENTs .BS X.MAX.RECURSE+1
* oDIRENTs .BS X.MAX.RECURSE*2
* STAT .BS S.STAT
* STATBUF .BS S.STAT
* hSrcBasePath .BS 1
* hDstBasePath .BS 1 (optional)
* hFilter .BS 1
@ -149,12 +149,12 @@ InitSrcDirYA >PUSHYA
beq .5 we have '/'
>PUSHW ZPPtr1
>PUSHEA.G STAT
>PUSHEA.G STATBUF
>SYSCALL Stat
bcs .1 File/DIR does not exists, go extract pattern
.DO X.ENTER.SUBDIR=1
>LDA.G STAT+S.STAT.MODE+1
>LDA.G STATBUF+S.STAT.MODE+1
and #$F0
cmp /S.STAT.MODE.DIR
bne .4 TYPE not a DIR, extract....
@ -297,11 +297,11 @@ InitDstDirYA >PUSHYA
>STA.G hFullPath
>PUSHW ZPPtr1
>PUSHEA.G STAT
>PUSHEA.G STATBUF
>SYSCALL Stat
bcs .1 File/DIR does not exists, go extract DstFileName
>LDA.G STAT+S.STAT.MODE+1
>LDA.G STATBUF+S.STAT.MODE+1
and #$F0
cmp /S.STAT.MODE.DIR
beq .5 Dst is a directory...no destfilename