added valid_command() rule (only "cmd_prefix")
+ skip exec if no cmd_name in a command
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2021/10/24 18:52:05 by lperrey #+# #+# */
|
||||
/* Updated: 2021/10/24 19:21:28 by lperrey ### ########.fr */
|
||||
/* Updated: 2021/12/17 03:14:06 by lperrey ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -18,6 +18,7 @@ static int valid_command_rule1(t_token **token_list);
|
||||
static int valid_command_rule2(t_token **token_list);
|
||||
static int valid_command_rule3(t_token **token_list);
|
||||
static int valid_command_rule4(t_token **token_list);
|
||||
static int valid_command_rule5(t_token **token_list);
|
||||
|
||||
int valid_command(t_token **token_list)
|
||||
{
|
||||
@@ -35,6 +36,9 @@ int valid_command(t_token **token_list)
|
||||
*token_list = cmd_start;
|
||||
if (valid_command_rule4(token_list))
|
||||
return (1);
|
||||
*token_list = cmd_start;
|
||||
if (valid_command_rule5(token_list))
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -94,3 +98,14 @@ static int valid_command_rule4(t_token **token_list)
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
// cmd_prefix
|
||||
static int valid_command_rule5(t_token **token_list)
|
||||
{
|
||||
while (valid_io_redirect(token_list))
|
||||
{
|
||||
if (valid_command_separator(*token_list))
|
||||
return (1);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user