diff --git a/42sh/src/completion/c_match.c b/42sh/src/completion/c_match.c index 06440ac5..4df444b5 100644 --- a/42sh/src/completion/c_match.c +++ b/42sh/src/completion/c_match.c @@ -6,7 +6,7 @@ /* By: alao +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/10/15 13:27:14 by alao #+# #+# */ -/* Updated: 2017/03/19 15:34:38 by gwojda ### ########.fr */ +/* Updated: 2017/03/20 14:41:04 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -22,7 +22,8 @@ static int c_chevron(t_comp *c) pos = c->ircmd; if (pos >= ft_strlen(c->rcmd)) - pos = ft_strlen(c->rcmd) - (ft_strlen(data_singleton()->line.input) - pos); + pos = ft_strlen(c->rcmd) - (ft_strlen(data_singleton()->line.input) + - pos); while (pos) { if (c->rcmd[pos] == '<' || c->rcmd[pos] == '>') diff --git a/42sh/src/job_control/builtin_fg.c b/42sh/src/job_control/builtin_fg.c index dfbe6104..74258367 100644 --- a/42sh/src/job_control/builtin_fg.c +++ b/42sh/src/job_control/builtin_fg.c @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* builtin_fg.c :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: jhalford +#+ +:+ +#+ */ +/* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/08 14:30:07 by jhalford #+# #+# */ -/* Updated: 2017/03/20 12:12:16 by jhalford ### ########.fr */ +/* Updated: 2017/03/20 14:42:22 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -27,7 +27,7 @@ int builtin_fg(const char *path, char *const av[], char *const envp[]) return (-1); } jobc = &data_singleton()->jobc; - job_getrank(&rank); + job_getrank(&rank); if (av[1] ? (id = *av[1]) : 0) { if ((jlist = ft_lst_find(jobc->first_job, &id, job_cmp_id))) diff --git a/42sh/src/line_editing/readline.c b/42sh/src/line_editing/readline.c index 6205bbc9..cbbc9438 100644 --- a/42sh/src/line_editing/readline.c +++ b/42sh/src/line_editing/readline.c @@ -6,7 +6,7 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/15 14:19:48 by gwojda #+# #+# */ -/* Updated: 2017/03/20 14:16:03 by gwojda ### ########.fr */ +/* Updated: 2017/03/20 14:49:03 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/main/data_exit.c b/42sh/src/main/data_exit.c index 566a1c23..d62a3ddb 100644 --- a/42sh/src/main/data_exit.c +++ b/42sh/src/main/data_exit.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/07 18:07:50 by jhalford #+# #+# */ -/* Updated: 2017/03/18 15:43:07 by gwojda ### ########.fr */ +/* Updated: 2017/03/20 14:44:51 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -17,7 +17,6 @@ void data_exit(void) t_data *data; data = data_singleton(); - /* ft_strdel(&data->line.input); */ ft_sstrfree(data->env); ft_sstrfree(data->local_var); ft_sstrfree(data->argv); diff --git a/42sh/src/main/data_singleton.c b/42sh/src/main/data_singleton.c index 4dc9731c..31512ede 100644 --- a/42sh/src/main/data_singleton.c +++ b/42sh/src/main/data_singleton.c @@ -6,13 +6,13 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/10 11:36:39 by jhalford #+# #+# */ -/* Updated: 2017/03/16 15:12:53 by jhalford ### ########.fr */ +/* Updated: 2017/03/20 14:45:01 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ #include "minishell.h" -t_data *data_singleton() +t_data *data_singleton(void) { static t_data *data = NULL; diff --git a/42sh/src/main/main.c b/42sh/src/main/main.c index b76b695f..f5f5a4d6 100644 --- a/42sh/src/main/main.c +++ b/42sh/src/main/main.c @@ -3,15 +3,16 @@ /* ::: :::::::: */ /* main.c :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: jhalford +#+ +:+ +#+ */ +/* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ -/* Updated: 2017/03/17 10:51:23 by gwojda ### ########.fr */ +/* Created: 2017/03/20 14:45:40 by gwojda #+# #+# */ +/* Updated: 2017/03/20 14:46:44 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ #include "minishell.h" -static int do_readline_routine(char **stream) +static int do_readline_routine(char **stream) { int ret; int has_prompt; @@ -55,7 +56,7 @@ static int handle_instruction(t_list **token, t_btree **ast) return (0); } -int main(int ac, char **av) +int main(int ac, char **av) { int ret; t_data *data; @@ -67,7 +68,7 @@ int main(int ac, char **av) DG("{inv}{bol}{gre}start of shell{eoc}"); if (shell_init(ac, av) != 0) return (1); - DG("JOBC is %s", SH_HAS_JOBC(data_singleton()->opts)?"ON":"OFF"); + DG("JOBC is %s", SH_HAS_JOBC(data_singleton()->opts) ? "ON" : "OFF"); token = NULL; ast = NULL; data = data_singleton(); diff --git a/42sh/src/main/shell_init.c b/42sh/src/main/shell_init.c index 5e1af3c5..0dc2c0f3 100644 --- a/42sh/src/main/shell_init.c +++ b/42sh/src/main/shell_init.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/12 17:23:59 by jhalford #+# #+# */ -/* Updated: 2017/03/20 11:30:42 by jhalford ### ########.fr */ +/* Updated: 2017/03/20 14:54:28 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -19,7 +19,7 @@ static t_cliopts g_opts[] = {0, 0, 0, 0, 0}, }; -int get_c_arg(char ***av, t_data *data) +int get_c_arg(char ***av, t_data *data) { if (!av || !*av) return (1); @@ -28,7 +28,7 @@ int get_c_arg(char ***av, t_data *data) return (0); } -static int get_input_fd(t_data *data) +static int get_input_fd(t_data *data) { static int fds[2] = {-1, STDIN}; char *file; @@ -47,7 +47,8 @@ static int get_input_fd(t_data *data) ft_printf("{red}%s: %s: No such file or directory\n{eoc}", data->argv[0], file); else if (S_ISDIR(buf.st_mode)) - ft_printf("{red}%s: %s: is a directory\n{eoc}", data->argv[0], file); + ft_printf("{red}%s: %s: is a directory\n{eoc}", data->argv[0], + file); else if ((fds[PIPE_READ] = open(file, O_RDONLY | O_CLOEXEC)) < 0) ft_printf("{red}%s: %s: No such file or directory\n{eoc}", data->argv[0], file); @@ -115,7 +116,7 @@ int shell_init(int ac, char **av) if ((data->fd = get_input_fd(data)) < 0) return (-1); DG(); - if (SH_IS_INTERACTIVE(data->opts) && interactive_settings() < 0) + if (SH_IS_INTERACTIVE(data->opts) && interactive_settings() < 0) return (-1); return (0); } diff --git a/42sh/src/parser/add_subshell.c b/42sh/src/parser/add_subshell.c index 5b70e8da..22bbb97e 100644 --- a/42sh/src/parser/add_subshell.c +++ b/42sh/src/parser/add_subshell.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/24 18:41:50 by ariard #+# #+# */ -/* Updated: 2017/03/18 15:50:28 by ariard ### ########.fr */ +/* Updated: 2017/03/20 14:57:34 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -41,16 +41,16 @@ int add_subshell_cmd(t_btree **ast, t_list **lst) token = (*lst)->content; node = (*ast)->item; if ((token->type == SUBSHELL && node->type == SUBSHELL) - || (token->type == TK_LBRACE && node->type == TK_LBRACE)) - node->nest++; + || (token->type == TK_LBRACE && node->type == TK_LBRACE)) + node->nest++; if (((token->type == TK_PAREN_CLOSE && node->type == SUBSHELL) - || (token->type == TK_RBRACE && node->type == TK_LBRACE)) && node->nest > 0) + || (token->type == TK_RBRACE && node->type == TK_LBRACE)) && node->nest > 0) node->nest--; else if (token->type == TK_PAREN_CLOSE && node->type == SUBSHELL - && node->nest == 0) + && node->nest == 0) return ((node->full = 1)); else if (token->type == TK_RBRACE && node->type == TK_LBRACE - && node->nest == 0) + && node->nest == 0) return ((node->full = 1)); return (add_cmd(&(*ast)->right, lst)); } diff --git a/42sh/src/parser/read_stack.c b/42sh/src/parser/read_stack.c index af8a85d7..c6ad591b 100644 --- a/42sh/src/parser/read_stack.c +++ b/42sh/src/parser/read_stack.c @@ -6,13 +6,13 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/09 15:32:10 by ariard #+# #+# */ -/* Updated: 2017/03/15 16:33:57 by ariard ### ########.fr */ +/* Updated: 2017/03/20 14:59:23 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ #include "minishell.h" -char *read_state(t_sym current) +char *read_state(t_sym current) { if (current == FNAME) return ("FNAME"); @@ -131,7 +131,7 @@ char *read_state(t_sym current) if (current == TK_DONE) return ("TK_DONE"); if (current == AND_OR_MINOR) - return("AND_OR_MINOR"); + return ("AND_OR_MINOR"); if (current == AND_OR_MAJOR) return ("AND_OR_MAJOR"); if (current == TK_COMMAND) @@ -227,7 +227,6 @@ int ft_read_stack(t_sym *stack) return (0); } - int ft_show_heredoc_data(t_astnode *node) { t_redir *redir; diff --git a/42sh/src/parser/sym_free.c b/42sh/src/parser/sym_free.c index 200be9ba..b26c2144 100644 --- a/42sh/src/parser/sym_free.c +++ b/42sh/src/parser/sym_free.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/18 17:13:31 by ariard #+# #+# */ -/* Updated: 2017/03/18 17:15:11 by ariard ### ########.fr */ +/* Updated: 2017/03/20 14:57:58 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -19,4 +19,4 @@ void sym_free(void *data, size_t size) (void)size; sym = data; free(sym); -} +}