42 lines
617 B
C
42 lines
617 B
C
|
#include "libftx/libftx.h"
|
||
|
#include "minishell.h"
|
||
|
|
||
|
static int ft_quote_verif(char *str)
|
||
|
{
|
||
|
if (ft_is_in_quote(str, ft_strlen(str)))
|
||
|
{
|
||
|
ft_eprintf("minishell: Quote is note closed");
|
||
|
return (1);
|
||
|
}
|
||
|
else
|
||
|
return (0);
|
||
|
}
|
||
|
|
||
|
static int ft_multipipe(char *str)
|
||
|
{
|
||
|
size_t i;
|
||
|
size_t y;
|
||
|
|
||
|
i = 0;
|
||
|
while (str[i] != '\0')
|
||
|
{
|
||
|
y = 0;
|
||
|
while (str[i + y] == '|' && ft_is_in_quote(str, i))
|
||
|
{
|
||
|
y++;
|
||
|
if (y > 1)
|
||
|
{
|
||
|
ft_eprintf("minishell: Multiple pipes is not supported\n");
|
||
|
return (1);
|
||
|
}
|
||
|
}
|
||
|
i++;
|
||
|
}
|
||
|
return (0);
|
||
|
}
|
||
|
|
||
|
int ft_syntatic_verif(char *str)
|
||
|
{
|
||
|
return (ft_quote_verif(str) || ft_multipipe(str));
|
||
|
}
|