hjl / source-git / glibc

Forked from source-git/glibc 3 years ago
Clone

Blame stdlib/stdlib.h

Packit 6c4009
/* Copyright (C) 1991-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 *	ISO C99 Standard: 7.20 General utilities	<stdlib.h>
Packit 6c4009
 */
Packit 6c4009
Packit 6c4009
#ifndef	_STDLIB_H
Packit 6c4009
Packit 6c4009
#define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
Packit 6c4009
#include <bits/libc-header-start.h>
Packit 6c4009
Packit 6c4009
/* Get size_t, wchar_t and NULL from <stddef.h>.  */
Packit 6c4009
#define __need_size_t
Packit 6c4009
#define __need_wchar_t
Packit 6c4009
#define __need_NULL
Packit 6c4009
#include <stddef.h>
Packit 6c4009
Packit 6c4009
__BEGIN_DECLS
Packit 6c4009
Packit 6c4009
#define	_STDLIB_H	1
Packit 6c4009
Packit 6c4009
#if (defined __USE_XOPEN || defined __USE_XOPEN2K8) && !defined _SYS_WAIT_H
Packit 6c4009
/* XPG requires a few symbols from <sys/wait.h> being defined.  */
Packit 6c4009
# include <bits/waitflags.h>
Packit 6c4009
# include <bits/waitstatus.h>
Packit 6c4009
Packit 6c4009
/* Define the macros <sys/wait.h> also would define this way.  */
Packit 6c4009
# define WEXITSTATUS(status)	__WEXITSTATUS (status)
Packit 6c4009
# define WTERMSIG(status)	__WTERMSIG (status)
Packit 6c4009
# define WSTOPSIG(status)	__WSTOPSIG (status)
Packit 6c4009
# define WIFEXITED(status)	__WIFEXITED (status)
Packit 6c4009
# define WIFSIGNALED(status)	__WIFSIGNALED (status)
Packit 6c4009
# define WIFSTOPPED(status)	__WIFSTOPPED (status)
Packit 6c4009
# ifdef __WIFCONTINUED
Packit 6c4009
#  define WIFCONTINUED(status)	__WIFCONTINUED (status)
Packit 6c4009
# endif
Packit 6c4009
#endif	/* X/Open or XPG7 and <sys/wait.h> not included.  */
Packit 6c4009
Packit 6c4009
/* _FloatN API tests for enablement.  */
Packit 6c4009
#include <bits/floatn.h>
Packit 6c4009
Packit 6c4009
/* Returned by `div'.  */
Packit 6c4009
typedef struct
Packit 6c4009
  {
Packit 6c4009
    int quot;			/* Quotient.  */
Packit 6c4009
    int rem;			/* Remainder.  */
Packit 6c4009
  } div_t;
Packit 6c4009
Packit 6c4009
/* Returned by `ldiv'.  */
Packit 6c4009
#ifndef __ldiv_t_defined
Packit 6c4009
typedef struct
Packit 6c4009
  {
Packit 6c4009
    long int quot;		/* Quotient.  */
Packit 6c4009
    long int rem;		/* Remainder.  */
Packit 6c4009
  } ldiv_t;
Packit 6c4009
# define __ldiv_t_defined	1
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if defined __USE_ISOC99 && !defined __lldiv_t_defined
Packit 6c4009
/* Returned by `lldiv'.  */
Packit 6c4009
__extension__ typedef struct
Packit 6c4009
  {
Packit 6c4009
    long long int quot;		/* Quotient.  */
Packit 6c4009
    long long int rem;		/* Remainder.  */
Packit 6c4009
  } lldiv_t;
Packit 6c4009
# define __lldiv_t_defined	1
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* The largest number rand will return (same as INT_MAX).  */
Packit 6c4009
#define	RAND_MAX	2147483647
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* We define these the same for all machines.
Packit 6c4009
   Changes from this to the outside world should be done in `_exit'.  */
Packit 6c4009
#define	EXIT_FAILURE	1	/* Failing exit status.  */
Packit 6c4009
#define	EXIT_SUCCESS	0	/* Successful exit status.  */
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Maximum length of a multibyte character in the current locale.  */
Packit 6c4009
#define	MB_CUR_MAX	(__ctype_get_mb_cur_max ())
Packit 6c4009
extern size_t __ctype_get_mb_cur_max (void) __THROW __wur;
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Convert a string to a floating-point number.  */
Packit 6c4009
extern double atof (const char *__nptr)
Packit 6c4009
     __THROW __attribute_pure__ __nonnull ((1)) __wur;
Packit 6c4009
/* Convert a string to an integer.  */
Packit 6c4009
extern int atoi (const char *__nptr)
Packit 6c4009
     __THROW __attribute_pure__ __nonnull ((1)) __wur;
Packit 6c4009
/* Convert a string to a long integer.  */
Packit 6c4009
extern long int atol (const char *__nptr)
Packit 6c4009
     __THROW __attribute_pure__ __nonnull ((1)) __wur;
Packit 6c4009
Packit 6c4009
#ifdef __USE_ISOC99
Packit 6c4009
/* Convert a string to a long long integer.  */
Packit 6c4009
__extension__ extern long long int atoll (const char *__nptr)
Packit 6c4009
     __THROW __attribute_pure__ __nonnull ((1)) __wur;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Convert a string to a floating-point number.  */
Packit 6c4009
extern double strtod (const char *__restrict __nptr,
Packit 6c4009
		      char **__restrict __endptr)
Packit 6c4009
     __THROW __nonnull ((1));
Packit 6c4009
Packit 6c4009
#ifdef	__USE_ISOC99
Packit 6c4009
/* Likewise for `float' and `long double' sizes of floating-point numbers.  */
Packit 6c4009
extern float strtof (const char *__restrict __nptr,
Packit 6c4009
		     char **__restrict __endptr) __THROW __nonnull ((1));
Packit 6c4009
Packit 6c4009
extern long double strtold (const char *__restrict __nptr,
Packit 6c4009
			    char **__restrict __endptr)
Packit 6c4009
     __THROW __nonnull ((1));
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Likewise for '_FloatN' and '_FloatNx'.  */
Packit 6c4009
Packit 6c4009
#if __HAVE_FLOAT16 && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
extern _Float16 strtof16 (const char *__restrict __nptr,
Packit 6c4009
			  char **__restrict __endptr)
Packit 6c4009
     __THROW __nonnull ((1));
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if __HAVE_FLOAT32 && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
extern _Float32 strtof32 (const char *__restrict __nptr,
Packit 6c4009
			  char **__restrict __endptr)
Packit 6c4009
     __THROW __nonnull ((1));
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if __HAVE_FLOAT64 && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
extern _Float64 strtof64 (const char *__restrict __nptr,
Packit 6c4009
			  char **__restrict __endptr)
Packit 6c4009
     __THROW __nonnull ((1));
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if __HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
extern _Float128 strtof128 (const char *__restrict __nptr,
Packit 6c4009
			    char **__restrict __endptr)
Packit 6c4009
     __THROW __nonnull ((1));
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if __HAVE_FLOAT32X && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
extern _Float32x strtof32x (const char *__restrict __nptr,
Packit 6c4009
			    char **__restrict __endptr)
Packit 6c4009
     __THROW __nonnull ((1));
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if __HAVE_FLOAT64X && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
extern _Float64x strtof64x (const char *__restrict __nptr,
Packit 6c4009
			    char **__restrict __endptr)
Packit 6c4009
     __THROW __nonnull ((1));
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if __HAVE_FLOAT128X && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
extern _Float128x strtof128x (const char *__restrict __nptr,
Packit 6c4009
			      char **__restrict __endptr)
Packit 6c4009
     __THROW __nonnull ((1));
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Convert a string to a long integer.  */
Packit 6c4009
extern long int strtol (const char *__restrict __nptr,
Packit 6c4009
			char **__restrict __endptr, int __base)
Packit 6c4009
     __THROW __nonnull ((1));
Packit 6c4009
/* Convert a string to an unsigned long integer.  */
Packit 6c4009
extern unsigned long int strtoul (const char *__restrict __nptr,
Packit 6c4009
				  char **__restrict __endptr, int __base)
Packit 6c4009
     __THROW __nonnull ((1));
Packit 6c4009
Packit 6c4009
#ifdef __USE_MISC
Packit 6c4009
/* Convert a string to a quadword integer.  */
Packit 6c4009
__extension__
Packit 6c4009
extern long long int strtoq (const char *__restrict __nptr,
Packit 6c4009
			     char **__restrict __endptr, int __base)
Packit 6c4009
     __THROW __nonnull ((1));
Packit 6c4009
/* Convert a string to an unsigned quadword integer.  */
Packit 6c4009
__extension__
Packit 6c4009
extern unsigned long long int strtouq (const char *__restrict __nptr,
Packit 6c4009
				       char **__restrict __endptr, int __base)
Packit 6c4009
     __THROW __nonnull ((1));
Packit 6c4009
#endif /* Use misc.  */
Packit 6c4009
Packit 6c4009
#ifdef __USE_ISOC99
Packit 6c4009
/* Convert a string to a quadword integer.  */
Packit 6c4009
__extension__
Packit 6c4009
extern long long int strtoll (const char *__restrict __nptr,
Packit 6c4009
			      char **__restrict __endptr, int __base)
Packit 6c4009
     __THROW __nonnull ((1));
Packit 6c4009
/* Convert a string to an unsigned quadword integer.  */
Packit 6c4009
__extension__
Packit 6c4009
extern unsigned long long int strtoull (const char *__restrict __nptr,
Packit 6c4009
					char **__restrict __endptr, int __base)
Packit 6c4009
     __THROW __nonnull ((1));
Packit 6c4009
#endif /* ISO C99 or use MISC.  */
Packit 6c4009
Packit 6c4009
/* Convert a floating-point number to a string.  */
Packit 6c4009
#if __GLIBC_USE (IEC_60559_BFP_EXT)
Packit 6c4009
extern int strfromd (char *__dest, size_t __size, const char *__format,
Packit 6c4009
		     double __f)
Packit 6c4009
     __THROW __nonnull ((3));
Packit 6c4009
Packit 6c4009
extern int strfromf (char *__dest, size_t __size, const char *__format,
Packit 6c4009
		     float __f)
Packit 6c4009
     __THROW __nonnull ((3));
Packit 6c4009
Packit 6c4009
extern int strfroml (char *__dest, size_t __size, const char *__format,
Packit 6c4009
		     long double __f)
Packit 6c4009
     __THROW __nonnull ((3));
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if __HAVE_FLOAT16 && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
extern int strfromf16 (char *__dest, size_t __size, const char * __format,
Packit 6c4009
		       _Float16 __f)
Packit 6c4009
     __THROW __nonnull ((3));
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if __HAVE_FLOAT32 && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
extern int strfromf32 (char *__dest, size_t __size, const char * __format,
Packit 6c4009
		       _Float32 __f)
Packit 6c4009
     __THROW __nonnull ((3));
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if __HAVE_FLOAT64 && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
extern int strfromf64 (char *__dest, size_t __size, const char * __format,
Packit 6c4009
		       _Float64 __f)
Packit 6c4009
     __THROW __nonnull ((3));
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if __HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
extern int strfromf128 (char *__dest, size_t __size, const char * __format,
Packit 6c4009
			_Float128 __f)
Packit 6c4009
     __THROW __nonnull ((3));
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if __HAVE_FLOAT32X && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
extern int strfromf32x (char *__dest, size_t __size, const char * __format,
Packit 6c4009
			_Float32x __f)
Packit 6c4009
     __THROW __nonnull ((3));
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if __HAVE_FLOAT64X && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
extern int strfromf64x (char *__dest, size_t __size, const char * __format,
Packit 6c4009
			_Float64x __f)
Packit 6c4009
     __THROW __nonnull ((3));
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if __HAVE_FLOAT128X && __GLIBC_USE (IEC_60559_TYPES_EXT)
Packit 6c4009
extern int strfromf128x (char *__dest, size_t __size, const char * __format,
Packit 6c4009
			 _Float128x __f)
Packit 6c4009
     __THROW __nonnull ((3));
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
Packit 6c4009
#ifdef __USE_GNU
Packit 6c4009
/* Parallel versions of the functions above which take the locale to
Packit 6c4009
   use as an additional parameter.  These are GNU extensions inspired
Packit 6c4009
   by the POSIX.1-2008 extended locale API.  */
Packit 6c4009
# include <bits/types/locale_t.h>
Packit 6c4009
Packit 6c4009
extern long int strtol_l (const char *__restrict __nptr,
Packit 6c4009
			  char **__restrict __endptr, int __base,
Packit 6c4009
			  locale_t __loc) __THROW __nonnull ((1, 4));
Packit 6c4009
Packit 6c4009
extern unsigned long int strtoul_l (const char *__restrict __nptr,
Packit 6c4009
				    char **__restrict __endptr,
Packit 6c4009
				    int __base, locale_t __loc)
Packit 6c4009
     __THROW __nonnull ((1, 4));
Packit 6c4009
Packit 6c4009
__extension__
Packit 6c4009
extern long long int strtoll_l (const char *__restrict __nptr,
Packit 6c4009
				char **__restrict __endptr, int __base,
Packit 6c4009
				locale_t __loc)
Packit 6c4009
     __THROW __nonnull ((1, 4));
Packit 6c4009
Packit 6c4009
__extension__
Packit 6c4009
extern unsigned long long int strtoull_l (const char *__restrict __nptr,
Packit 6c4009
					  char **__restrict __endptr,
Packit 6c4009
					  int __base, locale_t __loc)
Packit 6c4009
     __THROW __nonnull ((1, 4));
Packit 6c4009
Packit 6c4009
extern double strtod_l (const char *__restrict __nptr,
Packit 6c4009
			char **__restrict __endptr, locale_t __loc)
Packit 6c4009
     __THROW __nonnull ((1, 3));
Packit 6c4009
Packit 6c4009
extern float strtof_l (const char *__restrict __nptr,
Packit 6c4009
		       char **__restrict __endptr, locale_t __loc)
Packit 6c4009
     __THROW __nonnull ((1, 3));
Packit 6c4009
Packit 6c4009
extern long double strtold_l (const char *__restrict __nptr,
Packit 6c4009
			      char **__restrict __endptr,
Packit 6c4009
			      locale_t __loc)
Packit 6c4009
     __THROW __nonnull ((1, 3));
Packit 6c4009
Packit 6c4009
# if __HAVE_FLOAT16
Packit 6c4009
extern _Float16 strtof16_l (const char *__restrict __nptr,
Packit 6c4009
			    char **__restrict __endptr,
Packit 6c4009
			    locale_t __loc)
Packit 6c4009
     __THROW __nonnull ((1, 3));
Packit 6c4009
# endif
Packit 6c4009
Packit 6c4009
# if __HAVE_FLOAT32
Packit 6c4009
extern _Float32 strtof32_l (const char *__restrict __nptr,
Packit 6c4009
			    char **__restrict __endptr,
Packit 6c4009
			    locale_t __loc)
Packit 6c4009
     __THROW __nonnull ((1, 3));
Packit 6c4009
# endif
Packit 6c4009
Packit 6c4009
# if __HAVE_FLOAT64
Packit 6c4009
extern _Float64 strtof64_l (const char *__restrict __nptr,
Packit 6c4009
			    char **__restrict __endptr,
Packit 6c4009
			    locale_t __loc)
Packit 6c4009
     __THROW __nonnull ((1, 3));
Packit 6c4009
# endif
Packit 6c4009
Packit 6c4009
# if __HAVE_FLOAT128
Packit 6c4009
extern _Float128 strtof128_l (const char *__restrict __nptr,
Packit 6c4009
			      char **__restrict __endptr,
Packit 6c4009
			      locale_t __loc)
Packit 6c4009
     __THROW __nonnull ((1, 3));
Packit 6c4009
# endif
Packit 6c4009
Packit 6c4009
# if __HAVE_FLOAT32X
Packit 6c4009
extern _Float32x strtof32x_l (const char *__restrict __nptr,
Packit 6c4009
			      char **__restrict __endptr,
Packit 6c4009
			      locale_t __loc)
Packit 6c4009
     __THROW __nonnull ((1, 3));
Packit 6c4009
# endif
Packit 6c4009
Packit 6c4009
# if __HAVE_FLOAT64X
Packit 6c4009
extern _Float64x strtof64x_l (const char *__restrict __nptr,
Packit 6c4009
			      char **__restrict __endptr,
Packit 6c4009
			      locale_t __loc)
Packit 6c4009
     __THROW __nonnull ((1, 3));
Packit 6c4009
# endif
Packit 6c4009
Packit 6c4009
# if __HAVE_FLOAT128X
Packit 6c4009
extern _Float128x strtof128x_l (const char *__restrict __nptr,
Packit 6c4009
				char **__restrict __endptr,
Packit 6c4009
				locale_t __loc)
Packit 6c4009
     __THROW __nonnull ((1, 3));
Packit 6c4009
# endif
Packit 6c4009
#endif /* GNU */
Packit 6c4009
Packit 6c4009
Packit 6c4009
#ifdef __USE_EXTERN_INLINES
Packit 6c4009
__extern_inline int
Packit 6c4009
__NTH (atoi (const char *__nptr))
Packit 6c4009
{
Packit 6c4009
  return (int) strtol (__nptr, (char **) NULL, 10);
Packit 6c4009
}
Packit 6c4009
__extern_inline long int
Packit 6c4009
__NTH (atol (const char *__nptr))
Packit 6c4009
{
Packit 6c4009
  return strtol (__nptr, (char **) NULL, 10);
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
# ifdef __USE_ISOC99
Packit 6c4009
__extension__ __extern_inline long long int
Packit 6c4009
__NTH (atoll (const char *__nptr))
Packit 6c4009
{
Packit 6c4009
  return strtoll (__nptr, (char **) NULL, 10);
Packit 6c4009
}
Packit 6c4009
# endif
Packit 6c4009
#endif /* Optimizing and Inlining.  */
Packit 6c4009
Packit 6c4009
Packit 6c4009
#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
Packit 6c4009
/* Convert N to base 64 using the digits "./0-9A-Za-z", least-significant
Packit 6c4009
   digit first.  Returns a pointer to static storage overwritten by the
Packit 6c4009
   next call.  */
Packit 6c4009
extern char *l64a (long int __n) __THROW __wur;
Packit 6c4009
Packit 6c4009
/* Read a number from a string S in base 64 as above.  */
Packit 6c4009
extern long int a64l (const char *__s)
Packit 6c4009
     __THROW __attribute_pure__ __nonnull ((1)) __wur;
Packit 6c4009
Packit 6c4009
#endif	/* Use misc || extended X/Open.  */
Packit 6c4009
Packit 6c4009
#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
Packit 6c4009
# include <sys/types.h>	/* we need int32_t... */
Packit 6c4009
Packit 6c4009
/* These are the functions that actually do things.  The `random', `srandom',
Packit 6c4009
   `initstate' and `setstate' functions are those from BSD Unices.
Packit 6c4009
   The `rand' and `srand' functions are required by the ANSI standard.
Packit 6c4009
   We provide both interfaces to the same random number generator.  */
Packit 6c4009
/* Return a random long integer between 0 and RAND_MAX inclusive.  */
Packit 6c4009
extern long int random (void) __THROW;
Packit 6c4009
Packit 6c4009
/* Seed the random number generator with the given number.  */
Packit 6c4009
extern void srandom (unsigned int __seed) __THROW;
Packit 6c4009
Packit 6c4009
/* Initialize the random number generator to use state buffer STATEBUF,
Packit 6c4009
   of length STATELEN, and seed it with SEED.  Optimal lengths are 8, 16,
Packit 6c4009
   32, 64, 128 and 256, the bigger the better; values less than 8 will
Packit 6c4009
   cause an error and values greater than 256 will be rounded down.  */
Packit 6c4009
extern char *initstate (unsigned int __seed, char *__statebuf,
Packit 6c4009
			size_t __statelen) __THROW __nonnull ((2));
Packit 6c4009
Packit 6c4009
/* Switch the random number generator to state buffer STATEBUF,
Packit 6c4009
   which should have been previously initialized by `initstate'.  */
Packit 6c4009
extern char *setstate (char *__statebuf) __THROW __nonnull ((1));
Packit 6c4009
Packit 6c4009
Packit 6c4009
# ifdef __USE_MISC
Packit 6c4009
/* Reentrant versions of the `random' family of functions.
Packit 6c4009
   These functions all use the following data structure to contain
Packit 6c4009
   state, rather than global state variables.  */
Packit 6c4009
Packit 6c4009
struct random_data
Packit 6c4009
  {
Packit 6c4009
    int32_t *fptr;		/* Front pointer.  */
Packit 6c4009
    int32_t *rptr;		/* Rear pointer.  */
Packit 6c4009
    int32_t *state;		/* Array of state values.  */
Packit 6c4009
    int rand_type;		/* Type of random number generator.  */
Packit 6c4009
    int rand_deg;		/* Degree of random number generator.  */
Packit 6c4009
    int rand_sep;		/* Distance between front and rear.  */
Packit 6c4009
    int32_t *end_ptr;		/* Pointer behind state table.  */
Packit 6c4009
  };
Packit 6c4009
Packit 6c4009
extern int random_r (struct random_data *__restrict __buf,
Packit 6c4009
		     int32_t *__restrict __result) __THROW __nonnull ((1, 2));
Packit 6c4009
Packit 6c4009
extern int srandom_r (unsigned int __seed, struct random_data *__buf)
Packit 6c4009
     __THROW __nonnull ((2));
Packit 6c4009
Packit 6c4009
extern int initstate_r (unsigned int __seed, char *__restrict __statebuf,
Packit 6c4009
			size_t __statelen,
Packit 6c4009
			struct random_data *__restrict __buf)
Packit 6c4009
     __THROW __nonnull ((2, 4));
Packit 6c4009
Packit 6c4009
extern int setstate_r (char *__restrict __statebuf,
Packit 6c4009
		       struct random_data *__restrict __buf)
Packit 6c4009
     __THROW __nonnull ((1, 2));
Packit 6c4009
# endif	/* Use misc.  */
Packit 6c4009
#endif	/* Use extended X/Open || misc. */
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Return a random integer between 0 and RAND_MAX inclusive.  */
Packit 6c4009
extern int rand (void) __THROW;
Packit 6c4009
/* Seed the random number generator with the given number.  */
Packit 6c4009
extern void srand (unsigned int __seed) __THROW;
Packit 6c4009
Packit 6c4009
#ifdef __USE_POSIX199506
Packit 6c4009
/* Reentrant interface according to POSIX.1.  */
Packit 6c4009
extern int rand_r (unsigned int *__seed) __THROW;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
Packit 6c4009
#if defined __USE_MISC || defined __USE_XOPEN
Packit 6c4009
/* System V style 48-bit random number generator functions.  */
Packit 6c4009
Packit 6c4009
/* Return non-negative, double-precision floating-point value in [0.0,1.0).  */
Packit 6c4009
extern double drand48 (void) __THROW;
Packit 6c4009
extern double erand48 (unsigned short int __xsubi[3]) __THROW __nonnull ((1));
Packit 6c4009
Packit 6c4009
/* Return non-negative, long integer in [0,2^31).  */
Packit 6c4009
extern long int lrand48 (void) __THROW;
Packit 6c4009
extern long int nrand48 (unsigned short int __xsubi[3])
Packit 6c4009
     __THROW __nonnull ((1));
Packit 6c4009
Packit 6c4009
/* Return signed, long integers in [-2^31,2^31).  */
Packit 6c4009
extern long int mrand48 (void) __THROW;
Packit 6c4009
extern long int jrand48 (unsigned short int __xsubi[3])
Packit 6c4009
     __THROW __nonnull ((1));
Packit 6c4009
Packit 6c4009
/* Seed random number generator.  */
Packit 6c4009
extern void srand48 (long int __seedval) __THROW;
Packit 6c4009
extern unsigned short int *seed48 (unsigned short int __seed16v[3])
Packit 6c4009
     __THROW __nonnull ((1));
Packit 6c4009
extern void lcong48 (unsigned short int __param[7]) __THROW __nonnull ((1));
Packit 6c4009
Packit 6c4009
# ifdef __USE_MISC
Packit 6c4009
/* Data structure for communication with thread safe versions.  This
Packit 6c4009
   type is to be regarded as opaque.  It's only exported because users
Packit 6c4009
   have to allocate objects of this type.  */
Packit 6c4009
struct drand48_data
Packit 6c4009
  {
Packit 6c4009
    unsigned short int __x[3];	/* Current state.  */
Packit 6c4009
    unsigned short int __old_x[3]; /* Old state.  */
Packit 6c4009
    unsigned short int __c;	/* Additive const. in congruential formula.  */
Packit 6c4009
    unsigned short int __init;	/* Flag for initializing.  */
Packit 6c4009
    __extension__ unsigned long long int __a;	/* Factor in congruential
Packit 6c4009
						   formula.  */
Packit 6c4009
  };
Packit 6c4009
Packit 6c4009
/* Return non-negative, double-precision floating-point value in [0.0,1.0).  */
Packit 6c4009
extern int drand48_r (struct drand48_data *__restrict __buffer,
Packit 6c4009
		      double *__restrict __result) __THROW __nonnull ((1, 2));
Packit 6c4009
extern int erand48_r (unsigned short int __xsubi[3],
Packit 6c4009
		      struct drand48_data *__restrict __buffer,
Packit 6c4009
		      double *__restrict __result) __THROW __nonnull ((1, 2));
Packit 6c4009
Packit 6c4009
/* Return non-negative, long integer in [0,2^31).  */
Packit 6c4009
extern int lrand48_r (struct drand48_data *__restrict __buffer,
Packit 6c4009
		      long int *__restrict __result)
Packit 6c4009
     __THROW __nonnull ((1, 2));
Packit 6c4009
extern int nrand48_r (unsigned short int __xsubi[3],
Packit 6c4009
		      struct drand48_data *__restrict __buffer,
Packit 6c4009
		      long int *__restrict __result)
Packit 6c4009
     __THROW __nonnull ((1, 2));
Packit 6c4009
Packit 6c4009
/* Return signed, long integers in [-2^31,2^31).  */
Packit 6c4009
extern int mrand48_r (struct drand48_data *__restrict __buffer,
Packit 6c4009
		      long int *__restrict __result)
Packit 6c4009
     __THROW __nonnull ((1, 2));
Packit 6c4009
extern int jrand48_r (unsigned short int __xsubi[3],
Packit 6c4009
		      struct drand48_data *__restrict __buffer,
Packit 6c4009
		      long int *__restrict __result)
Packit 6c4009
     __THROW __nonnull ((1, 2));
Packit 6c4009
Packit 6c4009
/* Seed random number generator.  */
Packit 6c4009
extern int srand48_r (long int __seedval, struct drand48_data *__buffer)
Packit 6c4009
     __THROW __nonnull ((2));
Packit 6c4009
Packit 6c4009
extern int seed48_r (unsigned short int __seed16v[3],
Packit 6c4009
		     struct drand48_data *__buffer) __THROW __nonnull ((1, 2));
Packit 6c4009
Packit 6c4009
extern int lcong48_r (unsigned short int __param[7],
Packit 6c4009
		      struct drand48_data *__buffer)
Packit 6c4009
     __THROW __nonnull ((1, 2));
Packit 6c4009
# endif	/* Use misc.  */
Packit 6c4009
#endif	/* Use misc or X/Open.  */
Packit 6c4009
Packit 6c4009
/* Allocate SIZE bytes of memory.  */
Packit 6c4009
extern void *malloc (size_t __size) __THROW __attribute_malloc__ __wur;
Packit 6c4009
/* Allocate NMEMB elements of SIZE bytes each, all initialized to 0.  */
Packit 6c4009
extern void *calloc (size_t __nmemb, size_t __size)
Packit 6c4009
     __THROW __attribute_malloc__ __wur;
Packit 6c4009
Packit 6c4009
/* Re-allocate the previously allocated block
Packit 6c4009
   in PTR, making the new block SIZE bytes long.  */
Packit 6c4009
/* __attribute_malloc__ is not used, because if realloc returns
Packit 6c4009
   the same pointer that was passed to it, aliasing needs to be allowed
Packit 6c4009
   between objects pointed by the old and new pointers.  */
Packit 6c4009
extern void *realloc (void *__ptr, size_t __size)
Packit 6c4009
     __THROW __attribute_warn_unused_result__;
Packit 6c4009
Packit 6c4009
#ifdef __USE_GNU
Packit 6c4009
/* Re-allocate the previously allocated block in PTR, making the new
Packit 6c4009
   block large enough for NMEMB elements of SIZE bytes each.  */
Packit 6c4009
/* __attribute_malloc__ is not used, because if reallocarray returns
Packit 6c4009
   the same pointer that was passed to it, aliasing needs to be allowed
Packit 6c4009
   between objects pointed by the old and new pointers.  */
Packit 6c4009
extern void *reallocarray (void *__ptr, size_t __nmemb, size_t __size)
Packit 6c4009
     __THROW __attribute_warn_unused_result__;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Free a block allocated by `malloc', `realloc' or `calloc'.  */
Packit 6c4009
extern void free (void *__ptr) __THROW;
Packit 6c4009
Packit 6c4009
#ifdef __USE_MISC
Packit 6c4009
# include <alloca.h>
Packit 6c4009
#endif /* Use misc.  */
Packit 6c4009
Packit 6c4009
#if (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K) \
Packit 6c4009
    || defined __USE_MISC
Packit 6c4009
/* Allocate SIZE bytes on a page boundary.  The storage cannot be freed.  */
Packit 6c4009
extern void *valloc (size_t __size) __THROW __attribute_malloc__ __wur;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#ifdef __USE_XOPEN2K
Packit 6c4009
/* Allocate memory of SIZE bytes with an alignment of ALIGNMENT.  */
Packit 6c4009
extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
Packit 6c4009
     __THROW __nonnull ((1)) __wur;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#ifdef __USE_ISOC11
Packit 6c4009
/* ISO C variant of aligned allocation.  */
Packit 6c4009
extern void *aligned_alloc (size_t __alignment, size_t __size)
Packit 6c4009
     __THROW __attribute_malloc__ __attribute_alloc_size__ ((2)) __wur;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Abort execution and generate a core-dump.  */
Packit 6c4009
extern void abort (void) __THROW __attribute__ ((__noreturn__));
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Register a function to be called when `exit' is called.  */
Packit 6c4009
extern int atexit (void (*__func) (void)) __THROW __nonnull ((1));
Packit 6c4009
Packit 6c4009
#if defined __USE_ISOC11 || defined __USE_ISOCXX11
Packit 6c4009
/* Register a function to be called when `quick_exit' is called.  */
Packit 6c4009
# ifdef __cplusplus
Packit 6c4009
extern "C++" int at_quick_exit (void (*__func) (void))
Packit 6c4009
     __THROW __asm ("at_quick_exit") __nonnull ((1));
Packit 6c4009
# else
Packit 6c4009
extern int at_quick_exit (void (*__func) (void)) __THROW __nonnull ((1));
Packit 6c4009
# endif
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#ifdef	__USE_MISC
Packit 6c4009
/* Register a function to be called with the status
Packit 6c4009
   given to `exit' and the given argument.  */
Packit 6c4009
extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg)
Packit 6c4009
     __THROW __nonnull ((1));
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Call all functions registered with `atexit' and `on_exit',
Packit 6c4009
   in the reverse of the order in which they were registered,
Packit 6c4009
   perform stdio cleanup, and terminate program execution with STATUS.  */
Packit 6c4009
extern void exit (int __status) __THROW __attribute__ ((__noreturn__));
Packit 6c4009
Packit 6c4009
#if defined __USE_ISOC11 || defined __USE_ISOCXX11
Packit 6c4009
/* Call all functions registered with `at_quick_exit' in the reverse
Packit 6c4009
   of the order in which they were registered and terminate program
Packit 6c4009
   execution with STATUS.  */
Packit 6c4009
extern void quick_exit (int __status) __THROW __attribute__ ((__noreturn__));
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#ifdef __USE_ISOC99
Packit 6c4009
/* Terminate the program with STATUS without calling any of the
Packit 6c4009
   functions registered with `atexit' or `on_exit'.  */
Packit 6c4009
extern void _Exit (int __status) __THROW __attribute__ ((__noreturn__));
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Return the value of envariable NAME, or NULL if it doesn't exist.  */
Packit 6c4009
extern char *getenv (const char *__name) __THROW __nonnull ((1)) __wur;
Packit 6c4009
Packit 6c4009
#ifdef __USE_GNU
Packit 6c4009
/* This function is similar to the above but returns NULL if the
Packit 6c4009
   programs is running with SUID or SGID enabled.  */
Packit 6c4009
extern char *secure_getenv (const char *__name)
Packit 6c4009
     __THROW __nonnull ((1)) __wur;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if defined __USE_MISC || defined __USE_XOPEN
Packit 6c4009
/* The SVID says this is in <stdio.h>, but this seems a better place.	*/
Packit 6c4009
/* Put STRING, which is of the form "NAME=VALUE", in the environment.
Packit 6c4009
   If there is no `=', remove NAME from the environment.  */
Packit 6c4009
extern int putenv (char *__string) __THROW __nonnull ((1));
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#ifdef __USE_XOPEN2K
Packit 6c4009
/* Set NAME to VALUE in the environment.
Packit 6c4009
   If REPLACE is nonzero, overwrite an existing value.  */
Packit 6c4009
extern int setenv (const char *__name, const char *__value, int __replace)
Packit 6c4009
     __THROW __nonnull ((2));
Packit 6c4009
Packit 6c4009
/* Remove the variable NAME from the environment.  */
Packit 6c4009
extern int unsetenv (const char *__name) __THROW __nonnull ((1));
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#ifdef	__USE_MISC
Packit 6c4009
/* The `clearenv' was planned to be added to POSIX.1 but probably
Packit 6c4009
   never made it.  Nevertheless the POSIX.9 standard (POSIX bindings
Packit 6c4009
   for Fortran 77) requires this function.  */
Packit 6c4009
extern int clearenv (void) __THROW;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
Packit 6c4009
#if defined __USE_MISC \
Packit 6c4009
    || (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8)
Packit 6c4009
/* Generate a unique temporary file name from TEMPLATE.
Packit 6c4009
   The last six characters of TEMPLATE must be "XXXXXX";
Packit 6c4009
   they are replaced with a string that makes the file name unique.
Packit 6c4009
   Always returns TEMPLATE, it's either a temporary file name or a null
Packit 6c4009
   string if it cannot get a unique file name.  */
Packit 6c4009
extern char *mktemp (char *__template) __THROW __nonnull ((1));
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
Packit 6c4009
/* Generate a unique temporary file name from TEMPLATE.
Packit 6c4009
   The last six characters of TEMPLATE must be "XXXXXX";
Packit 6c4009
   they are replaced with a string that makes the filename unique.
Packit 6c4009
   Returns a file descriptor open on the file for reading and writing,
Packit 6c4009
   or -1 if it cannot create a uniquely-named file.
Packit 6c4009
Packit 6c4009
   This function is a possible cancellation point and therefore not
Packit 6c4009
   marked with __THROW.  */
Packit 6c4009
# ifndef __USE_FILE_OFFSET64
Packit 6c4009
extern int mkstemp (char *__template) __nonnull ((1)) __wur;
Packit 6c4009
# else
Packit 6c4009
#  ifdef __REDIRECT
Packit 6c4009
extern int __REDIRECT (mkstemp, (char *__template), mkstemp64)
Packit 6c4009
     __nonnull ((1)) __wur;
Packit 6c4009
#  else
Packit 6c4009
#   define mkstemp mkstemp64
Packit 6c4009
#  endif
Packit 6c4009
# endif
Packit 6c4009
# ifdef __USE_LARGEFILE64
Packit 6c4009
extern int mkstemp64 (char *__template) __nonnull ((1)) __wur;
Packit 6c4009
# endif
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#ifdef __USE_MISC
Packit 6c4009
/* Similar to mkstemp, but the template can have a suffix after the
Packit 6c4009
   XXXXXX.  The length of the suffix is specified in the second
Packit 6c4009
   parameter.
Packit 6c4009
Packit 6c4009
   This function is a possible cancellation point and therefore not
Packit 6c4009
   marked with __THROW.  */
Packit 6c4009
# ifndef __USE_FILE_OFFSET64
Packit 6c4009
extern int mkstemps (char *__template, int __suffixlen) __nonnull ((1)) __wur;
Packit 6c4009
# else
Packit 6c4009
#  ifdef __REDIRECT
Packit 6c4009
extern int __REDIRECT (mkstemps, (char *__template, int __suffixlen),
Packit 6c4009
		       mkstemps64) __nonnull ((1)) __wur;
Packit 6c4009
#  else
Packit 6c4009
#   define mkstemps mkstemps64
Packit 6c4009
#  endif
Packit 6c4009
# endif
Packit 6c4009
# ifdef __USE_LARGEFILE64
Packit 6c4009
extern int mkstemps64 (char *__template, int __suffixlen)
Packit 6c4009
     __nonnull ((1)) __wur;
Packit 6c4009
# endif
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#ifdef __USE_XOPEN2K8
Packit 6c4009
/* Create a unique temporary directory from TEMPLATE.
Packit 6c4009
   The last six characters of TEMPLATE must be "XXXXXX";
Packit 6c4009
   they are replaced with a string that makes the directory name unique.
Packit 6c4009
   Returns TEMPLATE, or a null pointer if it cannot get a unique name.
Packit 6c4009
   The directory is created mode 700.  */
Packit 6c4009
extern char *mkdtemp (char *__template) __THROW __nonnull ((1)) __wur;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#ifdef __USE_GNU
Packit 6c4009
/* Generate a unique temporary file name from TEMPLATE similar to
Packit 6c4009
   mkstemp.  But allow the caller to pass additional flags which are
Packit 6c4009
   used in the open call to create the file..
Packit 6c4009
Packit 6c4009
   This function is a possible cancellation point and therefore not
Packit 6c4009
   marked with __THROW.  */
Packit 6c4009
# ifndef __USE_FILE_OFFSET64
Packit 6c4009
extern int mkostemp (char *__template, int __flags) __nonnull ((1)) __wur;
Packit 6c4009
# else
Packit 6c4009
#  ifdef __REDIRECT
Packit 6c4009
extern int __REDIRECT (mkostemp, (char *__template, int __flags), mkostemp64)
Packit 6c4009
     __nonnull ((1)) __wur;
Packit 6c4009
#  else
Packit 6c4009
#   define mkostemp mkostemp64
Packit 6c4009
#  endif
Packit 6c4009
# endif
Packit 6c4009
# ifdef __USE_LARGEFILE64
Packit 6c4009
extern int mkostemp64 (char *__template, int __flags) __nonnull ((1)) __wur;
Packit 6c4009
# endif
Packit 6c4009
Packit 6c4009
/* Similar to mkostemp, but the template can have a suffix after the
Packit 6c4009
   XXXXXX.  The length of the suffix is specified in the second
Packit 6c4009
   parameter.
Packit 6c4009
Packit 6c4009
   This function is a possible cancellation point and therefore not
Packit 6c4009
   marked with __THROW.  */
Packit 6c4009
# ifndef __USE_FILE_OFFSET64
Packit 6c4009
extern int mkostemps (char *__template, int __suffixlen, int __flags)
Packit 6c4009
     __nonnull ((1)) __wur;
Packit 6c4009
# else
Packit 6c4009
#  ifdef __REDIRECT
Packit 6c4009
extern int __REDIRECT (mkostemps, (char *__template, int __suffixlen,
Packit 6c4009
				   int __flags), mkostemps64)
Packit 6c4009
     __nonnull ((1)) __wur;
Packit 6c4009
#  else
Packit 6c4009
#   define mkostemps mkostemps64
Packit 6c4009
#  endif
Packit 6c4009
# endif
Packit 6c4009
# ifdef __USE_LARGEFILE64
Packit 6c4009
extern int mkostemps64 (char *__template, int __suffixlen, int __flags)
Packit 6c4009
     __nonnull ((1)) __wur;
Packit 6c4009
# endif
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Execute the given line as a shell command.
Packit 6c4009
Packit 6c4009
   This function is a cancellation point and therefore not marked with
Packit 6c4009
   __THROW.  */
Packit 6c4009
extern int system (const char *__command) __wur;
Packit 6c4009
Packit 6c4009
Packit 6c4009
#ifdef	__USE_GNU
Packit 6c4009
/* Return a malloc'd string containing the canonical absolute name of the
Packit 6c4009
   existing named file.  */
Packit 6c4009
extern char *canonicalize_file_name (const char *__name)
Packit 6c4009
     __THROW __nonnull ((1)) __wur;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
Packit 6c4009
/* Return the canonical absolute name of file NAME.  If RESOLVED is
Packit 6c4009
   null, the result is malloc'd; otherwise, if the canonical name is
Packit 6c4009
   PATH_MAX chars or more, returns null with `errno' set to
Packit 6c4009
   ENAMETOOLONG; if the name fits in fewer than PATH_MAX chars,
Packit 6c4009
   returns the name in RESOLVED.  */
Packit 6c4009
extern char *realpath (const char *__restrict __name,
Packit 6c4009
		       char *__restrict __resolved) __THROW __wur;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Shorthand for type of comparison functions.  */
Packit 6c4009
#ifndef __COMPAR_FN_T
Packit 6c4009
# define __COMPAR_FN_T
Packit 6c4009
typedef int (*__compar_fn_t) (const void *, const void *);
Packit 6c4009
Packit 6c4009
# ifdef	__USE_GNU
Packit 6c4009
typedef __compar_fn_t comparison_fn_t;
Packit 6c4009
# endif
Packit 6c4009
#endif
Packit 6c4009
#ifdef __USE_GNU
Packit 6c4009
typedef int (*__compar_d_fn_t) (const void *, const void *, void *);
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Do a binary search for KEY in BASE, which consists of NMEMB elements
Packit 6c4009
   of SIZE bytes each, using COMPAR to perform the comparisons.  */
Packit 6c4009
extern void *bsearch (const void *__key, const void *__base,
Packit 6c4009
		      size_t __nmemb, size_t __size, __compar_fn_t __compar)
Packit 6c4009
     __nonnull ((1, 2, 5)) __wur;
Packit 6c4009
Packit 6c4009
#ifdef __USE_EXTERN_INLINES
Packit 6c4009
# include <bits/stdlib-bsearch.h>
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Sort NMEMB elements of BASE, of SIZE bytes each,
Packit 6c4009
   using COMPAR to perform the comparisons.  */
Packit 6c4009
extern void qsort (void *__base, size_t __nmemb, size_t __size,
Packit 6c4009
		   __compar_fn_t __compar) __nonnull ((1, 4));
Packit 6c4009
#ifdef __USE_GNU
Packit 6c4009
extern void qsort_r (void *__base, size_t __nmemb, size_t __size,
Packit 6c4009
		     __compar_d_fn_t __compar, void *__arg)
Packit 6c4009
  __nonnull ((1, 4));
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Return the absolute value of X.  */
Packit 6c4009
extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
Packit 6c4009
extern long int labs (long int __x) __THROW __attribute__ ((__const__)) __wur;
Packit 6c4009
Packit 6c4009
#ifdef __USE_ISOC99
Packit 6c4009
__extension__ extern long long int llabs (long long int __x)
Packit 6c4009
     __THROW __attribute__ ((__const__)) __wur;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Return the `div_t', `ldiv_t' or `lldiv_t' representation
Packit 6c4009
   of the value of NUMER over DENOM. */
Packit 6c4009
/* GCC may have built-ins for these someday.  */
Packit 6c4009
extern div_t div (int __numer, int __denom)
Packit 6c4009
     __THROW __attribute__ ((__const__)) __wur;
Packit 6c4009
extern ldiv_t ldiv (long int __numer, long int __denom)
Packit 6c4009
     __THROW __attribute__ ((__const__)) __wur;
Packit 6c4009
Packit 6c4009
#ifdef __USE_ISOC99
Packit 6c4009
__extension__ extern lldiv_t lldiv (long long int __numer,
Packit 6c4009
				    long long int __denom)
Packit 6c4009
     __THROW __attribute__ ((__const__)) __wur;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
Packit 6c4009
#if (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8) \
Packit 6c4009
    || defined __USE_MISC
Packit 6c4009
/* Convert floating point numbers to strings.  The returned values are
Packit 6c4009
   valid only until another call to the same function.  */
Packit 6c4009
Packit 6c4009
/* Convert VALUE to a string with NDIGIT digits and return a pointer to
Packit 6c4009
   this.  Set *DECPT with the position of the decimal character and *SIGN
Packit 6c4009
   with the sign of the number.  */
Packit 6c4009
extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt,
Packit 6c4009
		   int *__restrict __sign) __THROW __nonnull ((3, 4)) __wur;
Packit 6c4009
Packit 6c4009
/* Convert VALUE to a string rounded to NDIGIT decimal digits.  Set *DECPT
Packit 6c4009
   with the position of the decimal character and *SIGN with the sign of
Packit 6c4009
   the number.  */
Packit 6c4009
extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt,
Packit 6c4009
		   int *__restrict __sign) __THROW __nonnull ((3, 4)) __wur;
Packit 6c4009
Packit 6c4009
/* If possible convert VALUE to a string with NDIGIT significant digits.
Packit 6c4009
   Otherwise use exponential representation.  The resulting string will
Packit 6c4009
   be written to BUF.  */
Packit 6c4009
extern char *gcvt (double __value, int __ndigit, char *__buf)
Packit 6c4009
     __THROW __nonnull ((3)) __wur;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#ifdef __USE_MISC
Packit 6c4009
/* Long double versions of above functions.  */
Packit 6c4009
extern char *qecvt (long double __value, int __ndigit,
Packit 6c4009
		    int *__restrict __decpt, int *__restrict __sign)
Packit 6c4009
     __THROW __nonnull ((3, 4)) __wur;
Packit 6c4009
extern char *qfcvt (long double __value, int __ndigit,
Packit 6c4009
		    int *__restrict __decpt, int *__restrict __sign)
Packit 6c4009
     __THROW __nonnull ((3, 4)) __wur;
Packit 6c4009
extern char *qgcvt (long double __value, int __ndigit, char *__buf)
Packit 6c4009
     __THROW __nonnull ((3)) __wur;
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Reentrant version of the functions above which provide their own
Packit 6c4009
   buffers.  */
Packit 6c4009
extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt,
Packit 6c4009
		   int *__restrict __sign, char *__restrict __buf,
Packit 6c4009
		   size_t __len) __THROW __nonnull ((3, 4, 5));
Packit 6c4009
extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt,
Packit 6c4009
		   int *__restrict __sign, char *__restrict __buf,
Packit 6c4009
		   size_t __len) __THROW __nonnull ((3, 4, 5));
Packit 6c4009
Packit 6c4009
extern int qecvt_r (long double __value, int __ndigit,
Packit 6c4009
		    int *__restrict __decpt, int *__restrict __sign,
Packit 6c4009
		    char *__restrict __buf, size_t __len)
Packit 6c4009
     __THROW __nonnull ((3, 4, 5));
Packit 6c4009
extern int qfcvt_r (long double __value, int __ndigit,
Packit 6c4009
		    int *__restrict __decpt, int *__restrict __sign,
Packit 6c4009
		    char *__restrict __buf, size_t __len)
Packit 6c4009
     __THROW __nonnull ((3, 4, 5));
Packit 6c4009
#endif	/* misc */
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Return the length of the multibyte character
Packit 6c4009
   in S, which is no longer than N.  */
Packit 6c4009
extern int mblen (const char *__s, size_t __n) __THROW;
Packit 6c4009
/* Return the length of the given multibyte character,
Packit 6c4009
   putting its `wchar_t' representation in *PWC.  */
Packit 6c4009
extern int mbtowc (wchar_t *__restrict __pwc,
Packit 6c4009
		   const char *__restrict __s, size_t __n) __THROW;
Packit 6c4009
/* Put the multibyte character represented
Packit 6c4009
   by WCHAR in S, returning its length.  */
Packit 6c4009
extern int wctomb (char *__s, wchar_t __wchar) __THROW;
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Convert a multibyte string to a wide char string.  */
Packit 6c4009
extern size_t mbstowcs (wchar_t *__restrict  __pwcs,
Packit 6c4009
			const char *__restrict __s, size_t __n) __THROW;
Packit 6c4009
/* Convert a wide char string to multibyte string.  */
Packit 6c4009
extern size_t wcstombs (char *__restrict __s,
Packit 6c4009
			const wchar_t *__restrict __pwcs, size_t __n)
Packit 6c4009
     __THROW;
Packit 6c4009
Packit 6c4009
Packit 6c4009
#ifdef __USE_MISC
Packit 6c4009
/* Determine whether the string value of RESPONSE matches the affirmation
Packit 6c4009
   or negative response expression as specified by the LC_MESSAGES category
Packit 6c4009
   in the program's current locale.  Returns 1 if affirmative, 0 if
Packit 6c4009
   negative, and -1 if not matching.  */
Packit 6c4009
extern int rpmatch (const char *__response) __THROW __nonnull ((1)) __wur;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
Packit 6c4009
#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
Packit 6c4009
/* Parse comma separated suboption from *OPTIONP and match against
Packit 6c4009
   strings in TOKENS.  If found return index and set *VALUEP to
Packit 6c4009
   optional value introduced by an equal sign.  If the suboption is
Packit 6c4009
   not part of TOKENS return in *VALUEP beginning of unknown
Packit 6c4009
   suboption.  On exit *OPTIONP is set to the beginning of the next
Packit 6c4009
   token or at the terminating NUL character.  */
Packit 6c4009
extern int getsubopt (char **__restrict __optionp,
Packit 6c4009
		      char *const *__restrict __tokens,
Packit 6c4009
		      char **__restrict __valuep)
Packit 6c4009
     __THROW __nonnull ((1, 2, 3)) __wur;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* X/Open pseudo terminal handling.  */
Packit 6c4009
Packit 6c4009
#ifdef __USE_XOPEN2KXSI
Packit 6c4009
/* Return a master pseudo-terminal handle.  */
Packit 6c4009
extern int posix_openpt (int __oflag) __wur;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#ifdef __USE_XOPEN_EXTENDED
Packit 6c4009
/* The next four functions all take a master pseudo-tty fd and
Packit 6c4009
   perform an operation on the associated slave:  */
Packit 6c4009
Packit 6c4009
/* Chown the slave to the calling user.  */
Packit 6c4009
extern int grantpt (int __fd) __THROW;
Packit 6c4009
Packit 6c4009
/* Release an internal lock so the slave can be opened.
Packit 6c4009
   Call after grantpt().  */
Packit 6c4009
extern int unlockpt (int __fd) __THROW;
Packit 6c4009
Packit 6c4009
/* Return the pathname of the pseudo terminal slave associated with
Packit 6c4009
   the master FD is open on, or NULL on errors.
Packit 6c4009
   The returned storage is good until the next call to this function.  */
Packit 6c4009
extern char *ptsname (int __fd) __THROW __wur;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#ifdef __USE_GNU
Packit 6c4009
/* Store at most BUFLEN characters of the pathname of the slave pseudo
Packit 6c4009
   terminal associated with the master FD is open on in BUF.
Packit 6c4009
   Return 0 on success, otherwise an error number.  */
Packit 6c4009
extern int ptsname_r (int __fd, char *__buf, size_t __buflen)
Packit 6c4009
     __THROW __nonnull ((2));
Packit 6c4009
Packit 6c4009
/* Open a master pseudo terminal and return its file descriptor.  */
Packit 6c4009
extern int getpt (void);
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#ifdef __USE_MISC
Packit 6c4009
/* Put the 1 minute, 5 minute and 15 minute load averages into the first
Packit 6c4009
   NELEM elements of LOADAVG.  Return the number written (never more than
Packit 6c4009
   three, but may be less than NELEM), or -1 if an error occurred.  */
Packit 6c4009
extern int getloadavg (double __loadavg[], int __nelem)
Packit 6c4009
     __THROW __nonnull ((1));
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K
Packit 6c4009
/* Return the index into the active-logins file (utmp) for
Packit 6c4009
   the controlling terminal.  */
Packit 6c4009
extern int ttyslot (void) __THROW;
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#include <bits/stdlib-float.h>
Packit 6c4009
Packit 6c4009
/* Define some macros helping to catch buffer overflows.  */
Packit 6c4009
#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
Packit 6c4009
# include <bits/stdlib.h>
Packit 6c4009
#endif
Packit 6c4009
#ifdef __LDBL_COMPAT
Packit 6c4009
# include <bits/stdlib-ldbl.h>
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
__END_DECLS
Packit 6c4009
Packit 6c4009
#endif /* stdlib.h  */