minor fix export

This commit is contained in:
whaffman 2025-03-03 11:49:09 +01:00
parent 19c1059097
commit 8e5deaa6c0
2 changed files with 5 additions and 7 deletions

View File

@ -6,7 +6,7 @@
/* By: whaffman <whaffman@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2025/02/20 11:32:53 by whaffman #+# #+# */
/* Updated: 2025/03/02 22:22:19 by whaffman ######## odam.nl */
/* Updated: 2025/03/03 11:47:34 by whaffman ######## odam.nl */
/* */
/* ************************************************************************** */
@ -19,15 +19,12 @@ int builtin_export(t_minishell *msh, t_command *cmd)
int i;
i = 0;
arr = NULL;
while (cmd->args[++i] != NULL)
{
arr = ft_split_safe(msh, cmd->args[i], '=');
if (arr[1] == NULL)
{
ft_free_arr_safe(msh, arr);
i++;
continue ;
}
env = environment_get(msh, arr[0]);
if (env != NULL)
{
@ -38,5 +35,6 @@ int builtin_export(t_minishell *msh, t_command *cmd)
environment_add(msh, arr[0], arr[1]);
ft_free_arr_safe(msh, arr);
}
ft_free_arr_safe(msh, arr);
return (SUCCESS);
}

View File

@ -6,7 +6,7 @@
/* By: qmennen <qmennen@student.codam.nl> +#+ */
/* +#+ */
/* Created: 2025/02/20 11:32:28 by whaffman #+# #+# */
/* Updated: 2025/02/26 16:06:09 by whaffman ######## odam.nl */
/* Updated: 2025/03/02 22:48:27 by whaffman ######## odam.nl */
/* */
/* ************************************************************************** */
@ -20,6 +20,6 @@ int builtin_pwd(t_minishell *msh, t_command *cmd)
(void)cmd;
cwd = getcwd(NULL, 0);
printf("%s\n", cwd);
free_safe(msh, (void **)&(cwd));
free(cwd);
return (SUCCESS);
}