diff options
-rw-r--r-- | src/s_com.c | 25 | ||||
-rw-r--r-- | src/s_com.h | 6 |
2 files changed, 12 insertions, 19 deletions
diff --git a/src/s_com.c b/src/s_com.c index d304675..baa6401 100644 --- a/src/s_com.c +++ b/src/s_com.c @@ -30,21 +30,17 @@ ** TODO: norme */ -static int8_t - s_fill_com(char *words[], t_com **com) +static int8_t s_fill_com(char *words[], t_com **com) { uint64_t i; uint64_t j; - if (words[0] != NULL) - { - if (((*com)->bin = (char*)malloc((ft_strlen(words[0]) + 1) * - sizeof(char))) == NULL) - return (-1); - ft_strlcpy((*com)->bin, words[0], ft_strlen(words[0]) + 1); - } - else + if (words[0] == NULL) return (0); + if (((*com)->bin = (char*)malloc((ft_strlen(words[0]) + 1) + * sizeof(char))) == NULL) + return (-1); + ft_strlcpy((*com)->bin, words[0], ft_strlen(words[0]) + 1); i = 0; while (words[i] != NULL) i++; @@ -61,8 +57,7 @@ static int8_t return (0); } -static void - s_com_cpy_env_fork(t_com **com, t_msh *msh) +static void s_com_cpy_env_fork(t_com **com, t_msh *msh) { size_t i; size_t j; @@ -82,8 +77,7 @@ static void (*com)->env_fork[j] = NULL; } -void - s_com_destroy(t_com **com) +void s_com_destroy(t_com **com) { t_com *ptr; @@ -99,8 +93,7 @@ void } -t_com - *s_com_new(char word[], t_msh *msh) +t_com *s_com_new(char word[], t_msh *msh) { char nword[ARG_MAX]; t_com *com; diff --git a/src/s_com.h b/src/s_com.h index aad61e2..80c03e1 100644 --- a/src/s_com.h +++ b/src/s_com.h @@ -10,10 +10,10 @@ /* */ /* ************************************************************************** */ -#ifndef S_COM_H -#define S_COM_H +#ifndef FT_S_COM_H +# define FT_S_COM_H -#include "s_struct.h" +# include "s_struct.h" void s_com_destroy(t_com **com); t_com *s_com_new(const char word[], t_msh *msh); |