aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Kaiser2025-01-20 19:04:57 +0100
committerGitHub2025-01-20 19:04:57 +0100
commitb73e9e4fda360885035b9b04e9e9aca4724cb285 (patch)
tree4890581e58503e6f17d1044f0ce40630c7707944
parent63a78c5ecea8acf1d8d7096bc693f4b489c3aab4 (diff)
parenta9aba07b52cbf98eb9c52cd8ee0cd5f5021d2931 (diff)
downloadminishell-b73e9e4fda360885035b9b04e9e9aca4724cb285.tar.gz
minishell-b73e9e4fda360885035b9b04e9e9aca4724cb285.zip
Merge branch 'main' into miau
-rw-r--r--include/env.h2
-rw-r--r--include/minishell.h1
-rw-r--r--include/token.h3
-rw-r--r--src/builtins_part_two.c2
-rw-r--r--src/env.c2
-rw-r--r--src/interpreter.c1
-rw-r--r--src/new_token.c29
-rw-r--r--src/tokenizer.c2
8 files changed, 34 insertions, 8 deletions
diff --git a/include/env.h b/include/env.h
index 56b50b5..bfb28c7 100644
--- a/include/env.h
+++ b/include/env.h
@@ -40,4 +40,4 @@ t_env *env_new(char *name);
t_env *check_existing(t_env *env, char *av);
int check_flag(int f);
-#endif \ No newline at end of file
+#endif
diff --git a/include/minishell.h b/include/minishell.h
index 1139dbb..e9810bd 100644
--- a/include/minishell.h
+++ b/include/minishell.h
@@ -37,6 +37,7 @@ t_node *parse_cmd(t_token *tokens, t_env **env);
t_redirection *collect_redirs(t_token **tokens, t_env *env, t_list **cf);
void print_ast(t_node *ast);
+
int eval(t_node *node, t_env **env);
char *get_cmd_path(char *cmd, t_env *env, int *return_code);
int execute_cmd(t_cmd *cmd, t_env **env);
diff --git a/include/token.h b/include/token.h
index 993a408..bb7ea94 100644
--- a/include/token.h
+++ b/include/token.h
@@ -45,8 +45,7 @@ t_token *new_redir_token(int type, t_token *previous,
t_token *next);
void free_token(t_token *token);
-void free_token_and_connect(t_token *token);
-void free_tokens(t_token *tokens);
+
void tokenizer(char *s, t_token **token_list,
char quote_check);
void print_token(t_token *token);
diff --git a/src/builtins_part_two.c b/src/builtins_part_two.c
index 9fabc81..d3c0929 100644
--- a/src/builtins_part_two.c
+++ b/src/builtins_part_two.c
@@ -59,7 +59,7 @@ void update_pwd(t_env **env)
int cd(t_env **env, char **av)
{
t_env *current;
-
+
current = *env;
if (av[1] == NULL)
{
diff --git a/src/env.c b/src/env.c
index cc9cfae..63a0f8a 100644
--- a/src/env.c
+++ b/src/env.c
@@ -78,4 +78,4 @@ void free_env_node(t_env *node)
free(node->name);
free(node->value);
free(node);
-}
+} \ No newline at end of file
diff --git a/src/interpreter.c b/src/interpreter.c
index f31e965..6d71022 100644
--- a/src/interpreter.c
+++ b/src/interpreter.c
@@ -53,3 +53,4 @@ int eval(t_node *node, t_env **env)
{
return (eval_rec(node, env, STDIN_FILENO));
}
+
diff --git a/src/new_token.c b/src/new_token.c
index 92ff421..6431c7d 100644
--- a/src/new_token.c
+++ b/src/new_token.c
@@ -3,10 +3,10 @@
/* ::: :::::::: */
/* new_token.c :+: :+: :+: */
/* +:+ +:+ +:+ */
-/* By: dkaiser <dkaiser@student.42heilbronn.de +#+ +:+ +#+ */
+/* By: chuhlig <chuhlig@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/27 14:29:44 by dkaiser #+# #+# */
-/* Updated: 2024/06/28 14:59:34 by dkaiser ### ########.fr */
+/* Updated: 2024/08/29 15:30:52 by chuhlig ### ########.fr */
/* */
/* ************************************************************************** */
@@ -50,3 +50,28 @@ t_token *new_redir_token(int type, t_token *previous, t_token *next)
token->content.redir_type = type;
return (token);
}
+
+// void ft_append_token(int type, t_token **list)// but we need somewhere token/node head initialize with nul
+// {
+// t_token *node;
+// t_token *last_node;
+
+// if (!list)
+// return ;
+// node = malloc(sizeof(t_token));
+// if (!node)
+// return ;
+// node->next = NULL;
+// node->type = type;
+// if (!*list)
+// {
+// *list = node;
+// node->previous = NULL;
+// }
+// else
+// {
+// last_node = ft_lstlast(*list);
+// last_node->next = node;
+// node->previous = last_node;
+// }
+// } \ No newline at end of file
diff --git a/src/tokenizer.c b/src/tokenizer.c
index eb5d8fe..e202de6 100644
--- a/src/tokenizer.c
+++ b/src/tokenizer.c
@@ -6,7 +6,7 @@
/* By: chuhlig <chuhlig@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/28 20:55:50 by chuhlig #+# #+# */
-/* Updated: 2025/01/16 18:57:38 by dkaiser ### ########.fr */
+/* Updated: 2024/10/17 14:21:26 by chuhlig ### ########.fr */
/* */
/* ************************************************************************** */