View | Details | Raw Unified | Return to bug 137374
Collapse All | Expand All

(-)Imakefile (+2 lines)
Lines 79-84 Link Here
79
79
80
SRCS =	\
80
SRCS =	\
81
	xf86Configure.c \
81
	xf86Configure.c \
82
	xf86ShowOpts.c \
82
	xf86Bus.c \
83
	xf86Bus.c \
83
	xf86isaBus.c \
84
	xf86isaBus.c \
84
	xf86pciBus.c \
85
	xf86pciBus.c \
Lines 120-125 Link Here
120
121
121
OBJS = \
122
OBJS = \
122
	xf86Configure.o \
123
	xf86Configure.o \
124
	xf86ShowOpts.o \
123
	xf86Bus.o \
125
	xf86Bus.o \
124
	xf86isaBus.o \
126
	xf86isaBus.o \
125
	xf86pciBus.o \
127
	xf86pciBus.o \
(-)xf86.h (+1 lines)
Lines 53-58 Link Here
53
53
54
/* General parameters */
54
/* General parameters */
55
extern int xf86DoConfigure;
55
extern int xf86DoConfigure;
56
extern int xf86DoShowOptions;
56
extern Bool xf86DoConfigurePass1;
57
extern Bool xf86DoConfigurePass1;
57
extern int xf86ScreenIndex;		/* Index into pScreen.devPrivates */
58
extern int xf86ScreenIndex;		/* Index into pScreen.devPrivates */
58
extern int xf86CreateRootWindowIndex;	/* Index into pScreen.devPrivates */
59
extern int xf86CreateRootWindowIndex;	/* Index into pScreen.devPrivates */
(-)xf86Globals.c (+1 lines)
Lines 189-194 Link Here
189
Bool xf86ProbeFailed = FALSE;
189
Bool xf86ProbeFailed = FALSE;
190
Bool xf86DoProbe = FALSE;
190
Bool xf86DoProbe = FALSE;
191
Bool xf86DoConfigure = FALSE;
191
Bool xf86DoConfigure = FALSE;
192
Bool xf86DoShowOptions = FALSE;
192
#ifdef XFree86LOADER
193
#ifdef XFree86LOADER
193
DriverPtr *xf86DriverList = NULL;
194
DriverPtr *xf86DriverList = NULL;
194
int xf86NumDrivers = 0;
195
int xf86NumDrivers = 0;
(-)xf86Init.c (-1 / +14 lines)
Lines 323-329 Link Here
323
    }
323
    }
324
324
325
    /* Read and parse the config file */
325
    /* Read and parse the config file */
326
    if (!xf86DoProbe && !xf86DoConfigure) {
326
    if (!xf86DoProbe && !xf86DoConfigure && !xf86DoShowOptions) {
327
      switch (xf86HandleConfigFile(FALSE)) {
327
      switch (xf86HandleConfigFile(FALSE)) {
328
      case CONFIG_OK:
328
      case CONFIG_OK:
329
	break;
329
	break;
Lines 385-390 Link Here
385
    
385
    
386
#endif
386
#endif
387
387
388
	if (xf86DoShowOptions)        
389
	DoShowOptions();
390
388
    xf86OpenConsole();
391
    xf86OpenConsole();
389
392
390
    /* Do a general bus probe.  This will be a PCI probe for x86 platforms */
393
    /* Do a general bus probe.  This will be a PCI probe for x86 platforms */
Lines 1687-1692 Link Here
1687
    xf86AllowMouseOpenFail = TRUE;
1690
    xf86AllowMouseOpenFail = TRUE;
1688
    return 1;
1691
    return 1;
1689
  }
1692
  }
1693
  if (!strcmp(argv[i], "-showopts"))
1694
  {
1695
    if (getuid() != 0 && geteuid == 0) {
1696
    ErrorF("The '-showopts' option can only be used by root.\n");
1697
    exit(1);
1698
    }
1699
    xf86DoShowOptions = TRUE;
1700
    return 1;
1701
  }
1690
  if (!strcmp(argv[i], "-isolateDevice"))
1702
  if (!strcmp(argv[i], "-isolateDevice"))
1691
  {
1703
  {
1692
    int bus, device, func;
1704
    int bus, device, func;
Lines 1729-1734 Link Here
1729
    ErrorF("-modulepath paths      specify the module search path\n");
1741
    ErrorF("-modulepath paths      specify the module search path\n");
1730
    ErrorF("-logfile file          specify a log file name\n");
1742
    ErrorF("-logfile file          specify a log file name\n");
1731
    ErrorF("-configure             probe for devices and write an "__XCONFIGFILE__"\n");
1743
    ErrorF("-configure             probe for devices and write an "__XCONFIGFILE__"\n");
1744
	ErrorF("-showopts              print available options for all installed drivers\n");
1732
  }
1745
  }
1733
  ErrorF("-config file           specify a configuration file, relative to the\n");
1746
  ErrorF("-config file           specify a configuration file, relative to the\n");
1734
  ErrorF("                       "__XCONFIGFILE__" search path, only root can use absolute\n");
1747
  ErrorF("                       "__XCONFIGFILE__" search path, only root can use absolute\n");
(-)xf86Priv.h (+1 lines)
Lines 174-179 Link Here
174
void DoProbeArgs(int argc, char **argv, int i);
174
void DoProbeArgs(int argc, char **argv, int i);
175
void DoProbe(void);
175
void DoProbe(void);
176
void DoConfigure(void);
176
void DoConfigure(void);
177
void DoShowOptions(void);
177
178
178
/* xf86Events.c */
179
/* xf86Events.c */
(-)/dev/null (+129 lines)
Added Link Here
1
/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86ShopwOpts.c,v 3.80 2003/10/08 14:58:27 dawes Exp $ */
2
/*
3
 * Copyright 2000-2002 by Alan Hourihane, Flint Mountain, North Wales.
4
 *
5
 * Permission to use, copy, modify, distribute, and sell this software and its
6
 * documentation for any purpose is hereby granted without fee, provided that
7
 * the above copyright notice appear in all copies and that both that
8
 * copyright notice and this permission notice appear in supporting
9
 * documentation, and that the name of Alan Hourihane not be used in
10
 * advertising or publicity pertaining to distribution of the software without
11
 * specific, written prior permission.  Alan Hourihane makes no representations
12
 * about the suitability of this software for any purpose.  It is provided
13
 * "as is" without express or implied warranty.
14
 *
15
 * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
17
 * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
19
 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
20
 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21
 * PERFORMANCE OF THIS SOFTWARE.
22
 *
23
 * Author:  Marcus Schaefer, ms@suse.de
24
 *
25
 */
26
27
#include <ctype.h>
28
#include <stdlib.h>
29
#include <unistd.h>
30
#include <sys/types.h>
31
#include <sys/stat.h>
32
#include <fcntl.h>
33
#include <X11/X.h>
34
#include <X11/Xmd.h>
35
#include "os.h"
36
#ifdef XFree86LOADER
37
#include "loaderProcs.h"
38
#endif
39
#include "xf86.h"
40
#include "xf86Config.h"
41
#include "xf86_OSlib.h"
42
#include "xf86Priv.h"
43
#include "xf86PciData.h"
44
#define IN_XSERVER
45
#include "xf86Parser.h"
46
#include "xf86tokens.h"
47
#include "Configint.h"
48
#include "vbe.h"
49
#include "xf86DDC.h"
50
#if defined(__sparc__) && !defined(__OpenBSD__)
51
#include "xf86Bus.h"
52
#include "xf86Sbus.h"
53
#endif
54
#include "globals.h"
55
56
static const char* 
57
optionTypeToSting(OptionValueType type)
58
{
59
    switch (type) {
60
    case OPTV_NONE:
61
        return "";
62
    case OPTV_INTEGER:
63
        return "<int>";
64
    case OPTV_STRING:
65
        return "<str>";
66
    case OPTV_ANYSTR:
67
        return "<str>";
68
    case OPTV_REAL:
69
        return "<real>";
70
    case OPTV_BOOLEAN:
71
        return "<bool>";
72
    case OPTV_FREQ:
73
        return "<freq>";
74
    default:
75
        return "<undef>";
76
    }
77
}
78
79
void DoShowOptions (void) {
80
	int  i = 0;
81
	char **vlist  = 0;
82
	char *pSymbol = 0;
83
	XF86ModuleData *initData = 0;
84
	if (! (vlist = xf86DriverlistFromCompile())) {
85
		ErrorF("Missing output drivers\n");
86
		goto bail;
87
	}
88
	xf86LoadModules (vlist,0);
89
	xfree (vlist);
90
	for (i = 0; i < xf86NumDrivers; i++) {
91
		if (xf86DriverList[i]->AvailableOptions) {
92
			OptionInfoPtr pOption = (OptionInfoPtr)(*xf86DriverList[i]->AvailableOptions)(0,0);
93
			if (! pOption) {
94
				ErrorF ("(EE) Couldn't read option table for %s driver\n",
95
					xf86DriverList[i]->driverName
96
				);
97
				continue;                                                       
98
			}
99
			pSymbol = xalloc (
100
				strlen(xf86DriverList[i]->driverName) + strlen("ModuleData") + 1
101
			);
102
			strcpy (pSymbol, xf86DriverList[i]->driverName);
103
			strcat (pSymbol, "ModuleData");
104
			initData = LoaderSymbol (pSymbol);
105
			if (initData) {
106
				XF86ModuleVersionInfo *vers = initData->vers;
107
				ErrorF ("Driver[%d]:%s[%s] {\n",
108
					i,xf86DriverList[i]->driverName,vers->vendor
109
				);
110
				OptionInfoPtr p;
111
				for (p = pOption; p->name != NULL; p++) {
112
					const char *opttype = optionTypeToSting(p->type);
113
					char *optname = xalloc(strlen(p->name) + 2 + 1);
114
					if (!optname) {
115
						continue;                      
116
					}
117
					sprintf(optname, "%s", p->name);
118
					ErrorF ("\t%s:%s\n", optname,opttype);
119
				}
120
				ErrorF ("}\n");
121
			}
122
		}
123
	}
124
	bail:
125
	OsCleanup (TRUE);                             
126
	AbortDDX ();                                                           
127
	fflush (stderr);                        
128
	exit (0);
129
}

Return to bug 137374