++++++++++++++++++++++++++++++++++++++++++++++++++++ redirections are parsed ++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++ Failed test: echo hello < in hi > out ++++ Got output: ╰─ t_cmdgroup ├─ t_cmdlist │ ├─ num_cmds = 1 │ ╰─ cmd[0] │ ├─ t_cmdlist_item │ │ ╰─ t_pipeline │ │ ├─ num_cmd = 1 │ │ ╰─ cmd[0] │ │ ╰─ t_simple_cmd │ │ ├─ words = [echo][hello][hi] │ │ ╰─ t_redir_list │ │ ├─ redirection[0] │ │ │ ╰─ t_redirection │ │ │ ├─ t_redir_type = REDIR_INPUT │ │ │ ╰─ marker = [in] │ │ ╰─ redirection[1] │ │ ╰─ t_redirection │ │ ├─ t_redir_type = REDIR_OUTPUT │ │ ╰─ marker = [out] │ ╰─ t_operator = END ╰─ (no redirections) ++++ But expected: ╰─ t_cmdgroup ├─ t_cmdlist │ ├─ num_cmds = 1 │ ╰─ cmd[0] │ ├─ t_cmdlist_item │ │ ╰─ t_pipeline │ │ ├─ num_cmd = 1 │ │ ╰─ cmd[0] │ │ ╰─ t_simple_cmd │ │ ├─ words = [echo][hello][hi] │ │ ╰─ t_redir_list │ │ ├─ redirection[0] │ │ │ ╰─ t_redirection │ │ ╰─ redirection[1] │ │ ╰─ t_redirection │ ╰─ t_operator = END ╰─ (no redirections) ++++ Diff: (red is got, green is expected) 14,15d13 < │ │ │ ├─ t_redir_type = REDIR_INPUT < │ │ │ ╰─ marker = [in] 18,19d15 < │ │ ├─ t_redir_type = REDIR_OUTPUT < │ │ ╰─ marker = [out] ++++ Run this to debug: echo 'echo hello < in hi > out' | ./minishell ++++++++++++++++++++++++++++++++++++++++++++++++++++ multiple redirections are parsed ++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++ Failed test: echo << HERE_DOC hello>outfile < infile < infile2 >> append ++++ Got output: ╰─ t_cmdgroup ├─ t_cmdlist │ ├─ num_cmds = 1 │ ╰─ cmd[0] │ ├─ t_cmdlist_item │ │ ╰─ t_pipeline │ │ ├─ num_cmd = 1 │ │ ╰─ cmd[0] │ │ ╰─ t_simple_cmd │ │ ├─ words = [echo][hello] │ │ ╰─ t_redir_list │ │ ├─ redirection[0] │ │ │ ╰─ t_redirection │ │ │ ├─ t_redir_type = REDIR_HERE_DOC │ │ │ ╰─ marker = [HERE_DOC] │ │ ├─ redirection[1] │ │ │ ╰─ t_redirection │ │ │ ├─ t_redir_type = REDIR_OUTPUT │ │ │ ╰─ marker = [outfile] │ │ ├─ redirection[2] │ │ │ ╰─ t_redirection │ │ │ ├─ t_redir_type = REDIR_INPUT │ │ │ ╰─ marker = [infile] │ │ ├─ redirection[3] │ │ │ ╰─ t_redirection │ │ │ ├─ t_redir_type = REDIR_INPUT │ │ │ ╰─ marker = [infile2] │ │ ╰─ redirection[4] │ │ ╰─ t_redirection │ │ ├─ t_redir_type = REDIR_APPEND │ │ ╰─ marker = [append] │ ╰─ t_operator = END ╰─ (no redirections) ++++ But expected: ++++ Diff: (red is got, green is expected) 1,33c1 < ╰─ t_cmdgroup < ├─ t_cmdlist < │ ├─ num_cmds = 1 < │ ╰─ cmd[0] < │ ├─ t_cmdlist_item < │ │ ╰─ t_pipeline < │ │ ├─ num_cmd = 1 < │ │ ╰─ cmd[0] < │ │ ╰─ t_simple_cmd < │ │ ├─ words = [echo][hello] < │ │ ╰─ t_redir_list < │ │ ├─ redirection[0] < │ │ │ ╰─ t_redirection < │ │ │ ├─ t_redir_type = REDIR_HERE_DOC < │ │ │ ╰─ marker = [HERE_DOC] < │ │ ├─ redirection[1] < │ │ │ ╰─ t_redirection < │ │ │ ├─ t_redir_type = REDIR_OUTPUT < │ │ │ ╰─ marker = [outfile] < │ │ ├─ redirection[2] < │ │ │ ╰─ t_redirection < │ │ │ ├─ t_redir_type = REDIR_INPUT < │ │ │ ╰─ marker = [infile] < │ │ ├─ redirection[3] < │ │ │ ╰─ t_redirection < │ │ │ ├─ t_redir_type = REDIR_INPUT < │ │ │ ╰─ marker = [infile2] < │ │ ╰─ redirection[4] < │ │ ╰─ t_redirection < │ │ ├─ t_redir_type = REDIR_APPEND < │ │ ╰─ marker = [append] < │ ╰─ t_operator = END < ╰─ (no redirections) --- >  ++++ Run this to debug: echo 'echo << HERE_DOC hello>outfile < infile < infile2 >> append' | ./minishell