diff --git a/Makefile b/Makefile index cc92334..e40e196 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ # By: adjoly +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2023/11/01 11:03:22 by adjoly #+# #+# # -# Updated: 2023/11/05 10:48:31 by adjoly ### ########.fr # +# Updated: 2023/11/05 14:57:25 by adjoly ### ########.fr # # # # **************************************************************************** # @@ -20,6 +20,7 @@ SRCS = ft_atoi.c \ ft_isalpha.c \ ft_isascii.c \ ft_isdigit.c \ + ft_isprint.c \ ft_putchar_fd.c \ ft_putnbr_fd.c \ ft_putstr_fd.c \ @@ -34,6 +35,7 @@ SRCS = ft_atoi.c \ ft_strlcat.c \ ft_strjoin.c \ ft_strncmp.c \ + ft_strchr.c \ OBJS = $(SRCS:.c=.o) diff --git a/ft_isprint.c b/ft_isprint.c new file mode 100644 index 0000000..e21f334 --- /dev/null +++ b/ft_isprint.c @@ -0,0 +1,18 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_isprint.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: adjoly +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/05 14:47:49 by adjoly #+# #+# */ +/* Updated: 2023/11/05 14:51:51 by adjoly ### ########.fr */ +/* */ +/* ************************************************************************** */ + +int ft_isprint(int c) +{ + if (c >= 32 && c <= 126) + return (1); + return (0); +} diff --git a/ft_memchr.c b/ft_memchr.c new file mode 100644 index 0000000..abccd56 --- /dev/null +++ b/ft_memchr.c @@ -0,0 +1,18 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_memchr.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: adjoly +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/05 14:52:53 by adjoly #+# #+# */ +/* Updated: 2023/11/05 14:54:57 by adjoly ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +void *ft_memchr(const void *s, int c, size_t n) +{ + +} diff --git a/ft_memmove.c b/ft_memmove.c index bc2ebdf..a5dba16 100644 --- a/ft_memmove.c +++ b/ft_memmove.c @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/11/03 15:04:04 by adjoly #+# #+# */ -/* Updated: 2023/11/03 15:57:15 by adjoly ### ########.fr */ +/* Updated: 2023/11/05 14:52:24 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/ft_putstr_fd.c b/ft_putstr_fd.c index 1f63bff..2b23b47 100644 --- a/ft_putstr_fd.c +++ b/ft_putstr_fd.c @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/10/31 11:45:55 by adjoly #+# #+# */ -/* Updated: 2023/11/01 17:14:02 by adjoly ### ########.fr */ +/* Updated: 2023/11/05 15:06:13 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -17,6 +17,8 @@ void ft_putstr_fd(char *s, int fd) int i; i = 0; + if (s == NULL) + return ; while (s[i]) { write(fd, &s[i], 1); diff --git a/ft_strchr.c b/ft_strchr.c index 6cf9679..5af9f0f 100644 --- a/ft_strchr.c +++ b/ft_strchr.c @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/11/01 15:45:18 by adjoly #+# #+# */ -/* Updated: 2023/11/04 15:32:14 by adjoly ### ########.fr */ +/* Updated: 2023/11/05 14:59:50 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -15,9 +15,10 @@ char *ft_strchr(const char *s, int c) int i; int j; char *str_result; -// initialize str_result + i = 0; j = 0; + str_result = 0; while (s[i] != c || s[i]) i++; if (s[i] == c) diff --git a/ft_strncmp.c b/ft_strncmp.c new file mode 100644 index 0000000..656bd37 --- /dev/null +++ b/ft_strncmp.c @@ -0,0 +1,23 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_strncmp.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: adjoly +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2023/11/05 10:40:45 by adjoly #+# #+# */ +/* Updated: 2023/11/05 11:02:33 by adjoly ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +int ft_strncmp(const char *s1, const char *s2, size_t n) +{ + size_t i; + + i = 0; + while (s1[i] && s2[i] && i < n && s1[i] != s2[i]) + i++; + return (s1[i] - s2[i]); +} diff --git a/libft.h b/libft.h index 999a2f9..d345c6d 100644 --- a/libft.h +++ b/libft.h @@ -6,13 +6,14 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/11/01 10:06:03 by adjoly #+# #+# */ -/* Updated: 2023/11/05 10:48:55 by adjoly ### ########.fr */ +/* Updated: 2023/11/05 14:57:55 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef LIBFT_H # define LIBFT_H +#include # include # include # include @@ -40,5 +41,7 @@ int ft_toupper(int c); size_t ft_strlcat(char *dst, const char *src, size_t size); char *ft_strjoin(char const *s1, char const *s2); int ft_strncmp(const char *s1, const char *s2, size_t n); +int ft_isprint(int c); +void *memchr(const void *s, int c, size_t n); #endif \ No newline at end of file diff --git a/libft.so b/libft.so index fad2400..c082c23 100755 Binary files a/libft.so and b/libft.so differ