Oris482 / Minishell

Create own shell(such as bash): by_jaesjeon, minsuki2
1 stars 1 forks source link

BUG : subshell tree 리다이렉션 인식 문제 #28

Closed Giromi closed 2 years ago

Giromi commented 2 years ago

잘되는 상황

< eof (ls) > dfd
--------------
          CMD
          / \
         /   \
        /     \
       /       \
      /         \
< eof > dfd    ( )
                /
              CMD
                \
                ls

안되는 상황

(ls) > dfd < eof
--------------
      CMD
      / \
     /   \
    /     \
   /       \
> dfd    ( eof
           /
         CMD
           \
         ls ) <
--------------
Giromi commented 2 years ago
t_lx_token  *pop_node(t_lx_token **cur_node, \
                        t_lx_token *start_node, t_lx_token *end_node)
{
    if (_is_first_node(start_node))
    {
        *cur_node = end_node->next;
        if (*cur_node == NULL)
            return (start_node);
        return (cut_front_node(*cur_node));
    }
    else if (_is_last_node(end_node))
    {
        *cur_node = start_node->prev;
        return (cut_back_node(*cur_node));
    }
    else
    {
        // if (*cur_node == start_node || *cur_node == end_node)
        //     *cur_node = start_node->prev;
        if (*cur_node == start_node || *cur_node == end_node)
            *cur_node = end_node->next;
        start_node->prev->next = end_node->next;
        end_node->next->prev = start_node->prev;
        start_node->prev = end_node;
        end_node->next = NULL;
    }
    return (start_node);
}

pop_node else부분 수정 요망 end_prev를 가리켜야?