33 lines
1.2 KiB
C
33 lines
1.2 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_sstrdup.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2016/12/07 14:25:45 by jhalford #+# #+# */
|
|
/* Updated: 2017/03/21 15:42:19 by jhalford ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "libft.h"
|
|
|
|
char **ft_sstrdup(char **list)
|
|
{
|
|
int i;
|
|
int size;
|
|
char **cpy;
|
|
|
|
i = 0;
|
|
size = 0;
|
|
while (list[size])
|
|
size++;
|
|
cpy = (char **)ft_malloc(sizeof(char *) * (size + 1));
|
|
while (*list)
|
|
{
|
|
cpy[i++] = ft_strdup(*list);
|
|
list++;
|
|
}
|
|
cpy[i] = NULL;
|
|
return (cpy);
|
|
}
|