teesgdmbklvr

This commit is contained in:
Etienne Rey-bethbeder 2023-02-21 23:29:56 +01:00
commit 9ace235831
5 changed files with 15 additions and 12 deletions

Binary file not shown.

View File

@ -7,6 +7,7 @@
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/17 13:09:08 by erey-bet #+# #+# */
<<<<<<< HEAD
<<<<<<< HEAD
/* Updated: 2023/02/21 22:24:51 by erey-bet ### ########.fr */
=======
<<<<<<< HEAD
@ -15,6 +16,9 @@
/* Updated: 2023/02/21 22:09:55 by erey-bet ### ########.fr */
>>>>>>> 1fdc51a668e616de94c33d5b3b1e9cb51182916d
>>>>>>> eb4a8ed663b2f93cd955f7608aa686bd8e767a65
=======
/* Updated: 2023/02/21 22:15:27 by cchauvet ### ########.fr */
>>>>>>> 76bc8fbfd8d5413e8f6e4f3eb6ec00db0fa3c884
/* */
/* ************************************************************************** */
@ -53,7 +57,6 @@ int check_argument(char *str, int *check, int i)
return (i);
}
char *conca(char **strs)
{
int len;
@ -64,7 +67,7 @@ char *conca(char **strs)
i = -1;
len = 0;
while (strs[++i] != NULL)
len += strlen(strs[i]) + 2;
len += ft_strlen(strs[i]) + 2;
str = (char *) ft_calloc(len + 1, sizeof(char));
if (str == NULL)
return NULL;
@ -79,7 +82,6 @@ char *conca(char **strs)
return (str);
}
int echo(int fd, char **strs)
{
int check;

6
cmd.c
View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/15 14:18:21 by cchauvet #+# #+# */
/* Updated: 2023/02/21 21:54:08 by cchauvet ### ########.fr */
/* Updated: 2023/02/21 22:27:28 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
@ -22,10 +22,6 @@ void ft_cmddel(void *ptr)
ft_freer_tab_ultimate(1, content->args);
if (content->executable != NULL)
free(content->executable);
if (content->fd_in > 2)
close(content->fd_in);
if (content->fd_out > 2)
close(content->fd_in);
free(content);
}

View File

@ -6,12 +6,13 @@
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/21 12:45:16 by cchauvet #+# #+# */
/* Updated: 2023/02/21 22:11:34 by cchauvet ### ########.fr */
/* Updated: 2023/02/21 22:26:54 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#include "libftx/libftx.h"
#include "minishell.h"
#include <unistd.h>
static char *ft_get_executable_path(char *executable_name, t_list **env)
{
@ -158,6 +159,10 @@ int ft_cmds_executor(t_data *data, t_list **cmds)
ft_eprintf("minishell: malloc failed\n");
return (1);
}
if (content->fd_in > 2)
close(content->fd_in);
if (content->fd_out > 2)
close(content->fd_out);
set_value_by_key("?", return_value, data->env);
current = current->next;
}

View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/21 12:59:34 by cchauvet #+# #+# */
/* Updated: 2023/02/21 12:59:43 by cchauvet ### ########.fr */
/* Updated: 2023/02/21 23:08:10 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
@ -28,12 +28,12 @@ int ft_is_in_quote(const char *str, size_t n)
if (simple_quoted == 0)
double_quoted = !double_quoted;
}
if (str[i] == '\'')
else if (str[i] == '\'')
{
if (double_quoted == 0)
simple_quoted = !simple_quoted;
}
i++;
}
return (simple_quoted == 1 + (double_quoted == 1) * 2);
return (simple_quoted + double_quoted * 2);
}