cub3d/libft/src/ft_malstrs.c

32 lines
1.1 KiB
C
Raw Normal View History

2023-10-25 13:56:45 +02:00
/* ************************************************************************** */
/* */
/* :::::::: */
2023-10-26 19:11:30 +02:00
/* ft_malstrs.c :+: :+: */
2023-10-25 13:56:45 +02:00
/* +:+ */
/* By: djonker <marvin@codam.nl> +#+ */
/* +#+ */
/* Created: 2020/11/29 15:21:11 by djonker #+# #+# */
2023-10-26 19:11:30 +02:00
/* Updated: 2023/10/18 16:59:57 by houtworm ######## odam.nl */
2023-10-25 13:56:45 +02:00
/* */
/* ************************************************************************** */
#include "../libft.h"
char *ft_malstrs(char *s, char *c)
{
char *r;
int l;
r = ft_calloc(ft_wrdlens((char *)s, c, 0) + 1, 1);
if (!r)
return (NULL);
l = 0;
while (*s != '\0' && !(ft_chrstr(*s, c)))
{
r[l] = *s;
l++;
s++;
}
return (r);
}