Merge branch 'camille'
This commit is contained in:
commit
38e1b9834f
BIN
.cmds.c.swp
Normal file
BIN
.cmds.c.swp
Normal file
Binary file not shown.
6
cmds.c
6
cmds.c
@ -6,7 +6,7 @@
|
|||||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/02/15 14:17:26 by cchauvet #+# #+# */
|
/* Created: 2023/02/15 14:17:26 by cchauvet #+# #+# */
|
||||||
/* Updated: 2023/02/16 18:20:10 by cchauvet ### ########.fr */
|
/* Updated: 2023/02/17 13:06:35 by cchauvet ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -108,10 +108,6 @@ t_list **ft_parse_cmds(char *line, t_list **env)
|
|||||||
t_list **cmds;
|
t_list **cmds;
|
||||||
|
|
||||||
cmds = malloc(sizeof(t_list *));
|
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)
|
if (ft_cmds_prep(cmds, line, infile, outfile) == 1)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
if (ft_cmds_fill(cmds, env, line) == 1)
|
if (ft_cmds_fill(cmds, env, line) == 1)
|
||||||
|
BIN
env_fill.o
Normal file
BIN
env_fill.o
Normal file
Binary file not shown.
BIN
execution.o
Normal file
BIN
execution.o
Normal file
Binary file not shown.
BIN
libftx/extra/extra.a
Normal file
BIN
libftx/extra/extra.a
Normal file
Binary file not shown.
BIN
libftx/extra/ft_contain_only.o
Normal file
BIN
libftx/extra/ft_contain_only.o
Normal file
Binary file not shown.
BIN
libftx/extra/ft_freer.o
Normal file
BIN
libftx/extra/ft_freer.o
Normal file
Binary file not shown.
BIN
libftx/extra/ft_is_in.o
Normal file
BIN
libftx/extra/ft_is_in.o
Normal file
Binary file not shown.
BIN
libftx/extra/ft_random_generator.o
Normal file
BIN
libftx/extra/ft_random_generator.o
Normal file
Binary file not shown.
BIN
libftx/extra/ft_strchri.o
Normal file
BIN
libftx/extra/ft_strchri.o
Normal file
Binary file not shown.
BIN
libftx/extra/ft_strcmp.o
Normal file
BIN
libftx/extra/ft_strcmp.o
Normal file
Binary file not shown.
BIN
libftx/extra/ft_strfjoin.o
Normal file
BIN
libftx/extra/ft_strfjoin.o
Normal file
Binary file not shown.
BIN
libftx/extra/ft_strgen.o
Normal file
BIN
libftx/extra/ft_strgen.o
Normal file
Binary file not shown.
BIN
libftx/extra/ft_strmerger.o
Normal file
BIN
libftx/extra/ft_strmerger.o
Normal file
Binary file not shown.
BIN
libftx/extra/ft_strndup.o
Normal file
BIN
libftx/extra/ft_strndup.o
Normal file
Binary file not shown.
BIN
libftx/extra/ft_swap.o
Normal file
BIN
libftx/extra/ft_swap.o
Normal file
Binary file not shown.
BIN
libftx/extra/ft_tabrealloc.o
Normal file
BIN
libftx/extra/ft_tabrealloc.o
Normal file
Binary file not shown.
BIN
libftx/extra/ft_ultoa_base.o
Normal file
BIN
libftx/extra/ft_ultoa_base.o
Normal file
Binary file not shown.
BIN
libftx/gnl/get_next_line.a
Normal file
BIN
libftx/gnl/get_next_line.a
Normal file
Binary file not shown.
BIN
libftx/gnl/get_next_line.o
Normal file
BIN
libftx/gnl/get_next_line.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_atoi.o
Normal file
BIN
libftx/libft/ft_atoi.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_bzero.o
Normal file
BIN
libftx/libft/ft_bzero.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_calloc.o
Normal file
BIN
libftx/libft/ft_calloc.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_isalnum.o
Normal file
BIN
libftx/libft/ft_isalnum.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_isalpha.o
Normal file
BIN
libftx/libft/ft_isalpha.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_isascii.o
Normal file
BIN
libftx/libft/ft_isascii.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_isdigit.o
Normal file
BIN
libftx/libft/ft_isdigit.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_isprint.o
Normal file
BIN
libftx/libft/ft_isprint.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_itoa.o
Normal file
BIN
libftx/libft/ft_itoa.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_lstadd_back.o
Normal file
BIN
libftx/libft/ft_lstadd_back.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_lstadd_front.o
Normal file
BIN
libftx/libft/ft_lstadd_front.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_lstclear.o
Normal file
BIN
libftx/libft/ft_lstclear.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_lstdelone.o
Normal file
BIN
libftx/libft/ft_lstdelone.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_lstiter.o
Normal file
BIN
libftx/libft/ft_lstiter.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_lstlast.o
Normal file
BIN
libftx/libft/ft_lstlast.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_lstmap.o
Normal file
BIN
libftx/libft/ft_lstmap.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_lstnew.o
Normal file
BIN
libftx/libft/ft_lstnew.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_lstsize.o
Normal file
BIN
libftx/libft/ft_lstsize.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_memchr.o
Normal file
BIN
libftx/libft/ft_memchr.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_memcmp.o
Normal file
BIN
libftx/libft/ft_memcmp.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_memcpy.o
Normal file
BIN
libftx/libft/ft_memcpy.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_memmove.o
Normal file
BIN
libftx/libft/ft_memmove.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_memset.o
Normal file
BIN
libftx/libft/ft_memset.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_putchar_fd.o
Normal file
BIN
libftx/libft/ft_putchar_fd.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_putendl_fd.o
Normal file
BIN
libftx/libft/ft_putendl_fd.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_putnbr_fd.o
Normal file
BIN
libftx/libft/ft_putnbr_fd.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_putstr_fd.o
Normal file
BIN
libftx/libft/ft_putstr_fd.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_split.o
Normal file
BIN
libftx/libft/ft_split.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_strchr.o
Normal file
BIN
libftx/libft/ft_strchr.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_strdup.o
Normal file
BIN
libftx/libft/ft_strdup.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_striteri.o
Normal file
BIN
libftx/libft/ft_striteri.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_strjoin.o
Normal file
BIN
libftx/libft/ft_strjoin.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_strlcat.o
Normal file
BIN
libftx/libft/ft_strlcat.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_strlcpy.o
Normal file
BIN
libftx/libft/ft_strlcpy.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_strlen.o
Normal file
BIN
libftx/libft/ft_strlen.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_strmapi.o
Normal file
BIN
libftx/libft/ft_strmapi.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_strncmp.o
Normal file
BIN
libftx/libft/ft_strncmp.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_strnstr.o
Normal file
BIN
libftx/libft/ft_strnstr.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_strrchr.o
Normal file
BIN
libftx/libft/ft_strrchr.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_strtrim.o
Normal file
BIN
libftx/libft/ft_strtrim.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_substr.o
Normal file
BIN
libftx/libft/ft_substr.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_tolower.o
Normal file
BIN
libftx/libft/ft_tolower.o
Normal file
Binary file not shown.
BIN
libftx/libft/ft_toupper.o
Normal file
BIN
libftx/libft/ft_toupper.o
Normal file
Binary file not shown.
BIN
libftx/libft/libft.a
Normal file
BIN
libftx/libft/libft.a
Normal file
Binary file not shown.
BIN
libftx/libftx.a
Normal file
BIN
libftx/libftx.a
Normal file
Binary file not shown.
BIN
libftx/printf/ft_dprintX.o
Normal file
BIN
libftx/printf/ft_dprintX.o
Normal file
Binary file not shown.
BIN
libftx/printf/ft_dprintarg.o
Normal file
BIN
libftx/printf/ft_dprintarg.o
Normal file
Binary file not shown.
BIN
libftx/printf/ft_dprintflag.o
Normal file
BIN
libftx/printf/ft_dprintflag.o
Normal file
Binary file not shown.
BIN
libftx/printf/ft_dprintl_base.o
Normal file
BIN
libftx/printf/ft_dprintl_base.o
Normal file
Binary file not shown.
BIN
libftx/printf/ft_dprintptr.o
Normal file
BIN
libftx/printf/ft_dprintptr.o
Normal file
Binary file not shown.
BIN
libftx/printf/ft_dprintstrtab.o
Normal file
BIN
libftx/printf/ft_dprintstrtab.o
Normal file
Binary file not shown.
BIN
libftx/printf/ft_dprintul.o
Normal file
BIN
libftx/printf/ft_dprintul.o
Normal file
Binary file not shown.
BIN
libftx/printf/ft_dprintul_base.o
Normal file
BIN
libftx/printf/ft_dprintul_base.o
Normal file
Binary file not shown.
BIN
libftx/printf/ft_dprintx.o
Normal file
BIN
libftx/printf/ft_dprintx.o
Normal file
Binary file not shown.
BIN
libftx/printf/ft_eprintf.o
Normal file
BIN
libftx/printf/ft_eprintf.o
Normal file
Binary file not shown.
BIN
libftx/printf/ft_isarg.o
Normal file
BIN
libftx/printf/ft_isarg.o
Normal file
Binary file not shown.
BIN
libftx/printf/ft_isdigit.o
Normal file
BIN
libftx/printf/ft_isdigit.o
Normal file
Binary file not shown.
BIN
libftx/printf/ft_printf.a
Normal file
BIN
libftx/printf/ft_printf.a
Normal file
Binary file not shown.
BIN
libftx/printf/ft_printf.o
Normal file
BIN
libftx/printf/ft_printf.o
Normal file
Binary file not shown.
BIN
libftx/printf/ft_putchar_fd.o
Normal file
BIN
libftx/printf/ft_putchar_fd.o
Normal file
Binary file not shown.
BIN
libftx/printf/ft_putstr_fd.o
Normal file
BIN
libftx/printf/ft_putstr_fd.o
Normal file
Binary file not shown.
BIN
libftx/printf/ft_skipflag.o
Normal file
BIN
libftx/printf/ft_skipflag.o
Normal file
Binary file not shown.
BIN
libftx/printf/ft_strlen.o
Normal file
BIN
libftx/printf/ft_strlen.o
Normal file
Binary file not shown.
BIN
libftx/printf/ft_vdprintf.o
Normal file
BIN
libftx/printf/ft_vdprintf.o
Normal file
Binary file not shown.
63
main.c
63
main.c
@ -6,7 +6,7 @@
|
|||||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/02/16 15:16:14 by cchauvet #+# #+# */
|
/* Created: 2023/02/16 15:16:14 by cchauvet #+# #+# */
|
||||||
/* Updated: 2023/02/16 18:19:49 by cchauvet ### ########.fr */
|
/* Updated: 2023/02/17 13:05:54 by cchauvet ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -16,28 +16,65 @@ int main(int ac, char **av, char **env)
|
|||||||
{
|
{
|
||||||
t_list **cmds;
|
t_list **cmds;
|
||||||
char *line;
|
char *line;
|
||||||
|
int infile;
|
||||||
|
int outfile;
|
||||||
t_data data;
|
t_data data;
|
||||||
|
|
||||||
if (ac == 1)
|
if (ac == 1)
|
||||||
return (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);
|
data.env = init_env(env);
|
||||||
if (data.env == NULL)
|
if (data.env == NULL)
|
||||||
return (1);
|
return (1);
|
||||||
cmds = ft_parse_cmds(line, data.env);
|
line = ft_normalizer(av[1]);
|
||||||
if (cmds == NULL)
|
if (line == NULL)
|
||||||
return (1);
|
|
||||||
if (ft_cmds_executor(cmds, data.env) == 1)
|
|
||||||
{
|
{
|
||||||
|
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);
|
||||||
|
if (cmds == NULL)
|
||||||
|
{
|
||||||
|
close(outfile);
|
||||||
|
close(infile);
|
||||||
ft_lstclear(data.env, env_del);
|
ft_lstclear(data.env, env_del);
|
||||||
ft_lstclear(cmds, ft_cmddel);
|
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);
|
return (1);
|
||||||
}
|
}
|
||||||
ft_lstclear(data.env, env_del);
|
ft_lstclear(data.env, env_del);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/02/14 13:45:30 by cchauvet #+# #+# */
|
/* Created: 2023/02/14 13:45:30 by cchauvet #+# #+# */
|
||||||
/* Updated: 2023/02/16 18:19:34 by cchauvet ### ########.fr */
|
/* Updated: 2023/02/17 13:06:21 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);
|
char **ft_split_quoted(const char *s, char c);
|
||||||
void ft_cmddel(void *content);
|
void ft_cmddel(void *content);
|
||||||
void env_del(void *content);
|
void env_del(void *content);
|
||||||
t_list **ft_parse_cmds(char *line, t_list **env);
|
t_list **ft_parse_cmds(char *line, t_list **env, int infile, int outfile);
|
||||||
int ft_cmd_filler(t_list *current, char **args, t_list **env);
|
int ft_cmd_filler(t_list *current, char **args, t_list **env);
|
||||||
char *ft_normalizer(char *str);
|
char *ft_normalizer(char *str);
|
||||||
char *ft_env_filler(t_list **env, const char *str);
|
char *ft_env_filler(t_list **env, const char *str);
|
||||||
|
BIN
syntatics.o
Normal file
BIN
syntatics.o
Normal file
Binary file not shown.
BIN
utils/ft_is_in_quote.o
Normal file
BIN
utils/ft_is_in_quote.o
Normal file
Binary file not shown.
BIN
utils/ft_quote_remover.o
Normal file
BIN
utils/ft_quote_remover.o
Normal file
Binary file not shown.
BIN
utils/ft_split_quoted.o
Normal file
BIN
utils/ft_split_quoted.o
Normal file
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