From e8d0e5a7eccf01fb74ac809bc6414dfa64d47cc3 Mon Sep 17 00:00:00 2001 From: Jean-philippe Martel Date: Fri, 4 Feb 2022 18:02:06 -0500 Subject: [PATCH] fixed weird name --- Makefile | 8 ++++---- eval/eval.h | 4 ++-- eval/pre_eval_redir.c | 14 +++++++------- main.c | 4 ++-- parsing/parsing.c | 25 ++++++++++++------------- parsing/parsing.h | 8 ++++---- parsing/prompt_eval.c | 4 ++-- parsing/tokens_jobs.c | 5 +++-- 8 files changed, 36 insertions(+), 36 deletions(-) diff --git a/Makefile b/Makefile index 5c3ba96..6d62693 100644 --- a/Makefile +++ b/Makefile @@ -72,7 +72,7 @@ endif @echo "\n\033[32m\033[1m Minishell Compiled for $(DETECTED_OS) \n\033[0m" run: all - ./$(NAME) + @./$(NAME) leak: all leaks --atExit -- ./$(NAME) @@ -85,7 +85,6 @@ test: all norm: @norminette ${SRCS} | grep "Error!" - clean: @echo "\033[0;31m Cleaning..." @rm -rf ${OBJS} > /tmp/out @@ -110,12 +109,13 @@ dep: @echo "\n\033[32m\033[1m \n\033[0m" @echo "\033[0m" @echo "\n\033[32m\033[1m Currently compiling dependencies for $(DETECTED_OS) this will take some time \n\033[0m" - @sh -c "cd readline && ./configure > /tmp/out && make -q --ignore-errors " + @sh -c "cd readline && ./configure > /tmp/out" + @sh -c "make -C readline > /tmp/out" @sh -c "cd ncurses && ./configure > /tmp/out && make --ignore-errors -q" @echo "\033[0m" @clear @make run - @echo "\n\033[32m\033[1m time is up \n\033[0m" + @echo "\n\033[32m\033[1m Minishell is ready \n\033[0m" install: diff --git a/eval/eval.h b/eval/eval.h index 9c17fd5..f8fc10c 100644 --- a/eval/eval.h +++ b/eval/eval.h @@ -6,7 +6,7 @@ /* By: jemartel +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/01/24 14:58:12 by jemartel #+# #+# */ -/* Updated: 2022/02/03 14:43:04 by jemartel ### ########.fr */ +/* Updated: 2022/02/04 17:51:19 by jemartel ### ########.fr */ /* */ /* ************************************************************************** */ @@ -26,7 +26,7 @@ int eval(t_jobs *jobs); char *eval_line(char *str, char *output, int lon, int type); void eval_cmds(t_jobs *job); char *eval_noquote(char *str, int *append, int type); -void pre_val_redir(t_jobs *jobs, t_dlist *lst); +void pre_val_here(t_jobs *jobs, t_dlist *lst); char *quote_eval(char *str, int left, char *outcome, int type); int redir_poll(char *line, char *cmp); #endif diff --git a/eval/pre_eval_redir.c b/eval/pre_eval_redir.c index 78b314b..173d789 100644 --- a/eval/pre_eval_redir.c +++ b/eval/pre_eval_redir.c @@ -6,7 +6,7 @@ /* By: jemartel +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/01/15 18:30:49 by jemartel #+# #+# */ -/* Updated: 2022/02/03 16:51:38 by jemartel ### ########.fr */ +/* Updated: 2022/02/04 18:01:41 by jemartel ### ########.fr */ /* */ /* ************************************************************************** */ @@ -17,7 +17,7 @@ char *eval_docc(t_redir *temp); -void squash_delete(t_jobs *job, t_redir *temp, t_dlist *lst, char *str) +void squash_output(t_jobs *job, t_redir *temp, t_dlist *lst, char *str) { int fd; @@ -45,7 +45,7 @@ void squash_delete(t_jobs *job, t_redir *temp, t_dlist *lst, char *str) exit(130); } -void docc_out(t_jobs *job, t_redir *temp, t_dlist *lst) +void here_process(t_jobs *job, t_redir *temp, t_dlist *lst) { int pid; int status; @@ -56,7 +56,7 @@ void docc_out(t_jobs *job, t_redir *temp, t_dlist *lst) if (pid < 0) return ; if (pid == 0) - squash_delete(job, temp, lst, str); + squash_output(job, temp, lst, str); waitpid(pid, &status, 0); g_state.output = status; } @@ -87,7 +87,7 @@ char *eval_docc(t_redir *temp) return (outcome); } -void pre_val_redir(t_jobs *jobs, t_dlist *lst) +void pre_val_here(t_jobs *jobs, t_dlist *lst) { t_redir *temp; @@ -99,10 +99,10 @@ void pre_val_redir(t_jobs *jobs, t_dlist *lst) while (temp) { if (temp->type == 1 && jobs->status == 0) - docc_out(jobs, temp, lst); + here_process(jobs, temp, lst); temp = temp->next; } if (jobs && jobs->next) - pre_val_redir(jobs->next, lst); + pre_val_here(jobs->next, lst); } } diff --git a/main.c b/main.c index 4bee597..2060b7d 100644 --- a/main.c +++ b/main.c @@ -6,7 +6,7 @@ /* By: jemartel +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/01/14 18:48:26 by jemartel #+# #+# */ -/* Updated: 2022/02/02 23:53:42 by jemartel ### ########.fr */ +/* Updated: 2022/02/04 17:29:13 by jemartel ### ########.fr */ /* */ /* ************************************************************************** */ @@ -38,6 +38,6 @@ int main(int argc, char **argv, char **envp) { fd = open("/tmp/here_docced", O_TRUNC | O_CREAT | O_RDWR, 0644); close(fd); - parsing(); + igntion_seq(); } } diff --git a/parsing/parsing.c b/parsing/parsing.c index 705e986..2e32f78 100644 --- a/parsing/parsing.c +++ b/parsing/parsing.c @@ -6,7 +6,7 @@ /* By: olabrecq +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/01/15 02:46:42 by jemartel #+# #+# */ -/* Updated: 2022/02/03 16:56:22 by jemartel ### ########.fr */ +/* Updated: 2022/02/04 17:50:31 by jemartel ### ########.fr */ /* */ /* ************************************************************************** */ @@ -40,7 +40,7 @@ void handle_pipes(t_pipe *pipes, int status) g_state.output = status; } -void parser_muduled(t_jobs *job, t_dlist *lst) +void async_jobs(t_jobs *job, t_dlist *lst) { t_jobs *temp; t_pipe *pipes; @@ -62,7 +62,7 @@ void parser_muduled(t_jobs *job, t_dlist *lst) free_jobs((t_jobs *)job, 0); } -void parser_core(t_dlist *lst) +void job_composer(t_dlist *lst) { t_jobs *job; t_jobs *temp; @@ -74,14 +74,14 @@ void parser_core(t_dlist *lst) inc = 0; if (job) { - pre_val_redir(job, lst); + pre_val_here(job, lst); while (temp) { eval(temp); temp = temp->next; inc++; } - parser_muduled(job, lst); + async_jobs(job, lst); } } @@ -93,17 +93,17 @@ void quick_parser(char *str) if (trimed && ft_strlen(trimed) > 0) { - lst = line_parser((char *)trimed); + lst = parser((char *)trimed); free((char *)trimed); if (lst != NULL) { - parser_core(lst); + job_composer(lst); free_list(lst); } } } -void parsing(void) +void igntion_seq(void) { char *trimed; t_dlist *lst; @@ -113,20 +113,19 @@ void parsing(void) while (1) { signal(SIGINT, sig_cc); - if (parsing_start(&trimed) && ft_strlen(trimed) > 0) + if (prompt(&trimed) && ft_strlen(trimed) > 0) { signal(SIGINT, sig_chi); - lst = line_parser(trimed); - free(trimed); + lst = parser(trimed); if (lst != NULL) - parser_core(lst); + job_composer(lst); } else if (!trimed) { freelist(g_state.env); freelist(g_state.exprt); - rl_clear_history(); free(trimed); + rl_clear_history(); exit(g_state.output); } } diff --git a/parsing/parsing.h b/parsing/parsing.h index 221bd0b..6e66eac 100644 --- a/parsing/parsing.h +++ b/parsing/parsing.h @@ -6,7 +6,7 @@ /* By: jemartel +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/01/24 15:38:44 by jemartel #+# #+# */ -/* Updated: 2022/02/02 14:03:19 by jemartel ### ########.fr */ +/* Updated: 2022/02/04 17:47:53 by jemartel ### ########.fr */ /* */ /* ************************************************************************** */ @@ -25,14 +25,14 @@ typedef struct s_dlist size_t len; } t_dlist; -void parsing(void); +void igntion_seq(void); void tokens_peek(t_dlist *lst); char *token_builder(char *str); char *find_single(char *str, size_t *len); char *find_dquoted(char *str, size_t *len); char *find_partner(char *str, size_t *len); char *line_no_string(char *str, size_t *len); -char *line_handler(char *str, size_t *len); +t_dlist *parser(char *str); char *token_loop(char *result, char *str, size_t len, size_t offset); int token_bool(char *str, size_t *len); int is_quoted(char *str); @@ -44,6 +44,6 @@ void sig_child(int signum, siginfo_t *info, void *unsed); void sig_docc(int signum, siginfo_t *info, void *unsed); void start_signal(int type); char *prompt_eval(void); -char *parsing_start(char **trimed); +char *prompt(char **trimed); void sig_chi(int signum); #endif diff --git a/parsing/prompt_eval.c b/parsing/prompt_eval.c index 1a9dc55..5d2d7f4 100644 --- a/parsing/prompt_eval.c +++ b/parsing/prompt_eval.c @@ -6,7 +6,7 @@ /* By: jemartel +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/01/24 16:08:47 by jemartel #+# #+# */ -/* Updated: 2022/02/02 04:29:15 by jemartel ### ########.fr */ +/* Updated: 2022/02/04 17:34:39 by jemartel ### ########.fr */ /* */ /* ************************************************************************** */ #include "../minishell.h" @@ -37,7 +37,7 @@ char *prompt_eval(void) return (out); } -char *parsing_start(char **trimed) +char *prompt(char **trimed) { char *line; char *prompt; diff --git a/parsing/tokens_jobs.c b/parsing/tokens_jobs.c index 029a53c..2048794 100644 --- a/parsing/tokens_jobs.c +++ b/parsing/tokens_jobs.c @@ -6,7 +6,7 @@ /* By: olabrecq +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/01/15 16:51:53 by jemartel #+# #+# */ -/* Updated: 2022/02/01 16:27:10 by jemartel ### ########.fr */ +/* Updated: 2022/02/04 17:48:54 by jemartel ### ########.fr */ /* */ /* ************************************************************************** */ @@ -93,7 +93,7 @@ void tokens_lst(char *trimed, size_t total_len, t_dlist **token_lst) } /* created a list of token from a string (wrapped function)*/ -t_dlist *line_parser(char *trimed) +t_dlist *parser(char *trimed) { t_dlist *lst; @@ -101,5 +101,6 @@ t_dlist *line_parser(char *trimed) if (!trimed) return (NULL); tokens_lst(trimed, ft_strlen(trimed), &lst); + free(trimed); return (lst); }