42_minishell/main.c
Camille Chauvet 33cccda0ad start
2023-02-01 17:28:38 +01:00

57 lines
721 B
C

#include "minishell.h"
int ft_get_infile(char **line)
{
size_t i;
char *path;
path = NULL;
i = 0;
while ((*line)[i] != '\0')
{
if ((*line)[i] == '<' && ft_is_in_quote(*line, i) == 0)
{
if (path != NULL)
free(path);
path = ft_getstr(*line, i);
if (path == NULL)
return (-1);
if (ft_file_is_readable(path) == 0)
{
free(path);
return (-1);
}
}
i++;
}
return (open(path, O_RDONLY));
}
t_list **ft_parse_cmd(char *line)
{
char infile;
char outfile;
t_list **cmds;
size_t i;
(void) outfile;
(void) cmds;
i = 0;
while (line[i] != '\0')
{
i++;
}
}
int main(int ac, char **av)
{
int fd;
int i;
if (ac == 1)
return (1);
ft_parse_cmd(av[1]);
return (1);
}