diff options
| author | Dominik Kaiser | 2025-01-14 18:32:42 +0100 |
|---|---|---|
| committer | GitHub | 2025-01-14 18:32:42 +0100 |
| commit | d4f3525a01f2566afed0da9209cb1c64bf188776 (patch) | |
| tree | 14d1f541418576d565f42f0d70faf1369fc17d1b /src/tokenizer.c | |
| parent | 3e692dac63577011bd5862a66767ef412183f26b (diff) | |
| parent | da80405b345b58f9e1bd83039b1df3771b5ca193 (diff) | |
| download | minishell-d4f3525a01f2566afed0da9209cb1c64bf188776.tar.gz minishell-d4f3525a01f2566afed0da9209cb1c64bf188776.zip | |
Merge branch 'miau' into uwu
Diffstat (limited to 'src/tokenizer.c')
| -rw-r--r-- | src/tokenizer.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/tokenizer.c b/src/tokenizer.c index 26edd2e..6d16f1d 100644 --- a/src/tokenizer.c +++ b/src/tokenizer.c @@ -6,13 +6,33 @@ /* By: chuhlig <chuhlig@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/06/28 20:55:50 by chuhlig #+# #+# */ -/* Updated: 2025/01/11 15:22:07 by chuhlig ### ########.fr */ +/* Updated: 2025/01/14 15:58:41 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,7 +97,6 @@ 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] == '>') @@ -111,4 +130,5 @@ void tokenizer(char *s, t_token **token_list, char quote_check) pos = i + 1; } } + *token_list = reverse_token_list(*token_list); } |
