/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* b_pwd.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: rbousset +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/14 17:19:27 by rbousset #+# #+# */ /* Updated: 2020/02/14 17:19:29 by rbousset ### ########lyon.fr */ /* */ /* ************************************************************************** */ #include #include #include #include #include "f_fail.h" #include "s_struct.h" #include "u_vars.h" #include "u_vars_next.h" uint8_t b_pwd(char *args[], t_msh *msh) { char *cwd; if (args[0] != NULL && ft_strncmp(args[0], "-P", 3) == 0) { cwd = getcwd(NULL, 0); ft_printf("%s\n", cwd); ft_memdel((void*)&cwd); return (0); } if ((cwd = ft_strdup(msh->cwd)) == NULL) f_alloc_and_destroy_msh(msh); ft_printf("%s\n", cwd); ft_memdel((void*)&cwd); return (0); }