summaryrefslogtreecommitdiffstats
path: root/src/b_pwd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/b_pwd.c')
-rw-r--r--src/b_pwd.c11
1 files changed, 10 insertions, 1 deletions
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 <libft.h>
#include <stdint.h>
+#include <unistd.h>
#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);
}