move fnmatch function declaration from unistd.h
[unix-history] / usr / src / include / stdio.h
index a4dfe6a..8168b81 100644 (file)
@@ -7,25 +7,26 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)stdio.h     5.12 (Berkeley) %G%
+ *     @(#)stdio.h     5.21 (Berkeley) %G%
  */
 
 #ifndef        _STDIO_H_
 #define        _STDIO_H_
 
  */
 
 #ifndef        _STDIO_H_
 #define        _STDIO_H_
 
+#include <sys/types.h>
 #include <sys/cdefs.h>
 
 #include <sys/cdefs.h>
 
-#include <machine/types.h>
-#ifdef _SIZE_T_
-typedef        _SIZE_T_        size_t;
-#undef _SIZE_T_
+#include <machine/ansi.h>
+#ifdef _BSD_SIZE_T_
+typedef        _BSD_SIZE_T_    size_t;
+#undef _BSD_SIZE_T_
 #endif
 
 #ifndef NULL
 #define        NULL    0
 #endif
 
 #endif
 
 #ifndef NULL
 #define        NULL    0
 #endif
 
-typedef long fpos_t;           /* Must match off_t <sys/types.h> */
+typedef off_t fpos_t;          /* Must match off_t <sys/types.h> */
 
 #define        _FSTDIO                 /* Define for new stdio with functions. */
 
 
 #define        _FSTDIO                 /* Define for new stdio with functions. */
 
@@ -98,7 +99,9 @@ typedef       struct __sFILE {
        int     _offset;        /* current lseek offset */
 } FILE;
 
        int     _offset;        /* current lseek offset */
 } FILE;
 
+__BEGIN_DECLS
 extern FILE __sF[];
 extern FILE __sF[];
+__END_DECLS
 
 #define        __SLBF  0x0001          /* line buffered */
 #define        __SNBF  0x0002          /* unbuffered */
 
 #define        __SLBF  0x0001          /* line buffered */
 #define        __SNBF  0x0002          /* unbuffered */
@@ -177,16 +180,20 @@ FILE      *fopen __P((const char *, const char *));
 int     fprintf __P((FILE *, const char *, ...));
 int     fputc __P((int, FILE *));
 int     fputs __P((const char *, FILE *));
 int     fprintf __P((FILE *, const char *, ...));
 int     fputc __P((int, FILE *));
 int     fputs __P((const char *, FILE *));
-int     fread __P((void *, size_t, size_t, FILE *));
+size_t  fread __P((void *, size_t, size_t, FILE *));
 FILE   *freopen __P((const char *, const char *, FILE *));
 int     fscanf __P((FILE *, const char *, ...));
 int     fseek __P((FILE *, long, int));
 int     fsetpos __P((FILE *, const fpos_t *));
 long    ftell __P((const FILE *));
 FILE   *freopen __P((const char *, const char *, FILE *));
 int     fscanf __P((FILE *, const char *, ...));
 int     fseek __P((FILE *, long, int));
 int     fsetpos __P((FILE *, const fpos_t *));
 long    ftell __P((const FILE *));
-int     fwrite __P((const void *, size_t, size_t, FILE *));
+size_t  fwrite __P((const void *, size_t, size_t, FILE *));
 int     getc __P((FILE *));
 int     getchar __P((void));
 char   *gets __P((char *));
 int     getc __P((FILE *));
 int     getchar __P((void));
 char   *gets __P((char *));
+#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
+extern int sys_nerr;                   /* perror(3) external variables */
+extern char *sys_errlist[];
+#endif
 void    perror __P((const char *));
 int     printf __P((const char *, ...));
 int     putc __P((int, FILE *));
 void    perror __P((const char *));
 int     printf __P((const char *, ...));
 int     putc __P((int, FILE *));
@@ -203,9 +210,9 @@ int  sscanf __P((char *, const char *, ...));
 FILE   *tmpfile __P((void));
 char   *tmpnam __P((char *));
 int     ungetc __P((int, FILE *));
 FILE   *tmpfile __P((void));
 char   *tmpnam __P((char *));
 int     ungetc __P((int, FILE *));
-int     vfprintf __P((FILE *, const char *, _VA_LIST_));
-int     vprintf __P((const char *, _VA_LIST_));
-int     vsprintf __P((char *, const char *, _VA_LIST_));
+int     vfprintf __P((FILE *, const char *, _BSD_VA_LIST_));
+int     vprintf __P((const char *, _BSD_VA_LIST_));
+int     vsprintf __P((char *, const char *, _BSD_VA_LIST_));
 __END_DECLS
 
 /*
 __END_DECLS
 
 /*
@@ -237,9 +244,18 @@ void        setbuffer __P((FILE *, char *, int));
 int     setlinebuf __P((FILE *));
 char   *tempnam __P((const char *, const char *));
 int     snprintf __P((char *, size_t, const char *, ...));
 int     setlinebuf __P((FILE *));
 char   *tempnam __P((const char *, const char *));
 int     snprintf __P((char *, size_t, const char *, ...));
-int     vsnprintf __P((char *, size_t, const char *, _VA_LIST_));
+int     vsnprintf __P((char *, size_t, const char *, _BSD_VA_LIST_));
+int     vscanf __P((const char *, _BSD_VA_LIST_));
+int     vsscanf __P((const char *, const char *, _BSD_VA_LIST_));
 __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        __svfscanf
+
 /*
  * Stdio function-access interface.
  */
 /*
  * Stdio function-access interface.
  */
@@ -252,20 +268,23 @@ FILE      *funopen __P((const void *,
 __END_DECLS
 #define        fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0)
 #define        fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0)
 __END_DECLS
 #define        fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0)
 #define        fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0)
-#endif /* neither ANSI nor POSIX */
+#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */
 
 /*
  * Functions internal to the implementation.
  */
 
 /*
  * Functions internal to the implementation.
  */
+__BEGIN_DECLS
 int    __srget __P((FILE *));
 int    __srget __P((FILE *));
+int    __svfscanf __P((FILE *, const char *, _BSD_VA_LIST_));
 int    __swbuf __P((int, FILE *));
 int    __swbuf __P((int, FILE *));
+__END_DECLS
 
 /*
  * The __sfoo macros are here so that we can 
  * define function versions in the C library.
  */
 #define        __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++))
 
 /*
  * The __sfoo macros are here so that we can 
  * define function versions in the C library.
  */
 #define        __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++))
-#ifdef __GNUC__
+#if defined(__GNUC__) && defined(__STDC__)
 static __inline int __sputc(int _c, FILE *_p) {
        if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
                return (*_p->_p++ = _c);
 static __inline int __sputc(int _c, FILE *_p) {
        if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
                return (*_p->_p++ = _c);