update: minishell execution is now dependant on minishell.exit

This commit is contained in:
2025-10-30 22:39:22 +01:00
parent 8194a1d8d8
commit 5fc0af6bb3
2 changed files with 12 additions and 14 deletions

View File

@@ -6,7 +6,7 @@
/* By: sede-san <sede-san@student.42madrid.com +#+ +:+ +#+ */ /* By: sede-san <sede-san@student.42madrid.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/10/22 19:10:13 by sede-san #+# #+# */ /* Created: 2025/10/22 19:10:13 by sede-san #+# #+# */
/* Updated: 2025/10/30 12:46:15 by sede-san ### ########.fr */ /* Updated: 2025/10/30 16:05:48 by sede-san ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -50,6 +50,7 @@ typedef struct s_minishell
{ {
t_variables variables; t_variables variables;
u_int8_t exit_status; u_int8_t exit_status;
u_int8_t exit;
} t_minishell; } t_minishell;
/** /**

View File

@@ -6,7 +6,7 @@
/* By: sede-san <sede-san@student.42madrid.com +#+ +:+ +#+ */ /* By: sede-san <sede-san@student.42madrid.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/10/20 20:51:33 by sede-san #+# #+# */ /* Created: 2025/10/20 20:51:33 by sede-san #+# #+# */
/* Updated: 2025/10/23 14:14:30 by sede-san ### ########.fr */ /* Updated: 2025/10/30 22:36:03 by sede-san ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -24,24 +24,21 @@ int minishell_init(
u_int8_t minishell_run( u_int8_t minishell_run(
t_minishell *minishell t_minishell *minishell
){ ){
char *line; char *line;
t_command command;
while (1) line = NULL;
while (!minishell->exit)
{ {
line = readline("minishell > "); line = readline("minishell > ");
if (!*line) if (*line)
{ {
free(line); add_history(line);
continue ; command = parse(line, minishell);
execute(command, minishell);
} }
add_history(line); ft_free((void **)&line);
parse(line, minishell);
if (!ft_strcmp(line, "exit"))
break ;
// printf("%s\n", line);
free(line);
} }
free(line);
return (minishell->exit_status); return (minishell->exit_status);
} }