fork_execve

This commit is contained in:
whaffman 2025-02-11 14:03:18 +01:00
parent 7cad14f636
commit b49a8e5368

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/09 16:20:04 by willem ######## odam.nl */ /* Updated: 2025/02/11 13:16:13 by whaffman ######## odam.nl */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -38,7 +38,7 @@ void builtin_export(t_minishell *minishell)
environment_add(&(minishell->environment), arr[0], arr[1]); environment_add(&(minishell->environment), arr[0], arr[1]);
ft_free_arr(arr); ft_free_arr(arr);
tmp = tmp->next; tmp = tmp->next;
} }
} }
@ -57,7 +57,7 @@ void fork_execve(t_minishell *minishell, char *path, char **argv)
{ {
pid_t pid; pid_t pid;
int status; int status;
pid = fork(); pid = fork();
if (pid == 0) if (pid == 0)
{ {
@ -83,7 +83,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 (cmp_value(minishell->tokens, "clear")) if (cmp_value(minishell->tokens, "clear"))
printf("\033[2J\033[1;1H"); printf("\033[2J\033[1;1H");
else if (cmp_value(minishell->tokens, "env")) else if (cmp_value(minishell->tokens, "env"))
@ -103,7 +103,7 @@ void simple_builtins(t_minishell *minishell)
else else
{ {
printf("found excutable: %s\n", path); printf("found excutable: %s\n", path);
free(path); fork_execve(minishell, path, ft_split(((t_token *)minishell->tokens->content)->value, ' '));
} }
} }