Skip to content

Commit

Permalink
fixed weird name
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-philippe Martel committed Feb 4, 2022
1 parent 4a2279d commit e8d0e5a
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 36 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -85,7 +85,6 @@ test: all
norm:
@norminette ${SRCS} | grep "Error!"


clean:
@echo "\033[0;31m Cleaning..."
@rm -rf ${OBJS} > /tmp/out
Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions eval/eval.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: jemartel <jemartel@student.42quebec> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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 */
/* */
/* ************************************************************************** */

Expand All @@ -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
14 changes: 7 additions & 7 deletions eval/pre_eval_redir.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: jemartel <jemartel@student.42quebec> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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 */
/* */
/* ************************************************************************** */

Expand All @@ -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;

Expand Down Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;

Expand All @@ -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);
}
}
4 changes: 2 additions & 2 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: jemartel <jemartel@student.42quebec> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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 */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -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();
}
}
25 changes: 12 additions & 13 deletions parsing/parsing.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: olabrecq <olabrecq@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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 */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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);
}
}

Expand All @@ -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;
Expand All @@ -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);
}
}
Expand Down
8 changes: 4 additions & 4 deletions parsing/parsing.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: jemartel <jemartel@student.42quebec> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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 */
/* */
/* ************************************************************************** */

Expand All @@ -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);
Expand All @@ -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
4 changes: 2 additions & 2 deletions parsing/prompt_eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: jemartel <jemartel@student.42quebec> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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"
Expand Down Expand Up @@ -37,7 +37,7 @@ char *prompt_eval(void)
return (out);
}

char *parsing_start(char **trimed)
char *prompt(char **trimed)
{
char *line;
char *prompt;
Expand Down
5 changes: 3 additions & 2 deletions parsing/tokens_jobs.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: olabrecq <olabrecq@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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 */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -93,13 +93,14 @@ 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;

lst = NULL;
if (!trimed)
return (NULL);
tokens_lst(trimed, ft_strlen(trimed), &lst);
free(trimed);
return (lst);
}

0 comments on commit e8d0e5a

Please sign in to comment.