Open Giromi opened 2 years ago
minishell$> echo && ls || hello | psdfsdf | efkj && ls
----------- < TREE > --------------
AND[&&]
/ \
/ \
/ \
/ \
/ \
OR[||] CMD
/ \ \
/ \ SIMPLE_CMD[ls]
/ \
/ \
/ \
/ \
/ \
/ \
/ \
/ \
/ \
/ \
/ \
/ \
/ \
AND[&&] PIPE[|]
/ \ / \
/ \ / \
/ \ / \
/ \ / \
/ \ / \
/ \ PIPE[|] CMD
/ \ / \ \
/ \ / \ SIMPLE_CMD[efkj]
CMD CMD / \
\ \ / \
SIMPLE_CMD[echo] SIMPLE_CMD[ls] / \
/ \
/ \
/ \
/ \
/ \
CMD CMD
\ \
SIMPLE_CMD[hello] SIMPLE_CMD[psdfsdf]
-----------------------------------
leaks Report Version: 4.0
Process 34164: 372 nodes malloced for 343 KB
Process 34164: 0 leaks for 0 total leaked bytes.
void tree_traversal(t_tree *cur_tree, int tree_type, \
void (*handler)(t_tree *))
{
if (cur_tree == NULL)
return ;
// else if (cur_tree->type & tree_type)
// handler(cur_tree);
tree_traversal(cur_tree->left, tree_type, handler);
tree_traversal(cur_tree->right, tree_type, handler);
if (cur_tree->type & tree_type)
handler(cur_tree);
}
밑으로 보내야 조금 더 의미가 맞음 일단 깊숙히 들어가서 내가 원하는 handler로 작업하는게 맞음 작업하고 더 깊이 들어가는 건 조금 이상함.
와일드카드 사용시마다 릭이 2개씩 늘어나는 현상
* => 2개
*/* => 3개
*/*/* => 4개