--- Xvnc/programs/Xserver/hw/vnc/init.c.orig Wed Jun 27 09:48:20 2007 +++ Xvnc/programs/Xserver/hw/vnc/init.c Wed Jun 27 10:30:26 2007 @@ -90,6 +90,11 @@ #define RFB_DEFAULT_WHITEPIXEL 0 #define RFB_DEFAULT_BLACKPIXEL 1 +#define INETD_DPN_MIN 1 +#define INETD_DPN_MAX 99 +static int inetd_dpn_min = INETD_DPN_MIN; +static int inetd_dpn_max = INETD_DPN_MAX; + rfbScreenInfo rfbScreen; int rfbGCIndex; @@ -340,14 +345,26 @@ return 2; } + if (strcmp(argv[i], "-dpmin") == 0) { /* -dpmin DspNum */ + if (i + 1 >= argc) UseMsg(); + inetd_dpn_min = atoi(argv[i+1]); + if (inetd_dpn_max <= inetd_dpn_min) + inetd_dpn_max = inetd_dpn_min+(INETD_DPN_MAX-INETD_DPN_MIN-1); + return 2; + } + if (strcmp(argv[i], "-dpmax") == 0) { /* -dpmin DspNum */ + if (i + 1 >= argc) UseMsg(); + inetd_dpn_max = atoi(argv[i+1]); + return 2; + } if (strcmp(argv[i], "-inetd") == 0) { /* -inetd */ int n; - for (n = 1; n < 100; n++) { + for (n = inetd_dpn_min; n <= inetd_dpn_max; n++) { if (CheckDisplayNumber(n)) break; } - if (n >= 100) + if (n > inetd_dpn_max) FatalError("-inetd: couldn't find free display number"); sprintf(inetdDisplayNumStr, "%d", n); @@ -925,6 +942,8 @@ ErrorF("-interface ipaddr only bind to specified interface " "address\n"); ErrorF("-inetd Xvnc is launched by inetd\n"); + ErrorF("-dpmin DspNum (with -inetd)Search free dispnum from\n"); + ErrorF("-dpmax DspNum (with -inetd)Search free dispnum up-to\n"); ErrorF("-compatiblekbd set META key = ALT key as in the original " "VNC\n"); ErrorF("-version report Xvnc version on stderr\n");