fixes
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
int execute_command(t_ast_n *node)
|
int execute_command(t_ast_n *node)
|
||||||
{
|
{
|
||||||
if (!node->cmd)
|
if (!node || (node->state == _CMD && node->cmd == NULL))
|
||||||
return (0);
|
return (0);
|
||||||
if (node->state == _CMD)
|
if (node->state == _CMD)
|
||||||
handle_redir(node);
|
handle_redir(node);
|
||||||
|
|||||||
@@ -128,12 +128,15 @@ void parse_heredoc(char *limiter, t_node *lst, t_msh *msh)
|
|||||||
|
|
||||||
void create_heredoc(t_node *lst, t_msh *msh)
|
void create_heredoc(t_node *lst, t_msh *msh)
|
||||||
{
|
{
|
||||||
|
t_node *tmp;
|
||||||
|
|
||||||
|
tmp = lst;
|
||||||
while (lst)
|
while (lst)
|
||||||
{
|
{
|
||||||
if (lst->pressision == HEREDOC && lst->next && lst->next->pressision)
|
if (lst->pressision == HEREDOC && lst->next && lst->next->pressision)
|
||||||
{
|
{
|
||||||
lst = lst->next;
|
lst = lst->next;
|
||||||
parse_heredoc(lst->val, lst, msh);
|
parse_heredoc(lst->val, tmp, msh);
|
||||||
}
|
}
|
||||||
lst = lst->next;
|
lst = lst->next;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,13 +53,15 @@ int add_node_back(t_node **head, char *val, t_token token, t_pres pres)
|
|||||||
void free_linked_list(t_node *head)
|
void free_linked_list(t_node *head)
|
||||||
{
|
{
|
||||||
t_node *tmp;
|
t_node *tmp;
|
||||||
|
t_node *next;
|
||||||
|
|
||||||
while (head)
|
tmp = head;
|
||||||
|
while (tmp)
|
||||||
{
|
{
|
||||||
tmp = head;
|
next = tmp->next;
|
||||||
head = head->next;
|
|
||||||
free(tmp->val);
|
free(tmp->val);
|
||||||
free(tmp);
|
free(tmp);
|
||||||
|
tmp = next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user