better handling of end-of-string (: vs null)
This commit is contained in:
parent
6fb5bec0c1
commit
7fe9d94d8f
|
@ -42,7 +42,7 @@ get_file_info procname export
|
||||||
|
|
||||||
;~DebugSetTrace #1
|
;~DebugSetTrace #1
|
||||||
|
|
||||||
|
brk $ea
|
||||||
jsr path_to_inode
|
jsr path_to_inode
|
||||||
bcs exit
|
bcs exit
|
||||||
|
|
||||||
|
@ -320,6 +320,37 @@ absolute
|
||||||
|
|
||||||
endp
|
endp
|
||||||
|
|
||||||
|
entry skip_colon
|
||||||
|
skip_colon proc
|
||||||
|
;returns carry set if end of path.
|
||||||
|
|
||||||
|
with dp, data
|
||||||
|
path equ fst_parms.path1_ptr
|
||||||
|
|
||||||
|
|
||||||
|
ldy path_offset
|
||||||
|
short m
|
||||||
|
@loop
|
||||||
|
lda [path],y
|
||||||
|
beq zero
|
||||||
|
cmp #':'
|
||||||
|
bne done
|
||||||
|
iny
|
||||||
|
bra @loop
|
||||||
|
done
|
||||||
|
lda #':'
|
||||||
|
sta more
|
||||||
|
sty path_offset
|
||||||
|
long m
|
||||||
|
clc
|
||||||
|
rts
|
||||||
|
zero
|
||||||
|
long m
|
||||||
|
stz more
|
||||||
|
sty data.path_offset
|
||||||
|
sec
|
||||||
|
rts
|
||||||
|
endp
|
||||||
|
|
||||||
find_file procname
|
find_file procname
|
||||||
|
|
||||||
|
@ -345,14 +376,19 @@ span equ fst_parms.span1
|
||||||
|
|
||||||
dir_loop
|
dir_loop
|
||||||
|
|
||||||
lda inode
|
|
||||||
sta parent_inode
|
|
||||||
|
|
||||||
; get a path component.
|
; get a path component.
|
||||||
|
|
||||||
|
|
||||||
|
; 1. check for a null path.
|
||||||
|
jsr skip_colon
|
||||||
|
bcs done
|
||||||
|
|
||||||
|
lda inode
|
||||||
|
sta parent_inode
|
||||||
|
|
||||||
ldx #0
|
ldx #0
|
||||||
ldy path_offset
|
ldy path_offset
|
||||||
|
|
||||||
short m
|
short m
|
||||||
path_loop
|
path_loop
|
||||||
lda [path],y
|
lda [path],y
|
||||||
|
@ -399,29 +435,11 @@ eop
|
||||||
lda disk_inode.mode
|
lda disk_inode.mode
|
||||||
and #S_IFMT
|
and #S_IFMT
|
||||||
cmp #S_IFDIR
|
cmp #S_IFDIR
|
||||||
beq dir
|
beq dir_loop
|
||||||
lda #path_not_found
|
lda #path_not_found
|
||||||
sec
|
sec
|
||||||
rts
|
rts
|
||||||
|
|
||||||
dir
|
|
||||||
|
|
||||||
; skip the ':'
|
|
||||||
short m
|
|
||||||
ldy path_offset
|
|
||||||
loop
|
|
||||||
lda [path],y
|
|
||||||
beq @ok
|
|
||||||
cmp #':'
|
|
||||||
bne @ok
|
|
||||||
iny
|
|
||||||
bra loop
|
|
||||||
@ok
|
|
||||||
long m
|
|
||||||
sty path_offset
|
|
||||||
bra dir_loop
|
|
||||||
|
|
||||||
|
|
||||||
done
|
done
|
||||||
clc
|
clc
|
||||||
rts
|
rts
|
||||||
|
@ -453,7 +471,6 @@ path equ fst_parms.path1_ptr
|
||||||
cmp #':'
|
cmp #':'
|
||||||
bne @next
|
bne @next
|
||||||
iny
|
iny
|
||||||
sty path_offset
|
|
||||||
bra done
|
bra done
|
||||||
@next
|
@next
|
||||||
sta target.text,x
|
sta target.text,x
|
||||||
|
@ -463,6 +480,7 @@ path equ fst_parms.path1_ptr
|
||||||
done
|
done
|
||||||
|
|
||||||
long m
|
long m
|
||||||
|
sty path_offset
|
||||||
stx target.length
|
stx target.length
|
||||||
|
|
||||||
ldx #target
|
ldx #target
|
||||||
|
|
Loading…
Reference in New Issue