Print this page
oops!
getdelim.3c should list p1003.1-2008.
more ifdef cleanups, expose getline and getdelim

*** 213,235 **** #endif /* large file compilation environment setup */ #if !defined(_LP64) && _FILE_OFFSET_BITS == 64 #if !defined(__PRAGMA_REDEFINE_EXTNAME) - #if defined(__STDC__) extern FILE *fopen64(const char *, const char *); extern FILE *freopen64(const char *, const char *, FILE *); extern FILE *tmpfile64(void); extern int fgetpos64(FILE *, fpos_t *); extern int fsetpos64(FILE *, const fpos_t *); - #else /* defined(__STDC__) */ - extern FILE *fopen64(); - extern FILE *freopen64(); - extern FILE *tmpfile64(); - extern int fgetpos64(); - extern int fsetpos64(); - #endif /* defined(__STDC__) */ #define fopen fopen64 #define freopen freopen64 #define tmpfile tmpfile64 #define fgetpos fgetpos64 #define fsetpos fsetpos64 --- 213,227 ----
*** 267,354 **** #else typedef int ssize_t; /* (historical version) */ #endif #endif /* !_SSIZE_T */ ! #if defined(__STDC__) ! ! #if defined(__EXTENSIONS__) || \ ! (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \ ! defined(_REENTRANT) extern char *tmpnam_r(char *); #endif ! #if defined(__EXTENSIONS__) || \ ! (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) extern int fcloseall(void); extern void setbuffer(FILE *, char *, size_t); extern int setlinebuf(FILE *); /* PRINTFLIKE2 */ extern int asprintf(char **, const char *, ...); /* PRINTFLIKE2 */ extern int vasprintf(char **, const char *, __va_list); #endif ! #if defined(__EXTENSIONS__) || \ ! (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) ! /* || defined(_XPG7) */ extern ssize_t getdelim(char **_RESTRICT_KYWD, size_t *_RESTRICT_KYWD, int, FILE *_RESTRICT_KYWD); extern ssize_t getline(char **_RESTRICT_KYWD, size_t *_RESTRICT_KYWD, FILE *_RESTRICT_KYWD); ! #endif /* __EXTENSIONS__ ... */ /* * The following are known to POSIX and XOPEN, but not to ANSI-C. */ ! #if defined(__EXTENSIONS__) || \ ! !defined(_STRICT_STDC) || defined(__XOPEN_OR_POSIX) ! extern FILE *fdopen(int, const char *); extern char *ctermid(char *); extern int fileno(FILE *); - #endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */ - /* ! * The following are known to POSIX.1c, but not to ANSI-C or XOPEN. */ ! #if defined(__EXTENSIONS__) || defined(_REENTRANT) || \ (_POSIX_C_SOURCE - 0 >= 199506L) extern void flockfile(FILE *); extern int ftrylockfile(FILE *); extern void funlockfile(FILE *); extern int getc_unlocked(FILE *); extern int getchar_unlocked(void); extern int putc_unlocked(int, FILE *); extern int putchar_unlocked(int); - #endif /* defined(__EXTENSIONS__) || defined(_REENTRANT).. */ - /* * The following are known to XOPEN, but not to ANSI-C or POSIX. */ ! #if defined(__EXTENSIONS__) || !defined(_STRICT_STDC) || \ ! defined(_XOPEN_SOURCE) extern FILE *popen(const char *, const char *); extern char *tempnam(const char *, const char *); extern int pclose(FILE *); #if !defined(_XOPEN_SOURCE) extern int getsubopt(char **, char *const *, char **); ! #endif /* !defined(_XOPEN_SOURCE) */ /* Marked LEGACY in SUSv2 and removed in SUSv3 */ ! #if !defined(_XPG6) || defined(__EXTENSIONS__) extern char *cuserid(char *); extern int getopt(int, char *const *, const char *); extern char *optarg; extern int optind, opterr, optopt; extern int getw(FILE *); extern int putw(int, FILE *); ! #endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */ ! #endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */ /* * The following are defined as part of the Large File Summit interfaces. */ #if defined(_LARGEFILE_SOURCE) || defined(_XPG5) --- 259,337 ---- #else typedef int ssize_t; /* (historical version) */ #endif #endif /* !_SSIZE_T */ ! #if defined(_REENTRANT) || !defined(_STRICT_SYMBOLS) extern char *tmpnam_r(char *); #endif ! #if !defined(_STRICT_SYMBOLS) extern int fcloseall(void); extern void setbuffer(FILE *, char *, size_t); extern int setlinebuf(FILE *); /* PRINTFLIKE2 */ extern int asprintf(char **, const char *, ...); /* PRINTFLIKE2 */ extern int vasprintf(char **, const char *, __va_list); #endif ! #if defined(_XPG7) || !defined(_STRICT_SYMBOLS) extern ssize_t getdelim(char **_RESTRICT_KYWD, size_t *_RESTRICT_KYWD, int, FILE *_RESTRICT_KYWD); extern ssize_t getline(char **_RESTRICT_KYWD, size_t *_RESTRICT_KYWD, FILE *_RESTRICT_KYWD); ! #endif /* * The following are known to POSIX and XOPEN, but not to ANSI-C. */ ! #if defined(__XOPEN_OR_POSIX) || !defined(_STRICT_SYMBOLS) extern FILE *fdopen(int, const char *); extern char *ctermid(char *); extern int fileno(FILE *); + #endif /* ! * The following are known to POSIX.1c, but not to ANSI-C or older XOPEN. */ ! #if defined(_REENTRANT) || !defined(_STRICT_SYMBOLS) || \ (_POSIX_C_SOURCE - 0 >= 199506L) extern void flockfile(FILE *); extern int ftrylockfile(FILE *); extern void funlockfile(FILE *); extern int getc_unlocked(FILE *); extern int getchar_unlocked(void); extern int putc_unlocked(int, FILE *); extern int putchar_unlocked(int); + #endif /* * The following are known to XOPEN, but not to ANSI-C or POSIX. */ ! #if defined(_XOPEN_SOURCE) || !defined(_STRICT_SYMBOLS) ! extern FILE *popen(const char *, const char *); extern char *tempnam(const char *, const char *); extern int pclose(FILE *); + #if !defined(_XOPEN_SOURCE) + /* XOPEN puts this in stdlib.h */ extern int getsubopt(char **, char *const *, char **); ! #endif /* Marked LEGACY in SUSv2 and removed in SUSv3 */ ! #if !defined(_STRICT_XPG6) extern char *cuserid(char *); extern int getopt(int, char *const *, const char *); extern char *optarg; extern int optind, opterr, optopt; extern int getw(FILE *); extern int putw(int, FILE *); ! #endif ! #endif /* defined(_XOPEN_SOURCE) || !defined(_STRICT_SYMBOLS) */ /* * The following are defined as part of the Large File Summit interfaces. */ #if defined(_LARGEFILE_SOURCE) || defined(_XPG5)
*** 369,486 **** extern int fsetpos64(FILE *, const fpos64_t *); extern int fseeko64(FILE *, off64_t, int); extern off64_t ftello64(FILE *); #endif - #else /* !defined __STDC__ */ - - #ifndef _LP64 - #define _bufend(p) ((fileno(p) < _NFILE) ? _bufendtab[fileno(p)] : \ - (unsigned char *)_realbufend(p)) - #define _bufsiz(p) (_bufend(p) - (p)->_base) - #endif /* _LP64 */ - - #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \ - defined(_REENTRANT) - extern char *tmpnam_r(); - #endif - - #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) - extern int fcloseall(); - extern void setbuffer(); - extern int setlinebuf(); - extern int asprintf(); - extern int vasprintf(); - #endif - - #if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) - /* || defined(_XPG7) */ - extern ssize_t getdelim(); - extern ssize_t getline(); - #endif /* __EXTENSIONS__ ... */ - - #if defined(__EXTENSIONS__) || defined(__XOPEN_OR_POSIX) - extern FILE *fdopen(); - extern char *ctermid(); - extern int fileno(); - #endif /* defined(__EXTENSIONS__) || defined(__XOPEN_OR_POSIX) */ - - #if defined(__EXTENSIONS__) || defined(_REENTRANT) || \ - (_POSIX_C_SOURCE - 0 >= 199506L) - extern void flockfile(); - extern int ftrylockfile(); - extern void funlockfile(); - extern int getc_unlocked(); - extern int getchar_unlocked(); - extern int putc_unlocked(); - extern int putchar_unlocked(); - #endif /* defined(__EXTENSIONS__) || defined(_REENTRANT).. */ - - #if defined(__EXTENSIONS__) || defined(_XOPEN_SOURCE) - extern FILE *popen(); - extern char *tempnam(); - extern int pclose(); - - #if !defined(_XOPEN_SOURCE) - extern int getsubopt(); - #endif /* !defined(_XOPEN_SOURCE) */ - - #if !defined(_XPG6) || defined(__EXTENSIONS__) - extern char *cuserid(); - extern int getopt(); - extern char *optarg; - extern int optind, opterr, optopt; - extern int getw(); - extern int putw(); - #endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */ - - #endif /* defined(__EXTENSIONS__) || defined(_XOPEN_SOURCE) */ - - #if defined(_LARGEFILE_SOURCE) || defined(_XPG5) - extern int fseeko(); - extern off_t ftello(); - #endif - - #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ - !defined(__PRAGMA_REDEFINE_EXTNAME)) - extern FILE *fopen64(); - extern FILE *freopen64(); - extern FILE *tmpfile64(); - extern int fgetpos64(); - extern int fsetpos64(); - extern int fseeko64(); - extern off64_t ftello64(); - #endif - - #endif /* __STDC__ */ - #if !defined(__lint) ! #if defined(__EXTENSIONS__) || defined(_REENTRANT) || \ (_POSIX_C_SOURCE - 0 >= 199506L) #ifndef _LP64 - #ifdef __STDC__ #define getc_unlocked(p) (--(p)->_cnt < 0 \ ? __filbuf(p) \ : (int)*(p)->_ptr++) #define putc_unlocked(x, p) (--(p)->_cnt < 0 \ ? __flsbuf((x), (p)) \ : (int)(*(p)->_ptr++ = \ (unsigned char) (x))) - #else - #define getc_unlocked(p) (--(p)->_cnt < 0 \ - ? _filbuf(p) \ - : (int)*(p)->_ptr++) - #define putc_unlocked(x, p) (--(p)->_cnt < 0 \ - ? _flsbuf((x), (p)) \ - : (int)(*(p)->_ptr++ = \ - (unsigned char) (x))) - #endif /* __STDC__ */ #endif /* _LP64 */ #define getchar_unlocked() getc_unlocked(stdin) #define putchar_unlocked(x) putc_unlocked((x), stdout) ! #endif /* defined(__EXTENSIONS__) || defined(_REENTRANT).. */ #endif /* !defined(__lint) */ #ifdef __cplusplus } --- 352,377 ---- extern int fsetpos64(FILE *, const fpos64_t *); extern int fseeko64(FILE *, off64_t, int); extern off64_t ftello64(FILE *); #endif #if !defined(__lint) ! #if defined(_REENTRANT) || !defined(_STRICT_SYMBOLS) || \ (_POSIX_C_SOURCE - 0 >= 199506L) #ifndef _LP64 #define getc_unlocked(p) (--(p)->_cnt < 0 \ ? __filbuf(p) \ : (int)*(p)->_ptr++) #define putc_unlocked(x, p) (--(p)->_cnt < 0 \ ? __flsbuf((x), (p)) \ : (int)(*(p)->_ptr++ = \ (unsigned char) (x))) #endif /* _LP64 */ #define getchar_unlocked() getc_unlocked(stdin) #define putchar_unlocked(x) putc_unlocked((x), stdout) ! #endif /* defined(_REENTRANT).. */ #endif /* !defined(__lint) */ #ifdef __cplusplus }