8 #if __STDC_VERSION__ >= 199901L
9 #define __restrict restrict
10 #elif !defined(__GNUC__)
14 #if __STDC_VERSION__ >= 201112L
15 #elif defined(__GNUC__)
16 #define _Noreturn __attribute__((__noreturn__))
25 #define NULL ((void*)0)
29 #define __NEED_wchar_t
31 #include <bits/alltypes.h>
33 int atoi (const char *);
34 long atol (const char *);
35 long long atoll (const char *);
36 double atof (const char *);
38 float strtof (const char *__restrict, char **__restrict);
39 double strtod (const char *__restrict, char **__restrict);
40 long double strtold (const char *__restrict, char **__restrict);
42 long strtol (const char *__restrict, char **__restrict, int);
43 unsigned long strtoul (const char *__restrict, char **__restrict, int);
44 long long strtoll (const char *__restrict, char **__restrict, int);
45 unsigned long long strtoull (const char *__restrict, char **__restrict, int);
48 void srand (unsigned);
50 void *malloc (size_t);
51 void *calloc (size_t, size_t);
52 void *realloc (void *, size_t);
54 void *aligned_alloc(size_t alignment, size_t size);
56 _Noreturn void abort (void);
57 int atexit (void (*) (void));
58 _Noreturn void exit (int);
59 _Noreturn void _Exit (int);
60 int at_quick_exit (void (*) (void));
61 _Noreturn void quick_exit (int);
63 char *getenv (const char *);
65 int system (const char *);
67 void *bsearch (const void *, const void *, size_t, size_t, int (*)(const void *, const void *));
68 void qsort (void *, size_t, size_t, int (*)(const void *, const void *));
72 long long llabs (long long);
74 typedef struct { int quot, rem; } div_t;
75 typedef struct { long quot, rem; } ldiv_t;
76 typedef struct { long long quot, rem; } lldiv_t;
79 ldiv_t ldiv (long, long);
80 lldiv_t lldiv (long long, long long);
82 int mblen (const char *, size_t);
83 int mbtowc (wchar_t *__restrict, const char *__restrict, size_t);
84 int wctomb (char *, wchar_t);
85 size_t mbstowcs (wchar_t *__restrict, const char *__restrict, size_t);
86 size_t wcstombs (char *__restrict, const wchar_t *__restrict, size_t);
88 #define EXIT_FAILURE 1
89 #define EXIT_SUCCESS 0
91 #define MB_CUR_MAX ((size_t)+4)
93 #define RAND_MAX (0x7fffffff)
96 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
97 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
98 || defined(_BSD_SOURCE)
101 #define WEXITSTATUS(s) (((s) & 0xff00) >> 8)
102 #define WTERMSIG(s) ((s) & 0x7f)
103 #define WSTOPSIG(s) WEXITSTATUS(s)
104 #define WCOREDUMP(s) ((s) & 0x80)
105 #define WIFEXITED(s) (!WTERMSIG(s))
106 #define WIFSTOPPED(s) (((s) & 0xff) == 0x7f)
107 #define WIFSIGNALED(s) (((signed char) (((s) & 0x7f) + 1) >> 1) > 0)
108 #define WIFCONTINUED(s) ((s) == 0xffff)
111 int posix_memalign (void **, size_t, size_t);
112 int setenv (const char *, const char *, int);
113 int unsetenv (const char *);
114 int mkstemp (char *);
115 char *mkdtemp (char *);
116 int getsubopt (char **, char *const *, char **);
117 int rand_r (unsigned *);
122 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
123 || defined(_BSD_SOURCE)
124 char *realpath (const char *__restrict, char *__restrict);
125 long int random (void);
126 void srandom (unsigned int);
127 char *initstate (unsigned int, char *, size_t);
128 char *setstate (char *);
131 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
133 int posix_openpt (int);
138 long a64l (const char *);
139 void setkey (const char *);
140 double drand48 (void);
141 double erand48 (unsigned short [3]);
142 long int lrand48 (void);
143 long int nrand48 (unsigned short [3]);
145 long jrand48 (unsigned short [3]);
147 unsigned short *seed48 (unsigned short [3]);
148 void lcong48 (unsigned short [7]);
151 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
153 char *mktemp (char *);
154 void *valloc (size_t);
155 void *memalign(size_t, size_t);
160 int ptsname_r(int, char *, size_t);
161 char *ecvt(double, int, int *, int *);
162 char *fcvt(double, int, int *, int *);
163 char *gcvt(double, int, char *);
166 #if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
167 #define mkstemp64 mkstemp