/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strndup.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/10/07 17:53:55 by jhalford #+# #+# */ /* Updated: 2017/10/07 17:54:30 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" char *ft_strndup(const char *s1, size_t n) { char *dup; if (!(dup = ft_memalloc(n))) return (NULL); ft_strncpy(dup, s1, n); return (dup); }