Home | History | Annotate | Line # | Download | only in import
      1      1.1  christos /* A GNU-like <stdlib.h>.
      2      1.1  christos 
      3  1.1.1.2  christos    Copyright (C) 1995, 2001-2004, 2006-2022 Free Software Foundation, Inc.
      4      1.1  christos 
      5  1.1.1.2  christos    This file is free software: you can redistribute it and/or modify
      6  1.1.1.2  christos    it under the terms of the GNU Lesser General Public License as
      7  1.1.1.2  christos    published by the Free Software Foundation; either version 2.1 of the
      8  1.1.1.2  christos    License, or (at your option) any later version.
      9      1.1  christos 
     10  1.1.1.2  christos    This file 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.1.2  christos    GNU Lesser General Public License for more details.
     14      1.1  christos 
     15  1.1.1.2  christos    You should have received a copy of the GNU Lesser 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_system_stdlib_h || defined __need_malloc_and_calloc
     24      1.1  christos /* Special invocation conventions inside some gnulib header files,
     25      1.1  christos    and inside some glibc header files, respectively.  */
     26      1.1  christos 
     27      1.1  christos #@INCLUDE_NEXT@ @NEXT_STDLIB_H@
     28      1.1  christos 
     29      1.1  christos #else
     30      1.1  christos /* Normal invocation convention.  */
     31      1.1  christos 
     32      1.1  christos #ifndef _@GUARD_PREFIX@_STDLIB_H
     33      1.1  christos 
     34      1.1  christos /* The include_next requires a split double-inclusion guard.  */
     35      1.1  christos #@INCLUDE_NEXT@ @NEXT_STDLIB_H@
     36      1.1  christos 
     37      1.1  christos #ifndef _@GUARD_PREFIX@_STDLIB_H
     38      1.1  christos #define _@GUARD_PREFIX@_STDLIB_H
     39      1.1  christos 
     40      1.1  christos /* NetBSD 5.0 mis-defines NULL.  */
     41      1.1  christos #include <stddef.h>
     42      1.1  christos 
     43      1.1  christos /* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>.  */
     44      1.1  christos #if @GNULIB_SYSTEM_POSIX@ && !defined WEXITSTATUS
     45      1.1  christos # include <sys/wait.h>
     46      1.1  christos #endif
     47      1.1  christos 
     48      1.1  christos /* Solaris declares getloadavg() in <sys/loadavg.h>.  */
     49      1.1  christos #if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@
     50      1.1  christos /* OpenIndiana has a bug: <sys/time.h> must be included before
     51      1.1  christos    <sys/loadavg.h>.  */
     52      1.1  christos # include <sys/time.h>
     53      1.1  christos # include <sys/loadavg.h>
     54      1.1  christos #endif
     55      1.1  christos 
     56  1.1.1.2  christos /* Native Windows platforms declare _mktemp() in <io.h>.  */
     57  1.1.1.2  christos #if defined _WIN32 && !defined __CYGWIN__
     58      1.1  christos # include <io.h>
     59      1.1  christos #endif
     60      1.1  christos 
     61      1.1  christos #if @GNULIB_RANDOM_R@
     62      1.1  christos 
     63      1.1  christos /* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
     64      1.1  christos    from <stdlib.h> if _REENTRANT is defined.  Include it whenever we need
     65      1.1  christos    'struct random_data'.  */
     66      1.1  christos # if @HAVE_RANDOM_H@
     67      1.1  christos #  include <random.h>
     68      1.1  christos # endif
     69      1.1  christos 
     70      1.1  christos # if !@HAVE_STRUCT_RANDOM_DATA@ || @REPLACE_RANDOM_R@ || !@HAVE_RANDOM_R@
     71      1.1  christos #  include <stdint.h>
     72      1.1  christos # endif
     73      1.1  christos 
     74      1.1  christos # if !@HAVE_STRUCT_RANDOM_DATA@
     75      1.1  christos /* Define 'struct random_data'.
     76      1.1  christos    But allow multiple gnulib generated <stdlib.h> replacements to coexist.  */
     77      1.1  christos #  if !GNULIB_defined_struct_random_data
     78      1.1  christos struct random_data
     79      1.1  christos {
     80      1.1  christos   int32_t *fptr;                /* Front pointer.  */
     81      1.1  christos   int32_t *rptr;                /* Rear pointer.  */
     82      1.1  christos   int32_t *state;               /* Array of state values.  */
     83      1.1  christos   int rand_type;                /* Type of random number generator.  */
     84      1.1  christos   int rand_deg;                 /* Degree of random number generator.  */
     85      1.1  christos   int rand_sep;                 /* Distance between front and rear.  */
     86      1.1  christos   int32_t *end_ptr;             /* Pointer behind state table.  */
     87      1.1  christos };
     88      1.1  christos #   define GNULIB_defined_struct_random_data 1
     89      1.1  christos #  endif
     90      1.1  christos # endif
     91      1.1  christos #endif
     92      1.1  christos 
     93      1.1  christos #if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_MKOSTEMP@ || @GNULIB_MKOSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !(defined _WIN32 && ! defined __CYGWIN__)
     94      1.1  christos /* On Mac OS X 10.3, only <unistd.h> declares mkstemp.  */
     95      1.1  christos /* On Mac OS X 10.5, only <unistd.h> declares mkstemps.  */
     96      1.1  christos /* On Mac OS X 10.13, only <unistd.h> declares mkostemp and mkostemps.  */
     97      1.1  christos /* On Cygwin 1.7.1, only <unistd.h> declares getsubopt.  */
     98      1.1  christos /* But avoid namespace pollution on glibc systems and native Windows.  */
     99      1.1  christos # include <unistd.h>
    100      1.1  christos #endif
    101      1.1  christos 
    102  1.1.1.2  christos /* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
    103  1.1.1.2  christos    that can be freed by passing them as the Ith argument to the
    104  1.1.1.2  christos    function F.  */
    105  1.1.1.2  christos #ifndef _GL_ATTRIBUTE_DEALLOC
    106  1.1.1.2  christos # if __GNUC__ >= 11
    107  1.1.1.2  christos #  define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
    108  1.1.1.2  christos # else
    109  1.1.1.2  christos #  define _GL_ATTRIBUTE_DEALLOC(f, i)
    110  1.1.1.2  christos # endif
    111  1.1.1.2  christos #endif
    112  1.1.1.2  christos 
    113  1.1.1.2  christos /* _GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that
    114  1.1.1.2  christos    can be freed via 'free'; it can be used only after declaring 'free'.  */
    115  1.1.1.2  christos /* Applies to: functions.  Cannot be used on inline functions.  */
    116  1.1.1.2  christos #ifndef _GL_ATTRIBUTE_DEALLOC_FREE
    117  1.1.1.2  christos # define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (free, 1)
    118  1.1.1.2  christos #endif
    119  1.1.1.2  christos 
    120  1.1.1.2  christos /* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly
    121  1.1.1.2  christos    allocated memory.  */
    122  1.1.1.2  christos /* Applies to: functions.  */
    123  1.1.1.2  christos #ifndef _GL_ATTRIBUTE_MALLOC
    124  1.1.1.2  christos # if __GNUC__ >= 3 || defined __clang__
    125  1.1.1.2  christos #  define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
    126  1.1.1.2  christos # else
    127  1.1.1.2  christos #  define _GL_ATTRIBUTE_MALLOC
    128  1.1.1.2  christos # endif
    129  1.1.1.2  christos #endif
    130  1.1.1.2  christos 
    131      1.1  christos /* The __attribute__ feature is available in gcc versions 2.5 and later.
    132      1.1  christos    The attribute __pure__ was added in gcc 2.96.  */
    133      1.1  christos #ifndef _GL_ATTRIBUTE_PURE
    134  1.1.1.2  christos # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
    135      1.1  christos #  define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
    136      1.1  christos # else
    137      1.1  christos #  define _GL_ATTRIBUTE_PURE /* empty */
    138      1.1  christos # endif
    139      1.1  christos #endif
    140      1.1  christos 
    141      1.1  christos /* The definition of _Noreturn is copied here.  */
    142      1.1  christos 
    143      1.1  christos /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
    144      1.1  christos 
    145      1.1  christos /* The definition of _GL_ARG_NONNULL is copied here.  */
    146      1.1  christos 
    147      1.1  christos /* The definition of _GL_WARN_ON_USE is copied here.  */
    148      1.1  christos 
    149      1.1  christos 
    150      1.1  christos /* Some systems do not define EXIT_*, despite otherwise supporting C89.  */
    151      1.1  christos #ifndef EXIT_SUCCESS
    152      1.1  christos # define EXIT_SUCCESS 0
    153      1.1  christos #endif
    154      1.1  christos /* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
    155      1.1  christos    with proper operation of xargs.  */
    156      1.1  christos #ifndef EXIT_FAILURE
    157      1.1  christos # define EXIT_FAILURE 1
    158      1.1  christos #elif EXIT_FAILURE != 1
    159      1.1  christos # undef EXIT_FAILURE
    160      1.1  christos # define EXIT_FAILURE 1
    161      1.1  christos #endif
    162      1.1  christos 
    163      1.1  christos 
    164      1.1  christos #if @GNULIB__EXIT@
    165      1.1  christos /* Terminate the current process with the given return code, without running
    166      1.1  christos    the 'atexit' handlers.  */
    167      1.1  christos # if !@HAVE__EXIT@
    168      1.1  christos _GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status));
    169      1.1  christos # endif
    170      1.1  christos _GL_CXXALIAS_SYS (_Exit, void, (int status));
    171      1.1  christos _GL_CXXALIASWARN (_Exit);
    172      1.1  christos #elif defined GNULIB_POSIXCHECK
    173      1.1  christos # undef _Exit
    174      1.1  christos # if HAVE_RAW_DECL__EXIT
    175      1.1  christos _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
    176      1.1  christos                  "use gnulib module _Exit for portability");
    177      1.1  christos # endif
    178      1.1  christos #endif
    179      1.1  christos 
    180      1.1  christos 
    181  1.1.1.2  christos #if @GNULIB_FREE_POSIX@
    182  1.1.1.2  christos # if @REPLACE_FREE@
    183  1.1.1.2  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    184  1.1.1.2  christos #   undef free
    185  1.1.1.2  christos #   define free rpl_free
    186  1.1.1.2  christos #  endif
    187  1.1.1.2  christos #  if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
    188  1.1.1.2  christos _GL_FUNCDECL_RPL (free, void, (void *ptr) throw ());
    189  1.1.1.2  christos #  else
    190  1.1.1.2  christos _GL_FUNCDECL_RPL (free, void, (void *ptr));
    191  1.1.1.2  christos #  endif
    192  1.1.1.2  christos _GL_CXXALIAS_RPL (free, void, (void *ptr));
    193  1.1.1.2  christos # else
    194  1.1.1.2  christos _GL_CXXALIAS_SYS (free, void, (void *ptr));
    195  1.1.1.2  christos # endif
    196  1.1.1.2  christos # if __GLIBC__ >= 2
    197  1.1.1.2  christos _GL_CXXALIASWARN (free);
    198  1.1.1.2  christos # endif
    199  1.1.1.2  christos #elif defined GNULIB_POSIXCHECK
    200  1.1.1.2  christos # undef free
    201  1.1.1.2  christos /* Assume free is always declared.  */
    202  1.1.1.2  christos _GL_WARN_ON_USE (free, "free is not future POSIX compliant everywhere - "
    203  1.1.1.2  christos                  "use gnulib module free for portability");
    204  1.1.1.2  christos #endif
    205  1.1.1.2  christos 
    206  1.1.1.2  christos 
    207  1.1.1.2  christos /* Allocate memory with indefinite extent and specified alignment.  */
    208  1.1.1.2  christos #if @GNULIB_ALIGNED_ALLOC@
    209  1.1.1.2  christos # if @REPLACE_ALIGNED_ALLOC@
    210  1.1.1.2  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    211  1.1.1.2  christos #   undef aligned_alloc
    212  1.1.1.2  christos #   define aligned_alloc rpl_aligned_alloc
    213  1.1.1.2  christos #  endif
    214  1.1.1.2  christos _GL_FUNCDECL_RPL (aligned_alloc, void *,
    215  1.1.1.2  christos                   (size_t alignment, size_t size)
    216  1.1.1.2  christos                   _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
    217  1.1.1.2  christos _GL_CXXALIAS_RPL (aligned_alloc, void *, (size_t alignment, size_t size));
    218  1.1.1.2  christos # else
    219  1.1.1.2  christos #  if @HAVE_ALIGNED_ALLOC@
    220  1.1.1.2  christos #   if __GNUC__ >= 11
    221  1.1.1.2  christos /* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free.  */
    222  1.1.1.2  christos _GL_FUNCDECL_SYS (aligned_alloc, void *,
    223  1.1.1.2  christos                   (size_t alignment, size_t size)
    224  1.1.1.2  christos                   _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
    225  1.1.1.2  christos #   endif
    226  1.1.1.2  christos _GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size));
    227  1.1.1.2  christos #  endif
    228  1.1.1.2  christos # endif
    229  1.1.1.2  christos # if @HAVE_ALIGNED_ALLOC@
    230  1.1.1.2  christos _GL_CXXALIASWARN (aligned_alloc);
    231  1.1.1.2  christos # endif
    232  1.1.1.2  christos #else
    233  1.1.1.2  christos # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined aligned_alloc
    234  1.1.1.2  christos /* For -Wmismatched-dealloc: Associate aligned_alloc with free or rpl_free.  */
    235  1.1.1.2  christos _GL_FUNCDECL_SYS (aligned_alloc, void *,
    236  1.1.1.2  christos                   (size_t alignment, size_t size)
    237  1.1.1.2  christos                   _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
    238  1.1.1.2  christos # endif
    239  1.1.1.2  christos # if defined GNULIB_POSIXCHECK
    240  1.1.1.2  christos #  undef aligned_alloc
    241  1.1.1.2  christos #  if HAVE_RAW_DECL_ALIGNED_ALLOC
    242  1.1.1.2  christos _GL_WARN_ON_USE (aligned_alloc, "aligned_alloc is not portable - "
    243  1.1.1.2  christos                  "use gnulib module aligned_alloc for portability");
    244  1.1.1.2  christos #  endif
    245  1.1.1.2  christos # endif
    246  1.1.1.2  christos #endif
    247  1.1.1.2  christos 
    248      1.1  christos #if @GNULIB_ATOLL@
    249      1.1  christos /* Parse a signed decimal integer.
    250      1.1  christos    Returns the value of the integer.  Errors are not detected.  */
    251      1.1  christos # if !@HAVE_ATOLL@
    252      1.1  christos _GL_FUNCDECL_SYS (atoll, long long, (const char *string)
    253      1.1  christos                                     _GL_ATTRIBUTE_PURE
    254      1.1  christos                                     _GL_ARG_NONNULL ((1)));
    255      1.1  christos # endif
    256      1.1  christos _GL_CXXALIAS_SYS (atoll, long long, (const char *string));
    257      1.1  christos _GL_CXXALIASWARN (atoll);
    258      1.1  christos #elif defined GNULIB_POSIXCHECK
    259      1.1  christos # undef atoll
    260      1.1  christos # if HAVE_RAW_DECL_ATOLL
    261      1.1  christos _GL_WARN_ON_USE (atoll, "atoll is unportable - "
    262      1.1  christos                  "use gnulib module atoll for portability");
    263      1.1  christos # endif
    264      1.1  christos #endif
    265      1.1  christos 
    266      1.1  christos #if @GNULIB_CALLOC_POSIX@
    267  1.1.1.2  christos # if (@GNULIB_CALLOC_POSIX@ && @REPLACE_CALLOC_FOR_CALLOC_POSIX@) \
    268  1.1.1.2  christos      || (@GNULIB_CALLOC_GNU@ && @REPLACE_CALLOC_FOR_CALLOC_GNU@)
    269      1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    270      1.1  christos #   undef calloc
    271      1.1  christos #   define calloc rpl_calloc
    272      1.1  christos #  endif
    273  1.1.1.2  christos _GL_FUNCDECL_RPL (calloc, void *,
    274  1.1.1.2  christos                   (size_t nmemb, size_t size)
    275  1.1.1.2  christos                   _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
    276      1.1  christos _GL_CXXALIAS_RPL (calloc, void *, (size_t nmemb, size_t size));
    277      1.1  christos # else
    278  1.1.1.2  christos #  if __GNUC__ >= 11
    279  1.1.1.2  christos /* For -Wmismatched-dealloc: Associate calloc with free or rpl_free.  */
    280  1.1.1.2  christos _GL_FUNCDECL_SYS (calloc, void *,
    281  1.1.1.2  christos                   (size_t nmemb, size_t size)
    282  1.1.1.2  christos                   _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
    283  1.1.1.2  christos #  endif
    284      1.1  christos _GL_CXXALIAS_SYS (calloc, void *, (size_t nmemb, size_t size));
    285      1.1  christos # endif
    286      1.1  christos # if __GLIBC__ >= 2
    287      1.1  christos _GL_CXXALIASWARN (calloc);
    288      1.1  christos # endif
    289  1.1.1.2  christos #else
    290  1.1.1.2  christos # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined calloc
    291  1.1.1.2  christos /* For -Wmismatched-dealloc: Associate calloc with free or rpl_free.  */
    292  1.1.1.2  christos _GL_FUNCDECL_SYS (calloc, void *,
    293  1.1.1.2  christos                   (size_t nmemb, size_t size)
    294  1.1.1.2  christos                   _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
    295  1.1.1.2  christos # endif
    296  1.1.1.2  christos # if defined GNULIB_POSIXCHECK
    297  1.1.1.2  christos #  undef calloc
    298      1.1  christos /* Assume calloc is always declared.  */
    299      1.1  christos _GL_WARN_ON_USE (calloc, "calloc is not POSIX compliant everywhere - "
    300      1.1  christos                  "use gnulib module calloc-posix for portability");
    301  1.1.1.2  christos # endif
    302      1.1  christos #endif
    303      1.1  christos 
    304      1.1  christos #if @GNULIB_CANONICALIZE_FILE_NAME@
    305      1.1  christos # if @REPLACE_CANONICALIZE_FILE_NAME@
    306      1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    307      1.1  christos #   define canonicalize_file_name rpl_canonicalize_file_name
    308      1.1  christos #  endif
    309  1.1.1.2  christos _GL_FUNCDECL_RPL (canonicalize_file_name, char *,
    310  1.1.1.2  christos                   (const char *name)
    311  1.1.1.2  christos                   _GL_ARG_NONNULL ((1))
    312  1.1.1.2  christos                   _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
    313      1.1  christos _GL_CXXALIAS_RPL (canonicalize_file_name, char *, (const char *name));
    314      1.1  christos # else
    315  1.1.1.2  christos #  if !@HAVE_CANONICALIZE_FILE_NAME@ || __GNUC__ >= 11
    316  1.1.1.2  christos _GL_FUNCDECL_SYS (canonicalize_file_name, char *,
    317  1.1.1.2  christos                   (const char *name)
    318  1.1.1.2  christos                   _GL_ARG_NONNULL ((1))
    319  1.1.1.2  christos                   _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
    320      1.1  christos #  endif
    321      1.1  christos _GL_CXXALIAS_SYS (canonicalize_file_name, char *, (const char *name));
    322      1.1  christos # endif
    323      1.1  christos # ifndef GNULIB_defined_canonicalize_file_name
    324      1.1  christos #  define GNULIB_defined_canonicalize_file_name \
    325      1.1  christos      (!@HAVE_CANONICALIZE_FILE_NAME@ || @REPLACE_CANONICALIZE_FILE_NAME@)
    326      1.1  christos # endif
    327      1.1  christos _GL_CXXALIASWARN (canonicalize_file_name);
    328  1.1.1.2  christos #else
    329  1.1.1.2  christos # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined canonicalize_file_name
    330  1.1.1.2  christos /* For -Wmismatched-dealloc: Associate canonicalize_file_name with free or
    331  1.1.1.2  christos    rpl_free.  */
    332  1.1.1.2  christos _GL_FUNCDECL_SYS (canonicalize_file_name, char *,
    333  1.1.1.2  christos                   (const char *name)
    334  1.1.1.2  christos                   _GL_ARG_NONNULL ((1))
    335  1.1.1.2  christos                   _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
    336  1.1.1.2  christos # endif
    337  1.1.1.2  christos # if defined GNULIB_POSIXCHECK
    338  1.1.1.2  christos #  undef canonicalize_file_name
    339  1.1.1.2  christos #  if HAVE_RAW_DECL_CANONICALIZE_FILE_NAME
    340      1.1  christos _GL_WARN_ON_USE (canonicalize_file_name,
    341      1.1  christos                  "canonicalize_file_name is unportable - "
    342      1.1  christos                  "use gnulib module canonicalize-lgpl for portability");
    343  1.1.1.2  christos #  endif
    344  1.1.1.2  christos # endif
    345  1.1.1.2  christos #endif
    346  1.1.1.2  christos 
    347  1.1.1.2  christos #if @GNULIB_MDA_ECVT@
    348  1.1.1.2  christos /* On native Windows, map 'ecvt' to '_ecvt', so that -loldnames is not
    349  1.1.1.2  christos    required.  In C++ with GNULIB_NAMESPACE, avoid differences between
    350  1.1.1.2  christos    platforms by defining GNULIB_NAMESPACE::ecvt on all platforms that have
    351  1.1.1.2  christos    it.  */
    352  1.1.1.2  christos # if defined _WIN32 && !defined __CYGWIN__
    353  1.1.1.2  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    354  1.1.1.2  christos #   undef ecvt
    355  1.1.1.2  christos #   define ecvt _ecvt
    356  1.1.1.2  christos #  endif
    357  1.1.1.2  christos _GL_CXXALIAS_MDA (ecvt, char *,
    358  1.1.1.2  christos                   (double number, int ndigits, int *decptp, int *signp));
    359  1.1.1.2  christos # else
    360  1.1.1.2  christos #  if @HAVE_DECL_ECVT@
    361  1.1.1.2  christos _GL_CXXALIAS_SYS (ecvt, char *,
    362  1.1.1.2  christos                   (double number, int ndigits, int *decptp, int *signp));
    363  1.1.1.2  christos #  endif
    364  1.1.1.2  christos # endif
    365  1.1.1.2  christos # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_ECVT@
    366  1.1.1.2  christos _GL_CXXALIASWARN (ecvt);
    367  1.1.1.2  christos # endif
    368  1.1.1.2  christos #endif
    369  1.1.1.2  christos 
    370  1.1.1.2  christos #if @GNULIB_MDA_FCVT@
    371  1.1.1.2  christos /* On native Windows, map 'fcvt' to '_fcvt', so that -loldnames is not
    372  1.1.1.2  christos    required.  In C++ with GNULIB_NAMESPACE, avoid differences between
    373  1.1.1.2  christos    platforms by defining GNULIB_NAMESPACE::fcvt on all platforms that have
    374  1.1.1.2  christos    it.  */
    375  1.1.1.2  christos # if defined _WIN32 && !defined __CYGWIN__
    376  1.1.1.2  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    377  1.1.1.2  christos #   undef fcvt
    378  1.1.1.2  christos #   define fcvt _fcvt
    379  1.1.1.2  christos #  endif
    380  1.1.1.2  christos _GL_CXXALIAS_MDA (fcvt, char *,
    381  1.1.1.2  christos                   (double number, int ndigits, int *decptp, int *signp));
    382  1.1.1.2  christos # else
    383  1.1.1.2  christos #  if @HAVE_DECL_FCVT@
    384  1.1.1.2  christos _GL_CXXALIAS_SYS (fcvt, char *,
    385  1.1.1.2  christos                   (double number, int ndigits, int *decptp, int *signp));
    386  1.1.1.2  christos #  endif
    387  1.1.1.2  christos # endif
    388  1.1.1.2  christos # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_FCVT@
    389  1.1.1.2  christos _GL_CXXALIASWARN (fcvt);
    390  1.1.1.2  christos # endif
    391  1.1.1.2  christos #endif
    392  1.1.1.2  christos 
    393  1.1.1.2  christos #if @GNULIB_MDA_GCVT@
    394  1.1.1.2  christos /* On native Windows, map 'gcvt' to '_gcvt', so that -loldnames is not
    395  1.1.1.2  christos    required.  In C++ with GNULIB_NAMESPACE, avoid differences between
    396  1.1.1.2  christos    platforms by defining GNULIB_NAMESPACE::gcvt on all platforms that have
    397  1.1.1.2  christos    it.  */
    398  1.1.1.2  christos # if defined _WIN32 && !defined __CYGWIN__
    399  1.1.1.2  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    400  1.1.1.2  christos #   undef gcvt
    401  1.1.1.2  christos #   define gcvt _gcvt
    402  1.1.1.2  christos #  endif
    403  1.1.1.2  christos _GL_CXXALIAS_MDA (gcvt, char *, (double number, int ndigits, char *buf));
    404  1.1.1.2  christos # else
    405  1.1.1.2  christos #  if @HAVE_DECL_GCVT@
    406  1.1.1.2  christos _GL_CXXALIAS_SYS (gcvt, char *, (double number, int ndigits, char *buf));
    407  1.1.1.2  christos #  endif
    408  1.1.1.2  christos # endif
    409  1.1.1.2  christos # if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_GCVT@
    410  1.1.1.2  christos _GL_CXXALIASWARN (gcvt);
    411      1.1  christos # endif
    412      1.1  christos #endif
    413      1.1  christos 
    414      1.1  christos #if @GNULIB_GETLOADAVG@
    415      1.1  christos /* Store max(NELEM,3) load average numbers in LOADAVG[].
    416      1.1  christos    The three numbers are the load average of the last 1 minute, the last 5
    417      1.1  christos    minutes, and the last 15 minutes, respectively.
    418      1.1  christos    LOADAVG is an array of NELEM numbers.  */
    419      1.1  christos # if !@HAVE_DECL_GETLOADAVG@
    420      1.1  christos _GL_FUNCDECL_SYS (getloadavg, int, (double loadavg[], int nelem)
    421      1.1  christos                                    _GL_ARG_NONNULL ((1)));
    422      1.1  christos # endif
    423      1.1  christos _GL_CXXALIAS_SYS (getloadavg, int, (double loadavg[], int nelem));
    424      1.1  christos _GL_CXXALIASWARN (getloadavg);
    425      1.1  christos #elif defined GNULIB_POSIXCHECK
    426      1.1  christos # undef getloadavg
    427      1.1  christos # if HAVE_RAW_DECL_GETLOADAVG
    428      1.1  christos _GL_WARN_ON_USE (getloadavg, "getloadavg is not portable - "
    429      1.1  christos                  "use gnulib module getloadavg for portability");
    430      1.1  christos # endif
    431      1.1  christos #endif
    432      1.1  christos 
    433      1.1  christos #if @GNULIB_GETSUBOPT@
    434      1.1  christos /* Assuming *OPTIONP is a comma separated list of elements of the form
    435      1.1  christos    "token" or "token=value", getsubopt parses the first of these elements.
    436      1.1  christos    If the first element refers to a "token" that is member of the given
    437      1.1  christos    NULL-terminated array of tokens:
    438      1.1  christos      - It replaces the comma with a NUL byte, updates *OPTIONP to point past
    439      1.1  christos        the first option and the comma, sets *VALUEP to the value of the
    440      1.1  christos        element (or NULL if it doesn't contain an "=" sign),
    441      1.1  christos      - It returns the index of the "token" in the given array of tokens.
    442      1.1  christos    Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
    443      1.1  christos    For more details see the POSIX specification.
    444      1.1  christos    https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsubopt.html */
    445      1.1  christos # if !@HAVE_GETSUBOPT@
    446      1.1  christos _GL_FUNCDECL_SYS (getsubopt, int,
    447      1.1  christos                   (char **optionp, char *const *tokens, char **valuep)
    448      1.1  christos                   _GL_ARG_NONNULL ((1, 2, 3)));
    449      1.1  christos # endif
    450      1.1  christos _GL_CXXALIAS_SYS (getsubopt, int,
    451      1.1  christos                   (char **optionp, char *const *tokens, char **valuep));
    452      1.1  christos _GL_CXXALIASWARN (getsubopt);
    453      1.1  christos #elif defined GNULIB_POSIXCHECK
    454      1.1  christos # undef getsubopt
    455      1.1  christos # if HAVE_RAW_DECL_GETSUBOPT
    456      1.1  christos _GL_WARN_ON_USE (getsubopt, "getsubopt is unportable - "
    457      1.1  christos                  "use gnulib module getsubopt for portability");
    458      1.1  christos # endif
    459      1.1  christos #endif
    460      1.1  christos 
    461      1.1  christos #if @GNULIB_GRANTPT@
    462      1.1  christos /* Change the ownership and access permission of the slave side of the
    463      1.1  christos    pseudo-terminal whose master side is specified by FD.  */
    464      1.1  christos # if !@HAVE_GRANTPT@
    465      1.1  christos _GL_FUNCDECL_SYS (grantpt, int, (int fd));
    466      1.1  christos # endif
    467      1.1  christos _GL_CXXALIAS_SYS (grantpt, int, (int fd));
    468      1.1  christos _GL_CXXALIASWARN (grantpt);
    469      1.1  christos #elif defined GNULIB_POSIXCHECK
    470      1.1  christos # undef grantpt
    471      1.1  christos # if HAVE_RAW_DECL_GRANTPT
    472      1.1  christos _GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
    473      1.1  christos                  "use gnulib module grantpt for portability");
    474      1.1  christos # endif
    475      1.1  christos #endif
    476      1.1  christos 
    477      1.1  christos /* If _GL_USE_STDLIB_ALLOC is nonzero, the including module does not
    478      1.1  christos    rely on GNU or POSIX semantics for malloc and realloc (for example,
    479      1.1  christos    by never specifying a zero size), so it does not need malloc or
    480      1.1  christos    realloc to be redefined.  */
    481      1.1  christos #if @GNULIB_MALLOC_POSIX@
    482  1.1.1.2  christos # if (@GNULIB_MALLOC_POSIX@ && @REPLACE_MALLOC_FOR_MALLOC_POSIX@) \
    483  1.1.1.2  christos      || (@GNULIB_MALLOC_GNU@ && @REPLACE_MALLOC_FOR_MALLOC_GNU@)
    484      1.1  christos #  if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
    485      1.1  christos         || _GL_USE_STDLIB_ALLOC)
    486      1.1  christos #   undef malloc
    487      1.1  christos #   define malloc rpl_malloc
    488      1.1  christos #  endif
    489  1.1.1.2  christos _GL_FUNCDECL_RPL (malloc, void *,
    490  1.1.1.2  christos                   (size_t size)
    491  1.1.1.2  christos                   _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
    492      1.1  christos _GL_CXXALIAS_RPL (malloc, void *, (size_t size));
    493      1.1  christos # else
    494  1.1.1.2  christos #  if __GNUC__ >= 11
    495  1.1.1.2  christos /* For -Wmismatched-dealloc: Associate malloc with free or rpl_free.  */
    496  1.1.1.2  christos _GL_FUNCDECL_SYS (malloc, void *,
    497  1.1.1.2  christos                   (size_t size)
    498  1.1.1.2  christos                   _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
    499  1.1.1.2  christos #  endif
    500      1.1  christos _GL_CXXALIAS_SYS (malloc, void *, (size_t size));
    501      1.1  christos # endif
    502      1.1  christos # if __GLIBC__ >= 2
    503      1.1  christos _GL_CXXALIASWARN (malloc);
    504      1.1  christos # endif
    505  1.1.1.2  christos #else
    506  1.1.1.2  christos # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined malloc
    507  1.1.1.2  christos /* For -Wmismatched-dealloc: Associate malloc with free or rpl_free.  */
    508  1.1.1.2  christos _GL_FUNCDECL_SYS (malloc, void *,
    509  1.1.1.2  christos                   (size_t size)
    510  1.1.1.2  christos                   _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_DEALLOC_FREE);
    511  1.1.1.2  christos # endif
    512  1.1.1.2  christos # if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
    513  1.1.1.2  christos #  undef malloc
    514      1.1  christos /* Assume malloc is always declared.  */
    515      1.1  christos _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - "
    516      1.1  christos                  "use gnulib module malloc-posix for portability");
    517  1.1.1.2  christos # endif
    518      1.1  christos #endif
    519      1.1  christos 
    520      1.1  christos /* Convert a multibyte character to a wide character.  */
    521      1.1  christos #if @GNULIB_MBTOWC@
    522      1.1  christos # if @REPLACE_MBTOWC@
    523      1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    524      1.1  christos #   undef mbtowc
    525      1.1  christos #   define mbtowc rpl_mbtowc
    526      1.1  christos #  endif
    527      1.1  christos _GL_FUNCDECL_RPL (mbtowc, int,
    528      1.1  christos                   (wchar_t *restrict pwc, const char *restrict s, size_t n));
    529      1.1  christos _GL_CXXALIAS_RPL (mbtowc, int,
    530      1.1  christos                   (wchar_t *restrict pwc, const char *restrict s, size_t n));
    531      1.1  christos # else
    532      1.1  christos #  if !@HAVE_MBTOWC@
    533      1.1  christos _GL_FUNCDECL_SYS (mbtowc, int,
    534      1.1  christos                   (wchar_t *restrict pwc, const char *restrict s, size_t n));
    535      1.1  christos #  endif
    536      1.1  christos _GL_CXXALIAS_SYS (mbtowc, int,
    537      1.1  christos                   (wchar_t *restrict pwc, const char *restrict s, size_t n));
    538      1.1  christos # endif
    539      1.1  christos # if __GLIBC__ >= 2
    540      1.1  christos _GL_CXXALIASWARN (mbtowc);
    541      1.1  christos # endif
    542      1.1  christos #elif defined GNULIB_POSIXCHECK
    543      1.1  christos # undef mbtowc
    544      1.1  christos # if HAVE_RAW_DECL_MBTOWC
    545      1.1  christos _GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - "
    546      1.1  christos                  "use gnulib module mbtowc for portability");
    547      1.1  christos # endif
    548      1.1  christos #endif
    549      1.1  christos 
    550      1.1  christos #if @GNULIB_MKDTEMP@
    551      1.1  christos /* Create a unique temporary directory from TEMPLATE.
    552      1.1  christos    The last six characters of TEMPLATE must be "XXXXXX";
    553      1.1  christos    they are replaced with a string that makes the directory name unique.
    554      1.1  christos    Returns TEMPLATE, or a null pointer if it cannot get a unique name.
    555      1.1  christos    The directory is created mode 700.  */
    556      1.1  christos # if !@HAVE_MKDTEMP@
    557      1.1  christos _GL_FUNCDECL_SYS (mkdtemp, char *, (char * /*template*/) _GL_ARG_NONNULL ((1)));
    558      1.1  christos # endif
    559      1.1  christos _GL_CXXALIAS_SYS (mkdtemp, char *, (char * /*template*/));
    560      1.1  christos _GL_CXXALIASWARN (mkdtemp);
    561      1.1  christos #elif defined GNULIB_POSIXCHECK
    562      1.1  christos # undef mkdtemp
    563      1.1  christos # if HAVE_RAW_DECL_MKDTEMP
    564      1.1  christos _GL_WARN_ON_USE (mkdtemp, "mkdtemp is unportable - "
    565      1.1  christos                  "use gnulib module mkdtemp for portability");
    566      1.1  christos # endif
    567      1.1  christos #endif
    568      1.1  christos 
    569      1.1  christos #if @GNULIB_MKOSTEMP@
    570      1.1  christos /* Create a unique temporary file from TEMPLATE.
    571      1.1  christos    The last six characters of TEMPLATE must be "XXXXXX";
    572      1.1  christos    they are replaced with a string that makes the file name unique.
    573      1.1  christos    The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
    574      1.1  christos    and O_TEXT, O_BINARY (defined in "binary-io.h").
    575      1.1  christos    The file is then created, with the specified flags, ensuring it didn't exist
    576      1.1  christos    before.
    577      1.1  christos    The file is created read-write (mask at least 0600 & ~umask), but it may be
    578      1.1  christos    world-readable and world-writable (mask 0666 & ~umask), depending on the
    579      1.1  christos    implementation.
    580      1.1  christos    Returns the open file descriptor if successful, otherwise -1 and errno
    581      1.1  christos    set.  */
    582      1.1  christos # if !@HAVE_MKOSTEMP@
    583      1.1  christos _GL_FUNCDECL_SYS (mkostemp, int, (char * /*template*/, int /*flags*/)
    584      1.1  christos                                  _GL_ARG_NONNULL ((1)));
    585      1.1  christos # endif
    586      1.1  christos _GL_CXXALIAS_SYS (mkostemp, int, (char * /*template*/, int /*flags*/));
    587      1.1  christos _GL_CXXALIASWARN (mkostemp);
    588      1.1  christos #elif defined GNULIB_POSIXCHECK
    589      1.1  christos # undef mkostemp
    590      1.1  christos # if HAVE_RAW_DECL_MKOSTEMP
    591      1.1  christos _GL_WARN_ON_USE (mkostemp, "mkostemp is unportable - "
    592      1.1  christos                  "use gnulib module mkostemp for portability");
    593      1.1  christos # endif
    594      1.1  christos #endif
    595      1.1  christos 
    596      1.1  christos #if @GNULIB_MKOSTEMPS@
    597      1.1  christos /* Create a unique temporary file from TEMPLATE.
    598      1.1  christos    The last six characters of TEMPLATE before a suffix of length
    599      1.1  christos    SUFFIXLEN must be "XXXXXX";
    600      1.1  christos    they are replaced with a string that makes the file name unique.
    601      1.1  christos    The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)
    602      1.1  christos    and O_TEXT, O_BINARY (defined in "binary-io.h").
    603      1.1  christos    The file is then created, with the specified flags, ensuring it didn't exist
    604      1.1  christos    before.
    605      1.1  christos    The file is created read-write (mask at least 0600 & ~umask), but it may be
    606      1.1  christos    world-readable and world-writable (mask 0666 & ~umask), depending on the
    607      1.1  christos    implementation.
    608      1.1  christos    Returns the open file descriptor if successful, otherwise -1 and errno
    609      1.1  christos    set.  */
    610      1.1  christos # if !@HAVE_MKOSTEMPS@
    611      1.1  christos _GL_FUNCDECL_SYS (mkostemps, int,
    612      1.1  christos                   (char * /*template*/, int /*suffixlen*/, int /*flags*/)
    613      1.1  christos                   _GL_ARG_NONNULL ((1)));
    614      1.1  christos # endif
    615      1.1  christos _GL_CXXALIAS_SYS (mkostemps, int,
    616      1.1  christos                   (char * /*template*/, int /*suffixlen*/, int /*flags*/));
    617      1.1  christos _GL_CXXALIASWARN (mkostemps);
    618      1.1  christos #elif defined GNULIB_POSIXCHECK
    619      1.1  christos # undef mkostemps
    620      1.1  christos # if HAVE_RAW_DECL_MKOSTEMPS
    621      1.1  christos _GL_WARN_ON_USE (mkostemps, "mkostemps is unportable - "
    622      1.1  christos                  "use gnulib module mkostemps for portability");
    623      1.1  christos # endif
    624      1.1  christos #endif
    625      1.1  christos 
    626      1.1  christos #if @GNULIB_MKSTEMP@
    627      1.1  christos /* Create a unique temporary file from TEMPLATE.
    628      1.1  christos    The last six characters of TEMPLATE must be "XXXXXX";
    629      1.1  christos    they are replaced with a string that makes the file name unique.
    630      1.1  christos    The file is then created, ensuring it didn't exist before.
    631      1.1  christos    The file is created read-write (mask at least 0600 & ~umask), but it may be
    632      1.1  christos    world-readable and world-writable (mask 0666 & ~umask), depending on the
    633      1.1  christos    implementation.
    634      1.1  christos    Returns the open file descriptor if successful, otherwise -1 and errno
    635      1.1  christos    set.  */
    636      1.1  christos # if @REPLACE_MKSTEMP@
    637      1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    638      1.1  christos #   define mkstemp rpl_mkstemp
    639      1.1  christos #  endif
    640      1.1  christos _GL_FUNCDECL_RPL (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
    641      1.1  christos _GL_CXXALIAS_RPL (mkstemp, int, (char * /*template*/));
    642      1.1  christos # else
    643      1.1  christos #  if ! @HAVE_MKSTEMP@
    644      1.1  christos _GL_FUNCDECL_SYS (mkstemp, int, (char * /*template*/) _GL_ARG_NONNULL ((1)));
    645      1.1  christos #  endif
    646      1.1  christos _GL_CXXALIAS_SYS (mkstemp, int, (char * /*template*/));
    647      1.1  christos # endif
    648      1.1  christos _GL_CXXALIASWARN (mkstemp);
    649      1.1  christos #elif defined GNULIB_POSIXCHECK
    650      1.1  christos # undef mkstemp
    651      1.1  christos # if HAVE_RAW_DECL_MKSTEMP
    652      1.1  christos _GL_WARN_ON_USE (mkstemp, "mkstemp is unportable - "
    653      1.1  christos                  "use gnulib module mkstemp for portability");
    654      1.1  christos # endif
    655      1.1  christos #endif
    656      1.1  christos 
    657      1.1  christos #if @GNULIB_MKSTEMPS@
    658      1.1  christos /* Create a unique temporary file from TEMPLATE.
    659      1.1  christos    The last six characters of TEMPLATE prior to a suffix of length
    660      1.1  christos    SUFFIXLEN must be "XXXXXX";
    661      1.1  christos    they are replaced with a string that makes the file name unique.
    662      1.1  christos    The file is then created, ensuring it didn't exist before.
    663      1.1  christos    The file is created read-write (mask at least 0600 & ~umask), but it may be
    664      1.1  christos    world-readable and world-writable (mask 0666 & ~umask), depending on the
    665      1.1  christos    implementation.
    666      1.1  christos    Returns the open file descriptor if successful, otherwise -1 and errno
    667      1.1  christos    set.  */
    668      1.1  christos # if !@HAVE_MKSTEMPS@
    669      1.1  christos _GL_FUNCDECL_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/)
    670      1.1  christos                                  _GL_ARG_NONNULL ((1)));
    671      1.1  christos # endif
    672      1.1  christos _GL_CXXALIAS_SYS (mkstemps, int, (char * /*template*/, int /*suffixlen*/));
    673      1.1  christos _GL_CXXALIASWARN (mkstemps);
    674      1.1  christos #elif defined GNULIB_POSIXCHECK
    675      1.1  christos # undef mkstemps
    676      1.1  christos # if HAVE_RAW_DECL_MKSTEMPS
    677      1.1  christos _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
    678      1.1  christos                  "use gnulib module mkstemps for portability");
    679      1.1  christos # endif
    680      1.1  christos #endif
    681      1.1  christos 
    682  1.1.1.2  christos #if @GNULIB_MDA_MKTEMP@
    683  1.1.1.2  christos /* On native Windows, map 'mktemp' to '_mktemp', so that -loldnames is not
    684  1.1.1.2  christos    required.  In C++ with GNULIB_NAMESPACE, avoid differences between
    685  1.1.1.2  christos    platforms by defining GNULIB_NAMESPACE::mktemp always.  */
    686  1.1.1.2  christos # if defined _WIN32 && !defined __CYGWIN__
    687  1.1.1.2  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    688  1.1.1.2  christos #   undef mktemp
    689  1.1.1.2  christos #   define mktemp _mktemp
    690  1.1.1.2  christos #  endif
    691  1.1.1.2  christos _GL_CXXALIAS_MDA (mktemp, char *, (char * /*template*/));
    692  1.1.1.2  christos # else
    693  1.1.1.2  christos _GL_CXXALIAS_SYS (mktemp, char *, (char * /*template*/));
    694  1.1.1.2  christos # endif
    695  1.1.1.2  christos _GL_CXXALIASWARN (mktemp);
    696  1.1.1.2  christos #endif
    697  1.1.1.2  christos 
    698  1.1.1.2  christos /* Allocate memory with indefinite extent and specified alignment.  */
    699  1.1.1.2  christos #if @GNULIB_POSIX_MEMALIGN@
    700  1.1.1.2  christos # if @REPLACE_POSIX_MEMALIGN@
    701  1.1.1.2  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    702  1.1.1.2  christos #   undef posix_memalign
    703  1.1.1.2  christos #   define posix_memalign rpl_posix_memalign
    704  1.1.1.2  christos #  endif
    705  1.1.1.2  christos _GL_FUNCDECL_RPL (posix_memalign, int,
    706  1.1.1.2  christos                   (void **memptr, size_t alignment, size_t size)
    707  1.1.1.2  christos                   _GL_ARG_NONNULL ((1)));
    708  1.1.1.2  christos _GL_CXXALIAS_RPL (posix_memalign, int,
    709  1.1.1.2  christos                   (void **memptr, size_t alignment, size_t size));
    710  1.1.1.2  christos # else
    711  1.1.1.2  christos #  if @HAVE_POSIX_MEMALIGN@
    712  1.1.1.2  christos _GL_CXXALIAS_SYS (posix_memalign, int,
    713  1.1.1.2  christos                   (void **memptr, size_t alignment, size_t size));
    714  1.1.1.2  christos #  endif
    715  1.1.1.2  christos # endif
    716  1.1.1.2  christos # if @HAVE_POSIX_MEMALIGN@
    717  1.1.1.2  christos _GL_CXXALIASWARN (posix_memalign);
    718  1.1.1.2  christos # endif
    719  1.1.1.2  christos #elif defined GNULIB_POSIXCHECK
    720  1.1.1.2  christos # undef posix_memalign
    721  1.1.1.2  christos # if HAVE_RAW_DECL_POSIX_MEMALIGN
    722  1.1.1.2  christos _GL_WARN_ON_USE (posix_memalign, "posix_memalign is not portable - "
    723  1.1.1.2  christos                  "use gnulib module posix_memalign for portability");
    724  1.1.1.2  christos # endif
    725  1.1.1.2  christos #endif
    726  1.1.1.2  christos 
    727      1.1  christos #if @GNULIB_POSIX_OPENPT@
    728      1.1  christos /* Return an FD open to the master side of a pseudo-terminal.  Flags should
    729      1.1  christos    include O_RDWR, and may also include O_NOCTTY.  */
    730      1.1  christos # if !@HAVE_POSIX_OPENPT@
    731      1.1  christos _GL_FUNCDECL_SYS (posix_openpt, int, (int flags));
    732      1.1  christos # endif
    733      1.1  christos _GL_CXXALIAS_SYS (posix_openpt, int, (int flags));
    734      1.1  christos _GL_CXXALIASWARN (posix_openpt);
    735      1.1  christos #elif defined GNULIB_POSIXCHECK
    736      1.1  christos # undef posix_openpt
    737      1.1  christos # if HAVE_RAW_DECL_POSIX_OPENPT
    738      1.1  christos _GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - "
    739      1.1  christos                  "use gnulib module posix_openpt for portability");
    740      1.1  christos # endif
    741      1.1  christos #endif
    742      1.1  christos 
    743      1.1  christos #if @GNULIB_PTSNAME@
    744      1.1  christos /* Return the pathname of the pseudo-terminal slave associated with
    745      1.1  christos    the master FD is open on, or NULL on errors.  */
    746      1.1  christos # if @REPLACE_PTSNAME@
    747      1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    748      1.1  christos #   undef ptsname
    749      1.1  christos #   define ptsname rpl_ptsname
    750      1.1  christos #  endif
    751      1.1  christos _GL_FUNCDECL_RPL (ptsname, char *, (int fd));
    752      1.1  christos _GL_CXXALIAS_RPL (ptsname, char *, (int fd));
    753      1.1  christos # else
    754      1.1  christos #  if !@HAVE_PTSNAME@
    755      1.1  christos _GL_FUNCDECL_SYS (ptsname, char *, (int fd));
    756      1.1  christos #  endif
    757      1.1  christos _GL_CXXALIAS_SYS (ptsname, char *, (int fd));
    758      1.1  christos # endif
    759      1.1  christos _GL_CXXALIASWARN (ptsname);
    760      1.1  christos #elif defined GNULIB_POSIXCHECK
    761      1.1  christos # undef ptsname
    762      1.1  christos # if HAVE_RAW_DECL_PTSNAME
    763      1.1  christos _GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
    764      1.1  christos                  "use gnulib module ptsname for portability");
    765      1.1  christos # endif
    766      1.1  christos #endif
    767      1.1  christos 
    768      1.1  christos #if @GNULIB_PTSNAME_R@
    769      1.1  christos /* Set the pathname of the pseudo-terminal slave associated with
    770      1.1  christos    the master FD is open on and return 0, or set errno and return
    771      1.1  christos    non-zero on errors.  */
    772      1.1  christos # if @REPLACE_PTSNAME_R@
    773      1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    774      1.1  christos #   undef ptsname_r
    775      1.1  christos #   define ptsname_r rpl_ptsname_r
    776      1.1  christos #  endif
    777      1.1  christos _GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
    778      1.1  christos _GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
    779      1.1  christos # else
    780      1.1  christos #  if !@HAVE_PTSNAME_R@
    781      1.1  christos _GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
    782      1.1  christos #  endif
    783      1.1  christos _GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
    784      1.1  christos # endif
    785      1.1  christos # ifndef GNULIB_defined_ptsname_r
    786      1.1  christos #  define GNULIB_defined_ptsname_r (!@HAVE_PTSNAME_R@ || @REPLACE_PTSNAME_R@)
    787      1.1  christos # endif
    788      1.1  christos _GL_CXXALIASWARN (ptsname_r);
    789      1.1  christos #elif defined GNULIB_POSIXCHECK
    790      1.1  christos # undef ptsname_r
    791      1.1  christos # if HAVE_RAW_DECL_PTSNAME_R
    792      1.1  christos _GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - "
    793      1.1  christos                  "use gnulib module ptsname_r for portability");
    794      1.1  christos # endif
    795      1.1  christos #endif
    796      1.1  christos 
    797      1.1  christos #if @GNULIB_PUTENV@
    798      1.1  christos # if @REPLACE_PUTENV@
    799      1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    800      1.1  christos #   undef putenv
    801      1.1  christos #   define putenv rpl_putenv
    802      1.1  christos #  endif
    803      1.1  christos _GL_FUNCDECL_RPL (putenv, int, (char *string) _GL_ARG_NONNULL ((1)));
    804      1.1  christos _GL_CXXALIAS_RPL (putenv, int, (char *string));
    805  1.1.1.2  christos # elif defined _WIN32 && !defined __CYGWIN__
    806  1.1.1.2  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    807  1.1.1.2  christos #   undef putenv
    808  1.1.1.2  christos #   define putenv _putenv
    809  1.1.1.2  christos #  endif
    810  1.1.1.2  christos _GL_CXXALIAS_MDA (putenv, int, (char *string));
    811  1.1.1.2  christos # else
    812  1.1.1.2  christos _GL_CXXALIAS_SYS (putenv, int, (char *string));
    813  1.1.1.2  christos # endif
    814  1.1.1.2  christos _GL_CXXALIASWARN (putenv);
    815  1.1.1.2  christos #elif @GNULIB_MDA_PUTENV@
    816  1.1.1.2  christos /* On native Windows, map 'putenv' to '_putenv', so that -loldnames is not
    817  1.1.1.2  christos    required.  In C++ with GNULIB_NAMESPACE, avoid differences between
    818  1.1.1.2  christos    platforms by defining GNULIB_NAMESPACE::putenv always.  */
    819  1.1.1.2  christos # if defined _WIN32 && !defined __CYGWIN__
    820  1.1.1.2  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    821  1.1.1.2  christos #   undef putenv
    822  1.1.1.2  christos #   define putenv _putenv
    823  1.1.1.2  christos #  endif
    824  1.1.1.2  christos /* Need to cast, because on mingw, the parameter is either
    825  1.1.1.2  christos    'const char *string' or 'char *string'.  */
    826  1.1.1.2  christos _GL_CXXALIAS_MDA_CAST (putenv, int, (char *string));
    827      1.1  christos # else
    828      1.1  christos _GL_CXXALIAS_SYS (putenv, int, (char *string));
    829      1.1  christos # endif
    830      1.1  christos _GL_CXXALIASWARN (putenv);
    831      1.1  christos #endif
    832      1.1  christos 
    833      1.1  christos #if @GNULIB_QSORT_R@
    834      1.1  christos /* Sort an array of NMEMB elements, starting at address BASE, each element
    835      1.1  christos    occupying SIZE bytes, in ascending order according to the comparison
    836      1.1  christos    function COMPARE.  */
    837  1.1.1.2  christos # ifdef __cplusplus
    838  1.1.1.2  christos extern "C" {
    839  1.1.1.2  christos # endif
    840  1.1.1.2  christos # if !GNULIB_defined_qsort_r_fn_types
    841  1.1.1.2  christos typedef int (*_gl_qsort_r_compar_fn) (void const *, void const *, void *);
    842  1.1.1.2  christos #  define GNULIB_defined_qsort_r_fn_types 1
    843  1.1.1.2  christos # endif
    844  1.1.1.2  christos # ifdef __cplusplus
    845  1.1.1.2  christos }
    846  1.1.1.2  christos # endif
    847      1.1  christos # if @REPLACE_QSORT_R@
    848      1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    849      1.1  christos #   undef qsort_r
    850      1.1  christos #   define qsort_r rpl_qsort_r
    851      1.1  christos #  endif
    852      1.1  christos _GL_FUNCDECL_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
    853  1.1.1.2  christos                                   _gl_qsort_r_compar_fn compare,
    854      1.1  christos                                   void *arg) _GL_ARG_NONNULL ((1, 4)));
    855      1.1  christos _GL_CXXALIAS_RPL (qsort_r, void, (void *base, size_t nmemb, size_t size,
    856  1.1.1.2  christos                                   _gl_qsort_r_compar_fn compare,
    857      1.1  christos                                   void *arg));
    858      1.1  christos # else
    859      1.1  christos #  if !@HAVE_QSORT_R@
    860      1.1  christos _GL_FUNCDECL_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
    861  1.1.1.2  christos                                   _gl_qsort_r_compar_fn compare,
    862      1.1  christos                                   void *arg) _GL_ARG_NONNULL ((1, 4)));
    863      1.1  christos #  endif
    864      1.1  christos _GL_CXXALIAS_SYS (qsort_r, void, (void *base, size_t nmemb, size_t size,
    865  1.1.1.2  christos                                   _gl_qsort_r_compar_fn compare,
    866      1.1  christos                                   void *arg));
    867      1.1  christos # endif
    868      1.1  christos _GL_CXXALIASWARN (qsort_r);
    869      1.1  christos #elif defined GNULIB_POSIXCHECK
    870      1.1  christos # undef qsort_r
    871      1.1  christos # if HAVE_RAW_DECL_QSORT_R
    872      1.1  christos _GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - "
    873      1.1  christos                  "use gnulib module qsort_r for portability");
    874      1.1  christos # endif
    875      1.1  christos #endif
    876      1.1  christos 
    877      1.1  christos 
    878      1.1  christos #if @GNULIB_RANDOM_R@
    879      1.1  christos # if !@HAVE_RANDOM_R@
    880      1.1  christos #  ifndef RAND_MAX
    881      1.1  christos #   define RAND_MAX 2147483647
    882      1.1  christos #  endif
    883      1.1  christos # endif
    884      1.1  christos #endif
    885      1.1  christos 
    886      1.1  christos 
    887      1.1  christos #if @GNULIB_RANDOM@
    888      1.1  christos # if @REPLACE_RANDOM@
    889      1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    890      1.1  christos #   undef random
    891      1.1  christos #   define random rpl_random
    892      1.1  christos #  endif
    893      1.1  christos _GL_FUNCDECL_RPL (random, long, (void));
    894      1.1  christos _GL_CXXALIAS_RPL (random, long, (void));
    895      1.1  christos # else
    896      1.1  christos #  if !@HAVE_RANDOM@
    897      1.1  christos _GL_FUNCDECL_SYS (random, long, (void));
    898      1.1  christos #  endif
    899      1.1  christos /* Need to cast, because on Haiku, the return type is
    900      1.1  christos                                int.  */
    901      1.1  christos _GL_CXXALIAS_SYS_CAST (random, long, (void));
    902      1.1  christos # endif
    903      1.1  christos _GL_CXXALIASWARN (random);
    904      1.1  christos #elif defined GNULIB_POSIXCHECK
    905      1.1  christos # undef random
    906      1.1  christos # if HAVE_RAW_DECL_RANDOM
    907      1.1  christos _GL_WARN_ON_USE (random, "random is unportable - "
    908      1.1  christos                  "use gnulib module random for portability");
    909      1.1  christos # endif
    910      1.1  christos #endif
    911      1.1  christos 
    912      1.1  christos #if @GNULIB_RANDOM@
    913      1.1  christos # if @REPLACE_RANDOM@
    914      1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    915      1.1  christos #   undef srandom
    916      1.1  christos #   define srandom rpl_srandom
    917      1.1  christos #  endif
    918      1.1  christos _GL_FUNCDECL_RPL (srandom, void, (unsigned int seed));
    919      1.1  christos _GL_CXXALIAS_RPL (srandom, void, (unsigned int seed));
    920      1.1  christos # else
    921      1.1  christos #  if !@HAVE_RANDOM@
    922      1.1  christos _GL_FUNCDECL_SYS (srandom, void, (unsigned int seed));
    923      1.1  christos #  endif
    924      1.1  christos /* Need to cast, because on FreeBSD, the first parameter is
    925      1.1  christos                                        unsigned long seed.  */
    926      1.1  christos _GL_CXXALIAS_SYS_CAST (srandom, void, (unsigned int seed));
    927      1.1  christos # endif
    928      1.1  christos _GL_CXXALIASWARN (srandom);
    929      1.1  christos #elif defined GNULIB_POSIXCHECK
    930      1.1  christos # undef srandom
    931      1.1  christos # if HAVE_RAW_DECL_SRANDOM
    932      1.1  christos _GL_WARN_ON_USE (srandom, "srandom is unportable - "
    933      1.1  christos                  "use gnulib module random for portability");
    934      1.1  christos # endif
    935      1.1  christos #endif
    936      1.1  christos 
    937      1.1  christos #if @GNULIB_RANDOM@
    938      1.1  christos # if @REPLACE_INITSTATE@
    939      1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    940      1.1  christos #   undef initstate
    941      1.1  christos #   define initstate rpl_initstate
    942      1.1  christos #  endif
    943      1.1  christos _GL_FUNCDECL_RPL (initstate, char *,
    944      1.1  christos                   (unsigned int seed, char *buf, size_t buf_size)
    945      1.1  christos                   _GL_ARG_NONNULL ((2)));
    946      1.1  christos _GL_CXXALIAS_RPL (initstate, char *,
    947      1.1  christos                   (unsigned int seed, char *buf, size_t buf_size));
    948      1.1  christos # else
    949      1.1  christos #  if !@HAVE_INITSTATE@ || !@HAVE_DECL_INITSTATE@
    950      1.1  christos _GL_FUNCDECL_SYS (initstate, char *,
    951      1.1  christos                   (unsigned int seed, char *buf, size_t buf_size)
    952      1.1  christos                   _GL_ARG_NONNULL ((2)));
    953      1.1  christos #  endif
    954      1.1  christos /* Need to cast, because on FreeBSD, the first parameter is
    955      1.1  christos                         unsigned long seed.  */
    956      1.1  christos _GL_CXXALIAS_SYS_CAST (initstate, char *,
    957      1.1  christos                        (unsigned int seed, char *buf, size_t buf_size));
    958      1.1  christos # endif
    959      1.1  christos _GL_CXXALIASWARN (initstate);
    960      1.1  christos #elif defined GNULIB_POSIXCHECK
    961      1.1  christos # undef initstate
    962      1.1  christos # if HAVE_RAW_DECL_INITSTATE
    963      1.1  christos _GL_WARN_ON_USE (initstate, "initstate is unportable - "
    964      1.1  christos                  "use gnulib module random for portability");
    965      1.1  christos # endif
    966      1.1  christos #endif
    967      1.1  christos 
    968      1.1  christos #if @GNULIB_RANDOM@
    969      1.1  christos # if @REPLACE_SETSTATE@
    970      1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    971      1.1  christos #   undef setstate
    972      1.1  christos #   define setstate rpl_setstate
    973      1.1  christos #  endif
    974      1.1  christos _GL_FUNCDECL_RPL (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
    975      1.1  christos _GL_CXXALIAS_RPL (setstate, char *, (char *arg_state));
    976      1.1  christos # else
    977      1.1  christos #  if !@HAVE_SETSTATE@ || !@HAVE_DECL_SETSTATE@
    978      1.1  christos _GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
    979      1.1  christos #  endif
    980      1.1  christos /* Need to cast, because on Mac OS X 10.13, HP-UX, Solaris the first parameter
    981      1.1  christos    is                                     const char *arg_state.  */
    982      1.1  christos _GL_CXXALIAS_SYS_CAST (setstate, char *, (char *arg_state));
    983      1.1  christos # endif
    984      1.1  christos _GL_CXXALIASWARN (setstate);
    985      1.1  christos #elif defined GNULIB_POSIXCHECK
    986      1.1  christos # undef setstate
    987      1.1  christos # if HAVE_RAW_DECL_SETSTATE
    988      1.1  christos _GL_WARN_ON_USE (setstate, "setstate is unportable - "
    989      1.1  christos                  "use gnulib module random for portability");
    990      1.1  christos # endif
    991      1.1  christos #endif
    992      1.1  christos 
    993      1.1  christos 
    994      1.1  christos #if @GNULIB_RANDOM_R@
    995      1.1  christos # if @REPLACE_RANDOM_R@
    996      1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
    997      1.1  christos #   undef random_r
    998      1.1  christos #   define random_r rpl_random_r
    999      1.1  christos #  endif
   1000      1.1  christos _GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result)
   1001      1.1  christos                                  _GL_ARG_NONNULL ((1, 2)));
   1002      1.1  christos _GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result));
   1003      1.1  christos # else
   1004      1.1  christos #  if !@HAVE_RANDOM_R@
   1005      1.1  christos _GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result)
   1006      1.1  christos                                  _GL_ARG_NONNULL ((1, 2)));
   1007      1.1  christos #  endif
   1008      1.1  christos _GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
   1009      1.1  christos # endif
   1010      1.1  christos _GL_CXXALIASWARN (random_r);
   1011      1.1  christos #elif defined GNULIB_POSIXCHECK
   1012      1.1  christos # undef random_r
   1013      1.1  christos # if HAVE_RAW_DECL_RANDOM_R
   1014      1.1  christos _GL_WARN_ON_USE (random_r, "random_r is unportable - "
   1015      1.1  christos                  "use gnulib module random_r for portability");
   1016      1.1  christos # endif
   1017      1.1  christos #endif
   1018      1.1  christos 
   1019      1.1  christos #if @GNULIB_RANDOM_R@
   1020      1.1  christos # if @REPLACE_RANDOM_R@
   1021      1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1022      1.1  christos #   undef srandom_r
   1023      1.1  christos #   define srandom_r rpl_srandom_r
   1024      1.1  christos #  endif
   1025      1.1  christos _GL_FUNCDECL_RPL (srandom_r, int,
   1026      1.1  christos                   (unsigned int seed, struct random_data *rand_state)
   1027      1.1  christos                   _GL_ARG_NONNULL ((2)));
   1028      1.1  christos _GL_CXXALIAS_RPL (srandom_r, int,
   1029      1.1  christos                   (unsigned int seed, struct random_data *rand_state));
   1030      1.1  christos # else
   1031      1.1  christos #  if !@HAVE_RANDOM_R@
   1032      1.1  christos _GL_FUNCDECL_SYS (srandom_r, int,
   1033      1.1  christos                   (unsigned int seed, struct random_data *rand_state)
   1034      1.1  christos                   _GL_ARG_NONNULL ((2)));
   1035      1.1  christos #  endif
   1036      1.1  christos _GL_CXXALIAS_SYS (srandom_r, int,
   1037      1.1  christos                   (unsigned int seed, struct random_data *rand_state));
   1038      1.1  christos # endif
   1039      1.1  christos _GL_CXXALIASWARN (srandom_r);
   1040      1.1  christos #elif defined GNULIB_POSIXCHECK
   1041      1.1  christos # undef srandom_r
   1042      1.1  christos # if HAVE_RAW_DECL_SRANDOM_R
   1043      1.1  christos _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
   1044      1.1  christos                  "use gnulib module random_r for portability");
   1045      1.1  christos # endif
   1046      1.1  christos #endif
   1047      1.1  christos 
   1048      1.1  christos #if @GNULIB_RANDOM_R@
   1049      1.1  christos # if @REPLACE_RANDOM_R@
   1050      1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1051      1.1  christos #   undef initstate_r
   1052      1.1  christos #   define initstate_r rpl_initstate_r
   1053      1.1  christos #  endif
   1054      1.1  christos _GL_FUNCDECL_RPL (initstate_r, int,
   1055      1.1  christos                   (unsigned int seed, char *buf, size_t buf_size,
   1056      1.1  christos                    struct random_data *rand_state)
   1057      1.1  christos                   _GL_ARG_NONNULL ((2, 4)));
   1058      1.1  christos _GL_CXXALIAS_RPL (initstate_r, int,
   1059      1.1  christos                   (unsigned int seed, char *buf, size_t buf_size,
   1060      1.1  christos                    struct random_data *rand_state));
   1061      1.1  christos # else
   1062      1.1  christos #  if !@HAVE_RANDOM_R@
   1063      1.1  christos _GL_FUNCDECL_SYS (initstate_r, int,
   1064      1.1  christos                   (unsigned int seed, char *buf, size_t buf_size,
   1065      1.1  christos                    struct random_data *rand_state)
   1066      1.1  christos                   _GL_ARG_NONNULL ((2, 4)));
   1067      1.1  christos #  endif
   1068      1.1  christos /* Need to cast, because on Haiku, the third parameter is
   1069      1.1  christos                                                      unsigned long buf_size.  */
   1070      1.1  christos _GL_CXXALIAS_SYS_CAST (initstate_r, int,
   1071      1.1  christos                        (unsigned int seed, char *buf, size_t buf_size,
   1072      1.1  christos                         struct random_data *rand_state));
   1073      1.1  christos # endif
   1074      1.1  christos _GL_CXXALIASWARN (initstate_r);
   1075      1.1  christos #elif defined GNULIB_POSIXCHECK
   1076      1.1  christos # undef initstate_r
   1077      1.1  christos # if HAVE_RAW_DECL_INITSTATE_R
   1078      1.1  christos _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
   1079      1.1  christos                  "use gnulib module random_r for portability");
   1080      1.1  christos # endif
   1081      1.1  christos #endif
   1082      1.1  christos 
   1083      1.1  christos #if @GNULIB_RANDOM_R@
   1084      1.1  christos # if @REPLACE_RANDOM_R@
   1085      1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1086      1.1  christos #   undef setstate_r
   1087      1.1  christos #   define setstate_r rpl_setstate_r
   1088      1.1  christos #  endif
   1089      1.1  christos _GL_FUNCDECL_RPL (setstate_r, int,
   1090      1.1  christos                   (char *arg_state, struct random_data *rand_state)
   1091      1.1  christos                   _GL_ARG_NONNULL ((1, 2)));
   1092      1.1  christos _GL_CXXALIAS_RPL (setstate_r, int,
   1093      1.1  christos                   (char *arg_state, struct random_data *rand_state));
   1094      1.1  christos # else
   1095      1.1  christos #  if !@HAVE_RANDOM_R@
   1096      1.1  christos _GL_FUNCDECL_SYS (setstate_r, int,
   1097      1.1  christos                   (char *arg_state, struct random_data *rand_state)
   1098      1.1  christos                   _GL_ARG_NONNULL ((1, 2)));
   1099      1.1  christos #  endif
   1100      1.1  christos /* Need to cast, because on Haiku, the first parameter is
   1101      1.1  christos                         void *arg_state.  */
   1102      1.1  christos _GL_CXXALIAS_SYS_CAST (setstate_r, int,
   1103      1.1  christos                        (char *arg_state, struct random_data *rand_state));
   1104      1.1  christos # endif
   1105      1.1  christos _GL_CXXALIASWARN (setstate_r);
   1106      1.1  christos #elif defined GNULIB_POSIXCHECK
   1107      1.1  christos # undef setstate_r
   1108      1.1  christos # if HAVE_RAW_DECL_SETSTATE_R
   1109      1.1  christos _GL_WARN_ON_USE (setstate_r, "setstate_r is unportable - "
   1110      1.1  christos                  "use gnulib module random_r for portability");
   1111      1.1  christos # endif
   1112      1.1  christos #endif
   1113      1.1  christos 
   1114      1.1  christos 
   1115      1.1  christos #if @GNULIB_REALLOC_POSIX@
   1116  1.1.1.2  christos # if (@GNULIB_REALLOC_POSIX@ && @REPLACE_REALLOC_FOR_REALLOC_POSIX@) \
   1117  1.1.1.2  christos      || (@GNULIB_REALLOC_GNU@ && @REPLACE_REALLOC_FOR_REALLOC_GNU@)
   1118      1.1  christos #  if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
   1119      1.1  christos         || _GL_USE_STDLIB_ALLOC)
   1120      1.1  christos #   undef realloc
   1121      1.1  christos #   define realloc rpl_realloc
   1122      1.1  christos #  endif
   1123  1.1.1.2  christos _GL_FUNCDECL_RPL (realloc, void *, (void *ptr, size_t size)
   1124  1.1.1.2  christos                                    _GL_ATTRIBUTE_DEALLOC_FREE);
   1125      1.1  christos _GL_CXXALIAS_RPL (realloc, void *, (void *ptr, size_t size));
   1126      1.1  christos # else
   1127  1.1.1.2  christos #  if __GNUC__ >= 11
   1128  1.1.1.2  christos /* For -Wmismatched-dealloc: Associate realloc with free or rpl_free.  */
   1129  1.1.1.2  christos _GL_FUNCDECL_SYS (realloc, void *, (void *ptr, size_t size)
   1130  1.1.1.2  christos                                    _GL_ATTRIBUTE_DEALLOC_FREE);
   1131  1.1.1.2  christos #  endif
   1132      1.1  christos _GL_CXXALIAS_SYS (realloc, void *, (void *ptr, size_t size));
   1133      1.1  christos # endif
   1134      1.1  christos # if __GLIBC__ >= 2
   1135      1.1  christos _GL_CXXALIASWARN (realloc);
   1136      1.1  christos # endif
   1137  1.1.1.2  christos #else
   1138  1.1.1.2  christos # if @GNULIB_FREE_POSIX@ && __GNUC__ >= 11 && !defined realloc
   1139  1.1.1.2  christos /* For -Wmismatched-dealloc: Associate realloc with free or rpl_free.  */
   1140  1.1.1.2  christos _GL_FUNCDECL_SYS (realloc, void *, (void *ptr, size_t size)
   1141  1.1.1.2  christos                                    _GL_ATTRIBUTE_DEALLOC_FREE);
   1142  1.1.1.2  christos # endif
   1143  1.1.1.2  christos # if defined GNULIB_POSIXCHECK && !_GL_USE_STDLIB_ALLOC
   1144  1.1.1.2  christos #  undef realloc
   1145      1.1  christos /* Assume realloc is always declared.  */
   1146      1.1  christos _GL_WARN_ON_USE (realloc, "realloc is not POSIX compliant everywhere - "
   1147      1.1  christos                  "use gnulib module realloc-posix for portability");
   1148  1.1.1.2  christos # endif
   1149      1.1  christos #endif
   1150      1.1  christos 
   1151      1.1  christos 
   1152      1.1  christos #if @GNULIB_REALLOCARRAY@
   1153  1.1.1.2  christos # if @REPLACE_REALLOCARRAY@
   1154  1.1.1.2  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1155  1.1.1.2  christos #   undef reallocarray
   1156  1.1.1.2  christos #   define reallocarray rpl_reallocarray
   1157  1.1.1.2  christos #  endif
   1158  1.1.1.2  christos _GL_FUNCDECL_RPL (reallocarray, void *,
   1159  1.1.1.2  christos                   (void *ptr, size_t nmemb, size_t size));
   1160  1.1.1.2  christos _GL_CXXALIAS_RPL (reallocarray, void *,
   1161  1.1.1.2  christos                   (void *ptr, size_t nmemb, size_t size));
   1162  1.1.1.2  christos # else
   1163  1.1.1.2  christos #  if ! @HAVE_REALLOCARRAY@
   1164      1.1  christos _GL_FUNCDECL_SYS (reallocarray, void *,
   1165      1.1  christos                   (void *ptr, size_t nmemb, size_t size));
   1166  1.1.1.2  christos #  endif
   1167      1.1  christos _GL_CXXALIAS_SYS (reallocarray, void *,
   1168      1.1  christos                   (void *ptr, size_t nmemb, size_t size));
   1169  1.1.1.2  christos # endif
   1170      1.1  christos _GL_CXXALIASWARN (reallocarray);
   1171      1.1  christos #elif defined GNULIB_POSIXCHECK
   1172      1.1  christos # undef reallocarray
   1173      1.1  christos # if HAVE_RAW_DECL_REALLOCARRAY
   1174      1.1  christos _GL_WARN_ON_USE (reallocarray, "reallocarray is not portable - "
   1175      1.1  christos                  "use gnulib module reallocarray for portability");
   1176      1.1  christos # endif
   1177      1.1  christos #endif
   1178      1.1  christos 
   1179      1.1  christos #if @GNULIB_REALPATH@
   1180      1.1  christos # if @REPLACE_REALPATH@
   1181      1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1182      1.1  christos #   define realpath rpl_realpath
   1183      1.1  christos #  endif
   1184      1.1  christos _GL_FUNCDECL_RPL (realpath, char *,
   1185      1.1  christos                   (const char *restrict name, char *restrict resolved)
   1186      1.1  christos                   _GL_ARG_NONNULL ((1)));
   1187      1.1  christos _GL_CXXALIAS_RPL (realpath, char *,
   1188      1.1  christos                   (const char *restrict name, char *restrict resolved));
   1189      1.1  christos # else
   1190      1.1  christos #  if !@HAVE_REALPATH@
   1191      1.1  christos _GL_FUNCDECL_SYS (realpath, char *,
   1192      1.1  christos                   (const char *restrict name, char *restrict resolved)
   1193      1.1  christos                   _GL_ARG_NONNULL ((1)));
   1194      1.1  christos #  endif
   1195      1.1  christos _GL_CXXALIAS_SYS (realpath, char *,
   1196      1.1  christos                   (const char *restrict name, char *restrict resolved));
   1197      1.1  christos # endif
   1198      1.1  christos _GL_CXXALIASWARN (realpath);
   1199      1.1  christos #elif defined GNULIB_POSIXCHECK
   1200      1.1  christos # undef realpath
   1201      1.1  christos # if HAVE_RAW_DECL_REALPATH
   1202      1.1  christos _GL_WARN_ON_USE (realpath, "realpath is unportable - use gnulib module "
   1203      1.1  christos                  "canonicalize or canonicalize-lgpl for portability");
   1204      1.1  christos # endif
   1205      1.1  christos #endif
   1206      1.1  christos 
   1207      1.1  christos #if @GNULIB_RPMATCH@
   1208      1.1  christos /* Test a user response to a question.
   1209      1.1  christos    Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear.  */
   1210      1.1  christos # if !@HAVE_RPMATCH@
   1211      1.1  christos _GL_FUNCDECL_SYS (rpmatch, int, (const char *response) _GL_ARG_NONNULL ((1)));
   1212      1.1  christos # endif
   1213      1.1  christos _GL_CXXALIAS_SYS (rpmatch, int, (const char *response));
   1214      1.1  christos _GL_CXXALIASWARN (rpmatch);
   1215      1.1  christos #elif defined GNULIB_POSIXCHECK
   1216      1.1  christos # undef rpmatch
   1217      1.1  christos # if HAVE_RAW_DECL_RPMATCH
   1218      1.1  christos _GL_WARN_ON_USE (rpmatch, "rpmatch is unportable - "
   1219      1.1  christos                  "use gnulib module rpmatch for portability");
   1220      1.1  christos # endif
   1221      1.1  christos #endif
   1222      1.1  christos 
   1223      1.1  christos #if @GNULIB_SECURE_GETENV@
   1224      1.1  christos /* Look up NAME in the environment, returning 0 in insecure situations.  */
   1225      1.1  christos # if !@HAVE_SECURE_GETENV@
   1226      1.1  christos _GL_FUNCDECL_SYS (secure_getenv, char *,
   1227      1.1  christos                   (char const *name) _GL_ARG_NONNULL ((1)));
   1228      1.1  christos # endif
   1229      1.1  christos _GL_CXXALIAS_SYS (secure_getenv, char *, (char const *name));
   1230      1.1  christos _GL_CXXALIASWARN (secure_getenv);
   1231      1.1  christos #elif defined GNULIB_POSIXCHECK
   1232      1.1  christos # undef secure_getenv
   1233      1.1  christos # if HAVE_RAW_DECL_SECURE_GETENV
   1234      1.1  christos _GL_WARN_ON_USE (secure_getenv, "secure_getenv is unportable - "
   1235      1.1  christos                  "use gnulib module secure_getenv for portability");
   1236      1.1  christos # endif
   1237      1.1  christos #endif
   1238      1.1  christos 
   1239      1.1  christos #if @GNULIB_SETENV@
   1240      1.1  christos /* Set NAME to VALUE in the environment.
   1241      1.1  christos    If REPLACE is nonzero, overwrite an existing value.  */
   1242      1.1  christos # if @REPLACE_SETENV@
   1243      1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1244      1.1  christos #   undef setenv
   1245      1.1  christos #   define setenv rpl_setenv
   1246      1.1  christos #  endif
   1247      1.1  christos _GL_FUNCDECL_RPL (setenv, int,
   1248      1.1  christos                   (const char *name, const char *value, int replace)
   1249      1.1  christos                   _GL_ARG_NONNULL ((1)));
   1250      1.1  christos _GL_CXXALIAS_RPL (setenv, int,
   1251      1.1  christos                   (const char *name, const char *value, int replace));
   1252      1.1  christos # else
   1253      1.1  christos #  if !@HAVE_DECL_SETENV@
   1254      1.1  christos _GL_FUNCDECL_SYS (setenv, int,
   1255      1.1  christos                   (const char *name, const char *value, int replace)
   1256      1.1  christos                   _GL_ARG_NONNULL ((1)));
   1257      1.1  christos #  endif
   1258      1.1  christos _GL_CXXALIAS_SYS (setenv, int,
   1259      1.1  christos                   (const char *name, const char *value, int replace));
   1260      1.1  christos # endif
   1261      1.1  christos # if !(@REPLACE_SETENV@ && !@HAVE_DECL_SETENV@)
   1262      1.1  christos _GL_CXXALIASWARN (setenv);
   1263      1.1  christos # endif
   1264      1.1  christos #elif defined GNULIB_POSIXCHECK
   1265      1.1  christos # undef setenv
   1266      1.1  christos # if HAVE_RAW_DECL_SETENV
   1267      1.1  christos _GL_WARN_ON_USE (setenv, "setenv is unportable - "
   1268      1.1  christos                  "use gnulib module setenv for portability");
   1269      1.1  christos # endif
   1270      1.1  christos #endif
   1271      1.1  christos 
   1272      1.1  christos #if @GNULIB_STRTOD@
   1273      1.1  christos  /* Parse a double from STRING, updating ENDP if appropriate.  */
   1274      1.1  christos # if @REPLACE_STRTOD@
   1275      1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1276      1.1  christos #   define strtod rpl_strtod
   1277      1.1  christos #  endif
   1278      1.1  christos #  define GNULIB_defined_strtod_function 1
   1279      1.1  christos _GL_FUNCDECL_RPL (strtod, double,
   1280      1.1  christos                   (const char *restrict str, char **restrict endp)
   1281      1.1  christos                   _GL_ARG_NONNULL ((1)));
   1282      1.1  christos _GL_CXXALIAS_RPL (strtod, double,
   1283      1.1  christos                   (const char *restrict str, char **restrict endp));
   1284      1.1  christos # else
   1285      1.1  christos #  if !@HAVE_STRTOD@
   1286      1.1  christos _GL_FUNCDECL_SYS (strtod, double,
   1287      1.1  christos                   (const char *restrict str, char **restrict endp)
   1288      1.1  christos                   _GL_ARG_NONNULL ((1)));
   1289      1.1  christos #  endif
   1290      1.1  christos _GL_CXXALIAS_SYS (strtod, double,
   1291      1.1  christos                   (const char *restrict str, char **restrict endp));
   1292      1.1  christos # endif
   1293      1.1  christos # if __GLIBC__ >= 2
   1294      1.1  christos _GL_CXXALIASWARN (strtod);
   1295      1.1  christos # endif
   1296      1.1  christos #elif defined GNULIB_POSIXCHECK
   1297      1.1  christos # undef strtod
   1298      1.1  christos # if HAVE_RAW_DECL_STRTOD
   1299      1.1  christos _GL_WARN_ON_USE (strtod, "strtod is unportable - "
   1300      1.1  christos                  "use gnulib module strtod for portability");
   1301      1.1  christos # endif
   1302      1.1  christos #endif
   1303      1.1  christos 
   1304      1.1  christos #if @GNULIB_STRTOLD@
   1305      1.1  christos  /* Parse a 'long double' from STRING, updating ENDP if appropriate.  */
   1306      1.1  christos # if @REPLACE_STRTOLD@
   1307      1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1308      1.1  christos #   define strtold rpl_strtold
   1309      1.1  christos #  endif
   1310      1.1  christos #  define GNULIB_defined_strtold_function 1
   1311      1.1  christos _GL_FUNCDECL_RPL (strtold, long double,
   1312      1.1  christos                   (const char *restrict str, char **restrict endp)
   1313      1.1  christos                   _GL_ARG_NONNULL ((1)));
   1314      1.1  christos _GL_CXXALIAS_RPL (strtold, long double,
   1315      1.1  christos                   (const char *restrict str, char **restrict endp));
   1316      1.1  christos # else
   1317      1.1  christos #  if !@HAVE_STRTOLD@
   1318      1.1  christos _GL_FUNCDECL_SYS (strtold, long double,
   1319      1.1  christos                   (const char *restrict str, char **restrict endp)
   1320      1.1  christos                   _GL_ARG_NONNULL ((1)));
   1321      1.1  christos #  endif
   1322      1.1  christos _GL_CXXALIAS_SYS (strtold, long double,
   1323      1.1  christos                   (const char *restrict str, char **restrict endp));
   1324      1.1  christos # endif
   1325      1.1  christos _GL_CXXALIASWARN (strtold);
   1326      1.1  christos #elif defined GNULIB_POSIXCHECK
   1327      1.1  christos # undef strtold
   1328      1.1  christos # if HAVE_RAW_DECL_STRTOLD
   1329      1.1  christos _GL_WARN_ON_USE (strtold, "strtold is unportable - "
   1330      1.1  christos                  "use gnulib module strtold for portability");
   1331      1.1  christos # endif
   1332      1.1  christos #endif
   1333      1.1  christos 
   1334  1.1.1.2  christos #if @GNULIB_STRTOL@
   1335  1.1.1.2  christos /* Parse a signed integer whose textual representation starts at STRING.
   1336  1.1.1.2  christos    The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
   1337  1.1.1.2  christos    it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
   1338  1.1.1.2  christos    "0x").
   1339  1.1.1.2  christos    If ENDPTR is not NULL, the address of the first byte after the integer is
   1340  1.1.1.2  christos    stored in *ENDPTR.
   1341  1.1.1.2  christos    Upon overflow, the return value is LONG_MAX or LONG_MIN, and errno is set
   1342  1.1.1.2  christos    to ERANGE.  */
   1343  1.1.1.2  christos # if @REPLACE_STRTOL@
   1344  1.1.1.2  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1345  1.1.1.2  christos #   define strtol rpl_strtol
   1346  1.1.1.2  christos #  endif
   1347  1.1.1.2  christos #  define GNULIB_defined_strtol_function 1
   1348  1.1.1.2  christos _GL_FUNCDECL_RPL (strtol, long,
   1349  1.1.1.2  christos                   (const char *restrict string, char **restrict endptr,
   1350  1.1.1.2  christos                    int base)
   1351  1.1.1.2  christos                   _GL_ARG_NONNULL ((1)));
   1352  1.1.1.2  christos _GL_CXXALIAS_RPL (strtol, long,
   1353  1.1.1.2  christos                   (const char *restrict string, char **restrict endptr,
   1354  1.1.1.2  christos                    int base));
   1355  1.1.1.2  christos # else
   1356  1.1.1.2  christos #  if !@HAVE_STRTOL@
   1357  1.1.1.2  christos _GL_FUNCDECL_SYS (strtol, long,
   1358  1.1.1.2  christos                   (const char *restrict string, char **restrict endptr,
   1359  1.1.1.2  christos                    int base)
   1360  1.1.1.2  christos                   _GL_ARG_NONNULL ((1)));
   1361  1.1.1.2  christos #  endif
   1362  1.1.1.2  christos _GL_CXXALIAS_SYS (strtol, long,
   1363  1.1.1.2  christos                   (const char *restrict string, char **restrict endptr,
   1364  1.1.1.2  christos                    int base));
   1365  1.1.1.2  christos # endif
   1366  1.1.1.2  christos _GL_CXXALIASWARN (strtol);
   1367  1.1.1.2  christos #elif defined GNULIB_POSIXCHECK
   1368  1.1.1.2  christos # undef strtol
   1369  1.1.1.2  christos # if HAVE_RAW_DECL_STRTOL
   1370  1.1.1.2  christos _GL_WARN_ON_USE (strtol, "strtol is unportable - "
   1371  1.1.1.2  christos                  "use gnulib module strtol for portability");
   1372  1.1.1.2  christos # endif
   1373  1.1.1.2  christos #endif
   1374  1.1.1.2  christos 
   1375      1.1  christos #if @GNULIB_STRTOLL@
   1376      1.1  christos /* Parse a signed integer whose textual representation starts at STRING.
   1377      1.1  christos    The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
   1378      1.1  christos    it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
   1379      1.1  christos    "0x").
   1380      1.1  christos    If ENDPTR is not NULL, the address of the first byte after the integer is
   1381      1.1  christos    stored in *ENDPTR.
   1382      1.1  christos    Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
   1383      1.1  christos    to ERANGE.  */
   1384  1.1.1.2  christos # if @REPLACE_STRTOLL@
   1385  1.1.1.2  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1386  1.1.1.2  christos #   define strtoll rpl_strtoll
   1387  1.1.1.2  christos #  endif
   1388  1.1.1.2  christos #  define GNULIB_defined_strtoll_function 1
   1389  1.1.1.2  christos _GL_FUNCDECL_RPL (strtoll, long long,
   1390  1.1.1.2  christos                   (const char *restrict string, char **restrict endptr,
   1391  1.1.1.2  christos                    int base)
   1392  1.1.1.2  christos                   _GL_ARG_NONNULL ((1)));
   1393  1.1.1.2  christos _GL_CXXALIAS_RPL (strtoll, long long,
   1394  1.1.1.2  christos                   (const char *restrict string, char **restrict endptr,
   1395  1.1.1.2  christos                    int base));
   1396  1.1.1.2  christos # else
   1397  1.1.1.2  christos #  if !@HAVE_STRTOLL@
   1398      1.1  christos _GL_FUNCDECL_SYS (strtoll, long long,
   1399      1.1  christos                   (const char *restrict string, char **restrict endptr,
   1400      1.1  christos                    int base)
   1401      1.1  christos                   _GL_ARG_NONNULL ((1)));
   1402  1.1.1.2  christos #  endif
   1403      1.1  christos _GL_CXXALIAS_SYS (strtoll, long long,
   1404      1.1  christos                   (const char *restrict string, char **restrict endptr,
   1405      1.1  christos                    int base));
   1406  1.1.1.2  christos # endif
   1407      1.1  christos _GL_CXXALIASWARN (strtoll);
   1408      1.1  christos #elif defined GNULIB_POSIXCHECK
   1409      1.1  christos # undef strtoll
   1410      1.1  christos # if HAVE_RAW_DECL_STRTOLL
   1411      1.1  christos _GL_WARN_ON_USE (strtoll, "strtoll is unportable - "
   1412      1.1  christos                  "use gnulib module strtoll for portability");
   1413      1.1  christos # endif
   1414      1.1  christos #endif
   1415      1.1  christos 
   1416  1.1.1.2  christos #if @GNULIB_STRTOUL@
   1417  1.1.1.2  christos /* Parse an unsigned integer whose textual representation starts at STRING.
   1418  1.1.1.2  christos    The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
   1419  1.1.1.2  christos    it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
   1420  1.1.1.2  christos    "0x").
   1421  1.1.1.2  christos    If ENDPTR is not NULL, the address of the first byte after the integer is
   1422  1.1.1.2  christos    stored in *ENDPTR.
   1423  1.1.1.2  christos    Upon overflow, the return value is ULONG_MAX, and errno is set to ERANGE.  */
   1424  1.1.1.2  christos # if @REPLACE_STRTOUL@
   1425  1.1.1.2  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1426  1.1.1.2  christos #   define strtoul rpl_strtoul
   1427  1.1.1.2  christos #  endif
   1428  1.1.1.2  christos #  define GNULIB_defined_strtoul_function 1
   1429  1.1.1.2  christos _GL_FUNCDECL_RPL (strtoul, unsigned long,
   1430  1.1.1.2  christos                   (const char *restrict string, char **restrict endptr,
   1431  1.1.1.2  christos                    int base)
   1432  1.1.1.2  christos                   _GL_ARG_NONNULL ((1)));
   1433  1.1.1.2  christos _GL_CXXALIAS_RPL (strtoul, unsigned long,
   1434  1.1.1.2  christos                   (const char *restrict string, char **restrict endptr,
   1435  1.1.1.2  christos                    int base));
   1436  1.1.1.2  christos # else
   1437  1.1.1.2  christos #  if !@HAVE_STRTOUL@
   1438  1.1.1.2  christos _GL_FUNCDECL_SYS (strtoul, unsigned long,
   1439  1.1.1.2  christos                   (const char *restrict string, char **restrict endptr,
   1440  1.1.1.2  christos                    int base)
   1441  1.1.1.2  christos                   _GL_ARG_NONNULL ((1)));
   1442  1.1.1.2  christos #  endif
   1443  1.1.1.2  christos _GL_CXXALIAS_SYS (strtoul, unsigned long,
   1444  1.1.1.2  christos                   (const char *restrict string, char **restrict endptr,
   1445  1.1.1.2  christos                    int base));
   1446  1.1.1.2  christos # endif
   1447  1.1.1.2  christos _GL_CXXALIASWARN (strtoul);
   1448  1.1.1.2  christos #elif defined GNULIB_POSIXCHECK
   1449  1.1.1.2  christos # undef strtoul
   1450  1.1.1.2  christos # if HAVE_RAW_DECL_STRTOUL
   1451  1.1.1.2  christos _GL_WARN_ON_USE (strtoul, "strtoul is unportable - "
   1452  1.1.1.2  christos                  "use gnulib module strtoul for portability");
   1453  1.1.1.2  christos # endif
   1454  1.1.1.2  christos #endif
   1455  1.1.1.2  christos 
   1456      1.1  christos #if @GNULIB_STRTOULL@
   1457      1.1  christos /* Parse an unsigned integer whose textual representation starts at STRING.
   1458      1.1  christos    The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
   1459      1.1  christos    it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
   1460      1.1  christos    "0x").
   1461      1.1  christos    If ENDPTR is not NULL, the address of the first byte after the integer is
   1462      1.1  christos    stored in *ENDPTR.
   1463      1.1  christos    Upon overflow, the return value is ULLONG_MAX, and errno is set to
   1464      1.1  christos    ERANGE.  */
   1465  1.1.1.2  christos # if @REPLACE_STRTOULL@
   1466  1.1.1.2  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1467  1.1.1.2  christos #   define strtoull rpl_strtoull
   1468  1.1.1.2  christos #  endif
   1469  1.1.1.2  christos #  define GNULIB_defined_strtoull_function 1
   1470  1.1.1.2  christos _GL_FUNCDECL_RPL (strtoull, unsigned long long,
   1471  1.1.1.2  christos                   (const char *restrict string, char **restrict endptr,
   1472  1.1.1.2  christos                    int base)
   1473  1.1.1.2  christos                   _GL_ARG_NONNULL ((1)));
   1474  1.1.1.2  christos _GL_CXXALIAS_RPL (strtoull, unsigned long long,
   1475  1.1.1.2  christos                   (const char *restrict string, char **restrict endptr,
   1476  1.1.1.2  christos                    int base));
   1477  1.1.1.2  christos # else
   1478  1.1.1.2  christos #  if !@HAVE_STRTOULL@
   1479      1.1  christos _GL_FUNCDECL_SYS (strtoull, unsigned long long,
   1480      1.1  christos                   (const char *restrict string, char **restrict endptr,
   1481      1.1  christos                    int base)
   1482      1.1  christos                   _GL_ARG_NONNULL ((1)));
   1483  1.1.1.2  christos #  endif
   1484      1.1  christos _GL_CXXALIAS_SYS (strtoull, unsigned long long,
   1485      1.1  christos                   (const char *restrict string, char **restrict endptr,
   1486      1.1  christos                    int base));
   1487  1.1.1.2  christos # endif
   1488      1.1  christos _GL_CXXALIASWARN (strtoull);
   1489      1.1  christos #elif defined GNULIB_POSIXCHECK
   1490      1.1  christos # undef strtoull
   1491      1.1  christos # if HAVE_RAW_DECL_STRTOULL
   1492      1.1  christos _GL_WARN_ON_USE (strtoull, "strtoull is unportable - "
   1493      1.1  christos                  "use gnulib module strtoull for portability");
   1494      1.1  christos # endif
   1495      1.1  christos #endif
   1496      1.1  christos 
   1497      1.1  christos #if @GNULIB_UNLOCKPT@
   1498      1.1  christos /* Unlock the slave side of the pseudo-terminal whose master side is specified
   1499      1.1  christos    by FD, so that it can be opened.  */
   1500      1.1  christos # if !@HAVE_UNLOCKPT@
   1501      1.1  christos _GL_FUNCDECL_SYS (unlockpt, int, (int fd));
   1502      1.1  christos # endif
   1503      1.1  christos _GL_CXXALIAS_SYS (unlockpt, int, (int fd));
   1504      1.1  christos _GL_CXXALIASWARN (unlockpt);
   1505      1.1  christos #elif defined GNULIB_POSIXCHECK
   1506      1.1  christos # undef unlockpt
   1507      1.1  christos # if HAVE_RAW_DECL_UNLOCKPT
   1508      1.1  christos _GL_WARN_ON_USE (unlockpt, "unlockpt is not portable - "
   1509      1.1  christos                  "use gnulib module unlockpt for portability");
   1510      1.1  christos # endif
   1511      1.1  christos #endif
   1512      1.1  christos 
   1513      1.1  christos #if @GNULIB_UNSETENV@
   1514      1.1  christos /* Remove the variable NAME from the environment.  */
   1515      1.1  christos # if @REPLACE_UNSETENV@
   1516      1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1517      1.1  christos #   undef unsetenv
   1518      1.1  christos #   define unsetenv rpl_unsetenv
   1519      1.1  christos #  endif
   1520      1.1  christos _GL_FUNCDECL_RPL (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
   1521      1.1  christos _GL_CXXALIAS_RPL (unsetenv, int, (const char *name));
   1522      1.1  christos # else
   1523      1.1  christos #  if !@HAVE_DECL_UNSETENV@
   1524      1.1  christos _GL_FUNCDECL_SYS (unsetenv, int, (const char *name) _GL_ARG_NONNULL ((1)));
   1525      1.1  christos #  endif
   1526      1.1  christos _GL_CXXALIAS_SYS (unsetenv, int, (const char *name));
   1527      1.1  christos # endif
   1528      1.1  christos # if !(@REPLACE_UNSETENV@ && !@HAVE_DECL_UNSETENV@)
   1529      1.1  christos _GL_CXXALIASWARN (unsetenv);
   1530      1.1  christos # endif
   1531      1.1  christos #elif defined GNULIB_POSIXCHECK
   1532      1.1  christos # undef unsetenv
   1533      1.1  christos # if HAVE_RAW_DECL_UNSETENV
   1534      1.1  christos _GL_WARN_ON_USE (unsetenv, "unsetenv is unportable - "
   1535      1.1  christos                  "use gnulib module unsetenv for portability");
   1536      1.1  christos # endif
   1537      1.1  christos #endif
   1538      1.1  christos 
   1539      1.1  christos /* Convert a wide character to a multibyte character.  */
   1540      1.1  christos #if @GNULIB_WCTOMB@
   1541      1.1  christos # if @REPLACE_WCTOMB@
   1542      1.1  christos #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
   1543      1.1  christos #   undef wctomb
   1544      1.1  christos #   define wctomb rpl_wctomb
   1545      1.1  christos #  endif
   1546      1.1  christos _GL_FUNCDECL_RPL (wctomb, int, (char *s, wchar_t wc));
   1547      1.1  christos _GL_CXXALIAS_RPL (wctomb, int, (char *s, wchar_t wc));
   1548      1.1  christos # else
   1549      1.1  christos _GL_CXXALIAS_SYS (wctomb, int, (char *s, wchar_t wc));
   1550      1.1  christos # endif
   1551      1.1  christos # if __GLIBC__ >= 2
   1552      1.1  christos _GL_CXXALIASWARN (wctomb);
   1553      1.1  christos # endif
   1554      1.1  christos #endif
   1555      1.1  christos 
   1556      1.1  christos 
   1557      1.1  christos #endif /* _@GUARD_PREFIX@_STDLIB_H */
   1558      1.1  christos #endif /* _@GUARD_PREFIX@_STDLIB_H */
   1559      1.1  christos #endif
   1560