commit pour recup lib & node_copy
This commit is contained in:
parent
157519224d
commit
be78dfbdf8
4 changed files with 35 additions and 10 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/13 17:21:56 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/07 17:29:38 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/08 03:08:48 by wescande ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -32,6 +32,4 @@ int builtin_bg(const char *path, char *const av[], char *const envp[]);
|
|||
int builtin_history(const char *path, char *const av[], char *const envp[]);
|
||||
int builtin_hash(const char *path, char *const av[], char *const envp[]);
|
||||
|
||||
extern t_stof g_builtins[];
|
||||
|
||||
#endif
|
||||
|
|
|
|||
27
42sh/src/exec/is_function.c
Normal file
27
42sh/src/exec/is_function.c
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* is_function.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/03/08 02:45:15 by wescande #+# #+# */
|
||||
/* Updated: 2017/03/08 03:10:25 by wescande ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "minishell.h"
|
||||
|
||||
t_btree *is_function(t_process *p)
|
||||
{
|
||||
t_list *tmp;
|
||||
|
||||
tmp = data_singleton()->lst_func;
|
||||
while (tmp)
|
||||
{
|
||||
if (!ft_strcmp(((t_astnode *)tmp->content)->data.str, p->data.cmd.av[0]))
|
||||
btree_map(p->data.subshell.content, node_copy);
|
||||
tmp = tmp->next;
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/13 17:07:10 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/07 21:44:37 by wescande ### ########.fr */
|
||||
/* Updated: 2017/03/08 03:08:30 by wescande ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -16,9 +16,9 @@ int process_setexec(t_process *p)
|
|||
{
|
||||
p->data.cmd.path = NULL;
|
||||
p->data.cmd.execf = NULL;
|
||||
/* if ((p->execf = is_function(p))) */
|
||||
/* p->type = PROCESS_FUNCTION; */
|
||||
if ((p->data.cmd.execf = is_builtin(p)))
|
||||
if ((p->data.subshell.content = is_function(p)))
|
||||
p->type = PROCESS_FUNCTION;
|
||||
else if ((p->data.cmd.execf = is_builtin(p)))
|
||||
p->type = PROCESS_BUILTIN;
|
||||
else if (ft_strchr(p->data.cmd.av[0], '/'))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/02/24 23:43:07 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/07 10:49:15 by ariard ### ########.fr */
|
||||
/* Updated: 2017/03/08 03:04:45 by wescande ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -25,6 +25,7 @@ int isfunc_name(t_btree **ast, t_list **lst)
|
|||
{
|
||||
DG("add func name");
|
||||
node->type = FNAME;
|
||||
node->data.str = ft_strdup(token->data);
|
||||
return (1);
|
||||
}
|
||||
if (node->type == FNAME && token->type == TK_PAREN_CLOSE && node->nest == 0)
|
||||
|
|
@ -87,8 +88,7 @@ int add_one_func(t_btree **ast, t_list **lst)
|
|||
{
|
||||
t_btree *func_ast;
|
||||
|
||||
(void)lst;
|
||||
// func_ast = btree_map(*ast, &id);
|
||||
func_ast = btree_map(*ast, node_copy);
|
||||
ft_lsteadd(&data_singleton()->lst_func, ft_lstnew(&func_ast, sizeof(*ast)));
|
||||
DG("arbre ajoute");
|
||||
return (0);
|
||||
|
|
|
|||
Loading…
Reference in a new issue