diff options
Diffstat (limited to '')
-rw-r--r-- | src/ft_m_argv.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/ft_m_argv.c b/src/ft_m_argv.c index a4da580..389fbe7 100644 --- a/src/ft_m_argv.c +++ b/src/ft_m_argv.c @@ -14,6 +14,7 @@ #include <stdint.h> #include "ft_d_define.h" +#include "ft_m_comm.h" #include "ft_m_loop.h" #include "ft_s_struct.h" @@ -22,19 +23,21 @@ uint8_t const char *argv[], t_msh *msh) { - int32_t i; - - (void)argv; + /* TODO: better argv handling */ if (argc == 1) { msh->ret = ft_m_loop(msh); return (msh->ret); } - i = 1; - while (i < argc) + if (!ft_strncmp(*(argv + 1), FT_OPT_COMMAND, 3)) { - /* if (ft_strncmp(*(argv + i), )) */ - i++; + if (*(argv + 2) == NULL) + { + ft_dprintf(2, "%s: %s: option requires an argument", + msh->shname, FT_OPT_COMMAND); + return (2); + } + msh->ret = ft_m_comm(*(argv + 2), msh); } return (msh->ret); } |