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); }