」 feat: Did a lot of things, don't know what but it work

This commit is contained in:
2024-06-30 18:03:58 +02:00
parent 3d7669d056
commit f0c0830c4d
19 changed files with 188 additions and 111 deletions

View File

@ -0,0 +1,45 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* check_pipe.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/30 12:52:22 by adjoly #+# #+# */
/* Updated: 2024/06/30 17:26:09 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
#include "parsing.h"
#include <stdbool.h>
#include "error_msg.h"
size_t strlen_till_end_char(char *s, int c)
{
char *tmp;
tmp = s;
while (*tmp && *tmp == c)
tmp++;
return (tmp - s);
}
bool check_pipe(char *readline)
{
char *tmp;
tmp = readline;
while (*tmp)
{
if (*tmp == '|' && is_inquote(readline, tmp - readline) == FALSE)
{
tmp++;
tmp += strlen_till_end_char(tmp, ' ');
if (!*tmp)
return (send_error_parsing("No command after pipe"));
}
tmp++;
}
return (false);
}