diff --git a/.infile.c.swp b/.infile.c.swp deleted file mode 100644 index c2bfbc1..0000000 Binary files a/.infile.c.swp and /dev/null differ diff --git a/.heredoc.c.swp b/.syntatics.c.swp similarity index 83% rename from .heredoc.c.swp rename to .syntatics.c.swp index 476a495..0f707c9 100644 Binary files a/.heredoc.c.swp and b/.syntatics.c.swp differ diff --git a/cmds.c b/cmds.c index 65ee907..2c39eb7 100644 --- a/cmds.c +++ b/cmds.c @@ -6,7 +6,7 @@ /* By: cchauvet ", str[i])) { - if (y > 0) + y = 0; + while (str[i] == str[i + y]) + y++; + if ((y > 2 && (str[i] == '>' || str[i] == '<')) + || (y > 1 && str[i] == '|')) { - ft_eprintf("minishell: Multiple pipes is not supported\n"); + ft_eprintf("minishell: to many %c in a row", str, str[i]); return (1); } - y++; + i = i + y; } i++; } return (0); } -static int ft_pipe_is_alone(const char *str) +int ft_empty_verif(const char *str) { size_t i; - i = ft_strlen(str) - 1; - while (str[i] != '|' && i > 0) - { - if (str[i] != ' ') - return (0); - i--; - } - if (i == 0) - return (0); - ft_eprintf("minishell: Pipe must be followed by a command or redirection\n"); - return (1); + i = 0; + while (str[i] == ' ') + i++; + if (str[i] == '\0') + ft_eprintf("minishell: %s: command not found \n", str); + return (str[i] == '\0'); } int ft_syntatic_verif(const char *str) { - return (ft_quote_verif(str) || ft_multipipe(str) || ft_pipe_is_alone(str)); + return (ft_quote_verif(str) + || ft_pipe_is_alone(str) + || ft_empty_verif(str) + || ft_special_char_dub(str)); } diff --git a/t b/t deleted file mode 100644 index e69de29..0000000