40 lines
676 B
C
40 lines
676 B
C
|
#include "libftx/libftx.h"
|
||
|
#include "minishell.h"
|
||
|
#include <unistd.h>
|
||
|
|
||
|
int main(int ac, char **av, char **env)
|
||
|
{
|
||
|
|
||
|
}
|
||
|
|
||
|
char *ft_get_executable_path(t_data *data, char *executable)
|
||
|
{
|
||
|
if (ft_strcmp(executable, "env"))
|
||
|
return (ft_strjoin("/usr/bin/bo", const char *s2))
|
||
|
}
|
||
|
|
||
|
int ft_excutor(t_cmd *cmd, )
|
||
|
{
|
||
|
char cmd[13] = "/usr/bin/ls";
|
||
|
char *args[3] = {NULL, "cat", NULL};
|
||
|
int pid;
|
||
|
int fd_in;
|
||
|
int fd_out;
|
||
|
|
||
|
if (ac != 3)
|
||
|
return (1);
|
||
|
fd_out = open(av[2], O_WRONLY | O_CREAT | O_TRUNC);
|
||
|
fd_in = open(av[1], O_RDONLY);
|
||
|
pid = fork();
|
||
|
if (pid == -1)
|
||
|
return (1);
|
||
|
if (pid == 0)
|
||
|
{
|
||
|
dup2(fd_out, 1);
|
||
|
dup2(fd_in, 0);
|
||
|
execve(cmd, args, env);
|
||
|
}
|
||
|
else
|
||
|
waitpid(pid);
|
||
|
}
|