[🗑️] clean: cleaned project.
This commit is contained in:
BIN
.cache/clangd/index/exec.c.0790F7FFBBA14DB7.idx
Normal file
BIN
.cache/clangd/index/exec.c.0790F7FFBBA14DB7.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/exec.h.37CB144F896E9007.idx
Normal file
BIN
.cache/clangd/index/exec.h.37CB144F896E9007.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/ft_freearr.c.702B21921D406A5C.idx
Normal file
BIN
.cache/clangd/index/ft_freearr.c.702B21921D406A5C.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/ft_senderror.c.513E04A6E4E254EB.idx
Normal file
BIN
.cache/clangd/index/ft_senderror.c.513E04A6E4E254EB.idx
Normal file
Binary file not shown.
BIN
.cache/clangd/index/getpath.c.E59496E4AC65B437.idx
Normal file
BIN
.cache/clangd/index/getpath.c.E59496E4AC65B437.idx
Normal file
Binary file not shown.
Binary file not shown.
BIN
.cache/clangd/index/set_path.c.DE8818CAB0FB9AD3.idx
Normal file
BIN
.cache/clangd/index/set_path.c.DE8818CAB0FB9AD3.idx
Normal file
Binary file not shown.
2
Makefile
2
Makefile
@ -6,7 +6,7 @@
|
||||
# By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2023/11/01 11:03:22 by adjoly #+# #+# #
|
||||
# Updated: 2024/03/28 21:59:20 by adjoly ### ########.fr #
|
||||
# Updated: 2024/04/08 15:21:46 by adjoly ### ########.fr #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
|
@ -1,59 +0,0 @@
|
||||
[
|
||||
{
|
||||
"directory": "/nfs/homes/adjoly/Documents/pipex",
|
||||
"arguments": [
|
||||
"cc",
|
||||
"-I",
|
||||
"include/",
|
||||
"-I",
|
||||
"libft/",
|
||||
"-Werror",
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-g",
|
||||
"src/main.c",
|
||||
"-c",
|
||||
"-o",
|
||||
"obj/src/main.o"
|
||||
],
|
||||
"file": "src/main.c"
|
||||
},
|
||||
{
|
||||
"directory": "/nfs/homes/adjoly/Documents/pipex",
|
||||
"arguments": [
|
||||
"cc",
|
||||
"-I",
|
||||
"include/",
|
||||
"-I",
|
||||
"libft/",
|
||||
"-Werror",
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-g",
|
||||
"src/parsing/parsing.c",
|
||||
"-c",
|
||||
"-o",
|
||||
"obj/src/parsing/parsing.o"
|
||||
],
|
||||
"file": "src/parsing/parsing.c"
|
||||
},
|
||||
{
|
||||
"directory": "/nfs/homes/adjoly/Documents/pipex",
|
||||
"arguments": [
|
||||
"cc",
|
||||
"-I",
|
||||
"include/",
|
||||
"-I",
|
||||
"libft/",
|
||||
"-Werror",
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-g",
|
||||
"src/utils/ft_freetab.c",
|
||||
"-c",
|
||||
"-o",
|
||||
"obj/src/utils/ft_freetab.o"
|
||||
],
|
||||
"file": "src/utils/ft_freetab.c"
|
||||
}
|
||||
]
|
BIN
obj/src/exec/exec.o
Normal file
BIN
obj/src/exec/exec.o
Normal file
Binary file not shown.
BIN
obj/src/main.o
Normal file
BIN
obj/src/main.o
Normal file
Binary file not shown.
BIN
obj/src/parsing/parsing.o
Normal file
BIN
obj/src/parsing/parsing.o
Normal file
Binary file not shown.
BIN
obj/src/utils/ft_freearr.o
Normal file
BIN
obj/src/utils/ft_freearr.o
Normal file
Binary file not shown.
BIN
obj/src/utils/ft_senderror.o
Normal file
BIN
obj/src/utils/ft_senderror.o
Normal file
Binary file not shown.
BIN
obj/src/utils/getpath.o
Normal file
BIN
obj/src/utils/getpath.o
Normal file
Binary file not shown.
BIN
obj/src/utils/set_path.o
Normal file
BIN
obj/src/utils/set_path.o
Normal file
Binary file not shown.
@ -6,7 +6,7 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/06 14:07:27 by adjoly #+# #+# */
|
||||
/* Updated: 2024/04/07 11:01:39 by adjoly ### ########.fr */
|
||||
/* Updated: 2024/04/08 14:09:14 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -63,10 +63,11 @@ pid_t ft_exec_scnd_pipe(t_pipex *pipex, int fd[2])
|
||||
{
|
||||
outfile = open(pipex->outfile, O_CREAT | O_WRONLY | O_TRUNC, 0644);
|
||||
dup2(fd[0], STDIN_FILENO);
|
||||
close(fd[0]);
|
||||
dup2(outfile, STDOUT_FILENO);
|
||||
close(outfile);
|
||||
close(fd[0]);
|
||||
close(fd[1]);
|
||||
close(pipex->infile);
|
||||
execve(pipex->cmd[1].cmd, pipex->cmd[1].option, pipex->env);
|
||||
}
|
||||
return (pid);
|
||||
|
29
src/main.c
29
src/main.c
@ -6,13 +6,35 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/03/21 10:03:04 by adjoly #+# #+# */
|
||||
/* Updated: 2024/04/08 12:49:21 by adjoly ### ########.fr */
|
||||
/* Updated: 2024/04/08 15:26:06 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
#include "parsing.h"
|
||||
#include "pipex.h"
|
||||
#include <unistd.h>
|
||||
|
||||
void check_cmd_validity(t_pipex *pipex)
|
||||
{
|
||||
t_pcmd *cmd;
|
||||
|
||||
cmd = pipex->cmd;
|
||||
while (cmd)
|
||||
{
|
||||
if (access(cmd->cmd, X_OK) != 0)
|
||||
{
|
||||
// ft_freearr((*cmd).option);
|
||||
// if (pipex->cmd[1].cmd)
|
||||
// {
|
||||
// ft_freearr(pipex->cmd[1].option);
|
||||
// free(pipex->cmd[1].cmd);
|
||||
// }
|
||||
ft_senderror(pipex, "Error: Command not found");
|
||||
}
|
||||
cmd++;
|
||||
}
|
||||
}
|
||||
|
||||
void check_empty_args(char **av, t_pipex *pipex)
|
||||
{
|
||||
@ -71,9 +93,10 @@ int main(int ac, char **av, char **env)
|
||||
pipex->cmd = parse_cmd(ac - 3, av);
|
||||
pipex->env = env;
|
||||
getpath(pipex);
|
||||
if (pipex->path == NULL)
|
||||
ft_senderror(pipex, "Error : Can't find path");
|
||||
if (pipex->path)
|
||||
get_arrcmd_path(pipex);
|
||||
else
|
||||
check_cmd_validity(pipex);
|
||||
exec_pipe(pipex);
|
||||
ft_freearr(pipex->path);
|
||||
free_pcmd(pipex->cmd);
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/04 15:32:56 by adjoly #+# #+# */
|
||||
/* Updated: 2024/04/07 16:20:05 by adjoly ### ########.fr */
|
||||
/* Updated: 2024/04/08 14:18:42 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/06 13:31:15 by adjoly #+# #+# */
|
||||
/* Updated: 2024/04/08 12:54:26 by adjoly ### ########.fr */
|
||||
/* Updated: 2024/04/08 14:39:01 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
Reference in New Issue
Block a user