]> git.dkaiser.de - 42/minishell.git/commitdiff
added in repl.c tokenizer + visual and free
authorChristopher Uhlig <chuhlig@1-E-11.42heilbronn.de>
Mon, 22 Jul 2024 12:39:25 +0000 (14:39 +0200)
committerChristopher Uhlig <chuhlig@1-E-11.42heilbronn.de>
Mon, 22 Jul 2024 12:39:25 +0000 (14:39 +0200)
src/repl.c

index 85d227fde417a92c53890a499ffe62b0df68f61c..99293e2cc420dd6ff7808873f7b7d6a1fb1f1a91 100644 (file)
@@ -3,18 +3,22 @@
 /*                                                        :::      ::::::::   */
 /*   repl.c                                             :+:      :+:    :+:   */
 /*                                                    +:+ +:+         +:+     */
-/*   By: dkaiser <dkaiser@student.42heilbronn.de    +#+  +:+       +#+        */
+/*   By: chuhlig <chuhlig@student.42.fr>            +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/06/24 16:07:04 by dkaiser           #+#    #+#             */
-/*   Updated: 2024/06/25 15:03:00 by dkaiser          ###   ########.fr       */
+/*   Updated: 2024/07/15 19:53:52 by chuhlig          ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
-#include "minishell.h"
+#include "../include/minishell.h"
+#include "token.h"
 
 void   repl(const char *prompt)
 {
        char    *input;
+       t_token *token_list;
+       t_token *current;
+       t_token *next;
 
        while (1)
        {
@@ -22,6 +26,15 @@ void repl(const char *prompt)
                if (input == NULL)
                        return ;
                add_history(input);
+               token_list = NULL;
+               tokenizer(input, &token_list);
+               current = token_list;
+               while (current != NULL)
+               {
+                       next = current->next;
+                       free_token(current);
+                       current = next;
+               }
                free(input);
        }
 }