/*
*
* 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 (including the next
* paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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.
*/
/*
* fbc_edit_config - Write an updated configuration file
*/
#include <errno.h> /* errno */
#include <stdio.h> /* fprintf() */
#include <stdlib.h> /* mkstemp() */
#include <string.h> /* strcat(), strcpy(), strlen(), strerror() */
#include <unistd.h>
#include "xf86Parser.h" /* Public function, etc. declatations */
#include "Configint.h" /* Private definitions, etc. */
#include "configProcs.h" /* Private function, etc. declarations */
#include "fbc.h" /* Common fbconf_xorg(1M) definitions */
#include "fbc_properties.h" /* fbconf_xorg(1M) program properties */
#include "fbc_Device.h" /* Edit Device sections */
#include "fbc_Monitor.h" /* Edit Monitor sections */
#include "fbc_Screen.h" /* Edit Screen sections */
#include "fbc_dev.h" /* Identify the graphics device (-dev opt) */
#include "fbc_edit_config.h" /* Write an updated configuration file */
#include "fbc_error.h" /* Error reporting */
#include "fbc_fields.h" /* Measure aligned whitespace fields */
#include "fbc_line_er.h" /* External Representation of config lines */
/*
* fbc_find_active_sections()
*
* associated with the specified frame buffer device:
* Device section (required)
* Screen section (required)
* Monitor section (optional unless the user wants to reference it)
* Display subsection of Screen section (optional unless referenced)
*
* The device handle is used to find (or construct) the target Device
* section. The Device section identifier is used to find (or
* construct) the referencing Screen section. The target Screen
* section identifies the target Monitor section (or one may have to
* be constructed). The target Screen section also contains the
* target Display subsection (or one may have to be constructed),
* which the Monitor section helps to identify.
*/
int
{
/*
* Find the Device section that refers to this device
*
* The Device section must exist for the configuration to be
* correct. If it doesn't exist then it must be created. If
* there is more than one, all but the first will be ignored.
*/
/*???*/ stream_num = 0;
/*
* Insert a Device section for this device
*/
if (error_code != FBC_SUCCESS) {
fbc_errormsg("Can't create Device section, %s\n",
return (error_code);
}
}
/*
* Find the first Screen section referring to this Device section name
*
* The Screen section must exist for the configuration to be
* correct. If it doesn't exist then it must be created.
*/
/*
* Insert a Screen section that refers to the Device section
*
* the first Screen section in the configuration.
* Otherwise, just append it.
*/
if (device->is_default) {
}
if (error_code != FBC_SUCCESS) {
"Can't create Screen section for Device section, \"%s\"\n",
return (error_code);
}
}
/*
* Find any active Monitor entry, and therefore the Monitor section
*
* Monitor entries within a Screen section are optional. If
* the user wants to modify the Monitor section, the Display
* subsection, or get to Modes sections (-res ?), then the
* Monitor entry and section must exist or be created.
*/
/*
* Insert a Monitor section and its Monitor entry
*
* Memory allocation errors are unlikely and
* won't corrupt program state.
*/
!= FBC_SUCCESS) {
"Can't create Monitor section for Screen section, \"%s\"\n",
} else
&mon_ptr)
!= FBC_SUCCESS) {
"Can't create Monitor entry in Screen section, \"%s\"\n",
}
}
/*
*/
/*
*
* Display subsections within a Screen section are
* optional. If the user wants to modify the Display
* subsection then it must exist or be created.
*/
(ref_config & FBC_SUBSCTN_Display)) {
/*
* Insert a Display subsection
*/
!= FBC_SUCCESS) {
"Can't create Display subsection in Screen section, \"%s\"\n",
}
}
}
return (FBC_SUCCESS);
} /* fbc_find_active_sections() */
/*
* fbc_find_active_mode()
*
* This function tries to find the name of the active video mode in
* the Modes entry of the active Display Subsection of the active
* Screen Section. For completeness, it also looks for the
* corresponding ModeLine / Mode-EndMode entry.
*/
int
{
/*
* No Mode name or ModeLine / Mode-EndMode entry has been found yet
*/
/*
* If Display & Monitor sections are known, find Mode name & Mode entry
*/
/*
* Look for the ModeLine / Mode-EndMode entry
*/
}
}
return (FBC_SUCCESS);
} /* fbc_find_active_mode() */
/*
* fbc_edit_active_sections()
*
* Edit the active sections in the configuration that are associated
* with the frame buffer device.
*/
int
{
/*
* Make any modifications to the existing active Screen section
*/
if (error_code != FBC_SUCCESS) {
return (error_code);
}
/*
* Make any modifications to the active Display subsection, if any
*/
if (error_code != FBC_SUCCESS) {
return (error_code);
}
}
/*
* Make any modifications to the active Monitor section
*/
/*
* Make any changes to the active Monitor section
*/
if (error_code != FBC_SUCCESS) {
return (error_code);
}
}
/*
* Make any modifications to the Option lists of active sections
*/
return (FBC_SUCCESS);
} /* fbc_edit_active_sections() */
/* End of fbc_edit_config.c */