From d07a954adf30fdcc70899abd6c1d7f638b0cdcfb Mon Sep 17 00:00:00 2001 From: tomoron Date: Thu, 28 Mar 2024 14:44:58 +0100 Subject: [PATCH] bonus --- srcs/builtins.c | 4 +-- srcs/commands.c | 10 +++---- srcs/debug.c | 40 ++++++++++++++++++-------- srcs/echo.c | 4 +-- srcs/exec_bonus.c | 21 ++++++++++++++ srcs/input_redirections.c | 6 ++-- srcs/lst_cmd.c | 12 ++++---- srcs/lst_token.c | 57 ++++++++++++++++++++++++++++++++++++++ srcs/main.c | 29 +++++++++++++++++-- srcs/minishell.h | 19 +++++++------ srcs/minishellrc.c | 55 ------------------------------------ srcs/output_redirections.c | 6 ++-- srcs/parsing.c | 10 +++---- srcs/parsing_bonus.c | 6 +++- srcs/parsing_var.c | 2 +- srcs/pipe.c | 8 +++--- srcs/utils.c | 4 +-- srcs/utils2.c | 4 +-- 18 files changed, 182 insertions(+), 115 deletions(-) create mode 100644 srcs/exec_bonus.c create mode 100755 srcs/lst_token.c delete mode 100644 srcs/minishellrc.c diff --git a/srcs/builtins.c b/srcs/builtins.c index 6526f20..59d5079 100644 --- a/srcs/builtins.c +++ b/srcs/builtins.c @@ -6,7 +6,7 @@ /* By: marde-vr +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/03/05 18:20:21 by marde-vr #+# #+# */ -/* Updated: 2024/03/27 16:25:53 by tomoron ### ########.fr */ +/* Updated: 2024/03/28 13:28:19 by tomoron ### ########.fr */ /* */ /* ************************************************************************** */ @@ -37,7 +37,7 @@ int cmd_is_builtin(t_msh *msh, char *cmd_token) } else if (!ft_strcmp(cmd_token, "export")) { - if (!(msh->in_type == PIPE || msh->out_type == PIPE)) + if (!(/*msh->in_type == PIPE || msh->out_type == PIPE*/ 0)) g_return_code = ft_export(msh); return (1); } diff --git a/srcs/commands.c b/srcs/commands.c index 34ef592..5c7bb38 100644 --- a/srcs/commands.c +++ b/srcs/commands.c @@ -6,7 +6,7 @@ /* By: marde-vr +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/03/05 18:22:15 by marde-vr #+# #+# */ -/* Updated: 2024/03/27 17:01:49 by tomoron ### ########.fr */ +/* Updated: 2024/03/28 13:35:09 by tomoron ### ########.fr */ /* */ /* ************************************************************************** */ @@ -22,7 +22,7 @@ int get_cmd_count(t_token *cmds) while (cur_cmd->next != 0) { if (cur_cmd->type != ARG) - if (cur_cmd->type == PIPE) + if (/*cur_cmd->type == PIPE*/ 0) count++; cur_cmd = cur_cmd->next; } @@ -42,12 +42,12 @@ int get_args_count(t_token *cmds) count++; while (cur_cmd->next) { - if (cur_cmd->type == PIPE) + if (/*cur_cmd->type == PIPE*/ 0) break ; cur_cmd = cur_cmd->next; if (cur_cmd->type == ARG) count++; - else if (cur_cmd->type != PIPE) + else if (/*cur_cmd->type != PIPE*/ 1) cur_cmd = cur_cmd->next; } return (count); @@ -90,7 +90,7 @@ void remove_command_from_msh(t_msh *msh) cur_cmd = msh->cmds; while (cur_cmd && cur_cmd->next) { - if (cur_cmd->type == PIPE) + if (/*cur_cmd->type == PIPE*/ 0) { cmd_tmp = cur_cmd; cur_cmd = cur_cmd->next; diff --git a/srcs/debug.c b/srcs/debug.c index 8c91d85..00b5a25 100644 --- a/srcs/debug.c +++ b/srcs/debug.c @@ -6,31 +6,47 @@ /* By: marde-vr +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/18 15:46:50 by tomoron #+# #+# */ -/* Updated: 2024/03/27 16:21:24 by tomoron ### ########.fr */ +/* Updated: 2024/03/28 14:29:21 by tomoron ### ########.fr */ /* */ /* ************************************************************************** */ #include "minishell.h" -void print_parsed_cmd(t_token *cmd) +void print_parsed_token(t_token *token) { - while (cmd) + while (token) { printf("["); - if (cmd->type == ARG) - printf("ARG : \"%s\"", cmd->value); - else if (cmd->type == PIPE) - printf("PIPE"); - else if (cmd->type == RED_O) + if (token->type == ARG) + printf("ARG : \"%s\"", token->value); + else if (token->type == RED_O) printf("RED_O"); - else if (cmd->type == RED_O_APP) + else if (token->type == RED_O_APP) printf("RED_O_APP"); - else if (cmd->type == RED_I) + else if (token->type == RED_I) printf("RED_I"); - else if (cmd->type == HERE_DOC) + else if (token->type == HERE_DOC) printf("HERE_DOC"); printf("] "); - cmd = cmd->next; + token = token->next; } printf("\n"); } + +void print_parsed_cmd(t_cmd *cmd) +{ + while(cmd) + { + if(cmd->cmd_type == CMD) + printf("[CMD : %s] ", cmd->value); + if(cmd->cmd_type == PAREN) + printf("[PAREN : %s] ", cmd->value); + if(cmd->cmd_type == AND) + printf("[AND] "); + if(cmd->cmd_type == OR) + printf("[OR] "); + if(cmd->cmd_type == PIPE) + printf("[PIPE] "); + cmd = cmd->next; + } +} diff --git a/srcs/echo.c b/srcs/echo.c index 6b9bd44..db2f851 100755 --- a/srcs/echo.c +++ b/srcs/echo.c @@ -6,7 +6,7 @@ /* By: marde-vr +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/07 15:30:37 by tomoron #+# #+# */ -/* Updated: 2024/03/27 17:20:40 by tomoron ### ########.fr */ +/* Updated: 2024/03/28 13:21:05 by tomoron ### ########.fr */ /* */ /* ************************************************************************** */ @@ -18,7 +18,7 @@ void put_args(t_token *args) int first; first = 1; - while (args && args->type != PIPE) + while (args && args->type == ARG) { if (args->type != ARG) args = args->next; diff --git a/srcs/exec_bonus.c b/srcs/exec_bonus.c new file mode 100644 index 0000000..6090988 --- /dev/null +++ b/srcs/exec_bonus.c @@ -0,0 +1,21 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* exec_bonus.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: tomoron +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2024/03/28 13:50:14 by tomoron #+# #+# */ +/* Updated: 2024/03/28 14:34:55 by tomoron ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "minishell.h" + +void exec_command_bonus(char *cmd_str) +{ + t_cmd *cmd; + + cmd = parsing_bonus(commands); + print_parsed_cmd(t_cmd *cmd); +} diff --git a/srcs/input_redirections.c b/srcs/input_redirections.c index 9636109..6af2867 100644 --- a/srcs/input_redirections.c +++ b/srcs/input_redirections.c @@ -6,7 +6,7 @@ /* By: marde-vr +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/03/05 18:15:27 by marde-vr #+# #+# */ -/* Updated: 2024/03/27 16:20:41 by tomoron ### ########.fr */ +/* Updated: 2024/03/28 13:26:42 by tomoron ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,7 +14,7 @@ void redirect_input(t_msh *msh, int i) { - if (msh->in_type != PIPE) + if (/*msh->in_type != PIPE*/ 1) { if (dup2(msh->in_fd, 0) < 0) ft_exit(msh, 1); @@ -72,7 +72,7 @@ int first_is_in_type(t_msh *msh) cur_cmd = msh->cmds; while (cur_cmd && cur_cmd->type == ARG && cur_cmd->next) cur_cmd = cur_cmd->next; - if (cur_cmd->type == PIPE || cur_cmd->type == RED_I + if (/*cur_cmd->type == PIPE || */cur_cmd->type == RED_I || cur_cmd->type == HERE_DOC) return (1); return (0); diff --git a/srcs/lst_cmd.c b/srcs/lst_cmd.c index cee2f14..82ec88c 100755 --- a/srcs/lst_cmd.c +++ b/srcs/lst_cmd.c @@ -6,23 +6,23 @@ /* By: marde-vr +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/06 20:46:19 by tomoron #+# #+# */ -/* Updated: 2024/03/27 17:24:55 by tomoron ### ########.fr */ +/* Updated: 2024/03/28 14:30:24 by tomoron ### ########.fr */ /* */ /* ************************************************************************** */ #include "minishell.h" -t_token *cmd_add_back(t_token *cmd, char *value, t_token_type type) +t_cmd *cmd_add_back(t_cmd *cmd, char *value, t_cmd_type type) { - t_token *res; - t_token *current; + t_cmd *res; + t_cmd *current; if (value && !*value) { free(value); return (cmd); } - res = ft_calloc(1, sizeof(t_token)); + res = ft_calloc(1, sizeof(t_cmd)); if (!res) return (cmd); res->value = value; @@ -36,7 +36,7 @@ t_token *cmd_add_back(t_token *cmd, char *value, t_token_type type) return (cmd); } -t_token *free_cmd(t_token *cmd) +t_cmd *free_cmd(t_cmd *cmd) { if (cmd) { diff --git a/srcs/lst_token.c b/srcs/lst_token.c new file mode 100755 index 0000000..eee029f --- /dev/null +++ b/srcs/lst_token.c @@ -0,0 +1,57 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* lst_token.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: marde-vr +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2024/02/06 20:46:19 by tomoron #+# #+# */ +/* Updated: 2024/03/28 12:34:31 by tomoron ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "minishell.h" + +t_token *token_add_back(t_token *token, char *value, t_token_type type) +{ + t_token *res; + t_token *current; + + if (value && !*value) + { + free(value); + return (token); + } + res = ft_calloc(1, sizeof(t_token)); + if (!res) + return (token); + res->value = value; + res->type = type; + if (!token) + return (res); + current = token; + while (current->next) + current = current->next; + current->next = res; + return (token); +} + +t_token *free_token(t_token *token) +{ + if (token) + { + if (token && token->value) + { + free(token->value); + token->value = 0; + } + if (token && token->next) + { + free_token(token->next); + token->next = 0; + } + free(token); + token = 0; + } + return (0); +} diff --git a/srcs/main.c b/srcs/main.c index a06239a..9af79b6 100755 --- a/srcs/main.c +++ b/srcs/main.c @@ -6,7 +6,7 @@ /* By: marde-vr +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/02 21:59:20 by tomoron #+# #+# */ -/* Updated: 2024/03/27 17:33:15 by tomoron ### ########.fr */ +/* Updated: 2024/03/28 14:44:28 by tomoron ### ########.fr */ /* */ /* ************************************************************************** */ @@ -89,7 +89,8 @@ int init_minishell(t_msh **msh, int argc, char **argv, char **envp) ft_exit(*msh, 1); return (0); } - +/* +mandatory int main(int argc, char **argv, char **envp) { char *commands; @@ -107,13 +108,35 @@ int main(int argc, char **argv, char **envp) free(prompt); add_history(commands); msh->cmds = parse_command(commands, msh->env); + print_parsed_cmd(msh->cmds); free(commands); exec_commands(msh); - free_cmd(msh->cmds); + free_token(msh->cmds); + } rl_clear_history(); set_echoctl(msh->echoctl); free_msh(msh); ft_printf("exit\n"); return (g_return_code); +}*/ + +int main(void int argc, char **argv, char **envp) +{ + char *commands; + char *prompt; + t_cmd *cmd + + commands = (char *)1; + init_minishell(&msh, argc, argv, envp); + while (commands) + { + prompt = get_prompt(msh->env); + if (!prompt) + exit(1); + commands = readline(prompt); + free(prompt); + add_history(commands); + exec_command_bonus(commands); + } } diff --git a/srcs/minishell.h b/srcs/minishell.h index 2b73651..31636ea 100755 --- a/srcs/minishell.h +++ b/srcs/minishell.h @@ -6,7 +6,7 @@ /* By: marde-vr +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/04 17:31:38 by tomoron #+# #+# */ -/* Updated: 2024/03/27 19:50:37 by tomoron ### ########.fr */ +/* Updated: 2024/03/28 14:31:17 by tomoron ### ########.fr */ /* */ /* ************************************************************************** */ @@ -27,18 +27,18 @@ typedef enum e_cmd_type { - PIPE, CMD, PAREN, AND, - OR -} + OR, + PIPE +} t_cmd_type; typedef struct s_cmd { t_cmd_type cmd_type; char *value; - stuct s_cmd *next; + struct s_cmd *next; } t_cmd; typedef enum e_token_type @@ -81,7 +81,8 @@ typedef struct s_msh extern int g_return_code; -t_token *cmd_add_back(t_token *res, char *token, t_token_type type); +t_token *token_add_back(t_token *res, char *token, t_token_type type); +t_cmd *cmd_add_back(t_cmd *res, char *cmd, t_cmd_type type); void *here_doc_variables(int write, int index, void *data); int add_var_to_str(char *res, char **command, t_env *env); void find_cmd_path(t_msh *msh, char **paths, int *found); @@ -96,6 +97,7 @@ void handle_here_doc(t_msh *msh, char *eof); void get_in_type(t_msh *msh, t_token *cmds); void signal_handler_interactive(int signum); int get_token_len(char *cmd, t_env *env); +void signal_handler_here_doc(int signum); t_token *parsing_syntax_error(t_token *res); int file_access(t_msh *msh, int *found); void remove_command_from_msh(t_msh *msh); @@ -107,12 +109,13 @@ char **split_paths_from_env(t_env *env); int add_return_code_to_str(char *res); void redirect_input(t_msh *msh, int i); void parse_var(t_msh *msh, char *line); +void print_parsed_token(t_token *cmd);//debug int get_var_name_len(char *command); void handle_minishellrc(t_msh *msh); char *get_tmp_file_name(t_msh *msh); -void print_parsed_cmd(t_token *cmd);//debug int get_args_count(t_token *cmds); char **env_to_char_tab(t_env *env); +void print_parsed_cmd(t_cmd *cmd);//debug int get_cmd_count(t_token *cmds); int first_is_in_type(t_msh *msh); int contains_newline(char *str); @@ -123,7 +126,7 @@ char *remove_path(char *token); char *get_var_name(char *str); int exec_builtin(t_msh *msh); void get_cmd_path(t_msh *msh); -t_token *free_cmd(t_token *cmd); +t_token *free_token(t_token *cmd); int set_echoctl(int value); int print_env(t_env *env); int ft_export(t_msh *msh); diff --git a/srcs/minishellrc.c b/srcs/minishellrc.c deleted file mode 100644 index 83982cf..0000000 --- a/srcs/minishellrc.c +++ /dev/null @@ -1,55 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* minishellrc.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: marde-vr +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2024/02/16 17:40:16 by marde-vr #+# #+# */ -/* Updated: 2024/03/05 18:33:30 by marde-vr ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "minishell.h" - -void exec_rc_file(t_msh *msh, int fd) -{ - char *line; - - line = get_next_line(fd); - while (line) - { - if (line[0] != '#') - { - msh->cmds = parse_command(line, msh->env); - exec_commands(msh); - free_cmd(msh->cmds); - } - free(line); - line = get_next_line(fd); - } - free(line); -} - -void handle_minishellrc(t_msh *msh) -{ - char *home; - char *rc_path; - int fd; - - home = ft_get_env(msh->env, "HOME"); - rc_path = ft_strjoin(home, "/.minishellrc"); - if (access(rc_path, R_OK) != -1) - { - fd = open(rc_path, O_RDONLY); - if (fd == -1) - { - free(msh->env); - perror("open"); - return ; - } - exec_rc_file(msh, fd); - close(fd); - } - free(rc_path); -} diff --git a/srcs/output_redirections.c b/srcs/output_redirections.c index 590cdab..4a51594 100644 --- a/srcs/output_redirections.c +++ b/srcs/output_redirections.c @@ -6,7 +6,7 @@ /* By: marde-vr +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/03/05 19:10:52 by marde-vr #+# #+# */ -/* Updated: 2024/03/27 16:21:56 by tomoron ### ########.fr */ +/* Updated: 2024/03/28 13:26:17 by tomoron ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,7 +14,7 @@ void redirect_output(t_msh *msh, int i) { - if (msh->out_type != PIPE) + if (/*msh->out_type != PIPE*/ 1) { if (dup2(msh->out_fd, 1) < 0) ft_exit(msh, 1); @@ -41,7 +41,7 @@ void open_out_file(t_msh *msh, t_token **cur_cmd) perror("open"); return ; } - if ((*cur_cmd)->type != PIPE) + if (/*(*cur_cmd)->type != PIPE*/ 1) { while ((*cur_cmd)->next && (*cur_cmd)->next->type == ARG) *cur_cmd = (*cur_cmd)->next; diff --git a/srcs/parsing.c b/srcs/parsing.c index abd69e0..68a0acb 100755 --- a/srcs/parsing.c +++ b/srcs/parsing.c @@ -6,7 +6,7 @@ /* By: marde-vr +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/09 15:26:01 by tomoron #+# #+# */ -/* Updated: 2024/03/27 17:20:20 by tomoron ### ########.fr */ +/* Updated: 2024/03/28 14:10:02 by tomoron ### ########.fr */ /* */ /* ************************************************************************** */ #include "minishell.h" @@ -51,7 +51,7 @@ char *get_token(char **cmd, int *in_quote, int *in_dquote, t_env *env) else if (**cmd == '~' && !*in_quote && !*in_dquote) i += add_home_to_str(res + i); else if (((**cmd == '\'' && *in_dquote) || (**cmd == '"' && *in_quote)) - || (**cmd != '\'' && **cmd != '"')) + || (**cmd != '\'' && **cmd != '"')) res[i++] = **cmd; (*cmd)++; } @@ -72,13 +72,11 @@ t_token_type get_token_type(char **command) res = RED_O; else if ((*command)[0] == '<') res = RED_I; - else if ((*command)[0] == '|') - res = PIPE; else res = ARG; if (res == RED_O_APP || res == HERE_DOC) (*command) += 2; - if (res == RED_O || res == RED_I || res == PIPE) + if (res == RED_O || res == RED_I) (*command)++; return (res); } @@ -102,7 +100,7 @@ t_token *parse_command(char *command, t_env *env) else value = 0; if (type == ARG && value == 0) - return (free_cmd(res)); + return (free_token(res)); res = cmd_add_back(res, value, type); while (ft_isspace(*command)) command++; diff --git a/srcs/parsing_bonus.c b/srcs/parsing_bonus.c index 317f0ac..bdec630 100644 --- a/srcs/parsing_bonus.c +++ b/srcs/parsing_bonus.c @@ -6,9 +6,13 @@ /* By: tomoron +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/03/27 14:40:44 by tomoron #+# #+# */ -/* Updated: 2024/03/27 20:08:38 by tomoron ### ########.fr */ +/* Updated: 2024/03/28 14:43:59 by tomoron ### ########.fr */ /* */ /* ************************************************************************** */ #include "minishell.h" +t_cmd *parsing_bonus(char *cmd) +{ + t_cmd *res; +} diff --git a/srcs/parsing_var.c b/srcs/parsing_var.c index 921dd52..8546dfb 100755 --- a/srcs/parsing_var.c +++ b/srcs/parsing_var.c @@ -6,7 +6,7 @@ /* By: marde-vr +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/09 15:24:36 by tomoron #+# #+# */ -/* Updated: 2024/03/27 17:23:21 by tomoron ### ########.fr */ +/* Updated: 2024/03/28 14:10:02 by tomoron ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/srcs/pipe.c b/srcs/pipe.c index 0924b5f..2b9015a 100644 --- a/srcs/pipe.c +++ b/srcs/pipe.c @@ -6,7 +6,7 @@ /* By: marde-vr +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/03/05 18:17:25 by marde-vr #+# #+# */ -/* Updated: 2024/03/27 15:00:06 by tomoron ### ########.fr */ +/* Updated: 2024/03/28 13:18:35 by tomoron ### ########.fr */ /* */ /* ************************************************************************** */ @@ -54,10 +54,10 @@ void execute_command(t_msh *msh, char **cmd_args, int i) void child(t_msh *msh, char **cmd_args, int i) { - if ((msh->in_type != ARG && msh->in_type != PIPE) - || (msh->in_type == PIPE && i > 0)) + if ((msh->in_type != ARG/* && msh->in_type != PIPE*/) + || (/*msh->in_type == PIPE &&*/ i > 0)) redirect_input(msh, i); - if (msh->out_type == PIPE || msh->out_type == RED_O + if (/*msh->out_type == PIPE ||*/ msh->out_type == RED_O || msh->out_type == RED_O_APP) redirect_output(msh, i); close_pipe_fds(msh, i); diff --git a/srcs/utils.c b/srcs/utils.c index 1aaa2ca..dab0b4d 100644 --- a/srcs/utils.c +++ b/srcs/utils.c @@ -6,7 +6,7 @@ /* By: marde-vr +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/03/05 18:19:26 by marde-vr #+# #+# */ -/* Updated: 2024/03/27 16:55:04 by tomoron ### ########.fr */ +/* Updated: 2024/03/28 13:56:58 by tomoron ### ########.fr */ /* */ /* ************************************************************************** */ @@ -19,7 +19,7 @@ void free_msh(t_msh *msh) free_env(msh->env); free(msh->pids); free(msh->fds); - free_cmd(msh->cmds); + free_token(msh->cmds); set_echoctl(msh->echoctl); free(msh); } diff --git a/srcs/utils2.c b/srcs/utils2.c index cabf3fd..d177907 100644 --- a/srcs/utils2.c +++ b/srcs/utils2.c @@ -6,7 +6,7 @@ /* By: tomoron +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/03/27 17:19:27 by tomoron #+# #+# */ -/* Updated: 2024/03/27 17:25:54 by tomoron ### ########.fr */ +/* Updated: 2024/03/28 13:55:48 by tomoron ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,7 +14,7 @@ t_token *parsing_syntax_error(t_token *res) { - free_cmd(res); + free_token(res); ft_putstr_fd("minishell: syntax error\n", 2); return (0); }