diff --git a/42sh/Makefile b/42sh/Makefile index b067e7df..b2a8cb9a 100644 --- a/42sh/Makefile +++ b/42sh/Makefile @@ -13,7 +13,7 @@ NAME = 42sh CC = gcc -FLAGS = -Wall -Wextra -Werror #-fvisibility=hidden# -fsanitize=address +FLAGS = -Wall -Wextra -Werror -fvisibility=hidden -fsanitize=address D_FLAGS = -g DELTA = $$(echo "$$(tput cols)-47"|bc) diff --git a/42sh/includes/lexer.h b/42sh/includes/lexer.h index 3a5ee122..91ec40ae 100644 --- a/42sh/includes/lexer.h +++ b/42sh/includes/lexer.h @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/01 12:15:50 by jhalford #+# #+# */ -/* Updated: 2017/03/22 18:13:32 by jhalford ### ########.fr */ +/* Updated: 2017/03/22 22:07:49 by wescande ### ########.fr */ /* */ /* ************************************************************************** */ @@ -77,7 +77,6 @@ void token_print(t_list *lst); int reduce_parens(t_list **alst, char *str); int bquotes_expand(t_list **alst); char *command_getoutput(char *command); -int command_setoutput(char *const av[], char **env); int ft_is_delim(char c); int ft_is_delim_list(char c); diff --git a/42sh/includes/parser.h b/42sh/includes/parser.h index d3a0cbb7..cdb01093 100644 --- a/42sh/includes/parser.h +++ b/42sh/includes/parser.h @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/22 17:22:51 by ariard #+# #+# */ -/* Updated: 2017/03/22 17:25:11 by ariard ### ########.fr */ +/* Updated: 2017/03/22 21:50:33 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/libft/src/sstr/ft_sstrfree.c b/42sh/libft/src/sstr/ft_sstrfree.c index 1e10d105..7855228d 100644 --- a/42sh/libft/src/sstr/ft_sstrfree.c +++ b/42sh/libft/src/sstr/ft_sstrfree.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/05 11:53:36 by jhalford #+# #+# */ -/* Updated: 2017/01/11 14:42:45 by jhalford ### ########.fr */ +/* Updated: 2017/03/22 23:19:24 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/libft/src/sstr/ft_sstrstr.c b/42sh/libft/src/sstr/ft_sstrstr.c index 7170a6e6..d6618563 100644 --- a/42sh/libft/src/sstr/ft_sstrstr.c +++ b/42sh/libft/src/sstr/ft_sstrstr.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/07 11:29:54 by ariard #+# #+# */ -/* Updated: 2017/03/21 18:14:45 by ariard ### ########.fr */ +/* Updated: 2017/03/22 21:54:40 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/libft/src/str/ft_atoi.c b/42sh/libft/src/str/ft_atoi.c index b583a198..546c58f6 100644 --- a/42sh/libft/src/str/ft_atoi.c +++ b/42sh/libft/src/str/ft_atoi.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/08/03 16:17:21 by jhalford #+# #+# */ -/* Updated: 2017/03/17 20:36:22 by wescande ### ########.fr */ +/* Updated: 2017/03/22 22:21:21 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/libft/src/str/ft_strdupchr.c b/42sh/libft/src/str/ft_strdupchr.c index aee98aaf..3fd5d0d5 100644 --- a/42sh/libft/src/str/ft_strdupchr.c +++ b/42sh/libft/src/str/ft_strdupchr.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/07 11:01:15 by ariard #+# #+# */ -/* Updated: 2017/03/21 15:43:51 by jhalford ### ########.fr */ +/* Updated: 2017/03/22 23:12:37 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/libft/src/str/ft_strlenchr.c b/42sh/libft/src/str/ft_strlenchr.c index 34882af2..1ea82cfa 100644 --- a/42sh/libft/src/str/ft_strlenchr.c +++ b/42sh/libft/src/str/ft_strlenchr.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/01 16:10:54 by ariard #+# #+# */ -/* Updated: 2017/03/07 11:30:02 by ariard ### ########.fr */ +/* Updated: 2017/03/22 22:12:03 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/libft/src/str/ft_strtok.c b/42sh/libft/src/str/ft_strtok.c index c6fab4de..dbb73ed9 100644 --- a/42sh/libft/src/str/ft_strtok.c +++ b/42sh/libft/src/str/ft_strtok.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/07 18:08:31 by jhalford #+# #+# */ -/* Updated: 2017/03/07 18:18:30 by jhalford ### ########.fr */ +/* Updated: 2017/03/22 22:23:33 by wescande ### ########.fr */ /* */ /* ************************************************************************** */ @@ -22,7 +22,7 @@ char *ft_strtok(char *s, const char *delim) if ((ch = *s++) == 0) return (0); while (ft_strchr(delim, ch)) - if ((ch = *s) == 0) + if ((ch = *s++) == 0) return (0); --s; lasts = s + ft_strcspn(s, delim); diff --git a/42sh/src/builtin/builtin_math.c b/42sh/src/builtin/builtin_math.c index 77072563..9bdb8261 100644 --- a/42sh/src/builtin/builtin_math.c +++ b/42sh/src/builtin/builtin_math.c @@ -6,103 +6,60 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/17 18:54:00 by ariard #+# #+# */ -/* Updated: 2017/03/21 18:08:31 by ariard ### ########.fr */ +/* Updated: 2017/03/22 22:26:37 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ #include "minishell.h" -#define MATHERR_0 "math : invalid number of arguments" -#define MATHERR_1 "math : invalid variable name" -#define MATHERR_2 "math : invalid operator" -#define MATHERR_3 "math : invalid operand" -#define MATHERR_4 "math : division by 0" +#define MATHERR_0 "usage: math variable operator(+-/*%) operand" +#define MATHERR_2 "math: %c: invalid operator" +#define MATHERR_3 "math: %s: operand must be digits only" +#define MATHERR_4 "math: division by 0" +#define MATHERR_5 "math: modulo by 0" -static int init_math(char **var, char **value, char **operator, - char **operand) -{ - *var = NULL; - *value = NULL; - *operator = NULL; - *operand = NULL; - return (0); -} - -static int get_value(char *var, char **value) -{ - char *temp; - char *esc; - int ret; - - esc = ft_strnew((ft_strlen(var) >> 3) + 1); - ret = word_is_assignment((char *[]) {var, (esc + 1)}); - ft_strdel(&esc); - if (!ret) - return (SH_ERR(MATHERR_1)); - temp = ft_sstrstr(data_singleton()->local_var, var); - if (temp) - { - temp += ft_strlenchr(temp, '=') + 1; - *value = ft_strdup(temp); - if (!(ft_stris(*value, &ft_isdigit))) - { - ft_strdel(value); - *value = ft_itoa(0); - } - } - else - *value = ft_itoa(0); - return (0); -} - -static int do_math(char **value, char *operator, char *operand) +static char *do_math(char *value, char operator, char *operand) { long ope1; long ope2; - ope1 = ft_atoi(*value); - if (operand) - ope2 = ft_atoi(operand); - else - ope2 = 0; - if ((operator[0] == '/' || operator[0] == '%') && ope2 == 0) - return (SH_ERR(MATHERR_4)); - else - { - ope1 = (operator[0] == '+') ? ope1 + ope2 : ope1; - ope1 = (operator[0] == '-') ? ope1 - ope2 : ope1; - ope1 = (operator[0] == '/') ? ope1 / ope2 : ope1; - ope1 = (operator[0] == '*') ? ope1 * ope2 : ope1; - ope1 = (operator[0] == '%') ? ope1 % ope2 : ope1; - } - ft_strdel(value); - *value = ft_itoa(ope1); - return (0); + ope1 = ft_atoi(value); + ope2 = ft_atoi(operand); + DG("value %s -> %i", value, ope1); + DG("operand %s -> %i", operand, ope2); + if ((operator == '/') && ope2 == 0) + return (SH_ERR(MATHERR_4) ? NULL : NULL); + if ((operator == '%') && ope2 == 0) + return (SH_ERR(MATHERR_5) ? NULL : NULL); + ope1 = (operator == '+') ? ope1 + ope2 : ope1; + ope1 = (operator == '-') ? ope1 - ope2 : ope1; + ope1 = (operator == '/') ? ope1 / ope2 : ope1; + ope1 = (operator == '*') ? ope1 * ope2 : ope1; + ope1 = (operator == '%') ? ope1 % ope2 : ope1; + DG("output=%s (%i)", ft_itoa(ope1), ope1); + return (ft_itoa(ope1)); } int builtin_math(const char *path, char *const av[], char *const envp[]) { - char *var; char *value; - char *operator; + char operator; char *operand; (void)path; (void)envp; if (!av || !av[1] || !av[2] || !av[3] || av[4]) return (SH_ERR(MATHERR_0)); - init_math(&var, &value, &operator, &operand); - var = av[1]; - if (get_value(var, &value)) - return (1); - operator = av[2]; - if (ft_strlen(operator) != 1 || !(ft_strchr("+-/*%", operator[0]))) - return (SH_ERR(MATHERR_2)); + value = ft_getenv(data_singleton()->local_var, av[1]); + operator = av[2][0]; + if (!(ft_strchr("+-/*%", operator))) + return (SH_ERR(MATHERR_2, operator)); operand = av[3]; if (!ft_stris(operand, &ft_isdigit)) - return (SH_ERR(MATHERR_3)); - if (do_math(&value, operator, operand)) + return (SH_ERR(MATHERR_3, operand)); + if (!(value = do_math(value, operator, operand))) return (1); - builtin_setenv("setenv", (char *[]){"local", var, value, 0}, NULL); + builtin_setenv("setenv", (char *[]){"math", av[1], value, 0}, NULL); + ft_strdel(&value); return (0); } diff --git a/42sh/src/builtin/builtin_setenv.c b/42sh/src/builtin/builtin_setenv.c index a00dd611..8cd00b78 100644 --- a/42sh/src/builtin/builtin_setenv.c +++ b/42sh/src/builtin/builtin_setenv.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/28 14:25:17 by jhalford #+# #+# */ -/* Updated: 2017/03/22 16:21:49 by gwojda ### ########.fr */ +/* Updated: 2017/03/22 22:08:20 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/exec/ast_free.c b/42sh/src/exec/ast_free.c index 756ea439..ec5599be 100644 --- a/42sh/src/exec/ast_free.c +++ b/42sh/src/exec/ast_free.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/05 11:50:51 by jhalford #+# #+# */ -/* Updated: 2017/03/21 19:14:31 by ariard ### ########.fr */ +/* Updated: 2017/03/22 21:50:11 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/exec/exec_case_branch.c b/42sh/src/exec/exec_case_branch.c index 9a618168..a705fad8 100644 --- a/42sh/src/exec/exec_case_branch.c +++ b/42sh/src/exec/exec_case_branch.c @@ -6,7 +6,7 @@ /* By: wescande +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/07 20:33:45 by wescande #+# #+# */ -/* Updated: 2017/03/20 15:42:17 by gwojda ### ########.fr */ +/* Updated: 2017/03/22 22:06:11 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -23,10 +23,11 @@ int exec_case_branch(t_btree **ast) return (0); node = (*ast)->item; av = token_to_argv(node->data.cmd.token, 1); - if (ft_strcmp(av[0], ((char **)exec->case_pattern)[0]) == 0) + if (av && (ft_strcmp(av[0], ((char **)exec->case_pattern)[0]) == 0)) { exec->attrs |= EXEC_CASE_BRANCH; ft_exec(&(*ast)->right); } + ft_tabdel(&av); return (0); } diff --git a/42sh/src/exec/exec_leaf.c b/42sh/src/exec/exec_leaf.c index a95f54c2..9fb93b0e 100644 --- a/42sh/src/exec/exec_leaf.c +++ b/42sh/src/exec/exec_leaf.c @@ -6,7 +6,7 @@ /* By: wescande +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/07 15:47:30 by wescande #+# #+# */ -/* Updated: 2017/03/22 18:27:03 by jhalford ### ########.fr */ +/* Updated: 2017/03/22 21:48:12 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/exec/exec_var.c b/42sh/src/exec/exec_var.c index dbeaea7c..394908be 100644 --- a/42sh/src/exec/exec_var.c +++ b/42sh/src/exec/exec_var.c @@ -6,32 +6,28 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/07 11:12:05 by ariard #+# #+# */ -/* Updated: 2017/03/20 15:43:34 by gwojda ### ########.fr */ +/* Updated: 2017/03/22 23:23:44 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ #include "minishell.h" -static int set_var(char *stream, char **var, char **value) -{ - *var = ft_strdupchr(stream, '='); - stream += ft_strlenchr(stream, '=') + 1; - *value = ft_strdup(stream); - return (0); -} - int exec_var(t_btree **ast) { t_astnode *node; char **av; char *var; char *value; + char *equal; node = (*ast)->item; - av = token_to_argv(node->data.cmd.token, 1); - set_var(av[0], &var, &value); - if (ft_getenv(data_singleton()->env, var)) + if (!(av = token_to_argv(node->data.cmd.token, 1))) return (0); + var = av[0]; + if ((equal = ft_strchr(av[0], '='))) + *equal = 0; + value = equal ? equal + 1 : NULL; builtin_setenv("internal", (char*[]){"local", var, value, 0}, NULL); + ft_sstrfree(av); return (0); } diff --git a/42sh/src/exec/ft_exec.c b/42sh/src/exec/ft_exec.c index 38897055..5cf734ba 100644 --- a/42sh/src/exec/ft_exec.c +++ b/42sh/src/exec/ft_exec.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/27 20:30:32 by jhalford #+# #+# */ -/* Updated: 2017/03/16 23:38:29 by ariard ### ########.fr */ +/* Updated: 2017/03/22 19:52:58 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/exec/node_copy.c b/42sh/src/exec/node_copy.c index 5b829c78..e5e662ec 100644 --- a/42sh/src/exec/node_copy.c +++ b/42sh/src/exec/node_copy.c @@ -6,7 +6,7 @@ /* By: wescande +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/08 03:38:36 by wescande #+# #+# */ -/* Updated: 2017/03/21 18:44:57 by ariard ### ########.fr */ +/* Updated: 2017/03/22 21:50:06 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/exec/pfree_cmd.c b/42sh/src/exec/pfree_cmd.c index 2047d654..58ebe736 100644 --- a/42sh/src/exec/pfree_cmd.c +++ b/42sh/src/exec/pfree_cmd.c @@ -6,7 +6,7 @@ /* By: wescande +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/08 00:58:02 by wescande #+# #+# */ -/* Updated: 2017/03/20 16:29:37 by gwojda ### ########.fr */ +/* Updated: 2017/03/22 23:17:54 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/exec/pfree_list.c b/42sh/src/exec/pfree_list.c index 22c8a012..7e927680 100644 --- a/42sh/src/exec/pfree_list.c +++ b/42sh/src/exec/pfree_list.c @@ -6,7 +6,7 @@ /* By: wescande +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/08 02:37:04 by wescande #+# #+# */ -/* Updated: 2017/03/20 15:50:03 by gwojda ### ########.fr */ +/* Updated: 2017/03/22 21:48:34 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/exec/plaunch_case.c b/42sh/src/exec/plaunch_case.c index 85806831..7c23b356 100644 --- a/42sh/src/exec/plaunch_case.c +++ b/42sh/src/exec/plaunch_case.c @@ -6,7 +6,7 @@ /* By: wescande +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/07 19:02:23 by wescande #+# #+# */ -/* Updated: 2017/03/20 18:15:17 by gwojda ### ########.fr */ +/* Updated: 2017/03/22 22:00:16 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -19,6 +19,7 @@ int plaunch_case(t_process *p) exec = &data_singleton()->exec; exec->attrs &= ~EXEC_CASE_BRANCH; exec->case_pattern = token_to_argv(p->data.d_case.token, 1); - ft_exec(&p->data.d_if.content); + ft_exec(&p->data.d_case.content); + ft_tabdel(&exec->case_pattern); return (0); } diff --git a/42sh/src/exec/plaunch_file.c b/42sh/src/exec/plaunch_file.c index 4c3a4050..a9e66228 100644 --- a/42sh/src/exec/plaunch_file.c +++ b/42sh/src/exec/plaunch_file.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/07 14:53:31 by jhalford #+# #+# */ -/* Updated: 2017/03/20 16:29:20 by gwojda ### ########.fr */ +/* Updated: 2017/03/22 21:32:36 by wescande ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,7 +14,7 @@ static void error_launch(char *error_ori, char *error_type, int error_code) { - SH_ERR("%s: %s%s", SHELL_NAME, error_ori, error_type); + SH_ERR("%s%s", error_ori, error_type); exit(error_code); } diff --git a/42sh/src/exec/pset_case.c b/42sh/src/exec/pset_case.c index 8719f5d8..d74929d0 100644 --- a/42sh/src/exec/pset_case.c +++ b/42sh/src/exec/pset_case.c @@ -6,7 +6,7 @@ /* By: wescande +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/07 20:36:04 by wescande #+# #+# */ -/* Updated: 2017/03/20 15:59:05 by gwojda ### ########.fr */ +/* Updated: 2017/03/22 21:48:03 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/glob/command_getoutput.c b/42sh/src/glob/command_getoutput.c index 8bd80bbb..f3d8d8ae 100644 --- a/42sh/src/glob/command_getoutput.c +++ b/42sh/src/glob/command_getoutput.c @@ -6,7 +6,7 @@ /* By: wescande +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/14 19:44:25 by wescande #+# #+# */ -/* Updated: 2017/03/21 18:15:53 by jhalford ### ########.fr */ +/* Updated: 2017/03/22 22:25:49 by wescande ### ########.fr */ /* */ /* ************************************************************************** */ @@ -29,55 +29,6 @@ static char *manage_output(int *fds) return (output); } -static char *manage_command(char *const av_cmd[]) -{ - char *command; - int i; - - if (!av_cmd) - return (NULL); - i = -1; - command = NULL; - while (av_cmd[++i]) - { - if (!command) - command = ft_str3join("\"", av_cmd[i], "\""); - else - command = ft_strjoinf(command, ft_str3join("\"", av_cmd[i], "\""), 3); - } - return (command); -} - -static void execute_command(char *const av[], char **env) -{ - t_list *token; - t_btree *ast; - t_data *data; - char *command; - - token = NULL; - ast = NULL; - data = data_singleton(); - data->env = env; - data->opts &= ~SH_INTERACTIVE; - data->opts &= ~SH_OPTS_JOBC; - command = manage_command(av); - DG("DO THE EXEC"); - if (do_lexer_routine(&token, command)) - { - ft_dprintf(2, "{red}%s: syntax error in command substitution{eoc}\n", - SHELL_NAME); - exit(1); - } - if (do_parser_routine(&token, &ast) <= 0) - { - ft_dprintf(2, "{red}%s: parse error in command substitution{eoc}\n", - SHELL_NAME); - exit(1); - } - exit(data_singleton()->parser.state == SUCCESS && ft_exec(&ast) < 0); -} - char *command_getoutput(char *command) { int ret; @@ -101,15 +52,3 @@ char *command_getoutput(char *command) waitpid(pid, &ret, WUNTRACED); return (manage_output(fds)); } - -int command_setoutput(char *const av[], char **env) -{ - int pid; - - if (!av) - return (0); - pid = 0; - if (!(pid = process_fork(NULL))) - execute_command(av, env); - return (pid); -} diff --git a/42sh/src/glob/dir_glob.c b/42sh/src/glob/dir_glob.c index 0a5e0361..d7736c1c 100644 --- a/42sh/src/glob/dir_glob.c +++ b/42sh/src/glob/dir_glob.c @@ -6,7 +6,7 @@ /* By: wescande +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/30 12:07:16 by wescande #+# #+# */ -/* Updated: 2017/03/14 23:14:19 by wescande ### ########.fr */ +/* Updated: 2017/03/22 21:59:49 by wescande ### ########.fr */ /* */ /* ************************************************************************** */ @@ -63,7 +63,8 @@ int dir_research(t_glob *gl, char *p, } if ((ft_strlen(p) <= 1 || p[ft_strlen(p) - 1] != '.') && is_directory(p)) { - dir = opendir(p); + if (!(dir = opendir(p))) + return (0); while ((in = readdir(dir))) dir_list_content(gl, (char *[2]){p, in->d_name}, pat, mode[0]); diff --git a/42sh/src/main/main.c b/42sh/src/main/main.c index 8fddad30..7996a840 100644 --- a/42sh/src/main/main.c +++ b/42sh/src/main/main.c @@ -6,7 +6,7 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/20 14:45:40 by gwojda #+# #+# */ -/* Updated: 2017/03/22 19:37:21 by jhalford ### ########.fr */ +/* Updated: 2017/03/22 22:02:30 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/parser/produce_sym.c b/42sh/src/parser/produce_sym.c index b2e3f4c8..661940b5 100644 --- a/42sh/src/parser/produce_sym.c +++ b/42sh/src/parser/produce_sym.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/09 17:58:34 by ariard #+# #+# */ -/* Updated: 2017/03/22 19:26:03 by ariard ### ########.fr */ +/* Updated: 2017/03/22 21:51:30 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -32,6 +32,7 @@ t_prodmatch g_prodmatch[] = {TK_WORD, TK_PIPE, CMD_NAME}, {TK_WORD, AND_OR, CMD_NAME}, {TK_WORD, AND_OR_MAJOR, CMD_NAME}, + {TK_WORD, TK_PAREN_CLOSE, CMD_NAME}, {TK_WORD, TK_WHILE, CMD_NAME}, {TK_WORD, TK_UNTIL, CMD_NAME}, {TK_WORD, TK_DO, CMD_NAME},