expansions refactoring WIP
This commit is contained in:
@@ -6,41 +6,14 @@
|
||||
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/10/24 10:52:40 by lperrey #+# #+# */
|
||||
/* Updated: 2021/12/10 19:58:17 by lperrey ### ########.fr */
|
||||
/* Updated: 2021/12/12 21:18:52 by lperrey ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "minishell.h"
|
||||
|
||||
void save_redirections_words(t_token *t)
|
||||
{
|
||||
while (t)
|
||||
{
|
||||
if (t->id == '>' || t->id == T_DGREAT
|
||||
|| t->id == '<' || t->id == T_DLESS)
|
||||
{
|
||||
t = t->next;
|
||||
t->id = T_REDIRECTION_WORD;
|
||||
}
|
||||
t = t->next;
|
||||
}
|
||||
}
|
||||
|
||||
void print_pipeline(t_cmd **pipeline)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
while (pipeline[i])
|
||||
{
|
||||
printf("CMD %i, fd_in=%i, fd_out=%i\n", i, pipeline[i]->fd_in, pipeline[i]->fd_out);
|
||||
ft_putstr_fd(" |", 1);
|
||||
print_matrix(pipeline[i]->argv, "|\n |");
|
||||
i++;
|
||||
if (pipeline[i])
|
||||
ft_putstr_fd("----------------\n", 1);
|
||||
}
|
||||
}
|
||||
void save_redirections_words(t_token *t);
|
||||
void print_pipeline(t_cmd **pipeline);
|
||||
|
||||
t_cmd **parsing(t_token *token_list)
|
||||
{
|
||||
@@ -80,6 +53,36 @@ t_cmd **parsing(t_token *token_list)
|
||||
return (pipeline);
|
||||
}
|
||||
|
||||
void save_redirections_words(t_token *t)
|
||||
{
|
||||
while (t)
|
||||
{
|
||||
if (t->id == '>' || t->id == T_DGREAT
|
||||
|| t->id == '<' || t->id == T_DLESS)
|
||||
{
|
||||
t = t->next;
|
||||
t->id = T_REDIRECTION_WORD;
|
||||
}
|
||||
t = t->next;
|
||||
}
|
||||
}
|
||||
|
||||
void print_pipeline(t_cmd **pipeline)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
while (pipeline[i])
|
||||
{
|
||||
printf("CMD %i, fd_in=%i, fd_out=%i\n", i, pipeline[i]->fd_in, pipeline[i]->fd_out);
|
||||
ft_putstr_fd(" |", 1);
|
||||
print_matrix(pipeline[i]->argv, "|\n |");
|
||||
i++;
|
||||
if (pipeline[i])
|
||||
ft_putstr_fd("----------------\n", 1);
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------
|
||||
The grammar symbols
|
||||
------------------------------------------------------- */
|
||||
|
||||
Reference in New Issue
Block a user