xref: /onnv-gate/usr/src/lib/libldap4/common/getmsg.c (revision 3857:21b9b714e4ab)
1 /*
2  *
3  * Copyright 1998 Sun Microsystems, Inc.  All rights reserved.
4  * Use is subject to license terms.
5  *
6  *
7  * Comments:
8  *
9  */
10 
11 #pragma ident	"%Z%%M%	%I%	%E% SMI"
12 
13 #include <stdio.h>
14 #include <ctype.h>
15 #include <string.h>
16 #include "lber.h"
17 #include "ldap.h"
18 #include "ldap-private.h"
19 
ldap_first_message(LDAP * ld,LDAPMessage * res)20 LDAPMessage * ldap_first_message(LDAP *ld, LDAPMessage *res)
21 {
22 	return (res == NULLMSG ? NULLMSG : res);
23 }
24 
ldap_next_message(LDAP * ld,LDAPMessage * msg)25 LDAPMessage * ldap_next_message(LDAP *ld, LDAPMessage *msg)
26 {
27 	if (msg == NULLMSG || msg->lm_chain == NULLMSG)
28 		return (NULLMSG);
29 	return (msg->lm_chain);
30 }
31 
ldap_count_messages(LDAP * ld,LDAPMessage * res)32 int ldap_count_messages( LDAP *ld, LDAPMessage *res)
33 {
34 	int i;
35 
36 	for ( i =0; res != NULL; res = res->lm_chain)
37 		i++;
38 
39 	return (i);
40 }
41