This commit is contained in:
Etienne Rey-bethbeder 2023-04-05 12:24:20 +02:00
parent d99aa39070
commit f93fed5cdd

View File

@ -6,7 +6,7 @@
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */ /* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/24 10:17:59 by erey-bet #+# #+# */ /* Created: 2023/02/24 10:17:59 by erey-bet #+# #+# */
/* Updated: 2023/04/05 12:21:18 by erey-bet ### ########.fr */ /* Updated: 2023/04/05 12:24:04 by erey-bet ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -14,7 +14,7 @@
static int error(int err, char *reason, char *problem) static int error(int err, char *reason, char *problem)
{ {
ft_putstr_fd("minishell: exit ", 2); ft_putstr_fd("bozoshell: bozo_exit ", 2);
if (problem != NULL) if (problem != NULL)
{ {
ft_putstr_fd(problem, 2); ft_putstr_fd(problem, 2);
@ -28,16 +28,16 @@ int ft_exit(char **args, int err)
{ {
if (args[0] == NULL) if (args[0] == NULL)
{ {
write(1, "exit\n", 6); write(1, "bozo_exit\n", 6);
return (err); return (err);
} }
err = ft_atoi_check(args[0]); err = ft_atoi_check(args[0]);
if (err == 1) if (err == 1)
return (error(err, "exit: numeric argument required", args[0])); return (error(err, "bozo_exit: numeric argument required\n", args[0]));
if (args[1] != NULL) if (args[1] != NULL)
return (error(-1, "exit: too many arguments", NULL)); return (error(-1, "bozo_exit: too many arguments\n", NULL));
if (err > 0) if (err > 0)
return (error(err, "exit: numeric argument required", args[0])); return (error(err, "bozo_exit: numeric argument required\n", args[0]));
write(1, "exit\n", 6); write(1, "exit\n", 6);
return ((ft_atoi(args[0]) % 256 + 256) % 256); return ((ft_atoi(args[0]) % 256 + 256) % 256);
} }