diff --git a/.gitignore b/.gitignore index df504bc..ab4ff83 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,14 @@ +# File +minishell + # Build path -build/ +/build + +# Libraries path +/lib + +# VSCode +/.vscode # Prerequisites *.d diff --git a/Makefile b/Makefile index fe5a4e3..cb676af 100644 --- a/Makefile +++ b/Makefile @@ -6,14 +6,14 @@ # By: sede-san make DEBUG=1 DFLAGS = -g3 @@ -58,7 +58,7 @@ SRC_PATH = src # Source files SRC = \ - + $(SRC_PATH)/minishell.c # Include path INCLUDE_PATH = ./include @@ -118,12 +118,12 @@ re: fclean all # Compile libraries lib: @$(MAKE) libft - @$(MAKE) ft_printf +# @$(MAKE) ft_printf @$(MAKE) get_next_line .PHONY: lib # Compile file with libraries -# LIBS = $(GNL_BIN) $(LIBFT_BIN) $(PRINTF_BIN) +LIBS = -lreadline $(GNL_BIN) $(LIBFT_BIN) # $(PRINTF_BIN) # Libraries path LIB_PATH = lib @@ -189,6 +189,7 @@ get_next_line: echo "$(YELLOW)$(EMOJI_WRENCH) Cloning $(GNL)...$(RESET)"; \ git clone $(GNL_REPO) $(GNL_PATH); \ rm -rf $(GNL_PATH)/.git; \ + rm -rf $(GNL_PATH)/tests; \ echo "$(GREEN)$(EMOJI_CHECK) $(GNL) cloned...$(RESET)"; \ fi @if [ ! -f $(GNL_BIN) ]; then \ diff --git a/include/minishell.h b/include/minishell.h new file mode 100644 index 0000000..e1a799a --- /dev/null +++ b/include/minishell.h @@ -0,0 +1,38 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* minishell.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: sede-san +# include +# include +# include + +# define HISTORY_FILE "/.minishell_history" + +typedef struct s_env +{ + char *home; + char **path; +} t_env; + +typedef struct s_minishell +{ + char *prompt; + char *history_file; + t_env env; +} t_minishell; + +#endif diff --git a/src/minishell.c b/src/minishell.c new file mode 100644 index 0000000..43b688e --- /dev/null +++ b/src/minishell.c @@ -0,0 +1,103 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* minishell.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: sede-san "RESET; + minishell.env.home = getenv("HOME"); + minishell.history_file = ft_strjoin(minishell.env.home, HISTORY_FILE); + minishell.env.path = ft_split(getenv("PATH"), ':'); + return (minishell); +}