/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* pwd.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: erey-bet +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/02/17 16:09:11 by erey-bet #+# #+# */ /* Updated: 2023/02/21 14:34:50 by erey-bet ### ########.fr */ /* */ /* ************************************************************************** */ #include "../minishell.h" int pwd(int fd) { char path[PATH_MAX]; if (getcwd(path, sizeof(path)) != NULL) ft_putstr_fd(path, fd); else { ft_putstr_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_putstr_fd("Error getcwd", fd); return (NULL); } }