From 87afde27d14e29b8c80f9e7eb0a3dde66e4b3e84 Mon Sep 17 00:00:00 2001 From: adjoly Date: Tue, 30 Jul 2024 17:17:31 +0200 Subject: [PATCH] =?UTF-8?q?=E3=80=8C=F0=9F=8F=97=EF=B8=8F=E3=80=8D=20wip:?= =?UTF-8?q?=20testing=20check=20on=20in=20and=20out=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/parsing/check_error/check_pipe.c | 5 +++-- src/parsing/check_error/check_wspace.c | 4 +--- src/parsing/get_redir_fd.c | 6 ++++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/parsing/check_error/check_pipe.c b/src/parsing/check_error/check_pipe.c index bad3e59..cc9bfac 100644 --- a/src/parsing/check_error/check_pipe.c +++ b/src/parsing/check_error/check_pipe.c @@ -6,10 +6,10 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/06/30 12:52:22 by adjoly #+# #+# */ -/* Updated: 2024/07/29 21:15:29 by adjoly ### ########.fr */ +/* Updated: 2024/07/30 16:42:50 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ -\ + #include "libft.h" #include "parsing.h" #include @@ -37,6 +37,7 @@ bool check_pipe(char *readline) { while (tmp && *tmp && ft_isspace(*tmp)) tmp++; + printf("%s\n", tmp); if (!tmp && !*tmp) return (send_error_parsing("No command after pipe")); } diff --git a/src/parsing/check_error/check_wspace.c b/src/parsing/check_error/check_wspace.c index ec3d609..d35ea56 100644 --- a/src/parsing/check_error/check_wspace.c +++ b/src/parsing/check_error/check_wspace.c @@ -6,15 +6,13 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/07/29 19:18:19 by adjoly #+# #+# */ -/* Updated: 2024/07/29 19:31:02 by adjoly ### ########.fr */ +/* Updated: 2024/07/30 14:36:47 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ #include "parsing.h" #include "error_msg.h" - -#include bool check_wspace(char *readline) { while (*readline && ft_isspace(*readline)) diff --git a/src/parsing/get_redir_fd.c b/src/parsing/get_redir_fd.c index 4689742..7b62d75 100644 --- a/src/parsing/get_redir_fd.c +++ b/src/parsing/get_redir_fd.c @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/05/30 10:48:41 by adjoly #+# #+# */ -/* Updated: 2024/07/20 17:16:57 by adjoly ### ########.fr */ +/* Updated: 2024/07/30 17:17:13 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -31,8 +31,10 @@ t_cmd *get_redir_fd(void *content, t_list *tmp) while (tmp) { open_redir((t_redirection *)tmp->content, cmd, sign); - if (cmd->infile == -2) + if (cmd->infile >= -1 || cmd->outfile == -1) { + if (cmd->infile == -1 || cmd->outfile == -1) + send_error_parsing(ERROR_NO_FILE); free(cmd); return (NULL); }