core: exit_code work ?
This commit is contained in:
27
utils/ft_change_exit_code.c
Normal file
27
utils/ft_change_exit_code.c
Normal file
@ -0,0 +1,27 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* 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);
|
||||
}
|
Reference in New Issue
Block a user