alist.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
/*
* Portions Copyright (C) 2001, 2004, 2005, 2007, 2015, 2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Portions Copyright (C) 2001 Nominum, Inc.
*
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: alist.c,v 1.8 2007/08/28 07:20:43 tbox Exp $ */
/*! \file */
#include <config.h>
#include <stdlib.h>
#include <string.h>
#include <isc/assertions.h>
#define ALIST_TAG "*alist*"
#define MAX_INDENT 64
" ";
isccc_alist_create(void)
{
return (NULL);
return (NULL);
}
return (alist);
}
{
return (ISC_FALSE);
return (ISC_FALSE);
return (ISC_FALSE);
return (ISC_TRUE);
}
{
return (ISC_TRUE);
return (ISC_FALSE);
}
{
}
{
/*
* Skip alist type tag.
*/
return (car);
}
return (NULL);
}
void
{
break;
}
}
}
{
/*
* New association.
*/
k = isccc_sexpr_fromstring(key);
if (k == NULL)
return (NULL);
return (NULL);
}
return (NULL);
}
} else {
/*
* We've already got an entry for this key. Replace it.
*/
}
return (kv);
}
{
isccc_sexpr_t *v, *kv;
v = isccc_sexpr_fromstring(str);
if (v == NULL)
return (NULL);
isccc_sexpr_free(&v);
return (kv);
}
{
isccc_sexpr_t *v, *kv;
v = isccc_sexpr_frombinary(r);
if (v == NULL)
return (NULL);
isccc_sexpr_free(&v);
return (kv);
}
{
return (NULL);
}
{
isccc_sexpr_t *kv, *v;
if (isccc_sexpr_stringp(v)) {
*strp = isccc_sexpr_tostring(v);
return (ISC_R_SUCCESS);
} else
return (ISC_R_EXISTS);
}
return (ISC_R_NOTFOUND);
}
{
isccc_sexpr_t *kv, *v;
if (isccc_sexpr_binaryp(v)) {
if (r != NULL)
*r = isccc_sexpr_tobinary(v);
return (ISC_R_SUCCESS);
} else
return (ISC_R_EXISTS);
}
return (ISC_R_NOTFOUND);
}
void
{
if (isccc_alist_alistp(sexpr)) {
indent += 4;
isccc_sexpr_tostring(k));
}
indent -= 4;
} else if (isccc_sexpr_listp(sexpr)) {
indent += 4;
}
indent -= 4;
} else
}