add a return -1 helper
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
|
||||
.export _fclose
|
||||
|
||||
.import _close
|
||||
.import _close, ___directerrno
|
||||
.importzp ptr1
|
||||
|
||||
.include "errno.inc"
|
||||
@@ -31,10 +31,7 @@
|
||||
; File is not open
|
||||
|
||||
lda #EINVAL
|
||||
jsr ___seterrno
|
||||
lda #$FF ; Return -1
|
||||
tax
|
||||
rts
|
||||
jmp ___directerrno
|
||||
|
||||
; File is open. Reset the flags and close the file.
|
||||
|
||||
@@ -47,4 +44,3 @@
|
||||
jmp _close ; Will set errno and return an error flag
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
;
|
||||
|
||||
.export _clearerr, _feof, _ferror, _fileno, _fflush
|
||||
.import return0
|
||||
.import return0, ___directerrno
|
||||
.importzp ptr1
|
||||
|
||||
.include "_file.inc"
|
||||
@@ -78,10 +78,7 @@ err: rts
|
||||
; If the file is not valid, fileno must set errno and return -1
|
||||
|
||||
error: lda #<EBADF
|
||||
jsr ___seterrno
|
||||
lda #$FF
|
||||
tax
|
||||
rts
|
||||
jmp ___directerrno
|
||||
.endproc
|
||||
|
||||
;
|
||||
@@ -89,5 +86,3 @@ error: lda #<EBADF
|
||||
;
|
||||
|
||||
_fflush = return0
|
||||
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
.import _malloc, _free
|
||||
.import searchenv, copyenvptr
|
||||
.import __environ, __envcount, __envsize
|
||||
.import return0
|
||||
.import return0, ___directerrno
|
||||
.import ptr1:zp, ptr2:zp, ptr3:zp, tmp1:zp
|
||||
|
||||
.include "errno.inc"
|
||||
@@ -169,10 +169,7 @@ addentry:
|
||||
; Error entries
|
||||
|
||||
nomem: lda #ENOMEM
|
||||
error: jsr ___seterrno
|
||||
lda #$FF ; Return -1
|
||||
tax
|
||||
rts
|
||||
error: jmp ___directerrno
|
||||
|
||||
.endproc
|
||||
|
||||
@@ -184,5 +181,3 @@ error: jsr ___seterrno
|
||||
|
||||
name: .addr 0 ; Pointer to name
|
||||
newsize: .byte 0 ; New environment size
|
||||
|
||||
|
||||
|
||||
@@ -62,10 +62,6 @@
|
||||
; File is not open or the character is invalid
|
||||
|
||||
error: lda #EINVAL
|
||||
jsr ___seterrno
|
||||
lda #$FF ; Return -1
|
||||
tax
|
||||
rts
|
||||
jmp ___directerrno
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
Reference in New Issue
Block a user