/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <stdio.h>
#include <stdio.h>
#include <errno.h>
#include <limits.h>
#include <fcntl.h>
#include <string.h>
#include <strings.h>
#include <stdlib.h>
#include <unistd.h>
#include <locale.h>
#include <langinfo.h>
#include <libintl.h>
#include <stdarg.h>
#include <netdb.h>
#include <ctype.h>
#include "cfg_impl.h"
#include "cfg.h"
#include "cfg_local.h"
#if 0
#define DEBUG_CFGLIST
#define DEBUG_CFGLISTRM
#endif
extern int cfg_severity;
extern char *cfg_perror_str;
long
{
char *rest;
int slice;
int fd;
return (0);
return (0);
goto do_open;
}
if (fd < 0)
return (0);
if (slice < 0) {
return (0);
}
}
/*
* round up to the next block size
*/
int
{
int ret;
if (size % CFG_BLOCK_SIZE != 0)
else
return (ret);
}
/*
* get a chunk of mem rounded up to next block size
*/
char *
{
int blk_size;
char *blk_buf;
return (NULL);
}
return (blk_buf);
}
void
{
if (buf)
}
void
{
}
/*
* cfg_open
* Open the current configuration file
* Sets file descriptor in cfp->cf_fd for use by other routines
*/
cfp_t *
{
int rc;
"cfg_open: unable to open configuration location");
return (NULL);
}
"cfg_open: unable to open configuration location");
return (NULL);
}
}
"cfg_open: unable to stat configuration location");
return (NULL);
}
/* skip the vtoc if necessary */
do {
if (rc == -1) {
return (NULL);
}
}
} else {
return (NULL);
}
return (cfp);
}
int
{
int rc;
do {
return (rc);
}
int
{
int rc;
do {
return (rc);
}
int
{
int rc;
do {
return (rc);
}
int
{
int rc;
int offset;
offset += CFG_VTOC_SKIP;
}
do {
return (rc);
}
int
{
int rc;
int blk_size;
char *blk_buf;
return (-1);
do {
return (rc);
}
int
{
int rc;
int blk_size;
char *blk_buf;
return (-1);
do {
return (rc);
}
/*
* Routines which operate on internal version of configuration
*/
/*
* Add entry to end of configuration section
*/
int
{
char *q;
#ifdef DEBUG_CFGLIST
" %d l_free %u adding len %d\n",
#endif
#ifdef DEBUG_CFGLIST
#endif
return (-1);
}
}
/* out of list slots, get some more */
/*
* first, figure out how much bigger, than realloc
*/
#ifdef DEBUG_CFGLIST
"list %d getting more nentries, I have %d\n",
#endif
sizeof (int));
return (-1);
}
}
/* add line to end of list */
q += len;
/* set sizes */
#ifdef DEBUG_CFGLIST
" %d l_free %u\n h_csize %d\n",
#endif
return (1);
}
/*
* remove entry from configuration section
*/
int
{
char *p, *q;
int len;
int copylen;
int i;
/* list is empty */
return (-1);
}
if (!q) { /* somethings wrong here */
return (-1);
}
for (i = 1; i < setnum; i++) {
return (-1);
}
}
return (-1);
#ifdef DEBUG_CFGLISTRM
" removing len %d\n",
#endif
p = q + len; /* next string */
/* if we didn't delete the last string in list */
/* LINTED possible overflow */
}
/* decrement the number of sets in this list */
/* not really necessary, but.. */
#ifdef DEBUG_CFGLIST
"remcfline: post: l_size %d h_cfgsizes[%d] %d free %d\n ",
#endif
return (0);
}
/*
* Read entry from configuration section
*/
char *
{
char *q;
int i;
/* this means they couldn't even find it in the parser tree */
if (table_offset < 0)
return (NULL);
for (i = 1; i < num; i++) {
return (NULL);
}
return (NULL);
return (q);
}
/*
* overwrite from current position with new value
*/
int
{
/*
* take a table offset and a num to replace
* index in, bump the list up, leaving a hole big
* enough for the new string, or bcopying the rest of the list
* down only leaving a hole big enough.
* make sure not to overflow the
* allocated list size.
*/
char *p, *q;
int diff = 0;
int i;
for (i = 1; i < num; i++) {
return (-1);
}
/* check for > 0, comparing uint to int */
/*
* we are going to overflow, get more mem, but only
* 1/2 as much as initial calloc, we don't need to be greedy
*/
#ifdef DEBUG_CFGLIST
"resizing at replacecfline from %d to %d \n",
#endif
return (-1);
}
/* re-find q, we could have a whole new chunk of memory here */
for (i = 1; i < num; i++) {
return (-1);
}
}
/* LINTED possible overflow */
/* total of all h_cfgs[n].l_entry */
}
return (1);
}
NULL,
"Local",
};
NULL,
"Local",
};
cfg_io_t *
cfg_raw_io_provider(void)
{
return (&_cfg_raw_io_def);
}
cfg_io_t *
cfg_block_io_provider(void)
{
return (&_cfg_block_io_def);
}