」 feat: $ expand working

This commit is contained in:
2024-07-06 18:08:04 +02:00
parent 6ca36c8854
commit 249b6a6920
4 changed files with 11 additions and 11 deletions

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */ /* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/25 12:20:26 by adjoly #+# #+# */ /* Created: 2024/04/25 12:20:26 by adjoly #+# #+# */
/* Updated: 2024/07/03 19:03:35 by adjoly ### ########.fr */ /* Updated: 2024/07/06 18:06:23 by adjoly ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -37,8 +37,8 @@ bool check_syntax(char *readline);
void send_error(char *msg, char **argv); void send_error(char *msg, char **argv);
bool check_redir(t_list *redir); bool check_redir(t_list *redir);
bool check_argv(t_list *token); bool check_argv(t_list *token);
t_cmd *get_redir_fd(void *content); t_cmd *get_redir_fd(void *content, t_env *env);
t_list *get_cmd_list(t_list *list); t_list *get_cmd_list(t_list *list, t_env *env);
void open_redir(t_redirection *redir, t_cmd *cmd, t_redir_sign sign[2]); void open_redir(t_redirection *redir, t_cmd *cmd, t_redir_sign sign[2]);
char **split_argv(char *readline); char **split_argv(char *readline);
char *env_var_replace(char *readline, t_env *env); char *env_var_replace(char *readline, t_env *env);

View File

@ -6,7 +6,7 @@
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */ /* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/24 11:18:04 by adjoly #+# #+# */ /* Created: 2024/04/24 11:18:04 by adjoly #+# #+# */
/* Updated: 2024/07/04 20:17:22 by adjoly ### ########.fr */ /* Updated: 2024/07/06 18:07:24 by adjoly ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -65,7 +65,7 @@ int main(int ac, char **av, char **env)
if (check_argv(piped)) if (check_argv(piped))
continue ; continue ;
add_history(rl); add_history(rl);
cmd_list = get_cmd_list(piped); cmd_list = get_cmd_list(piped, &env_l);
ft_lstclear(&piped, &free_token); ft_lstclear(&piped, &free_token);
format_quotes(cmd_list); format_quotes(cmd_list);
exec_split_cmd(cmd_list, &env_l); exec_split_cmd(cmd_list, &env_l);

View File

@ -6,14 +6,14 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */ /* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/31 12:47:13 by adjoly #+# #+# */ /* Created: 2024/05/31 12:47:13 by adjoly #+# #+# */
/* Updated: 2024/06/30 17:28:40 by adjoly ### ########.fr */ /* Updated: 2024/07/06 18:05:27 by adjoly ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "libft.h" #include "libft.h"
#include "parsing.h" #include "parsing.h"
t_list *get_cmd_list(t_list *list) t_list *get_cmd_list(t_list *list, t_env *env)
{ {
t_list *tmp; t_list *tmp;
t_list *cmd_list; t_list *cmd_list;
@ -22,7 +22,7 @@ t_list *get_cmd_list(t_list *list)
cmd_list = NULL; cmd_list = NULL;
while (tmp) while (tmp)
{ {
ft_lstadd_back(&cmd_list, ft_lstnew(get_redir_fd(tmp->content))); ft_lstadd_back(&cmd_list, ft_lstnew(get_redir_fd(tmp->content, env)));
tmp = tmp->next; tmp = tmp->next;
} }
return (cmd_list); return (cmd_list);

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */ /* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/30 10:48:41 by adjoly #+# #+# */ /* Created: 2024/05/30 10:48:41 by adjoly #+# #+# */
/* Updated: 2024/06/30 17:34:47 by adjoly ### ########.fr */ /* Updated: 2024/07/06 18:06:14 by adjoly ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -18,7 +18,7 @@
#include <stdio.h> #include <stdio.h>
#include "libft.h" #include "libft.h"
t_cmd *get_redir_fd(void *content) t_cmd *get_redir_fd(void *content, t_env *env)
{ {
t_list *tmp; t_list *tmp;
t_redir_sign sign[2]; t_redir_sign sign[2];
@ -38,6 +38,6 @@ t_cmd *get_redir_fd(void *content)
cmd->outfile = STDOUT_FILENO; cmd->outfile = STDOUT_FILENO;
if (sign[1] == OUTFILE) if (sign[1] == OUTFILE)
cmd->infile = STDIN_FILENO; cmd->infile = STDIN_FILENO;
cmd = split_cmd(((t_token *)content)->argv, cmd); cmd = split_cmd(env_var_replace(((t_token *)content)->argv, env), cmd);
return (cmd); return (cmd);
} }