]> git.sur5r.net Git - openldap/blob - libraries/libldap/getentry.c
Add strdup.c from -llutil, renamed to ldap_strdup() and always used.
[openldap] / libraries / libldap / getentry.c
1 /*
2  *  Copyright (c) 1990 Regents of the University of Michigan.
3  *  All rights reserved.
4  *
5  *  getentry.c
6  */
7
8 #include "portable.h"
9
10 #ifndef lint 
11 static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
12 #endif
13
14 #include <stdio.h>
15 #include <stdlib.h>
16
17 #include <ac/ctype.h>
18 #include <ac/socket.h>
19 #include <ac/string.h>
20 #include <ac/time.h>
21
22 #include "ldap-int.h"
23
24 /* ARGSUSED */
25 LDAPMessage *
26 ldap_first_entry( LDAP *ld, LDAPMessage *chain )
27 {
28         return( chain == NULLMSG || chain->lm_msgtype == LDAP_RES_SEARCH_RESULT
29             ? NULLMSG : chain );
30 }
31
32 /* ARGSUSED */
33 LDAPMessage *ldap_next_entry( LDAP *ld, LDAPMessage *entry )
34 {
35         if ( entry == NULLMSG || entry->lm_chain == NULLMSG
36             || entry->lm_chain->lm_msgtype == LDAP_RES_SEARCH_RESULT )
37                 return( NULLMSG );
38
39         return( entry->lm_chain );
40 }
41
42 /* ARGSUSED */
43 int
44 ldap_count_entries( LDAP *ld, LDAPMessage *chain )
45 {
46         int     i;
47
48         for ( i = 0; chain != NULL && chain->lm_msgtype
49             != LDAP_RES_SEARCH_RESULT; chain = chain->lm_chain )
50                 i++;
51
52         return( i );
53 }