42_minishell/main.c

57 lines
721 B
C
Raw Normal View History

2023-01-31 08:40:15 -05:00
#include "minishell.h"
2023-02-01 11:28:38 -05:00
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));
}
2023-01-31 09:02:23 -05:00
t_list **ft_parse_cmd(char *line)
{
2023-02-01 11:28:38 -05:00
char infile;
char outfile;
t_list **cmds;
size_t i;
(void) outfile;
(void) cmds;
i = 0;
while (line[i] != '\0')
{
i++;
}
2023-01-31 09:02:23 -05:00
}
int main(int ac, char **av)
{
2023-02-01 11:28:38 -05:00
int fd;
int i;
if (ac == 1)
return (1);
ft_parse_cmd(av[1]);
return (1);
2023-01-31 09:02:23 -05:00
}