diff --git a/42sh/includes/builtin.h b/42sh/includes/builtin.h index 5efa6dff..be6045e4 100644 --- a/42sh/includes/builtin.h +++ b/42sh/includes/builtin.h @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/13 17:21:56 by jhalford #+# #+# */ -/* Updated: 2017/02/27 20:28:37 by ariard ### ########.fr */ +/* Updated: 2017/03/07 17:29:38 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -32,4 +32,6 @@ int builtin_bg(const char *path, char *const av[], char *const envp[]); int builtin_history(const char *path, char *const av[], char *const envp[]); int builtin_hash(const char *path, char *const av[], char *const envp[]); +extern t_stof g_builtins[]; + #endif diff --git a/42sh/includes/exec.h b/42sh/includes/exec.h index 6101dd9c..40df13ae 100644 --- a/42sh/includes/exec.h +++ b/42sh/includes/exec.h @@ -6,13 +6,15 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/27 20:29:56 by jhalford #+# #+# */ -/* Updated: 2017/03/07 20:50:23 by wescande ### ########.fr */ +/* Updated: 2017/03/07 20:55:11 by wescande ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef EXEC_H # define EXEC_H +# include + # define PIPE_READ 0 # define PIPE_WRITE 1 @@ -42,11 +44,6 @@ # define EXEC_IS_IF_BRANCH(j) (j & EXEC_IF_BRANCH) # define EXEC_IS_CASE_BRANCH(j) (j & EXEC_CASE_BRANCH) -# include "../libft/includes/libft.h" -# include "types.h" -# include "job_control.h" -# include "minishell.h" - struct s_data_cmd { char **av; @@ -146,7 +143,7 @@ int exec_else(t_btree **ast); int exec_var(t_btree **ast); //int exec_for(t_btree **ast); //int exec_case(t_btree **ast); -//int exec_case_branch(t_btree **ast); +int exec_case_branch(t_btree **ast); int exec_math(t_btree **ast); int launch_process(t_process *p); @@ -178,6 +175,7 @@ void redir_free(void *data, size_t content_size); char **token_to_argv(t_ld *ld, int do_match); +# include int add_new_job(t_job *job); int error_badidentifier(char *name); diff --git a/42sh/includes/ft_readline.h b/42sh/includes/ft_readline.h index 92c78218..419d74df 100644 --- a/42sh/includes/ft_readline.h +++ b/42sh/includes/ft_readline.h @@ -6,7 +6,7 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/23 10:35:44 by gwojda #+# #+# */ -/* Updated: 2017/02/21 19:51:19 by jhalford ### ########.fr */ +/* Updated: 2017/03/07 18:36:00 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -54,20 +54,6 @@ # define TOUCHE_F5 892427035 # define TOUCHE_F6 925981467 -/* # define PROMPT_QUOTES "quote> " */ -/* # define PROMPT_DQUOTES "dquote> " */ -/* # define PROMPT_BQUOTES "bquote> " */ -/* # define PROMPT_ACCOLADE "cursh> " */ -/* # define PROMPT_BRACKET "subsh> " */ -/* # define PROMPT_BSLASH "> " */ - -/* # define SIZE_PROMPT_QUOTES 7 */ -/* # define SIZE_PROMPT_DQUOTES 8 */ -/* # define SIZE_PROMPT_BQUOTES 8 */ -/* # define SIZE_PROMPT_ACCOLADE 7 */ -/* # define SIZE_PROMPT_BRACKET 7 */ -/* # define SIZE_PROMPT_BSLASH 2 */ - # define IS_QUOTES (1 << 0) # define IS_BQUOTES (1 << 1) # define IS_DQUOTES (1 << 2) diff --git a/42sh/includes/glob.h b/42sh/includes/glob.h index d91bcaef..bec425e6 100644 --- a/42sh/includes/glob.h +++ b/42sh/includes/glob.h @@ -6,15 +6,13 @@ /* By: wescande +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/04 16:31:18 by wescande #+# #+# */ -/* Updated: 2017/03/07 20:40:28 by wescande ### ########.fr */ +/* Updated: 2017/03/07 20:57:04 by wescande ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef GLOB_H # define GLOB_H -# include "minishell.h" - # define CH(x) ((char **)(x)->content) # define UCH(x) ((unsigned char **)(x)->content) # define SCH(x) ((char **)(x).content) @@ -107,32 +105,5 @@ char **ft_strsplit_spe(const char *str, const unsigned char *esc, char c); unsigned char **ft_strsplit_esc(const char *str, const unsigned char *esc, char c); -/* -** LIST D: -*/ -void ft_ld_new(t_ld **alst, void *content); -t_ld *ft_ld_front(t_ld *ld); -void ft_ld_pushfront(t_ld **alst, void *content); -void ft_ld_pushback(t_ld **alst, void *content); -size_t ft_ld_size(t_ld *ld); -void ft_ld_del(t_ld **ld, void (*del)()); -void ft_ld_clear(t_ld **ld, void (*del)()); -void ft_ld_reverse(t_ld **lst); -t_ld *ft_ld_back(t_ld *ld); -t_ld *ft_ld_swap(t_ld *l_cur); -char **ft_ld_to_tab(t_ld *ld); -t_ld *ft_ld_order(t_ld *ld, int (*f)(), void (*del)()); -t_ld *ft_ld_copy(t_ld *src, void *(*f)(void *elem)); -/* -** str: -*/ - -char *ft_strjoinf(char *str, char *str2, int mode); -char *ft_strsubf(char *s, unsigned int start, - size_t len, short int mode); -void ft_tabdel(char ***mytab); -int ft_tablen(char **mytab); - -void *ft_memrealloc(void *ptr, size_t old_s, size_t new_s); #endif diff --git a/42sh/includes/minishell.h b/42sh/includes/minishell.h index 7fab094a..2a98dd10 100644 --- a/42sh/includes/minishell.h +++ b/42sh/includes/minishell.h @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/10 13:07:44 by jhalford #+# #+# */ -/* Updated: 2017/03/07 14:27:40 by jhalford ### ########.fr */ +/* Updated: 2017/03/07 18:38:08 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,48 +14,24 @@ # define MINISHELL_H # define SHELL_NAME "minishell" +# include +# include +# include +# include +# include + # include "libft.h" # include "types.h" # include "lexer.h" # include "parser.h" # include "ft_readline.h" +# include "job_control.h" # include "exec.h" # include "builtin.h" -# include "job_control.h" # include "glob.h" # include "completion.h" # include "hash.h" -# include -# include -# include -# include -# include -# include - -# define SH_INTERACTIVE (1 << 0) -# define SH_OPTS_JOBC (1 << 1) -# define SH_OPTS_LC (1 << 2) -# define SH_MODE_INPUT (1 << 3) -# define SH_MODE_EXEC (1 << 4) - -# define SH_MODE_MASK (SH_MODE_INPUT | SH_MODE_EXEC) -# define SH_HAS_JOBC(b) (b & SH_OPTS_JOBC) -# define SH_IS_INTERACTIVE(b) (b & SH_INTERACTIVE) -# define SH_NO_INTERACTIVE(b) !(b & SH_INTERACTIVE) - -# define SH_MSG_NOJOBC "no job-control" - -struct s_script -{ - char *buffer; - int fd; - int size; - int lc; -}; - -typedef struct s_script t_script; - struct s_data { char **env; @@ -70,8 +46,6 @@ struct s_data t_list *lst_func; }; -extern t_stof g_builtins[]; - void shell_get_opts(int ac, char **av); char *shell_get_avdata(); void shell_init(int ac, char **av); diff --git a/42sh/includes/parser.h b/42sh/includes/parser.h index 69bf088f..a144c663 100644 --- a/42sh/includes/parser.h +++ b/42sh/includes/parser.h @@ -12,11 +12,8 @@ #ifndef PARSER_H # define PARSER_H -# include "minishell.h" - /* - * Parse POSIX grammar - * +** Parse POSIX grammar */ enum e_parstate @@ -43,8 +40,6 @@ struct s_aggrematch int erase_sym; }; -extern t_aggrematch g_aggrematch[]; - struct s_prodmatch { t_type token; @@ -52,22 +47,21 @@ struct s_prodmatch t_sym new_sym; }; -extern t_prodmatch g_prodmatch[]; - struct s_stackmatch { t_sym top; t_sym under; }; -extern t_stackmatch g_stackmatch[]; - struct s_errormatch { t_type token; char *error; }; +extern t_aggrematch g_aggrematch[]; +extern t_prodmatch g_prodmatch[]; +extern t_stackmatch g_stackmatch[]; extern t_errormatch g_errormatch[]; void parser_init(t_parser *parser); diff --git a/42sh/includes/types.h b/42sh/includes/types.h index 792363f9..8bd09d87 100644 --- a/42sh/includes/types.h +++ b/42sh/includes/types.h @@ -6,44 +6,72 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/13 17:11:48 by jhalford #+# #+# */ -/* Updated: 2017/03/07 15:08:17 by jhalford ### ########.fr */ +/* Updated: 2017/03/07 20:57:19 by wescande ### ########.fr */ +/* Updated: 2017/03/07 18:35:11 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef TYPES_H # define TYPES_H -typedef struct s_data t_data; +# include + +# define SH_INTERACTIVE (1 << 0) +# define SH_OPTS_JOBC (1 << 1) +# define SH_OPTS_LC (1 << 2) +# define SH_MODE_INPUT (1 << 3) +# define SH_MODE_EXEC (1 << 4) + +# define SH_MODE_MASK (SH_MODE_INPUT | SH_MODE_EXEC) +# define SH_HAS_JOBC(b) (b & SH_OPTS_JOBC) +# define SH_IS_INTERACTIVE(b) (b & SH_INTERACTIVE) +# define SH_NO_INTERACTIVE(b) !(b & SH_INTERACTIVE) + +# define SH_MSG_NOJOBC "no job-control" typedef long long t_type; typedef long long t_flag; + +typedef struct s_data t_data; typedef struct s_line t_line; typedef struct s_comp t_comp; typedef struct s_exec t_exec; typedef struct s_jobc t_jobc; typedef enum e_mode t_mode; +/* +** Execution types +*/ + typedef struct s_lexer t_lexer; typedef enum e_lexstate t_lexstate; typedef struct s_token t_token; typedef struct s_rvwords t_rvwords; typedef struct s_ld t_ld; + +/* +** Execution types +*/ + +typedef int t_condition; +typedef struct s_job t_job; +typedef struct s_process t_process; +typedef int (t_execf)(const char *path, + char *const argv[], + char *const envp[]); + +/* +** Parser types +*/ + typedef struct s_astnode t_astnode; typedef struct s_redir t_redir; typedef struct s_cmd t_cmd; typedef union u_astdata t_astdata; typedef union u_word t_word; - -typedef int t_condition; -typedef struct s_job t_job; -typedef struct s_execmap t_execmap; -typedef struct s_redirmap t_redirmap; -typedef struct s_process t_process; -typedef int (t_execf)(const char *path, char *const argv[], char *const envp[]); - -typedef int t_sym; typedef struct s_parser t_parser; +typedef int t_sym; typedef enum e_parstate t_parstate; typedef struct s_aggrematch t_aggrematch; typedef struct s_prodmatch t_prodmatch; @@ -169,4 +197,34 @@ enum e_sym TERMINUS = 300, }; +/* +** LIST D: +*/ + +void ft_ld_new(t_ld **alst, void *content); +t_ld *ft_ld_front(t_ld *ld); +void ft_ld_pushfront(t_ld **alst, void *content); +void ft_ld_pushback(t_ld **alst, void *content); +size_t ft_ld_size(t_ld *ld); +void ft_ld_del(t_ld **ld, void (*del)()); +void ft_ld_clear(t_ld **ld, void (*del)()); +void ft_ld_reverse(t_ld **lst); +t_ld *ft_ld_back(t_ld *ld); +t_ld *ft_ld_swap(t_ld *l_cur); +char **ft_ld_to_tab(t_ld *ld); +t_ld *ft_ld_order(t_ld *ld, int (*f)(), void (*del)()); +t_ld *ft_ld_copy(t_ld *src, void *(*f)(void *elem)); + +/* +** str: +*/ + +char *ft_strjoinf(char *str, char *str2, int mode); +char *ft_strsubf(char *s, unsigned int start, + size_t len, short int mode); +void ft_tabdel(char ***mytab); +int ft_tablen(char **mytab); + +void *ft_memrealloc(void *ptr, size_t old_s, size_t new_s); + #endif diff --git a/42sh/src/addls b/42sh/src/addls deleted file mode 100644 index 8b137891..00000000 --- a/42sh/src/addls +++ /dev/null @@ -1 +0,0 @@ - diff --git a/42sh/src/builtin/bt_read_get.c b/42sh/src/builtin/bt_read_get.c index f2e70ab1..575d694e 100644 --- a/42sh/src/builtin/bt_read_get.c +++ b/42sh/src/builtin/bt_read_get.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "builtin_read.h" +#include "minishell.h" int bt_read_getdelim(t_read *data, char *arg) { diff --git a/42sh/src/builtin/bt_read_parse.c b/42sh/src/builtin/bt_read_parse.c index 15aaff94..d79c754c 100644 --- a/42sh/src/builtin/bt_read_parse.c +++ b/42sh/src/builtin/bt_read_parse.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "builtin_read.h" +#include "minishell.h" static t_readopt *bt_read_getopt(char letter) { diff --git a/42sh/src/builtin/bt_read_term.c b/42sh/src/builtin/bt_read_term.c index 131eaaf7..b0a7477b 100644 --- a/42sh/src/builtin/bt_read_term.c +++ b/42sh/src/builtin/bt_read_term.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "builtin.h" +#include "minishell.h" struct termios bt_read_term(int init) { diff --git a/42sh/src/builtin/builtin_cd.c b/42sh/src/builtin/builtin_cd.c index 4884205e..e3ace609 100644 --- a/42sh/src/builtin/builtin_cd.c +++ b/42sh/src/builtin/builtin_cd.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "builtin.h" +#include "minishell.h" #define CDOPT_L (1 << 0) #define CDOPT_P (1 << 1) diff --git a/42sh/src/builtin/builtin_echo.c b/42sh/src/builtin/builtin_echo.c index f84c9123..2fd4f3de 100644 --- a/42sh/src/builtin/builtin_echo.c +++ b/42sh/src/builtin/builtin_echo.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "builtin.h" +#include "minishell.h" int builtin_echo(const char *path, char *const av[], char *const envp[]) { diff --git a/42sh/src/builtin/builtin_read.c b/42sh/src/builtin/builtin_read.c index cba5e4e6..264f2b3b 100644 --- a/42sh/src/builtin/builtin_read.c +++ b/42sh/src/builtin/builtin_read.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "builtin_read.h" +#include "minishell.h" t_readopt g_readtab[] = { diff --git a/42sh/src/builtin/is_builtin.c b/42sh/src/builtin/is_builtin.c index 3a2ee82c..c48252ed 100644 --- a/42sh/src/builtin/is_builtin.c +++ b/42sh/src/builtin/is_builtin.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/13 13:09:57 by jhalford #+# #+# */ -/* Updated: 2017/03/07 15:17:32 by wescande ### ########.fr */ +/* Updated: 2017/03/07 19:42:54 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/completion/c_binary.c b/42sh/src/completion/c_binary.c index bccc73d8..bf359ca4 100644 --- a/42sh/src/completion/c_binary.c +++ b/42sh/src/completion/c_binary.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "completion.h" +#include "minishell.h" /* ** Retrieve the path from the env and create a char ** from the PATH pattern. diff --git a/42sh/src/completion/c_clear.c b/42sh/src/completion/c_clear.c index 815d12b5..80f6f3fb 100644 --- a/42sh/src/completion/c_clear.c +++ b/42sh/src/completion/c_clear.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "completion.h" +#include "minishell.h" /* ** Clear the list from the memory diff --git a/42sh/src/completion/c_files.c b/42sh/src/completion/c_files.c index dba7bc4f..5931ca22 100644 --- a/42sh/src/completion/c_files.c +++ b/42sh/src/completion/c_files.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "completion.h" +#include "minishell.h" /* ** If the parsing for local file fail. The function is called to check if the diff --git a/42sh/src/completion/c_init.c b/42sh/src/completion/c_init.c index d9701694..5b5c6934 100644 --- a/42sh/src/completion/c_init.c +++ b/42sh/src/completion/c_init.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "completion.h" +#include "minishell.h" /* ** Trim if there's many commands in a raw separed with a semi colon. diff --git a/42sh/src/completion/c_matching.c b/42sh/src/completion/c_matching.c index 761f6ef3..25936087 100644 --- a/42sh/src/completion/c_matching.c +++ b/42sh/src/completion/c_matching.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "completion.h" +#include "minishell.h" /* ** Start the parsing for the autocompletion. diff --git a/42sh/src/completion/c_misc.c b/42sh/src/completion/c_misc.c index fbdd425a..eb740791 100644 --- a/42sh/src/completion/c_misc.c +++ b/42sh/src/completion/c_misc.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "completion.h" +#include "minishell.h" /* ** Support: Return the size of a char**. diff --git a/42sh/src/completion/c_output.c b/42sh/src/completion/c_output.c index 6b9f280d..6704ad3a 100644 --- a/42sh/src/completion/c_output.c +++ b/42sh/src/completion/c_output.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "completion.h" +#include "minishell.h" /* ** Update of the struct data. diff --git a/42sh/src/completion/c_parser.c b/42sh/src/completion/c_parser.c index f611f4df..3788ff73 100644 --- a/42sh/src/completion/c_parser.c +++ b/42sh/src/completion/c_parser.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "completion.h" +#include "minishell.h" /* ** Add the matching element to the list diff --git a/42sh/src/completion/c_pathsolver.c b/42sh/src/completion/c_pathsolver.c index 752d874d..6ab88f40 100644 --- a/42sh/src/completion/c_pathsolver.c +++ b/42sh/src/completion/c_pathsolver.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "completion.h" +#include "minishell.h" /* ** Solve the tilde pattern in the path diff --git a/42sh/src/completion/c_printer.c b/42sh/src/completion/c_printer.c index f43163de..c46fd10d 100644 --- a/42sh/src/completion/c_printer.c +++ b/42sh/src/completion/c_printer.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "completion.h" +#include "minishell.h" /* ** Print the name with or without an underline and colored upon file type diff --git a/42sh/src/completion/c_rematch.c b/42sh/src/completion/c_rematch.c index 13421f70..6771e656 100644 --- a/42sh/src/completion/c_rematch.c +++ b/42sh/src/completion/c_rematch.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "completion.h" +#include "minishell.h" /* ** Recreate a c->match value by adding the new key pressed to it. diff --git a/42sh/src/completion/c_sizing.c b/42sh/src/completion/c_sizing.c index 2d7adda9..559b3329 100644 --- a/42sh/src/completion/c_sizing.c +++ b/42sh/src/completion/c_sizing.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "completion.h" +#include "minishell.h" /* ** Get the max length from the list diff --git a/42sh/src/completion/c_terminal.c b/42sh/src/completion/c_terminal.c index 1b5d28a2..58d01bd7 100644 --- a/42sh/src/completion/c_terminal.c +++ b/42sh/src/completion/c_terminal.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "completion.h" +#include "minishell.h" /* ** Clear the previous list from the screen and restore the same position. diff --git a/42sh/src/completion/completion.c b/42sh/src/completion/completion.c index 42705b56..ba4717c7 100644 --- a/42sh/src/completion/completion.c +++ b/42sh/src/completion/completion.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "completion.h" +#include "minishell.h" /* ** Function to select the next item in the list if it has already been created diff --git a/42sh/src/exec/ast_free.c b/42sh/src/exec/ast_free.c index 4975673e..e9577366 100644 --- a/42sh/src/exec/ast_free.c +++ b/42sh/src/exec/ast_free.c @@ -6,11 +6,11 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/05 11:50:51 by jhalford #+# #+# */ -/* Updated: 2017/03/05 18:05:43 by ariard ### ########.fr */ +/* Updated: 2017/03/07 18:34:27 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" void read_redir(void *data) { diff --git a/42sh/src/exec/error_badidentifier.c b/42sh/src/exec/error_badidentifier.c index 9883f60d..9238d892 100644 --- a/42sh/src/exec/error_badidentifier.c +++ b/42sh/src/exec/error_badidentifier.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" int error_badidentifier(char *name) { diff --git a/42sh/src/exec/exec_ampersand.c b/42sh/src/exec/exec_ampersand.c index 4480fc2e..a95c357c 100644 --- a/42sh/src/exec/exec_ampersand.c +++ b/42sh/src/exec/exec_ampersand.c @@ -6,11 +6,11 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/10 16:01:30 by jhalford #+# #+# */ -/* Updated: 2017/03/03 19:35:21 by jhalford ### ########.fr */ +/* Updated: 2017/03/07 18:24:12 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" int exec_ampersand(t_btree **ast) { diff --git a/42sh/src/exec/exec_and_if.c b/42sh/src/exec/exec_and_if.c index 42ee38a7..b37c2fbc 100644 --- a/42sh/src/exec/exec_and_if.c +++ b/42sh/src/exec/exec_and_if.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" int exec_and_if(t_btree **ast) { diff --git a/42sh/src/exec/exec_case_branch.c b/42sh/src/exec/exec_case_branch.c index 921b136b..76596970 100644 --- a/42sh/src/exec/exec_case_branch.c +++ b/42sh/src/exec/exec_case_branch.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" int exec_case_branch(t_btree **ast) { diff --git a/42sh/src/exec/exec_command.c b/42sh/src/exec/exec_command.c index 5871991b..db331164 100644 --- a/42sh/src/exec/exec_command.c +++ b/42sh/src/exec/exec_command.c @@ -6,11 +6,11 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/14 17:28:14 by jhalford #+# #+# */ -/* Updated: 2017/03/07 16:43:48 by wescande ### ########.fr */ +/* Updated: 2017/03/07 17:33:50 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" /* int exec_cmd(t_btree **ast) { diff --git a/42sh/src/exec/exec_default.c b/42sh/src/exec/exec_default.c index 287cc995..796a10a7 100644 --- a/42sh/src/exec/exec_default.c +++ b/42sh/src/exec/exec_default.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" int exec_default(t_btree **ast) { diff --git a/42sh/src/exec/exec_elif.c b/42sh/src/exec/exec_elif.c index 34ad5d9a..c4a5fa4a 100644 --- a/42sh/src/exec/exec_elif.c +++ b/42sh/src/exec/exec_elif.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" int exec_elif(t_btree **ast) { diff --git a/42sh/src/exec/exec_func.c b/42sh/src/exec/exec_func.c index a4a34f66..7255d850 100644 --- a/42sh/src/exec/exec_func.c +++ b/42sh/src/exec/exec_func.c @@ -10,6 +10,6 @@ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" diff --git a/42sh/src/exec/exec_leaf.c b/42sh/src/exec/exec_leaf.c index 88a36bcc..e237cb99 100644 --- a/42sh/src/exec/exec_leaf.c +++ b/42sh/src/exec/exec_leaf.c @@ -6,11 +6,11 @@ /* By: wescande +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/07 15:47:30 by wescande #+# #+# */ -/* Updated: 2017/03/07 15:50:04 by wescande ### ########.fr */ +/* Updated: 2017/03/07 17:34:51 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" int exec_leaf(t_btree **ast) { diff --git a/42sh/src/exec/exec_math.c b/42sh/src/exec/exec_math.c index 0bbcc8b2..7f9c994a 100644 --- a/42sh/src/exec/exec_math.c +++ b/42sh/src/exec/exec_math.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" static int get_math(char *stream, char **var, char **value, char **operator) { diff --git a/42sh/src/exec/exec_or_if.c b/42sh/src/exec/exec_or_if.c index 5cc45a5e..50def42a 100644 --- a/42sh/src/exec/exec_or_if.c +++ b/42sh/src/exec/exec_or_if.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" int exec_or_if(t_btree **ast) { diff --git a/42sh/src/exec/exec_pipe.c b/42sh/src/exec/exec_pipe.c index 63c280c0..3668da9e 100644 --- a/42sh/src/exec/exec_pipe.c +++ b/42sh/src/exec/exec_pipe.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" int exec_pipe(t_btree **ast) { diff --git a/42sh/src/exec/exec_semi.c b/42sh/src/exec/exec_semi.c index c7848424..4a0d2699 100644 --- a/42sh/src/exec/exec_semi.c +++ b/42sh/src/exec/exec_semi.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" int exec_semi(t_btree **ast) { diff --git a/42sh/src/exec/exec_until.c b/42sh/src/exec/exec_until.c index eb0ebff2..c8b4943a 100644 --- a/42sh/src/exec/exec_until.c +++ b/42sh/src/exec/exec_until.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" int exec_until(t_btree **ast) { diff --git a/42sh/src/exec/exec_var.c b/42sh/src/exec/exec_var.c index b01c2f39..578422d2 100644 --- a/42sh/src/exec/exec_var.c +++ b/42sh/src/exec/exec_var.c @@ -6,11 +6,11 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/07 11:12:05 by ariard #+# #+# */ -/* Updated: 2017/03/07 14:40:30 by ariard ### ########.fr */ +/* Updated: 2017/03/07 18:37:38 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" static int set_var(char *stream, char **var, char **value) { diff --git a/42sh/src/exec/ft_exec.c b/42sh/src/exec/ft_exec.c index 7c70ce5f..072ac974 100644 --- a/42sh/src/exec/ft_exec.c +++ b/42sh/src/exec/ft_exec.c @@ -6,11 +6,11 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/27 20:30:32 by jhalford #+# #+# */ -/* Updated: 2017/03/07 17:22:42 by wescande ### ########.fr */ +/* Updated: 2017/03/07 20:54:28 by wescande ### ########.fr */ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" t_itof g_execmap[] = { @@ -30,7 +30,7 @@ t_itof g_execmap[] = {TK_PAREN_OPEN, &exec_case_branch}, {TK_ASSIGNEMENT_WORD, &exec_var}, {MATH, &exec_math}, - /* {TK_SUBSHELL, &exec_}, */ + /* {TK_SUBSHELL, &exec_leaf}, */ {CMD, &exec_leaf}, {0, 0}, }; diff --git a/42sh/src/exec/launch_builtin.c b/42sh/src/exec/launch_builtin.c index 392c238d..aed14ec5 100644 --- a/42sh/src/exec/launch_builtin.c +++ b/42sh/src/exec/launch_builtin.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" int launch_builtin(t_process *p) { diff --git a/42sh/src/exec/launch_file.c b/42sh/src/exec/launch_file.c index aaa04a6d..80c990b3 100644 --- a/42sh/src/exec/launch_file.c +++ b/42sh/src/exec/launch_file.c @@ -6,11 +6,11 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/07 14:53:31 by jhalford #+# #+# */ -/* Updated: 2017/03/07 17:08:16 by wescande ### ########.fr */ +/* Updated: 2017/03/07 20:58:31 by wescande ### ########.fr */ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" int launch_file(t_process *p) { diff --git a/42sh/src/exec/launch_process.c b/42sh/src/exec/launch_process.c index cd6710f8..11d1b619 100644 --- a/42sh/src/exec/launch_process.c +++ b/42sh/src/exec/launch_process.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/13 14:20:45 by jhalford #+# #+# */ -/* Updated: 2017/03/07 19:02:40 by wescande ### ########.fr */ +/* Updated: 2017/03/07 20:58:52 by wescande ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/exec/launch_while.c b/42sh/src/exec/launch_while.c index 947ea4c6..a003c8b1 100644 --- a/42sh/src/exec/launch_while.c +++ b/42sh/src/exec/launch_while.c @@ -6,11 +6,11 @@ /* By: wescande +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/07 17:20:53 by wescande #+# #+# */ -/* Updated: 2017/03/07 17:30:16 by wescande ### ########.fr */ +/* Updated: 2017/03/07 20:59:40 by wescande ### ########.fr */ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" /* int exec_while(t_btree **ast) { diff --git a/42sh/src/exec/mark_process_status.c b/42sh/src/exec/mark_process_status.c index eeca4a86..ecc3c9ea 100644 --- a/42sh/src/exec/mark_process_status.c +++ b/42sh/src/exec/mark_process_status.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "job_control.h" +#include "minishell.h" int mark_process_status(pid_t pid, int status) { diff --git a/42sh/src/exec/process_redirect.c b/42sh/src/exec/process_redirect.c index 2bb7f19d..3e9b2460 100644 --- a/42sh/src/exec/process_redirect.c +++ b/42sh/src/exec/process_redirect.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" t_redirmap g_redirmap[] = { diff --git a/42sh/src/exec/process_reset.c b/42sh/src/exec/process_reset.c index a3a85852..3b5c065e 100644 --- a/42sh/src/exec/process_reset.c +++ b/42sh/src/exec/process_reset.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" void process_reset(t_process *p) { diff --git a/42sh/src/exec/process_setgroup.c b/42sh/src/exec/process_setgroup.c index 8654d2f8..60caf7e9 100644 --- a/42sh/src/exec/process_setgroup.c +++ b/42sh/src/exec/process_setgroup.c @@ -10,8 +10,8 @@ /* */ /* ************************************************************************** */ -#include "job_control.h" -#include "exec.h" +#include "minishell.h" +#include "minishell.h" int process_setgroup(t_process *p, pid_t pid) { diff --git a/42sh/src/exec/process_setsig.c b/42sh/src/exec/process_setsig.c index b2a68b09..821137ea 100644 --- a/42sh/src/exec/process_setsig.c +++ b/42sh/src/exec/process_setsig.c @@ -1,4 +1,4 @@ -#include "exec.h" +#include "minishell.h" void process_setsig(void) { diff --git a/42sh/src/exec/redir_free.c b/42sh/src/exec/redir_free.c index 5befbe63..fa19403f 100644 --- a/42sh/src/exec/redir_free.c +++ b/42sh/src/exec/redir_free.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" void redir_free(void *data, size_t content_size) { diff --git a/42sh/src/exec/redirect_dgreat.c b/42sh/src/exec/redirect_dgreat.c index f890172b..66fc6881 100644 --- a/42sh/src/exec/redirect_dgreat.c +++ b/42sh/src/exec/redirect_dgreat.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" int redirect_dgreat(t_redir *redir) { diff --git a/42sh/src/exec/redirect_dless.c b/42sh/src/exec/redirect_dless.c index 0244098d..9a1a7873 100644 --- a/42sh/src/exec/redirect_dless.c +++ b/42sh/src/exec/redirect_dless.c @@ -9,7 +9,7 @@ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" int redirect_dless(t_redir *redir) { diff --git a/42sh/src/exec/redirect_great.c b/42sh/src/exec/redirect_great.c index fee82964..13810ae4 100644 --- a/42sh/src/exec/redirect_great.c +++ b/42sh/src/exec/redirect_great.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" int redirect_great(t_redir* redir) { diff --git a/42sh/src/exec/redirect_greatand.c b/42sh/src/exec/redirect_greatand.c index 002375e8..d2bf02aa 100644 --- a/42sh/src/exec/redirect_greatand.c +++ b/42sh/src/exec/redirect_greatand.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" int redirect_greatand(t_redir *redir) { diff --git a/42sh/src/exec/redirect_less.c b/42sh/src/exec/redirect_less.c index c8df2f62..2a1e6809 100644 --- a/42sh/src/exec/redirect_less.c +++ b/42sh/src/exec/redirect_less.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" int redirect_less(t_redir *redir) { diff --git a/42sh/src/exec/redirect_lessand.c b/42sh/src/exec/redirect_lessand.c index bb9987d6..9c184b82 100644 --- a/42sh/src/exec/redirect_lessand.c +++ b/42sh/src/exec/redirect_lessand.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" int redirect_lessand(t_redir *redir) { diff --git a/42sh/src/exec/set_process.c b/42sh/src/exec/set_process.c index b99307ed..9e9f1764 100644 --- a/42sh/src/exec/set_process.c +++ b/42sh/src/exec/set_process.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" int set_process(t_process *p, t_btree *ast) { diff --git a/42sh/src/exec/set_process_cmd.c b/42sh/src/exec/set_process_cmd.c index e47714e6..022e0305 100644 --- a/42sh/src/exec/set_process_cmd.c +++ b/42sh/src/exec/set_process_cmd.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" int set_process_cmd(t_process *p, t_btree *ast, t_cmd *cmd) { diff --git a/42sh/src/exec/set_process_if.c b/42sh/src/exec/set_process_if.c index f07f8202..bdf46274 100644 --- a/42sh/src/exec/set_process_if.c +++ b/42sh/src/exec/set_process_if.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" int set_process_if(t_process *p, t_btree *ast, t_cmd *cmd) { diff --git a/42sh/src/exec/set_process_map.c b/42sh/src/exec/set_process_map.c index ced5af20..004bb01a 100644 --- a/42sh/src/exec/set_process_map.c +++ b/42sh/src/exec/set_process_map.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" t_itof g_setprocessmap[] = { diff --git a/42sh/src/exec/set_process_while.c b/42sh/src/exec/set_process_while.c index bc7b4b1a..4743d859 100644 --- a/42sh/src/exec/set_process_while.c +++ b/42sh/src/exec/set_process_while.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" int set_process_while(t_process *p, t_btree *ast, t_cmd *cmd) { diff --git a/42sh/src/exec/token_to_argv.c b/42sh/src/exec/token_to_argv.c index ae10fae7..10b2c192 100644 --- a/42sh/src/exec/token_to_argv.c +++ b/42sh/src/exec/token_to_argv.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "exec.h" +#include "minishell.h" char **token_to_argv(t_ld *ld, int do_match) { diff --git a/42sh/src/glob/dir_glob.c b/42sh/src/glob/dir_glob.c index f4be218d..2e9f3281 100644 --- a/42sh/src/glob/dir_glob.c +++ b/42sh/src/glob/dir_glob.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "glob.h" +#include "minishell.h" int is_directory(const char *path) { diff --git a/42sh/src/glob/esc_print.c b/42sh/src/glob/esc_print.c index 44de1fb5..504e95bd 100644 --- a/42sh/src/glob/esc_print.c +++ b/42sh/src/glob/esc_print.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "glob.h" +#include "minishell.h" void esc_print(char *str, unsigned char *esc) { diff --git a/42sh/src/glob/expand_bquote.c b/42sh/src/glob/expand_bquote.c index 7c7c0667..d09f7c17 100644 --- a/42sh/src/glob/expand_bquote.c +++ b/42sh/src/glob/expand_bquote.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "glob.h" +#include "minishell.h" static void expand_all_bquote(t_bquote *me, char *content, char *ifs) diff --git a/42sh/src/glob/expand_brace.c b/42sh/src/glob/expand_brace.c index c715ae48..c5d48981 100644 --- a/42sh/src/glob/expand_brace.c +++ b/42sh/src/glob/expand_brace.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "glob.h" +#include "minishell.h" /* ** expand_brace return expansion of a string. diff --git a/42sh/src/glob/expand_esc.c b/42sh/src/glob/expand_esc.c index f66bf422..d5b8104e 100644 --- a/42sh/src/glob/expand_esc.c +++ b/42sh/src/glob/expand_esc.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "glob.h" +#include "minishell.h" unsigned char *calc_expand_esc(const unsigned char *esc, int nb_start, int *nb_middle, int *nb_end) diff --git a/42sh/src/glob/expand_home.c b/42sh/src/glob/expand_home.c index 79c56448..d9c325a7 100644 --- a/42sh/src/glob/expand_home.c +++ b/42sh/src/glob/expand_home.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "glob.h" +#include "minishell.h" void do_expand_home(t_bquote *me, char *home) { diff --git a/42sh/src/glob/expand_var.c b/42sh/src/glob/expand_var.c index ed163a76..1de56e57 100644 --- a/42sh/src/glob/expand_var.c +++ b/42sh/src/glob/expand_var.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "glob.h" +#include "minishell.h" /* ** expand_var return value of $var in the string. diff --git a/42sh/src/glob/ft_strsplit_esc.c b/42sh/src/glob/ft_strsplit_esc.c index 6e050cb7..897b4eb3 100644 --- a/42sh/src/glob/ft_strsplit_esc.c +++ b/42sh/src/glob/ft_strsplit_esc.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "glob.h" +#include "minishell.h" static int ft_strlen_c(const char *str, const char *fix, const unsigned char *esc, char c) diff --git a/42sh/src/glob/ft_strsplit_spe.c b/42sh/src/glob/ft_strsplit_spe.c index 3d69627c..cc65dcf2 100644 --- a/42sh/src/glob/ft_strsplit_spe.c +++ b/42sh/src/glob/ft_strsplit_spe.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "glob.h" +#include "minishell.h" static int ft_strlen_c(const char *str, const char *fix, const unsigned char *esc, char c) diff --git a/42sh/src/glob/glob.c b/42sh/src/glob/glob.c index 91b58a4a..b44b5c89 100644 --- a/42sh/src/glob/glob.c +++ b/42sh/src/glob/glob.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "glob.h" +#include "minishell.h" /* ** glob return expansion of a string. diff --git a/42sh/src/glob/is_char_esc.c b/42sh/src/glob/is_char_esc.c index 13061165..0f83bff6 100644 --- a/42sh/src/glob/is_char_esc.c +++ b/42sh/src/glob/is_char_esc.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "glob.h" +#include "minishell.h" int is_char_esc(const unsigned char *esc, const char *ini_str, const char *str_pos) diff --git a/42sh/src/glob/match_pattern.c b/42sh/src/glob/match_pattern.c index d98fd7e2..f3573fe5 100644 --- a/42sh/src/glob/match_pattern.c +++ b/42sh/src/glob/match_pattern.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "glob.h" +#include "minishell.h" static int match_bracket_char(char **cmp, const char *pat, char c, int neg) { diff --git a/42sh/src/job-control/builtin_bg.c b/42sh/src/job-control/builtin_bg.c index f58a1d1e..99eb37fc 100644 --- a/42sh/src/job-control/builtin_bg.c +++ b/42sh/src/job-control/builtin_bg.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "job_control.h" +#include "minishell.h" int builtin_bg(const char *path, char *const av[], char *const envp[]) { diff --git a/42sh/src/job-control/builtin_fg.c b/42sh/src/job-control/builtin_fg.c index 50d9cb69..9e7720f6 100644 --- a/42sh/src/job-control/builtin_fg.c +++ b/42sh/src/job-control/builtin_fg.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "job_control.h" +#include "minishell.h" int builtin_fg(const char *path, char *const av[], char *const envp[]) { diff --git a/42sh/src/job-control/builtin_jobs.c b/42sh/src/job-control/builtin_jobs.c index f2a83ee0..70395bf6 100644 --- a/42sh/src/job-control/builtin_jobs.c +++ b/42sh/src/job-control/builtin_jobs.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "job_control.h" +#include "minishell.h" static int bt_jobs_parse(char **av, int *i) { diff --git a/42sh/src/job-control/do_job_notification.c b/42sh/src/job-control/do_job_notification.c index 0e2aeef6..48829692 100644 --- a/42sh/src/job-control/do_job_notification.c +++ b/42sh/src/job-control/do_job_notification.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "job_control.h" +#include "minishell.h" int do_job_notification(void) { diff --git a/42sh/src/job-control/job_addprocess.c b/42sh/src/job-control/job_addprocess.c index 8afe2cee..42c5229e 100644 --- a/42sh/src/job-control/job_addprocess.c +++ b/42sh/src/job-control/job_addprocess.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "job_control.h" +#include "minishell.h" int job_addprocess(t_process *p) { diff --git a/42sh/src/job-control/job_format.c b/42sh/src/job-control/job_format.c index 5c811a86..dde4e0fb 100644 --- a/42sh/src/job-control/job_format.c +++ b/42sh/src/job-control/job_format.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "job_control.h" +#include "minishell.h" void job_format(t_job *j, int opts) { diff --git a/42sh/src/job-control/job_format_head.c b/42sh/src/job-control/job_format_head.c index c7b8854f..f874933e 100644 --- a/42sh/src/job-control/job_format_head.c +++ b/42sh/src/job-control/job_format_head.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "job_control.h" +#include "minishell.h" void job_format_head(t_job *j) { diff --git a/42sh/src/job-control/job_free.c b/42sh/src/job-control/job_free.c index db63e7f2..7046cfe7 100644 --- a/42sh/src/job-control/job_free.c +++ b/42sh/src/job-control/job_free.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "job_control.h" +#include "minishell.h" void job_free(void *content, size_t content_size) { diff --git a/42sh/src/job-control/job_getprocess.c b/42sh/src/job-control/job_getprocess.c index 3ad82217..17eec5d2 100644 --- a/42sh/src/job-control/job_getprocess.c +++ b/42sh/src/job-control/job_getprocess.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "job_control.h" +#include "minishell.h" t_list *job_getprocess(pid_t pid) { diff --git a/42sh/src/job-control/job_getrank.c b/42sh/src/job-control/job_getrank.c index f07263e0..6da80d6b 100644 --- a/42sh/src/job-control/job_getrank.c +++ b/42sh/src/job-control/job_getrank.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "job_control.h" +#include "minishell.h" void job_getrank(int (*rank)[2]) { diff --git a/42sh/src/job-control/job_is_completed.c b/42sh/src/job-control/job_is_completed.c index 9742515a..c289614f 100644 --- a/42sh/src/job-control/job_is_completed.c +++ b/42sh/src/job-control/job_is_completed.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "job_control.h" +#include "minishell.h" int job_is_completed(int id) { diff --git a/42sh/src/job-control/job_is_stopped.c b/42sh/src/job-control/job_is_stopped.c index b7c20a91..60eed462 100644 --- a/42sh/src/job-control/job_is_stopped.c +++ b/42sh/src/job-control/job_is_stopped.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "job_control.h" +#include "minishell.h" int job_is_stopped(int id) { diff --git a/42sh/src/job-control/job_kill_all.c b/42sh/src/job-control/job_kill_all.c index 1d36a8a6..ded01abd 100644 --- a/42sh/src/job-control/job_kill_all.c +++ b/42sh/src/job-control/job_kill_all.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "job_control.h" +#include "minishell.h" void job_kill_all(void) { diff --git a/42sh/src/job-control/job_notify_change.c b/42sh/src/job-control/job_notify_change.c index fd6c7728..3ec46e79 100644 --- a/42sh/src/job-control/job_notify_change.c +++ b/42sh/src/job-control/job_notify_change.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "job_control.h" +#include "minishell.h" void job_notify_change(int id) { diff --git a/42sh/src/job-control/job_notify_new.c b/42sh/src/job-control/job_notify_new.c index 1b39f0ea..d19feb96 100644 --- a/42sh/src/job-control/job_notify_new.c +++ b/42sh/src/job-control/job_notify_new.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "job_control.h" +#include "minishell.h" void job_notify_new(t_job *job) { diff --git a/42sh/src/job-control/job_remove.c b/42sh/src/job-control/job_remove.c index 2ffe9c8a..794a6c44 100644 --- a/42sh/src/job-control/job_remove.c +++ b/42sh/src/job-control/job_remove.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "job_control.h" +#include "minishell.h" void job_remove(int id) { diff --git a/42sh/src/job-control/job_run.c b/42sh/src/job-control/job_run.c index bd9d0f48..412af6df 100644 --- a/42sh/src/job-control/job_run.c +++ b/42sh/src/job-control/job_run.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "job_control.h" +#include "minishell.h" void job_run(t_job *job, int foreground) { diff --git a/42sh/src/job-control/job_update_status.c b/42sh/src/job-control/job_update_status.c index 5e314792..cae2b934 100644 --- a/42sh/src/job-control/job_update_status.c +++ b/42sh/src/job-control/job_update_status.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "job_control.h" +#include "minishell.h" void job_update_status(void) { diff --git a/42sh/src/job-control/job_wait.c b/42sh/src/job-control/job_wait.c index 38f18f8f..966b5f3c 100644 --- a/42sh/src/job-control/job_wait.c +++ b/42sh/src/job-control/job_wait.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "job_control.h" +#include "minishell.h" int job_wait(int id) { diff --git a/42sh/src/job-control/mark_job_as_running.c b/42sh/src/job-control/mark_job_as_running.c index 3d5f3cfb..ae34335f 100644 --- a/42sh/src/job-control/mark_job_as_running.c +++ b/42sh/src/job-control/mark_job_as_running.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "job_control.h" +#include "minishell.h" void mark_job_as_running(t_job *j) { diff --git a/42sh/src/job-control/process_format.c b/42sh/src/job-control/process_format.c index c8cad1a0..8954b13d 100644 --- a/42sh/src/job-control/process_format.c +++ b/42sh/src/job-control/process_format.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "job_control.h" +#include "minishell.h" static void process_format_state(t_process *p) { diff --git a/42sh/src/job-control/process_free.c b/42sh/src/job-control/process_free.c index d7348c90..f4e0047c 100644 --- a/42sh/src/job-control/process_free.c +++ b/42sh/src/job-control/process_free.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "job_control.h" +#include "minishell.h" void process_free(void *content, size_t content_size) { diff --git a/42sh/src/job-control/put_job_in_background.c b/42sh/src/job-control/put_job_in_background.c index 895b58a9..8498bea7 100644 --- a/42sh/src/job-control/put_job_in_background.c +++ b/42sh/src/job-control/put_job_in_background.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "job_control.h" +#include "minishell.h" int put_job_in_background(t_job *j, int cont) { diff --git a/42sh/src/job-control/put_job_in_foreground.c b/42sh/src/job-control/put_job_in_foreground.c index c5b75d0b..67570957 100644 --- a/42sh/src/job-control/put_job_in_foreground.c +++ b/42sh/src/job-control/put_job_in_foreground.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "job_control.h" +#include "minishell.h" int put_job_in_foreground(t_job *j, int cont) { diff --git a/42sh/src/lexer/get_lexer_stack.c b/42sh/src/lexer/get_lexer_stack.c index a574564c..b37ec859 100644 --- a/42sh/src/lexer/get_lexer_stack.c +++ b/42sh/src/lexer/get_lexer_stack.c @@ -6,11 +6,11 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/03 17:39:45 by jhalford #+# #+# */ -/* Updated: 2017/03/05 16:27:04 by jhalford ### ########.fr */ +/* Updated: 2017/03/07 19:33:30 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ -#include "lexer.h" +#include "minishell.h" int get_lexer_stack(t_lexer lexer) { diff --git a/42sh/src/lexer/get_reserved_words.c b/42sh/src/lexer/get_reserved_words.c index 4d14e54d..e1c525ff 100644 --- a/42sh/src/lexer/get_reserved_words.c +++ b/42sh/src/lexer/get_reserved_words.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "lexer.h" +#include "minishell.h" t_rvwords g_rvwords[] = diff --git a/42sh/src/lexer/get_state_global.c b/42sh/src/lexer/get_state_global.c index d0ab9d18..5fd8532e 100644 --- a/42sh/src/lexer/get_state_global.c +++ b/42sh/src/lexer/get_state_global.c @@ -6,11 +6,11 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/09 20:39:06 by jhalford #+# #+# */ -/* Updated: 2017/03/05 17:29:24 by jhalford ### ########.fr */ +/* Updated: 2017/03/07 19:33:58 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ -#include "lexer.h" +#include "minishell.h" t_lexstate get_state_global(t_lexer *lexer) { @@ -19,7 +19,7 @@ t_lexstate get_state_global(t_lexer *lexer) c = lexer->str[lexer->pos]; if (ft_is_delim(c)) return (DELIM); - else if (c == '&' || c == ';' || c == '|') + else if (c == '&' || c == ';' || c == '|' || c == '!') return (SEP); else if (c == '\\') return (BACKSLASH); diff --git a/42sh/src/lexer/get_state_redir.c b/42sh/src/lexer/get_state_redir.c index 6ea22d94..d4d60d3b 100644 --- a/42sh/src/lexer/get_state_redir.c +++ b/42sh/src/lexer/get_state_redir.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "lexer.h" +#include "minishell.h" t_lexstate get_state_redir(t_lexer *lexer) { diff --git a/42sh/src/lexer/insert_newline.c b/42sh/src/lexer/insert_newline.c index 6d39ec5d..7a24a0ca 100644 --- a/42sh/src/lexer/insert_newline.c +++ b/42sh/src/lexer/insert_newline.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "parser.h" +#include "minishell.h" int insert_newline(t_list **alst) { diff --git a/42sh/src/lexer/lexer_assignement_word.c b/42sh/src/lexer/lexer_assignement_word.c index a6bae9dd..2f802e33 100644 --- a/42sh/src/lexer/lexer_assignement_word.c +++ b/42sh/src/lexer/lexer_assignement_word.c @@ -6,11 +6,11 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/24 20:28:13 by ariard #+# #+# */ -/* Updated: 2017/03/02 19:11:25 by jhalford ### ########.fr */ +/* Updated: 2017/03/07 18:36:23 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ -#include "lexer.h" +#include "minishell.h" int lexer_assignement_word(t_list **alst, t_lexer *lexer) { diff --git a/42sh/src/lexer/lexer_backslash.c b/42sh/src/lexer/lexer_backslash.c index abd2a95c..3418e2a2 100644 --- a/42sh/src/lexer/lexer_backslash.c +++ b/42sh/src/lexer/lexer_backslash.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "lexer.h" +#include "minishell.h" int lexer_backslash(t_list **alst, t_lexer *lexer) { diff --git a/42sh/src/lexer/lexer_bquote.c b/42sh/src/lexer/lexer_bquote.c index b4360556..2e7cb813 100644 --- a/42sh/src/lexer/lexer_bquote.c +++ b/42sh/src/lexer/lexer_bquote.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "lexer.h" +#include "minishell.h" int lexer_bquote(t_list **alst, t_lexer *lexer) { diff --git a/42sh/src/lexer/lexer_curly_braces.c b/42sh/src/lexer/lexer_curly_braces.c index 1674027a..d6eee381 100644 --- a/42sh/src/lexer/lexer_curly_braces.c +++ b/42sh/src/lexer/lexer_curly_braces.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "parser.h" +#include "minishell.h" int lexer_curly_braces(t_list **alst, t_lexer *lexer) { diff --git a/42sh/src/lexer/lexer_default.c b/42sh/src/lexer/lexer_default.c index 0fff3b18..a2802c5c 100644 --- a/42sh/src/lexer/lexer_default.c +++ b/42sh/src/lexer/lexer_default.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "lexer.h" +#include "minishell.h" int lexer_default(t_list **alst, t_lexer *lexer) { diff --git a/42sh/src/lexer/lexer_delim.c b/42sh/src/lexer/lexer_delim.c index 648aa8a0..d67b61d5 100644 --- a/42sh/src/lexer/lexer_delim.c +++ b/42sh/src/lexer/lexer_delim.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "lexer.h" +#include "minishell.h" int lexer_delim(t_list **alst, t_lexer *lexer) { diff --git a/42sh/src/lexer/lexer_dless.c b/42sh/src/lexer/lexer_dless.c index f0e0ee4d..d3859b87 100644 --- a/42sh/src/lexer/lexer_dless.c +++ b/42sh/src/lexer/lexer_dless.c @@ -1,4 +1,4 @@ -#include "lexer.h" +#include "minishell.h" int lexer_dless(t_list **alst, t_lexer *lexer) { diff --git a/42sh/src/lexer/lexer_dquote.c b/42sh/src/lexer/lexer_dquote.c index b158a14d..10455689 100644 --- a/42sh/src/lexer/lexer_dquote.c +++ b/42sh/src/lexer/lexer_dquote.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "lexer.h" +#include "minishell.h" int lexer_dquote(t_list **alst, t_lexer *lexer) { diff --git a/42sh/src/lexer/lexer_end.c b/42sh/src/lexer/lexer_end.c index dcc162c8..4e3be646 100644 --- a/42sh/src/lexer/lexer_end.c +++ b/42sh/src/lexer/lexer_end.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "lexer.h" +#include "minishell.h" int lexer_end(t_list **alst, t_lexer *lexer) { diff --git a/42sh/src/lexer/lexer_great.c b/42sh/src/lexer/lexer_great.c index 7e43e814..6e582bdc 100644 --- a/42sh/src/lexer/lexer_great.c +++ b/42sh/src/lexer/lexer_great.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "lexer.h" +#include "minishell.h" int lexer_great(t_list **alst, t_lexer *lexer) { diff --git a/42sh/src/lexer/lexer_greatand.c b/42sh/src/lexer/lexer_greatand.c index 4f802455..83d96d8b 100644 --- a/42sh/src/lexer/lexer_greatand.c +++ b/42sh/src/lexer/lexer_greatand.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "lexer.h" +#include "minishell.h" int lexer_greatand(t_list **alst, t_lexer *lexer) { diff --git a/42sh/src/lexer/lexer_init.c b/42sh/src/lexer/lexer_init.c index 799a52db..a7000895 100644 --- a/42sh/src/lexer/lexer_init.c +++ b/42sh/src/lexer/lexer_init.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "lexer.h" +#include "minishell.h" void lexer_init(t_lexer *lexer) { diff --git a/42sh/src/lexer/lexer_less.c b/42sh/src/lexer/lexer_less.c index 92d6bf45..9d08611c 100644 --- a/42sh/src/lexer/lexer_less.c +++ b/42sh/src/lexer/lexer_less.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "lexer.h" +#include "minishell.h" int lexer_less(t_list **alst, t_lexer *lexer) { diff --git a/42sh/src/lexer/lexer_lessand.c b/42sh/src/lexer/lexer_lessand.c index 1e5cfb20..f7d30d45 100644 --- a/42sh/src/lexer/lexer_lessand.c +++ b/42sh/src/lexer/lexer_lessand.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "lexer.h" +#include "minishell.h" int lexer_lessand(t_list **alst, t_lexer *lexer) { diff --git a/42sh/src/lexer/lexer_lex.c b/42sh/src/lexer/lexer_lex.c index 8dadd9e3..9ec90b49 100644 --- a/42sh/src/lexer/lexer_lex.c +++ b/42sh/src/lexer/lexer_lex.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "lexer.h" +#include "minishell.h" int (*g_lexer[])(t_list **alst, t_lexer *lexer) = { diff --git a/42sh/src/lexer/lexer_newline.c b/42sh/src/lexer/lexer_newline.c index 31b45b4b..b2256091 100644 --- a/42sh/src/lexer/lexer_newline.c +++ b/42sh/src/lexer/lexer_newline.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "lexer.h" +#include "minishell.h" int lexer_newline(t_list **alst, t_lexer *lexer) { diff --git a/42sh/src/lexer/lexer_number.c b/42sh/src/lexer/lexer_number.c index 910dbd7b..f986fb12 100644 --- a/42sh/src/lexer/lexer_number.c +++ b/42sh/src/lexer/lexer_number.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "lexer.h" +#include "minishell.h" int lexer_number(t_list **alst, t_lexer *lexer) { diff --git a/42sh/src/lexer/lexer_paren.c b/42sh/src/lexer/lexer_paren.c index db8b0545..735e56fe 100644 --- a/42sh/src/lexer/lexer_paren.c +++ b/42sh/src/lexer/lexer_paren.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "lexer.h" +#include "minishell.h" int lexer_paren(t_list **alst, t_lexer *lexer) { diff --git a/42sh/src/lexer/lexer_quote.c b/42sh/src/lexer/lexer_quote.c index 9b1afbd1..67cbc4c7 100644 --- a/42sh/src/lexer/lexer_quote.c +++ b/42sh/src/lexer/lexer_quote.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "lexer.h" +#include "minishell.h" int lexer_quote(t_list **alst, t_lexer *lexer) { diff --git a/42sh/src/lexer/lexer_sep.c b/42sh/src/lexer/lexer_sep.c index 2c12ea8b..c159a930 100644 --- a/42sh/src/lexer/lexer_sep.c +++ b/42sh/src/lexer/lexer_sep.c @@ -6,11 +6,11 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/30 16:29:57 by jhalford #+# #+# */ -/* Updated: 2017/02/24 19:14:57 by ariard ### ########.fr */ +/* Updated: 2017/03/07 19:40:52 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ -#include "lexer.h" +#include "minishell.h" int lexer_sep(t_list **alst, t_lexer *lexer) { @@ -37,8 +37,11 @@ int lexer_sep(t_list **alst, t_lexer *lexer) token->type = cn == '&' ? TK_AND_IF : TK_AMP; else if (c == '|') token->type = cn == '|' ? TK_OR_IF : TK_PIPE; + else if (c == '!') + token->type = TK_BANG; token->type = (c == ';') ? TK_SEMI : token->type; token->type = (c == ';') && (cn == ';') ? TK_DSEMI : token->type; +// c est ici que ca bug, ca marche plus les bitwise sur des enums lexer->pos += 1 + (token->type & (TK_AND_IF | TK_OR_IF | TK_DSEMI) ? 1 : 0); return (lexer_lex(&(*alst)->next, lexer)); } diff --git a/42sh/src/lexer/lexer_word.c b/42sh/src/lexer/lexer_word.c index 2fcf8faa..d5ad413c 100644 --- a/42sh/src/lexer/lexer_word.c +++ b/42sh/src/lexer/lexer_word.c @@ -6,31 +6,11 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/03 12:07:11 by jhalford #+# #+# */ -/* Updated: 2017/03/07 19:00:22 by wescande ### ########.fr */ +/* Updated: 2017/03/07 21:00:18 by wescande ### ########.fr */ /* */ /* ************************************************************************** */ -#include "lexer.h" -/* -static int word_is_assignment(t_token *token) -{ - const int len = ft_strlen(token->data); - int pos; - char c; - - pos = -1; - if (ft_isdigit(token->data[pos])) - return (0); - while (++pos < len) - { - if (is_char_esc(token->esc, token->data, token->data + pos)) - return (0); - c = token->data[pos]; - if (!ft_isalnum(c) && c != '_') - return (0); - } - return (1); -}*/ +#include "minishell.h" int lexer_word(t_list **alst, t_lexer *lexer) { diff --git a/42sh/src/lexer/token_append.c b/42sh/src/lexer/token_append.c index 75de9fb1..45a45b97 100644 --- a/42sh/src/lexer/token_append.c +++ b/42sh/src/lexer/token_append.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "lexer.h" +#include "minishell.h" int token_append_char(t_token *token, char c, short int esc, short int esc2) diff --git a/42sh/src/lexer/token_cmp_type.c b/42sh/src/lexer/token_cmp_type.c index 23ad5562..4185bc7b 100644 --- a/42sh/src/lexer/token_cmp_type.c +++ b/42sh/src/lexer/token_cmp_type.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "lexer.h" +#include "minishell.h" int token_cmp_type(t_token *token, t_type *ref) { diff --git a/42sh/src/lexer/token_free.c b/42sh/src/lexer/token_free.c index d88b0e1b..0727f7a5 100644 --- a/42sh/src/lexer/token_free.c +++ b/42sh/src/lexer/token_free.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "lexer.h" +#include "minishell.h" void token_free(void *data, size_t size) { diff --git a/42sh/src/lexer/token_init.c b/42sh/src/lexer/token_init.c index dcf4a219..4739d61b 100644 --- a/42sh/src/lexer/token_init.c +++ b/42sh/src/lexer/token_init.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "lexer.h" +#include "minishell.h" t_token *token_init(void) { diff --git a/42sh/src/lexer/token_print.c b/42sh/src/lexer/token_print.c index 4f71879f..c4529027 100644 --- a/42sh/src/lexer/token_print.c +++ b/42sh/src/lexer/token_print.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "lexer.h" +#include "minishell.h" void token_print(t_list *lst) { diff --git a/42sh/src/main/instruction_free.c b/42sh/src/main/instruction_free.c index 5f27155a..69a80006 100644 --- a/42sh/src/main/instruction_free.c +++ b/42sh/src/main/instruction_free.c @@ -1,4 +1,4 @@ -#include "parser.h" +#include "minishell.h" int instruction_free(t_list **token, t_parser *parser, t_btree **ast) { diff --git a/42sh/src/parser/add_case.c b/42sh/src/parser/add_case.c index 4b4d5415..04a3cdea 100644 --- a/42sh/src/parser/add_case.c +++ b/42sh/src/parser/add_case.c @@ -6,11 +6,11 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/04 20:42:13 by ariard #+# #+# */ -/* Updated: 2017/03/07 11:52:45 by ariard ### ########.fr */ +/* Updated: 2017/03/07 19:32:45 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ -#include "parser.h" +#include "minishell.h" int iscase(t_btree **ast, t_list **lst) { diff --git a/42sh/src/parser/add_cmd.c b/42sh/src/parser/add_cmd.c index f88cbaa8..47eb3499 100644 --- a/42sh/src/parser/add_cmd.c +++ b/42sh/src/parser/add_cmd.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "parser.h" +#include "minishell.h" t_distrostree g_distrostree[] = { diff --git a/42sh/src/parser/add_condition.c b/42sh/src/parser/add_condition.c index bc62c84f..902606c5 100644 --- a/42sh/src/parser/add_condition.c +++ b/42sh/src/parser/add_condition.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "parser.h" +#include "minishell.h" int iscondition(t_btree **ast, t_list **lst) { diff --git a/42sh/src/parser/add_func.c b/42sh/src/parser/add_func.c index cc481f37..736e7e22 100644 --- a/42sh/src/parser/add_func.c +++ b/42sh/src/parser/add_func.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "parser.h" +#include "minishell.h" int isfunc_name(t_btree **ast, t_list **lst) { diff --git a/42sh/src/parser/add_loop.c b/42sh/src/parser/add_loop.c index 427b0741..b393ebef 100644 --- a/42sh/src/parser/add_loop.c +++ b/42sh/src/parser/add_loop.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "parser.h" +#include "minishell.h" int isloop(t_btree **ast, t_list **lst) { diff --git a/42sh/src/parser/add_math.c b/42sh/src/parser/add_math.c index 78a3f414..a309a957 100644 --- a/42sh/src/parser/add_math.c +++ b/42sh/src/parser/add_math.c @@ -1,4 +1,4 @@ -#include "parser.h" +#include "minishell.h" int ismath(t_btree **ast, t_list **lst) { diff --git a/42sh/src/parser/add_number.c b/42sh/src/parser/add_number.c index 7ed5d7de..67873692 100644 --- a/42sh/src/parser/add_number.c +++ b/42sh/src/parser/add_number.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "parser.h" +#include "minishell.h" int isionumber(t_btree **ast, t_list **lst) { diff --git a/42sh/src/parser/add_redir.c b/42sh/src/parser/add_redir.c index ce91da7c..41df28a0 100644 --- a/42sh/src/parser/add_redir.c +++ b/42sh/src/parser/add_redir.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "parser.h" +#include "minishell.h" int isdir_sep(t_btree **ast, t_list **list) { diff --git a/42sh/src/parser/add_sep.c b/42sh/src/parser/add_sep.c index 111c7786..2985134c 100644 --- a/42sh/src/parser/add_sep.c +++ b/42sh/src/parser/add_sep.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "parser.h" +#include "minishell.h" int add_sep(t_btree **ast, t_list **lst) { diff --git a/42sh/src/parser/add_subshell.c b/42sh/src/parser/add_subshell.c index 80dea8e7..9b5f6c58 100644 --- a/42sh/src/parser/add_subshell.c +++ b/42sh/src/parser/add_subshell.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "parser.h" +#include "minishell.h" int issubshell(t_btree **ast, t_list **lst) { diff --git a/42sh/src/parser/add_var.c b/42sh/src/parser/add_var.c index 661446b4..e191490f 100644 --- a/42sh/src/parser/add_var.c +++ b/42sh/src/parser/add_var.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "parser.h" +#include "minishell.h" int isvar(t_btree **ast, t_list **lst) { diff --git a/42sh/src/parser/aggregate_sym.c b/42sh/src/parser/aggregate_sym.c index 54e8da17..65edcf13 100644 --- a/42sh/src/parser/aggregate_sym.c +++ b/42sh/src/parser/aggregate_sym.c @@ -9,7 +9,7 @@ /* */ /* ************************************************************************** */ -#include "parser.h" +#include "minishell.h" t_aggrematch g_aggrematch[] = { @@ -45,6 +45,9 @@ t_aggrematch g_aggrematch[] = {TK_PAREN_CLOSE, COMPOUND_LIST, SUBSHELL, TK_PAREN_OPEN}, {TK_PAREN_CLOSE, CMD_SUPERIOR, SUBSHELL, TK_PAREN_OPEN}, {TK_PAREN_CLOSE, PIPE_SEMI_SEQUENCE, SUBSHELL, TK_PAREN_OPEN}, + {TK_RBRACE, COMPOUND_LIST, BRACE_CLAUSE, TK_LBRACE}, + {TK_RBRACE, CMD_SUPERIOR, BRACE_CLAUSE, TK_LBRACE}, + {TK_RBRACE, PIPE_SEMI_SEQUENCE, BRACE_CLAUSE, TK_LBRACE}, {TK_RBRACE, COMPOUND_LIST, BRACE_CLAUSE, TK_LBRACE}, {TK_RBRACE, CMD_SUPERIOR, BRACE_CLAUSE, TK_LBRACE}, @@ -73,13 +76,14 @@ t_aggrematch g_aggrematch[] = {LINEBREAK, PIPE_SEMI_SEQUENCE, PIPE_SEQUENCE, PIPE_SEMI_SEQUENCE}, {LINEBREAK, COMPOUND_LIST, COMPOUND_LIST, COMPOUND_LIST}, {LINEBREAK, CASE_LIST_NS, CASE_LIST_NS, CASE_LIST_NS}, - {LINEBREAK, COMPLETE_COMMANDS, PROGRAM, LINEBREAK}, {NEWLINE_LIST, MATH_SUP, CMD_SUPERIOR, MATH_SUP}, {NEWLINE_LIST, CMD_NAME, CMD_SUPERIOR, CMD_NAME}, {NEWLINE_LIST, SEQUENTIAL_SEP, SEQUENTIAL_SEP, SEQUENTIAL_SEP}, {NEWLINE_LIST, TK_DO, TK_DO, TK_DO}, {NEWLINE_LIST, TK_PAREN_CLOSE, TK_PAREN_CLOSE, TK_PAREN_CLOSE}, {NEWLINE_LIST, TK_PAREN_OPEN, TK_PAREN_OPEN, TK_PAREN_OPEN}, + {NEWLINE_LIST, TK_RBRACE, TK_RBRACE, TK_RBRACE}, + {NEWLINE_LIST, TK_LBRACE, TK_LBRACE, TK_LBRACE}, {NEWLINE_LIST, TK_IN, TK_IN, TK_IN}, {NEWLINE_LIST, TK_THEN, TK_THEN, TK_THEN}, {NEWLINE_LIST, TK_IF, TK_IF, TK_IF}, @@ -208,6 +212,7 @@ t_aggrematch g_aggrematch[] = {AND_OR_MINOR, TK_LBRACE, AND_OR_MAJOR, 0}, {AND_OR_MINOR, COMPLETE_COMMANDS, AND_OR_MAJOR, 0}, {AND_OR_MINOR, AND_OR_MAJOR, AND_OR_MAJOR, 0}, + {AND_OR_MINOR, TK_BANG, AND_OR_MAJOR, 0}, {COMMAND, SEQUENCE, PIPE_SEMI_SEQUENCE, 0}, // {COMMAND, PIPE_SEMI_SEQUENCE, PIPE_SEMI_SEQUENCE, PIPE_SEMI_SEQUENCE}, // watch @@ -225,6 +230,7 @@ t_aggrematch g_aggrematch[] = {COMMAND, SEPARATOR_OP, PIPE_SEMI_SEQUENCE, 0}, {COMMAND, NEWLINE_LIST, PIPE_SEMI_SEQUENCE, 0}, {COMMAND, LINEBREAK, PIPE_SEMI_SEQUENCE, 0}, + {COMMAND, TK_BANG, PIPE_SEMI_SEQUENCE, 0}, {COMMAND, TK_PAREN_OPEN, PIPE_SEMI_SEQUENCE, 0}, {COMMAND, TK_LBRACE, PIPE_SEMI_SEQUENCE, 0}, {COMMAND, COMPLETE_COMMANDS, PIPE_SEMI_SEQUENCE, 0}, @@ -237,6 +243,7 @@ t_aggrematch g_aggrematch[] = {END_COMMAND, TK_WHILE, PIPE_SEQUENCE, 0}, {END_COMMAND, TK_UNTIL, PIPE_SEQUENCE, 0}, {END_COMMAND, LINEBREAK, PIPE_SEQUENCE, 0}, + {END_COMMAND, TK_BANG, PIPE_SEQUENCE, 0}, {END_COMMAND, TK_PAREN_OPEN, PIPE_SEQUENCE, 0}, {END_COMMAND, TK_LBRACE, PIPE_SEQUENCE, 0}, {END_COMMAND, COMPLETE_COMMANDS, PIPE_SEQUENCE, 0}, @@ -281,6 +288,7 @@ t_aggrematch g_aggrematch[] = {PIPELINE, COMPOUND_LIST, AND_OR, 0}, {PIPELINE, CASE_LIST_NS, AND_OR, 0}, {PIPELINE, LINEBREAK, AND_OR, 0}, + {PIPELINE, TK_BANG, AND_OR, 0}, {PIPELINE, TK_PAREN_OPEN, AND_OR, 0}, {PIPELINE, TK_LBRACE, AND_OR, 0}, {PIPELINE, COMPLETE_COMMANDS, AND_OR, 0}, @@ -305,6 +313,7 @@ t_aggrematch g_aggrematch[] = {AND_OR, SEPARATOR_OP, LIST, LIST}, {AND_OR, NEWLINE_LIST, LIST, 0}, {AND_OR, LINEBREAK, LIST, 0}, + {AND_OR, TK_BANG, LIST, 0}, {AND_OR, TK_LBRACE, LIST, 0}, {AND_OR, COMPLETE_COMMANDS, LIST, 0}, {LIST, NEWLINE_LIST, COMPLETE_COMMAND, 0}, diff --git a/42sh/src/parser/build_tree.c b/42sh/src/parser/build_tree.c index e8b79714..a51e1241 100644 --- a/42sh/src/parser/build_tree.c +++ b/42sh/src/parser/build_tree.c @@ -6,16 +6,17 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/15 18:32:59 by ariard #+# #+# */ -/* Updated: 2017/03/06 15:55:07 by ariard ### ########.fr */ +/* Updated: 2017/03/07 19:32:15 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ -#include "parser.h" +#include "minishell.h" t_treematch g_treematch[] = { {TK_WORD, &add_cmd}, {TK_PIPE, &add_sep}, + {TK_BANG, &add_sep}, {TK_SEMI, &add_sep}, {TK_GREAT, &add_cmd}, {TK_LESS, &add_cmd}, diff --git a/42sh/src/parser/error_syntax.c b/42sh/src/parser/error_syntax.c index d48228c6..e3ebe5e4 100644 --- a/42sh/src/parser/error_syntax.c +++ b/42sh/src/parser/error_syntax.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "parser.h" +#include "minishell.h" t_errormatch g_errormatch[] = { diff --git a/42sh/src/parser/eval_sym.c b/42sh/src/parser/eval_sym.c index b51bd6d4..957c647d 100644 --- a/42sh/src/parser/eval_sym.c +++ b/42sh/src/parser/eval_sym.c @@ -9,7 +9,7 @@ /* */ /* ************************************************************************** */ -#include "parser.h" +#include "minishell.h" t_stackmatch g_stackmatch[] = { @@ -18,6 +18,7 @@ t_stackmatch g_stackmatch[] = {TK_WORD, TK_CASE}, {TK_WORD, WORDLIST}, {TK_WORD, LINEBREAK}, + {TK_WORD, TK_BANG}, {TK_WORD, TK_PAREN_OPEN}, {TK_WORD, TK_LBRACE}, {TK_WORD, COMPLETE_COMMANDS}, @@ -31,6 +32,7 @@ t_stackmatch g_stackmatch[] = {TK_IO_NUMBER, CMD_NAME}, {TK_IO_NUMBER, CMD_WORD}, {TK_IO_NUMBER, LINEBREAK}, + {TK_IO_NUMBER, TK_BANG}, {TK_IO_NUMBER, TK_PAREN_OPEN}, {TK_IO_NUMBER, TK_LBRACE}, {TK_IO_NUMBER, COMPLETE_COMMANDS}, @@ -48,6 +50,7 @@ t_stackmatch g_stackmatch[] = {TK_OR_IF, CMD_SUPERIOR}, {TK_OR_IF, AND_OR}, {TK_DSEMI, LINEBREAK}, + {TK_DSEMI, TK_BANG}, {TK_DSEMI, COMPLETE_COMMANDS}, {TK_DSEMI, COMPOUND_LIST}, {TK_DSEMI, CASE_LIST_NS}, @@ -62,6 +65,7 @@ t_stackmatch g_stackmatch[] = {TK_LESS, CMD_WORD}, {TK_LESS, CMD_NAME}, {TK_LESS, LINEBREAK}, + {TK_LESS, TK_BANG}, {TK_LESS, TK_PAREN_OPEN}, {TK_LESS, TK_LBRACE}, {TK_LESS, COMPLETE_COMMANDS}, @@ -80,6 +84,7 @@ t_stackmatch g_stackmatch[] = {TK_GREAT, CMD_WORD}, {TK_GREAT, CMD_NAME}, {TK_GREAT, LINEBREAK}, + {TK_GREAT, TK_BANG}, {TK_GREAT, TK_PAREN_OPEN}, {TK_GREAT, TK_LBRACE}, {TK_GREAT, COMPLETE_COMMANDS}, @@ -100,6 +105,7 @@ t_stackmatch g_stackmatch[] = {TK_DLESS, CMD_WORD}, {TK_DLESS, CMD_NAME}, {TK_DLESS, LINEBREAK}, + {TK_DLESS, TK_BANG}, {TK_DLESS, TK_PAREN_OPEN}, {TK_DLESS, TK_LBRACE}, {TK_DLESS, COMPLETE_COMMANDS}, @@ -119,6 +125,7 @@ t_stackmatch g_stackmatch[] = {TK_DLESSDASH, CMD_WORD}, {TK_DLESSDASH, CMD_NAME}, {TK_DLESSDASH, LINEBREAK}, + {TK_DLESSDASH, TK_BANG}, {TK_DLESSDASH, TK_PAREN_OPEN}, {TK_DLESSDASH, TK_LBRACE}, {TK_DLESSDASH, COMPLETE_COMMANDS}, @@ -139,6 +146,7 @@ t_stackmatch g_stackmatch[] = {TK_DGREAT, CMD_WORD}, {TK_DGREAT, CMD_NAME}, {TK_DGREAT, LINEBREAK}, + {TK_DGREAT, TK_BANG}, {TK_DGREAT, TK_PAREN_OPEN}, {TK_DGREAT, TK_LBRACE}, {TK_DGREAT, COMPLETE_COMMANDS}, @@ -159,6 +167,7 @@ t_stackmatch g_stackmatch[] = {TK_LESSAND, CMD_WORD}, {TK_LESSAND, CMD_NAME}, {TK_LESSAND, LINEBREAK}, + {TK_LESSAND, TK_BANG}, {TK_LESSAND, TK_PAREN_OPEN}, {TK_LESSAND, TK_LBRACE}, {TK_LESSAND, COMPLETE_COMMANDS}, @@ -179,6 +188,7 @@ t_stackmatch g_stackmatch[] = {TK_GREATAND, CMD_WORD}, {TK_GREATAND, CMD_NAME}, {TK_GREATAND, LINEBREAK}, + {TK_GREATAND, TK_BANG}, {TK_GREATAND, TK_PAREN_OPEN}, {TK_GREATAND, TK_LBRACE}, {TK_GREATAND, COMPLETE_COMMANDS}, @@ -188,15 +198,15 @@ t_stackmatch g_stackmatch[] = {TK_GREATAND, NEWLINE_LIST}, {TK_GREATAND, PIPE_SEMI_SEQUENCE}, {TK_GREATAND, SEQUENCE}, -// watch ! +// watch ! {TK_GREATAND, CMD_SUPERIOR}, {TK_GREATAND, AND_OR_MAJOR}, {TK_IF, LINEBREAK}, + {TK_IF, TK_BANG}, {TK_IF, TK_PAREN_OPEN}, {TK_IF, TK_LBRACE}, - {TK_IF, TK_PAREN_CLOSE}, {TK_IF, COMPLETE_COMMANDS}, {TK_IF, TK_BANG}, {TK_IF, SEPARATOR_OP}, @@ -236,6 +246,7 @@ t_stackmatch g_stackmatch[] = {TK_DONE, COMPOUND_LIST}, {TK_DONE, END_COMMAND}, {TK_CASE, LINEBREAK}, + {TK_CASE, TK_BANG}, {TK_CASE, TK_PAREN_OPEN}, {TK_CASE, TK_LBRACE}, {TK_CASE, COMPLETE_COMMANDS}, @@ -259,8 +270,10 @@ t_stackmatch g_stackmatch[] = {TK_IN, NAME}, {TK_ESAC, CASE_LIST_NS}, {TK_ESAC, LINEBREAK}, + {TK_ESAC, TK_BANG}, {TK_ESAC, TK_IN}, {TK_WHILE, LINEBREAK}, + {TK_WHILE, TK_BANG}, {TK_WHILE, TK_PAREN_OPEN}, {TK_WHILE, TK_LBRACE}, {TK_WHILE, COMPLETE_COMMANDS}, @@ -281,6 +294,7 @@ t_stackmatch g_stackmatch[] = {TK_WHILE, TK_THEN}, {TK_WHILE, COMPLETE_CONDITION}, {TK_UNTIL, LINEBREAK}, + {TK_UNTIL, TK_BANG}, {TK_UNTIL, TK_PAREN_OPEN}, {TK_UNTIL, TK_LBRACE}, {TK_UNTIL, COMPLETE_COMMANDS}, @@ -301,6 +315,7 @@ t_stackmatch g_stackmatch[] = {TK_UNTIL, TK_PAREN_CLOSE}, {TK_UNTIL, COMPLETE_CONDITION}, {TK_FOR, LINEBREAK}, + {TK_FOR, TK_BANG}, {TK_FOR, TK_PAREN_OPEN}, {TK_FOR, TK_LBRACE}, {TK_FOR, COMPLETE_COMMANDS}, @@ -323,6 +338,7 @@ t_stackmatch g_stackmatch[] = {TK_FOR, COMPLETE_CONDITION}, {TK_LBRACE, COMPLETE_COMMANDS}, {TK_LBRACE, LINEBREAK}, + {TK_LBRACE, TK_BANG}, {TK_LBRACE, TK_LBRACE}, {TK_LBRACE, TK_BANG}, {TK_LBRACE, SEPARATOR_OP}, @@ -368,7 +384,6 @@ t_stackmatch g_stackmatch[] = {TK_BANG, TK_LBRACE}, {TK_BANG, COMPLETE_COMMANDS}, {TK_BANG, SEPARATOR_OP}, - {TK_BANG, SEPARATOR_OP}, {TK_BANG, NEWLINE_LIST}, {TK_IN, LINEBREAK}, {TK_SEMI, NAME}, @@ -388,8 +403,8 @@ t_stackmatch g_stackmatch[] = {PATTERN_CASE, CASE_LIST_NS}, {TK_PAREN_OPEN, COMPLETE_COMMANDS}, {TK_PAREN_OPEN, LINEBREAK}, - {TK_PAREN_OPEN, TK_PAREN_OPEN}, {TK_PAREN_OPEN, TK_BANG}, + {TK_PAREN_OPEN, TK_PAREN_OPEN}, {TK_PAREN_OPEN, SEPARATOR_OP}, {TK_PAREN_OPEN, NEWLINE_LIST}, {TK_PAREN_OPEN, SEQUENCE}, @@ -425,6 +440,7 @@ t_stackmatch g_stackmatch[] = {END_COMMAND, TK_ELIF}, {END_COMMAND, TK_ELSE}, {END_COMMAND, LINEBREAK}, + {END_COMMAND, TK_BANG}, {END_COMMAND, TK_PAREN_OPEN}, {END_COMMAND, TK_LBRACE}, {END_COMMAND, COMPLETE_COMMANDS}, @@ -455,6 +471,7 @@ t_stackmatch g_stackmatch[] = {LINEBREAK, TK_OR_IF}, {LINEBREAK, TK_PIPE}, {LINEBREAK, LINEBREAK}, + {LINEBREAK, TK_BANG}, {LINEBREAK, COMPLETE_COMMANDS}, {LINEBREAK, CMD_SUPERIOR}, {LINEBREAK, PIPE_SEMI_SEQUENCE}, @@ -484,10 +501,32 @@ t_stackmatch g_stackmatch[] = {TK_PAREN_CLOSE, PATTERN}, {TK_PAREN_CLOSE, COMPOUND_LIST}, {TK_PAREN_CLOSE, FUNC_NAME}, + {TK_RBRACE, MATH}, + {TK_RBRACE, MATH_PLUS}, + {TK_RBRACE, TK_SEMI}, + {TK_RBRACE, END_COMMAND}, + {TK_RBRACE, SEPARATOR_OP}, + {TK_RBRACE, WORD}, + {TK_RBRACE, IN}, + {TK_RBRACE, TK_AND_IF}, + {TK_RBRACE, TK_OR_IF}, + {TK_RBRACE, TK_PIPE}, + {TK_RBRACE, TK_RBRACE}, + {TK_RBRACE, COMPLETE_COMMANDS}, + {TK_RBRACE, CMD_SUPERIOR}, + {TK_RBRACE, PIPE_SEMI_SEQUENCE}, + {TK_RBRACE, CASE_LIST_NS}, + {TK_RBRACE, PROGRAM}, + {TK_RBRACE, TK_LBRACE}, + {TK_RBRACE, PATTERN_CASE}, + {TK_RBRACE, PATTERN}, + {TK_RBRACE, COMPOUND_LIST}, + {TK_RBRACE, FUNC_NAME}, {NEWLINE_LIST, MATH_SUP}, {NEWLINE_LIST, TK_DO}, {NEWLINE_LIST, CASE_LIST_NS}, {NEWLINE_LIST, TK_PAREN_CLOSE}, + {NEWLINE_LIST, TK_RBRACE}, {NEWLINE_LIST, SEQUENTIAL_SEP}, {NEWLINE_LIST, FOR_WORDLIST}, {NEWLINE_LIST, TK_IN}, @@ -509,6 +548,7 @@ t_stackmatch g_stackmatch[] = {NEWLINE_LIST, COMPLETE_CONDITION}, {NEWLINE_LIST, CONDITION}, {NEWLINE_LIST, LINEBREAK}, + {NEWLINE_LIST, TK_BANG}, {NEWLINE_LIST, TK_PAREN_OPEN}, {NEWLINE_LIST, TK_LBRACE}, {HERE_END, TK_DLESS}, @@ -522,11 +562,10 @@ t_stackmatch g_stackmatch[] = {IO_HERE, CMD_WORD}, {IO_HERE, CMD_NAME}, {IO_HERE, LINEBREAK}, + {IO_HERE, TK_BANG}, {IO_HERE, TK_PAREN_OPEN}, {IO_HERE, TK_LBRACE}, {IO_HERE, COMPLETE_COMMANDS}, - {IO_HERE, TK_BANG}, - {IO_HERE, TK_BANG}, {IO_HERE, SEPARATOR_OP}, {IO_HERE, NEWLINE_LIST}, {IO_HERE, PIPE_SEMI_SEQUENCE}, @@ -547,9 +586,8 @@ t_stackmatch g_stackmatch[] = {IO_FILE, CMD_WORD}, {IO_FILE, CMD_NAME}, {IO_FILE, LINEBREAK}, + {IO_FILE, TK_BANG}, {IO_FILE, COMPLETE_COMMANDS}, - {IO_FILE, TK_BANG}, - {IO_FILE, TK_BANG}, {IO_FILE, SEPARATOR_OP}, {IO_FILE, NEWLINE_LIST}, {IO_FILE, PIPE_SEMI_SEQUENCE}, @@ -562,11 +600,10 @@ t_stackmatch g_stackmatch[] = {IO_REDIRECT, CMD_WORD}, {IO_REDIRECT, CMD_NAME}, {IO_REDIRECT, LINEBREAK}, + {IO_REDIRECT, TK_BANG}, {IO_REDIRECT, TK_PAREN_OPEN}, {IO_REDIRECT, TK_LBRACE}, {IO_REDIRECT, COMPLETE_COMMANDS}, - {IO_REDIRECT, TK_BANG}, - {IO_REDIRECT, TK_BANG}, {IO_REDIRECT, SEPARATOR_OP}, {IO_REDIRECT, NEWLINE_LIST}, {IO_REDIRECT, PIPE_SEMI_SEQUENCE}, @@ -582,7 +619,6 @@ t_stackmatch g_stackmatch[] = {CMD_PREFIX, TK_LBRACE}, {CMD_PREFIX, COMPLETE_COMMANDS}, {CMD_PREFIX, TK_BANG}, - {CMD_PREFIX, TK_BANG}, {CMD_PREFIX, SEPARATOR_OP}, {CMD_PREFIX, NEWLINE_LIST}, {CMD_PREFIX, SEQUENCE}, @@ -593,7 +629,6 @@ t_stackmatch g_stackmatch[] = {CMD_NAME, TK_PAREN_OPEN}, {CMD_NAME, TK_LBRACE}, {CMD_NAME, TK_BANG}, - {CMD_NAME, TK_BANG}, {CMD_NAME, SEPARATOR_OP}, {CMD_NAME, NEWLINE_LIST}, {CMD_NAME, SEQUENCE}, @@ -627,7 +662,6 @@ t_stackmatch g_stackmatch[] = {CMD_SUPERIOR, TK_LBRACE}, {CMD_SUPERIOR, COMPLETE_COMMANDS}, {CMD_SUPERIOR, TK_BANG}, - {CMD_SUPERIOR, TK_BANG}, {CMD_SUPERIOR, SEPARATOR_OP}, {CMD_SUPERIOR, NEWLINE_LIST}, {CMD_SUPERIOR, TK_PIPE}, @@ -664,7 +698,6 @@ t_stackmatch g_stackmatch[] = {SIMPLE_COMMAND, TK_LBRACE}, {SIMPLE_COMMAND, COMPLETE_COMMANDS}, {SIMPLE_COMMAND, TK_BANG}, - {SIMPLE_COMMAND, TK_BANG}, {SIMPLE_COMMAND, SEPARATOR_OP}, {SIMPLE_COMMAND, NEWLINE_LIST}, {SIMPLE_COMMAND, SEQUENCE}, @@ -694,7 +727,6 @@ t_stackmatch g_stackmatch[] = {BRACE_GROUP, TK_LBRACE}, {BRACE_GROUP, COMPLETE_COMMANDS}, {BRACE_GROUP, TK_BANG}, - {BRACE_GROUP, TK_BANG}, {BRACE_GROUP, SEPARATOR_OP}, {BRACE_GROUP, NEWLINE_LIST}, {BRACE_GROUP, SEQUENCE}, @@ -704,7 +736,6 @@ t_stackmatch g_stackmatch[] = {FNAME, TK_LBRACE}, {FNAME, COMPLETE_COMMANDS}, {FNAME, TK_BANG}, - {FNAME, TK_BANG}, {FNAME, SEPARATOR_OP}, {FNAME, NEWLINE_LIST}, {FNAME, SEQUENCE}, @@ -715,7 +746,6 @@ t_stackmatch g_stackmatch[] = {FUNCTION_DEFINITION, TK_LBRACE}, {FUNCTION_DEFINITION, COMPLETE_COMMANDS}, {FUNCTION_DEFINITION, TK_BANG}, - {FUNCTION_DEFINITION, TK_BANG}, {FUNCTION_DEFINITION, SEPARATOR_OP}, {FUNCTION_DEFINITION, NEWLINE_LIST}, {FUNCTION_DEFINITION, SEQUENCE}, @@ -728,7 +758,6 @@ t_stackmatch g_stackmatch[] = {UNTIL_CLAUSE, SEPARATOR_OP}, {UNTIL_CLAUSE, NEWLINE_LIST}, {UNTIL_CLAUSE, SEQUENCE}, -// watch ! {UNTIL_CLAUSE, TK_DO}, {UNTIL_CLAUSE, TK_PAREN_CLOSE}, {UNTIL_CLAUSE, TK_WHILE}, @@ -763,6 +792,7 @@ t_stackmatch g_stackmatch[] = // {ELSE_PART, COMPOUND_LIST}, // {ELSE_PART, COMPLETE_CONDITION}, {IF_CLAUSE, LINEBREAK}, + {IF_CLAUSE, TK_BANG}, {IF_CLAUSE, TK_PAREN_OPEN}, {IF_CLAUSE, TK_LBRACE}, {IF_CLAUSE, COMPLETE_COMMANDS}, @@ -785,6 +815,7 @@ t_stackmatch g_stackmatch[] = {IF_CLAUSE, COMPLETE_CONDITION}, {IF_CLAUSE, AND_OR_MAJOR}, {BRACE_CLAUSE, LINEBREAK}, + {BRACE_CLAUSE, TK_BANG}, {BRACE_CLAUSE, TK_PAREN_OPEN}, {BRACE_CLAUSE, TK_LBRACE}, {BRACE_CLAUSE, COMPLETE_COMMANDS}, @@ -812,6 +843,7 @@ t_stackmatch g_stackmatch[] = {CASE_LIST_NS, LINEBREAK}, {CASE_LIST_NS, TK_IN}, {CASE_CLAUSE, LINEBREAK}, + {CASE_CLAUSE, TK_BANG}, {CASE_CLAUSE, TK_PAREN_OPEN}, {CASE_CLAUSE, TK_LBRACE}, {CASE_CLAUSE, COMPLETE_COMMANDS}, @@ -839,11 +871,10 @@ t_stackmatch g_stackmatch[] = {NAME, TK_FOR}, {FOR_WORDLIST, NAME}, {FOR_CLAUSE, LINEBREAK}, + {FOR_CLAUSE, TK_BANG}, {FOR_CLAUSE, TK_PAREN_OPEN}, {FOR_CLAUSE, TK_LBRACE}, {FOR_CLAUSE, COMPLETE_COMMANDS}, - {FOR_CLAUSE, TK_BANG}, - {FOR_CLAUSE, TK_BANG}, {FOR_CLAUSE, SEPARATOR_OP}, {FOR_CLAUSE, NEWLINE_LIST}, {FOR_CLAUSE, SEQUENCE}, @@ -860,8 +891,6 @@ t_stackmatch g_stackmatch[] = {FOR_CLAUSE, CASE_LIST_NS}, {FOR_CLAUSE, COMPLETE_CONDITION}, {FOR_CLAUSE, AND_OR_MAJOR}, - {TERM, LINEBREAK}, - {TERM, COMPLETE_COMMANDS}, {COMPOUND_LIST, TK_DO}, {COMPOUND_LIST, TK_PAREN_CLOSE}, {COMPOUND_LIST, TK_LBRACE}, @@ -902,7 +931,6 @@ t_stackmatch g_stackmatch[] = {COMPOUND_COMMAND, TK_LBRACE}, {COMPOUND_COMMAND, COMPLETE_COMMANDS}, {COMPOUND_COMMAND, TK_BANG}, - {COMPOUND_COMMAND, TK_BANG}, {COMPOUND_COMMAND, SEPARATOR_OP}, {COMPOUND_COMMAND, NEWLINE_LIST}, {COMPOUND_COMMAND, SEQUENCE}, @@ -923,6 +951,7 @@ t_stackmatch g_stackmatch[] = {COMMAND, TK_WHILE}, {COMMAND, TK_UNTIL}, {COMMAND, LINEBREAK}, + {COMMAND, TK_BANG}, {COMMAND, TK_PAREN_OPEN}, {COMMAND, TK_LBRACE}, {COMMAND, COMPLETE_COMMANDS}, @@ -943,6 +972,7 @@ t_stackmatch g_stackmatch[] = {AND_OR_MINOR, SEQUENCE}, // watch ! {AND_OR_MINOR, LINEBREAK}, + {AND_OR_MINOR, TK_BANG}, {AND_OR_MINOR, TK_PAREN_OPEN}, {AND_OR_MINOR, TK_LBRACE}, {AND_OR_MINOR, COMPLETE_COMMANDS}, @@ -959,6 +989,7 @@ t_stackmatch g_stackmatch[] = {PIPE_SEQUENCE, CASE_LIST_NS}, {PIPE_SEQUENCE, COMPLETE_CONDITION}, {PIPE_SEQUENCE, LINEBREAK}, + {PIPE_SEQUENCE, TK_BANG}, {PIPE_SEQUENCE, TK_PAREN_OPEN}, {PIPE_SEQUENCE, TK_LBRACE}, {PIPE_SEQUENCE, COMPLETE_COMMANDS}, @@ -967,6 +998,26 @@ t_stackmatch g_stackmatch[] = {PIPE_SEQUENCE, SEPARATOR_OP}, {PIPE_SEQUENCE, NEWLINE_LIST}, {PIPE_SEQUENCE, AND_OR_MAJOR}, + {TK_BANG, TK_WHILE}, + {TK_BANG, TK_UNTIL}, + {TK_BANG, TK_DO}, + {TK_BANG, TK_PAREN_CLOSE}, + {TK_BANG, TK_IF}, + {TK_BANG, TK_ELIF}, + {TK_BANG, TK_THEN}, + {TK_BANG, TK_ELSE}, + {TK_BANG, COMPOUND_LIST}, + {TK_BANG, CASE_LIST_NS}, + {TK_BANG, COMPLETE_CONDITION}, + {TK_BANG, LINEBREAK}, + {TK_BANG, TK_PAREN_OPEN}, + {TK_BANG, TK_LBRACE}, + {TK_BANG, COMPLETE_COMMANDS}, + {TK_BANG, TK_BANG}, + {TK_BANG, TK_BANG}, + {TK_BANG, SEPARATOR_OP}, + {TK_BANG, NEWLINE_LIST}, + {TK_BANG, AND_OR_MAJOR}, {PIPE_SEMI_SEQUENCE, TK_WHILE}, {PIPE_SEMI_SEQUENCE, TK_UNTIL}, {PIPE_SEMI_SEQUENCE, TK_DO}, @@ -979,11 +1030,10 @@ t_stackmatch g_stackmatch[] = {PIPE_SEMI_SEQUENCE, CASE_LIST_NS}, {PIPE_SEMI_SEQUENCE, COMPLETE_CONDITION}, {PIPE_SEMI_SEQUENCE, LINEBREAK}, + {PIPE_SEMI_SEQUENCE, TK_BANG}, {PIPE_SEMI_SEQUENCE, TK_PAREN_OPEN}, {PIPE_SEMI_SEQUENCE, TK_LBRACE}, {PIPE_SEMI_SEQUENCE, COMPLETE_COMMANDS}, - {PIPE_SEMI_SEQUENCE, TK_BANG}, - {PIPE_SEMI_SEQUENCE, TK_BANG}, {PIPE_SEMI_SEQUENCE, SEPARATOR_OP}, {PIPE_SEMI_SEQUENCE, NEWLINE_LIST}, {PIPE_SEMI_SEQUENCE, AND_OR_MAJOR}, @@ -1004,7 +1054,6 @@ t_stackmatch g_stackmatch[] = {SEQUENCE, TK_LBRACE}, {SEQUENCE, COMPLETE_COMMANDS}, {SEQUENCE, TK_BANG}, - {SEQUENCE, TK_BANG}, {SEQUENCE, SEPARATOR_OP}, {SEQUENCE, NEWLINE_LIST}, {SEQUENCE, AND_OR_MAJOR}, @@ -1021,6 +1070,7 @@ t_stackmatch g_stackmatch[] = {PIPELINE, CASE_LIST_NS}, {PIPELINE, COMPLETE_CONDITION}, {PIPELINE, LINEBREAK}, + {PIPELINE, TK_BANG}, {PIPELINE, TK_PAREN_OPEN}, {PIPELINE, TK_LBRACE}, {PIPELINE, COMPLETE_COMMANDS}, @@ -1029,6 +1079,7 @@ t_stackmatch g_stackmatch[] = {PIPELINE, NEWLINE_LIST}, {PIPELINE, AND_OR_MAJOR}, {AND_OR_MAJOR, LINEBREAK}, + {AND_OR_MAJOR, TK_BANG}, {AND_OR_MAJOR, TK_PAREN_OPEN}, {AND_OR_MAJOR, TK_LBRACE}, {AND_OR_MAJOR, COMPLETE_COMMANDS}, @@ -1046,6 +1097,7 @@ t_stackmatch g_stackmatch[] = {AND_OR, CASE_LIST_NS}, {AND_OR, COMPLETE_CONDITION}, {AND_OR, LINEBREAK}, + {AND_OR, TK_BANG}, {AND_OR, TK_PAREN_OPEN}, {AND_OR, TK_LBRACE}, {AND_OR, COMPLETE_COMMANDS}, diff --git a/42sh/src/parser/ft_parse.c b/42sh/src/parser/ft_parse.c index dcd34b83..ee706c67 100644 --- a/42sh/src/parser/ft_parse.c +++ b/42sh/src/parser/ft_parse.c @@ -9,7 +9,7 @@ /* */ /* ************************************************************************** */ -#include "parser.h" +#include "minishell.h" static void insert_linebreak(t_list **lst) { diff --git a/42sh/src/parser/parser_init.c b/42sh/src/parser/parser_init.c index 1c884a72..6b807a98 100644 --- a/42sh/src/parser/parser_init.c +++ b/42sh/src/parser/parser_init.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "parser.h" +#include "minishell.h" void parser_init(t_parser *parser) { diff --git a/42sh/src/parser/pop_stack.c b/42sh/src/parser/pop_stack.c index 59e57a09..dca7b2f1 100644 --- a/42sh/src/parser/pop_stack.c +++ b/42sh/src/parser/pop_stack.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "parser.h" +#include "minishell.h" int pop_stack(t_list **stack, t_sym erase_sym) { diff --git a/42sh/src/parser/produce_sym.c b/42sh/src/parser/produce_sym.c index 32de3fdc..8cf01e20 100644 --- a/42sh/src/parser/produce_sym.c +++ b/42sh/src/parser/produce_sym.c @@ -6,11 +6,11 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/09 17:58:34 by ariard #+# #+# */ -/* Updated: 2017/03/07 15:53:23 by ariard ### ########.fr */ +/* Updated: 2017/03/07 18:47:55 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ -#include "parser.h" +#include "minishell.h" t_prodmatch g_prodmatch[] = { @@ -28,6 +28,7 @@ t_prodmatch g_prodmatch[] = {TK_WORD, CMD_SUPERIOR, CMD_SUFFIX}, {TK_WORD, PIPE_SEMI_SEQUENCE, CMD_SUFFIX}, {TK_WORD, LINEBREAK, CMD_NAME}, + {TK_WORD, TK_BANG, CMD_NAME}, {TK_WORD, TK_PIPE, CMD_NAME}, {TK_WORD, AND_OR, CMD_NAME}, {TK_WORD, AND_OR_MAJOR, CMD_NAME}, @@ -35,6 +36,7 @@ t_prodmatch g_prodmatch[] = {TK_WORD, TK_UNTIL, CMD_NAME}, {TK_WORD, TK_DO, CMD_NAME}, {TK_WORD, TK_PAREN_CLOSE, CMD_NAME}, + {TK_WORD, TK_RBRACE, CMD_NAME}, {TK_WORD, TK_IF, CMD_NAME}, {TK_WORD, TK_THEN, CMD_NAME}, {TK_WORD, TK_ELIF, CMD_NAME}, @@ -51,12 +53,14 @@ t_prodmatch g_prodmatch[] = {TK_WORD, CASE_LIST, PATTERN}, {TK_WORD, PATTERN_CASE, PATTERN}, {TK_WORD, COMPLETE_COMMANDS, CMD_NAME}, + {TK_ASSIGNEMENT_WORD, TK_BANG, CMD_PREFIX}, {TK_ASSIGNEMENT_WORD, LINEBREAK, CMD_PREFIX}, {TK_ASSIGNEMENT_WORD, TK_PAREN_OPEN, CMD_PREFIX}, {TK_ASSIGNEMENT_WORD, TK_LBRACE, CMD_PREFIX}, {TK_ASSIGNEMENT_WORD, TK_BANG, CMD_PREFIX}, {TK_ASSIGNEMENT_WORD, SEPARATOR_OP, CMD_PREFIX}, {TK_ASSIGNEMENT_WORD, NEWLINE_LIST, CMD_PREFIX}, + {TK_NAME, TK_BAMG, FNAME}, {TK_NAME, LINEBREAK, FNAME}, {TK_NAME, TK_PAREN_OPEN, FNAME}, {TK_NAME, TK_LBRACE, FNAME}, @@ -68,6 +72,7 @@ t_prodmatch g_prodmatch[] = {TK_NEWLINE, CASE_LIST_NS, NEWLINE_LIST}, {TK_NEWLINE, TK_DO, NEWLINE_LIST}, {TK_NEWLINE, TK_PAREN_CLOSE, NEWLINE_LIST}, + {TK_NEWLINE, TK_RBRACE, CMD_NAME}, {TK_NEWLINE, TK_IN, NEWLINE_LIST}, {TK_NEWLINE, TK_WHILE, NEWLINE_LIST}, {TK_NEWLINE, TK_UNTIL, NEWLINE_LIST}, @@ -79,6 +84,7 @@ t_prodmatch g_prodmatch[] = {TK_NEWLINE, CMD_NAME, NEWLINE_LIST}, {TK_NEWLINE, COMPLETE_COMMANDS, NEWLINE_LIST}, {TK_NEWLINE, LINEBREAK, NEWLINE_LIST}, + {TK_NEWLINE, TK_BANG, NEWLINE_LIST}, {TK_NEWLINE, TK_PAREN_OPEN, NEWLINE_LIST}, {TK_NEWLINE, TK_LBRACE, NEWLINE_LIST}, {TK_NEWLINE, CMD_SUPERIOR, LINEBREAK}, diff --git a/42sh/src/parser/push_stack.c b/42sh/src/parser/push_stack.c index 0ac6061b..1f2ba51e 100644 --- a/42sh/src/parser/push_stack.c +++ b/42sh/src/parser/push_stack.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "parser.h" +#include "minishell.h" //int push_stack(t_sym *stack, t_sym new_sym) int push_stack(t_list **stack, t_sym sym) diff --git a/42sh/src/parser/read_stack.c b/42sh/src/parser/read_stack.c index 0e7450af..ddb76ad3 100644 --- a/42sh/src/parser/read_stack.c +++ b/42sh/src/parser/read_stack.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "parser.h" +#include "minishell.h" char *read_state(t_sym current) { diff --git a/42sh/src/parser/tree_wrapper.c b/42sh/src/parser/tree_wrapper.c index 81415d2e..1a11caaf 100644 --- a/42sh/src/parser/tree_wrapper.c +++ b/42sh/src/parser/tree_wrapper.c @@ -10,7 +10,7 @@ /* */ /* ************************************************************************** */ -#include "parser.h" +#include "minishell.h" int join_ast(t_btree **ast, t_btree **new_node) {