fix: pipe alone fix
This commit is contained in:
parent
22b7a4feea
commit
c44530728c
4
cmds.c
4
cmds.c
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/02/15 14:17:26 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/02/15 21:21:42 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/02/16 14:42:08 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -111,8 +111,6 @@ t_list **ft_parse_cmds(char *line)
|
||||
infile = ft_infile(line);
|
||||
if (infile == -2 || outfile == -2)
|
||||
return (NULL);
|
||||
if (ft_syntatic_verif(line) == 1)
|
||||
return (NULL);
|
||||
if (ft_cmds_prep(cmds, line, infile, outfile) == 1)
|
||||
return (NULL);
|
||||
if (ft_cmds_fill(cmds, line) == 1)
|
||||
|
7
main.c
7
main.c
@ -30,6 +30,13 @@ int main(int ac, char **av, char **env)
|
||||
if (ac == 1)
|
||||
return (1);
|
||||
line = ft_normalizer(av[1]);
|
||||
if (line == NULL)
|
||||
return (1);
|
||||
if (ft_syntatic_verif(line) == 1)
|
||||
{
|
||||
free(line);
|
||||
return (1);
|
||||
}
|
||||
data.env = init_env(env);
|
||||
if (data.env == NULL)
|
||||
return (1);
|
||||
|
4
spacer.c
4
spacer.c
@ -6,10 +6,11 @@
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/02/15 13:35:50 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/02/16 13:17:24 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/02/16 14:53:16 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libftx/libftx.h"
|
||||
#include "minishell.h"
|
||||
#include "utils/utils.h"
|
||||
|
||||
@ -108,5 +109,6 @@ char *ft_normalizer(char *str)
|
||||
if (out == NULL)
|
||||
return (NULL);
|
||||
ft_space_simplifier(out);
|
||||
out[ft_strlen(out) - 1] = '\0';
|
||||
return (out);
|
||||
}
|
||||
|
11
syntatics.c
11
syntatics.c
@ -22,7 +22,9 @@ static int ft_pipe_is_alone(const char *str)
|
||||
i = 0;
|
||||
while (str[i] != '\0')
|
||||
{
|
||||
if (str[i] != '|')
|
||||
while (str[i] == ' ')
|
||||
i++;
|
||||
if (str[i] != '|' && str[i] != '\0')
|
||||
check = 1;
|
||||
else
|
||||
{
|
||||
@ -36,7 +38,12 @@ static int ft_pipe_is_alone(const char *str)
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return (0);
|
||||
if (check == 0)
|
||||
{
|
||||
ft_eprintf("minishell: Pipe must be followed and ");
|
||||
ft_eprintf("preced by a command or redirection\n");
|
||||
}
|
||||
return (check == 0);
|
||||
}
|
||||
|
||||
static int ft_special_char_dub(const char *str)
|
||||
|
Loading…
Reference in New Issue
Block a user