From 9b95a771df64f192f107d4d905804d34b5ad47eb Mon Sep 17 00:00:00 2001 From: Thomas Chobert Date: Tue, 10 Dec 2024 16:48:10 +0100 Subject: [PATCH 1/3] test_prompt_interactions --- Makefile | 6 +++++- includes/minishell.h | 14 +++++++++++--- srcs/main.c | 11 ++++++++--- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 3483478..b91817a 100644 --- a/Makefile +++ b/Makefile @@ -39,6 +39,10 @@ ifeq ($(sanitize), true) CFLAGS += -fsanitize=address,undefined -g3 endif +### RL_FLAG #################################################################### + +RL_FLAG := -lreadline + ### COLORS ##################################################################### GREEN := \033[0;32m @@ -70,7 +74,7 @@ all: $(NAME) $(NAME): $(LIBFT) $(OBJS) @echo "$(BLUE)Compiling $(NAME)...$(WHITE)" - @$(CC) $(CFLAGS) $(OBJS) -o $(NAME) $(LIBFT) -I $(PATH_INCLUDES) -I $(PATH_INCLUDES_LIBFT) + @$(CC) $(CFLAGS) $(OBJS) -o $(NAME) $(LIBFT) -I $(PATH_INCLUDES) -I $(PATH_INCLUDES_LIBFT) $(RL_FLAG) @echo "$(GREEN)$(NAME) Compiled !$(WHITE)" $(OBJS): $(PATH_OBJS)%.o: %.c $(HEADERS) diff --git a/includes/minishell.h b/includes/minishell.h index ff84826..1c1b402 100644 --- a/includes/minishell.h +++ b/includes/minishell.h @@ -3,18 +3,26 @@ /* ::: :::::::: */ /* minishell.h :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: hucherea +#+ +:+ +#+ */ +/* By: tchobert +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/12/09 16:11:56 by hucherea #+# #+# */ -/* Updated: 2024/12/10 11:08:32 by hucherea ### ########.fr */ +/* Updated: 2024/12/10 16:41:31 by tchobert ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef MINISHELL_H # define MINISHELL_H +// INCLUDES + +# include # include +# include +# include + +// DEFINES -# define LOOP 1 +# define MSH_LOOP 1 +# define MSH_PROMPT "SDF$> " #endif diff --git a/srcs/main.c b/srcs/main.c index ef1410b..81a1176 100644 --- a/srcs/main.c +++ b/srcs/main.c @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* main.c :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: hucherea +#+ +:+ +#+ */ +/* By: tchobert +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/12/09 16:11:39 by hucherea #+# #+# */ -/* Updated: 2024/12/10 10:39:56 by hucherea ### ########.fr */ +/* Updated: 2024/12/10 16:47:37 by tchobert ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,8 +14,13 @@ static int core_routine(void) { - while (LOOP) + char *user_input_line; + + user_input_line = NULL; + while (MSH_LOOP) { + user_input_line = readline(MSH_PROMPT); + free(user_input_line); } return (EXIT_SUCCESS); } From 34fd0e3ce0eef12d6eaaa3775ea2363e0a99024f Mon Sep 17 00:00:00 2001 From: Thomas Chobert Date: Tue, 10 Dec 2024 16:59:22 +0100 Subject: [PATCH 2/3] essai_MAJ_main --- libft | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libft b/libft index b9b6b98..58e1e5c 160000 --- a/libft +++ b/libft @@ -1 +1 @@ -Subproject commit b9b6b98192a0fd4fd14ca2c7a2e085d20ce97e74 +Subproject commit 58e1e5c9c03810a76ac1309fd63443136eb4d0ca From 5ee841592db103a230894c07bbd623707c9c43f8 Mon Sep 17 00:00:00 2001 From: Hugo Chereau Date: Tue, 10 Dec 2024 17:21:28 +0100 Subject: [PATCH 3/3] test --- libft | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libft b/libft index 58e1e5c..b9b6b98 160000 --- a/libft +++ b/libft @@ -1 +1 @@ -Subproject commit 58e1e5c9c03810a76ac1309fd63443136eb4d0ca +Subproject commit b9b6b98192a0fd4fd14ca2c7a2e085d20ce97e74