diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2020-10-09 14:01:03 +0200 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2020-10-09 14:01:03 +0200 |
| commit | 2a8056e885151fa155bf82a3d8cc97b0905ea577 (patch) | |
| tree | cde4444d26f1a3f27a56cad029e923a35accdc2a /include | |
| parent | 70c76a4e6d73551a1a78ed61e7cd8f7287137a99 (diff) | |
| download | minishell-2a8056e885151fa155bf82a3d8cc97b0905ea577.tar.gz minishell-2a8056e885151fa155bf82a3d8cc97b0905ea577.tar.bz2 minishell-2a8056e885151fa155bf82a3d8cc97b0905ea577.zip | |
Norming header, Fixing mistakes detected by static analyser
Diffstat (limited to 'include')
| -rw-r--r-- | include/eval.h | 6 | ||||
| -rw-r--r-- | include/lexer.h | 66 | ||||
| -rw-r--r-- | include/minishell.h | 12 | ||||
| -rw-r--r-- | include/parser.h | 5 |
4 files changed, 47 insertions, 42 deletions
diff --git a/include/eval.h b/include/eval.h index 2aa4f1d..e2f3c8b 100644 --- a/include/eval.h +++ b/include/eval.h @@ -6,7 +6,7 @@ /* By: charles <charles@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/04/01 17:05:30 by charles #+# #+# */ -/* Updated: 2020/10/06 17:22:12 by cacharle ### ########.fr */ +/* Updated: 2020/10/09 13:40:26 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -22,7 +22,7 @@ # include "lexer.h" # include "parser.h" -typedef struct +typedef struct s_fork_param_args { t_env env; t_ast *ast; @@ -37,7 +37,7 @@ typedef struct t_builtin_entry *builtin; } t_fork_param_cmd; -typedef int (*t_wrapped_func)(void *param); +typedef int (*t_wrapped_func)(void *param); # define FD_NONE -2 # define FD_WRITE 1 diff --git a/include/lexer.h b/include/lexer.h index 72480d5..36dfd5b 100644 --- a/include/lexer.h +++ b/include/lexer.h @@ -6,7 +6,7 @@ /* By: nahaddac <nahaddac@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/06/19 10:51:26 by nahaddac #+# #+# */ -/* Updated: 2020/10/08 17:38:33 by cacharle ### ########.fr */ +/* Updated: 2020/10/09 13:44:09 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -43,25 +43,25 @@ ** \param TAG_IS_SEP all of separator tags */ -enum e_tok +enum e_tok { - TAG_AND = 1 << 0, - TAG_END = 1 << 1, - TAG_OR = 1 << 2, - TAG_PIPE = 1 << 3, - TAG_REDIR_IN = 1 << 4, - TAG_REDIR_OUT = 1 << 5, + TAG_AND = 1 << 0, + TAG_END = 1 << 1, + TAG_OR = 1 << 2, + TAG_PIPE = 1 << 3, + TAG_REDIR_IN = 1 << 4, + TAG_REDIR_OUT = 1 << 5, TAG_REDIR_APPEND = 1 << 6, - TAG_PARENT_OPEN = 1 << 7, + TAG_PARENT_OPEN = 1 << 7, TAG_PARENT_CLOSE = 1 << 8, - TAG_STR = 1 << 9, - TAG_STR_DOUBLE = 1 << 10, - TAG_STR_SINGLE = 1 << 11, - TAG_STICK = 1 << 12, - - TAG_IS_STR = TAG_STR | TAG_STR_SINGLE | TAG_STR_DOUBLE, - TAG_IS_REDIR = TAG_REDIR_IN | TAG_REDIR_OUT | TAG_REDIR_APPEND, - TAG_IS_SEP = TAG_AND | TAG_END | TAG_OR, + TAG_STR = 1 << 9, + TAG_STR_DOUBLE = 1 << 10, + TAG_STR_SINGLE = 1 << 11, + TAG_STICK = 1 << 12, + + TAG_IS_STR = TAG_STR | TAG_STR_SINGLE | TAG_STR_DOUBLE, + TAG_IS_REDIR = TAG_REDIR_IN | TAG_REDIR_OUT | TAG_REDIR_APPEND, + TAG_IS_SEP = TAG_AND | TAG_END | TAG_OR, }; /* @@ -86,11 +86,16 @@ typedef struct s_tok_lst } t_tok_lst; t_tok_lst *tok_lst_new(enum e_tok tag, char *content); -t_tok_lst *tok_lst_new_until(enum e_tok tag, char *content, size_t n); -void tok_lst_push_back(t_tok_lst **tokens, t_tok_lst *pushed); -t_tok_lst *tok_lst_push_front(t_tok_lst **tokens, t_tok_lst *pushed); -void tok_lst_pop_front(t_tok_lst **tokens, void (*del)(void*)); -void *tok_lst_destroy(t_tok_lst **tokens, void (*del)(void*)); +t_tok_lst *tok_lst_new_until( + enum e_tok tag, char *content, size_t n); +void tok_lst_push_back( + t_tok_lst **tokens, t_tok_lst *pushed); +t_tok_lst *tok_lst_push_front( + t_tok_lst **tokens, t_tok_lst *pushed); +void tok_lst_pop_front( + t_tok_lst **tokens, void (*del)(void*)); +void *tok_lst_destroy( + t_tok_lst **tokens, void (*del)(void*)); t_tok_lst *tok_lst_last(t_tok_lst *tokens); t_tok_lst *tok_lst_uncons(t_tok_lst **tokens); @@ -98,27 +103,26 @@ t_tok_lst *tok_lst_uncons(t_tok_lst **tokens); ** lexer.c */ -int len_until_sep(char *input); +int len_until_sep(char *input); int tok_len(char *input); t_tok_lst *create_token_list(char *input, t_tok_lst **lst); int lexer(char *input, t_tok_lst **out); - /* ** utils.c */ -enum e_tok tok_assign_tag(char *content); -enum e_tok tok_assign_stick(t_tok_lst *tok); -enum e_tok tok_assign_str(t_tok_lst *tok); -int lexer_sep(char input); -int lexer_space(char *input); -int quote_len(char *input, int i); +enum e_tok tok_assign_tag(char *content); +enum e_tok tok_assign_stick(t_tok_lst *tok); +enum e_tok tok_assign_str(t_tok_lst *tok); +int lexer_sep(char input); +int lexer_space(char *input); +int quote_len(char *input, int i); /* ** trim.c */ -int lexer_trim(t_tok_lst *lst); +int lexer_trim(t_tok_lst *lst); #endif diff --git a/include/minishell.h b/include/minishell.h index cba92df..b878f41 100644 --- a/include/minishell.h +++ b/include/minishell.h @@ -6,13 +6,12 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/26 15:33:51 by cacharle #+# #+# */ -/* Updated: 2020/10/09 12:41:09 by cacharle ### ########.fr */ +/* Updated: 2020/10/09 13:45:24 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef MINISHELL_H # define MINISHELL_H -#include <stdio.h> // for debugging - dont remove /* ** \file minishell.h @@ -73,7 +72,9 @@ extern t_state g_state; ** path.c */ -int path_search(t_env env, char *exec_name, char exec_path[PATH_MAX + 1], bool print); +int path_search( + t_env env, char *exec_name, + char exec_path[PATH_MAX + 1], bool print); /* ** env.c @@ -101,7 +102,7 @@ typedef int (*t_builtin_func)(char **argv, t_env env); ** \param func Associated function */ -typedef struct +typedef struct s_builtin_entry { char *name; t_builtin_func func; @@ -123,7 +124,8 @@ int builtin_exit(char **argv, t_env env); */ char **preprocess(t_tok_lst **tokens, t_env env); -int preprocess_filename(t_tok_lst **tokens, t_env env, char **filename); +int preprocess_filename( + t_tok_lst **tokens, t_env env, char **filename); /* ** signal.c diff --git a/include/parser.h b/include/parser.h index b00407c..126ef8d 100644 --- a/include/parser.h +++ b/include/parser.h @@ -6,7 +6,7 @@ /* By: cacharle <cacharle@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/28 09:00:00 by cacharle #+# #+# */ -/* Updated: 2020/10/07 16:33:16 by cacharle ### ########.fr */ +/* Updated: 2020/10/09 13:45:41 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -36,7 +36,7 @@ # include "lexer.h" # include "error.h" -struct s_ast; +struct s_ast; /* ** \brief Operation struct @@ -122,5 +122,4 @@ t_parsed *parse_op(t_tok_lst *input); t_parsed *parse_expr(t_tok_lst *input); t_parsed *parse_cmd(t_tok_lst *input); - #endif |
