diff options
author | kraxel <kraxel> | 2008-09-19 20:50:05 +0000 |
---|---|---|
committer | kraxel <kraxel> | 2008-09-19 20:50:05 +0000 |
commit | a3aa4e1df1e9f67ef8a0944d79666fc307416c00 (patch) | |
tree | 5a37182e14202b860ab460f95a25db92909cf729 | |
parent | fbeef6611a8714c960db65cb2702abb9c4e628d7 (diff) | |
download | qemu-gtk-a3aa4e1df1e9f67ef8a0944d79666fc307416c00.tar.gz |
- monitor fixes.
-rw-r--r-- | VERSION | 2 | ||||
-rw-r--r-- | monitor.c | 23 | ||||
-rw-r--r-- | qemu-gtk.c | 3 | ||||
-rw-r--r-- | qemu-gtk.h | 1 |
4 files changed, 20 insertions, 9 deletions
@@ -1 +1 @@ -0.1 +0.2 @@ -21,24 +21,30 @@ static int monitor_parse(struct qemu_window *win, char *buf, int len) int off; prompt = strstr(buf, "(qemu) "); - if (NULL == prompt) + if (NULL == prompt) { return 0; + } off = prompt - buf; if (prompt > buf+1 && prompt[-2] == '\r' && prompt[-1] == '\n') prompt -= 2; *prompt = 0; - if (!win->mrun) + if (!win->mrun) { + if (debug) + fprintf(stderr, "%s: no cmd in flight\n", __FUNCTION__); goto out; + } cmd = win->mrun->cmd; reply = strstr(buf, "\r\n"); - if (!reply) + if (!reply) { + if (debug) + fprintf(stderr, "%s: no reply for \"%s\"\n", __FUNCTION__, cmd); goto out; + } reply += 2; -#if 0 - fprintf(stderr, "\"%s\" -> [%s]\n--\n", cmd, reply); -#endif + if (debug) + fprintf(stderr, "%s: \"%s\" -> [%s]\n", __FUNCTION__, cmd, reply); if (0 == strcmp(cmd, "info version")) { snprintf(win->version, sizeof(win->version), "%s", reply); update_status(win); @@ -76,6 +82,7 @@ static void monitor_next(struct qemu_window *win) void monitor_append(struct qemu_window *win, char *cmd) { struct qemu_mq *mq; + int try_send = 0; if (win->mqueue) { for (mq = win->mqueue; mq->next; mq = mq->next) @@ -85,11 +92,13 @@ void monitor_append(struct qemu_window *win, char *cmd) } else { win->mqueue = malloc(sizeof(*mq)); mq = win->mqueue; + if (!win->mused && win->msize) + try_send = 1; } mq->next = NULL; snprintf(mq->cmd, sizeof(mq->cmd), "%s", cmd); - if (0 == win->mused) + if (try_send) monitor_next(win); } @@ -452,6 +452,8 @@ void qemu_conn_tab(struct qemu_window *win, struct qemu_conn *conn, int pos) /* ------------------------------------------------------------------ */ +int debug = 0; + static void usage(FILE *fp) { fprintf(fp, @@ -474,7 +476,6 @@ main(int argc, char *argv[]) struct qemu_window *win; char *console_tab = NULL; int monitor_tab = 0; - int debug = 0; int c; gtk_init(&argc, &argv); @@ -57,6 +57,7 @@ struct qemu_window { }; /* qemu-gtk.c */ +extern int debug; void update_status(struct qemu_window *win); void vnc_connect(struct qemu_window *win); int conn_init(struct qemu_conn *conn, char *name, char *dest); |