summary refs log tree commit diff stats
path: root/monitor/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'monitor/misc.c')
-rw-r--r--monitor/misc.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/monitor/misc.c b/monitor/misc.c
index 1539e18557..ad476c6e51 100644
--- a/monitor/misc.c
+++ b/monitor/misc.c
@@ -1974,6 +1974,22 @@ static void sortcmdlist(void)
           compare_mon_cmd);
 }
 
+void monitor_register_hmp(const char *name, bool info,
+                          void (*cmd)(Monitor *mon, const QDict *qdict))
+{
+    HMPCommand *table = info ? hmp_info_cmds : hmp_cmds;
+
+    while (table->name != NULL) {
+        if (strcmp(table->name, name) == 0) {
+            g_assert(table->cmd == NULL);
+            table->cmd = cmd;
+            return;
+        }
+        table++;
+    }
+    g_assert_not_reached();
+}
+
 void monitor_init_globals(void)
 {
     monitor_init_globals_core();