cmd: fix arglist iterator not finding all relevant opts/args in certain cases
This commit is contained in:
@@ -5,9 +5,9 @@
|
||||
#include <blue/term/print.h>
|
||||
#include <blue/term/tty.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
B_BTREE_DEFINE_SIMPLE_INSERT(
|
||||
struct b_arglist_option, opt_node, opt_id, put_arglist_option)
|
||||
@@ -859,14 +859,15 @@ int b_arglist_iterator_begin(
|
||||
}
|
||||
|
||||
b_btree_iterator_begin(&opt->opt_values, &it->_arg_it);
|
||||
bool done = false;
|
||||
|
||||
while (1) {
|
||||
if (!b_btree_iterator_is_valid(&it->_arg_it)) {
|
||||
if (arg_filter == B_COMMAND_INVALID_ID) {
|
||||
break;
|
||||
done = true;
|
||||
}
|
||||
|
||||
val = NULL;
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
|
||||
val = b_unbox(
|
||||
@@ -878,10 +879,15 @@ int b_arglist_iterator_begin(
|
||||
continue;
|
||||
}
|
||||
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
if (done) {
|
||||
break;
|
||||
}
|
||||
|
||||
b_btree_iterator_next(&it->_opt_it);
|
||||
}
|
||||
|
||||
it->opt_id = opt->opt_id;
|
||||
|
||||
Reference in New Issue
Block a user