Files
42_INT_07_minishell/srcs/init/open_script_file.c
lperrey 8ed97346f7 fixed argv open().
previously wrongly dup2() to STDIN.
2021-12-20 22:52:41 +01:00

27 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* open_script_file.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/12/20 22:22:29 by lperrey #+# #+# */
/* Updated: 2021/12/20 22:27:14 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
void open_script_file(t_all *c, char *argv[])
{
if (argv[1])
{
c->script_fd = open(argv[1], O_RDONLY);
if (c->script_fd == -1)
{
shell_perror(argv[1], ": ", "", 0);
exit_free(c, EXIT_CMD_NOT_FOUND);
}
}
}