commit 7bd66aee5b054ebcdba36c1b2198fe6f2f6a6886 Author: Raphaƫl <35407363+EniumRaphael@users.noreply.github.com> Date: Tue Nov 14 13:31:56 2023 +0100 Push libft 125/100 corrected the 14/11/23 diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7f3c318 --- /dev/null +++ b/Makefile @@ -0,0 +1,52 @@ +# **************************************************************************** # +# # +# ::: :::::::: # +# Makefile :+: :+: :+: # +# +:+ +:+ +:+ # +# By: rparodi +#+ +:+ +#+ # +# +#+#+#+#+#+ +#+ # +# Created: 2023/11/12 11:05:05 by rparodi #+# #+# # +# Updated: 2023/11/13 19:10:24 by rparodi ### ########.fr # +# # +# **************************************************************************** # + +NAME=libft.a +CC=clang +CFLAGS=-Wall -Wextra -Werror -g2 +RM=rm -f +LDFLAGS=-L. +LDLIBS=-lft +SRC = ft_atoi.c ft_bzero.c ft_isalnum.c ft_isalpha.c ft_isascii.c ft_isdigit.c ft_isprint.c ft_memchr.c ft_memcmp.c ft_memcpy.c ft_memmove.c ft_memset.c ft_strchr.c ft_strlcat.c ft_strlcpy.c ft_strlen.c ft_strncmp.c ft_strnstr.c ft_strrchr.c ft_tolower.c ft_toupper.c ft_calloc.c ft_strdup.c ft_substr.c ft_strjoin.c ft_strtrim.c ft_split.c ft_itoa.c ft_strmapi.c ft_striteri.c ft_putchar_fd.c ft_putstr_fd.c ft_putendl_fd.c ft_putnbr_fd.c +SRCBonus = ft_lstnew.c ft_lstadd_front.c ft_lstsize.c ft_lstlast.c ft_lstadd_back.c ft_lstdelone.c ft_lstclear.c ft_lstiter.c ft_lstmap.c +OBJ = $(SRC:.c=.o) +OBJBonus = $(SRCBonus:.c=.o) + +$(NAME): $(OBJ) $(OBJBonus) + ar rc $(NAME) $(OBJ) $(OBJBonus) + ranlib $(NAME) + +%.o: %.c + $(CC) -I. -o $@ -c $? $(CFLAGS) + +all: $(NAME) + +bonus: $(OBJ) $(OBJBonus) + ar rc $(NAME) $(OBJ) $(OBJBonus) + ranlib $(NAME) + + +dev: all bonus clean + +clean: + $(RM) $(OBJ) $(OBJBonus) + +fclean: clean + $(RM) $(NAME) + +re: fclean all bonus + +.PHONY: clean clean + +so: $(OBJ) $(OBJBonus) + $(CC) -nostartfiles -fPIC $(CFLAGS) $(SRC) $(SRCBonus) + gcc -nostartfiles -shared -o libft.so $(OBJ) $(OBJBonus) diff --git a/ft_atoi.c b/ft_atoi.c new file mode 100644 index 0000000..8f0c074 --- /dev/null +++ b/ft_atoi.c @@ -0,0 +1,54 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_atoi.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/08 17:22:41 by rparodi #+# #+# */ +/* Updated: 2023/11/13 12:20:14 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +static int ft_check_space(int c) +{ + if (c == 32 || (c >= 9 && c <= 13)) + return (1); + return (0); +} + +static int ft_check_sign(const char *nptr, int *i) +{ + while (ft_check_space(nptr[*i])) + (*i)++; + if (nptr[*i] == '-') + { + (*i)++; + return (-1); + } + else if (nptr[*i] == '+') + (*i)++; + return (1); +} + +int ft_atoi(const char *nptr) +{ + int i; + int sign; + int number; + + i = 0; + sign = ft_check_sign(nptr, &i); + number = 0; + while (nptr[i]) + { + if (nptr[i] >= '0' && nptr[i] <= '9') + number = (number * 10) + nptr[i] - '0'; + else + break ; + i++; + } + return (sign * number); +} diff --git a/ft_bzero.c b/ft_bzero.c new file mode 100644 index 0000000..5b8fb1e --- /dev/null +++ b/ft_bzero.c @@ -0,0 +1,18 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_bzero.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/07 16:43:13 by rparodi #+# #+# */ +/* Updated: 2023/11/07 17:25:28 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +void ft_bzero(void *s, size_t n) +{ + ft_memset(s, 0, n); +} diff --git a/ft_calloc.c b/ft_calloc.c new file mode 100644 index 0000000..a057429 --- /dev/null +++ b/ft_calloc.c @@ -0,0 +1,31 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_calloc.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/07 16:47:17 by rparodi #+# #+# */ +/* Updated: 2023/11/13 14:47:17 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +void *ft_calloc(size_t nmemb, size_t size) +{ + size_t total; + char *to_return; + + if (nmemb == 0 || size == 0) + return ((void *)malloc(1)); + total = nmemb * size; + if (total / nmemb != size && total / size != nmemb) + return (NULL); + to_return = (char *)malloc(total); + if (to_return == NULL) + to_return = NULL; + else + ft_bzero(to_return, total); + return (to_return); +} diff --git a/ft_isalnum.c b/ft_isalnum.c new file mode 100644 index 0000000..0de3565 --- /dev/null +++ b/ft_isalnum.c @@ -0,0 +1,20 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_isalnum.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/06 12:47:28 by rparodi #+# #+# */ +/* Updated: 2023/11/07 10:38:08 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +int ft_isalnum(int c) +{ + if (ft_isalpha(c) || ft_isdigit(c)) + return (c); + return (0); +} diff --git a/ft_isalpha.c b/ft_isalpha.c new file mode 100644 index 0000000..1d9f36f --- /dev/null +++ b/ft_isalpha.c @@ -0,0 +1,20 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_isalpha.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/06 11:58:37 by rparodi #+# #+# */ +/* Updated: 2023/11/07 10:38:08 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +int ft_isalpha(int c) +{ + if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) + return (c); + return (0); +} diff --git a/ft_isascii.c b/ft_isascii.c new file mode 100644 index 0000000..2c0bad9 --- /dev/null +++ b/ft_isascii.c @@ -0,0 +1,22 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_isascii.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/06 14:04:26 by rparodi #+# #+# */ +/* Updated: 2023/11/08 18:23:33 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +int ft_isascii(int c) +{ + if (c == 0) + return (1); + if (c > 0 && c <= 127) + return (c); + return (0); +} diff --git a/ft_isdigit.c b/ft_isdigit.c new file mode 100644 index 0000000..5bde7f0 --- /dev/null +++ b/ft_isdigit.c @@ -0,0 +1,20 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_isdigit.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/06 12:44:28 by rparodi #+# #+# */ +/* Updated: 2023/11/07 10:35:36 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +int ft_isdigit(int c) +{ + if (c >= '0' && c <= '9') + return (c); + return (0); +} diff --git a/ft_isprint.c b/ft_isprint.c new file mode 100644 index 0000000..5997448 --- /dev/null +++ b/ft_isprint.c @@ -0,0 +1,20 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_isprint.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/06 14:06:53 by rparodi #+# #+# */ +/* Updated: 2023/11/07 17:01:22 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +int ft_isprint(int c) +{ + if (c >= 32 && c <= 126) + return (c); + return (0); +} diff --git a/ft_itoa.c b/ft_itoa.c new file mode 100644 index 0000000..fa4265f --- /dev/null +++ b/ft_itoa.c @@ -0,0 +1,52 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_itoa.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/09 13:56:30 by rparodi #+# #+# */ +/* Updated: 2023/11/13 19:50:31 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +static size_t ft_check_sign(char *str, long *nb) +{ + if ((*nb) == 0) + str[0] = '0'; + if ((*nb) < 0) + { + str[0] = '-'; + *nb = -*nb; + return (1); + } + return (0); +} + +char *ft_itoa(int n) +{ + size_t i; + size_t modulus; + short int maiboyerlpb; + char str[13]; + long nb; + + nb = n; + maiboyerlpb = 0; + modulus = 1000000000; + ft_bzero(str, 13); + i = ft_check_sign(str, &nb); + while (modulus != 0) + { + if (nb / modulus != 0 || maiboyerlpb != 0) + { + str[i++] = (nb / modulus) + 48; + maiboyerlpb++; + } + nb %= modulus; + modulus /= 10; + } + return (ft_strdup(str)); +} diff --git a/ft_lstadd_back.c b/ft_lstadd_back.c new file mode 100644 index 0000000..3b7be38 --- /dev/null +++ b/ft_lstadd_back.c @@ -0,0 +1,28 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lstadd_back.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/12 11:39:56 by rparodi #+# #+# */ +/* Updated: 2023/11/12 17:11:53 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +void ft_lstadd_back(t_list **lst, t_list *new) +{ + t_list *tempo; + + if (*lst == NULL) + { + *lst = new; + return ; + } + tempo = *lst; + while (tempo->next != NULL) + tempo = tempo->next; + tempo->next = new; +} diff --git a/ft_lstadd_front.c b/ft_lstadd_front.c new file mode 100644 index 0000000..3e3794e --- /dev/null +++ b/ft_lstadd_front.c @@ -0,0 +1,24 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lstadd_front.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/12 11:40:16 by rparodi #+# #+# */ +/* Updated: 2023/11/12 17:14:33 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +void ft_lstadd_front(t_list **lst, t_list *new) +{ + if (*lst == NULL) + { + *lst = new; + return ; + } + new->next = *lst; + *lst = new; +} diff --git a/ft_lstclear.c b/ft_lstclear.c new file mode 100644 index 0000000..3cf5595 --- /dev/null +++ b/ft_lstclear.c @@ -0,0 +1,25 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lstclear.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/12 11:40:37 by rparodi #+# #+# */ +/* Updated: 2023/11/12 19:34:19 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +void ft_lstclear(t_list **lst, void (*del)(void *)) +{ + t_list *tempo; + + while (*lst) + { + tempo = (*lst)->next; + ft_lstdelone(*lst, del); + (*lst) = tempo; + } +} diff --git a/ft_lstdelone.c b/ft_lstdelone.c new file mode 100644 index 0000000..bffd7cf --- /dev/null +++ b/ft_lstdelone.c @@ -0,0 +1,19 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lstdelone.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/12 11:42:11 by rparodi #+# #+# */ +/* Updated: 2023/11/12 18:10:40 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +void ft_lstdelone(t_list *lst, void (*del)(void *)) +{ + del(lst->content); + free(lst); +} diff --git a/ft_lstiter.c b/ft_lstiter.c new file mode 100644 index 0000000..30547eb --- /dev/null +++ b/ft_lstiter.c @@ -0,0 +1,22 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lstiter.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/12 11:42:24 by rparodi #+# #+# */ +/* Updated: 2023/11/12 18:07:02 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +void ft_lstiter(t_list *lst, void (*f)(void *)) +{ + while (lst != NULL) + { + f(lst->content); + lst = lst->next; + } +} diff --git a/ft_lstlast.c b/ft_lstlast.c new file mode 100644 index 0000000..d0b6b53 --- /dev/null +++ b/ft_lstlast.c @@ -0,0 +1,22 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lstlast.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/12 11:42:54 by rparodi #+# #+# */ +/* Updated: 2023/11/12 17:25:48 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +t_list *ft_lstlast(t_list *lst) +{ + if (lst == NULL) + return (lst); + while (lst->next != NULL) + lst = lst->next; + return (lst); +} diff --git a/ft_lstmap.c b/ft_lstmap.c new file mode 100644 index 0000000..6282a67 --- /dev/null +++ b/ft_lstmap.c @@ -0,0 +1,37 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lstmap.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/12 11:43:28 by rparodi #+# #+# */ +/* Updated: 2023/11/12 19:28:02 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +t_list *ft_lstmap(t_list *lst, void *(*f)(void *), void (*del)(void *)) +{ + t_list *tempo; + t_list *tempo_content; + + tempo_content = ft_lstnew(f(lst->content)); + if (!tempo_content) + return (NULL); + tempo = tempo_content; + lst = lst->next; + while (lst) + { + tempo_content = ft_lstnew(f(lst->content)); + if (!tempo_content) + { + ft_lstclear(&tempo, del); + return (NULL); + } + ft_lstadd_back(&tempo, tempo_content); + lst = lst->next; + } + return (tempo); +} diff --git a/ft_lstnew.c b/ft_lstnew.c new file mode 100644 index 0000000..6d2a4fc --- /dev/null +++ b/ft_lstnew.c @@ -0,0 +1,26 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lstnew.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/12 11:44:02 by rparodi #+# #+# */ +/* Updated: 2023/11/12 14:25:12 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +t_list *ft_lstnew(void *content) +{ + t_list *to_return; + + to_return = NULL; + to_return = (t_list *)malloc(sizeof(t_list)); + if (!to_return) + return (NULL); + to_return->content = content; + to_return->next = NULL; + return (to_return); +} diff --git a/ft_lstsize.c b/ft_lstsize.c new file mode 100644 index 0000000..99d1d45 --- /dev/null +++ b/ft_lstsize.c @@ -0,0 +1,26 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_lstsize.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/12 11:44:24 by rparodi #+# #+# */ +/* Updated: 2023/11/13 12:22:02 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +int ft_lstsize(t_list *lst) +{ + int count; + + count = 0; + while (lst != NULL) + { + lst = lst->next; + count++; + } + return (count); +} diff --git a/ft_memchr.c b/ft_memchr.c new file mode 100644 index 0000000..ec3f19c --- /dev/null +++ b/ft_memchr.c @@ -0,0 +1,29 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_memchr.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/07 16:48:30 by rparodi #+# #+# */ +/* Updated: 2023/11/07 18:45:57 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +void *ft_memchr(const void *s, int c, size_t n) +{ + size_t i; + char *str; + + i = 0; + str = (char *)s; + while (i < n) + { + if ((char)c == str[i]) + return ((void *)str + i); + i++; + } + return (NULL); +} diff --git a/ft_memcmp.c b/ft_memcmp.c new file mode 100644 index 0000000..d1a3ba5 --- /dev/null +++ b/ft_memcmp.c @@ -0,0 +1,31 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_memcmp.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/07 16:49:04 by rparodi #+# #+# */ +/* Updated: 2023/11/07 18:46:15 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +int ft_memcmp(const void *s1, const void *s2, size_t n) +{ + size_t i; + unsigned char *str1; + unsigned char *str2; + + i = 0; + str1 = (unsigned char *)s1; + str2 = (unsigned char *)s2; + while (i < n) + { + if (str1[i] != str2[i]) + return (str1[i] - str2[i]); + i++; + } + return (0); +} diff --git a/ft_memcpy.c b/ft_memcpy.c new file mode 100644 index 0000000..2715322 --- /dev/null +++ b/ft_memcpy.c @@ -0,0 +1,32 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_memcpy.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/07 16:49:46 by rparodi #+# #+# */ +/* Updated: 2023/11/13 19:14:23 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +void *ft_memcpy(void *dest, const void *src, size_t n) +{ + char *d; + const char *s; + size_t i; + + i = 0; + if (!dest && !src) + return (NULL); + d = (char *)dest; + s = (char *)src; + while (i < n) + { + d[i] = s[i]; + i++; + } + return ((void *)d); +} diff --git a/ft_memmove.c b/ft_memmove.c new file mode 100644 index 0000000..986a36f --- /dev/null +++ b/ft_memmove.c @@ -0,0 +1,51 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_memmove.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/07 16:51:35 by rparodi #+# #+# */ +/* Updated: 2023/11/13 19:55:40 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +char *ft_checks(char *s, char *d, size_t n) +{ + size_t i; + + i = 0; + if (d < s) + { + while (i < n) + { + d[i] = s[i]; + i++; + } + } + else + { + i = n; + while (i > 0) + { + i--; + d[i] = s[i]; + } + } + return (d); +} + +void *ft_memmove(void *dest, const void *src, size_t n) +{ + char *d; + char *s; + + if (!dest && !src) + return (NULL); + d = (char *)dest; + s = (char *)src; + ft_checks(s, d, n); + return (dest); +} diff --git a/ft_memset.c b/ft_memset.c new file mode 100644 index 0000000..1a68559 --- /dev/null +++ b/ft_memset.c @@ -0,0 +1,28 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_memset.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/07 16:50:29 by rparodi #+# #+# */ +/* Updated: 2023/11/07 18:58:02 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +void *ft_memset(void *s, int c, size_t n) +{ + char *str; + size_t i; + + i = 0; + str = (char *)s; + while (i < n) + { + str[i] = c; + i++; + } + return (str); +} diff --git a/ft_putchar_fd.c b/ft_putchar_fd.c new file mode 100644 index 0000000..5b4613f --- /dev/null +++ b/ft_putchar_fd.c @@ -0,0 +1,18 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_putchar_fd.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/09 13:58:22 by rparodi #+# #+# */ +/* Updated: 2023/11/10 15:31:57 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +void ft_putchar_fd(char c, int fd) +{ + write(fd, &c, 1); +} diff --git a/ft_putendl_fd.c b/ft_putendl_fd.c new file mode 100644 index 0000000..8c43b1c --- /dev/null +++ b/ft_putendl_fd.c @@ -0,0 +1,19 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_putendl_fd.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/09 13:59:01 by rparodi #+# #+# */ +/* Updated: 2023/11/10 15:57:53 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +void ft_putendl_fd(char *s, int fd) +{ + ft_putstr_fd(s, fd); + ft_putchar_fd('\n', fd); +} diff --git a/ft_putnbr_fd.c b/ft_putnbr_fd.c new file mode 100644 index 0000000..d596c3a --- /dev/null +++ b/ft_putnbr_fd.c @@ -0,0 +1,55 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_putnbr_fd.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/09 13:59:18 by rparodi #+# #+# */ +/* Updated: 2023/11/13 20:13:20 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +static int ft_check_sign(int n, char *str, size_t *i, int fd) +{ + size_t modulus; + short int maiboyerlpb; + + maiboyerlpb = 0; + modulus = 1000000000; + if (n < 0) + { + n = -n; + str[(*i)] = '-'; + (*i)++; + } + while (modulus != 0) + { + if (n / modulus != 0 || maiboyerlpb != 0) + { + str[(*i)++] = (n / modulus) + 48; + maiboyerlpb++; + } + n %= modulus; + modulus /= 10; + } + ft_putstr_fd(str, fd); + return (n); +} + +void ft_putnbr_fd(int n, int fd) +{ + size_t i; + char str[13]; + + i = 0; + ft_bzero(str, 13); + if (n == 0) + ft_putstr_fd("0", fd); + else if (n == -2147483648) + ft_putstr_fd("-2147483648", fd); + else + ft_check_sign(n, str, &i, fd); +} diff --git a/ft_putstr_fd.c b/ft_putstr_fd.c new file mode 100644 index 0000000..0c8cd8f --- /dev/null +++ b/ft_putstr_fd.c @@ -0,0 +1,25 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_putstr_fd.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/09 13:58:46 by rparodi #+# #+# */ +/* Updated: 2023/11/10 15:57:46 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +void ft_putstr_fd(char *s, int fd) +{ + size_t i; + + i = 0; + while (s[i] != '\0') + { + ft_putchar_fd(s[i], fd); + i++; + } +} diff --git a/ft_split.c b/ft_split.c new file mode 100644 index 0000000..32a5d2d --- /dev/null +++ b/ft_split.c @@ -0,0 +1,93 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_split.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/09 13:56:02 by rparodi #+# #+# */ +/* Updated: 2023/11/13 12:14:57 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +static int count_words(const char *str, char sep) +{ + int i; + int count; + + i = 0; + count = 0; + while (str[i]) + { + while (str[i] == sep && str[i]) + i++; + if (str[i] != sep && str[i]) + { + while (str[i] != sep && str[i]) + i++; + count++; + } + } + return (count); +} + +static char *ft_strndup(const char *s, int j) +{ + int i; + char *str; + + i = 0; + str = (char *)malloc((j + 1)); + if (!str) + return (NULL); + while (s[i] && i < j) + { + str[i] = s[i]; + i++; + } + str[i] = '\0'; + return (str); +} + +static char **ext_w(char **words_array, const char *str, char sep, int size) +{ + int i; + int j; + + i = 0; + j = 0; + while (j < size) + { + while (str[i] == sep && str[i]) + i++; + str = str + i; + i = 0; + while (str[i] != sep && str[i]) + i++; + words_array[j++] = ft_strndup(str, i); + str = str + i; + i = 0; + } + words_array[j] = 0; + return (words_array); +} + +char **ft_split(char const *s, char c) +{ + int size; + char **words_array; + + size = count_words(s, c); + words_array = (char **)malloc(sizeof(char *) * (size + 1)); + if (!words_array) + return (NULL); + if (size == 0) + { + words_array[0] = NULL; + return (words_array); + } + words_array = ext_w(words_array, s, c, size); + return (words_array); +} diff --git a/ft_strchr.c b/ft_strchr.c new file mode 100644 index 0000000..f29c896 --- /dev/null +++ b/ft_strchr.c @@ -0,0 +1,29 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_strchr.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/07 16:32:19 by rparodi #+# #+# */ +/* Updated: 2023/11/09 12:08:01 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +char *ft_strchr(const char *s, int c) +{ + unsigned int i; + + i = 0; + if (c == 0) + return ((char *)s + ft_strlen(s)); + while (s[i] != '\0') + { + if (s[i] == (char)c) + return ((char *)s + i); + i++; + } + return (NULL); +} diff --git a/ft_strdup.c b/ft_strdup.c new file mode 100644 index 0000000..38a98fc --- /dev/null +++ b/ft_strdup.c @@ -0,0 +1,26 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_strdup.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/07 16:53:59 by rparodi #+# #+# */ +/* Updated: 2023/11/13 20:02:09 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +char *ft_strdup(const char *s) +{ + size_t len; + char *to_return; + + len = ft_strlen(s) + 1; + to_return = (char *)malloc(sizeof(char) * len); + if (!to_return) + return (NULL); + ft_strlcpy(to_return, s, len); + return (to_return); +} diff --git a/ft_striteri.c b/ft_striteri.c new file mode 100644 index 0000000..bf9869a --- /dev/null +++ b/ft_striteri.c @@ -0,0 +1,25 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_striteri.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/09 13:57:34 by rparodi #+# #+# */ +/* Updated: 2023/11/11 17:26:00 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +void ft_striteri(char *s, void (*f)(unsigned int, char*)) +{ + size_t i; + + i = 0; + while (s[i] != '\0') + { + f(i, s + i); + i++; + } +} diff --git a/ft_strjoin.c b/ft_strjoin.c new file mode 100644 index 0000000..18844b3 --- /dev/null +++ b/ft_strjoin.c @@ -0,0 +1,39 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_strjoin.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/09 13:55:15 by rparodi #+# #+# */ +/* Updated: 2023/11/09 17:47:46 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +char *ft_strjoin(char const *s1, char const *s2) +{ + size_t i; + size_t save_i; + char *str; + + i = 0; + str = (char *)malloc((ft_strlen(s1) + ft_strlen(s2)) + 1); + if (!str) + return (NULL); + while (s1[i] != '\0') + { + str[i] = s1[i]; + i++; + } + save_i = i; + i = 0; + while (s2[i] != '\0') + { + str[save_i + i] = s2[i]; + i++; + } + str[i + save_i] = '\0'; + return (str); +} diff --git a/ft_strlcat.c b/ft_strlcat.c new file mode 100644 index 0000000..77658ad --- /dev/null +++ b/ft_strlcat.c @@ -0,0 +1,53 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_strlcat.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/08 22:28:26 by rparodi #+# #+# */ +/* Updated: 2023/11/12 11:45:52 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +static size_t ft_strnlen(char *dest, size_t size) +{ + size_t i; + + i = 0; + while (i < size) + { + if (dest[i] == '\0') + break ; + i++; + } + return (i); +} + +size_t ft_strlcat(char *dest, const char *src, size_t size) +{ + size_t i; + size_t j; + size_t destlen; + + i = 0; + j = 0; + destlen = ft_strnlen(dest, size); + while (i < size && dest[i]) + i++; + if (i == size) + return (i + ft_strlen(src)); + while (src[j]) + { + if (j < size - destlen - 1) + { + dest[i] = src[j]; + i++; + } + j++; + } + dest[i] = '\0'; + return (destlen + j); +} diff --git a/ft_strlcpy.c b/ft_strlcpy.c new file mode 100644 index 0000000..bfd75e5 --- /dev/null +++ b/ft_strlcpy.c @@ -0,0 +1,31 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_strlcpy.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/07 16:55:25 by rparodi #+# #+# */ +/* Updated: 2023/11/13 19:16:30 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +size_t ft_strlcpy(char *dst, const char *src, size_t size) +{ + size_t i; + + i = 0; + while (src[i] && i + 1 < size) + { + dst[i] = src[i]; + i++; + } + if (size > 0) + { + dst[i] = '\0'; + i++; + } + return (ft_strlen(src)); +} diff --git a/ft_strlen.c b/ft_strlen.c new file mode 100644 index 0000000..ea2a01e --- /dev/null +++ b/ft_strlen.c @@ -0,0 +1,23 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_strlen.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/07 16:56:24 by rparodi #+# #+# */ +/* Updated: 2023/11/08 12:37:09 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +size_t ft_strlen(const char *s) +{ + size_t i; + + i = 0; + while (s[i] != '\0') + i++; + return (i); +} diff --git a/ft_strmapi.c b/ft_strmapi.c new file mode 100644 index 0000000..163c12f --- /dev/null +++ b/ft_strmapi.c @@ -0,0 +1,34 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_strmapi.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/09 13:56:57 by rparodi #+# #+# */ +/* Updated: 2023/11/13 19:49:30 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +char *ft_strmapi(char const *s, char (*f)(unsigned int, char)) +{ + size_t i; + size_t len; + char *str; + + i = 0; + len = ft_strlen(s); + str = (char *)malloc(len + 1); + if (!str) + return (NULL); + else + ft_bzero((char *)str, len + 1); + while (i < len) + { + str[i] = f(i, s[i]); + i++; + } + return (str); +} diff --git a/ft_strncmp.c b/ft_strncmp.c new file mode 100644 index 0000000..9afff02 --- /dev/null +++ b/ft_strncmp.c @@ -0,0 +1,31 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_strncmp.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/07 16:56:56 by rparodi #+# #+# */ +/* Updated: 2023/11/09 13:16:39 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +int ft_strncmp(const char *s1, const char *s2, size_t n) +{ + size_t i; + int diff; + + i = 0; + while ((s1[i] || s2[i]) && i < n) + { + if (s1[i] != s2[i]) + { + diff = (unsigned char)s1[i] - (unsigned char)s2[i]; + return (diff); + } + i++; + } + return (0); +} diff --git a/ft_strnstr.c b/ft_strnstr.c new file mode 100644 index 0000000..6c20844 --- /dev/null +++ b/ft_strnstr.c @@ -0,0 +1,37 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_strnstr.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/07 16:57:44 by rparodi #+# #+# */ +/* Updated: 2023/11/13 19:17:49 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +char *ft_strnstr(const char *big, const char *little, size_t len) +{ + size_t i; + size_t j; + + i = 0; + if (len == 0 && (!big || !little)) + return (NULL); + if (!little[i]) + return ((char *)big); + while (big[i] && i < len) + { + j = 0; + while (i + j < len && little[j] == big[i + j]) + { + j++; + if (little[j] == '\0') + return ((char *)(big + i)); + } + i++; + } + return (0); +} diff --git a/ft_strrchr.c b/ft_strrchr.c new file mode 100644 index 0000000..3f7177a --- /dev/null +++ b/ft_strrchr.c @@ -0,0 +1,29 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_strrchr.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/07 16:58:22 by rparodi #+# #+# */ +/* Updated: 2023/11/11 18:46:54 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +char *ft_strrchr(const char *s, int c) +{ + size_t i; + + i = ft_strlen(s); + while (i > 0) + { + if (s[i] == c % 256) + return ((char *)s + i); + i--; + } + if (s[i] == c % 256) + return ((char *)s + i); + return (NULL); +} diff --git a/ft_strtrim.c b/ft_strtrim.c new file mode 100644 index 0000000..2d3e105 --- /dev/null +++ b/ft_strtrim.c @@ -0,0 +1,40 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_strtrim.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/09 13:55:44 by rparodi #+# #+# */ +/* Updated: 2023/11/13 20:08:51 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +char *ft_strtrim(char const *s1, char const *set) +{ + size_t i; + size_t j; + size_t k; + char *str; + + if (!s1) + return (NULL); + i = 0; + while (ft_strchr(set, s1[i]) != NULL && s1[i]) + i++; + if (i == ft_strlen(s1)) + return (ft_strdup("")); + j = ft_strlen(s1); + while (ft_strrchr(set, s1[j - 1]) != NULL && j > i) + j--; + str = (char *)malloc(j - i + 1); + if (!str) + return (NULL); + k = 0; + while (i < j) + str[k++] = s1[i++]; + str[k] = '\0'; + return (str); +} diff --git a/ft_substr.c b/ft_substr.c new file mode 100644 index 0000000..1870902 --- /dev/null +++ b/ft_substr.c @@ -0,0 +1,32 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_substr.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/09 13:54:42 by rparodi #+# #+# */ +/* Updated: 2023/11/13 20:08:02 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +char *ft_substr(char const *s, unsigned int start, size_t len) +{ + size_t i; + size_t j; + char *str; + + i = start; + if (start >= ft_strlen(s)) + return (ft_strdup("")); + if (len + start > (ft_strlen(s))) + len = ft_strlen(s) - start; + j = 0; + str = (char *)malloc(len + 1); + if (!str || !s) + return (free(str), ft_strdup("")); + ft_strlcpy(str, s + start, len + 1); + return (str); +} diff --git a/ft_tolower.c b/ft_tolower.c new file mode 100644 index 0000000..a520567 --- /dev/null +++ b/ft_tolower.c @@ -0,0 +1,20 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_tolower.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/07 10:38:54 by rparodi #+# #+# */ +/* Updated: 2023/11/07 16:59:18 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +int ft_tolower(int c) +{ + if (c >= 'A' && c <= 'Z') + c += 32; + return (c); +} diff --git a/ft_toupper.c b/ft_toupper.c new file mode 100644 index 0000000..a320bce --- /dev/null +++ b/ft_toupper.c @@ -0,0 +1,20 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_toupper.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/07 10:44:26 by rparodi #+# #+# */ +/* Updated: 2023/11/08 18:08:21 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +int ft_toupper(int c) +{ + if (c >= 'a' && c <= 'z') + c -= 32; + return (c); +} diff --git a/libft.h b/libft.h new file mode 100644 index 0000000..ae914b4 --- /dev/null +++ b/libft.h @@ -0,0 +1,74 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* libft.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/06 11:14:57 by rparodi #+# #+# */ +/* Updated: 2023/11/12 18:58:02 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#ifndef LIBFT_H +# define LIBFT_H + +# include +# include +# include +# include +# define INT_MAX 2147483647 +# define INT_MIN -2147483648 + +typedef struct s_list +{ + void *content; + struct s_list *next; +} t_list; + +int ft_isalpha(int c); +int ft_isdigit(int c); +int ft_isalnum(int c); +int ft_isascii(int c); +int ft_isprint(int c); +size_t ft_strlen(const char *s); +void *ft_memset(void *s, int c, size_t n); +void *ft_memcpy(void *dest, const void *src, size_t n); +void ft_bzero(void *s, size_t n); +void *ft_memcpy(void *dest, const void *src, size_t n); +size_t ft_strlcpy(char *dst, const char *src, size_t size); +size_t ft_strlcat(char *dst, const char *src, size_t size); +int ft_toupper(int c); +int ft_tolower(int c); +char *ft_strchr(const char *s, int c); +char *ft_strrchr(const char *s, int c); +int ft_strncmp(const char *s1, const char *s2, size_t n); +void *ft_memchr(const void *s, int c, size_t n); +void *ft_memmove(void *dest, const void *src, size_t n); +int ft_memcmp(const void *s1, const void *s2, size_t n); +char *ft_strnstr(const char *big, const char *little, size_t len); +int ft_atoi(const char *nptr); +void *ft_calloc(size_t nmemb, size_t size); +char *ft_strdup(const char *s); +char *ft_substr(char const *s, unsigned int start, size_t len); +char *ft_strjoin(char const *s1, char const *s2); +char *ft_strtrim(char const *s1, char const *set); +char **ft_split(char const *s, char c); +char *ft_itoa(int n); +char *ft_strmapi(char const *s, char (*f)(unsigned int, char)); +void ft_striteri(char *s, void (*f)(unsigned int, char*)); +void ft_putchar_fd(char c, int fd); +void ft_putstr_fd(char *s, int fd); +void ft_putendl_fd(char *s, int fd); +void ft_putnbr_fd(int n, int fd); +void ft_lstadd_back(t_list **lst, t_list *new); +void ft_lstadd_front(t_list **lst, t_list *new); +void ft_lstclear(t_list **lst, void (*del)(void *)); +void ft_lstdelone(t_list *lst, void (*del)(void *)); +void ft_lstiter(t_list *lst, void (*f)(void *)); +t_list *ft_lstlast(t_list *lst); +t_list *ft_lstmap(t_list *lst, void *(*f)(void *), void (*del)(void *)); +t_list *ft_lstnew(void *content); +int ft_lstsize(t_list *lst); + +#endif