|
| 1 | +/** |
| 2 | + * @file stdlib.h |
| 3 | + * @author Craig Edwards |
| 4 | + * @brief Standard library stubs |
| 5 | + * @date 2023-05-27 |
| 6 | + * @copyright Copyright (c) 2023 |
| 7 | + */ |
| 8 | +#include <stddef.h> |
| 9 | +#include <stdint.h> |
| 10 | + |
| 11 | +#pragma once |
| 12 | + |
| 13 | +typedef struct div_t { |
| 14 | + int quot; |
| 15 | + int rem; |
| 16 | +} div_t; |
| 17 | + |
| 18 | +typedef struct ldiv_t { |
| 19 | + long int quot; |
| 20 | + long int rem; |
| 21 | +} ldiv_t; |
| 22 | + |
| 23 | +typedef char schar_t; |
| 24 | + |
| 25 | +double strtod(const char *str, char **endptr); |
| 26 | + |
| 27 | +long int strtol(const char *str, char **endptr, int base); |
| 28 | + |
| 29 | +unsigned long int strtoul(const char *str, char **endptr, int base); |
| 30 | + |
| 31 | +void abort(void); |
| 32 | + |
| 33 | +int atexit(void (*func)(void)); |
| 34 | + |
| 35 | +void exit(int status); |
| 36 | + |
| 37 | +char *getenv(const char *name); |
| 38 | + |
| 39 | +int system(const char *string); |
| 40 | + |
| 41 | +void *bsearch(const void *key, const void *base, size_t nitems, size_t size, int (*compar)(const void *, const void *)); |
| 42 | + |
| 43 | +void qsort(void *base, size_t nitems, size_t size, int (*compar)(const void *, const void*)); |
| 44 | + |
| 45 | +div_t div(int numer, int denom); |
| 46 | + |
| 47 | +ldiv_t ldiv(long int numer, long int denom); |
| 48 | + |
| 49 | +int rand(void); |
| 50 | + |
| 51 | +void srand(unsigned int seed); |
| 52 | + |
| 53 | +int mblen(const char *str, size_t n); |
| 54 | + |
| 55 | +size_t mbstowcs(schar_t *pwcs, const char *str, size_t n); |
| 56 | + |
| 57 | +int mbtowc(wchar_t *pwc, const char *str, size_t n); |
| 58 | + |
| 59 | +size_t wcstombs(char *str, const wchar_t *pwcs, size_t n); |
| 60 | + |
| 61 | +int wctomb(char *str, wchar_t wchar); |
| 62 | + |
0 commit comments