parse.c revision 731682d81d6004ade5d139920d1186cdccaa5418
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include "pmconfig.h"
#include <deflt.h>
#include <pwd.h>
#ifdef sparc
#include <libdevinfo.h>
static char sf_cmt[] = "# Statefile\t\tPath\n";
#endif
static char as_cmt[] =
char **line_args;
int lineno = 0;
/*
* cpr and pm combined permission/update status
*/
/*
* For config file parsing to work correctly/efficiently, this table
* needs to be sorted by .keyword and any longer string like "device"
* must appear before a substring like "dev".
*/
"device-dependency-property",
#ifdef sparc
#endif
};
/*
*/
static void
{
/*
* all (all users + root)
* - (none + root)
* <user1[, user2...> (list users + root)
* console-owner (console onwer + root)
* access requirement to root.
*/
return;
*perm = 1;
/* Scan dinfo for a matching user. */
*perm = 1;
break;
}
}
}
}
/*
*/
void
lookup_perms(void)
{
int cons_perm;
char *user;
return;
} else {
}
return;
cons_perm = 0;
else
}
#ifdef sparc
/*
* Lookup energystar-v[23] property and set estar_vers.
*/
void
lookup_estar_vers(void)
{
int last;
char ch;
return;
return;
}
es_prop);
estar_vers = ch;
break;
}
}
}
#endif /* sparc */
/*
* limit open() to the real user
*/
static int
{
int fd;
return (fd);
}
/*
* Alloc space and read a config file; caller needs to free the space.
*/
static char *
get_conf_data(char *name)
{
char *buf;
int fd;
return (buf);
}
/*
* Add an arg to line_args, adding space if needed.
*/
static void
{
static int alcnt;
alcnt += 4;
}
}
/*
* Convert blank-delimited words into an arg vector and return
* the arg count; character strings get null-terminated in place.
*/
static int
{
extern int debug;
int cnt = 0;
/*
* Search logic: look for "\\\n" as a continuation marker,
* treat any other "\\*" as ordinary arg data, scan until a
* white-space delimiter is found, and if the arg has length,
* null-terminate and save arg to line_args. The scan includes
* tail so the last arg is found without any special-case code.
*/
if (*cp == '\\') {
cp++;
continue;
}
continue;
*cp = '\0';
}
}
if (debug) {
}
return (cnt);
}
/*
* Match leading keyword from a conf line and
* return a reference to a config info struct.
*/
static cinfo_t *
get_cinfo(void)
{
char *keyword;
int chr_diff;
/*
* Scan the config table for a matching keyword; since the table
* is sorted by keyword strings, a few optimizations can be done:
* first compare only the first byte of the keyword, skip any
* table string that starts with a lower ASCII value, compare the
* full string only when the first byte matches, and stop checking
* if the table string starts with a higher ASCII value.
*/
#if 0
#endif
if (chr_diff < 0)
continue;
else if (chr_diff == 0) {
break;
}
} else
break;
}
return (info);
}
/*
* Find the end of a [possibly continued] conf line
* and record the real/lf-delimited line count at *lcnt.
*/
static char *
{
*lcnt = 0;
(*lcnt)++;
break;
}
return (lf);
}
/*
* Parse the named conf file and for each conf line
* call the action routine or conftab handler routine.
*/
void
{
int dontcare;
/*
* Do the "implied default" for autoS3, but only before we
* start parsing the first conf file.
*/
if (first_parse) {
&dontcare, -1);
}
lineno = 1;
/*
* Each line should start with valid data
* but leading white-space can be ignored
*/
break;
line++;
}
/*
* Copy line into allocated space and null-terminate
* without the trailing line-feed.
*/
"for line copy\n", llen);
} else
/*
* For blank and comment lines: possibly show a debug
* message and otherwise ignore them. For other lines:
* parse into an arg vector and try to match the first
* arg with conftab keywords. When a match is found,
* check for exact or minimum arg count, and call the
* action or handler routine; if handler does not return
* OKUP, set the referenced update value to NOUP so that
* later CPR or PM updates are skipped.
*/
if (llen == 0)
else if (*line == '#')
LINEARG(0));
} else if (action)
} else {
"==> handler skipped: %s_perm %d, "
}
}
if (cline)
}
lineno = 0;
if (verify) {
if (ret < 0) {
}
switch (ret) {
case PM_SYSTEM_PM_ENABLED:
break;
case PM_SYSTEM_PM_DISABLED:
break;
}
if (ret < 0) {
}
switch (ret) {
case PM_S3_SUPPORT_ENABLED:
break;
case PM_S3_SUPPORT_DISABLED:
break;
}
if (ret < 0) {
}
switch (ret) {
case PM_AUTOS3_ENABLED:
break;
case PM_AUTOS3_DISABLED:
break;
}
}
}