1 /*
2  * Copyright (c) 2004, Bull SA. All rights reserved.
3  * Created by:  Laurent.Vivier@bull.net
4  * This file is licensed under the GPL license.  For the full content
5  * of this license, see the COPYING file at the top level of this
6  * source tree.
7  */
8 
9  /* test if stdlib.h exists and can be included */
10 
11 // #define _POSIX_C_SOURCE 200809L
12 
13 #include <stdlib.h>
14 #include <sys/time.h>
15 
16 #ifndef __compar_fn_t_defined
17 #define __compar_fn_t_defined
18 typedef int (*__compar_fn_t) (const void *, const void *);
19 #endif
20 
21 void                (*test_abort)(void);
22 int                 (*test_abs)(int);
23 double              (*test_atof)(const char *__nptr);
24 int                 (*test_atoi)(const char *__nptr);
25 long                (*test_atol)(const char *__nptr);
26 long long           (*test_atoll)(const char *__nptr);
27 void *              (*test_bsearch)(const void *__key, const void *__base, size_t __nmemb, size_t __size, __compar_fn_t _compar);
28 void *              (*test_calloc)(size_t, size_t);
29 div_t               (*test_div)(int __numer, int __denom);
30 void                (*test_free)(void *);
31 char *              (*test_getenv)(const char *__string);
32 long                (*test_labs)(long);
33 ldiv_t              (*test_ldiv)(long __numer, long __denom);
34 void *              (*test_malloc)(size_t);
35 void                (*test_qsort)(void *__base, size_t __nmemb, size_t __size, __compar_fn_t _compar);
36 int                 (*test_rand)(void);
37 int                 (*test_rand_r)(unsigned *__seed);
38 void *              (*test_realloc)(void *, size_t);
39 int                 (*test_setenv)(const char *__string, const char *__value, int __overwrite);
40 void                (*test_srand)(unsigned __seed);
41 double              (*test_strtod)(const char *__restrict __n, char **__restrict __end_PTR);
42 float               (*test_strtof)(const char *__restrict __n, char **__restrict __end_PTR);
43 long                (*test_strtol)(const char *__restrict __n, char **__restrict __end_PTR, int __base);
44 long double         (*test_strtold)(const char *__restrict, char **__restrict);
45 long long           (*test_strtoll)(const char *__restrict __n, char **__restrict __end_PTR, int __base);
46 unsigned long       (*test_strtoul)(const char *__restrict __n, char **__restrict __end_PTR, int __base);
47 unsigned long long  (*test_strtoull)(const char *__restrict __n, char **__restrict __end_PTR, int __base);
48 int                 (*test_unsetenv)(const char *__string);
49 
50 
51 
test_defined()52 __attribute__((unused)) static int test_defined()
53 {
54     test_abort = abort;
55     test_abs = abs;
56     test_atof = atof;
57     test_atoi = atoi;
58     test_atol = atol;
59     test_atoll = atoll;
60     test_bsearch = bsearch;
61     test_calloc = calloc;
62     test_div = div;
63     test_free = free;
64     test_getenv = getenv;
65     test_labs = labs;
66     test_ldiv = ldiv;
67     test_malloc = malloc;
68     test_qsort = qsort;
69     test_rand = rand;
70     // test_rand_r = rand_r;
71     test_realloc = realloc;
72     // test_setenv = setenv;
73     test_srand = srand;
74     test_strtod = strtod;
75     test_strtof = strtof;
76     test_strtol = strtol;
77     test_strtold = strtold;
78     test_strtoll = strtoll;
79     test_strtoul = strtoul;
80     test_strtoull = strtoull;
81     // test_unsetenv = unsetenv;
82 
83     return 0;
84 }
85 
86