From f6e474d27a1398c6d4f2e88c7f2d3797b85217da Mon Sep 17 00:00:00 2001 From: Christopher Uhlig Date: Wed, 22 Jan 2025 02:40:27 +0100 Subject: kinda fix for pipe error and again.vs for you db just chnage workfolder gn --- src/tokenizer.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'src/tokenizer.c') diff --git a/src/tokenizer.c b/src/tokenizer.c index 26edd2e..451fa50 100644 --- a/src/tokenizer.c +++ b/src/tokenizer.c @@ -6,13 +6,33 @@ /* By: chuhlig +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/06/28 20:55:50 by chuhlig #+# #+# */ -/* Updated: 2025/01/11 15:22:07 by chuhlig ### ########.fr */ +/* Updated: 2025/01/22 00:49:10 by chuhlig ### ########.fr */ /* */ /* ************************************************************************** */ #include "minishell.h" #include "token.h" +t_token *reverse_token_list(t_token *head) +{ + t_token *prev; + t_token *current; + t_token *next; + + prev = NULL; + current = head; + next = NULL; + while (current != NULL) + { + next = current->previous; + current->next = prev; + current->previous = next; + prev = current; + current = next; + } + return (prev); +} + void print_token(t_token *token) { if (DEBUG) @@ -77,11 +97,11 @@ void handle_special_chars(char *s, int *i, int *start, t_token **token_list) *token_list = new_token(PIPE_TOKEN, *token_list, NULL); else if (s[*i] == '\n') *token_list = new_token(NEWLINE_TOKEN, *token_list, NULL); - print_token(*token_list); if (s[*i] == '<' && s[*i + 1] == '<') (*i)++; if (s[*i] == '>' && s[*i + 1] == '>') (*i)++; + print_token(*token_list); *start = *i + 1; } @@ -111,4 +131,5 @@ void tokenizer(char *s, t_token **token_list, char quote_check) pos = i + 1; } } + *token_list = reverse_token_list(*token_list); } -- cgit v1.2.3