diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | libft/Makefile | 174 | ||||
-rw-r--r-- | libft/inc/libft.h (renamed from libft/libft.h) | 3 | ||||
-rw-r--r-- | libft/main.c | 122 | ||||
-rw-r--r-- | libft/src/ft_atoi.c (renamed from libft/ft_atoi.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_bzero.c (renamed from libft/ft_bzero.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_calloc.c (renamed from libft/ft_calloc.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_isalnum.c (renamed from libft/ft_isalnum.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_isalpha.c (renamed from libft/ft_isalpha.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_isascii.c (renamed from libft/ft_isascii.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_isdigit.c (renamed from libft/ft_isdigit.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_isprint.c (renamed from libft/ft_isprint.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_isspace.c (renamed from libft/ft_isspace_bonus.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_itoa.c (renamed from libft/ft_itoa.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_lstadd_back.c (renamed from libft/ft_lstadd_back_bonus.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_lstadd_front.c (renamed from libft/ft_lstadd_front_bonus.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_lstclear.c (renamed from libft/ft_lstclear_bonus.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_lstdelone.c (renamed from libft/ft_lstdelone_bonus.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_lstiter.c (renamed from libft/ft_lstiter_bonus.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_lstlast.c (renamed from libft/ft_lstlast_bonus.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_lstmap.c (renamed from libft/ft_lstmap_bonus.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_lstnew.c (renamed from libft/ft_lstnew_bonus.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_lstsize.c (renamed from libft/ft_lstsize_bonus.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_memccpy.c (renamed from libft/ft_memccpy.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_memchr.c (renamed from libft/ft_memchr.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_memcmp.c (renamed from libft/ft_memcmp.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_memcpy.c (renamed from libft/ft_memcpy.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_memmove.c (renamed from libft/ft_memmove.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_memset.c (renamed from libft/ft_memset.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_putchar.c (renamed from libft/ft_putchar_bonus.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_putchar_fd.c (renamed from libft/ft_putchar_fd.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_putendl.c (renamed from libft/ft_putendl_bonus.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_putendl_fd.c (renamed from libft/ft_putendl_fd.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_putnbr.c (renamed from libft/ft_putnbr_bonus.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_putnbr_fd.c (renamed from libft/ft_putnbr_fd.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_putstr.c (renamed from libft/ft_putstr_bonus.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_putstr_fd.c (renamed from libft/ft_putstr_fd.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_split.c (renamed from libft/ft_split.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_sqrt.c (renamed from libft/ft_sqrt_bonus.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_strcat.c (renamed from libft/ft_strcat_bonus.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_strchr.c (renamed from libft/ft_strchr.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_strcmp.c (renamed from libft/ft_strcmp_bonus.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_strdup.c (renamed from libft/ft_strdup.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_strjoin.c (renamed from libft/ft_strjoin.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_strlcat.c (renamed from libft/ft_strlcat.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_strlcpy.c (renamed from libft/ft_strlcpy.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_strlen.c (renamed from libft/ft_strlen.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_strmapi.c (renamed from libft/ft_strmapi.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_strncmp.c (renamed from libft/ft_strncmp.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_strnlen.c | 27 | ||||
-rw-r--r-- | libft/src/ft_strnstr.c (renamed from libft/ft_strnstr.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_strrchr.c (renamed from libft/ft_strrchr.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_strtrim.c (renamed from libft/ft_strtrim.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_substr.c (renamed from libft/ft_substr.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_tolower.c (renamed from libft/ft_tolower.c) | 0 | ||||
-rw-r--r-- | libft/src/ft_toupper.c (renamed from libft/ft_toupper.c) | 0 |
56 files changed, 112 insertions, 216 deletions
@@ -39,7 +39,7 @@ MKDIR = mkdir -p ${OBJS_DIR}%.o: ${SRCS_DIR}%.c inc/minishell.h libft/libft.h - ${MKDIR} ${OBJS_DIR} + @${MKDIR} ${OBJS_DIR} ${CC} ${CFLAGS} ${DEBUG} ${INCS_DIR} -o $@ -c $< $(NAME): ${OBJS} diff --git a/libft/Makefile b/libft/Makefile index fbe5c6e..83c4b54 100644 --- a/libft/Makefile +++ b/libft/Makefile @@ -11,114 +11,106 @@ # / # # **************************************************************************** # -SRCS_DIR = ./ - +SRCS_DIR = src/ SRCS = \ - ft_memset.c \ - ft_bzero.c \ - ft_memcpy.c \ - ft_memccpy.c \ - ft_memmove.c \ - ft_memchr.c \ - ft_memcmp.c \ - ft_strlen.c \ - ft_isalpha.c \ - ft_isdigit.c \ - ft_isalnum.c \ - ft_isascii.c \ - ft_isprint.c \ - ft_tolower.c \ - ft_toupper.c \ - ft_strchr.c \ - ft_strrchr.c \ - ft_strncmp.c \ - ft_strlcpy.c \ - ft_strlcat.c \ - ft_strnstr.c \ - ft_atoi.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_putchar_fd.c \ - ft_putstr_fd.c \ - ft_putendl_fd.c \ - ft_putnbr_fd.c - -BONUS_SRCS_DIR = ./ - -BONUS_SRCS = \ - ft_lstnew_bonus.c \ - ft_lstadd_front_bonus.c \ - ft_lstsize_bonus.c \ - ft_lstlast_bonus.c \ - ft_lstadd_back_bonus.c \ - ft_lstdelone_bonus.c \ - ft_lstclear_bonus.c \ - ft_lstiter_bonus.c \ - ft_lstmap_bonus.c \ - ft_putchar_bonus.c \ - ft_putstr_bonus.c \ - ft_putendl_bonus.c \ - ft_putnbr_bonus.c \ - ft_strcat_bonus.c \ - ft_strcmp_bonus.c \ - ft_isspace_bonus.c \ - ft_sqrt_bonus.c - -OBJS_DIR = ./ - -#OBJS = $(patsubst ${SRCS_DIR}%.c,${OBJS_DIR}%.o,${SRCS}) - -OBJS = ${SRCS:.c=.o} - -BONUS_OBJS_DIR = ./ - -B_OBJS = ${BONUS_SRCS:.c=.o} - -#B_OBJS = \ - $(patsubst ${SRCS_DIR}bonus/%.c,${OBJS_DIR}bonus/%.o,${BONUS_SRCS}) - -INCS_DIR = ./ - -CC = gcc - + ${SRCS_DIR}ft_memset.c \ + ${SRCS_DIR}ft_bzero.c \ + ${SRCS_DIR}ft_memcpy.c \ + ${SRCS_DIR}ft_memccpy.c \ + ${SRCS_DIR}ft_memmove.c \ + ${SRCS_DIR}ft_memchr.c \ + ${SRCS_DIR}ft_memcmp.c \ + ${SRCS_DIR}ft_strlen.c \ + ${SRCS_DIR}ft_isalpha.c \ + ${SRCS_DIR}ft_isdigit.c \ + ${SRCS_DIR}ft_isalnum.c \ + ${SRCS_DIR}ft_isascii.c \ + ${SRCS_DIR}ft_isprint.c \ + ${SRCS_DIR}ft_tolower.c \ + ${SRCS_DIR}ft_toupper.c \ + ${SRCS_DIR}ft_strchr.c \ + ${SRCS_DIR}ft_strrchr.c \ + ${SRCS_DIR}ft_strncmp.c \ + ${SRCS_DIR}ft_strlcpy.c \ + ${SRCS_DIR}ft_strlcat.c \ + ${SRCS_DIR}ft_strnstr.c \ + ${SRCS_DIR}ft_atoi.c \ + ${SRCS_DIR}ft_calloc.c \ + ${SRCS_DIR}ft_strdup.c \ + \ + ${SRCS_DIR}ft_substr.c \ + ${SRCS_DIR}ft_strjoin.c \ + ${SRCS_DIR}ft_strtrim.c \ + ${SRCS_DIR}ft_split.c \ + ${SRCS_DIR}ft_itoa.c \ + ${SRCS_DIR}ft_strmapi.c \ + ${SRCS_DIR}ft_putchar_fd.c \ + ${SRCS_DIR}ft_putstr_fd.c \ + ${SRCS_DIR}ft_putendl_fd.c \ + ${SRCS_DIR}ft_putnbr_fd.c \ + \ + ${SRCS_DIR}ft_lstnew.c \ + ${SRCS_DIR}ft_lstadd_front.c \ + ${SRCS_DIR}ft_lstsize.c \ + ${SRCS_DIR}ft_lstlast.c \ + ${SRCS_DIR}ft_lstadd_back.c \ + ${SRCS_DIR}ft_lstdelone.c \ + ${SRCS_DIR}ft_lstclear.c \ + ${SRCS_DIR}ft_lstiter.c \ + ${SRCS_DIR}ft_lstmap.c \ + ${SRCS_DIR}ft_putchar.c \ + ${SRCS_DIR}ft_putstr.c \ + ${SRCS_DIR}ft_putendl.c \ + ${SRCS_DIR}ft_putnbr.c \ + ${SRCS_DIR}ft_strnlen.c \ + ${SRCS_DIR}ft_strcat.c \ + ${SRCS_DIR}ft_strcmp.c \ + ${SRCS_DIR}ft_isspace.c \ + ${SRCS_DIR}ft_sqrt.c + +OBJS_DIR = obj/ +OBJS = $(patsubst ${SRCS_DIR}%.c,${OBJS_DIR}%.o,${SRCS}) + +INCS_DIR = inc/ +INCS = libft.h + +CC = clang CFLAGS = -Wall -Wextra -Werror +DEBUG = -g3 +FSANITIZE = -fsanitize=address + +AR = ar rcs NAME = libft.a +MKDIR = mkdir -p RM = rm -rf -AR = ar rcs - -%.o: %.c - ${CC} ${CFLAGS} -I${INCS_DIR} -c $< -o $@ +${OBJS_DIR}%.o: ${SRCS_DIR}%.c ${INCS_DIR}${INCS} + @if [ ! -a ${OBJS_DIR} ]; then \ + ${MKDIR} ${OBJS_DIR}; \ + fi + @${CC} ${CFLAGS} -I${INCS_DIR} -c $< -o $@ + @echo "Compiled $(subst ${OBJS_DIR},,$@)!" $(NAME): ${OBJS} - ${AR} ${NAME} ${OBJS} + @${AR} ${NAME} ${OBJS} + @echo + @echo "libft.a linked!" all: ${NAME} -bonus: all ${B_OBJS} - ${AR} ${NAME} ${B_OBJS} - clean: - ${RM} ${OBJS} ${B_OBJS} + @${RM} ${OBJS} + @echo "Removed obj files!" fclean: clean - ${RM} ${NAME} + @${RM} ${OBJS_DIR} + @${RM} ${NAME} + @echo "Removed everything!" re: fclean all -build: ${OBJS} ${B_OBJS} - ${CC} ${CFLAGS} -g3 -fsanitize=address -I./ -o a.out \ - ${OBJS} ${B_OBJS} main.c - default: all -.PHONY: all clean clean fclean re bonus run +.PHONY: all clean clean fclean re diff --git a/libft/libft.h b/libft/inc/libft.h index 3ce9b07..83a0177 100644 --- a/libft/libft.h +++ b/libft/inc/libft.h @@ -75,8 +75,6 @@ typedef struct s_list struct s_list *next; } t_list; -# define BUFFER_SIZE 30 - t_list *ft_lstnew(void *content); void ft_lstadd_front(t_list **alst, t_list *new); int ft_lstsize(t_list *lst); @@ -95,5 +93,6 @@ char *ft_strcat(char *s1, const char *s2); uint8_t ft_isspace(int c); int ft_strcmp(const char *s1, const char *s2); double ft_sqrt(double x); +size_t ft_strnlen(const char *s, size_t size); # endif diff --git a/libft/main.c b/libft/main.c deleted file mode 100644 index d0cacd5..0000000 --- a/libft/main.c +++ /dev/null @@ -1,122 +0,0 @@ -#include "libft.h" -#include <stdio.h> -#include <stdlib.h> -#include <stddef.h> -#include <string.h> -#include <limits.h> -#include <inttypes.h> - -/* -** static void -** putlst(t_list *lst, t_list *init) -** { -** uint8_t i; -** -** i = 0; -** printf("list:\n"); -** while (lst != NULL) -** { -** printf("lst[%d] (%s)\n", i, (char*)lst->content); -** lst = lst->next; -** i++; -** } -** lst = init; -** } -** -** static void -** delfunc(void *content) -** { -** free(content); -** } -** -** #include <unistd.h> -** int main(void) { -** t_list *lst = NULL; -** t_list *init = NULL; -** -** char *c0; -** char *c1; -** char *c2; -** char *c3; -** char *c4; -** char *c5; -** char *c6; -** char *c7; -** -** c0 = (char *)ft_calloc(6, sizeof(char)); -** c1 = (char *)ft_calloc(6, sizeof(char)); -** c2 = (char *)ft_calloc(6, sizeof(char)); -** c3 = (char *)ft_calloc(6, sizeof(char)); -** c4 = (char *)ft_calloc(6, sizeof(char)); -** c5 = (char *)ft_calloc(6, sizeof(char)); -** c6 = (char *)ft_calloc(6, sizeof(char)); -** c7 = (char *)ft_calloc(6, sizeof(char)); -** if (!c0 || !c1 || !c2 || !c3 || !c4 || !c5 || !c6 || !c7) -** return 1; -** memcpy(c0, "first", 6); -** memcpy(c1, "secon", 6); -** memcpy(c2, "third", 6); -** memcpy(c3, "fooba", 6); -** memcpy(c4, "qweqw", 6); -** memcpy(c5, "AAAAA", 6); -** memcpy(c6, "front", 6); -** memcpy(c7, "_back", 6); -** -** // INIT -** printf("INIT\n"); -** lst = ft_lstnew(c0); -** init = lst; -** lst->next = ft_lstnew(c1); -** lst = lst->next; -** lst->next = ft_lstnew(c2); -** lst = lst->next; -** lst->next = ft_lstnew(c3); -** lst = lst->next; -** lst->next = ft_lstnew(c4); -** lst = lst->next; -** lst->next = ft_lstnew(c5); -** lst = lst->next; -** lst = init; -** putlst(lst, init); -** -*/ /* ADD FRONT */ -/* printf("\n\nft_lstadd_front\n"); -** ft_lstadd_front(&lst, ft_lstnew(c6)); -** putlst(lst, init); -** -*/ /* ADD BACK */ -/* printf("\n\nft_lstadd_back\n"); -** ft_lstadd_back(&lst, ft_lstnew(c7)); -** putlst(lst, init); -** -*/ /* DELONE */ -/* printf("\n\nft_lstdelone\n"); -** ft_lstdelone(lst->next->next, &delfunc); -** putlst(lst, init); -** lst->next->next = ft_lstnew(c3); -** -*/ /* CLEAR */ -/* printf("\n\nft_lstclear\n"); -** ft_lstclear(&lst, &delfunc); -** putlst(lst, init); -** -** char dst[40] = "foo"; -** char src[40] = "foo"; -** size_t len = 4; -** printf("%s\n", ft_strnstr(dst, src, len)); -** return 0; -** } -*/ - -int main(void) { - char dst[40] = "bar"; - char src[40] = "Foobar"; - - char dst2[40] = "bar"; - char src2[40] = "Foobar"; - - size_t len = 8; - printf("FT_RETURN (%s)\n", ft_memmove(dst, src, len)); - printf("C__RETURN (%s)\n", memmove(dst2, src2, len)); - return (0); -} diff --git a/libft/ft_atoi.c b/libft/src/ft_atoi.c index 8903606..8903606 100644 --- a/libft/ft_atoi.c +++ b/libft/src/ft_atoi.c diff --git a/libft/ft_bzero.c b/libft/src/ft_bzero.c index 05ff6b7..05ff6b7 100644 --- a/libft/ft_bzero.c +++ b/libft/src/ft_bzero.c diff --git a/libft/ft_calloc.c b/libft/src/ft_calloc.c index 49383da..49383da 100644 --- a/libft/ft_calloc.c +++ b/libft/src/ft_calloc.c diff --git a/libft/ft_isalnum.c b/libft/src/ft_isalnum.c index e9e1134..e9e1134 100644 --- a/libft/ft_isalnum.c +++ b/libft/src/ft_isalnum.c diff --git a/libft/ft_isalpha.c b/libft/src/ft_isalpha.c index 9e95bd6..9e95bd6 100644 --- a/libft/ft_isalpha.c +++ b/libft/src/ft_isalpha.c diff --git a/libft/ft_isascii.c b/libft/src/ft_isascii.c index 937ead5..937ead5 100644 --- a/libft/ft_isascii.c +++ b/libft/src/ft_isascii.c diff --git a/libft/ft_isdigit.c b/libft/src/ft_isdigit.c index 52ededc..52ededc 100644 --- a/libft/ft_isdigit.c +++ b/libft/src/ft_isdigit.c diff --git a/libft/ft_isprint.c b/libft/src/ft_isprint.c index d82ded0..d82ded0 100644 --- a/libft/ft_isprint.c +++ b/libft/src/ft_isprint.c diff --git a/libft/ft_isspace_bonus.c b/libft/src/ft_isspace.c index c9cf255..c9cf255 100644 --- a/libft/ft_isspace_bonus.c +++ b/libft/src/ft_isspace.c diff --git a/libft/ft_itoa.c b/libft/src/ft_itoa.c index bf3c0c8..bf3c0c8 100644 --- a/libft/ft_itoa.c +++ b/libft/src/ft_itoa.c diff --git a/libft/ft_lstadd_back_bonus.c b/libft/src/ft_lstadd_back.c index 58b3a72..58b3a72 100644 --- a/libft/ft_lstadd_back_bonus.c +++ b/libft/src/ft_lstadd_back.c diff --git a/libft/ft_lstadd_front_bonus.c b/libft/src/ft_lstadd_front.c index c9515ea..c9515ea 100644 --- a/libft/ft_lstadd_front_bonus.c +++ b/libft/src/ft_lstadd_front.c diff --git a/libft/ft_lstclear_bonus.c b/libft/src/ft_lstclear.c index 8d97b9c..8d97b9c 100644 --- a/libft/ft_lstclear_bonus.c +++ b/libft/src/ft_lstclear.c diff --git a/libft/ft_lstdelone_bonus.c b/libft/src/ft_lstdelone.c index 42a1da8..42a1da8 100644 --- a/libft/ft_lstdelone_bonus.c +++ b/libft/src/ft_lstdelone.c diff --git a/libft/ft_lstiter_bonus.c b/libft/src/ft_lstiter.c index 3129ab5..3129ab5 100644 --- a/libft/ft_lstiter_bonus.c +++ b/libft/src/ft_lstiter.c diff --git a/libft/ft_lstlast_bonus.c b/libft/src/ft_lstlast.c index a685322..a685322 100644 --- a/libft/ft_lstlast_bonus.c +++ b/libft/src/ft_lstlast.c diff --git a/libft/ft_lstmap_bonus.c b/libft/src/ft_lstmap.c index 474b1bc..474b1bc 100644 --- a/libft/ft_lstmap_bonus.c +++ b/libft/src/ft_lstmap.c diff --git a/libft/ft_lstnew_bonus.c b/libft/src/ft_lstnew.c index a5e1c0a..a5e1c0a 100644 --- a/libft/ft_lstnew_bonus.c +++ b/libft/src/ft_lstnew.c diff --git a/libft/ft_lstsize_bonus.c b/libft/src/ft_lstsize.c index 1742a5f..1742a5f 100644 --- a/libft/ft_lstsize_bonus.c +++ b/libft/src/ft_lstsize.c diff --git a/libft/ft_memccpy.c b/libft/src/ft_memccpy.c index a029e7d..a029e7d 100644 --- a/libft/ft_memccpy.c +++ b/libft/src/ft_memccpy.c diff --git a/libft/ft_memchr.c b/libft/src/ft_memchr.c index c2578aa..c2578aa 100644 --- a/libft/ft_memchr.c +++ b/libft/src/ft_memchr.c diff --git a/libft/ft_memcmp.c b/libft/src/ft_memcmp.c index 59a99bd..59a99bd 100644 --- a/libft/ft_memcmp.c +++ b/libft/src/ft_memcmp.c diff --git a/libft/ft_memcpy.c b/libft/src/ft_memcpy.c index 548ea95..548ea95 100644 --- a/libft/ft_memcpy.c +++ b/libft/src/ft_memcpy.c diff --git a/libft/ft_memmove.c b/libft/src/ft_memmove.c index 000a2b7..000a2b7 100644 --- a/libft/ft_memmove.c +++ b/libft/src/ft_memmove.c diff --git a/libft/ft_memset.c b/libft/src/ft_memset.c index b94c6fa..b94c6fa 100644 --- a/libft/ft_memset.c +++ b/libft/src/ft_memset.c diff --git a/libft/ft_putchar_bonus.c b/libft/src/ft_putchar.c index b558ead..b558ead 100644 --- a/libft/ft_putchar_bonus.c +++ b/libft/src/ft_putchar.c diff --git a/libft/ft_putchar_fd.c b/libft/src/ft_putchar_fd.c index f57a4f9..f57a4f9 100644 --- a/libft/ft_putchar_fd.c +++ b/libft/src/ft_putchar_fd.c diff --git a/libft/ft_putendl_bonus.c b/libft/src/ft_putendl.c index 26dc80b..26dc80b 100644 --- a/libft/ft_putendl_bonus.c +++ b/libft/src/ft_putendl.c diff --git a/libft/ft_putendl_fd.c b/libft/src/ft_putendl_fd.c index 39fe7c1..39fe7c1 100644 --- a/libft/ft_putendl_fd.c +++ b/libft/src/ft_putendl_fd.c diff --git a/libft/ft_putnbr_bonus.c b/libft/src/ft_putnbr.c index 5220151..5220151 100644 --- a/libft/ft_putnbr_bonus.c +++ b/libft/src/ft_putnbr.c diff --git a/libft/ft_putnbr_fd.c b/libft/src/ft_putnbr_fd.c index b240f43..b240f43 100644 --- a/libft/ft_putnbr_fd.c +++ b/libft/src/ft_putnbr_fd.c diff --git a/libft/ft_putstr_bonus.c b/libft/src/ft_putstr.c index d29a940..d29a940 100644 --- a/libft/ft_putstr_bonus.c +++ b/libft/src/ft_putstr.c diff --git a/libft/ft_putstr_fd.c b/libft/src/ft_putstr_fd.c index b90c078..b90c078 100644 --- a/libft/ft_putstr_fd.c +++ b/libft/src/ft_putstr_fd.c diff --git a/libft/ft_split.c b/libft/src/ft_split.c index 7c706cf..7c706cf 100644 --- a/libft/ft_split.c +++ b/libft/src/ft_split.c diff --git a/libft/ft_sqrt_bonus.c b/libft/src/ft_sqrt.c index 3003e6d..3003e6d 100644 --- a/libft/ft_sqrt_bonus.c +++ b/libft/src/ft_sqrt.c diff --git a/libft/ft_strcat_bonus.c b/libft/src/ft_strcat.c index 59084c2..59084c2 100644 --- a/libft/ft_strcat_bonus.c +++ b/libft/src/ft_strcat.c diff --git a/libft/ft_strchr.c b/libft/src/ft_strchr.c index 86bd41d..86bd41d 100644 --- a/libft/ft_strchr.c +++ b/libft/src/ft_strchr.c diff --git a/libft/ft_strcmp_bonus.c b/libft/src/ft_strcmp.c index 2e9ffe9..2e9ffe9 100644 --- a/libft/ft_strcmp_bonus.c +++ b/libft/src/ft_strcmp.c diff --git a/libft/ft_strdup.c b/libft/src/ft_strdup.c index ce74fb5..ce74fb5 100644 --- a/libft/ft_strdup.c +++ b/libft/src/ft_strdup.c diff --git a/libft/ft_strjoin.c b/libft/src/ft_strjoin.c index f666781..f666781 100644 --- a/libft/ft_strjoin.c +++ b/libft/src/ft_strjoin.c diff --git a/libft/ft_strlcat.c b/libft/src/ft_strlcat.c index 98fa3e8..98fa3e8 100644 --- a/libft/ft_strlcat.c +++ b/libft/src/ft_strlcat.c diff --git a/libft/ft_strlcpy.c b/libft/src/ft_strlcpy.c index bba4263..bba4263 100644 --- a/libft/ft_strlcpy.c +++ b/libft/src/ft_strlcpy.c diff --git a/libft/ft_strlen.c b/libft/src/ft_strlen.c index 68c7614..68c7614 100644 --- a/libft/ft_strlen.c +++ b/libft/src/ft_strlen.c diff --git a/libft/ft_strmapi.c b/libft/src/ft_strmapi.c index 7a38ca9..7a38ca9 100644 --- a/libft/ft_strmapi.c +++ b/libft/src/ft_strmapi.c diff --git a/libft/ft_strncmp.c b/libft/src/ft_strncmp.c index c8a0b87..c8a0b87 100644 --- a/libft/ft_strncmp.c +++ b/libft/src/ft_strncmp.c diff --git a/libft/src/ft_strnlen.c b/libft/src/ft_strnlen.c new file mode 100644 index 0000000..88bd437 --- /dev/null +++ b/libft/src/ft_strnlen.c @@ -0,0 +1,27 @@ +/* ************************************************************************** */ +/* LE - / */ +/* / */ +/* ft_strnlen.c .:: .:/ . .:: */ +/* +:+:+ +: +: +:+:+ */ +/* By: rbousset <marvin@le-101.fr> +:+ +: +: +:+ */ +/* #+# #+ #+ #+# */ +/* Created: 2019/10/30 14:28:01 by rbousset #+# ## ## #+# */ +/* Updated: 2019/10/30 14:28:03 by rbousset ### #+. /#+ ###.fr */ +/* / */ +/* / */ +/* ************************************************************************** */ + +#include <stddef.h> + +size_t + ft_strlen_size(const char *s, size_t size) +{ + const char *ptr = s; + + while (size > 0 && *ptr) + { + size--; + ptr++; + } + return (ptr - s); +} diff --git a/libft/ft_strnstr.c b/libft/src/ft_strnstr.c index 583026e..583026e 100644 --- a/libft/ft_strnstr.c +++ b/libft/src/ft_strnstr.c diff --git a/libft/ft_strrchr.c b/libft/src/ft_strrchr.c index 47ba95b..47ba95b 100644 --- a/libft/ft_strrchr.c +++ b/libft/src/ft_strrchr.c diff --git a/libft/ft_strtrim.c b/libft/src/ft_strtrim.c index c691815..c691815 100644 --- a/libft/ft_strtrim.c +++ b/libft/src/ft_strtrim.c diff --git a/libft/ft_substr.c b/libft/src/ft_substr.c index 87c2568..87c2568 100644 --- a/libft/ft_substr.c +++ b/libft/src/ft_substr.c diff --git a/libft/ft_tolower.c b/libft/src/ft_tolower.c index 48c065e..48c065e 100644 --- a/libft/ft_tolower.c +++ b/libft/src/ft_tolower.c diff --git a/libft/ft_toupper.c b/libft/src/ft_toupper.c index 3346cc3..3346cc3 100644 --- a/libft/ft_toupper.c +++ b/libft/src/ft_toupper.c |