Skip to content

Commit

Permalink
add extra functions putstrarray putstrlst
Browse files Browse the repository at this point in the history
  • Loading branch information
anaiel committed Nov 17, 2018
1 parent 501dc4d commit c3ed997
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: anleclab <marvin@42.fr> +#+ +:+ +#+ #
# By: anaiel <anaiel@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2018/11/06 17:19:55 by anleclab #+# #+# #
# Updated: 2018/11/14 17:51:13 by anleclab ### ########.fr #
# Updated: 2018/11/17 12:05:18 by anaiel ### ########.fr #
# #
# **************************************************************************** #

Expand All @@ -22,7 +22,7 @@ SRC = ft_memset.c ft_bzero.c ft_memcpy.c ft_memccpy.c ft_memmove.c ft_memchr.c \
ft_itoa.c ft_putchar.c ft_putstr.c ft_putendl.c ft_putnbr.c \
ft_putchar_fd.c ft_putstr_fd.c ft_putendl_fd.c ft_putnbr_fd.c ft_lstnew.c \
ft_lstdelone.c ft_lstdel.c ft_lstadd.c ft_lstiter.c ft_lstmap.c \
ft_strsplitlst.c
ft_strsplitlst.c ft_putstrarray.c ft_putstrlst.c
OBJ = $(SRC:.c=.o)

.PHONY: all, clean, fclean, re
Expand Down
28 changes: 28 additions & 0 deletions ft_putstrarray.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putstrarray.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: anaiel <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/11/17 10:50:08 by anaiel #+# #+# */
/* Updated: 2018/11/17 11:56:53 by anaiel ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"

void ft_putstrarray(const char **str)
{
int i;

if (str)
{
i = 0;
while (**(str + i))
{
ft_putstr(*(str + i));
i++;
}
}
}
27 changes: 27 additions & 0 deletions ft_putstrlst.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_putstrlst.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: anaiel <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/11/17 11:55:36 by anaiel #+# #+# */
/* Updated: 2018/11/17 12:05:34 by anaiel ### ########.fr */
/* */
/* ************************************************************************** */

#include "libft.h"

void ft_putstrlst(t_list *lst)
{
if (lst)
{
if (!lst->next)
ft_putstr(lst->content);
else
{
ft_putstrlst(lst->next);
ft_putstr(lst->content);
}
}
}
7 changes: 4 additions & 3 deletions libft.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
/* ::: :::::::: */
/* libft.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: anleclab <marvin@42.fr> +#+ +:+ +#+ */
/* By: anaiel <anaiel@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/11/06 17:19:32 by anleclab #+# #+# */
/* Updated: 2018/11/14 17:46:15 by anleclab ### ########.fr */
/* Updated: 2018/11/17 12:05:22 by anaiel ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -59,7 +59,6 @@ char *ft_strsub(char const *s, unsigned int start, size_t len);
char *ft_strjoin(char const *s1, char const *s2);
char *ft_strtrim(char const *s);
char **ft_strsplit(char const *s, char c);
void ft_putstrarray(const char **arr);
int ft_atoi(const char *str);
char *ft_itoa(int n);
void ft_putnbr(int n);
Expand All @@ -83,5 +82,7 @@ void ft_lstadd(t_list **alst, t_list *new);
void ft_lstiter(t_list *lst, void (*f)(t_list *elem));
t_list *ft_lstmap(t_list *lst, t_list *(*f)(t_list *elem));
t_list *ft_strsplitlst(char *s, char c);
void ft_putstrarray(const char **str);
void ft_putstrlst(t_list *lst);

#endif

0 comments on commit c3ed997

Please sign in to comment.