diff --git a/include/minishell.h b/include/minishell.h index 11b7bf7..d76c2a0 100644 --- a/include/minishell.h +++ b/include/minishell.h @@ -6,7 +6,7 @@ /* By: sede-san // tgetent(3), tgetflag(3), tgetnum(3), // tgetstr(3), tgoto(3), tputs(3) +/******************************************************************************/ +/* Structures & Data Types */ +/******************************************************************************/ + +typedef struct s_minishell t_minishell; + +typedef struct s_minishell +{ + char **env; + u_int8_t exit_status; +} t_minishell; + +/* core/minishell.c */ + +extern int minishell_init(struct s_minishell *minishell, char **envp); + +extern u_int8_t minishell_run(struct s_minishell *minishell); + +extern void minishell_clear(struct s_minishell *minishell); + #endif /* MINISHELL_H */ diff --git a/src/.gitkeep b/src/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/src/core/minishell.c b/src/core/minishell.c new file mode 100644 index 0000000..2139aa6 --- /dev/null +++ b/src/core/minishell.c @@ -0,0 +1,45 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* minishell.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: sede-san env = envp; + return (1); +} + +u_int8_t minishell_run( + t_minishell *minishell +){ + char *line; + + while (1) + { + line = readline("minishell > "); + if (!ft_strcmp(line, "exit")) + break ; + printf("%s\n", line); + free(line); + } + free(line); + return (minishell->exit_status); +} + +void minishell_clear( + t_minishell *minishell +){ + ft_bzero(minishell, sizeof(t_minishell)); +} diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..175ac78 --- /dev/null +++ b/src/main.c @@ -0,0 +1,36 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: sede-san