Merge branch 'bonus' of github.com:mdev9/minishell into bonus
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/04/24 10:58:36 by marde-vr #+# #+# */
|
/* Created: 2024/04/24 10:58:36 by marde-vr #+# #+# */
|
||||||
/* Updated: 2024/04/25 13:49:47 by tomoron ### ########.fr */
|
/* Updated: 2024/04/25 18:55:17 by marde-vr ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -75,6 +75,7 @@ void print_env_declare(t_msh *msh, t_env *env_orig)
|
|||||||
}
|
}
|
||||||
env = env->next;
|
env = env->next;
|
||||||
}
|
}
|
||||||
|
free_env_cpy(env);
|
||||||
}
|
}
|
||||||
|
|
||||||
void delete_from_env(t_msh *msh, char *name)
|
void delete_from_env(t_msh *msh, char *name)
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/02/18 18:29:20 by marde-vr #+# #+# */
|
/* Created: 2024/02/18 18:29:20 by marde-vr #+# #+# */
|
||||||
/* Updated: 2024/04/25 18:19:39 by marde-vr ### ########.fr */
|
/* Updated: 2024/04/25 18:59:15 by marde-vr ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -89,10 +89,12 @@ int ft_export(t_msh *msh, t_token *cmd, t_env *env)
|
|||||||
int error;
|
int error;
|
||||||
|
|
||||||
if (cmd && !cmd->next)
|
if (cmd && !cmd->next)
|
||||||
|
{
|
||||||
print_env_declare(msh, env);
|
print_env_declare(msh, env);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
cmd = cmd->next;
|
cmd = cmd->next;
|
||||||
while (cmd->next)
|
while (cmd->next)
|
||||||
//if (cmd && cmd->next && !cmd->next->next)
|
|
||||||
{
|
{
|
||||||
if (export_var(cmd, env))
|
if (export_var(cmd, env))
|
||||||
error = 1;
|
error = 1;
|
||||||
|
21
srcs/free.c
21
srcs/free.c
@ -6,7 +6,7 @@
|
|||||||
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/04/24 10:51:13 by marde-vr #+# #+# */
|
/* Created: 2024/04/24 10:51:13 by marde-vr #+# #+# */
|
||||||
/* Updated: 2024/04/24 21:11:53 by marde-vr ### ########.fr */
|
/* Updated: 2024/04/25 19:01:49 by marde-vr ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -43,3 +43,22 @@ void free_msh(t_msh *msh)
|
|||||||
free(msh);
|
free(msh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void free_env_cpy(t_env *env)
|
||||||
|
{
|
||||||
|
if (env && env->next)
|
||||||
|
free_env_cpy(env->next);
|
||||||
|
free(env);
|
||||||
|
}
|
||||||
|
|
||||||
|
void free_env(t_env *env)
|
||||||
|
{
|
||||||
|
if (env && env->next)
|
||||||
|
free_env(env->next);
|
||||||
|
if (env)
|
||||||
|
{
|
||||||
|
free(env->name);
|
||||||
|
free(env->value);
|
||||||
|
}
|
||||||
|
free(env);
|
||||||
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/02/06 20:46:19 by tomoron #+# #+# */
|
/* Created: 2024/02/06 20:46:19 by tomoron #+# #+# */
|
||||||
/* Updated: 2024/04/18 20:48:55 by marde-vr ### ########.fr */
|
/* Updated: 2024/04/25 18:53:51 by marde-vr ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -31,18 +31,6 @@ t_env *env_add_back(t_env *env, char *name, char *value)
|
|||||||
return (env);
|
return (env);
|
||||||
}
|
}
|
||||||
|
|
||||||
void free_env(t_env *env)
|
|
||||||
{
|
|
||||||
if (env && env->next)
|
|
||||||
free_env(env->next);
|
|
||||||
if (env)
|
|
||||||
{
|
|
||||||
free(env->name);
|
|
||||||
free(env->value);
|
|
||||||
}
|
|
||||||
free(env);
|
|
||||||
}
|
|
||||||
|
|
||||||
int print_env(t_env *env)
|
int print_env(t_env *env)
|
||||||
{
|
{
|
||||||
while (env)
|
while (env)
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/02/04 17:31:38 by tomoron #+# #+# */
|
/* Created: 2024/02/04 17:31:38 by tomoron #+# #+# */
|
||||||
/* Updated: 2024/04/24 21:30:28 by tomoron ### ########.fr */
|
/* Updated: 2024/04/25 18:54:09 by marde-vr ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -107,6 +107,7 @@ void print_syntax_error_bonus(t_cmd *cmd);
|
|||||||
void signal_handler_here_doc(int signum);
|
void signal_handler_here_doc(int signum);
|
||||||
t_token *parsing_syntax_error(t_token *res);
|
t_token *parsing_syntax_error(t_token *res);
|
||||||
int file_access(t_msh *msh, int *found);
|
int file_access(t_msh *msh, int *found);
|
||||||
|
void free_env_cpy(t_env *env);
|
||||||
void remove_command_from_msh(t_msh *msh);
|
void remove_command_from_msh(t_msh *msh);
|
||||||
void get_redirections(t_msh *msh, t_cmd *cmds);
|
void get_redirections(t_msh *msh, t_cmd *cmds);
|
||||||
t_cmd *get_next_command(t_cmd *cmd);
|
t_cmd *get_next_command(t_cmd *cmd);
|
||||||
|
Reference in New Issue
Block a user