xref: /onnv-gate/usr/src/lib/libldap4/common/getmsg.c (revision 3857:21b9b714e4ab)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  *
3*3857Sstevel  * Copyright 1998 Sun Microsystems, Inc.  All rights reserved.
4*3857Sstevel  * Use is subject to license terms.
50Sstevel@tonic-gate  *
60Sstevel@tonic-gate  *
70Sstevel@tonic-gate  * Comments:
80Sstevel@tonic-gate  *
90Sstevel@tonic-gate  */
100Sstevel@tonic-gate 
110Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
120Sstevel@tonic-gate 
130Sstevel@tonic-gate #include <stdio.h>
140Sstevel@tonic-gate #include <ctype.h>
150Sstevel@tonic-gate #include <string.h>
160Sstevel@tonic-gate #include "lber.h"
170Sstevel@tonic-gate #include "ldap.h"
180Sstevel@tonic-gate #include "ldap-private.h"
190Sstevel@tonic-gate 
ldap_first_message(LDAP * ld,LDAPMessage * res)200Sstevel@tonic-gate LDAPMessage * ldap_first_message(LDAP *ld, LDAPMessage *res)
210Sstevel@tonic-gate {
220Sstevel@tonic-gate 	return (res == NULLMSG ? NULLMSG : res);
230Sstevel@tonic-gate }
240Sstevel@tonic-gate 
ldap_next_message(LDAP * ld,LDAPMessage * msg)250Sstevel@tonic-gate LDAPMessage * ldap_next_message(LDAP *ld, LDAPMessage *msg)
260Sstevel@tonic-gate {
270Sstevel@tonic-gate 	if (msg == NULLMSG || msg->lm_chain == NULLMSG)
280Sstevel@tonic-gate 		return (NULLMSG);
290Sstevel@tonic-gate 	return (msg->lm_chain);
300Sstevel@tonic-gate }
310Sstevel@tonic-gate 
ldap_count_messages(LDAP * ld,LDAPMessage * res)320Sstevel@tonic-gate int ldap_count_messages( LDAP *ld, LDAPMessage *res)
330Sstevel@tonic-gate {
340Sstevel@tonic-gate 	int i;
350Sstevel@tonic-gate 
360Sstevel@tonic-gate 	for ( i =0; res != NULL; res = res->lm_chain)
370Sstevel@tonic-gate 		i++;
380Sstevel@tonic-gate 
390Sstevel@tonic-gate 	return (i);
400Sstevel@tonic-gate }
41