From fdfe1c8b95fd95579a7c93c088c414427394dfea Mon Sep 17 00:00:00 2001 From: Camille Chauvet Date: Tue, 4 Apr 2023 13:56:21 +0200 Subject: [PATCH] fix: redirection file == redirection sign --- parse/parse.c | 8 ++++++-- redirection/check.c | 29 +++++++++++++++++++++++------ redirection/redirection.c | 12 ++++++++---- 3 files changed, 37 insertions(+), 12 deletions(-) diff --git a/parse/parse.c b/parse/parse.c index 27fbc23..f5cc5c2 100644 --- a/parse/parse.c +++ b/parse/parse.c @@ -6,7 +6,7 @@ /* By: cchauvet ", redirection[0])) + { + ft_eprintf("minishell: %s: invalid redirection file\n", redirection); + return (1); + } + str = ft_strdup(redirection); + if (str == NULL) + { + ft_eprintf("minishell: malloc failed\n"); + return (1); + } + ft_quote_remover(str); + return_code = (ft_check_heredoc(data, cmd, redirection_identifier, str) + || ft_check_infile(data, cmd, redirection_identifier, str) + || ft_check_outfile(data, cmd, redirection_identifier, str) + || ft_check_outfile_append(data, cmd, redirection_identifier, + str)); + free(str); + return (return_code); } diff --git a/redirection/redirection.c b/redirection/redirection.c index 10bc034..079fde0 100644 --- a/redirection/redirection.c +++ b/redirection/redirection.c @@ -6,7 +6,7 @@ /* By: cchauvet ", tab[i][0])) + { + ft_eprintf("minishell: %s: must be followed by a file\n", tab[i]); + return (1); + } return (0); }