version 1.42.2.1, 2002/05/24 22:05:51 |
version 1.53.2.1.2.1, 2005/05/29 23:38:25 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright |
* 2. Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* documentation and/or other materials provided with the distribution. |
* 3. All advertising materials mentioning features or use of this software |
* 3. Neither the name of the University nor the names of its contributors |
* must display the following acknowledgement: |
|
* This product includes software developed by the University of |
|
* California, Berkeley and its contributors. |
|
* 4. Neither the name of the University nor the names of its contributors |
|
* may be used to endorse or promote products derived from this software |
* may be used to endorse or promote products derived from this software |
* without specific prior written permission. |
* without specific prior written permission. |
* |
* |
|
|
#ifndef _STDIO_H_ |
#ifndef _STDIO_H_ |
#define _STDIO_H_ |
#define _STDIO_H_ |
|
|
#include <sys/ansi.h> |
|
|
|
#include <sys/cdefs.h> |
#include <sys/cdefs.h> |
#include <sys/featuretest.h> |
#include <sys/featuretest.h> |
|
#include <sys/ansi.h> |
|
|
#include <machine/ansi.h> |
#include <machine/ansi.h> |
#ifdef _BSD_SIZE_T_ |
#ifdef _BSD_SIZE_T_ |
|
|
#define FILENAME_MAX 1024 /* must be <= PATH_MAX <sys/syslimits.h> */ |
#define FILENAME_MAX 1024 /* must be <= PATH_MAX <sys/syslimits.h> */ |
|
|
/* System V/ANSI C; this is the wrong way to do this, do *not* use these. */ |
/* System V/ANSI C; this is the wrong way to do this, do *not* use these. */ |
#ifndef _ANSI_SOURCE |
#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) |
#define P_tmpdir "/var/tmp/" |
#define P_tmpdir "/var/tmp/" |
#endif |
#endif |
#define L_tmpnam 1024 /* XXX must be == PATH_MAX */ |
#define L_tmpnam 1024 /* XXX must be == PATH_MAX */ |
#define TMP_MAX 308915776 |
/* Always ensure that this is consistent with <limits.h> */ |
|
#ifndef TMP_MAX |
|
#define TMP_MAX 308915776 /* Legacy */ |
|
#endif |
|
|
/* Always ensure that these are consistent with <fcntl.h> and <unistd.h>! */ |
/* Always ensure that these are consistent with <fcntl.h> and <unistd.h>! */ |
#ifndef SEEK_SET |
#ifndef SEEK_SET |
Line 251 FILE *tmpfile __P((void)); |
|
Line 249 FILE *tmpfile __P((void)); |
|
int ungetc __P((int, FILE *)); |
int ungetc __P((int, FILE *)); |
int vfprintf __P((FILE * __restrict, const char * __restrict, |
int vfprintf __P((FILE * __restrict, const char * __restrict, |
_BSD_VA_LIST_)); |
_BSD_VA_LIST_)); |
|
int vfprintf_unlocked __P((FILE * __restrict, const char * __restrict, |
|
_BSD_VA_LIST_)); |
int vprintf __P((const char * __restrict, _BSD_VA_LIST_)); |
int vprintf __P((const char * __restrict, _BSD_VA_LIST_)); |
|
|
#ifndef __AUDIT__ |
#ifndef __AUDIT__ |
char *gets __P((char *)); |
char *gets __P((char *)); |
int sprintf __P((char * __restrict, const char * __restrict, ...)); |
int sprintf __P((char * __restrict, const char * __restrict, ...)); |
char *tmpnam __P((char *)); |
char *tmpnam __P((char *)); |
int vsprintf __P((char * __resitrct, const char * __restrict, |
int vsprintf __P((char * __restrict, const char * __restrict, |
_BSD_VA_LIST_)); |
_BSD_VA_LIST_)); |
#endif |
#endif |
|
|
|
|
/* |
/* |
* IEEE Std 1003.1-90 |
* IEEE Std 1003.1-90 |
*/ |
*/ |
#ifndef _ANSI_SOURCE |
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ |
|
defined(_NETBSD_SOURCE) |
#define L_ctermid 1024 /* size for ctermid(); PATH_MAX */ |
#define L_ctermid 1024 /* size for ctermid(); PATH_MAX */ |
#define L_cuserid 9 /* size for cuserid(); UT_NAMESIZE + 1 */ |
#define L_cuserid 9 /* size for cuserid(); UT_NAMESIZE + 1 */ |
|
|
|
|
/* |
/* |
* IEEE Std 1003.1c-95, also adopted by X/Open CAE Spec Issue 5 Version 2 |
* IEEE Std 1003.1c-95, also adopted by X/Open CAE Spec Issue 5 Version 2 |
*/ |
*/ |
#if (!defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \ |
#if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \ |
!defined(_XOPEN_SOURCE)) || (_POSIX_C_SOURCE - 0) >= 199506L || \ |
defined(_REENTRANT) || defined(_NETBSD_SOURCE) |
(_XOPEN_SOURCE - 0) >= 500 || defined(_REENTRANT) |
|
__BEGIN_DECLS |
__BEGIN_DECLS |
#if 0 /* not yet */ |
|
void flockfile __P((FILE *)); |
void flockfile __P((FILE *)); |
int ftrylockfile __P((FILE *)); |
int ftrylockfile __P((FILE *)); |
void funlockfile __P((FILE *)); |
void funlockfile __P((FILE *)); |
#endif /* 0 */ |
|
int getc_unlocked __P((FILE *)); |
int getc_unlocked __P((FILE *)); |
int getchar_unlocked __P((void)); |
int getchar_unlocked __P((void)); |
int putc_unlocked __P((int, FILE *)); |
int putc_unlocked __P((int, FILE *)); |
int putchar_unlocked __P((int)); |
int putchar_unlocked __P((int)); |
__END_DECLS |
__END_DECLS |
#endif /* (!_ANSI_SOURCE && !_POSIX_C_SOURCE && !_XOPEN_SOURCE) || ... */ |
#endif /* _POSIX_C_SOURCE >= 1995056 || _XOPEN_SOURCE >= 500 || ... */ |
|
|
/* |
/* |
* Functions defined in POSIX 1003.2 and XPG2 or later. |
* Functions defined in POSIX 1003.2 and XPG2 or later. |
*/ |
*/ |
#if (!defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \ |
#if (_POSIX_C_SOURCE - 0) >= 2 || (_XOPEN_SOURCE - 0) >= 2 || \ |
!defined(_XOPEN_SOURCE)) || (_POSIX_C_SOURCE - 0) >= 2 || \ |
defined(_NETBSD_SOURCE) |
(_XOPEN_SOURCE - 0) >= 2 |
|
__BEGIN_DECLS |
__BEGIN_DECLS |
int pclose __P((FILE *)); |
int pclose __P((FILE *)); |
FILE *popen __P((const char *, const char *)); |
FILE *popen __P((const char *, const char *)); |
|
|
/* |
/* |
* Functions defined in XPG4.2. |
* Functions defined in XPG4.2. |
*/ |
*/ |
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) || \ |
#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) |
defined(_XOPEN_SOURCE) |
|
__BEGIN_DECLS |
__BEGIN_DECLS |
int getw __P((FILE *)); |
int getw __P((FILE *)); |
int putw __P((int, FILE *)); |
int putw __P((int, FILE *)); |
|
|
/* |
/* |
* X/Open CAE Specification Issue 5 Version 2 |
* X/Open CAE Specification Issue 5 Version 2 |
*/ |
*/ |
#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \ |
#if (_XOPEN_SOURCE - 0) >= 500 || defined(_LARGEFILE_SOURCE) || \ |
(_XOPEN_SOURCE - 0) >= 500 || defined(_LARGEFILE_SOURCE) |
defined(_NETBSD_SOURCE) |
#ifndef off_t |
#ifndef off_t |
typedef __off_t off_t; |
typedef __off_t off_t; |
#define off_t __off_t |
#define off_t __off_t |
|
|
int fseeko __P((FILE *, off_t, int)); |
int fseeko __P((FILE *, off_t, int)); |
off_t ftello __P((FILE *)); |
off_t ftello __P((FILE *)); |
__END_DECLS |
__END_DECLS |
#endif /* (!_POSIX_SOURCE && !_XOPEN_SOURCE) || ... */ |
#endif /* _XOPEN_SOURCE >= 500 || _LARGEFILE_SOURCE || _NETBSD_SOURCE */ |
|
|
/* |
/* |
* Routines that are purely local. |
* Routines that are purely local. |
*/ |
*/ |
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \ |
#if defined(_NETBSD_SOURCE) |
!defined(_XOPEN_SOURCE) |
|
|
#define FPARSELN_UNESCESC 0x01 |
|
#define FPARSELN_UNESCCONT 0x02 |
|
#define FPARSELN_UNESCCOMM 0x04 |
|
#define FPARSELN_UNESCREST 0x08 |
|
#define FPARSELN_UNESCALL 0x0f |
|
|
__BEGIN_DECLS |
__BEGIN_DECLS |
int asprintf __P((char ** __restrict, const char * __restrict, ...)) |
int asprintf __P((char ** __restrict, const char * __restrict, ...)) |
__attribute__((__format__(__printf__, 2, 3))); |
__attribute__((__format__(__printf__, 2, 3))); |
char *fgetln __P((FILE * __restrict, size_t * __restrict)); |
char *fgetln __P((FILE * __restrict, size_t * __restrict)); |
|
char *fparseln(FILE *, size_t *, size_t *, const char[3], int); |
int fpurge __P((FILE *)); |
int fpurge __P((FILE *)); |
void setbuffer __P((FILE *, char *, int)); |
void setbuffer __P((FILE *, char *, int)); |
int setlinebuf __P((FILE *)); |
int setlinebuf __P((FILE *)); |
Line 371 int vasprintf __P((char ** __restrict, |
|
Line 374 int vasprintf __P((char ** __restrict, |
|
__attribute__((__format__(__printf__, 2, 0))); |
__attribute__((__format__(__printf__, 2, 0))); |
int vscanf __P((const char * __restrict, _BSD_VA_LIST_)) |
int vscanf __P((const char * __restrict, _BSD_VA_LIST_)) |
__attribute__((__format__(__scanf__, 1, 0))); |
__attribute__((__format__(__scanf__, 1, 0))); |
|
int vfscanf __P((FILE * __restrict, const char * __restrict, |
|
_BSD_VA_LIST_)) |
|
__attribute__((__format__(__scanf__, 2, 0))); |
int vsscanf __P((const char * __restrict, const char * __restrict, |
int vsscanf __P((const char * __restrict, const char * __restrict, |
_BSD_VA_LIST_)) |
_BSD_VA_LIST_)) |
__attribute__((__format__(__scanf__, 2, 0))); |
__attribute__((__format__(__scanf__, 2, 0))); |
Line 379 __const char *fmtcheck __P((const char * |
|
Line 385 __const char *fmtcheck __P((const char * |
|
__END_DECLS |
__END_DECLS |
|
|
/* |
/* |
* This is a #define because the function is used internally and |
|
* (unlike vfscanf) the name __svfscanf is guaranteed not to collide |
|
* with a user function when _ANSI_SOURCE or _POSIX_SOURCE is defined. |
|
*/ |
|
#define vfscanf(fp, fmt, va) __svfscanf((fp), (fmt), (va)) |
|
|
|
/* |
|
* Stdio function-access interface. |
* Stdio function-access interface. |
*/ |
*/ |
__BEGIN_DECLS |
__BEGIN_DECLS |
Line 397 FILE *funopen __P((const void *, |
|
Line 396 FILE *funopen __P((const void *, |
|
__END_DECLS |
__END_DECLS |
#define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0) |
#define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0) |
#define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0) |
#define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0) |
#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */ |
#endif /* _NETBSD_SOURCE */ |
|
|
/* |
/* |
* Functions internal to the implementation. |
* Functions internal to the implementation. |
*/ |
*/ |
__BEGIN_DECLS |
__BEGIN_DECLS |
int __srget __P((FILE *)); |
int __srget __P((FILE *)); |
int __svfscanf __P((FILE * __restrict, const char * __restrict, |
|
_BSD_VA_LIST_)) |
|
__attribute__((__format__(__scanf__, 2, 0))); |
|
int __swbuf __P((int, FILE *)); |
int __swbuf __P((int, FILE *)); |
__END_DECLS |
__END_DECLS |
|
|
Line 441 static __inline int __sputc(int _c, FILE |
|
Line 437 static __inline int __sputc(int _c, FILE |
|
#define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF))) |
#define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF))) |
#define __sfileno(p) ((p)->_file) |
#define __sfileno(p) ((p)->_file) |
|
|
#ifndef lint |
#ifndef __lint__ |
#ifndef _REENTRANT |
#if !defined(_REENTRANT) && !defined(_PTHREADS) |
#define feof(p) __sfeof(p) |
#define feof(p) __sfeof(p) |
#define ferror(p) __sferror(p) |
#define ferror(p) __sferror(p) |
#define clearerr(p) __sclearerr(p) |
#define clearerr(p) __sclearerr(p) |
|
|
#define getc(fp) __sgetc(fp) |
#define getc(fp) __sgetc(fp) |
#define putc(x, fp) __sputc(x, fp) |
#define putc(x, fp) __sputc(x, fp) |
#endif /* !_REENTRANT */ |
#endif /* !_REENTRANT && !_PTHREADS */ |
#endif /* lint */ |
#endif /* __lint__ */ |
|
|
#define getchar() getc(stdin) |
#define getchar() getc(stdin) |
#define putchar(x) putc(x, stdout) |
#define putchar(x) putc(x, stdout) |
|
|
#ifndef _ANSI_SOURCE |
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ |
#ifndef _REENTRANT |
defined(_NETBSD_SOURCE) |
|
#if !defined(_REENTRANT) && !defined(_PTHREADS) |
#define fileno(p) __sfileno(p) |
#define fileno(p) __sfileno(p) |
#endif /* !_REENTRANT */ |
#endif /* !_REENTRANT && !_PTHREADS */ |
#endif /* !_ANSI_SOURCE */ |
#endif /* !_ANSI_SOURCE */ |
|
|
#if (!defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \ |
#if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \ |
!defined(_XOPEN_SOURCE)) || (_POSIX_C_SOURCE - 0) >= 199506L || \ |
defined(_REENTRANT) || defined(_NETBSD_SOURCE) |
(_XOPEN_SOURCE - 0) >= 500 || defined(_REENTRANT) |
|
#define getc_unlocked(fp) __sgetc(fp) |
#define getc_unlocked(fp) __sgetc(fp) |
#define putc_unlocked(x, fp) __sputc(x, fp) |
#define putc_unlocked(x, fp) __sputc(x, fp) |
|
|
#define getchar_unlocked() getc_unlocked(stdin) |
#define getchar_unlocked() getc_unlocked(stdin) |
#define putchar_unlocked(x) putc_unlocked(x, stdout) |
#define putchar_unlocked(x) putc_unlocked(x, stdout) |
#endif /* (!_ANSI_SOURCE && !_POSIX_C_SOURCE && !_XOPEN_SOURCE) || ... */ |
#endif /* _POSIX_C_SOURCE >= 199506 || _XOPEN_SOURCE >= 500 || _REENTRANT... */ |
|
|
#endif /* _STDIO_H_ */ |
#endif /* _STDIO_H_ */ |