This commit is contained in:
2024-04-25 13:52:01 +02:00
4 changed files with 8 additions and 7 deletions

View File

@ -6,7 +6,7 @@
/* By: tomoron <marvin@42.fr> +#+ +:+ +#+ */ /* By: tomoron <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/24 14:50:15 by tomoron #+# #+# */ /* Created: 2024/04/24 14:50:15 by tomoron #+# #+# */
/* Updated: 2024/04/25 13:15:19 by tomoron ### ########.fr */ /* Updated: 2024/04/25 13:50:46 by tomoron ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -113,8 +113,8 @@ int check_str_syntax(char *cmd)
} }
if (in_quote || in_dquote || parenthesis) if (in_quote || in_dquote || parenthesis)
{ {
g_return_code = 2;
ft_putstr_fd("minishell: syntax error\n", 2); ft_putstr_fd("minishell: syntax error\n", 2);
g_return_code = 2;
} }
return (!(in_quote || in_dquote || parenthesis)); return (!(in_quote || in_dquote || parenthesis));
} }

View File

@ -6,7 +6,7 @@
/* By: tomoron <marvin@42.fr> +#+ +:+ +#+ */ /* By: tomoron <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/24 14:54:53 by tomoron #+# #+# */ /* Created: 2024/04/24 14:54:53 by tomoron #+# #+# */
/* Updated: 2024/04/25 13:15:00 by tomoron ### ########.fr */ /* Updated: 2024/04/25 13:51:03 by tomoron ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -37,6 +37,7 @@ int check_tokens_syntax(t_cmd *cmd, t_cmd *last, t_env *env)
{ {
g_return_code = 2; g_return_code = 2;
ft_putstr_fd("minishell : syntax error\n", 2); ft_putstr_fd("minishell : syntax error\n", 2);
g_return_code = 2;
return (0); return (0);
} }
token = parse_cmds_to_token(cmd, env); token = parse_cmds_to_token(cmd, env);

View File

@ -6,7 +6,7 @@
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */ /* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/02/07 16:04:11 by tomoron #+# #+# */ /* Created: 2024/02/07 16:04:11 by tomoron #+# #+# */
/* Updated: 2024/04/25 13:26:35 by tomoron ### ########.fr */ /* Updated: 2024/04/25 13:51:19 by tomoron ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -25,7 +25,7 @@ void get_exit_bt_return_code(t_msh *msh, int *exit_code)
t_token *cur_cmd; t_token *cur_cmd;
cur_cmd = msh->tokens->next; cur_cmd = msh->tokens->next;
if (cur_cmd && !ft_strisnbr(cur_cmd->value)) if (cur_cmd && (!ft_strisnbr(cur_cmd->value) || ft_strlen(cur_cmd->value) > 18))
numeric_arg_err(cur_cmd->value, exit_code); numeric_arg_err(cur_cmd->value, exit_code);
else if (cur_cmd) else if (cur_cmd)
*exit_code = (unsigned char)ft_atoi(cur_cmd->value); *exit_code = (unsigned char)ft_atoi(cur_cmd->value);

View File

@ -6,7 +6,7 @@
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */ /* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/27 17:19:27 by tomoron #+# #+# */ /* Created: 2024/03/27 17:19:27 by tomoron #+# #+# */
/* Updated: 2024/04/25 13:13:55 by tomoron ### ########.fr */ /* Updated: 2024/04/25 13:51:44 by tomoron ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -16,7 +16,7 @@ t_token *parsing_syntax_error(t_token *res)
{ {
free_token(res); free_token(res);
ft_putstr_fd("minishell: syntax error\n", 2); ft_putstr_fd("minishell: syntax error\n", 2);
g_return_code = 0; g_return_code = 2;
return ((void *)1); return ((void *)1);
} }