secdb.c revision f89940742f5d14dde79b69b98a414dd7b7f585c7
/*
* 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
*/
/*
*/
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <secdb.h>
#include <ctype.h>
/* From libnsl */
extern char *_strdup_null(char *);
extern char *_strtok_escape(char *, char *, char **);
extern char *_strpbrk_escape(char *, char *);
extern char *_unescape(char *, char *);
char *_do_unescape(char *);
/*
* kva_match(): Given a key-value array and a key, return a pointer to the
* value that matches the key.
*/
char *
{
int i;
return (NULL);
}
}
}
return (NULL);
}
/*
* _kva_free(): Free up memory.
*/
void
{
int i;
return;
}
}
}
}
}
/*
* _kva_free_value(): Free up memory (value) for all the occurrences of
* the given key.
*/
void
{
int ctr;
return;
}
while (ctr--) {
}
data++;
}
}
/*
* new_kva(): Allocate a key-value array.
*/
kva_t *
{
return (NULL);
}
return (NULL);
}
return (new_kva);
}
/*
* _str2kva(): Given a string (s) of key-value pairs, separated by delimeter
* (del), place the values into the key value array (nkva).
*/
kva_t *
{
int n = 0;
int m;
int size = KV_ADD_KEYS;
char *buf;
char *p;
char *pair;
char *key;
char *last_pair;
char *last_key;
if (s == NULL ||
*s == '\0' ||
*s == '\n' ||
(strlen(s) <= 1)) {
return (NULL);
}
p = s;
n++;
p++;
}
if (n > size) {
m = n/size;
if (n%size) {
++m;
}
size = m * KV_ADD_KEYS;
}
return (NULL);
}
return (NULL);
}
do {
}
return (nkva);
}
/*
* _kva2str(): Given an array of key-value pairs, place them into a string
* (buf). Use delimeter (del) to separate pairs. Use assignment character
* (ass) to separate keys and values.
*
* Return Values: 0 Success 1 Buffer too small
*/
int
{
int i;
int len;
int off = 0;
return (0);
}
buf[0] = '\0';
return (1);
}
}
}
return (0);
}
int
{
int i;
return (0);
}
return (0);
}
}
return (1);
}
kva_t *
{
int i;
int size;
return (NULL);
}
return (NULL);
}
}
return (nkva);
}
static void
strip_spaces(char **valuep)
{
char *p, *start;
/* Find first non-white space character and return pointer to it */
;
if (*p == '\0')
return;
p = p + strlen(p) - 1;
/* Remove trailing spaces */
p--;
p[1] = '\0';
}
char *
_do_unescape(char *src)
{
} else {
strip_spaces(&src);
}
return (dst);
}
/*
* Some utilities for handling comma-separated lists.
*/
char *
_argv_to_csl(char **strings)
{
int len = 0;
int i = 0;
return (NULL);
}
}
return (newstr);
} else
return (NULL);
}
char **
_csl_to_argv(char *csl)
{
int len = 0;
int ncommas = 0;
int i = 0;
char *pc;
for (i = 0; i < len; i++) {
if (csl[i] == ',')
ncommas++;
}
return (NULL);
}
}
return (spc);
}
void
_free_argv(char **p_argv)
{
char **p_a;
}
#ifdef DEBUG
void
{
int i;
(void) printf(" (empty)\n");
return;
}
(void) printf(" %s = %s\n",
}
}
#endif /* DEBUG */