diff --git a/libft/libft.h b/libft/libft.h index 027a2e7..5b9b7bb 100644 --- a/libft/libft.h +++ b/libft/libft.h @@ -6,7 +6,7 @@ /* By: jguelen +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/10/17 16:06:09 by jguelen #+# #+# */ -/* Updated: 2025/01/07 18:10:15 by jguelen ### ########.fr */ +/* Updated: 2025/02/13 15:27:21 by khais ### ########.fr */ /* */ /* ************************************************************************** */ @@ -131,6 +131,7 @@ 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_strcmp(const char *s1, const char *s2); int ft_strncmp(const char *s1, const char *s2, size_t n); void *ft_memchr(const void *s, int c, size_t n); int ft_memcmp(const void *s1, const void *s2, size_t n); diff --git a/libft/libft/Makefile b/libft/libft/Makefile index cf86ed9..5c16a25 100644 --- a/libft/libft/Makefile +++ b/libft/libft/Makefile @@ -8,7 +8,7 @@ SOURCES = ft_atoi.c ft_itoa.c ft_putendl_fd.c ft_strlcat.c ft_substr.c \ ft_bzero.c ft_putnbr_fd.c ft_strlcpy.c ft_tolower.c ft_calloc.c \ ft_memchr.c ft_putstr_fd.c ft_strlen.c ft_toupper.c ft_isalnum.c \ ft_memcmp.c ft_split.c ft_strmapi.c ft_isalpha.c ft_memcpy.c ft_strchr.c \ - ft_strncmp.c ft_isascii.c ft_memmove.c ft_strdup.c ft_strnstr.c \ + ft_strcmp.c ft_strncmp.c ft_isascii.c ft_memmove.c ft_strdup.c ft_strnstr.c \ ft_isdigit.c ft_memset.c ft_striteri.c ft_strrchr.c ft_isprint.c \ ft_putchar_fd.c ft_strjoin.c ft_strtrim.c ft_min_max.c ft_strjoin_sepc.c BONUSSOURCES = ft_lstnew_bonus.c ft_lstadd_back_bonus.c ft_lstsize_bonus.c \ diff --git a/libft/libft/ft_strcmp.c b/libft/libft/ft_strcmp.c new file mode 100644 index 0000000..9ae8328 --- /dev/null +++ b/libft/libft/ft_strcmp.c @@ -0,0 +1,23 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_strcmp.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jguelen +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2024/10/17 12:34:03 by jguelen #+# #+# */ +/* Updated: 2025/02/13 15:27:03 by khais ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include + +int ft_strcmp(const char *s1, const char *s2) +{ + size_t i; + + i = 0; + while (s1[i] && s1[i] == s2[i]) + i++; + return ((unsigned char) s1[i] - (unsigned char) s2[i]); +}