mirror of
https://github.com/KeyZox71/ft_minipowershell.git
synced 2025-05-10 22:58:45 +02:00
49 lines
1.5 KiB
C
49 lines
1.5 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* check_pipe.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2024/06/30 12:52:22 by adjoly #+# #+# */
|
|
/* Updated: 2024/07/29 20:41:05 by adjoly ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "libft.h"
|
|
#include "parsing.h"
|
|
#include <stdbool.h>
|
|
#include "error_msg.h"
|
|
#include <stdio.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)
|
|
{
|
|
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"));
|
|
}
|
|
tmp++;
|
|
}
|
|
return (false);
|
|
}
|