26 lines
381 B
C
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);
|
|
}
|
|
|