From 82f1e954590de21f6db9b1b6e3dba78a951bc319 Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 9 Jun 2020 10:59:59 +0200 Subject: Added make with multiple jobs and making merge compile --- Makefile | 11 ++++++++--- include/ast.h | 4 ++-- include/parse.h | 4 ++-- libft | 2 +- src/env.c | 3 ++- src/eval/eval.c | 5 +++-- src/lexer/main.c | 24 ++++++++++++------------ src/parse/lexer.c | 37 ++++++++++++++++++------------------- src/parse/parse.c | 4 +++- 9 files changed, 51 insertions(+), 43 deletions(-) diff --git a/Makefile b/Makefile index f3bfbd5..d726b69 100644 --- a/Makefile +++ b/Makefile @@ -6,12 +6,13 @@ # By: cacharle +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/02/03 04:14:24 by cacharle #+# #+# # -# Updated: 2020/04/03 13:50:17 by charles ### ########.fr # +# Updated: 2020/06/09 10:51:41 by charles ### ########.fr # # # # **************************************************************************** # RM = rm -f -MAKE = make +MAKE = make --no-print-directory +JOBS = 4 DOXYGEN = doxygen DOXYGEN_FILE = Doxyfile DOC_DIR = doc @@ -37,7 +38,11 @@ LDFLAGS = -L$(LIBFTDIR) -lft NAME = minishell .PHONY: all -all: libft_all prebuild $(NAME) +all: libft_all prebuild + @$(MAKE) -j$(JOBS) allnopre + +.PHONY: allnopre +allnopre: $(NAME) .PHONY: test test: diff --git a/include/ast.h b/include/ast.h index b725c8b..1dd28a1 100644 --- a/include/ast.h +++ b/include/ast.h @@ -6,7 +6,7 @@ /* By: charles +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/04/01 17:05:38 by charles #+# #+# */ -/* Updated: 2020/05/04 11:59:43 by charles ### ########.fr */ +/* Updated: 2020/05/14 23:54:46 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -98,7 +98,7 @@ typedef struct s_ast { t_line line; t_cmd cmd; - } ; + }; } t_ast; t_ast *ast_new(t_ast_tag tag, void *data); diff --git a/include/parse.h b/include/parse.h index bc86230..e864f9a 100644 --- a/include/parse.h +++ b/include/parse.h @@ -6,7 +6,7 @@ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/28 09:00:00 by cacharle #+# #+# */ -/* Updated: 2020/04/01 17:49:45 by charles ### ########.fr */ +/* Updated: 2020/06/09 10:55:09 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -43,6 +43,6 @@ char **lexer(char *input); ** parse.c */ -t_ast *parse(char *input); +t_ast *parse(char **input); #endif diff --git a/libft b/libft index 3a2d19d..8b8b8b8 160000 --- a/libft +++ b/libft @@ -1 +1 @@ -Subproject commit 3a2d19df9e509d0b015c786eb02f8315ff0ad91c +Subproject commit 8b8b8b8a35524f0ee73ac74c947a325ea54b2880 diff --git a/src/env.c b/src/env.c index 41aca6d..fcee163 100644 --- a/src/env.c +++ b/src/env.c @@ -6,7 +6,7 @@ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/28 09:21:24 by cacharle #+# #+# */ -/* Updated: 2020/04/05 14:42:38 by charles ### ########.fr */ +/* Updated: 2020/05/08 13:48:40 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -75,6 +75,7 @@ char *env_search_first_match(t_env env, const char *haystack) len = 0; while (ft_isalnum(haystack[len]) || haystack[len] == '_') len++; + i = 0; while (i < env->size) { if (ft_strncmp((char*)env->data[i], haystack, len) == 0) diff --git a/src/eval/eval.c b/src/eval/eval.c index 0270024..c4df1c9 100644 --- a/src/eval/eval.c +++ b/src/eval/eval.c @@ -6,7 +6,7 @@ /* By: charles +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/04/01 17:05:21 by charles #+# #+# */ -/* Updated: 2020/05/04 12:00:38 by charles ### ########.fr */ +/* Updated: 2020/05/15 00:12:51 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -89,7 +89,7 @@ static int eval_cmd(int fd_in, int fd_out, t_eval_state *state, t_cmd *cmd) if (cmd->in != NULL && (fd_in = open(cmd->in, O_RDONLY)) == -1) return (-1); if (cmd->out != NULL && (fd_out = open(cmd->out, - (cmd->is_append ? O_APPEND : O_RDONLY) | O_CREAT)) == -1) + (cmd->is_append ? O_APPEND : O_WRONLY) | O_CREAT)) == -1) return (-1); param.argv = cmd->argv; param.envp = (char**)state->env->data; @@ -102,6 +102,7 @@ static int eval_cmd(int fd_in, int fd_out, t_eval_state *state, t_cmd *cmd) ** \param line Line to evaluate ** \return Last Executed command status or -1 on error */ + static int eval_line(void *param) { int status; diff --git a/src/lexer/main.c b/src/lexer/main.c index b660f55..b341e93 100644 --- a/src/lexer/main.c +++ b/src/lexer/main.c @@ -1,15 +1,15 @@ #include "lexer.h" -int main(void) -{ - char **out; - int i = -1; - - out = lexer("\"echo\" \"* login_x\"<