Merge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging

* remotes/qmp-unstable/queue/qmp:
  json-parser: drop superfluous assignment for token variable
  readline: Clear screen on form feed.
  monitor: Add delvm and loadvm argument completion
  monitor: Add host_net_remove arguments completion
  readline: Make completion strings always unique
  monitor: Add host_net_add device argument completion
  net: Export valid host network devices list
  monitor: Add migrate_set_capability completion
  monitor: Add watchdog_action argument completion
  monitor: Add ringbuf_write and ringbuf_read argument completion
  dump: simplify get_len_buf_out()
  dump: hoist lzo_init() from get_len_buf_out() to dump_init()
  dump: select header bitness based on ELF class, not ELF architecture
  dump: eliminate DumpState.page_size ("guest's page size")
  dump: eliminate DumpState.page_shift ("guest's page shift")
  dump: simplify write_start_flat_header()
  dump: fill in the flat header signature more pleasingly to the eye

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2014-06-11 21:34:08 +01:00
commit 05fedeef83
11 changed files with 300 additions and 115 deletions

View file

@ -263,6 +263,12 @@ static void readline_hist_add(ReadLineState *rs, const char *cmdline)
void readline_add_completion(ReadLineState *rs, const char *str)
{
if (rs->nb_completions < READLINE_MAX_COMPLETIONS) {
int i;
for (i = 0; i < rs->nb_completions; i++) {
if (!strcmp(rs->completions[i], str)) {
return;
}
}
rs->completions[rs->nb_completions++] = g_strdup(str);
}
}
@ -345,6 +351,12 @@ static void readline_completion(ReadLineState *rs)
}
}
static void readline_clear_screen(ReadLineState *rs)
{
rs->printf_func(rs->opaque, "\033[2J\033[1;1H");
readline_show_prompt(rs);
}
/* return true if command handled */
void readline_handle_byte(ReadLineState *rs, int ch)
{
@ -363,6 +375,9 @@ void readline_handle_byte(ReadLineState *rs, int ch)
case 9:
readline_completion(rs);
break;
case 12:
readline_clear_screen(rs);
break;
case 10:
case 13:
rs->cmd_buf[rs->cmd_buf_size] = '\0';