Merge branch 'master' of https://github.com/jzck/libft into HEAD

This commit is contained in:
Jack Halford 2017-09-01 19:29:50 +02:00
commit cc5885aec3
5 changed files with 28 additions and 1 deletions

View file

@ -108,6 +108,7 @@ lst/ft_lst_pop.c\
lst/pop.c\
lst/push.c\
lst/top.c\
lst/ft_lst2str.c\
math/ft_addrcmp.c\
math/ft_ilen.c\
math/ft_ilen_base.c\

0
libft/STDBUG Normal file
View file

View file

@ -89,5 +89,6 @@ void lst_insert_sort(t_list **head,
int (cmp)());
t_list *ft_lst_pop(t_list **lst);
char *ft_lst2str(t_list *list);
#endif

View file

@ -17,7 +17,7 @@
# define STDIN STDIN_FILENO
# define STDOUT STDOUT_FILENO
# define STDERR STDERR_FILENO
# define STDBUG 3
# define STDBUG 9
# define PIPE_READ 0
# define PIPE_WRITE 1

View file

@ -0,0 +1,25 @@
#include "libft.h"
char *ft_lst2str(t_list *list)
{
size_t size;
t_list *tmp;
char *new;
size = 0;
tmp = list;
while (tmp)
{
size += ft_strlen((char *)tmp->content) + 1;
tmp = tmp->next;
}
new = ft_memalloc(size);
while (list)
{
ft_strcat(new, (char *)list->content);
if (list->next)
ft_strcat(new, " ");
list = list->next;
}
return (new);
}