small fixes

This commit is contained in:
Loic Deridder
2025-02-18 13:52:56 +01:00
parent f3bf429c07
commit 28b4b0d3bc
5 changed files with 11 additions and 3 deletions

View File

@@ -11,6 +11,7 @@
/* ************************************************************************** */
#include "../../includes/minishell.h"
#include <stdlib.h>
int count_cmds(t_ast_n **pline)
{
@@ -94,6 +95,7 @@ int exec_scmd(t_ast_n *node)
pid_t pid;
int status;
status = 0;
if (!node->cmd)
return (0);
else if (is_builtin(node->cmd))

View File

@@ -93,10 +93,12 @@ void read_input(t_ast_n *node, int j)
{
char *str;
int check;
char *tmp;
check = ifhere_remove_quote(node, j);
str = get_next_line(node->msh->here_fd, 0);
while (str && ft_strncmp(str, node->files[j], -1) != 0)
tmp = ft_strjoin(node->files[j], "\n");
while (str && ft_strncmp(str, tmp, -1) != 0)
{
if (!check)
expander_here(&str, node);
@@ -107,6 +109,7 @@ void read_input(t_ast_n *node, int j)
if (!str)
get_next_line(node->msh->here_fd, 1);
ft_free(&str);
ft_free(&tmp);
}
void here_doc(t_ast_n *node, int i)

View File

@@ -44,6 +44,7 @@ void exec_pchild(int *pipes, int index, t_ast_n *pcmd, int cmds)
dup2(pipes[1], STDOUT_FILENO);
close(pipes[0]);
close(pipes[1]);
pcmd->sh = true;
if (handle_redir(pcmd))
{
free_child(pcmd->msh);

View File

@@ -17,6 +17,7 @@ int exec_shcmd(t_ast_n *node)
pid_t pid;
int status;
status = 0;
if (is_builtin(node->cmd))
return (exec_builtin(node));
else
@@ -92,6 +93,7 @@ int exec_subsh(t_ast_n *node)
pid_t pid;
int ret;
status = 0;
pid = fork();
if (pid == 0)
{