23 lines
1 KiB
C
23 lines
1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_strndup.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* 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);
|
|
}
|