diff --git a/README.md b/README.md index cc2a9a6..783e1d8 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,7 @@ zero). Work-in-progress APIs can change at any time. * [Example: vsnprintf](/examples/printf_str_va.c) * libc replacement (*work in progress*) * [ctype.h](/libc/include/ctype.h) + * [errno.h](/libc/include/errno.h) * [inttypes.h](/libc/include/inttypes.h) * [setjmp.h](/libc/include/setjmp.h) * [stdlib.h](/libc/include/stdlib.h) diff --git a/libc/Makefile.am b/libc/Makefile.am index d645adc..acdfa47 100644 --- a/libc/Makefile.am +++ b/libc/Makefile.am @@ -10,6 +10,7 @@ endif libc_la_SOURCES = \ src/ctype.c \ + src/errno.c \ src/stdlib.c \ src/string.c diff --git a/libc/include/Makefile.am b/libc/include/Makefile.am index 056f416..3a76e8c 100644 --- a/libc/include/Makefile.am +++ b/libc/include/Makefile.am @@ -1,5 +1,6 @@ nobase_include_HEADERS = \ ctype.h \ + errno.h \ inttypes.h \ setjmp.h \ stdlib.h \ diff --git a/libc/include/errno.h b/libc/include/errno.h new file mode 100644 index 0000000..755a4c7 --- /dev/null +++ b/libc/include/errno.h @@ -0,0 +1,16 @@ +#ifndef _ERRNO_H +#define _ERRNO_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +#define ERANGE 1 + +extern int errno; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libc/src/errno.c b/libc/src/errno.c new file mode 100644 index 0000000..ebd7d69 --- /dev/null +++ b/libc/src/errno.c @@ -0,0 +1,7 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +int errno = 0;