42_minishell/data/data.c
2023-03-10 12:32:39 +01:00

26 lines
381 B
C

#include "./data_private.h"
int *ft_get_exit_code(void)
{
static int exit_code = 0;
return (&exit_code);
}
int ft_gen_exit_code(t_data *data)
{
char *str;
if (data->exit_code_str != NULL)
free(data->exit_code_str);
str = ft_itoa(data->exit_code);
if (str == NULL)
{
ft_printf("minishell: malloc failed");
return (1);
}
data->exit_code_str = str;
return (0);
}