update: normed exec and finish the glob for current directory
This commit is contained in:
parent
cc1e2b7fdc
commit
fba538e344
24 changed files with 647 additions and 429 deletions
41
exec/src/run_ast/run_builtins2.c
Normal file
41
exec/src/run_ast/run_builtins2.c
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* run_builtins2.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/09/14 12:24:49 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/09/18 21:07:12 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "exec/_run_ast.h"
|
||||
#include "exec/builtins.h"
|
||||
#include "me/mem/mem.h"
|
||||
#include "me/os/os.h"
|
||||
#include "me/str/str.h"
|
||||
|
||||
void _ffree_func(struct s_ffree_state *state)
|
||||
{
|
||||
if (state == NULL)
|
||||
return ;
|
||||
hmap_env_free(state->state->env);
|
||||
hmap_env_free(state->state->tmp_var);
|
||||
close_fd(state->cmd_pipe.input);
|
||||
}
|
||||
|
||||
bool _is_builtin(t_const_str argv0)
|
||||
{
|
||||
t_usize i;
|
||||
const t_str value[] = {"cd", "echo", "env", "exit", "export", "pwd", \
|
||||
"unset", "_debug", NULL};
|
||||
|
||||
i = 0;
|
||||
if (argv0 == NULL)
|
||||
return (false);
|
||||
while (value[i] != NULL)
|
||||
if (str_compare(argv0, value[i++]))
|
||||
return (true);
|
||||
return (false);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue