norm errors

This commit is contained in:
whaffman 2025-02-11 17:22:11 +01:00
parent fa04c4e265
commit 486a207834
11 changed files with 69 additions and 69 deletions

View File

@ -6,15 +6,15 @@
/* By: willem <willem@student.codam.nl> +#+ */ /* By: willem <willem@student.codam.nl> +#+ */
/* +#+ */ /* +#+ */
/* Created: 2025/02/08 17:06:07 by willem #+# #+# */ /* Created: 2025/02/08 17:06:07 by willem #+# #+# */
/* Updated: 2025/02/08 17:15:24 by willem ######## odam.nl */ /* Updated: 2025/02/11 17:06:54 by whaffman ######## odam.nl */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#ifndef EXECUTER_H #ifndef EXECUTOR_H
# define EXECUTER_H # define EXECUTOR_H
# include "minishell.h" # include "minishell.h"
char *executor_absolute_path(t_list *env, char *cmd); char *executor_absolute_path(t_list *env, char *cmd);
#endif // EXECUTER_H #endif // EXECUTOR_H

View File

@ -1,19 +1,19 @@
/* ************************************************************************** */ /* ************************************************************************** */
/* */ /* */
/* ::: :::::::: */ /* :::::::: */
/* parser.h :+: :+: :+: */ /* parser.h :+: :+: */
/* +:+ +:+ +:+ */ /* +:+ */
/* 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/02/11 16:25:16 by qmennen ### ########.fr */ /* Updated: 2025/02/11 17:19:01 by whaffman ######## odam.nl */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#ifndef PARSER_H #ifndef PARSER_H
# define PARSER_H # define PARSER_H
#include "minishell.h" # include "minishell.h"
t_command *parser_command_new(char *cmd); t_command *parser_command_new(char *cmd);
char **parser_get_arguments(t_list *list); char **parser_get_arguments(t_list *list);

View File

@ -6,7 +6,7 @@
/* By: whaffman <whaffman@student.codam.nl> +#+ */ /* By: whaffman <whaffman@student.codam.nl> +#+ */
/* +#+ */ /* +#+ */
/* Created: 2025/02/04 16:13:33 by whaffman #+# #+# */ /* Created: 2025/02/04 16:13:33 by whaffman #+# #+# */
/* Updated: 2025/02/04 16:15:35 by whaffman ######## odam.nl */ /* Updated: 2025/02/11 17:15:45 by whaffman ######## odam.nl */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -25,7 +25,9 @@ void environment_add(t_list **environment, char *name, char *value)
new_environment->name = ft_strdup(name); new_environment->name = ft_strdup(name);
new_environment->value = ft_strdup(value); new_environment->value = ft_strdup(value);
new_node = ft_lstnew(new_environment); new_node = ft_lstnew(new_environment);
if (new_node == NULL || new_environment->name == NULL || new_environment->value == NULL) if (new_node == NULL
|| new_environment->name == NULL
|| new_environment->value == NULL)
{ {
free(new_environment->name); free(new_environment->name);
free(new_environment->value); free(new_environment->value);

View File

@ -6,7 +6,7 @@
/* By: whaffman <whaffman@student.codam.nl> +#+ */ /* By: whaffman <whaffman@student.codam.nl> +#+ */
/* +#+ */ /* +#+ */
/* Created: 2025/02/11 14:17:53 by whaffman #+# #+# */ /* Created: 2025/02/11 14:17:53 by whaffman #+# #+# */
/* Updated: 2025/02/11 15:40:09 by whaffman ######## odam.nl */ /* Updated: 2025/02/11 17:20:26 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/04 16:13:59 by whaffman #+# #+# */ /* Created: 2025/02/04 16:13:59 by whaffman #+# #+# */
/* Updated: 2025/02/04 16:14:04 by whaffman ######## odam.nl */ /* Updated: 2025/02/11 17:18:27 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/04 16:15:05 by whaffman #+# #+# */ /* Created: 2025/02/04 16:15:05 by whaffman #+# #+# */
/* Updated: 2025/02/04 16:15:10 by whaffman ######## odam.nl */ /* Updated: 2025/02/11 17:04:28 by whaffman ######## odam.nl */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -15,6 +15,7 @@
t_environment *environment_get(t_list *environment, char *name) t_environment *environment_get(t_list *environment, char *name)
{ {
t_environment *env; t_environment *env;
while (environment != NULL) while (environment != NULL)
{ {
env = (t_environment *)environment->content; env = (t_environment *)environment->content;

View File

@ -6,11 +6,11 @@
/* By: willem <willem@student.codam.nl> +#+ */ /* By: willem <willem@student.codam.nl> +#+ */
/* +#+ */ /* +#+ */
/* Created: 2025/02/08 13:59:48 by willem #+# #+# */ /* Created: 2025/02/08 13:59:48 by willem #+# #+# */
/* Updated: 2025/02/08 13:59:49 by willem ######## odam.nl */ /* Updated: 2025/02/11 17:18:15 by whaffman ######## odam.nl */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
# include "minishell.h" #include "minishell.h"
char **environment_get_arr(t_list *environment) char **environment_get_arr(t_list *environment)
{ {
@ -27,13 +27,11 @@ char **environment_get_arr(t_list *environment)
env = (t_environment *)environment->content; env = (t_environment *)environment->content;
arr[i] = malloc(ft_strlen(env->name) + ft_strlen(env->value) + 2); arr[i] = malloc(ft_strlen(env->name) + ft_strlen(env->value) + 2);
if (arr[i] == NULL) if (arr[i] == NULL)
{ return (ft_free_arr(arr), NULL);
ft_free_arr(arr);
return (NULL);
}
ft_strlcpy(arr[i], env->name, ft_strlen(env->name) + 1); ft_strlcpy(arr[i], env->name, ft_strlen(env->name) + 1);
ft_strlcat(arr[i], "=", ft_strlen(env->name) + 2); ft_strlcat(arr[i], "=", ft_strlen(env->name) + 2);
ft_strlcat(arr[i], env->value, ft_strlen(env->name) + ft_strlen(env->value) + 2); ft_strlcat(arr[i], env->value,
ft_strlen(env->name) + ft_strlen(env->value) + 2);
environment = environment->next; environment = environment->next;
i++; i++;
} }

View File

@ -6,7 +6,7 @@
/* By: whaffman <whaffman@student.codam.nl> +#+ */ /* By: whaffman <whaffman@student.codam.nl> +#+ */
/* +#+ */ /* +#+ */
/* Created: 2025/02/05 15:52:33 by whaffman #+# #+# */ /* Created: 2025/02/05 15:52:33 by whaffman #+# #+# */
/* Updated: 2025/02/05 15:52:34 by whaffman ######## odam.nl */ /* Updated: 2025/02/11 17:18:43 by whaffman ######## odam.nl */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View File

@ -6,7 +6,7 @@
/* By: willem <willem@student.codam.nl> +#+ */ /* By: willem <willem@student.codam.nl> +#+ */
/* +#+ */ /* +#+ */
/* Created: 2025/02/08 13:52:08 by willem #+# #+# */ /* Created: 2025/02/08 13:52:08 by willem #+# #+# */
/* Updated: 2025/02/08 14:24:20 by willem ######## odam.nl */ /* Updated: 2025/02/11 17:05:10 by whaffman ######## odam.nl */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View File

@ -6,7 +6,7 @@
/* By: willem <willem@student.codam.nl> +#+ */ /* By: willem <willem@student.codam.nl> +#+ */
/* +#+ */ /* +#+ */
/* Created: 2025/02/08 17:00:24 by willem #+# #+# */ /* Created: 2025/02/08 17:00:24 by willem #+# #+# */
/* Updated: 2025/02/11 16:45:17 by whaffman ######## odam.nl */ /* Updated: 2025/02/11 17:20:17 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/05 16:21:39 by whaffman #+# #+# */ /* Created: 2025/02/05 16:21:39 by whaffman #+# #+# */
/* Updated: 2025/02/11 14:30:38 by whaffman ######## odam.nl */ /* Updated: 2025/02/11 17:11:16 by whaffman ######## odam.nl */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -41,7 +41,6 @@ void builtin_export(t_minishell *minishell)
} }
} }
static int cmp_value(t_list *list, char *str) static int cmp_value(t_list *list, char *str)
{ {
if (list != NULL if (list != NULL
@ -83,6 +82,7 @@ void fork_execve(t_minishell *minishell, char *path, char **argv)
void simple_builtins(t_minishell *minishell) void simple_builtins(t_minishell *minishell)
{ {
char *path; char *path;
if (!minishell->tokens) if (!minishell->tokens)
return ; return ;
if (cmp_value(minishell->tokens, "clear")) if (cmp_value(minishell->tokens, "clear"))
@ -109,5 +109,4 @@ void simple_builtins(t_minishell *minishell)
fork_execve(minishell, path, ft_split(((t_token *)minishell->tokens->content)->value, ' ')); fork_execve(minishell, path, ft_split(((t_token *)minishell->tokens->content)->value, ' '));
} }
} }
} }