aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile11
-rw-r--r--include/ast.h4
-rw-r--r--include/parse.h4
m---------libft0
-rw-r--r--src/env.c3
-rw-r--r--src/eval/eval.c5
-rw-r--r--src/lexer/main.c24
-rw-r--r--src/parse/lexer.c37
-rw-r--r--src/parse/parse.c4
9 files changed, 50 insertions, 42 deletions
diff --git a/Makefile b/Makefile
index f3bfbd5..d726b69 100644
--- a/Makefile
+++ b/Makefile
@@ -6,12 +6,13 @@
# By: cacharle <marvin@42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# 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 <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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 <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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
-Subproject 3a2d19df9e509d0b015c786eb02f8315ff0ad91
+Subproject 8b8b8b8a35524f0ee73ac74c947a325ea54b288
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 <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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 <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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\"<<AUTHORS; echo && ; salut;\"echo\"\"* login_x\"");
- //out = lexer("echo * login_x << AUTHORS&&cd Desktop");
- while(out[++i])
- printf("%s\n", out[i]);;
- exit(0);
- return (0);
-}
+/* int main(void) */
+/* { */
+/* char **out; */
+/* int i = -1; */
+/* */
+/* out = lexer("\"echo\" \"* login_x\"<<AUTHORS; echo && ; salut;\"echo\"\"* login_x\""); */
+/* //out = lexer("echo * login_x << AUTHORS&&cd Desktop"); */
+/* while(out[++i]) */
+/* printf("%s\n", out[i]);; */
+/* exit(0); */
+/* return (0); */
+/* } */
diff --git a/src/parse/lexer.c b/src/parse/lexer.c
index 584ecd7..2aa8a6f 100644
--- a/src/parse/lexer.c
+++ b/src/parse/lexer.c
@@ -5,23 +5,22 @@
#include "minishell.h"
-static char **lex_len(char *input)
-{
- int i;
+/* static char **lex_len(char *input) */
+/* { */
+/* int i; */
+/* */
+/* i = 0; */
+/* while(input[i] != '\0') */
+/* { */
+/* lex_comp_cmd(input); */
+/* i++; */
+/* } */
+/* } */
- i = 0;
- while(input[i] != '\0')
- {
- lex_comp_cmd(input);
- i++;
- }
-}
-
-char **lexer(char *input)
-{
- (void)out_lex;
- if (!input)
- return (NULL);
- lex_len(input);
- return (NULL);
-}
+/* char **lexer(char *input) */
+/* { */
+/* if (!input) */
+/* return (NULL); */
+/* lex_len(input); */
+/* return (NULL); */
+/* } */
diff --git a/src/parse/parse.c b/src/parse/parse.c
index 3aa2a30..4c8d279 100644
--- a/src/parse/parse.c
+++ b/src/parse/parse.c
@@ -7,8 +7,10 @@
t_ast *parse(char **input)
{
+ int i = 0;
+
while (input[i] != '\0')
{
-
+
}
}