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/print.h>
|
||||||
#include <blue/term/tty.h>
|
#include <blue/term/tty.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
B_BTREE_DEFINE_SIMPLE_INSERT(
|
B_BTREE_DEFINE_SIMPLE_INSERT(
|
||||||
struct b_arglist_option, opt_node, opt_id, put_arglist_option)
|
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);
|
b_btree_iterator_begin(&opt->opt_values, &it->_arg_it);
|
||||||
|
bool done = false;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if (!b_btree_iterator_is_valid(&it->_arg_it)) {
|
if (!b_btree_iterator_is_valid(&it->_arg_it)) {
|
||||||
if (arg_filter == B_COMMAND_INVALID_ID) {
|
if (arg_filter == B_COMMAND_INVALID_ID) {
|
||||||
break;
|
done = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
val = NULL;
|
break;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val = b_unbox(
|
val = b_unbox(
|
||||||
@@ -878,10 +879,15 @@ int b_arglist_iterator_begin(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
done = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
if (done) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
b_btree_iterator_next(&it->_opt_it);
|
||||||
}
|
}
|
||||||
|
|
||||||
it->opt_id = opt->opt_id;
|
it->opt_id = opt->opt_id;
|
||||||
|
|||||||
Reference in New Issue
Block a user