コード例 #1
0
int
ddxProcessArgument (int argc, char **argv, int i)
{
    int	ret;
    
    if (!strcmp (argv[i], "-clk")) 
    {
	if (i+1 < argc)
	    trident_clk = atoi (argv[i+1]);
	else
	    UseMsg ();
	return 2;
    }
    if (!strcmp (argv[i], "-mclk")) 
    {
	if (i+1 < argc)
	    trident_mclk = atoi (argv[i+1]);
	else
	    UseMsg ();
	return 2;
    }
	
#ifdef VESA
    if (!(ret = vesaProcessArgument (argc, argv, i)))
#endif
	ret = KdProcessArgument(argc, argv, i);
    return ret;
}
コード例 #2
0
ファイル: sco_init.c プロジェクト: GrahamCobb/maemo-xsisusb
int
xf86ProcessArgument(int argc, char *argv[], int i)
{
  /*
   * Keep server from detaching from controlling tty.  This is useful
   * when debugging (so the server can receive keyboard signals).
   */
  if (!strcmp(argv[i], "-keeptty")) {
    KeepTty = TRUE;
    return(1);
  }

  /*
   * By default, the X server wants to bind itself to CPU 0. This makes
   * sure that the server has full access to the I/O ports at IOPL 3.
   * Some SMP systems have trouble with I/O on CPU's other than 0. If,
   * however, you have a system that is well behaved, you can specify
   * this argument and let the scheduler decide which CPU the server
   * should run on.
   */
  if (!strcmp(argv[i], "-nompxlock")) {
    mpxLock = FALSE;
    return (1);
  }

  /*
   * Specify the VT number to run on (NOT the device).
   */
  if ((argv[i][0] == 'v') && (argv[i][1] == 't')) {
    if (sscanf(argv[i], "vt%2d", &VTnum) == 0) {
      UseMsg();
      VTnum = -1;
      return(0);
    }
    if (VTnum <= 0) {
      UseMsg();
      VTnum = -1;
      return(0);
    }
    return(1);
  }

  /*
   * Use a device the user specifies.
   */
  if (!strcmp(argv[i], "-crt")) {
    if (++i > argc) {
      UseMsg();
      VTnum = -1;
      return(0);
    } else {
      VTnum = -2;
      strlcpy (vtdevice, argv[i], sizeof(vtdevice));
      return(2);
    }
  }
  return(0);
}
コード例 #3
0
int
xf86ProcessArgument(int argc, char *argv[], int i)
{
	/*
	 * Keep server from detaching from controlling tty.  This is useful
	 * when debugging (so the server can receive keyboard signals.
	 */
	if (!strcmp(argv[i], "-keeptty"))
	{
		KeepTty = TRUE;
		return(1);
	}
        if (!strcmp(argv[i], "-novtswitch"))
        {
                VTSwitch = FALSE;
                return(1);
        }
        if (!strcmp(argv[i], "-sharevts"))
        {
                ShareVTs = TRUE;
                return(1);
        }
	if ((argv[i][0] == 'v') && (argv[i][1] == 't'))
	{
		if (sscanf(argv[i], "vt%2d", &VTnum) == 0)
		{
			UseMsg();
			VTnum = -1;
			return(0);
		}
		return(1);
	}
	return(0);
}
コード例 #4
0
ファイル: lynx_init.c プロジェクト: Magister/x11rdp_xorg71
int
xf86ProcessArgument(int argc, char *argv[], int i)
{
	if ((argv[i][0] == 'v') && (argv[i][1] == 't'))
	{
		if (sscanf(argv[i], "vt%2d", &VTnum) == 0)
		{
			UseMsg();
			VTnum = -1;
			return(0);
		}
		return(1);
	}
	return(0);
}
コード例 #5
0
ファイル: fbinit.c プロジェクト: 4eremuxa/xserver
int
ddxProcessArgument (int argc, char **argv, int i)
{
  if (!strcmp (argv[i], "-fb"))
    {
      if (i+1 < argc)
	{
	  fbdevDevicePath = argv[i+1];
	  return 2;
	}
      UseMsg();
      exit(1);
    }

  return KdProcessArgument (argc, argv, i);
}
コード例 #6
0
int
ddxProcessArgument (int argc, char **argv, int i)
{
  EPHYR_DBG("mark");

  if (!strcmp (argv[i], "-parent"))
    {
      if(i+1 < argc) 
	{
	  hostx_use_preexisting_window(strtol(argv[i+1], NULL, 0));
	  return 2;
	} 
      
      UseMsg();
      exit(1);
    }
  else if (!strcmp (argv[i], "-host-cursor"))
    {
      hostx_use_host_cursor();
      return 1;
    }
  else if (!strcmp (argv[i], "-fullscreen"))
    {
      hostx_use_fullscreen();
      return 1;
    }
  else if (!strcmp (argv[i], "-grayscale"))
    {
      EphyrWantGrayScale = 1;      
      return 1;
    }
  else if (!strcmp (argv[i], "-fakexa"))
    {
      ephyrFuncs.initAccel = ephyrDrawInit;
      ephyrFuncs.enableAccel = ephyrDrawEnable;
      ephyrFuncs.disableAccel = ephyrDrawDisable;
      ephyrFuncs.finiAccel = ephyrDrawFini;
      return 1;
    }
  else if (argv[i][0] == ':')
    {
      hostx_set_display_name(argv[i]);
    }

  return KdProcessArgument (argc, argv, i);
}
コード例 #7
0
ファイル: lnx_init.c プロジェクト: MrKepzie/xserver
int
xf86ProcessArgument(int argc, char *argv[], int i)
{
    /*
     * Keep server from detaching from controlling tty.  This is useful
     * when debugging (so the server can receive keyboard signals.
     */
    if (!strcmp(argv[i], "-keeptty")) {
        KeepTty = TRUE;
        return 1;
    }

    if ((argv[i][0] == 'v') && (argv[i][1] == 't')) {
        if (sscanf(argv[i], "vt%2d", &xf86Info.vtno) == 0) {
            UseMsg();
            xf86Info.vtno = -1;
            return 0;
        }
        return 1;
    }
    return 0;
}
コード例 #8
0
ファイル: sysv_init.c プロジェクト: L3oV1nc3/VMGL
int
xf86ProcessArgument(int argc, char *argv[], int i)
{
	/*
	 * Keep server from detaching from controlling tty.  This is useful 
	 * when debugging (so the server can receive keyboard signals.
	 */
	if (!strcmp(argv[i], "-keeptty"))
	{
		KeepTty = TRUE;
		return(1);
	}
#ifdef SVR4
	/*
	 * Undocumented flag to protect page 0 from read/write to help
	 * catch NULL pointer dereferences.  This is purely a debugging
	 * flag.
	 */
	if (!strcmp(argv[i], "-protect0"))
	{
		Protect0 = TRUE;
		return(1);
	}
#endif
	if ((argv[i][0] == 'v') && (argv[i][1] == 't'))
	{
		if (sscanf(argv[i], "vt%2d", &VTnum) == 0)
		{
			UseMsg();
			VTnum = -1;
			return(0);
		}
		return(1);
	}
	return(0);
}
コード例 #9
0
int
xf86ProcessArgument(int argc, char **argv, int i)
{
    /*
     * Keep server from detaching from controlling tty.  This is useful when
     * debugging, so the server can receive keyboard signals.
     */
    if (!strcmp(argv[i], "-keeptty"))
    {
	KeepTty = TRUE;
	return 1;
    }

    /*
     * Undocumented flag to protect page 0 from read/write to help catch NULL
     * pointer dereferences.  This is purely a debugging flag.
     */
    if (!strcmp(argv[i], "-protect0"))
    {
	Protect0 = TRUE;
	return 1;
    }

#ifdef HAS_USL_VTS

    if ((argv[i][0] == 'v') && (argv[i][1] == 't'))
    {
	if (sscanf(argv[i], "vt%2d", &VTnum) == 0)
	{
	    UseMsg();
	    VTnum = -1;
	    return 0;
	}

	return 1;
    }

#endif /* HAS_USL_VTS */

#if defined(__SOL8__) || !defined(i386)

    if ((i + 1) < argc) {
	if (!strcmp(argv[i], "-dev")) {
	    strncpy(fb_dev, argv[i+1], PATH_MAX);
	    fb_dev[PATH_MAX - 1] = '\0';
	    return 2;
	}

	if (!strcmp(argv[i], "-ar1")) {
	    xf86Info.kbdDelay = atoi(argv[i + 1]) * 1000;
	    return 2;
	}

	if (!strcmp(argv[i], "-ar2")) {
	    xf86Info.kbdRate = atoi(argv[i + 1]) * 1000;
	    return 2;
	}
    }

#endif

    return 0;
}
コード例 #10
0
ファイル: utils.c プロジェクト: coffee8651/turbovnc
/*
 * This function parses the command line. Handles device-independent fields
 * and allows ddx to handle additional fields.  It is not allowed to modify
 * argc or any of the strings pointed to by argv.
 */
void
ProcessCommandLine(int argc, char *argv[])
{
    int i, skip;

    defaultKeyboardControl.autoRepeat = TRUE;

#ifdef NO_PART_NET
    PartialNetwork = FALSE;
#else
    PartialNetwork = TRUE;
#endif

    for (i = 1; i < argc; i++) {
        /* call ddx first, so it can peek/override if it wants */
        if ((skip = ddxProcessArgument(argc, argv, i))) {
            i += (skip - 1);
        }
        else if (argv[i][0] == ':') {
            /* initialize display */
            display = argv[i];
            display++;
            if (!VerifyDisplayName(display)) {
                ErrorF("Bad display name: %s\n", display);
                UseMsg();
                FatalError("Bad display name, exiting: %s\n", display);
            }
        }
        else if (strcmp(argv[i], "-a") == 0) {
            if (++i < argc)
                defaultPointerControl.num = atoi(argv[i]);
            else
                UseMsg();
        }
        else if (strcmp(argv[i], "-ac") == 0) {
            defeatAccessControl = TRUE;
        }
        else if (strcmp(argv[i], "-audit") == 0) {
            if (++i < argc)
                auditTrailLevel = atoi(argv[i]);
            else
                UseMsg();
        }
        else if (strcmp(argv[i], "-auth") == 0) {
            if (++i < argc)
                InitAuthorization(argv[i]);
            else
                UseMsg();
        }
        else if (strcmp(argv[i], "-br") == 0);  /* default */
        else if (strcmp(argv[i], "+bs") == 0)
            enableBackingStore = TRUE;
        else if (strcmp(argv[i], "-bs") == 0)
            disableBackingStore = TRUE;
        else if (strcmp(argv[i], "c") == 0) {
            if (++i < argc)
                defaultKeyboardControl.click = atoi(argv[i]);
            else
                UseMsg();
        }
        else if (strcmp(argv[i], "-c") == 0) {
            defaultKeyboardControl.click = 0;
        }
        else if (strcmp(argv[i], "-cc") == 0) {
            if (++i < argc)
                defaultColorVisualClass = atoi(argv[i]);
            else
                UseMsg();
        }
        else if (strcmp(argv[i], "-core") == 0) {
#if !defined(WIN32) || !defined(__MINGW32__)
            struct rlimit core_limit;

            getrlimit(RLIMIT_CORE, &core_limit);
            core_limit.rlim_cur = core_limit.rlim_max;
            setrlimit(RLIMIT_CORE, &core_limit);
#endif
            CoreDump = TRUE;
        }
        else if (strcmp(argv[i], "-nocursor") == 0) {
            EnableCursor = FALSE;
        }
        else if (strcmp(argv[i], "-dpi") == 0) {
            if (++i < argc)
                monitorResolution = atoi(argv[i]);
            else
                UseMsg();
        }
#ifdef DPMSExtension
        else if (strcmp(argv[i], "dpms") == 0)
            /* ignored for compatibility */ ;
        else if (strcmp(argv[i], "-dpms") == 0)
            DPMSDisabledSwitch = TRUE;
#endif
        else if (strcmp(argv[i], "-deferglyphs") == 0) {
            if (++i >= argc || !ParseGlyphCachingMode(argv[i]))
                UseMsg();
        }
        else if (strcmp(argv[i], "-f") == 0) {
            if (++i < argc)
                defaultKeyboardControl.bell = atoi(argv[i]);
            else
                UseMsg();
        }
        else if (strcmp(argv[i], "-fc") == 0) {
            if (++i < argc)
                defaultCursorFont = argv[i];
            else
                UseMsg();
        }
        else if (strcmp(argv[i], "-fn") == 0) {
            if (++i < argc)
                defaultTextFont = argv[i];
            else
                UseMsg();
        }
        else if (strcmp(argv[i], "-fp") == 0) {
            if (++i < argc) {
                defaultFontPath = argv[i];
            }
            else
                UseMsg();
        }
        else if (strcmp(argv[i], "-help") == 0) {
            UseMsg();
            exit(0);
        }
        else if ((skip = XkbProcessArguments(argc, argv, i)) != 0) {
            if (skip > 0)
                i += skip - 1;
            else
                UseMsg();
        }
#ifdef RLIMIT_DATA
        else if (strcmp(argv[i], "-ld") == 0) {
            if (++i < argc) {
                limitDataSpace = atoi(argv[i]);
                if (limitDataSpace > 0)
                    limitDataSpace *= 1024;
            }
            else
                UseMsg();
        }
#endif
#ifdef RLIMIT_NOFILE
        else if (strcmp(argv[i], "-lf") == 0) {
            if (++i < argc)
                limitNoFile = atoi(argv[i]);
            else
                UseMsg();
        }
#endif
#ifdef RLIMIT_STACK
        else if (strcmp(argv[i], "-ls") == 0) {
            if (++i < argc) {
                limitStackSpace = atoi(argv[i]);
                if (limitStackSpace > 0)
                    limitStackSpace *= 1024;
            }
            else
                UseMsg();
        }
#endif
        else if (strcmp(argv[i], "-nolock") == 0) {
#if !defined(WIN32) && !defined(__CYGWIN__)
            if (getuid() != 0)
                ErrorF
                    ("Warning: the -nolock option can only be used by root\n");
            else
#endif
                nolock = TRUE;
        }
        else if (strcmp(argv[i], "-nolisten") == 0) {
            if (++i < argc) {
                if (_XSERVTransNoListen(argv[i]))
                    ErrorF("Failed to disable listen for %s transport",
                           argv[i]);
            }
            else
                UseMsg();
        }
        else if (strcmp(argv[i], "-noreset") == 0) {
            dispatchExceptionAtReset = 0;
        }
        else if (strcmp(argv[i], "-reset") == 0) {
            dispatchExceptionAtReset = DE_RESET;
        }
        else if (strcmp(argv[i], "-p") == 0) {
            if (++i < argc)
                defaultScreenSaverInterval = ((CARD32) atoi(argv[i])) *
                    MILLI_PER_MIN;
            else
                UseMsg();
        }
        else if (strcmp(argv[i], "-pogo") == 0) {
            dispatchException = DE_TERMINATE;
        }
        else if (strcmp(argv[i], "-pn") == 0)
            PartialNetwork = TRUE;
        else if (strcmp(argv[i], "-nopn") == 0)
            PartialNetwork = FALSE;
        else if (strcmp(argv[i], "r") == 0)
            defaultKeyboardControl.autoRepeat = TRUE;
        else if (strcmp(argv[i], "-r") == 0)
            defaultKeyboardControl.autoRepeat = FALSE;
        else if (strcmp(argv[i], "-retro") == 0)
            party_like_its_1989 = TRUE;
        else if (strcmp(argv[i], "-s") == 0) {
            if (++i < argc)
                defaultScreenSaverTime = ((CARD32) atoi(argv[i])) *
                    MILLI_PER_MIN;
            else
                UseMsg();
        }
        else if (strcmp(argv[i], "-seat") == 0) {
            if (++i < argc)
                SeatId = argv[i];
            else
                UseMsg();
        }
        else if (strcmp(argv[i], "-t") == 0) {
            if (++i < argc)
                defaultPointerControl.threshold = atoi(argv[i]);
            else
                UseMsg();
        }
        else if (strcmp(argv[i], "-terminate") == 0) {
            dispatchExceptionAtReset = DE_TERMINATE;
        }
        else if (strcmp(argv[i], "-to") == 0) {
            if (++i < argc)
                TimeOutValue = ((CARD32) atoi(argv[i])) * MILLI_PER_SECOND;
            else
                UseMsg();
        }
        else if (strcmp(argv[i], "-tst") == 0) {
            noTestExtensions = TRUE;
        }
        else if (strcmp(argv[i], "v") == 0)
            defaultScreenSaverBlanking = PreferBlanking;
        else if (strcmp(argv[i], "-v") == 0)
            defaultScreenSaverBlanking = DontPreferBlanking;
        else if (strcmp(argv[i], "-wm") == 0)
            defaultBackingStore = WhenMapped;
        else if (strcmp(argv[i], "-wr") == 0)
            whiteRoot = TRUE;
        else if (strcmp(argv[i], "-background") == 0) {
            if (++i < argc) {
                if (!strcmp(argv[i], "none"))
                    bgNoneRoot = TRUE;
                else
                    UseMsg();
            }
        }
        else if (strcmp(argv[i], "-maxbigreqsize") == 0) {
            if (++i < argc) {
                long reqSizeArg = atol(argv[i]);

                /* Request size > 128MB does not make much sense... */
                if (reqSizeArg > 0L && reqSizeArg < 128L) {
                    maxBigRequestSize = (reqSizeArg * 1048576L) - 1L;
                }
                else {
                    UseMsg();
                }
            }
            else {
                UseMsg();
            }
        }
#ifdef PANORAMIX
        else if (strcmp(argv[i], "+xinerama") == 0) {
            noPanoramiXExtension = FALSE;
        }
        else if (strcmp(argv[i], "-xinerama") == 0) {
            noPanoramiXExtension = TRUE;
        }
        else if (strcmp(argv[i], "-disablexineramaextension") == 0) {
            PanoramiXExtensionDisabledHack = TRUE;
        }
#endif
        else if (strcmp(argv[i], "-I") == 0) {
            /* ignore all remaining arguments */
            break;
        }
        else if (strncmp(argv[i], "tty", 3) == 0) {
            /* init supplies us with this useless information */
        }
#ifdef XDMCP
        else if ((skip = XdmcpOptions(argc, argv, i)) != i) {
            i = skip - 1;
        }
#endif
        else if (strcmp(argv[i], "-dumbSched") == 0) {
            SmartScheduleDisable = TRUE;
        }
        else if (strcmp(argv[i], "-schedInterval") == 0) {
            if (++i < argc) {
                SmartScheduleInterval = atoi(argv[i]);
                SmartScheduleSlice = SmartScheduleInterval;
            }
            else
                UseMsg();
        }
        else if (strcmp(argv[i], "-schedMax") == 0) {
            if (++i < argc) {
                SmartScheduleMaxSlice = atoi(argv[i]);
            }
            else
                UseMsg();
        }
        else if (strcmp(argv[i], "-render") == 0) {
            if (++i < argc) {
                int policy = PictureParseCmapPolicy(argv[i]);

                if (policy != PictureCmapPolicyInvalid)
                    PictureCmapPolicy = policy;
                else
                    UseMsg();
            }
            else
                UseMsg();
        }
        else if (strcmp(argv[i], "-sigstop") == 0) {
            RunFromSigStopParent = TRUE;
        }
        else if (strcmp(argv[i], "+extension") == 0) {
            if (++i < argc) {
                if (!EnableDisableExtension(argv[i], TRUE))
                    EnableDisableExtensionError(argv[i], TRUE);
            }
            else
                UseMsg();
        }
        else if (strcmp(argv[i], "-extension") == 0) {
            if (++i < argc) {
                if (!EnableDisableExtension(argv[i], FALSE))
                    EnableDisableExtensionError(argv[i], FALSE);
            }
            else
                UseMsg();
        }
        else {
            ErrorF("Unrecognized option: %s\n", argv[i]);
            UseMsg();
            FatalError("Unrecognized option: %s\n", argv[i]);
        }
    }
}
コード例 #11
0
ファイル: ephyrinit.c プロジェクト: mmaruska/xserver
int
ddxProcessArgument(int argc, char **argv, int i)
{
    static char *parent = NULL;

    EPHYR_DBG("mark argv[%d]='%s'", i, argv[i]);

    if (i == 1) {
        hostx_use_resname(basename(argv[0]), 0);
    }

    if (!strcmp(argv[i], "-parent")) {
        if (i + 1 < argc) {
            int j;

            /* If parent is specified and a screen argument follows, don't do
             * anything, let the -screen handling init the rest */
            for (j = i; j < argc; j++) {
                if (!strcmp(argv[j], "-screen")) {
                    parent = argv[i + 1];
                    return 2;
                }
            }

            processScreenArg("100x100", argv[i + 1]);
            return 2;
        }

        UseMsg();
        exit(1);
    }
    else if (!strcmp(argv[i], "-screen")) {
        if ((i + 1) < argc) {
            processScreenArg(argv[i + 1], parent);
            parent = NULL;
            return 2;
        }

        UseMsg();
        exit(1);
    }
    else if (!strcmp(argv[i], "-output")) {
        if (i + 1 < argc) {
            processOutputArg(argv[i + 1], NULL);
            return 2;
        }

        UseMsg();
        exit(1);
    }
    else if (!strcmp(argv[i], "-sw-cursor")) {
        hostx_use_sw_cursor();
        return 1;
    }
    else if (!strcmp(argv[i], "-host-cursor")) {
        /* Compatibility with the old command line argument, now the default. */
        return 1;
    }
    else if (!strcmp(argv[i], "-fullscreen")) {
        hostx_use_fullscreen();
        return 1;
    }
    else if (!strcmp(argv[i], "-grayscale")) {
        EphyrWantGrayScale = 1;
        return 1;
    }
    else if (!strcmp(argv[i], "-resizeable")) {
        EphyrWantResize = 1;
        return 1;
    }
#ifdef GLAMOR
    else if (!strcmp (argv[i], "-glamor")) {
        ephyr_glamor = TRUE;
        ephyrFuncs.initAccel = ephyr_glamor_init;
        ephyrFuncs.enableAccel = ephyr_glamor_enable;
        ephyrFuncs.disableAccel = ephyr_glamor_disable;
        ephyrFuncs.finiAccel = ephyr_glamor_fini;
        return 1;
    }
    else if (!strcmp (argv[i], "-glamor_gles2")) {
        ephyr_glamor = TRUE;
        ephyr_glamor_gles2 = TRUE;
        ephyrFuncs.initAccel = ephyr_glamor_init;
        ephyrFuncs.enableAccel = ephyr_glamor_enable;
        ephyrFuncs.disableAccel = ephyr_glamor_disable;
        ephyrFuncs.finiAccel = ephyr_glamor_fini;
        return 1;
    }
#endif
    else if (!strcmp(argv[i], "-fakexa")) {
        ephyrFuncs.initAccel = ephyrDrawInit;
        ephyrFuncs.enableAccel = ephyrDrawEnable;
        ephyrFuncs.disableAccel = ephyrDrawDisable;
        ephyrFuncs.finiAccel = ephyrDrawFini;
        return 1;
    }
    else if (!strcmp(argv[i], "-verbosity")) {
        if (i + 1 < argc && argv[i + 1][0] != '-') {
            int verbosity = atoi(argv[i + 1]);

            LogSetParameter(XLOG_VERBOSITY, verbosity);
            EPHYR_LOG("set verbosiry to %d\n", verbosity);
            return 2;
        }
        else {
            UseMsg();
            exit(1);
        }
    }
#ifdef GLXEXT
    else if (!strcmp(argv[i], "-nodri")) {
        ephyrNoDRI = TRUE;
        EPHYR_LOG("no direct rendering enabled\n");
        return 1;
    }
#endif
    else if (!strcmp(argv[i], "-noxv")) {
        ephyrNoXV = TRUE;
        EPHYR_LOG("no XVideo enabled\n");
        return 1;
    }
    else if (!strcmp(argv[i], "-name")) {
        if (i + 1 < argc && argv[i + 1][0] != '-') {
            hostx_use_resname(argv[i + 1], 1);
            return 2;
        }
        else {
            UseMsg();
            return 0;
        }
    }
    else if (!strcmp(argv[i], "-title")) {
        if (i + 1 < argc && argv[i + 1][0] != '-') {
            hostx_set_title(argv[i + 1]);
            return 2;
        }
        else {
            UseMsg();
            return 0;
        }
    }
    else if (argv[i][0] == ':') {
        hostx_set_display_name(argv[i]);
    }
    /* Xnest compatibility */
    else if (!strcmp(argv[i], "-display")) {
        hostx_set_display_name(argv[i + 1]);
        return 2;
    }
    else if (!strcmp(argv[i], "-sync") ||
             !strcmp(argv[i], "-full") ||
             !strcmp(argv[i], "-sss") || !strcmp(argv[i], "-install")) {
        return 1;
    }
    else if (!strcmp(argv[i], "-bw") ||
             !strcmp(argv[i], "-class") ||
             !strcmp(argv[i], "-geometry") || !strcmp(argv[i], "-scrns")) {
        return 2;
    }
    /* end Xnest compat */

    return KdProcessArgument(argc, argv, i);
}
コード例 #12
0
ファイル: InitOutput.c プロジェクト: aosm/X11server
int
ddxProcessArgument(int argc, char *argv[], int i)
{
    static Bool firstTime = TRUE;

    if (firstTime)
    {
	vfbInitializeDefaultScreens();
	vfbInitializePixmapDepths();
        firstTime = FALSE;
    }

#define CHECK_FOR_REQUIRED_ARGUMENTS(num) \
    if (((i + num) >= argc) || (!argv[i + num])) {                      \
      ErrorF("Required argument to %s not specified\n", argv[i]);       \
      UseMsg();                                                         \
      FatalError("Required argument to %s not specified\n", argv[i]);   \
    }
    
    if (strcmp (argv[i], "-screen") == 0)	/* -screen n WxHxD */
    {
	int screenNum;
	CHECK_FOR_REQUIRED_ARGUMENTS(2);
	screenNum = atoi(argv[i+1]);
	if (screenNum < 0 || screenNum >= MAXSCREENS)
	{
	    ErrorF("Invalid screen number %d\n", screenNum);
	    UseMsg();
	    FatalError("Invalid screen number %d passed to -screen\n",
		       screenNum);
	}
	if (3 != sscanf(argv[i+2], "%dx%dx%d",
			&vfbScreens[screenNum].width,
			&vfbScreens[screenNum].height,
			&vfbScreens[screenNum].depth))
	{
	    ErrorF("Invalid screen configuration %s\n", argv[i+2]);
	    UseMsg();
	    FatalError("Invalid screen configuration %s for -screen %d\n",
		   argv[i+2], screenNum);
	}

	if (screenNum >= vfbNumScreens)
	    vfbNumScreens = screenNum + 1;
	lastScreen = screenNum;
	return 3;
    }

    if (strcmp (argv[i], "-pixdepths") == 0)	/* -pixdepths list-of-depth */
    {
	int depth, ret = 1;

	CHECK_FOR_REQUIRED_ARGUMENTS(1);
	while ((++i < argc) && (depth = atoi(argv[i])) != 0)
	{
	    if (depth < 0 || depth > 32)
	    {
		ErrorF("Invalid pixmap depth %d\n", depth);
		UseMsg();
		FatalError("Invalid pixmap depth %d passed to -pixdepths\n",
			   depth);
	    }
	    vfbPixmapDepths[depth] = TRUE;
	    ret++;
	}
	return ret;
    }

    if (strcmp (argv[i], "+render") == 0)	/* +render */
    {
	Render = TRUE;
	return 1;
    }

    if (strcmp (argv[i], "-render") == 0)	/* -render */
    {
	Render = FALSE;
#ifdef COMPOSITE
	noCompositeExtension = TRUE;
#endif
	return 1;
    }

    if (strcmp (argv[i], "-blackpixel") == 0)	/* -blackpixel n */
    {
	Pixel pix;
	CHECK_FOR_REQUIRED_ARGUMENTS(1);
	pix = atoi(argv[++i]);
	if (-1 == lastScreen)
	{
	    int i;
	    for (i = 0; i < MAXSCREENS; i++)
	    {
		vfbScreens[i].blackPixel = pix;
	    }
	}
	else
	{
	    vfbScreens[lastScreen].blackPixel = pix;
	}
	return 2;
    }

    if (strcmp (argv[i], "-whitepixel") == 0)	/* -whitepixel n */
    {
	Pixel pix;
	CHECK_FOR_REQUIRED_ARGUMENTS(1);
	pix = atoi(argv[++i]);
	if (-1 == lastScreen)
	{
	    int i;
	    for (i = 0; i < MAXSCREENS; i++)
	    {
		vfbScreens[i].whitePixel = pix;
	    }
	}
	else
	{
	    vfbScreens[lastScreen].whitePixel = pix;
	}
	return 2;
    }

    if (strcmp (argv[i], "-linebias") == 0)	/* -linebias n */
    {
	unsigned int linebias;
	CHECK_FOR_REQUIRED_ARGUMENTS(1);
	linebias = atoi(argv[++i]);
	if (-1 == lastScreen)
	{
	    int i;
	    for (i = 0; i < MAXSCREENS; i++)
	    {
		vfbScreens[i].lineBias = linebias;
	    }
	}
	else
	{
	    vfbScreens[lastScreen].lineBias = linebias;
	}
	return 2;
    }

#ifdef HAS_MMAP
    if (strcmp (argv[i], "-fbdir") == 0)	/* -fbdir directory */
    {
	CHECK_FOR_REQUIRED_ARGUMENTS(1);
	pfbdir = argv[++i];
	fbmemtype = MMAPPED_FILE_FB;
	return 2;
    }
#endif /* HAS_MMAP */

#ifdef HAS_SHM
    if (strcmp (argv[i], "-shmem") == 0)	/* -shmem */
    {
	fbmemtype = SHARED_MEMORY_FB;
	return 1;
    }
#endif

    return 0;
}
コード例 #13
0
int
XkbProcessArguments(int argc,char *argv[],int i)
{
    if (strncmp(argv[i], "-xkbdir", 7) == 0) {
	if(++i < argc) {
#if !defined(WIN32) && !defined(__CYGWIN__)
	    if (getuid() != geteuid()) {
		LogMessage(X_WARNING, "-xkbdir is not available for setuid X servers\n");
		return -1;
	    } else
#endif
	    {
		if (strlen(argv[i]) < PATH_MAX) {
		    XkbBaseDirectory= argv[i];
		    return 2;
	        } else {
		    LogMessage(X_ERROR, "-xkbdir pathname too long\n");
		    return -1;
		}
	    }
	}
	else {
	    return -1;
	}
    }
    else if ((strncmp(argv[i],"-accessx",8)==0)||
                 (strncmp(argv[i],"+accessx",8)==0)) {
	int j=1;	    
	if (argv[i][0]=='-')        
	    XkbWantAccessX= 0;
	else {
	    XkbWantAccessX= 1;
	    
	    if ( ((i+1)<argc) && (isdigit(argv[i+1][0])) ) {
		XkbDfltAccessXTimeout = atoi(argv[++i]);
		j++;

		if ( ((i+1)<argc) && (isdigit(argv[i+1][0])) ) {
		    /*
		     * presumption that the reasonably useful range of
		     * values fits in 0..MAXINT since SunOS 4 doesn't
		     * have strtoul.
		     */
		    XkbDfltAccessXTimeoutMask=(unsigned int)
					      strtol(argv[++i],NULL,16); 
		    j++;
		}
		if ( ((i+1)<argc) && (isdigit(argv[i+1][0])) ) {
		    if (argv[++i][0] == '1' ) 
			XkbDfltAccessXFeedback=XkbAccessXFeedbackMask;
		    else
			XkbDfltAccessXFeedback=0;
		    j++;
		}
		if ( ((i+1)<argc) && (isdigit(argv[i+1][0])) ) {
		    XkbDfltAccessXOptions=(unsigned char)
					   strtol(argv[++i],NULL,16);
		    j++;
		}
	    }
	}
	return j;
    }
    if ((strcmp(argv[i], "-ardelay") == 0) ||
        (strcmp (argv[i], "-ar1") == 0)) {	/* -ardelay int */
	if (++i >= argc) UseMsg ();
	XkbDfltRepeatDelay = (long)atoi(argv[i]);
	return 2;
    }
    if ((strcmp(argv[i], "-arinterval") == 0) ||
        (strcmp (argv[i], "-ar2") == 0)) {	/* -arinterval int */
	if (++i >= argc) UseMsg ();
	XkbDfltRepeatInterval = (long)atoi(argv[i]);
	return 2;
    }
    return 0;
}
コード例 #14
0
ファイル: xvnc.c プロジェクト: nufroftsuj/tigervnc
int 
ddxProcessArgument(int argc, char *argv[], int i)
{
    static Bool firstTime = TRUE;

    if (firstTime)
    {
        /* Force -noreset as default until we properly handle resets */
	dispatchExceptionAtReset = 0;

        vfbInitializeDefaultScreens();
	vfbInitializePixmapDepths();
	firstTime = FALSE;
	vncInitRFB();
    }

    if (argv[i][0] ==  ':')
        displaySpecified = TRUE;

    if (strcmp (argv[i], "-screen") == 0)	/* -screen n WxHxD */
    {
	int screenNum;
	fail_unless_args(argc, i, 2);
	screenNum = atoi(argv[i+1]);
	if (screenNum < 0 || screenNum >= MAXSCREENS)
	{
	    ErrorF("Invalid screen number %d\n", screenNum);
	    UseMsg();
	    return 0;
	}
	if (3 != sscanf(argv[i+2], "%dx%dx%d",
			&vfbScreens[screenNum].fb.width,
			&vfbScreens[screenNum].fb.height,
			&vfbScreens[screenNum].fb.depth))
	{
	    ErrorF("Invalid screen configuration %s\n", argv[i+2]);
	    UseMsg();
	    return 0;
	}

	if (screenNum >= vfbNumScreens)
	    vfbNumScreens = screenNum + 1;
	lastScreen = screenNum;
	return 3;
    }

    if (strcmp (argv[i], "-pixdepths") == 0)	/* -pixdepths list-of-depth */
    {
	int depth, ret = 1;

	fail_unless_args(argc, i, 1);
	++i;
	while ((i < argc) && (depth = atoi(argv[i++])) != 0)
	{
	    if (depth < 0 || depth > 32)
	    {
		ErrorF("Invalid pixmap depth %d\n", depth);
		UseMsg();
		return 0;
	    }
	    vfbPixmapDepths[depth] = TRUE;
	    ret++;
	}
	return ret;
    }
    
    if (strcmp (argv[i], "+render") == 0)	/* +render */
    {
	Render = TRUE;
	return 1;
    }
  
    if (strcmp (argv[i], "-render") == 0)	/* -render */
    {
	Render = FALSE;
	return 1;
    }

    if (strcmp (argv[i], "-blackpixel") == 0)	/* -blackpixel n */
    {
	Pixel pix;
	fail_unless_args(argc, i, 1);
	++i;
	pix = atoi(argv[i]);
	if (-1 == lastScreen)
	{
	    int j;
	    for (j = 0; j < MAXSCREENS; j++)
	    {
		vfbScreens[j].blackPixel = pix;
	    }
	}
	else
	{
	    vfbScreens[lastScreen].blackPixel = pix;
	}
	return 2;
    }

    if (strcmp (argv[i], "-whitepixel") == 0)	/* -whitepixel n */
    {
	Pixel pix;
	fail_unless_args(argc, i, 1);
	++i;
	pix = atoi(argv[i]);
	if (-1 == lastScreen)
	{
	    int j;
	    for (j = 0; j < MAXSCREENS; j++)
	    {
		vfbScreens[j].whitePixel = pix;
	    }
	}
	else
	{
	    vfbScreens[lastScreen].whitePixel = pix;
	}
	return 2;
    }
    
    if (strcmp (argv[i], "-linebias") == 0)	/* -linebias n */
    {
	unsigned int linebias;
	fail_unless_args(argc, i, 1);
	++i;
	linebias = atoi(argv[i]);
	if (-1 == lastScreen)
	{
	    int j;
	    for (j = 0; j < MAXSCREENS; j++)
	    {
		vfbScreens[j].lineBias = linebias;
	    }
	}
	else
	{
	    vfbScreens[lastScreen].lineBias = linebias;
	}
	return 2;
    }

#ifdef HAS_SHM
    if (strcmp (argv[i], "-shmem") == 0)	/* -shmem */
    {
	fbmemtype = SHARED_MEMORY_FB;
	return 1;
    }
#endif
    
    if (strcmp(argv[i], "-geometry") == 0)
    {
	fail_unless_args(argc, i, 1);
	++i;
	if (sscanf(argv[i],"%dx%d",&vfbScreens[0].fb.width,
		   &vfbScreens[0].fb.height) != 2) {
	    ErrorF("Invalid geometry %s\n", argv[i]);
	    UseMsg();
	    return 0;
	}
	return 2;
    }
    
    if (strcmp(argv[i], "-depth") == 0)
    {
	fail_unless_args(argc, i, 1);
	++i;
	vfbScreens[0].fb.depth = atoi(argv[i]);
	return 2;
    }

    if (strcmp(argv[i], "-pixelformat") == 0)
    {
	char rgbbgr[4];
	int bits1, bits2, bits3;
	fail_unless_args(argc, i, 1);
	++i;
	if (sscanf(argv[i], "%3s%1d%1d%1d", rgbbgr,&bits1,&bits2,&bits3) < 4) {
	    ErrorF("Invalid pixel format %s\n", argv[i]);
	    UseMsg();
	    return 0;
	}

#define SET_PIXEL_FORMAT(vfbScreen)                     \
    (vfbScreen).pixelFormatDefined = TRUE;              \
    (vfbScreen).fb.depth = bits1 + bits2 + bits3;          \
    (vfbScreen).greenBits = bits2;                      \
    if (strcasecmp(rgbbgr, "bgr") == 0) {               \
        (vfbScreen).rgbNotBgr = FALSE;                  \
        (vfbScreen).redBits = bits3;                    \
        (vfbScreen).blueBits = bits1;                   \
    } else if (strcasecmp(rgbbgr, "rgb") == 0) {        \
        (vfbScreen).rgbNotBgr = TRUE;                   \
        (vfbScreen).redBits = bits1;                    \
        (vfbScreen).blueBits = bits3;                   \
    } else {                                            \
        ErrorF("Invalid pixel format %s\n", argv[i]);   \
        UseMsg();                                       \
        return 0;					\
    }

	if (-1 == lastScreen)
	{
	    int j;
	    for (j = 0; j < MAXSCREENS; j++)
	    {
		SET_PIXEL_FORMAT(vfbScreens[j]);
	    }
	}
	else
	{
	    SET_PIXEL_FORMAT(vfbScreens[lastScreen]);
	}

	return 2;
    }

    if (strcmp(argv[i], "-inetd") == 0)
    {
	dup2(0,3);
	vncInetdSock = 3;
	close(2);
	
	if (!displaySpecified) {
	    int port = vncGetSocketPort(vncInetdSock);
	    int displayNum = port - 5900;
	    if (displayNum < 0 || displayNum > 99 || !displayNumFree(displayNum)) {
		for (displayNum = 1; displayNum < 100; displayNum++)
		    if (displayNumFree(displayNum)) break;
		
		if (displayNum == 100)
		    FatalError("Xvnc error: no free display number for -inetd");
	    }
	    
	    display = displayNumStr;
	    sprintf(displayNumStr, "%d", displayNum);
	}
	
	return 1;
    }

    if (strcmp(argv[i], "-noclipboard") == 0) {
	vncNoClipboard = 1;
	return 1;
    }

    if (!strcmp(argv[i], "-verbose")) {
        if (++i < argc && argv[i]) {
            char *end;
            long val;

            val = strtol(argv[i], &end, 0);
            if (*end == '\0') {
                vncVerbose = val;
                LogSetParameter(XLOG_VERBOSITY, vncVerbose);
                return 2;
            }
        }
        vncVerbose++;
        LogSetParameter(XLOG_VERBOSITY, vncVerbose);
        return 1;
    }

    if (!strcmp(argv[i], "-quiet")) {
        vncVerbose = -1;
        LogSetParameter(XLOG_VERBOSITY, vncVerbose);
        return 1;
    }

    if (!strcmp(argv[i], "-showconfig") || !strcmp(argv[i], "-version")) {
        vncPrintBanner();
        exit(0);
    }

    if (vncSetParamSimple(argv[i]))
	return 1;
    
    if (argv[i][0] == '-' && i+1 < argc) {
	if (vncSetParam(&argv[i][1], argv[i+1]))
	    return 2;
    }
    
    return 0;
}
コード例 #15
0
ファイル: usl_init.c プロジェクト: Magister/x11rdp_xorg71
int
xf86ProcessArgument(int argc, char *argv[], int i)
{
  /*
   * Keep server from detaching from controlling tty.  This is useful 
   * when debugging (so the server can receive keyboard signals.
   */
  if (!strcmp(argv[i], "-keeptty")) {
    KeepTty = TRUE;
    return(1);
  }

  /*
   * Undocumented flag to protect page 0 from read/write to help
   * catch NULL pointer dereferences.  This is purely a debugging
   * flag.
   */
  if (!strcmp(argv[i], "-protect0")) {
    Protect0 = TRUE;
    return(1);
  }

  if ((argv[i][0] == 'v') && (argv[i][1] == 't')) {
    if (sscanf(argv[i], "vt%2d", &VTnum) == 0) {
      UseMsg();
      VTnum = -1;
      return(0);
    }
    VTnum -= is_osr6();
    CRTSpecified = TRUE;
    return(1);
  }

  /*
   * Use a device the user specifies.
   */
  if (!strcmp(argv[i], "-crt")) {
    if (++i > argc) {
      UseMsg();
      VTnum = -1;
      return(0);
    } else {
      char *mytty = ttyname(0);
      char *arg = argv[i];

      if (!mytty)
	mytty = "\1";
      if (!arg[0])
	arg = "\2";	/* Prevent idiots from using -crt "" */

      if (strcmp (mytty, arg) != 0) {
	char *fmt;

	if (is_osr6())
	  fmt = "/dev/tty%02d";
	else
	  fmt = "/dev/vt%02d";

	if (sscanf(arg, fmt, &VTnum) == 0) {
	  UseMsg();
	  VTnum = -1;
	  return(0);
	}

	/* OSR6 devices start names at 1, UW7 starts at 0 */
	VTnum -= is_osr6();
	CRTSpecified = TRUE;
      }
      return(2);
    }
  }
  return(0);
}
コード例 #16
0
ファイル: InitOutput.c プロジェクト: timon37/xwayland
int
ddxProcessArgument(int argc, char *argv[], int i)
{
    static Bool firstTime = TRUE;
    static int lastScreen = -1;
    vfbScreenInfo *currentScreen;

    if (firstTime)
    {
	vfbInitializePixmapDepths();
        firstTime = FALSE;
    }

    if (lastScreen == -1)
	currentScreen = &defaultScreenInfo;
    else
	currentScreen = &vfbScreens[lastScreen];

#define CHECK_FOR_REQUIRED_ARGUMENTS(num) \
    if (((i + num) >= argc) || (!argv[i + num])) {                      \
      ErrorF("Required argument to %s not specified\n", argv[i]);       \
      UseMsg();                                                         \
      FatalError("Required argument to %s not specified\n", argv[i]);   \
    }
    
    if (strcmp (argv[i], "-screen") == 0)	/* -screen n WxHxD */
    {
	int screenNum;
	CHECK_FOR_REQUIRED_ARGUMENTS(2);
	screenNum = atoi(argv[i+1]);
	/* The protocol only has a CARD8 for number of screens in the
	   connection setup block, so don't allow more than that. */
	if ((screenNum < 0) || (screenNum >= 255))
	{
	    ErrorF("Invalid screen number %d\n", screenNum);
	    UseMsg();
	    FatalError("Invalid screen number %d passed to -screen\n",
		       screenNum);
	}

	if (vfbNumScreens <= screenNum)
	{
	    vfbScreens = realloc(vfbScreens, sizeof(*vfbScreens) * (screenNum + 1));
	    if (!vfbScreens)
		FatalError("Not enough memory for screen %d\n", screenNum);
	    for (; vfbNumScreens <= screenNum; ++vfbNumScreens)
		vfbScreens[vfbNumScreens] = defaultScreenInfo;
	}

	if (3 != sscanf(argv[i+2], "%dx%dx%d",
			&vfbScreens[screenNum].width,
			&vfbScreens[screenNum].height,
			&vfbScreens[screenNum].depth))
	{
	    ErrorF("Invalid screen configuration %s\n", argv[i+2]);
	    UseMsg();
	    FatalError("Invalid screen configuration %s for -screen %d\n",
		   argv[i+2], screenNum);
	}

	lastScreen = screenNum;
	return 3;
    }

    if (strcmp (argv[i], "-pixdepths") == 0)	/* -pixdepths list-of-depth */
    {
	int depth, ret = 1;

	CHECK_FOR_REQUIRED_ARGUMENTS(1);
	while ((++i < argc) && (depth = atoi(argv[i])) != 0)
	{
	    if (depth < 0 || depth > 32)
	    {
		ErrorF("Invalid pixmap depth %d\n", depth);
		UseMsg();
		FatalError("Invalid pixmap depth %d passed to -pixdepths\n",
			   depth);
	    }
	    vfbPixmapDepths[depth] = TRUE;
	    ret++;
	}
	return ret;
    }

    if (strcmp (argv[i], "+render") == 0)	/* +render */
    {
	Render = TRUE;
	return 1;
    }

    if (strcmp (argv[i], "-render") == 0)	/* -render */
    {
	Render = FALSE;
#ifdef COMPOSITE
	noCompositeExtension = TRUE;
#endif
	return 1;
    }

    if (strcmp (argv[i], "-blackpixel") == 0)	/* -blackpixel n */
    {
	CHECK_FOR_REQUIRED_ARGUMENTS(1);
	currentScreen->blackPixel = atoi(argv[++i]);
	return 2;
    }

    if (strcmp (argv[i], "-whitepixel") == 0)	/* -whitepixel n */
    {
	CHECK_FOR_REQUIRED_ARGUMENTS(1);
	currentScreen->whitePixel = atoi(argv[++i]);
	return 2;
    }

    if (strcmp (argv[i], "-linebias") == 0)	/* -linebias n */
    {
	CHECK_FOR_REQUIRED_ARGUMENTS(1);
	currentScreen->lineBias = atoi(argv[++i]);
	return 2;
    }

#ifdef HAVE_MMAP
    if (strcmp (argv[i], "-fbdir") == 0)	/* -fbdir directory */
    {
	CHECK_FOR_REQUIRED_ARGUMENTS(1);
	pfbdir = argv[++i];
	fbmemtype = MMAPPED_FILE_FB;
	return 2;
    }
#endif /* HAVE_MMAP */

#ifdef HAS_SHM
    if (strcmp (argv[i], "-shmem") == 0)	/* -shmem */
    {
	fbmemtype = SHARED_MEMORY_FB;
	return 1;
    }
#endif

    return 0;
}
コード例 #17
0
ファイル: kdrive.c プロジェクト: AmesianX/xorg-server
int
KdProcessArgument(int argc, char **argv, int i)
{
    KdCardInfo *card;
    KdScreenInfo *screen;

    if (!strcmp(argv[i], "-screen")) {
        if ((i + 1) < argc) {
            card = KdCardInfoLast();
            if (!card) {
                InitCard(0);
                card = KdCardInfoLast();
            }
            if (card) {
                screen = KdScreenInfoAdd(card);
                KdParseScreen(screen, argv[i + 1]);
            }
            else
                ErrorF("No matching card found!\n");
        }
        else
            UseMsg();
        return 2;
    }
    if (!strcmp(argv[i], "-zaphod")) {
        kdDisableZaphod = TRUE;
        return 1;
    }
    if (!strcmp(argv[i], "-zap")) {
        kdAllowZap = TRUE;
        return 1;
    }
    if (!strcmp(argv[i], "-3button")) {
        kdEmulateMiddleButton = FALSE;
        return 1;
    }
    if (!strcmp(argv[i], "-2button")) {
        kdEmulateMiddleButton = TRUE;
        return 1;
    }
    if (!strcmp(argv[i], "-rawcoord")) {
        kdRawPointerCoordinates = 1;
        return 1;
    }
    if (!strcmp(argv[i], "-dumb")) {
        kdDumbDriver = TRUE;
        return 1;
    }
    if (!strcmp(argv[i], "-softCursor")) {
        kdSoftCursor = TRUE;
        return 1;
    }
    if (!strcmp(argv[i], "-videoTest")) {
        kdVideoTest = TRUE;
        return 1;
    }
    if (!strcmp(argv[i], "-origin")) {
        if ((i + 1) < argc) {
            char *x = argv[i + 1];
            char *y = strchr(x, ',');

            if (x)
                kdOrigin.x = atoi(x);
            else
                kdOrigin.x = 0;
            if (y)
                kdOrigin.y = atoi(y + 1);
            else
                kdOrigin.y = 0;
        }
        else
            UseMsg();
        return 2;
    }
    if (!strcmp(argv[i], "-rgba")) {
        if ((i + 1) < argc)
            KdParseRgba(argv[i + 1]);
        else
            UseMsg();
        return 2;
    }
    if (!strcmp(argv[i], "-switchCmd")) {
        if ((i + 1) < argc)
            kdSwitchCmd = argv[i + 1];
        else
            UseMsg();
        return 2;
    }
    if (!strncmp(argv[i], "vt", 2) &&
        sscanf(argv[i], "vt%2d", &kdVirtualTerminal) == 1) {
        return 1;
    }
    if (!strcmp(argv[i], "-mouse") || !strcmp(argv[i], "-pointer")) {
        if (i + 1 >= argc)
            UseMsg();
        KdAddConfigPointer(argv[i + 1]);
        kdHasPointer = TRUE;
        return 2;
    }
    if (!strcmp(argv[i], "-keybd")) {
        if (i + 1 >= argc)
            UseMsg();
        KdAddConfigKeyboard(argv[i + 1]);
        kdHasKbd = TRUE;
        return 2;
    }

    return 0;
}
コード例 #18
0
ファイル: kdrive.c プロジェクト: Magister/x11rdp_xorg71
void
KdParseMouse (char *arg)
{
    char	save[1024];
    char	delim;
    KdMouseInfo	*mi;
    int		i;
    
    mi = KdMouseInfoAdd ();
    if (!mi)
	return;
    mi->name = 0;
    mi->prot = 0;
    mi->emulateMiddleButton = kdEmulateMiddleButton;
    mi->transformCoordinates = !kdRawPointerCoordinates;
    mi->nbutton = 3;
    for (i = 0; i < KD_MAX_BUTTON; i++)
	mi->map[i] = i + 1;
    
    if (!arg)
	return;
    if (strlen (arg) >= sizeof (save))
	return;
    arg = KdParseFindNext (arg, ",", save, &delim);
    if (!save[0])
	return;
    mi->name = KdSaveString (save);
    if (delim != ',')
	return;
    
    arg = KdParseFindNext (arg, ",", save, &delim);
    if (!save[0])
	return;
    
    if ('1' <= save[0] && save[0] <= '0' + KD_MAX_BUTTON && save[1] == '\0')
    {
        mi->nbutton = save[0] - '0';
	if (mi->nbutton > KD_MAX_BUTTON)
	{
	    UseMsg ();
	    return;
	}
    }
    
    if (!delim != ',')
	return;
    
    arg = KdParseFindNext (arg, ",", save, &delim);
    
    if (save[0])
	mi->prot = KdSaveString (save);
    
    while (delim == ',')
    {
	arg = KdParseFindNext (arg, ",", save, &delim);
	if (save[0] == '{')
	{
	    char	*s = save + 1;
	    i = 0;
	    while (*s && *s != '}')
	    {
		if ('1' <= *s && *s <= '0' + mi->nbutton)
		    mi->map[i] = *s - '0';
		else
		    UseMsg ();
		s++;
	    }
	}
	else if (!strcmp (save, "2button"))
	    mi->emulateMiddleButton = TRUE;
	else if (!strcmp (save, "3button"))
	    mi->emulateMiddleButton = FALSE;
	else if (!strcmp (save, "rawcoord"))
	    mi->transformCoordinates = FALSE;
	else if (!strcmp (save, "transform"))
	    mi->transformCoordinates = TRUE;
	else
	    UseMsg ();
    }
}
コード例 #19
0
ファイル: kdrive.c プロジェクト: dimkr/tinyxserver
int
KdProcessArgument (int argc, char **argv, int i)
{
    KdCardInfo	    *card;
    KdScreenInfo    *screen;

    if (!strcmp (argv[i], "-card"))
    {
	if ((i+1) < argc)
	    InitCard (argv[i+1]);
	else
	    UseMsg ();
	return 2;
    }
    if (!strcmp (argv[i], "-screen"))
    {
	if ((i+1) < argc)
	{
	    card = KdCardInfoLast ();
	    if (!card)
	    {
		InitCard (0);
		card = KdCardInfoLast ();
	    }
	    screen = KdScreenInfoAdd (card);
	    KdParseScreen (screen, argv[i+1]);
	}
	else
	    UseMsg ();
	return 2;
    }
    if (!strcmp (argv[i], "-zaphod"))
    {
	kdDisableZaphod = TRUE;
	return 1;
    }
    if (!strcmp (argv[i], "-3button"))
    {
	kdEmulateMiddleButton = FALSE;
	return 1;
    }
    if (!strcmp (argv[i], "-2button"))
    {
	kdEmulateMiddleButton = TRUE;
	return 1;
    }
    if (!strcmp (argv[i], "-dumb"))
    {
	kdDumbDriver = TRUE;
	return 1;
    }
    if (!strcmp (argv[i], "-softCursor"))
    {
	kdSoftCursor = TRUE;
	return 1;
    }
    if (!strcmp (argv[i], "-videoTest"))
    {
	kdVideoTest = TRUE;
	return 1;
    }
    if (!strcmp (argv[i], "-standalone"))
	return 1;
    if (!strcmp (argv[i], "-origin"))
    {
	if ((i+1) < argc)
	{
	    char    *x = argv[i+1];
	    char    *y = strchr (x, ',');
	    if (x)
		kdOrigin.x = atoi (x);
	    else
		kdOrigin.x = 0;
	    if (y)
		kdOrigin.y = atoi(y+1);
	    else
		kdOrigin.y = 0;
	}
	else
	    UseMsg ();
	return 2;
    }
    if (!strcmp (argv[i], "-mouse"))
    {
	if ((i+1) < argc)
	    KdParseMouse (argv[i+1]);
	else
	    UseMsg ();
	return 2;
    }
#ifdef PSEUDO8
    return p8ProcessArgument (argc, argv, i);
#else
    return 0;
#endif
}
コード例 #20
0
int
ddxProcessArgument (int argc, char *argv[], int i)
{
  static Bool		s_fBeenHere = FALSE;
  winScreenInfo	*screenInfoPtr = NULL;

  /* Initialize once */
  if (!s_fBeenHere)
    {
#ifdef DDXOSVERRORF
      /*
       * This initialises our hook into VErrorF () for catching log messages
       * that are generated before OsInit () is called.
       */
      OsVendorVErrorFProc = OsVendorVErrorF;
#endif

      s_fBeenHere = TRUE;

      /* Initialize only if option is not -help */
      if (!IS_OPTION("-help") && !IS_OPTION("-h") && !IS_OPTION("--help") &&
          !IS_OPTION("-version") && !IS_OPTION("--version"))
	{

          /* Log the version information */
          winLogVersionInfo ();

          /* Log the command line */
          winLogCommandLine (argc, argv);

	  /*
	   * Initialize default screen settings.  We have to do this before
	   * OsVendorInit () gets called, otherwise we will overwrite
	   * settings changed by parameters such as -fullscreen, etc.
	   */
	  winErrorFVerb (2, "ddxProcessArgument - Initializing default "
			 "screens\n");
	  winInitializeScreenDefaults();
	}
    }

#if CYGDEBUG
  winDebug ("ddxProcessArgument - arg: %s\n", argv[i]);
#endif

  /*
   * Look for the '-help' and similar options
   */ 
  if (IS_OPTION ("-help") || IS_OPTION("-h") || IS_OPTION("--help"))
    {
      /* Reset logfile. We don't need that helpmessage in the logfile */  
      g_pszLogFile = NULL;
      g_fNoHelpMessageBox = TRUE;
      UseMsg();
      exit (0);
      return 1;
    }

  if (IS_OPTION ("-version") || IS_OPTION("--version"))
    {
      /* Reset logfile. We don't need that versioninfo in the logfile */  
      g_pszLogFile = NULL;
      winLogVersionInfo ();
      exit (0);
      return 1;
    }

  /*
   * Look for the '-screen scr_num [width height]' argument
   */
  if (IS_OPTION ("-screen"))
    {
      int		iArgsProcessed = 1;
      int		nScreenNum;
      int		iWidth, iHeight, iX, iY;
      int		iMonitor;

#if CYGDEBUG
      winDebug ("ddxProcessArgument - screen - argc: %d i: %d\n",
	      argc, i);
#endif

      /* Display the usage message if the argument is malformed */
      if (i + 1 >= argc)
	{
	  return 0;
	}
      
      /* Grab screen number */
      nScreenNum = atoi (argv[i + 1]);

      /* Validate the specified screen number */
      if (nScreenNum < 0)
        {
          ErrorF ("ddxProcessArgument - screen - Invalid screen number %d\n",
		  nScreenNum);
          UseMsg ();
	  return 0;
        }

      /*
        Initialize default values for any new screens

        Note that default values can't change after a -screen option is
        seen, so it's safe to do this for each screen as it is introduced
      */
      winInitializeScreens(nScreenNum+1);

	  /* look for @m where m is monitor number */
	  if (i + 2 < argc
		  && 1 == sscanf(argv[i + 2], "@%d", (int *) &iMonitor)) 
      {
        struct GetMonitorInfoData data;
        if (!QueryMonitor(iMonitor, &data))
        {
            ErrorF ("ddxProcessArgument - screen - "
                    "Querying monitors is not supported on NT4 and Win95\n");
        } else if (data.bMonitorSpecifiedExists == TRUE) 
        {
		  winErrorFVerb(2, "ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n", iMonitor);
		  iArgsProcessed = 3;
		  g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = FALSE;
		  g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE;
		  g_ScreenInfo[nScreenNum].dwWidth = data.monitorWidth;
		  g_ScreenInfo[nScreenNum].dwHeight = data.monitorHeight;
		  g_ScreenInfo[nScreenNum].dwUserWidth = data.monitorWidth;
		  g_ScreenInfo[nScreenNum].dwUserHeight = data.monitorHeight;
		  g_ScreenInfo[nScreenNum].dwInitialX = data.monitorOffsetX;
		  g_ScreenInfo[nScreenNum].dwInitialY = data.monitorOffsetY;
		}
		else 
        {
		  /* monitor does not exist, error out */
		  ErrorF ("ddxProcessArgument - screen - Invalid monitor number %d\n",
				  iMonitor);
		  UseMsg ();
		  exit (0);
		  return 0;
		}
	  }

      /* Look for 'WxD' or 'W D' */
      else if (i + 2 < argc
	  && 2 == sscanf (argv[i + 2], "%dx%d",
			  (int *) &iWidth,
			  (int *) &iHeight))
	{
	  winErrorFVerb (2, "ddxProcessArgument - screen - Found ``WxD'' arg\n");
	  iArgsProcessed = 3;
	  g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = TRUE;
	  g_ScreenInfo[nScreenNum].dwWidth = iWidth;
	  g_ScreenInfo[nScreenNum].dwHeight = iHeight;
	  g_ScreenInfo[nScreenNum].dwUserWidth = iWidth;
	  g_ScreenInfo[nScreenNum].dwUserHeight = iHeight;
	  /* Look for WxD+X+Y */
	  if (2 == sscanf (argv[i + 2], "%*dx%*d+%d+%d",
			   (int *) &iX,
			   (int *) &iY))
	  {
	    winErrorFVerb (2, "ddxProcessArgument - screen - Found ``X+Y'' arg\n");
	    g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE;
	    g_ScreenInfo[nScreenNum].dwInitialX = iX;
	    g_ScreenInfo[nScreenNum].dwInitialY = iY;

		/* look for WxD+X+Y@m where m is monitor number. take X,Y to be offsets from monitor's root position */
		if (1 == sscanf (argv[i + 2], "%*dx%*d+%*d+%*d@%d",
						 (int *) &iMonitor)) 
        {
          struct GetMonitorInfoData data;
          if (!QueryMonitor(iMonitor, &data))
          {
              ErrorF ("ddxProcessArgument - screen - "
                      "Querying monitors is not supported on NT4 and Win95\n");
          } else if (data.bMonitorSpecifiedExists == TRUE) 
          {
			g_ScreenInfo[nScreenNum].dwInitialX += data.monitorOffsetX;
			g_ScreenInfo[nScreenNum].dwInitialY += data.monitorOffsetY;
		  }
		  else 
          {
			/* monitor does not exist, error out */
			ErrorF ("ddxProcessArgument - screen - Invalid monitor number %d\n",
					iMonitor);
			UseMsg ();
			exit (0);
			return 0;
		  }

		}
	  }

	  /* look for WxD@m where m is monitor number */
	  else if (1 == sscanf(argv[i + 2], "%*dx%*d@%d",
						   (int *) &iMonitor)) 
      {
        struct GetMonitorInfoData data;
        if (!QueryMonitor(iMonitor, &data))
        {
		  ErrorF ("ddxProcessArgument - screen - "
                  "Querying monitors is not supported on NT4 and Win95\n");
        } else if (data.bMonitorSpecifiedExists == TRUE) 
        {
		  winErrorFVerb (2, "ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n", iMonitor);
		  g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE;
		  g_ScreenInfo[nScreenNum].dwInitialX = data.monitorOffsetX;
		  g_ScreenInfo[nScreenNum].dwInitialY = data.monitorOffsetY;
		}
		else 
        {
		  /* monitor does not exist, error out */
		  ErrorF ("ddxProcessArgument - screen - Invalid monitor number %d\n",
				  iMonitor);
		  UseMsg ();
		  exit (0);
		  return 0;
		}

	  }
	}
      else if (i + 3 < argc
	       && 1 == sscanf (argv[i + 2], "%d",
			       (int *) &iWidth)
	       && 1 == sscanf (argv[i + 3], "%d",
			       (int *) &iHeight))
	{
	  winErrorFVerb (2, "ddxProcessArgument - screen - Found ``W D'' arg\n");
	  iArgsProcessed = 4;
	  g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = TRUE;
	  g_ScreenInfo[nScreenNum].dwWidth = iWidth;
	  g_ScreenInfo[nScreenNum].dwHeight = iHeight;
	  g_ScreenInfo[nScreenNum].dwUserWidth = iWidth;
	  g_ScreenInfo[nScreenNum].dwUserHeight = iHeight;
	  if (i + 5 < argc
	      && 1 == sscanf (argv[i + 4], "%d",
			      (int *) &iX)
	      && 1 == sscanf (argv[i + 5], "%d",
			      (int *) &iY))
	  {
	    winErrorFVerb (2, "ddxProcessArgument - screen - Found ``X Y'' arg\n");
	    iArgsProcessed = 6;
	    g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE;
	    g_ScreenInfo[nScreenNum].dwInitialX = iX;
	    g_ScreenInfo[nScreenNum].dwInitialY = iY;
	  }
	}
      else
	{
	  winErrorFVerb (2, "ddxProcessArgument - screen - Did not find size arg. "
		  "dwWidth: %d dwHeight: %d\n",
		  (int) g_ScreenInfo[nScreenNum].dwWidth,
		  (int) g_ScreenInfo[nScreenNum].dwHeight);
	  iArgsProcessed = 2;
	  g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = FALSE;
	}

      /* Calculate the screen width and height in millimeters */
      if (g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth)
	{
	  g_ScreenInfo[nScreenNum].dwWidth_mm
	    = (g_ScreenInfo[nScreenNum].dwWidth
	       / monitorResolution) * 25.4;
	  g_ScreenInfo[nScreenNum].dwHeight_mm
	    = (g_ScreenInfo[nScreenNum].dwHeight
	       / monitorResolution) * 25.4;
	}

      /* Flag that this screen was explicity specified by the user */
      g_ScreenInfo[nScreenNum].fExplicitScreen = TRUE;

      /*
       * Keep track of the last screen number seen, as parameters seen
       * before a screen number apply to all screens, whereas parameters
       * seen after a screen number apply to that screen number only.
       */
      iLastScreen = nScreenNum;

      return iArgsProcessed;
    }


  /*
   * Is this parameter attached to a screen or global?
   *
   * If the parameter is for all screens (appears before
   * any -screen option), store it in the default screen
   * info
   *
   * If the parameter is for a single screen (appears
   * after a -screen option), store it in the screen info
   * for that screen
   *
   */
  if (iLastScreen == -1)
    {
      screenInfoPtr = &defaultScreenInfo;
    }
  else
    {
      screenInfoPtr = &(g_ScreenInfo[iLastScreen]);
    }

  /*
   * Look for the '-engine n' argument
   */
  if (IS_OPTION ("-engine"))
    {
      DWORD		dwEngine = 0;
      CARD8		c8OnBits = 0;
      
      /* Display the usage message if the argument is malformed */
      if (++i >= argc)
	{
	  UseMsg ();
	  return 0;
	}

      /* Grab the argument */
      dwEngine = atoi (argv[i]);

      /* Count the one bits in the engine argument */
      c8OnBits = winCountBits (dwEngine);

      /* Argument should only have a single bit on */
      if (c8OnBits != 1)
	{
	  UseMsg ();
	  return 0;
	}

      screenInfoPtr->dwEnginePreferred = dwEngine;
      
      /* Indicate that we have processed the argument */
      return 2;
    }

  /*
   * Look for the '-fullscreen' argument
   */
  if (IS_OPTION ("-fullscreen"))
    {
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
          if (!screenInfoPtr->fMultiMonitorOverride)
            screenInfoPtr->fMultipleMonitors = FALSE;
#endif
	  screenInfoPtr->fFullScreen = TRUE;

      /* Indicate that we have processed this argument */
      return 1;
    }

  /*
   * Look for the '-lesspointer' argument
   */
  if (IS_OPTION ("-lesspointer"))
    {
      screenInfoPtr->fLessPointer = TRUE;

      /* Indicate that we have processed this argument */
      return 1;
    }

  /*
   * Look for the '-nodecoration' argument
   */
  if (IS_OPTION ("-nodecoration"))
    {
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
      if (!screenInfoPtr->fMultiMonitorOverride)
        screenInfoPtr->fMultipleMonitors = FALSE;
#endif
      screenInfoPtr->fDecoration = FALSE;

      /* Indicate that we have processed this argument */
      return 1;
    }

#ifdef XWIN_MULTIWINDOWEXTWM
  /*
   * Look for the '-mwextwm' argument
   */
  if (IS_OPTION ("-mwextwm"))
    {
      if (!screenInfoPtr->fMultiMonitorOverride)
        screenInfoPtr->fMultipleMonitors = TRUE;
      screenInfoPtr->fMWExtWM = TRUE;

      /* Indicate that we have processed this argument */
      return 1;
    }
  /*
   * Look for the '-internalwm' argument
   */
  if (IS_OPTION ("-internalwm"))
    {
      if (!screenInfoPtr->fMultiMonitorOverride)
        screenInfoPtr->fMultipleMonitors = TRUE;
      screenInfoPtr->fMWExtWM = TRUE;
      screenInfoPtr->fInternalWM = TRUE;

      /* Indicate that we have processed this argument */
      return 1;
    }
#endif

  /*
   * Look for the '-rootless' argument
   */
  if (IS_OPTION ("-rootless"))
    {
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
      if (!screenInfoPtr->fMultiMonitorOverride)
        screenInfoPtr->fMultipleMonitors = FALSE;
#endif
      screenInfoPtr->fRootless = TRUE;

      /* Indicate that we have processed this argument */
      return 1;
    }

#ifdef XWIN_MULTIWINDOW
  /*
   * Look for the '-multiwindow' argument
   */
  if (IS_OPTION ("-multiwindow"))
    {
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
      if (!screenInfoPtr->fMultiMonitorOverride)
        screenInfoPtr->fMultipleMonitors = TRUE;
#endif
      screenInfoPtr->fMultiWindow = TRUE;

      /* Indicate that we have processed this argument */
      return 1;
    }
#endif

  /*
   * Look for the '-multiplemonitors' argument
   */
  if (IS_OPTION ("-multiplemonitors")
      || IS_OPTION ("-multimonitors"))
    {
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
      screenInfoPtr->fMultiMonitorOverride = TRUE;
#endif
      screenInfoPtr->fMultipleMonitors = TRUE;

      /* Indicate that we have processed this argument */
      return 1;
    }

  /*
   * Look for the '-nomultiplemonitors' argument
   */
  if (IS_OPTION ("-nomultiplemonitors")
      || IS_OPTION ("-nomultimonitors"))
    {
#if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM)
      screenInfoPtr->fMultiMonitorOverride = TRUE;
#endif
      screenInfoPtr->fMultipleMonitors = FALSE;

      /* Indicate that we have processed this argument */
      return 1;
    }


  /*
   * Look for the '-scrollbars' argument
   */
  if (IS_OPTION ("-scrollbars"))
    {
      screenInfoPtr->fScrollbars = TRUE;

      /* Indicate that we have processed this argument */
      return 1;
    }


#ifdef XWIN_CLIPBOARD
  /*
   * Look for the '-clipboard' argument
   */
  if (IS_OPTION ("-clipboard"))
    {
      /* Now the default, we still accept the arg for backwards compatibility */
      g_fClipboard = TRUE;

      /* Indicate that we have processed this argument */
      return 1;
    }

  /*
   * Look for the '-noclipboard' argument
   */
  if (IS_OPTION ("-noclipboard"))
    {
      g_fClipboard = FALSE;

      /* Indicate that we have processed this argument */
      return 1;
    }
#endif


  /*
   * Look for the '-ignoreinput' argument
   */
  if (IS_OPTION ("-ignoreinput"))
    {
      screenInfoPtr->fIgnoreInput = TRUE;

      /* Indicate that we have processed this argument */
      return 1;
    }

  /*
   * Look for the '-emulate3buttons' argument
   */
  if (IS_OPTION ("-emulate3buttons"))
    {
      int	iArgsProcessed = 1;
      int	iE3BTimeout = WIN_DEFAULT_E3B_TIME;

      /* Grab the optional timeout value */
      if (i + 1 < argc
	  && 1 == sscanf (argv[i + 1], "%d",
			  &iE3BTimeout))
        {
	  /* Indicate that we have processed the next argument */
	  iArgsProcessed++;
        }
      else
	{
	  /*
	   * sscanf () won't modify iE3BTimeout if it doesn't find
	   * the specified format; however, I want to be explicit
	   * about setting the default timeout in such cases to
	   * prevent some programs (me) from getting confused.
	   */
	  iE3BTimeout = WIN_DEFAULT_E3B_TIME;
	}

      screenInfoPtr->iE3BTimeout = iE3BTimeout;

      /* Indicate that we have processed this argument */
      return iArgsProcessed;
    }

  /*
   * Look for the '-depth n' argument
   */
  if (IS_OPTION ("-depth"))
    {
      DWORD		dwBPP = 0;
      
      /* Display the usage message if the argument is malformed */
      if (++i >= argc)
	{
	  UseMsg ();
	  return 0;
	}

      /* Grab the argument */
      dwBPP = atoi (argv[i]);

      screenInfoPtr->dwBPP = dwBPP;

      /* Indicate that we have processed the argument */
      return 2;
    }

  /*
   * Look for the '-refresh n' argument
   */
  if (IS_OPTION ("-refresh"))
    {
      DWORD		dwRefreshRate = 0;
      
      /* Display the usage message if the argument is malformed */
      if (++i >= argc)
	{
	  UseMsg ();
	  return 0;
	}

      /* Grab the argument */
      dwRefreshRate = atoi (argv[i]);

      screenInfoPtr->dwRefreshRate = dwRefreshRate;

      /* Indicate that we have processed the argument */
      return 2;
    }

  /*
   * Look for the '-clipupdates num_boxes' argument
   */
  if (IS_OPTION ("-clipupdates"))
    {
      DWORD		dwNumBoxes = 0;
      
      /* Display the usage message if the argument is malformed */
      if (++i >= argc)
	{
	  UseMsg ();
	  return 0;
	}

      /* Grab the argument */
      dwNumBoxes = atoi (argv[i]);

      screenInfoPtr->dwClipUpdatesNBoxes = dwNumBoxes;

      /* Indicate that we have processed the argument */
      return 2;
    }

#ifdef XWIN_EMULATEPSEUDO
  /*
   * Look for the '-emulatepseudo' argument
   */
  if (IS_OPTION ("-emulatepseudo"))
    {
      screenInfoPtr->fEmulatePseudo = TRUE;

      /* Indicate that we have processed this argument */
      return 1;
    }
#endif

  /*
   * Look for the '-nowinkill' argument
   */
  if (IS_OPTION ("-nowinkill"))
    {
      screenInfoPtr->fUseWinKillKey = FALSE;

      /* Indicate that we have processed this argument */
      return 1;
    }

  /*
   * Look for the '-winkill' argument
   */
  if (IS_OPTION ("-winkill"))
    {
      screenInfoPtr->fUseWinKillKey = TRUE;

      /* Indicate that we have processed this argument */
      return 1;
    }

  /*
   * Look for the '-nounixkill' argument
   */
  if (IS_OPTION ("-nounixkill"))
    {
      screenInfoPtr->fUseUnixKillKey = FALSE;

      /* Indicate that we have processed this argument */
      return 1;
    }

  /*
   * Look for the '-unixkill' argument
   */
  if (IS_OPTION ("-unixkill"))
    {
      screenInfoPtr->fUseUnixKillKey = TRUE;

      /* Indicate that we have processed this argument */
      return 1;
    }

  /*
   * Look for the '-notrayicon' argument
   */
  if (IS_OPTION ("-notrayicon"))
    {
      screenInfoPtr->fNoTrayIcon = TRUE;

      /* Indicate that we have processed this argument */
      return 1;
    }

  /*
   * Look for the '-trayicon' argument
   */
  if (IS_OPTION ("-trayicon"))
    {
      screenInfoPtr->fNoTrayIcon = FALSE;

      /* Indicate that we have processed this argument */
      return 1;
    }

  /*
   * Look for the '-fp' argument
   */
  if (IS_OPTION ("-fp"))
    {
      CHECK_ARGS (1);
      g_cmdline.fontPath = argv[++i];
      return 0; /* Let DIX parse this again */
    }

  /*
   * Look for the '-query' argument
   */
  if (IS_OPTION ("-query"))
    {
      CHECK_ARGS (1);
      g_fXdmcpEnabled = TRUE;
      g_pszQueryHost = argv[++i];
      return 0; /* Let DIX parse this again */
    }

  /*
   * Look for the '-auth' argument
   */
  if (IS_OPTION ("-auth"))
    {
      g_fAuthEnabled = TRUE;
      return 0; /* Let DIX parse this again */
    }

  /*
   * Look for the '-indirect' or '-broadcast' arguments
   */
  if (IS_OPTION ("-indirect")
      || IS_OPTION ("-broadcast"))
    {
      g_fXdmcpEnabled = TRUE;
      return 0; /* Let DIX parse this again */
    }

  /*
   * Look for the '-config' argument
   */
  if (IS_OPTION ("-config")
      || IS_OPTION ("-xf86config"))
    {
      CHECK_ARGS (1);
#ifdef XWIN_XF86CONFIG
      g_cmdline.configFile = argv[++i];
#else
      winMessageBoxF ("The %s option is not supported in this "
		      "release.\n"
		      "Ignoring this option and continuing.\n",
		      MB_ICONINFORMATION,
		      argv[i]);
#endif
      return 2;
    }

  /*
   * Look for the '-configdir' argument
   */
  if (IS_OPTION ("-configdir"))
    {
      CHECK_ARGS (1);
#ifdef XWIN_XF86CONFIG
      g_cmdline.configDir = argv[++i];
#else
      winMessageBoxF ("The %s option is not supported in this "
		      "release.\n"
		      "Ignoring this option and continuing.\n",
		      MB_ICONINFORMATION,
		      argv[i]);
#endif
      return 2;
    }

  /*
   * Look for the '-keyboard' argument
   */
  if (IS_OPTION ("-keyboard"))
    {
#ifdef XWIN_XF86CONFIG
      CHECK_ARGS (1);
      g_cmdline.keyboard = argv[++i];
#else
      winMessageBoxF ("The -keyboard option is not supported in this "
		      "release.\n"
		      "Ignoring this option and continuing.\n",
		      MB_ICONINFORMATION);
#endif
      return 2;
    }

  /*
   * Look for the '-logfile' argument
   */
  if (IS_OPTION ("-logfile"))
    {
      CHECK_ARGS (1);
      g_pszLogFile = argv[++i];
#ifdef RELOCATE_PROJECTROOT
      g_fLogFileChanged = TRUE;
#endif
      return 2;
    }

  /*
   * Look for the '-logverbose' argument
   */
  if (IS_OPTION ("-logverbose"))
    {
      CHECK_ARGS (1);
      g_iLogVerbose = atoi(argv[++i]);
      return 2;
    }

#ifdef XWIN_CLIPBOARD
  /*
   * Look for the '-nounicodeclipboard' argument
   */
  if (IS_OPTION ("-nounicodeclipboard"))
    {
      g_fUnicodeClipboard = FALSE;
      /* Indicate that we have processed the argument */
      return 1;
    }
#endif

  if (IS_OPTION ("-xkbrules"))
    {
      CHECK_ARGS (1);
      g_cmdline.xkbRules = argv[++i];
      return 2;
    }
  if (IS_OPTION ("-xkbmodel"))
    {
      CHECK_ARGS (1);
      g_cmdline.xkbModel = argv[++i];
      return 2;
    }
  if (IS_OPTION ("-xkblayout"))
    {
      CHECK_ARGS (1);
      g_cmdline.xkbLayout = argv[++i];
      return 2;
    }
  if (IS_OPTION ("-xkbvariant"))
    {
      CHECK_ARGS (1);
      g_cmdline.xkbVariant = argv[++i];
      return 2;
    }
  if (IS_OPTION ("-xkboptions"))
    {
      CHECK_ARGS (1);
      g_cmdline.xkbOptions = argv[++i];
      return 2;
    }

  if (IS_OPTION ("-keyhook"))
    {
      g_fKeyboardHookLL = TRUE;
      return 1;
    }
  
  if (IS_OPTION ("-nokeyhook"))
    {
      g_fKeyboardHookLL = FALSE;
      return 1;
    }
  
  if (IS_OPTION ("-swcursor"))
    {
      g_fSoftwareCursor = TRUE;
      return 1;
    }
  
  if (IS_OPTION ("-silent-dup-error"))
    {
      g_fSilentDupError = TRUE;
      return 1;
    }

  if (IS_OPTION("-wgl"))
    {
      g_fNativeGl = TRUE;
      return 1;
    }

  if (IS_OPTION("-nowgl"))
    {
      g_fNativeGl = FALSE;
      return 1;
    }

  return 0;
}
コード例 #21
0
ファイル: kdrive.c プロジェクト: dikerex/theqvd
int
KdProcessArgument (int argc, char **argv, int i)
{
    KdCardInfo	    *card;
    KdScreenInfo    *screen;

    if (!strcmp (argv[i], "-card"))
    {
	if ((i+1) < argc)
	    InitCard (argv[i+1]);
	else
	    UseMsg ();
	return 2;
    }
    if (!strcmp (argv[i], "-screen"))
    {
	if ((i+1) < argc)
	{
	    card = KdCardInfoLast ();
	    if (!card)
	    {
		InitCard (0);
		card = KdCardInfoLast ();
	    }
	    if (card) {
		screen = KdScreenInfoAdd (card);
		KdParseScreen (screen, argv[i+1]);
	    } else
		ErrorF("No matching card found!\n");
	}
	else
	    UseMsg ();
	return 2;
    }
    if (!strcmp (argv[i], "-zaphod"))
    {
	kdDisableZaphod = TRUE;
	return 1;
    }
    if (!strcmp (argv[i], "-3button"))
    {
	kdEmulateMiddleButton = FALSE;
	return 1;
    }
    if (!strcmp (argv[i], "-2button"))
    {
	kdEmulateMiddleButton = TRUE;
	return 1;
    }
    if (!strcmp (argv[i], "-dumb"))
    {
	kdDumbDriver = TRUE;
	return 1;
    }
    if (!strcmp (argv[i], "-softCursor"))
    {
	kdSoftCursor = TRUE;
	return 1;
    }
    if (!strcmp (argv[i], "-videoTest"))
    {
	kdVideoTest = TRUE;
	return 1;
    }
    if (!strcmp (argv[i], "-origin"))
    {
	if ((i+1) < argc)
	{
	    char    *x = argv[i+1];
	    char    *y = strchr (x, ',');
	    if (x)
		kdOrigin.x = atoi (x);
	    else
		kdOrigin.x = 0;
	    if (y)
		kdOrigin.y = atoi(y+1);
	    else
		kdOrigin.y = 0;
	}
	else
	    UseMsg ();
	return 2;
    }
    if (!strcmp (argv[i], "-mouse"))
    {
	if ((i+1) < argc)
	    KdParseMouse (argv[i+1]);
	else
	    UseMsg ();
	return 2;
    }
    if (!strcmp (argv[i], "-rgba"))
    {
	if ((i+1) < argc)
	    KdParseRgba (argv[i+1]);
	else
	    UseMsg ();
	return 2;
    }
    if (!strncmp (argv[i], "vt", 2) &&
	sscanf (argv[i], "vt%2d", &kdVirtualTerminal) == 1)
    {
	return 1;
    }
#ifdef PSEUDO8
    return p8ProcessArgument (argc, argv, i);
#else
    return 0;
#endif
}