diff --git a/Makefile b/Makefile index 97a46ba..c98e858 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ # By: adjoly +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2023/11/01 11:03:22 by adjoly #+# #+# # -# Updated: 2023/11/08 12:14:33 by adjoly ### ########.fr # +# Updated: 2023/11/08 17:07:14 by adjoly ### ########.fr # # # # **************************************************************************** # @@ -36,11 +36,13 @@ SRCS = ft_atoi.c \ ft_strlcat.c \ ft_strjoin.c \ ft_strncmp.c \ - ft_strchr.c \ ft_itoa.c \ ft_calloc.c \ ft_memchr.c \ ft_memcmp.c \ + ft_strchr.c \ + ft_strrchr.c \ + ft_strnstr.c \ OBJS = $(SRCS:.c=.o) @@ -51,9 +53,9 @@ HEADER = libft.h $(NAME): $(OBJS) ar -rcs $(NAME) $(OBJS) -so: - $(CC) -nostartfiles -fPIC $(CFLAGS) $(SRCS) - gcc -nostartfiles -shared -o libft.so $(OBJS) +# so: + # $(CC) -nostartfiles -fPIC $(CFLAGS) $(SRCS) + # gcc -nostartfiles -shared -o libft.so $(OBJS) %.o: %.c $(CC) $(FLAGS) -I $(HEADER) $< -c -o $@ diff --git a/ft_memchr.c b/ft_memchr.c index 3483542..c6c91ff 100644 --- a/ft_memchr.c +++ b/ft_memchr.c @@ -6,12 +6,14 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/11/05 14:52:53 by adjoly #+# #+# */ -/* Updated: 2023/11/08 11:59:58 by adjoly ### ########.fr */ +/* Updated: 2023/11/08 14:52:06 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" +#define BUFFER_SIZE 10 + void *ft_memchr(const void *s, int c, size_t n) { size_t i; diff --git a/ft_strchr.c b/ft_strchr.c index 4d96690..2a967e2 100644 --- a/ft_strchr.c +++ b/ft_strchr.c @@ -6,17 +6,18 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/11/01 15:45:18 by adjoly #+# #+# */ -/* Updated: 2023/11/08 12:17:21 by adjoly ### ########.fr */ +/* Updated: 2023/11/08 14:31:21 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ +#include "libft.h" + char *ft_strchr(const char *s, int c) { - int i; + size_t len_s; + char *result; - i = 0; - while (s[i]) - { - - } + len_s = ft_strlen(s); + result = ft_memchr(s, c, len_s); + return (result); } diff --git a/libft.h b/libft.h index ad81796..1ccdd3a 100644 --- a/libft.h +++ b/libft.h @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/11/01 10:06:03 by adjoly #+# #+# */ -/* Updated: 2023/11/08 12:14:58 by adjoly ### ########.fr */ +/* Updated: 2023/11/08 17:08:26 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -46,5 +46,7 @@ char *ft_itoa(int n); void *ft_memmove(void *dest, const void *src, 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); +char *ft_strrchr(const char *s, int c); +char *ft_strnstr(const char *big, const char *little, size_t len); #endif \ No newline at end of file diff --git a/libft.so b/libft.so deleted file mode 100755 index c4036e6..0000000 Binary files a/libft.so and /dev/null differ