From 54aff47513eb19bc115880fc32f14b1d55026f31 Mon Sep 17 00:00:00 2001 From: mrdudz Date: Sun, 28 Aug 2022 22:09:44 +0200 Subject: [PATCH] fix some errno related stuff, "make all" works again --- include/errno.h | 15 ++++++++++++++- libsrc/cbm/dir.s | 4 ++-- libsrc/cbm/readdir.c | 2 +- libsrc/common/_seterrno.s | 6 +++--- libsrc/common/errno.s | 4 ++-- libsrc/common/perror.c | 2 +- libsrc/common/strerror.s | 4 ++-- 7 files changed, 25 insertions(+), 12 deletions(-) diff --git a/include/errno.h b/include/errno.h index c762e8b1c..8f329e3cc 100644 --- a/include/errno.h +++ b/include/errno.h @@ -101,11 +101,21 @@ int __fastcall__ __osmaperrno (unsigned char oserror); unsigned char __fastcall__ __seterrno (unsigned char code); /* 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); /* Set errno to a specific error code, clear __oserror and return -1. Used ** 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); /* 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 @@ -113,7 +123,10 @@ int __fastcall__ __mappederrno (unsigned char code); ** 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 */ #endif diff --git a/libsrc/cbm/dir.s b/libsrc/cbm/dir.s index 808fcf982..734485aaf 100644 --- a/libsrc/cbm/dir.s +++ b/libsrc/cbm/dir.s @@ -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 lda #EINVAL ; = 0 - sta __errno+1 + sta ___errno+1 ; lda #$00 ; A contains zero: "Unknown error" ; Load the pointer to the error message and return