aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Uhlig2025-01-20 19:32:10 +0100
committerChristopher Uhlig2025-01-20 19:32:10 +0100
commit852e00cb465b05f13aa6298ce71a1067c0846556 (patch)
tree23407cd33e3dc255a9a4a6acb9d67a051ba80f65
parentb73e9e4fda360885035b9b04e9e9aca4724cb285 (diff)
downloadminishell-852e00cb465b05f13aa6298ce71a1067c0846556.tar.gz
minishell-852e00cb465b05f13aa6298ce71a1067c0846556.zip
fixed norm tester 133 remove .vs
-rw-r--r--.vscode/c_cpp_properties.json18
-rw-r--r--.vscode/launch.json13
-rw-r--r--.vscode/settings.json64
-rw-r--r--.vscode/tasks.json29
-rw-r--r--include/minishell.h4
-rw-r--r--include/token.h6
-rw-r--r--src/builtins_part_one.c12
-rw-r--r--src/builtins_part_two.c4
-rw-r--r--src/env.c4
-rw-r--r--src/interpreter.c3
-rw-r--r--src/new_token.c27
-rw-r--r--src/parse_cmd.c2
-rw-r--r--src/parser.c4
13 files changed, 16 insertions, 174 deletions
diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json
deleted file mode 100644
index 94b2ae4..0000000
--- a/.vscode/c_cpp_properties.json
+++ /dev/null
@@ -1,18 +0,0 @@
-{
- "configurations": [
- {
- "name": "macos-clang-x64",
- "includePath": [
- "${workspaceFolder}/**"
- ],
- "compilerPath": "/usr/bin/clang",
- "cStandard": "${default}",
- "cppStandard": "${default}",
- "intelliSenseMode": "macos-clang-x64",
- "compilerArgs": [
- ""
- ]
- }
- ],
- "version": 4
- } \ No newline at end of file
diff --git a/.vscode/launch.json b/.vscode/launch.json
deleted file mode 100644
index 86fa44a..0000000
--- a/.vscode/launch.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "version": "0.2.0",
- "configurations": [
- {
- "name": "C/C++ Runner: Debug Session",
- "type": "lldb",
- "request": "launch",
- "args": [],
- "cwd": "/Users/chuhlig/Desktop/merged_minishell/",
- "program": "/Users/chuhlig/Desktop/merged_minishell/minishell"
- }
- ]
- } \ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
deleted file mode 100644
index e43ecab..0000000
--- a/.vscode/settings.json
+++ /dev/null
@@ -1,64 +0,0 @@
-{
- "C_Cpp_Runner.cCompilerPath": "clang",
- "C_Cpp_Runner.cppCompilerPath": "clang++",
- "C_Cpp_Runner.debuggerPath": "lldb",
- "C_Cpp_Runner.cStandard": "",
- "C_Cpp_Runner.cppStandard": "",
- "C_Cpp_Runner.msvcBatchPath": "",
- "C_Cpp_Runner.useMsvc": false,
- "C_Cpp_Runner.warnings": [
- "-Wall",
- "-Wextra",
- "-Wpedantic",
- "-Wshadow",
- "-Wformat=2",
- "-Wcast-align",
- "-Wconversion",
- "-Wsign-conversion",
- "-Wnull-dereference"
- ],
- "C_Cpp_Runner.msvcWarnings": [
- "/W4",
- "/permissive-",
- "/w14242",
- "/w14287",
- "/w14296",
- "/w14311",
- "/w14826",
- "/w44062",
- "/w44242",
- "/w14905",
- "/w14906",
- "/w14263",
- "/w44265",
- "/w14928"
- ],
- "C_Cpp_Runner.enableWarnings": true,
- "C_Cpp_Runner.warningsAsError": false,
- "C_Cpp_Runner.compilerArgs": [],
- "C_Cpp_Runner.linkerArgs": [],
- "C_Cpp_Runner.includePaths": [],
- "C_Cpp_Runner.includeSearch": [
- "*",
- "**/*"
- ],
- "C_Cpp_Runner.excludeSearch": [
- "**/build",
- "**/build/**",
- "**/.*",
- "**/.*/**",
- "**/.vscode",
- "**/.vscode/**"
- ],
- "C_Cpp_Runner.useAddressSanitizer": false,
- "C_Cpp_Runner.useUndefinedSanitizer": false,
- "C_Cpp_Runner.useLeakSanitizer": false,
- "C_Cpp_Runner.showCompilationTime": false,
- "C_Cpp_Runner.useLinkTimeOptimization": false,
- "C_Cpp_Runner.msvcSecureNoWarnings": false,
- "files.associations": {
- "minishell.h": "c",
- "debug_tools.h": "c",
- "token.h": "c"
- }
- } \ No newline at end of file
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
deleted file mode 100644
index 4ede37a..0000000
--- a/.vscode/tasks.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "tasks": [
- {
- "type": "cppbuild",
- "label": "C/C++: clang build active file",
- "command": "/usr/bin/clang",
- "args": [
- "-fcolor-diagnostics",
- "-fansi-escape-codes",
- "-g",
- "${file}",
- "-o",
- "${fileDirname}/${fileBasenameNoExtension}"
- ],
- "options": {
- "cwd": "${fileDirname}"
- },
- "problemMatcher": [
- "$gcc"
- ],
- "group": {
- "kind": "build",
- "isDefault": true
- },
- "detail": "Task generated by Debugger."
- }
- ],
- "version": "2.0.0"
-} \ No newline at end of file
diff --git a/include/minishell.h b/include/minishell.h
index e9810bd..356df7a 100644
--- a/include/minishell.h
+++ b/include/minishell.h
@@ -6,7 +6,7 @@
/* By: chuhlig <chuhlig@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/22 17:14:49 by dkaiser #+# #+# */
-/* Updated: 2025/01/20 18:41:11 by dkaiser ### ########.fr */
+/* Updated: 2025/01/20 19:12:03 by chuhlig ### ########.fr */
/* */
/* ************************************************************************** */
@@ -42,7 +42,7 @@ 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);
char *format_string(char *str, t_env *env, int is_literal);
-void set_return_code(int return_code, t_env **env);
+void set_return_code(int return_code, t_env **env);
int handle_redirections(t_redirection *redirs);
void *error(int err_code, char *err_text, int exit_code,
int *ret_code);
diff --git a/include/token.h b/include/token.h
index bb7ea94..2e8da35 100644
--- a/include/token.h
+++ b/include/token.h
@@ -6,7 +6,7 @@
/* By: chuhlig <chuhlig@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/27 13:27:18 by dkaiser #+# #+# */
-/* Updated: 2025/01/20 12:37:59 by chuhlig ### ########.fr */
+/* Updated: 2025/01/20 19:10:30 by chuhlig ### ########.fr */
/* */
/* ************************************************************************** */
@@ -43,9 +43,9 @@ t_token *new_str_token(char *str, t_token *previous,
t_token *next);
t_token *new_redir_token(int type, t_token *previous,
t_token *next);
-
+void free_tokens(t_token *tokens);
void free_token(t_token *token);
-
+void free_token_and_connect(t_token *token);
void tokenizer(char *s, t_token **token_list,
char quote_check);
void print_token(t_token *token);
diff --git a/src/builtins_part_one.c b/src/builtins_part_one.c
index 629cc87..11989cc 100644
--- a/src/builtins_part_one.c
+++ b/src/builtins_part_one.c
@@ -6,7 +6,7 @@
/* By: chuhlig <chuhlig@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/09 17:01:16 by chuhlig #+# #+# */
-/* Updated: 2025/01/20 17:05:19 by chuhlig ### ########.fr */
+/* Updated: 2025/01/20 19:07:18 by chuhlig ### ########.fr */
/* */
/* ************************************************************************** */
@@ -26,15 +26,7 @@ int unset(char **av, t_env **env)
prev = NULL;
while (current)
{
- if ((!ft_strcmp(current->name, av[i])) && (!ft_strcmp("?", av[1])))
- {
- if (prev)
- prev->next = current->next;
- else
- *env = current->next;
- free_env_node(current);
- break ;
- }
+ if (ft_strcmp(current->name, av[i]) == 0)
{
if (prev)
prev->next = current->next;
diff --git a/src/builtins_part_two.c b/src/builtins_part_two.c
index d3c0929..e461861 100644
--- a/src/builtins_part_two.c
+++ b/src/builtins_part_two.c
@@ -6,7 +6,7 @@
/* By: chuhlig <chuhlig@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/25 20:52:16 by chuhlig #+# #+# */
-/* Updated: 2025/01/18 18:57:12 by chuhlig ### ########.fr */
+/* Updated: 2025/01/20 19:12:33 by chuhlig ### ########.fr */
/* */
/* ************************************************************************** */
@@ -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 63a0f8a..572040c 100644
--- a/src/env.c
+++ b/src/env.c
@@ -6,7 +6,7 @@
/* By: chuhlig <chuhlig@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/17 14:31:07 by chuhlig #+# #+# */
-/* Updated: 2025/01/20 15:05:49 by chuhlig ### ########.fr */
+/* Updated: 2025/01/20 19:12:43 by chuhlig ### ########.fr */
/* */
/* ************************************************************************** */
@@ -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 6d71022..44f4b95 100644
--- a/src/interpreter.c
+++ b/src/interpreter.c
@@ -6,7 +6,7 @@
/* By: chuhlig <chuhlig@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/12/17 19:15:49 by chuhlig #+# #+# */
-/* Updated: 2025/01/20 12:48:49 by chuhlig ### ########.fr */
+/* Updated: 2025/01/20 19:12:49 by chuhlig ### ########.fr */
/* */
/* ************************************************************************** */
@@ -53,4 +53,3 @@ 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 6431c7d..bd65b9d 100644
--- a/src/new_token.c
+++ b/src/new_token.c
@@ -6,7 +6,7 @@
/* By: chuhlig <chuhlig@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/27 14:29:44 by dkaiser #+# #+# */
-/* Updated: 2024/08/29 15:30:52 by chuhlig ### ########.fr */
+/* Updated: 2025/01/20 19:12:57 by chuhlig ### ########.fr */
/* */
/* ************************************************************************** */
@@ -50,28 +50,3 @@ 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/parse_cmd.c b/src/parse_cmd.c
index b30d126..6505384 100644
--- a/src/parse_cmd.c
+++ b/src/parse_cmd.c
@@ -6,7 +6,7 @@
/* By: chuhlig <chuhlig@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/08 15:06:25 by dkaiser #+# #+# */
-/* Updated: 2025/01/20 17:57:50 by dkaiser ### ########.fr */
+/* Updated: 2025/01/20 19:09:21 by chuhlig ### ########.fr */
/* */
/* ************************************************************************** */
diff --git a/src/parser.c b/src/parser.c
index 75f1c64..13ab10d 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -6,14 +6,14 @@
/* By: chuhlig <chuhlig@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/29 15:53:29 by dkaiser #+# #+# */
-/* Updated: 2025/01/20 17:57:20 by dkaiser ### ########.fr */
+/* Updated: 2025/01/20 19:13:31 by chuhlig ### ########.fr */
/* */
/* ************************************************************************** */
-#include "env.h"
#include "libft.h"
#include "minishell.h"
#include "token.h"
+#include "env.h"
static t_token *find_token_by_type(t_token *tokens, int type);
t_token *split_at_first(t_token **tokens, int type);