- for (i = 0; i < argpar_parse_ret.items->n_items; i++) {
- const struct argpar_item *item =
- argpar_parse_ret.items->items[i];
+ while (true) {
+ enum parse_next_item_status status;
+
+ status = parse_next_item(argpar_iter, &argpar_item, argv,
+ true, NULL);
+ if (status == PARSE_NEXT_ITEM_STATUS_ERROR) {
+ goto error;
+ } else if (status == PARSE_NEXT_ITEM_STATUS_END) {
+ break;
+ }
+
+ assert(status == PARSE_NEXT_ITEM_STATUS_OK);