0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * Portions Copyright (C) 2001, 2004, 2005, 2007, 2015, 2016 Internet Systems Consortium, Inc. ("ISC")
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * This Source Code Form is subject to the terms of the Mozilla Public
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * License, v. 2.0. If a copy of the MPL was not distributed with this
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * file, You can obtain one at http://mozilla.org/MPL/2.0/.
cb3e854e181373807f7f011e5050c1a8013b4841Brian Wellington * Portions Copyright (C) 2001 Nominum, Inc.
271c4c7ffafeb0bda21278af6cac4535c0193f18Automatic Updater * Permission to use, copy, modify, and/or distribute this software for any
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington * purpose with or without fee is hereby granted, provided that the above
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington * copyright notice and this permission notice appear in all copies.
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY
cb3e854e181373807f7f011e5050c1a8013b4841Brian Wellington * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
cb3e854e181373807f7f011e5050c1a8013b4841Brian Wellington * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
271c4c7ffafeb0bda21278af6cac4535c0193f18Automatic Updater/* $Id: alist.c,v 1.8 2007/08/28 07:20:43 tbox Exp $ */
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington if (alist == NULL || alist->type != ISCCC_SEXPRTYPE_DOTTEDPAIR)
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington if (car == NULL || car->type != ISCCC_SEXPRTYPE_STRING)
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington if (strcmp(car->value.as_string, ALIST_TAG) != 0)
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellingtonisccc_alist_assq(isccc_sexpr_t *alist, const char *key)
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington * Skip alist type tag.
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington INSIST(alist->type == ISCCC_SEXPRTYPE_DOTTEDPAIR);
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington INSIST(car->type == ISCCC_SEXPRTYPE_DOTTEDPAIR);
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington if (caar->type == ISCCC_SEXPRTYPE_STRING &&
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellingtonisccc_alist_delete(isccc_sexpr_t *alist, const char *key)
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington INSIST(rest->type == ISCCC_SEXPRTYPE_DOTTEDPAIR);
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington INSIST(car != NULL && car->type == ISCCC_SEXPRTYPE_DOTTEDPAIR);
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington if (caar->type == ISCCC_SEXPRTYPE_STRING &&
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellingtonisccc_alist_define(isccc_sexpr_t *alist, const char *key, isccc_sexpr_t *value)
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington * New association.
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington * We've already got an entry for this key. Replace it.
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellingtonisccc_alist_definestring(isccc_sexpr_t *alist, const char *key, const char *str)
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellingtonisccc_alist_definebinary(isccc_sexpr_t *alist, const char *key, isccc_region_t *r)
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellingtonisccc_alist_lookup(isccc_sexpr_t *alist, const char *key)
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellingtonisccc_alist_lookupstring(isccc_sexpr_t *alist, const char *key, char **strp)
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellingtonisccc_alist_lookupbinary(isccc_sexpr_t *alist, const char *key, isccc_region_t **r)
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellingtonisccc_alist_prettyprint(isccc_sexpr_t *sexpr, unsigned int indent, FILE *stream)
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington fprintf(stream, "%.*s%s => ", (int)indent, spaces,
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington isccc_alist_prettyprint(v, indent, stream);
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington fprintf(stream, "%.*s}", (int)indent, spaces);
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington fprintf(stream, "%.*s", (int)indent, spaces);
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington isccc_alist_prettyprint(CAR(elt), indent, stream);
1d92d8a2456b23842a649b6104c60a9d6ea25333Brian Wellington fprintf(stream, "%.*s)", (int)indent, spaces);