diff --git a/debug.c b/debug.c index eeb68a1..90731f8 100644 --- a/debug.c +++ b/debug.c @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* debug.c :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: tomoron +#+ +:+ +#+ */ +/* By: marde-vr +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/15 14:16:47 by tomoron #+# #+# */ -/* Updated: 2024/02/15 14:45:29 by tomoron ### ########.fr */ +/* Updated: 2024/02/16 15:08:40 by marde-vr ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,16 +14,16 @@ void print_parsed_cmd(t_cmd *cmd) { - while(cmd) + while (cmd) { printf("["); - if(cmd->type == ARG) - printf("ARG : %s",cmd->token); - else if(cmd->type == PIPE) + if (cmd->type == ARG) + printf("ARG : %s", cmd->token); + else if (cmd->type == PIPE) printf("PIPE"); - else if(cmd->type == OR) + else if (cmd->type == OR) printf("OR"); - else if(cmd->type == AND) + else if (cmd->type == AND) printf("AND"); printf("] "); cmd = cmd->next; diff --git a/env_to_char_tab.c b/env_to_char_tab.c index 846355d..5d043d6 100644 --- a/env_to_char_tab.c +++ b/env_to_char_tab.c @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* env_to_char_tab.c :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: tomoron +#+ +:+ +#+ */ +/* By: marde-vr +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/16 13:30:18 by tomoron #+# #+# */ -/* Updated: 2024/02/16 14:31:07 by tomoron ### ########.fr */ +/* Updated: 2024/02/16 15:08:53 by marde-vr ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,32 +14,32 @@ int get_env_len(t_env *env) { - int res; + int res; res = 0; - while(env) + while (env) { res++; env = env->next; } - return(res); + return (res); } -char **env_to_char_tab(t_env *env) +char **env_to_char_tab(t_env *env) { - char **res; - int i; - char *tmp; + char **res; + int i; + char *tmp; res = ft_calloc(get_env_len(env) + 1, sizeof(char *)); i = 0; - while(res && env) + while (res && env) { - tmp = ft_strjoin(env->name, "="); + tmp = ft_strjoin(env->name, "="); tmp = ft_strjoin_free(tmp, env->value, 1); res[i] = tmp; i++; env = env->next; } - return(res); + return (res); } diff --git a/exec.c b/exec.c index 80cac38..23fed98 100755 --- a/exec.c +++ b/exec.c @@ -6,7 +6,7 @@ /* By: marde-vr +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/07 14:12:49 by tomoron #+# #+# */ -/* Updated: 2024/02/16 14:41:43 by marde-vr ### ########.fr */ +/* Updated: 2024/02/16 15:10:43 by marde-vr ### ########.fr */ /* */ /* ************************************************************************** */ @@ -112,7 +112,7 @@ void get_cmd_path(t_cmd *cmd, t_env *env) int found; found = 0; - if (access(cmd->token, X_OK != -1)) + if (access(cmd->token, X_OK) != -1) found = 1; else { diff --git a/libft/ft_strisnbr.c b/libft/ft_strisnbr.c index efb54ef..8dddb93 100755 --- a/libft/ft_strisnbr.c +++ b/libft/ft_strisnbr.c @@ -3,22 +3,22 @@ /* ::: :::::::: */ /* ft_strisnbr.c :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: tomoron +#+ +:+ +#+ */ +/* By: marde-vr +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/11 17:14:58 by tomoron #+# #+# */ -/* Updated: 2024/02/12 03:21:56 by tomoron ### ########.fr */ +/* Updated: 2024/02/16 15:07:30 by marde-vr ### ########.fr */ /* */ /* ************************************************************************** */ int ft_strisnbr(char *str) { - if(!str) - return(0); - while(*str) + if (!str) + return (0); + while (*str) { - if(*str < '0' || *str > '9') - return(0); + if (*str < '0' || *str > '9') + return (0); str++; } - return(1); + return (1); } diff --git a/parsing.c b/parsing.c index 859c618..0c310bc 100755 --- a/parsing.c +++ b/parsing.c @@ -6,14 +6,14 @@ /* By: marde-vr +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/09 15:26:01 by tomoron #+# #+# */ -/* Updated: 2024/02/16 14:52:11 by tomoron ### ########.fr */ +/* Updated: 2024/02/16 15:09:25 by marde-vr ### ########.fr */ /* */ /* ************************************************************************** */ #include "minishell.h" int is_cmd_char(char c) { - return(!ft_isspace(c) && c != '|' && c != '&' && c != '<' && c != '>'); + return (!ft_isspace(c) && c != '|' && c != '&' && c != '<' && c != '>'); } char *get_token(char **cmd, int *in_quote, int *in_dquote, t_env *env) @@ -37,7 +37,7 @@ char *get_token(char **cmd, int *in_quote, int *in_dquote, t_env *env) i += add_var_to_str(res + i, cmd, env); } else if (((**cmd == '\'' && *in_dquote) || (**cmd == '"' && *in_quote)) - || (**cmd != '\'' && **cmd != '"')) + || (**cmd != '\'' && **cmd != '"')) res[i++] = **cmd; (*cmd)++; } @@ -46,27 +46,27 @@ char *get_token(char **cmd, int *in_quote, int *in_dquote, t_env *env) t_token_type get_token_type(char **command) { - t_token_type res; + t_token_type res; while (ft_isspace(**command)) (*command)++; - if((*command)[0] == '|' && (*command)[1] == '|') + if ((*command)[0] == '|' && (*command)[1] == '|') res = OR; - else if((*command)[0] == '&' && (*command)[1] == '&') + else if ((*command)[0] == '&' && (*command)[1] == '&') res = AND; else if ((*command)[0] == '>' && (*command)[1] == '>') res = RED_O_APP; - else if((*command)[0] == '<' && (*command)[1] == '<') + else if ((*command)[0] == '<' && (*command)[1] == '<') res = HERE_DOC; - else if((*command)[0] == '>') + else if ((*command)[0] == '>') res = RED_O; - else if((*command)[0] == '<') + else if ((*command)[0] == '<') res = RED_I; - else if((*command)[0] == '|') + else if ((*command)[0] == '|') res = PIPE; else res = ARG; - if(res == OR || res == AND || res == RED_O_APP || res == HERE_DOC) + if (res == OR || res == AND || res == RED_O_APP || res == HERE_DOC) (*command) += 2; if (res == RED_O || res == RED_I || res == PIPE) (*command)++;