Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ ifeq ($(sanitize), true)
CFLAGS += -fsanitize=address,undefined -g3
endif

### READLINE FLAGS ##############################################################

RDL_FLAGS += -lreadline

### COLORS #####################################################################

GREEN := \033[0;32m
Expand Down Expand Up @@ -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) $(RDL_FLAGS) $(OBJS) -o $(NAME) $(LIBFT) -I $(PATH_INCLUDES) -I $(PATH_INCLUDES_LIBFT)
@echo "$(GREEN)$(NAME) Compiled !$(WHITE)"

$(OBJS): $(PATH_OBJS)%.o: %.c $(HEADERS)
Expand Down
18 changes: 18 additions & 0 deletions e2e/edit_text_in_prompt/edit_text_in_prompt.test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import pexpect

# Lancer Minishell
child = pexpect.spawn('./minishell')

# Vérifier que le prompt s'affiche
child.expect("SDF> ")

# Envoyer une commande
child.sendline("echo Hello World")

# Lire la sortie et vérifier
child.expect("Hello World")
print("Test passed: 'echo Hello World' executed correctly.")

# Quitter le shell
child.sendcontrol('d')
child.expect(pexpect.EOF)
16 changes: 13 additions & 3 deletions includes/minishell.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,28 @@
/* ::: :::::::: */
/* minishell.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hucherea <hucherea@student.42.fr> +#+ +:+ +#+ */
/* By: tchobert <tchobert@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/12/09 16:11:56 by hucherea #+# #+# */
/* Updated: 2024/12/10 11:08:32 by hucherea ### ########.fr */
/* Updated: 2024/12/10 14:32:57 by tchobert ### ########.fr */
/* */
/* ************************************************************************** */

#ifndef MINISHELL_H
# define MINISHELL_H

// INCLUDES //

# include "libft.h"

# include <stdlib.h>
# include <stdio.h>
# include <readline/readline.h>
//# include <readline/history.h>

// DEFINES //

# define LOOP 1
# define MSH_LOOP 1
# define MSH_PROMPT "SDF$> "

#endif
11 changes: 8 additions & 3 deletions srcs/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,24 @@
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hucherea <hucherea@student.42.fr> +#+ +:+ +#+ */
/* By: tchobert <tchobert@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/12/09 16:11:39 by hucherea #+# #+# */
/* Updated: 2024/12/10 10:39:56 by hucherea ### ########.fr */
/* Updated: 2024/12/10 14:32:35 by tchobert ### ########.fr */
/* */
/* ************************************************************************** */

#include "minishell.h"

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);
}
Expand Down
Loading