diff --git a/.clangd b/.clangd new file mode 100644 index 00000000..f5f407b8 --- /dev/null +++ b/.clangd @@ -0,0 +1,4 @@ +CompileFlags: # Tweak the parse settings + Add: + - "-I/usr/include" + diff --git a/Makefile b/shcat_c/Makefile similarity index 100% rename from Makefile rename to shcat_c/Makefile diff --git a/includes/minishell.h b/shcat_c/includes/minishell.h similarity index 94% rename from includes/minishell.h rename to shcat_c/includes/minishell.h index e35e2dd6..d2266a4f 100644 --- a/includes/minishell.h +++ b/shcat_c/includes/minishell.h @@ -6,7 +6,7 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/03/28 14:41:15 by rparodi #+# #+# */ -/* Updated: 2024/04/01 01:51:57 by rparodi ### ########.fr */ +/* Updated: 2024/04/13 17:05:26 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ @@ -39,7 +39,7 @@ typedef struct s_utils t_i32 main(t_i32 argc, t_str argv[], t_str arge[]); void ft_other_cmd(t_utils *shcat, t_usize i); t_i32 ft_strcmp(const char *s1, const char *s2); -t_i32 ft_check_type_operators(t_i8 **operators); +t_i32 ft_check_type_operators(t_str operators); t_str *ft_split(t_const_str s, t_i8 c); t_str ft_strdup(t_const_str s); void *ft_calloc(t_usize nmemb, t_usize size); diff --git a/includes/type_rust.h b/shcat_c/includes/type_rust.h similarity index 100% rename from includes/type_rust.h rename to shcat_c/includes/type_rust.h diff --git a/libft/ft_bzero.c b/shcat_c/libft/ft_bzero.c similarity index 100% rename from libft/ft_bzero.c rename to shcat_c/libft/ft_bzero.c diff --git a/libft/ft_calloc.c b/shcat_c/libft/ft_calloc.c similarity index 100% rename from libft/ft_calloc.c rename to shcat_c/libft/ft_calloc.c diff --git a/libft/ft_memset.c b/shcat_c/libft/ft_memset.c similarity index 100% rename from libft/ft_memset.c rename to shcat_c/libft/ft_memset.c diff --git a/libft/ft_split.c b/shcat_c/libft/ft_split.c similarity index 100% rename from libft/ft_split.c rename to shcat_c/libft/ft_split.c diff --git a/libft/ft_strcmp.c b/shcat_c/libft/ft_strcmp.c similarity index 100% rename from libft/ft_strcmp.c rename to shcat_c/libft/ft_strcmp.c diff --git a/libft/ft_strdup.c b/shcat_c/libft/ft_strdup.c similarity index 100% rename from libft/ft_strdup.c rename to shcat_c/libft/ft_strdup.c diff --git a/libft/ft_strlcpy.c b/shcat_c/libft/ft_strlcpy.c similarity index 100% rename from libft/ft_strlcpy.c rename to shcat_c/libft/ft_strlcpy.c diff --git a/libft/ft_strlen.c b/shcat_c/libft/ft_strlen.c similarity index 100% rename from libft/ft_strlen.c rename to shcat_c/libft/ft_strlen.c diff --git a/note_raph.txt b/shcat_c/note_raph.txt similarity index 100% rename from note_raph.txt rename to shcat_c/note_raph.txt diff --git a/sources/ft_cmd.c b/shcat_c/sources/ft_cmd.c similarity index 100% rename from sources/ft_cmd.c rename to shcat_c/sources/ft_cmd.c diff --git a/sources/ft_echo.c b/shcat_c/sources/ft_echo.c similarity index 100% rename from sources/ft_echo.c rename to shcat_c/sources/ft_echo.c diff --git a/sources/ft_exit.c b/shcat_c/sources/ft_exit.c similarity index 100% rename from sources/ft_exit.c rename to shcat_c/sources/ft_exit.c diff --git a/sources/ft_pwd.c b/shcat_c/sources/ft_pwd.c similarity index 100% rename from sources/ft_pwd.c rename to shcat_c/sources/ft_pwd.c diff --git a/sources/main.c b/shcat_c/sources/main.c similarity index 62% rename from sources/main.c rename to shcat_c/sources/main.c index 68957f4a..38b2f3fc 100644 --- a/sources/main.c +++ b/shcat_c/sources/main.c @@ -6,47 +6,40 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/03/28 14:40:38 by rparodi #+# #+# */ -/* Updated: 2024/04/01 18:17:41 by rparodi ### ########.fr */ +/* Updated: 2024/04/13 17:05:11 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ #include "../includes/minishell.h" -t_i32 ft_check_type_operators(t_str *operators) +t_i32 ft_check_type_operators(t_str operators) { - t_usize i; - - i = 0; - while (operators[i]) - { - if (ft_strcmp(operators[i], ">") == 0) - printf("Have to redirect in the file\n"); - else if (ft_strcmp(operators[i], ">>") == 0) - printf("Have to redirect at the end of the file after\n"); - else if (ft_strcmp(operators[i], ">&") == 0) - printf("Have to redirect the stdout in the file\n"); - else if (ft_strcmp(operators[i], "<") == 0) - printf("Have to redirect at the end of the file before\n"); - else if (ft_strcmp(operators[i], "<<") == 0) - printf("Have to redirect at the end of the file after\n"); - else if (ft_strcmp(operators[i], "<&") == 0) - printf("Have to redirect the stdout in the file\n"); - else if (ft_strcmp(operators[i], ";") == 0) - printf("Have to execute one more command\n"); - else if (ft_strcmp(operators[i], ";") == 0) - printf("Have to execute one more command\n"); - else if (ft_strcmp(operators[i], "|") == 0) - printf("I have to pipe a operators !\n"); - else if (ft_strcmp(operators[i], "||") == 0) - printf("Or something\n"); - else if (ft_strcmp(operators[i], "&&") == 0) - printf("Only if the first has exit status 0\n"); - else if (ft_strcmp(operators[i], "&") == 0) - printf("Parreil mais chelou\n"); - else - return (0); - i++; - } + if (ft_strcmp(operators, ">") == 0) + printf("Have to redirect in the file\n"); + else if (ft_strcmp(operators, ">>") == 0) + printf("Have to redirect at the end of the file after\n"); + else if (ft_strcmp(operators, ">&") == 0) + printf("Have to redirect the stdout in the file\n"); + else if (ft_strcmp(operators, "<") == 0) + printf("Have to redirect at the end of the file before\n"); + else if (ft_strcmp(operators, "<<") == 0) + printf("Have to redirect at the end of the file after\n"); + else if (ft_strcmp(operators, "<&") == 0) + printf("Have to redirect the stdout in the file\n"); + else if (ft_strcmp(operators, ";") == 0) + printf("Have to execute one more command\n"); + else if (ft_strcmp(operators, ";") == 0) + printf("Have to execute one more command\n"); + else if (ft_strcmp(operators, "|") == 0) + printf("I have to pipe a operators !\n"); + else if (ft_strcmp(operators, "||") == 0) + printf("Or something\n"); + else if (ft_strcmp(operators, "&&") == 0) + printf("Only if the first has exit status 0\n"); + else if (ft_strcmp(operators, "&") == 0) + printf("Parreil mais chelou\n"); + else + return (0); return (1); } @@ -57,7 +50,7 @@ void ft_check(t_utils *shcat, char **input) i = 0; while (input[i] != NULL) { - if (ft_check_type_operators(input) == 1) + if (ft_check_type_operators(input[i]) == 1) printf("Operateur\n"); else { @@ -65,7 +58,7 @@ void ft_check(t_utils *shcat, char **input) ft_exit(shcat, 0); else if (ft_strcmp(input[i], "pwd") == 0) ft_pwd(); - else if (ft_strcmp(input[i], "cmd") == 0) + else if (ft_strcmp(input[i], "echo") == 0) ft_echo("ECHO MAIS PAS ARG BORDEL !\n", "flag"); else ft_other_cmd(shcat, i); diff --git a/valgrind_readline_leaks_ignore.txt b/shcat_c/valgrind_readline_leaks_ignore.txt similarity index 100% rename from valgrind_readline_leaks_ignore.txt rename to shcat_c/valgrind_readline_leaks_ignore.txt