diff options
author | das <das@FreeBSD.org> | 2009-02-28 06:00:58 +0000 |
---|---|---|
committer | das <das@FreeBSD.org> | 2009-02-28 06:00:58 +0000 |
commit | a67fbaa46cbdf18a03eefb3f83e2f74f68918753 (patch) | |
tree | f258384b92d5c4bde23e95d4c44fa3547a0364cd /include/stdio.h | |
parent | b739b3fb48f28ef6b6e7efeeceb832d3dec3fc9c (diff) | |
download | FreeBSD-src-a67fbaa46cbdf18a03eefb3f83e2f74f68918753.zip FreeBSD-src-a67fbaa46cbdf18a03eefb3f83e2f74f68918753.tar.gz |
- Add getdelim(), getline(), stpncpy(), strnlen(), wcsnlen(),
wcscasecmp(), and wcsncasecmp().
- Make some previously non-standard extensions visible
if POSIX_VISIBLE >= 200809.
- Use restrict qualifiers in stpcpy().
- Declare off_t and size_t in stdio.h.
- Bump __FreeBSD_version in case the new symbols (particularly
getline()) cause issues with ports.
Reviewed by: standards@
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. */ |