]> git.sur5r.net Git - openldap/blob - libraries/libldap/addentry.c
Parsing and printing of extensions in schema definitions.
[openldap] / libraries / libldap / addentry.c
1 /* $OpenLDAP$ */
2 /*
3  * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
4  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
5  */
6 /*  Portions
7  *  Copyright (c) 1990 Regents of the University of Michigan.
8  *  All rights reserved.
9  *
10  *  addentry.c
11  */
12
13 #include "portable.h"
14
15 #include <stdio.h>
16
17 #include <ac/stdlib.h>
18
19 #include <ac/ctype.h>
20 #include <ac/socket.h>
21 #include <ac/string.h>
22 #include <ac/time.h>
23
24 #include "ldap-int.h"
25
26 LDAPMessage *
27 ldap_delete_result_entry( LDAPMessage **list, LDAPMessage *e )
28 {
29         LDAPMessage     *tmp, *prev = NULL;
30
31         assert( list != NULL );
32         assert( e != NULL );
33
34         for ( tmp = *list; tmp != NULL && tmp != e; tmp = tmp->lm_chain )
35                 prev = tmp;
36
37         if ( tmp == NULL )
38                 return( NULL );
39
40         if ( prev == NULL )
41                 *list = tmp->lm_chain;
42         else
43                 prev->lm_chain = tmp->lm_chain;
44         tmp->lm_chain = NULL;
45
46         return( tmp );
47 }
48
49 void
50 ldap_add_result_entry( LDAPMessage **list, LDAPMessage *e )
51 {
52         assert( list != NULL );
53         assert( e != NULL );
54
55         e->lm_chain = *list;
56         *list = e;
57 }