diff --git a/Makefile b/Makefile index 67aec3e..fee204a 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ # By: tmaze +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2018/04/04 10:51:59 by tmaze #+# #+# # -# Updated: 2018/04/04 17:17:24 by tmaze ### ########.fr # +# Updated: 2018/04/04 18:34:41 by tmaze ### ########.fr # # # #******************************************************************************# @@ -21,6 +21,8 @@ SRCS = \ ft_strdup.c \ ft_strcpy.c \ ft_strncpy.c \ + ft_strcat.c \ + ft_strncat.c \ ft_isalpha.c \ ft_isdigit.c \ ft_isalnum.c \ diff --git a/ft_strcat.c b/ft_strcat.c new file mode 100644 index 0000000..557710c --- /dev/null +++ b/ft_strcat.c @@ -0,0 +1,22 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_strcat.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: tmaze +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2018/04/04 17:56:56 by tmaze #+# #+# */ +/* Updated: 2018/04/04 18:21:46 by tmaze ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +char *ft_strcat(char *restrict dest, const char *src) +{ + int dest_len; + + dest_len = ft_strlen(dest); + ft_strcpy(&dest[dest_len], src); + return (dest); +} diff --git a/ft_strncat.c b/ft_strncat.c new file mode 100644 index 0000000..23de45b --- /dev/null +++ b/ft_strncat.c @@ -0,0 +1,22 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_strncat.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: tmaze +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2018/04/04 18:29:06 by tmaze #+# #+# */ +/* Updated: 2018/04/04 18:34:17 by tmaze ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +char *ft_strncat(char *restrict dest, const char *src, size_t n) +{ + int dest_len; + + dest_len = ft_strlen(dest); + ft_strncpy(&dest[dest_len], src, n); + return (dest); +} diff --git a/libft.h b/libft.h index bfcea1e..e61678c 100644 --- a/libft.h +++ b/libft.h @@ -6,7 +6,7 @@ /* By: tmaze +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2018/04/04 10:40:01 by tmaze #+# #+# */ -/* Updated: 2018/04/04 15:30:00 by tmaze ### ########.fr */ +/* Updated: 2018/04/04 18:08:25 by tmaze ### ########.fr */ /* */ /* ************************************************************************** */ @@ -31,7 +31,7 @@ size_t ft_strlen(const char *s); char *ft_strdup(const char *s); char *ft_strcpy(char *dest, const char *src); char *ft_strncpy(char *dest, const char *src, size_t n); -char *ft_strcat(char *dest, const char *src); +char *ft_strcat(char *restrict dest, const char *src); char *ft_strncat(char *dest, const char *src, size_t n); size_t ft_strlcat(char *dst, const char *src, size_t size); char *ft_strchr(const char *s, int c);