Oris482 / Minishell

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

FEAT : cut_xxx_token utils 제작 #23

Closed Giromi closed 2 years ago

Giromi commented 2 years ago
int main(void)
{
    char    *str1 = "abc";
    char    *str2 = "&&";
    char    *str3 = "ls";
    char    *str4 = "|";
    char    *str5 = "hello";
    t_lx_token  *cut_node;
    t_lx_token  *lst1 = make_new_node();
    t_lx_token  *lst2 = make_new_node();
    t_lx_token  *lst3 = make_new_node();
    t_lx_token  *lst4 = make_new_node();
    t_lx_token  *lst5 = make_new_node();

    lst1->token_str = str1;
    lst1->next = lst2;
    lst1->prev = lst5;

    lst2->token_str = str2;
    lst2->next = lst3;
    lst2->prev = lst1;

    lst3->token_str = str3;
    lst3->next = lst4;
    lst3->prev = lst2;

    lst4->token_str = str4;
    lst4->next = lst5;
    lst4->prev = lst3;

    lst5->token_str = str5;
    lst5->next = NULL;
    lst5->prev = lst4;

    print_token_next(lst1);
    print_token_prev(lst1);

    cut_node = cut_back_node(lst2);

    print_token_next(lst1);
    print_token_prev(lst1);
    print_token_next(cut_node);
    print_token_prev(cut_node);
    free(lst1);
    free(lst2);
    free(lst3);
    free(lst4);
    free(lst5);
}
Oris482 commented 2 years ago
t_lx_token      *cut_front_node(t_lx_token *cur_node);
t_lx_token  *cut_back_node(t_lx_token *cur_node);
t_lx_token      *pop_node(t_lx_token **cur_node,  t_lx_token *start_node, t_lx_token *end_node);