merge avec moi meme

This commit is contained in:
2024-05-06 10:29:41 +02:00
3 changed files with 16 additions and 4 deletions

View File

@ -6,7 +6,7 @@
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */ /* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/05 18:15:27 by marde-vr #+# #+# */ /* Created: 2024/03/05 18:15:27 by marde-vr #+# #+# */
/* Updated: 2024/05/03 14:11:52 by marde-vr ### ########.fr */ /* Updated: 2024/05/05 20:10:03 by tomoron ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -40,7 +40,10 @@ int open_input_redirection_file(t_msh *msh, t_cmd **cur_token)
if (msh->in_fd != 0) if (msh->in_fd != 0)
close(msh->in_fd); close(msh->in_fd);
if (ft_strchr((*cur_token)->value, '$')) if (ft_strchr((*cur_token)->value, '$'))
{
ambiguous_redirect((*cur_token)->value, msh); ambiguous_redirect((*cur_token)->value, msh);
return (1);
}
filename = parse_tokens((*cur_token)->value, msh->env); filename = parse_tokens((*cur_token)->value, msh->env);
if (!filename) if (!filename)
ft_exit(msh, 1); ft_exit(msh, 1);

View File

@ -6,7 +6,7 @@
/* By: tomoron <marvin@42.fr> +#+ +:+ +#+ */ /* By: tomoron <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/19 14:09:44 by tomoron #+# #+# */ /* Created: 2024/04/19 14:09:44 by tomoron #+# #+# */
/* Updated: 2024/05/06 09:58:11 by tomoron ### ########.fr */ /* Updated: 2024/05/06 10:28:56 by tomoron ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -71,7 +71,10 @@ void get_out_file(t_msh *msh, t_cmd *cur_cmd, int *ret)
msh->out_type = cur_cmd->cmd_type; msh->out_type = cur_cmd->cmd_type;
if (ft_strchr(cur_cmd->value, '$')) if (ft_strchr(cur_cmd->value, '$'))
{
ambiguous_redirect(cur_cmd->value, msh); ambiguous_redirect(cur_cmd->value, msh);
return ;
}
filename = parse_tokens(cur_cmd->value, msh->env); filename = parse_tokens(cur_cmd->value, msh->env);
if (!filename) if (!filename)
ft_exit(msh, 1); ft_exit(msh, 1);

View File

@ -6,7 +6,7 @@
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */ /* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/02/09 15:24:36 by tomoron #+# #+# */ /* Created: 2024/02/09 15:24:36 by tomoron #+# #+# */
/* Updated: 2024/05/04 14:11:54 by tomoron ### ########.fr */ /* Updated: 2024/05/05 20:36:59 by tomoron ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -29,9 +29,15 @@ int get_var_len(char **command, t_env *env)
(*command)++; (*command)++;
if (**command == '\'' || **command == '"') if (**command == '\'' || **command == '"')
return(0); {
(*command)--;
return (0);
}
if (!**command) if (!**command)
{
(*command)--;
return (1); return (1);
}
if (!ft_isalnum(**command) && **command != '_' && **command != '?') if (!ft_isalnum(**command) && **command != '_' && **command != '?')
return (2); return (2);
if (**command == '?') if (**command == '?')