32 lines
1.1 KiB
C
32 lines
1.1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_sstrdup.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2016/11/03 18:04:13 by jhalford #+# #+# */
|
|
/* Updated: 2016/11/03 18:04:13 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 **)malloc(sizeof(char *) * (size + 1));
|
|
while (*list)
|
|
{
|
|
cpy[i++] = ft_strdup(*list);
|
|
list++;
|
|
}
|
|
return (cpy);
|
|
}
|