From 22f7eda94424071edcfa6bb08eea6795adaf060b Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Tue, 4 Aug 2020 16:24:56 +0200 Subject: Added -P to cwd --- src/b_pwd.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/b_pwd.c b/src/b_pwd.c index 78ef128..ac8d7d0 100644 --- a/src/b_pwd.c +++ b/src/b_pwd.c @@ -12,6 +12,7 @@ #include #include +#include #include "s_struct.h" @@ -19,7 +20,15 @@ uint8_t b_pwd(char *args[], t_msh *msh) { - (void)args; + char *tmp; + + if (args[0] != NULL && ft_strncmp(args[0], "-P", 3) == 0) + { + tmp = getcwd(NULL, 0); + ft_printf("%s\n", tmp); + ft_memdel((void*)&tmp); + return (0); + } ft_printf("%s\n", msh->cwd); return (0); } -- cgit v1.2.3