10Sstevel@tonic-gate /*
20Sstevel@tonic-gate * CDDL HEADER START
30Sstevel@tonic-gate *
40Sstevel@tonic-gate * The contents of this file are subject to the terms of the
5*1450Sjanga * Common Development and Distribution License (the "License").
6*1450Sjanga * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate *
80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate * See the License for the specific language governing permissions
110Sstevel@tonic-gate * and limitations under the License.
120Sstevel@tonic-gate *
130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate *
190Sstevel@tonic-gate * CDDL HEADER END
200Sstevel@tonic-gate */
210Sstevel@tonic-gate /*
22*1450Sjanga * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
23*1450Sjanga * Use is subject to license terms.
240Sstevel@tonic-gate */
250Sstevel@tonic-gate
260Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI"
270Sstevel@tonic-gate
280Sstevel@tonic-gate #include <stdio.h>
290Sstevel@tonic-gate #include "../../../lib/libsldap/common/ns_sldap.h"
300Sstevel@tonic-gate
310Sstevel@tonic-gate void
_printEntry(ns_ldap_entry_t * entry)32*1450Sjanga _printEntry(ns_ldap_entry_t *entry) {
330Sstevel@tonic-gate int j, k;
340Sstevel@tonic-gate char *cp;
350Sstevel@tonic-gate for (j = 0; j < entry->attr_count; j++) {
360Sstevel@tonic-gate cp = entry->attr_pair[j]->attrname;
370Sstevel@tonic-gate if (j == 0) {
38*1450Sjanga (void) fprintf(stdout, "%s: %s\n", cp,
390Sstevel@tonic-gate entry->attr_pair[j]->attrvalue[0]);
400Sstevel@tonic-gate } else {
410Sstevel@tonic-gate for (k = 0; (k < entry->attr_pair[j]->value_count) &&
420Sstevel@tonic-gate (entry->attr_pair[j]->attrvalue[k]); k++)
43*1450Sjanga (void) fprintf(stdout, "\t%s: %s\n", cp,
440Sstevel@tonic-gate entry->attr_pair[j]->attrvalue[k]);
450Sstevel@tonic-gate }
460Sstevel@tonic-gate }
470Sstevel@tonic-gate }
480Sstevel@tonic-gate
490Sstevel@tonic-gate
500Sstevel@tonic-gate void
_printResult(ns_ldap_result_t * result)51*1450Sjanga _printResult(ns_ldap_result_t *result) {
520Sstevel@tonic-gate ns_ldap_entry_t *curEntry;
53*1450Sjanga int i;
540Sstevel@tonic-gate
550Sstevel@tonic-gate if (result == NULL) {
560Sstevel@tonic-gate return;
570Sstevel@tonic-gate }
580Sstevel@tonic-gate curEntry = result->entry;
590Sstevel@tonic-gate for (i = 0; i < result->entries_count; i++) {
600Sstevel@tonic-gate if (i != 0)
61*1450Sjanga (void) fprintf(stdout, "\n");
620Sstevel@tonic-gate _printEntry(curEntry);
630Sstevel@tonic-gate curEntry = curEntry->next;
640Sstevel@tonic-gate }
650Sstevel@tonic-gate }
66