norm: splitted functions in main into appropriate file
Moved lstdelenvelem & env2lst to ms_env.c Normed out files
This commit is contained in:
29
libft/srcs/ft_lstaddend.c
Normal file
29
libft/srcs/ft_lstaddend.c
Normal file
@@ -0,0 +1,29 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_lstaddend.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2018/04/17 20:55:26 by tmaze #+# #+# */
|
||||
/* Updated: 2018/11/26 12:30:30 by tmaze ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
t_list *ft_lstaddend(t_list **alst, t_list *new)
|
||||
{
|
||||
t_list *tmp;
|
||||
|
||||
if (new == NULL)
|
||||
return (NULL);
|
||||
if (ft_lstsize(*alst) == 0)
|
||||
ft_lstadd(alst, new);
|
||||
else if (ft_lstsize(*alst) > 0)
|
||||
{
|
||||
tmp = ft_lstgetlast(*alst);
|
||||
ft_lstadd(&(tmp->next), new);
|
||||
}
|
||||
return (*alst);
|
||||
}
|
Reference in New Issue
Block a user