🏗️」 wip: testing check on in and out file

This commit is contained in:
2024-07-30 17:17:31 +02:00
parent b1e2cfaf39
commit 87afde27d1
3 changed files with 8 additions and 7 deletions

View File

@ -6,10 +6,10 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */ /* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/30 12:52:22 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 "libft.h"
#include "parsing.h" #include "parsing.h"
#include <stdbool.h> #include <stdbool.h>
@ -37,6 +37,7 @@ bool check_pipe(char *readline)
{ {
while (tmp && *tmp && ft_isspace(*tmp)) while (tmp && *tmp && ft_isspace(*tmp))
tmp++; tmp++;
printf("%s\n", tmp);
if (!tmp && !*tmp) if (!tmp && !*tmp)
return (send_error_parsing("No command after pipe")); return (send_error_parsing("No command after pipe"));
} }

View File

@ -6,15 +6,13 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */ /* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/29 19:18:19 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 "parsing.h"
#include "error_msg.h" #include "error_msg.h"
#include <stdio.h>
bool check_wspace(char *readline) bool check_wspace(char *readline)
{ {
while (*readline && ft_isspace(*readline)) while (*readline && ft_isspace(*readline))

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */ /* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/30 10:48:41 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) while (tmp)
{ {
open_redir((t_redirection *)tmp->content, cmd, sign); 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); free(cmd);
return (NULL); return (NULL);
} }