2019-04-29 05:59:01 +00:00
|
|
|
|
NEW
|
|
|
|
|
AUTO 3,1
|
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
|
|
|
|
.TF BIN/USERDEL
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.INB INC/MACROS.I
|
|
|
|
|
.INB INC/A2OSX.I
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Zero Page Segment, up to 32 bytes
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DUMMY
|
|
|
|
|
.OR ZPBIN
|
|
|
|
|
ZS.START
|
|
|
|
|
ZPhPW .BS 1
|
|
|
|
|
ZPPWPtr .BS 2
|
|
|
|
|
ZPhStr .BS 1
|
|
|
|
|
ZPStrPtr .BS 2
|
|
|
|
|
ArgIndex .BS 1
|
|
|
|
|
ArgUsername .BS 1
|
|
|
|
|
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 S.PS.F.EVENT
|
|
|
|
|
.DA #0
|
|
|
|
|
.DA CS.END-CS.START Code Size (without Constants)
|
|
|
|
|
.DA DS.END-DS.START Data Segment Size
|
|
|
|
|
.DA #64 Stack Size
|
|
|
|
|
.DA #ZS.END-ZS.START Zero Page Size
|
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Relocation Table
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.1 .DA CS.INIT
|
|
|
|
|
.DA CS.RUN
|
|
|
|
|
.DA CS.DOEVENT
|
|
|
|
|
.DA CS.QUIT
|
|
|
|
|
L.MSG.USAGE .DA MSG.USAGE
|
|
|
|
|
L.MSG.INV .DA MSG.INV
|
2019-04-29 15:47:17 +00:00
|
|
|
|
L.CMD.RM .DA CMD.RM
|
2019-04-29 05:59:01 +00:00
|
|
|
|
.DA 0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Called once at process creation
|
|
|
|
|
* Put code for loading LIB here
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.INIT clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Called until exit with CS
|
|
|
|
|
* if RUN exits with CC, RN entered again
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN >LDYAI S.PW
|
|
|
|
|
>SYSCALL getmem
|
|
|
|
|
bcs .99
|
|
|
|
|
>STYA ZPPWPtr
|
|
|
|
|
stx ZPhPW
|
|
|
|
|
|
|
|
|
|
>LDYAI 256
|
|
|
|
|
>SYSCALL getmem
|
|
|
|
|
bcs .99
|
|
|
|
|
>STYA ZPStrPtr
|
|
|
|
|
stx ZPhStr
|
|
|
|
|
|
|
|
|
|
jsr CS.RUN.CheckArg
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
>PUSHW ZPPWPtr
|
|
|
|
|
lda ArgUsername
|
|
|
|
|
>SYSCALL ArgV
|
|
|
|
|
>SYSCALL GetPWName
|
2019-04-29 15:47:17 +00:00
|
|
|
|
bcs .99
|
2019-04-29 05:59:01 +00:00
|
|
|
|
|
|
|
|
|
ldy #S.PW.PASSWD
|
|
|
|
|
lda #0
|
|
|
|
|
sta (ZPPWPtr),y
|
|
|
|
|
|
|
|
|
|
>LDYA ZPPWPtr
|
|
|
|
|
>SYSCALL putpw
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
jsr CS.RUN.RmDir
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 >PUSHBI 0
|
|
|
|
|
>LDYA L.MSG.INV
|
|
|
|
|
>SYSCALL printf
|
|
|
|
|
|
|
|
|
|
lda #E.IUSR
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.90 lda #E.IPWDDB
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.RUN.CheckArg inc ArgIndex
|
|
|
|
|
lda ArgIndex
|
|
|
|
|
>SYSCALL ArgV
|
|
|
|
|
bcs .8
|
|
|
|
|
>STYA ZPStrPtr
|
|
|
|
|
|
|
|
|
|
lda (ZPStrPtr)
|
|
|
|
|
cmp #'-'
|
|
|
|
|
bne .4
|
|
|
|
|
|
|
|
|
|
ldy #1
|
|
|
|
|
lda (ZPStrPtr),y
|
|
|
|
|
ldx OptionList
|
|
|
|
|
|
|
|
|
|
.2 cmp OptionList,x
|
|
|
|
|
beq .3
|
|
|
|
|
dex
|
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
.9 >PUSHBI 0
|
|
|
|
|
>LDYA L.MSG.USAGE
|
|
|
|
|
>SYSCALL printf
|
|
|
|
|
|
|
|
|
|
lda #E.SYN
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.3 ldy OptionVars-1,x
|
|
|
|
|
lda #$80
|
|
|
|
|
sta (pData),y
|
|
|
|
|
bra CS.RUN.CheckArg
|
|
|
|
|
|
2019-04-29 15:47:17 +00:00
|
|
|
|
.4 lda ArgUsername
|
2019-04-29 05:59:01 +00:00
|
|
|
|
bne .9
|
|
|
|
|
|
2019-04-29 15:47:17 +00:00
|
|
|
|
lda ArgIndex
|
2019-04-29 05:59:01 +00:00
|
|
|
|
sta ArgUsername
|
|
|
|
|
bra CS.RUN.CheckArg
|
|
|
|
|
|
|
|
|
|
.8 lda ArgUsername
|
|
|
|
|
beq .9
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2019-04-29 15:47:17 +00:00
|
|
|
|
CS.RUN.RmDir >LDA.G bDelete
|
|
|
|
|
bmi .1
|
|
|
|
|
|
|
|
|
|
lda ZPPWPtr
|
|
|
|
|
clc
|
|
|
|
|
adc #S.PW.DIR
|
|
|
|
|
tay
|
|
|
|
|
lda ZPPWPtr+1
|
|
|
|
|
adc /S.PW.DIR
|
|
|
|
|
>SYSCALL remove
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.1 >PUSHW L.CMD.RM
|
2019-04-29 05:59:01 +00:00
|
|
|
|
|
2019-04-29 15:47:17 +00:00
|
|
|
|
>LDYA ZPStrPtr
|
|
|
|
|
>SYSCALL strcpy
|
|
|
|
|
|
|
|
|
|
lda ZPPWPtr
|
|
|
|
|
clc
|
|
|
|
|
adc #S.PW.DIR
|
|
|
|
|
tay
|
|
|
|
|
lda ZPPWPtr+1
|
|
|
|
|
adc /S.PW.DIR
|
|
|
|
|
|
|
|
|
|
>LDYA ZPStrPtr
|
|
|
|
|
>SYSCALL strcat
|
|
|
|
|
|
2019-04-30 16:08:47 +00:00
|
|
|
|
>PUSHBI S.PS.F.HOLD
|
2019-04-29 15:47:17 +00:00
|
|
|
|
>LDYA ZPStrPtr
|
|
|
|
|
>SYSCALL execl
|
2019-04-29 05:59:01 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Called if option S.PS.F.EVENT enabled in Header
|
|
|
|
|
* Timer Event : every 10th seconds
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.DOEVENT sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Called once, when RUN exited with CS
|
|
|
|
|
* Put code for unloading LIB here
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.QUIT lda ZPhStr
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
>SYSCALL freemem
|
|
|
|
|
|
|
|
|
|
.1 lda ZPhPW
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
>SYSCALL freemem
|
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CS.END
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
OptionList >PSTR "Rr"
|
|
|
|
|
OptionVars .DA #bDelete,#bDelete
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Initialized DATA
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MSG.USAGE .AS "Usage : USERDEL username\r\n"
|
|
|
|
|
.AZ " -r : Force remove files in home directory\r\n"
|
|
|
|
|
MSG.INV .AZ "Invalid username.\r\n"
|
2019-04-29 15:47:17 +00:00
|
|
|
|
CMD.RM .AZ "${ROOT}BIN/RM -R -Q "
|
2019-04-29 05:59:01 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Per Process DATA segment
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DUMMY
|
|
|
|
|
.OR 0
|
|
|
|
|
DS.START
|
|
|
|
|
bDelete .BS 1
|
|
|
|
|
DS.END
|
|
|
|
|
.ED
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE USR/SRC/BIN/USERDEL.S
|
|
|
|
|
ASM
|