This commit is contained in:
whaffman 2025-03-07 16:37:41 +01:00
parent 8a04cc69d8
commit d4baa4b440
7 changed files with 40 additions and 38 deletions

View File

@ -6,7 +6,7 @@
/* By: qmennen <qmennen@student.codam.nl> +#+ */ /* By: qmennen <qmennen@student.codam.nl> +#+ */
/* +#+ */ /* +#+ */
/* Created: 2025/02/11 14:03:03 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_validate_command(t_command *command);
int parser_count_arguments(t_list *list); int parser_count_arguments(t_list *list);
char *parser_concatenate(t_minishell *msh, char *str1, char *str2); 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 #endif

View File

@ -6,7 +6,7 @@
/* By: whaffman <whaffman@student.codam.nl> +#+ */ /* By: whaffman <whaffman@student.codam.nl> +#+ */
/* +#+ */ /* +#+ */
/* Created: 2025/03/05 13:30:18 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 */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View File

@ -6,7 +6,7 @@
/* By: whaffman <whaffman@student.codam.nl> +#+ */ /* By: whaffman <whaffman@student.codam.nl> +#+ */
/* +#+ */ /* +#+ */
/* Created: 2025/02/20 11:32:53 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,6 +26,7 @@ static int ft_isvalid_identifier(char *str)
} }
return (TRUE); return (TRUE);
} }
static int actually_append(t_minishell *msh, char *arg, static int actually_append(t_minishell *msh, char *arg,
char *name, char *value) char *name, char *value)
{ {
@ -96,7 +97,6 @@ int builtin_export(t_minishell *msh, t_command *cmd)
int i; int i;
i = 0; i = 0;
if (cmd->args[1] == NULL) if (cmd->args[1] == NULL)
environment_print(msh, TRUE); environment_print(msh, TRUE);
while (cmd->args[++i] != NULL) while (cmd->args[++i] != NULL)

View File

@ -6,7 +6,7 @@
/* By: marvin <marvin@student.42.fr> +#+ */ /* By: marvin <marvin@student.42.fr> +#+ */
/* +#+ */ /* +#+ */
/* Created: 2025/02/18 20:06:37 by qmennen #+# #+# */ /* 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 */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -72,5 +72,6 @@ void token_print(void *param)
if (token->type == 11) if (token->type == 11)
printf(RED BOLD "[ERROR]\t\t" RESET "(%s)\n", token_type[token->type]); printf(RED BOLD "[ERROR]\t\t" RESET "(%s)\n", token_type[token->type]);
else 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);
} }

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */ /* ************************************************************************** */
/* */ /* */
/* ::: :::::::: */ /* :::::::: */
/* executor_child.c :+: :+: :+: */ /* executor_child.c :+: :+: */
/* +:+ +:+ +:+ */ /* +:+ */
/* By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ */ /* By: qmennen <qmennen@student.codam.nl> +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+ */
/* Created: 2025/02/12 21:25:10 by willem #+# #+# */ /* Created: 2025/02/12 21:25:10 by willem #+# #+# */
/* Updated: 2025/03/06 14:12:17 by qmennen ### ########.fr */ /* 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); exit_status = validate_executable_path(path);
if (exit_status != 0) if (exit_status != 0)
return (exit_status) ; return (exit_status);
execve(path, command->args, environment_get_arr(msh)); execve(path, command->args, environment_get_arr(msh));
return (126); return (126);
} }

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */ /* ************************************************************************** */
/* */ /* */
/* ::: :::::::: */ /* :::::::: */
/* executor_execute_pipeline.c :+: :+: :+: */ /* executor_execute_pipeline.c :+: :+: */
/* +:+ +:+ +:+ */ /* +:+ */
/* By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ */ /* By: qmennen <qmennen@student.codam.nl> +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+ */
/* Created: 2025/02/12 21:25:02 by willem #+# #+# */ /* Created: 2025/02/12 21:25:02 by willem #+# #+# */
/* Updated: 2025/03/06 14:39:56 by qmennen ### ########.fr */ /* 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); return (exit_status);
} }
//TODO: Discuss
static int executor_execute_command(t_minishell *msh, t_command *cmd) static int executor_execute_command(t_minishell *msh, t_command *cmd)
{ {
//TODO: Discuss
if (cmd->args[0] && ft_strcmp(cmd->args[0], "") == 0) if (cmd->args[0] && ft_strcmp(cmd->args[0], "") == 0)
return (0); return (0);
if (is_builtin(cmd->args[0]) >= 0) if (is_builtin(cmd->args[0]) >= 0)

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */ /* ************************************************************************** */
/* */ /* */
/* ::: :::::::: */ /* :::::::: */
/* lexer_read_word.c :+: :+: :+: */ /* lexer_read_word.c :+: :+: */
/* +:+ +:+ +:+ */ /* +:+ */
/* By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ */ /* By: qmennen <qmennen@student.codam.nl> +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+ */
/* Created: 2025/02/05 19:03:47 by qmennen #+# #+# */ /* Created: 2025/02/05 19:03:47 by qmennen #+# #+# */
/* Updated: 2025/03/06 18:02:51 by qmennen ### ########.fr */ /* 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)); 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 i;
int len; int len;
@ -68,7 +68,7 @@ char *lexer_readword(t_minishell *msh, t_lexer *lexer)
qts = (c == '"' || c == '\''); qts = (c == '"' || c == '\'');
if (qts) if (qts)
return (lexer_parse_quotes(msh, lexer)); return (lexer_parse_quotes(msh, lexer));
len = calculate_word_len(msh, lexer); len = calculate_word_len(lexer);
word = read_word(msh, lexer, len); word = read_word(msh, lexer, len);
return (word); return (word);
} }