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
|
2019-10-18 15:07:14 +00:00
|
|
|
|
bDelete .BS 1
|
2019-04-29 05:59:01 +00:00
|
|
|
|
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
|
2019-10-03 06:25:27 +00:00
|
|
|
|
*--------------------------------------
|
2019-04-29 05:59:01 +00:00
|
|
|
|
.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
|
|
|
|
|
|
2019-10-11 13:06:33 +00:00
|
|
|
|
>SYSCALL FlushEtcPasswd
|
|
|
|
|
bcs .99
|
|
|
|
|
|
2019-04-29 05:59:01 +00:00
|
|
|
|
jsr CS.RUN.RmDir
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
sec
|
|
|
|
|
rts
|
2019-10-18 15:07:14 +00:00
|
|
|
|
|
2019-04-29 05:59:01 +00:00
|
|
|
|
.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
|
2019-10-18 15:07:14 +00:00
|
|
|
|
|
2019-04-29 05:59:01 +00:00
|
|
|
|
ldy #1
|
|
|
|
|
lda (ZPStrPtr),y
|
2019-10-18 15:07:14 +00:00
|
|
|
|
|
|
|
|
|
ldx #OptionVars-OptionList-1
|
|
|
|
|
|
2019-04-29 05:59:01 +00:00
|
|
|
|
.2 cmp OptionList,x
|
|
|
|
|
beq .3
|
2019-10-18 15:07:14 +00:00
|
|
|
|
|
2019-04-29 05:59:01 +00:00
|
|
|
|
dex
|
2019-10-18 15:07:14 +00:00
|
|
|
|
bpl .2
|
|
|
|
|
|
2019-04-29 05:59:01 +00:00
|
|
|
|
.9 >PUSHBI 0
|
|
|
|
|
>LDYA L.MSG.USAGE
|
|
|
|
|
>SYSCALL printf
|
|
|
|
|
lda #E.SYN
|
|
|
|
|
sec
|
|
|
|
|
rts
|
2019-10-18 15:07:14 +00:00
|
|
|
|
|
|
|
|
|
.3 ldy OptionVars,x
|
2019-04-29 05:59:01 +00:00
|
|
|
|
lda #$80
|
2019-10-18 15:07:14 +00:00
|
|
|
|
sta 0,y
|
2019-04-29 05:59:01 +00:00
|
|
|
|
bra CS.RUN.CheckArg
|
2019-10-18 15:07:14 +00:00
|
|
|
|
|
2019-04-29 15:47:17 +00:00
|
|
|
|
.4 lda ArgUsername
|
2019-04-29 05:59:01 +00:00
|
|
|
|
bne .9
|
2019-10-18 15:07:14 +00:00
|
|
|
|
|
2019-04-29 15:47:17 +00:00
|
|
|
|
lda ArgIndex
|
2019-04-29 05:59:01 +00:00
|
|
|
|
sta ArgUsername
|
|
|
|
|
bra CS.RUN.CheckArg
|
2019-10-18 15:07:14 +00:00
|
|
|
|
|
2019-04-29 05:59:01 +00:00
|
|
|
|
.8 lda ArgUsername
|
|
|
|
|
beq .9
|
2019-10-18 15:07:14 +00:00
|
|
|
|
|
2019-04-29 05:59:01 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2019-10-18 15:07:14 +00:00
|
|
|
|
CS.RUN.RmDir lda bDelete
|
2019-04-29 15:47:17 +00:00
|
|
|
|
bmi .1
|
|
|
|
|
|
|
|
|
|
lda ZPPWPtr
|
|
|
|
|
clc
|
|
|
|
|
adc #S.PW.DIR
|
|
|
|
|
tay
|
|
|
|
|
lda ZPPWPtr+1
|
|
|
|
|
adc /S.PW.DIR
|
|
|
|
|
>SYSCALL remove
|
|
|
|
|
rts
|
2019-10-18 15:07:14 +00:00
|
|
|
|
|
2019-04-29 15:47:17 +00:00
|
|
|
|
.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
|
|
|
|
|
*--------------------------------------
|
2019-10-18 15:07:14 +00:00
|
|
|
|
OptionList .AS "Rr"
|
2019-04-29 05:59:01 +00:00
|
|
|
|
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
|
2019-10-18 15:07:14 +00:00
|
|
|
|
DS.END .ED
|
2019-04-29 05:59:01 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE USR/SRC/BIN/USERDEL.S
|
|
|
|
|
ASM
|