From edc40ed8b1165c857bfe954b4ab2fa564c5c24e3 Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Sat, 27 Jan 2024 03:01:34 -0500 Subject: update libs --- include/lib.h | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 4 deletions(-) (limited to 'include/lib.h') 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); -- cgit v1.2.3-freya