void cmd_show_list (struct cmd_list_element *list, int from_tty, const char *prefix) { struct cleanup *showlist_chain; struct ui_out *uiout = current_uiout; showlist_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "showlist"); for (; list != NULL; list = list->next) { /* If we find a prefix, run its list, prefixing our output by its prefix (with "show " skipped). */ if (list->prefixlist && !list->abbrev_flag) { struct cleanup *optionlist_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "optionlist"); char *new_prefix = strstr (list->prefixname, "show ") + 5; if (ui_out_is_mi_like_p (uiout)) ui_out_field_string (uiout, "prefix", new_prefix); cmd_show_list (*list->prefixlist, from_tty, new_prefix); /* Close the tuple. */ do_cleanups (optionlist_chain); } else { if (list->theclass != no_set_class) { struct cleanup *option_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "option"); ui_out_text (uiout, prefix); ui_out_field_string (uiout, "name", list->name); ui_out_text (uiout, ": "); if (list->type == show_cmd) do_show_command ((char *) NULL, from_tty, list); else cmd_func (list, NULL, from_tty); /* Close the tuple. */ do_cleanups (option_chain); } } } /* Close the tuple. */ do_cleanups (showlist_chain); }
void cmd_show_list (struct cmd_list_element *list, int from_tty, char *prefix) { for (; list != NULL; list = list->next) { /* If we find a prefix, run its list, prefixing our output by its prefix (with "show " skipped). */ if (list->prefixlist && !list->abbrev_flag) { char *new_prefix = strstr (list->prefixname, "show ") + 5; cmd_show_list (*list->prefixlist, from_tty, new_prefix); } else { g_print ("%s%s:", prefix, list->name); if (list->type == show_cmd) do_setshow_command ((char *) NULL, from_tty, list); else bosh_command_call (list, NULL, from_tty); } } }
static void show_command (char *arg, int from_tty) { cmd_show_list (showlist, from_tty, ""); }
static void serial_show_cmd (char *args, int from_tty) { cmd_show_list (serial_show_cmdlist, from_tty, ""); }
static void show_check (char *ignore, int from_tty) { cmd_show_list (showchecklist, from_tty, ""); }
static void show_guile_command (char *args, int from_tty) { cmd_show_list (show_guile_list, from_tty, ""); }
static void show_style (const char *arg, int from_tty) { cmd_show_list (style_show_list, from_tty, ""); }
static void show_dcache_command (char *args, int from_tty) { cmd_show_list (dcache_show_list, from_tty, ""); }