version 1.42, 2017/05/10 13:05:41 |
version 1.43, 2019/03/18 11:58:40 |
|
|
cmd_show_options_print(struct cmd *self, struct cmdq_item *item, |
cmd_show_options_print(struct cmd *self, struct cmdq_item *item, |
struct options_entry *o, int idx) |
struct options_entry *o, int idx) |
{ |
{ |
const char *name; |
struct options_array_item *a; |
const char *value; |
const char *name, *value; |
char *tmp, *escaped; |
char *tmp, *escaped; |
u_int size, i; |
|
|
|
if (idx != -1) { |
if (idx != -1) { |
xasprintf(&tmp, "%s[%d]", options_name(o), idx); |
xasprintf(&tmp, "%s[%d]", options_name(o), idx); |
name = tmp; |
name = tmp; |
} else { |
} else { |
if (options_array_size(o, &size) != -1) { |
if (options_isarray(o)) { |
for (i = 0; i < size; i++) { |
a = options_array_first(o); |
if (options_array_get(o, i) == NULL) |
while (a != NULL) { |
continue; |
idx = options_array_item_index(a); |
cmd_show_options_print(self, item, o, i); |
cmd_show_options_print(self, item, o, idx); |
|
a = options_array_next(a); |
} |
} |
return; |
return; |
} |
} |
|
|
cmd_show_options_all(struct cmd *self, struct cmdq_item *item, |
cmd_show_options_all(struct cmd *self, struct cmdq_item *item, |
struct options *oo) |
struct options *oo) |
{ |
{ |
struct options_entry *o; |
struct options_entry *o; |
const struct options_table_entry *oe; |
const struct options_table_entry *oe; |
u_int size, idx; |
struct options_array_item *a; |
|
u_int idx; |
|
|
o = options_first(oo); |
o = options_first(oo); |
while (o != NULL) { |
while (o != NULL) { |
|
|
o = options_next(o); |
o = options_next(o); |
continue; |
continue; |
} |
} |
if (options_array_size(o, &size) == -1) |
if (!options_isarray(o)) |
cmd_show_options_print(self, item, o, -1); |
cmd_show_options_print(self, item, o, -1); |
else { |
else { |
for (idx = 0; idx < size; idx++) { |
a = options_array_first(o); |
if (options_array_get(o, idx) == NULL) |
while (a != NULL) { |
continue; |
idx = options_array_item_index(a); |
cmd_show_options_print(self, item, o, idx); |
cmd_show_options_print(self, item, o, idx); |
|
a = options_array_next(a); |
} |
} |
} |
} |
o = options_next(o); |
o = options_next(o); |