/* stdlib.h: General utilities header. */ #ifndef _STDLIB_H #define _STDLIB_H #include #include /* The result of a division operation on two integers. */ typedef struct { int quot; int rem; } div_t; /* The result of a division operation on two long integers. */ typedef struct { long quot; long rem; } ldiv_t; /* The result of a division operation on two long long integers. */ typedef struct { long long quot; long long rem; } lldiv_t; #define MB_CUR_MAX 4 #ifdef __cplusplus extern "C" { #endif /* Return the absolute value of an integer. */ int abs(int v); /* Return the absolute value of a long integer. */ long labs(long v); /* Return the absolute value of a long long integer. */ long long llabs(long long v); /* Return the result of dividing two integers, including the remainder. */ div_t div(int num, int den); /* Return the result of dividing two long integers, including the remainder. */ ldiv_t ldiv(long, long); /* Return the result of dividing two long long integers, including the remainder. */ lldiv_t lldiv(long long, long long); void* malloc(size_t); void* calloc(size_t, size_t); void* realloc(void*, size_t); void free(void*); /* Abort the program without performing any normal cleanup. */ __noreturn void abort(); /* Register a handler to be run at normal program termination. */ int atexit(void (*func)(void)); /* Parse a decimal integer from the a string. */ int atoi(const char* s); /* Parse a decimal integer from the a string. */ long atol(const char* s); /* Parse a decimal integer from the a string. */ long long atoll(const char* s); double atof(const char*); double strtod(const char*, char**); /* Parse an integer of the specified base from a string, storing the first non-number character in endptr if * nonnull. */ long strtol(const char* str, char** endptr, int base); /* Parse an unsigned integer of the specified base from a string, storing the first non-number character in * endptr if nonnull. */ unsigned long strtoul(const char* str, char** endptr, int base); int rand(); void srand(int); /* Exit the program normally, performing any registered cleanup actions. */ __noreturn void exit(int); /* Exit the program abnormally, without performing any registered cleanup actions. */ __noreturn void _Exit(int); int system(const char*); char* getenv(const char*); void qsort(void*, size_t, size_t, int (*)(const void*, const void*)); void* bsearch(const void*, const void*, size_t, size_t, int (*)(const void*, const void*)); /* Convert a multibyte character string to a wide character string. */ size_t mbstowcs(wchar_t* buf, const char* src, size_t max); #ifdef __cplusplus } #endif #endif