diff options
Diffstat (limited to 'src/s_com.c')
-rw-r--r-- | src/s_com.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/s_com.c b/src/s_com.c index 28b460f..ebf7b87 100644 --- a/src/s_com.c +++ b/src/s_com.c @@ -19,14 +19,15 @@ #include "p_args.h" #include "p_lblock.h" #include "p_lblock_next.h" +>>>>>>> master #include "s_struct.h" static int8_t s_fill_com(char *words[], t_com **com) { - /* TODO: norme */ - uint64_t i; - uint64_t j; + /* TODO: norme is bav (for now)*/ + int64_t i; + int64_t j; i = 0; if (words[0] != NULL) @@ -38,23 +39,19 @@ static int8_t } else return (0); - while(words[i]) + while(words[++i]) { /* TODO: cut fd number "msh ~> echo a 2>file" */ /* ^ */ if (ft_ischarset("<>", words[i][0]) == TRUE) break ; - i++; } if (!((*com)->argv = (char**)malloc((i + 1) * sizeof(char*)))) return (-1); - j = 0; - while (i > 0 && j < i) - { + j = -1; + while (++j < i) if (!((*com)->argv[j] = ft_strdup(words[j]))) return (-1); - j++; - } (*com)->argv[j] = 0; return (0); } |