readability
This commit is contained in:
parent
e13eff0669
commit
8b33185add
@ -19,4 +19,6 @@ t_list *redirect_get_inputs(t_list *list);
|
||||
t_list *redirect_get_outputs(t_list *list);
|
||||
int redirect_is_valid(t_list *lst, t_token *token);
|
||||
int redirect_token_type(t_token *token);
|
||||
int redirect_is_delimiter(t_token *token);
|
||||
|
||||
#endif
|
||||
@ -23,7 +23,7 @@ t_list *redirect_get_inputs(t_list *list)
|
||||
while (current)
|
||||
{
|
||||
token = (t_token *)current->content;
|
||||
if (token->type == T_PIPE || token->type == T_EOF)
|
||||
if (redirect_is_delimiter(token))
|
||||
break ;
|
||||
if (token->type != T_REDIRECT_IN && token->type != T_HEREDOC)
|
||||
{
|
||||
|
||||
@ -23,7 +23,7 @@ t_list *redirect_get_outputs(t_list *list)
|
||||
while (current)
|
||||
{
|
||||
token = (t_token *)current->content;
|
||||
if (token->type == T_PIPE || token->type == T_EOF)
|
||||
if (redirect_is_delimiter(token))
|
||||
break;
|
||||
if (token->type != T_REDIRECT_OUT && token->type != T_APPEND_OUT)
|
||||
{
|
||||
|
||||
@ -28,4 +28,10 @@ int redirect_is_valid(t_list *lst, t_token *token)
|
||||
if (!next)
|
||||
return (0);
|
||||
return (redirect_token_type(token) && next->type < 3);
|
||||
}
|
||||
}
|
||||
|
||||
int redirect_is_delimiter(t_token *token)
|
||||
{
|
||||
return (token->type == T_PIPE || token->type == T_AND ||
|
||||
token->type == T_OR || token->type == T_EOF || token->type == T_ERROR);
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user