commit 93de7422bfc300941c83077ca0690f9d3310d933 Author: LuckyLaszlo Date: Sun Oct 3 19:17:19 2021 +0200 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b2e009d --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +.DS_Store +*.o +*.swp +*.out +*.exe +*.stackdump +*.a +*.so +*.dSYM +.vscode +*.lnk +memo +memo.txt +minishell +*.zip diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..ad4e307 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "libft"] + path = libft + url = https://github.com/LuckyLaszlo/libft diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7292a93 --- /dev/null +++ b/Makefile @@ -0,0 +1,63 @@ +NAME = minishell + +CC = clang + +CFLAGS = -Wall -Wextra -Werror $(INCLUDES) -g + +VPATH = $(DIR_SRCS) +DIR_SRCS = src + +INCLUDES = -I$(HEADERS_D) -I$(LIBFT_D) + +HEADERS_D = ./header +HEADERS = minishell.h + +LIBS = -L $(LIBFT_D) -lft \ + -lreadline + +LIBFT_D = ./libft +LIBFT = $(LIBFT_D)/libft.a + +SRCS = main.c + +DIR_OBJS = builds +OBJS = $(SRCS:%.c=$(DIR_OBJS)/%.o) + +# -------------------- +# ------ RULES ------- +# -------------------- + +all: subsystem $(NAME) + +subsystem: + @cd $(LIBFT_D) && $(MAKE) + +$(LIBFT): # dispensable. utile seulement pour un appel direct à $(NAME), si $(LIBFT) n'existe pas + cd $(LIBFT_D) && $(MAKE) + +$(DIR_OBJS)/%.o: %.c | $(DIR_OBJS) + $(CC) $(CFLAGS) -c $< -o $@ + +$(DIR_OBJS): + mkdir $@ + +$(OBJS): $(HEADERS:%=$(HEADERS_D)/%) + +$(NAME): $(OBJS) $(LIBFT) + $(CC) $(OBJS) -o $(NAME) $(LIBS) + +clean: + rm -f $(OBJS) + +fclean: clean + rm -f $(NAME) + +re: fclean all + +valgrind: $(NAME) + valgrind --leak-check=full --leak-resolution=low --show-reachable=yes ./$(NAME) + +run: $(NAME) + ./$(NAME) + +.PHONY : all clean fclean re bonus subsystem run valgrind diff --git a/header/minishell.h b/header/minishell.h new file mode 100644 index 0000000..505b001 --- /dev/null +++ b/header/minishell.h @@ -0,0 +1,69 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* minishell.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: lperrey +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2021/10/03 19:14:46 by lperrey #+# #+# */ +/* Updated: 2021/10/03 19:14:49 by lperrey ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#ifndef MINISHELL_H +# define MINISHELL_H +# include "libft.h" +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include + +# include +# include // sudo apt install libreadline-dev +# include + +/* +** : printf(), perror(), readline() +** : access(), unlink() +** : sigaction() +** , +** , +** lib readline (-lreadline), +** readline(), rl_clear_history(), rl_on_new_line(), +** rl_replace_line(), rl_redisplay(), add_history() +** ------------------ +** : open() +** : read(), write(), close(), fork(), getcwd(), chdir(), +** stat(), lstat(), fstat(), execve(), dup(), dup2(), pipe(), +** isatty(), ttyname(), ttyslot(), ioctl(), +** tcsetattr(), tcgetattr() +** : malloc(), free(), exit(), getenv() +** : strerror(), define NULL, define size_t +** : define errno +** : wait(), waitpid() +** , +** : wait3(), wait4() +** : signal(), kill() +** : opendir(), readdir(), closedir() +** : tcsetattr(), tcgetattr() +** , +** : tgetent(), tgetflag(), tgetnum(), +** tgetstr(), tgoto(), tputs() +** ------------------ +** : open(), stat(), lstat(), fstat() +** : open(), wait(), waitpid(), wait3(), wait4(), kill() +** stat(), lstat(), fstat(), opendir(), closedir() +*/ + +#endif diff --git a/libft b/libft new file mode 160000 index 0000000..1401fdd --- /dev/null +++ b/libft @@ -0,0 +1 @@ +Subproject commit 1401fddfcd177d8794d41a8c7dd3b806bbb5057f diff --git a/minishell.en.subject.pdf b/minishell.en.subject.pdf new file mode 100644 index 0000000..a36d0b2 Binary files /dev/null and b/minishell.en.subject.pdf differ diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..9fcf432 --- /dev/null +++ b/src/main.c @@ -0,0 +1,7 @@ + +#include "minishell.h" + +int main(void) +{ + return (0); +}