Home | History | Annotate | Line # | Download | only in import
stdio.in.h revision 1.1
      1  1.1  christos /* A GNU-like <stdio.h>.
      2  1.1  christos 
      3  1.1  christos    Copyright (C) 2004, 2007-2020 Free Software Foundation, Inc.
      4  1.1  christos 
      5  1.1  christos    This program is free software; you can redistribute it and/or modify
      6  1.1  christos    it under the terms of the GNU General Public License as published by
      7  1.1  christos    the Free Software Foundation; either version 3, or (at your option)
      8  1.1  christos    any later version.
      9  1.1  christos 
     10  1.1  christos    This program is distributed in the hope that it will be useful,
     11  1.1  christos    but WITHOUT ANY WARRANTY; without even the implied warranty of
     12  1.1  christos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13  1.1  christos    GNU General Public License for more details.
     14  1.1  christos 
     15  1.1  christos    You should have received a copy of the GNU General Public License
     16  1.1  christos    along with this program; if not, see <https://www.gnu.org/licenses/>.  */
     17  1.1  christos 
     18  1.1  christos #if __GNUC__ >= 3
     19  1.1  christos @PRAGMA_SYSTEM_HEADER@
     20  1.1  christos #endif
     21  1.1  christos @PRAGMA_COLUMNS@
     22  1.1  christos 
     23  1.1  christos #if defined __need_FILE || defined __need___FILE || defined _GL_ALREADY_INCLUDING_STDIO_H
     24  1.1  christos /* Special invocation convention:
     25  1.1  christos    - Inside glibc header files.
     26  1.1  christos    - On OSF/1 5.1 we have a sequence of nested includes
     27  1.1  christos      <stdio.h> -> <getopt.h> -> <ctype.h> -> <sys/localedef.h> ->
     28  1.1  christos      <sys/lc_core.h> -> <nl_types.h> -> <mesg.h> -> <stdio.h>.
     29  1.1  christos      In this situation, the functions are not yet declared, therefore we cannot
     30  1.1  christos      provide the C++ aliases.  */
     31  1.1  christos 
     32  1.1  christos #@INCLUDE_NEXT@ @NEXT_STDIO_H@
     33  1.1  christos 
     34  1.1  christos #else
     35  1.1  christos /* Normal invocation convention.  */
     36  1.1  christos 
     37  1.1  christos #ifndef _@GUARD_PREFIX@_STDIO_H
     38  1.1  christos 
     39  1.1  christos #define _GL_ALREADY_INCLUDING_STDIO_H
     40  1.1  christos 
     41  1.1  christos /* The include_next requires a split double-inclusion guard.  */
     42  1.1  christos #@INCLUDE_NEXT@ @NEXT_STDIO_H@
     43  1.1  christos 
     44  1.1  christos #undef _GL_ALREADY_INCLUDING_STDIO_H
     45  1.1  christos 
     46  1.1  christos #ifndef _@GUARD_PREFIX@_STDIO_H
     47  1.1  christos #define _@GUARD_PREFIX@_STDIO_H
     48  1.1  christos 
     49  1.1  christos /* Get va_list.  Needed on many systems, including glibc 2.8.  */
     50  1.1  christos #include <stdarg.h>
     51  1.1  christos 
     52  1.1  christos #include <stddef.h>
     53  1.1  christos 
     54  1.1  christos /* Get off_t and ssize_t.  Needed on many systems, including glibc 2.8
     55  1.1  christos    and eglibc 2.11.2.
     56  1.1  christos    May also define off_t to a 64-bit type on native Windows.  */
     57  1.1  christos #include <sys/types.h>
     58  1.1  christos 
     59  1.1  christos /* The __attribute__ feature is available in gcc versions 2.5 and later.
     60  1.1  christos    The __-protected variants of the attributes 'format' and 'printf' are
     61  1.1  christos    accepted by gcc versions 2.6.4 (effectively 2.7) and later.
     62  1.1  christos    We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
     63  1.1  christos    gnulib and libintl do '#define printf __printf__' when they override
     64  1.1  christos    the 'printf' function.  */
     65  1.1  christos #ifndef _GL_ATTRIBUTE_FORMAT
     66  1.1  christos # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
     67  1.1  christos #  define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
     68  1.1  christos # else
     69  1.1  christos #  define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
     70  1.1  christos # endif
     71  1.1  christos #endif
     72  1.1  christos 
     73  1.1  christos /* _GL_ATTRIBUTE_FORMAT_PRINTF
     74  1.1  christos    indicates to GCC that the function takes a format string and arguments,
     75  1.1  christos    where the format string directives are the ones standardized by ISO C99
     76  1.1  christos    and POSIX.  */
     77  1.1  christos #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
     78  1.1  christos # define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \
     79  1.1  christos    _GL_ATTRIBUTE_FORMAT ((__gnu_printf__, formatstring_parameter, first_argument))
     80  1.1  christos #else
     81  1.1  christos # define _GL_ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \
     82  1.1  christos    _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
     83  1.1  christos #endif
     84  1.1  christos 
     85  1.1  christos /* _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_PRINTF,
     86  1.1  christos    except that it indicates to GCC that the supported format string directives
     87  1.1  christos    are the ones of the system printf(), rather than the ones standardized by
     88  1.1  christos    ISO C99 and POSIX.  */
     89  1.1  christos #if GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU
     90  1.1  christos # define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \
     91  1.1  christos   _GL_ATTRIBUTE_FORMAT_PRINTF (formatstring_parameter, first_argument)
     92  1.1  christos #else
     93  1.1  christos # define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \
     94  1.1  christos   _GL_ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
     95  1.1  christos #endif
     96  1.1  christos 
     97  1.1  christos /* _GL_ATTRIBUTE_FORMAT_SCANF
     98  1.1  christos    indicates to GCC that the function takes a format string and arguments,
     99  1.1  christos    where the format string directives are the ones standardized by ISO C99
    100  1.1  christos    and POSIX.  */
    101  1.1  christos #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
    102  1.1  christos # define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \
    103  1.1  christos    _GL_ATTRIBUTE_FORMAT ((__gnu_scanf__, formatstring_parameter, first_argument))
    104  1.1  christos #else
    105  1.1  christos # define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \
    106  1.1  christos    _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument))
    107  1.1  christos #endif
    108  1.1  christos 
    109  1.1  christos /* _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_SCANF,
    110  1.1  christos    except that it indicates to GCC that the supported format string directives
    111  1.1  christos    are the ones of the system scanf(), rather than the ones standardized by
    112  1.1  christos    ISO C99 and POSIX.  */
    113  1.1  christos #define _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM(formatstring_parameter, first_argument) \
    114  1.1  christos   _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument))
    115  1.1  christos 
    116  1.1  christos /* Solaris 10 and NetBSD 7.0 declare renameat in <unistd.h>, not in <stdio.h>.  */
    117  1.1  christos /* But in any case avoid namespace pollution on glibc systems.  */
    118  1.1  christos #if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && (defined __sun || defined __NetBSD__) \
    119  1.1  christos     && ! defined __GLIBC__
    120  1.1  christos # include <unistd.h>
    121  1.1  christos #endif
    122  1.1  christos 
    123  1.1  christos /* Android 4.3 declares renameat in <sys/stat.h>, not in <stdio.h>.  */
    124  1.1  christos /* But in any case avoid namespace pollution on glibc systems.  */
    125  1.1  christos #if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \
    126  1.1  christos     && ! defined __GLIBC__
    127  1.1  christos # include <sys/stat.h>
    128  1.1  christos #endif
    129  1.1  christos 
    130  1.1  christos /* MSVC declares 'perror' in <stdlib.h>, not in <stdio.h>.  We must include
    131  1.1  christos    it before we  #define perror rpl_perror.  */
    132  1.1  christos /* But in any case avoid namespace pollution on glibc systems.  */
    133  1.1  christos #if (@GNULIB_PERROR@ || defined GNULIB_POSIXCHECK) \
    134  1.1  christos     && (defined _WIN32 && ! defined __CYGWIN__) \
    135  1.1  christos     && ! defined __GLIBC__
    136  1.1  christos # include <stdlib.h>
    137  1.1  christos #endif
    138  1.1  christos 
    139  1.1  christos /* MSVC declares 'remove' in <io.h>, not in <stdio.h>.  We must include
    140  1.1  christos    it before we  #define remove rpl_remove.  */
    141  1.1  christos /* MSVC declares 'rename' in <io.h>, not in <stdio.h>.  We must include
    142  1.1  christos    it before we  #define rename rpl_rename.  */
    143  1.1  christos /* But in any case avoid namespace pollution on glibc systems.  */
    144  1.1  christos #if (@GNULIB_REMOVE@ || @GNULIB_RENAME@ || defined GNULIB_POSIXCHECK) \
    145  1.1  christos     && (defined _WIN32 && ! defined __CYGWIN__) \
    146  1.1  christos     && ! defined __GLIBC__
    147  1.1  christos # include <io.h>
    148  1.1  christos #endif
    149  1.1  christos 
    150  1.1  christos 
    151  1.1  christos /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
    152  1.1  christos 
    153  1.1  christos /* The definition of _GL_ARG_NONNULL is copied here.  */
    154  1.1  christos 
    155  1.1  christos /* The definition of _GL_WARN_ON_USE is copied here.  */
    156  1.1  christos 
    157  1.1  christos /* Macros for stringification.  */
    158  1.1  christos #define _GL_STDIO_STRINGIZE(token) #token
    159  1.1  christos #define _GL_STDIO_MACROEXPAND_AND_STRINGIZE(token) _GL_STDIO_STRINGIZE(token)
    160  1.1  christos 
    161  1.1  christos /* When also using extern inline, suppress the use of static inline in
    162  1.1  christos    standard headers of problematic Apple configurations, as Libc at
    163  1.1  christos    least through Libc-825.26 (2013-04-09) mishandles it; see, e.g.,
    164  1.1  christos    <https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html>.
    165  1.1  christos    Perhaps Apple will fix this some day.  */
    166  1.1  christos #if (defined _GL_EXTERN_INLINE_IN_USE && defined __APPLE__ \
    167  1.1  christos      && defined __GNUC__ && defined __STDC__)
    168  1.1  christos # undef putc_unlocked
    169  1.1  christos #endif
    170  1.1  christos 
    171  1.1  christos #if @GNULIB_DPRINTF@
    172  1.1  christos # if @REPLACE_DPRINTF@
    173  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    174  1.1  christos #   define dprintf rpl_dprintf
    175  1.1  christos #  endif
    176  1.1  christos _GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *restrict format, ...)
    177  1.1  christos                                 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
    178  1.1  christos                                 _GL_ARG_NONNULL ((2)));
    179  1.1  christos _GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *restrict format, ...));
    180  1.1  christos # else
    181  1.1  christos #  if !@HAVE_DPRINTF@
    182  1.1  christos _GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *restrict format, ...)
    183  1.1  christos                                 _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
    184  1.1  christos                                 _GL_ARG_NONNULL ((2)));
    185  1.1  christos #  endif
    186  1.1  christos _GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *restrict format, ...));
    187  1.1  christos # endif
    188  1.1  christos _GL_CXXALIASWARN (dprintf);
    189  1.1  christos #elif defined GNULIB_POSIXCHECK
    190  1.1  christos # undef dprintf
    191  1.1  christos # if HAVE_RAW_DECL_DPRINTF
    192  1.1  christos _GL_WARN_ON_USE (dprintf, "dprintf is unportable - "
    193  1.1  christos                  "use gnulib module dprintf for portability");
    194  1.1  christos # endif
    195  1.1  christos #endif
    196  1.1  christos 
    197  1.1  christos #if @GNULIB_FCLOSE@
    198  1.1  christos /* Close STREAM and its underlying file descriptor.  */
    199  1.1  christos # if @REPLACE_FCLOSE@
    200  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    201  1.1  christos #   define fclose rpl_fclose
    202  1.1  christos #  endif
    203  1.1  christos _GL_FUNCDECL_RPL (fclose, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
    204  1.1  christos _GL_CXXALIAS_RPL (fclose, int, (FILE *stream));
    205  1.1  christos # else
    206  1.1  christos _GL_CXXALIAS_SYS (fclose, int, (FILE *stream));
    207  1.1  christos # endif
    208  1.1  christos # if __GLIBC__ >= 2
    209  1.1  christos _GL_CXXALIASWARN (fclose);
    210  1.1  christos # endif
    211  1.1  christos #elif defined GNULIB_POSIXCHECK
    212  1.1  christos # undef fclose
    213  1.1  christos /* Assume fclose is always declared.  */
    214  1.1  christos _GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - "
    215  1.1  christos                  "use gnulib module fclose for portable POSIX compliance");
    216  1.1  christos #endif
    217  1.1  christos 
    218  1.1  christos #if @GNULIB_FDOPEN@
    219  1.1  christos # if @REPLACE_FDOPEN@
    220  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    221  1.1  christos #   undef fdopen
    222  1.1  christos #   define fdopen rpl_fdopen
    223  1.1  christos #  endif
    224  1.1  christos _GL_FUNCDECL_RPL (fdopen, FILE *, (int fd, const char *mode)
    225  1.1  christos                                   _GL_ARG_NONNULL ((2)));
    226  1.1  christos _GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode));
    227  1.1  christos # else
    228  1.1  christos _GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode));
    229  1.1  christos # endif
    230  1.1  christos _GL_CXXALIASWARN (fdopen);
    231  1.1  christos #elif defined GNULIB_POSIXCHECK
    232  1.1  christos # undef fdopen
    233  1.1  christos /* Assume fdopen is always declared.  */
    234  1.1  christos _GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX compliant - "
    235  1.1  christos                  "use gnulib module fdopen for portability");
    236  1.1  christos #endif
    237  1.1  christos 
    238  1.1  christos #if @GNULIB_FFLUSH@
    239  1.1  christos /* Flush all pending data on STREAM according to POSIX rules.  Both
    240  1.1  christos    output and seekable input streams are supported.
    241  1.1  christos    Note! LOSS OF DATA can occur if fflush is applied on an input stream
    242  1.1  christos    that is _not_seekable_ or on an update stream that is _not_seekable_
    243  1.1  christos    and in which the most recent operation was input.  Seekability can
    244  1.1  christos    be tested with lseek(fileno(fp),0,SEEK_CUR).  */
    245  1.1  christos # if @REPLACE_FFLUSH@
    246  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    247  1.1  christos #   define fflush rpl_fflush
    248  1.1  christos #  endif
    249  1.1  christos _GL_FUNCDECL_RPL (fflush, int, (FILE *gl_stream));
    250  1.1  christos _GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream));
    251  1.1  christos # else
    252  1.1  christos _GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream));
    253  1.1  christos # endif
    254  1.1  christos # if __GLIBC__ >= 2
    255  1.1  christos _GL_CXXALIASWARN (fflush);
    256  1.1  christos # endif
    257  1.1  christos #elif defined GNULIB_POSIXCHECK
    258  1.1  christos # undef fflush
    259  1.1  christos /* Assume fflush is always declared.  */
    260  1.1  christos _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
    261  1.1  christos                  "use gnulib module fflush for portable POSIX compliance");
    262  1.1  christos #endif
    263  1.1  christos 
    264  1.1  christos #if @GNULIB_FGETC@
    265  1.1  christos # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
    266  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    267  1.1  christos #   undef fgetc
    268  1.1  christos #   define fgetc rpl_fgetc
    269  1.1  christos #  endif
    270  1.1  christos _GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
    271  1.1  christos _GL_CXXALIAS_RPL (fgetc, int, (FILE *stream));
    272  1.1  christos # else
    273  1.1  christos _GL_CXXALIAS_SYS (fgetc, int, (FILE *stream));
    274  1.1  christos # endif
    275  1.1  christos # if __GLIBC__ >= 2
    276  1.1  christos _GL_CXXALIASWARN (fgetc);
    277  1.1  christos # endif
    278  1.1  christos #endif
    279  1.1  christos 
    280  1.1  christos #if @GNULIB_FGETS@
    281  1.1  christos # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
    282  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    283  1.1  christos #   undef fgets
    284  1.1  christos #   define fgets rpl_fgets
    285  1.1  christos #  endif
    286  1.1  christos _GL_FUNCDECL_RPL (fgets, char *,
    287  1.1  christos                   (char *restrict s, int n, FILE *restrict stream)
    288  1.1  christos                   _GL_ARG_NONNULL ((1, 3)));
    289  1.1  christos _GL_CXXALIAS_RPL (fgets, char *,
    290  1.1  christos                   (char *restrict s, int n, FILE *restrict stream));
    291  1.1  christos # else
    292  1.1  christos _GL_CXXALIAS_SYS (fgets, char *,
    293  1.1  christos                   (char *restrict s, int n, FILE *restrict stream));
    294  1.1  christos # endif
    295  1.1  christos # if __GLIBC__ >= 2
    296  1.1  christos _GL_CXXALIASWARN (fgets);
    297  1.1  christos # endif
    298  1.1  christos #endif
    299  1.1  christos 
    300  1.1  christos #if @GNULIB_FOPEN@
    301  1.1  christos # if @REPLACE_FOPEN@
    302  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    303  1.1  christos #   undef fopen
    304  1.1  christos #   define fopen rpl_fopen
    305  1.1  christos #  endif
    306  1.1  christos _GL_FUNCDECL_RPL (fopen, FILE *,
    307  1.1  christos                   (const char *restrict filename, const char *restrict mode)
    308  1.1  christos                   _GL_ARG_NONNULL ((1, 2)));
    309  1.1  christos _GL_CXXALIAS_RPL (fopen, FILE *,
    310  1.1  christos                   (const char *restrict filename, const char *restrict mode));
    311  1.1  christos # else
    312  1.1  christos _GL_CXXALIAS_SYS (fopen, FILE *,
    313  1.1  christos                   (const char *restrict filename, const char *restrict mode));
    314  1.1  christos # endif
    315  1.1  christos # if __GLIBC__ >= 2
    316  1.1  christos _GL_CXXALIASWARN (fopen);
    317  1.1  christos # endif
    318  1.1  christos #elif defined GNULIB_POSIXCHECK
    319  1.1  christos # undef fopen
    320  1.1  christos /* Assume fopen is always declared.  */
    321  1.1  christos _GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX compliant - "
    322  1.1  christos                  "use gnulib module fopen for portability");
    323  1.1  christos #endif
    324  1.1  christos 
    325  1.1  christos #if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@
    326  1.1  christos # if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \
    327  1.1  christos      || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
    328  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    329  1.1  christos #   define fprintf rpl_fprintf
    330  1.1  christos #  endif
    331  1.1  christos #  define GNULIB_overrides_fprintf 1
    332  1.1  christos #  if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
    333  1.1  christos _GL_FUNCDECL_RPL (fprintf, int,
    334  1.1  christos                   (FILE *restrict fp, const char *restrict format, ...)
    335  1.1  christos                   _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
    336  1.1  christos                   _GL_ARG_NONNULL ((1, 2)));
    337  1.1  christos #  else
    338  1.1  christos _GL_FUNCDECL_RPL (fprintf, int,
    339  1.1  christos                   (FILE *restrict fp, const char *restrict format, ...)
    340  1.1  christos                   _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3)
    341  1.1  christos                   _GL_ARG_NONNULL ((1, 2)));
    342  1.1  christos #  endif
    343  1.1  christos _GL_CXXALIAS_RPL (fprintf, int,
    344  1.1  christos                   (FILE *restrict fp, const char *restrict format, ...));
    345  1.1  christos # else
    346  1.1  christos _GL_CXXALIAS_SYS (fprintf, int,
    347  1.1  christos                   (FILE *restrict fp, const char *restrict format, ...));
    348  1.1  christos # endif
    349  1.1  christos # if __GLIBC__ >= 2
    350  1.1  christos _GL_CXXALIASWARN (fprintf);
    351  1.1  christos # endif
    352  1.1  christos #endif
    353  1.1  christos #if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
    354  1.1  christos # if !GNULIB_overrides_fprintf
    355  1.1  christos #  undef fprintf
    356  1.1  christos # endif
    357  1.1  christos /* Assume fprintf is always declared.  */
    358  1.1  christos _GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - "
    359  1.1  christos                  "use gnulib module fprintf-posix for portable "
    360  1.1  christos                  "POSIX compliance");
    361  1.1  christos #endif
    362  1.1  christos 
    363  1.1  christos #if @GNULIB_FPURGE@
    364  1.1  christos /* Discard all pending buffered I/O data on STREAM.
    365  1.1  christos    STREAM must not be wide-character oriented.
    366  1.1  christos    When discarding pending output, the file position is set back to where it
    367  1.1  christos    was before the write calls.  When discarding pending input, the file
    368  1.1  christos    position is advanced to match the end of the previously read input.
    369  1.1  christos    Return 0 if successful.  Upon error, return -1 and set errno.  */
    370  1.1  christos # if @REPLACE_FPURGE@
    371  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    372  1.1  christos #   define fpurge rpl_fpurge
    373  1.1  christos #  endif
    374  1.1  christos _GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1)));
    375  1.1  christos _GL_CXXALIAS_RPL (fpurge, int, (FILE *gl_stream));
    376  1.1  christos # else
    377  1.1  christos #  if !@HAVE_DECL_FPURGE@
    378  1.1  christos _GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1)));
    379  1.1  christos #  endif
    380  1.1  christos _GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream));
    381  1.1  christos # endif
    382  1.1  christos _GL_CXXALIASWARN (fpurge);
    383  1.1  christos #elif defined GNULIB_POSIXCHECK
    384  1.1  christos # undef fpurge
    385  1.1  christos # if HAVE_RAW_DECL_FPURGE
    386  1.1  christos _GL_WARN_ON_USE (fpurge, "fpurge is not always present - "
    387  1.1  christos                  "use gnulib module fpurge for portability");
    388  1.1  christos # endif
    389  1.1  christos #endif
    390  1.1  christos 
    391  1.1  christos #if @GNULIB_FPUTC@
    392  1.1  christos # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
    393  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    394  1.1  christos #   undef fputc
    395  1.1  christos #   define fputc rpl_fputc
    396  1.1  christos #  endif
    397  1.1  christos _GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2)));
    398  1.1  christos _GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream));
    399  1.1  christos # else
    400  1.1  christos _GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream));
    401  1.1  christos # endif
    402  1.1  christos # if __GLIBC__ >= 2
    403  1.1  christos _GL_CXXALIASWARN (fputc);
    404  1.1  christos # endif
    405  1.1  christos #endif
    406  1.1  christos 
    407  1.1  christos #if @GNULIB_FPUTS@
    408  1.1  christos # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
    409  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    410  1.1  christos #   undef fputs
    411  1.1  christos #   define fputs rpl_fputs
    412  1.1  christos #  endif
    413  1.1  christos _GL_FUNCDECL_RPL (fputs, int,
    414  1.1  christos                   (const char *restrict string, FILE *restrict stream)
    415  1.1  christos                   _GL_ARG_NONNULL ((1, 2)));
    416  1.1  christos _GL_CXXALIAS_RPL (fputs, int,
    417  1.1  christos                   (const char *restrict string, FILE *restrict stream));
    418  1.1  christos # else
    419  1.1  christos _GL_CXXALIAS_SYS (fputs, int,
    420  1.1  christos                   (const char *restrict string, FILE *restrict stream));
    421  1.1  christos # endif
    422  1.1  christos # if __GLIBC__ >= 2
    423  1.1  christos _GL_CXXALIASWARN (fputs);
    424  1.1  christos # endif
    425  1.1  christos #endif
    426  1.1  christos 
    427  1.1  christos #if @GNULIB_FREAD@
    428  1.1  christos # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
    429  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    430  1.1  christos #   undef fread
    431  1.1  christos #   define fread rpl_fread
    432  1.1  christos #  endif
    433  1.1  christos _GL_FUNCDECL_RPL (fread, size_t,
    434  1.1  christos                   (void *restrict ptr, size_t s, size_t n,
    435  1.1  christos                    FILE *restrict stream)
    436  1.1  christos                   _GL_ARG_NONNULL ((4)));
    437  1.1  christos _GL_CXXALIAS_RPL (fread, size_t,
    438  1.1  christos                   (void *restrict ptr, size_t s, size_t n,
    439  1.1  christos                    FILE *restrict stream));
    440  1.1  christos # else
    441  1.1  christos _GL_CXXALIAS_SYS (fread, size_t,
    442  1.1  christos                   (void *restrict ptr, size_t s, size_t n,
    443  1.1  christos                    FILE *restrict stream));
    444  1.1  christos # endif
    445  1.1  christos # if __GLIBC__ >= 2
    446  1.1  christos _GL_CXXALIASWARN (fread);
    447  1.1  christos # endif
    448  1.1  christos #endif
    449  1.1  christos 
    450  1.1  christos #if @GNULIB_FREOPEN@
    451  1.1  christos # if @REPLACE_FREOPEN@
    452  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    453  1.1  christos #   undef freopen
    454  1.1  christos #   define freopen rpl_freopen
    455  1.1  christos #  endif
    456  1.1  christos _GL_FUNCDECL_RPL (freopen, FILE *,
    457  1.1  christos                   (const char *restrict filename, const char *restrict mode,
    458  1.1  christos                    FILE *restrict stream)
    459  1.1  christos                   _GL_ARG_NONNULL ((2, 3)));
    460  1.1  christos _GL_CXXALIAS_RPL (freopen, FILE *,
    461  1.1  christos                   (const char *restrict filename, const char *restrict mode,
    462  1.1  christos                    FILE *restrict stream));
    463  1.1  christos # else
    464  1.1  christos _GL_CXXALIAS_SYS (freopen, FILE *,
    465  1.1  christos                   (const char *restrict filename, const char *restrict mode,
    466  1.1  christos                    FILE *restrict stream));
    467  1.1  christos # endif
    468  1.1  christos # if __GLIBC__ >= 2
    469  1.1  christos _GL_CXXALIASWARN (freopen);
    470  1.1  christos # endif
    471  1.1  christos #elif defined GNULIB_POSIXCHECK
    472  1.1  christos # undef freopen
    473  1.1  christos /* Assume freopen is always declared.  */
    474  1.1  christos _GL_WARN_ON_USE (freopen,
    475  1.1  christos                  "freopen on native Windows platforms is not POSIX compliant - "
    476  1.1  christos                  "use gnulib module freopen for portability");
    477  1.1  christos #endif
    478  1.1  christos 
    479  1.1  christos #if @GNULIB_FSCANF@
    480  1.1  christos # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
    481  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    482  1.1  christos #   undef fscanf
    483  1.1  christos #   define fscanf rpl_fscanf
    484  1.1  christos #  endif
    485  1.1  christos _GL_FUNCDECL_RPL (fscanf, int,
    486  1.1  christos                   (FILE *restrict stream, const char *restrict format, ...)
    487  1.1  christos                   _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3)
    488  1.1  christos                   _GL_ARG_NONNULL ((1, 2)));
    489  1.1  christos _GL_CXXALIAS_RPL (fscanf, int,
    490  1.1  christos                   (FILE *restrict stream, const char *restrict format, ...));
    491  1.1  christos # else
    492  1.1  christos _GL_CXXALIAS_SYS (fscanf, int,
    493  1.1  christos                   (FILE *restrict stream, const char *restrict format, ...));
    494  1.1  christos # endif
    495  1.1  christos # if __GLIBC__ >= 2
    496  1.1  christos _GL_CXXALIASWARN (fscanf);
    497  1.1  christos # endif
    498  1.1  christos #endif
    499  1.1  christos 
    500  1.1  christos 
    501  1.1  christos /* Set up the following warnings, based on which modules are in use.
    502  1.1  christos    GNU Coding Standards discourage the use of fseek, since it imposes
    503  1.1  christos    an arbitrary limitation on some 32-bit hosts.  Remember that the
    504  1.1  christos    fseek module depends on the fseeko module, so we only have three
    505  1.1  christos    cases to consider:
    506  1.1  christos 
    507  1.1  christos    1. The developer is not using either module.  Issue a warning under
    508  1.1  christos    GNULIB_POSIXCHECK for both functions, to remind them that both
    509  1.1  christos    functions have bugs on some systems.  _GL_NO_LARGE_FILES has no
    510  1.1  christos    impact on this warning.
    511  1.1  christos 
    512  1.1  christos    2. The developer is using both modules.  They may be unaware of the
    513  1.1  christos    arbitrary limitations of fseek, so issue a warning under
    514  1.1  christos    GNULIB_POSIXCHECK.  On the other hand, they may be using both
    515  1.1  christos    modules intentionally, so the developer can define
    516  1.1  christos    _GL_NO_LARGE_FILES in the compilation units where the use of fseek
    517  1.1  christos    is safe, to silence the warning.
    518  1.1  christos 
    519  1.1  christos    3. The developer is using the fseeko module, but not fseek.  Gnulib
    520  1.1  christos    guarantees that fseek will still work around platform bugs in that
    521  1.1  christos    case, but we presume that the developer is aware of the pitfalls of
    522  1.1  christos    fseek and was trying to avoid it, so issue a warning even when
    523  1.1  christos    GNULIB_POSIXCHECK is undefined.  Again, _GL_NO_LARGE_FILES can be
    524  1.1  christos    defined to silence the warning in particular compilation units.
    525  1.1  christos    In C++ compilations with GNULIB_NAMESPACE, in order to avoid that
    526  1.1  christos    fseek gets defined as a macro, it is recommended that the developer
    527  1.1  christos    uses the fseek module, even if he is not calling the fseek function.
    528  1.1  christos 
    529  1.1  christos    Most gnulib clients that perform stream operations should fall into
    530  1.1  christos    category 3.  */
    531  1.1  christos 
    532  1.1  christos #if @GNULIB_FSEEK@
    533  1.1  christos # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
    534  1.1  christos #  define _GL_FSEEK_WARN /* Category 2, above.  */
    535  1.1  christos #  undef fseek
    536  1.1  christos # endif
    537  1.1  christos # if @REPLACE_FSEEK@
    538  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    539  1.1  christos #   undef fseek
    540  1.1  christos #   define fseek rpl_fseek
    541  1.1  christos #  endif
    542  1.1  christos _GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence)
    543  1.1  christos                               _GL_ARG_NONNULL ((1)));
    544  1.1  christos _GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence));
    545  1.1  christos # else
    546  1.1  christos _GL_CXXALIAS_SYS (fseek, int, (FILE *fp, long offset, int whence));
    547  1.1  christos # endif
    548  1.1  christos # if __GLIBC__ >= 2
    549  1.1  christos _GL_CXXALIASWARN (fseek);
    550  1.1  christos # endif
    551  1.1  christos #endif
    552  1.1  christos 
    553  1.1  christos #if @GNULIB_FSEEKO@
    554  1.1  christos # if !@GNULIB_FSEEK@ && !defined _GL_NO_LARGE_FILES
    555  1.1  christos #  define _GL_FSEEK_WARN /* Category 3, above.  */
    556  1.1  christos #  undef fseek
    557  1.1  christos # endif
    558  1.1  christos # if @REPLACE_FSEEKO@
    559  1.1  christos /* Provide an fseeko function that is aware of a preceding fflush(), and which
    560  1.1  christos    detects pipes.  */
    561  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    562  1.1  christos #   undef fseeko
    563  1.1  christos #   define fseeko rpl_fseeko
    564  1.1  christos #  endif
    565  1.1  christos _GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)
    566  1.1  christos                                _GL_ARG_NONNULL ((1)));
    567  1.1  christos _GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence));
    568  1.1  christos # else
    569  1.1  christos #  if ! @HAVE_DECL_FSEEKO@
    570  1.1  christos _GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)
    571  1.1  christos                                _GL_ARG_NONNULL ((1)));
    572  1.1  christos #  endif
    573  1.1  christos _GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence));
    574  1.1  christos # endif
    575  1.1  christos _GL_CXXALIASWARN (fseeko);
    576  1.1  christos #elif defined GNULIB_POSIXCHECK
    577  1.1  christos # define _GL_FSEEK_WARN /* Category 1, above.  */
    578  1.1  christos # undef fseek
    579  1.1  christos # undef fseeko
    580  1.1  christos # if HAVE_RAW_DECL_FSEEKO
    581  1.1  christos _GL_WARN_ON_USE (fseeko, "fseeko is unportable - "
    582  1.1  christos                  "use gnulib module fseeko for portability");
    583  1.1  christos # endif
    584  1.1  christos #endif
    585  1.1  christos 
    586  1.1  christos #ifdef _GL_FSEEK_WARN
    587  1.1  christos # undef _GL_FSEEK_WARN
    588  1.1  christos /* Here, either fseek is undefined (but C89 guarantees that it is
    589  1.1  christos    declared), or it is defined as rpl_fseek (declared above).  */
    590  1.1  christos _GL_WARN_ON_USE (fseek, "fseek cannot handle files larger than 4 GB "
    591  1.1  christos                  "on 32-bit platforms - "
    592  1.1  christos                  "use fseeko function for handling of large files");
    593  1.1  christos #endif
    594  1.1  christos 
    595  1.1  christos 
    596  1.1  christos /* ftell, ftello.  See the comments on fseek/fseeko.  */
    597  1.1  christos 
    598  1.1  christos #if @GNULIB_FTELL@
    599  1.1  christos # if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES
    600  1.1  christos #  define _GL_FTELL_WARN /* Category 2, above.  */
    601  1.1  christos #  undef ftell
    602  1.1  christos # endif
    603  1.1  christos # if @REPLACE_FTELL@
    604  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    605  1.1  christos #   undef ftell
    606  1.1  christos #   define ftell rpl_ftell
    607  1.1  christos #  endif
    608  1.1  christos _GL_FUNCDECL_RPL (ftell, long, (FILE *fp) _GL_ARG_NONNULL ((1)));
    609  1.1  christos _GL_CXXALIAS_RPL (ftell, long, (FILE *fp));
    610  1.1  christos # else
    611  1.1  christos _GL_CXXALIAS_SYS (ftell, long, (FILE *fp));
    612  1.1  christos # endif
    613  1.1  christos # if __GLIBC__ >= 2
    614  1.1  christos _GL_CXXALIASWARN (ftell);
    615  1.1  christos # endif
    616  1.1  christos #endif
    617  1.1  christos 
    618  1.1  christos #if @GNULIB_FTELLO@
    619  1.1  christos # if !@GNULIB_FTELL@ && !defined _GL_NO_LARGE_FILES
    620  1.1  christos #  define _GL_FTELL_WARN /* Category 3, above.  */
    621  1.1  christos #  undef ftell
    622  1.1  christos # endif
    623  1.1  christos # if @REPLACE_FTELLO@
    624  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    625  1.1  christos #   undef ftello
    626  1.1  christos #   define ftello rpl_ftello
    627  1.1  christos #  endif
    628  1.1  christos _GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
    629  1.1  christos _GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp));
    630  1.1  christos # else
    631  1.1  christos #  if ! @HAVE_DECL_FTELLO@
    632  1.1  christos _GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1)));
    633  1.1  christos #  endif
    634  1.1  christos _GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp));
    635  1.1  christos # endif
    636  1.1  christos _GL_CXXALIASWARN (ftello);
    637  1.1  christos #elif defined GNULIB_POSIXCHECK
    638  1.1  christos # define _GL_FTELL_WARN /* Category 1, above.  */
    639  1.1  christos # undef ftell
    640  1.1  christos # undef ftello
    641  1.1  christos # if HAVE_RAW_DECL_FTELLO
    642  1.1  christos _GL_WARN_ON_USE (ftello, "ftello is unportable - "
    643  1.1  christos                  "use gnulib module ftello for portability");
    644  1.1  christos # endif
    645  1.1  christos #endif
    646  1.1  christos 
    647  1.1  christos #ifdef _GL_FTELL_WARN
    648  1.1  christos # undef _GL_FTELL_WARN
    649  1.1  christos /* Here, either ftell is undefined (but C89 guarantees that it is
    650  1.1  christos    declared), or it is defined as rpl_ftell (declared above).  */
    651  1.1  christos _GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB "
    652  1.1  christos                  "on 32-bit platforms - "
    653  1.1  christos                  "use ftello function for handling of large files");
    654  1.1  christos #endif
    655  1.1  christos 
    656  1.1  christos 
    657  1.1  christos #if @GNULIB_FWRITE@
    658  1.1  christos # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
    659  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    660  1.1  christos #   undef fwrite
    661  1.1  christos #   define fwrite rpl_fwrite
    662  1.1  christos #  endif
    663  1.1  christos _GL_FUNCDECL_RPL (fwrite, size_t,
    664  1.1  christos                   (const void *restrict ptr, size_t s, size_t n,
    665  1.1  christos                    FILE *restrict stream)
    666  1.1  christos                   _GL_ARG_NONNULL ((1, 4)));
    667  1.1  christos _GL_CXXALIAS_RPL (fwrite, size_t,
    668  1.1  christos                   (const void *restrict ptr, size_t s, size_t n,
    669  1.1  christos                    FILE *restrict stream));
    670  1.1  christos # else
    671  1.1  christos _GL_CXXALIAS_SYS (fwrite, size_t,
    672  1.1  christos                   (const void *restrict ptr, size_t s, size_t n,
    673  1.1  christos                    FILE *restrict stream));
    674  1.1  christos 
    675  1.1  christos /* Work around bug 11959 when fortifying glibc 2.4 through 2.15
    676  1.1  christos    <https://sourceware.org/bugzilla/show_bug.cgi?id=11959>,
    677  1.1  christos    which sometimes causes an unwanted diagnostic for fwrite calls.
    678  1.1  christos    This affects only function declaration attributes under certain
    679  1.1  christos    versions of gcc and clang, and is not needed for C++.  */
    680  1.1  christos #  if (0 < __USE_FORTIFY_LEVEL                                          \
    681  1.1  christos        && __GLIBC__ == 2 && 4 <= __GLIBC_MINOR__ && __GLIBC_MINOR__ <= 15 \
    682  1.1  christos        && 3 < __GNUC__ + (4 <= __GNUC_MINOR__)                          \
    683  1.1  christos        && !defined __cplusplus)
    684  1.1  christos #   undef fwrite
    685  1.1  christos #   undef fwrite_unlocked
    686  1.1  christos extern size_t __REDIRECT (rpl_fwrite,
    687  1.1  christos                           (const void *__restrict, size_t, size_t,
    688  1.1  christos                            FILE *__restrict),
    689  1.1  christos                           fwrite);
    690  1.1  christos extern size_t __REDIRECT (rpl_fwrite_unlocked,
    691  1.1  christos                           (const void *__restrict, size_t, size_t,
    692  1.1  christos                            FILE *__restrict),
    693  1.1  christos                           fwrite_unlocked);
    694  1.1  christos #   define fwrite rpl_fwrite
    695  1.1  christos #   define fwrite_unlocked rpl_fwrite_unlocked
    696  1.1  christos #  endif
    697  1.1  christos # endif
    698  1.1  christos # if __GLIBC__ >= 2
    699  1.1  christos _GL_CXXALIASWARN (fwrite);
    700  1.1  christos # endif
    701  1.1  christos #endif
    702  1.1  christos 
    703  1.1  christos #if @GNULIB_GETC@
    704  1.1  christos # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
    705  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    706  1.1  christos #   undef getc
    707  1.1  christos #   define getc rpl_fgetc
    708  1.1  christos #  endif
    709  1.1  christos _GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
    710  1.1  christos _GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream));
    711  1.1  christos # else
    712  1.1  christos _GL_CXXALIAS_SYS (getc, int, (FILE *stream));
    713  1.1  christos # endif
    714  1.1  christos # if __GLIBC__ >= 2
    715  1.1  christos _GL_CXXALIASWARN (getc);
    716  1.1  christos # endif
    717  1.1  christos #endif
    718  1.1  christos 
    719  1.1  christos #if @GNULIB_GETCHAR@
    720  1.1  christos # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
    721  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    722  1.1  christos #   undef getchar
    723  1.1  christos #   define getchar rpl_getchar
    724  1.1  christos #  endif
    725  1.1  christos _GL_FUNCDECL_RPL (getchar, int, (void));
    726  1.1  christos _GL_CXXALIAS_RPL (getchar, int, (void));
    727  1.1  christos # else
    728  1.1  christos _GL_CXXALIAS_SYS (getchar, int, (void));
    729  1.1  christos # endif
    730  1.1  christos # if __GLIBC__ >= 2
    731  1.1  christos _GL_CXXALIASWARN (getchar);
    732  1.1  christos # endif
    733  1.1  christos #endif
    734  1.1  christos 
    735  1.1  christos #if @GNULIB_GETDELIM@
    736  1.1  christos /* Read input, up to (and including) the next occurrence of DELIMITER, from
    737  1.1  christos    STREAM, store it in *LINEPTR (and NUL-terminate it).
    738  1.1  christos    *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
    739  1.1  christos    bytes of space.  It is realloc'd as necessary.
    740  1.1  christos    Return the number of bytes read and stored at *LINEPTR (not including the
    741  1.1  christos    NUL terminator), or -1 on error or EOF.  */
    742  1.1  christos # if @REPLACE_GETDELIM@
    743  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    744  1.1  christos #   undef getdelim
    745  1.1  christos #   define getdelim rpl_getdelim
    746  1.1  christos #  endif
    747  1.1  christos _GL_FUNCDECL_RPL (getdelim, ssize_t,
    748  1.1  christos                   (char **restrict lineptr, size_t *restrict linesize,
    749  1.1  christos                    int delimiter,
    750  1.1  christos                    FILE *restrict stream)
    751  1.1  christos                   _GL_ARG_NONNULL ((1, 2, 4)));
    752  1.1  christos _GL_CXXALIAS_RPL (getdelim, ssize_t,
    753  1.1  christos                   (char **restrict lineptr, size_t *restrict linesize,
    754  1.1  christos                    int delimiter,
    755  1.1  christos                    FILE *restrict stream));
    756  1.1  christos # else
    757  1.1  christos #  if !@HAVE_DECL_GETDELIM@
    758  1.1  christos _GL_FUNCDECL_SYS (getdelim, ssize_t,
    759  1.1  christos                   (char **restrict lineptr, size_t *restrict linesize,
    760  1.1  christos                    int delimiter,
    761  1.1  christos                    FILE *restrict stream)
    762  1.1  christos                   _GL_ARG_NONNULL ((1, 2, 4)));
    763  1.1  christos #  endif
    764  1.1  christos _GL_CXXALIAS_SYS (getdelim, ssize_t,
    765  1.1  christos                   (char **restrict lineptr, size_t *restrict linesize,
    766  1.1  christos                    int delimiter,
    767  1.1  christos                    FILE *restrict stream));
    768  1.1  christos # endif
    769  1.1  christos _GL_CXXALIASWARN (getdelim);
    770  1.1  christos #elif defined GNULIB_POSIXCHECK
    771  1.1  christos # undef getdelim
    772  1.1  christos # if HAVE_RAW_DECL_GETDELIM
    773  1.1  christos _GL_WARN_ON_USE (getdelim, "getdelim is unportable - "
    774  1.1  christos                  "use gnulib module getdelim for portability");
    775  1.1  christos # endif
    776  1.1  christos #endif
    777  1.1  christos 
    778  1.1  christos #if @GNULIB_GETLINE@
    779  1.1  christos /* Read a line, up to (and including) the next newline, from STREAM, store it
    780  1.1  christos    in *LINEPTR (and NUL-terminate it).
    781  1.1  christos    *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
    782  1.1  christos    bytes of space.  It is realloc'd as necessary.
    783  1.1  christos    Return the number of bytes read and stored at *LINEPTR (not including the
    784  1.1  christos    NUL terminator), or -1 on error or EOF.  */
    785  1.1  christos # if @REPLACE_GETLINE@
    786  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    787  1.1  christos #   undef getline
    788  1.1  christos #   define getline rpl_getline
    789  1.1  christos #  endif
    790  1.1  christos _GL_FUNCDECL_RPL (getline, ssize_t,
    791  1.1  christos                   (char **restrict lineptr, size_t *restrict linesize,
    792  1.1  christos                    FILE *restrict stream)
    793  1.1  christos                   _GL_ARG_NONNULL ((1, 2, 3)));
    794  1.1  christos _GL_CXXALIAS_RPL (getline, ssize_t,
    795  1.1  christos                   (char **restrict lineptr, size_t *restrict linesize,
    796  1.1  christos                    FILE *restrict stream));
    797  1.1  christos # else
    798  1.1  christos #  if !@HAVE_DECL_GETLINE@
    799  1.1  christos _GL_FUNCDECL_SYS (getline, ssize_t,
    800  1.1  christos                   (char **restrict lineptr, size_t *restrict linesize,
    801  1.1  christos                    FILE *restrict stream)
    802  1.1  christos                   _GL_ARG_NONNULL ((1, 2, 3)));
    803  1.1  christos #  endif
    804  1.1  christos _GL_CXXALIAS_SYS (getline, ssize_t,
    805  1.1  christos                   (char **restrict lineptr, size_t *restrict linesize,
    806  1.1  christos                    FILE *restrict stream));
    807  1.1  christos # endif
    808  1.1  christos # if @HAVE_DECL_GETLINE@
    809  1.1  christos _GL_CXXALIASWARN (getline);
    810  1.1  christos # endif
    811  1.1  christos #elif defined GNULIB_POSIXCHECK
    812  1.1  christos # undef getline
    813  1.1  christos # if HAVE_RAW_DECL_GETLINE
    814  1.1  christos _GL_WARN_ON_USE (getline, "getline is unportable - "
    815  1.1  christos                  "use gnulib module getline for portability");
    816  1.1  christos # endif
    817  1.1  christos #endif
    818  1.1  christos 
    819  1.1  christos /* It is very rare that the developer ever has full control of stdin,
    820  1.1  christos    so any use of gets warrants an unconditional warning; besides, C11
    821  1.1  christos    removed it.  */
    822  1.1  christos #undef gets
    823  1.1  christos #if HAVE_RAW_DECL_GETS && !defined __cplusplus
    824  1.1  christos _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
    825  1.1  christos #endif
    826  1.1  christos 
    827  1.1  christos #if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
    828  1.1  christos struct obstack;
    829  1.1  christos /* Grow an obstack with formatted output.  Return the number of
    830  1.1  christos    bytes added to OBS.  No trailing nul byte is added, and the
    831  1.1  christos    object should be closed with obstack_finish before use.  Upon
    832  1.1  christos    memory allocation error, call obstack_alloc_failed_handler.  Upon
    833  1.1  christos    other error, return -1.  */
    834  1.1  christos # if @REPLACE_OBSTACK_PRINTF@
    835  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    836  1.1  christos #   define obstack_printf rpl_obstack_printf
    837  1.1  christos #  endif
    838  1.1  christos _GL_FUNCDECL_RPL (obstack_printf, int,
    839  1.1  christos                   (struct obstack *obs, const char *format, ...)
    840  1.1  christos                   _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
    841  1.1  christos                   _GL_ARG_NONNULL ((1, 2)));
    842  1.1  christos _GL_CXXALIAS_RPL (obstack_printf, int,
    843  1.1  christos                   (struct obstack *obs, const char *format, ...));
    844  1.1  christos # else
    845  1.1  christos #  if !@HAVE_DECL_OBSTACK_PRINTF@
    846  1.1  christos _GL_FUNCDECL_SYS (obstack_printf, int,
    847  1.1  christos                   (struct obstack *obs, const char *format, ...)
    848  1.1  christos                   _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
    849  1.1  christos                   _GL_ARG_NONNULL ((1, 2)));
    850  1.1  christos #  endif
    851  1.1  christos _GL_CXXALIAS_SYS (obstack_printf, int,
    852  1.1  christos                   (struct obstack *obs, const char *format, ...));
    853  1.1  christos # endif
    854  1.1  christos _GL_CXXALIASWARN (obstack_printf);
    855  1.1  christos # if @REPLACE_OBSTACK_PRINTF@
    856  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    857  1.1  christos #   define obstack_vprintf rpl_obstack_vprintf
    858  1.1  christos #  endif
    859  1.1  christos _GL_FUNCDECL_RPL (obstack_vprintf, int,
    860  1.1  christos                   (struct obstack *obs, const char *format, va_list args)
    861  1.1  christos                   _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
    862  1.1  christos                   _GL_ARG_NONNULL ((1, 2)));
    863  1.1  christos _GL_CXXALIAS_RPL (obstack_vprintf, int,
    864  1.1  christos                   (struct obstack *obs, const char *format, va_list args));
    865  1.1  christos # else
    866  1.1  christos #  if !@HAVE_DECL_OBSTACK_PRINTF@
    867  1.1  christos _GL_FUNCDECL_SYS (obstack_vprintf, int,
    868  1.1  christos                   (struct obstack *obs, const char *format, va_list args)
    869  1.1  christos                   _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
    870  1.1  christos                   _GL_ARG_NONNULL ((1, 2)));
    871  1.1  christos #  endif
    872  1.1  christos _GL_CXXALIAS_SYS (obstack_vprintf, int,
    873  1.1  christos                   (struct obstack *obs, const char *format, va_list args));
    874  1.1  christos # endif
    875  1.1  christos _GL_CXXALIASWARN (obstack_vprintf);
    876  1.1  christos #endif
    877  1.1  christos 
    878  1.1  christos #if @GNULIB_PCLOSE@
    879  1.1  christos # if !@HAVE_PCLOSE@
    880  1.1  christos _GL_FUNCDECL_SYS (pclose, int, (FILE *stream) _GL_ARG_NONNULL ((1)));
    881  1.1  christos # endif
    882  1.1  christos _GL_CXXALIAS_SYS (pclose, int, (FILE *stream));
    883  1.1  christos _GL_CXXALIASWARN (pclose);
    884  1.1  christos #elif defined GNULIB_POSIXCHECK
    885  1.1  christos # undef pclose
    886  1.1  christos # if HAVE_RAW_DECL_PCLOSE
    887  1.1  christos _GL_WARN_ON_USE (pclose, "pclose is unportable - "
    888  1.1  christos                  "use gnulib module pclose for more portability");
    889  1.1  christos # endif
    890  1.1  christos #endif
    891  1.1  christos 
    892  1.1  christos #if @GNULIB_PERROR@
    893  1.1  christos /* Print a message to standard error, describing the value of ERRNO,
    894  1.1  christos    (if STRING is not NULL and not empty) prefixed with STRING and ": ",
    895  1.1  christos    and terminated with a newline.  */
    896  1.1  christos # if @REPLACE_PERROR@
    897  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    898  1.1  christos #   define perror rpl_perror
    899  1.1  christos #  endif
    900  1.1  christos _GL_FUNCDECL_RPL (perror, void, (const char *string));
    901  1.1  christos _GL_CXXALIAS_RPL (perror, void, (const char *string));
    902  1.1  christos # else
    903  1.1  christos _GL_CXXALIAS_SYS (perror, void, (const char *string));
    904  1.1  christos # endif
    905  1.1  christos # if __GLIBC__ >= 2
    906  1.1  christos _GL_CXXALIASWARN (perror);
    907  1.1  christos # endif
    908  1.1  christos #elif defined GNULIB_POSIXCHECK
    909  1.1  christos # undef perror
    910  1.1  christos /* Assume perror is always declared.  */
    911  1.1  christos _GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - "
    912  1.1  christos                  "use gnulib module perror for portability");
    913  1.1  christos #endif
    914  1.1  christos 
    915  1.1  christos #if @GNULIB_POPEN@
    916  1.1  christos # if @REPLACE_POPEN@
    917  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    918  1.1  christos #   undef popen
    919  1.1  christos #   define popen rpl_popen
    920  1.1  christos #  endif
    921  1.1  christos _GL_FUNCDECL_RPL (popen, FILE *, (const char *cmd, const char *mode)
    922  1.1  christos                                  _GL_ARG_NONNULL ((1, 2)));
    923  1.1  christos _GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode));
    924  1.1  christos # else
    925  1.1  christos #  if !@HAVE_POPEN@
    926  1.1  christos _GL_FUNCDECL_SYS (popen, FILE *, (const char *cmd, const char *mode)
    927  1.1  christos                                  _GL_ARG_NONNULL ((1, 2)));
    928  1.1  christos #  endif
    929  1.1  christos _GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode));
    930  1.1  christos # endif
    931  1.1  christos _GL_CXXALIASWARN (popen);
    932  1.1  christos #elif defined GNULIB_POSIXCHECK
    933  1.1  christos # undef popen
    934  1.1  christos # if HAVE_RAW_DECL_POPEN
    935  1.1  christos _GL_WARN_ON_USE (popen, "popen is buggy on some platforms - "
    936  1.1  christos                  "use gnulib module popen or pipe for more portability");
    937  1.1  christos # endif
    938  1.1  christos #endif
    939  1.1  christos 
    940  1.1  christos #if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@
    941  1.1  christos # if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \
    942  1.1  christos      || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
    943  1.1  christos #  if defined __GNUC__
    944  1.1  christos #   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    945  1.1  christos /* Don't break __attribute__((format(printf,M,N))).  */
    946  1.1  christos #    define printf __printf__
    947  1.1  christos #   endif
    948  1.1  christos #   if @GNULIB_PRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
    949  1.1  christos _GL_FUNCDECL_RPL_1 (__printf__, int,
    950  1.1  christos                     (const char *restrict format, ...)
    951  1.1  christos                     __asm__ (@ASM_SYMBOL_PREFIX@
    952  1.1  christos                              _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
    953  1.1  christos                     _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2)
    954  1.1  christos                     _GL_ARG_NONNULL ((1)));
    955  1.1  christos #   else
    956  1.1  christos _GL_FUNCDECL_RPL_1 (__printf__, int,
    957  1.1  christos                     (const char *restrict format, ...)
    958  1.1  christos                     __asm__ (@ASM_SYMBOL_PREFIX@
    959  1.1  christos                              _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf))
    960  1.1  christos                     _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2)
    961  1.1  christos                     _GL_ARG_NONNULL ((1)));
    962  1.1  christos #   endif
    963  1.1  christos _GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...));
    964  1.1  christos #  else
    965  1.1  christos #   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    966  1.1  christos #    define printf rpl_printf
    967  1.1  christos #   endif
    968  1.1  christos _GL_FUNCDECL_RPL (printf, int,
    969  1.1  christos                   (const char *restrict format, ...)
    970  1.1  christos                   _GL_ATTRIBUTE_FORMAT_PRINTF (1, 2)
    971  1.1  christos                   _GL_ARG_NONNULL ((1)));
    972  1.1  christos _GL_CXXALIAS_RPL (printf, int, (const char *restrict format, ...));
    973  1.1  christos #  endif
    974  1.1  christos #  define GNULIB_overrides_printf 1
    975  1.1  christos # else
    976  1.1  christos _GL_CXXALIAS_SYS (printf, int, (const char *restrict format, ...));
    977  1.1  christos # endif
    978  1.1  christos # if __GLIBC__ >= 2
    979  1.1  christos _GL_CXXALIASWARN (printf);
    980  1.1  christos # endif
    981  1.1  christos #endif
    982  1.1  christos #if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK
    983  1.1  christos # if !GNULIB_overrides_printf
    984  1.1  christos #  undef printf
    985  1.1  christos # endif
    986  1.1  christos /* Assume printf is always declared.  */
    987  1.1  christos _GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - "
    988  1.1  christos                  "use gnulib module printf-posix for portable "
    989  1.1  christos                  "POSIX compliance");
    990  1.1  christos #endif
    991  1.1  christos 
    992  1.1  christos #if @GNULIB_PUTC@
    993  1.1  christos # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
    994  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    995  1.1  christos #   undef putc
    996  1.1  christos #   define putc rpl_fputc
    997  1.1  christos #  endif
    998  1.1  christos _GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2)));
    999  1.1  christos _GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream));
   1000  1.1  christos # else
   1001  1.1  christos _GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream));
   1002  1.1  christos # endif
   1003  1.1  christos # if __GLIBC__ >= 2
   1004  1.1  christos _GL_CXXALIASWARN (putc);
   1005  1.1  christos # endif
   1006  1.1  christos #endif
   1007  1.1  christos 
   1008  1.1  christos #if @GNULIB_PUTCHAR@
   1009  1.1  christos # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
   1010  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1011  1.1  christos #   undef putchar
   1012  1.1  christos #   define putchar rpl_putchar
   1013  1.1  christos #  endif
   1014  1.1  christos _GL_FUNCDECL_RPL (putchar, int, (int c));
   1015  1.1  christos _GL_CXXALIAS_RPL (putchar, int, (int c));
   1016  1.1  christos # else
   1017  1.1  christos _GL_CXXALIAS_SYS (putchar, int, (int c));
   1018  1.1  christos # endif
   1019  1.1  christos # if __GLIBC__ >= 2
   1020  1.1  christos _GL_CXXALIASWARN (putchar);
   1021  1.1  christos # endif
   1022  1.1  christos #endif
   1023  1.1  christos 
   1024  1.1  christos #if @GNULIB_PUTS@
   1025  1.1  christos # if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)
   1026  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1027  1.1  christos #   undef puts
   1028  1.1  christos #   define puts rpl_puts
   1029  1.1  christos #  endif
   1030  1.1  christos _GL_FUNCDECL_RPL (puts, int, (const char *string) _GL_ARG_NONNULL ((1)));
   1031  1.1  christos _GL_CXXALIAS_RPL (puts, int, (const char *string));
   1032  1.1  christos # else
   1033  1.1  christos _GL_CXXALIAS_SYS (puts, int, (const char *string));
   1034  1.1  christos # endif
   1035  1.1  christos # if __GLIBC__ >= 2
   1036  1.1  christos _GL_CXXALIASWARN (puts);
   1037  1.1  christos # endif
   1038  1.1  christos #endif
   1039  1.1  christos 
   1040  1.1  christos #if @GNULIB_REMOVE@
   1041  1.1  christos # if @REPLACE_REMOVE@
   1042  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1043  1.1  christos #   undef remove
   1044  1.1  christos #   define remove rpl_remove
   1045  1.1  christos #  endif
   1046  1.1  christos _GL_FUNCDECL_RPL (remove, int, (const char *name) _GL_ARG_NONNULL ((1)));
   1047  1.1  christos _GL_CXXALIAS_RPL (remove, int, (const char *name));
   1048  1.1  christos # else
   1049  1.1  christos _GL_CXXALIAS_SYS (remove, int, (const char *name));
   1050  1.1  christos # endif
   1051  1.1  christos # if __GLIBC__ >= 2
   1052  1.1  christos _GL_CXXALIASWARN (remove);
   1053  1.1  christos # endif
   1054  1.1  christos #elif defined GNULIB_POSIXCHECK
   1055  1.1  christos # undef remove
   1056  1.1  christos /* Assume remove is always declared.  */
   1057  1.1  christos _GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - "
   1058  1.1  christos                  "use gnulib module remove for more portability");
   1059  1.1  christos #endif
   1060  1.1  christos 
   1061  1.1  christos #if @GNULIB_RENAME@
   1062  1.1  christos # if @REPLACE_RENAME@
   1063  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1064  1.1  christos #   undef rename
   1065  1.1  christos #   define rename rpl_rename
   1066  1.1  christos #  endif
   1067  1.1  christos _GL_FUNCDECL_RPL (rename, int,
   1068  1.1  christos                   (const char *old_filename, const char *new_filename)
   1069  1.1  christos                   _GL_ARG_NONNULL ((1, 2)));
   1070  1.1  christos _GL_CXXALIAS_RPL (rename, int,
   1071  1.1  christos                   (const char *old_filename, const char *new_filename));
   1072  1.1  christos # else
   1073  1.1  christos _GL_CXXALIAS_SYS (rename, int,
   1074  1.1  christos                   (const char *old_filename, const char *new_filename));
   1075  1.1  christos # endif
   1076  1.1  christos # if __GLIBC__ >= 2
   1077  1.1  christos _GL_CXXALIASWARN (rename);
   1078  1.1  christos # endif
   1079  1.1  christos #elif defined GNULIB_POSIXCHECK
   1080  1.1  christos # undef rename
   1081  1.1  christos /* Assume rename is always declared.  */
   1082  1.1  christos _GL_WARN_ON_USE (rename, "rename is buggy on some platforms - "
   1083  1.1  christos                  "use gnulib module rename for more portability");
   1084  1.1  christos #endif
   1085  1.1  christos 
   1086  1.1  christos #if @GNULIB_RENAMEAT@
   1087  1.1  christos # if @REPLACE_RENAMEAT@
   1088  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1089  1.1  christos #   undef renameat
   1090  1.1  christos #   define renameat rpl_renameat
   1091  1.1  christos #  endif
   1092  1.1  christos _GL_FUNCDECL_RPL (renameat, int,
   1093  1.1  christos                   (int fd1, char const *file1, int fd2, char const *file2)
   1094  1.1  christos                   _GL_ARG_NONNULL ((2, 4)));
   1095  1.1  christos _GL_CXXALIAS_RPL (renameat, int,
   1096  1.1  christos                   (int fd1, char const *file1, int fd2, char const *file2));
   1097  1.1  christos # else
   1098  1.1  christos #  if !@HAVE_RENAMEAT@
   1099  1.1  christos _GL_FUNCDECL_SYS (renameat, int,
   1100  1.1  christos                   (int fd1, char const *file1, int fd2, char const *file2)
   1101  1.1  christos                   _GL_ARG_NONNULL ((2, 4)));
   1102  1.1  christos #  endif
   1103  1.1  christos _GL_CXXALIAS_SYS (renameat, int,
   1104  1.1  christos                   (int fd1, char const *file1, int fd2, char const *file2));
   1105  1.1  christos # endif
   1106  1.1  christos _GL_CXXALIASWARN (renameat);
   1107  1.1  christos #elif defined GNULIB_POSIXCHECK
   1108  1.1  christos # undef renameat
   1109  1.1  christos # if HAVE_RAW_DECL_RENAMEAT
   1110  1.1  christos _GL_WARN_ON_USE (renameat, "renameat is not portable - "
   1111  1.1  christos                  "use gnulib module renameat for portability");
   1112  1.1  christos # endif
   1113  1.1  christos #endif
   1114  1.1  christos 
   1115  1.1  christos #if @GNULIB_SCANF@
   1116  1.1  christos # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
   1117  1.1  christos #  if defined __GNUC__
   1118  1.1  christos #   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1119  1.1  christos #    undef scanf
   1120  1.1  christos /* Don't break __attribute__((format(scanf,M,N))).  */
   1121  1.1  christos #    define scanf __scanf__
   1122  1.1  christos #   endif
   1123  1.1  christos _GL_FUNCDECL_RPL_1 (__scanf__, int,
   1124  1.1  christos                     (const char *restrict format, ...)
   1125  1.1  christos                     __asm__ (@ASM_SYMBOL_PREFIX@
   1126  1.1  christos                              _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf))
   1127  1.1  christos                     _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
   1128  1.1  christos                     _GL_ARG_NONNULL ((1)));
   1129  1.1  christos _GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *restrict format, ...));
   1130  1.1  christos #  else
   1131  1.1  christos #   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1132  1.1  christos #    undef scanf
   1133  1.1  christos #    define scanf rpl_scanf
   1134  1.1  christos #   endif
   1135  1.1  christos _GL_FUNCDECL_RPL (scanf, int, (const char *restrict format, ...)
   1136  1.1  christos                               _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2)
   1137  1.1  christos                               _GL_ARG_NONNULL ((1)));
   1138  1.1  christos _GL_CXXALIAS_RPL (scanf, int, (const char *restrict format, ...));
   1139  1.1  christos #  endif
   1140  1.1  christos # else
   1141  1.1  christos _GL_CXXALIAS_SYS (scanf, int, (const char *restrict format, ...));
   1142  1.1  christos # endif
   1143  1.1  christos # if __GLIBC__ >= 2
   1144  1.1  christos _GL_CXXALIASWARN (scanf);
   1145  1.1  christos # endif
   1146  1.1  christos #endif
   1147  1.1  christos 
   1148  1.1  christos #if @GNULIB_SNPRINTF@
   1149  1.1  christos # if @REPLACE_SNPRINTF@
   1150  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1151  1.1  christos #   define snprintf rpl_snprintf
   1152  1.1  christos #  endif
   1153  1.1  christos _GL_FUNCDECL_RPL (snprintf, int,
   1154  1.1  christos                   (char *restrict str, size_t size,
   1155  1.1  christos                    const char *restrict format, ...)
   1156  1.1  christos                   _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4)
   1157  1.1  christos                   _GL_ARG_NONNULL ((3)));
   1158  1.1  christos _GL_CXXALIAS_RPL (snprintf, int,
   1159  1.1  christos                   (char *restrict str, size_t size,
   1160  1.1  christos                    const char *restrict format, ...));
   1161  1.1  christos # else
   1162  1.1  christos #  if !@HAVE_DECL_SNPRINTF@
   1163  1.1  christos _GL_FUNCDECL_SYS (snprintf, int,
   1164  1.1  christos                   (char *restrict str, size_t size,
   1165  1.1  christos                    const char *restrict format, ...)
   1166  1.1  christos                   _GL_ATTRIBUTE_FORMAT_PRINTF (3, 4)
   1167  1.1  christos                   _GL_ARG_NONNULL ((3)));
   1168  1.1  christos #  endif
   1169  1.1  christos _GL_CXXALIAS_SYS (snprintf, int,
   1170  1.1  christos                   (char *restrict str, size_t size,
   1171  1.1  christos                    const char *restrict format, ...));
   1172  1.1  christos # endif
   1173  1.1  christos _GL_CXXALIASWARN (snprintf);
   1174  1.1  christos #elif defined GNULIB_POSIXCHECK
   1175  1.1  christos # undef snprintf
   1176  1.1  christos # if HAVE_RAW_DECL_SNPRINTF
   1177  1.1  christos _GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
   1178  1.1  christos                  "use gnulib module snprintf for portability");
   1179  1.1  christos # endif
   1180  1.1  christos #endif
   1181  1.1  christos 
   1182  1.1  christos /* Some people would argue that all sprintf uses should be warned about
   1183  1.1  christos    (for example, OpenBSD issues a link warning for it),
   1184  1.1  christos    since it can cause security holes due to buffer overruns.
   1185  1.1  christos    However, we believe that sprintf can be used safely, and is more
   1186  1.1  christos    efficient than snprintf in those safe cases; and as proof of our
   1187  1.1  christos    belief, we use sprintf in several gnulib modules.  So this header
   1188  1.1  christos    intentionally avoids adding a warning to sprintf except when
   1189  1.1  christos    GNULIB_POSIXCHECK is defined.  */
   1190  1.1  christos 
   1191  1.1  christos #if @GNULIB_SPRINTF_POSIX@
   1192  1.1  christos # if @REPLACE_SPRINTF@
   1193  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1194  1.1  christos #   define sprintf rpl_sprintf
   1195  1.1  christos #  endif
   1196  1.1  christos _GL_FUNCDECL_RPL (sprintf, int,
   1197  1.1  christos                   (char *restrict str, const char *restrict format, ...)
   1198  1.1  christos                   _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
   1199  1.1  christos                   _GL_ARG_NONNULL ((1, 2)));
   1200  1.1  christos _GL_CXXALIAS_RPL (sprintf, int,
   1201  1.1  christos                   (char *restrict str, const char *restrict format, ...));
   1202  1.1  christos # else
   1203  1.1  christos _GL_CXXALIAS_SYS (sprintf, int,
   1204  1.1  christos                   (char *restrict str, const char *restrict format, ...));
   1205  1.1  christos # endif
   1206  1.1  christos # if __GLIBC__ >= 2
   1207  1.1  christos _GL_CXXALIASWARN (sprintf);
   1208  1.1  christos # endif
   1209  1.1  christos #elif defined GNULIB_POSIXCHECK
   1210  1.1  christos # undef sprintf
   1211  1.1  christos /* Assume sprintf is always declared.  */
   1212  1.1  christos _GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - "
   1213  1.1  christos                  "use gnulib module sprintf-posix for portable "
   1214  1.1  christos                  "POSIX compliance");
   1215  1.1  christos #endif
   1216  1.1  christos 
   1217  1.1  christos #if @GNULIB_TMPFILE@
   1218  1.1  christos # if @REPLACE_TMPFILE@
   1219  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1220  1.1  christos #   define tmpfile rpl_tmpfile
   1221  1.1  christos #  endif
   1222  1.1  christos _GL_FUNCDECL_RPL (tmpfile, FILE *, (void));
   1223  1.1  christos _GL_CXXALIAS_RPL (tmpfile, FILE *, (void));
   1224  1.1  christos # else
   1225  1.1  christos _GL_CXXALIAS_SYS (tmpfile, FILE *, (void));
   1226  1.1  christos # endif
   1227  1.1  christos # if __GLIBC__ >= 2
   1228  1.1  christos _GL_CXXALIASWARN (tmpfile);
   1229  1.1  christos # endif
   1230  1.1  christos #elif defined GNULIB_POSIXCHECK
   1231  1.1  christos # undef tmpfile
   1232  1.1  christos # if HAVE_RAW_DECL_TMPFILE
   1233  1.1  christos _GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - "
   1234  1.1  christos                  "use gnulib module tmpfile for portability");
   1235  1.1  christos # endif
   1236  1.1  christos #endif
   1237  1.1  christos 
   1238  1.1  christos #if @GNULIB_VASPRINTF@
   1239  1.1  christos /* Write formatted output to a string dynamically allocated with malloc().
   1240  1.1  christos    If the memory allocation succeeds, store the address of the string in
   1241  1.1  christos    *RESULT and return the number of resulting bytes, excluding the trailing
   1242  1.1  christos    NUL.  Upon memory allocation error, or some other error, return -1.  */
   1243  1.1  christos # if @REPLACE_VASPRINTF@
   1244  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1245  1.1  christos #   define asprintf rpl_asprintf
   1246  1.1  christos #  endif
   1247  1.1  christos _GL_FUNCDECL_RPL (asprintf, int,
   1248  1.1  christos                   (char **result, const char *format, ...)
   1249  1.1  christos                   _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
   1250  1.1  christos                   _GL_ARG_NONNULL ((1, 2)));
   1251  1.1  christos _GL_CXXALIAS_RPL (asprintf, int,
   1252  1.1  christos                   (char **result, const char *format, ...));
   1253  1.1  christos # else
   1254  1.1  christos #  if !@HAVE_VASPRINTF@
   1255  1.1  christos _GL_FUNCDECL_SYS (asprintf, int,
   1256  1.1  christos                   (char **result, const char *format, ...)
   1257  1.1  christos                   _GL_ATTRIBUTE_FORMAT_PRINTF (2, 3)
   1258  1.1  christos                   _GL_ARG_NONNULL ((1, 2)));
   1259  1.1  christos #  endif
   1260  1.1  christos _GL_CXXALIAS_SYS (asprintf, int,
   1261  1.1  christos                   (char **result, const char *format, ...));
   1262  1.1  christos # endif
   1263  1.1  christos _GL_CXXALIASWARN (asprintf);
   1264  1.1  christos # if @REPLACE_VASPRINTF@
   1265  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1266  1.1  christos #   define vasprintf rpl_vasprintf
   1267  1.1  christos #  endif
   1268  1.1  christos _GL_FUNCDECL_RPL (vasprintf, int,
   1269  1.1  christos                   (char **result, const char *format, va_list args)
   1270  1.1  christos                   _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
   1271  1.1  christos                   _GL_ARG_NONNULL ((1, 2)));
   1272  1.1  christos _GL_CXXALIAS_RPL (vasprintf, int,
   1273  1.1  christos                   (char **result, const char *format, va_list args));
   1274  1.1  christos # else
   1275  1.1  christos #  if !@HAVE_VASPRINTF@
   1276  1.1  christos _GL_FUNCDECL_SYS (vasprintf, int,
   1277  1.1  christos                   (char **result, const char *format, va_list args)
   1278  1.1  christos                   _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
   1279  1.1  christos                   _GL_ARG_NONNULL ((1, 2)));
   1280  1.1  christos #  endif
   1281  1.1  christos _GL_CXXALIAS_SYS (vasprintf, int,
   1282  1.1  christos                   (char **result, const char *format, va_list args));
   1283  1.1  christos # endif
   1284  1.1  christos _GL_CXXALIASWARN (vasprintf);
   1285  1.1  christos #endif
   1286  1.1  christos 
   1287  1.1  christos #if @GNULIB_VDPRINTF@
   1288  1.1  christos # if @REPLACE_VDPRINTF@
   1289  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1290  1.1  christos #   define vdprintf rpl_vdprintf
   1291  1.1  christos #  endif
   1292  1.1  christos _GL_FUNCDECL_RPL (vdprintf, int,
   1293  1.1  christos                   (int fd, const char *restrict format, va_list args)
   1294  1.1  christos                   _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
   1295  1.1  christos                   _GL_ARG_NONNULL ((2)));
   1296  1.1  christos _GL_CXXALIAS_RPL (vdprintf, int,
   1297  1.1  christos                   (int fd, const char *restrict format, va_list args));
   1298  1.1  christos # else
   1299  1.1  christos #  if !@HAVE_VDPRINTF@
   1300  1.1  christos _GL_FUNCDECL_SYS (vdprintf, int,
   1301  1.1  christos                   (int fd, const char *restrict format, va_list args)
   1302  1.1  christos                   _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
   1303  1.1  christos                   _GL_ARG_NONNULL ((2)));
   1304  1.1  christos #  endif
   1305  1.1  christos /* Need to cast, because on Solaris, the third parameter will likely be
   1306  1.1  christos                                                     __va_list args.  */
   1307  1.1  christos _GL_CXXALIAS_SYS_CAST (vdprintf, int,
   1308  1.1  christos                        (int fd, const char *restrict format, va_list args));
   1309  1.1  christos # endif
   1310  1.1  christos # if __GLIBC__ >= 2
   1311  1.1  christos _GL_CXXALIASWARN (vdprintf);
   1312  1.1  christos # endif
   1313  1.1  christos #elif defined GNULIB_POSIXCHECK
   1314  1.1  christos # undef vdprintf
   1315  1.1  christos # if HAVE_RAW_DECL_VDPRINTF
   1316  1.1  christos _GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - "
   1317  1.1  christos                  "use gnulib module vdprintf for portability");
   1318  1.1  christos # endif
   1319  1.1  christos #endif
   1320  1.1  christos 
   1321  1.1  christos #if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@
   1322  1.1  christos # if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \
   1323  1.1  christos      || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
   1324  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1325  1.1  christos #   define vfprintf rpl_vfprintf
   1326  1.1  christos #  endif
   1327  1.1  christos #  define GNULIB_overrides_vfprintf 1
   1328  1.1  christos #  if @GNULIB_VFPRINTF_POSIX@
   1329  1.1  christos _GL_FUNCDECL_RPL (vfprintf, int,
   1330  1.1  christos                   (FILE *restrict fp,
   1331  1.1  christos                    const char *restrict format, va_list args)
   1332  1.1  christos                   _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
   1333  1.1  christos                   _GL_ARG_NONNULL ((1, 2)));
   1334  1.1  christos #  else
   1335  1.1  christos _GL_FUNCDECL_RPL (vfprintf, int,
   1336  1.1  christos                   (FILE *restrict fp,
   1337  1.1  christos                    const char *restrict format, va_list args)
   1338  1.1  christos                   _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0)
   1339  1.1  christos                   _GL_ARG_NONNULL ((1, 2)));
   1340  1.1  christos #  endif
   1341  1.1  christos _GL_CXXALIAS_RPL (vfprintf, int,
   1342  1.1  christos                   (FILE *restrict fp,
   1343  1.1  christos                    const char *restrict format, va_list args));
   1344  1.1  christos # else
   1345  1.1  christos /* Need to cast, because on Solaris, the third parameter is
   1346  1.1  christos                                                       __va_list args
   1347  1.1  christos    and GCC's fixincludes did not change this to __gnuc_va_list.  */
   1348  1.1  christos _GL_CXXALIAS_SYS_CAST (vfprintf, int,
   1349  1.1  christos                        (FILE *restrict fp,
   1350  1.1  christos                         const char *restrict format, va_list args));
   1351  1.1  christos # endif
   1352  1.1  christos # if __GLIBC__ >= 2
   1353  1.1  christos _GL_CXXALIASWARN (vfprintf);
   1354  1.1  christos # endif
   1355  1.1  christos #endif
   1356  1.1  christos #if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
   1357  1.1  christos # if !GNULIB_overrides_vfprintf
   1358  1.1  christos #  undef vfprintf
   1359  1.1  christos # endif
   1360  1.1  christos /* Assume vfprintf is always declared.  */
   1361  1.1  christos _GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - "
   1362  1.1  christos                  "use gnulib module vfprintf-posix for portable "
   1363  1.1  christos                       "POSIX compliance");
   1364  1.1  christos #endif
   1365  1.1  christos 
   1366  1.1  christos #if @GNULIB_VFSCANF@
   1367  1.1  christos # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
   1368  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1369  1.1  christos #   undef vfscanf
   1370  1.1  christos #   define vfscanf rpl_vfscanf
   1371  1.1  christos #  endif
   1372  1.1  christos _GL_FUNCDECL_RPL (vfscanf, int,
   1373  1.1  christos                   (FILE *restrict stream,
   1374  1.1  christos                    const char *restrict format, va_list args)
   1375  1.1  christos                   _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0)
   1376  1.1  christos                   _GL_ARG_NONNULL ((1, 2)));
   1377  1.1  christos _GL_CXXALIAS_RPL (vfscanf, int,
   1378  1.1  christos                   (FILE *restrict stream,
   1379  1.1  christos                    const char *restrict format, va_list args));
   1380  1.1  christos # else
   1381  1.1  christos _GL_CXXALIAS_SYS (vfscanf, int,
   1382  1.1  christos                   (FILE *restrict stream,
   1383  1.1  christos                    const char *restrict format, va_list args));
   1384  1.1  christos # endif
   1385  1.1  christos _GL_CXXALIASWARN (vfscanf);
   1386  1.1  christos #endif
   1387  1.1  christos 
   1388  1.1  christos #if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@
   1389  1.1  christos # if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \
   1390  1.1  christos      || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
   1391  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1392  1.1  christos #   define vprintf rpl_vprintf
   1393  1.1  christos #  endif
   1394  1.1  christos #  define GNULIB_overrides_vprintf 1
   1395  1.1  christos #  if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
   1396  1.1  christos _GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args)
   1397  1.1  christos                                 _GL_ATTRIBUTE_FORMAT_PRINTF (1, 0)
   1398  1.1  christos                                 _GL_ARG_NONNULL ((1)));
   1399  1.1  christos #  else
   1400  1.1  christos _GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args)
   1401  1.1  christos                                 _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0)
   1402  1.1  christos                                 _GL_ARG_NONNULL ((1)));
   1403  1.1  christos #  endif
   1404  1.1  christos _GL_CXXALIAS_RPL (vprintf, int, (const char *restrict format, va_list args));
   1405  1.1  christos # else
   1406  1.1  christos /* Need to cast, because on Solaris, the second parameter is
   1407  1.1  christos                                                           __va_list args
   1408  1.1  christos    and GCC's fixincludes did not change this to __gnuc_va_list.  */
   1409  1.1  christos _GL_CXXALIAS_SYS_CAST (vprintf, int,
   1410  1.1  christos                        (const char *restrict format, va_list args));
   1411  1.1  christos # endif
   1412  1.1  christos # if __GLIBC__ >= 2
   1413  1.1  christos _GL_CXXALIASWARN (vprintf);
   1414  1.1  christos # endif
   1415  1.1  christos #endif
   1416  1.1  christos #if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK
   1417  1.1  christos # if !GNULIB_overrides_vprintf
   1418  1.1  christos #  undef vprintf
   1419  1.1  christos # endif
   1420  1.1  christos /* Assume vprintf is always declared.  */
   1421  1.1  christos _GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - "
   1422  1.1  christos                  "use gnulib module vprintf-posix for portable "
   1423  1.1  christos                  "POSIX compliance");
   1424  1.1  christos #endif
   1425  1.1  christos 
   1426  1.1  christos #if @GNULIB_VSCANF@
   1427  1.1  christos # if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
   1428  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1429  1.1  christos #   undef vscanf
   1430  1.1  christos #   define vscanf rpl_vscanf
   1431  1.1  christos #  endif
   1432  1.1  christos _GL_FUNCDECL_RPL (vscanf, int, (const char *restrict format, va_list args)
   1433  1.1  christos                                _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0)
   1434  1.1  christos                                _GL_ARG_NONNULL ((1)));
   1435  1.1  christos _GL_CXXALIAS_RPL (vscanf, int, (const char *restrict format, va_list args));
   1436  1.1  christos # else
   1437  1.1  christos _GL_CXXALIAS_SYS (vscanf, int, (const char *restrict format, va_list args));
   1438  1.1  christos # endif
   1439  1.1  christos _GL_CXXALIASWARN (vscanf);
   1440  1.1  christos #endif
   1441  1.1  christos 
   1442  1.1  christos #if @GNULIB_VSNPRINTF@
   1443  1.1  christos # if @REPLACE_VSNPRINTF@
   1444  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1445  1.1  christos #   define vsnprintf rpl_vsnprintf
   1446  1.1  christos #  endif
   1447  1.1  christos _GL_FUNCDECL_RPL (vsnprintf, int,
   1448  1.1  christos                   (char *restrict str, size_t size,
   1449  1.1  christos                    const char *restrict format, va_list args)
   1450  1.1  christos                   _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0)
   1451  1.1  christos                   _GL_ARG_NONNULL ((3)));
   1452  1.1  christos _GL_CXXALIAS_RPL (vsnprintf, int,
   1453  1.1  christos                   (char *restrict str, size_t size,
   1454  1.1  christos                    const char *restrict format, va_list args));
   1455  1.1  christos # else
   1456  1.1  christos #  if !@HAVE_DECL_VSNPRINTF@
   1457  1.1  christos _GL_FUNCDECL_SYS (vsnprintf, int,
   1458  1.1  christos                   (char *restrict str, size_t size,
   1459  1.1  christos                    const char *restrict format, va_list args)
   1460  1.1  christos                   _GL_ATTRIBUTE_FORMAT_PRINTF (3, 0)
   1461  1.1  christos                   _GL_ARG_NONNULL ((3)));
   1462  1.1  christos #  endif
   1463  1.1  christos _GL_CXXALIAS_SYS (vsnprintf, int,
   1464  1.1  christos                   (char *restrict str, size_t size,
   1465  1.1  christos                    const char *restrict format, va_list args));
   1466  1.1  christos # endif
   1467  1.1  christos _GL_CXXALIASWARN (vsnprintf);
   1468  1.1  christos #elif defined GNULIB_POSIXCHECK
   1469  1.1  christos # undef vsnprintf
   1470  1.1  christos # if HAVE_RAW_DECL_VSNPRINTF
   1471  1.1  christos _GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - "
   1472  1.1  christos                  "use gnulib module vsnprintf for portability");
   1473  1.1  christos # endif
   1474  1.1  christos #endif
   1475  1.1  christos 
   1476  1.1  christos #if @GNULIB_VSPRINTF_POSIX@
   1477  1.1  christos # if @REPLACE_VSPRINTF@
   1478  1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1479  1.1  christos #   define vsprintf rpl_vsprintf
   1480  1.1  christos #  endif
   1481  1.1  christos _GL_FUNCDECL_RPL (vsprintf, int,
   1482  1.1  christos                   (char *restrict str,
   1483  1.1  christos                    const char *restrict format, va_list args)
   1484  1.1  christos                   _GL_ATTRIBUTE_FORMAT_PRINTF (2, 0)
   1485  1.1  christos                   _GL_ARG_NONNULL ((1, 2)));
   1486  1.1  christos _GL_CXXALIAS_RPL (vsprintf, int,
   1487  1.1  christos                   (char *restrict str,
   1488  1.1  christos                    const char *restrict format, va_list args));
   1489  1.1  christos # else
   1490  1.1  christos /* Need to cast, because on Solaris, the third parameter is
   1491  1.1  christos                                                        __va_list args
   1492  1.1  christos    and GCC's fixincludes did not change this to __gnuc_va_list.  */
   1493  1.1  christos _GL_CXXALIAS_SYS_CAST (vsprintf, int,
   1494  1.1  christos                        (char *restrict str,
   1495  1.1  christos                         const char *restrict format, va_list args));
   1496  1.1  christos # endif
   1497  1.1  christos # if __GLIBC__ >= 2
   1498  1.1  christos _GL_CXXALIASWARN (vsprintf);
   1499  1.1  christos # endif
   1500  1.1  christos #elif defined GNULIB_POSIXCHECK
   1501  1.1  christos # undef vsprintf
   1502  1.1  christos /* Assume vsprintf is always declared.  */
   1503  1.1  christos _GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - "
   1504  1.1  christos                  "use gnulib module vsprintf-posix for portable "
   1505  1.1  christos                       "POSIX compliance");
   1506  1.1  christos #endif
   1507  1.1  christos 
   1508  1.1  christos #endif /* _@GUARD_PREFIX@_STDIO_H */
   1509  1.1  christos #endif /* _@GUARD_PREFIX@_STDIO_H */
   1510  1.1  christos #endif
   1511