fix
This commit is contained in:
@@ -66,9 +66,9 @@ static int unstick_nodes(t_node *head)
|
||||
if (is_sticked(it->val))
|
||||
{
|
||||
if (is_meta(it->val[0]))
|
||||
first_str = copy_meta_xor(it->val, &copied, 0);
|
||||
first_str = copy_meta(it->val, &copied);
|
||||
else
|
||||
first_str = copy_meta_xor(it->val, &copied, 1);
|
||||
first_str = copy_unmeta(it->val, &copied);
|
||||
second_str = ft_substr(it->val, copied, ft_strlen(it->val)
|
||||
- copied);
|
||||
ft_free(&it->val);
|
||||
@@ -153,6 +153,9 @@ t_node *tokenize(char *str)
|
||||
if (!head)
|
||||
return (NULL);
|
||||
debug_token_list(head, "tokenize_base");
|
||||
if (!trim_nodes(head))
|
||||
return (NULL);
|
||||
debug_token_list(head, "trim_nodes");
|
||||
if (!unstick_nodes(head))
|
||||
return (NULL);
|
||||
debug_token_list(head, "unstick_nodes");
|
||||
@@ -164,7 +167,7 @@ t_node *tokenize(char *str)
|
||||
debug_token_list(head, "trim_nodes");
|
||||
set_token(head);
|
||||
del_void_nodes(&head);
|
||||
debug_token_list(head, "del_void_nodes");
|
||||
debug_token_list(head, "tokenizer");
|
||||
if (syntax_error(head))
|
||||
return (NULL);
|
||||
return (head);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#include "../../../includes/minishell.h"
|
||||
|
||||
char *copy_meta_xor(char *val, int *copied, int rev)
|
||||
char *copy_meta(char *val, int *copied)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
@@ -21,7 +21,25 @@ char *copy_meta_xor(char *val, int *copied, int rev)
|
||||
|
||||
i = 0;
|
||||
ref = val[0];
|
||||
while ((is_meta(val[i]) && val[i] == ref) ^ rev)
|
||||
while (val[i] && ((is_meta(val[i]) && val[i] == ref)))
|
||||
i++;
|
||||
*copied = i;
|
||||
out = malloc(i + 1);
|
||||
j = -1;
|
||||
while (++j < i)
|
||||
out[j] = val[j];
|
||||
out[i] = 0;
|
||||
return (out);
|
||||
}
|
||||
|
||||
char *copy_unmeta(char *val, int *copied)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
char *out;
|
||||
|
||||
i = 0;
|
||||
while (val[i] && !is_meta(val[i]))
|
||||
i++;
|
||||
*copied = i;
|
||||
out = malloc(i + 1);
|
||||
|
||||
Reference in New Issue
Block a user