/*
*
* Copyright (c) 1997 Metro Link Incorporated
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* Except as contained in this notice, the name of the Metro Link shall not be
* used in advertising or otherwise to promote the sale, use or other dealings
* in this Software without prior written authorization from Metro Link.
*
*/
/*
* Copyright (c) 1997-2003 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
#include <math.h>
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf86Parser.h"
#include "xf86tokens.h"
#include "Configint.h"
#include "fields.h" /* Config file output line fields */
#if defined(SMI_FBCONFIG)
#include "fbc_edit_config.h" /* Write an updated configuration file */
#include "fbc_line_er.h" /* External Representation of config lines */
#endif
{
{ENDSECTION, "endsection"},
{NOTRAPSIGNALS, "notrapsignals"},
{DONTZAP, "dontzap"},
{DONTZOOM, "dontzoom"},
{DISABLEVIDMODE, "disablevidmodeextension"},
{ALLOWNONLOCAL, "allownonlocalxvidtune"},
{DISABLEMODINDEV, "disablemodindev"},
{MODINDEVALLOWNONLOCAL, "allownonlocalmodindev"},
{ALLOWMOUSEOPENFAIL, "allowmouseopenfail"},
{OPTION, "option"},
{BLANKTIME, "blanktime"},
{STANDBYTIME, "standbytime"},
{SUSPENDTIME, "suspendtime"},
{OFFTIME, "offtime"},
{DEFAULTLAYOUT, "defaultserverlayout"},
{-1, ""},
};
xf86parseFlagsSection (void)
{
int token;
{
int tokentype;
switch (token)
{
case COMMENT:
break;
/*
* these old keywords are turned into standard generic options.
* we fall through here on purpose
*/
case DEFAULTLAYOUT:
case BLANKTIME:
case STANDBYTIME:
case SUSPENDTIME:
case OFFTIME:
case NOTRAPSIGNALS:
case DONTZAP:
case DONTZOOM:
case DISABLEVIDMODE:
case ALLOWNONLOCAL:
case DISABLEMODINDEV:
case MODINDEVALLOWNONLOCAL:
case ALLOWMOUSEOPENFAIL:
{
int i = 0;
{
char *tmp;
{
/* can't use strdup because it calls malloc */
if (hasvalue)
{
if (strvalue) {
} else {
if (valstr)
}
}
}
i++;
}
}
break;
case OPTION:
break;
case EOF_TOKEN:
break;
default:
break;
}
}
#ifdef DEBUG
printf ("ServerFlags section parsed\n");
#endif
return ptr;
}
void
{
return;
p = flags->flg_option_lst;
fprintf (f, "Section \"ServerFlags\"\n");
if (flags->flg_comment)
xf86printOptionList(f, p, xf86whitespace_1);
fprintf (f, "EndSection\n\n");
}
/*
* xf86addNewOptionOrValue()
*
* Append a new Option record to the specified Option list if the
* option name is not already present in the list. If the option
* name is already present, replace the value, etc. of the existing
* option. Return a pointer to the head of the list.
*/
#if !defined(SMI_FBCONFIG)
static
#endif
char *name, /* Ptr to new option name string */
char *val, /* Ptr to new option value string */
#if !defined(SMI_FBCONFIG)
int used)
#else
int used, /* Not used w/ SMI_FBCONFIG */
void *end_line_er) /* Ptr to End[Sub]Section, else NULL */
#endif
{
/*
* Disallow duplicate option names, discarding any but the last one
*
* Note that xf86findOption() accepts NULL as the list head
* and returns NULL in that case.
*/
} else {
//??? Memory leak in some or all cases (e.g. when old->used==1) ???
//??? xf86freeconfig(old->opt_name);
//??? xf86freeconfig(old->opt_val);
//??? Memory leak in some or all cases (e.g. when old->used==1) ???
}
#if defined(SMI_FBCONFIG)
/*
* Insert and link the External Representation of this option
*
* The External Representation of this new Option
* line will be inserted just before the EndSection
* or EndSubSection line (assuming our caller has
* provided a pointer to the ER for the end line).
*/
if (end_line_er != NULL) {
}
#endif
/*
* Add the new option and return the (new) list head
*/
}
#if defined(SMI_FBCONFIG)
/*
* Mark the External Representation of this option as modified
*
* If our caller hasn't provided a pointer (end_line_er) to
* the External Representation of an EndSection or
* EndSubSection line then it's likely that our caller isn't
* on an SMI_FBCONFIG code path.
*/
if (end_line_er != NULL) {
}
#endif
/*
* Return the unchanged list head, having modified an existing option
*/
return (head);
}
/*
* xf86addNewOption()
*
* Append a new Option record to the specified Option list if the
* option name is not already present in the list. If the option
* name is already present, replace the value, etc. of the existing
* option. Return a pointer to the head of the list.
*/
{
#if !defined(SMI_FBCONFIG)
#else
#endif
}
void
{
return;
}
{
while (opt)
{
if (opt->opt_comment)
}
return newopt;
}
void
{
while (opt)
{
xf86conffree (prev);
}
}
char *
{
if (opt)
return 0;
}
char *
{
if (opt)
return 0;
}
{
if (!opt)
return NULL;
return opt;
}
{
if (!list)
return NULL;
}
/*
* This function searches the given option list for the named option and
* returns a pointer to the option rec if found. If not found, it returns
* NULL.
*/
{
/*
* Known Boolean option names, which accept a "No" prefix
*
* This table is arranged in xorg.conf(4) man page order,
* merely for ease of its creation and potential maintenance.
*
* What should the opposites of the following Boolean option
* names be?
* "NoTrapSignals" - "NoNoTrapSignals" or "TrapSignals"
* "NoPM" - "NoNoPM" or "PM"
* "NoInt10" - "NoNoInt10" or "Int10"
*/
static const char * const bool_option_names[] =
{
/*
* ServerFlags Section
*/
"NoTrapSignals", /* ??? Not a negated option name */
"DontVTSwitch",
"DontZap",
"DontZoom",
"DisableVidModeExtension",
"AllowNonLocalXvidtune",
"DisableModInDev",
"AllowNonLocalModInDev",
"AllowMouseOpenFail",
"VTSysReq",
"XkbDisable",
"PC98",
"NoPM", /* ??? Not a negated option name */
"Xinerama",
"AllowDeactivateGrabs",
"AllowClosedownGrabs",
/*
* InputDevice section
*/
"AIGLX",
"IgnoreABI",
/*
* Module section
*/
"AlwaysCore",
"SendCoreEvents",
"SendDragEvents",
/*
* Monitor section
*/
"DPMS",
"SyncOnGreen",
"Enable",
"Ignore",
/*
* Screen section
*/
"InitPrimary",
"NoInt10", /* ??? Not a negated option name */
"SingleCard",
#if defined(SMI_FBCONFIG)
FBC_KEYWD_DefLinear, /* Display subsection */
FBC_KEYWD_DefOverlay, /* Display subsection */
FBC_KEYWD_DefTransparent, /* Display subsection */
FBC_KEYWD_DoubleHigh, /* ??? Is this really a Boolean ??? */
FBC_KEYWD_DoubleWide, /* ??? Is this really a Boolean ??? */
#endif
NULL /* End-of-table marker */
};
{
if (xf86optionNameCompare (
{
return (list);
}
}
return (NULL);
}
/*
* This function searches the given option list for the named option. If
* found and the option has a parameter, a pointer to the parameter is
* returned. If the option does not have a parameter, an empty string
* is returned. If the option is not found, a NULL is returned.
*/
char *
{
if (p)
{
if (p->opt_val)
return (p->opt_val);
else
return "";
}
return (NULL);
}
/*
* xf86optionListCreate()
*
* Create and return a list of options from an array of option &
* value string pairs. The size of the array is specified by a
* non-negative "count" value or else by a NULL as the last element
* of the array. The purpose of "used," which appears to be Boolean,
* has been documented only by its name.
*/
{
XF86OptionPtr p = NULL;
int i;
if (count == -1)
{
;
}
if( (count % 2) != 0 )
{
return (NULL);
}
for (i = 0; i < count; i += 2)
{
/* can't use strdup because it calls malloc */
t1 = xf86confmalloc (sizeof (char) *
t2 = xf86confmalloc (sizeof (char) *
#if !defined(SMI_FBCONFIG)
#else
#endif
}
return (p);
}
/* the 2 given lists are merged. If an option with the same name is present in
* both, the option from the user list - specified in the second argument -
* is used. The end result is a single valid list of options. Duplicates
* are freed, and the original lists are no longer guaranteed to be complete.
*/
{
a = tail;
b = head;
while (tail && b) {
if (b == head)
head = a;
else
if (a == tail)
else
xf86optionListFree (b);
bp = a;
a = tail;
} else {
ap = a;
a = tail;
bp = b;
}
}
}
if (head) {
;
} else
return (head);
}
char *
xf86uLongToString(unsigned long i)
{
char *s;
int l;
s = xf86confmalloc(l);
if (!s)
return NULL;
sprintf(s, "%lu", i);
return s;
}
void
{
while (Options) {
}
}
/*
* xf86parseOption()
*
* Parse the current Option line. Complain about bad Option lines.
* Discard duplicate option names. Otherwise, append the new option
* to the Option list specified by "head."
*/
{
int token;
#if defined(SMI_FBCONFIG)
/*
* Get a pointer to the External Representation of this Option line
*/
#endif
/*
* Get the option name token
*/
if (comment)
return (head);
}
/*
* Get the option value token, if any, and comment string, if any
*/
else
}
else {
else
}
/*
* Disallow duplicate option names, discarding any but the first one
*
* Note that xf86findOption() accepts NULL as the list head
* and returns NULL in that case.
*/
#if defined(SMI_FBCONFIG)
#endif
return (head);
}
#if defined(SMI_FBCONFIG)
/*
* Link the Internal and External Representations of this Option line
*/
(void *)option,
#endif
}
/*
* xf86printOption()
*
* Write an Option line to the output configuration file.
*/
void
{
/*
* Comment or end-of-line text
*/
comment = "\n";
}
/*
* Write the Option line, which may include an Option value
*/
} else {
}
}
/*
* xf86printOptionList()
*
* Write all of the Option lines of a (sub)section to the output
* configuration file.
*/
void
{
}
}