2020-07-16 14:53:35 +00:00
|
|
|
|
NEW
|
|
|
|
|
AUTO 3,1
|
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
|
|
|
|
.TF bin/chown
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.INB inc/macros.i
|
|
|
|
|
.INB inc/a2osx.i
|
|
|
|
|
.INB inc/mli.i
|
|
|
|
|
.INB inc/mli.e.i
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
X.ENTER.SUBDIR .EQ 0
|
|
|
|
|
X.COPY.TO.DEST .EQ 0
|
|
|
|
|
X.DELETE.SOURCE .EQ 0
|
2023-07-12 17:07:55 +00:00
|
|
|
|
X.RESET.SRC.DIR .EQ 0
|
2020-07-16 14:53:35 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DUMMY
|
|
|
|
|
.OR ZPBIN
|
|
|
|
|
ZS.START
|
|
|
|
|
ZPPtr1 .BS 2
|
|
|
|
|
ZPPtr2 .BS 2
|
|
|
|
|
ZPFileName .BS 2
|
|
|
|
|
ZPFileStat .BS 2
|
|
|
|
|
ZPFullPath .BS 2
|
|
|
|
|
|
|
|
|
|
ZS.END .ED
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* File Header (16 Bytes)
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.START cld
|
|
|
|
|
jmp (.1,x)
|
|
|
|
|
.DA #$61 6502,Level 1 (65c02)
|
|
|
|
|
.DA #1 BIN Layout Version 1
|
|
|
|
|
.DA 0
|
|
|
|
|
.DA CS.END-CS.START Code Size (without Constants)
|
|
|
|
|
.DA DS.END-DS.START Data SegmentSize
|
|
|
|
|
.DA #64 Stack Size
|
|
|
|
|
.DA #ZS.END-ZS.START Zero Page Size
|
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Relocation Table
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.1 .DA CS.INIT
|
|
|
|
|
.DA CS.RUN
|
2021-06-27 13:48:04 +00:00
|
|
|
|
.DA CS.DOEVENT
|
2020-07-16 14:53:35 +00:00
|
|
|
|
.DA CS.QUIT
|
|
|
|
|
L.MSG.USAGE .DA MSG.USAGE
|
|
|
|
|
L.MSG.DIR .DA MSG.DIR
|
|
|
|
|
L.MSG.FILE .DA MSG.FILE
|
|
|
|
|
L.MSG.OK .DA MSG.OK
|
|
|
|
|
L.MSG.ERR .DA MSG.ERR
|
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.INIT clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN >INC.G ArgIndex
|
|
|
|
|
>SYSCALL ArgV
|
|
|
|
|
bcs .8
|
|
|
|
|
|
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
lda (ZPPtr1)
|
|
|
|
|
cmp #'-'
|
|
|
|
|
bne .4
|
|
|
|
|
|
2021-06-27 13:48:04 +00:00
|
|
|
|
ldy #1
|
2020-07-16 14:53:35 +00:00
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
|
|
|
|
|
ldx #OptionVars-OptionList-1
|
|
|
|
|
|
|
|
|
|
.2 cmp OptionList,x
|
|
|
|
|
beq .3
|
|
|
|
|
dex
|
|
|
|
|
bpl .2
|
|
|
|
|
|
2022-11-02 06:54:30 +00:00
|
|
|
|
.9 >LDYA L.MSG.USAGE
|
|
|
|
|
>SYSCALL PutS
|
2020-07-16 14:53:35 +00:00
|
|
|
|
lda #E.SYN
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
|
|
|
|
|
|
|
|
|
.3 ldy OptionVars,x
|
|
|
|
|
lda #$80
|
|
|
|
|
sta (pData),y
|
|
|
|
|
bra CS.RUN
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.4 >LDA.G UID
|
|
|
|
|
bne .5
|
|
|
|
|
|
|
|
|
|
>LDA.G ArgIndex
|
|
|
|
|
>STA.G UID
|
|
|
|
|
bra CS.RUN
|
|
|
|
|
|
|
|
|
|
.5 >LDA.G hSrcBasePath
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
>LDYA ZPPtr1
|
2023-07-12 17:07:55 +00:00
|
|
|
|
jsr X.InitSrcDirYA
|
2020-07-16 14:53:35 +00:00
|
|
|
|
bcc CS.RUN
|
|
|
|
|
rts
|
2021-06-27 13:48:04 +00:00
|
|
|
|
|
2020-07-16 14:53:35 +00:00
|
|
|
|
.8 >LDA.G UID
|
|
|
|
|
beq .9
|
2021-06-27 13:48:04 +00:00
|
|
|
|
|
2020-07-16 14:53:35 +00:00
|
|
|
|
jsr CS.RUN.GetUID
|
|
|
|
|
bcs .99
|
2021-06-27 13:48:04 +00:00
|
|
|
|
|
2020-07-16 14:53:35 +00:00
|
|
|
|
>LDA.G hSrcBasePath
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
>LDYAI 256
|
|
|
|
|
>SYSCALL GetMem
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
>STYA ZPFullPath
|
|
|
|
|
txa
|
|
|
|
|
>STA.G hSrcFullPath
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.LOOP ldy #S.PS.hStdIn
|
|
|
|
|
lda (pPS),y
|
2020-08-25 10:56:00 +00:00
|
|
|
|
>SYSCALL FEOF
|
2020-07-16 14:53:35 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
tay
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
>SYSCALL GetChar
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
cmp #$03 Ctrl-C
|
|
|
|
|
beq .99 Abort....
|
|
|
|
|
|
|
|
|
|
cmp #$13 Ctrl-S
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
>LDA.G bPause
|
|
|
|
|
eor #$ff
|
|
|
|
|
sta (pData),y
|
|
|
|
|
bne CS.RUN.LOOP
|
|
|
|
|
|
|
|
|
|
.1 >LDA.G bPause
|
|
|
|
|
bne CS.RUN.LOOP Pause...
|
|
|
|
|
*--------------------------------------
|
2023-07-12 17:07:55 +00:00
|
|
|
|
jsr X.GetEntry
|
2020-07-16 14:53:35 +00:00
|
|
|
|
bcs CS.RUN.LEAVE
|
|
|
|
|
|
|
|
|
|
ldy #S.STAT.MODE+1
|
|
|
|
|
lda (ZPFileStat),y
|
|
|
|
|
and #$70
|
|
|
|
|
bne .5 REG file ?
|
|
|
|
|
|
|
|
|
|
jsr CS.RUN.FILE
|
|
|
|
|
bcc CS.RUN.NEXT
|
|
|
|
|
rts
|
2021-06-27 13:48:04 +00:00
|
|
|
|
|
2020-07-16 14:53:35 +00:00
|
|
|
|
.5 cmp /S.STAT.MODE.DIR DIR ?
|
2020-07-18 14:04:21 +00:00
|
|
|
|
beq .6
|
2021-06-27 13:48:04 +00:00
|
|
|
|
|
2020-07-18 14:04:21 +00:00
|
|
|
|
cmp /S.STAT.MODE.BDEV VOL ?
|
|
|
|
|
bne .9
|
2020-07-16 14:53:35 +00:00
|
|
|
|
|
2020-07-18 14:04:21 +00:00
|
|
|
|
.6 jsr CS.RUN.DIR
|
2020-07-16 14:53:35 +00:00
|
|
|
|
bcc CS.RUN.NEXT
|
|
|
|
|
rts
|
|
|
|
|
|
2020-07-18 14:04:21 +00:00
|
|
|
|
.9 lda #MLI.E.UNSUPST
|
2020-07-16 14:53:35 +00:00
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
2023-07-12 17:07:55 +00:00
|
|
|
|
CS.RUN.NEXT jsr X.GetNextEntry
|
2020-07-16 14:53:35 +00:00
|
|
|
|
bcc CS.RUN.LOOP
|
2021-06-27 13:48:04 +00:00
|
|
|
|
|
2023-07-12 17:07:55 +00:00
|
|
|
|
CS.RUN.LEAVE jsr X.LeaveSubDir
|
2020-07-16 14:53:35 +00:00
|
|
|
|
bcs .90
|
|
|
|
|
|
2023-07-12 17:07:55 +00:00
|
|
|
|
jsr X.BasePath..
|
2021-06-27 13:48:04 +00:00
|
|
|
|
|
2020-07-16 14:53:35 +00:00
|
|
|
|
jmp CS.RUN.NEXT
|
|
|
|
|
|
|
|
|
|
.90 lda #0
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.DIR lda (ZPFileName)
|
|
|
|
|
cmp #'.'
|
|
|
|
|
bne .1
|
2021-06-27 13:48:04 +00:00
|
|
|
|
|
2020-07-16 14:53:35 +00:00
|
|
|
|
ldy #1
|
|
|
|
|
lda (ZPFileName),y
|
|
|
|
|
beq .8 skip "."
|
2021-06-27 13:48:04 +00:00
|
|
|
|
|
2020-07-16 14:53:35 +00:00
|
|
|
|
cmp #'.'
|
|
|
|
|
bne .1
|
2021-06-27 13:48:04 +00:00
|
|
|
|
|
2020-07-16 14:53:35 +00:00
|
|
|
|
iny
|
|
|
|
|
lda (ZPFileName),y
|
|
|
|
|
beq .8 skip ".."
|
2021-06-27 13:48:04 +00:00
|
|
|
|
|
2023-07-12 17:07:55 +00:00
|
|
|
|
.1 jsr X.IncludeMatch
|
2020-07-28 20:37:26 +00:00
|
|
|
|
bcs .8
|
2021-06-27 13:48:04 +00:00
|
|
|
|
|
2020-07-28 20:37:26 +00:00
|
|
|
|
jsr CS.RUN.GetFilePath
|
2020-07-16 14:53:35 +00:00
|
|
|
|
>PUSHW L.MSG.DIR
|
|
|
|
|
>PUSHW ZPFullPath
|
|
|
|
|
>PUSHBI 2
|
|
|
|
|
>SYSCALL PrintF
|
|
|
|
|
bcs .9
|
2021-06-27 13:48:04 +00:00
|
|
|
|
|
2020-07-16 14:53:35 +00:00
|
|
|
|
>PUSHW ZPFullPath
|
|
|
|
|
>PUSHB.G UID
|
2020-07-18 14:18:10 +00:00
|
|
|
|
>PUSHBI 255
|
2020-08-25 10:56:00 +00:00
|
|
|
|
>SYSCALL ChOwn
|
2020-07-16 14:53:35 +00:00
|
|
|
|
|
2020-07-18 14:18:10 +00:00
|
|
|
|
jsr CS.RUN.CheckErr
|
2020-07-16 14:53:35 +00:00
|
|
|
|
bcs .9
|
2021-06-27 13:48:04 +00:00
|
|
|
|
|
2020-07-16 14:53:35 +00:00
|
|
|
|
>LDA.G bRecurse
|
2020-07-28 20:37:26 +00:00
|
|
|
|
bpl .8
|
2021-06-27 13:48:04 +00:00
|
|
|
|
|
2020-07-16 14:53:35 +00:00
|
|
|
|
>LDYA ZPFileName
|
2023-07-12 17:07:55 +00:00
|
|
|
|
jmp X.EnterSubDirYA
|
2021-06-27 13:48:04 +00:00
|
|
|
|
|
2020-07-28 20:37:26 +00:00
|
|
|
|
.8 clc
|
|
|
|
|
.9 rts
|
2020-07-16 14:53:35 +00:00
|
|
|
|
*--------------------------------------
|
2021-06-27 13:48:04 +00:00
|
|
|
|
CS.RUN.FILE
|
2020-07-16 14:53:35 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.GetUID >SYSCALL ArgV
|
|
|
|
|
>PUSHYA
|
2021-07-24 20:42:23 +00:00
|
|
|
|
>PUSHWZ
|
2020-07-16 14:53:35 +00:00
|
|
|
|
>SYSCALL GetPWName
|
|
|
|
|
bcs .9
|
2021-06-27 13:48:04 +00:00
|
|
|
|
|
2020-07-16 14:53:35 +00:00
|
|
|
|
>STA.G UID
|
2021-06-27 13:48:04 +00:00
|
|
|
|
|
2020-07-16 14:53:35 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.CheckErr bcs .1
|
|
|
|
|
>LDYA L.MSG.OK
|
|
|
|
|
>SYSCALL PutS
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.1 pha
|
|
|
|
|
>PUSHW L.MSG.ERR
|
|
|
|
|
pla
|
|
|
|
|
pha
|
|
|
|
|
>PUSHA
|
|
|
|
|
>PUSHBI 1
|
|
|
|
|
>SYSCALL PrintF
|
|
|
|
|
>LDA.G bContinue
|
|
|
|
|
eor #$80
|
|
|
|
|
asl
|
|
|
|
|
pla
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.GetFilePath
|
2021-05-04 17:31:21 +00:00
|
|
|
|
>PUSHW ZPFullPath
|
2020-07-16 14:53:35 +00:00
|
|
|
|
>LDA.G hSrcBasePath
|
|
|
|
|
>SYSCALL GetMemPtr
|
|
|
|
|
>PUSHYA
|
|
|
|
|
>SYSCALL StrCpy
|
2021-05-04 17:31:21 +00:00
|
|
|
|
|
|
|
|
|
>PUSHW ZPFullPath
|
2020-07-16 14:53:35 +00:00
|
|
|
|
>PUSHW ZPFileName
|
|
|
|
|
>SYSCALL StrCat
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.DOEVENT sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2023-07-12 17:07:55 +00:00
|
|
|
|
CS.QUIT jsr X.LeaveSubDir
|
2020-07-16 14:53:35 +00:00
|
|
|
|
bcc CS.QUIT
|
2023-07-12 17:07:55 +00:00
|
|
|
|
|
2023-07-14 10:24:49 +00:00
|
|
|
|
>LDA.G hInclude
|
2020-07-16 14:53:35 +00:00
|
|
|
|
beq .1
|
2023-07-12 17:07:55 +00:00
|
|
|
|
|
2020-07-16 14:53:35 +00:00
|
|
|
|
>SYSCALL FreeMem
|
2023-07-12 17:07:55 +00:00
|
|
|
|
|
2020-07-16 14:53:35 +00:00
|
|
|
|
.1 >LDA.G hSrcFullPath
|
|
|
|
|
beq .8
|
2023-07-12 17:07:55 +00:00
|
|
|
|
|
2020-07-16 14:53:35 +00:00
|
|
|
|
>SYSCALL FreeMem
|
2023-07-12 17:07:55 +00:00
|
|
|
|
|
2020-07-16 14:53:35 +00:00
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2020-08-25 14:54:30 +00:00
|
|
|
|
.INB usr/src/shared/x.fileenum.s
|
2020-07-16 14:53:35 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
OptionList .AS "CRcr"
|
|
|
|
|
OptionVars .DA #bContinue,#bRecurse,#bContinue,#bRecurse
|
|
|
|
|
*--------------------------------------
|
2022-11-02 06:54:30 +00:00
|
|
|
|
MSG.USAGE .CS "Usage : CHOWN username [File *,? wildcards allowed]\r\n"
|
|
|
|
|
.CS " -C : Continue on error\r\n"
|
|
|
|
|
.CZ " -R : Recurse subdirectories\r\n"
|
|
|
|
|
MSG.OK .CZ "[OK]"
|
|
|
|
|
MSG.ERR .CZ "[%h]\r\n"
|
|
|
|
|
MSG.DIR .CZ "Dir :%s..."
|
|
|
|
|
MSG.FILE .CZ "File:%s..."
|
2020-07-16 14:53:35 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DUMMY
|
|
|
|
|
.OR 0
|
|
|
|
|
DS.START
|
|
|
|
|
ArgIndex .BS 1
|
|
|
|
|
bContinue .BS 1
|
|
|
|
|
bRecurse .BS 1
|
|
|
|
|
bPause .BS 1
|
|
|
|
|
|
|
|
|
|
UID .BS 1
|
|
|
|
|
hSrcFullPath .BS 1
|
|
|
|
|
|
2020-08-25 14:54:30 +00:00
|
|
|
|
.INB usr/src/shared/x.fileenum.g
|
2020-07-16 14:53:35 +00:00
|
|
|
|
|
2021-06-27 13:48:04 +00:00
|
|
|
|
DS.END .ED
|
2020-07-16 14:53:35 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE usr/src/bin/chown.s
|
|
|
|
|
ASM
|