AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

This commit is contained in:
2024-04-26 14:46:08 +02:00
parent f3d01b28f0
commit 744ab7728d
7 changed files with 13 additions and 16 deletions

View File

@ -6,7 +6,7 @@
/* By: tomoron <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/24 14:50:15 by tomoron #+# #+# */
/* Updated: 2024/04/25 13:50:46 by tomoron ### ########.fr */
/* Updated: 2024/04/26 14:39:48 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
@ -32,7 +32,7 @@ int check_parens_syntax(t_cmd *cmd, t_cmd *last, t_env *env)
}
tmp = check_cmds_syntax(parsed_cmd, env);
if (tmp)
print_syntax_error_bonus(tmp);
print_syntax_error_bonus(tmp, 0);
free_cmd(parsed_cmd);
return (tmp == 0);
}

View File

@ -6,14 +6,15 @@
/* By: tomoron <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/24 14:54:53 by tomoron #+# #+# */
/* Updated: 2024/04/25 13:51:03 by tomoron ### ########.fr */
/* Updated: 2024/04/26 14:41:58 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
void print_syntax_error_bonus(t_cmd *cmd)
void print_syntax_error_bonus(t_cmd *cmd,t_cmd *cmds)
{
free_cmd(cmds);
if (cmd->cmd_type == CMD || cmd->cmd_type == PAREN)
return ;
ft_printf_fd(2, "minishell : syntax error near unexpected token `");

View File

@ -6,7 +6,7 @@
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/28 13:50:14 by tomoron #+# #+# */
/* Updated: 2024/04/26 13:14:42 by marde-vr ### ########.fr */
/* Updated: 2024/04/26 14:37:53 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
@ -20,11 +20,11 @@ void exec_command_bonus(t_msh *msh, char *cmd_str)
if (!cmd_str)
return ;
cmds = parsing_bonus(cmd_str);
free(cmd_str);
tmp = check_cmds_syntax(cmds, msh->env);
if (tmp)
{
print_syntax_error_bonus(tmp);
free_cmd(cmds);
print_syntax_error_bonus(tmp, cmds);
return ;
}
msh->cmds_head = cmds;

View File

@ -6,7 +6,7 @@
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/02/02 21:59:20 by tomoron #+# #+# */
/* Updated: 2024/04/26 11:08:22 by tomoron ### ########.fr */
/* Updated: 2024/04/26 14:22:59 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
@ -128,7 +128,6 @@ int main(int argc, char **argv, char **envp)
free(prompt);
add_history(commands);
exec_command_bonus(msh, commands);
free(commands);
}
printf("exit\n");
ft_exit(msh, g_return_code);

View File

@ -6,7 +6,7 @@
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/02/04 17:31:38 by tomoron #+# #+# */
/* Updated: 2024/04/25 18:54:09 by marde-vr ### ########.fr */
/* Updated: 2024/04/26 14:41:02 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
@ -103,7 +103,7 @@ void handle_here_doc(t_msh *msh, char *eof);
int get_in_type(t_msh *msh, t_cmd *t_strt, t_cmd *tokens, int here_doc);
void signal_handler_interactive(int signum);
int get_token_len(char *cmd, t_env *env);
void print_syntax_error_bonus(t_cmd *cmd);
void print_syntax_error_bonus(t_cmd *cmd, t_cmd *cmds);
void signal_handler_here_doc(int signum);
t_token *parsing_syntax_error(t_token *res);
int file_access(t_msh *msh, int *found);
@ -125,14 +125,12 @@ void ft_exit(t_msh *msh, int exit_code);
char **split_paths_from_env(t_env *env);
int add_return_code_to_str(char *res);
void parse_var(t_msh *msh, char *line);
void print_parsed_token(t_token *cmd);//debug
int get_var_name_len(char *command);
void handle_minishellrc(t_msh *msh);
t_cmd *check_cmds_syntax(t_cmd *cmds, t_env *env);
char *get_tmp_file_name(t_msh *msh);
int get_args_count(t_token *cmds);
char **env_to_char_tab(t_env *env);
void print_parsed_cmd(t_cmd *cmd);//debug
int first_is_in_type(t_cmd *cmd);
void print_msh_struct(t_msh *msh);
int contains_newline(char *str);

View File

@ -6,7 +6,7 @@
/* By: tomoron <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/27 14:40:44 by tomoron #+# #+# */
/* Updated: 2024/04/24 14:53:19 by tomoron ### ########.fr */
/* Updated: 2024/04/26 14:32:51 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */

View File

@ -6,7 +6,7 @@
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/05 18:17:25 by marde-vr #+# #+# */
/* Updated: 2024/04/26 10:49:45 by marde-vr ### ########.fr */
/* Updated: 2024/04/26 14:43:52 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
@ -50,7 +50,6 @@ void handle_parenthesis(t_msh *msh)
msh->out_fd = 0;
msh->locked_return_code = 0;
exec_command_bonus(msh, command);
free(command);
ft_exit(msh, g_return_code);
}