mirror of
https://github.com/A2osX/A2osX.git
synced 2024-09-30 15:57:29 +00:00
206 lines
3.1 KiB
Plaintext
206 lines
3.1 KiB
Plaintext
NEW
|
||
AUTO 3,1
|
||
*--------------------------------------
|
||
X.PWD jmp (.1-SYS.GetPWUID,x)
|
||
.1 .DA PWD.GetPWUID
|
||
.DA PWD.GetPWName
|
||
.DA PWD.PutPW
|
||
*--------------------------------------
|
||
* ZPPtr1 : UID / pName
|
||
* ZPPtr2 : pPW
|
||
* ZPPtr3 : pDB
|
||
* USERNAME:PASSWORD:UID:GID:GECOS:HOME:SHELL\CR
|
||
* ....\CR
|
||
* \0
|
||
*--------------------------------------
|
||
PWD.GetPWUID
|
||
*--------------------------------------
|
||
PWD.GetPWName
|
||
lda PWD.hDB
|
||
beq .9
|
||
|
||
.9 lda #E.IPWDDB
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
PWD.PutPW >LDYA ZPPtr2
|
||
>STYA TXTPTR
|
||
|
||
lda PWD.hDB
|
||
bne .1
|
||
|
||
ldy #S.PW.UID
|
||
jsr MEM.TXTPTR.GetY
|
||
bne .9 Must be ROOT user
|
||
|
||
jmp PWD.InitDB
|
||
|
||
.1
|
||
|
||
.9 lda #E.IPWDDB
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
PWD.InitDB
|
||
jsr PWD.GetRecordLen
|
||
>STYA PWD.DBSize
|
||
|
||
jsr K.getmem
|
||
bcs .9
|
||
>STYA ZPPtr3
|
||
stx PWD.hDB
|
||
|
||
jsr PWD.StoreRecord
|
||
|
||
inc PWD.bDirty
|
||
clc
|
||
.9 rts
|
||
*--------------------------------------
|
||
PWD.FindByID
|
||
*--------------------------------------
|
||
PWD.StoreRecord sec
|
||
.HS 90 BCC
|
||
*--------------------------------------
|
||
PWD.GetRecordLen
|
||
clc
|
||
ldx #0
|
||
|
||
ldy #S.PW.NAME-1
|
||
|
||
.1 iny
|
||
jsr MEM.TXTPTR.GetY
|
||
jsr PWD.StoreChar
|
||
bne .1
|
||
|
||
lda #':'
|
||
jsr PWD.StoreChar
|
||
|
||
ldy #S.PW.PASSWD-1
|
||
|
||
.2 iny
|
||
jsr MEM.TXTPTR.GetY
|
||
jsr PWD.StoreChar
|
||
bne .2
|
||
|
||
lda #':'
|
||
jsr PWD.StoreChar
|
||
|
||
ldy #S.PW.UID
|
||
jsr MEM.TXTPTR.GetY
|
||
jsr PWD.StoreByte
|
||
|
||
lda #':'
|
||
jsr PWD.StoreChar
|
||
|
||
iny S.PW.UID
|
||
|
||
jsr MEM.TXTPTR.GetY
|
||
jsr PWD.StoreByte
|
||
|
||
lda #':'
|
||
jsr PWD.StoreChar
|
||
|
||
* iny S.PW.GECOS
|
||
|
||
.3 iny
|
||
jsr MEM.TXTPTR.GetY
|
||
jsr PWD.StoreChar
|
||
bne .3
|
||
|
||
lda #':'
|
||
jsr PWD.StoreChar
|
||
|
||
ldy #S.PW.DIR-1
|
||
|
||
.4 iny
|
||
jsr MEM.TXTPTR.GetY
|
||
jsr PWD.StoreChar
|
||
bne .4
|
||
|
||
lda #':'
|
||
jsr PWD.StoreChar
|
||
|
||
ldy #S.PW.SHELL-1
|
||
|
||
.5 iny
|
||
jsr MEM.TXTPTR.GetY
|
||
jsr PWD.StoreChar
|
||
bne .5
|
||
|
||
lda #C.CR
|
||
jsr PWD.StoreChar
|
||
|
||
txa
|
||
tay
|
||
lda #0
|
||
|
||
rts
|
||
*--------------------------------------
|
||
PWD.StoreByte stz .2+1
|
||
stz .3+1
|
||
|
||
phx
|
||
ldx #8
|
||
|
||
sed
|
||
|
||
.1 asl
|
||
pha
|
||
.2 lda #$ff Self Modified
|
||
adc .2+1
|
||
sta .2+1
|
||
|
||
.3 lda #$ff Self Modified
|
||
adc .3+1
|
||
sta .3+1
|
||
|
||
pla
|
||
dex
|
||
bne .1
|
||
|
||
cld
|
||
plx
|
||
|
||
lda .3+1
|
||
beq .4
|
||
|
||
jsr PWD.StoreChar30
|
||
|
||
.4 lda .2+1
|
||
pha
|
||
lsr
|
||
lsr
|
||
lsr
|
||
lsr
|
||
beq .5
|
||
|
||
jsr PWD.StoreChar30
|
||
|
||
.5 pla
|
||
|
||
and #$0f
|
||
|
||
.8 jsr PWD.StoreChar30
|
||
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
PWD.StoreChar30 ora #$30
|
||
|
||
PWD.StoreChar inx
|
||
pha
|
||
|
||
bcc .9 Dry run no store
|
||
sta (ZPPtr3)
|
||
inc ZPPtr3
|
||
bne .9
|
||
inc ZPPtr3+1
|
||
|
||
.9 pla
|
||
rts
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE USR/SRC/SYS/KERNEL.S.PWDX
|
||
LOAD USR/SRC/SYS/KERNEL.S
|
||
ASM
|