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> +#+ */
/* +#+ */
/* 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

View File

@ -6,16 +6,16 @@
/* By: whaffman <whaffman@student.codam.nl> +#+ */
/* +#+ */
/* 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);
}
}

View File

@ -6,7 +6,7 @@
/* By: whaffman <whaffman@student.codam.nl> +#+ */
/* +#+ */
/* 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)

View File

@ -6,7 +6,7 @@
/* By: marvin <marvin@student.42.fr> +#+ */
/* +#+ */
/* 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);
}

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* executor_child.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/12 21:25:10 by willem #+# #+# */
/* Updated: 2025/03/06 14:12:17 by qmennen ### ########.fr */
/* :::::::: */
/* executor_child.c :+: :+: */
/* +:+ */
/* By: qmennen <qmennen@student.codam.nl> +#+ */
/* +#+ */
/* 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);
}

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* executor_execute_pipeline.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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 <qmennen@student.codam.nl> +#+ */
/* +#+ */
/* 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)

View File

@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* lexer_read_word.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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 <qmennen@student.codam.nl> +#+ */
/* +#+ */
/* 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);
}