Make the project entirely compliant with the Norm
authorLukas Jiriste <ljiriste@student.42prague.com>
Sun, 1 Sep 2024 12:40:18 +0000 (14:40 +0200)
committerLukas Jiriste <ljiriste@student.42prague.com>
Sun, 1 Sep 2024 13:40:40 +0000 (15:40 +0200)
17 files changed:
inc/builtins.h
inc/execution.h
inc/minishell.h
inc/minishell_structs.h
inc/parsing_info.h
src/add_word.c
src/assignments.c
src/exe_helpers.c
src/exe_prepare.c
src/execute_builtin.c
src/execute_cmd.c
src/expand.c
src/expand_split.c
src/redir_file.c
src/redir_here.c
src/redirection.c
src/token_finish.c

index 30ee6b6b8305736b46eabac91038899e6736fa8f..69222070ea1e495523b343077a8507bbbb60c23d 100644 (file)
@@ -6,14 +6,14 @@
 /*   By: ljiriste <ljiriste@student.42prague.com>   +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/08/26 11:39:54 by ljiriste          #+#    #+#             */
-/*   Updated: 2024/08/27 15:02:28 by ljiriste         ###   ########.fr       */
+/*   Updated: 2024/09/01 14:29:59 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
 #ifndef BUILTINS_H
 # define BUILTINS_H
 
-#include "minishell_structs.h"
+# include "minishell_structs.h"
 
 int            cd(int argc, char **argv, t_execution_env *env);
 int            echo(int argc, char **argv);
index bc27ae12199dc0f41a8bf57063e0efb23fbd6e6a..d76503a7da614a0332667541287d8945a0ab44c5 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: ljiriste <marvin@42.fr>                    +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/08/02 17:40:19 by ljiriste          #+#    #+#             */
-/*   Updated: 2024/09/01 14:03:42 by lnikolov         ###   ########.fr       */
+/*   Updated: 2024/09/01 14:43:27 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
 extern volatile sig_atomic_t   g_last_signal;
 
 void   free_split(char **fields);
-int    set_quote(char *quote, char c);
-int    is_token_type(const t_parse_tree_node *node, const char *type);
+int            set_quote(char *quote, char c);
+int            is_token_type(const t_parse_tree_node *node, const char *type);
 
-int    dup_pipes(const t_execution_env *env);
-int    dup_redirections(const t_vec *redirections);
+int            dup_pipes(const t_execution_env *env);
+void   dup_redirections(const t_vec *redirections);
 
 char   **quoted_split(const char *str);
-int    unquote_field(char *field);
-int    add_word(t_vec *exp_str, const char *word,
-       const t_execution_env *env, int enquote_result);
+int            unquote_field(char *field);
+int            add_word(t_vec *exp_str, const char *word,
+                       const t_execution_env *env, int enquote_result);
 char   **expand(t_parse_tree_node *simple_command, const t_execution_env *env);
 
 char   *find_exe(const char *exe_name, const t_execution_env *env);
-int    prepare_env(t_execution_env *env,
-               const t_vec *redirections, t_vec *assignments);
-
-int    ex_builtin(char **fields, __attribute__((unused))
-       t_vec *assignments, const t_vec *redirections, t_execution_env *env);
-int    ex_fields(char **fields, t_vec *assignments,
-       const t_vec *redirections, t_execution_env *env);
-int    ex_command(t_parse_tree_node *command, t_execution_env *env);
-int    ex_pipeline(t_parse_tree_node *pipeline, t_execution_env *env, int depth);
-int    ex_program(t_parse_tree_node *program, t_execution_env *env);
+int            prepare_env(t_execution_env *env,
+                       const t_vec *redirections, t_vec *assignments);
+
+int            ex_builtin(char **fields, __attribute__((unused)) t_vec *assignments,
+                       const t_vec *redirections, t_execution_env *env);
+int            ex_fields(char **fields, t_vec *assignments,
+                       const t_vec *redirections, t_execution_env *env);
+int            ex_command(t_parse_tree_node *command, t_execution_env *env);
+int            ex_pipeline(t_parse_tree_node *pipeline,
+                       t_execution_env *env, int depth);
+int            ex_program(t_parse_tree_node *program, t_execution_env *env);
 
 char   *get_word(const t_parse_tree_node *parent);
-int    add_redirection_here(t_vec *redirections,
-       t_parse_tree_node *io_here, int fd, const t_execution_env *env);
-int    add_redirection_file(t_vec *redirections,
-       t_parse_tree_node *io_file, int fd, t_execution_env *env);
-
-int    save_redirections(t_vec *redirections,
-       t_parse_tree_node *simple_command, t_execution_env *env);
-int    save_assignments(t_vec *assignments, t_parse_tree_node *simple_command,
-       const t_execution_env *env);
+int            add_redirection_here(t_vec *redirections,
+                       t_parse_tree_node *io_here, int fd, const t_execution_env *env);
+int            add_redirection_file(t_vec *redirections,
+                       t_parse_tree_node *io_file, int fd, t_execution_env *env);
+
+int            save_redirections(t_vec *redirections,
+                       t_parse_tree_node *simple_command, t_execution_env *env);
+int            save_assignments(t_vec *assignments, t_parse_tree_node *simple_command,
+                       const t_execution_env *env);
 
 #endif // EXECUTION_H
index 3516221a4308fa80b8f767487620d030251eb2ac..bb2634bf83c017dcc4b989fb3979e27866eab1cd 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: lnikolov <lnikolov@student.42prague.com    +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/05/02 13:22:57 by ljiriste          #+#    #+#             */
-/*   Updated: 2024/09/01 09:47:19 by ljiriste         ###   ########.fr       */
+/*   Updated: 2024/09/01 14:34:54 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
@@ -30,7 +30,8 @@ void  regenerate_terminal(void);
 void   handle_input(char **line, t_execution_env *env);
 
 int            unquote_field(char *field);
-int            add_word(t_vec *exp_str, const char *word, const t_execution_env *env, int quote);
+int            add_word(t_vec *exp_str, const char *word,
+                       const t_execution_env *env, int quote);
 int            add_conformant(t_vec *expanded, t_wildcard_info *info, char quote);
 int            should_be_expanded(const char *word);
 int            expand_dir(t_vec *expanded, t_wildcard_info *info);
@@ -45,6 +46,8 @@ int           parse(t_vec *tokens, t_tree **parse_tree);
 int            execute(t_tree *parse_tree, t_execution_env *env);
 int            finish_token(t_vec *tokens, t_vec *current_token, char next);
 char   **quoted_split(const char *str);
-int            categorization_step(char *line, size_t *i, t_vec *current_token, t_vec *tokens);
-int            handle_quote(t_vec *current_token, char *line, char quote_char, size_t *i);
+int            categorization_step(char *line, size_t *i,
+                       t_vec *current_token, t_vec *tokens);
+int            handle_quote(t_vec *current_token, char *line,
+                       char quote_char, size_t *i);
 #endif // MINISHELL_H
index 09acaab73286e835e2a6550c06246b0730082226..cb34ea83ea9b0541940a9de67e4bbbbffa47b217 100644 (file)
@@ -6,16 +6,16 @@
 /*   By: lnikolov <lnikolov@student.42prague.com    +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/08/26 09:08:46 by ljiriste          #+#    #+#             */
-/*   Updated: 2024/09/01 09:18:49 by ljiriste         ###   ########.fr       */
+/*   Updated: 2024/09/01 14:42:11 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
 #ifndef MINISHELL_STRUCTS_H
 # define MINISHELL_STRUCTS_H
 
-#include "libft.h"
+# include "libft.h"
 
-enum token_type
+typedef enum e_token_type
 {
        WORD,
        ASSIGNMENT_WORD,
@@ -29,7 +29,7 @@ enum token_type
        PIPE,
        LPARA,
        RPARA,
-};
+}      t_token_type;
 
 typedef struct s_vars
 {
@@ -56,7 +56,7 @@ typedef struct s_execution_env
        t_vec   child_pids;
 }                      t_execution_env;
 
-typedef struct s_wildcard_info
+typedef struct s_wildcard_info
 {
        const char      *to_expand;
        const char      *current_expand_char;
@@ -75,14 +75,16 @@ int                 has_valid_name(const char *str);
 int                    is_assignment_word(const char *str);
 int                    cmp_var_name(const char *a, const char *b);
 int                    set_var_value(t_vec *vars, const char *name, const char *value);
-int                    set_env_var_value(t_execution_env *env, const char *name, const char *value);
+int                    set_env_var_value(t_execution_env *env,
+                               const char *name, const char *value);
 ssize_t                get_var_index(const t_vec *vars, const char *var_name);
 const char     *get_var_value(const t_vec *vars, const char *var_name);
-const char     *get_env_var_value(const t_execution_env *env, const char *var_name);
+const char     *get_env_var_value(const t_execution_env *env,
+                               const char *var_name);
 char           *get_var_name(const char *line);
 int                    add_var_line(t_vec *vec, const char *line);
 
-const char     *type_enum_to_str(enum token_type type);
+const char     *type_enum_to_str(t_token_type type);
 
 void           free_str(void *str);
 void           free_token(void *token);
index 72114fc9f2dda2162884bdb5b9dfc1a18eb05207..cc5ecca328a97f32bc3f4e38321c80e76210d956 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: ljiriste <marvin@42.fr>                    +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/08/02 12:57:18 by ljiriste          #+#    #+#             */
-/*   Updated: 2024/08/02 14:18:00 by ljiriste         ###   ########.fr       */
+/*   Updated: 2024/09/01 14:30:23 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
@@ -16,7 +16,7 @@
 // Generated by xxd -i with small changes
 // from shell_parsing_table and shell_rules
 
-static char    g_str_table[6725] = {
+static const char      g_str_table[6725] = {
        0x53, 0x74, 0x61, 0x74, 0x65, 0x3b, 0x44, 0x47, 0x52, 0x45, 0x41, 0x54,
        0x3b, 0x47, 0x52, 0x45, 0x41, 0x54, 0x3b, 0x4c, 0x45, 0x53, 0x53, 0x3b,
        0x44, 0x4c, 0x45, 0x53, 0x53, 0x3b, 0x49, 0x4f, 0x5f, 0x4e, 0x55, 0x4d,
@@ -580,7 +580,7 @@ static char g_str_table[6725] = {
        0x3b, 0x3b, 0x3b, 0x0a, 0x00
 };
 
-static char    g_str_rules[941] = {
+static const char      g_str_rules[941] = {
        0x70, 0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x20, 0x2d, 0x3e, 0x20, 0x70,
        0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x20, 0x41, 0x4e, 0x44, 0x5f, 0x49,
        0x46, 0x20, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x0a, 0x70,
index 6db9d3d9055890bc43ed61478b931e9ea1fd305e..cb510ba1ac294f704c7ce8616eb6933c67177598 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: lnikolov <lnikolov@student.42prague.com    +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/09/01 11:51:31 by lnikolov          #+#    #+#             */
-/*   Updated: 2024/09/01 13:24:55 by lnikolov         ###   ########.fr       */
+/*   Updated: 2024/09/01 14:26:22 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
@@ -95,4 +95,4 @@ int   add_word(t_vec *exp_str, const char *word,
                                return (1);
        }
        return (ft_vec_append(exp_str, &space) != success);
-}
\ No newline at end of file
+}
index 8042f94ab0b92b05605d57531648bd379a7f47da..730de511e468094c8cf5d465b8ef8fc4d6a6a8d3 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: lnikolov <lnikolov@student.42prague.com    +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/09/01 11:19:00 by lnikolov          #+#    #+#             */
-/*   Updated: 2024/09/01 14:00:36 by lnikolov         ###   ########.fr       */
+/*   Updated: 2024/09/01 14:28:53 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
@@ -52,8 +52,8 @@ static int    add_assignment(t_vec *assignments, const char *assignment,
        return (1);
 }
 
-static int     save_assignments_prefix(t_vec *assignments, t_parse_tree_node *prefix,
-       const t_execution_env *env)
+static int     save_assignments_prefix(t_vec *assignments,
+                               t_parse_tree_node *prefix, const t_execution_env *env)
 {
        size_t                          i;
        t_parse_tree_node       *subnode;
index 9e3e0d0b25e32d42ebc6338a7f6a2dd671fec7a2..3ae7506a5d5273b0afa9cb91ca5fddde5755be17 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: lnikolov <lnikolov@student.42prague.com    +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/07/21 08:57:54 by ljiriste          #+#    #+#             */
-/*   Updated: 2024/09/01 13:22:49 by lnikolov         ###   ########.fr       */
+/*   Updated: 2024/09/01 14:25:34 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
@@ -78,4 +78,4 @@ void  free_split(char **fields)
        }
        free(fields);
        return ;
-}
\ No newline at end of file
+}
index 8c6abfda85bef832440f59b5ba7e6a2d2fc3ef90..56ac12084949bb6965c75c31fda973c2978c67b0 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: lnikolov <lnikolov@student.42prague.com    +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/09/01 11:53:23 by lnikolov          #+#    #+#             */
-/*   Updated: 2024/09/01 13:25:40 by lnikolov         ###   ########.fr       */
+/*   Updated: 2024/09/01 14:43:49 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
@@ -29,7 +29,7 @@ int   dup_pipes(const t_execution_env *env)
        return (0);
 }
 
-int    dup_redirections(const t_vec *redirections)
+void   dup_redirections(const t_vec *redirections)
 {
        size_t                          i;
        const t_redirection     *redir;
@@ -42,7 +42,7 @@ int   dup_redirections(const t_vec *redirections)
                close(redir->from_to_fds[1]);
                ++i;
        }
-       return (0);
+       return ;
 }
 
 static int     add_exported(t_vec *assignments, const t_execution_env *env)
@@ -85,7 +85,7 @@ int   prepare_env(t_execution_env *env,
 
        close_fds(&env->fds_to_close);
        res = dup_pipes(env);
-       res = dup_redirections(redirections) || res;
+       dup_redirections(redirections);
        res = add_exported(assignments, env) || res;
        return (res);
-}
\ No newline at end of file
+}
index e3dbab91cf9ef7aee9019f78d73cd5f5d00b90f3..4854dac70971bab880c25a911fa6aa35792e6222 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: lnikolov <lnikolov@student.42prague.com    +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/09/01 11:53:07 by lnikolov          #+#    #+#             */
-/*   Updated: 2024/09/01 13:26:33 by lnikolov         ###   ########.fr       */
+/*   Updated: 2024/09/01 14:49:28 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
 #include <unistd.h>
 #include <fcntl.h>
 
-static int     save_std_filenos(int fds[3])
+static void    close_redirections(const t_vec *redirections)
 {
-       fds[0] = dup(STDIN_FILENO);
-       if (fds[0] < 0)
-               return (1);
-       fds[1] = dup(STDOUT_FILENO);
-       if (fds[1] < 0)
-       {
-               close(fds[0]);
-               return (1);
-       }
-       fds[2] = dup(STDERR_FILENO);
-       if (fds[2] < 0)
+       size_t                          i;
+       const t_redirection     *redir;
+
+       i = 0;
+       while (i < redirections->size)
        {
-               close(fds[0]);
-               close(fds[1]);
-               return (1);
+               redir = ft_vec_caccess(redirections, i);
+               close(redir->from_to_fds[0]);
+               ++i;
        }
-       return (0);
+       return ;
 }
 
-static int     restore_std_filenos(int fds[3])
+static int     restore_fds(int fds[3], const t_vec *redirections,
+                               t_execution_env *env)
 {
+       close_redirections(redirections);
+       close(env->stdin_fd);
+       close(env->stdout_fd);
        if (dup2(fds[0], STDIN_FILENO) == -1)
                return (1);
        if (dup2(fds[1], STDOUT_FILENO) == -1)
@@ -52,11 +50,30 @@ static int  restore_std_filenos(int fds[3])
        return (0);
 }
 
-static void    close_pipes(const t_execution_env *env)
+static int     prepare_fds(int fds[3], const t_vec *redirections,
+                               t_execution_env *env)
 {
-       close(env->stdin_fd);
-       close(env->stdout_fd);
-       return ;
+       fds[0] = dup(STDIN_FILENO);
+       if (fds[0] < 0)
+               return (1);
+       fds[1] = dup(STDOUT_FILENO);
+       if (fds[1] < 0)
+       {
+               close(fds[0]);
+               return (1);
+       }
+       fds[2] = dup(STDERR_FILENO);
+       if (fds[2] < 0)
+       {
+               close(fds[0]);
+               close(fds[1]);
+               return (1);
+       }
+       dup_redirections(redirections);
+       if (!dup_pipes(env))
+               return (0);
+       restore_fds(fds, redirections, env);
+       return (1);
 }
 
 static size_t  count_fields(char **fields)
@@ -69,29 +86,13 @@ static size_t       count_fields(char **fields)
        return (i);
 }
 
-static void    close_redirections(const t_vec *redirections)
-{
-       size_t                          i;
-       const t_redirection     *redir;
-
-       i = 0;
-       while (i < redirections->size)
-       {
-               redir = ft_vec_caccess(redirections, i);
-               close(redir->from_to_fds[0]);
-               ++i;
-       }
-       return ;
-}
-
 int    ex_builtin(char **fields, __attribute__((unused))
        t_vec *assignments, const t_vec *redirections, t_execution_env *env)
 {
        int     fds[3];
 
-       save_std_filenos(fds);
-       dup_pipes(env);
-       dup_redirections(redirections);
+       if (prepare_fds(fds, redirections, env))
+               return (1);
        if (!ft_strcmp(fields[0], "cd"))
                env->builtin_ret_val = cd(count_fields(fields), fields, env);
        else if (!ft_strcmp(fields[0], "echo"))
@@ -108,8 +109,6 @@ int ex_builtin(char **fields, __attribute__((unused))
                env->builtin_ret_val = execute_exit(count_fields(fields), fields, env);
        else
                return (1);
-       close_redirections(redirections);
-       close_pipes(env);
-       restore_std_filenos(fds);
+       restore_fds(fds, redirections, env);
        return (0);
-}
\ No newline at end of file
+}
index 36cc2161f82aeab0e71612843ed67ca2998645b7..4d8f973a5ba0b53d0619587abc296d1dff9d44d4 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: lnikolov <lnikolov@student.42prague.com    +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/09/01 11:53:01 by lnikolov          #+#    #+#             */
-/*   Updated: 2024/09/01 14:13:10 by ljiriste         ###   ########.fr       */
+/*   Updated: 2024/09/01 14:24:28 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
@@ -51,7 +51,8 @@ static int    assignments_to_env(const t_vec *assignments, t_execution_env *env)
        return (0);
 }
 
-static int     ex_simple_command(t_parse_tree_node *simple_command, t_execution_env *env)
+static int     ex_simple_command(t_parse_tree_node *simple_command,
+                               t_execution_env *env)
 {
        t_vec   redirections;
        t_vec   assignments;
index a8c06741536c2fd55f45e3fb05b67fbaaef0679d..78e9dabff7cff74a3526514948e5627713777c92 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: lnikolov <lnikolov@student.42prague.com    +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/09/01 11:53:33 by lnikolov          #+#    #+#             */
-/*   Updated: 2024/09/01 13:31:20 by lnikolov         ###   ########.fr       */
+/*   Updated: 2024/09/01 14:28:25 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
@@ -88,4 +88,4 @@ char  **expand(t_parse_tree_node *simple_command, const t_execution_env *env)
        ft_vec_free(&expanded_str, NULL);
        unquote(fields);
        return (fields);
-}
\ No newline at end of file
+}
index e2a2fe6497954dcb88b22dd4e07cca39df2ef29f..14a3b608ef2ba3a0354cdc88e8f1e9f8b309d69b 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: lnikolov <lnikolov@student.42prague.com    +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/09/01 11:51:34 by lnikolov          #+#    #+#             */
-/*   Updated: 2024/09/01 13:30:17 by lnikolov         ###   ########.fr       */
+/*   Updated: 2024/09/01 14:27:19 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
@@ -76,4 +76,4 @@ char  **quoted_split(const char *str)
                return (NULL);
        }
        return (fields.vec);
-}
\ No newline at end of file
+}
index b19e1c98d9f5c0e2ed2573431a2638a3cb58323e..80166fca4f4f9ecc20c58b25d8f47a8e89936f6a 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: lnikolov <lnikolov@student.42prague.com    +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/09/01 11:23:57 by lnikolov          #+#    #+#             */
-/*   Updated: 2024/09/01 14:02:22 by lnikolov         ###   ########.fr       */
+/*   Updated: 2024/09/01 14:28:16 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
@@ -80,4 +80,3 @@ int   add_redirection_file(t_vec *redirections,
        free(filename);
        return (ft_vec_append(redirections, &redir) != success);
 }
-
index cdaacbb36257c33572387601cf194213a04bb33a..b8e842ede4f9b74bdf790c9fc22beb5668439aea 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: lnikolov <lnikolov@student.42prague.com    +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/09/01 11:48:10 by lnikolov          #+#    #+#             */
-/*   Updated: 2024/09/01 13:31:59 by lnikolov         ###   ########.fr       */
+/*   Updated: 2024/09/01 14:29:10 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
@@ -17,8 +17,6 @@
 #include <unistd.h>
 #include <fcntl.h>
 
-
-
 static char    *here_file_getline(void)
 {
        ft_printf("> ");
@@ -109,4 +107,4 @@ int add_redirection_here(t_vec *redirections,
        redir = (t_redirection){.from_to_fds[0] = fd,
                .from_to_fds[1] = pipe_fds[0]};
        return (ft_vec_append(redirections, &redir) != success);
-}
\ No newline at end of file
+}
index 9f4bbce881631c399e1a820e25f8979cb44d20f7..97005c5ed3f9d806e758a2aaf84730864ba0775b 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: lnikolov <lnikolov@student.42prague.com    +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/09/01 11:49:27 by lnikolov          #+#    #+#             */
-/*   Updated: 2024/09/01 14:02:49 by lnikolov         ###   ########.fr       */
+/*   Updated: 2024/09/01 14:26:09 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
@@ -14,7 +14,6 @@
 #include "minishell_structs.h"
 #include "libft.h"
 
-
 char   *get_word(const t_parse_tree_node *parent)
 {
        char                                    *res;
index 76cf1f47b95b262fce852421ec15cdfc7a3061d7..8354d696b72b033a94014b68d25cdd4b424783fb 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: lnikolov <lnikolov@student.42prague.com    +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2024/08/31 15:12:50 by lnikolov          #+#    #+#             */
-/*   Updated: 2024/09/01 09:44:20 by ljiriste         ###   ########.fr       */
+/*   Updated: 2024/09/01 14:42:32 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
@@ -14,7 +14,7 @@
 #include "minishell.h"
 #include <stdlib.h>
 
-const char     *type_enum_to_str(enum token_type type)
+const char     *type_enum_to_str(t_token_type type)
 {
        static const char       *tokens[12] = {
                "WORD",