diff -ur qemu-orig/vl.c qemu-vncport/vl.c --- qemu-orig/vl.c 2004-11-26 14:28:08.000000000 -0600 +++ qemu-vncport/vl.c 2004-11-26 14:23:45.000000000 -0600 @@ -113,6 +113,7 @@ static DisplayState display_state; int nographic; int usevnc; /* 1=vnc only, 2=vnc and sdl */ +int vnc_port = 0; const char* keyboard_layout = 0; int64_t ticks_per_sec; int boot_device = 'c'; @@ -2505,6 +2506,7 @@ "-nographic disable graphical output and redirect serial I/Os to console\n" #ifdef CONFIG_VNC "-vnc use vnc instead of sdl\n" + "-vncport use this vnc port. Default is auto-choosing\n" #ifdef CONFIG_SDL "-vnc-and-sdl use vnc and sdl simultaneously\n" #endif @@ -2599,6 +2601,7 @@ QEMU_OPTION_boot, QEMU_OPTION_snapshot, QEMU_OPTION_m, + QEMU_OPTION_vncport, QEMU_OPTION_nographic, #ifdef CONFIG_VNC QEMU_OPTION_vnc, @@ -2662,6 +2665,7 @@ { "boot", HAS_ARG, QEMU_OPTION_boot }, { "snapshot", 0, QEMU_OPTION_snapshot }, { "m", HAS_ARG, QEMU_OPTION_m }, + { "vncport", HAS_ARG, QEMU_OPTION_vncport }, { "nographic", 0, QEMU_OPTION_nographic }, #ifdef CONFIG_VNC { "vnc", 0, QEMU_OPTION_vnc }, @@ -3041,6 +3045,9 @@ exit(1); } break; + case QEMU_OPTION_vncport: + vnc_port = atoi(optarg); + break; case QEMU_OPTION_d: { int mask; diff -ur qemu-orig/vnc.c qemu-vncport/vnc.c --- qemu-orig/vnc.c 2004-11-26 14:28:08.000000000 -0600 +++ qemu-vncport/vnc.c 2004-11-26 14:17:29.000000000 -0600 @@ -342,6 +342,7 @@ #include extern SDL_PixelFormat* sdl_get_format(); +extern int vnc_port; static void vnc_resize(DisplayState *ds, int w, int h) { @@ -529,6 +530,15 @@ screen->desktopName = "QEMU/VNC"; screen->cursor = 0; + + /* Did we get a VNC port in the command line? */ + if (vnc_port) { + screen->autoPort = FALSE; + screen->port = vnc_port; + } + else + screen->autoPort = TRUE; + screen->kbdAddEvent = vnc_process_key; screen->ptrAddEvent = vnc_process_mouse; rfbInitServer(screen);