mirror of
https://github.com/cc65/cc65.git
synced 2024-06-07 23:29:39 +00:00
fix some errno related stuff, "make all" works again
This commit is contained in:
parent
2dabb65ee0
commit
54aff47513
|
@ -101,11 +101,21 @@ int __fastcall__ __osmaperrno (unsigned char oserror);
|
||||||
unsigned char __fastcall__ __seterrno (unsigned char code);
|
unsigned char __fastcall__ __seterrno (unsigned char code);
|
||||||
/* Set errno to a specific error code and return zero. Used by the library */
|
/* Set errno to a specific error code and return zero. Used by the library */
|
||||||
|
|
||||||
|
#if __CC65_STD__ >= __CC65_STD_CC65__
|
||||||
|
/* define the name with just one underscore for backwards compatibility */
|
||||||
|
#define _seterrno __seterrno
|
||||||
|
#endif
|
||||||
|
|
||||||
int __fastcall__ __directerrno (unsigned char code);
|
int __fastcall__ __directerrno (unsigned char code);
|
||||||
/* Set errno to a specific error code, clear __oserror and return -1. Used
|
/* Set errno to a specific error code, clear __oserror and return -1. Used
|
||||||
** by the library.
|
** by the library.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if __CC65_STD__ >= __CC65_STD_CC65__
|
||||||
|
/* define the name with just one underscore for backwards compatibility */
|
||||||
|
#define _directerrno __directerrno
|
||||||
|
#endif
|
||||||
|
|
||||||
int __fastcall__ __mappederrno (unsigned char code);
|
int __fastcall__ __mappederrno (unsigned char code);
|
||||||
/* Set __oserror to the given platform specific error code. If it is a real
|
/* Set __oserror to the given platform specific error code. If it is a real
|
||||||
** error code (not zero) set errno to the corresponding system error code
|
** error code (not zero) set errno to the corresponding system error code
|
||||||
|
@ -113,7 +123,10 @@ int __fastcall__ __mappederrno (unsigned char code);
|
||||||
** Used by the library.
|
** Used by the library.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if __CC65_STD__ >= __CC65_STD_CC65__
|
||||||
|
/* define the name with just one underscore for backwards compatibility */
|
||||||
|
#define _mappederrno __mappederrno
|
||||||
|
#endif
|
||||||
|
|
||||||
/* End of errno.h */
|
/* End of errno.h */
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -92,8 +92,8 @@ L3: sta tmp1 ; Save returned count
|
||||||
; Didn't read enough bytes. This is an error for us, but errno is not set
|
; Didn't read enough bytes. This is an error for us, but errno is not set
|
||||||
|
|
||||||
lda #<EIO
|
lda #<EIO
|
||||||
sta __errno
|
sta ___errno
|
||||||
stx __errno+1 ; X is zero
|
stx ___errno+1 ; X is zero
|
||||||
bne L1 ; Branch always
|
bne L1 ; Branch always
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ struct dirent* __fastcall__ readdir (register DIR* dir)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Something went wrong when parsing the directory entry */
|
/* Something went wrong when parsing the directory entry */
|
||||||
_errno = EIO;
|
__errno = EIO;
|
||||||
exitpoint:
|
exitpoint:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
;
|
;
|
||||||
; Ullrich von Bassewitz, 2004-05-13
|
; Ullrich von Bassewitz, 2004-05-13
|
||||||
;
|
;
|
||||||
; ___seterrno: Will set __errno to the value in A and return zero in A. Other
|
; ___seterrno: Will set ___errno to the value in A and return zero in A. Other
|
||||||
; registers aren't changed. The function is C callable, but
|
; registers aren't changed. The function is C callable, but
|
||||||
; currently only called from asm code.
|
; currently only called from asm code.
|
||||||
;
|
;
|
||||||
|
@ -12,9 +12,9 @@
|
||||||
|
|
||||||
.proc ___seterrno
|
.proc ___seterrno
|
||||||
|
|
||||||
sta __errno
|
sta ___errno
|
||||||
lda #0
|
lda #0
|
||||||
sta __errno+1
|
sta ___errno+1
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
; 2003-08-12, Ullrich von Bassewitz
|
; 2003-08-12, Ullrich von Bassewitz
|
||||||
; 2015-09-24, Greg King
|
; 2015-09-24, Greg King
|
||||||
;
|
;
|
||||||
; extern int _errno;
|
; extern int __errno;
|
||||||
; /* Library errors go here. */
|
; /* Library errors go here. */
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -10,5 +10,5 @@
|
||||||
|
|
||||||
.bss
|
.bss
|
||||||
|
|
||||||
__errno:
|
___errno:
|
||||||
.word 0
|
.word 0
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
void __fastcall__ perror (const char* msg)
|
void __fastcall__ perror (const char* msg)
|
||||||
{
|
{
|
||||||
/* Fetch the message that corresponds to errno */
|
/* Fetch the message that corresponds to errno */
|
||||||
const char* errormsg = strerror (_errno);
|
const char* errormsg = strerror (__errno);
|
||||||
|
|
||||||
/* Different output depending on msg */
|
/* Different output depending on msg */
|
||||||
if (msg) {
|
if (msg) {
|
||||||
|
|
|
@ -19,9 +19,9 @@ _strerror:
|
||||||
; The given error code is invalid
|
; The given error code is invalid
|
||||||
|
|
||||||
@L1: lda #<EINVAL
|
@L1: lda #<EINVAL
|
||||||
sta __errno
|
sta ___errno
|
||||||
lda #>EINVAL ; = 0
|
lda #>EINVAL ; = 0
|
||||||
sta __errno+1
|
sta ___errno+1
|
||||||
; lda #$00 ; A contains zero: "Unknown error"
|
; lda #$00 ; A contains zero: "Unknown error"
|
||||||
|
|
||||||
; Load the pointer to the error message and return
|
; Load the pointer to the error message and return
|
||||||
|
|
Loading…
Reference in New Issue
Block a user