From d4baa4b44034e686426d49838189c04cf1d54eb5 Mon Sep 17 00:00:00 2001 From: whaffman Date: Fri, 7 Mar 2025 16:37:41 +0100 Subject: [PATCH] norm --- inc/parser.h | 5 +++-- src/builtin/builtin_clear.c | 6 +++--- src/builtin/builtin_export.c | 8 ++++---- src/debug/print_commands.c | 9 +++++---- src/executor/executor_child.c | 16 ++++++++-------- src/executor/executor_execute_pipeline.c | 16 ++++++++-------- src/lexer/lexer_read_word.c | 18 +++++++++--------- 7 files changed, 40 insertions(+), 38 deletions(-) diff --git a/inc/parser.h b/inc/parser.h index 7a67d31..2af5e5a 100644 --- a/inc/parser.h +++ b/inc/parser.h @@ -6,7 +6,7 @@ /* By: qmennen +#+ */ /* +#+ */ /* Created: 2025/02/11 14:03:03 by qmennen #+# #+# */ -/* Updated: 2025/03/05 12:50:03 by whaffman ######## odam.nl */ +/* Updated: 2025/03/07 16:14:15 by whaffman ######## odam.nl */ /* */ /* ************************************************************************** */ @@ -25,6 +25,7 @@ char **parser_get_arguments(t_list *list, t_minishell *msh); int parser_validate_command(t_command *command); int parser_count_arguments(t_list *list); char *parser_concatenate(t_minishell *msh, char *str1, char *str2); -char *parser_process_token(t_minishell *msh, t_list *prev, t_list *t_head); +char *parser_process_token(t_minishell *msh, + t_list *prev, t_list *t_head); #endif diff --git a/src/builtin/builtin_clear.c b/src/builtin/builtin_clear.c index 67565f7..8ae69a9 100644 --- a/src/builtin/builtin_clear.c +++ b/src/builtin/builtin_clear.c @@ -6,16 +6,16 @@ /* By: whaffman +#+ */ /* +#+ */ /* Created: 2025/03/05 13:30:18 by whaffman #+# #+# */ -/* Updated: 2025/03/05 13:34:28 by whaffman ######## odam.nl */ +/* Updated: 2025/03/07 16:14:33 by whaffman ######## odam.nl */ /* */ /* ************************************************************************** */ #include "minishell.h" -int builtin_clear(t_minishell *msh, t_command *cmd) +int builtin_clear(t_minishell *msh, t_command *cmd) { (void)msh; (void)cmd; ft_putstr_fd("\033[2J\033[H", STDOUT_FILENO); return (0); -} \ No newline at end of file +} diff --git a/src/builtin/builtin_export.c b/src/builtin/builtin_export.c index 0e217e1..a631c56 100644 --- a/src/builtin/builtin_export.c +++ b/src/builtin/builtin_export.c @@ -6,7 +6,7 @@ /* By: whaffman +#+ */ /* +#+ */ /* Created: 2025/02/20 11:32:53 by whaffman #+# #+# */ -/* Updated: 2025/03/06 17:52:48 by whaffman ######## odam.nl */ +/* Updated: 2025/03/07 16:15:30 by whaffman ######## odam.nl */ /* */ /* ************************************************************************** */ @@ -26,8 +26,9 @@ static int ft_isvalid_identifier(char *str) } return (TRUE); } + static int actually_append(t_minishell *msh, char *arg, - char *name, char *value) + char *name, char *value) { char *value_old; char *err; @@ -54,7 +55,7 @@ static int handle_append(t_minishell *msh, char *arg) char *name; char *name_end; char *value; - int ret; + int ret; ret = FAILURE; name_end = ft_strnstr(arg, "+=", ft_strlen(arg)); @@ -96,7 +97,6 @@ int builtin_export(t_minishell *msh, t_command *cmd) int i; i = 0; - if (cmd->args[1] == NULL) environment_print(msh, TRUE); while (cmd->args[++i] != NULL) diff --git a/src/debug/print_commands.c b/src/debug/print_commands.c index 84a18ec..d5a490b 100644 --- a/src/debug/print_commands.c +++ b/src/debug/print_commands.c @@ -6,7 +6,7 @@ /* By: marvin +#+ */ /* +#+ */ /* Created: 2025/02/18 20:06:37 by qmennen #+# #+# */ -/* Updated: 2025/03/05 13:03:54 by whaffman ######## odam.nl */ +/* Updated: 2025/03/07 16:16:38 by whaffman ######## odam.nl */ /* */ /* ************************************************************************** */ @@ -50,8 +50,8 @@ void print_redirects(void *param) void token_print(void *param) { - t_token *token; - const char *token_type[] = { + t_token *token; + const char *token_type[] = { "T_WORD", "T_DQWORD", "T_SQWORD", @@ -72,5 +72,6 @@ void token_print(void *param) if (token->type == 11) printf(RED BOLD "[ERROR]\t\t" RESET "(%s)\n", token_type[token->type]); else - printf( GREEN BOLD "[%s]\t\t" RESET "{%s(%d)}\n", token->value, token_type[token->type], token->type); + printf(GREEN BOLD "[%s]\t\t" RESET "{%s(%d)}\n", + token->value, token_type[token->type], token->type); } diff --git a/src/executor/executor_child.c b/src/executor/executor_child.c index 852901e..13ee887 100644 --- a/src/executor/executor_child.c +++ b/src/executor/executor_child.c @@ -1,12 +1,12 @@ /* ************************************************************************** */ /* */ -/* ::: :::::::: */ -/* executor_child.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: qmennen +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2025/02/12 21:25:10 by willem #+# #+# */ -/* Updated: 2025/03/06 14:12:17 by qmennen ### ########.fr */ +/* :::::::: */ +/* executor_child.c :+: :+: */ +/* +:+ */ +/* By: qmennen +#+ */ +/* +#+ */ +/* Created: 2025/02/12 21:25:10 by willem #+# #+# */ +/* Updated: 2025/03/07 16:16:54 by whaffman ######## odam.nl */ /* */ /* ************************************************************************** */ @@ -58,7 +58,7 @@ int executor_child(t_minishell *msh, t_command *command) } exit_status = validate_executable_path(path); if (exit_status != 0) - return (exit_status) ; + return (exit_status); execve(path, command->args, environment_get_arr(msh)); return (126); } diff --git a/src/executor/executor_execute_pipeline.c b/src/executor/executor_execute_pipeline.c index 1880e89..bb3eda4 100644 --- a/src/executor/executor_execute_pipeline.c +++ b/src/executor/executor_execute_pipeline.c @@ -1,12 +1,12 @@ /* ************************************************************************** */ /* */ -/* ::: :::::::: */ -/* executor_execute_pipeline.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: qmennen +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2025/02/12 21:25:02 by willem #+# #+# */ -/* Updated: 2025/03/06 14:39:56 by qmennen ### ########.fr */ +/* :::::::: */ +/* executor_execute_pipeline.c :+: :+: */ +/* +:+ */ +/* By: qmennen +#+ */ +/* +#+ */ +/* Created: 2025/02/12 21:25:02 by willem #+# #+# */ +/* Updated: 2025/03/07 16:17:26 by whaffman ######## odam.nl */ /* */ /* ************************************************************************** */ @@ -36,9 +36,9 @@ static int execute_builtin(t_minishell *msh, t_command *cmd) return (exit_status); } + //TODO: Discuss static int executor_execute_command(t_minishell *msh, t_command *cmd) { - //TODO: Discuss if (cmd->args[0] && ft_strcmp(cmd->args[0], "") == 0) return (0); if (is_builtin(cmd->args[0]) >= 0) diff --git a/src/lexer/lexer_read_word.c b/src/lexer/lexer_read_word.c index d20ba9e..f1119a9 100644 --- a/src/lexer/lexer_read_word.c +++ b/src/lexer/lexer_read_word.c @@ -1,12 +1,12 @@ /* ************************************************************************** */ /* */ -/* ::: :::::::: */ -/* lexer_read_word.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: qmennen +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2025/02/05 19:03:47 by qmennen #+# #+# */ -/* Updated: 2025/03/06 18:02:51 by qmennen ### ########.fr */ +/* :::::::: */ +/* lexer_read_word.c :+: :+: */ +/* +:+ */ +/* By: qmennen +#+ */ +/* +#+ */ +/* Created: 2025/02/05 19:03:47 by qmennen #+# #+# */ +/* Updated: 2025/03/07 13:42:29 by whaffman ######## odam.nl */ /* */ /* ************************************************************************** */ @@ -23,7 +23,7 @@ static int is_word_char(char c) return (ft_isprint(c)); } -static int calculate_word_len(t_minishell *msh, t_lexer *lexer) +static int calculate_word_len(t_lexer *lexer) { int i; int len; @@ -68,7 +68,7 @@ char *lexer_readword(t_minishell *msh, t_lexer *lexer) qts = (c == '"' || c == '\''); if (qts) return (lexer_parse_quotes(msh, lexer)); - len = calculate_word_len(msh, lexer); + len = calculate_word_len(lexer); word = read_word(msh, lexer, len); return (word); }