aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkraxel <kraxel>2009-03-17 15:43:30 +0000
committerkraxel <kraxel>2009-03-17 15:43:30 +0000
commit58c2f65fe5725b88d60ebb59f888959da59f16e6 (patch)
tree9e2f69ca07bc990d28eb98a8f9d3a0e4219829ce
parentb8e450c041409fd6881c7938d525a9be78d95356 (diff)
downloadqemu-gtk-58c2f65fe5725b88d60ebb59f888959da59f16e6.tar.gz
misc qemu-run tweaks
-rw-r--r--VERSION2
-rw-r--r--monitor.c7
-rwxr-xr-xqemu-run20
3 files changed, 20 insertions, 9 deletions
diff --git a/VERSION b/VERSION
index eb49d7c..68c123c 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.7
+0.10
diff --git a/monitor.c b/monitor.c
index b626593..ab63f22 100644
--- a/monitor.c
+++ b/monitor.c
@@ -241,8 +241,15 @@ close:
int monitor_connect(struct qemu_window *win, char *dest)
{
+ char buf[256];
int fd;
+ if (!strchr(dest,':') && !strchr(dest,'/')) {
+ /* just a name */
+ snprintf(buf, sizeof(buf), "unix:%s/.qemu-gtk/%s", getenv("HOME"), dest);
+ dest = buf;
+ }
+
fd = conn_init(&win->monitor, "monitor", dest);
if (-1 == fd)
return -1;
diff --git a/qemu-run b/qemu-run
index 95634a2..e07cfa6 100755
--- a/qemu-run
+++ b/qemu-run
@@ -2,16 +2,19 @@
use warnings;
use strict;
use XML::Parser;
+use Getopt::Std;
# args
-my $name = shift;
+my %opts;
+getopts('dm', \%opts);
+my $name = shift;
+my $debug = defined($opts{'d'}) ? 1 : 0;
+my $showmon = defined($opts{'m'}) ? 1 : 0;
# config
-my $debug = 1;
-my $showmon = 1;
my $tapup = "/etc/qemu-virbr0-ifup";
my $tapdown = "/etc/qemu-virbr0-ifdown";
-my $mondir = $ENV{HOME} . "/.qemu-run";
+my $mondir = $ENV{HOME} . "/.qemu-gtk";
my $monitor = $mondir . "/" . $name . ",server,nowait";
# vars
@@ -253,9 +256,6 @@ if ($graphics) {
print "-- \n" if $debug;
-# print it
-print join(", ", map { "\"$_\"" } @cmdline) . "\n";
-
# prepare
mkdir $mondir unless -d $mondir;
unlink($monitor);
@@ -265,6 +265,8 @@ $pid = fork();
die "fork: $!" unless defined($pid);
if (0 == $pid) {
# child
+ print join(", ", map { "\"$_\"" } @cmdline) . "\n"
+ if $debug;
exec(@cmdline);
exit(1);
}
@@ -273,9 +275,11 @@ if (0 == $pid) {
@cmdline = ();
push @cmdline, "qemu-gtk";
push @cmdline, "-m" if $showmon;
-push @cmdline, "unix:monitor";
+push @cmdline, "unix:$monitor";
foreach my $i (0 ... 256) {
last if -S $monitor;
sleep(0.03);
}
+print join(", ", map { "\"$_\"" } @cmdline) . "\n"
+ if $debug;
exec(@cmdline);