/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* pwd.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: erey-bet +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/02/17 16:09:11 by erey-bet #+# #+# */ /* Updated: 2023/03/09 20:00:19 by erey-bet ### ########.fr */ /* */ /* ************************************************************************** */ #include "./builtins_private.h" int pwd(int fd) { char path[PATH_MAX]; if (getcwd(path, sizeof(path)) != NULL) ft_putendl_fd(path, fd); else { ft_putendl_fd("Error getcwd", fd); return (1); } return (0); } char *get_pwd(int fd) { char *str; str = ft_calloc(PATH_MAX, sizeof(char *)); if (getcwd(str, PATH_MAX) != NULL) return (str); else { ft_putendl_fd("Error getcwd", fd); return (NULL); } }