aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkraxel <kraxel>2008-09-19 20:50:05 +0000
committerkraxel <kraxel>2008-09-19 20:50:05 +0000
commita3aa4e1df1e9f67ef8a0944d79666fc307416c00 (patch)
tree5a37182e14202b860ab460f95a25db92909cf729
parentfbeef6611a8714c960db65cb2702abb9c4e628d7 (diff)
downloadqemu-gtk-a3aa4e1df1e9f67ef8a0944d79666fc307416c00.tar.gz
- monitor fixes.
-rw-r--r--VERSION2
-rw-r--r--monitor.c23
-rw-r--r--qemu-gtk.c3
-rw-r--r--qemu-gtk.h1
4 files changed, 20 insertions, 9 deletions
diff --git a/VERSION b/VERSION
index 49d5957..3b04cfb 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.1
+0.2
diff --git a/monitor.c b/monitor.c
index f8bd9ff..3a4c20a 100644
--- a/monitor.c
+++ b/monitor.c
@@ -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);
}
diff --git a/qemu-gtk.c b/qemu-gtk.c
index 164e1c7..e9ae9c0 100644
--- a/qemu-gtk.c
+++ b/qemu-gtk.c
@@ -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);
diff --git a/qemu-gtk.h b/qemu-gtk.h
index 1db432b..aca2565 100644
--- a/qemu-gtk.h
+++ b/qemu-gtk.h
@@ -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);