diff options
author | Thomas Adam <thomas@xteddy.org> | 2019-03-18 15:07:51 +0000 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2019-03-18 15:07:51 +0000 |
commit | acb2413852b98745b69459d0cdd0d9698cb75e2c (patch) | |
tree | 6af803240715b8a6bccc328d5eda14f237e44944 /cmd-show-options.c | |
parent | aa2b3472c515dd1e5f57618e17c0c612cfa3c117 (diff) | |
parent | ce6be7afd4d10b542f9cce8634d6bdd81754f775 (diff) | |
download | rtmux-acb2413852b98745b69459d0cdd0d9698cb75e2c.tar.gz rtmux-acb2413852b98745b69459d0cdd0d9698cb75e2c.tar.bz2 rtmux-acb2413852b98745b69459d0cdd0d9698cb75e2c.zip |
Merge branch 'obsd-master'
Diffstat (limited to 'cmd-show-options.c')
-rw-r--r-- | cmd-show-options.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/cmd-show-options.c b/cmd-show-options.c index 2dc3dee3..2948f9ff 100644 --- a/cmd-show-options.c +++ b/cmd-show-options.c @@ -88,20 +88,20 @@ static void cmd_show_options_print(struct cmd *self, struct cmdq_item *item, struct options_entry *o, int idx) { - const char *name; - const char *value; - char *tmp, *escaped; - u_int size, i; + struct options_array_item *a; + const char *name, *value; + char *tmp, *escaped; if (idx != -1) { xasprintf(&tmp, "%s[%d]", options_name(o), idx); name = tmp; } else { - if (options_array_size(o, &size) != -1) { - for (i = 0; i < size; i++) { - if (options_array_get(o, i) == NULL) - continue; - cmd_show_options_print(self, item, o, i); + if (options_isarray(o)) { + a = options_array_first(o); + while (a != NULL) { + idx = options_array_item_index(a); + cmd_show_options_print(self, item, o, idx); + a = options_array_next(a); } return; } @@ -164,9 +164,10 @@ static enum cmd_retval cmd_show_options_all(struct cmd *self, struct cmdq_item *item, struct options *oo) { - struct options_entry *o; + struct options_entry *o; const struct options_table_entry *oe; - u_int size, idx; + struct options_array_item *a; + u_int idx; o = options_first(oo); while (o != NULL) { @@ -175,13 +176,14 @@ cmd_show_options_all(struct cmd *self, struct cmdq_item *item, o = options_next(o); continue; } - if (options_array_size(o, &size) == -1) + if (!options_isarray(o)) cmd_show_options_print(self, item, o, -1); else { - for (idx = 0; idx < size; idx++) { - if (options_array_get(o, idx) == NULL) - continue; + a = options_array_first(o); + while (a != NULL) { + idx = options_array_item_index(a); cmd_show_options_print(self, item, o, idx); + a = options_array_next(a); } } o = options_next(o); |