X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=include%2Fstdlib.h;h=023f6e788c8a8d47ded58fc89581fea7fb4b09e3;hp=6dbbc9cb32eddf369e859c67a0524f54c2762826;hb=4b5f054098e484baa6d457aebe8bdab0eeb90215;hpb=0b44a0315b47dd8eced9f3b7f31580cf14bbfc01 diff --git a/include/stdlib.h b/include/stdlib.h index 6dbbc9cb..023f6e78 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -28,59 +28,26 @@ long double strtold (const char *, char **); long strtol (const char *, char **, int); unsigned long strtoul (const char *, char **, int); - long long strtoll (const char *, char **, int); unsigned long long strtoull (const char *, char **, int); -char *l64a (long); -long a64l (const char *); - -long int random (void); -void srandom (unsigned int); -char *initstate (unsigned int, char *, size_t); -char *setstate (char *); - int rand (void); void srand (unsigned); -int rand_r (unsigned *); - -double drand48 (void); -double erand48 (unsigned short [3]); -long int lrand48 (void); -long int nrand48 (unsigned short [3]); -long mrand48 (void); -long jrand48 (unsigned short [3]); -void srand48 (long); -unsigned short *seed48 (unsigned short [3]); -void lcong48 (unsigned short [7]); void *malloc (size_t); void *calloc (size_t, size_t); void *realloc (void *, size_t); void free (void *); -void *valloc (size_t); -int posix_memalign (void **, size_t, size_t); void abort (void); int atexit (void (*) (void)); void exit (int); void _Exit (int); - char *getenv (const char *); -int putenv (char *); -int setenv (const char *, const char *, int); -int unsetenv (const char *); - - -char *mktemp (char *); -int mkstemp (char *); int system (const char *); - -char *realpath (const char *, char *); - void *bsearch (const void *, const void *, size_t, size_t, int (*)(const void *, const void *)); void qsort (void *, size_t, size_t, int (*)(const void *, const void *)); @@ -89,14 +56,12 @@ long labs (long); long long llabs (long long); typedef struct { int quot, rem; } div_t; -extern div_t div (int, int); - typedef struct { long quot, rem; } ldiv_t; -ldiv_t ldiv (long, long); - typedef struct { long long quot, rem; } lldiv_t; -lldiv_t lldiv (long long, long long); +div_t div (int, int); +ldiv_t ldiv (long, long); +lldiv_t lldiv (long long, long long); int mblen (const char *, size_t); int mbtowc (wchar_t *, const char *, size_t); @@ -104,23 +69,72 @@ int wctomb (char *, wchar_t); size_t mbstowcs (wchar_t *, const char *, size_t); size_t wcstombs (char *, const wchar_t *, size_t); +#define EXIT_FAILURE 1 +#define EXIT_SUCCESS 0 + +#define MB_CUR_MAX ((size_t)+4) + +#define RAND_MAX (0x7fffffff) + + +#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ + || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) + +#ifndef WEXITSTATUS +#define WEXITSTATUS(s) (((s) & 0xff00) >> 8) +#define WTERMSIG(s) ((s) & 0x7f) +#define WSTOPSIG(s) WEXITSTATUS(s) +#define WCOREDUMP(s) ((s) & 0x80) +#define WIFEXITED(s) (!WTERMSIG(s)) +#define WIFSTOPPED(s) (((s) & 0xff) == 0x7f) +#define WIFSIGNALED(s) (((signed char) (((s) & 0x7f) + 1) >> 1) > 0) +#define WIFCONTINUED(s) ((s) == 0xffff) +#endif + +int posix_memalign (void **, size_t, size_t); +int setenv (const char *, const char *, int); +int unsetenv (const char *); +int mkstemp (char *); +char *mkdtemp (char *); int getsubopt (char **, char *const *, char **); +int rand_r (unsigned *); -void setkey (const char *); +#endif + +#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) +int putenv (char *); int posix_openpt (int); int grantpt (int); int unlockpt (int); char *ptsname (int); +char *realpath (const char *, char *); +char *l64a (long); +long a64l (const char *); +void setkey (const char *); +long int random (void); +void srandom (unsigned int); +char *initstate (unsigned int, char *, size_t); +char *setstate (char *); +double drand48 (void); +double erand48 (unsigned short [3]); +long int lrand48 (void); +long int nrand48 (unsigned short [3]); +long mrand48 (void); +long jrand48 (unsigned short [3]); +void srand48 (long); +unsigned short *seed48 (unsigned short [3]); +void lcong48 (unsigned short [7]); +#endif -#define MB_CUR_MAX 4 - -#define RAND_MAX (0x7fffffff) - -#define EXIT_FAILURE 1 -#define EXIT_SUCCESS 0 +#if defined(_GNU_SOURCE) +char *mktemp (char *); +void *valloc (size_t); +void *memalign(size_t, size_t); +int clearenv(void); +int ptsname_r(int, char *, size_t); +#endif -#include #ifdef __cplusplus }