🏗️」 wip: Testing pipe check

This commit is contained in:
2024-07-29 20:46:17 +02:00
parent c3aad1290d
commit 59c03e8e42
12 changed files with 369 additions and 10 deletions

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/16 14:38:11 by adjoly #+# #+# */
/* Updated: 2024/07/16 14:38:58 by adjoly ### ########.fr */
/* Updated: 2024/07/29 19:16:15 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/30 12:52:22 by adjoly #+# #+# */
/* Updated: 2024/07/18 17:04:06 by adjoly ### ########.fr */
/* Updated: 2024/07/29 20:41:05 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -14,6 +14,7 @@
#include "parsing.h"
#include <stdbool.h>
#include "error_msg.h"
#include <stdio.h>
size_t strlen_till_end_char(char *s, int c)
{
@ -34,7 +35,10 @@ bool check_pipe(char *readline)
{
if (*tmp == '|' && is_inquote(readline, tmp - readline) == FALSE)
{
tmp += strlen_till_end_char(tmp + 1, ' ') + 1;
if (!*tmp)
return (send_error_parsing("No command after pipe"));
while (*tmp && !ft_isspace(*tmp))
tmp++;
if (!*tmp)
return (send_error_parsing("No command after pipe"));
}

View File

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* check_wspace.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/29 19:18:19 by adjoly #+# #+# */
/* Updated: 2024/07/29 19:31:02 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include "parsing.h"
#include "error_msg.h"
#include <stdio.h>
bool check_wspace(char *readline)
{
while (*readline && ft_isspace(*readline))
readline++;
if (!*readline)
return (send_error_parsing("Only white space in line"));
return (false);
}

View File

@ -6,7 +6,7 @@
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/18 13:30:27 by adjoly #+# #+# */
/* Updated: 2024/07/18 17:13:11 by adjoly ### ########.fr */
/* Updated: 2024/07/29 19:17:47 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -20,6 +20,8 @@ bool run_checks(char *rl)
if (!*rl)
return (true);
add_history(rl);
if (check_wspace(rl))
return (true);
if (check_syntax(rl))
return (true);
if (check_quote(rl))

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/20 21:05:04 by adjoly #+# #+# */
/* Updated: 2024/07/21 17:58:47 by adjoly ### ########.fr */
/* Updated: 2024/07/29 19:32:38 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */