From 75304f8962129981b6198facafde8275db30ae66 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Mon, 10 Aug 2020 16:35:39 +0200 Subject: pwd TODO done --- src/b_pwd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/b_pwd.c b/src/b_pwd.c index 2b87091..5e4209e 100644 --- a/src/b_pwd.c +++ b/src/b_pwd.c @@ -13,7 +13,9 @@ #include #include #include +#include +#include "f_fail.h" #include "s_struct.h" #include "u_vars.h" #include "u_vars_next.h" @@ -31,8 +33,8 @@ uint8_t ft_memdel((void*)&cwd); return (0); } - if ((cwd = u_get_var_value("$PWD", msh)) == NULL) - cwd = getcwd(NULL, 0); + if ((cwd = ft_strdup(msh->cwd)) == NULL) + f_fail_alloc_and_destroy(msh); ft_printf("%s\n", cwd); ft_memdel((void*)&cwd); return (0); -- cgit v1.2.3