This commit is contained in:
Etienne Rey-bethbeder 2023-03-31 15:04:44 +02:00
commit 1e00fee53c
5 changed files with 26 additions and 28 deletions

View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/21 12:45:16 by cchauvet #+# #+# */
/* Updated: 2023/03/29 18:53:35 by cchauvet ### ########.fr */
/* Updated: 2023/03/30 14:03:07 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
@ -58,7 +58,6 @@ static bool ft_executor(t_cmd *cmd, char **env, int fd)
ft_closer(cmd->fd_in);
ft_closer(cmd->fd_out);
execve(cmd->executable, cmd->args, env);
ft_eprintf("minishell: permission denied: %s\n", cmd->executable);
return (1);
}
return (0);

View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/15 13:35:50 by cchauvet #+# #+# */
/* Updated: 2023/03/29 16:53:15 by cchauvet ### ########.fr */
/* Updated: 2023/03/30 16:01:56 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
@ -66,7 +66,7 @@ static char *ft_spacer_before(const char *str)
i = -1;
while (out[++i] != '\0')
{
while (ft_is_in_quote(out, i))
while (ft_is_in_quote(out, i + 1))
i++;
if (out[i] == '\0')
break ;

View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/21 13:00:05 by cchauvet #+# #+# */
/* Updated: 2023/03/30 12:45:18 by cchauvet ### ########.fr */
/* Updated: 2023/03/30 15:58:39 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */

View File

@ -3,39 +3,38 @@
/* ::: :::::::: */
/* ft_is_in_quote.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/21 12:59:34 by cchauvet #+# #+# */
/* Updated: 2023/03/27 15:32:44 by cchauvet ### ########.fr */
/* Created: 2023/03/30 15:39:25 by cchauvet #+# #+# */
/* Updated: 2023/03/30 15:52:10 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include "utils.h"
#include <sys/types.h>
int ft_is_in_quote(const char *str, size_t n)
{
ssize_t i;
size_t i;
ssize_t start;
i = -1;
while (str[++i] != '\0' && i < (ssize_t) n)
start = -1;
i = 0;
while (str[i] != '\0')
{
if (str[i] == '\'')
if (i == n)
break ;
if (str[i] == '\"' || str[i] == '\'')
{
if (start == -1)
start = i;
else if (str[i] == str[start])
start = -1;
}
i++;
while (str[i] != '\'' && str[i] != '\0')
{
if (i == (ssize_t) n)
}
if (start == -1)
return (0);
if (str[start] == '\'')
return (1);
i++;
}
}
if (str[i] == '"')
{
while (str[++i] != '"' && str[i] != '\0')
if (i == (ssize_t) n)
return (2);
}
}
return (0);
}

View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/14 14:46:40 by cchauvet #+# #+# */
/* Updated: 2023/03/29 18:52:32 by cchauvet ### ########.fr */
/* Updated: 2023/03/30 15:38:56 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */