OSDN Git Service

Add in the "_start" symbol in asm. Fix a makefile (that needs to be
[uclinux-h8/uClibc.git] / include / stdlib.h
1 /* stdlib.h  <ndf@linux.mit.edu> */
2 #include <features.h>
3 #include <sys/types.h>
4
5 #ifndef __STDLIB_H
6 #define __STDLIB_H
7
8 /* Don't overwrite user definitions of NULL */
9 #ifndef NULL
10 #define NULL ((void *) 0)
11 #endif
12
13 /* For program termination */
14 #define EXIT_FAILURE 1
15 #define EXIT_SUCCESS 0
16
17 extern void exit __P ((int __status)) __attribute__ ((__noreturn__));
18 extern int atexit __P ((void (*__func) (void)));
19
20 extern void * malloc __P ((size_t));
21 extern void * calloc __P ((size_t, size_t));
22 extern void free __P ((void *));
23 extern void * realloc __P ((void *, size_t));
24
25 #ifdef DEBUG_MALLOC
26
27 extern void * malloc_dbg __P ((size_t, char* func, char* file, int line));
28 extern void * calloc_dbg __P ((size_t, size_t, char* func, char* file, int line));
29 extern void free_dbg __P ((void *, char* func, char* file, int line));
30 extern void * realloc_dbg __P ((void *, size_t, char* func, char* file, int line));
31
32 #define malloc(x) malloc_dbg((x),__FUNCTION__,__FILE__,__LINE__)
33 #define calloc(x,y) calloc_dbg((x),(y),__FUNCTION__,__FILE__,__LINE__)
34 #define free(x) free_dbg((x),__FUNCTION__,__FILE__,__LINE__)
35 #define realloc(x) realloc((x),__FUNCTION__,__FILE__,__LINE__)
36
37 #endif
38
39 extern int rand __P ((void));
40 extern void srand __P ((unsigned int seed));
41
42 extern long strtol __P ((const char * nptr, char ** endptr, int base));
43 extern unsigned long strtoul __P ((const char * nptr,
44                                    char ** endptr, int base));
45 #ifndef __HAS_NO_FLOATS__
46 extern float strtod __P ((const char * nptr, char ** endptr));
47 #endif
48
49 extern char *getenv __P ((__const char *__name));
50
51 extern int putenv __P ((__const char *__string));
52
53 extern int setenv __P ((__const char *__name, __const char *__value,
54                         int __replace));
55
56 extern int system __P ((__const char *__command));
57
58 extern int qsort __P ((char *base, int num, int size, int (*cmp)()));
59
60 extern char * gcvt __P ((float number, size_t ndigit, char * buf));
61
62 #define atof(x) strtod((x),(char**)0)
63 #define atoi(x) (int)strtol((x),(char**)0,10)
64 #define atol(x) strtol((x),(char**)0,10)
65
66 /* Returned by `div'.  */
67 typedef struct
68   {
69     int quot;                   /* Quotient.  */
70     int rem;                    /* Remainder.  */
71   } div_t;
72
73 /* Returned by `ldiv'.  */
74 typedef struct
75   {
76     long int quot;              /* Quotient.  */
77     long int rem;               /* Remainder.  */
78   } ldiv_t;
79
80 #endif /* __STDLIB_H */