diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-08-25 23:33:27 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-08-25 23:33:27 +0200 |
commit | c8a5f03103ac70d6525cab05ac85312099336989 (patch) | |
tree | ae3db612f17f6959e1a496e22259b88439066ff2 /src | |
parent | In progress (diff) | |
download | 42-minishell-c8a5f03103ac70d6525cab05ac85312099336989.tar.gz 42-minishell-c8a5f03103ac70d6525cab05ac85312099336989.tar.bz2 42-minishell-c8a5f03103ac70d6525cab05ac85312099336989.tar.xz 42-minishell-c8a5f03103ac70d6525cab05ac85312099336989.tar.zst 42-minishell-c8a5f03103ac70d6525cab05ac85312099336989.zip |
qweqwe
Diffstat (limited to '')
-rw-r--r-- | src/b_sqb.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/b_sqb.c b/src/b_sqb.c index 91bf7b6..28e0fa6 100644 --- a/src/b_sqb.c +++ b/src/b_sqb.c @@ -25,26 +25,24 @@ static void } static uint8_t - b_get_sqb_id(uint64_t argc, - char *argv[], + b_get_sqb_id(char *argv[], t_msh *msh) { - size_t j; uint8_t i; i = 0; while (i < FT_ID_SQB_COUNT) { - j = 0; - while (j < argc) - { - if ( - ft_strncmp(argv[j], + if (i < FT_ID_SQB_NT && + ft_strncmp(argv[0], msh->sqb_ref[i], ft_strlen(msh->sqb_ref[i]) + 1) == 0) - return (i); - j++; - } + return (i); + if (i >= FT_ID_SQB_NT && + ft_strncmp(argv[1], + msh->sqb_ref[i], + ft_strlen(msh->sqb_ref[i]) + 1) == 0) + return (i); i++; } return (i); @@ -57,13 +55,13 @@ static uint8_t { uint8_t id; - id = b_get_sqb_id(argc, argv, msh); + (void)argc; + id = b_get_sqb_id(argv, msh); if (id == FT_ID_SQB_COUNT) { b_sqb_unexpected_operator(argv[0]); return (2); } - ft_printf("[%s]\n", msh->sqb_ref[id]); return (0); } |