diff options
author | kraxel <kraxel> | 2006-11-07 14:32:36 +0000 |
---|---|---|
committer | kraxel <kraxel> | 2006-11-07 14:32:36 +0000 |
commit | 701c9668cabe7a3c2bf0151a4474b981ec010c66 (patch) | |
tree | 996b3a57028b1d707ffb61895388cacadd9509fa | |
parent | e16c481d49db8954e9f90941265b1a75d4ada29e (diff) | |
download | xenwatch-701c9668cabe7a3c2bf0151a4474b981ec010c66.tar.gz |
s/displayno/tcpport/
-rw-r--r-- | apps.c | 8 | ||||
-rw-r--r-- | apps.h | 2 | ||||
-rw-r--r-- | vnc-client.c | 11 | ||||
-rw-r--r-- | vnc.c | 8 | ||||
-rw-r--r-- | vnc.h | 2 | ||||
-rw-r--r-- | xd_view.c | 16 |
6 files changed, 23 insertions, 24 deletions
@@ -242,15 +242,15 @@ int run_cmdline_replace(int do_wait, char *str, ...) /* ------------------------------------------------------------------ */ -int open_vnc_session(char *host, int screen) +int open_vnc_session(char *host, int tcpport) { char display[64]; char javaurl[64]; char vncurl[64]; - snprintf(display, sizeof(display), "%s:%d", host, screen); - snprintf(javaurl, sizeof(javaurl), "http://%s:%d/", host, 5800 + screen); - snprintf(vncurl, sizeof(vncurl), "vnc://%s:%d/", host, 5900 + screen); + snprintf(display, sizeof(display), "%s:%d", host, tcpport - 5900); + snprintf(javaurl, sizeof(javaurl), "http://%s:%d/", host, tcpport - 100); + snprintf(vncurl, sizeof(vncurl), "vnc://%s:%d/", host, tcpport); /* --- try client apps --- */ if (have_application("vncviewer")) @@ -20,4 +20,4 @@ int run_application(int do_wait, const char *app, ...); int run_cmdline(int do_wait, char *line); int run_cmdline_replace(int do_wait, char *str, ...); -int open_vnc_session(char *host, int screen); +int open_vnc_session(char *host, int tcpport); diff --git a/vnc-client.c b/vnc-client.c index 94f3507..41eff13 100644 --- a/vnc-client.c +++ b/vnc-client.c @@ -68,19 +68,18 @@ main(int argc, char *argv[]) exit(1); } - if (2 == sscanf(argv[optind], "%64[^:]:%d", hostname, &displayno)) + if (2 == sscanf(argv[optind], "%64[^:]:%d", hostname, &displayno)) { + port = displayno + 5900; goto connect; - if (2 == sscanf(argv[optind], "%64[^:]::%d", hostname, &port)) { - displayno = port - 5900; - if (displayno >= 0) - goto connect; } + if (2 == sscanf(argv[optind], "%64[^:]::%d", hostname, &port)) + goto connect; usage(stderr); exit(1); connect: - if (NULL == vnc_open(hostname, displayno, vnc_flags, debug)) + if (NULL == vnc_open(hostname, port, vnc_flags, debug)) exit(1); gtk_main(); @@ -475,7 +475,7 @@ static GdkFilterReturn event_filter(GdkXEvent *gdkxevent, GdkEvent *gtkevent, /* ------------------------------------------------------------------ */ /* public API functions */ -GtkWidget *vnc_open(char *hostname, int displayno, unsigned long flags, +GtkWidget *vnc_open(char *hostname, int tcpport, unsigned long flags, int debug_level) { char display[128]; @@ -500,8 +500,8 @@ GtkWidget *vnc_open(char *hostname, int displayno, unsigned long flags, goto err; /* rfb client */ - snprintf(display, sizeof(display), "%s:%d", hostname, displayno); - fprintf(stderr, "%s: connecting to %s:%d\n", __FUNCTION__, hostname, displayno); + snprintf(display, sizeof(display), "%s:%d", hostname, tcpport - 5900); + fprintf(stderr, "%s: connecting to %s:%d\n", __FUNCTION__, hostname, tcpport - 5900); if (8 == x11_red_bits) vnc->client = rfbGetClient(8,3,4); else @@ -577,7 +577,7 @@ GtkWidget *vnc_open(char *hostname, int displayno, unsigned long flags, #else /* HAVE_VNCCLIENT */ -GtkWidget *vnc_open(char *hostname, int displayno, +GtkWidget *vnc_open(char *hostname, int tcpport, int standalone, int uskbd, int debug) { fprintf(stderr, "compiled without VNC support, sorry\n"); @@ -2,5 +2,5 @@ #define VNC_FLAG_US_KBD (1 << 2) #define VNC_FLAG_SHOW_MOUSE (1 << 3) -GtkWidget *vnc_open(char *hostname, int displayno, unsigned long flags, +GtkWidget *vnc_open(char *hostname, int tcpport, unsigned long flags, int debug_level); @@ -132,15 +132,15 @@ static void open_tty(gint id, char *name, char *tty) } } -static void open_vnc(gint id, char *hostname, gint displayno) +static void open_vnc(gint id, char *hostname, gint tcpport) { #ifdef HAVE_VNCCLIENT if (1) { - vnc_open(hostname, displayno, VNC_FLAG_US_KBD, 0); + vnc_open(hostname, tcpport, VNC_FLAG_US_KBD, 0); return; } #endif - if (-1 == open_vnc_session(hostname, id)) + if (-1 == open_vnc_session(hostname, tcpport)) gtk_message(GTK_MESSAGE_ERROR, app_error); } @@ -304,7 +304,7 @@ static void menu_cb_mdns(void) static void menu_cb_open_vnc(void) { char *name, *tty, *ostype; - gint id = -1, vncport, displayno = -1; + gint id = -1, vncport, tcpport = -1; if (!get_domain(&id, &name, &ostype, &tty, &vncport)) return; @@ -313,14 +313,14 @@ static void menu_cb_open_vnc(void) if (vncport) /* xen 3.0.3+ */ - displayno = vncport - 5900; + tcpport = vncport; else if (0 == strcmp(ostype, "hvm")) { /* xen 3.0.2 */ - displayno = id; + tcpport = id + 5900; } - if (-1 != displayno) - open_vnc(id, "localhost", displayno); + if (-1 != tcpport) + open_vnc(id, "localhost", tcpport); else gtk_message(GTK_MESSAGE_ERROR, "Domain has no graphical display.\n"); } |