]> git.saurik.com Git - apple/libc.git/blobdiff - stdio/FreeBSD/funopen.c
Libc-825.24.tar.gz
[apple/libc.git] / stdio / FreeBSD / funopen.c
index 040c80650ac8f430d0a2c775aa4c888e695fcafe..408f0f42e2147e4f080743ba5e59608a8b9259b9 100644 (file)
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    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
  *    without specific prior written permission.
@@ -38,7 +34,7 @@
 static char sccsid[] = "@(#)funopen.c  8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/funopen.c,v 1.5 2002/05/28 16:59:39 alfred Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/stdio/funopen.c,v 1.7 2009/12/05 19:31:38 ed Exp $");
 
 #include <stdio.h>
 #include <errno.h>
@@ -46,11 +42,11 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/funopen.c,v 1.5 2002/05/28 16:59:39 alfre
 #include "local.h"
 
 FILE *
-funopen(cookie, readfn, writefn, seekfn, closefn)
-       const void *cookie;
-       int (*readfn)(), (*writefn)();
-       fpos_t (*seekfn)(void *cookie, fpos_t off, int whence);
-       int (*closefn)();
+funopen(const void *cookie,
+       int (*readfn)(void *, char *, int),
+       int (*writefn)(void *, const char *, int),
+       fpos_t (*seekfn)(void *, fpos_t, int),
+       int (*closefn)(void *))
 {
        FILE *fp;
        int flags;
@@ -67,7 +63,8 @@ funopen(cookie, readfn, writefn, seekfn, closefn)
                else
                        flags = __SRW;          /* read-write */
        }
-       if ((fp = __sfp()) == NULL)
+       /* funopen in not covered in SUSv3, so never count the streams */
+       if ((fp = __sfp(0)) == NULL)
                return (NULL);
        fp->_flags = flags;
        fp->_file = -1;