+++ /dev/null
-{
- "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
+++ /dev/null
-{
- "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
+++ /dev/null
-{
- "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
+++ /dev/null
-{
- "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
/* 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 */
/* */
/* ************************************************************************** */
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);
/* 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 */
/* */
/* ************************************************************************** */
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);
/* 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 */
/* */
/* ************************************************************************** */
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;
/* 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 */
/* */
/* ************************************************************************** */
int cd(t_env **env, char **av)
{
t_env *current;
-
+
current = *env;
if (av[1] == NULL)
{
/* 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 */
/* */
/* ************************************************************************** */
free(node->name);
free(node->value);
free(node);
-}
\ No newline at end of file
+}
/* 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 */
/* */
/* ************************************************************************** */
{
return (eval_rec(node, env, STDIN_FILENO));
}
-
/* 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 */
/* */
/* ************************************************************************** */
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
/* 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 */
/* */
/* ************************************************************************** */
/* 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);