diff --git a/minishell.c b/minishell.c index a485492..eef1c20 100755 --- a/minishell.c +++ b/minishell.c @@ -6,7 +6,7 @@ /* By: mea +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/05/02 12:14:09 by narnaud #+# #+# */ -/* Updated: 2022/05/17 17:14:47 by narnaud ### ########.fr */ +/* Updated: 2022/05/18 14:57:34 by narnaud@stude ### ########.fr */ /* */ /* ************************************************************************** */ @@ -82,6 +82,8 @@ int main(int argc, char **argv, char **envp) datas.envp = ft_calloc(ENVP_MAX_SIZE, sizeof(char *)); while (*envp) datas.envp[i++] = ft_strdup(*(envp++)); + if (!*get_var_value(&datas, "MINISH", 7)) + datas.envp[i] = ft_strjoin_with("MINISH=", "/minishell", getcwd(NULL, 0)); datas.exit_code = 0; if (datas.silent) { diff --git a/parser.c b/parser.c index e2e9e57..af309df 100755 --- a/parser.c +++ b/parser.c @@ -6,7 +6,7 @@ /* By: mea +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/05/02 16:09:25 by narnaud #+# #+# */ -/* Updated: 2022/05/17 17:14:15 by narnaud ### ########.fr */ +/* Updated: 2022/05/18 14:58:51 by narnaud@stude ### ########.fr */ /* */ /* ************************************************************************** */ @@ -68,7 +68,7 @@ static t_token *parse_cmd(t_datas *datas, t_token *tok, t_command *cmd) if (tok->value[0] == '(') { - cmd->argv[cmd->argc++] = get_var_value(datas, "_", 2); + cmd->argv[cmd->argc++] = get_var_value(datas, "MINISH", 7); cmd->argv[cmd->argc++] = ft_substr(tok->value, 1, ft_strlen(tok->value) - 2); }