/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* prof_get.c --- routines that expose the public interfaces for
* querying items from the profile.
*
*/
#include "prof_int.h"
#include <stdio.h>
#include <string.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include <errno.h>
#include <limits.h>
/*
* Solaris Kerberos: The following functions are made public so that other
* profile functions can call upon these basic routines:
* init_list(), end_list(), and add_to_list().
* Note: That profile_string_list is moved to prof_int.h as a result.
*
* These functions --- init_list(), end_list(), and add_to_list() are
* publicy exported functions used to build up a null-terminated char ** list
* of strings to be returned by functions like profile_get_values.
*
* The publicly exported interface for freeing char** list is
* profile_free_list().
*/
/*
* Initialize the string list abstraction.
*/
{
return ENOMEM;
return 0;
}
/*
* Free any memory left over in the string abstraction, returning the
* built up list in *ret_list if it is non-null.
*/
{
char **cp;
if (list == 0)
return;
if (ret_list) {
return;
} else {
}
}
/*
* Add a string to the list.
*/
{
unsigned int newmax;
if (newlist == 0)
return ENOMEM;
}
if (newstr == 0)
return ENOMEM;
return 0;
}
/*
* Return TRUE if the string is already a member of the list.
*/
{
char **cpp;
return 0;
return 1;
}
return 0;
}
/*
* This function frees a null-terminated list as returned by
* profile_get_values.
*/
{
char **cp;
if (list == 0)
return;
}
char ***ret_values)
{
void *state;
char *value;
&state)))
return retval;
return retval;
do {
goto cleanup;
if (value)
} while (state);
goto cleanup;
}
return 0;
return retval;
}
/*
* This function only gets the first value from the file; it is a
* helper function for profile_get_string, profile_get_integer, etc.
*/
const char **ret_value)
{
void *state;
char *value;
&state)))
return retval;
goto cleanup;
if (value)
else
return retval;
}
const char *subsubname, const char *def_val,
char **ret_string)
{
const char *value;
if (profile) {
names[3] = 0;
else if (retval)
return retval;
} else
if (value) {
if (*ret_string == 0)
return ENOMEM;
} else
*ret_string = 0;
return 0;
}
{
const char *value;
char *end_value;
long ret_long;
if (profile == 0)
return 0;
names[3] = 0;
return 0;
} else if (retval)
return retval;
if (value[0] == 0)
/* Empty string is no good. */
return PROF_BAD_INTEGER;
errno = 0;
/* Overflow or underflow. */
return PROF_BAD_INTEGER;
/* Value outside "int" range. */
return PROF_BAD_INTEGER;
/* Garbage in string. */
return PROF_BAD_INTEGER;
return 0;
}
static const char *const conf_yes[] = {
"y", "yes", "true", "t", "1", "on",
0,
};
static const char *const conf_no[] = {
"n", "no", "false", "nil", "0", "off",
0,
};
static errcode_t
{
const char *const *p;
if (ret_boolean == NULL)
return PROF_EINVAL;
for(p=conf_yes; *p; p++) {
if (!strcasecmp(*p,s)) {
*ret_boolean = 1;
return 0;
}
}
for(p=conf_no; *p; p++) {
if (!strcasecmp(*p,s)) {
*ret_boolean = 0;
return 0;
}
}
return PROF_BAD_BOOLEAN;
}
{
const char *value;
if (profile == 0) {
*ret_boolean = def_val;
return 0;
}
names[3] = 0;
*ret_boolean = def_val;
return 0;
} else if (retval)
return retval;
}
/*
* This function will return the list of the names of subections in the
* under the specified section name.
*/
char ***ret_names)
{
void *state;
char *name;
&state)))
return retval;
return retval;
do {
goto cleanup;
if (name)
} while (state);
return 0;
return retval;
}
/*
* This function will return the list of the names of relations in the
* under the specified section name.
*/
char ***ret_names)
{
void *state;
char *name;
&state)))
return retval;
return retval;
do {
goto cleanup;
} while (state);
return 0;
return retval;
}
void **ret_iter)
{
}
void KRB5_CALLCONV
{
}
{
if (retval)
return retval;
if (ret_name) {
if (name) {
if (!*ret_name)
return ENOMEM;
} else
*ret_name = 0;
}
if (ret_value) {
if (value) {
if (!*ret_value) {
if (ret_name) {
*ret_name = 0;
}
return ENOMEM;
}
} else
*ret_value = 0;
}
return 0;
}
void KRB5_CALLCONV
{
}