🏗️」 wip: __to_token nearly done

This commit is contained in:
2024-05-23 20:53:07 +02:00
parent ce0ef1d897
commit 6a8a6382bd
12 changed files with 305 additions and 60 deletions

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/24 11:18:04 by adjoly #+# #+# */
/* Updated: 2024/05/13 17:26:21 by adjoly ### ########.fr */
/* Updated: 2024/05/23 20:06:16 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -19,8 +19,9 @@
#include "libft.h"
#include "minishell.h"
#include "parsing.h"
#include "prompt.h"
void print_cmd(t_cmd cmd)
/*void print_cmd(t_cmd cmd)
{
ft_putendl_fd(cmd.cmd, 1);
while (*(cmd.argv))
@ -28,21 +29,16 @@ void print_cmd(t_cmd cmd)
ft_putendl_fd(*(cmd.argv), 1);
(cmd.argv)++;
}
}
}*/
void print_pipe(t_list *pipe)
{
t_list *tmp;
tmp = pipe;
if (!pipe->next)
while (tmp)
{
print_cmd(*(t_cmd*)tmp->content);
return;
}
while (tmp)
{
print_cmd(*(t_cmd*)tmp->content);
ft_putendl_fd(tmp->content, STDOUT_FILENO);
tmp = tmp->next;
}
}
@ -50,9 +46,10 @@ void print_pipe(t_list *pipe)
int main(int ac, char **av, char **env)
{
char *test;
char **lll;
char *prompt;
t_list *cmd;
char **lll;
t_list *piped;
t_token *token;
(void)ac;
(void)av;
@ -68,10 +65,23 @@ int main(int ac, char **av, char **env)
continue;
if (is_str(test, "exit"))
break;
cmd = split_pipe(test);
print_pipe(cmd);
ft_free("a", &lll);
piped = __split_pipe(test);
token = __to_token(piped->content);
print_token(token);
free(token);
free(test);
ft_lstclear(&piped, &free);
}
ft_free("a", &lll);
return (0);
}
/*int main()
{
char *ll = "asdf\"xf\"asfffd";
t_quote d;
d = is_inquote(ll, 6);
ft_printf("%c\n", *(ll+6));
print_quote_type(d);
}*/