aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/bits/types.h10
-rw-r--r--include/err.h3
-rw-r--r--include/errno.h1
-rw-r--r--include/error.h3
-rw-r--r--include/slibc-error.h4
-rw-r--r--include/stdarg.h12
-rw-r--r--include/stdio.h63
-rw-r--r--include/stdlib.h11
-rw-r--r--include/string.h4
-rw-r--r--include/unistd.h9
10 files changed, 112 insertions, 8 deletions
diff --git a/include/bits/types.h b/include/bits/types.h
index 83087b5..3d178b8 100644
--- a/include/bits/types.h
+++ b/include/bits/types.h
@@ -368,9 +368,17 @@ typedef struct {
*/
#if defined(__NEED_locale_t) && !defined(__DEFINED_locale_t)
# define __DEFINED_locale_t
-typedef struct __locale locale_t; /* TODO not implemented */
+typedef int locale_t; /* TODO not implemented */
#endif
#ifndef __INTMAX_MAX
# define __INTMAX_MAX INT64_MAX
#endif
+
+/**
+ * State of variadic argument-reading.
+ */
+#define __ONLY_va_list
+# include <stdarg.h>
+#undef __ONLY_va_list
+
diff --git a/include/err.h b/include/err.h
index c4b241a..3f52afc 100644
--- a/include/err.h
+++ b/include/err.h
@@ -26,7 +26,8 @@
#endif
-#include <stdarg.h>
+#define __NEED_va_list
+#include <bits/types.h>
diff --git a/include/errno.h b/include/errno.h
index 9344a8a..fc36695 100644
--- a/include/errno.h
+++ b/include/errno.h
@@ -23,6 +23,7 @@
/* TODO include error definitions */
+#define ERANGE 34
diff --git a/include/error.h b/include/error.h
index 37d8328..0716530 100644
--- a/include/error.h
+++ b/include/error.h
@@ -26,7 +26,8 @@
#endif
-#include <stdarg.h>
+#define __NEED_va_list
+#include <bits/types.h>
diff --git a/include/slibc-error.h b/include/slibc-error.h
index 086ad31..c474745 100644
--- a/include/slibc-error.h
+++ b/include/slibc-error.h
@@ -22,7 +22,9 @@
#ifndef __PORTABLE
-#include <stdarg.h>
+#define __NEED_va_list
+#include <bits/types.h>
+
#include <errno.h>
diff --git a/include/stdarg.h b/include/stdarg.h
index 84bc840..801e5e8 100644
--- a/include/stdarg.h
+++ b/include/stdarg.h
@@ -16,7 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _STDARG_H
-#define _STDARG_H
+# ifndef __ONLY_va_list
+# define _STDARG_H
+# endif
#include <slibc/version.h>
#include <slibc/features.h>
@@ -37,6 +39,12 @@
typedef __builtin_va_list va_list;
#endif
+
+
+#ifndef __ONLY_va_list
+
+
+
/**
* Prologue to using a variadic arguments.
*
@@ -84,3 +92,5 @@ typedef __builtin_va_list va_list;
#endif
+#endif
+
diff --git a/include/stdio.h b/include/stdio.h
new file mode 100644
index 0000000..d23339d
--- /dev/null
+++ b/include/stdio.h
@@ -0,0 +1,63 @@
+/**
+ * slibc — Yet another C library
+ * Copyright © 2015 Mattias Andrée (maandree@member.fsf.org)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef _STDIO_H
+#define _STDIO_H
+#include <slibc/version.h>
+#include <slibc/features.h>
+
+
+
+#define __NEED_fpos_t /* TODO not implemented */
+#define __NEED_off_t
+#define __NEED_size_t
+#define __NEED_ssize_t
+#define __NEED_va_list
+#if __STDC_VERSION__ >= 201112L
+# define __NEED_max_align_t
+#endif
+
+#include <bits/types.h>
+
+
+
+/* TODO implement I/O */
+int fflush(void*);
+#define stdin NULL
+#define stdout NULL
+#define stderr NULL
+int printf(const char*, ...);
+int fprintf(void*, const char*, ...);
+int dprintf(int, const char*, ...);
+int sprintf(char*, const char*, ...);
+int snprintf(char*, size_t, const char*, ...);
+#if (defined(_GNU_SOURCE) || defined(_SLIBC_SOURCE)) && !defined(__PORTABLE)
+int asprintf(char**, const char*, ...);
+#endif
+int vprintf(const char*, va_list);
+int vfprintf(void*, const char*, va_list);
+int vdprintf(int, const char*, va_list);
+int vsprintf(char*, const char*, va_list);
+int vsnprintf(char*, size_t, const char*, va_list);
+#if (defined(_GNU_SOURCE) || defined(_SLIBC_SOURCE)) && !defined(__PORTABLE)
+int vasprintf(char**, const char*, va_list);
+#endif
+
+
+
+#endif
+
diff --git a/include/stdlib.h b/include/stdlib.h
index 9340201..89712f9 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -102,5 +102,16 @@ void srand(unsigned int seed);
+/* TODO implement exit-functions */
+void abort(void) __noreturn;
+void _Exit(int) __noreturn;
+int atexit(void (*)(void));
+int on_exit(void (*)(int, void*), void*);
+void exit(int) __noreturn;
+int at_quick_exit (void (*) (void));
+void quick_exit(int) __noreturn;
+
+
+
#endif
diff --git a/include/string.h b/include/string.h
index d1eedd0..03c6acd 100644
--- a/include/string.h
+++ b/include/string.h
@@ -73,10 +73,8 @@ char* strerror(int)
* `LC_GLOBAL_LOCALE`, lest the behaviour is undefined.
* @return A description of the error.
*/
-/* TODO strerror_l
char* strerror_l(int, locale_t)
- __GCC_ONLY(__attribute__((warn_unused_result)));
-*/
+ __GCC_ONLY(__attribute__((warn_unused_result))); /* TODO attributes */
#if !defined(__PORTABLE)
diff --git a/include/unistd.h b/include/unistd.h
index f651867..45ec712 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -134,5 +134,14 @@ void* sbrk(ptrdiff_t) /* TODO implement sbrk */
+/* TODO implement exit-functions */
+void _exit(int) __noreturn;
+
+
+/* TODO implement I/O */
+int isatty(int);
+
+
+
#endif