Compare commits
No commits in common. "38e1b9834f727b802a1f6514151ac18289d31dec" and "8b771d661579b15f30aab23b5120887903f9817c" have entirely different histories.
38e1b9834f
...
8b771d6615
BIN
.cmds.c.swp
BIN
.cmds.c.swp
Binary file not shown.
6
cmds.c
6
cmds.c
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/02/15 14:17:26 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/02/17 13:06:35 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/02/16 18:20:10 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -108,6 +108,10 @@ t_list **ft_parse_cmds(char *line, t_list **env)
|
||||
t_list **cmds;
|
||||
|
||||
cmds = malloc(sizeof(t_list *));
|
||||
outfile = ft_outfile(line);
|
||||
infile = ft_infile(line);
|
||||
if (infile == -2 || outfile == -2)
|
||||
return (NULL);
|
||||
if (ft_cmds_prep(cmds, line, infile, outfile) == 1)
|
||||
return (NULL);
|
||||
if (ft_cmds_fill(cmds, env, line) == 1)
|
||||
|
BIN
env_fill.o
BIN
env_fill.o
Binary file not shown.
BIN
execution.o
BIN
execution.o
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
libftx/libftx.a
BIN
libftx/libftx.a
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
57
main.c
57
main.c
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/02/16 15:16:14 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/02/17 13:05:54 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/02/16 18:19:49 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -16,65 +16,28 @@ int main(int ac, char **av, char **env)
|
||||
{
|
||||
t_list **cmds;
|
||||
char *line;
|
||||
int infile;
|
||||
int outfile;
|
||||
t_data data;
|
||||
|
||||
if (ac == 1)
|
||||
return (1);
|
||||
line = ft_normalizer(av[1]);
|
||||
if (line == NULL)
|
||||
return (1);
|
||||
if (ft_syntatic_verif(line) == 1)
|
||||
{
|
||||
free(line);
|
||||
return (1);
|
||||
}
|
||||
data.env = init_env(env);
|
||||
if (data.env == NULL)
|
||||
return (1);
|
||||
line = ft_normalizer(av[1]);
|
||||
if (line == NULL)
|
||||
{
|
||||
ft_lstclear(data.env, env_del);
|
||||
free(data.env);
|
||||
return (1);
|
||||
}
|
||||
if (ft_syntatic_verif(line) == 1)
|
||||
{
|
||||
ft_lstclear(data.env, env_del);
|
||||
free(data.env);
|
||||
free(line);
|
||||
return (1);
|
||||
}
|
||||
outfile = ft_outfile(line);
|
||||
if (outfile == -2)
|
||||
{
|
||||
ft_lstclear(data.env, env_del);
|
||||
free(data.env);
|
||||
free(line);
|
||||
}
|
||||
infile = ft_infile(line);
|
||||
if (infile == -2)
|
||||
{
|
||||
close(outfile);
|
||||
ft_lstclear(data.env, env_del);
|
||||
free(data.env);
|
||||
free(line);
|
||||
}
|
||||
cmds = ft_parse_cmds(line, data.env, infile, outfile);
|
||||
cmds = ft_parse_cmds(line, data.env);
|
||||
if (cmds == NULL)
|
||||
{
|
||||
close(outfile);
|
||||
close(infile);
|
||||
ft_lstclear(data.env, env_del);
|
||||
ft_lstclear(cmds, ft_cmddel);
|
||||
free(cmds);
|
||||
free(data.env);
|
||||
free(line);
|
||||
return (1);
|
||||
}
|
||||
if (ft_cmds_executor(cmds, data.env) == 1)
|
||||
{
|
||||
close(outfile);
|
||||
close(infile);
|
||||
ft_lstclear(data.env, env_del);
|
||||
ft_lstclear(cmds, ft_cmddel);
|
||||
free(cmds);
|
||||
free(data.env);
|
||||
free(line);
|
||||
return (1);
|
||||
}
|
||||
ft_lstclear(data.env, env_del);
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/02/14 13:45:30 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/02/17 13:06:21 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/02/16 18:19:34 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -38,7 +38,7 @@ int ft_cmds_executor(t_list **cmds, t_list **env);
|
||||
char **ft_split_quoted(const char *s, char c);
|
||||
void ft_cmddel(void *content);
|
||||
void env_del(void *content);
|
||||
t_list **ft_parse_cmds(char *line, t_list **env, int infile, int outfile);
|
||||
t_list **ft_parse_cmds(char *line, t_list **env);
|
||||
int ft_cmd_filler(t_list *current, char **args, t_list **env);
|
||||
char *ft_normalizer(char *str);
|
||||
char *ft_env_filler(t_list **env, const char *str);
|
||||
|
BIN
syntatics.o
BIN
syntatics.o
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user