summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-10-03 15:58:16 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-10-03 15:58:16 +0200
commit953ff509aae1e3b37f75a123a36da95e0bed2277 (patch)
tree2d517f01dfd72a91cf358f00034b600ff84fbdd9 /src
parentNormed p_split (diff)
download42-minishell-953ff509aae1e3b37f75a123a36da95e0bed2277.tar.gz
42-minishell-953ff509aae1e3b37f75a123a36da95e0bed2277.tar.bz2
42-minishell-953ff509aae1e3b37f75a123a36da95e0bed2277.tar.xz
42-minishell-953ff509aae1e3b37f75a123a36da95e0bed2277.tar.zst
42-minishell-953ff509aae1e3b37f75a123a36da95e0bed2277.zip
Update
Diffstat (limited to 'src')
-rw-r--r--src/s_com.c25
-rw-r--r--src/s_com.h6
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);