42_minishell/utils/ft_change_exit_code.c

28 lines
1.1 KiB
C
Raw Permalink Normal View History

2023-02-24 14:30:01 -05:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* 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)
{
2023-04-14 10:17:35 -04:00
ft_eprintf("bozoshell: malloc failed\n");
2023-02-24 14:30:01 -05:00
return (1);
}
return (0);
}