Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:11:23

0001 /*
0002  * Copyright © 2004-2024 Guillem Jover <guillem@hadrons.org>
0003  *
0004  * Redistribution and use in source and binary forms, with or without
0005  * modification, are permitted provided that the following conditions
0006  * are met:
0007  * 1. Redistributions of source code must retain the above copyright
0008  *    notice, this list of conditions and the following disclaimer.
0009  * 2. Redistributions in binary form must reproduce the above copyright
0010  *    notice, this list of conditions and the following disclaimer in the
0011  *    documentation and/or other materials provided with the distribution.
0012  * 3. The name of the author may not be used to endorse or promote products
0013  *    derived from this software without specific prior written permission.
0014  *
0015  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
0016  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
0017  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
0018  * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
0019  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
0020  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
0021  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
0022  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
0023  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
0024  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0025  */
0026 
0027 #if defined(__need_FILE) || defined(__need___FILE)
0028 #define LIBBSD_STDIO_H_SKIP
0029 #endif
0030 
0031 #ifdef LIBBSD_OVERLAY
0032 #include_next <stdio.h>
0033 #else
0034 #include <stdio.h>
0035 #endif
0036 
0037 #ifndef LIBBSD_STDIO_H_SKIP
0038 #ifndef LIBBSD_STDIO_H
0039 #define LIBBSD_STDIO_H
0040 
0041 #ifdef LIBBSD_OVERLAY
0042 #include <sys/cdefs.h>
0043 #else
0044 #include <bsd/sys/cdefs.h>
0045 #endif
0046 #include <sys/types.h>
0047 #if defined(_AIX)
0048 #include <stdarg.h>
0049 #endif
0050 
0051 __BEGIN_DECLS
0052 #if defined(_AIX)
0053 int asprintf(char **strp, char const *fmt, ...)
0054     __printflike(2, 3);
0055 int vasprintf(char **strp, char const *fmt, va_list args)
0056     __printflike(2, 0);
0057 #endif
0058 
0059 const char *fmtcheck(const char *, const char *);
0060 
0061 /* XXX: The function requires cooperation from the system libc to store the
0062  * line buffer in the FILE struct itself. */
0063 char *fgetln(FILE *fp, size_t *lenp)
0064     LIBBSD_DEPRECATED("This functions cannot be safely ported, "
0065                       "use getline(3) instead, as it is supported "
0066                       "by GNU and POSIX.1-2008.");
0067 
0068 /*
0069  * Note: We diverge from the FreeBSD, OpenBSD and DragonFlyBSD declarations,
0070  * because seekfn() there wrongly uses fpos_t, assuming it's an integral
0071  * type, and any code using that on a system where fpos_t is a struct
0072  * (such as GNU-based systems or NetBSD) will fail to build. In which case,
0073  * as the code has to be modified anyway, we might just as well use the
0074  * correct declaration here.
0075  */
0076 FILE *funopen(const void *cookie,
0077               int (*readfn)(void *cookie, char *buf, int size),
0078               int (*writefn)(void *cookie, const char *buf, int size),
0079               off_t (*seekfn)(void *cookie, off_t offset, int whence),
0080               int (*closefn)(void *cookie));
0081 
0082 #define fropen(cookie, fn) funopen(cookie, fn, NULL, NULL, NULL)
0083 #define fwopen(cookie, fn) funopen(cookie, NULL, fn, NULL, NULL)
0084 
0085 int fpurge(FILE *fp);
0086 __END_DECLS
0087 
0088 #endif
0089 #endif
0090 #undef LIBBSD_STDIO_H_SKIP