]> git.sur5r.net Git - openldap/blob - libraries/libldap/getentry.c
Modified NT changes to work under UNIX.
[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 #include <ctype.h>
17
18 #include <ac/socket.h>
19 #include <ac/string.h>
20 #include <ac/time.h>
21
22 #include "lber.h"
23 #include "ldap.h"
24
25 /* ARGSUSED */
26 LDAPMessage *
27 ldap_first_entry( LDAP *ld, LDAPMessage *chain )
28 {
29         return( chain == NULLMSG || chain->lm_msgtype == LDAP_RES_SEARCH_RESULT
30             ? NULLMSG : chain );
31 }
32
33 /* ARGSUSED */
34 LDAPMessage *ldap_next_entry( LDAP *ld, LDAPMessage *entry )
35 {
36         if ( entry == NULLMSG || entry->lm_chain == NULLMSG
37             || entry->lm_chain->lm_msgtype == LDAP_RES_SEARCH_RESULT )
38                 return( NULLMSG );
39
40         return( entry->lm_chain );
41 }
42
43 /* ARGSUSED */
44 int
45 ldap_count_entries( LDAP *ld, LDAPMessage *chain )
46 {
47         int     i;
48
49         for ( i = 0; chain != NULL && chain->lm_msgtype
50             != LDAP_RES_SEARCH_RESULT; chain = chain->lm_chain )
51                 i++;
52
53         return( i );
54 }