merged done
This commit is contained in:
commit
9e0c2bd906
38 changed files with 226 additions and 216 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
# By: wescande <wescande@student.42.fr> +#+ +:+ +#+ #
|
# By: wescande <wescande@student.42.fr> +#+ +:+ +#+ #
|
||||||
# +#+#+#+#+#+ +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2016/08/29 21:32:58 by wescande #+# #+# #
|
# Created: 2016/08/29 21:32:58 by wescande #+# #+# #
|
||||||
# Updated: 2017/03/03 20:06:37 by ariard ### ########.fr #
|
#* Updated: 2017/03/05 15:36:45 by wescande ### ########.fr *#
|
||||||
# #
|
# #
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
|
|
||||||
|
|
@ -95,6 +95,7 @@ exec/redirect_greatand.c\
|
||||||
exec/redirect_less.c\
|
exec/redirect_less.c\
|
||||||
exec/redirect_lessand.c\
|
exec/redirect_lessand.c\
|
||||||
exec/set_exitstatus.c\
|
exec/set_exitstatus.c\
|
||||||
|
exec/set_process.c\
|
||||||
glob/command_getoutput.c\
|
glob/command_getoutput.c\
|
||||||
glob/dir_glob.c\
|
glob/dir_glob.c\
|
||||||
glob/esc_print.c\
|
glob/esc_print.c\
|
||||||
|
|
@ -137,11 +138,11 @@ history/history_parsing_toolz.c\
|
||||||
history/history_parsing_toolz_2.c\
|
history/history_parsing_toolz_2.c\
|
||||||
history/list_toolz.c\
|
history/list_toolz.c\
|
||||||
history/surch_in_history.c\
|
history/surch_in_history.c\
|
||||||
job-control/add_new_job.c\
|
|
||||||
job-control/builtin_bg.c\
|
job-control/builtin_bg.c\
|
||||||
job-control/builtin_fg.c\
|
job-control/builtin_fg.c\
|
||||||
job-control/builtin_jobs.c\
|
job-control/builtin_jobs.c\
|
||||||
job-control/do_job_notification.c\
|
job-control/do_job_notification.c\
|
||||||
|
job-control/job_addprocess.c\
|
||||||
job-control/job_cmp_id.c\
|
job-control/job_cmp_id.c\
|
||||||
job-control/job_format.c\
|
job-control/job_format.c\
|
||||||
job-control/job_format_head.c\
|
job-control/job_format_head.c\
|
||||||
|
|
@ -178,7 +179,7 @@ lexer/lexer_assignement_word.c\
|
||||||
lexer/lexer_backslash.c\
|
lexer/lexer_backslash.c\
|
||||||
lexer/lexer_bquote.c\
|
lexer/lexer_bquote.c\
|
||||||
lexer/lexer_comment.c\
|
lexer/lexer_comment.c\
|
||||||
lexer/lexer_curly_brackets.c\
|
lexer/lexer_curly_braces.c\
|
||||||
lexer/lexer_default.c\
|
lexer/lexer_default.c\
|
||||||
lexer/lexer_delim.c\
|
lexer/lexer_delim.c\
|
||||||
lexer/lexer_dless.c\
|
lexer/lexer_dless.c\
|
||||||
|
|
@ -223,12 +224,12 @@ main/data_exit.c\
|
||||||
main/data_init.c\
|
main/data_init.c\
|
||||||
main/data_singleton.c\
|
main/data_singleton.c\
|
||||||
main/ft_putast.c\
|
main/ft_putast.c\
|
||||||
|
main/instruction_free.c\
|
||||||
main/main.c\
|
main/main.c\
|
||||||
main/shell_exit.c\
|
main/shell_exit.c\
|
||||||
main/shell_get_avdata.c\
|
main/shell_get_avdata.c\
|
||||||
main/shell_get_opts.c\
|
main/shell_get_opts.c\
|
||||||
main/shell_init.c\
|
main/shell_init.c\
|
||||||
main/instruction_free.c\
|
|
||||||
parser/add_case.c\
|
parser/add_case.c\
|
||||||
parser/add_cmd.c\
|
parser/add_cmd.c\
|
||||||
parser/add_condition.c\
|
parser/add_condition.c\
|
||||||
|
|
@ -259,13 +260,13 @@ all :
|
||||||
@make -j $(NAME)
|
@make -j $(NAME)
|
||||||
|
|
||||||
$(NAME): $(LIBFT_LIB) $(OBJ_DIR) $(OBJS)
|
$(NAME): $(LIBFT_LIB) $(OBJ_DIR) $(OBJS)
|
||||||
@$(CC) $(FLAGS) $(D_FLAGS) \
|
@$(CC) $(OBJS) -o $(NAME) \
|
||||||
-I $(INC_DIR) \
|
-I $(INC_DIR) \
|
||||||
-I $(LIBFT_INC) \
|
-I $(LIBFT_INC) \
|
||||||
$(LIBS) \
|
$(LIBS) \
|
||||||
$(LIBFT_LIB) $(OBJS) \
|
$(LIBFT_LIB) \
|
||||||
-o $(NAME)
|
$(FLAGS) $(D_FLAGS)
|
||||||
@printf "\r\e[48;5;15;38;5;25m✅ MAKE $(NAME)\e[0m\e[K\n"
|
@printf "\r\033[48;5;15;38;5;25m✅ MAKE $(NAME)\033[0m\033[K\n"
|
||||||
|
|
||||||
$(LIBFT_LIB):
|
$(LIBFT_LIB):
|
||||||
@make -C $(LIBFT_DIR)
|
@make -C $(LIBFT_DIR)
|
||||||
|
|
@ -279,7 +280,7 @@ $(OBJ_DIR)%.o : $(SRC_DIR)%.c | $(OBJ_DIR)
|
||||||
@$(eval PERCENT=$(shell echo $$(($(INDEX)*100/$(NB)))))
|
@$(eval PERCENT=$(shell echo $$(($(INDEX)*100/$(NB)))))
|
||||||
@$(eval COLOR=$(shell echo $$(($(PERCENT)%35+196))))
|
@$(eval COLOR=$(shell echo $$(($(PERCENT)%35+196))))
|
||||||
@$(eval TO_DO=$(shell echo $$((20-$(INDEX)*20/$(NB)))))
|
@$(eval TO_DO=$(shell echo $$((20-$(INDEX)*20/$(NB)))))
|
||||||
@printf "\r\e[38;5;11m⌛ MAKE %10.10s : %2d%% \e[48;5;%dm%*s\e[0m%*s\e[48;5;255m \e[0m \e[38;5;11m %*s\e[0m\e[K" $(NAME) $(PERCENT) $(COLOR) $(DONE) "" $(TO_DO) "" $(DELTA) "$@"
|
@printf "\r\033[38;5;11m⌛ MAKE %10.10s : %2d%% \033[48;5;%dm%*s\033[0m%*s\033[48;5;255m \033[0m \033[38;5;11m %*s\033[0m\033[K" $(NAME) $(PERCENT) $(COLOR) $(DONE) "" $(TO_DO) "" $(DELTA) "$@"
|
||||||
@$(CC) $(FLAGS) $(D_FLAGS) -MMD -c $< -o $@\
|
@$(CC) $(FLAGS) $(D_FLAGS) -MMD -c $< -o $@\
|
||||||
-I $(INC_DIR)\
|
-I $(INC_DIR)\
|
||||||
-I $(LIBFT_INC)
|
-I $(LIBFT_INC)
|
||||||
|
|
@ -287,14 +288,14 @@ $(OBJ_DIR)%.o : $(SRC_DIR)%.c | $(OBJ_DIR)
|
||||||
|
|
||||||
clean: cleanlib
|
clean: cleanlib
|
||||||
@rm -rf $(OBJ_DIR)
|
@rm -rf $(OBJ_DIR)
|
||||||
@printf "\r\e[38;5;202m✖ clean $(NAME).\e[0m\e[K\n"
|
@printf "\r\033[38;5;202m✖ clean $(NAME).\033[0m\033[K\n"
|
||||||
|
|
||||||
cleanlib:
|
cleanlib:
|
||||||
@make -C $(LIBFT_DIR) clean
|
@make -C $(LIBFT_DIR) clean
|
||||||
|
|
||||||
fclean: clean fcleanlib
|
fclean: clean fcleanlib
|
||||||
@rm -f $(NAME)
|
@rm -f $(NAME)
|
||||||
@printf "\r\e[38;5;196m❌ fclean $(NAME).\e[0m\e[K\n"
|
@printf "\r\033[38;5;196m❌ fclean $(NAME).\033[0m\033[K\n"
|
||||||
|
|
||||||
fcleanlib: cleanlib
|
fcleanlib: cleanlib
|
||||||
@make -C $(LIBFT_DIR) fclean
|
@make -C $(LIBFT_DIR) fclean
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/27 20:29:56 by jhalford #+# #+# */
|
/* Created: 2016/11/27 20:29:56 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/03 20:28:08 by wescande ### ########.fr */
|
/* Updated: 2017/03/05 15:19:44 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -41,7 +41,7 @@
|
||||||
# define EXEC_IS_BG(j) (j & EXEC_BG)
|
# define EXEC_IS_BG(j) (j & EXEC_BG)
|
||||||
# define EXEC_IS_FG(j) (!EXEC_IS_BG(j))
|
# define EXEC_IS_FG(j) (!EXEC_IS_BG(j))
|
||||||
# define EXEC_IS_AND_IF(j) (j & EXEC_AND_IF)
|
# define EXEC_IS_AND_IF(j) (j & EXEC_AND_IF)
|
||||||
# define EXEC_IS_OR_IF(j) (j & EXEC_JOB_OR_IF)
|
# define EXEC_IS_OR_IF(j) (j & EXEC_OR_IF)
|
||||||
# define EXEC_AOL_MASK (EXEC_AND_IF | EXEC_OR_IF)
|
# define EXEC_AOL_MASK (EXEC_AND_IF | EXEC_OR_IF)
|
||||||
|
|
||||||
# define EXEC_IS_IF_BRANCH(j) (j & EXEC_IF_BRANCH)
|
# define EXEC_IS_IF_BRANCH(j) (j & EXEC_IF_BRANCH)
|
||||||
|
|
@ -119,6 +119,7 @@ int exec_case(t_btree **ast);
|
||||||
int exec_case_branch(t_btree **ast);
|
int exec_case_branch(t_btree **ast);
|
||||||
|
|
||||||
int launch_process(t_process *p);
|
int launch_process(t_process *p);
|
||||||
|
int set_process(t_process *p, t_btree *ast);
|
||||||
int process_setexec(t_process *p);
|
int process_setexec(t_process *p);
|
||||||
int process_setgroup(t_process *p, pid_t pid);
|
int process_setgroup(t_process *p, pid_t pid);
|
||||||
void process_setsig(void);
|
void process_setsig(void);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/10 16:55:09 by jhalford #+# #+# */
|
/* Created: 2016/12/10 16:55:09 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/03 18:35:49 by jhalford ### ########.fr */
|
/* Updated: 2017/03/05 16:28:37 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/01 12:15:50 by jhalford #+# #+# */
|
/* Created: 2016/12/01 12:15:50 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/03 17:58:18 by jhalford ### ########.fr */
|
/* Updated: 2017/03/05 16:28:17 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -23,8 +23,8 @@
|
||||||
| TK_DO | TK_IF | TK_FI | TK_THEN | TK_ELIF | TK_ELSE)
|
| TK_DO | TK_IF | TK_FI | TK_THEN | TK_ELIF | TK_ELSE)
|
||||||
enum e_lexstate
|
enum e_lexstate
|
||||||
{
|
{
|
||||||
PAREN,
|
|
||||||
DEFAULT,
|
DEFAULT,
|
||||||
|
PAREN,
|
||||||
NEWLINE,
|
NEWLINE,
|
||||||
DELIM,
|
DELIM,
|
||||||
SEP,
|
SEP,
|
||||||
|
|
@ -111,7 +111,7 @@ int lexer_dquote(t_list **alst, t_lexer *lexer);
|
||||||
int lexer_bquote(t_list **alst, t_lexer *lexer);
|
int lexer_bquote(t_list **alst, t_lexer *lexer);
|
||||||
int lexer_backslash(t_list **alst, t_lexer *lexer);
|
int lexer_backslash(t_list **alst, t_lexer *lexer);
|
||||||
int lexer_paren(t_list **alst, t_lexer *lexer);
|
int lexer_paren(t_list **alst, t_lexer *lexer);
|
||||||
int lexer_curly_brackets(t_list **alst, t_lexer *lexer);
|
int lexer_curly_braces(t_list **alst, t_lexer *lexer);
|
||||||
int lexer_assignement_word(t_list **alst, t_lexer *lexer);
|
int lexer_assignement_word(t_list **alst, t_lexer *lexer);
|
||||||
int lexer_comment(t_list **alst, t_lexer *lexer);
|
int lexer_comment(t_list **alst, t_lexer *lexer);
|
||||||
int lexer_end(t_list **alst, t_lexer *lexer);
|
int lexer_end(t_list **alst, t_lexer *lexer);
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 318efc7cfb7b7cc9d3714fa19fd2be7382b6adec
|
Subproject commit 282df927230b2c6da253f8fc9d7ca0eedc0fe30c
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/01/27 18:25:22 by jhalford #+# #+# */
|
/* Created: 2017/01/27 18:25:22 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/01/27 19:40:14 by jhalford ### ########.fr */
|
/* Updated: 2017/03/05 15:28:10 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -30,11 +30,9 @@ int bt_read_parse(t_read *data, char **av)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
int k;
|
|
||||||
t_readopt *opt;
|
t_readopt *opt;
|
||||||
|
|
||||||
i = 1;
|
i = 1;
|
||||||
k = 0;
|
|
||||||
while (av[i])
|
while (av[i])
|
||||||
{
|
{
|
||||||
j = 0;
|
j = 0;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/05 11:50:51 by jhalford #+# #+# */
|
/* Created: 2016/12/05 11:50:51 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/05 16:24:52 by ariard ### ########.fr */
|
/* Updated: 2017/03/05 16:50:06 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -33,5 +33,4 @@ void ast_free(void *data, size_t content_size)
|
||||||
}
|
}
|
||||||
// if (node->type == WORDLIST)
|
// if (node->type == WORDLIST)
|
||||||
// do clear
|
// do clear
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/30 20:52:28 by jhalford #+# #+# */
|
/* Created: 2016/11/30 20:52:28 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/03 16:05:42 by jhalford ### ########.fr */
|
/* Updated: 2017/03/05 15:18:41 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -20,6 +20,7 @@ int exec_and_if(t_btree **ast)
|
||||||
exec = &data_singleton()->exec;
|
exec = &data_singleton()->exec;
|
||||||
push(&exec->op_stack, TK_AND_IF);
|
push(&exec->op_stack, TK_AND_IF);
|
||||||
ft_exec(&(*ast)->left);
|
ft_exec(&(*ast)->left);
|
||||||
|
exec->attrs &= ~EXEC_OR_IF;
|
||||||
exec->attrs |= EXEC_AND_IF;
|
exec->attrs |= EXEC_AND_IF;
|
||||||
ft_exec(&(*ast)->right);
|
ft_exec(&(*ast)->right);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/06 18:07:31 by ariard #+# #+# */
|
/* Created: 2017/02/06 18:07:31 by ariard #+# #+# */
|
||||||
/* Updated: 2017/03/04 18:18:29 by ariard ### ########.fr */
|
/* Updated: 2017/03/05 15:29:22 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -14,16 +14,17 @@
|
||||||
|
|
||||||
int exec_case(t_btree **ast)
|
int exec_case(t_btree **ast)
|
||||||
{
|
{
|
||||||
t_astnode *node;
|
// t_astnode *node;
|
||||||
/* char **av; */
|
/* char **av; */
|
||||||
t_exec *exec;
|
t_exec *exec;
|
||||||
|
|
||||||
|
(void)ast;
|
||||||
return (0);
|
return (0);
|
||||||
exec = &data_singleton()->exec;
|
exec = &data_singleton()->exec;
|
||||||
/* data_singleton()->exec.process.case_branch = 0; */
|
/* data_singleton()->exec.process.case_branch = 0; */
|
||||||
exec->attrs |= EXEC_CASE_BRANCH;
|
exec->attrs |= EXEC_CASE_BRANCH;
|
||||||
|
|
||||||
node = (*ast)->item;
|
// node = (*ast)->item;
|
||||||
/* av = token_to_argv(node); */
|
/* av = token_to_argv(node); */
|
||||||
/* data_singleton()->exec.process.case_pattern = av[0]; */
|
/* data_singleton()->exec.process.case_pattern = av[0]; */
|
||||||
/* exec->case_pattern = av[0]; */
|
/* exec->case_pattern = av[0]; */
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/06 18:07:31 by ariard #+# #+# */
|
/* Created: 2017/02/06 18:07:31 by ariard #+# #+# */
|
||||||
/* Updated: 2017/03/04 18:23:29 by ariard ### ########.fr */
|
/* Updated: 2017/03/05 15:29:46 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -14,16 +14,17 @@
|
||||||
|
|
||||||
int exec_case_branch(t_btree **ast)
|
int exec_case_branch(t_btree **ast)
|
||||||
{
|
{
|
||||||
t_astnode *node;
|
// t_astnode *node;
|
||||||
/* char **av; */
|
/* char **av; */
|
||||||
t_exec *exec;
|
t_exec *exec;
|
||||||
|
|
||||||
|
(void)ast;
|
||||||
return (0);
|
return (0);
|
||||||
exec = &data_singleton()->exec;
|
exec = &data_singleton()->exec;
|
||||||
/* if (data_singleton()->exec.process.case_branch == 1) */
|
/* if (data_singleton()->exec.process.case_branch == 1) */
|
||||||
if (EXEC_IS_CASE_BRANCH(exec->attrs))
|
if (EXEC_IS_CASE_BRANCH(exec->attrs))
|
||||||
return (0);
|
return (0);
|
||||||
node = (*ast)->item;
|
// node = (*ast)->item;
|
||||||
/* av = token_to_argv(node); */
|
/* av = token_to_argv(node); */
|
||||||
/* if (ft_strcmp(av[0], data_singleton()->exec.process.case_pattern) == 1) */
|
/* if (ft_strcmp(av[0], data_singleton()->exec.process.case_pattern) == 1) */
|
||||||
/* { */
|
/* { */
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/14 17:28:14 by jhalford #+# #+# */
|
/* Created: 2016/11/14 17:28:14 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/04 17:11:10 by ariard ### ########.fr */
|
/* Updated: 2017/03/05 15:42:36 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -37,51 +37,25 @@ char **token_to_argv(t_ld *ld, int do_match)
|
||||||
|
|
||||||
int exec_cmd(t_btree **ast)
|
int exec_cmd(t_btree **ast)
|
||||||
{
|
{
|
||||||
t_cmd *cmd;
|
|
||||||
t_job *job;
|
|
||||||
t_exec *exec;
|
|
||||||
t_process p;
|
t_process p;
|
||||||
int fds[2];
|
t_job *job;
|
||||||
int op;
|
|
||||||
|
|
||||||
cmd = &((t_astnode *)(*ast)->item)->data.cmd;
|
|
||||||
exec = &data_singleton()->exec;
|
|
||||||
job = &data_singleton()->exec.job;
|
job = &data_singleton()->exec.job;
|
||||||
process_reset(&p);
|
if (set_process(&p, *ast))
|
||||||
op = pop(&exec->op_stack);
|
|
||||||
fds[PIPE_WRITE] = STDOUT;
|
|
||||||
fds[PIPE_READ] = STDIN;
|
|
||||||
if (op == TK_AMP)
|
|
||||||
exec->attrs |= JOB_BG;
|
|
||||||
else if (op == TK_PIPE)
|
|
||||||
pipe(fds);
|
|
||||||
p.fdin = exec->fdin;
|
|
||||||
p.to_close = fds[PIPE_READ];
|
|
||||||
p.fdout = fds[PIPE_WRITE];
|
|
||||||
p.redirs = cmd->redir;
|
|
||||||
exec->fdin = fds[PIPE_READ];
|
|
||||||
if (IS_PIPESTART(p))
|
|
||||||
{
|
|
||||||
job->first_process = NULL;
|
|
||||||
job->attrs = EXEC_IS_FG(exec->attrs) ? 0 : JOB_BG;
|
|
||||||
}
|
|
||||||
if (!(p.av = token_to_argv(cmd->token, 1)))
|
|
||||||
return (1);
|
return (1);
|
||||||
process_setexec(&p);
|
|
||||||
if (!(launch_process(&p)))
|
if (!(launch_process(&p)))
|
||||||
ft_lstadd(&job->first_process, ft_lstnew(&p, sizeof(p)));
|
{
|
||||||
if (fds[PIPE_WRITE] != STDOUT)
|
job_addprocess(&p);
|
||||||
close(fds[PIPE_WRITE]);
|
|
||||||
if (IS_PIPEEND(p))
|
if (IS_PIPEEND(p))
|
||||||
{
|
{
|
||||||
add_new_job(job);
|
|
||||||
if (JOB_IS_FG(job->attrs))
|
if (JOB_IS_FG(job->attrs))
|
||||||
put_job_in_foreground(job, 0);
|
put_job_in_foreground(job, 0);
|
||||||
else
|
else
|
||||||
{
|
|
||||||
job_notify_new(job);
|
|
||||||
put_job_in_background(job, 0);
|
put_job_in_background(job, 0);
|
||||||
}
|
}
|
||||||
|
job->pgid = 0;
|
||||||
}
|
}
|
||||||
|
if (p.fdout != STDOUT)
|
||||||
|
close(p.fdout);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/06 18:07:31 by ariard #+# #+# */
|
/* Created: 2017/02/06 18:07:31 by ariard #+# #+# */
|
||||||
/* Updated: 2017/03/04 17:37:11 by ariard ### ########.fr */
|
/* Updated: 2017/03/05 15:12:28 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/30 21:06:17 by jhalford #+# #+# */
|
/* Created: 2016/11/30 21:06:17 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/03 16:07:35 by jhalford ### ########.fr */
|
/* Updated: 2017/03/05 15:18:49 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -20,7 +20,8 @@ int exec_or_if(t_btree **ast)
|
||||||
exec = &data_singleton()->exec;
|
exec = &data_singleton()->exec;
|
||||||
push(&exec->op_stack, TK_OR_IF);
|
push(&exec->op_stack, TK_OR_IF);
|
||||||
ft_exec(&(*ast)->left);
|
ft_exec(&(*ast)->left);
|
||||||
exec->attrs |= EXEC_OR_IF;
|
exec->attrs &= ~EXEC_AND_IF;
|
||||||
|
exec->attrs = EXEC_OR_IF;
|
||||||
ft_exec(&(*ast)->right);
|
ft_exec(&(*ast)->right);
|
||||||
|
|
||||||
/* data = data_singleton(); */
|
/* data = data_singleton(); */
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/13 14:20:45 by jhalford #+# #+# */
|
/* Created: 2016/12/13 14:20:45 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/03 19:53:26 by jhalford ### ########.fr */
|
/* Updated: 2017/03/05 16:32:22 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -14,22 +14,18 @@
|
||||||
|
|
||||||
int launch_process(t_process *p)
|
int launch_process(t_process *p)
|
||||||
{
|
{
|
||||||
t_exec *exec;
|
|
||||||
int pid;
|
int pid;
|
||||||
|
|
||||||
exec = &data_singleton()->exec;
|
/* DG("gonna launch [%s]", p->av[0]); */
|
||||||
DG("gonna launch [%s]", p->av[0]);
|
/* DG("fdin=[%i]", p->fdin); */
|
||||||
DG("fdin=[%i]", p->fdin);
|
/* DG("fdout=[%i]", p->fdout); */
|
||||||
DG("fdout=[%i]", p->fdout);
|
|
||||||
if (p->attributes & PROCESS_BUILTIN && IS_PIPESINGLE(*p))
|
if (p->attributes & PROCESS_BUILTIN && IS_PIPESINGLE(*p))
|
||||||
{
|
{
|
||||||
if (process_redirect(p))
|
if (process_redirect(p))
|
||||||
return (1);
|
return (1);
|
||||||
set_exitstatus((*p->execf)(p->path, p->av, data_singleton()->env), 1);
|
set_exitstatus((*p->execf)(p->path, p->av, data_singleton()->env), 1);
|
||||||
return (0);
|
return (1);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
p->attributes &= ~PROCESS_STATE_MASK;
|
p->attributes &= ~PROCESS_STATE_MASK;
|
||||||
p->attributes |= PROCESS_RUNNING;
|
p->attributes |= PROCESS_RUNNING;
|
||||||
if (p->attributes & (PROCESS_BINARY | PROCESS_SCRIPT)
|
if (p->attributes & (PROCESS_BINARY | PROCESS_SCRIPT)
|
||||||
|
|
@ -46,14 +42,14 @@ int launch_process(t_process *p)
|
||||||
{
|
{
|
||||||
ft_dprintf(2, "{red}%s: command not found: %s{eoc}\n", SHELL_NAME, p->av[0]);
|
ft_dprintf(2, "{red}%s: command not found: %s{eoc}\n", SHELL_NAME, p->av[0]);
|
||||||
exit(127);
|
exit(127);
|
||||||
/* set_exitstatus(127, 1); */
|
|
||||||
}
|
}
|
||||||
process_setgroup(p, 0);
|
process_setgroup(p, 0);
|
||||||
process_setsig();
|
process_setsig();
|
||||||
|
DG("gonna redirect");
|
||||||
if (process_redirect(p))
|
if (process_redirect(p))
|
||||||
exit (1);
|
exit (1);
|
||||||
(*p->execf)(p->path, p->av, data_singleton()->env);
|
(*p->execf)(p->path, p->av, data_singleton()->env);
|
||||||
exit(43);
|
ft_dprintf(2, "{red}%s: internal excve error{eoc}\n", SHELL_NAME);
|
||||||
}
|
}
|
||||||
else if (pid > 0)
|
else if (pid > 0)
|
||||||
{
|
{
|
||||||
|
|
@ -63,6 +59,5 @@ int launch_process(t_process *p)
|
||||||
}
|
}
|
||||||
else if (pid == -1)
|
else if (pid == -1)
|
||||||
ft_dprintf(2, "{red}%s: internal fork error{eoc}\n", SHELL_NAME);
|
ft_dprintf(2, "{red}%s: internal fork error{eoc}\n", SHELL_NAME);
|
||||||
}
|
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/29 16:04:18 by jhalford #+# #+# */
|
/* Created: 2016/11/29 16:04:18 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/03 18:49:27 by jhalford ### ########.fr */
|
/* Updated: 2017/03/05 15:59:06 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/03 18:12:57 by ariard #+# #+# */
|
/* Created: 2017/03/03 18:12:57 by ariard #+# #+# */
|
||||||
/* Updated: 2017/03/03 20:02:24 by ariard ### ########.fr */
|
/* Updated: 2017/03/05 15:58:13 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -19,11 +19,14 @@ void redir_free(void *data, size_t content_size)
|
||||||
(void)content_size;
|
(void)content_size;
|
||||||
redir = data;
|
redir = data;
|
||||||
if (redir->type == TK_GREAT || redir->type == TK_LESS || redir->type == TK_DGREAT)
|
if (redir->type == TK_GREAT || redir->type == TK_LESS || redir->type == TK_DGREAT)
|
||||||
|
{
|
||||||
|
/* DG("word.word: %s", redir->word.word); */
|
||||||
ft_strdel(&redir->word.word);
|
ft_strdel(&redir->word.word);
|
||||||
else
|
}
|
||||||
redir->word.fd = 0;
|
/* else */
|
||||||
redir->type = 0;
|
/* redir->word.fd = 0; */
|
||||||
redir->n = 0;
|
/* redir->type = 0; */
|
||||||
redir->close = 1;
|
/* redir->n = 0; */
|
||||||
|
/* redir->close = 1; */
|
||||||
free(redir);
|
free(redir);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
46
42sh/src/exec/set_process.c
Normal file
46
42sh/src/exec/set_process.c
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* set_process.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2017/03/05 14:54:45 by jhalford #+# #+# */
|
||||||
|
/* Updated: 2017/03/05 15:42:45 by jhalford ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "exec.h"
|
||||||
|
|
||||||
|
int set_process(t_process *p, t_btree *ast)
|
||||||
|
{
|
||||||
|
t_exec *exec;
|
||||||
|
t_cmd *cmd;
|
||||||
|
int op;
|
||||||
|
int fds[2];
|
||||||
|
|
||||||
|
cmd = &((t_astnode *)ast->item)->data.cmd;
|
||||||
|
process_reset(p);
|
||||||
|
exec = &data_singleton()->exec;
|
||||||
|
op = pop(&exec->op_stack);
|
||||||
|
if ((EXEC_IS_AND_IF(exec->attrs)
|
||||||
|
&& ft_strcmp(ft_getenv(data_singleton()->env, "?"), "0") != 0)
|
||||||
|
|| (EXEC_IS_OR_IF(exec->attrs)
|
||||||
|
&& ft_strcmp(ft_getenv(data_singleton()->env, "?"), "0") == 0))
|
||||||
|
return (1);
|
||||||
|
if (!(p->av = token_to_argv(cmd->token, 1)))
|
||||||
|
return (1);
|
||||||
|
fds[PIPE_WRITE] = STDOUT;
|
||||||
|
fds[PIPE_READ] = STDIN;
|
||||||
|
if (op == TK_AMP)
|
||||||
|
exec->attrs |= JOB_BG;
|
||||||
|
else if (op == TK_PIPE)
|
||||||
|
pipe(fds);
|
||||||
|
p->fdin = exec->fdin;
|
||||||
|
p->to_close = fds[PIPE_READ];
|
||||||
|
p->fdout = fds[PIPE_WRITE];
|
||||||
|
exec->fdin = fds[PIPE_READ];
|
||||||
|
p->redirs = cmd->redir;
|
||||||
|
process_setexec(p);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
@ -1,28 +1,37 @@
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* add_new_job.c :+: :+: :+: */
|
/* job_addprocess.c :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/02 20:44:21 by jhalford #+# #+# */
|
/* Created: 2016/12/13 13:54:51 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/03 19:33:29 by jhalford ### ########.fr */
|
/* Updated: 2017/03/05 15:12:31 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "job_control.h"
|
#include "job_control.h"
|
||||||
|
|
||||||
int add_new_job(t_job *job)
|
int job_addprocess(t_process *p)
|
||||||
{
|
{
|
||||||
t_jobc *jobc;
|
t_jobc *jobc;
|
||||||
|
t_job *job;
|
||||||
|
|
||||||
DG("adding new job");
|
|
||||||
if (!job->first_process)
|
|
||||||
return (1);
|
|
||||||
jobc = &data_singleton()->jobc;
|
jobc = &data_singleton()->jobc;
|
||||||
|
job = &data_singleton()->exec.job;
|
||||||
|
if (IS_PIPESTART(*p))
|
||||||
|
{
|
||||||
job_update_id();
|
job_update_id();
|
||||||
job->id = jobc->current_id;
|
job->id = jobc->current_id;
|
||||||
job->pgid = ((t_process*)job->first_process->content)->pid;
|
job->pgid = p->pid;
|
||||||
ft_lstadd(&jobc->first_job, ft_lstnew(job, sizeof(*job)));
|
ft_lstadd(&jobc->first_job, ft_lstnew(job, sizeof(*job)));
|
||||||
|
}
|
||||||
|
job = jobc->first_job->content;
|
||||||
|
if (p->pid > 0)
|
||||||
|
{
|
||||||
|
ft_lsteadd(&job->first_process, ft_lstnew(p, sizeof(*p)));
|
||||||
|
}
|
||||||
|
if (JOB_IS_BG(job->attrs) && IS_PIPEEND(*p))
|
||||||
|
job_notify_new(job);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/12 12:41:11 by jhalford #+# #+# */
|
/* Created: 2016/12/12 12:41:11 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/02 17:48:50 by jhalford ### ########.fr */
|
/* Updated: 2017/03/05 16:00:27 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -20,6 +20,6 @@ void process_free(void *content, size_t content_size)
|
||||||
p = content;
|
p = content;
|
||||||
ft_strdel(&p->path);
|
ft_strdel(&p->path);
|
||||||
ft_sstrfree(p->av);
|
ft_sstrfree(p->av);
|
||||||
ft_lstdel(&p->redirs, ft_lst_cfree);
|
/* ft_lstdel(&p->redirs, ft_lst_cfree); */
|
||||||
free(p);
|
free(p);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/10 17:37:56 by jhalford #+# #+# */
|
/* Created: 2016/12/10 17:37:56 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/01/31 15:09:29 by jhalford ### ########.fr */
|
/* Updated: 2017/03/05 15:30:35 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -14,8 +14,8 @@
|
||||||
|
|
||||||
void sigchld_handler(int signo)
|
void sigchld_handler(int signo)
|
||||||
{
|
{
|
||||||
t_data *data;
|
// t_data *data;
|
||||||
|
|
||||||
(void)signo;
|
(void)signo;
|
||||||
data = data_singleton();
|
// data = data_singleton();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/10 15:14:53 by jhalford #+# #+# */
|
/* Created: 2016/12/10 15:14:53 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/01/22 19:03:32 by ariard ### ########.fr */
|
/* Updated: 2017/03/05 15:30:58 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -14,10 +14,10 @@
|
||||||
|
|
||||||
void sigtstp_handler(int signo)
|
void sigtstp_handler(int signo)
|
||||||
{
|
{
|
||||||
t_jobc *jobc;
|
// t_jobc *jobc;
|
||||||
|
|
||||||
(void)signo;
|
(void)signo;
|
||||||
jobc = &data_singleton()->jobc;
|
// jobc = &data_singleton()->jobc;
|
||||||
DG("got SIGTSTP pid=%i, pgrp=%i, shell_pgid=%i", getpid(), getpgrp(), data_singleton()->jobc.shell_pgid);
|
DG("got SIGTSTP pid=%i, pgrp=%i, shell_pgid=%i", getpid(), getpgrp(), data_singleton()->jobc.shell_pgid);
|
||||||
ft_putchar('\x1A');
|
ft_putchar('\x1A');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/03 17:39:45 by jhalford #+# #+# */
|
/* Created: 2017/03/03 17:39:45 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/03 17:40:24 by jhalford ### ########.fr */
|
/* Updated: 2017/03/05 16:27:04 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/09 20:39:06 by jhalford #+# #+# */
|
/* Created: 2017/02/09 20:39:06 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/03 17:56:09 by jhalford ### ########.fr */
|
/* Updated: 2017/03/05 16:28:14 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -17,6 +17,7 @@ t_lexstate get_state_global(t_lexer *lexer)
|
||||||
char c;
|
char c;
|
||||||
|
|
||||||
c = lexer->str[lexer->pos];
|
c = lexer->str[lexer->pos];
|
||||||
|
DG("check, c=%c", lexer->str[lexer->pos]);
|
||||||
if (ft_is_delim(c))
|
if (ft_is_delim(c))
|
||||||
return (DELIM);
|
return (DELIM);
|
||||||
else if (c == '#')
|
else if (c == '#')
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/07 12:15:59 by jhalford #+# #+# */
|
/* Created: 2017/02/07 12:15:59 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/02/20 21:03:53 by ariard ### ########.fr */
|
/* Updated: 2017/03/05 15:31:17 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -14,9 +14,9 @@
|
||||||
|
|
||||||
int lexer_comment(t_list **alst, t_lexer *lexer)
|
int lexer_comment(t_list **alst, t_lexer *lexer)
|
||||||
{
|
{
|
||||||
t_token *token;
|
// t_token *token;
|
||||||
|
|
||||||
token = (*alst)->content;
|
// token = (*alst)->content;
|
||||||
if (lexer->str[lexer->pos] == '\n')
|
if (lexer->str[lexer->pos] == '\n')
|
||||||
return (lexer_lex(&(*alst)->next, lexer));
|
return (lexer_lex(&(*alst)->next, lexer));
|
||||||
return (lexer_comment(alst, lexer));
|
return (lexer_comment(alst, lexer));
|
||||||
|
|
|
||||||
|
|
@ -1,46 +1,35 @@
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* lexer_curly_brackets.c :+: :+: :+: */
|
/* lexer_curly_braces.c :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/24 21:24:50 by ariard #+# #+# */
|
/* Created: 2017/03/05 16:29:35 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/02/24 21:48:52 by ariard ### ########.fr */
|
/* Updated: 2017/03/05 16:29:36 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "parser.h"
|
#include "parser.h"
|
||||||
|
|
||||||
int lexer_curly_brackets(t_list **alst, t_lexer *lexer)
|
int lexer_curly_braces(t_list **alst, t_lexer *lexer)
|
||||||
{
|
{
|
||||||
t_token *token;
|
t_token *token;
|
||||||
t_list **lst;
|
|
||||||
|
|
||||||
DG("lexer curly brackets");
|
|
||||||
lst = alst;
|
|
||||||
if (*alst)
|
|
||||||
{
|
|
||||||
token = (*alst)->content;
|
token = (*alst)->content;
|
||||||
if (token->type)
|
if (token->type)
|
||||||
lst = &(*alst)->next;
|
lexer_lex(&(*alst)->next, lexer);
|
||||||
}
|
|
||||||
token = token_init();
|
|
||||||
*lst = ft_lstnew(token, sizeof(*token));
|
|
||||||
token = (*lst)->content;
|
|
||||||
if (lexer->str[lexer->pos] == '{')
|
if (lexer->str[lexer->pos] == '{')
|
||||||
{
|
{
|
||||||
DG("lbrace");
|
|
||||||
token->type = TK_LBRACE;
|
token->type = TK_LBRACE;
|
||||||
push(&lexer->stack, CURLY_BRACKETS);
|
push(&lexer->stack, PAREN);
|
||||||
}
|
}
|
||||||
else if (lexer->stack && *(int*)lexer->stack->content == CURLY_BRACKETS)
|
else if (get_lexer_stack(*lexer))
|
||||||
{
|
{
|
||||||
DG("rbrace");
|
|
||||||
token->type = TK_RBRACE;
|
token->type = TK_RBRACE;
|
||||||
pop(&lexer->stack);
|
pop(&lexer->stack);
|
||||||
}
|
}
|
||||||
lexer->pos++;
|
lexer->pos++;
|
||||||
lexer->state = DEFAULT;
|
lexer->state = DEFAULT;
|
||||||
return (lexer_lex(&(*lst)->next, lexer));
|
return (lexer_lex(&(*alst)->next, lexer));
|
||||||
}
|
}
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/28 18:36:21 by jhalford #+# #+# */
|
/* Created: 2016/11/28 18:36:21 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/03 17:55:57 by jhalford ### ########.fr */
|
/* Updated: 2017/03/05 16:20:18 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/09 17:08:51 by jhalford #+# #+# */
|
/* Created: 2017/02/09 17:08:51 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/05 14:52:49 by ariard ### ########.fr */
|
/* Updated: 2017/03/05 16:49:13 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -14,8 +14,8 @@
|
||||||
|
|
||||||
int (*g_lexer[])(t_list **alst, t_lexer *lexer) =
|
int (*g_lexer[])(t_list **alst, t_lexer *lexer) =
|
||||||
{
|
{
|
||||||
&lexer_paren,
|
|
||||||
&lexer_default,
|
&lexer_default,
|
||||||
|
&lexer_paren,
|
||||||
&lexer_newline,
|
&lexer_newline,
|
||||||
&lexer_delim,
|
&lexer_delim,
|
||||||
&lexer_sep,
|
&lexer_sep,
|
||||||
|
|
@ -31,7 +31,7 @@ int (*g_lexer[])(t_list **alst, t_lexer *lexer) =
|
||||||
&lexer_bquote,
|
&lexer_bquote,
|
||||||
&lexer_bquote,
|
&lexer_bquote,
|
||||||
&lexer_backslash,
|
&lexer_backslash,
|
||||||
&lexer_curly_brackets,
|
&lexer_curly_braces,
|
||||||
&lexer_assignement_word,
|
&lexer_assignement_word,
|
||||||
&lexer_comment,
|
&lexer_comment,
|
||||||
&lexer_end,
|
&lexer_end,
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/03 12:06:45 by jhalford #+# #+# */
|
/* Created: 2016/12/03 12:06:45 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/05 16:44:00 by ariard ### ########.fr */
|
/* Updated: 2017/03/05 16:48:47 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -19,18 +19,16 @@ int lexer_number(t_list **alst, t_lexer *lexer)
|
||||||
|
|
||||||
token = (*alst)->content;
|
token = (*alst)->content;
|
||||||
token->type = TK_IO_NUMBER;
|
token->type = TK_IO_NUMBER;
|
||||||
if ((state = get_state_global(lexer)))
|
if ((state = get_state_global(lexer))
|
||||||
{
|
|| (state = get_state_redir(lexer)))
|
||||||
lexer->state = state;
|
|
||||||
return (lexer_lex(alst, lexer));
|
|
||||||
}
|
|
||||||
else if ((state = get_state_redir(lexer)))
|
|
||||||
{
|
{
|
||||||
lexer->state = state;
|
lexer->state = state;
|
||||||
return (lexer_lex(alst, lexer));
|
return (lexer_lex(alst, lexer));
|
||||||
}
|
}
|
||||||
else if (ft_isdigit(lexer->str[lexer->pos])
|
else if (ft_isdigit(lexer->str[lexer->pos])
|
||||||
&& (lexer->str[lexer->pos + 1] == '>' || lexer->str[lexer->pos + 1] == '<'))
|
&& (ft_isdigit(lexer->str[lexer->pos + 1])
|
||||||
|
|| lexer->str[lexer->pos + 1] == '>'
|
||||||
|
|| lexer->str[lexer->pos + 1] == '<'))
|
||||||
{
|
{
|
||||||
token_append(token, lexer, 0, 0);
|
token_append(token, lexer, 0, 0);
|
||||||
lexer->pos++;
|
lexer->pos++;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/03 17:37:15 by jhalford #+# #+# */
|
/* Created: 2017/03/03 17:37:15 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/05 14:47:09 by ariard ### ########.fr */
|
/* Updated: 2017/03/05 16:48:06 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -15,29 +15,21 @@
|
||||||
int lexer_paren(t_list **alst, t_lexer *lexer)
|
int lexer_paren(t_list **alst, t_lexer *lexer)
|
||||||
{
|
{
|
||||||
t_token *token;
|
t_token *token;
|
||||||
t_list **lst;
|
|
||||||
|
|
||||||
lst = alst;
|
|
||||||
if (*alst)
|
|
||||||
{
|
|
||||||
token = (*alst)->content;
|
token = (*alst)->content;
|
||||||
if (token->type)
|
if (token->type)
|
||||||
lst = &(*alst)->next;
|
lexer_lex(&(*alst)->next, lexer);
|
||||||
}
|
|
||||||
token = token_init();
|
|
||||||
*lst = ft_lstnew(token, sizeof(*token));
|
|
||||||
token = (*lst)->content;
|
|
||||||
if (lexer->str[lexer->pos] == '(')
|
if (lexer->str[lexer->pos] == '(')
|
||||||
{
|
{
|
||||||
token->type = TK_PAREN_OPEN;
|
token->type = TK_PAREN_OPEN;
|
||||||
push(&lexer->stack, PAREN);
|
push(&lexer->stack, PAREN);
|
||||||
}
|
}
|
||||||
else if (lexer->stack && *(int*)lexer->stack->content == PAREN)
|
else if (get_lexer_stack(*lexer))
|
||||||
{
|
{
|
||||||
token->type = TK_PAREN_CLOSE;
|
token->type = TK_PAREN_CLOSE;
|
||||||
pop(&lexer->stack);
|
pop(&lexer->stack);
|
||||||
}
|
}
|
||||||
lexer->pos++;
|
lexer->pos++;
|
||||||
lexer->state = DEFAULT;
|
lexer->state = DEFAULT;
|
||||||
return (lexer_lex(&(*lst)->next, lexer));
|
return (lexer_lex(&(*alst)->next, lexer));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/28 14:39:01 by jhalford #+# #+# */
|
/* Created: 2016/11/28 14:39:01 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/01 16:25:30 by ariard ### ########.fr */
|
/* Updated: 2017/03/05 16:27:58 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -18,7 +18,6 @@ void token_print(t_list *lst)
|
||||||
|
|
||||||
while (lst)
|
while (lst)
|
||||||
{
|
{
|
||||||
DG("token print");
|
|
||||||
if (lst->content)
|
if (lst->content)
|
||||||
token = lst->content;
|
token = lst->content;
|
||||||
if (token->type)
|
if (token->type)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/16 16:14:46 by gwojda #+# #+# */
|
/* Created: 2016/12/16 16:14:46 by gwojda #+# #+# */
|
||||||
/* Updated: 2017/02/02 14:29:34 by gwojda ### ########.fr */
|
/* Updated: 2017/03/05 15:31:42 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -14,12 +14,12 @@
|
||||||
|
|
||||||
char *ft_realloc_imput(char *str, int a, size_t pos)
|
char *ft_realloc_imput(char *str, int a, size_t pos)
|
||||||
{
|
{
|
||||||
int i;
|
// int i;
|
||||||
char tmp[2];
|
char tmp[2];
|
||||||
char *str_tmp;
|
char *str_tmp;
|
||||||
char *new_str;
|
char *new_str;
|
||||||
|
|
||||||
i = 0;
|
// i = 0;
|
||||||
tmp[0] = (char)a;
|
tmp[0] = (char)a;
|
||||||
tmp[1] = '\0';
|
tmp[1] = '\0';
|
||||||
if (!str)
|
if (!str)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/01/09 13:21:40 by gwojda #+# #+# */
|
/* Created: 2017/01/09 13:21:40 by gwojda #+# #+# */
|
||||||
/* Updated: 2017/02/14 11:18:54 by gwojda ### ########.fr */
|
/* Updated: 2017/03/05 15:32:18 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -40,9 +40,9 @@ static void ft_up_2(size_t *pos, char *str)
|
||||||
|
|
||||||
void ft_up(void)
|
void ft_up(void)
|
||||||
{
|
{
|
||||||
int i;
|
// int i;
|
||||||
|
|
||||||
i = 0;
|
// i = 0;
|
||||||
if (!STR || !POS)
|
if (!STR || !POS)
|
||||||
return ;
|
return ;
|
||||||
if (STR[POS - 1] == '\n')
|
if (STR[POS - 1] == '\n')
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/06 18:40:58 by jhalford #+# #+# */
|
/* Created: 2016/12/06 18:40:58 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/05 16:38:23 by ariard ### ########.fr */
|
/* Updated: 2017/03/05 16:47:43 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -83,7 +83,6 @@ int get_input_fd()
|
||||||
return (fd);
|
return (fd);
|
||||||
else if (data->opts & SH_OPTS_LC)
|
else if (data->opts & SH_OPTS_LC)
|
||||||
{
|
{
|
||||||
DG();
|
|
||||||
pipe(fds);
|
pipe(fds);
|
||||||
fd = fds[PIPE_READ];
|
fd = fds[PIPE_READ];
|
||||||
file = shell_get_avdata();
|
file = shell_get_avdata();
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/01/11 14:04:48 by jhalford #+# #+# */
|
/* Created: 2017/01/11 14:04:48 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/03 19:53:11 by jhalford ### ########.fr */
|
/* Updated: 2017/03/05 16:28:38 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/04 20:42:13 by ariard #+# #+# */
|
/* Created: 2017/03/04 20:42:13 by ariard #+# #+# */
|
||||||
/* Updated: 2017/03/05 14:47:19 by ariard ### ########.fr */
|
/* Updated: 2017/03/05 16:47:15 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -15,10 +15,11 @@
|
||||||
int iscase(t_btree **ast, t_list **lst)
|
int iscase(t_btree **ast, t_list **lst)
|
||||||
{
|
{
|
||||||
t_astnode *node;
|
t_astnode *node;
|
||||||
t_token *token;
|
// t_token *token;
|
||||||
|
|
||||||
|
(void)lst;
|
||||||
node = NULL;
|
node = NULL;
|
||||||
token = (*lst)->content;
|
// token = (*lst)->content;
|
||||||
if (*ast)
|
if (*ast)
|
||||||
{
|
{
|
||||||
node = (*ast)->item;
|
node = (*ast)->item;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/19 18:12:52 by ariard #+# #+# */
|
/* Created: 2017/02/19 18:12:52 by ariard #+# #+# */
|
||||||
/* Updated: 2017/03/04 21:51:34 by ariard ### ########.fr */
|
/* Updated: 2017/03/05 15:32:49 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -15,10 +15,10 @@
|
||||||
int iscondition(t_btree **ast, t_list **lst)
|
int iscondition(t_btree **ast, t_list **lst)
|
||||||
{
|
{
|
||||||
t_astnode *node;
|
t_astnode *node;
|
||||||
t_token *token;
|
// t_token *token;
|
||||||
|
|
||||||
node = NULL;
|
node = NULL;
|
||||||
token = (*lst)->content;
|
// token = (*lst)->content;
|
||||||
DG("iscondition");
|
DG("iscondition");
|
||||||
if (*ast)
|
if (*ast)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/17 22:17:14 by ariard #+# #+# */
|
/* Created: 2017/02/17 22:17:14 by ariard #+# #+# */
|
||||||
/* Updated: 2017/03/05 15:51:04 by ariard ### ########.fr */
|
/* Updated: 2017/03/05 16:46:50 by ariard ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -15,10 +15,10 @@
|
||||||
int isloop(t_btree **ast, t_list **lst)
|
int isloop(t_btree **ast, t_list **lst)
|
||||||
{
|
{
|
||||||
t_astnode *node;
|
t_astnode *node;
|
||||||
t_token *token;
|
// t_token *token;
|
||||||
|
|
||||||
node = NULL;
|
node = NULL;
|
||||||
token = (*lst)->content;
|
// token = (*lst)->content;
|
||||||
DG("isloop");
|
DG("isloop");
|
||||||
if (*ast)
|
if (*ast)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/24 18:41:50 by ariard #+# #+# */
|
/* Created: 2017/02/24 18:41:50 by ariard #+# #+# */
|
||||||
/* Updated: 2017/03/03 14:27:44 by ariard ### ########.fr */
|
/* Updated: 2017/03/05 15:34:12 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -15,10 +15,11 @@
|
||||||
int issubshell(t_btree **ast, t_list **lst)
|
int issubshell(t_btree **ast, t_list **lst)
|
||||||
{
|
{
|
||||||
t_astnode *node;
|
t_astnode *node;
|
||||||
t_token *token;
|
// t_token *token;
|
||||||
|
|
||||||
|
(void)lst;
|
||||||
node = NULL;
|
node = NULL;
|
||||||
token = (*lst)->content;
|
// token = (*lst)->content;
|
||||||
if (*ast)
|
if (*ast)
|
||||||
{
|
{
|
||||||
node = (*ast)->item;
|
node = (*ast)->item;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue