1
0
mirror of https://github.com/cc65/cc65.git synced 2025-02-25 16:29:08 +00:00

support append mode

git-svn-id: svn://svn.cc65.org/cc65/trunk@1272 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cpg 2002-05-16 15:28:07 +00:00
parent e79d285671
commit 5c2e2e5a96

View File

@ -1,5 +1,5 @@
; ;
; Christian Groessler, May-2000 ; Christian Groessler, May-2002
; ;
; int open(const char *name,int flags,...); ; int open(const char *name,int flags,...);
; ;
@ -42,13 +42,33 @@ seterr: jsr __seterrno
rts ; return -1 rts ; return -1
; process the mode argument ; process the mode argument
; @@@TODO: append not handled yet!
iocbok: stx tmp4 iocbok: stx tmp4
jsr clriocb ; init with zero jsr clriocb ; init with zero
ldy #1 ldy #1
jsr ldaxysp ; get mode jsr ldaxysp ; get mode
;brk
ldx tmp4 ldx tmp4
pha
and #O_APPEND
beq no_app
pla
and #15
cmp #O_RDONLY ; DOS supports append with write-only only
beq invret
cmp #O_RDWR
beq invret
lda #OPNOT|APPEND
bne set
.ifndef UCASE_FILENAME
invret: lda #<EINVAL ; file name is too long
ldx #>EINVAL
jmp seterr
.endif
no_app: pla
and #15
cmp #O_RDONLY cmp #O_RDONLY
bne l1 bne l1
lda #OPNIN lda #OPNIN
@ -73,7 +93,7 @@ cont: ldy #3
jsr ucase_fn jsr ucase_fn
bcc ucok1 bcc ucok1
lda #<EINVAL ; file name is too long invret: lda #<EINVAL ; file name is too long
ldx #>EINVAL ldx #>EINVAL
jmp seterr jmp seterr
ucok1: ucok1: