Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions includes/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
/* ::: :::::::: */
/* utils.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: moabid <moabid@student.42.fr> +#+ +:+ +#+ */
/* By: frame <frame@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/12 21:05:17 by moabid #+# #+# */
/* Updated: 2022/10/26 04:37:59 by moabid ### ########.fr */
/* Updated: 2022/10/26 10:44:16 by frame ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -38,6 +38,16 @@ struct s_variable;
struct s_minishell;
typedef struct s_env t_env;

struct s_data
{
int i;
int j;
bool open;
char q_type;
char *ret_str;
char *str;
};

char *get_path(char *cmd, t_env *env);
void ft_error(char *str);
int my_strcmp(const char *strg1, char *strg2);
Expand Down Expand Up @@ -177,5 +187,13 @@ void print_the_env(t_env *enviroment);
void minishell_process_command_pipe(struct s_ast *ast,
struct s_minishell *minishell, int type);
void freeme(char **paths);
void parentesis_open(struct s_data *d);

void open_true_dollarsign(struct s_data *d);
void closed_true_dollarsign(struct s_data *d);
char *quotes_remover(char *str, char *set, struct s_minishell *minishell);


int ft_atoi_special(char *str);

#endif
7 changes: 4 additions & 3 deletions src/builtin/ft_export.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: frame <frame@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/09/08 11:46:09 by moabid #+# #+# */
/* Updated: 2022/10/26 03:20:14 by moabid ### ########.fr */
/* Updated: 2022/10/26 09:26:08 by frame ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -75,7 +75,8 @@ bool indentfier_exist(t_env *env, char *str)
return (false);
}

t_env *export_the_argv(struct s_minishell *minishell, char **argv, t_env *enviroment)
t_env *export_the_argv(struct s_minishell *minishell,
char **argv, t_env *enviroment)
{
t_env *new;
int i;
Expand Down Expand Up @@ -123,7 +124,7 @@ t_env *export_the_argv(struct s_minishell *minishell, char **argv, t_env *enviro
return (true);
} */

void ft_export(char **argv, struct s_minishell *minishell)
void ft_export(char **argv, struct s_minishell *minishell)
{
t_env *enviroment;
t_env *head;
Expand Down
6 changes: 3 additions & 3 deletions src/builtin/ft_pwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
/* ::: :::::::: */
/* ft_pwd.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: moabid <moabid@student.42.fr> +#+ +:+ +#+ */
/* By: frame <frame@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/08/17 17:47:09 by frmessin #+# #+# */
/* Updated: 2022/10/26 03:20:14 by moabid ### ########.fr */
/* Updated: 2022/10/26 09:25:23 by frame ### ########.fr */
/* */
/* ************************************************************************** */

Expand All @@ -25,7 +25,7 @@ char *get_pwd(void)
return (pwd);
}

void ft_pwd (struct s_minishell *minishell)
void ft_pwd(struct s_minishell *minishell)
{
char *pwd;
int i;
Expand Down
6 changes: 3 additions & 3 deletions src/builtin/ft_unset.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
/* ::: :::::::: */
/* ft_unset.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: moabid <moabid@student.42.fr> +#+ +:+ +#+ */
/* By: frame <frame@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/08/22 12:21:03 by frmessin #+# #+# */
/* Updated: 2022/10/26 03:20:14 by moabid ### ########.fr */
/* Updated: 2022/10/26 09:25:02 by frame ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -61,7 +61,7 @@ bool is_valid(char *str)
return (true);
}

void ft_unset(char **argv, struct s_minishell *minishell)
void ft_unset(char **argv, struct s_minishell *minishell)
{
t_env *tmp;
int i;
Expand Down
7 changes: 4 additions & 3 deletions src/core/execute/heredoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
/* ::: :::::::: */
/* heredoc.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: moabid <moabid@student.42.fr> +#+ +:+ +#+ */
/* By: frame <frame@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/26 02:32:03 by moabid #+# #+# */
/* Updated: 2022/10/26 03:25:08 by moabid ### ########.fr */
/* Updated: 2022/10/26 10:25:34 by frame ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -57,7 +57,8 @@ void heredoc_execute_caller(struct s_ast *tmp, int direction)
execute_heredoc(tmp->right->value.token_name, 1);
}

void heredoc_forward_command(struct s_ast *ast, struct s_minishell *minishell)
void heredoc_forward_command(struct s_ast *ast,
struct s_minishell *minishell)
{
pid_t pid;
int fd_in;
Expand Down
14 changes: 8 additions & 6 deletions src/core/execute/redirection.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
/* ::: :::::::: */
/* redirection.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: moabid <moabid@student.42.fr> +#+ +:+ +#+ */
/* By: frame <frame@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/26 03:05:47 by moabid #+# #+# */
/* Updated: 2022/10/26 03:25:07 by moabid ### ########.fr */
/* Updated: 2022/10/26 10:26:16 by frame ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -54,9 +54,10 @@ void process_direct(struct s_ast *ast, struct s_minishell *minishell)
process_pipe_run_first(tmp, ast, minishell, 1);
}

void process_redirect_overwrite(struct s_ast *ast, struct s_minishell *minishell)
void process_redirect_overwrite(struct s_ast *ast,
struct s_minishell *minishell)
{
int fd_out;
int fd_out;
struct s_ast *tmp;

tmp = ast;
Expand All @@ -68,9 +69,10 @@ void process_redirect_overwrite(struct s_ast *ast, struct s_minishell *minishell
process_pipe_run_first(tmp->left, ast->left, minishell, fd_out);
}

void process_redirect_append(struct s_ast *ast, struct s_minishell *minishell)
void process_redirect_append(struct s_ast *ast,
struct s_minishell *minishell)
{
int fd_out;
int fd_out;
struct s_ast *tmp;

tmp = ast;
Expand Down
7 changes: 3 additions & 4 deletions src/core/execute/tree_crossing.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,19 @@
/* ::: :::::::: */
/* tree_crossing.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: moabid <moabid@student.42.fr> +#+ +:+ +#+ */
/* By: frame <frame@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/08/08 16:36:31 by moabid #+# #+# */
/* Updated: 2022/10/26 03:25:08 by moabid ### ########.fr */
/* Updated: 2022/10/26 10:25:57 by frame ### ########.fr */
/* */
/* ************************************************************************** */

#include "minishell.h"
#include "builtin.h"

/// Number of childs complex
int child_n_c(struct s_ast *node)
{
int num;
int num;
struct s_ast *tmp;

num = 0;
Expand Down
8 changes: 4 additions & 4 deletions src/core/execute/tree_executing.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
/* ::: :::::::: */
/* tree_executing.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: moabid <moabid@student.42.fr> +#+ +:+ +#+ */
/* By: frame <frame@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/08/09 22:36:12 by moabid #+# #+# */
/* Updated: 2022/10/26 03:25:08 by moabid ### ########.fr */
/* Updated: 2022/10/26 10:24:34 by frame ### ########.fr */
/* */
/* ************************************************************************** */

Expand All @@ -23,9 +23,9 @@ void command_statement_run(char **command_statement,

char **command_statement_create_complexe(struct s_ast *ast)
{
int i;
int i;
struct s_ast *tmp;
char **command_statement;
char **command_statement;

i = 0;
tmp = ast;
Expand Down
11 changes: 6 additions & 5 deletions src/core/execute/tree_run.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
/* ::: :::::::: */
/* tree_run.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: moabid <moabid@student.42.fr> +#+ +:+ +#+ */
/* By: frame <frame@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/26 02:25:16 by moabid #+# #+# */
/* Updated: 2022/10/26 03:25:08 by moabid ### ########.fr */
/* Updated: 2022/10/26 10:26:39 by frame ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -39,8 +39,8 @@ void minishell_run_equal(struct s_ast *ast, struct s_minishell *minishell)
void minishell_process_command(struct s_ast *ast, struct s_minishell *m)
{
struct s_ast *jump;
char **command_statement;
char *command_path;
char **command_statement;
char *command_path;

jump = ast;
if (ast->value.token_type == WORD && a_err(m, ast->value.token_name, 127))
Expand All @@ -67,7 +67,8 @@ void minishell_process_bool(struct s_ast *ast, struct s_minishell *minishell)
minishell->return_value = 0;
}

void minishell_process_pipeline(struct s_ast *ast, struct s_minishell *minishell)
void minishell_process_pipeline(struct s_ast *ast,
struct s_minishell *minishell)
{
minishell->type = COMPLEXE;
if (ast->value.token_type == PIPE)
Expand Down
9 changes: 5 additions & 4 deletions src/core/parser/ast_create.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
/* ::: :::::::: */
/* ast_create.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: moabid <moabid@student.42.fr> +#+ +:+ +#+ */
/* By: frame <frame@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/23 21:56:17 by moabid #+# #+# */
/* Updated: 2022/10/26 03:33:01 by moabid ### ########.fr */
/* Updated: 2022/10/26 10:23:38 by frame ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -35,7 +35,8 @@ void child_sanitize(struct s_ast *node, struct s_token_stream *tmp,
node->value.token_name = tmp->token_name;
}

struct s_ast *node_create_child(struct s_token_stream *tmp, struct s_minishell
struct s_ast *node_create_child(
struct s_token_stream *tmp, struct s_minishell
*minishell, int prev_type)
{
struct s_ast *node;
Expand All @@ -62,7 +63,7 @@ void ast_insert_child(struct s_ast *node, struct s_ast **ast,
struct s_token_stream *prev, struct s_minishell *minishell)
{
struct s_ast *iterator;
char *prev_token;
char *prev_token;

iterator = *ast;
prev_token = prev->token_name;
Expand Down
9 changes: 5 additions & 4 deletions src/core/parser/lexical_checker.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@
/* ::: :::::::: */
/* lexical_checker.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: moabid <moabid@student.42.fr> +#+ +:+ +#+ */
/* By: frame <frame@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/25 20:38:33 by moabid #+# #+# */
/* Updated: 2022/10/26 03:33:01 by moabid ### ########.fr */
/* Updated: 2022/10/26 10:24:09 by frame ### ########.fr */
/* */
/* ************************************************************************** */

#include "minishell.h"

bool token_checker(struct s_token_stream *stream, struct s_minishell *minishell)
bool token_checker(struct s_token_stream *stream,
struct s_minishell *minishell)
{
struct s_token_stream *tmp;
bool bracket;
bool bracket;

tmp = stream;
bracket = false;
Expand Down
7 changes: 4 additions & 3 deletions src/core/parser/semantic_analyzer.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
/* ::: :::::::: */
/* semantic_analyzer.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: moabid <moabid@student.42.fr> +#+ +:+ +#+ */
/* By: frame <frame@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/16 17:21:59 by moabid #+# #+# */
/* Updated: 2022/10/26 03:33:01 by moabid ### ########.fr */
/* Updated: 2022/10/26 10:23:09 by frame ### ########.fr */
/* */
/* ************************************************************************** */

#include "minishell.h"
#include "builtin.h"
#include "parser.h"

struct s_ast *sub_tree_builder(struct s_ast *ast, struct s_minishell *minishell,
struct s_ast *sub_tree_builder(struct s_ast *ast,
struct s_minishell *minishell,
struct s_token_stream **prev, struct s_token_stream **stm)
{
*prev = *stm;
Expand Down
Loading