42_minishell/utils/ft_change_exit_code.c
2023-02-24 20:30:01 +01:00

28 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_change_exit_code.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/24 19:04:04 by cchauvet #+# #+# */
/* Updated: 2023/02/24 19:05:57 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include "../minishell.h"
int ft_change_exit_code(t_data *data, int new_value)
{
char *exit_code_str;
data->exit_code = new_value;
exit_code_str = ft_itoa(new_value);
if (exit_code_str == NULL)
{
ft_eprintf("minishell: malloc failed\n");
return (1);
}
return (0);
}