From 613f0665475f914f32ae2d5fb748e570a2b1654f Mon Sep 17 00:00:00 2001 From: ReverseSky Date: Wed, 9 Oct 2024 03:36:39 +0200 Subject: [PATCH] s --- Libft/Makefile | 30 ---------- Libft/ft_atoi.c | 34 ----------- Libft/ft_bzero.c | 26 --------- Libft/ft_calloc.c | 29 ---------- Libft/ft_hexa.c | 64 --------------------- Libft/ft_isalnum.c | 19 ------- Libft/ft_isalpha.c | 19 ------- Libft/ft_isascii.c | 19 ------- Libft/ft_isdigit.c | 19 ------- Libft/ft_isprint.c | 19 ------- Libft/ft_itoa.c | 62 -------------------- Libft/ft_lstadd_back.c | 30 ---------- Libft/ft_lstadd_front.c | 18 ------ Libft/ft_lstclear.c | 30 ---------- Libft/ft_lstdelone.c | 22 -------- Libft/ft_lstiter.c | 27 --------- Libft/ft_lstlast.c | 21 ------- Libft/ft_lstmap.c | 41 -------------- Libft/ft_lstnew.c | 24 -------- Libft/ft_lstsize.c | 25 -------- Libft/ft_memchr.c | 26 --------- Libft/ft_memcmp.c | 26 --------- Libft/ft_memcpy.c | 28 --------- Libft/ft_memmove.c | 39 ------------- Libft/ft_memset.c | 26 --------- Libft/ft_printf.c | 63 --------------------- Libft/ft_put.c | 75 ------------------------ Libft/ft_putchar_fd.c | 17 ------ Libft/ft_putendl_fd.c | 27 --------- Libft/ft_putnbr_fd.c | 33 ----------- Libft/ft_putstr_fd.c | 26 --------- Libft/ft_split.c | 78 ------------------------- Libft/ft_strchr.c | 28 --------- Libft/ft_strdup.c | 25 -------- Libft/ft_striteri.c | 26 --------- Libft/ft_strjoin.c | 41 -------------- Libft/ft_strlcat.c | 37 ------------ Libft/ft_strlcpy.c | 28 --------- Libft/ft_strlen.c | 24 -------- Libft/ft_strmapi.c | 33 ----------- Libft/ft_strncmp.c | 26 --------- Libft/ft_strnstr.c | 38 ------------- Libft/ft_strrchr.c | 28 --------- Libft/ft_strtrim.c | 40 ------------- Libft/ft_substr.c | 39 ------------- Libft/ft_tolower.c | 19 ------- Libft/ft_toupper.c | 19 ------- Libft/get_next_line.c | 110 ------------------------------------ Libft/get_next_line_utils.c | 53 ----------------- Libft/libft.h | 89 ----------------------------- Minilibx | 1 - 51 files changed, 1746 deletions(-) delete mode 100644 Libft/Makefile delete mode 100644 Libft/ft_atoi.c delete mode 100644 Libft/ft_bzero.c delete mode 100644 Libft/ft_calloc.c delete mode 100644 Libft/ft_hexa.c delete mode 100644 Libft/ft_isalnum.c delete mode 100644 Libft/ft_isalpha.c delete mode 100644 Libft/ft_isascii.c delete mode 100644 Libft/ft_isdigit.c delete mode 100644 Libft/ft_isprint.c delete mode 100644 Libft/ft_itoa.c delete mode 100644 Libft/ft_lstadd_back.c delete mode 100644 Libft/ft_lstadd_front.c delete mode 100644 Libft/ft_lstclear.c delete mode 100644 Libft/ft_lstdelone.c delete mode 100644 Libft/ft_lstiter.c delete mode 100644 Libft/ft_lstlast.c delete mode 100644 Libft/ft_lstmap.c delete mode 100644 Libft/ft_lstnew.c delete mode 100644 Libft/ft_lstsize.c delete mode 100644 Libft/ft_memchr.c delete mode 100644 Libft/ft_memcmp.c delete mode 100644 Libft/ft_memcpy.c delete mode 100644 Libft/ft_memmove.c delete mode 100644 Libft/ft_memset.c delete mode 100644 Libft/ft_printf.c delete mode 100644 Libft/ft_put.c delete mode 100644 Libft/ft_putchar_fd.c delete mode 100644 Libft/ft_putendl_fd.c delete mode 100644 Libft/ft_putnbr_fd.c delete mode 100644 Libft/ft_putstr_fd.c delete mode 100644 Libft/ft_split.c delete mode 100644 Libft/ft_strchr.c delete mode 100644 Libft/ft_strdup.c delete mode 100644 Libft/ft_striteri.c delete mode 100644 Libft/ft_strjoin.c delete mode 100644 Libft/ft_strlcat.c delete mode 100644 Libft/ft_strlcpy.c delete mode 100644 Libft/ft_strlen.c delete mode 100644 Libft/ft_strmapi.c delete mode 100644 Libft/ft_strncmp.c delete mode 100644 Libft/ft_strnstr.c delete mode 100644 Libft/ft_strrchr.c delete mode 100644 Libft/ft_strtrim.c delete mode 100644 Libft/ft_substr.c delete mode 100644 Libft/ft_tolower.c delete mode 100644 Libft/ft_toupper.c delete mode 100644 Libft/get_next_line.c delete mode 100644 Libft/get_next_line_utils.c delete mode 100644 Libft/libft.h delete mode 160000 Minilibx diff --git a/Libft/Makefile b/Libft/Makefile deleted file mode 100644 index fa0de42..0000000 --- a/Libft/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -NAME = libft.a - -SRC = ft_atoi.c ft_bzero.c ft_calloc.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_strdup.c ft_strlcat.c ft_strlcpy.c ft_strlen.c \ -ft_strncmp.c ft_strrchr.c ft_tolower.c ft_toupper.c ft_strnstr.c ft_substr.c\ -ft_strjoin.c ft_strtrim.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 ft_split.c 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 ft_hexa.c ft_printf.c\ -ft_put.c get_next_line.c get_next_line_utils.c - -OBJS = ${SRC:.c=.o} - -CC = gcc - -CFLAGS = -Wall -Werror -Wextra - -all: $(NAME) - -$(NAME): ${OBJS} - ar rc ${NAME} ${OBJS} - -clean : - rm -f ${OBJS} - -fclean : clean - rm -f $(NAME) - -re : fclean all diff --git a/Libft/ft_atoi.c b/Libft/ft_atoi.c deleted file mode 100644 index 8504ede..0000000 --- a/Libft/ft_atoi.c +++ /dev/null @@ -1,34 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_atoi.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/04 14:30:22 by grobledo #+# #+# */ -/* Updated: 2023/02/04 14:30:24 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -int ft_atoi(const char *str) -{ - int i; - int is_neg; - int number; - - i = 0; - is_neg = 1; - number = 0; - while ((str[i] >= 9 && str[i] <= 13) || str[i] == 32) - i++; - if (str[i] == '-' || str[i] == '+') - { - if (str[i] == '-') - is_neg *= -1; - i++; - } - while (str [i] >= '0' && str[i] <= '9') - number = (number * 10) + str[i++] - 48; - return (number * is_neg); -} diff --git a/Libft/ft_bzero.c b/Libft/ft_bzero.c deleted file mode 100644 index b322d22..0000000 --- a/Libft/ft_bzero.c +++ /dev/null @@ -1,26 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_bzero.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/08 14:32:10 by grobledo #+# #+# */ -/* Updated: 2023/02/08 14:32:22 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -void ft_bzero(void *s, size_t n) -{ - unsigned char *str; - size_t i; - - i = 0; - str = s; - while (i < n) - { - str[i] = 0; - i++; - } -} diff --git a/Libft/ft_calloc.c b/Libft/ft_calloc.c deleted file mode 100644 index ca1c5d6..0000000 --- a/Libft/ft_calloc.c +++ /dev/null @@ -1,29 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_calloc.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/08 19:35:13 by grobledo #+# #+# */ -/* Updated: 2023/02/08 19:35:23 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -void *ft_calloc(size_t count, size_t size) -{ - void *str; - size_t tmp; - - tmp = size * count; - if (size == 0 || count == 0) - return (malloc(0)); - if (tmp / count != size) - return (NULL); - str = malloc(size * count); - if (str == NULL) - return (NULL); - ft_bzero (str, size * count); - return (str); -} diff --git a/Libft/ft_hexa.c b/Libft/ft_hexa.c deleted file mode 100644 index a439086..0000000 --- a/Libft/ft_hexa.c +++ /dev/null @@ -1,64 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_hexa.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/04/04 09:38:27 by grobledo #+# #+# */ -/* Updated: 2023/04/04 09:38:28 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -int ft_hexa(unsigned int args, char format, int count) -{ - char *base; - char *shiftbase; - - base = "0123456789abcdef"; - shiftbase = "0123456789ABCDEF"; - if (format == 'x') - { - if (args >= 16) - count = ft_hexa(args / 16, format, count); - count = ft_putcharf(base[args % 16], count); - return (count); - } - if (format == 'X') - { - if (args >= 16) - count = ft_hexa(args / 16, format, count); - count = ft_putcharf(shiftbase[args % 16], count); - return (count); - } - return (0); -} - -int ft_starthexa(unsigned int args, char format, int count) -{ - if (!args && (format == 'x' || format == 'X')) - return (ft_putcharf('0', count)); - count = ft_hexa(args, format, count); - return (count); -} - -int ft_startpointer(unsigned long long int args, char format, int count) -{ - if (!args) - return (ft_putstrf("(nil)", count)); - count = ft_putstrf("0x", count); - count = ft_pointer(args, format, count); - return (count); -} - -int ft_pointer(unsigned long long int args, char format, int count) -{ - char *base; - - base = "0123456789abcdef"; - if (args >= 16) - count = ft_pointer(args / 16, format, count); - count = ft_putcharf(base[args % 16], count); - return (count); -} diff --git a/Libft/ft_isalnum.c b/Libft/ft_isalnum.c deleted file mode 100644 index f5a8ec6..0000000 --- a/Libft/ft_isalnum.c +++ /dev/null @@ -1,19 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_isalnum.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/02 18:17:39 by grobledo #+# #+# */ -/* Updated: 2023/02/02 18:17:41 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -int ft_isalnum(int c) -{ - if (ft_isalpha(c) || ft_isdigit(c)) - return (1); - return (0); -} diff --git a/Libft/ft_isalpha.c b/Libft/ft_isalpha.c deleted file mode 100644 index 351bf89..0000000 --- a/Libft/ft_isalpha.c +++ /dev/null @@ -1,19 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_isalpha.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/02 17:36:30 by grobledo #+# #+# */ -/* Updated: 2023/02/02 17:36:34 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -int ft_isalpha(int c) -{ - if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) - return (1); - return (0); -} diff --git a/Libft/ft_isascii.c b/Libft/ft_isascii.c deleted file mode 100644 index f95ded8..0000000 --- a/Libft/ft_isascii.c +++ /dev/null @@ -1,19 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_isascii.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/02 18:20:38 by grobledo #+# #+# */ -/* Updated: 2023/02/02 18:20:40 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -int ft_isascii(int c) -{ - if (c >= 0 && c <= 127) - return (1); - return (0); -} diff --git a/Libft/ft_isdigit.c b/Libft/ft_isdigit.c deleted file mode 100644 index beb94d6..0000000 --- a/Libft/ft_isdigit.c +++ /dev/null @@ -1,19 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_isdigit.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/02 17:48:20 by grobledo #+# #+# */ -/* Updated: 2023/02/02 17:48:22 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -int ft_isdigit(int c) -{ - if (c >= '0' && c <= '9') - return (1); - return (0); -} diff --git a/Libft/ft_isprint.c b/Libft/ft_isprint.c deleted file mode 100644 index acaa9b7..0000000 --- a/Libft/ft_isprint.c +++ /dev/null @@ -1,19 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_isprint.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/02 18:27:24 by grobledo #+# #+# */ -/* Updated: 2023/02/02 18:27:25 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -int ft_isprint(int c) -{ - if (c >= 32 && c <= 126) - return (1); - return (0); -} diff --git a/Libft/ft_itoa.c b/Libft/ft_itoa.c deleted file mode 100644 index 3f1cdf6..0000000 --- a/Libft/ft_itoa.c +++ /dev/null @@ -1,62 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_itoa.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/19 19:32:47 by grobledo #+# #+# */ -/* Updated: 2023/02/19 19:32:48 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -int countsize(int nb) -{ - long int temp; - int size; - - size = 0; - temp = nb; - if (nb < 0) - { - temp = -nb; - size = size +1; - } - while (temp > 9) - { - temp = (temp / 10); - size++; - } - size++; - return (size); -} - -char *ft_itoa(int nb) -{ - long int temp; - char *res; - int size; - - if (nb == -2147483648) - return (ft_strdup("-2147483648")); - temp = nb; - size = countsize(nb); - res = ft_calloc(size + 1, sizeof (char)); - if (!res) - return (NULL); - if (nb < 0) - { - res[0] = '-'; - temp *= -1; - } - if (nb == 0) - res[0] = '0'; - while (temp > 0) - { - res[size - 1] = (temp % 10 + 48); - size--; - temp /= 10; - } - return (res); -} diff --git a/Libft/ft_lstadd_back.c b/Libft/ft_lstadd_back.c deleted file mode 100644 index fd2389e..0000000 --- a/Libft/ft_lstadd_back.c +++ /dev/null @@ -1,30 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_lstadd_back.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/23 11:38:44 by grobledo #+# #+# */ -/* Updated: 2023/02/23 11:38:46 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -void ft_lstadd_back(t_list **lst, t_list *new) -{ - t_list *temp; - - if (!new) - return ; - if (!*lst) - { - *lst = new; - return ; - } - else - { - temp = ft_lstlast(*lst); - temp->next = new; - } -} diff --git a/Libft/ft_lstadd_front.c b/Libft/ft_lstadd_front.c deleted file mode 100644 index a24ae19..0000000 --- a/Libft/ft_lstadd_front.c +++ /dev/null @@ -1,18 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_lstadd_front.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/21 23:42:28 by grobledo #+# #+# */ -/* Updated: 2023/02/21 23:42:30 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -void ft_lstadd_front(t_list **lst, t_list *new) -{ - new->next = *lst; - *lst = new; -} diff --git a/Libft/ft_lstclear.c b/Libft/ft_lstclear.c deleted file mode 100644 index 3d8d38d..0000000 --- a/Libft/ft_lstclear.c +++ /dev/null @@ -1,30 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_lstclear.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/23 22:05:11 by grobledo #+# #+# */ -/* Updated: 2023/02/23 22:05:12 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -void ft_lstclear(t_list **lst, void (*del)(void*)) -{ - t_list *next; - t_list *current; - - if (lst == NULL || del == NULL || *lst == NULL) - return ; - current = *lst; - while (current != NULL) - { - next = current->next; - del(current->content); - free(current); - current = next; - } - *lst = NULL; -} diff --git a/Libft/ft_lstdelone.c b/Libft/ft_lstdelone.c deleted file mode 100644 index da37e72..0000000 --- a/Libft/ft_lstdelone.c +++ /dev/null @@ -1,22 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_lstdelone.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/23 20:15:05 by grobledo #+# #+# */ -/* Updated: 2023/02/23 20:15:06 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -void ft_lstdelone(t_list *lst, void (*del)(void*)) -{ - if (!lst) - return ; - if (!del) - return ; - del(lst->content); - free(lst); -} diff --git a/Libft/ft_lstiter.c b/Libft/ft_lstiter.c deleted file mode 100644 index 67041a2..0000000 --- a/Libft/ft_lstiter.c +++ /dev/null @@ -1,27 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_lstiter.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/23 22:42:44 by grobledo #+# #+# */ -/* Updated: 2023/02/23 22:42:45 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -void ft_lstiter(t_list *lst, void (*f)(void *)) -{ - t_list *node; - - node = lst; - if (lst == NULL || f == NULL) - return ; - node = lst; - while (node != NULL) - { - f(node->content); - node = node->next; - } -} diff --git a/Libft/ft_lstlast.c b/Libft/ft_lstlast.c deleted file mode 100644 index 9024c06..0000000 --- a/Libft/ft_lstlast.c +++ /dev/null @@ -1,21 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_lstlast.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/23 10:27:02 by grobledo #+# #+# */ -/* Updated: 2023/02/23 10:27:07 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -t_list *ft_lstlast(t_list *lst) -{ - if (!lst) - return (NULL); - while (lst->next) - lst = lst->next; - return (lst); -} diff --git a/Libft/ft_lstmap.c b/Libft/ft_lstmap.c deleted file mode 100644 index 8329e15..0000000 --- a/Libft/ft_lstmap.c +++ /dev/null @@ -1,41 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_lstmap.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/24 11:59:12 by grobledo #+# #+# */ -/* Updated: 2023/02/24 11:59:13 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -t_list *ft_lstmap(t_list *lst, void *(f)(void *), void (*del)(void *)) -{ - t_list *new; - t_list *current; - - if (!lst || !f ||!del) - return (NULL); - new = ft_lstnew(NULL); - if (!new) - return (NULL); - current = new; - while (lst) - { - current->content = f(lst->content); - if (lst->next) - { - current->next = ft_lstnew(NULL); - if (!current) - { - ft_lstclear(&new, del); - return (NULL); - } - current = current ->next; - } - lst = lst->next; - } - return (new); -} diff --git a/Libft/ft_lstnew.c b/Libft/ft_lstnew.c deleted file mode 100644 index 1cf613c..0000000 --- a/Libft/ft_lstnew.c +++ /dev/null @@ -1,24 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_lstnew.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/21 19:40:32 by grobledo #+# #+# */ -/* Updated: 2023/02/21 22:58:42 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -t_list *ft_lstnew(void *content) -{ - t_list *new; - - new = malloc(sizeof(t_list)); - if (new == 0) - return (NULL); - new->content = content; - new->next = NULL; - return (new); -} diff --git a/Libft/ft_lstsize.c b/Libft/ft_lstsize.c deleted file mode 100644 index c489c1a..0000000 --- a/Libft/ft_lstsize.c +++ /dev/null @@ -1,25 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_lstsize.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/23 10:14:39 by grobledo #+# #+# */ -/* Updated: 2023/02/23 10:14:41 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -int ft_lstsize(t_list *lst) -{ - int i; - - i = 0; - while (lst) - { - lst = lst->next; - i++; - } - return (i); -} diff --git a/Libft/ft_memchr.c b/Libft/ft_memchr.c deleted file mode 100644 index 6a35922..0000000 --- a/Libft/ft_memchr.c +++ /dev/null @@ -1,26 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_memchr.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/08 20:08:44 by grobledo #+# #+# */ -/* Updated: 2023/02/08 20:08:45 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -void *ft_memchr(const void *str, int c, size_t n) -{ - size_t i; - - i = 0; - while (i < n) - { - if ((((unsigned char *)str)[i]) == (unsigned char)c) - return ((void *)str + i); - i++; - } - return (NULL); -} diff --git a/Libft/ft_memcmp.c b/Libft/ft_memcmp.c deleted file mode 100644 index 112ccee..0000000 --- a/Libft/ft_memcmp.c +++ /dev/null @@ -1,26 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_memcmp.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/08 20:15:03 by grobledo #+# #+# */ -/* Updated: 2023/02/08 20:15:05 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -int ft_memcmp(const void *s1, const void *s2, size_t n) -{ - size_t i; - - i = 0; - while (i < n) - { - if (((unsigned char *)s1)[i] != ((unsigned char *)s2)[i]) - return (((unsigned char *)s1)[i] - ((unsigned char *)s2)[i]); - i++; - } - return (0); -} diff --git a/Libft/ft_memcpy.c b/Libft/ft_memcpy.c deleted file mode 100644 index 407ca30..0000000 --- a/Libft/ft_memcpy.c +++ /dev/null @@ -1,28 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_memcpy.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/08 15:04:22 by grobledo #+# #+# */ -/* Updated: 2023/02/08 15:04:24 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -void *ft_memcpy(void *dest, const void *src, size_t n) -{ - int i; - - if (!dest && !src) - return (NULL); - i = 0; - while (n != 0) - { - ((unsigned char *)dest)[i] = ((unsigned char *)src)[i]; - i++; - n--; - } - return ((void *)dest); -} diff --git a/Libft/ft_memmove.c b/Libft/ft_memmove.c deleted file mode 100644 index c6e9153..0000000 --- a/Libft/ft_memmove.c +++ /dev/null @@ -1,39 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_memmove.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/10 10:32:23 by grobledo #+# #+# */ -/* Updated: 2023/02/10 10:32:25 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -void *ft_memmove(void *dest, const void *src, size_t n) -{ - size_t i; - - if (!dest && !src) - return (NULL); - i = 0; - if (dest < src) - { - while (n--) - { - (((unsigned char *)dest)[i]) = (((unsigned char *)src)[i]); - i++; - } - } - else - { - i = i + n - 1; - while (n--) - { - (((unsigned char *)dest)[i]) = (((unsigned char *)src)[i]); - i--; - } - } - return ((void *)dest); -} diff --git a/Libft/ft_memset.c b/Libft/ft_memset.c deleted file mode 100644 index ca28cfe..0000000 --- a/Libft/ft_memset.c +++ /dev/null @@ -1,26 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_memset.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/02 18:40:30 by grobledo #+# #+# */ -/* Updated: 2023/02/02 18:40:33 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -void *ft_memset(void *str, int c, size_t n) -{ - int i; - - i = 0; - while (n != 0) - { - (((unsigned char *)str)[i]) = c; - i++; - n--; - } - return ((void *)str); -} diff --git a/Libft/ft_printf.c b/Libft/ft_printf.c deleted file mode 100644 index f2c233c..0000000 --- a/Libft/ft_printf.c +++ /dev/null @@ -1,63 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_printf.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/03/13 10:48:34 by grobledo #+# #+# */ -/* Updated: 2023/03/13 10:48:35 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -int ft_format(const char format, va_list args, int count) -{ - if (format == 'c') - count = ft_putcharf((char)va_arg(args, int), count); - else if (format == 's') - count = ft_putstrf(va_arg(args, char *), count); - else if (format == 'd') - count = ft_putnbrf(va_arg(args, int), count); - else if (format == 'i') - count = ft_putnbrf(va_arg(args, int), count); - else if (format == 'u') - count = ft_putnbrposf(va_arg(args, unsigned int), count); - else if (format == 'x') - count = ft_starthexa (va_arg(args, unsigned int), 'x', count); - else if (format == 'X') - count = ft_starthexa (va_arg(args, unsigned int), 'X', count); - else if (format == 'p') - count = ft_startpointer - (va_arg(args, unsigned long long int), 'p', count); - else if (format == '%') - count = ft_putcharf('%', count); - return (count); -} - -int ft_printf(const char *format, ...) -{ - va_list args; - int i; - int count; - - va_start(args, format); - i = 0; - count = 0; - while (format[i]) - { - if (format[i] != '%') - { - write(1, &format[i], 1); - count++; - } - else - { - i++; - count = ft_format(format[i], args, count); - } - i++; - } - va_end(args); - return (count); -} diff --git a/Libft/ft_put.c b/Libft/ft_put.c deleted file mode 100644 index b29ff4d..0000000 --- a/Libft/ft_put.c +++ /dev/null @@ -1,75 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_put.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/04/13 10:26:43 by grobledo #+# #+# */ -/* Updated: 2023/04/13 10:26:45 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -int ft_putcharf(char c, int count) -{ - write(1, &c, 1); - count++; - return (count); -} - -int ft_putnbrf(int n, int count) -{ - if (n == -2147483648) - { - (write(1, "-2147483648", 11)); - count += 11; - return (count); - } - if (n < 0) - { - count = ft_putcharf('-', count); - n *= -1; - count = ft_putnbrf(n, count); - } - else if (n >= 10) - { - count = ft_putnbrf(n / 10, count); - count = ft_putnbrf(n % 10, count); - } - else - { - count = ft_putcharf(n + '0', count); - } - return (count); -} - -int ft_putnbrposf(unsigned int n, int count) -{ - if (n >= 10) - { - count = ft_putnbrposf(n / 10, count); - count = ft_putnbrposf(n % 10, count); - } - else - { - count = ft_putcharf(n + '0', count); - } - return (count); -} - -int ft_putstrf(char *s, int count) -{ - int i; - - if (!s) - return (ft_putstrf("(null)", count)); - i = 0; - while (s[i]) - { - write(1, &s[i], 1); - i++; - count++; - } - return (count); -} diff --git a/Libft/ft_putchar_fd.c b/Libft/ft_putchar_fd.c deleted file mode 100644 index 33fe262..0000000 --- a/Libft/ft_putchar_fd.c +++ /dev/null @@ -1,17 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_putchar_fd.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/20 23:21:04 by grobledo #+# #+# */ -/* Updated: 2023/02/20 23:21:05 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -void ft_putchar_fd(char c, int fd) -{ - write(fd, &c, 1); -} diff --git a/Libft/ft_putendl_fd.c b/Libft/ft_putendl_fd.c deleted file mode 100644 index bed0653..0000000 --- a/Libft/ft_putendl_fd.c +++ /dev/null @@ -1,27 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_putendl_fd.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/20 23:36:08 by grobledo #+# #+# */ -/* Updated: 2023/02/20 23:36:09 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -void ft_putendl_fd(char *s, int fd) -{ - int i; - - if (!s) - return ; - i = 0; - while (s[i]) - { - write(fd, &s[i], 1); - i++; - } - ft_putchar_fd('\n', fd); -} diff --git a/Libft/ft_putnbr_fd.c b/Libft/ft_putnbr_fd.c deleted file mode 100644 index 89e7851..0000000 --- a/Libft/ft_putnbr_fd.c +++ /dev/null @@ -1,33 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_putnbr_fd.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/20 23:43:01 by grobledo #+# #+# */ -/* Updated: 2023/02/20 23:43:02 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -void ft_putnbr_fd(int n, int fd) -{ - if (n == -2147483648) - { - write(fd, "-2147483648", 11); - } - else if (n < 0) - { - ft_putchar_fd('-', fd); - n *= -1; - ft_putnbr_fd(n, fd); - } - else if (n >= 10) - { - ft_putnbr_fd(n / 10, fd); - ft_putnbr_fd(n % 10, fd); - } - else - ft_putchar_fd(n + '0', fd); -} diff --git a/Libft/ft_putstr_fd.c b/Libft/ft_putstr_fd.c deleted file mode 100644 index 7a53068..0000000 --- a/Libft/ft_putstr_fd.c +++ /dev/null @@ -1,26 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_putstr_fd.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/20 23:29:21 by grobledo #+# #+# */ -/* Updated: 2023/02/20 23:29:26 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -void ft_putstr_fd(char *s, int fd) -{ - int i; - - if (!s) - return ; - i = 0; - while (s[i]) - { - write(fd, &s[i], 1); - i++; - } -} diff --git a/Libft/ft_split.c b/Libft/ft_split.c deleted file mode 100644 index f48337c..0000000 --- a/Libft/ft_split.c +++ /dev/null @@ -1,78 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_split.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/21 11:11:19 by grobledo #+# #+# */ -/* Updated: 2023/02/21 18:03:11 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -int ft_countword(const char *s, char c) -{ - int i; - int j; - - i = 0; - j = 0; - while (s[i]) - { - while (s[i] == c) - i++; - if (s[i] != '\0') - j++; - while (s[i] != c && s[i]) - i++; - } - return (j); -} - -char *ft_strdup_modif(const char *s, char c, size_t i) -{ - size_t k; - char *dest; - - k = 0; - while (s[i + k] && s[i + k] != c) - k++; - dest = ft_calloc(sizeof(char), (k + 1)); - k = 0; - if (dest == 0) - return (NULL); - while (s[i + k] && s[i + k] != c) - { - dest[k] = s[i + k]; - k++; - } - return (dest); -} - -char **ft_split(const char *s, char c) -{ - size_t i; - size_t j; - char **res; - - if (!s) - return (NULL); - res = ft_calloc(sizeof (char *), (ft_countword(s, c) + 1)); - if (!res) - return (NULL); - i = 0; - j = 0; - while (s[i]) - { - while (s[i] == c) - i++; - if (s[i] == '\0') - break ; - res[j] = ft_strdup_modif(s, c, i); - j++; - while (s[i] != c && s[i]) - i++; - } - return (res); -} diff --git a/Libft/ft_strchr.c b/Libft/ft_strchr.c deleted file mode 100644 index 8bb7eee..0000000 --- a/Libft/ft_strchr.c +++ /dev/null @@ -1,28 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strchr.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/04 12:59:29 by grobledo #+# #+# */ -/* Updated: 2023/02/04 12:59:31 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -char *ft_strchr(const char *str, int tofind) -{ - int i; - - i = 0; - while (str[i]) - { - if ((unsigned char)str[i] == (unsigned char)tofind) - return ((char *)&str[i]); - i++; - } - if (tofind == '\0') - return ((char *)&str[i]); - return (0); -} diff --git a/Libft/ft_strdup.c b/Libft/ft_strdup.c deleted file mode 100644 index b743a62..0000000 --- a/Libft/ft_strdup.c +++ /dev/null @@ -1,25 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strdup.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/08 20:55:55 by grobledo #+# #+# */ -/* Updated: 2023/02/13 21:30:44 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -char *ft_strdup(const char *src) -{ - size_t size; - char *dest; - - size = ft_strlen(src); - dest = (char *)malloc(size + 1); - if (dest == 0) - return (NULL); - ft_strlcpy(dest, src, size + 1); - return (dest); -} diff --git a/Libft/ft_striteri.c b/Libft/ft_striteri.c deleted file mode 100644 index 934c9d8..0000000 --- a/Libft/ft_striteri.c +++ /dev/null @@ -1,26 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_striteri.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/20 22:29:06 by grobledo #+# #+# */ -/* Updated: 2023/02/20 22:29:07 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -void ft_striteri(char *s, void (*f)(unsigned int, char*)) -{ - size_t i; - - if (!s || !(*f)) - return ; - i = 0; - while (i < ft_strlen(s)) - { - (*f)(i, &s[i]); - i++; - } -} diff --git a/Libft/ft_strjoin.c b/Libft/ft_strjoin.c deleted file mode 100644 index 735da25..0000000 --- a/Libft/ft_strjoin.c +++ /dev/null @@ -1,41 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strjoin.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/14 16:41:00 by grobledo #+# #+# */ -/* Updated: 2023/02/14 16:41:02 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -char *ft_strjoin(char const *s1, char const *s2) -{ - size_t i; - size_t j; - char *dest; - - if (!s1 || !s2) - return (NULL); - dest = ft_calloc ((ft_strlen(s1) + ft_strlen(s2) + 1), sizeof (char)); - if (dest == 0) - return (NULL); - i = 0; - j = 0; - while (s1[i] || s2[j]) - { - while (i < ft_strlen(s1)) - { - dest[i] = s1[i]; - i++; - } - while (j < ft_strlen(s2)) - { - dest[i + j] = s2[j]; - j++; - } - } - return (dest); -} diff --git a/Libft/ft_strlcat.c b/Libft/ft_strlcat.c deleted file mode 100644 index 89ae6b0..0000000 --- a/Libft/ft_strlcat.c +++ /dev/null @@ -1,37 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strlcat.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/02 19:33:00 by grobledo #+# #+# */ -/* Updated: 2023/02/02 19:33:01 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -int ft_strlcat(char *dest, const char *src, size_t size) -{ - unsigned int i; - unsigned int j; - unsigned int dlen; - unsigned int slen; - - if ((dest == NULL || src == NULL) && size == 0) - return (0); - i = 0; - j = ft_strlen(dest); - dlen = j; - slen = ft_strlen(src); - if (size <= dlen) - return (slen + size); - while (src[i] != '\0' && i < size - dlen - 1) - { - dest[j] = src[i]; - i++; - j++; - } - dest[j] = '\0'; - return (dlen + slen); -} diff --git a/Libft/ft_strlcpy.c b/Libft/ft_strlcpy.c deleted file mode 100644 index 5201ec0..0000000 --- a/Libft/ft_strlcpy.c +++ /dev/null @@ -1,28 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strlcpy.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/02 19:33:21 by grobledo #+# #+# */ -/* Updated: 2023/02/02 19:33:24 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -int ft_strlcpy(char *dest, const char *src, size_t size) -{ - unsigned int i; - - i = 0; - if (size == 0) - return (ft_strlen(src)); - while (src[i] && i < size - 1) - { - dest[i] = src[i]; - i++; - } - dest[i] = '\0'; - return (ft_strlen(src)); -} diff --git a/Libft/ft_strlen.c b/Libft/ft_strlen.c deleted file mode 100644 index 45c7ee9..0000000 --- a/Libft/ft_strlen.c +++ /dev/null @@ -1,24 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strlen.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/02 18:31:38 by grobledo #+# #+# */ -/* Updated: 2023/02/02 18:31:39 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -size_t ft_strlen(const char *str) -{ - size_t i; - - i = 0; - while (str[i]) - { - i++; - } - return (i); -} diff --git a/Libft/ft_strmapi.c b/Libft/ft_strmapi.c deleted file mode 100644 index 6ce2ee1..0000000 --- a/Libft/ft_strmapi.c +++ /dev/null @@ -1,33 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strmapi.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/20 21:51:01 by grobledo #+# #+# */ -/* Updated: 2023/02/20 21:51:02 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -char *ft_strmapi(char const *s, char (*f)(unsigned int, char)) -{ - size_t i; - size_t dlen; - char *dest; - - if (!s || !(*f)) - return (NULL); - i = 0; - dlen = ft_strlen(s); - dest = ft_calloc(dlen + 1, sizeof (char)); - if (!dest) - return (NULL); - while (i < ft_strlen(s)) - { - dest[i] = (*f)(i, s[i]); - i++; - } - return (dest); -} diff --git a/Libft/ft_strncmp.c b/Libft/ft_strncmp.c deleted file mode 100644 index 8a35309..0000000 --- a/Libft/ft_strncmp.c +++ /dev/null @@ -1,26 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strncmp.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/04 14:33:04 by grobledo #+# #+# */ -/* Updated: 2023/02/04 14:33:06 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -int ft_strncmp(const char *s1, const char *s2, size_t size) -{ - size_t i; - - i = 0; - while ((s1[i] || s2[i]) && (i < size)) - { - if (s1[i] != s2[i]) - return (((unsigned char)(s1[i]) - ((unsigned char)s2[i]))); - i++; - } - return (0); -} diff --git a/Libft/ft_strnstr.c b/Libft/ft_strnstr.c deleted file mode 100644 index 1a8660a..0000000 --- a/Libft/ft_strnstr.c +++ /dev/null @@ -1,38 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strnstr.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/13 22:07:12 by grobledo #+# #+# */ -/* Updated: 2023/02/13 22:07:14 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -char *ft_strnstr(const char *big, const char *little, size_t len) -{ - size_t i; - size_t j; - - if ((big == NULL || little == NULL) && !len) - return (0); - i = 0; - j = 0; - if (little[i] == '\0') - return ((char *)big); - while (big[i] && i < len) - { - if (big[i] == little[j]) - { - while (big[i + j] == little[j] && (i + j) < len && little[j]) - j++; - if (little[j] == '\0') - return ((char *)&big[i]); - j = 0; - } - i++; - } - return (NULL); -} diff --git a/Libft/ft_strrchr.c b/Libft/ft_strrchr.c deleted file mode 100644 index c1fb9e4..0000000 --- a/Libft/ft_strrchr.c +++ /dev/null @@ -1,28 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strrchr.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/04 14:00:32 by grobledo #+# #+# */ -/* Updated: 2023/02/13 21:32:54 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -char *ft_strrchr(const char *str, int tofind) -{ - int i; - - i = 0; - while (str[i]) - i++; - while (i >= 0) - { - if ((unsigned char)str[i] == (unsigned char)tofind) - return ((char *)&str[i]); - i--; - } - return (0); -} diff --git a/Libft/ft_strtrim.c b/Libft/ft_strtrim.c deleted file mode 100644 index 02a14e6..0000000 --- a/Libft/ft_strtrim.c +++ /dev/null @@ -1,40 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_strtrim.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/18 18:34:05 by grobledo #+# #+# */ -/* Updated: 2023/02/18 18:34:08 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -char *ft_strtrim(const char *s1, const char *set) -{ - size_t i; - size_t j; - size_t k; - size_t dlen; - char *dest; - - if (!s1) - return (NULL); - i = 0; - j = ft_strlen(s1); - k = -1; - while (ft_strchr(set, s1[i]) != 0 && s1[i]) - i++; - if (!s1[i]) - return (ft_strdup("")); - while (ft_strchr(set, s1[j]) != 0 && j > 0) - j--; - dlen = (j - i); - dest = ft_calloc ((dlen + 2), sizeof (char)); - if (dest == 0) - return (NULL); - while (++k <= dlen) - dest[k] = s1[i + k]; - return (dest); -} diff --git a/Libft/ft_substr.c b/Libft/ft_substr.c deleted file mode 100644 index 22c55ea..0000000 --- a/Libft/ft_substr.c +++ /dev/null @@ -1,39 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_substr.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/14 14:52:48 by grobledo #+# #+# */ -/* Updated: 2023/02/14 14:52:51 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -char *ft_substr(const char *s, unsigned int start, size_t len) -{ - size_t i; - size_t j; - char *dest; - - if (!s) - return (NULL); - i = start; - j = 0; - if (start >= ft_strlen(s)) - return (ft_calloc(1, 1)); - if (ft_strlen(s + start) < len) - dest = (char *)ft_calloc((ft_strlen(s + start) + 1), sizeof(char)); - else - dest = (char *)ft_calloc((len + 1), sizeof(char)); - if (dest == 0) - return (NULL); - while (j < len && s[i]) - { - dest[j] = s[i]; - i++; - j++; - } - return (dest); -} diff --git a/Libft/ft_tolower.c b/Libft/ft_tolower.c deleted file mode 100644 index 7eae236..0000000 --- a/Libft/ft_tolower.c +++ /dev/null @@ -1,19 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_tolower.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/02 20:49:29 by grobledo #+# #+# */ -/* Updated: 2023/02/02 20:49:30 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -int ft_tolower(int c) -{ - if (c >= 65 && c <= 90) - c += 32; - return (c); -} diff --git a/Libft/ft_toupper.c b/Libft/ft_toupper.c deleted file mode 100644 index 2f7e5f2..0000000 --- a/Libft/ft_toupper.c +++ /dev/null @@ -1,19 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* ft_toupper.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/02 20:19:23 by grobledo #+# #+# */ -/* Updated: 2023/02/02 20:19:25 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -int ft_toupper(int c) -{ - if (c >= 97 && c <= 122) - c -= 32; - return (c); -} diff --git a/Libft/get_next_line.c b/Libft/get_next_line.c deleted file mode 100644 index da04a89..0000000 --- a/Libft/get_next_line.c +++ /dev/null @@ -1,110 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* get_next_line.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/05/05 20:41:22 by grobledo #+# #+# */ -/* Updated: 2023/05/05 20:41:25 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -char *ft_join( char *buffer, char *buff_read) -{ - char *temp; - - temp = ft_strjoing(buffer, buff_read); - free (buffer); - return (temp); -} - -char *ft_nextline(char *buffer) -{ - int i; - int j; - char *nextline; - - i = 0; - while (buffer[i] && buffer[i] != '\n') - i++; - if (buffer[i] == '\n') - i++; - if (!buffer[i]) - { - free (buffer); - return (NULL); - } - j = 0; - nextline = ft_calloc(ft_strleng(buffer) - i + 1, sizeof(char)); - while (buffer[i]) - { - nextline[j++] = buffer[i++]; - } - free (buffer); - return (nextline); -} - -char *ft_line(char *buffer) -{ - char *line; - int i; - - i = 0; - if (!buffer) - return (NULL); - while (buffer[i] && buffer[i] != '\n') - i++; - line = ft_calloc(i + 2, sizeof(char)); - i = 0; - while (buffer[i] && buffer[i] != '\n') - { - line[i] = buffer[i]; - i++; - } - if (buffer[i] && buffer[i] == '\n') - line[i] = '\n'; - return (line); -} - -char *ft_readfile(int fd, char *buffer) -{ - int byte_read; - char *buff_read; - - buff_read = ft_calloc(BUFFER_SIZE + 1, sizeof(char)); - byte_read = 1; - while (byte_read > 0) - { - byte_read = read(fd, buff_read, BUFFER_SIZE); - if (byte_read == 0) - break ; - if (byte_read == -1) - { - free(buff_read); - return (NULL); - } - buff_read[byte_read] = 0; - buffer = ft_join(buffer, buff_read); - if (ft_strrchr(buff_read, '\n')) - break ; - } - free (buff_read); - return (buffer); -} - -char *get_next_line(int fd) -{ - char *line; - static char *buffer = NULL; - - if (fd < 0 || BUFFER_SIZE <= 0 || read(fd, 0, 0) < 0) - return (NULL); - buffer = ft_readfile(fd, buffer); - if (!buffer) - return (NULL); - line = ft_line(buffer); - buffer = ft_nextline(buffer); - return (line); -} diff --git a/Libft/get_next_line_utils.c b/Libft/get_next_line_utils.c deleted file mode 100644 index 6878058..0000000 --- a/Libft/get_next_line_utils.c +++ /dev/null @@ -1,53 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* get_next_line_utils.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/05/05 20:41:39 by grobledo #+# #+# */ -/* Updated: 2023/05/05 20:41:41 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#include "libft.h" - -size_t ft_strleng(const char *str) -{ - size_t i; - - i = 0; - while (str && str[i]) - { - i++; - } - return (i); -} - -char *ft_strjoing(char const *s1, char const *s2) -{ - size_t i; - size_t j; - char *dest; - - if (!s2) - return (NULL); - dest = ft_calloc ((ft_strleng(s1) + ft_strleng(s2) + 1), sizeof (char)); - if (dest == 0) - return (NULL); - i = 0; - j = 0; - while (s2[j]) - { - while (i < ft_strleng(s1)) - { - dest[i] = s1[i]; - i++; - } - while (j < ft_strleng(s2)) - { - dest[i + j] = s2[j]; - j++; - } - } - return (dest); -} diff --git a/Libft/libft.h b/Libft/libft.h deleted file mode 100644 index c98ec10..0000000 --- a/Libft/libft.h +++ /dev/null @@ -1,89 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* libft.h :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: grobledo +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2023/02/10 12:14:34 by grobledo #+# #+# */ -/* Updated: 2023/02/13 21:31:19 by grobledo ### ########.fr */ -/* */ -/* ************************************************************************** */ -#ifndef LIBFT_H -# define LIBFT_H -# include -# include -# include -# include -# include -# include -# include - -# ifndef BUFFER_SIZE -# define BUFFER_SIZE 10000 -# endif - -typedef struct s_list -{ - void *content; - struct s_list *next; -} t_list; - -int ft_atoi(const char *str); -void ft_bzero(void *s, size_t n); -void *ft_calloc(size_t count, size_t size); -int ft_isalnum(int c); -int ft_isalpha(int c); -int ft_isascii(int c); -int ft_isdigit(int c); -int ft_isprint(int c); -void *ft_memchr(const void *str, int c, size_t n); -int ft_memcmp(const void *s1, const void *s2, size_t n); -void *ft_memcpy(void *dest, const void *src, size_t n); -void *ft_memmove(void *dest, const void *src, size_t n); -void *ft_memset(void *str, int c, size_t n); -char *ft_strchr(const char *str, int tofind); -char *ft_strdup(const char *src); -int ft_strlcat(char *dest, const char *src, size_t size); -int ft_strlcpy(char *dest, const char *src, size_t size); -size_t ft_strlen(const char *str); -int ft_strncmp(const char *s1, const char *s2, size_t size); -char *ft_strrchr(const char *str, int tofind); -int ft_tolower(int c); -int ft_toupper(int c); -char *ft_strnstr(const char *big, const char *little, size_t len); -char *ft_substr(char const *s, unsigned int start, size_t len); -char *ft_strjoin(char const *s1, char const *s2); -char *ft_strtrim(const char *s1, const char *set); -char *ft_itoa(int nb); -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); -char **ft_split(const char *s, char c); -t_list *ft_lstnew(void *content); -void ft_lstadd_front(t_list **lst, t_list *new); -int ft_lstsize(t_list *lst); -t_list *ft_lstlast(t_list *lst); -void ft_lstadd_back(t_list **lst, t_list *new); -void ft_lstadd_back(t_list **lst, t_list *new); -void ft_lstdelone(t_list *lst, void (*del)(void*)); -void ft_lstclear(t_list **lst, void (*del)(void*)); -void ft_lstiter(t_list *lst, void (*f)(void *)); -t_list *ft_lstmap(t_list *lst, void *(f)(void *), void (*del)(void *)); -int ft_hexa(unsigned int args, char format, int count); -int ft_format(const char format, va_list args, int count); -int ft_printf(const char *format, ...); -int ft_putstrf(char *s, int count); -int ft_putcharf(char c, int count); -int ft_putnbrposf(unsigned int n, int count); -int ft_putnbrf(int n, int count); -int ft_starthexa(unsigned int args, char format, int count); -int ft_pointer(unsigned long long int args, char format, int count); -int ft_startpointer(unsigned long long int args, char format, int count); -char *get_next_line(int fd); -size_t ft_strleng(const char *str); -char *ft_strjoing(char const *s1, char const *s2); -#endif diff --git a/Minilibx b/Minilibx deleted file mode 160000 index 7dc53a4..0000000 --- a/Minilibx +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7dc53a411a7d4ae286c60c6229bd1e395b0efb82