diff --git a/builtins/exit.c b/builtins/exit.c index b76585a..8da9b78 100644 --- a/builtins/exit.c +++ b/builtins/exit.c @@ -6,7 +6,7 @@ /* By: erey-bet +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/02/24 10:17:59 by erey-bet #+# #+# */ -/* Updated: 2023/02/28 14:28:18 by erey-bet ### ########.fr */ +/* Updated: 2023/02/28 14:40:05 by erey-bet ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,14 +14,13 @@ static int error(int err, char *reason, char *problem, int fd) { - ft_putstr_fd("minishell: exit ", fd); + ft_putstr_fd("minishell: exit ", 2); if (problem != NULL) { - ft_putstr_fd(problem, fd); + ft_putstr_fd(problem, 2); write(fd, ": ", 2); } - ft_putstr_fd(reason, fd); - write(fd, "\n", 1); + ft_putstr_fd(reason, 2); return (err); } @@ -36,13 +35,13 @@ int ft_exit(char **args, int fd) return (error(err, "numeric argument required", args[0], fd)); if (args[1] != NULL) return (error(-1, "too many arguments", NULL, fd)); - if (error > 0) - error(err, "numeric argument required", args[0], fd); + if (err > 0) + return(error(err, "numeric argument required", args[0], fd)); return (ft_atoi(args[0]) % 256); } -/* int main(int argc, char *argv[]) */ -/* { */ -/* (void)argc; */ -/* return(ft_exit(argv + 1, 1)); */ -/* } */ +int main(int argc, char *argv[]) +{ + (void)argc; + return(ft_exit(argv + 1, 1)); +} diff --git a/builtins/export.c b/builtins/export.c index db729ff..c4d27ee 100644 --- a/builtins/export.c +++ b/builtins/export.c @@ -6,7 +6,7 @@ /* By: cchauvet