diff options
author | Freya Murphy <freya@freyacat.org> | 2024-01-27 03:01:34 -0500 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2024-01-27 03:02:02 -0500 |
commit | edc40ed8b1165c857bfe954b4ab2fa564c5c24e3 (patch) | |
tree | e3f3dc40f0d14d5e064223c4394a1a6d783354c4 /include/lib.h | |
parent | serial and fix makefile (diff) | |
download | corn-edc40ed8b1165c857bfe954b4ab2fa564c5c24e3.tar.gz corn-edc40ed8b1165c857bfe954b4ab2fa564c5c24e3.tar.bz2 corn-edc40ed8b1165c857bfe954b4ab2fa564c5c24e3.zip |
update libs
Diffstat (limited to 'include/lib.h')
-rw-r--r-- | include/lib.h | 56 |
1 files changed, 52 insertions, 4 deletions
diff --git a/include/lib.h b/include/lib.h index 4271aa5..0651770 100644 --- a/include/lib.h +++ b/include/lib.h @@ -1,12 +1,60 @@ +#pragma once + +/** + * The memcmp() function compares the first n bytes (each interpreted as unsigned char) of the memory + * areas s1 and s2. + */ +extern int memcmp(const void *restrict s1, const void *restrict s2, unsigned long n); + +/** + * The memcpy() function copies n bytes from memory area src to memory area dest. + * The memory areas must not overlap. + */ +extern void *memcpy(void *restrict dest, const void *restrict src, unsigned long n); + +/** + * The memmove() function copies n bytes from memory area src to memory area dest. The memory areas + * may overlap: copying takes place as though the bytes in src are first copied into a temporary array + * that does not overlap src or dest, and the bytes are then copied from the temporary array to dest. + */ +extern void *memmove(void *dest, const void *src, unsigned long n); + +/** + * The memset() function fills the first n bytes of the memory area pointed to by s with the constant + * byte c. + */ +extern void *memset(void *restrict dest, int c, unsigned long n); /** * The strcmp() function compares the two strings s1 and s2. The locale is not taken into account * (for a locale-aware comparison, see strcoll(3)). The comparison is done using unsigned characters. */ -int strncmp(const char *s1, const char *s2, unsigned long n); +extern int strncmp(const char *restrict s1, const char *restrict s2, unsigned long n); /** - * The memcmp() function compares the first n bytes (each interpreted as unsigned char) of the memory - * areas s1 and s2. + * @returns 1 if c is a space + */ +int isspace(int c); + +/** + * @returns 1 if c is a digit (0 - 9) */ -int memcmp(const void *s1, const void *s2, unsigned long n); +int isdigit(int c); + + +char itoc(int i); +int ctoi(char c); + +int atoi(const char* s); +long int atol(const char* s); +long long int atoll(const char* s); + +char *itoa(int n, char *buffer, int radix); +char *ltoa(long int n, char *buffer, int radix); +char *utoa(unsigned int n, char *buffer, int radix); +char *ultoa(unsigned long int n, char *buffer, int radix); +char *ftoa(float f, char *buffer); + +int strtoi(const char *str, char **endptr, int base); +long int strtol(const char *str, char **endptr, int base); +long long int strtoll(const char *str, char **endptr, int base); |