core: env var replacer

This commit is contained in:
Camille Chauvet
2023-03-22 14:29:32 +01:00
parent a58f9a0c76
commit 0fa822f6db
8 changed files with 138 additions and 1145 deletions

View File

@ -1,18 +1,9 @@
#include "./data_private.h"
#include "data.h"
int ft_gen_exit_code(t_data *data)
t_data *ft_get_data()
{
char *str;
static t_data data;
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);
return (&data);
}

View File

@ -7,9 +7,8 @@ typedef struct s_data
t_list **env;
t_list **cmds;
int exit_code;
char *exit_code_str;
int child_pid;
} t_data;
int ft_gen_exit_code(t_data *data);
t_data *ft_get_data();
#endif