From 224689b62b20c8932650bc0ecc35f7d7928d9989 Mon Sep 17 00:00:00 2001 From: Antoine Riard Date: Sat, 25 Mar 2017 04:13:45 +0100 Subject: [PATCH] create dir in libft --- 42sh/libft/src/sys/create_directory.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/42sh/libft/src/sys/create_directory.c b/42sh/libft/src/sys/create_directory.c index 9df0fcd5..10b4bdbe 100644 --- a/42sh/libft/src/sys/create_directory.c +++ b/42sh/libft/src/sys/create_directory.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/25 03:18:18 by ariard #+# #+# */ -/* Updated: 2017/03/25 04:07:10 by ariard ### ########.fr */ +/* Updated: 2017/03/25 04:13:15 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -16,20 +16,21 @@ char *create_directory(const char *path, const char *old_pathnames) { char *new_pathnames; char *newdir; + char *temp; char *semi; new_pathnames = ft_strdup(old_pathnames); temp = new_pathnames; while (new_pathnames) { - if ((semi = ft_strchr(new_pathnames, ":"))) + if ((semi = ft_strchr(new_pathnames, ':'))) *semi = 0; if (!is_directory(newdir = ft_str3join(new_pathnames, "/", path))) ft_strdel(&newdir); else break; - new_pathnames += new_pathnames + 1; + new_pathnames += ft_strlen(new_pathnames) + 1; } - ft_strdel(temp); + ft_strdel(&temp); return (newdir); }