summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TODO.org2
-rw-r--r--src/b_pwd.c6
2 files changed, 5 insertions, 3 deletions
diff --git a/TODO.org b/TODO.org
index 41d2f9e..544f7a2 100644
--- a/TODO.org
+++ b/TODO.org
@@ -1,5 +1,5 @@
* Stuff to fix
-** TODO PWD=qwe; pwd <== recheck
+** DONE PWD=qwe; pwd <== recheck
** TODO VISUAL=qweqwe crontab -e <=== deal with it
** DONE cd qweqwe <=== stderr
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 <libft.h>
#include <stdint.h>
#include <unistd.h>
+#include <errno.h>
+#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);