This commit is contained in:
kinou-p 2022-04-20 17:06:01 +02:00
parent c8953ce158
commit 470e2bb471
4 changed files with 10 additions and 10 deletions

View File

@ -6,13 +6,13 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */ /* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2022/04/19 16:53:13 by apommier #+# #+# */ /* Created: 2022/04/19 16:53:13 by apommier #+# #+# */
/* Updated: 2022/04/20 16:51:05 by apommier ### ########.fr */ /* Updated: 2022/04/20 17:03:57 by apommier ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "../../includes/minishell.h" #include "../../includes/minishell.h"
char *error_parsing(void) char *error_parsing(void)
{ {
ft_putstr_fd("Minishell: error while parsing command\n", 2); ft_putstr_fd("Minishell: error while parsing command\n", 2);
return (0); return (0);

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */ /* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2022/04/19 15:02:01 by apommier #+# #+# */ /* Created: 2022/04/19 15:02:01 by apommier #+# #+# */
/* Updated: 2022/04/20 14:48:26 by apommier ### ########.fr */ /* Updated: 2022/04/20 17:04:43 by apommier ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -59,7 +59,8 @@ char *change_var(t_cmd *big_cmd, char *cmd, int *index)
char *var; char *var;
i = *index + 1; i = *index + 1;
while (cmd[i] && (ft_isalnum(cmd[i]) || cmd[i] == '_' || cmd[i] == '?' || cmd[i] == '$')) while (cmd[i] && (ft_isalnum(cmd[i]) || cmd[i] == '_'
|| cmd[i] == '?' || cmd[i] == '$'))
i++; i++;
swap = ft_substr(cmd, *index + 1, i - *index - 1); swap = ft_substr(cmd, *index + 1, i - *index - 1);
var = get_var(big_cmd, swap); var = get_var(big_cmd, swap);

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */ /* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2022/03/09 15:18:58 by apommier #+# #+# */ /* Created: 2022/03/09 15:18:58 by apommier #+# #+# */
/* Updated: 2022/04/20 16:49:33 by apommier ### ########.fr */ /* Updated: 2022/04/20 17:05:09 by apommier ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -33,7 +33,7 @@ char *get_word(char *str, int start)
int set_file(char *file, int type) int set_file(char *file, int type)
{ {
int fd; int fd;
if (type) if (type)
fd = open(file, O_APPEND | O_CREAT, 0666); fd = open(file, O_APPEND | O_CREAT, 0666);
else else

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */ /* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2022/04/19 14:45:10 by apommier #+# #+# */ /* Created: 2022/04/19 14:45:10 by apommier #+# #+# */
/* Updated: 2022/04/20 16:45:06 by apommier ### ########.fr */ /* Updated: 2022/04/20 17:05:24 by apommier ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -28,7 +28,6 @@ int check_access_output(t_s_cmd *cmd)
return (1); return (1);
} }
char *set_output(char *line, t_s_cmd *cmd, int index) char *set_output(char *line, t_s_cmd *cmd, int index)
{ {
int i; int i;
@ -50,8 +49,8 @@ char *set_output(char *line, t_s_cmd *cmd, int index)
cmd->outfile = set_var(cmd->big_cmd, cmd->outfile); cmd->outfile = set_var(cmd->big_cmd, cmd->outfile);
if (!check_access_output(cmd)) if (!check_access_output(cmd))
{ {
free(line); free(line);
return (0); return (0);
} }
line = cut_str(line, index, i); line = cut_str(line, index, i);
return (line); return (line);