|
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 |
} |