make norminette happy(er)

This commit is contained in:
Quinten Mennen 2025-03-05 21:19:02 +01:00
parent 526eba189e
commit f6c2754882
10 changed files with 7 additions and 14 deletions

View File

@ -27,5 +27,4 @@ int builtin_router(t_minishell *msh, t_command *cmd)
if (is_builtin(cmd->args[0]) < 0) if (is_builtin(cmd->args[0]) < 0)
return (FALSE); return (FALSE);
return (builtin_fn[is_builtin(cmd->args[0])](msh, cmd)); return (builtin_fn[is_builtin(cmd->args[0])](msh, cmd));
} }

View File

@ -18,7 +18,7 @@ void environment_print(t_minishell *msh, int export)
t_environment *env; t_environment *env;
env_list = msh->environment; env_list = msh->environment;
while(env_list != NULL) while (env_list != NULL)
{ {
env = (t_environment *)env_list->content; env = (t_environment *)env_list->content;
if (export) if (export)

View File

@ -24,7 +24,7 @@ static int is_dir(char *path)
return (S_ISDIR(path_stats.st_mode)); return (S_ISDIR(path_stats.st_mode));
} }
static int validate_executable_path(char *path) static int validate_executable_path(char *path)
{ {
if (access(path, X_OK) < 0) if (access(path, X_OK) < 0)
{ {

View File

@ -34,7 +34,7 @@ static int execute_builtin(t_minishell *msh, t_command *cmd)
return (exit_status); return (exit_status);
} }
static int executor_execute_command(t_minishell *msh, t_command *cmd) static int executor_execute_command(t_minishell *msh, t_command *cmd)
{ {
if (is_builtin(cmd->args[0]) >= 0) if (is_builtin(cmd->args[0]) >= 0)
msh->exit_status = execute_builtin(msh, cmd); msh->exit_status = execute_builtin(msh, cmd);

View File

@ -41,6 +41,5 @@ t_list *ft_parse_input(t_minishell *msh)
break ; break ;
} }
} }
// ft_token_free(msh, token);
return (list); return (list);
} }

View File

@ -30,7 +30,6 @@ static int calculate_word_len(t_minishell *msh, t_lexer *lexer)
i = lexer->pos; i = lexer->pos;
while (is_word_char(lexer->input[i])) while (is_word_char(lexer->input[i]))
{ {
len++; len++;
i++; i++;
} }
@ -67,8 +66,6 @@ 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));
// if (!match_quotes(msh, lexer, qts))
// return (NULL);
len = calculate_word_len(msh, lexer); len = calculate_word_len(msh, lexer);
word = read_word(msh, lexer, len); word = read_word(msh, lexer, len);
return (word); return (word);

View File

@ -22,7 +22,6 @@ t_command *parser_alloc_command(t_minishell *msh)
command->fd_out = 1; command->fd_out = 1;
command->redirect_in = NULL; command->redirect_in = NULL;
command->redirect_out = NULL; command->redirect_out = NULL;
// command->environment = NULL;
command->n_fds = 0; command->n_fds = 0;
return (command); return (command);
} }

View File

@ -34,5 +34,3 @@ int parser_count_arguments(t_list *list)
} }
return (cmds); return (cmds);
} }

View File

@ -20,7 +20,7 @@ void history_write(char *line)
fd = open(".minishell_history", O_WRONLY | O_APPEND | O_CREAT, 0644); fd = open(".minishell_history", O_WRONLY | O_APPEND | O_CREAT, 0644);
if (fd < 0) if (fd < 0)
return ; return ;
// if (*line) if (*line)
// ft_putendl_fd(line, fd); ft_putendl_fd(line, fd);
close(fd); close(fd);
} }

View File

@ -15,6 +15,7 @@
void *malloc_safe(t_minishell *msh, size_t size) void *malloc_safe(t_minishell *msh, size_t size)
{ {
void *ptr; void *ptr;
if (size == 0) if (size == 0)
return (NULL); return (NULL);
ptr = malloc(size); ptr = malloc(size);