aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Bellows <greg.bellows@linaro.org>2014-11-20 09:32:14 -0600
committerAlex Bennée <alex.bennee@linaro.org>2015-01-07 11:36:06 +0000
commit5850feb4b98add1d53a2fa01fa59d71f47fe7867 (patch)
tree320b3f0261e8a9403996476c3b7025912eb5780f
parente5b922e29d308f2a4fee9b29e3f59714a53a83b0 (diff)
downloadqemu-android-5850feb4b98add1d53a2fa01fa59d71f47fe7867.tar.gz
android-console: Fix android_console_help call order
Fixes the order and hierarchy of handler calling so that commands with sub-tables take priority over parent only commands. This allows nesting of commands with sub-tables to be called properly. Signed-off-by: Greg Bellows <greg.bellows@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> [AJB: minor fix due to sub_cmd changes] Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
-rw-r--r--monitor.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/monitor.c b/monitor.c
index a53c050e9c..0ce43752be 100644
--- a/monitor.c
+++ b/monitor.c
@@ -965,15 +965,15 @@ static void android_console_help(Monitor *mon, const QDict *qdict)
sub_cmds = get_command_table(mon, cmd->sub_cmds);
if (thisarg >= nb_args || !sub_cmds) {
- /* For subtables, the command handler for the entry in the 1st
- * level of commands deals with help (including "help subcommand"
- * where there is no following second level command in the help
- * string). For top level commands, we just print the short text.
+ /* Last in line commands with sub-tables will deal with their own
+ * help messages. Otherwise, the parent handles the next lower
+ * level sub-command. Top level commands (no sub-commands) are
+ * dealt with here.
*/
- if (parent_cmd) {
- parent_cmd->mhandler.cmd(mon, qdict);
- } else if (sub_cmds) {
+ if (sub_cmds) {
cmd->mhandler.cmd(mon, qdict);
+ } else if (parent_cmd) {
+ parent_cmd->mhandler.cmd(mon, qdict);
} else {
monitor_printf(mon, "%s\nOK\n", cmd->help);
}