]> git.sur5r.net Git - openldap/blob - libraries/libldap/addentry.c
3b5c752a88d08995718ed15644cc8e337be9fc73
[openldap] / libraries / libldap / addentry.c
1 /*
2  *  Copyright (c) 1990 Regents of the University of Michigan.
3  *  All rights reserved.
4  *
5  *  addentry.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 LDAPMessage *
26 ldap_delete_result_entry( LDAPMessage **list, LDAPMessage *e )
27 {
28         LDAPMessage     *tmp, *prev = NULL;
29
30         for ( tmp = *list; tmp != NULL && tmp != e; tmp = tmp->lm_chain )
31                 prev = tmp;
32
33         if ( tmp == NULL )
34                 return( NULL );
35
36         if ( prev == NULL )
37                 *list = tmp->lm_chain;
38         else
39                 prev->lm_chain = tmp->lm_chain;
40         tmp->lm_chain = NULL;
41
42         return( tmp );
43 }
44
45 void
46 ldap_add_result_entry( LDAPMessage **list, LDAPMessage *e )
47 {
48         e->lm_chain = *list;
49         *list = e;
50 }