diff options
Diffstat (limited to 'include/stdio.h')
-rw-r--r-- | include/stdio.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/include/stdio.h b/include/stdio.h index 674a5c2..cc870a8 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -51,6 +51,17 @@ typedef __size_t size_t; #define _SIZE_T_DECLARED #endif +#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 +#ifndef _OFF_T_DECLARED +#define _OFF_T_DECLARED +typedef __off_t off_t; +#endif +#ifndef _SSIZE_T_DECLARED +#define _SSIZE_T_DECLARED +typedef __ssize_t ssize_t; +#endif +#endif + #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE #ifndef _VA_LIST_DECLARED typedef __va_list va_list; @@ -330,6 +341,34 @@ int putw(int, FILE *); char *tempnam(const char *, const char *); #endif +#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 +ssize_t getdelim(char ** __restrict, size_t * __restrict, int, + FILE * __restrict); + +/* + * Every programmer and his dog wrote functions called getline() + * before POSIX.1-2008 came along and decided to usurp the name, so we + * don't prototype getline() by default unless one of the following is true: + * a) the app has requested it specifically by defining _WITH_GETLINE + * b) the app has requested a POSIX.1-2008 environment via _POSIX_C_SOURCE + * c) the app defines a GNUism such as _BSD_SOURCE or _GNU_SOURCE + */ +#ifndef _WITH_GETLINE +#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) +#define _WITH_GETLINE +#elif defined(_POSIX_C_SOURCE) +#if _POSIX_C_SOURCE > 200809 +#define _WITH_GETLINE +#endif +#endif +#endif + +#ifdef _WITH_GETLINE +ssize_t getline(char ** __restrict, size_t * __restrict, FILE * __restrict); +#endif + +#endif /* __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 */ + /* * Routines that are purely local. */ |